// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://@sbaseurl@/jsapi/jsapi/esri/copyright.txt and http://www.arcgis.com/apps/webappbuilder/copyright.txt for details.

//>>built
require({cache:{"esri/dijit/OverviewMap":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/connect dojo/_base/html dojo/has dojo/dom-class dojo/dom-style dojo/dnd/Moveable dijit/_Widget dijit/_Templated ../map ../geometry/Point ../geometry/ScreenPoint ../layers/TiledMapServiceLayer ../layers/DynamicMapServiceLayer ../layers/VectorTileLayer ../layers/ArcGISTiledMapServiceLayer ../layers/ArcGISDynamicMapServiceLayer ../layers/ArcGISImageServiceLayer ../layers/RasterXLayer ../layers/OpenStreetMapLayer ../virtualearth/VETiledLayer ../kernel ../config ../domUtils dojo/text!./templates/OverviewMap.html dojo/i18n!../nls/jsapi".split(" "),
function(G,e,q,n,p,k,c,a,b,l,h,g,d,f,m,u,r,t,w,v,y,x,A,C,E,H,B){G=G([b,l],{declaredClass:"esri.dijit.OverviewMap",widgetsInTemplate:!0,templateString:H,constructor:function(z,F){e.mixin(this,B.widgets.overviewMap);z=z||{};if(z.map){var K={};F&&(this._detached=!0,K=n.coords(F,!0));this.map=z.map;this.baseLayer=z.baseLayer;this.width=z.width||K.w||this.map.width/4;this.height=z.height||K.h||this.map.height/4;this.attachTo=z.attachTo||"top-right";this.expandFactor=z.expandFactor||2;this.color=z.color||
"#000000";this.opacity=z.opacity||.5;this.maximizeButton=!!z.maximizeButton;this.visible=!!z.visible;if(this.map.loaded)this._initialSetup();else var L=q.connect(this.map,"onLoad",this,function(){q.disconnect(L);L=null;this._initialSetup()});this._detached&&(this.visible=!0);this._maximized=!1}else console.error("esri.dijit.OverviewMap: "+this.NLS_noMap)},startup:function(){this.inherited(arguments);(!this.domNode.parentNode||9>p("ie")&&"DIV"!==this.domNode.parentNode.nodeName)&&this.map.container.appendChild(this.domNode);
this._detached?(c.set(this._body,"display","block"),c.set(this._controllerDiv,"display","none"),c.set(this._maximizerDiv,"display","none"),this.map.loaded?this._initialize():q.connect(this.map,"onLoad",this,this._initialize)):("bottom"===this.attachTo.split("-")[0]&&this.domNode.insertBefore(this._maximizerDiv,this._controllerDiv),this.maximizeButton||k.add(this._maximizerDiv,"ovwDisabledButton"),k.add(this.domNode,{"top-left":"ovwTL","top-right":"ovwTR","bottom-left":"ovwBL","bottom-right":"ovwBR"}[this.attachTo]),
k.add(this._controllerDiv,"ovwShow"),k.add(this._maximizerDiv,"ovwMaximize"),this.visible&&this.map.loaded&&(this.visible=!1,this.show()));c.set(this._focusDiv,"opacity",this.opacity)},destroy:function(){this._deactivate();this.overviewMap&&this.overviewMap.destroy();this.overviewMap=this.baseLayer=null;this.inherited(arguments)},resize:function(z){!z||0>=z.w||0>=z.h||this._resize(z.w,z.h)},show:function(){if(!this.visible){var z=this._controllerDiv;z.title=this.NLS_hide;k.remove(z,"ovwShow");k.add(z,
"ovwHide");E.show(this._body);E.show(this._maximizerDiv);this._initialize();this.visible=!0}},hide:function(){if(this.visible){var z=this._controllerDiv;z.title=this.NLS_show;k.remove(z,"ovwHide");k.add(z,"ovwShow");this._maximized&&this._maximizeHandler();E.hide(this._body);E.hide(this._maximizerDiv);this._deactivate();this.visible=!1}},_initialSetup:function(){if(this._mainMapLayer=this.map.getLayer(this.map.layerIds[0])){var z=this.baseLayer||this._mainMapLayer,F=this.map.spatialReference,K=z.spatialReference;
if(K.wkid!==F.wkid&&K.wkt!==F.wkt)console.error("esri.dijit.OverviewMap: "+this.NLS_invalidSR);else{F=z.declaredClass;if(z instanceof f)if(-1!==F.indexOf("VETiledLayer"))this.baseLayer=new x({resourceInfo:z.getResourceInfo(),culture:z.culture,mapStyle:z.mapStyle,bingMapsKey:z.bingMapsKey});else if(-1!==F.indexOf("OpenStreetMapLayer"))this.baseLayer=new y({tileServers:z.tileServers});else if(-1!==F.indexOf("WebTiledLayer")){F=z.initialExtent;K=z.fullExtent;var L=z.tileInfo;this.baseLayer=new z.constructor(z.urlTemplate,
{initialExtent:F&&new F.constructor(F.toJson()),fullExtent:K&&new K.constructor(K.toJson()),tileInfo:L&&new L.constructor(L.toJson()),tileServers:z.tileServers&&z.tileServers.slice(0)})}else this.baseLayer=new r(z.url,{resourceInfo:z.getResourceInfo()});else if(z instanceof m)-1!==F.indexOf("ArcGISImageServiceLayer")?this.baseLayer=new w(z.url):(this.baseLayer=new t(z.url),this.baseLayer.setImageFormat("png24"));else if(z instanceof v)this.baseLayer=new v(z.url);else if(z instanceof u)this.baseLayer=
new r("https://services.arcgisonline.com/arcgis/rest/services/World_Street_Map/MapServer",{});else{console.error("esri.dijit.OverviewMap: "+this.NLS_invalidType);return}!this._detached&&this.visible&&this._controllerDiv&&(z=function(){this.visible=!1;this.show()},this.baseLayer.loaded?z.call(this):q.connect(this.baseLayer,"onLoad",this,z))}}else console.error("esri.dijit.OverviewMap: "+this.NLS_noLayer)},_visibilityHandler:function(){this.visible?this.hide():this.show()},_maximizeHandler:function(){var z=
this._maximizerDiv;this._maximized?(z.title=this.NLS_maximize,k.remove(z,"ovwRestore"),k.add(z,"ovwMaximize"),this._resize(this.width,this.height)):(z.title=this.NLS_restore,k.remove(z,"ovwMaximize"),k.add(z,"ovwRestore"),this._resize(this.map.width,this.map.height));this._maximized=!this._maximized},_resize:function(z,F){c.set(this._body,{width:z+"px",height:F+"px"});z=C.defaults.map.panDuration;F=this.overviewMap;C.defaults.map.panDuration=0;F&&(F.resize(!0),F.centerAt(this._focusExtent.getCenter()));
C.defaults.map.panDuration=z},_initialize:function(){if(this.overviewMap)this._activate();else{var z;var F=9>p("ie")?this._body.firstChild:this._body.firstElementChild;this.overviewMap=z=new h(F,{slider:!1,showAttribution:!1,logo:!1,lods:this._overviewLods,wrapAround180:this.map.wrapAround180});q.connect(z,"onLoad",this,function(){this._map_resize_override=e.hitch(z,this._map_resize_override);z.disableMapNavigation();this._activate()});z.addLayer(this.baseLayer)}},_activate:function(){var z=this.map,
F=this.overviewMap;this._moveableHandle=new a(this._focusDiv);this._soeConnect=q.connect(z,"onExtentChange",this,this._syncOverviewMap);this._ufoConnect=q.connect(z,"onPan",this,this._updateFocus);this._oecConnect=q.connect(F,"onExtentChange",this,this._ovwExtentChangeHandler);this._opaConnect=q.connect(F,"onPan",this,this._ovwPanHandler);this._ozsConnect=q.connect(F,"onZoomStart",this,function(){E.hide(this._focusDiv)});this._ozeConnect=q.connect(F,"onZoomEnd",this,function(){E.show(this._focusDiv)});
this._omsConnect=q.connect(this._moveableHandle,"onMoveStop",this,this._moveStopHandler);this._syncOverviewMap(z.extent,null,null,null)},_deactivate:function(){q.disconnect(this._soeConnect);q.disconnect(this._ufoConnect);q.disconnect(this._oecConnect);q.disconnect(this._opaConnect);q.disconnect(this._ozsConnect);q.disconnect(this._ozeConnect);q.disconnect(this._omsConnect);this._moveableHandle&&(this._moveableHandle.destroy(),this._moveableHandle=null)},_syncOverviewMap:function(z,F,K,L){this._suspendPanHandling?
this._suspendPanHandling=!1:(this._focusExtent=z,this.overviewMap.setExtent(z.expand(this.expandFactor),!0))},_updateFocus:function(z){this._suspendPanHandling||(this._focusExtent=z,this._drawFocusDiv(z))},_drawFocusDiv:function(z,F){var K=this.overviewMap,L=K.toScreen(new g(z.xmin,z.ymax,K.spatialReference));K=K.toScreen(new g(z.xmax,z.ymin,K.spatialReference));z=K.x-L.x;K=K.y-L.y;var N=!0;z>this.overviewMap.width&&K>this.overviewMap.height&&(N=!1);c.set(this._focusDiv,{left:L.x+(F?F.x:0)+"px",top:L.y+
(F?F.y:0)+"px",width:z+"px",height:K+"px",display:N?"block":"none"})},_moveStopHandler:function(z){var F=this._moveableHandle.node.style;z=this._focusExtent;var K=this.overviewMap;F=K.toMap(new d(parseInt(F.left,10),parseInt(F.top,10)));var L=new g(z.xmin,z.ymax,K.spatialReference);this._focusExtent=z.offset(F.x-L.x,F.y-L.y);this._maximized?this._maximizeHandler():K.centerAt(this._focusExtent.getCenter());this._suspendPanHandling=!0;this.map.setExtent(this._focusExtent)},_ovwExtentChangeHandler:function(){this._drawFocusDiv(this._focusExtent)},
_ovwPanHandler:function(z,F){this._drawFocusDiv(this._focusExtent,F)}});p("extend-esri")&&e.setObject("dijit.OverviewMap",G,A);return G})},"esri/layers/VectorTileLayer":function(){(function(){var G=function(){try{var q=window.WebGLRenderingContext}catch(b){q=!1}try{for(var n=document.createElement("canvas"),p=["webgl","experimental-webgl","webkit-3d","moz-webgl"],k=null,c=0;c<p.length;++c){try{k=n.getContext(p[c])}catch(b){}if(k)break}var a=k}catch(b){a=!1}return q&&a?!0:!1}(),e=["dojo/_base/lang",
"dojo/has","dojo/Deferred","../sniff","./layer"];G&&e.push("./VectorTileLayerImpl");define(e,function(q,n,p,k,c,a){c=a?a:c.createSubclass({declaredClass:"esri.layers.VectorTileLayer",constructor:function(){var b=new p;b.reject(Error("esri.layers.VectorTileLayer is not supported"));b.promise.otherwise(q.hitch(this,function(l){this._errorHandler(l)}))}});c.ACCESS_TOKEN=null;c.supported=function(){return G};n("extend-esri")&&q.setObject("layers.VectorTileLayer",c,k);return c})})()},"esri/layers/RasterXLayer":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/connect dojo/_base/array dojo/_base/Deferred dojo/sniff dojo/dom-construct dojo/dom-style dojo/on dojox/gfx/matrix dojo/when dojo/DeferredList ../kernel ../config ../lang ../domUtils ../urlUtils ../graphic ../request ../renderers/ClassBreaksRenderer ../renderers/StretchRenderer ../renderers/UniqueValueRenderer ../renderers/ColormapRenderer ../renderers/ShadedReliefRenderer ../geometry/Extent ../SpatialReference ../geometry/Point ./Field ./TimeInfo ./MosaicRule ./DimensionalDefinition ./PixelBlock ./ImageServiceLayerMixin ./rasterLib/raster/rasterFactory ./rasterLib/raster/rasterProjectionHelper ./rasterLib/renderer/rasterRendererHelper ./rasterLib/tile/RasterTileInfo ./rasterLib/tile/RasterTileManager ./rasterLib/tile/RasterHandler ./layer".split(" "),
function(G,e,q,n,p,k,c,a,b,l,h,g,d,f,m,u,r,t,w,v,y,x,A,C,E,H,B,z,F,K,L,N,Q,S,R,V,W,U,ha,ma){var ia=f.defaults.map.zoomDuration;G=G([ma],{declaredClass:"esri.layers.RasterXLayer",managedSuspension:!0,opacity:1,tileMode:!0,useWebGL:!0,drawMode:!0,_eventMap:{"raster-change":!0,"renderer-change":!0},_lastPopup:[],_rasterFieldPrefix:"Raster.",_cachedVariableStats:{},_cachedVariableHistogram:{},constructor:function(D,I){I=I||{};this.tileMode=null!=I.tileMode?I.tileMode:this.tileMode;this.useWebGL=null!=
I.useWebGL?I.useWebGL:this.useWebGL;this.roaming=null!=I.roaming?I.roaming:this.roaming;this.drawMode=null!=I.drawMode?I.drawMode:this.drawMode;this.bandIds=I.bandIds&&0<I.bandIds.length?I.bandIds:null;this.renderer=I.renderer;this._customModules=I.customModules;this.useMapTime=I.useMapTime;if(I.multidimensionalDefinition&&0<I.multidimensionalDefinition.length){var J=new K;J.multidimensionalDefinition=I.multidimensionalDefinition.map(function(M){return M.toJson?M:new L(M)});J.method=K.METHOD_NONE;
this.mosaicRule=J}this.infoTemplate=I.infoTemplate;this.drawMode||(this._contextType=I._contextType||I.drawType);this._supportLegacyPropMethods=!1!==I.legacySupport;this._rasterHandler=new ha({customModules:this._customModules});this._workInitPromise=this._rasterHandler.start();this.pixelData=null;this._initialize(D,I);b(this,"load",e.hitch(this,function(){h(this._rasterHandler._connected||this._rasterHandler._connectionPromise,e.hitch(this,function(){this._rasterHandler.setLayer({layerId:this.id,
raster:{rasterInfo:this.raster.rasterInfo,rasterFunction:this.raster.rasterFunction&&this.raster.rasterFunction.toJson()},bandCount:this.raster.rasterInfo.bandCount});this.raster.rasterFunction&&this._rasterHandler.setRasterFunction({layerId:this.id,data:this.raster.rasterFunction.toJson(!0)});this._rasterRenderer&&this._rasterHandler.setRasterRenderer({layerId:this.id,data:this._rasterRenderer.toJson(!0)})}))}));this._animatePan2d=e.hitch(this,this._animatePan2d)},setOpacity:function(D){this.opacity!==
D&&(this.opacity=D,this.onOpacityChange(D))},onOpacityChange:function(){},onRendererChange:function(){},refresh:function(){if(this.loaded&&this._map)if(!this._canDraw()||10>k("ie"))this.onError(Error("Unable to refresh. This layer is not supported in the current browser."));else this._map&&this._extentChangeHandler(this._map.extent)},clear:function(D,I,J,M){this._canDraw()&&(this.useWebGL||(J?this._context.clearRect(D,I,J,M):this._context.clearRect(0,0,this._map.width,this._map.height)))},getContext:function(){return this._context},
onResume:function(){this.inherited(arguments);this._toggleTime();u.show(this._div);if("css-transforms"===this._map.navigationMode){var D=this._map.__visibleDelta;this._left=this._tdx=D.x;this._top=this._tdy=D.y;a.set(this._div,d._css.names.transform,d._css.translate(this._left,this._top))}this._displayTimer=this._displayTimer||setTimeout(e.hitch(this,function(){this._extentChangeHandler(this._map.extent,null,!0)}),0)},onSuspend:function(){this.inherited(arguments);this._fireUpdateEnd();this._toggleTime();
u.hide(this._div);clearTimeout(this._displayTimer);this._displayTimer=null},redraw:function(){this.useWebGL&&this._glSetting&&(this._glSetting.hasNewTexture=!1);var D=this.tileMode?this.tileManager.originalPixelData:this.originalPixelData;if(this.tileMode?D&&(D.src||D.texture):D)if(this.tileMode)if(this.useWebGL)this._updateAllTilesOnce(D);else{this.tileManager.tiles.forEach(function(J){J&&(J.update=null,J.completed=!1,J.processedPixelBlock=null,J.renderedPixelBlock=null)});D.processedPixelBlock=
null;var I=this.raster.rasterFunction?this.raster.rasterFunction.read(D):{extent:D.extent,pixelBlock:D.src[this.tileManager.identifiers[0]]&&D.src[this.tileManager.identifiers[0]].pixelBlock};D.renderedPixelBlock=null;D=this._rasterRenderer?this._rasterRenderer.draw(I):I;this._drawOneFrame(D)}else this._supportLegacyPropMethods&&this.pixelFilter?this._setPixelData(this.originalPixelData):(D.processedPixelBlock=null,I=this.raster.rasterFunction?this.raster.rasterFunction.read(D):{extent:D.extent,pixelBlock:D.src?
D.src[this.tileManager.identifiers[0]]&&D.src[this.tileManager.identifiers[0]].pixelBlock:D.pixelBlock},D.renderedPixelBlock=null,D=this._rasterRenderer?this._rasterRenderer.draw(I):I,this._drawOneFrame(D))},getCurrentResolution:function(){var D=this._map.extent;return new B((D.xmax-D.xmin)/this._map.width,(D.ymax-D.ymin)/this._map.height,D.spatialReference)},getCustomRasterFields:function(D){var I=D?D.rasterAttributeTableFieldPrefix:this._rasterFieldPrefix,J={name:this._rasterFieldPrefix+"ServicePixelValue",
alias:"Pixel Value",domain:null,editable:!1,length:50,type:10.3<=this.version?"esriFieldTypeDouble":"esriFieldTypeString"};D=this.fields?e.clone(this.fields):[];D.push(J);(J=this.rasterAttributeTable&&this.rasterAttributeTable.fields)&&0<J.length&&(J=n.filter(J,function(M){return"esriFieldTypeOID"!==M.type&&"value"!==M.name.toLowerCase()}),J=n.map(J,function(M){var O=e.clone(M);O.name=I+M.name;return O}),D=D.concat(J));return D},setRenderer:function(D,I){if(this.loaded&&D){if(D.declaredClass&&-1<
D.declaredClass.indexOf("esri.layers.rasterLib")){this._rasterRenderer=D;this._rasterRenderer.bind({layer:this});var J=this.bandIds=D.bandIndex;this.raster&&this.raster.setFetchParameters({bandIds:J});this._params&&(this._params.bandIds=J&&0<J.length?J.join(","):null);this.renderer=this._getCommonRenderer(D)}else J=e.clone(D.toJson?D.toJson():D),"rasterStretch"===J.type&&(J.bandIndex=this.bandIds,J.bandIndex&&1<J.bandIndex.length||!J.bandIndex&&this.raster&&1<this.raster.rasterInfo.bandCount)&&(J.type=
"rgb"),this._rasterRenderer=V.create(J),this.renderer=D.declaredClass?D:this._getCommonRenderer(this._rasterRenderer),this._rasterRenderer.bind({layer:this});if(this._map){if(this.loaded&&this._rasterHandler._connected){var M=this._rasterHandler.setRasterRenderer({layerId:this.id,data:this._rasterRenderer.toJson(!0)});this._updateTilingEffects()}I||(M?M.then(e.hitch(this,function(){this.redraw()})):this.redraw());this.onRendererChange()}}},setBandIds:function(D,I){this.bandIds=D;this.raster&&this.raster.setFetchParameters({bandIds:D});
this._params&&(this._params.bandIds=D&&0<D.length?D.join(","):null);this.setRenderer(this.renderer,I)},_setTime:function(D){D=D?D.toJson():null;this._params&&(this._params.time=D);this.raster.setFetchParameters({time:D});this.tileManager&&this.tileManager.tiles&&this.tileManager.resetTiles()},setInfoTemplate:function(D){this.infoTemplate=D;this._updateInfoTemplateFields(this.fields)},setMultiDimensionalDefinition:function(D,I){var J=D&&D.multidimensionalDefinition;if(J&&this.loaded){var M=J&&J[0].variableName;
""===M&&(M=this._multidimensionalInfo.variables[0].name,J.forEach(function(P){P.variableName=M}));if("ImageService"===this.raster.sourceType){var O=this.raster._getAllDimensionDefinition(J,M);O.defChanged&&(D.multidimensionalDefinition=O.definition,this.setMosaicRule(D,!0))}this.raster.setFetchParameters({multidimensionalDefinition:J});this.tileManager&&this.tileManager.tiles&&this.tileManager.resetTiles();M&&this._updateRasterInfo(M);I||this.refresh()}},_updateRasterInfo:function(D){var I=this.raster.rasterInfo,
J=this.getHistograms(D);D=this.getStatistics(D);(new g([J,D])).then(e.hitch(this,function(M){M[0][0]&&(I.histograms=M[0][1].histograms);M[1][0]&&(I.statistics=M[1][1]);this.refresh()}))},_updateInfoTemplateFields:function(D){if(D&&!(1>D.length)&&this.infoTemplate&&this.infoTemplate.info&&this.infoTemplate.info.fieldInfos&&!(1>this.infoTemplate.info.fieldInfos.length)){var I,J;var M=this.infoTemplate.info.fieldInfos;for(I=0;I<D.length;I++){var O=D[I];for(J=0;J<M.length;J++)if(M[J].fieldName.toLowerCase()===
O.name.toLowerCase()&&M[J].fieldName!==O.name){M[J].fieldName=O.name;break}}}},getPixelData:function(D){return this.tileMode?D?this.tileManager.originalPixelData.src&&this.tileManager.originalPixelData.src[this.tileManager.identifiers[0]]:null:this.inherited(arguments)},fetchPopupFromTiles:function(D){var I=new p;this.identify(D.geometry).then(function(J){var M=J.pixelValue;this.hasStdTime()&&M&&M.length&&null!=M[0]&&(M=M.map(function(T){return this.getStdTimeValue(T)}.bind(this)).join(", "));if(M){J=
{ObjectId:0,"Raster.ServicePixelValue":M};var O=this.rasterAttributeTable&&this.rasterAttributeTable.features;if(O&&0<O.length&&(O=n.filter(O,function(T){if(T&&T.attributes)return T.attributes.hasOwnProperty("Value")?T.attributes.Value==M:T.attributes.VALUE==M}),0<O.length&&(O=e.clone(O[0]))))for(var P in O.attributes)O.attributes.hasOwnProperty(P)&&(J[this._rasterFieldPrefix+P]=O.attributes[P]);P=new t(new E(this.projectedFullExtent||this.fullExtent),null,J);P.setInfoTemplate(this.infoTemplate);
P._layer=this;this._lastPopup=[P];I.resolve([P])}else this._lastPopup=[],I.resolve()}.bind(this),function(J){this._lastPopup=[];I.resolve(J)});return I},getPopupFromTiles:function(){return this._lastPopup},identify:function(D,I){return this.raster?this.raster.identify(D):(D=new p,D.reject("layer must be initialized to identify"),D.promise)},_getCommonRenderer:function(D){switch(D.rendererName){case "RGB":case "Stretch":return new y(D.toCommonRendererJson());case "UniqueValue":return new x(D.toCommonRendererJson());
case "ClassBreaks":return new v(D.toCommonRendererJson());case "Colormap":return new A(D.toCommonRendererJson());case "ShadedRelief":return new C(D.toCommonRendererJson())}},_getProjectedFullExtent:function(D){return this.raster.getProjectedFullExtent(D).then(e.hitch(this,function(I){this.projectedFullExtent=I}))},_initialize:function(D,I){I=I||{};this._supportLegacyPropMethods&&this.constructor._onMap&&(this.constructor._onMap["rendering-change"]={method:"onRenderingChange"},this.constructor._onMap["mosaic-rule-change"]=
{method:"onMosaicRuleChange"},this.constructor._onMap["spatial-reference-change"]={method:"onSpatialReferenceChange"});this.raster={};var J=I.raster?I.raster.url:D;J&&-1<J.toLowerCase().indexOf("/imageserver")&&this._supportLegacyPropMethods&&this._addLegacySupport(J,I);var M=e.hitch(this,function(){this.loaded=!0;this.mosaicRule&&this.mosaicRule.multidimensionalDefinition&&0<this.mosaicRule.multidimensionalDefinition.length&&this.setMultiDimensionalDefinition(this.mosaicRule,!0);this.raster._setRasterHandler(this._rasterHandler);
this.onLoad(this);var O=this._loadCallback;O&&(delete this._loadCallback,O(this))});(D?S.create(e.mixin({url:D},I)):I.raster&&I.raster.open()).then(e.hitch(this,function(O){if(O){this.raster=O;var P=this._getSourceImageServiceRaster();this.url||(this.url=P&&P.url);this.url&&(this._url=r.urlToObject(D));var T=I.minScale,X=I.maxScale,na=O.tileInfo&&"Raster"===O.tileInfo.tileType;null==X&&(X=na&&I.zoomFactor?O.tileInfo.lods[O.tileInfo.lods.length-1].scale/I.zoomFactor:this.maxScale);null==T&&(T=na&&
I.zoomFactor?O.tileInfo.lods[0].scale*I.zoomFactor:this.minScale);P&&"ImageService"===P.sourceType&&this._supportLegacyPropMethods&&this._addGeneralProperties(D,I);this.initialExtent=this.fullExtent=this.extent=this.raster.rasterInfo.extent;this.spatialReference=this.extent.spatialReference;this.timeInfo=this.raster.rasterInfo.timeInfo?new F(this.raster.rasterInfo.timeInfo):null;this.rasterAttributeTable=this.raster.rasterInfo.vat;this._multidimensionalInfo=this.raster.rasterInfo.multidimensionalInfo;
this.rasterAttributeTable&&(this._rasterAttributeTableFields=this.rasterAttributeTable.fields);this.mosaicRule&&this.raster.setFetchParameters({multidimensionalDefinition:this.mosaicRule.multidimensionalDefinition});this._multidimensionalInfo&&(this._getDefaultMultidimensionalDefinition(this._multidimensionalInfo,!0,!0),this.mosaicRule||(this.mosaicRule=this.defaultMosaicRule,this.raster.setFetchParameters({multidimensionalDefinition:this._defaultMultidimensionalDefinition})),this.raster.defaultMultidimensionalDefinition=
this._defaultMultidimensionalDefinition);null==T||this._hasMin||this.setMinScale(T);null==X||this._hasMax||this.setMaxScale(X);this._workInitPromise?this._workInitPromise.then(M,M):M()}else console.error("cannot create rasterx layer as the raster data source cannot be opened")}),this._errorHandler)},_getSourceImageServiceRaster:function(){var D=this.raster&&"Function"===this.raster.sourceType?1===this.raster.getMemberRasters().length?this.raster.getMemberRasters()[0]:null:this.raster;if(D&&"ImageService"===
D.sourceType)return D},_addLegacySupport:function(D,I){this._url=r.urlToObject(D);I=I||{};this.format=(D=I.imageServiceParameters)&&D.format;this.compressionTolerance=D&&D.compressionTolerance?D.compressionTolerance:.01;this.interpolation=D?D.interpolation:null;this.compressionQuality=D?D.compressionQuality:null;this.bandIds=D&&D.bandIds||I&&I.bandIds||null;this.mosaicRule||(this.mosaicRule=D?D.mosaicRule:null);this.renderingRule||(this.renderingRule=D?D.renderingRule:null);this.useMapDimensionValue=
I.hasOwnProperty("useMapDimensionValue")?!!I.useMapDimensionValue:!0;this.hasImageFilter=I.hasImageFilter;this.activeMapDimensions=I.activeMapDimensions;this._params=e.mixin({},this._url.query,{f:"image",interpolation:this.interpolation,format:this.format,compressionQuality:this.compressionQuality,bandIds:this.bandIds?this.bandIds.join(","):null},D?D.toJson():{});this.pixelFilter=I.pixelFilter;this.originalPixelData=this.pixelData=null;this._queryVisibleRastersHandler=e.hitch(this,this._queryVisibleRastersHandler);
this._useRenderingRuleAttributeTable=!1;this._rasterFunctionTemplateInfos={};this._customRenderingRuleId={};this._setDefaultFilter=function(){};var J={setInterpolation:"interpolation",setCompressionQuality:"compressionQuality",setCompressionTolerance:"compressionTolerance",setBandIds:"bandIds",setDefaultBandIds:"bandIds",setMosaicRule:"mosaicRule",setRenderingRule:"renderingRule",setImageFormat:"format"},M,O=new Q;Object.keys(J).forEach(e.hitch(this,function(P){this[P]=e.hitch(this,function(T,X){M=
{};M[J[P]]=T;this.raster&&(this.raster.setFetchParameters(M),O[P].bind(this)(T,X))})}));this.setDisableClientCaching=function(P){O.setDisableClientCaching.bind(this)(P);var T=this._getSourceImageServiceRaster();T?T.disableClientCaching=P:null}.bind(this);this.setDefinitionExpression=O.setDefinitionExpression.bind(this);this.setUseMapTime=O.setUseMapTime.bind(this);this._toggleTime=O._toggleTime.bind(this);this._onTimeExtentChangeHandler=O._onTimeExtentChangeHandler.bind(this);this.setPixelFilter=
O.setPixelFilter.bind(this);this.getHistograms=O.getHistograms.bind(this);this.getRasterFunctionInfos=O.getRasterFunctionInfos.bind(this);this.getKeyProperties=O.getKeyProperties.bind(this);this.getRasterAttributeTable=O.getRasterAttributeTable.bind(this);this.getRenderingRuleServiceInfo=O.getRenderingRuleServiceInfo.bind(this);this._getRenderingRuleId=O._getRenderingRuleId.bind(this);this._isRenderingRuleAProcessingTemplate=O._isRenderingRuleAProcessingTemplate.bind(this);this.handleSpatialReferenceChange=
O.handleSpatialReferenceChange.bind(this);this.onRenderingChange=this.onRenderingChange||function(){};this.onSpatialReferenceChange=this.onSpatialReferenceChange||function(){};this.onMosaicRuleChange=this.onMosaicRuleChange||function(P){};this.setRasterRenderer=this.setRenderer;this.getMultidimensionalInfo=O.getMultidimensionalInfo.bind(this);this.getColormap=O.getColormap.bind(this);this.getRenderingRuleColormap=O.getRenderingRuleColormap.bind(this);this.getDefaultMultidimensionalDefinition=O.getDefaultMultidimensionalDefinition.bind(this);
this._getDefaultMultidimensionalDefinition=O._getDefaultMultidimensionalDefinition.bind(this);this._getDefaultDimensionValue=O._getDefaultDimensionValue.bind(this);this.getStatistics=O.getStatistics.bind(this)},_addGeneralProperties:function(){var D=this._getSourceImageServiceRaster();if(D){var I=["minScale","maxScale","tileInfo"];Object.keys(D.serviceInfo).forEach(function(O){null==this[O]&&-1===I.indexOf(O)&&(this[O]=D.serviceInfo[O])}.bind(this));this.pixelSizeX=parseFloat(this.pixelSizeX);this.pixelSizeY=
parseFloat(this.pixelSizeY);this.bands=D.rasterInfo.statistics;var J,M=[];this.fields=this.fields||[];for(J=0;J<this.fields.length;J++)M.push(new z(this.fields[J]));this.fields=M;this.version=this.currentVersion;this.defaultMosaicRule=D.serviceInfo.defaultMosaicRule}},setDefaultRenderer:function(){if(this.loaded&&this._canvas&&!this.pixelFilter){var D=V.createDefaultRenderer(this);if(null!=D){var I=this.mosaicRule&&this.mosaicRule.multidimensionalDefinition&&0<this.mosaicRule.multidimensionalDefinition.length;
if(this._multidimensionalInfo&&I&&"Stretch"===D.rendererName){var J=this.mosaicRule.multidimensionalDefinition[0].variableName;(I=this._multidimensionalInfo.variables.filter(function(M){return M.name===J})[0])&&I.histograms&&I.histograms.length&&(D.histograms=I.histograms,6===D.stretchType&&(D.dra=!1));I&&I.statistics&&I.statistics.length&&(D.statistics=I.statistics.map(function(M){return[M.min,M.max,M.mean,M.stddev||M.standardDeviation]}),6!==D.stretchType&&(D.dra=!1))}this.setRenderer(D,!0)}}},
setDefaultInterpolation:function(){if(this.loaded&&this._canvas){var D=this.raster.serviceInfo&&this.raster.serviceInfo.defaultResamplingMethod;if(D)switch(D.toLowerCase()){case "bilinear":this.interpolation="RSP_BilinearInterpolation";break;case "cubic":this.interpolation="RSP_CubicConvolution";break;case "majority":this.interpolation="RSP_Majority";break;case "nearest":this.interpolation="RSP_NearestNeighbor"}else{D=this.raster.dataType&&this.raster.dataType.toLowerCase();var I=!!this.raster.rasterInfo.colormap;
this.raster.rasterInfo.vat||I||"thematic"===D||"StdTime"===D?"RSP_NearestNeighbor":"RSP_BilinearInterpolation"}}},_toggleTime:function(){},_updateTilingEffects:function(){(this._hasTilingEffects=this._rasterRenderer&&this._rasterRenderer.hasTilingEffects()||this.raster&&this.raster.rasterFunction&&this.raster.rasterFunction.hasTilingEffects())&&this._map&&this.tileMode&&this.useWebGL&&this.tileManager&&(this._hasTilingEffects=!1)},_setMap:function(D,I){this.inherited(arguments);D.spatialReference&&
(D.spatialReference.ics||D.spatialReference.icsId)&&(this.roaming=this.useWebGL=this.tileMode=!1);if(this.tileMode){this.virtualTileInfo=new W(null,{refTileInfo:D.tileInfo,spatialReference:D.spatialReference,extent:this.raster.rasterInfo.extent});var J=this.raster.tileInfo&&(-1<["Elevation","Raster"].indexOf(this.raster.tileInfo.tileType)||3===this.raster.rasterInfo.bandCount&&"U8"===this.raster.rasterInfo.pixelType)?this.raster.tileInfo:this.virtualTileInfo;this._tileParams=this._tileParams||{};
this._tileParams.size=J.cols+","+J.rows;this.tileManager=new U({tileInfo:J,layer:this,mapSR:D.spatialReference})}this._dragOrigin={x:0,y:0};J=this._div=c.create("div",null,I);var M={width:D.width+"px",height:D.height+"px",position:"absolute"};"css-transforms"===D.navigationMode?this.roaming&&this.tileMode&&this.useWebGL||(M[d._css.names.transform]=d._css.translate(D.__visibleDelta.x,D.__visibleDelta.y),this._left=D.__visibleDelta.x,this._top=D.__visibleDelta.y):this._left=this._top=0;a.set(J,M);this._canvas=
c.create("canvas",{width:D.width+"px",height:D.height+"px",style:"position: absolute;"},J);m.isDefined(this.opacity)&&a.set(J,"opacity",this.opacity);this._contextType?(this._context=this._canvas.getContext(this._contextType,null),this.useWebGL=this._context instanceof WebGLRenderingContext):this.useWebGL?(this._context=this._canvas.getContext("webgl",null)||this._canvas.getContext("experimental-webgl",null),this.drawMode=!1):(this._context=this._canvas.getContext("2d"),this.drawMode=!0);this._context||
console.error("Unable to create the context. This browser might not support \x3ccanvas\x3e elements.");this.useWebGL&&(D.acquireWebGLContext(this),this._glSetting={gl:this._context,branchCount:this.raster.rasterFunction?this.raster.rasterFunction.branchCount:0,pingpong:null,branches:null,drawMesh:this._drawMesh,programUniforms:{}});this.raster.rasterFunction&&(this._updateTilingEffects(),this.raster.setProcessingContext({layer:this}));this.setRenderer(this.renderer,!0);this._rasterRenderer||this.setDefaultRenderer();
this.interpolation||this.setDefaultInterpolation();this._mapWidth=D.width;this._mapHeight=D.height;this._connects=[];this._connects.push(q.connect(D,"onPan",this,this._panHandler));this._connects.push(q.connect(D,"onPanEnd",this,this._panEndHandler));"css-transforms"===D.navigationMode?this._connects.push(q.connect(D,"onScale",this,this._onScaleHandler)):(this._connects.push(q.connect(D,"onZoom",this,this._onZoomHandler)),this._connects.push(q.connect(D,"onZoomEnd",this,this._onZoomEndHandler)));
this._connects.push(q.connect(D,"onResize",this,this._onResizeHandler));this._connects.push(q.connect(D,"onExtentChange",this,this._extentChangeHandler));this._connects.push(q.connect(this,"onVisibilityChange",this,this._visibilityChangeHandler));this._connects.push(q.connect(this,"onOpacityChange",this,this._opacityChangeHandler));this._startRect={left:0,top:0,width:D.width,height:D.height};this.evaluateSuspension();if(this.suspended&&!D.loaded)var O=q.connect(D,"onLoad",this,function(){q.disconnect(O);
O=null;this.evaluateSuspension()});return J},_unsetMap:function(D,I){this.useWebGL&&D.releaseWebGLContext(this);n.forEach(this._connects,q.disconnect,this);var J=this._div;J&&(I.removeChild(J),c.destroy(J));this._map=this._canvas=this._context=this.data=this._connects=null;clearTimeout(this._displayTimer);this._displayTimer=null;this.inherited(arguments)},_canDraw:function(){return!!(this._map&&this._canvas&&this._context)},_requestDataErrorHandler:function(D){"CancelError"!==D.name&&(this.clear(),
this.onError(D))},_clonePixelData:function(D){if(null===D||D.texture)return D;var I={};D.extent&&(I.extent=e.clone(D.extent));var J=D.pixelBlock;null!=J&&(I.pixelBlock=J.clone());I.texture=D.texture;return I},_setPixelData:function(D){if(D){D=this._clonePixelData(D);this.pixelFilter&&(this.pixelFilter.filter?(this.pixelFilter.renderTexture=!0,this.pixelFilter.filter(D)):this.pixelFilter(D));this.pixelData=D;if(this._rasterReadPromise&&this._rasterReadPromise.isCanceled())return;this._drawPixelData()}this._rasterReadPromise=
null},_requestData:function(D,I,J){this._rasterReadPromise&&this._rasterReadPromise.cancel();D=e.clone(D)._normalize(!0);this._rasterReadPromise=this.raster.read({extent:D,width:this._map.width,height:this._map.height});this._rasterReadPromise.then(e.hitch(this,function(M){this._rasterReadPromise&&this._rasterReadPromise.isCanceled()||(this.originalPixelData=M&&M.srcData?{extent:M.extent,src:M.srcData}:M,this.useWebGL&&this._glSetting&&(this._glSetting.hasNewTexture=!0),this._setPixelData(M))}),e.hitch(this,
this._requestDataErrorHandler));return this._rasterReadPromise},_drawPixelData:function(D){a.set(this._canvas,{left:"0px",top:"0px",width:this._map.width+"px",height:this._map.height+"px"});this._startRect={left:0,top:0,width:this._map.width,height:this._map.height};this.drawMode||"css-transforms"!==this._map.navigationMode||(this._tdx=this._left,this._tdy=this._top,this._multiply=null,a.set(this._div,d._css.names.transform,d._css.translate(this._left,this._top)),a.set(this._canvas,d._css.names.transform,
d._css.translate(-this._left,-this._top)),this._dragOrigin={x:0,y:0});this.useWebGL&&this._rasterRenderer&&this._rasterRenderer.draw(this.pixelData);if(this._canDraw()&&this.drawMode&&this.drawMode&&(D=D||this.pixelData)&&D.pixelBlock){var I=this.pixelFilter?this.pixelData:this._rasterRenderer?this._rasterRenderer.draw(D):D;D=I.pixelBlock;var J=this._context,M=J.createImageData(D.width,D.height);M.data.set(D.getAsRGBA());I=I.extent;var O=this._map.extent,P=this.getCurrentResolution(),T=0,X=0;Math.abs(I.xmin-
O.xmin)>P.x&&(T=Math.round((I.xmin-O.xmin)/P.x));Math.abs(O.ymax-I.ymax)>P.y&&(X=Math.round((O.ymax-I.ymax)/P.y));"css-transforms"===this._map.navigationMode?(this._tdx=this._left,this._tdy=this._top,this._multiply=null,a.set(this._div,d._css.names.transform,d._css.translate(this._left,this._top)),a.set(this._canvas,d._css.names.transform,d._css.translate(-this._left,-this._top))):(a.set(this._div,{left:"0px",top:"0px",width:this._map.width+"px",height:this._map.height+"px"}),a.set(this._canvas,{left:"0px",
top:"0px",width:this._map.width+"px",height:this._map.height+"px"}));this._dragOrigin={x:0,y:0};this.tileMode?this.clear(T,X,D.width,D.height):this.clear();J.putImageData(M,T,X,0,0,D.width,D.height);this._fireUpdateEnd()}},hasStdTime:function(){if(!this.hasMultidimensions||"StdTime"!==this.raster.dataType)return!1;var D=this.mosaicRule&&this.mosaicRule.multidimensionalDefinition,I=D&&D.length?D[0].variableName:this._defaultMultidimensionalDefinition[0].variableName;return this.raster.rasterInfo.multidimensionalInfo.variables.some(function(J){if(J.name===
I)return J.dimensions.some(function(M){return"StdTime"===M.name})})},getStdTimeValue:function(D){return(new Date(864E5*(D-25569))).toString()},_animatePan2d:function(){this._oldDelta&&this._delta.x===this._oldDelta.x&&this._delta.y===this._oldDelta.y||(this.tileManager.updateTile(this.tileManager.originalPixelData,!0),this._oldDelta={x:this._delta.x,y:this._delta.y});this._roamingAnimation&&this.tileMode&&this.useWebGL&&(this._roamingAnimation=requestAnimationFrame(this._animatePan2d))},_cancelAnimation:function(){this._animation&&
(cancelAnimationFrame(this._animation),this._animation=null)},_updateAllTilesOnce:function(D,I){return this.tileManager.updateTile(D,!0).then(e.hitch(this,function(J){(this._hasTilingEffects||this.useWebGL||I)&&this._drawOneFrame(J)}))},_drawOneFrame:function(D,I){if(!(this.suspended||!this._map||this.tileMode&&!this._drawTile||(this.tileMode&&this.useWebGL&&this.tileManager.originalPixelData.isEmpty&&this._context.clear(this._context.COLOR_BUFFER_BIT),this.tileMode&&this.useWebGL&&this.tileManager.xformSetting&&
this.tileManager.xformSetting.requireProjection&&!this.tileManager.xformSetting.gridConfig))){if(!this._resetCss||this._levelChange)this._levelChange=!1,this._resetDrawing();if(D&&(D.renderedPixelBlock||D.pixelBlock)&&this._canDraw()&&this.drawMode){I=D.extent;var J=this._map.extent;if(!this._isExtentOutSide(I,J)){var M=D.pixelBlock||D.renderedPixelBlock,O=this._context,P=O.createImageData(M.width,M.height);P.data.set((D.renderedPixelBlock||D.pixelBlock).getAsRGBA());D=this.getCurrentResolution();
var T=0,X=0;Math.abs(I.xmin-J.xmin)>D.x&&(T=Math.round((I.xmin-J.xmin)/D.x));Math.abs(J.ymax-I.ymax)>D.y&&(X=Math.round((J.ymax-I.ymax)/D.y));O.putImageData(P,T,X,0,0,M.width,M.height)}}else this._fireUpdateEnd()}},_isExtentOutSide:function(D,I){return D.xmax<=I.xmin||D.xmin>=I.xmax||D.ymax<=I.ymin||D.ymin>=I.ymax},_resetDrawing:function(){this._resetCss=!0;if(!this.useWebGL)if(this._multiply||this._startRect.width!==this._map.width||this._startRect.height!==this._map.height)this.clear();else{var D=
this._context.getImageData(0,0,this._map.width,this._map.height);this.clear();this._context.putImageData(D,this._startRect.left,this._startRect.top)}this._dragOrigin={x:0,y:0};this._startRect={left:0,top:0,width:this._map.width,height:this._map.height};a.set(this._canvas,{left:"0px",top:"0px",width:this._map.width+"px",height:this._map.height+"px"});"css-transforms"===this._map.navigationMode?(this.roaming&&this.tileMode&&this.useWebGL&&(this._delta=null),this._tdx=this._left,this._tdy=this._top,
this._multiply=null,a.set(this._div,d._css.names.transform,d._css.translate(this._left,this._top)),a.set(this._canvas,d._css.names.transform,d._css.translate(-this._left,-this._top))):(a.set(this._div,{left:"0px",top:"0px",width:this._map.width+"px",height:this._map.height+"px"}),a.set(this._canvas,{left:"0px",top:"0px",width:this._map.width+"px",height:this._map.height+"px"}))},_drawAllFrames:function(){if(!this.suspended&&this._map&&(!this.tileMode||this._drawTile))if(this._resetCss){var D=this._frames,
I=0,J;for(J=0;J<D.length;J++)if(D[J].completed)I++;else if(D[J].tileData.renderedPixelBlock){D[J].completed=!0;var M=D[J].tileData;break}else if(D[J].tileData._fetched&&!D[J].tileData.src){D[J].completed=!0;break}else if(D[J].tileData.update&&D[J].tileData.update.isFulfilled()&&!D[J].tileData.renderedPixelBlock){D[J].completed=!0;break}else D[J].tileData.fetch&&(!0===D[J].tileData.fetch||D[J].tileData.fetch.isCanceled()||D[J].tileData.fetch.isRejected())?(D[J].completed=!0,I++):this._isExtentOutSide(D[J].tileData.extent,
this._map.extent)&&(D[J].completed=!0,I++);if(M){I++;var O=M.extent,P=this._map.extent,T=this.getCurrentResolution(),X=J=0;Math.abs(O.xmin-P.xmin)>T.x&&(J=Math.round((O.xmin-P.xmin)/T.x));Math.abs(P.ymax-O.ymax)>T.y&&(X=Math.round((P.ymax-O.ymax)/T.y));M.renderedPixelBlock?(O=M.renderedPixelBlock,P=this._context.createImageData(O.width,O.height),P.data.set(M.renderedPixelBlock.getAsRGBA()),this._context.putImageData(P,J,X,0,0,O.width,O.height)):this.clear(J,X,M.width,M.height)}I===D.length?(this._animation=
null,this._fireUpdateEnd()):this._animation=requestAnimationFrame(e.hitch(this,this._drawAllFrames))}else this._resetDrawing(),this._animation=requestAnimationFrame(e.hitch(this,this._drawAllFrames))},_fetchTiles:function(D,I){if(!this.suspended&&this.loaded){this._cancelAnimation();var J=this.tileManager,M=!(J.xformSetting.requireProjection&&J.xformSetting.requirePE)||R.load();h(M,e.hitch(this,function(){J.updateExtent(D,this.getCurrentResolution());this._resetCss=!1;J.fetchTiles(I);I&&(this._hasTilingEffects||
this.useWebGL?this.useWebGL&&0<J.tiles.length?(J.fillupTiles(),J._validateRawPixelBlocks(J.originalPixelData)?this._updateAllTilesOnce(J.originalPixelData):J.originalPixelData&&J.originalPixelData.src&&J.tiles.some(function(O){return O.updateCompleted})&&this._context.clear(this._context.COLOR_BUFFER_BIT),J.tiles.forEach(e.hitch(this,function(O){O.update&&!O.updateCompleted&&O.update.then(function(P){O.updateCompleted||(O.updateCompleted=!0);(this._hasTilingEffects||this.useWebGL)&&this._drawOneFrame(P)}.bind(this))}))):
this._hasTilingEffects&&h(J.fetchAllCompleted.isResolved()||J.fetchAllCompleted,e.hitch(this,function(){this._updateAllTilesOnce(J.originalPixelData)})):(this._frames=J.tiles.map(function(O){return{completed:!1,tileData:O}}),this._drawAllFrames()))}))}},_redrawTiles:function(){this._fetchTiles(this._map.extent,!0)},_panHandler:function(D,I){this._drawTile=!1;"css-transforms"===this._map.navigationMode?this.roaming&&this.tileMode&&this.useWebGL?(this._delta=I,!this._roamingAnimation&&this.tileMode&&
(this._roamingAnimation=requestAnimationFrame(this._animatePan2d))):(this._left=this._map.__visibleDelta.x+I.x,this._top=this._map.__visibleDelta.y+I.y,a.set(this._div,d._css.names.transform,d._css.translate(this._left,this._top))):a.set(this._div,{left:this._startRect.left+I.x+"px",top:this._startRect.top+I.y+"px"});this.tileMode&&this._fetchTiles(D)},_panEndHandler:function(D,I){I&&(this._startRect.left+=I.x,this._startRect.top+=I.y);this.oldData=null;this._roamingAnimation&&(cancelAnimationFrame(this._roamingAnimation),
this._oldDelta=this._roamingAnimation=null)},_onScaleHandler:function(D,I){var J={},M=d._css.names;a.set(this._canvas,M.transition,I?"none":M.transformName+" "+ia+"ms ease");this._matrix=D;D=this._multiply?l.multiply(D,this._multiply):D;if(this._tdx||this._tdy)D=l.multiply(D,{xx:1,xy:0,yx:0,yy:1,dx:-this._tdx,dy:-this._tdy});J[M.transform]=d._css.matrix(D);a.set(this._canvas,J)},_onZoomHandler:function(D,I,J){var M=this._startRect;D=M.width*I;I*=M.height;var O=M.left-(D-M.width)*(J.x-M.left)/M.width;
J=M.top-(I-M.height)*(J.y-M.top)/M.height;a.set(this._canvas,{left:O+"px",top:J+"px",width:D+"px",height:I+"px"});this._endRect={left:O,top:J,width:D,height:I}},_onZoomEndHandler:function(){this._endRect&&(this._startRect=this._endRect)},_onResizeHandler:function(D,I,J){a.set(this._div,{width:I+"px",height:J+"px"});a.set(this._canvas,{width:I+"px",height:J+"px"});this._startRect.width=this._canvas.width=I;this._startRect.height=this._canvas.height=J;this.useWebGL&&this._glSetting&&(this._glSetting.pingpong=
null,this._glSetting.branches=null)},_extentChangeHandler:function(D,I,J,M){if(this.loaded&&!this.suspended&&(!I||0!==I.x||0!==I.y||J)){this._drawTile=!0;"css-transforms"===this._map.navigationMode&&(I&&(this._dragOrigin.x+=I.x,this._dragOrigin.y+=I.y),this._left=this._map.__visibleDelta.x,this._top=this._map.__visibleDelta.y,this.roaming&&this.tileMode&&this.useWebGL||J||a.set(this._div,d._css.names.transform,d._css.translate(this._left,this._top)),J&&(a.set(this._canvas,d._css.names.transition,
"none"),this._multiply=this._multiply?l.multiply(this._matrix,this._multiply):this._matrix,this._levelChange=!0));this._fireUpdateStart();var O=this._map;I=this.raster.rasterFunction?this.raster.getMemberRasters().map(function(T){return T._rasterId}):[this.raster._rasterId];var P={};this.tileMode?((this.roaming||this.useWebGL)&&this.tileMode||(I.forEach(function(T,X){P[T]={extent:O.extent,pixelBlock:new N({width:O.width,height:O.height,pixels:[],pixelType:"",mask:null,statistics:[]})}}),this.tileManager.originalPixelData=
{extent:O.extent,src:P}),this.projectedFullExtent?this._fetchTiles(D,!0):this._getProjectedFullExtent(O.spatialReference).then(e.hitch(this,function(){this._fetchTiles(D,!0)}))):this._requestData(O.extent,O.width,O.height)}},_visibilityChangeHandler:function(D){D?u.show(this._div):u.hide(this._div)},_opacityChangeHandler:function(D){a.set(this._div,"opacity",D)}});k("extend-esri")&&e.setObject("layers.RasterXLayer",G,d);return G})},"esri/layers/rasterLib/raster/rasterFactory":function(){define("require dojo/_base/declare dojo/_base/lang dojo/_base/Deferred dojo/_base/array dojo/_base/config dojo/sniff dojo/when ../../../kernel ../../../Evented ../../../request ../../../deferredUtils ../../../urlUtils ./ImageServiceRaster ./TileServiceRaster ./TileRaster ./FunctionRaster".split(" "),
function(G,e,q,n,p,k,c,a,b,l,h,g,d,f,m,u,r){G={customDrivers:[],create:function(t){if(t){if(t.url){var w=d.urlToObject(t.url);var v=w.path;var y=w.query}w=t.serviceInfo;var x=t.rasterFxArgs||{},A=new n,C=q.hitch(this,function(z){console.error(z);this._trycustomDrivers(q.mixin({url:v},t),0,A)});if(v)if(-1===v.toLowerCase().indexOf("imageserver")&&-1===v.toLowerCase().indexOf("mapserver")){var E=new u(q.mixin({},t,{url:v}));t.rasterFx&&(E=new r({rasterFx:t.rasterFx,rasterFxArgs:q.mixin({},x,{raster:E})}));
var H=E}else{H=new n;w=w||this._getServiceInfo(v,y);var B=q.hitch(this,function(z){z.bandCount?E=z.capabilities&&-1<z.capabilities.toLowerCase().indexOf("tileonly")?new m(q.mixin({},{serviceInfo:z},y,t,{url:v})):new f(q.mixin({},{serviceInfo:z},y,t,{url:v})):z.tileInfo&&(E=new m(q.mixin({},{serviceInfo:z},y,this._options,{url:v})));t.rasterFx&&(E=new r({rasterFx:t.rasterFx,rasterFxArgs:q.mixin({},x,{raster:E})}));H.resolve(E)});a(w,B,C)}else H=E=new r({rasterFx:t.rasterFx,rasterFxArgs:q.mixin({},
x,{raster:E})});a(H,q.hitch(this,function(z){z?z.open().then(q.hitch(this,function(F){A.resolve(z)}),C):C(Error("There is no raster to open"))}),C);return A.promise}},register:function(t){this.customDrivers=this.customDrivers||[];0<this.customDrivers.filter(function(w){return w.sourceType===t.prototype.sourceType}).length||this.customDrivers.push(t)},_trycustomDrivers:function(t,w,v){v=v||new n;var y=this.customDrivers[w];if(y){var x=new y(t);x.open().then(q.hitch(this,function(A){v.resolve(x)}),
q.hitch(this,function(A){this._trycustomDrivers(t,w+1,v)}))}else v.reject("cannot load layer "+(t&&t.url||""));return v.promise},_getServiceInfo:function(t,w){w=w||{};var v=w.bandIds;w=w.renderingRule;var y=new n(g._dfdCanceller),x={f:"json"};v&&(x.bandIds=v);w&&(x.renderingRule=w.toJson?JSON.stringify(w.toJson()):JSON.stringify(w));y._pendingDfd=h({url:t,content:x,handleAs:"json",callbackParamName:"callback"});y._pendingDfd.then(function(A){y.callback(A)},function(A){y.errback(A)});return y.promise}};
c("extend-esri")&&q.setObject("layers.rasterLib.raster.rasterFactory",G,b);return G})},"esri/layers/rasterLib/raster/ImageServiceRaster":function(){define("require dojo/_base/declare dojo/_base/lang dojo/_base/Deferred dojo/_base/array dojo/_base/config dojo/_base/json dojo/sniff dojo/DeferredList dojo/when ../../../kernel ../../../Evented ../../../request ../../../geometry/Extent ../../../geometry/Point ../../../SpatialReference ../../../WKIDUnitConversion ../../../deferredUtils ../../../urlUtils ../../MosaicRule ../../ImageServiceParameters ../../PixelBlock ./RasterInfo ./BasicRaster ../../rasterFormats/rasterCodec ../tile/RasterTileInfo".split(" "),
function(G,e,q,n,p,k,c,a,b,l,h,g,d,f,m,u,r,t,w,v,y,x,A,C,E,H){G=e([C],{declaredClass:"esri.layers.rasterLib.raster.ImageServiceRaster",sourceType:"ImageService",constructor:function(B){B&&(this._imageServiceParams=B.imageServiceParameters,this._commonReqParams=B._commonReqParams,this._imageServiceParams||(this._imageServiceParams={interpolation:B.interpolation,pixelType:B.pixelType,format:B.format||"lerc",compressionQuality:B.compressionQuality,bandIds:B.bandIds,noDataInterpretation:B.noDataInterpretation,
adjustAspectRatio:B.adjustAspectRatio,mosaicRule:B.mosaicRule,renderingRule:B.interpolation}))},open:function(){var B=new n;if(this.serviceInfo&&this.rasterInfo)return this.loaded=!0,this._findCredential(),this.setFetchParameters(this._imageServiceParams),B.resolve(this),B.promise;var z=this.serviceInfo||this._generateServiceInfo(this._imageServiceParams&&this._imageServiceParams.renderingRule),F=q.hitch(this,function(L){this._fixServiceInfo(L);this.serviceInfo=L;this._findCredential();var N=this._parseRasterInfo(L),
Q={};L.defaultMosaicMethod?(Q.method=L.defaultMosaicMethod,Q.operation=L.mosaicOperator,Q.sortField=L.sortField,Q.sortValue=L.sortValue):Q.method=v.METHOD_NONE;this.serviceInfo.defaultMosaicRule=new v(Q);this.serviceInfo.defaultMosaicRule.ascending=!0;L=this._getColormap(this);Q=this._getHistograms(this);var S=this._getRasterAttributeTable(this),R=this._getKeyProperties(this),V=this._getMultidimensionalInfo(),W=this._getSlices();(new b([L,Q,S,R,V,W])).then(q.hitch(this,function(U){U[0][0]&&(N.colormap=
U[0][1]);U[1][0]&&(N.histograms=U[1][1]);U[2][0]&&(N.vat=U[2][1]);U[3][0]&&(N.keyProperties=U[3][1]);U[4][0]&&(N.multidimensionalInfo=U[4][1]);this._slices=U[5][0]?U[5][1]:null;N.keyProperties&&N.keyProperties.DataType&&(this.dataType=N.keyProperties.DataType);this.loaded=!0;this.rasterInfo=N;this.setFetchParameters(this._imageServiceParams);B.resolve(this)}))}),K=q.hitch(this,function(L){this.loaded=!0;B.reject(L)});l(z,F,K);return B.promise},setFetchParameters:function(B,z){if(z)this.imageServiceParams=
B;else{var F=this.imageServiceParams;F&&B?Object.keys(B).forEach(function(K){F[K]=B[K]}):this.imageServiceParams=B}this._constructGetImageParams();this._getRasterIdentifier(!0)},read:function(B){if(B.pixelBlock||B.texture){var z=new n;z.resolve(B);return z.promise}if(!1===B.virtual&&this.tileInfo&&!this.tileInfo.virtual)return this.readTile(B);if(this._slices){var F=this._getSliceId();if(null==F)return z=new n,z.resolve(B),z.promise}var K=B.extent,L=K.spatialReference.wkid||c.toJson(K.spatialReference.toJson(!1)),
N=B.timeExtent?B.timeExtent.toJson().join(","):null;z=this.url+"/exportImage";var Q={};this._slices&&(Q.sliceid=F);this.disableClientCaching&&(Q._ts=(new Date).getTime());F=q.mixin({},this._commonReqParams,{bbox:K.xmin+","+K.ymin+","+K.xmax+","+K.ymax,imageSR:L,bboxSR:L,size:B.width+","+B.height,time:N},Q);return this._requestPixels({url:z,payload:F,decodeParams:{width:B.width,height:B.height,planes:null,pixelType:null,format:null,decodeFunc:null,isPoint:!1},tileOptions:B})},readTile:function(B){var z=
this.tileBoundary&&this.tileBoundary[B.level];if(z&&(z.minRow>B.row||z.maxRow<B.row||z.minCol>B.col||z.maxCol<B.col)){var F=new n;F.resolve(B);return F.promise}if(this._slices&&(F=this._getSliceId(),null==F))return F=new n,F.resolve(B),F.promise;z=this.url+"/tile/"+B.level+"/"+B.row+"/"+B.col;var K={width:this.tileInfo.cols,height:this.tileInfo.rows,planes:null,pixelType:null,format:null,decodeFunc:null,isPoint:"elevation"===B.tileType.toLowerCase()?!0:!1};F=this._slices?"sliceid\x3d"+F+"\x26":"";
F=this.disableClientCaching?"_ts\x3d "+(new Date).getTime():F.replace(/&$/,"");return this._requestPixels({url:z+(0<F.length?"?"+F:""),payload:{},decodeParams:K,tileOptions:B})},toJson:function(){return{url:this.url,tileInfo:this.tileInfo,rasterInfo:this.rasterInfo,serviceInfo:this.serviceInfo,sourceType:this.sourceType,_commonReqParams:this._commonReqParams,_rasterId:this._rasterId}},_getSliceId:function(){var B=q.clone(this._imageServiceParams.multidimensionalDefinition),z=q.clone(this._imageServiceParams.time);
if(null==this._slices||null==z&&(null==B||0===B.length))return 0;var F=B||this.defaultMultidimensionalDefinition,K=F[0].variableName;F=this._getAllDimensionDefinition(F,K).definition;B=null;if(null==F||0===F.length)return null;if(z&&this.serviceInfo.timeInfo){if(null==z[1]||z[1]===z[0])var L=z[0];else{var N=this.serviceInfo.timeInfo.startTimeField;L=this.rasterInfo.multidimensionalInfo.variables.find(function(R){return R.name===K}).dimensions.find(function(R){return R.name===N}).values.filter(function(R){return Array.isArray(R)?
Math.max(R[0],z[0])<Math.min(R[1],z[1]):R>=z[0]&&R<=z[1]}).sort(function(R,V){R=Array.isArray(R)?R[1]:R;V=Array.isArray(V)?R[1]:V;return Math.abs(z[1]-R)-Math.abs(z[1]-V)})[0]||[z[1]]}F.some(function(R){if(R.dimensionName===N)return R.values[0]=L,!0;if(!R.dimensionName)return R.dimensionName=N,R.isSlice=!0,R.values=[L],!0})||F.push({variableName:K,dimensionName:N,isSlice:!0,values:[L]})}for(var Q=0;Q<this._slices.length;Q++){var S=this._slices[Q].multidimensionalDefinition;if(S.length===F.length&&
!S.some(function(R){var V=F.filter(function(U){return R.variableName===U.variableName&&U.dimensionName===R.dimensionName})[0];if(!V)return!0;var W=Array.isArray(R.values[0])?R.values[0][0]:R.values[0];V=Array.isArray(V.values[0])?V.values[0][0]:V.values[0];return W!==V})){B=Q;break}}return B},_getAllDimensionDefinition:function(B,z){var F=B.map(function(L){return L.dimensionName}),K=!1;this.rasterInfo.multidimensionalInfo.variables.forEach(function(L){L.name!==z||L.dimensions.length===B.length&&F[0]||
(L.dimensions.forEach(function(N){0>F.indexOf(N.name)&&(F[0]?B.push({variableName:z,dimensionName:N.name,values:[N.values[0]]}):(B[0].dimensionName=N.name,B[0].values=[N.values[0]],N[0]=N.name))}),K=!0)},this);return{defChanged:K,definition:B}},_generateServiceInfo:function(B){var z=this.url,F=new n(t._dfdCanceller);F._pendingDfd=d({url:z,content:{f:"json",renderingRule:B?c.toJson(B.toJson()):null},handleAs:"json",callbackParamName:"callback"});F._pendingDfd.then(function(K){F.callback(K)},function(K){F.errback(K)});
return F},_fixServiceInfo:function(B){var z=B.spatialReference.wkid;B.tileInfo&&0===B.extent.xmin&&360===B.extent.xmax&&z&&null==r[z]&&(B.tileInfo.applyGCS360Transform=!0)},_parseRasterInfo:function(B){var z=new A;z.bandCount=B.bandCount;z.extent=new f(B.fullExtent);z.spatialReference=B.spatialReference;z.pixelType=B.pixelType;z.width=Math.floor((B.fullExtent.xmax-B.fullExtent.xmin)/B.pixelSizeX+.5);z.height=Math.floor((B.fullExtent.ymax-B.fullExtent.ymin)/B.pixelSizeY+.5);z.cellSize=new m({x:B.pixelSizeX,
y:B.pixelSizeY,spatialReference:B.spatialReference});var F;if(B.minValues&&0<B.minValues.length&&B.maxValues&&B.stdvValues&&B.meanValues){var K=[];for(F=0;F<B.minValues.length;F++)K.push({min:B.minValues[F],max:B.maxValues[F],mean:B.meanValues[F],stddev:B.stdvValues[F]});B.bandCount!==K.length&&(K=null)}this.dataType=B.serviceDataType?B.serviceDataType.replace("esriImageServiceDataType",""):"Generic";z.statistics=K;B.objectIdField&&B.fields&&(z.catalogInfo={objectIdField:B.objectIdField,fields:B.fields});
z.timeInfo=B.timeInfo;if(B.tileInfo){this.tileInfo=new H(B.tileInfo);this.tileInfo.tileType=B.cacheType||"Map";z.tileInfo=this.tileInfo;var L=z.extent,N=this.tileInfo.origin,Q=this.tileInfo.cols,S=this.tileInfo.rows;this.tileBoundary=this.tileInfo.lods.map(function(R){return{minCol:Math.floor((L.xmin-N.x+.1*R.resolution)/Q/R.resolution),maxCol:Math.floor((L.xmax-N.x-.1*R.resolution)/Q/R.resolution),minRow:Math.floor((N.y-L.ymax+.1*R.resolution)/S/R.resolution),maxRow:Math.floor((N.y-L.ymin-.1*R.resolution)/
S/R.resolution)}})}return z},_getColormap:function(B){B=this.url+"/colormap";var z=new n(t._dfdCanceller),F={f:"json"},K=this.serviceInfo.hasColormap||this.rasterInfo&&this.rasterInfo.hasColormap;10<this.serviceInfo.currentVersion&&K?(z._pendingDfd=d({url:B,content:F,handleAs:"json",callbackParamName:"callback"}),z._pendingDfd.then(function(L){z.callback(L.colormap)},function(L){z.errback(L)})):z.callback(null);return z},_getHistograms:function(B){var z=this.url+"/histograms",F=new n(t._dfdCanceller),
K={f:"json"},L=this.serviceInfo.hasHistograms||this.rasterInfo&&this.rasterInfo.hasHistograms;B&&B.renderingRule&&(K.renderingRule=c.toJson(B.renderingRule.toJson()),L=!0);10<this.serviceInfo.currentVersion&&L?(F._pendingDfd=d({url:z,content:K,handleAs:"json",callbackParamName:"callback"}),F._pendingDfd.then(function(N){F.callback(N.histograms)},function(N){F.errback(N)})):F.callback(null);return F},_getRasterAttributeTable:function(B){var z=this.url+"/rasterAttributeTable",F=new n(t._dfdCanceller),
K={f:"json"},L=this.serviceInfo.hasRasterAttributeTable;B&&B.renderingRule&&(K.renderingRule=c.toJson(B.renderingRule.toJson()),L=!0);10<this.serviceInfo.currentVersion&&L?(F._pendingDfd=d({url:z,content:K,handleAs:"json",callbackParamName:"callback"}),F._pendingDfd.then(function(N){F.callback(N)},function(N){F.errback(N)})):F.callback(null);return F},_getKeyProperties:function(B){var z=this.url+"/keyProperties",F=new n(t._dfdCanceller),K={f:"json"};B&&B.renderingRule&&(K.renderingRule=c.toJson(B.renderingRule.toJson()));
10<this.serviceInfo.currentVersion?(F._pendingDfd=d({url:z,content:K,handleAs:"json",callbackParamName:"callback"}),F._pendingDfd.then(function(L){F.callback(L)},function(L){F.errback(L)})):F.callback(null);return F},_getMultidimensionalInfo:function(){var B=this.url+"/multidimensionalInfo",z=new n(t._dfdCanceller);10.3<=this.serviceInfo.currentVersion&&this.serviceInfo.hasMultidimensions?(z._pendingDfd=d({url:B,content:{f:"json"},handleAs:"json",callbackParamName:"callback"}),z._pendingDfd.then(q.hitch(this,
function(F){z.callback(F.multidimensionalInfo)}),function(F){z.errback(F)})):z.callback(null);return z},_getSlices:function(){var B=this.url+"/slices",z=new n(t._dfdCanceller);this.serviceInfo.hasMultidimensions?(z._pendingDfd=d({url:B,content:{f:"json"},handleAs:"json",callbackParamName:"callback"}),z._pendingDfd.then(q.hitch(this,function(F){z.callback(F.slices)}),function(F){z.errback(F)})):z.callback(null);return z},_initializationFailed:function(){},_constructGetImageParams:function(){var B=
this.imageServiceParams||{},z=q.mixin({},this._query,{f:"image",interpolation:B.interpolation,pixelType:B.pixelType,format:B.format||"lerc",compressionQuality:B.compressionQuality,bandIds:B.bandIds?B.bandIds.join(","):null,noData:null!=B.noData?B.noData.join(","):null,noDataInterpretation:B.noDataInterpretation,adjustAspectRatio:null==B.adjustAspectRatio?null:B.adjustAspectRatio,mosaicRule:B.mosaicRule?c.toJson(B.mosaicRule.toJson()):null,renderingRule:B.renderingRule?c.toJson(B.renderingRule.toJson()):
null,token:this.credential&&this.credential.token||null});"lerc"===z.format.toLowerCase()?(z.compressionTolerance=B.compressionTolerance,10.5<=this.serviceInfo.currentVersion&&(z.lercVersion=B.lercVersion||2)):"tiff"===z.format.toLowerCase()?z.compression=B.compression:-1<["jpg","jpeg","jpg","jpgpng"].indexOf(z.format.toLowerCase())&&(z.compression=B.compression);this._commonReqParams=z},_getRasterIdentifier:function(B){if(this._rasterId)return this._rasterId;B=this.url.replace("http:","").replace("https:",
"");var z=[],F=this.imageServiceParams||{};z.push(B);z.push(F.interpolation);z.push(F.pixelType);z.push(F.compressionQuality);z.push(F.bandIds?F.bandIds.join(","):"");z.push(F.mosaicRule?c.toJson(F.mosaicRule.toJson()):"");z.push(F.renderingRule?c.toJson(F.renderingRule.toJson()):"");B=z.join("|");return this._rasterId=this._computeSignature(B)},_wrapExtent:function(B){var z=B.spatialReference._getInfo();if(z){var F=z.valid[0];z=z.valid[1];if(B.xmin<F-this.resolution.x||B.xmax>z+this.resolution.y){var K=
new f((B.xmin-F)%(z-F),B.ymin,(B.xmax-z)%(z-F),B.ymax,B.spatialReference);K.xmax<K.xmin&&(K=null)}}return K||B}});a("extend-esri")&&q.setObject("layers.rasterLib.raster.ImageServiceRaster",G,h);return G})},"esri/layers/ImageServiceParameters":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/json dojo/has ../kernel ../lang".split(" "),function(G,e,q,n,p,k){G=G(null,{declaredClass:"esri.layers.ImageServiceParameters",extent:null,width:null,height:null,imageSpatialReference:null,format:null,
interpolation:null,compressionQuality:null,bandIds:null,timeExtent:null,mosaicRule:null,renderingRule:null,renderer:null,noData:null,compressionTolerance:null,adjustAspectRatio:null,lercVersion:null,toJson:function(c){var a=this.bbox||this.extent;c=(a=a&&c&&a._normalize(!0))?a.spatialReference.wkid||q.toJson(a.spatialReference.toJson()):null;var b=this.imageSpatialReference;a={bbox:a?a.xmin+","+a.ymin+","+a.xmax+","+a.ymax:null,bboxSR:c,size:null!==this.width&&null!==this.height?this.width+","+this.height:
null,imageSR:b?b.wkid||q.toJson(b.toJson()):c,format:this.format,interpolation:this.interpolation,compressionQuality:this.compressionQuality,bandIds:this.bandIds?this.bandIds.join(","):null,mosaicRule:this.mosaicRule?q.toJson(this.mosaicRule.toJson()):null,renderingRule:this.renderingRule?q.toJson(this.renderingRule.toJson()):null,renderer:this.renderer?q.toJson(this.renderer.toJson()):null,noData:this.noData,noDataInterpretation:this.noDataInterpretation,compressionTolerance:this.compressionTolerance,
adjustAspectRatio:this.adjustAspectRatio,lercVersion:this.lercVersion};c=this.timeExtent;a.time=c?c.toJson().join(","):null;return k.filter(a,function(l){if(null!==l&&void 0!==l)return!0})}});e.mixin(G,{INTERPOLATION_BILINEAR:"RSP_BilinearInterpolation",INTERPOLATION_CUBICCONVOLUTION:"RSP_CubicConvolution",INTERPOLATION_MAJORITY:"RSP_Majority",INTERPOLATION_NEARESTNEIGHBOR:"RSP_NearestNeighbor",NODATA_MATCH_ALL:"esriNoDataMatchAll",NODATA_MATCH_ANY:"esriNoDataMatchAny"});n("extend-esri")&&e.setObject("layers.ImageServiceParameters",
G,p);return G})},"esri/layers/rasterLib/raster/RasterInfo":function(){define(["dojo/_base/declare","dojo/_base/lang","../../../geometry/Extent","../../../SpatialReference","../tile/RasterTileInfo"],function(G,e,q,n,p){return G(null,{declaredClass:"esri.layers.rasterLib.raster.RasterInfo",bandCount:null,pixelType:null,extent:null,spatialReference:null,width:null,height:null,colormap:null,attributeTable:null,multiDimensionalInfo:null,statistics:null,histograms:null,catalogInfo:null,keyProperties:null,
cellSize:null,format:null,compression:null,compressionQuality:null,packetSize:null,geodataXform:null,constructor:function(k){e.mixin(this,k);this.extent=this.extent?this.extent.toJson?this.extent:new q(this.extent):null;this.spatialReference=this.spatialReference?this.spatialReference.toJson?this.spatialReference:new n(this.spatialReference):null;this.tileInfo=this.tileInfo?this.tileInfo.toJson?this.tileInfo:new p(this.tileInfo):null},toJson:function(){return{bandCount:this.bandCount,pixelType:this.pixelType,
extent:this.extent&&this.extent.toJson?this.extent.toJson():this.extent,spatialReference:this.spatialReference&&this.spatialReference.toJson?this.spatialReference.toJson():this.spatialReference,width:this.width,height:this.height,colormap:this.colormap?e.clone(this.colormap):null,attributeTable:this.attributeTable?e.clone(this.attributeTable):null,multiDimensionalInfo:this.multiDimensionalInfo?e.clone(this.multiDimensionalInfo):null,statistics:this.statistics?e.clone(this.statistics):null,histograms:this.histograms?
e.clone(this.histograms):null,catalogInfo:this.catalogInfo?e.clone(this.catalogInfo):null,keyProperties:this.keyProperties?e.clone(this.keyProperties):null,cellSize:this.cellSize&&this.cellSize.toJson?this.cellSize.toJson():this.cellSize,tileInfo:this.tileInfo&&this.tileInfo.toJson?this.tileInfo.toJson():this.tileInfo,format:this.format,compression:this.compression,compressionQuality:this.compressionQuality,packetSize:this.packetSize,geodataXform:this.geodataXform?e.clone(this.geodataXform):null}},
clone:function(){return new this.constructor(this.toJson())}})})},"esri/layers/rasterLib/tile/RasterTileInfo":function(){define("dojo/_base/declare dojo/_base/lang ../../../geometry/Extent ../../../SpatialReference ../../../geometry/Point ../../../lang ../../TileInfo".split(" "),function(G,e,q,n,p,k,c){return G([c],{declaredClass:"esri.layers.rasterLib.tile.RasterTileInfo",rows:512,cols:512,compressionQuality:95,lercError:.01,spatialReference:null,origin:null,virtual:!0,tileType:"Raster",constructor:function(a,
b){if(a||b){var l=b&&b.refTileInfo;a?this.virtual=!1:(this.virtual=!0,e.mixin(this,{rows:b.rows||this.rows,cols:b.cols||this.cols,compressionQuality:b.compressionQuality||95,lercError:b.compressionTolerance||.01,spatialReference:b.spatialReference,origin:b.origin}),this.width=this.cols,this.height=this.rows,this.origin||(l?this.origin=l.origin:b.spatialReference.isWebMercator()||b.extent&&360<=Math.max(Math.abs(b.extent.xmin),Math.abs(b.extent.xmax))?this.origin={x:-2.0037508342787E7,y:2.0037508342787E7}:
-1<[4326,4269].indexOf(b.spatialReference.wkid)||360>Math.max(Math.abs(b.extent.xmin),Math.abs(b.extent.xmax))?this.origin={x:-180,y:90}:this.origin={x:b.extent.xmin,y:b.extent.ymax}))}},toJson:function(){var a=c.prototype.toJson.apply(this);a.tileType=this.tileType;a.virtual=this.virtual;a.lercError=this.lercError;return a},clone:function(){return new this.prototype(this.toJson())}})})},"esri/layers/rasterLib/raster/BasicRaster":function(){define("require dojo/_base/declare dojo/_base/lang dojo/_base/Deferred dojo/_base/array dojo/_base/config dojo/_base/json dojo/sniff dojo/DeferredList dojo/when ../../../kernel ../../../Evented ../../../request ../../../geometry/Extent ../../../geometry/Point ../../../SpatialReference ../../../deferredUtils ../../../urlUtils ../../MosaicRule ../../ImageServiceParameters ../../PixelBlock ../../rasterFormats/rasterCodec ../tile/RasterHandler ./rasterProjectionHelper ./RasterInfo".split(" "),
function(G,e,q,n,p,k,c,a,b,l,h,g,d,f,m,u,r,t,w,v,y,x,A,C,E){return e([g],{url:null,dataType:null,rasterInfo:null,tileInfo:null,serviceInfo:null,loaded:null,constructor:function(H){if(H){var B=H.url;B&&(B=t.urlToObject(B),this.url=B.path,this._query=B.query);this.dataType=H.dataType;this.serviceInfo=H.serviceInfo;this.rasterInfo=H.rasterInfo;this.tileInfo=H.tileInfo;this.serviceInfo=H.serviceInfo}},open:function(){},read:function(H){},identify:function(H){var B=new n,z=this.rasterInfo.extent;if(C.requirePE(z.spatialReference,
H.spatialReference))C.load().then(q.hitch(this,function(){F=C.project(H,z.spatialReference);B.resolve(F)}),function(){B.reject(Error("cannot project into this spatial reference"))});else{var F=C.project(H,z.spatialReference);B.resolve(F)}return B.then(q.hitch(this,function(K){var L=this.tileInfo,N=L.origin,Q=L.lods[L.lods.length-1],S=(K.x-N.x)/L.cols/Q.resolution;K=(N.y-K.y)/L.rows/Q.resolution;var R=Math.round((K-Math.floor(K))*L.rows)*L.cols+Math.round((S-Math.floor(S))*L.cols);N=new f(N.x+Q.resolution*
L.cols*S,N.y-Q.resolution*L.rows*(K+1),N.x+Q.resolution*L.cols*(S+1),N.y-Q.resolution*L.rows*K,z.spatialReference);var V=this.getMemberRasters?this.getMemberRasters()[0]:this;return V.read({level:Q.level,row:Math.floor(K),col:Math.floor(S),extent:N,width:L.cols,height:L.rows,virtual:V.tileInfo.virtual,tileType:V.tileInfo.tileType}).then(function(W){return(W=W&&W.pixelBlock)&&W.pixels&&0<W.pixels.length&&(!W.mask||W.mask[R])?{pixelValue:W.pixels.map(function(U){return U[R]})}:{pixelValue:null}})}))},
getProjectedFullExtent:function(H,B){var z=new n;if(this.projectedFullExtent&&!B)return z.resolve(this.projectedFullExtent),z.promise;var F=this.rasterInfo.extent;if(C.requirePE(this.rasterInfo.extent.spatialReference,H))C.load().then(q.hitch(this,function(){K=C.project(F,H);this.projectedFullExtent=K=new f(K.toJson());z.resolve(K)}),function(){z.reject(Error("cannot project into this spatial reference"))});else{var K=C.project(F,H);this.projectedFullExtent=K=new f(K.toJson());z.resolve(K)}return z.promise},
setFetchParameters:function(H,B){},_setRasterHandler:function(H){this._rasterHandler=H;this.getMemberRasters&&this.getMemberRasters().forEach(q.hitch(this,function(B){B._rasterHandler=H}))},_findCredential:function(){this.url&&((this._credential=h.id&&h.id.findCredential(this.url))&&this._credential.ssl||this.serviceInfo&&this.serviceInfo._ssl)&&(this.url=this.url.replace(/^http:/i,"https:"))},_initWorker:function(){this._rasterHandler=new A;this._rasterHandler.start().then(function(){this._rasterHandlerInitialized=
!0}.bind(this))},_requestPixels:function(H){var B=H.url,z=H.payload,F=H.decodeParams,K=H.tileOptions,L=new n(r._dfdCanceller);this._rasterHandler||this._initWorker();var N=this._rasterHandler,Q={};B={url:B,handleAs:"arraybuffer",content:z};H.headers&&(B.headers=H.headers);L._pendingDfd=d(B).then(q.hitch(this,function(S){(N&&this._rasterHandlerInitialized?N.decode({encodedData:S,decodeParams:F}):x.decode(S,F)).then(function(R){Q.pixelBlock=new y(R);Q.extent=K.extent;Q.level=K.level;Q.row=K.row;Q.col=
K.col;Q.width=K.width;Q.height=K.height;r._resDfd(L,[Q])},function(R){r._resDfd(L,[R],!0)})}),function(S){r._resDfd(L,[S],!0)});return L},_computeSignature:function(H){if("string"===typeof H){for(var B=new Uint8Array(H.length),z=0;z<H.length;z++)B[z]=H.charCodeAt(z);H=B}z=B=65535;for(var F=H.length,K=Math.floor(F/2),L=0;K;){var N=359<=K?359:K;K-=N;do B+=H[L++]<<8,z+=B+=H[L++];while(--N);B=(B&65535)+(B>>>16);z=(z&65535)+(z>>>16)}F&1&&(z+=B+=H[L]<<8);return((z&65535)+(z>>>16)<<16|(B&65535)+(B>>>16))>>>
0}})})},"esri/layers/rasterFormats/rasterCodec":function(){define("require dojo/_base/declare dojo/_base/lang dojo/_base/Deferred ../PixelBlock ./LercCodec ./Lerc2Codec ./JpgPlus ./Png ./Raw ./TiffDecoder".split(" "),function(G,e,q,n,p,k,c,a,b,l,h){return{validPixelTypes:"U1 U2 U4 U8 U16 U32 S8 S16 S32 F32".split(" "),supportedFormats:"lerc jpeg jpg jpgpng png png8 png24 png32 bip bsq tiff".split(" "),_isPlatformLittleEndian:function(){var g=new ArrayBuffer(4),d=new Uint8Array(g);(new Uint32Array(g))[0]=
1;return 1===d[0]}(),decode:function(g,d){if(void 0===d||null===d)throw"missing decode options";var f;d.format&&(f=d.format.toUpperCase());"BSQ"!==f&&"BIP"!==f&&(f=this._getFormat(g));var m=d.decodeFunc;if(void 0===m||null===m)m=this._getFormatDecoderDfd(f);return m(g,d)},_getFormatDecoderDfd:function(g){var d=null;switch(g){case "LERC":d=this._decodeLerc;break;case "LERC2":d=this._decodeLerc2;break;case "JPEG":d=this._decodeJpeg;break;case "PNG":d=this._decodePng;break;case "BSQ":d=this._decodeBsq;
break;case "BIP":d=this._decodeBip;break;case "TIFF":d=this._decodeTiff;break;default:d=function(f,m){throw"The raster format is not supported";}}d=q.hitch(this,d);return function(f,m){var u=new n;m.isPoint&&m.width&&(m.width++,m.height++);f=d(f,m);m.isPoint&&m.width&&(this._interpolatePointGrid(f),m.width--,m.height--);u.resolve(f);return u}.bind(this)},_getFormat:function(g){g=new Uint8Array(g,0,10);var d="";if(255===g[0]&&216===g[1])d="JPEG";else if(137===g[0]&&80===g[1]&&78===g[2]&&71===g[3])d=
"PNG";else if(67===g[0]&&110===g[1]&&116===g[2]&&90===g[3]&&73===g[4]&&109===g[5]&&97===g[6]&&103===g[7]&&101===g[8]&&32===g[9])d="LERC";else if(76===g[0]&&101===g[1]&&114===g[2]&&99===g[3]&&50===g[4]&&32===g[5])d="LERC2";else if(-1<String.fromCharCode.apply(null,g).toLowerCase().indexOf("error"))d="ERROR";else if(73===g[0]&&73===g[1]&&42===g[2]&&0===g[3]||77===g[0]&&77===g[1]&&0===g[2]&&42===g[3])d="TIFF";return d},_validateDecodeParams:function(g){if(!g.height||Math.floor(g.height)!==g.height)throw"Height not provided.";
if(!g.width||Math.floor(g.width)!==g.width)throw"Width not provided.";},_decodeJpeg:function(g,d){if(!a)throw"The jpeg decoder module is not loaded.";this._validateDecodeParams(d);g=(new a).decode(g);if(!this._verifyResult(g,d))throw"The decoded image dimensions are incorrect.";d=new p({width:g.width,height:g.height,pixels:g.pixels,pixelType:"U8",mask:g.mask,statistics:null});d.calculateStatistics();return d},_decodePng:function(g,d){if(!b)throw"The png decoder module is not loaded.";this._validateDecodeParams(d);
g=new Uint8Array(g);var f=new b(g);g=new Uint8Array(d.width*d.height*4);f.copyToImageData(g,f.decodePixels());var m=f=0;m=new Uint8Array(d.width*d.height);for(f=0;f<d.width*d.height;f++)m[f]=g[4*f+3];var u=new p({width:d.width,height:d.height,pixels:[],pixelType:"U8",mask:m,statistics:[]});for(f=0;3>f;f++){var r=new Uint8Array(d.width*d.height);for(m=0;m<d.width*d.height;m++)r[m]=g[4*m+f];u.addData({pixels:r})}u.calculateStatistics();return u},_decodeBsq:function(g,d){if(!l)throw"The bsq decoder module is not loaded.";
this._validateDecodeParams(d);var f=d.noDataValue;d.pixelType=this._getpixelTypeAndNoData(d.pixelType);g=l.decodeBSQ(g,{bandCount:d.planes,width:d.width,height:d.height,pixelType:d.pixelType,noDataValue:f});d=new p({width:d.width,height:d.height,pixels:g.pixels,pixelType:d.pixelType,mask:g.maskData,statistics:null});d.calculateStatistics();return d},_decodeBip:function(g,d){this._validateDecodeParams(d);var f=d.noDataValue;d.pixelType=this._getpixelTypeAndNoData(d.pixelType);g=l.decodeBIP(g,{bandCount:d.planes,
width:d.width,height:d.height,pixelType:d.pixelType,noDataValue:f});d=new p({width:d.width,height:d.height,pixels:g.pixels,pixelType:d.pixelType,mask:g.maskData,statistics:null});d.calculateStatistics();return d},_decodeTiff:function(g,d){this._validateDecodeParams(d);d.pixelType=this._getpixelTypeAndNoData(d.pixelType);g=h.decode(g);g=new p({width:g.width,height:g.height,pixels:g.pixels,pixelType:g.pixelType,mask:g.maskData,statistics:null});g.calculateStatistics();return g},_decodeLerc:function(g,
d){if(!this._isPlatformLittleEndian)throw"lerc decoder is not supported on big endian platform";this._validateDecodeParams(d);var f=d.noDataValue;d.pixelType=this._getpixelTypeAndNoData(d.pixelType);for(var m=0,u,r=0,t,w=g.byteLength-10;r<w;){var v=k.decode(g,{inputOffset:r,encodedMaskData:u,returnMask:0===m?!0:!1,returnEncodedMask:0===m?!0:!1,returnFileInfo:!0,pixelType:d.pixelType,noDataValue:f});r=v.fileInfo.eofOffset;0===m&&(u=v.encodedMaskData,t=new p({width:d.width,height:d.height,pixels:[],
pixelType:d.pixelType,mask:v.maskData,statistics:[]}));m++;if(!this._verifyResult(v,d))throw"The decoded image dimensions are incorrect";t.addData({pixels:v.pixelData,statistics:{minValue:v.minValue,maxValue:v.maxValue,noDataValue:v.noDataValue}})}return t},_decodeLerc2:function(g,d){if(!this._isPlatformLittleEndian)throw"lerc2 decoder is not supported on big endian platform";this._validateDecodeParams(d);d.pixelType=this._getpixelTypeAndNoData(d.pixelType);for(var f=0,m,u,r,t=0,w,v=g.byteLength-
10,y=[],x,A=0;t<v;){u=c.decode(g,{inputOffset:t,maskData:m,returnFileInfo:!0});t=u.fileInfo.eofOffset;m=u.maskData;0===f&&(r=u.fileInfo.numValidPixel,w=new p({width:d.width,height:d.height,pixels:[],dimCount:u.dimCount||1,pixelType:u.fileInfo.pixelType,mask:m,statistics:[]}));u.fileInfo.mask&&0<u.fileInfo.mask.numBytes&&A++;m&&y.push(m);f++;if(!this._verifyResult(u,d))throw"The decoded image dimensions are incorrect";w.addData({pixels:u.pixelData,statistics:{minValue:u.minValue,maxValue:u.maxValue,
noDataValue:u.noDataValue,dimStats:u.dimStats}})}if(1<A){d=w.width*w.height;w.bandMasks=y;m=new Uint8Array(d);m.set(y[0]);for(r=1;r<y.length;r++)for(x=y[r],g=0;g<d;g++)m[g]&=x[g];for(g=r=0;g<d;g++)r+=x[g];w.mask=m}w.validPixelCount=r;return w},_interpolatePointGrid:function(g,d){var f=g.pixels;if(f&&0!==f.length){var m=f.length,u=g.width,r=g.mask,t=u-1,w=g.height-1,v=[],y,x;if(0===(null==d?1:d)){for(d=0;d<m;d++){var A=f[d];var C=new A.constructor(t*w);for(y=0;y<w;y++){var E=y*u;for(x=0;x<t;x++)C[y*
t+x]=A[E+x]}v.push(C)}if(r){var H=new Uint8Array(t*w);for(y=0;y<w;y++)for(E=y*u,x=0;x<t;x++)H[y*t+x]=r[E+x]}}else{for(d=0;d<m;d++){A=f[d];C=new A.constructor(t*w);for(y=0;y<w;y++)for(E=y*u,x=0;x<t;x++)C[y*t+x]=(A[E+x]+A[E+x+1]+A[E+u+x]+A[E+u+x+1])/4;v.push(C)}if(r)for(H=new Uint8Array(t*w),y=0;y<w;y++)for(E=y*u,x=0;x<t;x++)H[y*t+x]=Math.min.apply(null,[r[E+x],r[E+x+1],r[E+u+x],r[E+u+x+1]])}g.width=t;g.height=w;g.mask=H;g.pixels=v;return g}},_getpixelTypeAndNoData:function(g){return"U1"===g||"U2"===
g||"U4"===g||"U8"===g?"U8":g},_verifyResult:function(g,d){return g.height!==d.height||g.width!==d.width?!1:!0}}})},"esri/layers/rasterFormats/JpgPlus":function(){define(["dojo/_base/declare","./Zlib","./Jpg"],function(G,e,q){return G(null,{constructor:function(){},decode:function(n){var p=new Uint8Array(n);n=new q;n.parse(p);var k=n.numComponents,c=n.getData(n.width,n.height,!0),a=n.width*n.height,b=n.eof,l=0,h=0,g=0;if(b<p.length-1){h=(new e(p.subarray(b))).getBytes();var d=new Uint8Array(a);for(l=
p=0;l<h.length;l++)for(g=7;0<=g;g--)d[p++]=h[l]>>g&1}p=[];if(1===k)p=[c,c,c];else{for(l=0;3>l;l++)k=new Uint8Array(a),p.push(k);for(h=g=0;h<a;h++)for(l=0;3>l;l++)p[l][h]=c[g++]}return{width:n.width,height:n.height,pixels:p,mask:d}}})})},"esri/layers/rasterFormats/Zlib":function(){define([],function(){var G=function(){function e(){this.bufferLength=this.pos=0;this.eof=!1;this.buffer=null}e.prototype={ensureBuffer:function(q){var n=this.buffer,p=n?n.byteLength:0;if(q<p)return n;for(var k=512;k<q;)k<<=
1;q=new Uint8Array(k);for(k=0;k<p;++k)q[k]=n[k];return this.buffer=q},getByte:function(){for(var q=this.pos;this.bufferLength<=q;){if(this.eof)return null;this.readBlock()}return this.buffer[this.pos++]},getBytes:function(q){var n=this.pos;if(q){this.ensureBuffer(n+q);for(q=n+q;!this.eof&&this.bufferLength<q;)this.readBlock();var p=this.bufferLength;q>p&&(q=p)}else{for(;!this.eof;)this.readBlock();q=this.bufferLength}this.pos=q;return this.buffer.subarray(n,q)},lookChar:function(){for(var q=this.pos;this.bufferLength<=
q;){if(this.eof)return null;this.readBlock()}return String.fromCharCode(this.buffer[this.pos])},getChar:function(){for(var q=this.pos;this.bufferLength<=q;){if(this.eof)return null;this.readBlock()}return String.fromCharCode(this.buffer[this.pos++])},makeSubStream:function(q,n,p){for(var k=q+n;this.bufferLength<=k&&!this.eof;)this.readBlock();return new Stream(this.buffer,q,n,p)},skip:function(q){q||(q=1);this.pos+=q},reset:function(){this.pos=0}};return e}();return function(){function e(b){throw Error(b);
}function q(b){var l=0,h=b[l++],g=b[l++];-1!=h&&-1!=g||e("Invalid header in flate stream");8!=(h&15)&&e("Unknown compression method in flate stream");0!=((h<<8)+g)%31&&e("Bad FCHECK in flate stream");g&32&&e("FDICT bit set in flate stream");this.bytes=b;this.bytesPos=l;this.codeBuf=this.codeSize=0;G.call(this)}if(!self||!self.Uint32Array)return null;var n=new Uint32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),p=new Uint32Array([3,4,5,6,7,8,9,10,65547,65549,65551,65553,131091,131095,131099,
131103,196643,196651,196659,196667,262211,262227,262243,262259,327811,327843,327875,327907,258,258,258]),k=new Uint32Array([1,2,3,4,65541,65543,131081,131085,196625,196633,262177,262193,327745,327777,393345,393409,459009,459137,524801,525057,590849,591361,657409,658433,724993,727041,794625,798721,868353,876545]),c=[new Uint32Array([459008,524368,524304,524568,459024,524400,524336,590016,459016,524384,524320,589984,524288,524416,524352,590048,459012,524376,524312,589968,459028,524408,524344,590032,
459020,524392,524328,59E4,524296,524424,524360,590064,459010,524372,524308,524572,459026,524404,524340,590024,459018,524388,524324,589992,524292,524420,524356,590056,459014,524380,524316,589976,459030,524412,524348,590040,459022,524396,524332,590008,524300,524428,524364,590072,459009,524370,524306,524570,459025,524402,524338,590020,459017,524386,524322,589988,524290,524418,524354,590052,459013,524378,524314,589972,459029,524410,524346,590036,459021,524394,524330,590004,524298,524426,524362,590068,
459011,524374,524310,524574,459027,524406,524342,590028,459019,524390,524326,589996,524294,524422,524358,590060,459015,524382,524318,589980,459031,524414,524350,590044,459023,524398,524334,590012,524302,524430,524366,590076,459008,524369,524305,524569,459024,524401,524337,590018,459016,524385,524321,589986,524289,524417,524353,590050,459012,524377,524313,589970,459028,524409,524345,590034,459020,524393,524329,590002,524297,524425,524361,590066,459010,524373,524309,524573,459026,524405,524341,590026,
459018,524389,524325,589994,524293,524421,524357,590058,459014,524381,524317,589978,459030,524413,524349,590042,459022,524397,524333,590010,524301,524429,524365,590074,459009,524371,524307,524571,459025,524403,524339,590022,459017,524387,524323,589990,524291,524419,524355,590054,459013,524379,524315,589974,459029,524411,524347,590038,459021,524395,524331,590006,524299,524427,524363,590070,459011,524375,524311,524575,459027,524407,524343,590030,459019,524391,524327,589998,524295,524423,524359,590062,
459015,524383,524319,589982,459031,524415,524351,590046,459023,524399,524335,590014,524303,524431,524367,590078,459008,524368,524304,524568,459024,524400,524336,590017,459016,524384,524320,589985,524288,524416,524352,590049,459012,524376,524312,589969,459028,524408,524344,590033,459020,524392,524328,590001,524296,524424,524360,590065,459010,524372,524308,524572,459026,524404,524340,590025,459018,524388,524324,589993,524292,524420,524356,590057,459014,524380,524316,589977,459030,524412,524348,590041,
459022,524396,524332,590009,524300,524428,524364,590073,459009,524370,524306,524570,459025,524402,524338,590021,459017,524386,524322,589989,524290,524418,524354,590053,459013,524378,524314,589973,459029,524410,524346,590037,459021,524394,524330,590005,524298,524426,524362,590069,459011,524374,524310,524574,459027,524406,524342,590029,459019,524390,524326,589997,524294,524422,524358,590061,459015,524382,524318,589981,459031,524414,524350,590045,459023,524398,524334,590013,524302,524430,524366,590077,
459008,524369,524305,524569,459024,524401,524337,590019,459016,524385,524321,589987,524289,524417,524353,590051,459012,524377,524313,589971,459028,524409,524345,590035,459020,524393,524329,590003,524297,524425,524361,590067,459010,524373,524309,524573,459026,524405,524341,590027,459018,524389,524325,589995,524293,524421,524357,590059,459014,524381,524317,589979,459030,524413,524349,590043,459022,524397,524333,590011,524301,524429,524365,590075,459009,524371,524307,524571,459025,524403,524339,590023,
459017,524387,524323,589991,524291,524419,524355,590055,459013,524379,524315,589975,459029,524411,524347,590039,459021,524395,524331,590007,524299,524427,524363,590071,459011,524375,524311,524575,459027,524407,524343,590031,459019,524391,524327,589999,524295,524423,524359,590063,459015,524383,524319,589983,459031,524415,524351,590047,459023,524399,524335,590015,524303,524431,524367,590079]),9],a=[new Uint32Array([327680,327696,327688,327704,327684,327700,327692,327708,327682,327698,327690,327706,
327686,327702,327694,0,327681,327697,327689,327705,327685,327701,327693,327709,327683,327699,327691,327707,327687,327703,327695,0]),5];q.prototype=Object.create(G.prototype);q.prototype.getBits=function(b){for(var l=this.codeSize,h=this.codeBuf,g=this.bytes,d=this.bytesPos,f;l<b;)"undefined"==typeof(f=g[d++])&&e("Bad encoding in flate stream"),h|=f<<l,l+=8;this.codeBuf=h>>b;this.codeSize=l-=b;this.bytesPos=d;return h&(1<<b)-1};q.prototype.getCode=function(b){var l=b[0],h=b[1];b=this.codeSize;for(var g=
this.codeBuf,d=this.bytes,f=this.bytesPos;b<h;){var m;"undefined"==typeof(m=d[f++])&&e("Bad encoding in flate stream");g|=m<<b;b+=8}h=l[g&(1<<h)-1];l=h>>16;h&=65535;(0==b||b<l||0==l)&&e("Bad encoding in flate stream");this.codeBuf=g>>l;this.codeSize=b-l;this.bytesPos=f;return h};q.prototype.generateHuffmanTable=function(b){for(var l=b.length,h=0,g=0;g<l;++g)b[g]>h&&(h=b[g]);for(var d=1<<h,f=new Uint32Array(d),m=1,u=0,r=2;m<=h;++m,u<<=1,r<<=1)for(var t=0;t<l;++t)if(b[t]==m){var w=0,v=u;for(g=0;g<m;++g)w=
w<<1|v&1,v>>=1;for(g=w;g<d;g+=r)f[g]=m<<16|t;++u}return[f,h]};q.prototype.readBlock=function(){function b(w,v,y,x,A){for(w=w.getBits(y)+x;0<w--;)v[u++]=A}var l=this.getBits(3);l&1&&(this.eof=!0);l>>=1;if(0==l){var h=this.bytes,g=this.bytesPos,d;"undefined"==typeof(d=h[g++])&&e("Bad block header in flate stream");var f=d;"undefined"==typeof(d=h[g++])&&e("Bad block header in flate stream");f|=d<<8;"undefined"==typeof(d=h[g++])&&e("Bad block header in flate stream");l=d;"undefined"==typeof(d=h[g++])&&
e("Bad block header in flate stream");(l|d<<8)!=(~f&65535)&&e("Bad uncompressed block length in flate stream");this.codeSize=this.codeBuf=0;d=this.bufferLength;l=this.ensureBuffer(d+f);this.bufferLength=f=d+f;for(var m=d;m<f;++m){if("undefined"==typeof(d=h[g++])){this.eof=!0;break}l[m]=d}this.bytesPos=g}else{if(1==l)g=c,d=a;else if(2==l){l=this.getBits(5)+257;d=this.getBits(5)+1;h=this.getBits(4)+4;g=Array(n.length);for(var u=0;u<h;)g[n[u++]]=this.getBits(3);g=this.generateHuffmanTable(g);u=h=0;d=
l+d;for(f=Array(d);u<d;)m=this.getCode(g),16==m?b(this,f,2,3,h):17==m?b(this,f,3,3,h=0):18==m?b(this,f,7,11,h=0):f[u++]=h=m;g=this.generateHuffmanTable(f.slice(0,l));d=this.generateHuffmanTable(f.slice(l,d))}else e("Unknown block type in flate stream");f=(l=this.buffer)?l.length:0;for(m=this.bufferLength;;){var r=this.getCode(g);if(256>r)m+1>=f&&(l=this.ensureBuffer(m+1),f=l.length),l[m++]=r;else{if(256==r){this.bufferLength=m;break}r-=257;r=p[r];var t=r>>16;0<t&&(t=this.getBits(t));h=(r&65535)+t;
r=this.getCode(d);r=k[r];t=r>>16;0<t&&(t=this.getBits(t));r=(r&65535)+t;m+h>=f&&(l=this.ensureBuffer(m+h),f=l.length);for(t=0;t<h;++t,++m)l[m]=l[m-r]}}}};return q}()})},"esri/layers/rasterFormats/Jpg":function(){define([],function(){var G=function(){function e(q){this.message="JPEG error: "+q}e.prototype=Error();e.prototype.name="JpegError";return e.constructor=e}();return function(){function e(){this.decodeTransform=null;this.colorTransform=-1}function q(a,b){for(var l=0,h=[],g,d,f=16;0<f&&!a[f-
1];)f--;h.push({children:[],index:0});var m=h[0],u;for(g=0;g<f;g++){for(d=0;d<a[g];d++){m=h.pop();for(m.children[m.index]=b[l];0<m.index;)m=h.pop();m.index++;for(h.push(m);h.length<=g;)h.push(u={children:[],index:0}),m.children[m.index]=u.children,m=u;l++}g+1<f&&(h.push(u={children:[],index:0}),m.children[m.index]=u.children,m=u)}return h[0].children}function n(a,b,l,h,g,d,f,m,u){function r(){if(0<F)return F--,z>>F&1;z=a[b++];if(255===z){var I=a[b++];if(I)throw new G("unexpected marker "+(z<<8|I).toString(16));
}F=7;return z>>>7}function t(I){for(;;){I=I[r()];if("number"===typeof I)return I;if("object"!==typeof I)throw new G("invalid huffman sequence");}}function w(I){for(var J=0;0<I;)J=J<<1|r(),I--;return J}function v(I){if(1===I)return 1===r()?1:-1;var J=w(I);return J>=1<<I-1?J:J+(-1<<I)+1}function y(I,J){var M=t(I.huffmanTableDC);M=0===M?0:v(M);I.blockData[J]=I.pred+=M;for(M=1;64>M;){var O=t(I.huffmanTableAC),P=O&15;O>>=4;if(0===P){if(15>O)break;M+=16}else M+=O,I.blockData[J+c[M]]=v(P),M++}}function x(I,
J){var M=t(I.huffmanTableDC);M=0===M?0:v(M)<<u;I.blockData[J]=I.pred+=M}function A(I,J){I.blockData[J]|=r()<<u}function C(I,J){if(0<K)K--;else for(var M=d;M<=f;){var O=t(I.huffmanTableAC),P=O&15;O>>=4;if(0===P){if(15>O){K=w(O)+(1<<O)-1;break}M+=16}else M+=O,I.blockData[J+c[M]]=v(P)*(1<<u),M++}}function E(I,J){for(var M=d,O=0,P;M<=f;){P=c[M];switch(L){case 0:O=t(I.huffmanTableAC);P=O&15;O>>=4;if(0===P)15>O?(K=w(O)+(1<<O),L=4):(O=16,L=1);else{if(1!==P)throw new G("invalid ACn encoding");N=v(P);L=O?
2:3}continue;case 1:case 2:I.blockData[J+P]?I.blockData[J+P]+=r()<<u:(O--,0===O&&(L=2===L?3:0));break;case 3:I.blockData[J+P]?I.blockData[J+P]+=r()<<u:(I.blockData[J+P]=N<<u,L=0);break;case 4:I.blockData[J+P]&&(I.blockData[J+P]+=r()<<u)}M++}4===L&&(K--,0===K&&(L=0))}var H=l.mcusPerLine,B=b,z=0,F=0,K=0,L=0,N,Q=h.length,S,R,V,W;m=l.progressive?0===d?0===m?x:A:0===m?C:E:y;var U=0;l=1===Q?h[0].blocksPerLine*h[0].blocksPerColumn:H*l.mcusPerColumn;for(var ha,ma;U<l;){var ia=g?Math.min(l-U,g):l;for(S=0;S<
Q;S++)h[S].pred=0;K=0;if(1===Q){var D=h[0];for(W=0;W<ia;W++)m(D,64*((D.blocksPerLine+1)*(U/D.blocksPerLine|0)+U%D.blocksPerLine)),U++}else for(W=0;W<ia;W++){for(S=0;S<Q;S++)for(D=h[S],ha=D.h,ma=D.v,R=0;R<ma;R++)for(V=0;V<ha;V++)m(D,64*((D.blocksPerLine+1)*((U/H|0)*D.v+R)+(U%H*D.h+V)));U++}F=0;(D=k(a,b))&&D.invalid&&(console.log("decodeScan - unexpected MCU data, next marker is: "+D.invalid),b=D.offset);D=D&&D.marker;if(!D||65280>=D)throw new G("marker was not found");if(65488<=D&&65495>=D)b+=2;else break}(D=
k(a,b))&&D.invalid&&(console.log("decodeScan - unexpected Scan data, next marker is: "+D.invalid),b=D.offset);return b-B}function p(a,b){a=b.blocksPerLine;for(var l=b.blocksPerColumn,h=new Int16Array(64),g=0;g<l;g++)for(var d=0;d<a;d++){var f=void 0,m=void 0,u=void 0,r=void 0,t=void 0,w=void 0,v=void 0,y=void 0,x=t=w=r=m=f=void 0,A=void 0,C=void 0,E=void 0,H=64*((b.blocksPerLine+1)*g+d),B=h,z=b.quantizationTable,F=b.blockData;if(!z)throw new G("missing required Quantization Table.");for(var K=0;64>
K;K+=8)f=F[H+K],y=F[H+K+1],v=F[H+K+2],w=F[H+K+3],t=F[H+K+4],r=F[H+K+5],u=F[H+K+6],m=F[H+K+7],f*=z[K],0===(y|v|w|t|r|u|m)?(f=5793*f+512>>10,B[K]=f,B[K+1]=f,B[K+2]=f,B[K+3]=f,B[K+4]=f,B[K+5]=f,B[K+6]=f,B[K+7]=f):(y*=z[K+1],v*=z[K+2],w*=z[K+3],t*=z[K+4],r*=z[K+5],u*=z[K+6],m*=z[K+7],E=5793*f+128>>8,C=5793*t+128>>8,A=v,x=u,t=2896*(y-m)+128>>8,m=2896*(y+m)+128>>8,w<<=4,r<<=4,E=E+C+1>>1,C=E-C,f=3784*A+1567*x+128>>8,A=1567*A-3784*x+128>>8,x=f,t=t+r+1>>1,r=t-r,m=m+w+1>>1,w=m-w,E=E+x+1>>1,x=E-x,C=C+A+1>>1,
A=C-A,f=2276*t+3406*m+2048>>12,t=3406*t-2276*m+2048>>12,m=f,f=799*w+4017*r+2048>>12,w=4017*w-799*r+2048>>12,r=f,B[K]=E+m,B[K+7]=E-m,B[K+1]=C+r,B[K+6]=C-r,B[K+2]=A+w,B[K+5]=A-w,B[K+3]=x+t,B[K+4]=x-t);for(z=0;8>z;++z)f=B[z],y=B[z+8],v=B[z+16],w=B[z+24],t=B[z+32],r=B[z+40],u=B[z+48],m=B[z+56],0===(y|v|w|t|r|u|m)?(f=5793*f+8192>>14,f=-2040>f?0:2024<=f?255:f+2056>>4,F[H+z]=f,F[H+z+8]=f,F[H+z+16]=f,F[H+z+24]=f,F[H+z+32]=f,F[H+z+40]=f,F[H+z+48]=f,F[H+z+56]=f):(E=5793*f+2048>>12,C=5793*t+2048>>12,A=v,x=u,
t=2896*(y-m)+2048>>12,m=2896*(y+m)+2048>>12,E=(E+C+1>>1)+4112,C=E-C,f=3784*A+1567*x+2048>>12,A=1567*A-3784*x+2048>>12,x=f,t=t+r+1>>1,r=t-r,m=m+w+1>>1,w=m-w,E=E+x+1>>1,x=E-x,C=C+A+1>>1,A=C-A,f=2276*t+3406*m+2048>>12,t=3406*t-2276*m+2048>>12,m=f,f=799*w+4017*r+2048>>12,w=4017*w-799*r+2048>>12,r=f,f=E+m,m=E-m,y=C+r,u=C-r,v=A+w,r=A-w,w=x+t,t=x-t,f=16>f?0:4080<=f?255:f>>4,y=16>y?0:4080<=y?255:y>>4,v=16>v?0:4080<=v?255:v>>4,w=16>w?0:4080<=w?255:w>>4,t=16>t?0:4080<=t?255:t>>4,r=16>r?0:4080<=r?255:r>>4,u=
16>u?0:4080<=u?255:u>>4,m=16>m?0:4080<=m?255:m>>4,F[H+z]=f,F[H+z+8]=y,F[H+z+16]=v,F[H+z+24]=w,F[H+z+32]=t,F[H+z+40]=r,F[H+z+48]=u,F[H+z+56]=m)}return b.blockData}function k(a,b,l){var h=a.length-1;l=l<b?l:b;if(b>=h)return null;var g=a[b]<<8|a[b+1];if(65472<=g&&65534>=g)return{invalid:null,marker:g,offset:b};for(b=a[l]<<8|a[l+1];!(65472<=b&&65534>=b);){if(++l>=h)return null;b=a[l]<<8|a[l+1]}return{invalid:g.toString(16),marker:b,offset:l}}if(!self||!self.Uint8ClampedArray)return null;var c=new Uint8Array([0,
1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]);e.prototype={parse:function(a){function b(){var z=a[g]<<8|a[g+1];g+=2;return z}function l(){var z=b();z=g+z-2;var F=k(a,z,g);F&&F.invalid&&(console.log("readDataBlock - incorrect length, next marker is: "+F.invalid),z=F.offset);z=a.subarray(g,z);g+=z.length;return z}function h(z){for(var F=Math.ceil(z.samplesPerLine/8/
z.maxH),K=Math.ceil(z.scanLines/8/z.maxV),L=0;L<z.components.length;L++){B=z.components[L];var N=Math.ceil(Math.ceil(z.samplesPerLine/8)*B.h/z.maxH),Q=Math.ceil(Math.ceil(z.scanLines/8)*B.v/z.maxV);B.blockData=new Int16Array(64*K*B.v*(F*B.h+1));B.blocksPerLine=N;B.blocksPerColumn=Q}z.mcusPerLine=F;z.mcusPerColumn=K}var g=0,d=null,f=null,m=[],u=[],r=[],t=b();if(65496!==t)throw new G("SOI not found");for(t=b();65497!==t;){switch(t){case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:var w=
l();65504===t&&74===w[0]&&70===w[1]&&73===w[2]&&70===w[3]&&0===w[4]&&(d={version:{major:w[5],minor:w[6]},densityUnits:w[7],xDensity:w[8]<<8|w[9],yDensity:w[10]<<8|w[11],thumbWidth:w[12],thumbHeight:w[13],thumbData:w.subarray(14,14+3*w[12]*w[13])});65518===t&&65===w[0]&&100===w[1]&&111===w[2]&&98===w[3]&&101===w[4]&&(f={version:w[5]<<8|w[6],flags0:w[7]<<8|w[8],flags1:w[9]<<8|w[10],transformCode:w[11]});break;case 65499:t=b()+g-2;for(var v;g<t;){var y=a[g++],x=new Uint16Array(64);if(0===y>>4)for(w=
0;64>w;w++)v=c[w],x[v]=a[g++];else if(1===y>>4)for(w=0;64>w;w++)v=c[w],x[v]=b();else throw new G("DQT - invalid table spec");m[y&15]=x}break;case 65472:case 65473:case 65474:if(A)throw new G("Only single frame JPEGs supported");b();var A={};A.extended=65473===t;A.progressive=65474===t;A.precision=a[g++];A.scanLines=b();A.samplesPerLine=b();A.components=[];A.componentIds={};w=a[g++];for(t=x=y=0;t<w;t++){v=a[g];var C=a[g+1]>>4;var E=a[g+1]&15;y<C&&(y=C);x<E&&(x=E);C=A.components.push({h:C,v:E,quantizationId:a[g+
2],quantizationTable:null});A.componentIds[v]=C-1;g+=3}A.maxH=y;A.maxV=x;h(A);break;case 65476:v=b();for(t=2;t<v;){y=a[g++];x=new Uint8Array(16);for(w=C=0;16>w;w++,g++)C+=x[w]=a[g];E=new Uint8Array(C);for(w=0;w<C;w++,g++)E[w]=a[g];t+=17+C;(0===y>>4?r:u)[y&15]=q(x,E)}break;case 65501:b();var H=b();break;case 65498:b();v=a[g++];w=[];for(t=0;t<v;t++){y=A.componentIds[a[g++]];var B=A.components[y];y=a[g++];B.huffmanTableDC=r[y>>4];B.huffmanTableAC=u[y&15];w.push(B)}t=a[g++];v=a[g++];y=a[g++];t=n(a,g,
A,w,H,t,v,y>>4,y&15);g+=t;break;case 65535:255!==a[g]&&g--;break;default:if(255===a[g-3]&&192<=a[g-2]&&254>=a[g-2])g-=3;else throw new G("unknown marker "+t.toString(16));}t=b()}this.width=A.samplesPerLine;this.height=A.scanLines;this.jfif=d;this.eof=g;this.adobe=f;this.components=[];for(t=0;t<A.components.length;t++){B=A.components[t];if(d=m[B.quantizationId])B.quantizationTable=d;this.components.push({output:p(A,B),scaleX:B.h/A.maxH,scaleY:B.v/A.maxV,blocksPerLine:B.blocksPerLine,blocksPerColumn:B.blocksPerColumn})}this.numComponents=
this.components.length},_getLinearizedBlockData:function(a,b){var l=this.width/a,h=this.height/b,g,d,f=0,m=this.components.length,u=a*b*m,r=new Uint8ClampedArray(u),t=new Uint32Array(a);for(d=0;d<m;d++){var w=this.components[d];var v=w.scaleX*l;var y=w.scaleY*h;f=d;var x=w.output;var A=w.blocksPerLine+1<<3;for(g=0;g<a;g++)w=0|g*v,t[g]=(w&4294967288)<<3|w&7;for(v=0;v<b;v++)for(w=0|v*y,w=A*(w&4294967288)|(w&7)<<3,g=0;g<a;g++)r[f]=x[w+t[g]],f+=m}if(b=this.decodeTransform)for(d=0;d<u;)for(a=w=0;w<m;w++,
d++,a+=2)r[d]=(r[d]*b[a]>>8)+b[a+1];return r},_isColorConversionNeeded:function(){return this.adobe?!!this.adobe.transformCode:3===this.numComponents?0===this.colorTransform?!1:!0:1===this.colorTransform?!0:!1},_convertYccToRgb:function(a){for(var b,l,h,g=0,d=a.length;g<d;g+=3)b=a[g],l=a[g+1],h=a[g+2],a[g]=b-179.456+1.402*h,a[g+1]=b+135.459-.344*l-.714*h,a[g+2]=b-226.816+1.772*l;return a},_convertYcckToRgb:function(a){for(var b,l,h,g,d=0,f=0,m=a.length;f<m;f+=4)b=a[f],l=a[f+1],h=a[f+2],g=a[f+3],a[d++]=
-122.67195406894+l*(-6.60635669420364E-5*l+4.37130475926232E-4*h-5.4080610064599E-5*b+4.8449797120281E-4*g-.154362151871126)+h*(-9.57964378445773E-4*h+8.17076911346625E-4*b-.00477271405408747*g+1.53380253221734)+b*(9.61250184130688E-4*b-.00266257332283933*g+.48357088451265)+g*(-3.36197177618394E-4*g+.484791561490776),a[d++]=107.268039397724+l*(2.19927104525741E-5*l-6.40992018297945E-4*h+6.59397001245577E-4*b+4.26105652938837E-4*g-.176491792462875)+h*(-7.78269941513683E-4*h+.00130872261408275*b+7.70482631801132E-4*
g-.151051492775562)+b*(.00126935368114843*b-.00265090189010898*g+.25802910206845)+g*(-3.18913117588328E-4*g-.213742400323665),a[d++]=-20.810012546947+l*(-5.70115196973677E-4*l-2.63409051004589E-5*h+.0020741088115012*b-.00288260236853442*g+.814272968359295)+h*(-1.53496057440975E-5*h-1.32689043961446E-4*b+5.60833691242812E-4*g-.195152027534049)+b*(.00174418132927582*b-.00255243321439347*g+.116935020465145)+g*(-3.43531996510555E-4*g+.24165260232407);return a},_convertYcckToCmyk:function(a){for(var b,
l,h,g=0,d=a.length;g<d;g+=4)b=a[g],l=a[g+1],h=a[g+2],a[g]=434.456-b-1.402*h,a[g+1]=119.541-b+.344*l+.714*h,a[g+2]=481.816-b-1.772*l;return a},_convertCmykToRgb:function(a){for(var b,l,h,g,d=0,f=1/255,m=0,u=a.length;m<u;m+=4)b=a[m]*f,l=a[m+1]*f,h=a[m+2]*f,g=a[m+3]*f,a[d++]=255+b*(-4.387332384609988*b+54.48615194189176*l+18.82290502165302*h+212.25662451639585*g-285.2331026137004)+l*(1.7149763477362134*l-5.6096736904047315*h-17.873870861415444*g-5.497006427196366)+h*(-2.5217340131683033*h-21.248923337353073*
g+17.5119270841813)-g*(21.86122147463605*g+189.48180835922747),a[d++]=255+b*(8.841041422036149*b+60.118027045597366*l+6.871425592049007*h+31.159100130055922*g-79.2970844816548)+l*(-15.310361306967817*l+17.575251261109482*h+131.35250912493976*g-190.9453302588951)+h*(4.444339102852739*h+9.8632861493405*g-24.86741582555878)-g*(20.737325471181034*g+187.80453709719578),a[d++]=255+b*(.8842522430003296*b+8.078677503112928*l+30.89978309703729*h-.23883238689178934*g-14.183576799673286)+l*(10.49593273432072*
l+63.02378494754052*h+50.606957656360734*g-112.23884253719248)+h*(.03296041114873217*h+115.60384449646641*g-193.58209356861505)-g*(22.33816807309886*g+180.12613974708367);return a},getData:function(a,b,l){if(4<this.numComponents)throw new G("Unsupported color mode");a=this._getLinearizedBlockData(a,b);if(1===this.numComponents&&l){l=a.length;b=new Uint8ClampedArray(3*l);for(var h=0,g=0;g<l;g++){var d=a[g];b[h++]=d;b[h++]=d;b[h++]=d}return b}if(3===this.numComponents&&this._isColorConversionNeeded())return this._convertYccToRgb(a);
if(4===this.numComponents){if(this._isColorConversionNeeded())return l?this._convertYcckToRgb(a):this._convertYcckToCmyk(a);if(l)return this._convertCmykToRgb(a)}return a}};return e}()})},"esri/layers/rasterFormats/Png":function(){define(["./Zlib"],function(G){return function(){function e(n){var p,k;this.data=n;this.pos=8;this.palette=[];this.imgData=[];this.transparency={};this.animation=null;this.text={};for(k=null;;){var c=this.readUInt32();var a=n=void 0;n=[];for(a=0;4>a;++a)n.push(String.fromCharCode(this.data[this.pos++]));
n=n.join("");switch(n){case "IHDR":this.width=this.readUInt32();this.height=this.readUInt32();this.bits=this.data[this.pos++];this.colorType=this.data[this.pos++];this.compressionMethod=this.data[this.pos++];this.filterMethod=this.data[this.pos++];this.interlaceMethod=this.data[this.pos++];break;case "acTL":this.animation={numFrames:this.readUInt32(),numPlays:this.readUInt32()||Infinity,frames:[]};break;case "PLTE":this.palette=this.read(c);break;case "fcTL":k&&this.animation.frames.push(k);this.pos+=
4;k={width:this.readUInt32(),height:this.readUInt32(),xOffset:this.readUInt32(),yOffset:this.readUInt32()};n=this.readUInt16();c=this.readUInt16()||100;k.delay=1E3*n/c;k.disposeOp=this.data[this.pos++];k.blendOp=this.data[this.pos++];k.data=[];break;case "IDAT":case "fdAT":"fdAT"===n&&(this.pos+=4,c-=4);n=(null!=k?k.data:void 0)||this.imgData;for(a=0;0<=c?a<c:a>c;0<=c?++a:--a)n.push(this.data[this.pos++]);break;case "tRNS":this.transparency={};switch(this.colorType){case 3:this.transparency.indexed=
this.read(c);c=255-this.transparency.indexed.length;if(0<c)for(n=0;0<=c?n<c:n>c;0<=c?++n:--n)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(c)[0];break;case 2:this.transparency.rgb=this.read(c)}break;case "tEXt":a=this.read(c);c=a.indexOf(0);n=String.fromCharCode.apply(String,a.slice(0,c));this.text[n]=String.fromCharCode.apply(String,a.slice(c+1));break;case "IEND":k&&this.animation.frames.push(k);a:{switch(this.colorType){case 0:case 3:case 4:k=1;break a;
case 2:case 6:k=3;break a}k=void 0}this.colors=k;this.hasAlphaChannel=4===(p=this.colorType)||6===p;p=this.colors+(this.hasAlphaChannel?1:0);this.pixelBitlength=this.bits*p;a:{switch(this.colors){case 1:p="DeviceGray";break a;case 3:p="DeviceRGB";break a}p=void 0}this.colorSpace=p;this.imgData=new Uint8Array(this.imgData);return;default:this.pos+=c}this.pos+=4;if(this.pos>this.data.length)throw Error("Incomplete or corrupt PNG file");}}e.load=function(n,p,k){"function"===typeof p&&(k=p);var c=new XMLHttpRequest;
c.open("GET",n,!0);c.responseType="arraybuffer";c.onload=function(){var a=new Uint8Array(c.response||c.mozResponseArrayBuffer);a=new e(a);"function"===typeof(null!=p?p.getContext:void 0)&&a.render(p);return"function"===typeof k?k(a):void 0};return c.send(null)};e.prototype.read=function(n){var p;var k=[];for(p=0;0<=n?p<n:p>n;0<=n?++p:--p)k.push(this.data[this.pos++]);return k};e.prototype.readUInt32=function(){var n=this.data[this.pos++]<<24;var p=this.data[this.pos++]<<16;var k=this.data[this.pos++]<<
8;var c=this.data[this.pos++];return n|p|k|c};e.prototype.readUInt16=function(){var n=this.data[this.pos++]<<8;var p=this.data[this.pos++];return n|p};e.prototype.decodePixels=function(n){var p,k,c,a,b,l,h,g;null==n&&(n=this.imgData);if(0===n.length)return new Uint8Array(0);n=new G(n);n=n.getBytes();var d=this.pixelBitlength/8;var f=d*this.width;var m=new Uint8Array(f*this.height);var u=n.length;for(k=a=b=0;a<u;){switch(n[a++]){case 0:for(c=p=0;p<f;c=p+=1)m[k++]=n[a++];break;case 1:for(c=l=0;l<f;c=
l+=1){p=n[a++];var r=c<d?0:m[k-d];m[k++]=(p+r)%256}break;case 2:for(c=r=0;r<f;c=r+=1){p=n[a++];var t=(c-c%d)/d;l=b&&m[(b-1)*f+t*d+c%d];m[k++]=(l+p)%256}break;case 3:for(c=g=0;g<f;c=g+=1)p=n[a++],t=(c-c%d)/d,r=c<d?0:m[k-d],l=b&&m[(b-1)*f+t*d+c%d],m[k++]=(p+Math.floor((r+l)/2))%256;break;case 4:for(c=g=0;g<f;c=g+=1){p=n[a++];t=(c-c%d)/d;r=c<d?0:m[k-d];0===b?l=h=0:(l=m[(b-1)*f+t*d+c%d],h=t&&m[(b-1)*f+(t-1)*d+c%d]);var w=r+l-h;c=Math.abs(w-r);t=Math.abs(w-l);w=Math.abs(w-h);r=c<=t&&c<=w?r:t<=w?l:h;m[k++]=
(p+r)%256}break;default:throw Error("Invalid filter algorithm: "+n[a-1]);}b++}return m};e.prototype.decodePalette=function(){var n,p,k,c,a;var b=this.palette;var l=this.transparency.indexed||[];var h=new Uint8Array((l.length||0)+b.length);var g=k=n=p=0;for(c=b.length;k<c;g=k+=3)h[p++]=b[g],h[p++]=b[g+1],h[p++]=b[g+2],h[p++]=null!=(a=l[n++])?a:255;return h};e.prototype.copyToImageData=function(n,p){var k,c;var a=this.colors;var b=null;var l=this.hasAlphaChannel;this.palette.length&&(b=null!=(k=this._decodedPalette)?
k:this._decodedPalette=this.decodePalette(),a=4,l=!0);n=n.data||n;var h=n.length;var g=b||p;k=c=0;if(1===a)for(;k<h;)a=b?4*p[k/4]:c,c=g[a++],n[k++]=c,n[k++]=c,n[k++]=c,n[k++]=l?g[a++]:this.transparency.grayscale&&this.transparency.grayscale===c?0:255,c=a;else for(;k<h;)a=b?4*p[k/4]:c,n[k++]=g[a++],n[k++]=g[a++],n[k++]=g[a++],n[k++]=l?g[a++]:this.transparency.rgb&&this.transparency.rgb[1]===g[a-3]&&this.transparency.rgb[3]===g[a-2]&&this.transparency.rgb[5]===g[a-1]?0:255,c=a};e.prototype.decode=function(){var n=
new Uint8Array(this.width*this.height*4);this.copyToImageData(n,this.decodePixels());return n};var q=function(n){(void 0).clearRect(0,0,n.width,n.height);(void 0).putImageData(n,0,0);n=new Image;n.src=(void 0).toDataURL();return n};e.prototype.decodeFrames=function(n){var p,k;if(this.animation){var c=this.animation.frames;var a=[];var b=p=0;for(k=c.length;p<k;b=++p){b=c[b];var l=n.createImageData(b.width,b.height);var h=this.decodePixels(new Uint8Array(b.data));this.copyToImageData(l,h);b.imageData=
l;a.push(b.image=q(l))}return a}};e.prototype.renderFrame=function(n,p){var k=this.animation.frames;var c=k[p];k=k[p-1];0===p&&n.clearRect(0,0,this.width,this.height);1===(null!=k?k.disposeOp:void 0)?n.clearRect(k.xOffset,k.yOffset,k.width,k.height):2===(null!=k?k.disposeOp:void 0)&&n.putImageData(k.imageData,k.xOffset,k.yOffset);0===c.blendOp&&n.clearRect(c.xOffset,c.yOffset,c.width,c.height);return n.drawImage(c.image,c.xOffset,c.yOffset)};e.prototype.animate=function(n){var p,k=this;var c=0;var a=
this.animation;var b=a.numFrames;var l=a.frames;var h=a.numPlays;return(p=function(){var g=c++%b;var d=l[g];k.renderFrame(n,g);if(1<b&&c/b<h)return k.animation._timeout=setTimeout(p,d.delay)})()};e.prototype.stopAnimation=function(){var n;return clearTimeout(null!=(n=this.animation)?n._timeout:void 0)};e.prototype.render=function(n){n._png&&n._png.stopAnimation();n._png=this;n.width=this.width;n.height=this.height;n=n.getContext("2d");if(this.animation)return this.decodeFrames(n),this.animate(n);
var p=n.createImageData(this.width,this.height);this.copyToImageData(p,this.decodePixels());return n.putImageData(p,0,0)};return e}()})},"esri/layers/rasterFormats/Raw":function(){define([],function(){return{decodeBIP:function(G,e){var q=e.pixelType,n=e.bandCount,p=[],k=e.width*e.height,c=this.getBandCount(G,e);n=n||c;var a=G.byteLength-G.byteLength%(k*this._getPixelLength(q)),b=new q(G,0,k*c),l,h,g;for(l=0;l<n;l++){var d=new q(k);for(h=0;h<k;h++)d[h]=b[h*c+l];p.push(d)}a<G.byteLength-1&&(g=this._decodeMask(G.slice(a),
e));return{pixels:p,maskData:g}},decodeBSQ:function(G,e){var q=e.pixelType,n=e.bandCount;if(void 0===n||null===n)n=this.getBandCount(G,e);var p=[],k=e.width*e.height,c=k*n,a=G.byteLength-G.byteLength%(k*this._getPixelLength(q));q=new q(G,0,c);var b;for(c=0;c<n;c++)p.push(q.subarray(c*k,(c+1)*k));a<G.byteLength-1&&(b=this._decodeMask(G.slice(a),e));return{pixels:p,maskData:b}},getBandCount:function(G,e){return Math.floor(G.byteLength/(e.width*e.height*this._getPixelLength(e.pixelType)))},_getPixelLength:function(G){var e=
1;switch(G){case Uint8Array:case Int8Array:case Uint8ClampedArray:e=1;break;case Uint16Array:case Int16Array:e=2;break;case Uint32Array:case Int32Array:case Float32Array:e=4;break;case Float64Array:e=8}return e},_decodeMask:function(G,e){var q=e.width*e.height;if(8*G.byteLength<q)return null;G=new Uint8Array(G,0,Math.ceil(q/8));e=new Uint8Array(e.width*e.height);var n=0,p=0,k=0,c=0;for(k=0;k<G.length-1;k++)for(p=G[k],c=7;0<=c;c--)e[n++]=p>>c&1;for(c=7;n<q-1;)p=G[G.length-1],e[n++]=p>>c&1,c--;return e}}})},
"esri/layers/rasterFormats/TiffDecoder":function(){define(["./Jpg","./Zlib"],function(G,e){var q=function(){var c=new ArrayBuffer(4),a=new Uint8Array(c);c=new Uint32Array(c);a[0]=1;a[1]=2;a[2]=3;a[3]=4;return 67305985===c[0]},n=function(){var c=[];c[254]="NEWSUBFILETYPE";c[255]="SUBFILETYPE";c[256]="IMAGEWIDTH";c[257]="IMAGELENGTH";c[258]="BITSPERSAMPLE";c[259]="COMPRESSION";c[262]="PHOTOMETRICINTERPRETATION";c[263]="THRESHHOLDING";c[264]="CELLWIDTH";c[265]="CELLLENGTH";c[266]="FILLORDER";c[269]=
"DOCUMENTNAME";c[270]="IMAGEDESCRIPTION";c[271]="MAKE";c[272]="MODEL";c[273]="STRIPOFFSETS";c[274]="ORIENTATION";c[277]="SAMPLESPERPIXEL";c[278]="ROWSPERSTRIP";c[279]="STRIPBYTECOUNTS";c[280]="MINSAMPLEVALUE";c[281]="MAXSAMPLEVALUE";c[282]="XRESOLUTION";c[283]="YRESOLUTION";c[284]="PLANARCONFIGURATION";c[285]="PAGENAME";c[286]="XPOSITION";c[287]="YPOSITION";c[288]="FREEOFFSETS";c[289]="FREEBYTECOUNTS";c[290]="GRAYRESPONSEUNIT";c[291]="GRAYRESPONSECURVE";c[292]="T4OPTIONS";c[293]="T6OPTIONS";c[296]=
"RESOLUTIONUNIT";c[297]="PAGENUMBER";c[300]="COLORRESPONSEUNIT";c[301]="TRANSFERFUNCTION";c[305]="SOFTWARE";c[306]="DATETIME";c[315]="ARTIST";c[316]="HOSTCOMPUTER";c[317]="PREDICTOR";c[318]="WHITEPOINT";c[319]="PRIMARYCHROMATICITIES";c[320]="COLORMAP";c[321]="HALFTONEHINTS";c[322]="TILEWIDTH";c[323]="TILELENGTH";c[324]="TILEOFFSETS";c[325]="TILEBYTECOUNTS";c[326]="BADFAXLINES";c[327]="CLEANFAXDATA";c[328]="CONSECUTIVEBADFAXLINES";c[330]="SUBIFD";c[332]="INKSET";c[333]="INKNAMES";c[334]="NUMBEROFINKS";
c[336]="DOTRANGE";c[337]="TARGETPRINTER";c[338]="EXTRASAMPLES";c[339]="SAMPLEFORMAT";c[340]="SMINSAMPLEVALUE";c[341]="SMAXSAMPLEVALUE";c[342]="TRANSFERRANGE";c[347]="JPEGTABLES";c[512]="JPEGPROC";c[513]="JPEGIFOFFSET";c[514]="JPEGIFBYTECOUNT";c[515]="JPEGRESTARTINTERVAL";c[517]="JPEGLOSSLESSPREDICTORS";c[518]="JPEGPOINTTRANSFORM";c[519]="JPEGQTABLES";c[520]="JPEGDCTABLES";c[521]="JPEGACTABLES";c[529]="YCBCRCOEFFICIENTS";c[530]="YCBCRSUBSAMPLING";c[531]="YCBCRPOSITIONING";c[532]="REFERENCEBLACKWHITE";
c[33550]="GEOPIXELSCALE";c[33922]="GEOTIEPOINTS";c[33432]="COPYRIGHT";c[42112]="GDAL_METADATA";c[42113]="GDAL_NODATA";c[50844]="RPCCOEFFICIENT";c[34735]="GEOKEYDIRECTORY";c[34736]="GEODOUBLEPARAMS";c[34737]="GEOASCIIPARAMS";return c}(),p=[0,1,1,2,4,8,1,1,2,4,8,4,8],k=function(c,a){var b="UNKNOWN";3===c?b="F32":1===c?8>=a?b="U8":16>=a?b="U16":32>=a&&(b="U32"):2===c&&(8>=a?b="S8":16>=a?b="S16":32>=a&&(b="S32"));return b};return{decode:function(c){var a=new DataView(c,0,8),b=a.getUint16(0,!1);if(18761===
b)var l=!0;else if(19789===b)l=!1;else throw"unexpected endianess byte";if(42!==a.getUint16(2,l))throw"unexpected tiff identifier";var h=a.getUint32(4,l);var g=l;var d,f;var m=h;for(var u=[];m;){var r=(new DataView(c,m,2)).getUint16(0,g);var t=m+2;m=(new DataView(c,t+12*r,4)).getUint32(0,g);var w={};for(d=0;d<r;d++){var v=new DataView(c,t,12);var y=v.getUint16(0,g);var x=v.getUint16(2,g);var A=v.getUint32(4,g);var C=v.getUint32(8,g);t+=12;if(!(7===x||12<x)){var E=f={fieldTag:y,fieldType:x,fieldValueCount:A,
fieldValueOffset:C},H=void 0,B=void 0,z=c,F=g,K=[],L=f.fieldType,N=f.fieldValueCount,Q=f.fieldValueOffset,S=Q,R=p[L],V=8*R,W=N*R,U=N*p[L]*8;if(32>=U)if(F||(Q>>>=32-U),1===N)K=[Q];else for(H=0;H<N;H++)K.push(Q<<V*H>>>32-V);else for(S=Q;S<Q+W;S+=R){switch(L){case 1:B=(new DataView(z,S,1)).getUint8(0);break;case 2:B=(new DataView(z,S,1)).getUint8(0);break;case 3:B=(new DataView(z,S,2)).getUint16(0,F);break;case 4:B=(new DataView(z,S,4)).getUint32(0,F);break;case 5:B=(new DataView(z,S,4)).getUint32(0,
F)/(new DataView(z,S+4,4)).getUint32(0,F);break;case 6:B=(new DataView(z,S,1)).getInt8(0);break;case 8:B=(new DataView(z,S,2)).getInt16(0,F);break;case 9:B=(new DataView(z,S,4)).getInt32(0,F);break;case 10:B=(new DataView(z,S,4)).getInt32(0,F)/(new DataView(z,S+4,4)).getInt32(0,F);break;case 11:B=(new DataView(z,S,4)).getFloat32(0,F);break;case 12:B=(new DataView(z,S,8)).getFloat64(0,F);break;case 7:B=null;break;default:B=null}K.push(B)}if(2===L){var ha="",ma=K;K=[];for(H=0;H<ma.length;H++)0===ma[H]&&
""!==ha?(K.push(ha),ha=""):ha+=String.fromCharCode(ma[H]);""===ha&&0!==K.length||K.push(ha)}E.fieldValues=K;var ia=w,D=n[y];void 0===D&&(D="unknown"+y);ia[D]={type:x,values:f.fieldValues}}}u.push(w)}if(0===u.length)throw"no valid image file directory";var I,J=u[0],M=void 0===J.GDAL_NODATA||null===J.GDAL_NODATA?null:parseFloat(J.GDAL_NODATA.values[0]);if(J.TILEOFFSETS){var O=q()===g,P=J.TILEOFFSETS?J.TILEOFFSETS.values:void 0;if(void 0===P)var T=void 0;else{var X=J.TILEBYTECOUNTS.values,na=J.TILEWIDTH.values[0],
Ca=J.TILELENGTH.values[0],Da=J.IMAGEWIDTH.values[0],Sa=J.IMAGELENGTH.values[0],pa=Da*Sa,ja=J.BITSPERSAMPLE.values[0],ca=J.SAMPLESPERPIXEL.values[0],Ea=J.SAMPLEFORMAT?J.SAMPLEFORMAT.values[0]:1,Ma=k(Ea,ja);if(1!==(J.PLANARCONFIGURATION?J.PLANARCONFIGURATION.values[0]:1))throw console.log("can only handle PLANARCONFIGURATION\x3d1"),"can only handle PLANARCONFIGURATION\x3d1";var oa=J.COMPRESSION?J.COMPRESSION.values[0]:1;if(1!==oa&&6!==oa&&8!==oa&&32946!==oa)throw console.log("this compression is not supported at this moment"),
"this compression is not supported at this moment";if(3<Ea)T=void 0;else{if(3===Ea){var qa=new Float32Array(pa*ca);var ua=Float32Array}else 1===Ea?8>=ja?(qa=new Uint8Array(pa*ca),ua=Uint8Array):16>=ja?(qa=new Uint16Array(pa*ca),ua=Uint16Array):32>=ja&&(qa=new Uint32Array(pa*ca),ua=Uint32Array):2===Ea&&(8>=ja?(qa=new Int8Array(pa*ca),ua=Int8Array):16>=ja?(qa=new Int16Array(pa*ca),ua=Int16Array):32>=ja&&(qa=new Int32Array(pa*ca),ua=Int32Array));var Z,Fa,da,Ga,Ta,Ya=Math.ceil(Da/na);if(0===ja%8)for(Z=
0;Z<P.length;Z++){var Za=Math.floor(Z/Ya)*Ca;var $a=Z%Ya*na;var ab=(Za*Da+$a)*ca;if("U8"===Ma||"S8"===Ma||O)if(8===oa||32946===oa){var aa=new Uint8Array(c,P[Z],X[Z]);var Ua=new e(aa);var bb=Ua.getBytes();var ra=new ArrayBuffer(bb.length);aa=new Uint8Array(ra);aa.set(bb);aa.length!==na*Ca*ca*ja/8&&console.log("tile byte counts is different than expected")}else if(6===oa){aa=new Uint8Array(c,P[Z],X[Z]);var Na=new G;Na.parse(aa);var cb=Na.getData(Na.width,Na.height);ra=new ArrayBuffer(cb.length);aa=
new Uint8Array(ra);aa.set(cb)}else 1===oa&&(X[Z]!==na*Ca*ca*ja/8&&console.log("tile byte counts is different than expected"),ra=c.slice(P[Z],P[Z]+X[Z]));else{if(8===oa||32946===oa){aa=new Uint8Array(c,P[Z],X[Z]);Ua=new e(aa);aa=Ua.getBytes();ra=new ArrayBuffer(aa.length);var Aa=new Uint8Array(ra);aa.length!==na*Ca*ca*ja/8&&console.log("tile byte counts is different than expected")}else 1===oa&&(X[Z]!==na*Ca*ca*ja/8&&console.log("tile byte counts is different than expected"),ra=new ArrayBuffer(X[Z]),
aa=new Uint8Array(c,P[Z],X[Z]),Aa=new Uint8Array(ra));switch(Ma){case "U16":case "S16":for(da=0;da<aa.length;da+=2)Aa[da]=aa[da+1],Aa[da+1]=aa[da];break;case "U32":case "S32":case "F32":for(da=0;da<aa.length;da+=4)Aa[da]=aa[da+3],Aa[da+1]=aa[da+2],Aa[da+2]=aa[da+1],Aa[da+3]=aa[da]}}var hb=new ua(ra);var Va=0;var Wa=ab;var ib=Math.min(na,Da-$a);var jb=Math.min(Ca,Sa-Za);for(Ga=0;Ga<jb;Ga++)for(Wa=ab+Ga*Da*ca,Va=Ga*na*ca,Ta=0;Ta<ib*ca;Ta++,Wa++,Va++)qa[Wa]=hb[Va]}var Oa={width:Da,height:Sa,pixelType:Ma};
if(1===ca)Oa.pixels=[qa];else for(Oa.pixels=[],Z=0;Z<ca;Z++){var db=new ua(pa);for(Fa=0;Fa<pa;Fa++)db[Fa]=qa[Fa*ca+Z];Oa.pixels.push(db)}T=Oa}}}else if(J.STRIPOFFSETS){var kb=q()===g,va=J.STRIPOFFSETS?J.STRIPOFFSETS.values:void 0;if(void 0===va)T=void 0;else{var wa=J.STRIPBYTECOUNTS.values,Ha=J.ROWSPERSTRIP.values,xa=J.IMAGEWIDTH.values[0],Ia=J.IMAGELENGTH.values[0],ya=xa*Ia,ka=J.BITSPERSAMPLE.values[0],fa=J.SAMPLESPERPIXEL.values[0],Ja=J.SAMPLEFORMAT?J.SAMPLEFORMAT.values[0]:1,Pa=k(Ja,ka);if(1!==
(J.PLANARCONFIGURATION?J.PLANARCONFIGURATION.values[0]:1))throw console.log("can only handle PLANARCONFIGURATION\x3d1"),"can only handle PLANARCONFIGURATION\x3d1";var la=J.COMPRESSION?J.COMPRESSION.values[0]:1;if(1!==la&&6!==la&&8!==la&&32946!==la)throw console.log("compressed tiff is not supported at this moment"),"compressed tiff is not supported at this moment";if(3<Ja)T=void 0;else{if(3===Ja){var sa=new Float32Array(ya*fa);var za=Float32Array}else 1===Ja?8>=ka?(sa=new Uint8Array(ya*fa),za=Uint8Array):
16>=ka?(sa=new Uint16Array(ya*fa),za=Uint16Array):32>=ka&&(sa=new Uint32Array(ya*fa),za=Uint32Array):2===Ja&&(8>=ka?(sa=new Int8Array(ya*fa),za=Int8Array):16>=ka?(sa=new Int16Array(ya*fa),za=Int16Array):32>=ka&&(sa=new Int32Array(xa*Ia*fa),za=Int32Array));var Y,Ka,ea,La=Ha;if(0===ka%8)for(Y=0;Y<va.length;Y++){var lb=Y*Ha*xa*fa;La=(Y+1)*Ha>Ia?Ia-Y*Ha:Ha;if("U8"===Pa||"S8"===Pa||kb)if(8===la||32946===la){var ba=new Uint8Array(c,va[Y],wa[Y]);var Xa=new e(ba);var eb=Xa.getBytes();var ta=new ArrayBuffer(eb.length);
ba=new Uint8Array(ta);ba.set(eb);ba.length!==La*xa*fa*ka/8&&console.log("strip byte counts is different than expected")}else if(6===la){ba=new Uint8Array(c,va[Y],wa[Y]);var Qa=new G;Qa.parse(ba);var fb=Qa.getData(Qa.width,Qa.height);ta=new ArrayBuffer(fb.length);ba=new Uint8Array(ta);ba.set(fb)}else 1===la&&(wa[Y]!==La*xa*fa*ka/8&&console.log("strip byte counts is different than expected"),ta=c.slice(va[Y],va[Y]+wa[Y]));else{if(6===la||8===la||32946===la){ba=new Uint8Array(c,va[Y],wa[Y]);Xa=new e(ba);
ba=Xa.getBytes();ta=new ArrayBuffer(ba.length);var Ba=new Uint8Array(ta);ba.length!==La*xa*fa*ka/8&&console.log("strip byte counts is different than expected")}else 1===la&&(wa[Y]!==La*xa*fa*ka/8&&console.log("strip byte counts is different than expected"),ta=new ArrayBuffer(wa[Y]),ba=new Uint8Array(c,va[Y],wa[Y]),Ba=new Uint8Array(ta));switch(Pa){case "U16":case "S16":for(ea=0;ea<ba.length;ea+=2)Ba[ea]=ba[ea+1],Ba[ea+1]=ba[ea];break;case "U32":case "S32":case "F32":for(ea=0;ea<ba.length;ea+=4)Ba[ea]=
ba[ea+3],Ba[ea+1]=ba[ea+2],Ba[ea+2]=ba[ea+1],Ba[ea+3]=ba[ea]}}var mb=new za(ta);sa.set(mb,lb)}var Ra={width:xa,height:Ia,pixelType:Pa};if(1===fa)Ra.pixels=[sa];else for(Ra.pixels=[],Y=0;Y<fa;Y++){var gb=new za(ya);for(Ka=0;Ka<ya;Ka++)gb[Ka]=sa[Ka*fa+Y];Ra.pixels.push(gb)}T=Ra}}}if(null!==M){T.maskData=new Uint8Array(T.width*T.height);if(1E24<Math.abs(M))for(I=0;I<T.width*T.height;I++)T.maskData[I]=1E-6>Math.abs((T.pixels[0][I]-M)/M)?0:1;else for(I=0;I<T.width*T.height;I++)T.maskData[I]=T.pixels[0][I]===
M?0:1;T.noDataValue=M}return T}}})},"esri/layers/rasterLib/tile/RasterHandler":function(){define("require exports module dojo/Deferred dojo/promise/all ../../PixelBlock ../../vectorTiles/core/workers ../../vectorTiles/core/promiseUtils ../../vectorTiles/core/requireUtils ../../vectorTiles/request ../../rasterLib/function/rasterFunctionHelper ../../rasterLib/renderer/rasterRendererHelper".split(" "),function(G,e,q,n,p,k,c,a,b,l,h,g){function d(f){var m=new n;p(f).then(function(u){m.resolve()});return m.promise}
return function(){function f(m){this.customModules=m&&m.customModules}f.prototype.destroy=function(){this.stop();this.customModules=this.rasterLayer=null};f.prototype.start=function(){this.stop();var m=new n,u=0,r=this.customModules?this.customModules.length+1:1,t=b.getAbsMid("esri/layers/rasterLib/tile/RasterWorker",G,q),w=c.open(t,{client:this}).then(function(v){this._connection=v;u++;u===r&&(this._connected=!0,m.resolve())}.bind(this));this._openDL=[w];this.customModules&&this.customModules.forEach(function(v){w=
c.open(v,{client:this}).then(function(y){u++;u===r&&(this._connected=!0,m.resolve())});this._openDL.push(w);console.log(v)}.bind(this));return this._connectionPromise=m.promise};f.prototype.stop=function(){this._openDL?this._openDL.forEach(function(m){m.isFulfilled()||m.cancel()}.bind(this)):this._connectionPromise&&!this._connectionPromise.isFulfilled()&&this._connectionPromise.cancel();this._connection&&(this._connection.close(),this._connection=null)};f.prototype.decode=function(m){if(!this._connectionPromise.isFulfilled()||
!this._connection)return a.reject(Error("no connection"));var u={id:null};return this._connection.invoke("decode",m,[],u).then(function(r){r.targetWorker=u;return r})};f.prototype.process=function(m){if(!this._connectionPromise.isFulfilled()||!this._connection)return a.reject(Error("no connection"));var u={id:null};m.layerId=this.rasterLayer.layerId;var r=new n;this._connection.invoke("process",m,[],u).then(function(t){t.targetWorker=u;t.src?Object.keys(t.src).forEach(function(w){t.src[w].pixelBlock=
new k(t.src[w].pixelBlock)}):t.src=null;t.pixelBlock&&(t.pixelBlock=new k(t.pixelBlock));r.resolve(t)});return r.promise};f.prototype.render=function(m){if(!this._connectionPromise.isFulfilled()||!this._connection)return a.reject(Error("no connection"));var u={id:null};m.layerId=this.rasterLayer.layerId;return this._connection.invoke("render",m,[],u).then(function(r){r.targetWorker=u;r.pixelBlock=r.pixelBlock?new k(r.pixelBlock):null;return r})};f.prototype.setLayer=function(m){if(!this._connectionPromise.isFulfilled()||
!this._connection)return a.reject(Error("no connection"));this.rasterLayer=m;m=this._connection.broadcast("setLayer",m,[],{id:null});return d(m)};f.prototype.setRasterFunction=function(m){if(!this._connectionPromise.isFulfilled()||!this._connection)return a.reject(Error("no connection"));m=this._connection.broadcast("setRasterFunction",m,[],{id:null});return d(m)};f.prototype.setRasterRenderer=function(m){if(!this._connectionPromise.isFulfilled()||!this._connection)return a.reject(Error("no connection"));
m=this._connection.broadcast("setRasterRenderer",m,[],{id:null});return d(m)};return f}()})},"esri/layers/vectorTiles/core/workers":function(){define(["require","exports","./workers/workers"],function(G,e,q){Object.defineProperty(e,"__esModule",{value:!0});for(var n in q)e.hasOwnProperty(n)||(e[n]=q[n])})},"esri/layers/vectorTiles/core/workers/workers":function(){define("require exports dojo/sniff dojo/promise/all ../Logger ../promiseUtils ./Connection ./RemoteClient ./WorkerOwner".split(" "),function(G,
e,q,n,p,k,c,a,b){function l(){if(u)return u;for(var r=h+g,t=[],w=function(y){var x=b.create(y).then(function(A){return m[y]=A});t.push(x)},v=0;v<r;v++)w(v);return u=n(t).then(function(){})}Object.defineProperty(e,"__esModule",{value:!0});e.Connection=c;e.RemoteClient=a;(c=navigator.hardwareConcurrency)||(c=q("safari")&&q("mac")||q("trident")?8:2);var h=q("esri-workers-debug")?1:Math.max(1,Math.ceil(c/2)),g=q("esri-workers-debug")?1:Math.max(1,Math.floor(c/2)),d=p.getLogger("esri.core.workers"),f=
0,m=[];e.initialize=function(){l()};e.open=function(r,t,w){void 0===t&&(t={});if(Array.isArray(r))return new e.Connection(r.map(function(x){return new e.RemoteClient(x,t.client)}));if("string"!==typeof r){d.warn("workers-open:signature-deprecated","DEPRECATED: workers.open() changed signature.");var v=r;r=t;t={client:v,strategy:w?"dedicated":"distributed"}}var y=t.strategy||"distributed";return"local"===y?k.create(function(x){G([r],function(A){x(e.RemoteClient.connect(A))})}).then(function(x){return new e.Connection([new e.RemoteClient(x,
t.client)])}):l().then(function(){if("dedicated"===y){var x=h+f++;f%=g;return m[x].open(r).then(function(A){return new e.Connection([new e.RemoteClient(A,t.client)])})}return k.all(m.map(function(A){return A.open(r)})).then(function(A){return new e.Connection(A.map(function(C){return new e.RemoteClient(C,t.client)}))})})};e.terminate=function(){for(var r=0;r<m.length;r++)m[r]&&m[r].terminate();m.length=0};var u})},"esri/layers/vectorTiles/core/Logger":function(){define(["require","exports","dojo/has"],
function(G,e,q){var n={info:0,warn:1,error:2};G=function(){function p(k){void 0===k&&(k={});this.module=k.module||"";this.writer=k.writer||null;this.level=k.level||null;null!=k.enabled&&(this.enabled=!!k.enabled);p._loggers[this.module]=this;k=this.module.lastIndexOf(".");-1!==k&&(this.parent=p.getLogger(this.module.slice(0,k)))}p.prototype.log=function(k){for(var c=[],a=1;a<arguments.length;a++)c[a-1]=arguments[a];this._isEnabled()&&this._matchLevel(k)&&(a=this._inheritedWriter())&&a.apply(void 0,
[k,this.module].concat(c))};p.prototype.error=function(){for(var k=[],c=0;c<arguments.length;c++)k[c]=arguments[c];this.log.apply(this,["error"].concat(k))};p.prototype.warn=function(){for(var k=[],c=0;c<arguments.length;c++)k[c]=arguments[c];this.log.apply(this,["warn"].concat(k))};p.prototype.info=function(){for(var k=[],c=0;c<arguments.length;c++)k[c]=arguments[c];this.log.apply(this,["info"].concat(k))};p.prototype.getLogger=function(k){return p.getLogger(this.module+"."+k)};p.getLogger=function(k){var c=
p._loggers[k];c||(c=new p({module:k}));return c};p.prototype._parentWithMember=function(k,c){for(var a=this;a&&null==a[k];)a=a.parent;return a?a[k]:c};p.prototype._inheritedWriter=function(){return this._parentWithMember("writer",this._consoleWriter)};p.prototype._consoleWriter=function(k,c){for(var a=[],b=2;b<arguments.length;b++)a[b-2]=arguments[b];console[k].apply(console,["["+c+"]"].concat(a))};p.prototype._matchLevel=function(k){return n[this._parentWithMember("level","error")]<=n[k]};p.prototype._isEnabled=
function(){return this._parentWithMember("enabled",!0)};p._loggers={};return p}();e=G.getLogger("esri");q("dojo-debug-messages")?e.level="info":e.level="warn";return G})},"esri/layers/vectorTiles/core/promiseUtils":function(){define("require exports dojo/Deferred dojo/when dojo/promise/all ./Error".split(" "),function(G,e,q,n,p,k){function c(a){if(a){if("function"!==typeof a.forEach){var b=Object.keys(a),l=b.map(function(f){return a[f]});return c(l).then(function(f){var m={};b.forEach(function(u,
r){return m[u]=f[r]});return m})}var h=new q,g=[],d=a.length;0===d&&h.resolve(g);a.forEach(function(f){var m={promise:f};g.push(m);f.then(function(u){m.value=u}).catch(function(u){m.error=u}).then(function(){--d;0===d&&h.resolve(g)})});return h.promise}}Object.defineProperty(e,"__esModule",{value:!0});e.all=function(a){return p(a)};e.filter=function(a,b){var l=a.slice();return p(a.map(function(h,g){return b(h,g)})).then(function(h){return l.filter(function(g,d){return h[d]})})};e.eachAlways=c;e.create=
function(a,b){var l=new q(b);a(function(h){void 0===h&&(h=null);return n(h).then(l.resolve)},l.reject);return l.promise};e.reject=function(a){var b=new q;b.reject(a);return b.promise};e.resolve=function(a){void 0===a&&(a=null);var b=new q;b.resolve(a);return b.promise};e.after=function(a,b){void 0===b&&(b=null);var l=0,h=new q(function(){l&&(clearTimeout(l),l=0)});l=setTimeout(function(){h.resolve(b)},a);return h.promise};e.timeout=function(a,b,l){var h=0,g=new q(a.cancel);a.then(function(d){g.isFulfilled()||
(g.resolve(d),h&&(clearTimeout(h),h=0))});a.catch(function(d){g.isFulfilled()||(g.reject(d),h&&(clearTimeout(h),h=0))});h=setTimeout(function(){var d=l||new k("promiseUtils:timeout","The wrapped promise did not resolve within "+b+" ms");g.reject(d)},b);return g.promise};e.wrapCallback=function(a){var b=!1,l=new q(function(){return b=!0});a(function(h){b||l.resolve(h)});return l.promise};e.isThenable=function(a){return a&&"function"===typeof a.then};e.when=function(a){return n(a)}})},"esri/layers/vectorTiles/core/Error":function(){define(["require",
"exports","./tsSupport/extendsHelper","./lang","./Message"],function(G,e,q,n,p){G=function(k){function c(a,b,l){var h=k.call(this,a,b,l)||this;return h instanceof c?h:new c(a,b,l)}q(c,k);c.prototype.toJSON=function(){return{name:this.name,message:this.message,details:n.clone(this.details),dojoType:this.dojoType}};c.fromJSON=function(a){var b=new c(a.name,a.message,a.details);null!=a.dojoType&&(b.dojoType=a.dojoType);return b};return c}(p);G.prototype.type="error";return G})},"esri/layers/vectorTiles/core/tsSupport/extendsHelper":function(){define([],
function(){return function(){var G=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,q){e.__proto__=q}||function(e,q){for(var n in q)q.hasOwnProperty(n)&&(e[n]=q[n])};return function(e,q){function n(){this.constructor=e}G(e,q);e.prototype=null===q?Object.create(q):(n.prototype=q.prototype,new n)}}()})},"esri/layers/vectorTiles/core/lang":function(){define("dojo/_base/kernel dojo/_base/lang dojo/date dojo/number dojo/date/locale dojo/i18n!../nls/common".split(" "),function(G,e,q,n,
p,k){function c(f){return void 0!==f&&null!==f}function a(f){return c(f)?f:""}function b(f,m,u){var r=u.match(/([^\(]+)(\([^\)]+\))?/i),t=e.trim(r[1]);u=m[f];r=JSON.parse((r[2]?e.trim(r[2]):"{}").replace(/^\(/,"{").replace(/\)$/,"}").replace(/([{,])\s*([0-9a-zA-Z_]+)\s*:/gi,'$1"$2":').replace(/"\s*:\s*'/gi,'":"').replace(/'\s*(,|\})/gi,'"$1'));var w=r.utcOffset;if(-1===g.indexOf(t))t=e.getObject(t),e.isFunction(t)&&(u=t(u,f,m,r));else if("number"===typeof u||"string"===typeof u&&u&&!isNaN(Number(u)))switch(u=
Number(u),t){case "NumberFormat":f=e.mixin({},r);m=parseFloat(f.places);if(isNaN(m)||0>m)f.places=Infinity;return n.format(u,f);case "DateString":u=new Date(u);if(r.local||r.systemLocale)return r.systemLocale?u.toLocaleDateString()+(r.hideTime?"":" "+u.toLocaleTimeString()):u.toDateString()+(r.hideTime?"":" "+u.toTimeString());u=u.toUTCString();r.hideTime&&(u=u.replace(/\s+\d\d:\d\d:\d\d\s+(utc|gmt)/i,""));return u;case "DateFormat":return u=new Date(u),c(w)&&(u=q.add(u,"minute",u.getTimezoneOffset()-
w)),p.format(u,r)}return a(u)}function l(f,m){var u;if(m)for(u in f)f.hasOwnProperty(u)&&(void 0===f[u]?delete f[u]:f[u]instanceof Object&&l(f[u],!0));else for(u in f)f.hasOwnProperty(u)&&void 0===f[u]&&delete f[u];return f}function h(f){if(!f||"object"!=typeof f||e.isFunction(f))return f;if(f instanceof Int8Array||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int16Array||f instanceof Int32Array||f instanceof Uint16Array||f instanceof Uint32Array||f instanceof Float32Array||
f instanceof Float64Array||f instanceof Date)return new f.constructor(f);if(f instanceof ArrayBuffer)return f.slice(0,f.byteLength);if("function"===typeof f.clone)f=f.clone();else if("function"===typeof f.map&&"function"===typeof f.forEach)f=f.map(h);else if("function"===typeof f.notifyChange&&"function"===typeof f.watch)f=f.clone();else{var m={},u,r={};for(u in f){var t=f[u];var w=!(u in r)||r[u]!==t;if(!(u in m)||m[u]!==t&&w)m[u]=h?h(t):t}f=m}return f}var g=["NumberFormat","DateString","DateFormat"],
d=/<\/?[^>]+>/g;return{equals:function(f,m){return f===m||"number"===typeof f&&isNaN(f)&&"number"===typeof m&&isNaN(m)||e.isFunction((f||{}).getTime)&&e.isFunction((m||{}).getTime)&&f.getTime()==m.getTime()||e.isFunction((f||{}).equals)&&f.equals(m)||e.isFunction((m||{}).equals)&&m.equals(f)||!1},mixin:e.mixin,valueOf:function(f,m){for(var u in f)if(f[u]==m)return u;return null},stripTags:function(f){if(f){var m=typeof f;if("string"===m)f=f.replace(d,"");else if("object"===m)for(var u in f)(m=f[u])&&
"string"===typeof m&&(m=m.replace(d,"")),f[u]=m}return f},substitute:function(f,m,u){if(c(u))if(e.isObject(u)){var r=u.first;var t=u.dateFormat;var w=u.numberFormat}else r=u;if(m&&"{*}"!==m)return e.replace(m,e.hitch({obj:f},function(y,x){y=x.split(":");return 1<y.length?(x=y[0],y.shift(),b(x,this.obj,y.join(":"))):t&&-1!==(t.properties||[]).indexOf(x)?b(x,this.obj,t.formatter||"DateString"):w&&-1!==(w.properties||[]).indexOf(x)?b(x,this.obj,w.formatter||"NumberFormat"):a(this.obj[x])}));m=[];var v;
m.push('\x3ctable class\x3d"esri-widget__table" summary\x3d"'+k.fieldsSummary+'"\x3e\x3ctbody\x3e');for(v in f)if(u=f[v],t&&-1!==(t.properties||[]).indexOf(v)?u=b(v,f,t.formatter||"DateString"):w&&-1!==(w.properties||[]).indexOf(v)&&(u=b(v,f,w.formatter||"NumberFormat")),m.push("\x3ctr\x3e\x3cth\x3e"+v+"\x3c/th\x3e\x3ctd\x3e"+a(u)+"\x3c/td\x3e\x3c/tr\x3e"),r)break;m.push("\x3c/tbody\x3e\x3c/table\x3e");return m.join("")},filter:function(f,m,u){m=[e.isString(f)?f.split(""):f,u||G.global,e.isString(m)?
new Function("item","index","array",m):m];u={};var r;f=m[0];for(r in f)m[2].call(m[r],f[r],r,f)&&(u[r]=f[r]);return u},startsWith:function(f,m,u){u=u||0;return f.indexOf(m,u)===u},endsWith:function(f,m,u){if("number"!==typeof u||!isFinite(u)||Math.floor(u)!==u||u>f.length)u=f.length;u-=m.length;f=f.indexOf(m,u);return-1!==f&&f===u},isDefined:c,fixJson:l,clone:h}})},"esri/layers/vectorTiles/core/Message":function(){define(["require","exports","dojo/string"],function(G,e,q){return function(){function n(p,
k,c){this instanceof n&&(this.name=p,this.message=k&&q.substitute(k,c,function(a){return null==a?"":a})||"",this.details=c)}n.prototype.toString=function(){return"["+this.name+"]: "+this.message};return n}()})},"esri/layers/vectorTiles/core/workers/Connection":function(){define(["require","exports","../promiseUtils"],function(G,e,q){return function(){function n(p){this._clientIdx=0;this._clients=p}n.prototype.broadcast=function(p,k,c){for(var a=[],b=0,l=this._clients;b<l.length;b++)a.push(l[b].invoke(p,
k,c));return a};n.prototype.close=function(){for(var p=0,k=this._clients;p<k.length;p++)k[p].close();this._clients=[]};n.prototype.invoke=function(p,k,c,a){var b=a&&a.client;if(!this._clients||!this._clients.length)return q.reject(Error("Connection closed"));null!=b&&-1!==this._clients.indexOf(b)||this._clients.some(function(l){return l.isBusy()?!1:(b=l,!0)})||(this._clientIdx=(this._clientIdx+1)%this._clients.length,b=this._clients[this._clientIdx]);p=b.invoke(p,k,c);a&&(a.client=b);return p};n.prototype.openPorts=
function(){return q.all(this._clients.map(function(p){return p.openPort()}))};return n}()})},"esri/layers/vectorTiles/core/workers/RemoteClient":function(){define("require exports dojo/Deferred ../Error ../promiseUtils ./utils".split(" "),function(G,e,q,n,p,k){function c(f,m){f["delete"](m)}var a=k.MessageType.CLOSE,b=k.MessageType.CANCEL,l=k.MessageType.INVOKE,h=k.MessageType.RESPONSE,g=k.MessageType.OPEN_PORT,d=function(){function f(m){this._timer=null;this._cancelledJobIds=new Set;this._invokeMessages=
[];this._invoke=m;this._timer=null;this._process=this._process.bind(this)}f.prototype.push=function(m){m.type===k.MessageType.CANCEL?this._cancelledJobIds.add(m.jobId):(this._invokeMessages.push(m),null===this._timer&&(this._timer=setTimeout(this._process,0)))};f.prototype.clear=function(){this._invokeMessages.length=0;this._cancelledJobIds.clear();this._timer=null};f.prototype._process=function(){this._timer=null;for(var m=0,u=this._invokeMessages;m<u.length;m++){var r=u[m];this._cancelledJobIds.has(r.jobId)||
this._invoke(r)}this._cancelledJobIds.clear();this._invokeMessages.length=0};return f}();return function(){function f(m,u,r){this._outJobs=new Map;this._inJobs=new Map;this._queue=new d(this._onInvoke.bind(this));this._onMessage=this._onMessage.bind(this);this._client=u;this._port=m;this._port.addEventListener("message",this._onMessage);this._port.start();this._channel=r}f.connect=function(m){var u=new MessageChannel;m="function"===typeof m?new m:"default"in m&&"function"===typeof m.default?new m.default:
m;m.remoteClient=new f(u.port1,m,u);return u.port2};f.prototype.close=function(){this._post({type:a});this._close()};f.prototype.isBusy=function(){return 0<this._outJobs.size};f.prototype.invoke=function(m,u,r){var t=this;if(!this._port)return p.reject(new n("remote-client:port-closed","Can't invoke(), port is closed"));var w=k.newJobId(),v=new q(function(){c(t._outJobs,w);t._post({type:b,jobId:w})});this._outJobs.set(w,v);this._post({type:l,jobId:w,methodName:m},u,r);return v.promise};f.prototype.openPort=
function(){var m=this,u=k.newJobId(),r=new q(function(){c(m._outJobs,u);m._post({type:b,jobId:u})});this._outJobs.set(u,r);this._post({type:g,jobId:u});return r.promise};f.prototype._close=function(){this._channel&&(this._channel=null);this._port.removeEventListener("message",this._onMessage);this._port.close();this._outJobs.forEach(function(m){m.cancel()});this._inJobs.clear();this._outJobs.clear();this._queue.clear();this._port=this._client=null};f.prototype._onMessage=function(m){if(m=k.receiveMessage(m))switch(m.type){case h:this._onResponse(m);
break;case l:this._queue.push(m);break;case b:this._onCancel(m);break;case a:this._close();break;case g:this._onOpenPort(m)}};f.prototype._onCancel=function(m){var u=this._inJobs,r=m.jobId,t=u.get(r);this._queue.push(m);t&&(c(u,r),t.cancel())};f.prototype._onInvoke=function(m){var u=this,r=m.methodName,t=m.jobId;m=m.data;var w=this._inJobs,v=this._client,y=v[r];try{if(!y&&r&&-1!==r.indexOf("."))for(var x=r.split("."),A=0;A<x.length-1;A++)v=v[x[A]],y=v[x[A+1]];if("function"!==typeof y)throw new TypeError(r+
" is not a function");var C=y.call(v,m,this)}catch(E){this._post({type:h,jobId:t,error:k.toInvokeError(E)});return}p.isThenable(C)?(w.set(t,C),C.then(function(E){w.has(t)&&(c(w,t),u._post({type:h,jobId:t},E))}).catch(function(E){w.has(t)&&(c(w,t),E&&"cancel"===E.dojoType||u._post({type:h,jobId:t,error:k.toInvokeError(E||{message:"Error encountered at method "+r})}))})):this._post({type:h,jobId:t},C)};f.prototype._onOpenPort=function(m){var u=new MessageChannel;new f(u.port1,this._client);this._post({type:h,
jobId:m.jobId},u.port2,[u.port2])};f.prototype._onResponse=function(m){var u=m.jobId,r=m.error;m=m.data;var t=this._outJobs;if(t.has(u)){var w=t.get(u);c(t,u);r?w.reject(n.fromJSON(JSON.parse(r))):w.resolve(m)}};f.prototype._post=function(m,u,r){return k.postMessage(this._port,m,u,r)};return f}()})},"esri/layers/vectorTiles/core/workers/utils":function(){define(["require","exports","dojo/has"],function(G,e,q){function n(k){return k&&"object"===typeof k&&("result"in k||"transferList"in k)}Object.defineProperty(e,
"__esModule",{value:!0});(function(k){k[k.HANDSHAKE=0]="HANDSHAKE";k[k.CONFIGURE=1]="CONFIGURE";k[k.CONFIGURED=2]="CONFIGURED";k[k.OPEN=3]="OPEN";k[k.OPENED=4]="OPENED";k[k.RESPONSE=5]="RESPONSE";k[k.INVOKE=6]="INVOKE";k[k.CANCEL=7]="CANCEL";k[k.CLOSE=8]="CLOSE";k[k.OPEN_PORT=9]="OPEN_PORT"})(e.MessageType||(e.MessageType={}));var p=0;e.newJobId=function(){return p++};e.isTranferableResult=n;e.toInvokeError=function(k){return k?k.toJSON?JSON.stringify(k):JSON.stringify({name:k.name,message:k.message,
details:k.details,stack:k.stack}):null};e.postMessage=function(k,c,a,b){2===arguments.length||void 0===a&&void 0===b?k.postMessage(c):(q("esri-workers-supports-transfer-arraybuffer")||(b?(b=b.filter(function(l){return!(l instanceof ArrayBuffer)}),b.length||(b=null)):n(a)&&a.transferList&&(a.transferList=a.transferList.filter(function(l){return!(l instanceof ArrayBuffer)}),a.transferList.length||(a.transferList=null))),b?(c.data=a,k.postMessage(c,b)):n(a)?(c.data=a.result,a.transferList?k.postMessage(c,
a.transferList):k.postMessage(c)):(c.data=a,k.postMessage(c)))};e.receiveMessage=function(k){return k?(k=k.data)?"string"===typeof k?JSON.parse(k):k:null:null}})},"esri/layers/vectorTiles/core/workers/WorkerOwner":function(){define("require exports dojo/Deferred ../../kernel ../Error ../Logger ../promiseUtils ./utils ./workerFactory".split(" "),function(G,e,q,n,p,k,c,a,b){var l=k.getLogger("esri.core.workers"),h=a.MessageType.CANCEL,g=a.MessageType.INVOKE,d=a.MessageType.OPEN,f=a.MessageType.OPENED,
m=a.MessageType.RESPONSE;return function(){function u(r,t){this._outJobs=new Map;this._inJobs=new Map;this.worker=r;this.id=t;r.addEventListener("message",this._onMessage.bind(this));r.addEventListener("error",function(w){w.preventDefault();l.error(w)})}u.create=function(r){return b.createWorker().then(function(t){return new u(t,r)})};u.prototype.terminate=function(){this.worker.terminate()};u.prototype.open=function(r){var t=this,w=a.newJobId(),v=new q(function(y){t._outJobs["delete"](w);t._post({type:h,
jobId:w})});this._outJobs.set(w,v);this._post({type:d,jobId:w,modulePath:r});return v.promise};u.prototype._onMessage=function(r){if(r=a.receiveMessage(r))switch(r.type){case f:case m:this._onResponse(r);break;case h:this._onCancel(r);break;case g:this._onInvoke(r)}};u.prototype._onCancel=function(r){(r=this._inJobs.get(r.jobId))&&r.cancel()};u.prototype._onInvoke=function(r){var t=this,w=r.methodName,v=r.jobId;r=r.data;var y=this._inJobs,x=n.workerMessages[w];try{if("function"!==typeof x)throw new TypeError(w+
" is not a function");var A=x.call(null,r)}catch(C){this._post({type:m,jobId:v,error:a.toInvokeError(C)});return}c.isThenable(A)?(y.set(v,A),A.then(function(C){y["delete"](v);t._post({type:m,jobId:v},C)}).catch(function(C){y["delete"](v);C||(C={message:"Error encountered at method"+w});C.dojoType&&"cancel"===C.dojoType||t._post({type:m,jobId:v,error:a.toInvokeError(C)})})):this._post({type:m,jobId:v},A)};u.prototype._onResponse=function(r){var t=r.jobId,w=r.error;r=r.data;var v=this._outJobs.get(t);
v&&(this._outJobs["delete"](t),w?v.reject(p.fromJSON(JSON.parse(w))):v.resolve(r))};u.prototype._post=function(r,t,w){return a.postMessage(this.worker,r,t,w)};return u}()})},"esri/layers/vectorTiles/core/workers/workerFactory":function(){define("require exports ../tsSupport/assignHelper dojo/_base/kernel ../../config ../../request ../Logger ../promiseUtils ../sniff ../urlUtils ./loaderConfig ./utils ./WorkerFallback".split(" "),function(G,e,q,n,p,k,c,a,b,l,h,g,d){function f(x){return a.create(function(A){function C(H){if(H=
g.receiveMessage(H))switch(H.type){case y:H=x;var B=p.workers.loaderUrl||h.DEFAULT_LOADER_URL;if(null!=p["default"]){var z=q({},p);delete z["default"];z=JSON.parse(JSON.stringify(z))}else z=JSON.parse(JSON.stringify(p));var F=p.workers.loaderConfig;F=h.default({baseUrl:F.baseUrl,locale:n.locale,has:q({"config-deferredInstrumentation":0,"dojo-test-sniff":0,"esri-cors":1,"esri-secure-context":b("esri-secure-context"),"esri-workers-supports-transfer-arraybuffer":b("esri-workers-supports-transfer-arraybuffer"),
"events-keypress-typed":0,"host-webworker":1},F.has),map:q({},F.map),paths:q({},F.paths),packages:F.packages||[]});H.postMessage({type:v,configure:{esriConfig:z,loaderUrl:B,loaderConfig:F}});break;case w:x.removeEventListener("message",C),x.removeEventListener("error",E),A(x)}}function E(H){H.preventDefault();x.removeEventListener("message",C);x.removeEventListener("error",E);r.warn("Failed to create Worker. Fallback to execute module in main thread",H);x=new d;x.addEventListener("message",C);x.addEventListener("error",
E)}x.addEventListener("message",C);x.addEventListener("error",E)})}Object.defineProperty(e,"__esModule",{value:!0});var m=l.normalize(G.toUrl("./worker.js")),u=!l.hasSameOrigin(m,location.href),r=c.getLogger("esri.core.workers"),t=null,w=g.MessageType.CONFIGURED,v=g.MessageType.CONFIGURE,y=g.MessageType.HANDSHAKE;e.createWorker=function(){if(!b("esri-workers"))return f(new d);if(!u){var x=void 0;try{x=new Worker(m)}catch(A){r.warn("Failed to create Worker. Fallback to execute module in main thread",
event),x=new d}return f(x)}t||(t=k(m,{responseType:"text"}));return t.then(function(A){return new Worker(URL.createObjectURL(new Blob([A.data],{type:"text/javascript"})))}).catch(function(A){r.warn("Failed to create Worker. Fallback to execute module in main thread",A);return new d}).then(function(A){return f(A)})}})},"esri/layers/vectorTiles/core/tsSupport/assignHelper":function(){define([],function(){return Object.assign||function(G){for(var e,q=1,n=arguments.length;q<n;q++){e=arguments[q];for(var p in e)Object.prototype.hasOwnProperty.call(e,
p)&&(G[p]=e[p])}return G}})},"esri/layers/vectorTiles/config":function(){define(["require","exports","esri/config"],function(G,e,q){Object.defineProperty(q,"workers",{get:function(){return q.defaults.workers},set:function(n){return q.defaults.workers=n}});return q})},"esri/layers/vectorTiles/request":function(){define(["require","exports","esri/request","dojo/_base/lang","dojo/Deferred"],function(G,e,q,n,p){return function(k,c){k=n.mixin({},{url:k,failOk:!0},c);"array-buffer"===c.responseType?(k.handleAs=
"arraybuffer",delete k.responseType):c.responseType&&(k.handleAs=c.responseType,delete k.responseType);null!==c.query&&(k.content=k.query,delete k.query);if(c.hasOwnProperty("allowImageDataAccess")){var a={allowImageDataAccess:c.allowImageDataAccess};delete k.allowImageDataAccess}var b=new p(function(){l.isFulfilled()||l.cancel()});var l=q(k,a).then(function(h){b.resolve({data:h})}).catch(function(h){h&&null!=h.httpCode&&(h.details=h.details||{},h.details.httpStatus=h.httpCode);b.reject(h)});return b.promise}})},
"esri/layers/vectorTiles/core/sniff":function(){define(["require","exports","dojo/sniff","./global","../views/webgl/context-util"],function(G,e,q,n,p){function k(){var l={available:!1,version:0,majorPerformanceCaveat:!1,supportsHighPrecisionFragment:!1,supportsVertexShaderSamplers:!1,supportsElementIndexUint:!1,supportsStandardDerivatives:!1},h=document.createElement("canvas");if(!h)return l;var g=p.createContext(h,{failIfMajorPerformanceCaveat:!0},"webgl");!g&&(g=p.createContext(h,{},"webgl"))&&
(l.majorPerformanceCaveat=!0);if(!g)return l;h=g.getParameter(g.VERSION);if(!h)return l;if(h=h.match(/^WebGL\s+([\d.]*)/))l.version=parseFloat(h[1]),l.available=.94<=l.version,h=g.getShaderPrecisionFormat(g.FRAGMENT_SHADER,g.HIGH_FLOAT),l.supportsHighPrecisionFragment=h&&0<h.precision,l.supportsVertexShaderSamplers=0<g.getParameter(g.MAX_VERTEX_TEXTURE_IMAGE_UNITS),l.supportsElementIndexUint=null!==g.getExtension("OES_element_index_uint"),l.supportsStandardDerivatives=null!==g.getExtension("OES_standard_derivatives");
return l}function c(){var l={available:!1,version:0},h=document.createElement("canvas");if(!h)return l;h=p.createContext(h,{},"webgl2");if(!h)return l;l.available=!0;h=h.getParameter(h.VERSION);if(!h)return l;if(h=h.match(/^WebGL\s+([\d.]*)/))l.version=parseFloat(h[1]);return l}(function(){var l=navigator.userAgent,h=l.match(/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini|IEMobile/i);l=l.match(/iPhone/i);h&&q.add("esri-mobile",h);l&&q.add("esri-iPhone",l);q.add("esri-phonegap",!!n.cordova);
q.add("esri-cors",q("esri-phonegap")||"XMLHttpRequest"in n&&"withCredentials"in new XMLHttpRequest);q.add("esri-geolocation",function(){return!!navigator.geolocation});q.add("esri-canvas-svg-support",function(){return!(q("trident")||q("ie"))});q.add("esri-secure-context",function(){if("isSecureContext"in n)return n.isSecureContext;if(n.location&&n.location.origin)return 0===n.location.origin.indexOf("https:")});q.add("esri-wasm","WebAssembly"in n);q("host-webworker")||(q.add("esri-workers","Worker"in
n),q.add("esri-script-sandbox",function(){return"MessageChannel"in n&&"HTMLIFrameElement"in n&&"sandbox"in HTMLIFrameElement.prototype}),q.add("esri-url-encodes-apostrophe",function(){var g=n.document.createElement("a");g.href="?'";return-1<g.href.indexOf("?%27")}),a||(a=k()),q.add("esri-webgl",a.available),q.add("esri-webgl-high-precision-fragment",a.supportsHighPrecisionFragment),q.add("esri-webgl-vertex-shader-samplers",a.supportsVertexShaderSamplers),q.add("esri-webgl-element-index-uint",a.supportsElementIndexUint),
q.add("esri-webgl-standard-derivatives",a.supportsStandardDerivatives),q.add("esri-webgl-major-performance-caveat",a.majorPerformanceCaveat),q.add("esri-featurelayer-webgl-labeling",!0),b||(b=c()),q.add("esri-webgl2",b.available))})();var a=null,b=null;return q})},"esri/layers/vectorTiles/core/global":function(){define(["require","exports"],function(G,e){return function(){if("undefined"!==typeof global)return global;if("undefined"!==typeof window)return window;if("undefined"!==typeof self)return self}()})},
"esri/layers/vectorTiles/views/webgl/context-util":function(){define(["require","exports"],function(G,e){function q(c,a,b){void 0===a&&(a={});switch(b){case "webgl":var l=["webgl","experimental-webgl","webkit-3d","moz-webgl"];break;case "webgl2":l=["webgl2"];break;default:l=["webgl","experimental-webgl","webkit-3d","moz-webgl"]}b=null;for(var h=0;h<l.length;h++){var g=l[h];try{b=c.getContext(g,a)}catch(d){}if(b)break}return b}function n(c,a){(c=c.parentNode)&&(c.innerHTML='\x3ctable style\x3d"background-color: #8CE; width: 100%; height: 100%;"\x3e\x3ctr\x3e\x3ctd align\x3d"center"\x3e\x3cdiv style\x3d"display: table-cell; vertical-align: middle;"\x3e\x3cdiv style\x3d""\x3e'+
a+"\x3c/div\x3e\x3c/div\x3e\x3c/td\x3e\x3c/tr\x3e\x3c/table\x3e")}Object.defineProperty(e,"__esModule",{value:!0});e.createContextOrErrorHTML=function(c,a,b){void 0===a&&(a={});if(!window.WebGLRenderingContext)return n(c,p),null;a=q(c,a,b);return a?a:(n(c,k),null)};e.createContext=q;var p='This page requires a browser that supports WebGL.\x3cbr/\x3e\x3ca href\x3d"http://get.webgl.org"\x3eClick here to upgrade your browser.\x3c/a\x3e',k='It doesn\'t appear your computer can support WebGL.\x3cbr/\x3e\x3ca href\x3d"http://get.webgl.org/troubleshooting/"\x3eClick here for more information.\x3c/a\x3e'})},
"esri/layers/vectorTiles/core/urlUtils":function(){define(["require","exports","esri/urlUtils","dojo/_base/url"],function(G,e,q,n){function p(v){return q.normalize(v)}function k(v){return"data:"===v.slice(0,5)}function c(v){return a(v)||t.test(v)}function a(v){return v&&"/"===v[0]&&"/"===v[1]}function b(v){return q.urlToObject(v)}function l(v){if("string"===typeof v)return new n(g(v));v.scheme||(v.scheme=e.appUrl.scheme);return v}function h(v){if(k(v))return null;var y=v.indexOf("://");if(-1===y&&
a(v))y=2;else if(-1!==y)y+=3;else return null;y=v.indexOf("/",y);return-1===y?v:v.slice(0,y)}function g(v,y,x){void 0===y&&(y=e.appBaseUrl);if(a(v))return x&&x.preserveProtocolRelative?v:"http"===e.appUrl.scheme&&e.appUrl.authority===h(v).slice(2)?"http:"+v:"https:"+v;if(t.test(v))return v;"/"===v[0]&&(x=y.indexOf("//"),x=y.indexOf("/",x+2),y=-1===x?y:y.slice(0,x));return f(y,v)}function d(v,y,x){void 0===x&&(x=!1);v=l(v);y=l(y);return x||v.scheme===y.scheme?v.host.toLowerCase()===y.host.toLowerCase()&&
v.port===y.port:!1}function f(){for(var v=[],y=0;y<arguments.length;y++)v[y]=arguments[y];if(v&&v.length){y=[];if(c(v[0])){var x=v[0],A=x.indexOf("//");y.push(x.slice(0,A+1));r.test(v[0])&&(y[0]+="/");v[0]=x.slice(A+2)}else"/"===v[0][0]&&y.push("");v=v.reduce(function(C,E){return E?C.concat(E.split("/")):C},[]);for(x=0;x<v.length;x++)A=v[x],".."===A&&0<y.length?y.pop():!A||"."===A&&0!==y.length||y.push(A);return y.join("/")}}function m(v,y,x){if(!(y&&x&&v&&c(v)))return v;var A=v.indexOf("//"),C=v.indexOf("/",
A+2),E=v.indexOf(":",A+2);C=Math.min(0>C?v.length:C,0>E?v.length:E);if(v.slice(A+2,C).toLowerCase()!==y.toLowerCase())return v;y=v.slice(0,A+2);v=v.slice(C);return""+y+x+v}function u(v,y,x){void 0===y&&(y=e.appBaseUrl);if(!c(v))return v;var A=p(v),C=A.toLowerCase();y=p(y).toLowerCase().replace(/\/+$/,"");if((x=x?p(x).toLowerCase().replace(/\/+$/,""):null)&&0!==y.indexOf(x))return v;for(var E=function(z,F,K){K=z.indexOf(F,K);return-1===K?z.length:K},H=E(C,"/",C.indexOf("//")+2),B=-1;C.slice(0,H+1)===
y.slice(0,H)+"/";){B=H+1;if(H===C.length)break;H=E(C,"/",H+1)}if(-1===B||x&&B<x.length)return v;v=A.slice(B);A=y.slice(B-1).replace(/[^/]+/g,"").length;if(0<A)for(C=0;C<A;C++)v="../"+v;else v="./"+v;return v}Object.defineProperty(e,"__esModule",{value:!0});e.normalize=p;e.canUseXhr=function(v){return q.canUseXhr(v)};e.removeTrailingSlash=function(v){return v.replace(/\/+$/,"")};G=Function("return this")();e.appUrl=new n(G.location);e.appBaseUrl=function(){var v=e.appUrl.path;v=v.substring(0,v.lastIndexOf(v.split("/")[v.split("/").length-
1]));return e.appUrl.scheme+"://"+e.appUrl.host+(null!=e.appUrl.port?":"+e.appUrl.port:"")+v}();var r=/^\s*file:/i,t=/^\s*[a-z][a-z0-9-+.]*:[^0-9]/i;e.isDataProtocol=k;e.isAbsolute=c;e.isProtocolRelative=a;e.urlToObject=b;e.getOrigin=h;e.makeAbsolute=g;e.hasSameOrigin=d;e.join=f;e.removeFile=function(v){var y=0;if(c(v)){var x=v.indexOf("//");-1!==x&&(y=x+2)}x=v.lastIndexOf("/");return x<y?v:v.slice(0,x+1)};e.addProxy=function(v){return q.addProxy(v)};e.makeData=function(v){return v.isBase64?"data:"+
v.mediaType+";base64,"+v.data:"data:"+v.mediaType+","+v.data};var w=/^data:(.*?)(;base64)?,(.*)$/;e.dataComponents=function(v){return(v=v.match(w))?{mediaType:v[1],isBase64:!!v[2],data:v[3]}:null};e.changeDomain=m;e.read=function(v,y){var x=y&&y.url&&y.url.path;v&&x&&(v=g(v,x,{preserveProtocolRelative:!0}));(y=y&&y.portal)&&!y.isPortal&&y.urlKey&&y.customBaseUrl?(x=y.urlKey+"."+y.customBaseUrl,y=d(e.appUrl,e.appUrl.scheme+"://"+x)?m(v,y.portalHostname,x):m(v,x,y.portalHostname)):y=v;return y};e.write=
function(v,y){if(!v)return v;!c(v)&&y&&y.blockedRelativeUrls&&y.blockedRelativeUrls.push(v);var x=g(v);if(y){var A=y.verifyItemRelativeUrls&&y.verifyItemRelativeUrls.rootPath||y.url&&y.url.path;A&&(x=u(x,A,A),x!==v&&y.verifyItemRelativeUrls&&y.verifyItemRelativeUrls.writtenUrls.push(x))}v=x;x=(y=y&&y.portal)&&!y.isPortal&&y.urlKey&&y.customBaseUrl?m(v,y.urlKey+"."+y.customBaseUrl,y.portalHostname):v;return x};e.makeRelative=u;e.removeQueryParameters=function(v){v=b(v);Object.keys(v.query||{});return v.path}})},
"esri/layers/vectorTiles/core/workers/loaderConfig":function(){define(["require","exports","../tsSupport/assignHelper","dojo/has","../urlUtils"],function(G,e,q,n,p){Object.defineProperty(e,"__esModule",{value:!0});e.DEFAULT_LOADER_URL=p.makeAbsolute(p.removeQueryParameters(G.toUrl("./worker-init.js")));e.DEFAULT_CONFIG={baseUrl:function(){var k=p.removeQueryParameters(G.toUrl("dojo/x.js"));return p.makeAbsolute(k.slice(0,k.length-5))}(),packages:[{name:"esri"},{name:"dojo"},{name:"dojox"},{name:"dstore"},
{name:"moment",main:"moment"},{name:"@dojo"},{name:"cldrjs",main:"dist/cldr"},{name:"globalize",main:"dist/globalize"},{name:"maquette",main:"dist/maquette.umd"},{name:"maquette-css-transitions",main:"dist/maquette-css-transitions.umd"},{name:"maquette-jsx",main:"dist/maquette-jsx.umd"},{name:"tslib",main:"tslib"}],map:{globalize:{cldr:"cldrjs/dist/cldr","cldr/event":"cldrjs/dist/cldr/event","cldr/supplemental":"cldrjs/dist/cldr/supplemental","cldr/unresolved":"cldrjs/dist/cldr/unresolved"}}};e.default=
function(k){var c={async:k.async,isDebug:k.isDebug,locale:k.locale,baseUrl:k.baseUrl,has:q({},k.has),map:q({},k.map),packages:k.packages&&k.packages.concat()||[],paths:q({},k.paths)};k.hasOwnProperty("async")||(c.async=!0);k.hasOwnProperty("isDebug")||(c.isDebug=!1);k.baseUrl||(c.baseUrl=e.DEFAULT_CONFIG.baseUrl);e.DEFAULT_CONFIG.packages.forEach(function(h){a:{for(var g=c.packages,d=0;d<g.length;d++)if(g[d].name===h.name)break a;h=q({},h);d=p.removeQueryParameters(G.toUrl(h.name+"/x.js"));d=d.slice(0,
d.length-5);h.location=p.makeAbsolute(d);g.push(h)}});k=c.map=c.map||{};for(var a=0,b=Object.keys(e.DEFAULT_CONFIG.map);a<b.length;a++){var l=b[a];k[l]||(k[l]=e.DEFAULT_CONFIG.map[l])}return c}})},"esri/layers/vectorTiles/core/workers/WorkerFallback":function(){define(["require","exports","dojo/has","../global","./utils"],function(G,e,q,n,p){var k=function(){return function(){var b=this,l=document.createDocumentFragment();["addEventListener","dispatchEvent","removeEventListener"].forEach(function(h){b[h]=
function(){for(var g=[],d=0;d<arguments.length;d++)g[d]=arguments[d];return l[h].apply(l,g)}})}}(),c=n.MutationObserver||n.WebKitMutationObserver,a=function(){if(n.process&&n.process.nextTick)var b=function(g){n.process.nextTick(g)};else if(n.Promise)b=function(g){n.Promise.resolve().then(g)};else if(c){var l=[],h=document.createElement("div");(new c(function(){for(;0<l.length;)l.shift()()})).observe(h,{attributes:!0});b=function(g){l.push(g);h.setAttribute("queueStatus","1")}}return b}();return function(){function b(){this._dispatcher=
new k;this._isInitialized=!1;this._workerPostMessage({type:p.MessageType.HANDSHAKE})}b.prototype.terminate=function(){};Object.defineProperty(b.prototype,"onmessage",{get:function(){return this._onmessageHandler},set:function(l){this._onmessageHandler&&this.removeEventListener("message",this._onmessageHandler);(this._onmessageHandler=l)&&this.addEventListener("message",l)},enumerable:!0,configurable:!0});Object.defineProperty(b.prototype,"onerror",{get:function(){return this._onerrorHandler},set:function(l){this._onerrorHandler&&
this.removeEventListener("error",this._onerrorHandler);(this._onerrorHandler=l)&&this.addEventListener("error",l)},enumerable:!0,configurable:!0});b.prototype.postMessage=function(l,h){var g=this;a(function(){g._workerMessageHandler(new MessageEvent("message",{data:l}))})};b.prototype.dispatchEvent=function(l){return this._dispatcher.dispatchEvent(l)};b.prototype.addEventListener=function(l,h,g){this._dispatcher.addEventListener(l,h,g)};b.prototype.removeEventListener=function(l,h,g){this._dispatcher.removeEventListener(l,
h,g)};b.prototype._workerPostMessage=function(l,h){var g=this;a(function(){g.dispatchEvent(new MessageEvent("message",{data:l}))})};b.prototype._workerMessageHandler=function(l){var h=this;if(l=p.receiveMessage(l)){var g=l.jobId;switch(l.type){case p.MessageType.CONFIGURE:this._isInitialized||this._workerPostMessage({type:p.MessageType.CONFIGURED});break;case p.MessageType.OPEN:l=l.modulePath,q("esri-webpack")?G(["esri/core/workers/RemoteClient","esri/views/vectorTiles/WorkerTileHandler","esri/views/2d/layers/features/Pipeline",
"esri/views/3d/layers/PointCloudWorker","esri/views/3d/layers/SceneLayerWorker","esri/layers/graphics/sources/support/CSVSourceWorker","esri/views/3d/webgl-engine/lib/edgeRendering/EdgeProcessingWorker",l],function(d,f,m,u,r,t,w,v){switch(v){case "esri/views/vectorTiles/WorkerTileHandler":break;case "esri/views/2d/layers/features/Pipeline":f=m;break;case "esri/views/3d/layers/PointCloudWorker":f=u;break;case "esri/views/3d/layers/SceneLayerWorker":f=r;break;case "esri/layers/graphics/sources/support/CSVSourceWorker":f=
t;break;case "esri/views/3d/webgl-engine/lib/edgeRendering/EdgeProcessingWorker":f=w;break;default:f=v}d=d.connect(f);h._workerPostMessage({type:p.MessageType.OPENED,jobId:g,data:d})}):G(["./RemoteClient",l],function(d,f){d=d.connect(f);h._workerPostMessage({type:p.MessageType.OPENED,jobId:g,data:d})})}}};return b}()})},"esri/layers/vectorTiles/core/requireUtils":function(){define(["require","exports","dojo/Deferred"],function(G,e,q){function n(p,k){if(Array.isArray(k)){var c=new q;p(k,function(){for(var a=
[],b=0;b<arguments.length;b++)a[b]=arguments[b];c.resolve(a)});return c.promise}return n(p,[k]).then(function(a){return a[0]})}Object.defineProperty(e,"__esModule",{value:!0});e.when=n;e.getAbsMid=function(p,k,c){return k.toAbsMid?k.toAbsMid(p):c.id.replace(/\/[^\/]*$/gi,"/")+p}})},"esri/layers/rasterLib/function/rasterFunctionHelper":function(){define(["dojo/_base/declare","dojo/_base/lang","./rasterFunctionRegistry"],function(G,e,q){return{create:function(n,p){if(n){var k=n.renderTexture,c=Object.keys(n);
if(n.read&&!p)return n;n.read&&p&&(n=n.toJson());-1<c.indexOf("name")&&c.indexOf(!1)?(n=e.mixin({},n),p=this._parseV2(n,p)):(n="esri.layers.RasterFunction"===n.declaredClass?n.toJson():e.mixin({},n),p=this._parseV1(n,p));p.branchCount=p.updateBranchStructure();p.renderTexture||(p.renderTexture=!!k);return p}},_parseV1:function(n,p){var k=n.rasterFunction,c=n.rasterFunctionArguments,a=n.renderTexture||n.rasterFunctionArguments.renderTexture||!1,b,l,h,g,d,f,m;(g=c.raster||c.Raster)&&g.rasterFunction&&
(b=this._parseV1(g,p));(g=c.raster2||c.Raster2)&&g.rasterFunction&&(l=this._parseV1(g,p));(g=c.rasters||c.Rasters)&&0<g.length&&(h=g.map(e.hitch(this,function(u){return u&&u.rasterFunction?this._parseV1(u,p):u})));(g=c.dem||c.DEM)&&(g.functionName||g.rasterFunction)&&(d=this._parseV1(g,p));(g=c.fillRaster||c.FillRaster)&&(g.functionName||g.rasterFunction)&&(f=this._parseV1(g,p));g=q.functions[k];if(!g)return console.error("Function is not currently supported: "+k),null;k=new g(c);k.variableName&&
(g=c[k.variableName])&&(g.functionName||g.rasterFunction)&&(m=this._parseV1(g,p));n.outputPixelType&&(k.pixelType=n.outputPixelType);"$$"===b?k.functionArguments.raster=p&&p.raster:null!=b?k.functionArguments.raster=b:k.functionArguments.raster||(k.functionArguments.raster=p&&p.raster);null!=l&&(k.functionArguments.raster2=l);null!=h&&(k.functionArguments.rasters=h.map(function(u){"$$"===u&&(u=p&&p.raster);return u}));null!=d&&(k.functionArguments.dem=d);null!=f&&(k.functionArguments.fillRaster=f);
null!=m&&(k.functionArguments[k.variableName]=m);k.renderTexture=a;return k},_parseV2:function(n,p){if(!n)return null;n=e.clone(n);this._bindV2Args(n,p);var k={};this._convertTov1(n,k);return this._parseV1(k,p)},_bindV2Args:function(n,p){(n||p)&&Object.keys(n).forEach(function(k){n[k]["function"]&&n[k].arguments?this._bindV2Args(n[k].arguments,p):null!=p[n[k].name]&&(n[k].value=p[n[k].name])}.bind(this))},_convertV2Types:function(n){if(!n)return null;"ArgumentArray"===n.type?n.elements&&"RasterStatistics"===
n.elements[0].type&&(n=n.elements):n instanceof Array&&0===n.length&&(n=null);return n},_convertTov1:function(n,p){if((n||p)&&n["function"]){var k=n["function"],c=n.arguments;p.rasterFunction=k.type.replace("Function","");p.outputPixelType="UNKNOWN"===k.pixelType?"Unknown":k.pixelType;p.rasterFunctionArguments={};var a;Object.keys(c).forEach(function(b){c[b]["function"]&&c[b].arguments?(p.rasterFunctionArguments[b]={},this._convertTov1(c[b],p.rasterFunctionArguments[b])):(a=c[b].value,p.rasterFunctionArguments[b]=
"object"!==typeof a||a.functionArguments?a:this._convertV2Types(a))}.bind(this))}}}})},"esri/layers/rasterLib/function/rasterFunctionRegistry":function(){define("dojo/_base/declare dojo/_base/lang ../../rasterLib/function/AspectFunction ../../rasterLib/function/BandArithmeticFunction ../../rasterLib/function/ColormapFunction ../../rasterLib/function/CompositeBandFunction ../../rasterLib/function/ContrastBrightnessFunction ../../rasterLib/function/ConvolutionFunction ../../rasterLib/function/ExtractBandFunction ../../rasterLib/function/HillshadeFunction ../../rasterLib/function/LocalFunction ../../rasterLib/function/MaskFunction ../../rasterLib/function/NDVIFunction ../../rasterLib/function/SlopeFunction ../../rasterLib/function/StretchFunction ../../rasterLib/function/RemapFunction ../../rasterLib/function/IdentityFunction ../../rasterLib/function/ResampleFunction".split(" "),
function(G,e,q,n,p,k,c,a,b,l,h,g,d,f,m,u,r,t){return function(){function w(A){A.prototype.supportWebGL&&(y[A.prototype.functionName]=A);A.prototype.support2D&&(v[A.prototype.functionName]=A);x[A.prototype.functionName]=A}var v={},y={},x={};w(q);w(n);w(p);w(k);w(c);w(a);w(b);w(l);w(h);w(g);w(d);w(f);w(m);w(u);w(r);w(t);return{cpu:v,gpu:y,functions:x,register:w,getFunction:function(A){return x[A]},support:function(A,C){return!!("gpu"===C?y:"cpu"===C?v:x)[A]}}}()})},"esri/layers/rasterLib/function/AspectFunction":function(){define("dojo/_base/declare dojo/_base/lang ./RasterFunctionX ../../../WKIDUnitConversion ../../PixelBlock ./pixelShaders ./RasterFunctionWebGLMixin ./surfaceUtils".split(" "),
function(G,e,q,n,p,k,c,a){return G([q,c],{declaredClass:"esri.layers.rasterLib.function.AspectFunction",functionName:"Aspect",supportWebGL:!0,support2D:!0,constructor:function(b){this.functionArguments=this.mixinIgnoreCase({raster:null},b)},bind:function(){var b=this.getSourceRasterInfo();if(!b.raster)return Error("The raster input to aspect function is invalid.");this.rasterInfo=e.mixin(b.raster,{bandCount:1,pixelType:this._calculatePixelType(this.pixelType,"F32"),statistics:[{min:0,max:360}],histograms:null});
this.rasterInfo.keyProperties=this.rasterInfo.keyProperties||{};this.rasterInfo.keyProperties.DataType="Generic";return!0},read2D:function(b){this._performance.start();b=a.aspect(b.raster);this._addPerformanceMetric(this._performance.elapsed());return b},readGL:function(b){this._performance.start();this._initializeProgram({fragment:k.aspect,fragmentName:"Aspect"});var l=this._setupTextureData(b.raster),h=this.bindFrameBuffer(),g=this.gl,d=g.drawingBufferWidth;g=g.drawingBufferHeight;var f=l.extent;
this._setUniforms({u_resolution:b&&b.raster&&b.raster.pixelBlock?[1/b.raster.pixelBlock.width,1/b.raster.pixelBlock.height]:[1/d,1/g],u_cellSize:[(f.xmax-f.xmin)/d,(f.ymax-f.ymin)/g]});this._bindTexture(l.texture,"u_image");this._drawGL();this._addPerformanceMetric(this._performance.elapsed());return{extent:l.extent,texture:h.texture}}})})},"esri/layers/rasterLib/function/RasterFunctionX":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/config ../raster/RasterInfo ../../../geometry/Extent ../../PixelBlock".split(" "),
function(G,e,q,n,p,k){return G(null,{functionName:null,functionArguments:null,pixelType:"Unknown",rasterInfo:null,constructor:function(c){c&&(this.pixelType=c.outputPixelType||c.OutputPixelType||this.pixelType,this.renderTexture=c.renderTexture,this._initFunction())},mixinIgnoreCase:function(c,a){var b=Object.keys(c),l=Object.keys(a),h,g,d=b.length;for(h=0;h<l.length;h++){var f=a[l[h]];if(null!=f)for(g=0;g<d;g++)if(b[g].toLowerCase()===l[h].toLowerCase()){c[b[g]]=f;break}}return c},bind:function(c){},
setProcessingContext:function(c){if(!c)throw"cannot bind to layer without options";this.useWebGL=!!c.useWebGL;this._tileMode=!!c.tileMode;this._glSetting=c.glSetting;this._rawRasterInfo=c.rawRasterInfo;this._xformSetting=c.xformSetting||this._xformSetting;if(!this.useWebGL||this._glSetting&&this._glSetting.gl){this.gl=this.useWebGL?this._glSetting.gl:null;this._glSetting&&(this._glSetting.pingpong=null,this._glSetting.branches=null);var a=this.functionArguments.raster,b=this.functionArguments.raster2,
l=this.functionArguments.dem,h=this.functionArguments.fillRaster,g=this.functionArguments.rasters;a&&a.functionArguments&&a.setProcessingContext(c);b&&b.functionArguments&&b.setProcessingContext(c);l&&l.functionArguments&&l.setProcessingContext(c);h&&h.functionArguments&&h.setProcessingContext(c);if(g)for(a=0;a<g.length;a++)g[a]&&g[a].functionArguments&&g[a].setProcessingContext(c);this.bind()}},updateBranchStructure:function(){var c=0,a=this.functionArguments;a.raster&&a.raster.read&&a.raster.functionArguments&&
(c+=a.raster.updateBranchStructure());a.raster2&&a.raster2.read&&a.raster2.functionArguments&&(c+=a.raster2.updateBranchStructure(),a.raster2.isBranch=!0,a.raster&&a.raster.read&&(a.raster.isBranch=!0));a.rasters&&(c=a.rasters.length,a.rasters.forEach(function(b){b.read&&b.functionArguments&&(b.isBranch=!0)}));a.dem&&a.dem.read&&a.dem.functionArguments&&(c+=a.dem.updateBranchStructure());return 1===c?0:c},read:function(c){c=this.processRasterArgument(c);return this.useWebGL?this.readGL(c):this.read2D(c)},
hasTilingEffects:function(){return!1},read2D:function(){},readGL:function(){},getSourceRasterInfo:function(){var c,a={};if(this.functionArguments.raster2)a.functionArguments.raster=this._bindRaster(this.functionArguments.raster),a.functionArguments.raster2=this._bindRaster(this.functionArguments.raster2);else if(this.functionArguments.rasters)for(a.rasters=[],c=0;c<this.functionArguments.rasters.length;c++)a.rasters[c]=this._bindRaster(this.functionArguments.rasters[c]);else a.raster=this._bindRaster(this.functionArguments.raster);
return this.sourceRasterInfo=a},processRasterArgument:function(c){var a=this.bind();if(!0!==a)throw a;var b={};if(this.functionArguments.raster2)b.raster=this._readRaster(this.functionArguments.raster,c),b.raster2=this._readRaster(this.functionArguments.raster2,c);else if(this.functionArguments.rasters)for(b.rasters=[],a=0;a<this.functionArguments.rasters.length;a++)b.rasters[a]=this._readRaster(this.functionArguments.rasters[a],c);else b.raster=this._readRaster(this.functionArguments.raster,c);return b},
toJson:function(){var c=this.functionArguments,a=c.raster,b=c.raster2;c=c.rasters;a=a?a.toJson?a.toJson():a:null;b=b?b.toJson?b.toJson():b:null;var l;c&&0<c.length&&(l=c.map(function(h){return h.toJson?h.toJson():h}));c=e.mixin({},this.functionArguments);c.raster=a;c.raster2=b;c.rasters=l;c=this._fixRasterFunctionJson(c);return{rasterFunction:this.functionName,rasterFunctionArguments:c,outputPixelType:this.pixelType}},_initFunction:function(c){},_getIntegerRange:function(c){switch(c){case "U8":var a=
[0,255];break;case "U16":a=[0,65535];break;case "U32":a=[0,4294967295];break;case "S8":a=[-128,127];break;case "S16":a=[-32768,32767];break;case "S32":a=[-2147483648,2147483647]}return a},_calculatePixelType:function(c,a){return c&&"unknown"!==c.toLowerCase()?c:a},_clonePixelData:function(c){if(null==c)return c;var a={};c.extent&&(a.extent=new p(c.extent.xmin,c.extent.ymin,c.extent.xmax,c.extent.ymax,c.extent.spatialReference));c=c.pixelBlock;if(null==c)return a;a.pixelBlock=c.clone?c.clone():k.prototype.clone(c);
return a},_readRaster:function(c,a){if(null==c||"$$"===c)var b=this._clonePixelData(a.src[Object.keys(a.src)[0]]);else c&&c.rasterInfo&&!c.functionArguments?b=this._clonePixelData(a.src[c._rasterId]):isNaN(c)?c.read&&(b=c.functionArguments?c.read(a):this._clonePixelData(a)):(b=a.src?a.src[Object.keys(a.src)[0]]:a,a=b.pixelBlock,a=new Float32Array(a.width*a.height),a.fill(parseFloat(c)),b=this._clonePixelData(b),b.pixelBlock.pixels=[a],b.isConstant=!0);return b},_bindRaster:function(c){if(c&&"$$"!==
c)isNaN(c)?c.rasterInfo?a=c.rasterInfo:c.bind&&c.bind()&&(a=c.rasterInfo):a={};else var a=this._rawRasterInfo;a&&(a=a.clone?a.clone():new n(a),a.bandCount=a.bandCount||3);return a},_getOutputBand:function(c,a){switch(c){case "U8":c=new Uint8Array(a);break;case "U16":c=new Uint16Array(a);break;case "U32":c=new Uint32Array(a);break;case "S8":c=new Int8Array(a);break;case "S16":c=new Int16Array(a);break;case "S32":c=new Int32Array(a);break;case "U32":c=new Uint32Array(a);break;case "F32":c=new Float32Array(a);
break;case "F64":c=new Float64Array(a);break;default:c=new Float32Array(a)}return c},_clampBand:function(c,a,b){if(("F64"===a||"F32"===a)&&!b)return c;var l,h=this._getIntegerRange(a),g=c.length;if(h)for(b=h[1],h=h[0],a=this._getOutputBand(a,g),l=0;l<g;l++){var d=c[l];a[l]=d>b?b:d<h?h:d}else a=c;return a},_performance:{start:function(){return this._start=self.performance&&self.performance.now()||new Date}.bind(this),elapsed:function(){return(self.performance&&self.performance.now()||new Date)-this._start}.bind(this)},
_addPerformanceMetric:function(c){q.isDebug&&(self.rasterFunctionPerformance||(self.rasterFunctionPerformance=[]),self.rasterFunctionPerformance.push(c),50<self.rasterFunctionPerformance.length&&self.rasterFunctionPerformance.shift())},_fixRasterFunctionJson:function(c){for(var a in c)c.hasOwnProperty(a)&&(null==c[a]?delete c[a]:c[a]instanceof Object&&!c[a].sourceType&&this._fixRasterFunctionJson(c[a],!0));return c}})})},"esri/layers/rasterLib/function/pixelShaders":function(){define(["dojo/_base/declare",
"dojo/_base/lang","./pixelShaderScripts"],function(G,e,q){G={shaderType:"fragment",getShader:function(n,p){var k=n.createShader(n.FRAGMENT_SHADER);n.shaderSource(k,p);n.compileShader(k);n.getShaderParameter(k,n.COMPILE_STATUS)||(k=null);return k}};e.mixin(G,q);return G})},"esri/layers/rasterLib/function/pixelShaderScripts":function(){define([],function(){return{aspect:"precision mediump float;\nuniform sampler2D u_image;\nvarying vec2 v_texCoord;\nuniform vec2 u_resolution;\nuniform vec2 u_cellSize;\nfloat getNeighborHoodAlpha(float a, float b, float c, float d, float e, float f, float g, float h, float i){\nif (a \x3d\x3d 0.0 || a \x3d\x3d 0.0 || a\x3d\x3d0.0 || a \x3d\x3d 0.0 || a \x3d\x3d 0.0 || a\x3d\x3d0.0 || a \x3d\x3d 0.0 || a \x3d\x3d 0.0 || a\x3d\x3d0.0) {\nreturn 0.0;\n}\nelse {\nreturn e;\n}\n}\nbool isOutside(){\nif (v_texCoord.t\x3e1.00001 ||v_texCoord.t\x3c-0.00001 || v_texCoord.s\x3e1.00001 ||v_texCoord.s\x3c-0.00001) {\ngl_FragColor \x3d vec4(0.0, 0.0, 0.0, 0.0);\nreturn true;\n}\nelse {\nreturn false;\n}\n}\nvoid main() {\nif (isOutside()) {\nreturn;\n}\nfloat pi \x3d 3.141592653589793238;\nfloat dz_dx \x3d 0.0;\nfloat dz_dy \x3d 0.0;\nvec4 va, vb, vc,vd,ve,vf,vg,vh,vi;\nvec2 axy \x3d vec2(-1.0,-1.0);\nvec2 bxy \x3d vec2(0.0, -1.0);\nvec2 cxy \x3d vec2(1.0, -1.0);\nvec2 dxy \x3d vec2(-1.0, 0.0);\nvec2 fxy \x3d vec2(1.0, 0.0);\nvec2 gxy \x3d vec2(-1.0, 1.0);\nvec2 hxy \x3d vec2(0.0, 1.0);\nvec2 ixy \x3d vec2(1.0, 1.0);\nif (v_texCoord.s \x3c u_resolution.s)\n{\naxy[0] \x3d 1.0;\ndxy[0] \x3d 1.0;\ngxy[0] \x3d 1.0;\n}\nif (v_texCoord.t \x3c u_resolution.t)\n{\naxy[1] \x3d 1.0;\nbxy[1] \x3d 1.0;\ncxy[1] \x3d 1.0;\n}\nif (v_texCoord.s \x3e1.0-u_resolution.s)\n{\ncxy[0] \x3d -1.0;\nfxy[0] \x3d -1.0;\nixy[0] \x3d -1.0;\n}\nif (v_texCoord.t \x3e 1.0- u_resolution.t)\n{\ngxy[1] \x3d -1.0;\nhxy[1] \x3d -1.0;\nixy[1] \x3d -1.0;\n}\nif (v_texCoord.s \x3e\x3d u_resolution.s \x26\x26 (1.0-u_resolution.s)\x3e\x3dv_texCoord.s \x26\x26 v_texCoord.t \x3e\x3d u_resolution.t \x26\x26 (1.0-u_resolution.t)\x3e\x3dv_texCoord.t)\n{\nva \x3d texture2D(u_image, v_texCoord + u_resolution* axy);\nvb \x3d texture2D(u_image, v_texCoord + u_resolution* bxy);\nvc \x3d texture2D(u_image, v_texCoord + u_resolution* cxy);\nvd \x3d texture2D(u_image, v_texCoord + u_resolution* dxy);\nve \x3d texture2D(u_image, v_texCoord + u_resolution* vec2(0, 0));\nvf \x3d texture2D(u_image, v_texCoord + u_resolution* fxy);\nvg \x3d texture2D(u_image, v_texCoord + u_resolution* gxy);\nvh \x3d texture2D(u_image, v_texCoord + u_resolution* hxy);\nvi \x3d texture2D(u_image, v_texCoord + u_resolution* ixy);\n}\ndz_dx \x3d (vc+2.0*vf+vi - va - 2.0*vd - vg).r/(8.0*u_cellSize[0]);\ndz_dy \x3d -(vg+2.0*vh+vi - va - 2.0*vb - vc).r/(8.0*u_cellSize[1]);\nfloat alpha \x3d getNeighborHoodAlpha(va.a, vb.a, vc.a, vd.a, ve.a, vf.a, vg.a, vh.a, vi.a);\nfloat aspect_rad \x3d 0.0;\nif (dz_dx \x3d\x3d 0.0)\n{\nif (dz_dy \x3e 0.0)\naspect_rad \x3d 0.5 * pi;\nelse if (dz_dy \x3c 0.0)\naspect_rad \x3d 1.5 * pi;\nelse\nalpha \x3d 0.0;//undefined make it nodata\n}\nelse\n{\naspect_rad \x3d 0.5*pi + atan(dz_dy, -dz_dx);\nif (aspect_rad \x3c 0.0)\naspect_rad \x3d 2.0*pi + aspect_rad;\n}\nfloat aspect \x3d aspect_rad * 180.0 / pi;\ngl_FragColor \x3d vec4(aspect, aspect, aspect, alpha);\n}",
bandArithmetic:"precision mediump float;\nuniform sampler2D u_image;\nvarying vec2 v_texCoord;\nuniform int u_bandId_nir;\nuniform int u_bandId_red;\nuniform bool u_scaled;\nuniform int u_bandCount;\nuniform int u_method;\nuniform float u_constants[6];\nvec4 calculateNDVI() {\nvec4 currentPixel \x3d texture2D(u_image, v_texCoord);\nfloat red \x3d float(u_bandId_red \x3d\x3d 0 ? currentPixel.r : (u_bandId_red \x3d\x3d 1 ? currentPixel.g : currentPixel.b));\nfloat nir \x3d float(u_bandId_nir \x3d\x3d 0 ? currentPixel.r : (u_bandId_nir \x3d\x3d 1 ? currentPixel.g : currentPixel.b));\nfloat ndvi_denom \x3d nir + red;\nfloat ndvi;\nif (ndvi_denom \x3d\x3d 0.0) {\nndvi \x3d 0.0;\n} else {\nndvi \x3d (nir - red) / ndvi_denom;\nif (u_scaled) {\nndvi \x3d float(floor(ndvi * 100.0 + 100.5));\n}\n}\nreturn vec4(ndvi, ndvi, ndvi, currentPixel.a);\n}\nvec4 calculateSAVI() {\nvec4 currentPixel \x3d texture2D(u_image, v_texCoord);\nfloat red \x3d float(u_bandId_red \x3d\x3d 0 ? currentPixel.r : (u_bandId_red \x3d\x3d 1 ? currentPixel.g : currentPixel.b));\nfloat nir \x3d float(u_bandId_nir \x3d\x3d 0 ? currentPixel.r : (u_bandId_nir \x3d\x3d 1 ? currentPixel.g : currentPixel.b));\nfloat savi_denom \x3d nir + red + u_constants[0];\nfloat savi;\nif (savi_denom \x3d\x3d 0.0) {\nsavi \x3d 0.0;\n} else {\nsavi \x3d (nir - red) / savi_denom * (1.0 + u_constants[0]);\n}\nreturn vec4(savi, savi, savi, currentPixel.a);\n}\nvec4 calculateMSAVI() {\nvec4 currentPixel \x3d texture2D(u_image, v_texCoord);\nfloat red \x3d float(u_bandId_red \x3d\x3d 0 ? currentPixel.r : (u_bandId_red \x3d\x3d 1 ? currentPixel.g : currentPixel.b));\nfloat nir \x3d float(u_bandId_nir \x3d\x3d 0 ? currentPixel.r : (u_bandId_nir \x3d\x3d 1 ? currentPixel.g : currentPixel.b));\nfloat msavi \x3d 0.5 * (2.0 * (nir + 1.0) - sqrt(pow((2.0 * nir + 1.0), 2.0) - 8.0 * (nir - red)));\nreturn vec4(msavi, msavi, msavi, currentPixel.a);\n}\nvec4 calculateTSAVI() {\nvec4 currentPixel \x3d texture2D(u_image, v_texCoord);\nfloat red \x3d float(u_bandId_red \x3d\x3d 0 ? currentPixel.r : (u_bandId_red \x3d\x3d 1 ? currentPixel.g : currentPixel.b));\nfloat nir \x3d float(u_bandId_nir \x3d\x3d 0 ? currentPixel.r : (u_bandId_nir \x3d\x3d 1 ? currentPixel.g : currentPixel.b));\nfloat s \x3d u_constants[0];\nfloat a \x3d u_constants[1];\nfloat x \x3d u_constants[2];\nfloat tsavi_denom \x3d a * nir + red - a * s + x * (1.0 + s * s);\nfloat tsavi;\nif (tsavi_denom \x3d\x3d 0.0) {\ntsavi \x3d 0.0;\n} else {\ntsavi \x3d s * (nir - s * red - a) / tsavi_denom;\n}\nreturn vec4(tsavi, tsavi, tsavi, currentPixel.a);\n}\nvec4 calculatePVI() {\nvec4 currentPixel \x3d texture2D(u_image, v_texCoord);\nfloat red \x3d float(u_bandId_red \x3d\x3d 0 ? currentPixel.r : (u_bandId_red \x3d\x3d 1 ? currentPixel.g : currentPixel.b));\nfloat nir \x3d float(u_bandId_nir \x3d\x3d 0 ? currentPixel.r : (u_bandId_nir \x3d\x3d 1 ? currentPixel.g : currentPixel.b));\nfloat a \x3d u_constants[0];\nfloat b \x3d u_constants[1];\nfloat pvi \x3d (nir - a * red - b) / sqrt(1.0 + a * 2.0);\nreturn vec4(pvi, pvi, pvi, currentPixel.a);\n}\nvec4 calculateGEMI() {\nvec4 currentPixel \x3d texture2D(u_image, v_texCoord);\nfloat red \x3d float(u_bandId_red \x3d\x3d 0 ? currentPixel.r : (u_bandId_red \x3d\x3d 1 ? currentPixel.g : currentPixel.b));\nfloat nir \x3d float(u_bandId_nir \x3d\x3d 0 ? currentPixel.r : (u_bandId_nir \x3d\x3d 1 ? currentPixel.g : currentPixel.b));\nfloat gemi;\nif (red \x3d\x3d 1.0) {\ngemi \x3d 0.0;\n} else {\nfloat eta \x3d (2.0 * (nir * nir - red * red) + 1.5 * nir + 0.5 * red) / (nir + red + 0.5);\nfloat gemi \x3d eta * (1.0 - 0.25*eta) - (red - 0.125) / (1.0 - red);\n}\nreturn vec4(gemi, gemi, gemi, currentPixel.a);\n}\nvec4 calculateVARI() {\nvec4 currentPixel \x3d texture2D(u_image, v_texCoord);\nfloat red \x3d float(currentPixel.r);\nfloat green \x3d float(currentPixel.g);\nfloat blue \x3d float(currentPixel.b);\nfloat vari \x3d (green - red) /(green + red - blue);\nreturn vec4(vari, vari, vari, currentPixel.a);\n}\nbool isOutside(){\nif (v_texCoord.t\x3e1.00001 ||v_texCoord.t\x3c-0.00001 || v_texCoord.s\x3e1.00001 ||v_texCoord.s\x3c-0.00001) {\ngl_FragColor \x3d vec4(0.0, 0.0, 0.0, 0.0);\nreturn true;\n}\nelse {\nreturn false;\n}\n}\nvoid main() {\nif (isOutside()) {\nreturn;\n}\nvec4 pv;\nif (u_method \x3c 4) {\nif (u_method \x3d\x3d 1) {\npv \x3d calculateNDVI();\n} else if (u_method \x3d\x3d 2) {\npv \x3d calculateSAVI();\n} else if (u_method \x3d\x3d 3) {\npv \x3d calculateTSAVI();\n} else if (u_method \x3d\x3d 4) {\npv \x3d calculateMSAVI();\n}\n} else {\nif (u_method \x3d\x3d 5) {\npv \x3d calculateGEMI();\n} else if (u_method \x3d\x3d 6) {\npv \x3d calculatePVI();\n} else if (u_method \x3d\x3d 7) {\npv \x3d calculateGEMI();\n} else if (u_method \x3d\x3d 9) {\npv \x3d calculateVARI();\n}\n}\ngl_FragColor \x3d pv;\n}",
colormap:"precision mediump float;\nuniform sampler2D u_image;\nuniform sampler2D u_image1;\nvarying vec2 v_texCoord;\nuniform float u_indexedColormapOffset;\nuniform float u_indexedColormapMaxIndex;\nvec4 colorize() {\nvec4 currentPixel \x3d texture2D(u_image, v_texCoord);\nfloat clrIndex \x3d currentPixel.r - u_indexedColormapOffset;\nvec4 result;\nif (currentPixel.a \x3d\x3d 0.0 || clrIndex \x3e u_indexedColormapMaxIndex) {\nresult \x3d vec4(0.0, 0.0, 0.0, 0.0);\n}\nelse {\nvec2 clrPosition \x3d vec2(clrIndex / u_indexedColormapMaxIndex, 0.0);\nvec4 color \x3d texture2D(u_image1, clrPosition);\nresult \x3d vec4(color.r, color.g, color.b, color.a);\n}\nreturn result;\n}\nbool isOutside(){\nif (v_texCoord.t\x3e1.00001 ||v_texCoord.t\x3c-0.00001 || v_texCoord.s\x3e1.00001 ||v_texCoord.s\x3c-0.00001) {\ngl_FragColor \x3d vec4(0.0, 0.0, 0.0, 0.0);\nreturn true;\n}\nelse {\nreturn false;\n}\n}\nvoid main() {\nif (isOutside()) {\nreturn;\n}\ngl_FragColor \x3d colorize();\n}",
compositeBand:"precision mediump float;\nuniform sampler2D u_image;\nuniform sampler2D u_image1;\nuniform sampler2D u_image2;\nvarying vec2 v_texCoord;\nuniform int u_rasterCount;\nvec4 composite() {\nvec4 p0, p1, p2;\np0 \x3d texture2D(u_image, v_texCoord);\nvec4 result;\nif (u_rasterCount \x3d\x3d 1){\nresult \x3d p0;\n}\nelse if (u_rasterCount \x3d\x3d 2){\np1 \x3d texture2D(u_image1, v_texCoord);\nresult \x3d vec4(p0.r,p1.r,0.0,min(p0.a,p1.a));\n}\nelse if (u_rasterCount \x3d\x3d 3){\np1 \x3d texture2D(u_image1, v_texCoord);\np2 \x3d texture2D(u_image2, v_texCoord);\nresult \x3d vec4(p0.r,p1.r,p2.r,min(min(p0.a,p1.a),p2.a));\n}\nreturn result;\n}\nbool isOutside(){\nif (v_texCoord.t\x3e1.00001 ||v_texCoord.t\x3c-0.00001 || v_texCoord.s\x3e1.00001 ||v_texCoord.s\x3c-0.00001) {\ngl_FragColor \x3d vec4(0.0, 0.0, 0.0, 0.0);\nreturn true;\n}\nelse {\nreturn false;\n}\n}\nvoid main() {\nif (isOutside()) {\nreturn;\n}\ngl_FragColor \x3d composite();\n}",
constant:"precision mediump float;\nuniform vec4 u_color;\nvoid main() {\ngl_FragColor \x3d u_color;\n}",contrastBrightness:"precision mediump float;\nuniform sampler2D u_image;\nvarying vec2 v_texCoord;\nuniform float u_contrastOffset;\nuniform float u_brightnessOffset;\nuniform float u_scaleFactor;\nvec4 adjustContrastBrightness() {\nvec4 currentPixel \x3d texture2D(u_image, v_texCoord);\nfloat c \x3d u_contrastOffset;\nfloat b \x3d u_brightnessOffset;\nfloat maxI \x3d 255.0;\nfloat mid \x3d 128.0;\nvec4 v;\nif (c \x3e 0.0 \x26\x26 c \x3c 100.0) {\nv \x3d (200.0 * currentPixel - 100.0 * maxI + 2.0 * maxI * b) / (2.0 * (100.0 - c)) + mid;\n} else if (c \x3c\x3d 0.0 \x26\x26 c \x3e -100.0) {\nv \x3d (200.0 * currentPixel - 100.0 * maxI + 2.0 * maxI * b) * (100.0 + c) / 20000.0 + mid;\n} else if (c \x3d\x3d 100.0) {\nv \x3d (200.0 * currentPixel - 100.0 * maxI + (maxI + 1.0) * (100.0 - c) + 2.0 * maxI * b);\nv \x3d (sign(v) + 1.0) / 2.0; //binary contrast with extra mid tone at 0.5\n} else if (c \x3d\x3d -100.0) {\nv \x3d vec4(mid, mid, mid, currentPixel.a); //no contrast\n}\nreturn vec4(v.r / u_scaleFactor, v.g / u_scaleFactor, v.b / u_scaleFactor, currentPixel.a);\n}\nbool isOutside(){\nif (v_texCoord.t\x3e1.00001 ||v_texCoord.t\x3c-0.00001 || v_texCoord.s\x3e1.00001 ||v_texCoord.s\x3c-0.00001) {\ngl_FragColor \x3d vec4(0.0, 0.0, 0.0, 0.0);\nreturn true;\n}\nelse {\nreturn false;\n}\n}\nvoid main() {\nif (isOutside()) {\nreturn;\n}\ngl_FragColor \x3d adjustContrastBrightness();\n}",
convolution:"precision mediump float;\nuniform sampler2D u_image;\nvarying vec2 v_texCoord;\nuniform vec2 u_resolution;\nuniform float u_kernel[25];\nuniform int u_kernelSize;\nvec4 convolve33(){\nvec4 vp11, vp12, vp13, vp21, vp22, vp23, vp31, vp32, vp33;\nvec2 xy11 \x3d vec2(-1.0, -1.0);\nvec2 xy12 \x3d vec2(0.0, -1.0);\nvec2 xy13 \x3d vec2(1.0, -1.0);\nvec2 xy21 \x3d vec2(-1.0, 0.0);\nvec2 xy23 \x3d vec2(1.0, 0.0);\nvec2 xy31 \x3d vec2(-1.0, 1.0);\nvec2 xy32 \x3d vec2(0.0, 1.0);\nvec2 xy33 \x3d vec2(1.0, 1.0);\nif (v_texCoord.s \x3c u_resolution.s) {\nxy11[0] \x3d 1.0;\nxy21[0] \x3d 1.0;\nxy31[0] \x3d 1.0;\n}\nif (v_texCoord.t \x3c u_resolution.t) {\nxy11[1] \x3d 1.0;\nxy12[1] \x3d 1.0;\nxy13[1] \x3d 1.0;\n}\nif (v_texCoord.s \x3e 1.0 - u_resolution.s) {\nxy13[0] \x3d -1.0;\nxy23[0] \x3d -1.0;\nxy33[0] \x3d -1.0;\n}\nif (v_texCoord.t \x3e 1.0 - u_resolution.t) {\nxy31[1] \x3d -1.0;\nxy32[1] \x3d -1.0;\nxy33[1] \x3d -1.0;\n}\nvec4 convolResult \x3d\ntexture2D(u_image, v_texCoord + u_resolution * xy11) * u_kernel[0] +\ntexture2D(u_image, v_texCoord + u_resolution * xy12) * u_kernel[1] +\ntexture2D(u_image, v_texCoord + u_resolution * xy13) * u_kernel[2] +\ntexture2D(u_image, v_texCoord + u_resolution * xy21) * u_kernel[3] +\ntexture2D(u_image, v_texCoord + u_resolution * vec2(0, 0)) * u_kernel[4] +\ntexture2D(u_image, v_texCoord + u_resolution * xy23) * u_kernel[5] +\ntexture2D(u_image, v_texCoord + u_resolution * xy31) * u_kernel[6] +\ntexture2D(u_image, v_texCoord + u_resolution * xy32) * u_kernel[7] +\ntexture2D(u_image, v_texCoord + u_resolution * xy33) * u_kernel[8];\nreturn vec4(convolResult.rgb, texture2D(u_image, v_texCoord).a);\n}\nvec4 convolve55(){\nvec4 vp11, vp12, vp13, vp21, vp22, vp23, vp31, vp32, vp33;\nfloat xdif[5];//https://www.opengl.org/wiki/Data_Type_(GLSL) array constructor ES3.0\nfloat ydif[5];\nfloat a \x3d -2.0;\nfor (int i\x3d0; i\x3c5; i++){\nxdif[i] \x3d a;\nydif[i] \x3d a;\na++;\n}\nif (v_texCoord.s \x3c u_resolution.s *2.0) { //2 pixel\nxdif[0] \x3d 2.0;\nif (v_texCoord.s \x3c u_resolution.s) { //1 pixel\nxdif[1] \x3d 1.0;\n}\n}\nelse if (v_texCoord.s \x3e 1.0 - u_resolution.s *2.0) {\nxdif[0] \x3d -2.0;\nif (v_texCoord.s \x3e 1.0 - u_resolution.s) {\nxdif[1] \x3d -1.0;\n}\n}\nif (v_texCoord.t \x3c u_resolution.t *2.0) {\nydif[0] \x3d 2.0;\nif (v_texCoord.t \x3c u_resolution.t) {\nydif[1] \x3d 1.0;\n}\n}\nelse if (v_texCoord.t \x3e 1.0 - u_resolution.t*2.0) {\nydif[0] \x3d -2.0;\nif (v_texCoord.t \x3e 1.0 - u_resolution.t) {\nydif[1] \x3d -1.0;\n}\n}\nvec4 convolResult \x3d\ntexture2D(u_image, v_texCoord + u_resolution * vec2(xdif[0], ydif[0])) * u_kernel[0] +\ntexture2D(u_image, v_texCoord + u_resolution * vec2(xdif[1], ydif[0])) * u_kernel[1] +\ntexture2D(u_image, v_texCoord + u_resolution * vec2(xdif[2], ydif[0])) * u_kernel[2] +\ntexture2D(u_image, v_texCoord + u_resolution * vec2(xdif[3], ydif[0])) * u_kernel[3] +\ntexture2D(u_image, v_texCoord + u_resolution * vec2(xdif[4], ydif[0])) * u_kernel[4] +\ntexture2D(u_image, v_texCoord + u_resolution * vec2(xdif[0], ydif[1])) * u_kernel[5] +\ntexture2D(u_image, v_texCoord + u_resolution * vec2(xdif[1], ydif[1])) * u_kernel[6] +\ntexture2D(u_image, v_texCoord + u_resolution * vec2(xdif[2], ydif[1])) * u_kernel[7] +\ntexture2D(u_image, v_texCoord + u_resolution * vec2(xdif[3], ydif[1])) * u_kernel[8] +\ntexture2D(u_image, v_texCoord + u_resolution * vec2(xdif[4], ydif[1])) * u_kernel[9] +\ntexture2D(u_image, v_texCoord + u_resolution * vec2(xdif[0], ydif[2])) * u_kernel[10] +\ntexture2D(u_image, v_texCoord + u_resolution * vec2(xdif[1], ydif[2])) * u_kernel[11] +\ntexture2D(u_image, v_texCoord + u_resolution * vec2(xdif[2], ydif[2])) * u_kernel[12] +\ntexture2D(u_image, v_texCoord + u_resolution * vec2(xdif[3], ydif[2])) * u_kernel[13] +\ntexture2D(u_image, v_texCoord + u_resolution * vec2(xdif[4], ydif[2])) * u_kernel[14] +\ntexture2D(u_image, v_texCoord + u_resolution * vec2(xdif[0], ydif[3])) * u_kernel[15] +\ntexture2D(u_image, v_texCoord + u_resolution * vec2(xdif[1], ydif[3])) * u_kernel[16] +\ntexture2D(u_image, v_texCoord + u_resolution * vec2(xdif[2], ydif[3])) * u_kernel[17] +\ntexture2D(u_image, v_texCoord + u_resolution * vec2(xdif[3], ydif[3])) * u_kernel[18] +\ntexture2D(u_image, v_texCoord + u_resolution * vec2(xdif[4], ydif[3])) * u_kernel[19] +\ntexture2D(u_image, v_texCoord + u_resolution * vec2(xdif[0], ydif[4])) * u_kernel[20] +\ntexture2D(u_image, v_texCoord + u_resolution * vec2(xdif[1], ydif[4])) * u_kernel[21] +\ntexture2D(u_image, v_texCoord + u_resolution * vec2(xdif[2], ydif[4])) * u_kernel[22] +\ntexture2D(u_image, v_texCoord + u_resolution * vec2(xdif[3], ydif[4])) * u_kernel[23] +\ntexture2D(u_image, v_texCoord + u_resolution * vec2(xdif[4], ydif[4])) * u_kernel[24];\nreturn vec4(convolResult.rgb, texture2D(u_image, v_texCoord).a);\n}\nbool isOutside(){\nif (v_texCoord.t\x3e1.00001 ||v_texCoord.t\x3c-0.00001 || v_texCoord.s\x3e1.00001 ||v_texCoord.s\x3c-0.00001) {\ngl_FragColor \x3d vec4(0.0, 0.0, 0.0, 0.0);\nreturn true;\n}\nelse {\nreturn false;\n}\n}\nvoid main() {\nif (isOutside()) {\nreturn;\n}\nif (u_kernelSize \x3d\x3d 9){\ngl_FragColor \x3d convolve33();\n}\nelse {\ngl_FragColor \x3d convolve55();\n}\n}",
extractBand:"precision mediump float;\nuniform sampler2D u_image;\nvarying vec2 v_texCoord;\nuniform int u_bandIDs[3];\nuniform bool u_alterBand;\nvec4 extractBand() {\nvec4 p \x3d texture2D(u_image, v_texCoord);\nif (!u_alterBand){\nreturn p;\n}\nfloat r, g, b;\nif (u_bandIDs[0] \x3d\x3d0){\nr \x3d p.r;\n}\nelse if (u_bandIDs[0] \x3d\x3d1){\nr \x3d p.g;\n}\nelse if (u_bandIDs[0] \x3d\x3d2){\nr \x3d p.b;\n}\nif (u_bandIDs[1] \x3d\x3d0){\ng \x3d p.r;\n}\nelse if (u_bandIDs[1] \x3d\x3d1){\ng \x3d p.g;\n}\nelse if (u_bandIDs[1] \x3d\x3d2){\ng \x3d p.b;\n}\nif (u_bandIDs[2] \x3d\x3d0){\nb \x3d p.r;\n}\nelse if (u_bandIDs[2] \x3d\x3d1){\nb \x3d p.g;\n}\nelse if (u_bandIDs[2] \x3d\x3d2){\nb \x3d p.b;\n}\nreturn vec4(r, g, b, p.a);\n}\nbool isOutside(){\nif (v_texCoord.t\x3e1.00001 ||v_texCoord.t\x3c-0.00001 || v_texCoord.s\x3e1.00001 ||v_texCoord.s\x3c-0.00001) {\ngl_FragColor \x3d vec4(0.0, 0.0, 0.0, 0.0);\nreturn true;\n}\nelse {\nreturn false;\n}\n}\nvoid main() {\nif (isOutside()) {\nreturn;\n}\ngl_FragColor \x3d extractBand();\n}",
hillshade:"precision mediump float;\nuniform sampler2D u_image;\nuniform sampler2D u_image1;\nvarying vec2 v_texCoord;\nuniform vec2 u_resolution;\nuniform int u_slopeType;\nuniform int u_hillshadeType;\nuniform int u_lightSourceCount;\nuniform float u_sinZcosA;\nuniform float u_sinZsinA;\nuniform float u_cosZ;\nuniform float u_sinZcosAs[6];\nuniform float u_sinZsinAs[6];\nuniform float u_cosZs[6];\nuniform float u_weights[6];\nuniform float u_xFactor;\nuniform float u_yFactor;\nuniform bool u_scaled;\nuniform float u_minValue;\nuniform float u_maxValue;\nuniform bool u_applyColorramp;\nuniform float u_indexedColormapOffset;\nuniform float u_indexedColormapMaxIndex;\nuniform vec2 u_rawResolution;\nuniform int u_resampling;\nvec4 getPixelValue(vec2 coords) {\nif (u_resampling \x3d\x3d 0) {\nreturn texture2D(u_image, coords);\n}\nvec2 pos_ul \x3d floor(coords / u_rawResolution) * u_rawResolution;\nvec2 pos_ur \x3d pos_ul + vec2(1.0, 0.0) * u_rawResolution;\nvec2 pos_ll \x3d pos_ul + vec2(0.0, 1.0) * u_rawResolution;\nvec2 pos_lr \x3d pos_ul + vec2(1.0, 1.0) * u_rawResolution;\nvec2 weight \x3d fract(coords / u_rawResolution);\nvec4 vp_ul \x3d texture2D(u_image, pos_ul);\nvec4 vp_ur \x3d texture2D(u_image, pos_ur);\nvec4 vp_ll \x3d texture2D(u_image, pos_ll);\nvec4 vp_lr \x3d texture2D(u_image, pos_lr);\nvec4 vp \x3d mix(mix(vp_ul, vp_ur, weight.x), mix(vp_ll, vp_lr, weight.x), weight.y);\nreturn vp;\n}\nfloat getNeighborHoodAlpha(float a, float b, float c, float d, float e, float f, float g, float h, float i){\nif (a \x3d\x3d 0.0 || a \x3d\x3d 0.0 || a\x3d\x3d0.0 || a \x3d\x3d 0.0 || a \x3d\x3d 0.0 || a\x3d\x3d0.0 || a \x3d\x3d 0.0 || a \x3d\x3d 0.0 || a\x3d\x3d0.0) {\nreturn 0.0;\n}\nelse {\nreturn e;\n}\n}\nbool isOutside(){\nif (v_texCoord.t\x3e1.00001 ||v_texCoord.t\x3c-0.00001 || v_texCoord.s\x3e1.00001 ||v_texCoord.s\x3c-0.00001) {\ngl_FragColor \x3d vec4(0.0, 0.0, 0.0, 0.0);\nreturn true;\n}\nelse {\nreturn false;\n}\n}\nvec3 rgb2hsv(vec3 c) {\nvec4 K \x3d vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\nvec4 p \x3d c.g \x3c c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy);\nvec4 q \x3d c.r \x3c p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx);\nfloat d \x3d q.x - min(q.w, q.y);\nfloat e \x3d 1.0e-10;\nreturn vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), min(d / (q.x + e), 1.0), q.x);\n}\nvec3 hsv2rgb(vec3 c) {\nvec4 K \x3d vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\nvec3 p \x3d abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\nreturn c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n}\nvec4 overlay(float val, float minValue, float maxValue, float hillshade, float alpha) {\nfloat clrIndex \x3d clamp((val - minValue) / (maxValue - minValue), 0.0, 1.0);\nvec4 rgb \x3d texture2D(u_image1, vec2(clrIndex, 0.0));\nvec3 hsv \x3d rgb2hsv(rgb.xyz);\nhsv.z \x3d hillshade;\nreturn vec4(hsv2rgb(hsv) * alpha, alpha);\n}\nvoid main() {\nif (isOutside()) {\nreturn;\n}\nvec4 va, vb, vc, vd, ve, vf, vg, vh, vi;\nvec2 axy \x3d vec2(-1.0, -1.0);\nvec2 bxy \x3d vec2(0.0, -1.0);\nvec2 cxy \x3d vec2(1.0, -1.0);\nvec2 dxy \x3d vec2(-1.0, 0.0);\nvec2 fxy \x3d vec2(1.0, 0.0);\nvec2 gxy \x3d vec2(-1.0, 1.0);\nvec2 hxy \x3d vec2(0.0, 1.0);\nvec2 ixy \x3d vec2(1.0, 1.0);\nif (v_texCoord.s \x3c u_resolution.s) {\naxy[0] \x3d 1.0;\ndxy[0] \x3d 1.0;\ngxy[0] \x3d 1.0;\n}\nif (v_texCoord.t \x3c u_resolution.t) {\naxy[1] \x3d 1.0;\nbxy[1] \x3d 1.0;\ncxy[1] \x3d 1.0;\n}\nif (v_texCoord.s \x3e 1.0 - u_resolution.s) {\ncxy[0] \x3d -1.0;\nfxy[0] \x3d -1.0;\nixy[0] \x3d -1.0;\n}\nif (v_texCoord.t \x3e 1.0 - u_resolution.t) {\ngxy[1] \x3d -1.0;\nhxy[1] \x3d -1.0;\nixy[1] \x3d -1.0;\n}\nva \x3d texture2D(u_image, v_texCoord + u_resolution * axy);\nvb \x3d texture2D(u_image, v_texCoord + u_resolution * bxy);\nvc \x3d texture2D(u_image, v_texCoord + u_resolution * cxy);\nvd \x3d texture2D(u_image, v_texCoord + u_resolution * dxy);\nve \x3d texture2D(u_image, v_texCoord + u_resolution * vec2(0, 0));\nvf \x3d texture2D(u_image, v_texCoord + u_resolution * fxy);\nvg \x3d texture2D(u_image, v_texCoord + u_resolution * gxy);\nvh \x3d texture2D(u_image, v_texCoord + u_resolution * hxy);\nvi \x3d texture2D(u_image, v_texCoord + u_resolution * ixy);\nfloat alpha \x3d getNeighborHoodAlpha(va.a, vb.a, vc.a, vd.a, ve.a, vf.a, vg.a, vh.a, vi.a);\nfloat dzx \x3d (vc + 2.0 * vf + vi - va - 2.0 * vd - vg).r * u_xFactor;\nfloat dzy \x3d (vg + 2.0 * vh + vi - va - 2.0 * vb - vc).r * u_yFactor; //flip\nfloat s2 \x3d sqrt(1.0 + dzx * dzx + dzy * dzy);\nfloat hillshade \x3d 0.0;\nif (u_hillshadeType \x3d\x3d 0){\nfloat cosDelta \x3d u_sinZsinA * dzy - u_sinZcosA * dzx;\nfloat z \x3d (u_cosZ + cosDelta) / s2;\nif (z \x3c 0.0)  z \x3d 0.0;\nhillshade \x3d z;\n}\nelse if (u_hillshadeType \x3d\x3d 1){\nfor (int k \x3d 0; k \x3c 6; k++) {\nfloat cosDelta \x3d u_sinZsinAs[k] * dzy - u_sinZcosAs[k] * dzx;\nfloat z \x3d (u_cosZs[k] + cosDelta) / s2;\nif (z \x3c 0.0) z \x3d 0.0;\nhillshade \x3d hillshade + z * u_weights[k];\nif (k \x3d\x3d u_lightSourceCount-1) break;\n}\n}\nif (u_applyColorramp) {\nvec4 result \x3d overlay(ve.r, u_minValue, u_maxValue, hillshade, alpha);\nif (u_scaled) {\nresult \x3d vec4(result.rgb * 255.0, result.a);\n}\ngl_FragColor \x3d result;\n} else {\nif (u_scaled) {\nhillshade \x3d hillshade * 255.0;\nif (hillshade\x3e 255.0) {\nhillshade \x3d 255.0;\n}\n}\ngl_FragColor \x3d vec4(hillshade, hillshade, hillshade, alpha);\n}\n}",
identity:"precision mediump float;\nuniform sampler2D u_image;\nvarying vec2 v_texCoord;\nuniform int u_bandCount;\nfloat shift_right(float v, float amt) {\nv \x3d floor(v) + 0.5;\nreturn floor(v / exp2(amt));\n}\nfloat shift_left(float v, float amt) {\nreturn floor(v * exp2(amt) + 0.5);\n}\nfloat mask_last(float v, float bits) {\nreturn mod(v, shift_left(1.0, bits));\n}\nfloat extract_bits(float num, float from, float to) {\nfrom \x3d floor(from + 0.5);\nto \x3d floor(to + 0.5);\nreturn mask_last(shift_right(num, from), to - from);\n}\nvec4 encode_float(float val) {\nif (val \x3d\x3d 0.0)\nreturn vec4(0, 0, 0, 0);\nfloat sign \x3d val \x3e 0.0 ? 0.0 : 1.0;\nval \x3d abs(val);\nfloat exponent \x3d floor(log2(val));\nfloat biased_exponent \x3d exponent + 127.0;\nfloat fraction \x3d ((val / exp2(exponent)) - 1.0) * 8388608.0;\nfloat t \x3d biased_exponent / 2.0;\nfloat last_bit_of_biased_exponent \x3d fract(t) * 2.0;\nfloat remaining_bits_of_biased_exponent \x3d floor(t);\nfloat byte4 \x3d extract_bits(fraction, 0.0, 8.0) / 255.0;\nfloat byte3 \x3d extract_bits(fraction, 8.0, 16.0) / 255.0;\nfloat byte2 \x3d (last_bit_of_biased_exponent * 128.0 + extract_bits(fraction, 16.0, 23.0)) / 255.0;\nfloat byte1 \x3d (sign * 128.0 + remaining_bits_of_biased_exponent) / 255.0;\nreturn vec4(byte4, byte3, byte2, byte1);\n}\nbool isOutside(){\nif (v_texCoord.t\x3e1.00001 ||v_texCoord.t\x3c-0.00001 || v_texCoord.s\x3e1.00001 ||v_texCoord.s\x3c-0.00001) {\ngl_FragColor \x3d vec4(0.0, 0.0, 0.0, 0.0);\nreturn true;\n}\nelse {\nreturn false;\n}\n}\nvoid main() {\nif (isOutside()) {\nreturn;\n}\nvec4 currentPixel \x3d  texture2D(u_image, v_texCoord);\ngl_FragColor \x3d vec4( currentPixel.rgb, currentPixel.a); //encode_float(currentPixel.r);\n}",
local:"precision mediump float;\nuniform sampler2D u_image;\nuniform sampler2D u_image1;\nuniform sampler2D u_image2;\nvarying vec2 v_texCoord;\nuniform int u_rasterCount;\nvec4 polyfill;\nvec4 localOp1() {\nvec4 a \x3d texture2D(u_image, v_texCoord);\nvec4 result;\nvec4 replaceme1;\nreturn result;\n}\nvec4 localOp2() {\nvec4 a \x3d texture2D(u_image, v_texCoord);\nvec4 b \x3d texture2D(u_image1, v_texCoord);\nvec4 result;\nvec4 replaceme2;\nreturn result;\n}\nvec4 localOp3() {\nvec4 a \x3d texture2D(u_image, v_texCoord);\nvec4 b \x3d texture2D(u_image1, v_texCoord);\nvec4 c \x3d texture2D(u_image2, v_texCoord);\nvec4 result;\nvec4 replaceme3;\nreturn result;\n}\nbool isOutside(){\nif (v_texCoord.t\x3e1.00001 ||v_texCoord.t\x3c-0.00001 || v_texCoord.s\x3e1.00001 ||v_texCoord.s\x3c-0.00001) {\ngl_FragColor \x3d vec4(0.0, 0.0, 0.0, 0.0);\nreturn true;\n}\nelse {\nreturn false;\n}\n}\nvoid main() {\nif (isOutside()) {\nreturn;\n}\ngl_FragColor \x3d localOp1();\n}",
local0:"precision mediump float;\nuniform sampler2D u_image0;\nuniform sampler2D u_image1;\nvarying vec2 v_texCoord;\nuniform float u_minCutOff[3];\nuniform float u_maxCutOff[3];\nuniform float u_minOutput[3];\nuniform float u_maxOutput[3];\nuniform float u_factor[3];\nuniform int u_operation;\nuniform int u_constant[3];\nuniform vec4 gamma;\nfloat localOperate1(float a, float b, float c){\nfloat result;\nif (u_operation \x3d\x3d 1){\nresult \x3d a + b;\n}\nelse if (u_operation \x3d\x3d 2){\nresult \x3d a - b;\n}\nelse if (u_operation \x3d\x3d3){\nresult \x3d a * b;\n}\nelse if (u_operation \x3d\x3d4){\nresult \x3d sqrt(a);\n}\nelse if (u_operation \x3d\x3d5){\nresult \x3d pow(a, b);\n}\nelse if (u_operation \x3d\x3d6){\nresult \x3d acos(a);\n}\nelse if (u_operation \x3d\x3d7){\nresult \x3d asin(a);\n}\nelse if (u_operation \x3d\x3d8){\nresult \x3d atan(a);\n}\nelse if (u_operation \x3d\x3d9){\nresult \x3d 999.0; //atanh not available\n}\nelse if (u_operation \x3d\x3d10){\nresult \x3d abs(a);\n}\nelse if (u_operation \x3d\x3d13){\nresult \x3d 999.0; //bitwise not available\n}\nelse if (u_operation \x3d\x3d17){\nresult \x3d a !\x3d 0.0 \x26\x26 b !\x3d0.0;\n}\nelse if (u_operation \x3d\x3d18){\nresult \x3d a \x3d\x3d0.0? 1.0:0.0;\n}\nelse if (u_operation \x3d\x3d19){\nresult \x3d a !\x3d 0.0 || b !\x3d0.0;\n}\nelse if (u_operation \x3d\x3d20){\nresult \x3d a !\x3d 0.0 ^^ b !\x3d0.0; //exclusive or\n}\nelse if (u_operation \x3d\x3d21){\nresult \x3d cos(a);\n}\nelse if (u_operation \x3d\x3d23){\nresult \x3d a / b;\n}\nelse if (u_operation \x3d\x3d24){\nresult \x3d a \x3d\x3d b ? 1.0:0.0;\n}\nelse if (u_operation \x3d\x3d25){\nresult \x3d exp(a);\n}\nelse if (u_operation \x3d\x3d26){\nresult \x3d pow(10.0, a);\n}\nelse if (u_operation \x3d\x3d27){\nresult \x3d exp2(a);\n}\nelse if (u_operation \x3d\x3d28){\nresult \x3d a \x3e b? 1.0 : 0.0;\n}\nelse if (u_operation \x3d\x3d29){\nresult \x3d  a \x3e\x3d b? 1.0 : 0.0;\n}\nelse if (u_operation \x3d\x3d30){\nresult \x3d floor(a); //int\n}\nelse if (u_operation \x3d\x3d31){\nresult \x3d a \x3d\x3d0? 1.0:0.0; //null pass mask\n}\nelse if (u_operation \x3d\x3d32){\nresult \x3d a; //float\n}\nelse if (u_operation \x3d\x3d33){\nresult \x3d a \x3c b? 1.0 : 0.0;\n}\nelse if (u_operation \x3d\x3d34){\nresult \x3d a \x3c\x3d b? 1.0 : 0.0;\n}\nelse if (u_operation \x3d\x3d35){\nresult \x3d log(a);\n}\nelse if (u_operation \x3d\x3d36){\nresult \x3d log2(a) / log2(10.0);\n}\nelse if (u_operation \x3d\x3d37){\nresult \x3d log2(a);\n}\nelse if (u_operation \x3d\x3d44){\nresult \x3d mod(a, b);\n}\nelse if (u_operation \x3d\x3d45){\nresult \x3d -a;\n}\nelse if (u_operation \x3d\x3d46){\nresult \x3d a !\x3d b? 1.0 : 0.0;\n}\nelse if (u_operation \x3d\x3d48){\nresult \x3d ceil(a);\n}\nelse if (u_operation \x3d\x3d49){\nresult \x3d floor(a);\n}\nelse if (u_operation \x3d\x3d51){\nresult \x3d sin(a);\n}\nelse if (u_operation \x3d\x3d53){\nresult \x3d a * a;\n}\nelse if (u_operation \x3d\x3d56){\nresult \x3d tan(a);\n}\nelse if (u_operation \x3d\x3d57){\nresult \x3d 999.0; //tanh not available\n}\nelse if (u_operation \x3d\x3d59){\nresult \x3d 999.0; //acosh not available\n}\nelse if (u_operation \x3d\x3d60){\nresult \x3d 999.0; //asinh not available\n}\nelse if (u_operation \x3d\x3d61){\nresult \x3d atan(a, b);\n}\nelse if (u_operation \x3d\x3d64){\nresult \x3d a / b;\n}\nelse if (u_operation \x3d\x3d65){\nresult \x3d floor(a/b);\n}\nelse if (u_operation \x3d\x3d76){\nresult \x3d a !\x3d0? b:c;\n}\n}\nvoid main() {\nvec4 currentPixel0 \x3d  texture2D(u_image0, v_texCoord);\nfloat graya, reda, greena, bluea;\nif (u_bandCount \x3d\x3d 1) {\ngraya \x3d stretchOneaue(float(currentPixel.r), u_minCutOff[0], u_maxCutOff[0], u_minOutput[0], u_maxOutput[0], u_factor[0]);\ngl_FragColor \x3d vec4(graya, graya, graya, currentPixel.a);\n}\nelse if (u_bandCount \x3d\x3d 3) {\nreda \x3d stretchOneaue(float(currentPixel.r), u_minCutOff[0], u_maxCutOff[0], u_minOutput[0], u_maxOutput[0], u_factor[0]);\ngreena \x3d stretchOneaue(float(currentPixel.g), u_minCutOff[1], u_maxCutOff[1], u_minOutput[1], u_maxOutput[1], u_factor[1]);\nbluea \x3d stretchOneaue(float(currentPixel.b), u_minCutOff[2], u_maxCutOff[2], u_minOutput[2], u_maxOutput[2], u_factor[2]);\ngl_FragColor \x3d vec4(reda, greena, bluea, currentPixel.a);\n}\n}",
mask:"precision mediump float;\nuniform sampler2D u_image;\nvarying vec2 v_texCoord;\nuniform float u_includedRanges[6];\nuniform bool u_includedRanges_specified;\nuniform float u_noDataValues[6];\nuniform bool u_noDataValues_specified;\nuniform int u_noDataInterpretation;\nuniform int u_bandCount;\nvec4 mask() {\nvec4 currentPixel \x3d texture2D(u_image, v_texCoord);\nvec4 processedPixel \x3d currentPixel;\nif (u_includedRanges_specified) {\nif (u_bandCount \x3d\x3d 1) {\nif (currentPixel.r \x3e u_includedRanges[0] \x26\x26 currentPixel.r \x3c u_includedRanges[1])\nprocessedPixel \x3d vec4(currentPixel.rgb, currentPixel.a);\nelse\nprocessedPixel \x3d vec4(currentPixel.rgb, 0);\n} else if (u_bandCount \x3d\x3d 3) {\nif (currentPixel.r \x3e u_includedRanges[0] \x26\x26 currentPixel.r \x3c u_includedRanges[1] \x26\x26 currentPixel.g \x3e u_includedRanges[2] \x26\x26 currentPixel.g \x3c u_includedRanges[3] \x26\x26 currentPixel.b \x3e u_includedRanges[4] \x26\x26 currentPixel.b \x3c u_includedRanges[5])\nprocessedPixel \x3d vec4(currentPixel.rgb, currentPixel.a);\nelse\nprocessedPixel \x3d vec4(currentPixel.rgb, 0);\n}\n}\nif (u_noDataValues_specified) {\nif (u_bandCount \x3d\x3d 1) {\nif (processedPixel.r \x3d\x3d u_noDataValues[0])\nprocessedPixel \x3d vec4(processedPixel.rgb, 0);\nelse\nprocessedPixel \x3d vec4(processedPixel.rgb, processedPixel.a);\n} else if (u_bandCount \x3d\x3d 3) {\nif (u_noDataInterpretation \x3d\x3d1 \x26\x26 processedPixel.r \x3d\x3d u_noDataValues[0] \x26\x26 processedPixel.g \x3d\x3d u_noDataValues[1] \x26\x26 processedPixel.b \x3d\x3d u_noDataValues[2])\nprocessedPixel \x3d vec4(processedPixel.rgb, 0);\nelse if (processedPixel.r \x3d\x3d u_noDataValues[0] || processedPixel.g \x3d\x3d u_noDataValues[1] || processedPixel.b \x3d\x3d u_noDataValues[2])\nprocessedPixel \x3d vec4(processedPixel.rgb, 0);\nelse\nprocessedPixel \x3d vec4(processedPixel.rgb, processedPixel.a);\n}\n}\nreturn processedPixel;\n}\nbool isOutside(){\nif (v_texCoord.t\x3e1.00001 ||v_texCoord.t\x3c-0.00001 || v_texCoord.s\x3e1.00001 ||v_texCoord.s\x3c-0.00001) {\ngl_FragColor \x3d vec4(0.0, 0.0, 0.0, 0.0);\nreturn true;\n}\nelse {\nreturn false;\n}\n}\nvoid main() {\nif (isOutside()) {\nreturn;\n}\ngl_FragColor \x3d mask();\n}",
ndvi:"precision mediump float;\nuniform sampler2D u_image;\nvarying vec2 v_texCoord;\nuniform int u_bandId_red;\nuniform int u_bandId_nir;\nuniform bool u_scaled;\nuniform int u_bandCount;\nvec4 calculateNDVI(){\nvec4 currentPixel \x3d texture2D(u_image, v_texCoord);\nfloat red \x3d float(u_bandId_red \x3d\x3d 0 ? currentPixel.r : (u_bandId_red \x3d\x3d 1 ? currentPixel.g : currentPixel.b));\nfloat nir \x3d float(u_bandId_nir \x3d\x3d 0 ? currentPixel.r : (u_bandId_nir \x3d\x3d 1 ? currentPixel.g : currentPixel.b));\nfloat ndvi_denom \x3d nir + red;\nfloat ndvi;\nif (ndvi_denom \x3d\x3d 0.0) {\nndvi \x3d 0.0;\n}\nelse {\nndvi \x3d (nir - red) / ndvi_denom;\nif (u_scaled) {\nndvi \x3d float(floor(ndvi * 100.0 + 100.5));\n}\n}\nreturn vec4(ndvi, ndvi, ndvi, currentPixel.a);\n}\nbool isOutside(){\nif (v_texCoord.t\x3e1.00001 ||v_texCoord.t\x3c-0.00001 || v_texCoord.s\x3e1.00001 ||v_texCoord.s\x3c-0.00001) {\ngl_FragColor \x3d vec4(0.0, 0.0, 0.0, 0.0);\nreturn true;\n}\nelse {\nreturn false;\n}\n}\nvoid main() {\nif (isOutside()) {\nreturn;\n}\ngl_FragColor \x3d calculateNDVI();\n}",
remap:"precision mediump float;\nuniform sampler2D u_image;\nuniform sampler2D u_image1;\nvarying vec2 v_texCoord;\nuniform float u_indexedColormapOffset;\nuniform float u_indexedColormapMaxIndex;\nuniform float u_breaks[16];\nuniform vec2 u_rawResolution;\nuniform int u_resampling;\nvec4 getPixelValue(vec2 coords) {\nif (u_resampling \x3d\x3d 0) {\nreturn texture2D(u_image, coords);\n}\nvec2 pos_ul \x3d floor(coords / u_rawResolution) * u_rawResolution;\nvec2 pos_ur \x3d pos_ul + vec2(1.0, 0.0) * u_rawResolution;\nvec2 pos_ll \x3d pos_ul + vec2(0.0, 1.0) * u_rawResolution;\nvec2 pos_lr \x3d pos_ul + vec2(1.0, 1.0) * u_rawResolution;\nvec2 weight \x3d fract(coords / u_rawResolution);\nvec4 vp_ul \x3d texture2D(u_image, pos_ul);\nvec4 vp_ur \x3d texture2D(u_image, pos_ur);\nvec4 vp_ll \x3d texture2D(u_image, pos_ll);\nvec4 vp_lr \x3d texture2D(u_image, pos_lr);\nvec4 vp \x3d mix(mix(vp_ul, vp_ur, weight.x), mix(vp_ll, vp_lr, weight.x), weight.y);\nreturn vp;\n}\nfloat getRemapIndex(float pixelValue) {\nif (pixelValue \x3c u_breaks[0] || pixelValue \x3e u_breaks[15]) {\nreturn -1.0;\n}\nfor (int i \x3d 0; i \x3c 16; i++) {\nif (pixelValue \x3c u_breaks[i]) {\nreturn float(i - 1);\n}\n}\nif (pixelValue \x3d\x3d u_breaks[15]) {\nreturn 15.0;\n}\nreturn 0.0;\n}\nvec4 colorize(float pv) {\nfloat clrIndex \x3d pv - u_indexedColormapOffset;\nvec4 result;\nif (clrIndex \x3e u_indexedColormapMaxIndex) {\nresult \x3d vec4(0.0, 0.0, 0.0, 0.0);\n}\nelse {\nvec2 clrPosition \x3d vec2(clrIndex / u_indexedColormapMaxIndex, 0.0);\nvec4 color \x3d texture2D(u_image1, clrPosition);\nresult \x3d vec4(color.r, color.g, color.b, color.a);\n}\nreturn result;\n}\nbool isOutside(){\nif (v_texCoord.t\x3e1.00001 ||v_texCoord.t\x3c-0.00001 || v_texCoord.s\x3e1.00001 ||v_texCoord.s\x3c-0.00001) {\ngl_FragColor \x3d vec4(0.0, 0.0, 0.0, 0.0);\nreturn true;\n}\nelse {\nreturn false;\n}\n}\nvoid main() {\nif (isOutside()) {\nreturn;\n}\nvec4 currentPixel \x3d texture2D(u_image, v_texCoord);\nif (currentPixel.a \x3d\x3d 0.0) {\ngl_FragColor \x3d vec4(0.0, 0.0, 0.0, 0.0);\nreturn;\n}\nfloat remappedIndex \x3d getRemapIndex(currentPixel.r);\nif (remappedIndex \x3c 0.0) {\ngl_FragColor \x3d vec4(0.0, 0.0, 0.0, 0.0);\nreturn;\n}\ngl_FragColor \x3d colorize(remappedIndex);\n}",
resample:"precision mediump float;\nuniform sampler2D u_image;\nvarying vec2 v_texCoord;\nuniform vec2 u_resamplingRatio;\nuniform int u_resamplingType;\nuniform vec2 u_anchor;\nuniform vec2 u_resolution;\nvec4 resample(){\nvec2 pos_nn, pos_ul, pos_ur, pos_ll, pos_lr, pos_offset;\nfloat weight,weight_total, weight_ul, weight_ur, weight_ll, weight_lr;\nvec4 vp;  //v_texCoord is canvas space 0-1\nvec2 originalResolution \x3d vec2(u_resolution.s*u_resamplingRatio.s, u_resolution.t*u_resamplingRatio.t);\nvec2 pos \x3d vec2(u_anchor.s+(v_texCoord.s-u_anchor.s),(u_anchor.t+(v_texCoord.t-u_anchor.t)));\nif (u_resamplingType \x3d\x3d 0)\n{//shift and scaling, y \x3d ax+b so x \x3d (y-b)/a\npos_nn \x3d vec2(floor(pos.s/originalResolution.s+0.5)*originalResolution.s,floor(pos.t/originalResolution.t+0.5)*originalResolution.t);\nif (pos_nn.s \x3c0.0 || pos_nn.s \x3e 1.0 || pos_nn.t \x3c0.0 || pos_nn.t \x3e 1.0){\nvp \x3d vec4(1.0, 0.0, 0.0, 1.0);//vec4(0.0, 1.0, 0.0, vp.a);\n}\nelse {\nvp \x3d texture2D(u_image, vec2(pos_nn.s, pos_nn.t));\n}\n}\nelse if (u_resamplingType \x3d\x3d 1)\n{//shift and scaling, 4 neighbors y \x3d ax+b so x \x3d (y-b)/a\npos_ul \x3d vec2(floor(pos.s/originalResolution.s)*originalResolution.s,floor(pos.t/originalResolution.t)*originalResolution.t);\npos_ur \x3d vec2(pos_ul.s+originalResolution.s, pos_ul.t);\npos_ll \x3d vec2(pos_ul.s, pos_ul.t+originalResolution.t);\npos_lr \x3d vec2(pos_ul.s+originalResolution.s, pos_ul.t+originalResolution.t);\npos_offset \x3d vec2(pos.s - floor(pos_ul.s),pos.t - floor(pos_ul.t));\nweight_lr \x3d sqrt(pow(pos_offset.s,2.0) + pow(pos_offset.t,2.0));\nweight_ul \x3d sqrt(pow( originalResolution.s- pos_offset.s,2.0)+ pow(originalResolution.t- pos_offset.t,2.0));\nweight_ur \x3d sqrt(pow( pos_offset.s,2.0)+ 1.0- pow(originalResolution.t - pos_offset.t,2.0));\nweight_ll \x3d sqrt(pow( originalResolution.s- pos_offset.s,2.0)+ pow(pos_offset.t,2.0));\nvp \x3d (texture2D(u_image, pos_ul) * weight_ul + texture2D(u_image, pos_ur) * weight_ur + texture2D(u_image, pos_ll) * weight_ll + texture2D(u_image, pos_lr) * weight_lr)/(weight_ul+weight_ur+weight_ll+weight_lr);\n}\nelse if (u_resamplingType \x3d\x3d 2)\n{//shift and scaling, 16 neighbors\nweight_total \x3d 0.0;\nvp \x3d vec4(0.0,0.0,0.0,0.0);\npos_ul \x3d vec2(floor(pos.s/originalResolution.s)*originalResolution.s-originalResolution.s,floor(pos.t/originalResolution.t)*originalResolution.t-originalResolution.t);\npos_offset \x3d vec2(pos.s - floor(pos_ul.s),pos.t - floor(pos_ul.t));\nfor (int i\x3d0; i\x3c4; i++){//row\nfor (int j\x3d0; j\x3c4; j++){//col\nweight \x3d sqrt(pow(pos_offset.s-float(j),2.0)+ pow(pos_offset.t-float(i),2.0));\nvp +\x3dtexture2D(u_image, vec2(pos_ul.s+float(i)*originalResolution.s,pos_ul.t+float(j)*originalResolution.t)) * weight;\nweight_total +\x3d weight;\n}\n}\nvp \x3d vp/weight_total;\n}\nreturn vp;\n}\nbool isOutside(){\nif (v_texCoord.t\x3e1.00001 ||v_texCoord.t\x3c-0.00001 || v_texCoord.s\x3e1.00001 ||v_texCoord.s\x3c-0.00001) {\ngl_FragColor \x3d vec4(0.0, 0.0, 0.0, 0.0);\nreturn true;\n}\nelse {\nreturn false;\n}\n}\nvoid main() {\nif (isOutside()) {\nreturn;\n}\ngl_FragColor \x3d resample();\n}",
slope:"precision mediump float;\nuniform sampler2D u_image;\nvarying vec2 v_texCoord;\nuniform vec2 u_resolution;\nuniform vec2 u_cellSize;\nuniform float u_zfactor;\nuniform float u_altitude;\nuniform float u_azimuth;\nfloat shift_right(float v, float amt) {\nv \x3d floor(v) + 0.5;\nreturn floor(v / exp2(amt));\n}\nfloat shift_left(float v, float amt) {\nreturn floor(v * exp2(amt) + 0.5);\n}\nfloat mask_last(float v, float bits) {\nreturn mod(v, shift_left(1.0, bits));\n}\nfloat extract_bits(float num, float from, float to) {\nfrom \x3d floor(from + 0.5);\nto \x3d floor(to + 0.5);\nreturn mask_last(shift_right(num, from), to - from);\n}\nvec4 encode_float(float val) {\nif (val \x3d\x3d 0.0)\nreturn vec4(0, 0, 0, 0);\nfloat sign \x3d val \x3e 0.0 ? 0.0 : 1.0;\nval \x3d abs(val);\nfloat exponent \x3d floor(log2(val));\nfloat biased_exponent \x3d exponent + 127.0;\nfloat fraction \x3d ((val / exp2(exponent)) - 1.0) * 8388608.0;\nfloat t \x3d biased_exponent / 2.0;\nfloat last_bit_of_biased_exponent \x3d fract(t) * 2.0;\nfloat remaining_bits_of_biased_exponent \x3d floor(t);\nfloat byte4 \x3d extract_bits(fraction, 0.0, 8.0) / 255.0;\nfloat byte3 \x3d extract_bits(fraction, 8.0, 16.0) / 255.0;\nfloat byte2 \x3d (last_bit_of_biased_exponent * 128.0 + extract_bits(fraction, 16.0, 23.0)) / 255.0;\nfloat byte1 \x3d (sign * 128.0 + remaining_bits_of_biased_exponent) / 255.0;\nreturn vec4(byte4, byte3, byte2, byte1);\n}\nfloat getNeighborHoodAlpha(float a, float b, float c, float d, float e, float f, float g, float h, float i){\nif (a \x3d\x3d 0.0 || a \x3d\x3d 0.0 || a\x3d\x3d0.0 || a \x3d\x3d 0.0 || a \x3d\x3d 0.0 || a\x3d\x3d0.0 || a \x3d\x3d 0.0 || a \x3d\x3d 0.0 || a\x3d\x3d0.0) {\nreturn 0.0;\n}\nelse {\nreturn e;\n}\n}\nvec4 calculateSlope() {\nfloat pi \x3d 3.141592653589793238;\nfloat dzx \x3d 0.0;\nfloat dzy \x3d 0.0;\nvec4 va,  vb,  vc,  vd,  ve,  vf,  vg,  vh,  vi;\nvec2 axy \x3d vec2(-1.0, -1.0);\nvec2 bxy \x3d vec2(0.0, -1.0);\nvec2 cxy \x3d vec2(1.0, -1.0);\nvec2 dxy \x3d vec2(-1.0, 0.0);\nvec2 fxy \x3d vec2(1.0, 0.0);\nvec2 gxy \x3d vec2(-1.0, 1.0);\nvec2 hxy \x3d vec2(0.0, 1.0);\nvec2 ixy \x3d vec2(1.0, 1.0);\nif (v_texCoord.s \x3c u_resolution.s) {\naxy[0] \x3d 1.0;\ndxy[0] \x3d 1.0;\ngxy[0] \x3d 1.0;\n}\nif (v_texCoord.t \x3c u_resolution.t) {\naxy[1] \x3d 1.0;\nbxy[1] \x3d 1.0;\ncxy[1] \x3d 1.0;\n}\nif (v_texCoord.s \x3e 1.0 - u_resolution.s) {\ncxy[0] \x3d -1.0;\nfxy[0] \x3d -1.0;\nixy[0] \x3d -1.0;\n}\nif (v_texCoord.t \x3e 1.0 - u_resolution.t) {\ngxy[1] \x3d -1.0;\nhxy[1] \x3d -1.0;\nixy[1] \x3d -1.0;\n}\nif (v_texCoord.s \x3e\x3d u_resolution.s \x26\x26 (1.0 - u_resolution.s) \x3e\x3d v_texCoord.s \x26\x26 v_texCoord.t \x3e\x3d u_resolution.t \x26\x26 (1.0 - u_resolution.t) \x3e\x3d v_texCoord.t) {\nva \x3d texture2D(u_image, v_texCoord + u_resolution * axy);\nvb \x3d texture2D(u_image, v_texCoord + u_resolution * bxy);\nvc \x3d texture2D(u_image, v_texCoord + u_resolution * cxy);\nvd \x3d texture2D(u_image, v_texCoord + u_resolution * dxy);\nve \x3d texture2D(u_image, v_texCoord + u_resolution * vec2(0, 0));\nvf \x3d texture2D(u_image, v_texCoord + u_resolution * fxy);\nvg \x3d texture2D(u_image, v_texCoord + u_resolution * gxy);\nvh \x3d texture2D(u_image, v_texCoord + u_resolution * hxy);\nvi \x3d texture2D(u_image, v_texCoord + u_resolution * ixy);\n}\ndzx \x3d (vc + 2.0 * vf + vi - va - 2.0 * vd - vg).r / (8.0 * u_cellSize[0]);\ndzy \x3d -(vg + 2.0 * vh + vi - va - 2.0 * vb - vc).r / (8.0 * u_cellSize[1]);\nfloat alpha \x3d getNeighborHoodAlpha(va.a, vb.a, vc.a, vd.a, ve.a, vf.a, vg.a, vh.a, vi.a);\nfloat slope \x3d atan(u_zfactor * sqrt(dzx * dzx + dzy * dzy)) * 57.2957795;\nreturn vec4(slope, slope, slope, alpha);\n}\nbool isOutside(){\nif (v_texCoord.t\x3e1.00001 ||v_texCoord.t\x3c-0.00001 || v_texCoord.s\x3e1.00001 ||v_texCoord.s\x3c-0.00001) {\ngl_FragColor \x3d vec4(0.0, 0.0, 0.0, 0.0);\nreturn true;\n}\nelse {\nreturn false;\n}\n}\nvoid main() {\nif (isOutside()) {\nreturn;\n}\ngl_FragColor \x3d calculateSlope();\n}",
stretch:"precision mediump float;\nuniform sampler2D u_image;\nuniform sampler2D u_image1;\nuniform sampler2D u_image2;\nvarying vec2 v_texCoord;\nuniform float u_minCutOff[3];\nuniform float u_maxCutOff[3];\nuniform float u_minOutput[3];\nuniform float u_maxOutput[3];\nuniform float u_factor[3];\nuniform int u_bandCount;\nuniform vec2 u_sourceDim;\nuniform vec2 u_targetDim;\nuniform int u_state;\nuniform bool u_minMaxTexture;\nuniform bool u_useGamma;\nuniform float u_gamma[4];\nuniform float u_gammaCorrection[4];\nuniform bool u_scaled;\nuniform vec2 u_rawResolution;\nuniform int u_resampling;\nvec4 getPixelValue(vec2 coords) {\nif (u_resampling \x3d\x3d 0) {\nreturn texture2D(u_image, coords);\n}\nvec2 pos_ul \x3d floor(coords / u_rawResolution) * u_rawResolution;\nvec2 pos_ur \x3d pos_ul + vec2(1.0, 0.0) * u_rawResolution;\nvec2 pos_ll \x3d pos_ul + vec2(0.0, 1.0) * u_rawResolution;\nvec2 pos_lr \x3d pos_ul + vec2(1.0, 1.0) * u_rawResolution;\nvec2 weight \x3d fract(coords / u_rawResolution);\nvec4 vp_ul \x3d texture2D(u_image, pos_ul);\nvec4 vp_ur \x3d texture2D(u_image, pos_ur);\nvec4 vp_ll \x3d texture2D(u_image, pos_ll);\nvec4 vp_lr \x3d texture2D(u_image, pos_lr);\nvec4 vp \x3d mix(mix(vp_ul, vp_ur, weight.x), mix(vp_ll, vp_lr, weight.x), weight.y);\nif (u_bandCount \x3d\x3d 1) {\nfloat alpha \x3d vp_ul.a * vp_ur.a * vp_ll.a * vp_lr.a;\nvec4 vp_nn \x3d texture2D(u_image, coords);\nreturn alpha \x3d\x3d 0.0 ? vp_nn : vec4(vp.rgb, alpha);\n}\nreturn vp;\n}\nvec4 findMin(vec4 p1, vec4 p2) {\nif (p1.a \x3d\x3d 0.0) {\nreturn p2;\n} else if (p2.a \x3d\x3d 0.0) {\nreturn p1;\n} else {\nreturn vec4(min(p1.r, p2.r),min(p1.g, p2.g),min(p1.b, p2.b),p1.a);\n}\n}\nvec4 findMax(vec4 p1, vec4 p2) {\nif (p1.a \x3d\x3d 0.0) {\nreturn p2;\n} else if (p2.a \x3d\x3d 0.0) {\nreturn p1;\n} else {\nreturn vec4(max(p1.r, p2.r),max(p1.g, p2.g),max(p1.b, p2.b),p1.a);\n}\n}\nvec4 findMinMax(vec4 p1, vec4 p2) {\nif (p1.a \x3d\x3d 0.0) {\nreturn p2;\n} else if (p2.a \x3d\x3d 0.0) {\nreturn p1;\n} else {\nreturn vec4(min(p1.r, p2.r), max(p1.g, p2.g), 0.0, p1.a);\n}\n}\nvec4 minMax(int state) {\nvec2 pixelFract \x3d fract(v_texCoord * u_sourceDim);\nfloat xshift \x3d ((pixelFract.s \x3e\x3d 0.5 || pixelFract.s \x3d\x3d 0.0) ? -1.0 : 1.0) / u_sourceDim.s; //take left pixel if \x3e 0.5\nfloat yshift \x3d ((pixelFract.s \x3e\x3d 0.5 || pixelFract.s \x3d\x3d 0.0) ? -1.0 : 1.0) / u_sourceDim.t; //take bottom pixel if \x3e 0.5\nif (u_sourceDim.s \x3d\x3d 1.0) {\nxshift \x3d 0.0;\n}\nif (u_sourceDim.t \x3d\x3d 1.0) {\nyshift \x3d 0.0;\n}\nvec4 p1 \x3d texture2D(u_image, v_texCoord);\nvec4 p2 \x3d texture2D(u_image, v_texCoord + vec2(xshift, 0.0));\nvec4 p3 \x3d texture2D(u_image, v_texCoord + vec2(0.0, yshift));\nvec4 p4 \x3d texture2D(u_image, v_texCoord + vec2(xshift, yshift));\nvec4 pval;\nif (state \x3d\x3d 2) {\npval \x3d findMinMax(findMinMax(p1, p2), findMinMax(p3, p4));\n} else if (state \x3d\x3d 1) {\npval \x3d findMax(findMax(p1, p2), findMax(p3, p4));\n} else if (state \x3d\x3d 0) {\npval \x3d findMin(findMin(p1, p2), findMin(p3, p4));\n}\nreturn pval;\n}\nfloat stretchOneValue(float val, float minCutOff, float maxCutOff, float minOutput, float maxOutput, float factor, bool scaled) {\nfloat stretchedVal;\nif (val \x3e minCutOff \x26\x26 val \x3c maxCutOff) {\nstretchedVal \x3d minOutput + (val - minCutOff) * factor;\n} else if (val \x3e\x3d maxCutOff) {\nstretchedVal \x3d maxOutput;\n} else {\nstretchedVal \x3d minOutput;\n}\nif (scaled) {\nreturn stretchedVal;\n}\nelse {\nreturn stretchedVal / maxOutput; //0-1\n}\n}\nfloat stretchOneValueGamma(float val, float minCutOff, float maxCutOff, float minOutput, float maxOutput, float factor, float gamma, float gammaCorrection, bool scaled) {\nfloat stretchedVal;\nfloat tempf \x3d 1.0;\nfloat outRange \x3d maxOutput - minOutput;\nfloat relativeVal \x3d (val - minCutOff) / (maxCutOff - minCutOff);\nif (val \x3e minCutOff \x26\x26 val \x3c maxCutOff) {\nif (gamma \x3e 1.0) {\ntempf -\x3d pow(1.0 / outRange, relativeVal * gammaCorrection);\n}\nstretchedVal \x3d floor(tempf * outRange * pow(relativeVal, 1.0 / gamma)) + minOutput;\n}\nelse if (val \x3e\x3d maxCutOff) {\nstretchedVal \x3d maxOutput;\n} else {\nstretchedVal \x3d minOutput;\n}\nif (scaled) {\nreturn stretchedVal;\n}\nelse {\nreturn stretchedVal / maxOutput; //0-1\n}\n}\nbool isOutside(){\nif (v_texCoord.t\x3e1.00001 ||v_texCoord.t\x3c-0.00001 || v_texCoord.s\x3e1.00001 ||v_texCoord.s\x3c-0.00001) {\ngl_FragColor \x3d vec4(0.0, 0.0, 0.0, 0.0);\nreturn true;\n}\nelse {\nreturn false;\n}\n}\nvoid main() {\nif (isOutside()) {\nreturn;\n}\nif (u_state \x3d\x3d 100) {\nvec4 currentPixel \x3d getPixelValue(v_texCoord);\nfloat grayVal,\nredVal,\ngreenVal,\nblueVal;\nfloat min0,\nmax0,\nmin1,\nmax1,\nmin2,\nmax2,\nfactor0,\nfactor1,\nfactor2;\nvec4 minV, maxV;\nif (u_minMaxTexture) {\nif (u_bandCount \x3d\x3d 1) {\nminV \x3d texture2D(u_image1, v_texCoord);\nmin0 \x3d minV.r;\nmax0 \x3d minV.g;\nfactor0 \x3d (u_maxOutput[0] - u_minOutput[0]) / (max0 - min0);\n} else {\nminV \x3d texture2D(u_image1, v_texCoord);\nmaxV \x3d texture2D(u_image2, v_texCoord);\nmin0 \x3d minV.r;\nmax0 \x3d maxV.r;\nmin1 \x3d minV.g;\nmax1 \x3d maxV.g;\nmin2 \x3d minV.b;\nmax2 \x3d maxV.b;\nfactor0 \x3d (u_maxOutput[0] - u_minOutput[0]) / (max0 - min0);\nfactor1 \x3d (u_maxOutput[1] - u_minOutput[1]) / (max1 - min1);\nfactor2 \x3d (u_maxOutput[2] - u_minOutput[2]) / (max2 - min2);\n}\n} else {\nmin0 \x3d u_minCutOff[0];\nmax0 \x3d u_maxCutOff[0];\nmin1 \x3d u_minCutOff[1];\nmax1 \x3d u_maxCutOff[1];\nmin2 \x3d u_minCutOff[2];\nmax2 \x3d u_maxCutOff[2];\nfactor0 \x3d u_factor[0];\nfactor1 \x3d u_factor[1];\nfactor2 \x3d u_factor[2];\n}\nif (u_useGamma){\nif (u_bandCount \x3d\x3d 1) {\ngrayVal \x3d stretchOneValueGamma(float(currentPixel.r), min0, max0, u_minOutput[0], u_maxOutput[0], factor0, u_gamma[0], u_gammaCorrection[0], u_scaled);\ngl_FragColor \x3d vec4(grayVal, grayVal, grayVal, currentPixel.a);\n} else {\nredVal \x3d stretchOneValueGamma(float(currentPixel.r), min0, max0, u_minOutput[0], u_maxOutput[0], factor0, u_gamma[0], u_gammaCorrection[0], u_scaled);\ngreenVal \x3d stretchOneValueGamma(float(currentPixel.g), min1, max1, u_minOutput[1], u_maxOutput[1], factor1, u_gamma[1], u_gammaCorrection[1], u_scaled);\nblueVal \x3d stretchOneValueGamma(float(currentPixel.b), min2, max2, u_minOutput[2], u_maxOutput[2], factor2, u_gamma[1], u_gammaCorrection[2], u_scaled);\ngl_FragColor \x3d vec4(redVal, greenVal, blueVal, currentPixel.a);\n}\n}\nelse {\nif (u_bandCount \x3d\x3d 1) {\ngrayVal \x3d stretchOneValue(float(currentPixel.r), min0, max0, u_minOutput[0], u_maxOutput[0], factor0, u_scaled);\ngl_FragColor \x3d vec4(grayVal, grayVal, grayVal, currentPixel.a);\n} else {\nredVal \x3d stretchOneValue(float(currentPixel.r), min0, max0, u_minOutput[0], u_maxOutput[0], factor0, u_scaled);\ngreenVal \x3d stretchOneValue(float(currentPixel.g), min1, max1, u_minOutput[1], u_maxOutput[1], factor1, u_scaled);\nblueVal \x3d stretchOneValue(float(currentPixel.b), min2, max2, u_minOutput[2], u_maxOutput[2], factor2, u_scaled);\ngl_FragColor \x3d vec4(redVal, greenVal, blueVal, currentPixel.a);\n}\n}\n} else {\nvec4 currentPixel \x3d minMax(u_state);\ngl_FragColor \x3d currentPixel;\n}\n}"}})},
"esri/layers/rasterLib/function/RasterFunctionWebGLMixin":function(){define("dojo/_base/declare dojo/_base/lang ./RasterFunctionX ./pixelShaders ./vertexShaders ./webglHelper ./convolutionKernel".split(" "),function(G,e,q,n,p,k,c){return G(null,{gl:null,rgbaFloatData:null,originalTexture:null,lastTexture:null,renderTexture:!1,constructor:function(a){this._isProgramInitialized=!1;this.gl=a&&a.gl;a&&a.renderTexture&&(this.renderTexture=a.renderTexture);this._xformSetting=a&&a._xformSetting||{requireProjection:!1,
meshSize:[20,20]}},bindFrameBuffer:function(){var a=this.gl;this._setupPingPongTextures();this._setupBranchingTextures();var b=this._glSetting;this.isBranch?(b.branchIndex=(b.branchIndex+1)%b.branchCount,b=b.branches[b.branchIndex]):(b.pingpongIndex=(b.pingpongIndex+1)%b.pingpong.length,b=b.pingpong[b.pingpongIndex]);a.bindFramebuffer(a.FRAMEBUFFER,b.frameBuffer);a.viewport(0,0,a.drawingBufferWidth,a.drawingBufferHeight);return b},_initializeProgram:function(a){if(this.gl)try{var b=this.gl;b.viewport(0,
0,b.drawingBufferWidth,b.drawingBufferHeight);var l=this._glSetting.programUniforms,h="local"===this.functionName?"local"+this.functionArguments.operation:this.functionName,g=l[h];if(g)this._uniforms=g.uniforms,this.rasterProgram=g.program;else{var d=(this._useMesh=this._tileMode&&this._xformSetting.requireProjection)?p.mesh:p.basic,f=p.getShader(b,a.vertex||d),m=n.getShader(b,a.fragment),u=this._loadProgram(f,m),r={rasterProgram:k.getUniforms(b,u)};l[h]={uniforms:r,program:u};this.rasterProgram=
u;this._uniforms=r}b.useProgram(this.rasterProgram);var t=b.getAttribLocation(this.rasterProgram,"a_texCoord"),w=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,w);var v=k.createMesh(this._xformSetting.meshSize);b.bufferData(b.ARRAY_BUFFER,v,b.STATIC_DRAW);b.enableVertexAttribArray(t);b.vertexAttribPointer(t,2,b.FLOAT,!1,0,0);b.disable(b.DEPTH_TEST);b.blendFunc(b.SRC_ALPHA,b.ZERO);b.disable(b.BLEND);b.pixelStorei(b.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1);b.pixelStorei(b.UNPACK_FLIP_Y_WEBGL,!1);this._shaderInfo=
{fragment:a.fragmentName}}catch(y){console.error("webgl exception: "+y.message)}else console.error("WebGL is required.")},_setUniform:function(a,b,l){null!=b&&(l&&!this._uniforms[l]&&(this._uniforms[l]=k.getUniforms(this.gl,this[l])),l=l?this._uniforms[l]:this._uniforms.rasterProgram,(a=l[a]||l[a+"[0]"])&&k.setUniform(this.gl,a,b))},_setUniforms:function(a,b){var l=Object.keys(a),h,g=l.length;for(h=0;h<g;h++)this._setUniform(l[h],a[l[h]],b);this.rawInput?this._setUniform("u_flipY",!0,b):this._setUniform("u_flipY",
!1,b);this._tileMode?(this.rawInput?(a=this._xformSetting.offset,l=this._xformSetting.scale):(a=[0,0],l=[1,1]),this._setUniform("u_xformOffset",a,b),this._setUniform("u_xformScale",l,b),this._xformSetting.requireProjection&&(this.rawInput?(this._setupXformTexture(),this._setUniform("u_projection",!0,b),this._setUniform("u_transformGridSize",this._xformSetting.gridConfig.size,b),this._setUniform("u_transformSpacing",this._xformSetting.gridConfig.spacing,b),this._setUniform("u_targetImageSize",new Float32Array([this.gl.drawingBufferWidth,
this.gl.drawingBufferHeight]),b)):this._setUniform("u_projection",!1,b))):(a=[0,0],l=[1,1],this._setUniform("u_xformOffset",a,b),this._setUniform("u_xformScale",l,b));this.rawInput&&this._rawResolution&&("RSP_BilinearInterpolation"===this.interpolation||"RSP_CubicConvolution"===this.interpolation)?(this._setUniform("u_resampling",1),this._setUniform("u_rawResolution",this._rawResolution)):this._setUniform("u_resampling",0)},_setupTextureData:function(a,b){if(a.texture)return a;a.raster&&a.raster.pixelBlock&&
(a=a.raster);this.rawInput=!0;var l=b&&b.notOriginal,h=b&&b.bandIDs;b&&b.reCreate?b=!1:(b=this._tileMode?!this._xformSetting.hasNewTexture:!this._glSetting.hasNewTexture)&&this._originalBandIDs&&(b=h?this._originalBandIDs.join("")===h.join(""):!1);0<this._glSetting.branchCount&&(b=!1);if(b&&this.originalTexture)return{extent:a.extent,texture:this.originalTexture};b=this._createTexture();l||(this.originalTexture=b,this._originalBandIDs=h);l=this.gl;var g=a.pixelBlock;this._rawResolution=g?[1/a.pixelBlock.width,
1/a.pixelBlock.height]:[1/this.gl.drawingBufferWidth,1/this.gl.drawingBufferHeight];var d=0;h&&0<h.length&&g&&(d=Math.max.apply(null,h),g.pixels.length>d&&h&&(g.pixels=h.map(function(m){return g.pixels[m]}),g.statistics&&(g.statistics=h.map(function(m){return g.statistics[m]}))));h=g.width;d=g.height;l.getExtension("OES_texture_float");var f=g.getAsRGBAFloat();l.texImage2D(l.TEXTURE_2D,0,l.RGBA,h,d,0,l.RGBA,l.FLOAT,f);return{extent:a.extent,texture:b}},_setupPingPongTextures:function(){var a=this._glSetting;
if(!a||!a.pingpong){a.pingpong=[];var b=k.createBufferTexture(this.gl,!1);a.pingpong.push(b);b=k.createBufferTexture(this.gl,!1);a.pingpong.push(b);a.pingpongIndex=1}},_setupBranchingTextures:function(){var a=this._glSetting;if(!a||!a.branches){a.branches=[];var b=0,l=a.branchCount;if(0<l){for(b=0;b<l;b++){var h=k.createBufferTexture(this.gl,!1);a.branches.push(h)}a.branchIndex=l-1}}},_setupXformTexture:function(a){for(var b=this._createTexture(),l=this.gl,h=4*this._xformSetting.gridConfig.size[0],
g=this._xformSetting.gridConfig.size[1],d=new Float32Array(h*g*4),f=0,m=0;m<this._xformSetting.gridConfig.coefficients.length;m++)d[f++]=this._xformSetting.gridConfig.coefficients[m],2===m%3&&(d[f++]=1);l.getExtension("OES_texture_float");l.texImage2D(l.TEXTURE_2D,0,l.RGBA,h,g,0,l.RGBA,l.FLOAT,d);this._bindTexture(b,"u_transformGrid",a)},_createTexture:function(a){return k.createTexture(this.gl,a)},_bindTexture:function(a,b,l){b=b||"u_image";l=this._uniforms[l||"rasterProgram"];var h=this._getTextureIndex(b);
if(-1!==h){var g=this.gl;g.uniform1i(l[b].location,h);g.activeTexture(g.TEXTURE0+h);g.bindTexture(g.TEXTURE_2D,a)}},_getTextureIndex:function(a,b){b=this._uniforms[b||"rasterProgram"];if(!b||!b[a]||b[a].info.type!==this.gl.SAMPLER_2D)return-1;if("u_transformGrid"===a)return 0;a="u_image"===a?0:parseInt(a.replace("u_image",""));return this._xformSetting.requireProjection?a+1:a},_drawGL:function(a){var b=this.gl;this.renderTexture?(b.enable(b.BLEND),b.bindFramebuffer(b.FRAMEBUFFER,null)):b.disable(b.BLEND);
a||b.viewport(0,0,b.drawingBufferWidth,b.drawingBufferHeight);a=this._xformSetting.meshSize||[1,1];b.drawArrays(b.TRIANGLES,0,a[0]*a[1]*6);this._drawMesh()},_drawMesh:function(){if(this.renderTexture&&this._glSetting.drawMesh){this.meshProgram=this.meshProgram||this._setupMeshProgram();var a=this.gl;a.useProgram(this.meshProgram);a.bindFramebuffer(a.FRAMEBUFFER,null);var b=a.getAttribLocation(this.meshProgram,"a_texCoord"),l=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,l);l=this._xformSetting.meshSize||
[1,1];var h=k.createMesh(l,!0);a.bufferData(a.ARRAY_BUFFER,h,a.STATIC_DRAW);a.enableVertexAttribArray(b);a.vertexAttribPointer(b,2,a.FLOAT,!1,0,0);a.disable(a.DEPTH_TEST);a.blendFunc(a.ONE,a.ZERO);this._setUniforms({u_color:[0,0,1,1],u_drawMeshLines:!0},"meshProgram");a.drawArrays(a.LINES,0,l[0]*l[1]*10)}},_setupMeshProgram:function(){var a=p.getShader(this.gl,p.mesh),b=n.getShader(this.gl,n.constant);return this._loadProgram(a,b)},_loadProgram:function(a,b){return k.loadProgram(this.gl,a,b)},_getShaderScript:function(a,
b){b=document.getElementById(b);if(!b)return null;a="";for(b=b.firstChild;b;)3==b.nodeType&&(a+=b.textContent),b=b.nextSibling;return a}})})},"esri/layers/rasterLib/function/vertexShaders":function(){define(["dojo/_base/declare","dojo/_base/lang","./vertexShaderScripts"],function(G,e,q){G={shaderType:"vertex",getShader:function(n,p){var k=n.createShader(n.VERTEX_SHADER);n.shaderSource(k,p);n.compileShader(k);n.getShaderParameter(k,n.COMPILE_STATUS)||(k=null);return k}};e.mixin(G,q);return G})},"esri/layers/rasterLib/function/vertexShaderScripts":function(){define([],
function(){return{basic:"varying vec2 v_texCoord;\nattribute vec2 a_texCoord;\nuniform vec2 u_xformOffset;\nuniform vec2 u_xformScale;\nuniform bool u_flipY;\nvoid main() {\nv_texCoord \x3d u_xformOffset + a_texCoord * u_xformScale;\nif (u_flipY) {\nv_texCoord.t \x3d 1.0 - v_texCoord.t;\n}\nvec2 position \x3d a_texCoord * 2.0 - 1.0;\ngl_Position \x3d vec4(position, 0.0, 1.0);\n}",histogram:"attribute float a_pixelIndex;\nuniform sampler2D u_image;\nuniform sampler2D u_image1;\nuniform sampler2D u_image2;\nuniform vec2 u_sourceDim;\nuniform vec2 u_halfPixel;\nuniform vec4 u_bandSelection;\nuniform vec4 u_mins;\nuniform vec4 u_factors;\nuniform float u_size;\nuniform int u_bandCount;\nuniform bool u_minMaxTexture;\nvoid main() {\nfloat row \x3d a_pixelIndex/u_sourceDim.s;\nvec2 coord \x3d vec2(fract(row), floor(row)/u_sourceDim.t);\nvec4 pv \x3d texture2D(u_image, coord + u_halfPixel);\nvec4 minVal, maxVal, pvm;\nif (u_minMaxTexture){\nif (u_bandCount \x3d\x3d1){ //min \x3d red, max \x3d green\nvec4 minmax \x3d texture2D(u_image1, vec2(0.5,0.5));\nminVal \x3d vec4(minmax.r, minmax.r, minmax.r, 0.0);\nmaxVal \x3d vec4(minmax.g, minmax.g, minmax.g, 0.0);\n}\nelse if (u_bandCount \x3d\x3d3){ //min \x3d red, max \x3d green\nminVal \x3d texture2D(u_image1, vec2(0.5,0.5));\nmaxVal \x3d texture2D(u_image2, vec2(0.5,0.5));\n}\nvec4 factors \x3d u_size/(maxVal-minVal+vec4(0.0,0.0,0.0,1.0)) * u_factors;\npvm \x3d (pv - minVal) * factors;\n}\nelse {\npvm \x3d (pv - u_mins) * u_factors;\n}\nfloat histVal \x3d min(floor(pvm.r+pvm.g+pvm.b), u_size-1.0);\nhistVal \x3d pv.a \x3d\x3d 1.0? histVal: u_size;\ngl_Position \x3d vec4((histVal+0.1) / (u_size+1.0) * 2.0 - 1.0, 0.5, 0, 1);\ngl_PointSize \x3d 1.0;\n}",
mesh:"varying vec2 v_texCoord;\nattribute vec2 a_texCoord;\nuniform bool u_drawMeshLines;\nuniform bool u_flipY;\nuniform vec2 u_xformOffset;\nuniform vec2 u_xformScale;\nuniform sampler2D u_transformGrid;\nuniform vec2 u_transformSpacing;\nuniform vec2 u_transformGridSize;\nuniform vec2 u_targetImageSize;\nuniform vec2 u_srcImageSize;\nuniform bool u_projection;\nvec2 projectPixelLocation(vec2 coords) {\nvec2 index_image \x3d floor(coords * u_targetImageSize);\nvec2 oneTransformPixel \x3d vec2(0.25 / u_transformGridSize.s, 1.0 / u_transformGridSize.t);\nvec2 index_transform \x3d floor(index_image / u_transformSpacing) / u_transformGridSize;\nvec2 pos \x3d fract((index_image + vec2(0.5, 0.5)) / u_transformSpacing);\nvec2 srcLocation;\nvec2 transform_location \x3d index_transform + oneTransformPixel * 0.5;\nif (pos.s \x3c\x3d pos.t) {\nvec4 ll_abc \x3d texture2D(u_transformGrid, vec2(transform_location.s, transform_location.t));\nvec4 ll_def \x3d texture2D(u_transformGrid, vec2(transform_location.s + oneTransformPixel.s, transform_location.t));\nsrcLocation.s \x3d dot(ll_abc.rgb, vec3(pos, 1.0));\nsrcLocation.t \x3d dot(ll_def.rgb, vec3(pos, 1.0));\n} else {\nvec4 ur_abc \x3d texture2D(u_transformGrid, vec2(transform_location.s + 2.0 * oneTransformPixel.s, transform_location.t));\nvec4 ur_def \x3d texture2D(u_transformGrid, vec2(transform_location.s + 3.0 * oneTransformPixel.s, transform_location.t));\nsrcLocation.s \x3d dot(ur_abc.rgb, vec3(pos, 1.0));\nsrcLocation.t \x3d dot(ur_def.rgb, vec3(pos, 1.0));\n}\nreturn srcLocation;// + halfPixel;\n}\nvoid main() {\nif (u_projection) {\nv_texCoord \x3d projectPixelLocation(a_texCoord);\n} else {\nv_texCoord \x3d u_xformOffset + a_texCoord * u_xformScale;\n}\nif (u_flipY) {\nv_texCoord.t \x3d 1.0 - v_texCoord.t;\n}\nvec2 position \x3d a_texCoord * 2.0 - 1.0;\nif (u_drawMeshLines){\nvec2 adjustedPos \x3d (v_texCoord - u_xformOffset) / u_xformScale;\ngl_Position \x3d vec4( adjustedPos * 2.0 - 1.0, 0.0, 1.0);\n}\nelse {\ngl_Position \x3d vec4(position, 0.0, 1.0);\n}\n}"}})},
"esri/layers/rasterLib/function/webglHelper":function(){define([],function(){var G={getUniforms:function(e,q){var n=e.getProgramParameter(q,e.ACTIVE_UNIFORMS),p,k,c={};for(p=0;p<n;p++)(k=e.getActiveUniform(q,p))&&(c[k.name]={location:e.getUniformLocation(q,k.name),info:k});return c},setUniform:function(e,q,n){var p=q.info,k=q.location,c=p.type;if(null==n)console.log("uniform "+q.info.name+" has null or undefined value");else switch(c){case e.FLOAT:1<p.size?0===n.length?console.log("uniform "+q.info.name+
" has length 0"):e.uniform1fv(k,n):e.uniform1f(k,n);break;case e.FLOAT_VEC2:if(0===n.length){console.log("uniform "+q.info.name+" has length 0");break}e.uniform2fv(k,n);break;case e.FLOAT_VEC3:if(0===n.length){console.log("uniform "+q.info.name+" has length 0");break}e.uniform3fv(k,n);break;case e.FLOAT_VEC4:if(0===n.length){console.log("uniform "+q.info.name+" has length 0");break}e.uniform4fv(k,n);break;case e.INT:case e.BOOL:1<p.size?0===n.length?console.log("uniform "+q.info.name+" has length 0"):
e.uniform1iv(k,n):e.uniform1i(k,n);break;case e.INT_VEC2:case e.BOOL_VEC2:if(0===n.length){console.log("uniform "+q.info.name+" has length 0");break}e.uniform2iv(k,n);break;case e.INT_VEC3:case e.BOOL_VEC3:if(0===n.length){console.log("uniform "+q.info.name+" has length 0");break}e.uniform3iv(k,n);break;case e.INT_VEC4:case e.BOOL_VEC4:0===n.length?console.log("uniform "+q.info.name+" has length 0"):e.uniform4iv(k,n)}},createTexture:function(e,q){var n=e.createTexture();e.bindTexture(e.TEXTURE_2D,
n);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,q?e.LINEAR:e.NEAREST);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,q?e.LINEAR:e.NEAREST);return n},createBufferTexture:function(e,q,n){q=G.createTexture(e,q);e.getExtension("OES_texture_float");n=n||[e.drawingBufferWidth,e.drawingBufferHeight];e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n[0],n[1],0,e.RGBA,e.FLOAT,null);n=e.createFramebuffer();
e.bindFramebuffer(e.FRAMEBUFFER,n);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,q,0);return{texture:q,frameBuffer:n}},getShader:function(e,q,n){n=n?e.createShader(e.VERTEX_SHADER):e.createShader(e.FRAGMENT_SHADER);e.shaderSource(n,q);e.compileShader(n);e.getShaderParameter(n,e.COMPILE_STATUS)||(console.log(e.getShaderInfoLog(n)),n=null);return n},loadProgram:function(e,q,n){var p=e.createProgram();e.attachShader(p,q);e.attachShader(p,n);e.linkProgram(p);e.getProgramParameter(p,
e.LINK_STATUS)||(console.warn("failed to load webgl program: "+e.getProgramInfoLog(p)),e.deleteProgram(p),p=null);return p},createMesh:function(e,q){if(!e||1===e[0]&&1===e[1])return new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]);var n=e&&q?new Float32Array(e[0]*e[1]*20):new Float32Array(e[0]*e[1]*12);var p=.9998/e[1],k=.9998/e[0],c,a,b=0;for(c=0;c<e[1];c++)for(a=0;a<e[0];a++){var l=1E-4+p*c;var h=1E-4+k*a;e&&!q?(n[b++]=l,n[b++]=h,n[b++]=l+p,n[b++]=h,n[b++]=l,n[b++]=h+k,n[b++]=l,n[b++]=h+k,n[b++]=l+p,
n[b++]=h,n[b++]=l+p,n[b++]=h+k):(n[b++]=l,n[b++]=h,n[b++]=l,n[b++]=h+k,n[b++]=l,n[b++]=h+k,n[b++]=l+p,n[b++]=h+k,n[b++]=l+p,n[b++]=h+k,n[b++]=l+p,n[b++]=h,n[b++]=l,n[b++]=h,n[b++]=l+p,n[b++]=h,n[b++]=l,n[b++]=h+k,n[b++]=l+p,n[b++]=h)}return n}};return G})},"esri/layers/rasterLib/function/convolutionKernel":function(){define([],function(){var G={Default:[0,0,0,0,1,0,0,0,0],LineDetectionHorizontal:[-1,-1,-1,2,2,2,-1,-1,-1],LineDetectionVertical:[-1,2,-1,-1,2,-1,-1,2,-1],LineDetectionLeftDiagonal:[2,
-1,-1,-1,2,-1,-1,-1,2],LineDetectionRightDiagonal:[-1,-1,2,-1,2,-1,2,-1,-1],GradientNorth:[-1,-2,-1,0,0,0,1,2,1],GradientWest:[-1,0,1,-2,0,2,-1,0,1],GradientEast:[1,0,-1,2,0,-2,1,0,-1],GradientSouth:[1,2,1,0,0,0,-1,-2,-1],GradientNorthEast:[0,-1,-2,1,0,-1,2,1,0],GradientNorthWest:[-2,-1,0,-1,0,1,0,1,2],SmoothArithmeticMean:[.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111],Smoothing3x3:[.0625,.125,.0625,.125,.25,.125,.0625,
.125,.0625],Smoothing5x5:[1,1,1,1,1,1,4,4,4,1,1,4,12,4,1,1,4,4,4,1,1,1,1,1,1],Sharpening3x3:[-1,-1,-1,-1,9,-1,-1,-1,-1],Sharpening5x5:[-1,-3,-4,-3,-1,-3,0,6,0,-3,-4,6,21,6,-4,-3,0,6,0,-3,-1,-3,-4,-3,-1],Laplacian3x3:[0,-1,0,-1,4,-1,0,-1,0],Laplacian5x5:[0,0,-1,0,0,0,-1,-2,-1,0,-1,-2,17,-2,-1,0,-1,-2,-1,0,0,0,-1,0,0],SobelHorizontal:[-1,-2,-1,0,0,0,1,2,1],SobelVertical:[-1,0,1,-2,0,2,-1,0,1],Sharpen:[0,-.25,0,-.25,2,-.25,0,-.25,0],Sharpen2:[-.25,-.25,-.25,-.25,3,-.25,-.25,-.25,-.25],PointSpread:[-.627,
.352,-.627,.352,2.923,.352,-.627,.352,-.627],getKernel:function(e){switch(e){case 0:return G.LineDetectionHorizontal;case 1:return G.LineDetectionVertical;case 2:return G.LineDetectionLeftDiagonal;case 3:return G.LineDetectionRightDiagonal;case 4:return G.GradientNorth;case 5:return G.GradientWest;case 6:return G.GradientEast;case 7:return G.GradientSouth;case 8:return G.GradientNorthEast;case 9:return G.GradientNorthWest;case 10:return G.SmoothArithmeticMean;case 11:return G.Smoothing3x3;case 12:return G.Smoothing5x5;
case 13:return G.Sharpening3x3;case 14:return G.Sharpening5x5;case 15:return G.Laplacian3x3;case 16:return G.Laplacian5x5;case 17:return G.SobelHorizontal;case 18:return G.SobelVertical;case 19:return G.Sharpen;case 20:return G.Sharpen2;case 21:return G.PointSpread;default:return G.Default}}};return G})},"esri/layers/rasterLib/function/surfaceUtils":function(){define(["dojo/_base/lang"],function(G){return{hillshade:function(e,q){if(null!==e&&null!==e.pixelBlock&&null!==e.pixelBlock.pixels){var n=
this._clonePixelBlock(e.pixelBlock),p=q.altitude,k=q.azimuth,c=q.zFactor,a=q.psPower,b=q.psFactor,l=q.hillshadeType,h=q.slopeType,g=q.isGCS;1===l&&(c*=2);q=n.width;var d=n.height,f=n.pixels[0],m=n.mask,u=new Uint8Array(q*d);m&&u.set(m);var r=new Uint8Array(q*d),t=(e.extent.xmax-e.extent.xmin)/q,w=(e.extent.ymax-e.extent.ymin)/d,v=c/(8*t),y=c/(8*w);.001<c&&g&&(v/=111E3,y/=111E3);3===h&&(g?(v=111E3*t,y=111E3*w,v=(c+Math.pow(v,a)*b)/(8*v),y=(c+Math.pow(y,a)*b)/(8*y)):(v=(c+Math.pow(t,a)*b)/(8*t),y=(c+
Math.pow(w,a)*b)/(8*w)));g=(90-p)*Math.PI/180;p=Math.cos(g);var x=(360-k+90)*Math.PI/180;k=Math.sin(g)*Math.cos(x);g=Math.sin(g)*Math.sin(x);c=[];a=[];b=[];t=[315,270,225,360,180,0];var A=[60,60,60,60,60,90];h=[3,5,3,2,1,4];var C=h.reduce(function(Q,S){return Q+S});w=h.map(function(Q){return Q/C});if(1===l){var E=t.length;for(h=0;h<E;h++)p=A[h],k=t[h],g=(90-p)*Math.PI/180,p=Math.cos(g),x=(360-k+90)*Math.PI/180,k=Math.sin(g)*Math.cos(x),g=Math.sin(g)*Math.sin(x),c.push(p),a.push(k),b.push(g)}var H=
0;for(h=1;h<d-1;h++)for(A=h*q,t=1;t<q-1;t++)if(m&&!m[A+t])r[A+t]=0;else{x=0;if(m&&(x=m[A-q+t-1]+m[A-q+t]+m[A-q+t+1]+m[A+t-1]+m[A+t+1]+m[A+q+t-1]+m[A+q+t]+m[A+q+t+1],7>x)){r[A+t]=0;u[A+t]=0;continue}if(7===x){var B=m[A-q+t-1]?f[A-q+t-1]:f[A+t];var z=m[A-q+t]?f[A-q+t]:f[A+t];var F=m[A-q+t+1]?f[A-q+t+1]:f[A+t];x=m[A+t-1]?f[A+t-1]:f[A+t];var K=m[A+t+1]?f[A+t+1]:f[A+t];H=m[A+q+t-1]?f[A+q+t-1]:f[A+t];var L=m[A+q+t]?f[A+q+t]:f[A+t];var N=m[A+q+t+1]?f[A+q+t+1]:f[A+t]}else B=f[A-q+t-1],z=f[A-q+t],F=f[A-q+
t+1],x=f[A+t-1],K=f[A+t+1],H=f[A+q+t-1],L=f[A+q+t],N=f[A+q+t+1];x=(F+K+K+N-(B+x+x+H))*v;z=(H+L+L+N-(B+z+z+F))*y;F=Math.sqrt(1+x*x+z*z);H=0;if(0===l)L=g*z-k*x,L=255*(p+L)/F,0>L&&(L=0),H=L;else if(1===l)for(B=0;B<E;B++)L=b[B]*z-a[B]*x,L=255*(c[B]+L)/F,0>L&&(L=0),H+=L*w[B];r[A+t]=H}for(h=0;h<d;h++)r[h*q]=r[h*q+1],r[(h+1)*q-1]=r[(h+1)*q-2];for(h=1;h<q-1;h++)r[h]=r[h+q],r[h+(d-1)*q]=r[h+(d-2)*q];n.pixelType="U8";n.pixels=[r];n.statistics=[{minValue:0,maxValue:255}];m&&(n.mask=u);return{extent:e.extent,
pixelBlock:n}}},slope:function(e,q){if(null!==e&&null!==e.pixelBlock&&null!==e.pixelBlock.pixels){var n=this._clonePixelBlock(e.pixelBlock),p=q.zFactor,k=q.psPower,c=q.psFactor,a=q.slopeType,b=q.isGCS;q=n.width;var l=n.height,h=n.pixels[0],g=n.mask,d=new Uint8Array(q*l);g&&d.set(g);var f=new Float32Array(q*l),m=(e.extent.xmax-e.extent.xmin)/q,u=(e.extent.ymax-e.extent.ymin)/l,r=p/(8*m),t=p/(8*u);1E-4>Math.abs(p-1)&&b&&(r/=111E3,t/=111E3);3===a&&(b?(r=111E3*m,t=111E3*u,r=(p+Math.pow(r,k)*c)/(8*r),
t=(p+Math.pow(t,k)*c)/(8*t)):(r=(p+Math.pow(m,k)*c)/(8*m),t=(p+Math.pow(u,k)*c)/(8*u)));for(p=1;p<l-1;p++)for(c=p*q,k=1;k<q-1;k++)if(g&&!g[c+k])f[c+k]=0;else{u=0;if(g&&(u=g[c-q+k-1]+g[c-q+k]+g[c-q+k+1]+g[c+k-1]+g[c+k+1]+g[c+q+k-1]+g[c+q+k]+g[c+q+k+1],7>u)){f[c+k]=0;d[c+k]=0;continue}if(7===u){u=g[c-q+k-1]?h[c-q+k-1]:h[c+k];b=g[c-q+k]?h[c-q+k]:h[c+k];m=g[c-q+k+1]?h[c-q+k+1]:h[c+k];var w=g[c+k-1]?h[c+k-1]:h[c+k];var v=g[c+k+1]?h[c+k+1]:h[c+k];var y=g[c+q+k-1]?h[c+q+k-1]:h[c+k];var x=g[c+q+k]?h[c+q+
k]:h[c+k];var A=g[c+q+k+1]?h[c+q+k+1]:h[c+k]}else u=h[c-q+k-1],b=h[c-q+k],m=h[c-q+k+1],w=h[c+k-1],v=h[c+k+1],y=h[c+q+k-1],x=h[c+q+k],A=h[c+q+k+1];w=(m+v+v+A-(u+w+w+y))*r;u=(y+x+x+A-(u+b+b+m))*t;u=Math.sqrt(w*w+u*u);f[c+k]=1===a||3===a?57.2957795*Math.atan(u):100*u}for(p=0;p<l;p++)f[p*q]=f[p*q+1],f[(p+1)*q-1]=f[(p+1)*q-2];for(p=1;p<q-1;p++)f[p]=f[p+q],f[p+(l-1)*q]=f[p+(l-2)*q];n.pixelType="F32";n.pixels=[f];n.statistics=[{minValue:0,maxValue:255}];g&&(n.mask=d);return{extent:e.extent,pixelBlock:n}}},
aspect:function(e){if(null!==e&&null!==e.pixelBlock&&null!==e.pixelBlock.pixels){var q=this._clonePixelBlock(e.pixelBlock),n=q.width,p=q.height,k=q.pixels[0],c=q.mask,a=new Uint8Array(n*p);c&&a.set(c);var b=new Float32Array(n*p),l=1/((e.extent.xmax-e.extent.xmin)/n),h=1/((e.extent.ymax-e.extent.ymin)/p),g,d;for(g=1;g<p-1;g++){var f=g*n;for(d=1;d<n-1;d++)if(c&&!c[f+d])b[f+d]=0;else{var m=0;if(c&&(m=c[f-n+d-1]+c[f-n+d]+c[f-n+d+1]+c[f+d-1]+c[f+d+1]+c[f+n+d-1]+c[f+n+d]+c[f+n+d+1],7>m)){b[f+d]=0;a[f+d]=
0;continue}if(7===m){m=c[f-n+d-1]?k[f-n+d-1]:k[f+d];var u=c[f-n+d]?k[f-n+d]:k[f+d];var r=c[f-n+d+1]?k[f-n+d+1]:k[f+d];var t=c[f+d-1]?k[f+d-1]:k[f+d];var w=c[f+d+1]?k[f+d+1]:k[f+d];var v=c[f+n+d-1]?k[f+n+d-1]:k[f+d];var y=c[f+n+d]?k[f+n+d]:k[f+d];var x=c[f+n+d+1]?k[f+n+d+1]:k[f+d]}else m=k[f-n+d-1],u=k[f-n+d],r=k[f-n+d+1],t=k[f+d-1],w=k[f+d+1],v=k[f+n+d-1],y=k[f+n+d],x=k[f+n+d+1];t=(r+w+w+x-(m+t+t+v))*l;m=(v+y+y+x-(m+u+u+r))*h;0===t&&0===m?m=-1:(m=90-57.29578*Math.atan2(m,-t),0>m&&(m+=360),360===m?
m=0:360<m&&(m%=360));b[f+d]=m}}for(g=0;g<p;g++)b[g*n]=b[g*n+1],b[(g+1)*n-1]=b[(g+1)*n-2];for(g=1;g<n-1;g++)b[g]=b[g+n],b[g+(p-1)*n]=b[g+(p-2)*n];q.pixelType="F32";q.pixels=[b];q.statistics={minValue:0,maxValue:360};c&&(q.mask=a);return{extent:e.extent,pixelBlock:q}}},_clonePixelBlock:function(e){return e.clone?e.clone():G.clone(e)}}})},"esri/layers/rasterLib/function/BandArithmeticFunction":function(){define("dojo/_base/declare dojo/_base/lang ./RasterFunctionX ../../PixelBlock ./pixelShaders ./RasterFunctionWebGLMixin ./rasterIndex".split(" "),
function(G,e,q,n,p,k,c){return G([q,k],{declaredClass:"esri.layers.rasterLib.function.BandArithmeticFunction",functionName:"BandArithmetic",supportWebGL:!0,support2D:!0,constructor:function(a){this.functionArguments=this.mixinIgnoreCase({method:1,bandIndexes:"",raster:null},a)},bind:function(a){a=this.getSourceRasterInfo(a);if(!a.raster)return Error("The raster input to band arithmetic function is invalid.");this.rasterInfo=e.mixin(a.raster,{bandCount:8===this.functionArguments.method?a.raster.bandCount:
1,pixelType:this._calculatePixelType(this.pixelType,"F32"),statistics:null,histograms:null});this.rasterInfo.keyProperties=this.rasterInfo.keyProperties||{};this.rasterInfo.keyProperties.DataType="Generic";return!0},read2D:function(a){this._performance.start();a=a.raster;var b=c.calculate(a.pixelBlock,{bandIndexes:this.functionArguments.bandIndexes,method:this.functionArguments.method});this._addPerformanceMetric(this._performance.elapsed());"Unknown"!==this.pixelType&&(b.pixelType=this.pixelType);
return{extent:a.extent,pixelBlock:b}},readGL:function(a){this._performance.start();this._initializeProgram({fragment:p.bandArithmetic,fragmentName:"bandArithmetic"});var b=this.functionArguments.bandIndexes.trim().split(" ").map(function(d){return parseInt(d,10)});this._infraredBandID=b[0]-1;this._visibleBandID=b[1]-1;this._alterBand=2<Math.max(this._infraredBandID,this._visibleBandID)?!0:!1;a=this._setupTextureData(a.raster,this._alterBand&&2==b.length?{bandIDs:[this._infraredBandID,this._visibleBandID,
this._infraredBandID]}:{bandIDs:[b[0]-1,b[1]-1,b[2]-1]});var l=this.bindFrameBuffer(),h=this.functionArguments.method,g=2<b.length?b.slice(2):null;this._alterBand?this._setUniforms({u_method:h,u_bandId_nir:0,u_bandId_red:1,u_constants:g}):this._setUniforms({u_method:h,u_bandId_nir:b[0]-1,u_bandId_red:b[1]-1,u_constants:g});this._bindTexture(a.texture,"u_image");this._drawGL();this._addPerformanceMetric(this._performance.elapsed());return{extent:a.extent,texture:l.texture}}})})},"esri/layers/rasterLib/function/rasterIndex":function(){define(["dojo/_base/lang"],
function(G){return{calculate:function(e,q){if(e&&e.pixels&&e.pixels.length){var n=q&&q.bandIndexes;q=q&&q.method;var p=n.trim().split(" ").map(function(a){return parseInt(a,10)}).filter(function(a){return null!=a});e=this._clonePixelBlock(e);var k=e.pixels,c=e.mask;switch(q){case 1:k=this._calculateNDVI(c,k[p[0]-1],k[p[1]-1]);break;case 2:k=this._calculateSAVI(c,k[p[0]-1],k[p[1]-1],p[2]);break;case 3:k=this._calculateTSAVI(c,k[p[0]-1],k[p[1]-1],p[2],p[3],p[4]);break;case 4:k=this._calculateMSAVI(c,
k[p[0]-1],k[p[1]-1]);break;case 5:k=this._calculateGEMI(c,k[p[0]-1],k[p[1]-1]);break;case 6:k=this._calculatePVI(c,k[p[0]-1],k[p[1]-1],p[2],p[3]);break;case 7:k=this._calculateGVITM(c,k[p[0]-1],k[p[1]-1],k[p[2]-1],k[p[3]-1],k[p[4]-1],k[p[5]-1]);break;case 8:k=this._calculateSultan(c,k[p[0]-1],k[p[1]-1],k[p[2]-1],k[p[3]-1],k[p[4]-1],k[p[5]-1]);break;case 9:k=this._calculateVARI(c,k[p[0]-1],k[p[1]-1],k[p[2]-1]);break;case 0:k=this._calculateUserDefined(c,k,n)}e.pixels=k;e.pixelType="F32";e.calculateStatistics();
return e}},_clonePixelBlock:function(e){return e.clone?e.clone():G.clone(e)},_parseUserDefined:function(e,q){e=e.replace(" ","");0===e.indexOf("-")&&(e="0"+e);0===e.indexOf("+")&&(e=e.slice(1,e.length));e=e.split("");var n=[],p=[],k="+-*/()".split(""),c,a="";for(c=0;c<e.length;c++){var b=e[c];k.some(function(l){return l===b})?(""!==a&&p.push(parseFloat(a)),n.push(b),a=""):"b"===b.toLowerCase()?(c++,a=b.concat(e[c]),p.push(q[parseInt(a[1],10)-1]),a=""):(a=a.concat(b),c===e.length-1&&p.push(parseFloat(a)))}return{ops:n,
nums:p}},_op:function(e,q,n,p){if(n.constructor===Number&&p.constructor===Number)return n+p;var k;if(n.constructor===Number){var c=p.length;var a=n;n=new Float32Array(c);for(k=0;k<c;k++)n[k]=a}else if(c=n.length,p.constructor===Number)for(a=p,p=new Float32Array(c),k=0;k<c;k++)p[k]=a;a=new Float32Array(c);if(null==e)if("+"===q)for(k=0;k<c;k++)a[k]=n[k]+p[k];else if("-"===q)for(k=0;k<c;k++)a[k]=n[k]-p[k];else if("*"===q)for(k=0;k<c;k++)a[k]=n[k]*p[k];else{if("/"===q)for(k=0;k<c;k++)a[k]=n[k]/p[k]}else if("+"===
q)for(k=0;k<c;k++)e[k]&&(a[k]=n[k]+p[k]);else if("-"===q)for(k=0;k<c;k++)e[k]&&(a[k]=n[k]-p[k]);else if("*"===q)for(k=0;k<c;k++)e[k]&&(a[k]=n[k]*p[k]);else if("/"===q)for(k=0;k<c;k++)e[k]&&(a[k]=n[k]/p[k]);return a},_shrinkOp:function(e,q){e.splice(q,1);var n=q=0,p=0;do{for(q=p=n=0;q<e.length;q++)if("("===e[q])n=q;else if(")"===e[q]){p=q;break}p===n+1&&e.splice(n,2)}while(p===n+1);return e},_getPriorityOpIndex:function(e,q){if(1===e.length)return{opIndex:0,numIndex:0};var n=q=0,p=0,k=-1,c=0;for(q=
0;q<e.length;q++)if("("===e[q])n=q;else if(")"===e[q]){p=q;break}var a=0===p?e:e.slice(n+1,p);for(q=0;q<a.length;q++)if("*"===a[q]||"/"===a[q]){k=q;break}if(!(-1<k))for(q=0;q<a.length;q++)if("+"===a[q]||"-"===a[q]){k=q;break}0<p&&(k+=n+1);for(q=0;q<k;q++)"("===e[q]&&c++;return{opIndex:k,numIndex:k-c}},_calculateUserDefined:function(e,q,n){q=this._parseUserDefined(n,q);n=q.ops;for(var p=q.nums,k,c,a;0<n.length&&(q=this._getPriorityOpIndex(n,p),k=n[q.opIndex],c=p[q.numIndex],a=p[q.numIndex+1],k=this._op(e,
k,c,a),1!==n.length);)n=this._shrinkOp(n,q.opIndex),p.splice(q.numIndex,2,k);return[k]},_calculateNDVI:function(e,q,n){var p=n.length,k=new Float32Array(p),c;if(null==e)for(c=0;c<p;c++){var a=n[c];var b=q[c];k[c]=(b-a)/(b+a)}else for(c=0;c<p;c++)e[c]&&(a=n[c],b=q[c],k[c]=(b-a)/(b+a));return[k]},_calculateSAVI:function(e,q,n,p){var k=n.length,c=new Float32Array(k),a;if(null==e)for(a=0;a<k;a++){var b=n[a];var l=q[a];c[a]=(l-b)/(l+b+p)*(1+p)}else for(a=0;a<k;a++)e[a]&&(b=n[a],l=q[a],c[a]=(l-b)/(l+b+
p)*(1+p));return[c]},_calculateTSAVI:function(e,q,n,p,k,c){var a=n.length,b=new Float32Array(a),l=-k*p+c*(1+p*p);if(null==e)for(c=0;c<a;c++){var h=n[c];var g=q[c];b[c]=p*(g-p*h-k)/(k*g+h+l)}else for(c=0;c<a;c++)e[c]&&(h=n[c],g=q[c],b[c]=p*(g-p*h-k)/(k*g+h+l));return[b]},_calculateMSAVI:function(e,q,n){var p=n.length,k=new Float32Array(p),c;if(null==e)for(c=0;c<p;c++){var a=n[c];var b=q[c];k[c]=.5*(2*(b+1)-Math.sqrt(Math.pow(2*b+1,2)-8*(b-a)))}else for(c=0;c<p;c++)e[c]&&(k[c]=.5*(2*(b+1)-Math.sqrt(Math.pow(2*
b+1,2)-8*(b-a))));return[k]},_calculateGEMI:function(e,q,n){var p=n.length,k=new Float32Array(p),c;if(null==e)for(c=0;c<p;c++){var a=n[c];var b=q[c];b=(2*(b*b-a*a)+1.5*b+.5*a)/(b+a+.5);k[c]=b*(1-.25*b)-(a-.125)/(1-a)}else for(c=0;c<p;c++)e[c]&&(a=n[c],b=q[c],b=(2*(b*b-a*a)+1.5*b+.5*a)/(b+a+.5),k[c]=b*(1-.25*b)-(a-.125)/(1-a));return[k]},_calculatePVI:function(e,q,n,p,k){var c=n.length,a=new Float32Array(c),b,l=Math.sqrt(1+p*p);if(null==e)for(b=0;b<c;b++){var h=n[b];var g=q[b];a[b]=(g-p*h-k)/l}else for(b=
0;b<c;b++)e[b]&&(h=n[b],g=q[b],a[b]=(g-p*h-k)/l);return[a]},_calculateGVITM:function(e,q,n,p,k,c,a){var b=q.length,l=new Float32Array(b),h;if(null==e)for(h=0;h<b;h++)l[h]=-.2848*q[h]-.2435*n[h]-.5436*p[h]+.7243*k[h]+.084*c[h]-1.18*a[h];else for(h=0;h<b;h++)e[h]&&(l[h]=-.2848*q[h]-.2435*n[h]-.5436*p[h]+.7243*k[h]+.084*c[h]-1.18*a[h]);return[l]},_calculateSultan:function(e,q,n,p,k,c,a){n=q.length;var b=new Float32Array(n),l=new Float32Array(n),h=new Float32Array(n),g;if(null==e)for(g=0;g<n;g++)b[g]=
c[g]/a[g]*100,l[g]=c[g]/q[g]*100,h[g]=p[g]/k[g]*(c[g]/k[g])*100;else for(g=0;g<n;g++)e[g]&&(b[g]=c[g]/a[g]*100,l[g]=c[g]/q[g]*100,h[g]=p[g]/k[g]*(c[g]/k[g])*100);return[b,l,h]},_calculateVARI:function(e,q,n,p){var k=q.length,c=new Float32Array(k),a;if(null==e)for(a=0;a<k;a++){var b=q[a];var l=n[a];var h=p[a];c[a]=(l-b)/(l+b-h)}else for(a=0;a<k;a++)if(e[a])for(a=0;a<k;a++)b=q[a],l=n[a],h=p[a],c[a]=(l-b)/(l+b-h);return[c]}}})},"esri/layers/rasterLib/function/ColormapFunction":function(){define("dojo/_base/declare dojo/_base/lang ../../../renderers/colorRampGenerator ./RasterFunctionX ./pixelShaders ./RasterFunctionWebGLMixin ./rasterUtils".split(" "),
function(G,e,q,n,p,k,c){return G([n,k],{declaredClass:"esri.layers.rasterLib.function.ColormapFunction",functionName:"Colormap",pixelType:"U8",renderTexture:!1,supportWebGL:!0,support2D:!0,constructor:function(a){this.functionArguments=this.mixinIgnoreCase({colormap:null,colorRampName:null,colorRamp:null,colorMapName:null,raster:null},a);this.invert=a&&a.invert;a=a.colormap||a.Colormap;if(a){if(a.features||a[0].attributes){a=a.features||a;var b=Object.keys(a[0].attributes);var l=b.filter(function(u){return"alpha"===
u.toLowerCase()})[0];var h=b.filter(function(u){return"value"===u.toLowerCase()})[0];var g=b.filter(function(u){return"red"===u.toLowerCase()})[0];var d=b.filter(function(u){return"green"===u.toLowerCase()})[0];var f=b.filter(function(u){return"blue"===u.toLowerCase()})[0];if(!(h&&g&&d&&f))throw"invalid colormap";a=a.map(function(u){return l?[u.attributes[h],u.attributes[g],u.attributes[d],u.attributes[f],u.attributes[l]]:[u.attributes[h],u.attributes[g],u.attributes[d],u.attributes[f]]});var m=1.1>
Math.max.apply(null,a.map(function(u){return u[1]}));b=l&&1.1>Math.max.apply(null,a.map(function(u){return u[4]}));if(m)for(m=0;m<a.length;m++)a[m][1]=Math.round(255*a[m][1]),a[m][2]=Math.round(255*a[m][2]),a[m][3]=Math.round(255*a[m][3]),b&&(a[m][4]=Math.round(255*a[m][4]))}this.functionArguments.colormap=this._sortClr(a)}this._initialize()},bind:function(a){this._initialize();a=this.getSourceRasterInfo(a);if(!a.raster||"F32"===a.raster.pixelType)return Error("The raster input to colormap function is invalid. It must be integer type.");
this.rasterInfo=e.mixin(a.raster,{bandCount:3,pixelType:this._calculatePixelType(this.pixelType,"U8"),statistics:null,histograms:null});this.rasterInfo.keyProperties=this.rasterInfo.keyProperties||{};this.rasterInfo.keyProperties.DataType="Processed";return!0},read2D:function(a){return this._colorize(a.raster)},readGL:function(a){return this._colorizeGL(a.raster)},_colorize:function(a){this._performance.start();var b=c.colorize(a.pixelBlock,{indexedColormap:this._indexedColormap,indexedColormapOffset:this._indexedColormapOffset,
indexed2DColormap:this._indexed2DColormap,alphaSpecified:this._alphaSpecified});this._addPerformanceMetric(this._performance.elapsed());return{extent:a.extent,pixelBlock:b}},_binarySearchClr:function(a,b){for(var l=0,h=a.length-1,g=0,d=0;l<h;)if(g=Math.floor((l+h)/2),d=a[g],d[0]<b)l=g;else if(d[0]>b)h=g;else return d.slice(1);return null},_sortClr:function(a,b){var l,h=[];for(l=0;l<a.length;l++)h.push(a[l]);for(l=0;l<h.length-1;l++){var g=h[l];for(a=l+1;a<h.length;a++)g[0]>h[a][0]&&(g=h[a],h[a]=h[l],
h[l]=g)}if(b)for(l=0;l<h.length/2;l++)g=h[l],h[h.length-1-l]=h[l],h[l]=g;return h},_invertColorRamp:function(a){if(!a)return a;var b={type:a.type};"random"===a.type?b=a:"multipart"===a.type?b.colorRamps=a.colorRamps.map(function(l){return{fromColor:l.toColor,toColor:l.fromColor}}).reverse():(b.fromColor=a.toColor,b.toColor=a.fromColor);return b},_initialize:function(){this._indexedColormapOffset=0;if(this.functionArguments.colormap){var a=c.buildIndexedColormap(this.functionArguments.colormap);this._alphaSpecified=
a&&a.alphaSpecified;this._indexedColormap=a&&a.indexedColormap;this._indexedColormapOffset=a&&a.offset;this._indexedColormap||(this._indexed2DColormap=this._getIndexed2DColormap())}else this.functionArguments.colorRamp?this._indexedColormap="multipart"===this.functionArguments.colorRamp.type?this.invert?q.createMultiPartColorRamp(this._invertColorRamp(this.functionArguments.colorRamp)):q.createMultiPartColorRamp(this.functionArguments.colorRamp):this.invert?q.createAlgorithmicColorRamp(this._invertColorRamp(this.functionArguments.colorRamp)):
q.createAlgorithmicColorRamp(this.functionArguments.colorRamp):this.functionArguments.colormapName&&"random"===this.functionArguments.colormapName.toLowerCase()&&(this._indexedColormap=q.createRandomColorRamp())},_getIndexed2DColormap:function(){var a=this.functionArguments.colormap;if(!a)return null;var b=0;0>a[0][0]&&(b=a[0][0]);var l=[],h=5===a[0].length,g;for(g=0;g<a.length;g++)l[a[g][0]-b]=h?a[g].slice(1):a[g].slice(1).concat([255]);return l},_colorizeGL:function(a){this._performance.start();
this._initializeProgram({fragment:p.colormap,fragmentName:"Colormap"});var b=this._indexedColormap,l=this._indexedColormapOffset;this._clrTexture||(this._clrTexture=this._setupColormapTexture(b));var h=this._clrTexture,g=this.bindFrameBuffer();a=this._setupTextureData(a);this._setUniforms({u_indexedColormapOffset:l,u_indexedColormapMaxIndex:b.length/4-1});this._bindTexture(h,"u_image1");this._bindTexture(a.texture,"u_image");this._drawGL();return{extent:a.extent,texture:g.texture}},_setupColormapTexture:function(a){var b=
this._createTexture(),l=this.gl,h=a.length/4,g=new Float32Array(a.length),d,f=this.renderTexture?255:1;for(d=0;d<a.length;d++)g[d]=a[d]/f;l.getExtension("OES_texture_float");l.texImage2D(l.TEXTURE_2D,0,l.RGBA,h,1,0,l.RGBA,l.FLOAT,g);return b}})})},"esri/renderers/colorRampGenerator":function(){define(["dojo/_base/declare","dojo/_base/lang","../renderers/colorUtils"],function(G,e,q){return{createAlgorithmicColorRamp:function(n,p){if(!n)return null;var k=n.fromColor,c=n.toColor;if(!k||!c)return null;
void 0===k.r&&3<=k.length&&(k={r:k[0],g:k[1],b:k[2]});void 0===c.r&&3<=c.length&&(c={r:c[0],g:c[1],b:c[2]});var a=n.size||256;n=n.algorithm||"cie-lab";if(1===a)var b=[k.r,k.g,k.b,255];else if(2===a)b=[k.r,k.g,k.b,255,c.r,c.g,k.b,255];else if(-1<n.toLowerCase().indexOf("hsv")){b=q.toHSV(k);c=q.toHSV(c);a=a||256;var l=0===b.s,h=0===c.s;k=b.h;n=c.h;l&&!h?k=b.h=n:h&&!l&&(n=c.h=k);l=Math.abs(n-k);180>l?n=(n-k)/(a-1):(l=360-l,n=k>n?l/(a-1):-l/(a-1));l=(c.s-b.s)/(a-1);h=(c.v-b.v)/(a-1);var g=b.s;b=b.v;var d,
f=new Uint8Array(4*a);for(d=0;d<a-1;d++){var m=q.toRGB({h:k,s:g,v:b});f[4*d]=m.r;f[4*d+1]=m.g;f[4*d+2]=m.b;f[4*d+3]=255;k+=n;g+=l;b+=h;360<k?k-=360:0>k&&(k+=360)}m=q.toRGB(c);f[4*(a-1)]=m.r;f[4*(a-1)+1]=m.g;f[4*(a-1)+2]=m.b;f[4*(a-1)+3]=255;b=f}else if(-1<n.toLowerCase().indexOf("lch")){g=q.toLCH(k);c=q.toLCH(c);a=a||256;b=(c.l-g.l)/(a-1);k=(c.c-g.c)/(a-1);n=(c.h-g.h)/(a-1);l=g.l;h=g.c;g=g.h;f=new Uint8Array(4*a);for(d=0;d<a-1;d++)m=q.toRGB({l:l,c:h,h:g}),f[4*d]=m.r,f[4*d+1]=m.g,f[4*d+2]=m.b,f[4*
d+3]=255,l+=b,h+=k,g+=n;m=q.toRGB(c);f[4*(a-1)]=m.r;f[4*(a-1)+1]=m.g;f[4*(a-1)+2]=m.b;f[4*(a-1)+3]=255;b=f}else if(-1<n.toLowerCase().indexOf("lab")){g=q.toLAB(k);c=q.toLAB(c);a=a||256;b=(c.l-g.l)/(a-1);k=(c.a-g.a)/(a-1);n=(c.b-g.b)/(a-1);l=g.l;h=g.a;g=g.b;f=new Uint8Array(4*a);for(d=0;d<a-1;d++)m=q.toRGB({l:l,a:h,b:g}),f[4*d]=m.r,f[4*d+1]=m.g,f[4*d+2]=m.b,f[4*d+3]=255,l+=b,h+=k,g+=n;m=q.toRGB(c);f[4*(a-1)]=m.r;f[4*(a-1)+1]=m.g;f[4*(a-1)+2]=m.b;f[4*(a-1)+3]=255;b=f}if(p&&!1===p.flattened)for(p=b,
b=[],c=0;c<b/4;c++)b[c]=p.slice(4*c,4*c+4);return b},createMultiPartColorRamp:function(n,p){if(!n)return null;p=p&&e.clone(p)||{flattened:!0};var k=n.colorRamps;if(!k||0===k.length)return null;var c=n.size||256;n=Math.max(Math.floor(c/k.length),1);var a=Math.max(n,c-(k.length-1)*n),b=!1!==p.flattened;p.flattened=!0;c=(k.length-1)*n+a;var l=new Uint8Array(4*c);for(c=0;c<k.length;c++){var h={fromColor:k[c].fromColor,toColor:k[c].toColor,size:c===k.length-1?a:n};l instanceof Array?l.concat(this.createAlgorithmicColorRamp(h,
p)):l.set(this.createAlgorithmicColorRamp(h,p),n*c*4)}if(!b)for(p=l,l=[],c=0;c<l/4;c++)l[c]=p.slice(4*c,4*c+4);return l},createRandomColorRamp:function(n){n=n||{};var p=n.size||256,k=!1===n.flattened;var c=k?new Uint8Array(4*p):[];for(n=0;n<p;n++)k?(c[4*n]=Math.round(255*Math.random()),c[4*n+1]=Math.round(255*Math.random()),c[4*n+2]=Math.round(255*Math.random()),c[4*n+3]=255):c[n]=[Math.round(255*Math.random()),Math.round(255*Math.random()),Math.round(255*Math.random()),255];return c}}})},"esri/layers/rasterLib/function/rasterUtils":function(){define(["dojo/_base/lang"],
function(G){return{mask:function(e,q){if(e&&e.pixels&&e.pixels.length){e=this._clonePixelBlock(e);var n=q.includedRanges,p=q.noDataInterpretation;q=q.noDataValues;if(null===n&&null===q)return e;var k=e.pixels,c=e.mask,a=e.width*e.height,b=k.length,l;if(null!==q&&q.length!==b)throw"expect "+b+" elements in noDataValues";if(null!==n&&n.length!==2*b)throw"expect "+2*b+" elements in IncludeRanges";if(null==c){c=new Uint8Array(a);for(l=0;l<a;l++)c[l]=1;e.mask=c}if(0===p)for(p=0;p<b;p++){var h=k[p];var g=
null===n?null:n[2*p];var d=null===n?null:n[2*p+1];var f=null===q?null:parseFloat(q[p]);if(null===g||null===d)for(l=0;l<a;l++){if(c[l]){var m=h[l];m===f&&(c[l]=0)}}else if(null===f)for(l=0;l<a;l++)c[l]&&(m=h[l],m<g||m>d)&&(c[l]=0);else for(l=0;l<a;l++)c[l]&&(m=h[l],m<g||m>d||m===f)&&(c[l]=0)}else{var u=new Uint8Array(a);for(l=0;l<a;l++)u[l]=c[l];for(p=0;p<b;p++)if(h=k[p],g=null===n?null:n[2*p],d=null===n?null:n[2*p+1],f=null===q?null:parseFloat(q[p]),null===g||null===d)for(l=0;l<a;l++)u[l]&&(m=h[l],
m!==f&&(u=0));else if(null===f)for(l=0;l<a;l++)u[l]&&(m=h[l],m<=g&&m<=d&&(u=0));else for(l=0;l<a;l++)u[l]&&(m=h[l],m<=g&&m<=d&&m!==f&&(u=0));for(l=0;l<a;l++)c[l]&&u[l]&&(c[l]=0)}return e}},calculateStatisticsHistograms:function(e,q){e=this._clonePixelBlock(e);q=e.pixelType;var n=e.pixels,p=e.mask,k=n.length,c,a,b=[],l;for(c=0;c<k;c++){var h={min:-.5,max:255.5,size:256,counts:new Uint32Array(256)};var g=h.counts;var d=n[c];if("U8"===q)if(p)for(a=0;a<e.width*e.height;a++)p[a]&&g[d[a]]++;else for(a=
0;a<e.width*e.height;a++)g[d[a]]++;else{var f=e.statistics[c].minValue;var m=e.statistics[c].maxValue;h.min=f;h.max=m;m=(m-f)/256;var u=new Uint32Array(257);if(p)for(a=0;a<e.width*e.height;a++)p[a]&&u[Math.floor((d[a]-f)/m)]++;else for(a=0;a<e.width*e.height;a++)u[Math.floor((d[a]-f)/m)]++;for(a=0;255>a;a++)g[a]=u[a];g[255]=u[255]+u[256]}b.push(h);f=e.statistics[c].minValue;m=e.statistics[c].maxValue;for(a=u=l=d=0;a<h.size;a++)d+=g[a],l+=a*g[a];l/=d;for(a=0;a<h.size;a++)u+=g[a]*Math.pow(a-l,2);g=
Math.sqrt(u/(d-1));a=(l+.5)*(h.max-h.min)/h.size+h.min;h=g*(h.max-h.min)/h.size;e.statistics[c]={min:f,minValue:f,max:m,maxValue:m,mean:a,stddev:h}}e.histograms=b;return e},buildIndexedColormap:function(e,q){if(!e)return null;var n=0;0>e[0][0]&&(n=e[0][0]);var p=Math.max(256,e[e.length-1][0]-n);if(65536<p)return null;var k=new Uint8Array(4*p),c=[],a=0,b=5===e[0].length;if(q)for(c=e[a],q=c[0]-n;q<p;q++)k[4*q]=c[1],k[4*q+1]=c[2],k[4*q+2]=c[3],k[4*q+3]=b?c[4]:255,q===c[0]-n&&(c=a===e.length-1?c:e[++a]);
else for(q=0;q<e.length;q++)c=e[q],a=4*(c[0]-n),k[a]=c[1],k[a+1]=c[2],k[a+2]=c[3],k[a+3]=b?c[4]:255;return{indexedColormap:k,offset:n,alphaSpecified:b}},colorize:function(e,q){if(null!==e&&null!==e.pixels){e=this._clonePixelBlock(e);var n=e.pixels,p=e.width*e.height,k=e.mask,c=q.indexedColormap,a=q.indexedColormapOffset,b=c&&c.length-1,l=q.indexed2DColormap;q=q.alphaSpecified;if(3<=n.length)throw"colormap only works on single band image";var h=n[0],g=new Uint8Array(h.length),d=new Uint8Array(h.length),
f=new Uint8Array(h.length),m=0;if(c)if(k)for(n=0;n<p;n++)k[n]&&(m=4*(h[n]-a),m<a||m>b?k[n]=0:(g[n]=c[m],d[n]=c[m+1],f[n]=c[m+2],k[n]=c[m+3]));else{k=new Uint8Array(p);for(n=0;n<p;n++)m=4*(h[n]-a),m<a||m>b?k[n]=0:(g[n]=c[m],d[n]=c[m+1],f[n]=c[m+2],k[n]=c[m+3]);e.mask=k}else if(k)for(n=0;n<p;n++)k[n]&&(c=l[h[n]],g[n]=c[0],d[n]=c[1],f[n]=c[2],k[n]=c[3]);else{k=new Uint8Array(p);for(n=0;n<p;n++)c=l[h[n]],g[n]=c[0],d[n]=c[1],f[n]=c[2],k[n]=c[3];e.mask=k}e.pixels=[g,d,f];e.statistics=null;e.pixelType="U8";
e.maskIsAlpha=q;return e}},convolute:function(e,q){e=this._clonePixelBlock(e);var n=e.pixels,p=e.width,k=e.height,c=p*k,a=n.length,b,l,h,g,d=[],f=[],m=q.normalizedKernel,u=q.kernelRows,r=q.kernelCols;for(q=0;q<a;q++){var t=n[q];var w=new Float32Array(c);w.set(t);for(h=1;h<k-1;h++){var v=h*p;for(g=1;g<p-1;g++){for(b=f=0;b<u;b++)for(l=0;l<r;l++)f+=t[v+g+(b-1)*p+l-1]*m[b*r+l];w[v+g]=f}}d.push(w)}e.pixels=d;return e},contrastBrightnessStretch:function(e,q){if(null!==e&&null!==e.pixels){e=this._clonePixelBlock(e);
var n=e.pixels,p=e.mask,k=e.width*e.height,c=n.length;var a=q&&q.contrastOffset;q=q&&q.brightnessOffset;if("U8"!==e.pixelType)throw"the contrast and brightness function only supports 8 bit unsigned integer data";var b=this._createContrastBrightnessLUT(a,q);if(null==p)for(a=0;a<k;a++)for(q=0;q<c;q++)n[q][a]=b[n[q][a]];else for(a=0;a<k;a++)if(p[a])for(q=0;q<c;q++)n[q][a]=b[n[q][a]];e.pixelType="U8";return e}},isNull:function(e,q){if(null!==e&&null!==e.pixels){e=this._clonePixelBlock(e);q=e.mask;var n=
e.pixels[0],p=n.length,k;if(q){for(k=0;k<p;k++)n[k]=q[k]?0:1;e.mask=null}else if(n.fill)n.fill(0);else for(k=0;k<p;k++)n[k]=0;return e}},setNull:function(e){if(null!==q&&null!==q.pixels){var q=this._clonePixelBlock(e);e=q.mask;var n=q.pixels[0],p=n.length,k;e=e||new Uint8Array(p);for(k=0;k<p;k++)e[k]=n[k]?0:1;q.mask=e;return q}},local:function(e,q){if(!q)return e[0];var n=q.rasterCountNeeded;q=q.functor;var p=this._clonePixelBlock(e[0]);if(null!==p&&null!==p.pixels){var k=p.width*p.height,c;e=(c=
e[1])&&c.pixels[0];var a=c&&c.mask,b=p.mask,l=p.pixels[0];if(2===n)if(!b&&a)b=a;else if(b&&a)for(c=0;c<k;c++)b[c]=b[c]&&a[c]?1:0;p.mask=b;if(1===n)if(null==b)for(c=0;c<k;c++)l[c]=q(l[c]);else for(c=0;c<k;c++)b[c]&&(l[c]=q(l[c]));else if(2===n)if(null==b)for(c=0;c<k;c++)l[c]=q(l[c],e[c]);else for(c=0;c<k;c++)b[c]&&(l[c]=q(l[c],e[c]));p.mask=b;p.calculateStatistics();return p}},remapColor:function(e,q){e=this._clonePixelBlock(e);var n=e.width*e.height,p=q.length,k=Math.floor(p/2),c=q[Math.floor(k)],
a=q[0].value,b=q[q.length-1].value,l=e.pixels[0],h,g,d=!1,f=new Uint8Array(n),m=new Uint8Array(n),u=new Uint8Array(n),r=e.mask,t=4===q[0].mappedColor.length;r&&0!==r.length||(r=new Uint8Array(n),r.fill(t?255:1),e.mask=r);for(g=0;g<n;g++)if(r[g]){var w=l[g];if(w<a||w>b)f[g]=m[g]=u[g]=r[g]=0;else{d=!1;var v=k;var y=c;var x=0;for(h=p-1;1<h-x;){if(w===y.value){d=!0;break}w>y.value?x=v:h=v;v=Math.floor((x+h)/2);y=q[Math.floor(v)]}d||(y=w===q[h].value?q[h]:q[x]);f[g]=y.mappedColor[0];m[g]=y.mappedColor[1];
u[g]=y.mappedColor[2];r[g]=y.mappedColor[3]}}e.pixels=[f,m,u];e.mask=r;e.pixelType="u8";e.maskIsAlpha=t;return e},_clonePixelBlock:function(e){if(e.clone)return e.clone();var q=G.clone(e),n;if(e.pixels&&e.pixels[0]&&0<e.pixels[0].length&&!(q.pixels&&q.pixels[0]&&0<q.pixels[0].length)){q.pixels=[];var p=e.pixels.length;for(n=0;n<p;n++)q.pixels[n]=new e.pixels[n].constructor(e.pixels[n])}if(e.statistics)for(q.statistics=[],p=e.statistics.length,n=0;n<p;n++)q.statistics[n]=G.clone(e.statistics[n]);e.mask&&
(q.mask=new Uint8Array(e.mask));return q},_createContrastBrightnessLUT:function(e,q){if(this._contrastCache&&this._contrastCache.contrastOffset===e&&this._contrastCache.brightnessOffset===q)return this._contrastCache.lut;var n=Math.min(Math.max(e,-100),100),p=Math.min(Math.max(q,-100),100),k,c=new Uint8Array(256);for(k=0;256>k;k++){if(0<n&&100>n)var a=(200*k-25500+510*p)/(2*(100-n))+128;else 0>=n&&-100<n?a=(200*k-25500+510*p)*(100+n)/2E4+128:100===n?(a=200*k-25500+256*(100-n)+510*p,a=0<a?255:0):-100===
n&&(a=128);c[k]=255<a?255:0>a?0:a}this._contrastCache={contrastOffset:e,brightnessOffset:q,lut:c};return c}}})},"esri/layers/rasterLib/function/CompositeBandFunction":function(){define("dojo/_base/declare dojo/_base/lang ./RasterFunctionX ../../PixelBlock ./pixelShaders ./RasterFunctionWebGLMixin".split(" "),function(G,e,q,n,p,k){return G([q,k],{declaredClass:"esri.layers.rasterLib.function.CompositeBandFunction",functionName:"CompositeBand",supportWebGL:!0,support2D:!0,constructor:function(c){this.functionArguments=
this.mixinIgnoreCase({rasters:null},c)},bind:function(c){c=this.getSourceRasterInfo(c);if(!c.rasters)return Error("The rasters input to composite band function is invalid.");var a=[],b=[],l=c.rasters.length,h;if(c.rasters[0].statistics)for(h=0;h<l;h++)a.push(c.rasters[h].statistics[0]);if(c.rasters[0].histograms)for(h=0;h<l;h++)b.push(c.rasters[h].histograms[0]);this.rasterInfo=e.mixin(c.rasters[0],{bandCount:l,pixelType:this._calculatePixelType(this.pixelType,c.rasters[0].pixelType),statistics:a,
histograms:b});return!0},read2D:function(c){c=c.rasters;if(null!=c&&0!==c.length){var a=this._clonePixelData(c[0]),b=a.pixelBlock,l=[],h=[];for(g=0;g<c.length;g++)l.push(c[g].pixelBlock.pixels[0]),h.push(c[g].pixelBlock.statistics[0]);b.pixels=l;b.stackedStatistics=h;b.planes=c.length;var g;h=b.width*b.height;for(g=0;g<c.length;g++)if(b=c[g].pixelBlock.mask,d&&b)for(l=0;l<h;l++)d[l]&=b[l];else var d=d||b;a.maks=d;return a}},readGL:function(c){this._performance.start();this._initializeProgram({fragment:p.compositeBand,
fragmentName:"CompositeBand"});var a=c.rasters;if(null!=a&&0!==a.length){a=a.length;var b,l=this.bindFrameBuffer();for(b=0;b<a;b++){var h=this._setupTextureData(c.rasters[b],{notOriginal:0<b});var g=0<b?b.toString():"";this._bindTexture(h.texture,"u_image"+g)}this._setUniforms({u_rasterCount:a});this._drawGL();this._addPerformanceMetric(this._performance.elapsed());return{extent:h.extent,texture:l.texture}}}})})},"esri/layers/rasterLib/function/ContrastBrightnessFunction":function(){define("dojo/_base/declare dojo/_base/lang ./RasterFunctionX ../../PixelBlock ./pixelShaders ./RasterFunctionWebGLMixin ./rasterUtils".split(" "),
function(G,e,q,n,p,k,c){return G([q,k],{declaredClass:"esri.layers.rasterLib.function.ContrastBrightnessFunction",renderTexture:!0,functionName:"ContrastBrightness",supportWebGL:!0,support2D:!0,pixelType:"U8",constructor:function(a){this.functionArguments=this.mixinIgnoreCase({contrastOffset:0,brightnessOffset:0,raster:null},a)},bind:function(a){a=this.getSourceRasterInfo(a);if(!a.raster)return Error("The raster input to contrast and brightness function is invalid.");this.rasterInfo=e.mixin(a.raster,
{bandCount:a.raster.bandCount,pixelType:this._calculatePixelType(this.pixelType,"U8"),statistics:null,histograms:null});this.rasterInfo.keyProperties=this.rasterInfo.keyProperties||{};this.rasterInfo.keyProperties.DataType="Processed";return!0},read2D:function(a){a=a.raster;if(null!==a&&null!==a.pixelBlock&&null!==a.pixelBlock.pixels){var b=c.contrastBrightnessStretch(a.pixelBlock,{contrastOffset:this.functionArguments.contrastOffset,brightnessOffset:this.functionArguments.brightnessOffset});"Unknown"!==
this.pixelType&&(b.pixelType=this.pixelType,b.pixels=b.pixels.map(e.hitch(this,function(l){return this._clampBand(l,b.pixelType)})));return{extent:a.extent,pixelBlock:b}}},readGL:function(a){return this._cbGL(a.raster)},_cbGL:function(a){this._performance.start();this._initializeProgram({fragment:p.contrastBrightness,fragmentName:"ContrastBrightness"});a=this._setupTextureData(a);this._setUniforms({u_contrastOffset:Math.min(Math.max(this.functionArguments.contrastOffset,-100),100),u_brightnessOffset:Math.min(Math.max(this.functionArguments.brightnessOffset,
-100),100),u_scaleFactor:this.renderTexture?255:1});this._bindTexture(a.texture,"u_image");var b=this.bindFrameBuffer();this._drawGL();this._addPerformanceMetric(this._performance.elapsed());return{extent:a.extent,texture:b.texture}}})})},"esri/layers/rasterLib/function/ConvolutionFunction":function(){define("dojo/_base/declare dojo/_base/lang ./RasterFunctionX ../../PixelBlock ./convolutionKernel ./pixelShaders ./RasterFunctionWebGLMixin ./rasterUtils".split(" "),function(G,e,q,n,p,k,c,a){return G([q,
c],{declaredClass:"esri.layers.rasterLib.function.ConvolutionFunction",functionName:"Convolution",supportWebGL:!0,support2D:!0,constructor:function(b){this.functionArguments=this.mixinIgnoreCase({columns:3,rows:3,type:0,kernel:null,raster:null},b)},bind:function(b){b=this.getSourceRasterInfo(b);if(!b.raster)return Error("The raster input to convolution function is invalid.");this.rasterInfo=e.mixin(b.raster,{bandCount:b.raster.bandCount,pixelType:this._calculatePixelType(this.pixelType,b.raster.pixelType),
statistics:b.raster.statistics,histograms:b.raster.histograms});this.rasterInfo.keyProperties=this.rasterInfo.keyProperties||{};this.rasterInfo.keyProperties.DataType="Generic";return!0},read2D:function(b){this._performance.start();b=b.raster;var l=this._analyzeKernel(),h=a.convolute(b.pixelBlock,{normalizedKernel:l.normalizedKernel,kernelCols:this.functionArguments.columns,kernelRows:this.functionArguments.rows});this._addPerformanceMetric(this._performance.elapsed());"Unknown"!==this.pixelType&&
(h.pixelType=this.pixelType);h.pixels=h.pixels.map(e.hitch(this,function(g){return this._clampBand(g,h.pixelType)}));return{extent:b.extent,pixelBlock:h}},readGL:function(b){this._performance.start();this._initializeProgram({fragment:k.convolution,fragmentName:"Convolution"});var l=this._setupTextureData(b.raster),h=this.bindFrameBuffer(),g=this.gl,d=g.drawingBufferWidth;g=g.drawingBufferHeight;var f=this.functionArguments.kernel;this._setUniforms({u_resolution:b&&b.raster&&b.raster.pixelBlock?[1/
b.raster.pixelBlock.width,1/b.raster.pixelBlock.height]:[1/d,1/g],u_kernel:f,u_kernelSize:f.length});this._bindTexture(l.texture,"u_image");this._drawGL();this._addPerformanceMetric(this._performance.elapsed());return{extent:l.extent,texture:h.texture}},_analyzeKernel:function(){var b=this.functionArguments.kernel,l=b.reduce(function(d,f){return d+f});0!==l&&1!==l&&(b=b.map(function(d){return d/l}));var h,g=[];for(h=0;h<b.length;h++)g.some(function(d){return d===b[h]})||g.push(b[h]);return{normalizedKernel:b,
distinctValues:g}},_analyzeKernelPattern:function(){var b=this.functionArguments.rows,l=this.functionArguments.columns,h=this.functionArguments.kernel,g=[],d,f;for(d=0;d<b;d++)g.push({weights:h.slice(d*l,(d+1)*l)});var m;for(d=1;d<b;d++){var u=g[d].weights;for(h=0;h<d;h++)if(m=g[h].weights){var r=u[0]/m[0];for(f=1;f<l;f++)u[f]/m[f]!==r&&(r=null);null!==r&&(g[d]={row:h,factor:r})}}return g}})})},"esri/layers/rasterLib/function/ExtractBandFunction":function(){define("dojo/_base/declare dojo/_base/lang ./RasterFunctionX ../../PixelBlock ./pixelShaders ./RasterFunctionWebGLMixin".split(" "),
function(G,e,q,n,p,k){return G([q,k],{declaredClass:"esri.layers.rasterLib.function.ExtractBandFunction",functionName:"ExtractBand",supportWebGL:!0,support2D:!0,constructor:function(c){this.functionArguments=this.mixinIgnoreCase({bandIDs:[],missingBandAction:0,raster:null},c)},bind:function(c){c=this.getSourceRasterInfo(c);if(!c.raster)return Error("The raster input to extract band function is invalid.");var a=[],b=c.raster.statistics,l=[],h=c.raster.histograms,g=this.functionArguments.bandIDs.length||
c.raster.bandCount;this.functionArguments.bandIDs.forEach(e.hitch(this,function(d){if(d>=g-1){if(1===this.functionArguments.missingBandAction)return Error("missing band "+d);d=g-1}if(0>d)return Error("missing band "+d);void 0!==b&&null!==b&&0<b.length&&a.push(b[d]);void 0!==h&&null!==h&&0<h.length&&l.push(h[d])}));this.rasterInfo=e.mixin(c.raster,{bandCount:g,pixelType:this._calculatePixelType(this.pixelType,c.raster.pixelType),statistics:a,histograms:l});return!0},read2D:function(c){c=this._clonePixelData(c.raster);
if(null!==c&&null!==c.pixelBlock&&null!==c.pixelBlock.pixels){this._performance.start();var a=c.pixelBlock,b=a.statistics,l=a.pixels,h=l.length;if(null==this.functionArguments.bandIDs)throw"missing bandIDs parameter";if(0===this.functionArguments.bandIDs.length)return c;var g=[],d=[];this.functionArguments.bandIDs.forEach(function(f){if(f>=h-1){if(1===this.functionArguments.missingBandAction)throw"missing band "+f;f=h-1}if(0>f)throw"missing band "+f;g.push(l[f]);void 0!==b&&null!==b&&0<b.length&&
d.push(b[f])});a.pixels=g;a.statistics=d;a.planes=this.functionArguments.bandIDs.length;return c}},readGL:function(c){this._performance.start();if(null==this.functionArguments.bandIDs)throw"missing bandIDs parameter";if(3<this.functionArguments.bandIDs.length)throw"this version does not support more than 3 bands yet";this._initializeProgram({fragment:p.extractBand,fragmentName:"ExtractBand"});var a=this.functionArguments.bandIDs;1===a.length&&(a=[a[0],a[0],a[0]]);this._bandIDs=a;this._alterBand=!(0===
this.functionArguments.bandIDs.length||0===a[0]&&1===a[1]&&2===a[2]);var b=!!(this._alterBand&&c.raster&&c.raster.texture);c=this._setupTextureData(c.raster,{bandIDs:a});var l=this.bindFrameBuffer();b?this._setUniforms({u_bandIDs:a,u_alterBand:this._alterBand}):this._setUniforms({u_bandIDs:a,u_alterBand:!1});this._bindTexture(c.texture,"u_image");this._drawGL();this._addPerformanceMetric(this._performance.elapsed());return{extent:c.extent,texture:l.texture}}})})},"esri/layers/rasterLib/function/HillshadeFunction":function(){define("dojo/_base/declare dojo/_base/lang ./RasterFunctionX ../../../renderers/colorRampGenerator ../../../WKIDUnitConversion ../../PixelBlock ./pixelShaders ./RasterFunctionWebGLMixin ./surfaceUtils ./rasterUtils".split(" "),
function(G,e,q,n,p,k,c,a,b,l){return G([q,a],{declaredClass:"esri.layers.rasterLib.function.HillshadeFunction",functionName:"Hillshade",supportWebGL:!0,support2D:!0,renderTexture:!0,constructor:function(h){this.functionArguments=this.mixinIgnoreCase({hillshadeType:0,altitude:45,azimuth:315,zFactor:1,slopeType:1,psPower:.664,psFactor:.024,colorRamp:null,raster:null},h);this._azimuths=[315,270,225,360,180,0];this._altitudes=[60,60,60,60,60,90];this._weights=[3,5,3,2,1,4];var g=this._weights.reduce(function(d,
f){return d+f});this._weights=this._weights.map(function(d){return d/g})},bind:function(h){h=this.getSourceRasterInfo(h);if(!h.raster)return Error("The raster input to hillshade function is invalid.");h.raster.statistics&&(this.srcStatistics=h.raster.statistics);this.rasterInfo=e.mixin(h.raster,{bandCount:1,pixelType:this._calculatePixelType(this.pixelType,"U8"),statistics:[{min:0,max:255}],histograms:null});this.rasterInfo.keyProperties=this.rasterInfo.keyProperties||{};this.rasterInfo.keyProperties.DataType=
"Generic";this._initializeColormap();return!0},read2D:function(h){this._performance.start();h=h.raster;h=b.hillshade(h,{altitude:this.functionArguments.altitude,azimuth:this.functionArguments.azimuth,zFactor:this.functionArguments.zFactor,psPower:this.functionArguments.psPower,psFactor:this.functionArguments.psFactor,hillshadeType:this.functionArguments.hillshadeType,slopeType:this.functionArguments.slopeType,isGCS:h.extent.spatialReference.wkid&&null==p[h.extent.spatialReference.wkid]});this._addPerformanceMetric(this._performance.elapsed());
return h},readGL:function(h){this._performance.start();this._initializeProgram({fragment:c.hillshade,fragmentName:"Hillshade"});this.functionArguments.colorRamp&&this._indexedColormap&&!this._clrTexture&&(this._clrTexture=this._setupColormapTexture(this._indexedColormap));var g=this._setupTextureData(h.raster),d=this.bindFrameBuffer(),f=this.gl,m=f.drawingBufferWidth;f=f.drawingBufferHeight;var u=g.extent,r=(u.xmax-u.xmin)/m,t=(u.ymax-u.ymin)/f,w=this.functionArguments.altitude,v=this.functionArguments.azimuth,
y=this.functionArguments.zFactor;1===this.functionArguments.hillshadeType&&(y*=2);var x=y/(8*r),A=y/(8*t);.001<y&&u.spatialReference.wkid&&null==p[u.spatialReference.wkid]&&(x/=111E3,A/=111E3);var C=this.functionArguments.psPower,E=this.functionArguments.psFactor;3===this.functionArguments.slopeType&&((x=u.spatialReference.wkid&&null==p[u.spatialReference.wkid])?(x=111E3*r,A=111E3*t,x=(y+Math.pow(x,C)*E)/(8*x),A=(y+Math.pow(A,C)*E)/(8*A)):(x=(y+Math.pow(r,C)*E)/(8*r),A=(y+Math.pow(t,C)*E)/(8*t)));
var H=(90-w)*Math.PI/180;w=Math.cos(H);var B=(360-v+90)*Math.PI/180;v=Math.sin(H)*Math.cos(B);H=Math.sin(H)*Math.sin(B);C=Array(6);E=Array(6);u=Array(6);var z=this._weights,F;if(1===this.functionArguments.hillshadeType){var K=this._azimuths.length;for(F=0;F<K;F++)w=this._altitudes[F],v=this._azimuths[F],H=(90-w)*Math.PI/180,w=Math.cos(H),B=(360-v+90)*Math.PI/180,v=Math.sin(H)*Math.cos(B),H=Math.sin(H)*Math.sin(B),C[F]=w,E[F]=v,u[F]=H}else C[0]=w,E[0]=v,u[0]=H;C=C.map(function(L){return parseFloat(L)});
E=E.map(function(L){return parseFloat(L)});u=u.map(function(L){return parseFloat(L)});this._setUniforms({u_cellSize:[r,t],u_zfactor:y,u_xFactor:x,u_yFactor:A,u_sinZcosA:v,u_sinZsinA:H,u_cosZ:w,u_sinZcosAs:E,u_sinZsinAs:u,u_cosZs:C,u_weights:z,u_hillshadeType:this.functionArguments.hillshadeType,u_resolution:h&&h.raster&&h.raster.pixelBlock?[1/h.raster.pixelBlock.width,1/h.raster.pixelBlock.height]:[1/m,1/f],u_scaled:!this.renderTexture,u_applyColorramp:this._clrTexture?!0:!1,u_minValue:this.srcStatistics[0].min,
u_maxValue:this.srcStatistics[0].max,u_indexedColormapOffset:this._indexedColormapOffset||0,u_indexedColormapMaxIndex:this._indexedColormap?this._indexedColormap.length/4-1:0});this._clrTexture&&this._bindTexture(this._clrTexture,"u_image1");this._bindTexture(g.texture,"u_image");this._drawGL();this._addPerformanceMetric(this._performance.elapsed());return{extent:g.extent,texture:d.texture}},_initializeColormap:function(){this._indexedColormapOffset=0;var h=this._indexedColormap,g=this.functionArguments.colorRamp;
this.functionArguments.colormap?(this._alphaSpecified=(g=l.buildIndexedColormap(this.functionArguments.colormap))&&g.alphaSpecified,this._indexedColormap=g&&g.indexedColormap,this._indexedColormapOffset=g&&g.offset):g?(this._indexedColormap="multipart"===g.type?this.invert?n.createMultiPartColorRamp(this._invertColorRamp(g)):n.createMultiPartColorRamp(g):this.invert?n.createAlgorithmicColorRamp(this._invertColorRamp(g)):n.createAlgorithmicColorRamp(g),g.fromColor&&g.toColor&&"000"===g.fromColor.slice(0,
3).join("")&&"255255255"===g.toColor.slice(0,3).join("")&&(this._clrTexture=this._indexedColormap=null)):this.functionArguments.colormapName?"random"===this.functionArguments.colormapName.toLowerCase()&&(this._indexedColormap=n.createRandomColorRamp()):this._clrTexture=this._indexedColormap=null;if(h&&this._indexedColormap){g=!0;for(var d=0;d<h.length;d++)if(h[d]!==this._indexedColormap[d]){g=!1;break}g||(this._clrTexture=null)}},_setupColormapTexture:function(h){var g=this._createTexture(),d=this.gl,
f=h.length/4,m=new Float32Array(h.length),u;for(u=0;u<h.length;u++)m[u]=h[u]/255;d.getExtension("OES_texture_float");d.texImage2D(d.TEXTURE_2D,0,d.RGBA,f,1,0,d.RGBA,d.FLOAT,m);return g}})})},"esri/layers/rasterLib/function/LocalFunction":function(){define("dojo/_base/declare dojo/_base/lang ./RasterFunctionX ../../PixelBlock ./pixelShaders ./RasterFunctionWebGLMixin ./rasterUtils".split(" "),function(G,e,q,n,p,k,c){return G([q,k],{declaredClass:"esri.layers.rasterLib.function.LocalFunction",functionName:"Local",
supportWebGL:!0,support2D:!0,constructor:function(a){this.functionArguments=this.mixinIgnoreCase({operation:null,rasters:null},a)},bind:function(a){a=this.getSourceRasterInfo(a);var b=0;a.raster?b=a.raster.bandCount:a.rasters&&(b=Math.max.apply(null,a.rasters.map(function(l){return l.bandCount})));if(0===b)return Error("The raster input to local function is invalid. It only takes single band input.");a=a.raster||a.rasters.filter(function(l){return!!l.extent})[0];this.rasterInfo=e.mixin(a,{bandCount:1,
pixelType:this._calculatePixelType(this.pixelType,"F32"),statistics:null,histograms:null});this.rasterInfo.keyProperties=this.rasterInfo.keyProperties||{};this.rasterInfo.keyProperties.DataType="Generic";return!0},read2D:function(a){var b=[];b=a.raster?a.raster2?[a.raster,a.raster2]:[a.raster]:a.rasters;a=b.map(function(f){return f.pixelBlock});var l=this.functionArguments.operation;if(null===l)return b[0];this._performance.start();var h=this._getOperations(),g=h.operators[l-1];h=h.functors[l-1];
if(!this.functionArguments.rasters){if(1!==g)throw"no sufficient rasters, require "+g;}else if(999!==g&&this.functionArguments.rasters.length!==g)throw"number of rasters does not meet (short or exceed) the operation requirment, require "+g;var d=31===l?c.isNull(a[0]):50===l?c.setNull(a[0]):c.local(a,{rasterCountNeeded:g,functor:h});"Unknown"!==this.pixelType&&(d.pixelType=this.pixelType,d.pixels=d.pixels.map(e.hitch(this,function(f){return this._clampBand(f,d.pixelType)})));d.statistics||d.calculateStatistics();
return{extent:b[0].extent,pixelBlock:d}},readGL:function(a){this._performance.start();var b=this.functionArguments.operation,l=this._getWebGLOperations(),h=l.operators[b-1],g=p.local;l="result\x3d"+l.functors[b-1]+";";31!==b&&50!==b&&(l+="result \x3d vec4(result.rgb, a.a);");g=g.replace("vec4 replaceme"+h+";",l);l=this.gl.getParameter(this.gl.VERSION);var d="";if(-1<l.toLowerCase().indexOf("webgl 1.0")||-1<l.toLowerCase().indexOf("webgl 0."))d=this._getPolyfill(b);g=g.replace("vec4 polyfill;",d);
1<h&&(g=g.replace("gl_FragColor \x3d localOp1();","gl_FragColor \x3d localOp1();".replace("1",h.toString())));this._initializeProgram({fragment:g,fragmentName:"Local"});b=a.rasters;if(null!=b&&0!==b.length){b=b.length;l=this.bindFrameBuffer();for(h=0;h<b;h++){g=0<h?h.toString():"";var f=this._setupTextureData(a.rasters[h],{reCreate:!0});this._bindTexture(f.texture,"u_image"+g)}this._setUniforms({});this._drawGL();this._addPerformanceMetric(this._performance.elapsed());return{extent:f.extent,texture:l.texture}}},
_getOperations:function(){return{operators:[2,2,2,1,2,1,1,1,1,1,2,2,1,2,2,2,2,1,2,2,1,1,2,2,1,1,1,2,2,1,1,1,2,2,1,1,1,999,999,999,999,999,999,2,1,2,999,1,1,1,1,1,1,999,999,1,1,999,1,1,2,2,2,999,999,999,999,999,999,999,999,999,999,3],functors:[function(a,b){return a+b},function(a,b){return a-b},function(a,b){return a*b},function(a){return Math.sqrt(a)},function(a,b){return Math.pow(a,b)},function(a){return Math.acos(a)},function(a){return Math.asin(a)},function(a){return Math.atan(a)},function(a){return Math.atanh(a)},
function(a){return Math.abs(a)},function(a,b){return a&b},function(a,b){return a<<b},function(a){return~a},function(a,b){return a|b},function(a,b){return a>>b},function(a,b){return a^b},function(a,b){return a&&b},function(a){return!a},function(a,b){return a||b},function(a,b){return a!=b},function(a){return Math.cos(a)},function(a,b){return Math.cosh(a)},function(a,b){return a/b},function(a,b){return a==b},function(a){return Math.exp(a)},function(a){return Math.pow(10,a)},function(a){return Math.pow(2,
a)},function(a,b){return a>b?1:0},function(a,b){return a>=b?1:0},function(a,b){return Math.floor(a)},function(a){return!a},function(a){return a},function(a,b){return a<b?1:0},function(a,b){return a<=b?1:0},function(a){return Math.log(a)},function(a,b){return Math.log10(a)},function(a,b){return Math.log2(a)},999,999,999,999,999,999,function(a,b){return a%b},function(a){return-a},function(a,b){return a!=b?1:0},999,function(a,b){return Math.floor(a)},function(a,b){return Math.ceil(a)},function(a,b){return b?
0:a},function(a,b){return Math.sin(a)},function(a,b){return Math.sinh(a)},function(a,b){return a*a},999,999,function(a){return Math.tan(a)},function(a){return Math.tanh(a)},999,function(a){return Math.acosh(a)},function(a){return Math.asinh(a)},function(a,b){return Math.atan2(a,b)},function(a,b){return a/b},function(a,b){return Math.floor(a/b)},999,999,999,999,999,999,999,999,999,999,function(a,b,l){return a?b:l}]}},_polyfill:{sinh:"vec4 sinh(vec4 x) {\nvec4 halfexp \x3d exp(x)/2.0;\nreturn halfexp - 1.0/halfexp;\n}",
asinh:"vec4 asinh(vec4 x) {\nvec4 halfexp \x3d exp(x)/2.0;\nreturn 1.0/(halfexp - 1.0/halfexp);\n}",cosh:"vec4 cosh(vec4 x) {\nvec4 halfexp \x3d exp(x)/2.0;\nreturn halfexp + 1.0/halfexp;\n}",acosh:"vec4 acosh(vec4 x) {\nvec4 halfexp \x3d exp(x)/2.0;\nreturn 1.0/(halfexp + 1.0/halfexp);\n}",tanh:"vec4 tanh(vec4 x) {\nvec4 expx \x3d exp(x);\nreturn (expx - 1.0/expx)/(expx + 1.0/expx);\n}",atanh:"vec4 atanh(vec4 x) {\nvec4 expx \x3d exp(x);\nreturn (expx + 1.0/expx)/(expx - 1.0/expx);\n}"},_getPolyfill:function(a){var b=
"";switch(a){case 9:b=this._polyfill.atanh;break;case 22:b=this._polyfill.cosh;break;case 52:b=this._polyfill.sinh;break;case 57:b=this._polyfill.tanh;break;case 59:b=this._polyfill.acosh;break;case 60:b=this._polyfill.asinh}return b},_getWebGLOperations:function(){return{operators:[2,2,2,1,2,1,1,1,1,1,2,2,1,2,2,2,2,1,2,2,1,1,2,2,1,1,1,2,2,1,1,1,2,2,1,1,1,999,999,999,999,999,999,2,1,2,999,1,1,1,1,1,1,999,999,1,1,999,1,1,2,2,2,999,999,999,999,999,999,999,999,999,999,3],functors:["(a + b)","(a - b)",
"(a * b)","sqrt(a)","pow(a, b)","acos(a)","asin(a)","atan(a)","atanh(a)","abs(a)","a","a","a","a","a","a","(a.r\x3d\x3d0.0 || b.r\x3d\x3d0.0) ? vec4(0.0,0.0,0.0,a.a) : vec4(1.0,1.0,1.0,a.a)","a.r\x3d\x3d0.0?vec4(1.0,1.0,1.0,a.a) : vec4(0.0,0.0,0.0,a.a)","(a.r\x3d\x3d0.0 \x26\x26 b.r\x3d\x3d0.0) ? vec4(0.0,0.0,0.0,a.a) : vec4(1.0,1.0,1.0,a.a)","(a.r\x3d\x3d0.0 ^^ b.r\x3d\x3d0.0) ? vec4(1.0,1.0,1.0,a.a) : vec4(0.0,0.0,0.0,a.a)","cos(a)","cosh(a)","a / b","a.r \x3d\x3d b.r? vec4(1.0,1.0,1.0,a.a) : vec4(0.0,0.0,0.0,a.a)",
"exp(a)","pow(10.0, a)","pow(2.0, a)","a.r \x3e b.r ? vec4(1.0,1.0,1.0,a.a) : vec4(0.0,0.0,0.0,a.a)","a.r \x3e\x3d b.r ? vec4(1.0,1.0,1.0,a.a) : vec4(0.0,0.0,0.0,a.a)","floor(a)","a.a \x3d\x3d 0.0? vec4(1.0,1.0,1.0,1.0) : vec4(0.0,0.0,0.0,1.0)","a","a.r \x3c b.r ? vec4(1.0,1.0,1.0,a.a) : vec4(0.0,0.0,0.0,a.a)","a.r \x3c\x3d b.r ? vec4(1.0,1.0,1.0,a.a) : vec4(0.0,0.0,0.0,a.a)","log(a)","log2(a) / log2(10.0)","log2(a)",999,999,999,999,999,999,"mod(a, b)","-a","a.r !\x3d b.r ? vec4(1.0,1.0,1.0,a.a) : vec4(0.0,0.0,0.0,a.a)",
999,"floor(a)","ceil(a)","a.r !\x3d 0.0 ? vec4(0.0,0.0,0.0,0.0) : a","sin(a)","sinh(a)","a * a",999,999,"tan(a)","tanh(a)",999,"acosh(a)","asinh(a)","atan(a, b)","a / b","floor(a / b)",999,999,999,999,999,999,999,999,999,999,"a.r!\x3d0 ? b : c"]}}})})},"esri/layers/rasterLib/function/MaskFunction":function(){define("dojo/_base/declare dojo/_base/lang ./RasterFunctionX ../../PixelBlock ./pixelShaders ./RasterFunctionWebGLMixin ./rasterUtils".split(" "),function(G,e,q,n,p,k,c){return G([q,k],{declaredClass:"esri.layers.rasterLib.function.MaskFunction",
functionName:"Mask",supportWebGL:!0,support2D:!0,constructor:function(a){this.functionArguments=this.mixinIgnoreCase({includedRanges:null,noDataInterpretation:0,noDataValues:null,raster:null},a)},bind:function(a){a=this.getSourceRasterInfo(a);if(!a.raster)return Error("The raster input to mask function is invalid.");this.rasterInfo=e.mixin(a.raster,{bandCount:a.raster.bandCount,pixelType:this._calculatePixelType(this.pixelType,a.raster.pixelType),statistics:a.raster.statistics,histograms:a.raster.histograms});
return!0},read2D:function(a){this._performance.start();a=a.raster;var b=c.mask(a.pixelBlock,{includedRanges:this.functionArguments.includedRanges,noDataInterpretation:this.functionArguments.noDataInterpretation,noDataValues:this.functionArguments.noDataValues});this._addPerformanceMetric(this._performance.elapsed());"Unknown"!==this.pixelType&&(b.pixelType=this.pixelType);return{extent:a.extent,pixelBlock:b}},readGL:function(a){this._performance.start();this._initializeProgram({fragment:p.mask,fragmentName:"Mask"});
a=this._setupTextureData(a.raster);var b=this.bindFrameBuffer(),l=this.functionArguments.includedRanges,h=this.functionArguments.noDataValues?this.functionArguments.noDataValues.map(function(g){return parseFloat(g,10)}):null;this._setUniforms({u_includedRanges:l,u_includedRanges_specified:l?!0:!1,u_noDataValues:h,u_noDataValues_specified:h?!0:!1,u_noDataInterpretation:this.functionArguments.noDataInterpretation,u_bandCount:Math.min(this.sourceRasterInfo.raster.bandCount,3)});this._bindTexture(a.texture,
"u_image");this._drawGL();this._addPerformanceMetric(this._performance.elapsed());return{extent:a.extent,texture:b.texture}}})})},"esri/layers/rasterLib/function/NDVIFunction":function(){define("dojo/_base/declare dojo/_base/lang ./RasterFunctionX ../../PixelBlock ./pixelShaders ./RasterFunctionWebGLMixin ./rasterIndex".split(" "),function(G,e,q,n,p,k,c){return G([q,k],{declaredClass:"esri.layers.rasterLib.function.NDVIFunction",functionName:"NDVI",supportWebGL:!0,support2D:!0,constructor:function(a){this.functionArguments=
this.mixinIgnoreCase({visibleBandID:1,infraredBandID:2,scaled:!0,raster:null},a)},bind:function(a){a=this.getSourceRasterInfo(a);if(!(a.raster&&1<a.raster.bandCount))return Error("The raster input to ndvi function is invalid. It requires more than 1 band.");this.rasterInfo=e.mixin(a.raster,{bandCount:1,pixelType:this._calculatePixelType(this.pixelType,this.scaled?"U8":"F32"),statistics:this.scaled?[{min:0,max:200}]:[{min:-1,max:1}],histograms:null});this.rasterInfo.keyProperties=this.rasterInfo.keyProperties||
{};this.rasterInfo.keyProperties.DataType="Generic";return!0},read2D:function(a){this._performance.start();a=a.raster;var b=c.calculate(a.pixelBlock,{bandIndexes:[this.functionArguments.infraredBandID+1,this.functionArguments.visibleBandID+1].join(" "),method:1}),l;if(this.functionArguments.scaled){var h=b.pixels[0];var g=b.mask;var d=h.length;var f=new Uint8Array(d);if(null==g)for(l=0;l<d;l++)f[l]=100*h[l]+100&255;else for(l=0;l<d;l++)g[l]&&(f[l]=100*h[l]+100&255);b.pixels[0]=f;b.pixelType="U8"}this._addPerformanceMetric(this._performance.elapsed());
"Unknown"!==this.pixelType&&(b.pixelType=this.pixelType);return{extent:a.extent,pixelBlock:b}},readGL:function(a){this._performance.start();this._initializeProgram({fragment:p.ndvi,fragmentName:"NDVI"});var b=this.functionArguments.visibleBandID,l=this.functionArguments.infraredBandID,h=this.functionArguments.scaled||!1;this._alterBand=2<Math.max(l,b)?!0:!1;a=this._setupTextureData(a.raster,{bandIDs:this._alterBand?{bandIDs:[l,b,l]}:null});var g=this.bindFrameBuffer();this._alterBand?this._setUniforms({u_bandId_nir:0,
u_bandId_red:1,u_scaled:h}):this._setUniforms({u_bandId_nir:l,u_bandId_red:b,u_scaled:h});this._bindTexture(a.texture,"u_image");this._drawGL();this._addPerformanceMetric(this._performance.elapsed());return{extent:a.extent,texture:g.texture}}})})},"esri/layers/rasterLib/function/SlopeFunction":function(){define("dojo/_base/declare dojo/_base/lang ./RasterFunctionX ../../../WKIDUnitConversion ../../PixelBlock ./pixelShaders ./RasterFunctionWebGLMixin ./surfaceUtils".split(" "),function(G,e,q,n,p,k,
c,a){return G([q,c],{declaredClass:"esri.layers.rasterLib.function.SlopeFunction",functionName:"Slope",supportWebGL:!0,support2D:!0,constructor:function(b){this.functionArguments=this.mixinIgnoreCase({zFactor:1,slopeType:1,psPower:.664,psFactor:.024,raster:null},b)},bind:function(b){b=this.getSourceRasterInfo(b);if(!b.raster)return Error("The raster input to slope function is invalid.");this.rasterInfo=e.mixin(b.raster,{bandCount:1,pixelType:this._calculatePixelType(this.outputPixelType,"F32"),statistics:1===
this.slopeType||3===this.slopeType?[{min:0,max:90}]:null,histograms:null});this.rasterInfo.keyProperties=this.rasterInfo.keyProperties||{};this.rasterInfo.keyProperties.DataType="Generic";return!0},read2D:function(b){this._performance.start();b=b.raster;b=a.slope(b,{zFactor:this.functionArguments.zFactor,psPower:this.functionArguments.psPower,psFactor:this.functionArguments.psFactor,slopeType:this.functionArguments.slopeType,isGCS:b.extent.spatialReference.wkid&&null==n[b.extent.spatialReference.wkid]});
this._addPerformanceMetric(this._performance.elapsed());return b},readGL:function(b){this._performance.start();this._initializeProgram({fragment:k.slope,fragmentName:"Slope"});var l=this._setupTextureData(b.raster),h=this.bindFrameBuffer(),g=this.gl,d=g.drawingBufferWidth;g=g.drawingBufferHeight;var f=l.extent;this._setUniforms({u_resolution:b&&b.raster&&b.raster.pixelBlock?[1/b.raster.pixelBlock.width,1/b.raster.pixelBlock.height]:[1/d,1/g],u_cellSize:[(f.xmax-f.xmin)/d,(f.ymax-f.ymin)/g],u_zfactor:this.functionArguments.zFactor});
this._bindTexture(l.texture,"u_image");this._drawGL();this._addPerformanceMetric(this._performance.elapsed());return{extent:l.extent,texture:h.texture}}})})},"esri/layers/rasterLib/function/StretchFunction":function(){define("dojo/_base/declare dojo/_base/lang ./RasterFunctionX ../../PixelBlock ./vertexShaders ./pixelShaders ./RasterFunctionWebGLMixin".split(" "),function(G,e,q,n,p,k,c){return G([q,c],{declaredClass:"esri.layers.rasterLib.function.StretchFunction",functionName:"Stretch",supportWebGL:!0,
support2D:!0,constructor:function(a){this.functionArguments=this.mixinIgnoreCase({stretchType:0,min:0,max:255,numberOfStandardDeviations:2,statistics:null,histograms:null,dra:!1,minPercent:.25,maxPercent:.5,useGamma:!1,gamma:null,raster:null,computeGamma:!1},a);this.functionArguments.statistics=this._convertStats(this.functionArguments.statistics);-1===[0,3,5,6].indexOf(this.functionArguments.stretchType)&&(console.error("The specific stretch type has not been implemented: "+this.functionArguments.stretchType),
this.functionArguments.stretchType=5);this.min=null==this.min?0:this.min;this.max=null==this.max?255:this.max},bind:function(a){a=this.getSourceRasterInfo(a);if(!a.raster)return Error("The raster input to stretch function is invalid.");a.raster.statistics&&(this.srcStatistics=this._convertStats(a.raster.statistics));a.raster.histograms&&(this.srcHistograms=a.raster.histograms);this.rasterInfo=e.mixin({},a.raster,{bandCount:a.raster.bandCount,pixelType:this._calculatePixelType(this.pixelType,"U8"),
statistics:null,histograms:null});this.rasterInfo.keyProperties=this.rasterInfo.keyProperties||{};this.rasterInfo.keyProperties.DataType="Generic";return!0},read2D:function(a){a=a.raster;this._stretch(a);return a},hasTilingEffects:function(a){a=a||this.functionArguments;return!!(a.dra||a.raster&&"object"===typeof a.raster&&a.raster.dra)},_convertStats:function(a){return a?a.map(function(b){return b&&null!=b.min?[b.min,b.max,b.mean,b.stddev]:b}):null},_updateStatistisHistograms:function(a){var b=this.functionArguments,
l=b.histograms||this.srcHistograms;if(a&&a.pixelBlock&&a.pixelBlock.pixels){if(0===b.stretchType)this._statistics=b.statistics&&0<b.statistics.length?b.statistics:this.srcStatistics,this._histograms=l;else{var h=a.pixelBlock,g=h.pixels.length,d=6===b.stretchType&&(b.dra||!l)||3===b.stretchType&&b.dra;d&&(h.statistics||h.calculateStatistics(),this._calculateStatisticsHistograms(a));if(b.dra)if(h.statistics||h.calculateStatistics(),d)this._statistics=h.statistics,this._histograms=h.histograms;else for(b=
h.statistics,this._statistics=[],a=0;a<g;a++)this._statistics[a]=[b[a].minValue,b[a].maxValue,0,0];else this._statistics=b.statistics&&0<b.statistics.length?b.statistics:this.srcStatistics,this._histograms=l}this._statistics=this._convertStats(this._statistics);this._gammaCorrection=this._getGammaCorrection()}else this._statistics=b.statistics&&0<b.statistics.length?b.statistics:this.srcStatistics,this._histograms=l,this._gammaCorrection=this._getGammaCorrection(),this._statistics=this._convertStats(this._statistics)},
_getGammaCorrection:function(){var a=this.functionArguments.gamma;if(a){var b=[],l;for(l=0;l<a.length;l++)b[l]=1<a[l]?2<a[l]?6.5+Math.pow(a[l]-2,2.5):6.5+100*Math.pow(2-a[l],4):1;return b}},_stretch:function(a){if(null!==a&&null!==a.pixelBlock&&null!==a.pixelBlock.pixels&&0!==this.functionArguments.stretchType){this._updateStatistisHistograms(a);var b=a.pixelBlock,l=b.pixels;b=b.width*b.height;var h=l.length,g,d;this._createLUT(a);if(null==this.LUT)return this._filterNoLUT(a);var f=this.LUT,m=this.LUTOffset;
for(g=0;g<h;g++){var u=f[g];for(d=0;d<b;d++){var r=l[g][d];l[g][d]=u[r-m]}}a.pixelBlock.pixelType="U8"}},_calculateStatisticsHistograms:function(a){a=a.pixelBlock;var b=a.pixelType,l=a.pixels,h=a.mask,g=l.length,d,f,m=function(E){this.min=-.5;this.max=255.5;this.size=256;e.mixin(this,E);this.counts=this.counts||new Uint32Array(this.size)},u=[],r,t;for(d=0;d<g;d++){var w=new m;var v=w.counts;var y=l[d];if("U8"===b)if(h)for(f=0;f<a.width*a.height;f++)h[f]&&v[y[f]]++;else for(f=0;f<a.width*a.height;f++)v[y[f]]++;
else{var x=a.statistics[d].minValue;var A=a.statistics[d].maxValue;w.min=x;w.max=A;A=(A-x)/256;var C=new Uint32Array(257);if(h)for(f=0;f<a.width*a.height;f++)h[f]&&C[Math.floor((y[f]-x)/A)]++;else for(f=0;f<a.width*a.height;f++)C[Math.floor((y[f]-x)/A)]++;for(f=0;255>f;f++)v[f]=C[f];v[255]=C[255]+C[256]}u.push(w);y=[];x=a.statistics[d].minValue;A=a.statistics[d].maxValue;for(f=t=r=C=0;f<w.size;f++)C+=v[f],r+=f*v[f];r/=C;for(f=0;f<w.size;f++)t+=v[f]*Math.pow(f-r,2);v=Math.sqrt(t/(C-1));f=(r+.5)*(w.max-
w.min)/w.size+w.min;w=v*(w.max-w.min)/w.size;y.push(x);y.push(A);y.push(f);y.push(w);a.statistics[d]={min:x,minValue:x,max:A,maxValue:A,mean:f,stddev:w}}a.histograms=u},_getCutOffPoints:function(a){var b=this.functionArguments,l=999;a&&a.pixelBlock?l=a.pixelBlock.pixels.length:a&&a.texture&&(l=3);a=Math.min(l,this._statistics.length);var h=[],g=[],d,f;switch(b.stretchType){case 5:for(d=0;d<a;d++)h[d]=this._statistics[d][0],g[d]=this._statistics[d][1];break;case 3:for(d=0;d<a;d++)h[d]=this._statistics[d][2]-
b.numberOfStandardDeviations*this._statistics[d][3],g[d]=this._statistics[d][2]+b.numberOfStandardDeviations*this._statistics[d][3],h[d]<this._statistics[d][0]&&(h[d]=this._statistics[d][0]),g[d]>this._statistics[d][1]&&(g[d]=this._statistics[d][1]);break;case 6:for(d=0;d<a;d++){l=this._histograms[d];var m=new Uint32Array(l.size);var u=l.counts;var r=0;var t=-.5===l.min&&1===(l.max-l.min)/u?.5:0;for(f=0;f<l.size;f++)r+=u[f],m[f]=r;u=b.minPercent*r/100;for(f=0;f<l.size;f++)if(m[f]>u){h[d]=l.min+(l.max-
l.min)/l.size*(f+t);break}u=(1-b.maxPercent/100)*r;for(f=l.size-2;0<=f;f--)if(m[f]<u){g[d]=l.min+(l.max-l.min)/l.size*(f+2-t);break}}break;default:for(d=0;d<l;d++)h[d]=0,g[d]=255}return{minCutOff:h,maxCutOff:g}},_createLUT:function(a){var b=this.functionArguments,l=a.pixelBlock,h=l.pixelType;if("U8"===h||"U16"===h||"S8"===h||"S16"===h){if(this._LUTSignature&&(h=this._computeLutSignature(),h.length===this._LUTSignature.length&&!h.some(function(H,B){return H!==this._LUTSignature[B]}.bind(this))))return;
h=l.pixels.length;var g=[],d=[],f=b.max,m=b.min,u=b.gamma,r=f-m,t=this._getCutOffPoints(a);a=t.minCutOff;t=t.maxCutOff;var w=0,v=256;"S8"===l.pixelType?w=-127:"S16"===l.pixelType&&(w=-32767);if("U16"===l.pixelType||"S16"===l.pixelType)v=65536;for(l=0;l<h;l++)g[l]=t[l]-a[l];var y=this._gammaCorrection;if(b.useGamma)for(l=0;l<h;l++){var x=[];for(b=0;b<v;b++){var A=b+w;var C=(A-a[l])/g[l];var E=1;1<u[l]&&(E-=Math.pow(1/r,C*y[l]));A<t[l]&&A>a[l]?x[b]=Math.floor(E*r*Math.pow(C,1/u[l]))+m:A>t[l]?x[b]=f:
A<a[l]&&(x[b]=m)}d[l]=x}else for(l=0;l<h;l++){x=[];for(b=0;b<v;b++)A=b+w,x[b]=A<a[l]?m:A>t[l]?f:Math.floor((A-a[l])/g[l]*r)+m;d[l]=x}this.LUT=d;this.LUTOffset=w;this._LUTSignature=this._computeLutSignature()}},_computeLutSignature:function(){var a=this.functionArguments,b=[],l,h;b.push(a.stretchType);b.push(a.min);b.push(a.max);b.push(a.numberOfStandardDeviations);if(this._statistics)for(l=0;l<this._statistics.length;l++)for(h=0;h<this._statistics[l].length;h++)b.push(this._statistics[l][h]);b.push(a.dra?
1:0);b.push(a.minPercent);b.push(a.maxPercent);if(a.gamma)for(l=0;l<this._statistics.length;l++)b.push(a.gamma[l]);b.push(a.useGamma?1:0);return b},_filterNoLUT:function(a){if(null!==a&&null!==a.pixelBlock&&null!==a.pixelBlock.pixels){var b=this.functionArguments,l=a.pixelBlock,h=l.pixels,g=l.mask;l=l.width*l.height;var d=h.length,f=[],m=[],u=b.max,r=b.min,t=b.gamma,w=u-r;var v=this._getCutOffPoints(a);var y=v.minCutOff,x=v.maxCutOff;for(v=0;v<d;v++)f[v]=x[v]-y[v];if(b.useGamma&&null!==t&&t.length>=
d)for(v=0;v<d;v++)m[v]=1<t[v]?2<t[v]?6.5+Math.pow(t[v]-2,2.5):6.5+100*Math.pow(2-t[v],4):1;if(b.useGamma)if(void 0!==g&&null!==g)for(b=0;b<l;b++){if(g[b])for(v=0;v<d;v++){var A=h[v][b];var C=(A-y[v])/f[v];var E=1;1<t[v]&&(E-=Math.pow(1/w,C*m[v]));A<x[v]&&A>y[v]?h[v][b]=Math.floor(E*w*Math.pow(C,1/t[v]))+r:A>x[v]?h[v][b]=u:A<y[v]&&(h[v][b]=r)}}else for(b=0;b<l;b++)for(v=0;v<d;v++)A=h[v][b],C=(A-y[v])/f[v],E=1,1<t[v]&&(E-=Math.pow(1/w,C*m[v])),A<x[v]&&A>y[v]?h[v][b]=Math.floor(E*w*Math.pow(C,1/t[v]))+
r:A>x[v]?h[v][b]=u:A<y[v]&&(h[v][b]=r);else if(void 0!==g&&null!==g)for(b=0;b<l;b++){if(g[b])for(v=0;v<d;v++)A=h[v][b],A<x[v]&&A>y[v]?h[v][b]=Math.floor((A-y[v])/f[v]*w)+r:A>x[v]?h[v][b]=u:A<y[v]&&(h[v][b]=r)}else for(b=0;b<l;b++)for(v=0;v<d;v++)A=h[v][b],A<x[v]&&A>y[v]?h[v][b]=Math.floor((A-y[v])/f[v]*w)+r:A>x[v]?h[v][b]=u:A<y[v]&&(h[v][b]=r);a.pixelBlock.pixelType="U8";return a}},_computeGammaValues:function(a){var b=this._statistics.length,l,h=[];for(l=0;l<b;l++){var g=this._statistics[l][2];"U8"!==
a&&(g=255*(g-this._statistics[l][0])/(this._statistics[l][1]-this._statistics[l][0]));h.push(this._computeGammaValue(g))}return h},_computeGammaValue:function(a){if(0!==a&&!(255<a||0>a)){var b=0;0<a&&150!=a&&255>a&&(b=150>=a?45*Math.cos(.01047*a):17*Math.sin(.021*a));b=Math.log((a+b)/255);if(0!==b&&(a=Math.log(a/255)/b,!isNaN(a)))return Math.min(9.9,Math.max(.01,a))}},readGL:function(a){return this._stretchGL(a.raster)},_stretchGL:function(a){this._performance.start();var b=this.renderTexture,l,h=
a.pixelBlock&&a.pixelBlock.pixels&&a.pixelBlock.pixels.length||this.sourceRasterInfo.raster.bandCount,g=a.pixelBlock,d=this.gl,f=d.drawingBufferWidth,m=d.drawingBufferHeight;if(!g&&this.functionArguments.dra){var u=new Float32Array(f*m*4),r=new Uint8Array(f*m);var t=new Float32Array(f*m);var w=new Float32Array(f*m);var v=new Float32Array(f*m);d.checkFramebufferStatus(d.FRAMEBUFFER)==d.FRAMEBUFFER_COMPLETE&&d.readPixels(0,0,f,m,d.RGBA,d.FLOAT,u);for(l=0;l<f*m;l++)t[l]=u[4*l],w[l]=u[4*l+1],v[l]=u[4*
l+2],r[l]=u[4*l+3];a.pixelBlock=new n({width:f,height:m,pixels:[t,w,v],mask:r});a.pixelBlock.calculateStatistics()}!g&&this.functionArguments.dra&&this._useGPUStats?(t=new Float32Array(h),w=new Float32Array(h)):(this._updateStatistisHistograms(a),u=this._getCutOffPoints(a),t=new Float32Array(h),w=new Float32Array(h),t.set(u.minCutOff.slice(0,h)),w.set(u.maxCutOff.slice(0,h)));this._initializeProgram({fragment:k.stretch,fragmentName:"Stretch"});u=this._setupTextureData(a);r=this.bindFrameBuffer();
this.renderTexture=!1;this._performance.start();if(!g&&this.functionArguments.dra&&this._useGPUStats){this._setUniforms({u_sourceDim:[f,m],u_bandCount:h});if(1===h)var y=this._readMinMax(u,2);else{y=this._readMinMax(u,0);var x=this._readMinMax(u,1)}if(6===this.functionArguments.stretchType||3===this.functionArguments.stretchType&&this.functionArguments.dra)l=this._readHistogram(y,x,a),t=l.minCutOff||t,w=l.minCutOff||w}v=this.functionArguments.max-this.functionArguments.min;a=new Float32Array(h);for(l=
0;l<h;l++)a[l]=v/(w[l]-t[l]);this._useGPUStats&&this._initializeProgram({fragment:k.stretch,fragmentName:"Stretch"});d.blendFunc(d.SRC_ALPHA,d.ZERO);v=new Float32Array(3);var A=new Float32Array(3);for(l=0;3>l;l++)v[l]=this.functionArguments.min,A[l]=this.functionArguments.max;l=this.functionArguments.useGamma;var C=this.functionArguments.gamma,E=this._gammaCorrection;Array.isArray(C)&&C.length>=h||(l=!1);this._setUniforms({u_sourceDim:[f,m],u_bandCount:h,u_minOutput:v,u_maxOutput:A,u_minCutOff:t,
u_maxCutOff:w,u_factor:a,u_state:100,u_useGamma:l,u_gamma:C,u_scaled:!b,u_gammaCorrection:E,u_minMaxTexture:!g&&this.functionArguments.dra&&this._useGPUStats?!0:!1});this.renderTexture=b;d.viewport(0,0,f,m);this._bindTexture(u.texture,"u_image");!g&&this.functionArguments.dra&&this._useGPUStats&&(b=d.getUniformLocation(this.rasterProgram,"u_image1"),d.uniform1i(b,1),d.activeTexture(d.TEXTURE1),d.bindTexture(d.TEXTURE_2D,y.texture),1<h&&(h=d.getUniformLocation(this.rasterProgram,"u_image2"),d.uniform1i(h,
2),d.activeTexture(d.TEXTURE2),d.bindTexture(d.TEXTURE_2D,x.texture)));this._drawGL();return{extent:u.extent,texture:r.texture}},_readMinMax:function(a,b){var l=this.gl,h=a.width||l.drawingBufferWidth,g=a.height||l.drawingBufferHeight;this._setUniforms({u_state:b});this.renderTexture=!1;var d=a.texture;for(l.activeTexture(l.TEXTURE0);1<h||1<g;){var f=this._createTexture();b=Math.max(Math.ceil(h/2),1);var m=Math.max(Math.ceil(g/2),1);l.getExtension("OES_texture_float");l.texImage2D(l.TEXTURE_2D,0,
l.RGBA,b,m,0,l.RGBA,l.FLOAT,null);a=l.createFramebuffer();l.bindFramebuffer(l.FRAMEBUFFER,a);l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,l.TEXTURE_2D,f,0);l.viewport(0,0,b,m);l.bindTexture(l.TEXTURE_2D,d);this._setUniforms({u_sourceDim:[h,g]});h=b;g=m;this._drawGL(!0);d=f}a=new Float32Array(h*g*4);l.checkFramebufferStatus(l.FRAMEBUFFER)==l.FRAMEBUFFER_COMPLETE&&l.readPixels(0,0,h,g,l.RGBA,l.FLOAT,a);return{texture:f,minmax:a}},_readHistogram:function(a,b,l){if(a)try{var h=this.gl,g=h.drawingBufferWidth,
d=h.drawingBufferHeight,f,m,u;if(a.texture instanceof WebGLTexture){var r=!0;var t=[1,0,0,1];if(b){var w=a.minmax;var v=b.minmax}else w=[a.minmax[0]],v=[a.minmax[1]]}else for(v=b,w=a,t=new Float32Array(v.length),f=0;f<v.length;f++)t[f]=256/(v[f]-w[f]);var y=new Float32Array(g*d);for(u=0;u<y.length;u++)y[u]=u;if(!this.histogramProgram){var x=p.getShader(h,p.histogram),A=k.getShader(h,k.constant);this.histogramProgram=this._loadProgram(x,A)}h.blendFunc(h.ONE,h.ONE);h.enable(h.BLEND);h.useProgram(this.histogramProgram);
var C=h.getAttribLocation(this.histogramProgram,"a_pixelIndex"),E=h.createBuffer();h.bindBuffer(h.ARRAY_BUFFER,E);h.bufferData(h.ARRAY_BUFFER,y,h.STATIC_DRAW);h.enableVertexAttribArray(C);h.vertexAttribPointer(C,1,h.FLOAT,!1,0,0);var H=this._setupHistTexture(l),B=this._createTexture();h.getExtension("OES_texture_float");h.texImage2D(h.TEXTURE_2D,0,h.RGBA,257,1,0,h.RGBA,h.FLOAT,null);var z=h.createFramebuffer();h.bindFramebuffer(h.FRAMEBUFFER,z);h.framebufferTexture2D(h.FRAMEBUFFER,h.COLOR_ATTACHMENT0,
h.TEXTURE_2D,B,0);h.viewport(0,0,257,1);var F=h.getUniformLocation(this.histogramProgram,"u_image");h.uniform1i(F,0);h.activeTexture(h.TEXTURE0);h.bindTexture(h.TEXTURE_2D,H);var K=h.getUniformLocation(this.histogramProgram,"u_sourceDim");h.uniform2f(K,g,d);var L=h.getUniformLocation(this.histogramProgram,"u_bandCount");h.uniform1i(L,3);var N=h.getUniformLocation(this.histogramProgram,"u_halfPixel");h.uniform2f(N,.5/g,.5/d);var Q=h.getUniformLocation(this.histogramProgram,"u_minMaxTexture");if(r){h.uniform1i(Q,
1);var S=h.getUniformLocation(this.histogramProgram,"u_image1");h.uniform1i(S,1);h.activeTexture(h.TEXTURE1);h.bindTexture(h.TEXTURE_2D,a.texture);if(b){var R=h.getUniformLocation(this.histogramProgram,"u_image2");h.uniform1i(R,2);h.activeTexture(h.TEXTURE2);h.bindTexture(h.TEXTURE_2D,b.texture)}}else{var V=h.getUniformLocation(this.histogramProgram,"u_mins");h.uniform4f(V,w[0],w[0],w[0],w[0]);h.uniform1i(Q,0)}var W=h.getUniformLocation(this.histogramProgram,"u_color"),U=h.getUniformLocation(this.histogramProgram,
"u_factors"),ha=h.getUniformLocation(this.histogramProgram,"u_size");h.uniform1f(ha,256);a=[];b=[];h.uniform4fv(W,[1,0,0,1]);h.uniform4fv(U,[t[0],0,0,1]);h.drawArrays(h.POINTS,0,y.length);var ma=this.sourceRasterInfo.raster.bandCount;1<ma&&(h.uniform4fv(W,[0,1,0,1]),h.uniform4fv(U,[0,t[0],0,1]),h.drawArrays(h.POINTS,0,y.length),h.uniform4fv(W,[0,0,1,1]),h.uniform4fv(U,[0,0,t[0],1]),h.drawArrays(h.POINTS,0,y.length));if(h.checkFramebufferStatus(h.FRAMEBUFFER)==h.FRAMEBUFFER_COMPLETE){var ia=new Float32Array(1028);
h.readPixels(0,0,257,1,h.RGBA,h.FLOAT,ia);h=0;var D=-.5===w[0]&&1===(v[0]-w[0])/256?.5:0;for(f=0;f<ma;f++){var I=new Float32Array(257);var J=new Float32Array(257);for(u=h=0;256>u;u++)h+=ia[4*u+f],I[u]=h,J[u]=ia[4*u+f];J[256]=ia[1024+f];I[256]=h+ia[1024+f];var M=this.functionArguments.minPercent*h/100;if(v){for(m=0;256>m;m++)if(I[m]>M){a[f]=w[0]+(v[0]-w[0])/256*(m+D);break}M=(1-this.functionArguments.maxPercent/100)*h;for(m=254;0<=m;m--)if(I[m]<M){b[f]=w[0]+(v[0]-w[0])/256*(m+2-D);break}}}}return{histogram:ia,
minCutOff:a,maxCutOff:b}}catch(O){console.debug("webgl filter exception: "+O.message)}},_setupHistTexture:function(a){if(a instanceof WebGLTexture)return a;var b=this.originalHistTexture=this._createTexture(),l=this.gl;a=a.pixelBlock;var h=a.width,g=a.height;l.getExtension("OES_texture_float");this.rgbaFloatData=a.getAsRGBAFloat();l.texImage2D(l.TEXTURE_2D,0,l.RGBA,h,g,0,l.RGBA,l.FLOAT,this.rgbaFloatData);return b}})})},"esri/layers/rasterLib/function/RemapFunction":function(){define("dojo/_base/declare dojo/_base/lang ../../../renderers/colorRampGenerator ./RasterFunctionX ./pixelShaders ./RasterFunctionWebGLMixin ./rasterUtils".split(" "),
function(G,e,q,n,p,k,c){return G([n,k],{declaredClass:"esri.layers.rasterLib.function.RemapFunction",functionName:"Remap",pixelType:"U8",renderTexture:!1,supportWebGL:!0,support2D:!0,constructor:function(a){this.functionArguments=this.mixinIgnoreCase({inputRanges:null,outputValues:null,outputColors:null,colorBreaks:null,raster:null},a)},bind:function(a){a=this.getSourceRasterInfo(a);if(!a.raster)return Error("The raster input is not available.");var b=!(!this.functionArguments.outputColors&&!this.functionArguments.colorBreaks);
this.rasterInfo=e.mixin(a.raster,{bandCount:b?3:1,pixelType:this._calculatePixelType(this.pixelType,"U8"),statistics:null,histograms:null});this.rasterInfo.keyProperties=this.rasterInfo.keyProperties||{};this.rasterInfo.keyProperties.DataType=b?"Processed":"Thematic";return!0},read2D:function(a){return this._remap(a.raster)},readGL:function(a){return this._remapGL(a.raster)},_remap:function(a){this._performance.start();var b=c.remapColor(a.pixelBlock,this.functionArguments.colorBreaks);this._addPerformanceMetric(this._performance.elapsed());
return{extent:a.extent,pixelBlock:b}},_remapGL:function(a){this._performance.start();this._initializeProgram({fragment:p.remap,fragmentName:"Remap"});var b=new Uint8Array(64),l=this.functionArguments.colorBreaks;l.forEach(function(f,m){b[4*m]=f.mappedColor[0];b[4*m+1]=f.mappedColor[1];b[4*m+2]=f.mappedColor[2];b[4*m+3]=1>=f.mappedColor[3]?255*f.mappedColor[3]:f.mappedColor[3]});var h=l[l.length-1],g=h.mappedColor;b[60]=g[0];b[61]=g[1];b[62]=g[2];b[63]=1>=g[3]?255*g[3]:g[3];var d=new Float32Array(16);
l.forEach(function(f,m){d[m]=f.value});d[15]=h.value;this._clrTexture||(this._clrTexture=this._setupColormapTexture(b));l=this._clrTexture;h=this.bindFrameBuffer();a=this._setupTextureData(a);this._setUniforms({u_indexedColormapOffset:0,u_indexedColormapMaxIndex:b.length/4-1,u_breaks:d});this._bindTexture(l,"u_image1");this._bindTexture(a.texture,"u_image");this._drawGL();return{extent:a.extent,texture:h.texture}},_setupColormapTexture:function(a){var b=this._createTexture(),l=a.length/4,h=new Float32Array(a.length),
g=this.renderTexture?255:1,d,f=this.gl;for(d=0;d<a.length;d++)h[d]=a[d]/g;f.getExtension("OES_texture_float");f.texImage2D(f.TEXTURE_2D,0,f.RGBA,l,1,0,f.RGBA,f.FLOAT,h);return b}})})},"esri/layers/rasterLib/function/IdentityFunction":function(){define(["dojo/_base/declare","dojo/_base/lang","./pixelShaders","./RasterFunctionX","./RasterFunctionWebGLMixin"],function(G,e,q,n,p){return G([n,p],{declaredClass:"esri.layers.rasterLib.function.IdentityFunction",functionName:"Identity",supportWebGL:!0,support2D:!0,
constructor:function(k){this.functionArguments={raster:null}},bind:function(k){k=this.getSourceRasterInfo(k);if(!k.raster)return Error("The raster input to identity function is invalid.");this.rasterInfo=e.mixin(k.raster,{});return!0},read2D:function(k){return k.raster},readGL:function(k){this._initializeProgram({fragment:q.identity,fragmentName:"identity"});k=this._setupTextureData(k.raster);var c=this.bindFrameBuffer();this._bindTexture(k.texture,"u_image");this._drawGL();return{extent:k.extent,
texture:c.texture}}})})},"esri/layers/rasterLib/function/ResampleFunction":function(){define(["dojo/_base/declare","dojo/_base/lang","./pixelShaders","./RasterFunctionX","./RasterFunctionWebGLMixin"],function(G,e,q,n,p){return G([n,p],{declaredClass:"esri.layers.rasterLib.function.ResampleFunction",renderTexture:!0,resamplingOrigin:null,resamplingRatio:null,zFactor:1,functionName:"Resample",supportWebGL:!0,support2D:!1,constructor:function(k){this.functionArguments=this.mixinIgnoreCase({resamplingType:0},
k)},bind:function(k){k=this.getSourceRasterInfo(k);if(!k.raster)return Error("The raster input to convolution function is invalid.");this.rasterInfo=e.mixin(k.raster,{bandCount:k.raster.bandCount,pixelType:this._calculatePixelType(this.pixelType,k.raster.pixelType),statistics:k.raster.statistics,histograms:k.raster.histograms});this.rasterInfo.keyProperties=this.rasterInfo.keyProperties||{};return!0},readGL:function(k){this._performance.start();this._initializeProgram({fragment:q.resample,fragmentName:"Resample"});
var c=this._setupTextureData(k.raster),a=this.bindFrameBuffer(),b=this.gl,l=b.drawingBufferWidth;b=b.drawingBufferHeight;var h=k.raster;void 0!==h.pixelBlock?(c=c||this._setupTextureData(h),k=h.pixelBlock.width,h=h.pixelBlock.height):(c=c||h,k=l,h=b);this._setUniforms({u_resamplingRatio:this.resamplingRatio||[k/l,h/b],u_anchor:this.resamplingOrigin||[0,1],u_resamplingType:this.functionArguments.resamplingType,u_resolution:[1/l,1/b]});this._drawGL();this._addPerformanceMetric(this._performance.elapsed());
return{extent:c.extent,texture:a.texture}}})})},"esri/layers/rasterLib/renderer/rasterRendererHelper":function(){define("dojo/_base/declare dojo/_base/lang ../../PixelBlock ./RasterColormapRenderer ./RasterUniqueValueRenderer ./RasterRGBRenderer ./RasterStretchColorRampRenderer ./RasterClassBreaksRenderer ./RasterShadedReliefRenderer".split(" "),function(G,e,q,n,p,k,c,a,b){var l=function(){function h(d){g[d.prototype.rendererName]=d}var g={};h(n);h(k);h(c);h(p);h(a);h(b);return g}();return{wellKnownRenderers:l,
isSupported:function(h){if(!h)return!1;var g=!0;l[h.rendererName]||(g=!1);return g},create:function(h){if(!h)return null;if(h.rendererName){var g=h.rendererName;h=h.rendererArguments}else g="uniqueValue rasterStretch rasterShadedRelief rgb rasterColormap classBreaks".split(" ").indexOf(h.type),g="UniqueValue Stretch ShadedRelief RGB Colormap ClassBreaks".split(" ")[g],"rasterStretch"===h.type&&h.bandIndex&&1<h.bandIndex.length&&(g="RGB");return(g=l[g])?new g(h):null},createDefaultRenderer:function(h){if(h&&
h.raster){var g=h.raster.rasterInfo,d=h.raster.dataType;if(g){var f=h.raster.rasterFunction,m=["Stretch","Colormap","ContrastAndBrightness"];if(f&&"U8"===g.pixelType&&-1<m.indexOf(f.functionName))f.renderTexture=!0;else if("Processed"!==d||!(h.useWebGL&&f&&f.renderTexture||!h.useWebGL&&"U8"===g.pixelType)){f&&(g=f.rasterInfo);f=g.bandCount;var u=g.colormap,r=g.vat;m=g.histograms;m&&0===m.length&&(m=null);var t=g.statistics&&g.statistics.map(function(y){return[y.min,y.max,y.mean,y.stddev]});if(1===
f&&u&&0<u.length)var w=this._getDefaultColormapRenderer(r,u);else if(1===f&&r&&r.features&&0<r.features.length)w=new p({});else{u=0;r=!1;d||!h.raster||!h.raster.tileInfo||void 0!==h.raster.tileInfo.tileType&&"Map"!==h.raster.tileInfo.tileType?"U8"===g.pixelType&&"Processed"===d?(u=5,t=t||[[0,255,0,0],[0,255,0,0],[0,255,0,0]],r=!1):"U8"===g.pixelType||"Elevation"===d?(u=5,r=t?!1:!0):"Scientific"===d||"StdTime"===d?(u=5,r=t?!1:!0,w=this._getDefaultScientificColorRamp()):m&&0<m.length?(u=6,r=!1):t?(u=
5,r=!1):(u=6,r=!0):(t=[[0,255,0,0],[0,255,0,0],[0,255,0,0]],u=5,r=!1);t||(u=5,r=!0);var v;3<=f&&!(h.bandIds||h.raster&&h.raster.imageServiceParams&&h.raster.imageServiceParams.bandIds)&&(v=this.getDefaultBandCombination(g));v&&(t=v.map(function(y){return t[y]}));h={stretchType:u,min:0,max:255,dra:r,minPercent:.25,maxPercent:.25,useGamma:!1,computeGamma:!1,statistics:t,histograms:m,numberOfStandardDeviations:2.5,bandIndex:v};1===f||v&&1===v.length?(w&&(h.colorRamp=w,h.invert=!1),w=new c(h)):w=new k(h)}return w}}}},
getDefaultBandCombination:function(h){var g=h.bandCount;if(1===g)return null;if(2===g)return[0];var d=(h=h.keyProperties)&&h.ChangeAnalysisParameters&&h.ChangeAnalysisParameters.AnalysisType;if(d&&("ccdc"===d.toLowerCase()||"landtrendr"===d.toLowerCase()))return[0];h=h&&h.BandProperties;var f;if(h&&h.length===g){var m=this.getWellKnownBandIndexes(h);h=m.red;d=m.green;var u=m.blue;m=m.nir;null!=h&&null!=d&&null!=u?f=[h,d,u]:null!=m&&null!=h&&null!=d&&(f=[m,h,d])}!f&&3<=g&&(f=[0,1,2]);return f},getWellKnownBandIndexes:function(h){for(var g=
{},d=0;d<h.length;d++){var f=h[d],m=f.BandName&&f.BandName.toLowerCase();"red"===m?g.red=d:"green"===m?g.green=d:"blue"===m?g.blue=d:"nearinfrared"===m||"nearinfrared_1"===m||"nir"===m?g.nir=d:f.WavelengthMax&&f.WavelengthMin&&(m=f.WavelengthMin,f=f.WavelengthMax,null==g.blue&&410<=m&&480>=m&&480<=f&&540>=f?g.blue=d:null==g.green&&490<=m&&560>=m&&560<=f&&610>=f?g.green=d:null==g.red&&595<=m&&670>=m&&660<=f&&730>=f?g.red=d:null==g.nir&&700<=m&&860>=m&&800<=f&&950>=f&&(g.nir=d))}return g},_getDefaultColormapRenderer:function(h,
g){if(g||g.length){var d=[],f=this._ratContainsColormap(h);if(f)var m=this._getRATValueClassNameMap(h);g.forEach(function(u){var r=m?m[u[0]]:u[0];d.push({color:[u[1],u[2],u[3]],value:u[0],label:f?null!=r?r:"":u[0]})});return new n({colormapInfos:d})}},_ratContainsColormap:function(h){if(!h||!h.fields)return!1;var g,d,f;return h.fields.some(function(m){m&&m.name&&(m=m.name.toLowerCase(),"red"===m&&(g=!0),"green"===m&&(d=!0),"blue"===m&&(f=!0));return g&&d&&f})},_getRATValueClassNameMap:function(h){if(!h||
!h.fields)return null;var g={},d,f;h.fields.forEach(function(m){if("classname"===m.name.toLowerCase()||"class_name"===m.name.toLowerCase())d=m.name;"value"===m.name.toLowerCase()&&(f=m.name)});h.features.forEach(function(m){m=m.attributes;g[m[f]]=d?m[d]:m[f]});return g},_getDefaultScientificColorRamp:function(){return{type:"multipart",colorRamps:[{fromColor:[255,0,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[0,255,255]},{fromColor:[0,255,255],toColor:[0,0,255]}].map(function(h){return{fromColor:h.toColor,
toColor:h.fromColor}}).reverse()}}}})},"esri/layers/rasterLib/renderer/RasterColormapRenderer":function(){define(["dojo/_base/declare","dojo/_base/lang","./RasterRenderer","../function/ColormapFunction"],function(G,e,q,n){return G([q],{declaredClass:"esri.layers.rasterLib.renderer.RasterColormapRenderer",rendererName:"Colormap",renderTexture:!0,constructor:function(p){p&&p.colormapInfos&&(p.colormap=p.colormapInfos.map(function(k){return[k.value].concat(k.color)}));this._function=new n(p);this._function.outputPixelType=
"U8";this._function.renderTexture=!0},draw2D:function(p){this._updateColormapParameters();p=this._clonePixelData(p);return p=this._function._colorize(p)},drawGL:function(p){this._updateColormapParameters();this._function._colorizeGL(p)},toJson:function(){var p=this._function.toJson().rasterFunctionArguments;return{rendererName:this.rendererName,rendererArguments:p}},toCommonRendererJson:function(){return{type:"rasterColormap",colormapInfos:this.colormapInfos||this.colormap.map(function(p){return{value:p[0],
color:p.slice(1),label:p[0]}})}},_updateColormapParameters:function(){var p=this._function.functionArguments;p.colormap=this.colormap;p.colormapName=this.colormapName;p.colorRamp=this.colorRamp;p.colorRampName=this.colorRampName}})})},"esri/layers/rasterLib/renderer/RasterRenderer":function(){define(["dojo/_base/declare","dojo/_base/lang","../../../geometry/Extent","../../PixelBlock"],function(G,e,q,n){return G(null,{declaredClass:"esri.layers.rasterLib.renderer.RasterRenderer",raster:null,constructor:function(p){p=
p||{};this.raster=p.raster||p.Raster||this.raster;this.draw=e.hitch(this,this.draw);this.bind=e.hitch(this,this.bind);p=e.clone(p);Object.keys(p).forEach(function(k){null==p[k]&&delete p[k]});e.mixin(this,p)},bind:function(p){if(!p)throw"failed to bind without options";var k=p;p.layer&&(p=p.layer,k={id:p.id,rawRasterInfo:p.raster.rasterInfo,glSetting:p._glSetting,xformSetting:p.tileManager&&p.tileManager.xformSetting,useWebGL:p.useWebGL,resampling:p.tileMode&&p.tileManager&&p.tileManager.xformSetting.requireProjection&&
!p._hasTilingEffects&&"Thematic"!==p.raster.dataType?1:0,tileMode:p.tileMode});this._rawRasterInfo=k.rawRasterInfo;this.useWebGL=k.useWebGL;this._function&&this._function.setProcessingContext(e.mixin({useProcessedData:!0},k));this._processingContext=k},hasTilingEffects:function(){},draw:function(p){return this.useWebGL?this.drawGL(p):this.draw2D(p)},toJson:function(){},_clonePixelData:function(p){if(null==p)return p;var k={};p.extent&&(k.extent=new q(p.extent.xmin,p.extent.ymin,p.extent.xmax,p.extent.ymax,
p.extent.spatialReference));p=p.processedPixelBlock||p.pixelBlock;if(null==p)return k;k.pixelBlock=p.clone?p.clone():n.prototype.clone(p);return k}})})},"esri/layers/rasterLib/renderer/RasterUniqueValueRenderer":function(){define(["dojo/_base/declare","dojo/_base/lang","./RasterRenderer","../function/ColormapFunction","../../../renderers/colorRampGenerator"],function(G,e,q,n,p){return G([q],{declaredClass:"esri.layers.rasterLib.renderer.RasterUniqueValueRenderer",rendererName:"UniqueValue",field:"",
alias:"",uniqueValueInfos:null,constructor:function(k){k&&k.colormap&&(this.colormap=k.colormap,this._function=new n(k),this._function.outputPixelType="U8",this._function.renderTexture=!0)},bind:function(k){this.inherited(arguments);if(!this._function){var c=(this.raster&&this.raster.rasterInfo||this._rawRasterInfo).vat;if(!c)throw"uv renderer requires data source to have raster attribute table";var a=this.attributeField||this.field1||this.field,b=this.infos||this.uniqueValueInfos;this.defaultColor=
this.defaultColor||this.defaultSymbol&&this.defaultSymbol.color;var l=c.fields.filter(function(w){return"value"===w.name.toLowerCase()})[0];if(l)var h=l.name;a||((a=c.fields.filter(function(w){return-1<["classname","category"].indexOf(w.name.toLowerCase())})[0])||(a=c.fields.filter(function(w){return"esriFieldTypeString"===w.type})[0]),this.alias=(this.field=a=a&&a.name||h)&&a.alias||h);var g=[],d;if(!b){b=[];var f=c.fields.filter(function(w){return"alpha"===w.name.toLowerCase()})[0];var m=c.fields.filter(function(w){return"red"===
w.name.toLowerCase()})[0];var u=c.fields.filter(function(w){return"green"===w.name.toLowerCase()})[0];var r=c.fields.filter(function(w){return"blue"===w.name.toLowerCase()})[0];for(l=0;l<c.features.length;l++){var t=c.features[l].attributes;(d=b.some(function(w){w.value===t[a]}))||(f&&m&&u&&r?b.push({value:t[a],alias:t[a],color:[t[m.name],t[u.name],t[r.name],t[f.name]]}):m&&u&&r?b.push({value:t[a],alias:t[a],color:[t[m.name],t[u.name],t[r.name]]}):b.push({value:t[a],alias:t[a]}))}if(!(m&&u&&r))for(d=
p.createRandomColorRamp({size:b.length}),l=0;l<b.length;l++)b[l].color=d[l];this.uniqueValueInfos=b}if(b)b.forEach(function(w){g=g.concat(c.features.filter(function(v){return w.value==v.attributes[a]}).map(function(v){return[v.attributes[h]].concat(w.color||w.symbol&&w.symbol.color)}))}),this.defaultColor&&c.features.filter(function(w){g.some(function(v){return v[0]===w.attributes[h]})||g.push([w.attributes[h]].concat(this.defaultColor))});else throw"missing uniqueValueInfos property";this._function=
new n({colormap:g});this.colormap=g;this._function.outputPixelType="U8";this._function.renderTexture=!0;this._function.setProcessingContext(this._processingContext)}},draw2D:function(k){k=this._clonePixelData(k);return k=this._function._colorize(k)},drawGL:function(k){this._function._colorizeGL(k)},toJson:function(k){var c={field:this.field,uniqueValueInfos:this.uniqueValueInfos,defaultColor:this.defaultColor};k&&(c.colormap=this.colormap);return{rendererName:this.rendererName,rendererArguments:c}},
toCommonRendererJson:function(){var k=this.attributeField||this.field1||this.field,c=(this.infos||this.uniqueValueInfos).map(function(a){return{value:a.value,label:a.alias+"",symbol:{color:3===a.color.length?a.color.concat([255]):a.color,type:"esriSFS",style:"esriSFSSolid"}}});return{type:"uniqueValue",field1:k,uniqueValueInfos:c}}})})},"esri/layers/rasterLib/renderer/RasterRGBRenderer":function(){define("dojo/_base/declare dojo/_base/lang ./RasterRenderer ../function/StretchFunction ../function/ContrastBrightnessFunction ../function/rasterUtils".split(" "),
function(G,e,q,n,p,k){return G([q],{declaredClass:"esri.layers.rasterLib.renderer.RasterRGBRenderer",rendererName:"RGB",bandIndex:null,stretchType:0,min:0,max:255,numberOfStandardDeviations:2,statistics:null,histograms:null,dra:!1,minPercent:.25,maxPercent:.5,useGamma:!1,gamma:null,computeGamma:!1,sigmoidStrengthLevel:1,constructor:function(c){this.stretchType="number"===typeof this.stretchType?this.stretchType:"none   standardDeviation histogramEqualization minMax percentClip   sigmoid".split(" ").indexOf(this.stretchType);
c=e.mixin({},c,{stretchType:this.stretchType});this._stretchFunction=new n(c);this._stretchFunction.outputPixelType="U8";this._stretchFunction.renderTexture=!1;this.bandIndex=c.bandIndex||c.BandIndex;this._function=new p(c);this._function.functionArguments.raster=this._stretchFunction;this._function.renderTexture=!0},hasTilingEffects:function(){return this._stretchFunction.hasTilingEffects()},draw2D:function(c){this._updateStretchParameters();c=this._clonePixelData(c);if("U8"===c.pixelBlock.pixelType&&
!this.contrastOffset&&!this.brightnessOffset)return c;this._stretchFunction._stretch(c);var a=c.pixelBlock,b=this.bandIndex,l=Math.max.apply(null,b);a&&a.pixels.length>l&&b&&(a.pixels=b.map(function(h){return a.pixels[h]}),a.statistics&&(a.statistics=b.map(function(h){return a.statistics[h]})));if(this.contrastOffset||this.brightnessOffset)c.pixelBlock=k.contrastBrightnessStretch(c.pixelBlock,{contrastOffset:this.contrastOffset,brightnessOffset:this.brightnessOffset});return c},drawGL:function(c){this._updateStretchParameters();
c.pixelBlock&&(c=this._clonePixelData(c));var a=c.pixelBlock,b=this.bandIndex,l=Math.max.apply(null,b),h=this.statistics&&0<this.statistics.length?this.statistics:this._stretchFunction&&this._stretchFunction.srcStatistics,g=this.histograms&&0<this.histograms.length?this.histograms:this._stretchFunction&&this._stretchFunction.srcHistograms,d,f;a&&a.pixels.length>l&&b&&(a.pixels=b.map(function(m){return a.pixels[m]}),a.statistics&&(a.statistics=b.map(function(m){return a.statistics[m]})),h&&0<h.length&&
h.length!==b.length&&(d=b.map(function(m){return h[m]})),g&&0<g.length&&g.length!==b.length&&(f=b.map(function(m){return g[m]})));this._stretchFunction.functionArguments.statistics=d||h;this._stretchFunction.functionArguments.histograms=f||g;this.contrastOffset||this.brightnessOffset?(this._stretchFunction.renderTexture=!1,this._function.renderTexture=!0,c=this._stretchFunction._stretchGL(c),this._function._cbGL(c)):(this._stretchFunction.renderTexture=!0,this._stretchFunction._stretchGL(c))},toJson:function(){var c=
this._stretchFunction.toJson().rasterFunctionArguments;c.bandIndex=this.bandIndex;c.contrastOffset=this.contrastOffset;c.brightnessOffset=this.brightnessOffset;return{rendererName:this.rendererName,rendererArguments:c}},toCommonRendererJson:function(){return{type:"rasterStretch",stretchType:"none   standardDeviation histogramEqualization minMax percentClip   sigmoid".split(" ")[this.stretchType]||"minMax",min:this.min,max:this.max,numberOfStandardDeviations:this.numberOfStandardDeviations,statistics:e.clone(this.statistics),
dra:this.dra,minPercent:this.minPercent,maxPercent:this.maxPercent,useGamma:this.useGamma,gamma:e.clone(this.gamma),computeGamma:this.computeGamma,sigmoidStrengthLevel:this.sigmoidStrengthLevel}},_updateStretchParameters:function(){var c=this._stretchFunction.functionArguments;c.stretchType=this.stretchType;c.min=this.min;c.max=this.max;c.numberOfStandardDeviations=this.numberOfStandardDeviations;c.statistics=this.statistics;c.histograms=this.histograms;c.dra=this.dra;c.minPercent=this.minPercent;
c.maxPercent=this.maxPercent;c.useGamma=this.useGamma;c.gamma=this.gamma;c.computeGamma=this.computeGamma;this._stretchFunction.interpolation=this.interpolation}})})},"esri/layers/rasterLib/renderer/RasterStretchColorRampRenderer":function(){define("dojo/_base/declare dojo/_base/lang ./RasterRenderer ../function/ResampleFunction ../function/StretchFunction ../function/ContrastBrightnessFunction ../function/ColormapFunction ../function/rasterUtils".split(" "),function(G,e,q,n,p,k,c,a){return G([q],
{declaredClass:"esri.layers.rasterLib.renderer.RasterStretchColorRampRenderer",rendererName:"Stretch",bandIndex:[0],colorRamp:null,invert:!1,stretchType:0,min:0,max:255,numberOfStandardDeviations:2,statistics:null,histograms:null,dra:!1,minPercent:.25,maxPercent:.5,useGamma:!1,gamma:null,computeGamma:!1,sigmoidStrengthLevel:1,constructor:function(b){this.stretchType="number"===typeof this.stretchType?this.stretchType:"none   standardDeviation histogramEqualization minMax percentClip   sigmoid".split(" ").indexOf(this.stretchType);
b=e.mixin({},b,{stretchType:this.stretchType});Object.keys(b).forEach(function(l){null==b[l]&&delete b[l]});this._function=new k(b);this._stretchFunction=new p(b);this._stretchFunction.outputPixelType="U8";this._stretchFunction.renderTexture=!1;this._clrFunction=new c(b);this._clrFunction.functionArguments.raster=this._stretchFunction;this._clrFunction.renderTexture=!1;this._function.functionArguments.raster=this._clrFunction},hasTilingEffects:function(){return this._stretchFunction.hasTilingEffects()},
draw2D:function(b){this._updateStretchParameters();b=this._clonePixelData(b);if("U8"===b.pixelBlock.pixelType&&!(this.contrastOffset||this.brightnessOffset||this.colorRamp))return b;this._stretchFunction._stretch(b);var l=b.pixelBlock,h=this.bandIndex?this.bandIndex[0]:0;l&&1<l.pixels.length&&l.pixels.length>h&&(l.pixels=[l.pixels[h]],l.statistics&&(l.statistics=[l.statistics[h]]));this.colorRamp&&(b=this._clrFunction._colorize(b));if(this.contrastOffset||this.brightnessOffset)b.pixelBlock=a.contrastBrightnessStretch(b.pixelBlock,
{contrastOffset:this.contrastOffset,brightnessOffset:this.brightnessOffset});return b},drawGL:function(b){this._updateStretchParameters();b.pixelBlock&&(b=this._clonePixelData(b));var l=b.pixelBlock,h=this.bandIndex?this.bandIndex[0]||0:0,g=this.statistics&&0<this.statistics.length?this.statistics:this._stretchFunction&&this._stretchFunction.srcStatistics,d=this.histograms&&0<this.histograms.length?this.histograms:this._stretchFunction&&this._stretchFunction.srcHistograms,f,m;l&&1<l.pixels.length&&
l.pixels.length>h&&(l.pixels=[l.pixels[h]],l.statistics&&(l.statistics=[l.statistics[h]]),g&&g.length>h&&(f=[g[h]]),d&&d.length>h&&(m=[d[h]]));this._stretchFunction.functionArguments.statistics=f||g;this._stretchFunction.functionArguments.histograms=m||d;l=!!this.colorRamp;this.contrastOffset||this.brightnessOffset?(this._stretchFunction.renderTexture=!1,this._clrFunction.renderTexture=!1,this._function.renderTexture=!0,b=this._stretchFunction._stretchGL(b),l&&(b=this._clrFunction._colorizeGL(b)),
this._function._cbGL(b)):l?(this._stretchFunction.renderTexture=!1,this._clrFunction.renderTexture=!0,b=this._stretchFunction._stretchGL(b),this._clrFunction._colorizeGL(b)):(this._stretchFunction.renderTexture=!0,this._stretchFunction._stretchGL(b))},toJson:function(){var b=this._stretchFunction.toJson().rasterFunctionArguments;b.colorRamp=this.colorRamp||"";this.invert&&(b.invert=!0);b.contrastOffset=this.contrastOffset;b.brightnessOffset=this.brightnessOffset;return{rendererName:this.rendererName,
rendererArguments:b}},toCommonRendererJson:function(){return{type:"rasterStretch",stretchType:"none   standardDeviation histogramEqualization minMax percentClip   sigmoid".split(" ")[this.stretchType]||"minMax",colorRamp:this.colorRamp&&this.colorRamp.toJson?this.colorRamp.toJson():this.colorRamp,min:this.min,max:this.max,numberOfStandardDeviations:this.numberOfStandardDeviations,statistics:e.clone(this.statistics),dra:this.dra,minPercent:this.minPercent,maxPercent:this.maxPercent,useGamma:this.useGamma,
gamma:e.clone(this.gamma),computeGamma:this.computeGamma,sigmoidStrengthLevel:this.sigmoidStrengthLevel}},_updateStretchParameters:function(){var b=this._stretchFunction.functionArguments;b.stretchType=this.stretchType;b.min=this.min;b.max=this.max;b.numberOfStandardDeviations=this.numberOfStandardDeviations;b.statistics=this.statistics;b.histograms=this.histograms;b.dra=this.dra;b.minPercent=this.minPercent;b.maxPercent=this.maxPercent;b.useGamma=this.useGamma;b.gamma=this.gamma;b.computeGamma=this.computeGamma;
this._stretchFunction.interpolation=this.interpolation}})})},"esri/layers/rasterLib/renderer/RasterClassBreaksRenderer":function(){define(["dojo/_base/declare","dojo/_base/lang","./RasterRenderer","../function/ColormapFunction","../function/RemapFunction"],function(G,e,q,n,p){return G([q],{declaredClass:"esri.layers.rasterLib.renderer.RasterClassBreaksRenderer",rendererName:"ClassBreaks",renderTexture:!0,constructor:function(k){k=k||{};this._function=new p(k);this._function.outputPixelType="U8";var c=
k.classBreakInfos;k=k.minValue;null!=k&&c&&(this._function.functionArguments.colorBreaks=this._getSortedColorBreaks(k,c))},bind:function(k){this.inherited(arguments);this.isColormapFunction=!1;var c=this.raster&&this.raster.rasterInfo||this._rawRasterInfo,a=c&&c.vat;if(a&&"u8"===c.pixelType.toLowerCase()&&this.classBreakInfos){var b=this.field;if(c=a.fields.filter(function(m){return"value"===m.name.toLowerCase()})[0])var l=c.name;var h=a.features.sort(function(m,u){return parseFloat(m.attributes[b])-
parseFloat(u.attributes[b])})[0].attributes[b];this.isColormapFunction=!0;var g=[],d=this.field,f=this.classBreakInfos;f.forEach(function(m,u){a.features.forEach(function(r){var t=f[u-1]&&f[u-1].classMaxValue||h;r.attributes[d]<=m.classMaxValue&&(r.attributes[d]>t||r.attributes[d]===h)&&(t=m.symbol.color,g.some(function(w){return w[0]===r.attributes[l]})||g.push([r.attributes[l]].concat(t)))})});this._function=new n({colormap:g});this.colormap=g;this._function.outputPixelType="U8";this._function.renderTexture=
!0}this._function&&this._function.setProcessingContext(e.mixin({useProcessedData:!0},this._processingContext))},draw2D:function(k){if(this.isColormapFunction)return this._updateColormapParameters(),k=this._clonePixelData(k),k=this._function._colorize(k);this._updateRemapParameters();return this._function._remap(k)},drawGL:function(k){this.isColormapFunction?(this._updateColormapParameters(),this._function._colorizeGL(k)):(this._function.renderTexture=!0,this._updateRemapParameters(),this._function._remapGL(k))},
toJson:function(){var k=this._function.toJson().rasterFunctionArguments;return{rendererName:this.rendererName,rendererArguments:k}},toCommonRendererJson:function(){var k,c=this.classBreakInfos,a=this.colorBreaks;if(null==c&&a)for(c=[],k=0;k<a.length-1;k++)c.push({classMaxValue:a[k+1].value,symbol:{color:a[k].mappedColor,type:"esriSFS",style:"esriSFSSolid"},label:a[k].value+" - "+a[k+1].value});return{type:"classBreaks",field:"Value",minValue:null!=this.minValue?this.minValue:a[0].value,classBreakInfos:c}},
_updateRemapParameters:function(){var k=this.classBreakInfos,c=this.minValue;null!=c&&k&&(this._function.functionArguments.colorBreaks=this._getSortedColorBreaks(c,k))},_getSortedColorBreaks:function(k,c){c=c.map(function(b){return{maxValue:b.classMaxValue,color:b.symbol.color}}).sort(function(b,l){return b.maxValue-l.maxValue});var a=[{value:k,mappedColor:c[0].color}];for(k=0;k<c.length;k++)a.push({value:c[k].maxValue,mappedColor:k===c.length-1?c[k].color:c[k+1].color});return a},_updateColormapParameters:function(){this._function.functionArguments.colormap=
this.colormap;this._function.interpolation=this.interpolation}})})},"esri/layers/rasterLib/renderer/RasterShadedReliefRenderer":function(){define("dojo/_base/declare dojo/_base/lang ./RasterRenderer ../function/HillshadeFunction ../function/ContrastBrightnessFunction ../function/ColormapFunction ../function/rasterUtils".split(" "),function(G,e,q,n,p,k,c){return G([q],{declaredClass:"esri.layers.rasterLib.renderer.RasterShadedReliefRenderer",rendererName:"ShadedRelief",hillshadeType:null,azimuth:315,
altitude:45,zFactor:1,slopeType:null,psPower:.664,psFactor:.024,raster:null,constructor:function(a){this.hillshadeType="number"===typeof this.hillshadeType?this.hillshadeType:["traditional","multi-directional"].indexOf(this.hillshadeType);a&&a.scalingType&&(this.slopeType="adjusted"===a.scalingType?3:1);a&&a.pixelSizePower&&(this.psPower=a.pixelSizePower);a&&a.pixelSizeFactor&&(this.psFactor=a.pixelSizeFactor);a=e.mixin({},a,{hillshadeType:this.hillshadeType,psPower:this.psPower,psFactor:this.psFactor,
slopeType:this.slopeType});Object.keys(a).forEach(function(b){null==a[b]&&delete a[b]});this._function=new p(a);this._hillshadeFunction=new n(a);this._hillshadeFunction.outputPixelType="U8";this._hillshadeFunction.renderTexture=!1;this._function.functionArguments.raster=this._hillshadeFunction},hasTilingEffects:function(){return this._hillshadeFunction.hasTilingEffects()},draw2D:function(a){this._updateHillshadeParameters();a=this._clonePixelData(a);a=this._hillshadeFunction.read2D({raster:a});if(this.contrastOffset||
this.brightnessOffset)a.pixelBlock=c.contrastBrightnessStretch(a.pixelBlock,{contrastOffset:this.contrastOffset,brightnessOffset:this.brightnessOffset});return a},drawGL:function(a){this._updateHillshadeParameters();this.contrastOffset||this.brightnessOffset?(this._hillshadeFunction.renderTexture=!1,this._function.renderTexture=!0,a=this._hillshadeFunction.readGL({raster:a}),this._function._cbGL(a)):(this._hillshadeFunction.renderTexture=!0,this._hillshadeFunction.readGL({raster:a}))},toJson:function(){var a=
this._hillshadeFunction.toJson().rasterFunctionArguments;a.colorRamp=this.colorRamp||"";this.invert&&(a.invert=!0);a.contrastOffset=this.contrastOffset;a.brightnessOffset=this.brightnessOffset;return{rendererName:this.rendererName,rendererArguments:a}},toCommonRendererJson:function(){return{type:"rasterShadedRelief",hillshadeType:["traditional","multi-directional"][this.hillshadeType]||"traditional",azimuth:this.azimuth,altitude:this.altitude,zFactor:this.zFactor,scalingType:3===this.slopeType?"adjusted":
"none",pixelSizePower:this.psPower,pixelSizeFactor:this.psFactor,colorRamp:this.colorRamp&&this.colorRamp.toJson?this.colorRamp.toJson():this.colorRamp}},_updateHillshadeParameters:function(){var a=this._hillshadeFunction.functionArguments;a.hillshadeType=this.hillshadeType;a.azimuth=this.azimuth;a.altitude=this.altitude;a.zFactor=this.zFactor;a.slopeType=this.slopeType;a.psPower=this.psPower;a.psFactor=this.psFactor}})})},"esri/layers/rasterLib/raster/rasterProjectionHelper":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/Deferred dojo/sniff ../../../kernel ../../../WKIDUnitConversion ../../../geometry/Extent ../../../geometry/projection ../../../geometry/webMercatorUtils ../../../SpatialReference ../../../geometry/Point".split(" "),
function(G,e,q,n,p,k,c,a,b,l,h){G={requirePE:function(d,f){return!(d.equals(f)||d._canProject(f))},load:function(){var d=new q;if(!this._loadPromise)if(a.isSupported())this._loadPromise=a.load();else{var f=new q;f.reject("projection engine is not supported on this version of the browser, please try with a modern browser");this._loadPromise=f.promise}this._loadPromise.isFulfilled()?this._loadPromise.isResolved()?d.resolve():this._loadPromise.isRejected()&&d.resolve():(this._pendingdfds=this._pendingdfds||
[],this._pendingdfds.push(d),this._loadPromise.then(e.hitch(this,function(){this._pendingdfds.forEach(function(m){m.isFulfilled()||m.resolve()})}),e.hitch(this,function(){this._pendingdfds.forEach(function(m){m.isFulfilled()||m.reject()})})));return d.promise},computeError:function(d,f){return[Math.abs((d[0]+d[4]+d[4*f.rows]+d[4*f.rows+4])/4-d[2*f.rows+2]),Math.abs((d[1]+d[5]+d[4*f.rows+1]+d[4*f.rows+5])/4-d[2*f.rows+3])]},getDefaultDatumTransformationForDataset:function(d,f,m){if(!(f&&d.spatialReference&&
this.requirePE(d.spatialReference,f)&&a.isLoaded()))return null;d=new c(d.toJson());f=new l(f.toJson());return m?a.getTransformation(f,d.spatialReference,d):a.getTransformation(d.spatialReference,f,d)},project:function(d,f,m){if(!f||d.spatialReference.equals(f))return d;var u=a.isLoaded()?a:b;"esri.geometry.Extent"===d.declaredClass?d=new c(d.toJson()):"esri.geometry.Point"===d.declaredClass&&(d=new h(d.toJson()));f=new l(f.toJson());(d=u.project(d,f))&&"esri.geometry.Extent"===d.declaredClass?(d=
new c(d.toJson()),m&&(1E-5>Math.abs(d.xmin+180)&&1E-5>Math.abs(d.xmax-180)?(d.xmin=0,d.xmax=360):(0>d.xmin&&(d.xmin+=360,d.xmax+=360),0>d.xmax&&(d.xmax+=360)))):d&&"esri.geometry.Point"===d.declaredClass&&(d=new h(d.toJson()),m&&0>d.x&&(d.x+=360));return d},projectResolution:function(d,f,m){var u=m.xmin+(m.xmax-m.xmin)/2;m=m.ymin+(m.ymax-m.ymin)/2;d=new c(u,m,u+d.x,m+d.y,d.spatialReference);d=this.project(d,f);return new h(d.xmax-d.xmin,d.ymax-d.ymin,f)},getProjectionOffsetGrid:function(d,f,m,u,r,
t,w){null==w&&(w=[32,32]);var v=d.xmin,y=d.ymin,x=d.xmax,A=d.ymax,C=d.spatialReference,E=f.spatialReference,H=a.isLoaded()?a:b,B=r?-r:null,z=w[0]*m.x,F=w[1]*m.y;x={cols:Math.ceil((x-v)/z)+1,rows:Math.ceil((A-y)/F)+1};d=[];for(A=0;A<x.cols;A++){var K=L;var L=[];for(m=0;m<x.rows;m++){var N=new h({x:v+z*A,y:y+F*m,spatialReference:C});N=H.project(N,E,t);if(!N)return null;u&&0>N.x&&(N.x+=360);L.push(N);0<A&&null!=B&&N.x<K[m].x&&(N.x+=r-B,N.x<K[m].x&&(N.x+=r-B));d.push((N.x-f.xmin)/(f.xmax-f.xmin));d.push((N.y-
f.ymin)/(f.ymax-f.ymin))}}f=this.computeError(d,x);u=new Float32Array((x.cols-1)*(x.rows-1)*12);r=new Float32Array([-0,-1,1,-1,1,-0,1,-0,-0]);t=new Float32Array([-1,1,0,0,-1,1,1,0,0]);for(A=0;A<x.cols-1;A++)for(m=0;m<x.rows-1;m++){z=A*x.rows*2+2*m;v=d[z];y=d[z+1];L=d[z+2];C=d[z+3];z+=2*x.rows;E=d[z];H=d[z+1];B=d[z+2];F=d[z+3];K=0;N=12*(m*(x.cols-1)+A);for(z=0;3>z;z++)u[N++]=r[K++]*v+r[K++]*L+r[K++]*B;for(z=K=0;3>z;z++)u[N++]=r[K++]*y+r[K++]*C+r[K++]*F;for(z=K=0;3>z;z++)u[N++]=t[K++]*v+t[K++]*E+t[K++]*
B;for(z=K=0;3>z;z++)u[N++]=t[K++]*y+t[K++]*H+t[K++]*F}return{offsets:d,error:f,coefficients:u,spacing:w,size:[x.cols-1,x.rows-1]}},getHalfWorldWidth:function(d){var f=d&&d.wkid;if(null!=f)return d.isWebMercator()&&(f=3857),null==k[f]?180:g[f]}};n("extend-esri")&&e.setObject("layers.rasterLib.raster.rasterProjectionHelper",G,p);var g={3395:2.0037508342789244E7,3410:1.7334193943686873E7,3832:3339584.723798206,3857:2.0037508342788905E7,3975:1.7367530445161372E7,4087:2.0037508342789244E7,4088:2.0015108787169147E7,
6933:1.7367530445161372E7,8858:7396237.374497803,8859:2465412.4581659334,32662:2.0037508342789244E7,53001:2.001508679602057E7,53002:1.000754339801029E7,53003:2.001508679602057E7,53004:2.001508679602057E7,53016:1.4152803599503474E7,53017:1.7333573624304302E7,53025:7276828.3848298555,53031:1.0384677558821043E7,53034:2.001508679602057E7,53036:7389443.187332862,53037:2463147.729110953,53079:2.0015114352186374E7,53080:2.0015114352186374E7,54001:2.0037508342789244E7,54002:1.0018754171394624E7,54003:2.0037508342789244E7,
54004:2.0037508342789244E7,54016:1.4168658027268292E7,54017:1.736753044516137E7,54025:7311399.09166516,54031:1.0396310810074743E7,54034:2.0037508342789244E7,54050:808820.9223376509,54053:1920897.3915568967,54079:2.0037508342789244E7,54080:2.0037508342789244E7,54099:1.3524439768288724E7,54100:2.0037508342789244E7,54101:2.0037508342789244E7,102038:4297258.582585486,102299:5013965.117483125};return G})},"esri/geometry/projection":function(){define("require exports dojo/Deferred ./pe ../SpatialReference ./GeographicTransformation".split(" "),
function(G,e,q,n,p,k){function c(g,d,f,m,u){void 0===m&&(m=null);void 0===u&&(u=!1);if(null===m){var r=k.cacheKey(d,f);void 0!==h[r]?m=h[r]:(m=a(d,f,null),null===m&&(m=new k),h[r]=m)}return b._project(g,d,f instanceof p||!1===u?f:new p(f),m,u)}function a(g,d,f){void 0===f&&(f=null);g=b._getTransformation(g,d,f);return null!==g?k.fromGE(g):null}Object.defineProperty(e,"__esModule",{value:!0});var b=null;e.isLoaded=function(){return!!b&&n.isLoaded()};e.isSupported=function(){return n.isSupported()};
var l=null;e.load=function(){if(l)return l.promise;l=new q;var g=n.load();G(["./geometryEngine"],function(d){b=d;g.then(function(){b._enableProjection(n);l.resolve()},function(f){l.reject(f)})});return l.promise};e.project=function(g,d,f){void 0===f&&(f=null);return g instanceof Array?0===g.length?[]:c(g,g[0].spatialReference,d,f):c([g],g.spatialReference,d,f)[0]};var h={};e.projectMany=c;e.getTransformation=a;e.getTransformations=function(g,d,f){void 0===f&&(f=null);g=b._getTransformationBySuitability(g,
d,f);if(null!==g){d=[];for(f=0;f<g.length;f++)d.push(k.fromGE(g[f]));return d}return[]}})},"esri/geometry/pe":function(){define(["require","exports","../core/tsSupport/extendsHelper","dojo/Deferred","../core/sniff"],function(G,e,q,n,p){function k(r){function t(x,A,C){x[A]=C(x[A])}e._pe=r;g.init();d.init();f.init();m.init();u.init();e.PeGCSExtent=function(x){function A(){return null!==x&&x.apply(this,arguments)||this}q(A,x);A.prototype.destroy=function(){e._pe.destroy(this)};return A}(e._pe.PeGCSExtent);
for(var w=0,v=[e._pe.PeDatum,e._pe.PeGeogcs,e._pe.PeGeogtran,e._pe.PeObject,e._pe.PeParameter,e._pe.PePrimem,e._pe.PeProjcs,e._pe.PeSpheroid,e._pe.PeUnit];w<v.length;w++)r=v[w],t(r.prototype,"getName",function(x){return function(){return x.call(this,Array(g.PE_NAME_MAX))}});w=0;for(v=[e._pe.PeGeogtran,e._pe.PeProjcs];w<v.length;w++)r=v[w],t(r.prototype,"getParameters",function(x){return function(){for(var A=Array(g.PE_PARM_MAX),C=x.call(this),E=0;E<A.length;E++){var H=e._pe.getValue(C,"*");A[E]=H?
e._pe.wrapPointer(H,e._pe.PeParameter):null;C+=Int32Array.BYTES_PER_ELEMENT}return A}});t(e._pe.PeHorizon.prototype,"getCoord",function(x){return function(){var A=this.getSize();if(!A)return null;var C=[],E=x.call(this);l(C,A,E);return C}});t(e._pe.PeGTlistExtendedEntry.prototype,"getEntries",function(x){var A=e._pe._pe_getPeGTlistExtendedGTsSize();return function(){var C=null,E=x.call(this);if(!e._pe.compare(E,e._pe.NULL)){C=[E];var H=this.getSteps();if(1<H){E=e._pe.getPointer(E);for(var B=1;B<H;B++)C.push(e._pe.wrapPointer(E+
A*B,e._pe.PeGTlistExtendedGTs))}}return C}});var y=e._pe._pe_getPeHorizonSize();r=function(x){return function(){var A=this._cache;A||(this._cache=A=new Map);if(A.has(x))return A.get(x);var C=null,E=x.call(this);if(!e._pe.compare(E,e._pe.NULL)){C=[E];var H=E.getNump();if(1<H){E=e._pe.getPointer(E);for(var B=1;B<H;B++)C.push(e._pe.wrapPointer(E+y*B,e._pe.PeHorizon))}}A.set(x,C);return C}};t(e._pe.PeProjcs.prototype,"horizonGcsGenerate",r);t(e._pe.PeProjcs.prototype,"horizonPcsGenerate",r);e._pe.PeObject.prototype.toString=
function(x){void 0===x&&(x=g.PE_STR_OPTS_NONE);e._pe.ensureCache.prepare();var A=e._pe.getPointer(this),C=e._pe.ensureInt8(Array(g.PE_BUFFER_MAX));return e._pe.UTF8ToString(e._pe._pe_object_to_string_ext(A,x,C))}}function c(r){if(r){var t=e._pe.getClass(r);t&&(t=e._pe.getCache(t))&&(r=e._pe.getPointer(r))&&delete t[r]}}function a(r,t){var w=[];t=Array(t);for(var v=0;v<r;v++)w.push(e._pe.ensureInt8(t));return w}function b(r){if(Array.isArray(r[0])){var t=[];r.forEach(function(w){t.push(w[0],w[1])})}else t=
r;return t}function l(r,t,w,v){void 0===v&&(v=!1);if(v)for(v=0;v<2*t;v++)r[v]=e._pe.getValue(w+v*Float64Array.BYTES_PER_ELEMENT,"double");else{var y=0===r.length;for(v=0;v<t;v++)y&&(r[v]=Array(2)),r[v][0]=e._pe.getValue(w,"double"),r[v][1]=e._pe.getValue(w+Float64Array.BYTES_PER_ELEMENT,"double"),w+=2*Float64Array.BYTES_PER_ELEMENT}}Object.defineProperty(e,"__esModule",{value:!0});var h;e._pe=null;e.isLoaded=function(){return!!e._pe};e.isSupported=function(){return!!p("esri-wasm")};e.load=function(){if(h)return h.promise;
h=new n;G(["./support/pe-wasm"],function(r){r({locateFile:function(t){return G.toUrl("./support/"+t)},onAbort:function(t){h.reject(Error(t))}}).then(function(t){k(t);h.resolve()})});return h.promise};(function(r){function t(y,x,A){e._pe.ensureCache.prepare();var C=b(A),E=A===C;C=e._pe.ensureFloat64(C);(y=e._pe._pe_geog_to_proj(e._pe.getPointer(y),x,C))&&l(A,x,C,E);return y}function w(y,x,A){return v(y,x,A,0)}function v(y,x,A,C){e._pe.ensureCache.prepare();var E=b(A),H=A===E;E=e._pe.ensureFloat64(E);
(y=e._pe._pe_proj_to_geog_center(e._pe.getPointer(y),x,E,C))&&l(A,x,E,H);return y}r.geogToProj=t;r.projGeog=function(y,x,A,C){switch(C){case g.PE_TRANSFORM_P_TO_G:return w(y,x,A);case g.PE_TRANSFORM_G_TO_P:return t(y,x,A)}return 0};r.projToGeog=w;r.projToGeogCenter=v})(e.PeCSTransformations||(e.PeCSTransformations={}));var g;(function(r){r.init=function(){r.PE_BUFFER_MAX=e._pe.PeDefs.prototype.PE_BUFFER_MAX;r.PE_NAME_MAX=e._pe.PeDefs.prototype.PE_NAME_MAX;r.PE_MGRS_MAX=e._pe.PeDefs.prototype.PE_MGRS_MAX;
r.PE_USNG_MAX=e._pe.PeDefs.prototype.PE_USNG_MAX;r.PE_DD_MAX=e._pe.PeDefs.prototype.PE_DD_MAX;r.PE_DDM_MAX=e._pe.PeDefs.prototype.PE_DDM_MAX;r.PE_DMS_MAX=e._pe.PeDefs.prototype.PE_DMS_MAX;r.PE_UTM_MAX=e._pe.PeDefs.prototype.PE_UTM_MAX;r.PE_PARM_MAX=e._pe.PeDefs.prototype.PE_PARM_MAX;r.PE_TYPE_NONE=e._pe.PeDefs.prototype.PE_TYPE_NONE;r.PE_TYPE_GEOGCS=e._pe.PeDefs.prototype.PE_TYPE_GEOGCS;r.PE_TYPE_PROJCS=e._pe.PeDefs.prototype.PE_TYPE_PROJCS;r.PE_TYPE_GEOGTRAN=e._pe.PeDefs.prototype.PE_TYPE_GEOGTRAN;
r.PE_TYPE_COORDSYS=e._pe.PeDefs.prototype.PE_TYPE_COORDSYS;r.PE_TYPE_UNIT=e._pe.PeDefs.prototype.PE_TYPE_UNIT;r.PE_STR_OPTS_NONE=e._pe.PeDefs.prototype.PE_STR_OPTS_NONE;r.PE_STR_AUTH_NONE=e._pe.PeDefs.prototype.PE_STR_AUTH_NONE;r.PE_STR_AUTH_TOP=e._pe.PeDefs.prototype.PE_STR_AUTH_TOP;r.PE_STR_NAME_CANON=e._pe.PeDefs.prototype.PE_STR_NAME_CANON;r.PE_PARM_X0=e._pe.PeDefs.prototype.PE_PARM_X0;r.PE_PARM_ND=e._pe.PeDefs.prototype.PE_PARM_ND;r.PE_TRANSFORM_1_TO_2=e._pe.PeDefs.prototype.PE_TRANSFORM_1_TO_2;
r.PE_TRANSFORM_2_TO_1=e._pe.PeDefs.prototype.PE_TRANSFORM_2_TO_1;r.PE_TRANSFORM_P_TO_G=e._pe.PeDefs.prototype.PE_TRANSFORM_P_TO_G;r.PE_TRANSFORM_G_TO_P=e._pe.PeDefs.prototype.PE_TRANSFORM_G_TO_P;r.PE_HORIZON_RECT=e._pe.PeDefs.prototype.PE_HORIZON_RECT;r.PE_HORIZON_POLY=e._pe.PeDefs.prototype.PE_HORIZON_POLY;r.PE_HORIZON_LINE=e._pe.PeDefs.prototype.PE_HORIZON_LINE;r.PE_HORIZON_DELTA=e._pe.PeDefs.prototype.PE_HORIZON_DELTA}})(g=e.PeDefs||(e.PeDefs={}));(function(r){function t(x,A){var C=null,E=v[x];
E||(E={},v[x]=E);E.hasOwnProperty(String(A))?C=E[A]:(x=e._pe.PeFactory.prototype.factoryByType(x,A),e._pe.compare(x,e._pe.NULL)||(C=x,E[A]=C));return C=w(C)}function w(x){if(x){var A=x.getType();switch(A){case g.PE_TYPE_GEOGCS:x=e._pe.castObject(x,e._pe.PeGeogcs);break;case g.PE_TYPE_PROJCS:x=e._pe.castObject(x,e._pe.PeProjcs);break;case g.PE_TYPE_GEOGTRAN:x=e._pe.castObject(x,e._pe.PeGeogtran);break;default:A&g.PE_TYPE_UNIT&&(x=e._pe.castObject(x,e._pe.PeUnit))}}return x}var v={},y={};r.initialize=
function(){e._pe.PeFactory.prototype.initialize(null)};r.coordsys=function(x){return t(g.PE_TYPE_COORDSYS,x)};r.factoryByType=t;r.fromString=function(x,A){var C=null,E=y[x];E||(E={},y[x]=E);E.hasOwnProperty(A)?C=E[A]:(x=e._pe.PeFactory.prototype.fromString(x,A),e._pe.compare(x,e._pe.NULL)||(C=x,E[A]=C));return C=w(C)};r.geogcs=function(x){return t(g.PE_TYPE_GEOGCS,x)};r.geogtran=function(x){return t(g.PE_TYPE_GEOGTRAN,x)};r.getCode=function(x){return e._pe.PeFactory.prototype.getCode(x)};r.projcs=
function(x){return t(g.PE_TYPE_PROJCS,x)};r.unit=function(x){return t(g.PE_TYPE_UNIT,x)}})(e.PeFactory||(e.PeFactory={}));e.PeGCSExtent=null;var d;(function(r){var t;r.init=function(){r.PE_GTLIST_OPTS_COMMON=e._pe.PeGTlistExtended.prototype.PE_GTLIST_OPTS_COMMON;t=e._pe._pe_getPeGTlistExtendedEntrySize()};r.getGTlist=function(w,v,y,x,A,C){var E=null,H=new e._pe.PeInteger(C);try{var B=e._pe.PeGTlistExtended.prototype.getGTlist(w,v,y,x,A,H);if(C=H.val)if(E=[B],1<C){var z=e._pe.getPointer(B);for(w=1;w<
C;w++)E.push(e._pe.wrapPointer(z+t*w,e._pe.PeGTlistExtendedEntry))}}finally{e._pe.destroy(H)}return E}})(d=e.PeGTlistExtended||(e.PeGTlistExtended={}));(function(r){r.destroy=function(t){if(t&&t.length){for(var w=0;w<t.length;w++){var v=t[w];c(v);v.getEntries().forEach(function(y){c(y);y=y.getGeogtran();c(y);y.getParameters().forEach(c);[y.getGeogcs1(),y.getGeogcs2()].forEach(function(x){c(x);var A=x.getDatum();c(A);c(A.getSpheroid());c(x.getPrimem());c(x.getUnit())})})}e._pe.PeGTlistExtendedEntry.prototype.Delete(t[0])}}})(e.PeGTlistExtendedEntry||
(e.PeGTlistExtendedEntry={}));(function(r){r.geogToGeog=function(t,w,v,y,x){e._pe.ensureCache.prepare();var A=b(v),C=v===A;A=e._pe.ensureFloat64(A);var E=0;y&&(E=e._pe.ensureFloat64(y));(t=e._pe._pe_geog_to_geog(e._pe.getPointer(t),w,A,E,x))&&l(v,w,A,C);return t}})(e.PeGTTransformations||(e.PeGTTransformations={}));(function(r){function t(v,y,x,A,C,E){e._pe.ensureCache.prepare();switch(v){case "dd":var H=e._pe._pe_geog_to_dd;var B=g.PE_DD_MAX;break;case "ddm":H=e._pe._pe_geog_to_ddm;B=g.PE_DDM_MAX;
break;case "dms":H=e._pe._pe_geog_to_dms,B=g.PE_DMS_MAX}v=0;y&&(v=e._pe.getPointer(y));y=b(A);y=e._pe.ensureFloat64(y);B=a(x,B);A=e._pe.ensureInt32(B);if(C=H(v,x,y,C,A))for(H=0;H<x;H++)E[H]=e._pe.UTF8ToString(B[H]);return C}function w(v,y,x,A,C){e._pe.ensureCache.prepare();switch(v){case "dd":var E=e._pe._pe_dd_to_geog;break;case "ddm":E=e._pe._pe_ddm_to_geog;break;case "dms":E=e._pe._pe_dms_to_geog}v=0;y&&(v=e._pe.getPointer(y));y=A.map(function(H){return e._pe.ensureString(H)});A=e._pe.ensureInt32(y);
y=e._pe.ensureFloat64(Array(2*x));(E=E(v,x,A,y))&&l(C,x,y);return E}r.geog_to_dms=function(v,y,x,A,C){return t("dms",v,y,x,A,C)};r.dms_to_geog=function(v,y,x,A){return w("dms",v,y,x,A)};r.geog_to_ddm=function(v,y,x,A,C){return t("ddm",v,y,x,A,C)};r.ddm_to_geog=function(v,y,x,A){return w("ddm",v,y,x,A)};r.geog_to_dd=function(v,y,x,A,C){return t("dd",v,y,x,A,C)};r.dd_to_geog=function(v,y,x,A){return w("dd",v,y,x,A)}})(e.PeNotationDms||(e.PeNotationDms={}));var f;(function(r){r.init=function(){r.PE_MGRS_STYLE_NEW=
e._pe.PeNotationMgrs.prototype.PE_MGRS_STYLE_NEW;r.PE_MGRS_STYLE_OLD=e._pe.PeNotationMgrs.prototype.PE_MGRS_STYLE_OLD;r.PE_MGRS_STYLE_AUTO=e._pe.PeNotationMgrs.prototype.PE_MGRS_STYLE_AUTO;r.PE_MGRS_180_ZONE_1_PLUS=e._pe.PeNotationMgrs.prototype.PE_MGRS_180_ZONE_1_PLUS;r.PE_MGRS_ADD_SPACES=e._pe.PeNotationMgrs.prototype.PE_MGRS_ADD_SPACES};r.geog_to_mgrs_extended=function(t,w,v,y,x,A,C){e._pe.ensureCache.prepare();var E=0;t&&(E=e._pe.getPointer(t));t=b(v);v=e._pe.ensureFloat64(t);t=a(w,g.PE_MGRS_MAX);
var H=e._pe.ensureInt32(t);if(y=e._pe._pe_geog_to_mgrs_extended(E,w,v,y,x,A,H))for(x=0;x<w;x++)C[x]=e._pe.UTF8ToString(t[x]);return y};r.mgrs_to_geog_extended=function(t,w,v,y,x){e._pe.ensureCache.prepare();var A=0;t&&(A=e._pe.getPointer(t));t=v.map(function(C){return e._pe.ensureString(C)});v=e._pe.ensureInt32(t);t=e._pe.ensureFloat64(Array(2*w));(y=e._pe._pe_mgrs_to_geog_extended(A,w,v,y,t))&&l(x,w,t);return y}})(f=e.PeNotationMgrs||(e.PeNotationMgrs={}));(function(r){r.geog_to_usng=function(t,
w,v,y,x,A,C){e._pe.ensureCache.prepare();var E=0;t&&(E=e._pe.getPointer(t));t=b(v);v=e._pe.ensureFloat64(t);t=a(w,g.PE_MGRS_MAX);var H=e._pe.ensureInt32(t);if(y=e._pe._pe_geog_to_usng(E,w,v,y,x,A,H))for(x=0;x<w;x++)C[x]=e._pe.UTF8ToString(t[x]);return y};r.usng_to_geog=function(t,w,v,y){e._pe.ensureCache.prepare();var x=0;t&&(x=e._pe.getPointer(t));t=v.map(function(A){return e._pe.ensureString(A)});v=e._pe.ensureInt32(t);t=e._pe.ensureFloat64(Array(2*w));(x=e._pe._pe_usng_to_geog(x,w,v,t))&&l(y,w,
t);return x}})(e.PeNotationUsng||(e.PeNotationUsng={}));var m;(function(r){r.init=function(){r.PE_UTM_OPTS_NONE=e._pe.PeNotationUtm.prototype.PE_UTM_OPTS_NONE;r.PE_UTM_OPTS_ADD_SPACES=e._pe.PeNotationUtm.prototype.PE_UTM_OPTS_ADD_SPACES;r.PE_UTM_OPTS_NS=e._pe.PeNotationUtm.prototype.PE_UTM_OPTS_NS};r.geog_to_utm=function(t,w,v,y,x){e._pe.ensureCache.prepare();var A=0;t&&(A=e._pe.getPointer(t));t=b(v);v=e._pe.ensureFloat64(t);t=a(w,g.PE_UTM_MAX);var C=e._pe.ensureInt32(t);if(y=e._pe._pe_geog_to_utm(A,
w,v,y,C))for(A=0;A<w;A++)x[A]=e._pe.UTF8ToString(t[A]);return y};r.utm_to_geog=function(t,w,v,y,x){e._pe.ensureCache.prepare();var A=0;t&&(A=e._pe.getPointer(t));t=v.map(function(C){return e._pe.ensureString(C)});v=e._pe.ensureInt32(t);t=e._pe.ensureFloat64(Array(2*w));(y=e._pe._pe_utm_to_geog(A,w,v,y,t))&&l(x,w,t);return y}})(m=e.PeNotationUtm||(e.PeNotationUtm={}));var u;(function(r){var t=new Map;r.init=function(){r.PE_PCSINFO_OPTION_NONE=e._pe.PePCSInfo.prototype.PE_PCSINFO_OPTION_NONE;r.PE_PCSINFO_OPTION_DOMAIN=
e._pe.PePCSInfo.prototype.PE_PCSINFO_OPTION_DOMAIN;r.PE_POLE_OUTSIDE_BOUNDARY=e._pe.PePCSInfo.prototype.PE_POLE_OUTSIDE_BOUNDARY;r.PE_POLE_POINT=e._pe.PePCSInfo.prototype.PE_POLE_POINT};r.generate=function(w,v){void 0===v&&(v=r.PE_PCSINFO_OPTION_DOMAIN);var y;if(t.has(w)){var x=t.get(w);x[v]&&(y=x[v])}y||(y=e._pe.PePCSInfo.prototype.generate(w,v),x||(x=[],t.set(w,x)),x[v]=y);return y}})(u=e.PePCSInfo||(e.PePCSInfo={}));(function(r){r.version_string=function(){return e._pe.PeVersion.prototype.version_string()}})(e.PeVersion||
(e.PeVersion={}));e._init=k})},"esri/core/tsSupport/extendsHelper":function(){define([],function(){return function(){var G=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,q){e.__proto__=q}||function(e,q){for(var n in q)q.hasOwnProperty(n)&&(e[n]=q[n])};return function(e,q){function n(){this.constructor=e}G(e,q);e.prototype=null===q?Object.create(q):(n.prototype=q.prototype,new n)}}()})},"esri/geometry/GeographicTransformation":function(){define(["require","exports","./GeographicTransformationStep"],
function(G,e,q){return function(){function n(p){this.steps=[];this._cached_projection={};this._chain="";this._gtlistentry=null;if(p&&p.steps){var k=0;for(p=p.steps;k<p.length;k++){var c=p[k];c instanceof q?this.steps.push(c):this.steps.push(new q({wkid:c.wkid,wkt:c.wkt,isInverse:c.isInverse}))}}}n.cacheKey=function(p,k){return[void 0!==p.wkid&&null!==p.wkid?p.wkid.toString():"-1",void 0!==p.wkt&&null!==p.wkt?p.wkt.toString():"",void 0!==k.wkid&&null!==k.wkid?k.wkid.toString():"-1",void 0!==k.wkt&&
null!==k.wkt?k.wkt.toString():""].join()};n.fromGE=function(p){var k=new n,c="",a=0;for(p=p.steps;a<p.length;a++){var b=q.fromGE(p[a]);k.steps.push(b);c+=b.uid.toString()+","}k._cached_projection={};k._gtlistentry=null;k._chain=c;return k};n.prototype.getInverse=function(){var p=new n;p.steps=[];for(var k=this.steps.length-1;0<=k;k--)p.steps.push(this.steps[k].getInverse());return p};n.prototype.getGTListEntry=function(){for(var p="",k=0,c=this.steps;k<c.length;k++)p+=c[k].uid.toString()+",";p!==
this._chain&&(this._gtlistentry=null,this._cached_projection={},this._chain=p);return this._gtlistentry};n.prototype.assignCachedGe=function(p,k,c){this._cached_projection[n.cacheKey(p,k)]=c};n.prototype.getCachedGeTransformation=function(p,k){for(var c="",a=0,b=this.steps;a<b.length;a++)c+=b[a].uid.toString()+",";c!==this._chain&&(this._gtlistentry=null,this._cached_projection={},this._chain=c);p=this._cached_projection[n.cacheKey(p,k)];return void 0===p?null:p};return n}()})},"esri/geometry/GeographicTransformationStep":function(){define(["require",
"exports"],function(G,e){var q=0;return function(){function n(p){void 0===p&&(p=null);this.uid=q++;p?(this._wkt=void 0!==p.wkt?p.wkt:null,this._wkid=void 0!==p.wkid?p.wkid:-1,this._isInverse=void 0!==p.isInverse?!0===p.isInverse:!1):(this._wkt=null,this._wkid=-1,this._isInverse=!1)}n.fromGE=function(p){var k=new n;k._wkt=p.wkt;k._wkid=p.wkid;k._isInverse=p.isInverse;return k};Object.defineProperty(n.prototype,"wkt",{get:function(){return this._wkt},set:function(p){this._wkt=p;this.uid=q++},enumerable:!0,
configurable:!0});Object.defineProperty(n.prototype,"wkid",{get:function(){return this._wkid},set:function(p){this._wkid=p;this.uid=q++},enumerable:!0,configurable:!0});Object.defineProperty(n.prototype,"isInverse",{get:function(){return this._isInverse},set:function(p){this._isInverse=p;this.uid=q++},enumerable:!0,configurable:!0});n.prototype.getInverse=function(){var p=new n;p._wkt=this.wkt;p._wkid=this._wkid;p._isInverse=!this.isInverse;return p};return n}()})},"esri/layers/rasterLib/raster/TileServiceRaster":function(){define("require dojo/_base/declare dojo/_base/lang dojo/_base/Deferred dojo/_base/array dojo/_base/config dojo/_base/json dojo/sniff dojo/DeferredList dojo/when ../../../kernel ../../../Evented ../../../request ../../../geometry/Extent ../../../geometry/Point ../../../SpatialReference ../../../deferredUtils ../../../urlUtils ../../PixelBlock ../../rasterFormats/rasterCodec ../tile/RasterTileInfo ./RasterInfo ./BasicRaster".split(" "),
function(G,e,q,n,p,k,c,a,b,l,h,g,d,f,m,u,r,t,w,v,y,x,A){G=e([A],{declaredClass:"esri.layers.rasterLib.raster.TileServiceRaster",constructor:function(C){},open:function(){var C=new n,E=this.serviceInfo||this._getServiceInfo(null),H=q.hitch(this,function(z){this.serviceInfo=z;this.version=z.currentVersion;this.rasterInfo=this._parseRasterInfo(z);this.loaded=!0;this._getRasterIdentifier();C.resolve(this)}),B=q.hitch(this,function(z){this.loaded=!0;this._getRasterIdentifier();C.reject(z)});l(E,H,B);return C.promise},
read:function(C){var E=this.url+"/tile/"+C.level+"/"+C.row+"/"+C.col,H={width:this.tileInfo.cols,height:this.tileInfo.rows,planes:null,pixelType:null,format:null,decodeFunc:null,isPoint:"elevation"===this.tileType.toLowerCase()?!0:!1};return this._requestPixels({url:E+(this.disableClientCaching?"?_ts\x3d "+(new Date).getTime():""),payload:{},decodeParams:H,tileOptions:C})},identify:function(C,E){null==E&&(E=this.tileInfo.lods[this.tileInfo.lods.length-1].level);var H=(C.x-this.tileInfo.origin.x)/
this.tileInfo.lods[E].resolution/this.tileInfo.cols;C=(this.tileInfo.origin.y-C.y)/this.tileInfo.lods[E].resolution/this.tileInfo.rows;var B=Math.floor(H),z=Math.floor(C),F=Math.floor((H-B)*this.tileInfo.cols);F=Math.min(F,this.tileInfo.cols-1);var K=Math.floor((C-z)*this.tileInfo.rows);K=Math.min(K,this.tileInfo.rows-1);var L=new n;this.read({level:E,row:z,col:B}).then(function(N){var Q=K*N.width+F;N&&N.pixels&&0<N.pixels.length?(N=N.mask?N.mask[Q]?N.pixels.map(function(S){return S[Q]}):null:N.pixels.map(function(S){return S[Q]}),
L.resolve(N)):L.reject("no valid data")},function(N){L.reject(N)});return L.promise},setFetchParameters:function(C,E){},_getRasterIdentifier:function(){this._rasterId||(this._rasterId=this.url.replace("http:","").replace("https:",""));return this._rasterId},_getServiceInfo:function(){var C=this.url,E=new n(r._dfdCanceller);E._pendingDfd=d({url:C,content:{f:"json"},handleAs:"json",callbackParamName:"callback"});E._pendingDfd.then(function(H){E.callback(H)},function(H){E.errback(H)});return E},_parseRasterInfo:function(C){var E=
new x;E.extent=new f(C.fullExtent);E.spatialReference=new u(C.spatialReference);this.tileType=C.cacheType||"Map";switch(this.tileType){case "Map":E.bandCount=3;E.pixelType="U8";this.dataType="Processed";break;case "Elevation":E.bandCount=1;E.pixelType=C.pixelType||"F32";this.dataType="Elevation";break;case "Raster":E.bandCount=null,E.pixelType=null,this.dataType=C.serviceDataType&&C.serviceDataType.replace("esriImageServiceDataType","")||"Generic"}var H=C.tileInfo;E.width=Math.floor((C.fullExtent.xmax-
C.fullExtent.xmin)/H.lods[H.lods.length-1].resolution+.5);E.height=Math.floor((C.fullExtent.ymax-C.fullExtent.ymin)/H.lods[H.lods.length-1].resolution+.5);E.cellSize=new m({x:H.lods[H.lods.length-1].resolution,y:H.lods[H.lods.length-1].resolution,spatialReference:C.spatialReference});this.tileInfo=new y(H);this.tileInfo.tileType=this.tileType;return E}});a("extend-esri")&&q.setObject("layers.rasterLib.raster.TileServiceRaster",G,h);return G})},"esri/layers/rasterLib/raster/TileRaster":function(){define("require dojo/_base/declare dojo/_base/lang dojo/_base/Deferred dojo/_base/array dojo/_base/config dojo/_base/json dojo/sniff dojo/DeferredList dojo/when ../../../kernel ../../../Evented ../../../request ../../../geometry/Extent ../../../geometry/Point ../../../SpatialReference ../../../deferredUtils ../../../urlUtils ../../PixelBlock ../../rasterFormats/rasterCodec ../tile/RasterTileInfo ./RasterInfo ./BasicRaster".split(" "),
function(G,e,q,n,p,k,c,a,b,l,h,g,d,f,m,u,r,t,w,v,y,x,A){G=e([A],{declaredClass:"esri.layers.rasterLib.raster.TileRaster",sourceType:"TileCache",_RECORD_SIZE:8,constructor:function(C){this._cloudBlobStorage=C&&C._cloudBlobStorage},open:function(){var C=new n,E=this.datasetInfo||this._getDatasetInfo(null),H=q.hitch(this,function(z){this.datasetInfo=z;this.rasterInfo=z=this._parseRasterInfo(z);this.tileType="Cache/LERC"===z.format?"Elevation":"Cache/MIXED"===z.format||"Cache/JPEG"===z.format||"Cache/PNG"===
z.format?"Map":"Raster";this.tileInfo=z.tileInfo;this.dataType=["Generic","Elevation","Processed"][["Raster","Elevation","Map"].indexOf(this.tileType)];this._HEADER_SIZE=z.packetSize*z.packetSize*this._RECORD_SIZE+64;this.loaded=!0;this._cloudBlobStorage=this._cloudBlobStorage||-1<this.url.toLowerCase().indexOf("s3.amazonaws.com")||-1<this.url.toLowerCase().indexOf("windows.net")||-1<this.url.toLowerCase().indexOf("googleapis.com");this._getRasterIdentifier();C.resolve(this)}),B=q.hitch(this,function(z){this.loaded=
!0;this._getRasterIdentifier();C.reject(z)});l(E,H,B);return C.promise},read:function(C){var E=new n,H=C.level,B=C.row,z=C.col,F=this._buildCacheFilePath(this.url,H,B,z),K=this._getIndexRecordFromBundle(H,B,z);d({url:F,content:{},headers:{Range:"bytes\x3d0-"+(this._HEADER_SIZE-1).toString()},handleAs:"arraybuffer"}).then(q.hitch(this,function(L,N){if(!E.isCanceled()){console.log("time in ms request "+(new Date-Q));var Q=new Date;L=new Uint8Array(L);L=this._getTileEndAndContentType(L,K);N={width:this.tileInfo.cols,
height:this.tileInfo.rows,planes:null,pixelType:null,format:null,decodeFunc:null,isPoint:"elevation"===this.tileType.toLowerCase()?!0:!1};this._requestPixels({url:F+(this.disableClientCaching?"?_ts\x3d "+(new Date).getTime():""),payload:{},headers:{Range:"bytes\x3d"+L.position.toString()+"-"+(L.position+L.recordSize).toString()},decodeParams:N,tileOptions:C}).then(function(S){E.isCanceled()||E.resolve(S)},function(S){E.isCanceled()||E.reject(S)})}}));return E.promise},identify:function(){return null},
setFetchParameters:function(C,E){},toJson:function(){return{url:this.url,tileInfo:this.tileInfo.toJson(),rasterInfo:this.rasterInfo.toJson(),datasetInfo:this.datasetInfo,sourceType:this.sourceType,tileType:this.tileType,_rasterId:this._rasterId}},_getDatasetInfo:function(){return d({url:this.url+"/conf.json",handleAs:"json",content:{}})},_parseRasterInfo:function(C){var E=new x;switch(C.pixelType){case 1:var H="U1";break;case 1:H="U2";break;case 2:H="U4";break;case 3:H="U8";break;case 4:H="S8";break;
case 5:H="U16";break;case 6:H="S16";break;case 7:H="U32";break;case 8:H="S32";break;case 9:H="F32";break;default:H="F32"}var B,z=[],F=C.LODInfos;for(B=0;B<F.levels.length;B++)z.push({level:F.levels[B],resolution:F.resolutions[B],scale:96/.0254*F.resolutions[B]});B=new u(C.extent.spatialReference||C.geodataXform.spatialReference);z=new y({rows:C.blockHeight,cols:C.blockWidth,dpi:96,format:C.format,compressionQuality:0,origin:C.origin,spatialReference:B,lods:z});E.pixelType=H;E.bandCount=C.bandCount;
E.spatialReference=B;E.extent=new f({xmin:C.extent.xmin,ymin:C.extent.ymin,xmax:C.extent.xmax,ymax:C.extent.ymax,spatialReference:B});E.cellSize=new m({x:C.pixelSizeX,y:C.pixelSizeY,spatialReference:B});E.width=Math.floor((E.extent.xmax-E.extent.xmin)/E.cellSize.x+.5);E.height=Math.floor((E.extent.ymax-E.extent.ymin)/E.cellSize.y+.5);E.statistics=C.statistics.map(function(K){Object.keys(K).forEach(function(L){isNaN(K[L])&&(K[L]=null)});return K});E.histograms=C.histograms;E.geodataXform=C.geodataXform;
E.packetSize=C.packetSize;E.format=C.format;E.compressionQuality=C.compressionQuality;E.tileInfo=z;return E},_getRasterIdentifier:function(){this._rasterId||(this._rasterId=this.url.replace("http:","").replace("https:",""));return this._rasterId},_buildCacheFilePath:function(C,E,H,B){var z=this.rasterInfo.packetSize;B=Math.floor(B/z)*z;H="R"+this._toHexString4(Math.floor(H/z)*z)+"C"+this._toHexString4(B);z="L";z=10<=E?z+E.toString():z+("0"+E.toString());return this._cloudBlobStorage?C+"/_alllayers/"+
z+"/"+H+".bundle":C+"/"+z+"_"+H+"/bundle"},_getIndexRecordFromBundle:function(C,E,H){C=this.rasterInfo.packetSize;E=E%C*C+H%C;if(0>E)throw"Invalid level / row / col";return E*this._RECORD_SIZE+64},_getTileEndAndContentType:function(C,E){C=C.subarray(E,E+8);E=0;var H;for(H=0;5>H;H++)E|=(C[H]&255)<<8*H;var B=E&0xffffffffff;E=0;for(H=5;8>H;H++)E|=(C[H]&255)<<8*(H-5);return{position:B,recordSize:E&0xffffffffff}},_toHexString4:function(C){C=C.toString(16);if(4!=C.length)for(var E=4-C.length;0<E--;)C="0"+
C;return C}});a("extend-esri")&&q.setObject("layers.rasterLib.raster.TileRaster",G,h);return G})},"esri/layers/rasterLib/raster/FunctionRaster":function(){define("require dojo/_base/declare dojo/_base/lang dojo/_base/Deferred dojo/_base/array dojo/_base/config dojo/_base/json dojo/sniff ../DeferredList2 dojo/when ../../../kernel ../../../Evented ../../../request ../../../deferredUtils ../../../geometry/Extent ../../../geometry/Point ../../../SpatialReference ../../../deferredUtils ../../../urlUtils ../../rasterFormats/rasterCodec ./RasterInfo ./BasicRaster ../../rasterLib/function/rasterFunctionHelper".split(" "),
function(G,e,q,n,p,k,c,a,b,l,h,g,d,f,m,u,r,t,w,v,y,x,A){G=e([x],{declaredClass:"esri.layers.rasterLib.raster.FunctionRaster",rasterFunction:null,sourceType:"Function",constructor:function(C){C&&C.rasterFx&&this._init(C.rasterFx,C.rasterFxArgs)},open:function(){var C=this.getMemberRasters().map(function(H){return H.open()});this.identifiers=this.getMemberRasters().map(function(H){return H._rasterId});var E=new n;(new b(C,null,null,!0)).then(function(H){H.some(function(B){return!B[0]})?E.reject(H):
(this.rasterFunction.bind(),this.rasterInfo=this.rasterFunction.rasterInfo,this.dataType=this.rasterInfo.keyProperties&&this.rasterInfo.keyProperties.DataType||"Generic",this.tileInfo=H[0][1].tileInfo,E.resolve(this))}.bind(this));return E.promise},getProjectedFullExtent:function(C){var E=new n;this.getMemberRasters()[0].getProjectedFullExtent(C).then(q.hitch(this,function(H){this.projectedFullExtent=H;E.resolve(H)}));return E.promise},setProcessingContext:function(C){var E=C;C.layer&&(C=C.layer,
E={id:C.id,rawRasterInfo:C.raster.rasterInfo,glSetting:C._glSetting,xformSetting:C.tileManager&&C.tileManager.xformSetting,useWebGL:C.useWebGL,resampling:C.tileMode&&C.tileManager&&C.tileManager.xformSetting.requireProjection&&!C._hasTilingEffects&&"Thematic"!==C.raster.dataType?1:0,tileMode:C.tileMode});this.rasterFunction.setProcessingContext(E);this._layerOptions=E},alterDefinition:function(C){if(C=C||this.rasterFunction)1===this.memberRasters.length&&!C._bindComplete&&(this.rasterFunction=A.create(C,
{raster:this.memberRasters[0]}))&&(this.rasterFunction.bind(),this.rasterInfo=this.rasterFunction.rasterInfo,this.dataType=this.rasterInfo.keyProperties&&this.rasterInfo.keyProperties.DataType||"Generic",this.rasterFunction.setProcessingContext(this._layerOptions)),this._rasterHandler&&this._rasterHandler._connected&&this.rasterFunction&&this._rasterHandler.setRasterFunction({layerId:this._layerOptions.id,data:this.rasterFunction.toJson(!0)})},setFetchParameters:function(C,E){var H=this.getMemberRasters();
H&&1===H.length&&H[0].setFetchParameters(C,E)},getMemberRasters:function(){this.memberRasters||(this.memberRasters=[],this._getMemberRasters(this.rasterFunction.functionArguments,this.memberRasters));return this.memberRasters},read:function(C){var E=new n(f._dfdCanceller);if(C.src){var H=this.rasterFunction.read(C);E.resolve(H);return E.promise}var B=this.getMemberRasters().map(function(L){return L.read(C)});B=new b(B);var z,F,K=this.identifiers;E._pendingDfd=B;B.then(q.hitch(this,function(L){if(z=
L.some(function(N){return N[0]}))F={},L.forEach(function(N,Q){F[K[Q]]=N[0]?N[1]:null});H=F?this.rasterFunction.read({extent:C.extent,src:F}):null;H.srcData=F;E.resolve(H)}));return E},_init:function(C,E){if(this.rasterFunction=A.create(C,E))this.rasterFunction._bindComplete=!0;else throw"Cannot initialize a function raster without a raster function";},_getMemberRasters:function(C,E){var H=Object.keys(C),B,z,F;for(B=0;B<H.length;B++)if(F=C[H[B]]){var K=F instanceof Array?F:[F];for(z=0;z<K.length;z++)(F=
K[z])&&("function"===typeof F||"object"===typeof F)&&F.read&&(F.functionArguments?this._getMemberRasters(F.functionArguments,E):F.sourceType&&"Function"!==F.sourceType&&(F._identifier=F._getRasterIdentifier(),E.some(function(L){return L._identifier===F._identifier})||E.push(F)))}return E}});a("extend-esri")&&q.setObject("layers.rasterLib.raster.FunctionRaster",G,h);return G})},"esri/layers/rasterLib/DeferredList2":function(){define(["dojo/DeferredList"],function(G){return function(e,q,n,p,k){this.list=
e;q=new G(e,q,n,p,k);var c=q.resolve.bind(q),a=q.cancel.bind(q);q.cancel=function(){e&&e.forEach(function(b){b.cancel&&b.cancel()});a.apply(this,arguments)}.bind(q);q.resolve=function(){this.isFulfilled()||c.apply(this,arguments)}.bind(q);return q}})},"esri/layers/rasterLib/tile/RasterTileManager":function(){define("dojo/_base/declare dojo/_base/lang dojo/Deferred dojo/when ../DeferredList2 ../../../geometry/Extent ../../../SpatialReference ../../../geometry/Point ../../PixelBlock ./RasterTileInfo ../raster/rasterProjectionHelper".split(" "),
function(G,e,q,n,p,k,c,a,b,l,h){var g=function(d,f){var m;for(m=0;m<d.length;m++)if(f(d[m]))return m;return-1};return G(null,{declaredClass:"esri.layers.rasterLib.tile.RasterTileManager",count:null,fullBoundary:null,tileBoundary:null,tiles:null,resolution:null,virtual:!0,prefetchBufferSize:0,_progressiveGlobal:!1,_MAX_TILES:128,_defaultMatrixResolution:20,constructor:function(d){this.tiles=[];this.xformSetting={};this.mapSpatialReference=d&&d.mapSR;this.layer=d&&d.layer;this.identifiers=this.layer.raster.rasterFunction?
this.layer.raster.getMemberRasters().map(function(f){return f._rasterId}):[this.layer.raster._rasterId];(d=d&&d.tileInfo)&&this.setTileInfo(d)},setTileInfo:function(d){this.tileInfo=d;this.virtual=d.virtual;this.mapResolution=null;this.tiles.length=0;this.xformSetting.requireProjection=!this.virtual&&!this.mapSpatialReference.equals(this.tileInfo.spatialReference);this.xformSetting.requirePE=h.requirePE(this.mapSpatialReference,this.tileInfo.spatialReference);this.xformSetting.meshSize=this.xformSetting.requireProjection?
[this._defaultMatrixResolution,this._defaultMatrixResolution]:[1,1];this.halfWorldWidth=h.getHalfWorldWidth(d.spatialReference)},updateResolution:function(d,f){if(!(this.mapResolution&&d&&this._resolutionEqual(this.mapResolution.x,d.x)&&this._resolutionEqual(this.mapResolution.y,d.y))){this.resetTiles();var m=this.xformSetting.requireProjection;this.mapResolution=this.resolution=d;m&&(this.resolution=h.projectResolution(d,this.tileInfo.spatialReference,this.layer.projectedFullExtent||f));this._resolution=
this.resolution;d=this.resolution;if(!this.tileInfo.virtual){m=.75*Math.min(d.x,d.y)+.25*Math.max(d.x,d.y);if(m>=this.tileInfo.lods[0].resolution){var u=this.tileInfo.lods[0];this.ooe=!0}else{if(m<=this.tileInfo.lods[this.tileInfo.lods.length-1].resolution)u=this.tileInfo.lods[this.tileInfo.lods.length-1];else for(d=0;d<this.tileInfo.lods.length-1;d++)if(u=this.tileInfo.lods[d],f=this.tileInfo.lods[d+1],u.resolution>=m&&f.resolution<=m){u.resolution-m>m-f.resolution&&(u=f);break}this.ooe=!1}this.level=
u&&u.level;d=this.resolution=new a({x:u.resolution,y:u.resolution,spatialReference:this.tileInfo.spatialReference})}m=this.layer.raster.rasterInfo.extent;u=this.tileInfo.origin;f=this.tileInfo.cols;var r=this.tileInfo.rows;this.fullBoundary={rowStart:Math.floor((u.y-m.ymax)/d.y/r),rowEnd:Math.floor((u.y-m.ymin-d.y)/d.y/r),colStart:Math.floor((m.xmin-u.x)/d.x/f),colEnd:Math.floor((m.xmax-u.x-d.x)/d.x/f)};if(m=this.halfWorldWidth){r=Math.ceil(m/d.x/(f/2));var t=this.tileInfo.applyGCS360Transform?360:
m,w=Math.round(f-(t-u.x)/d.x%f);w===f&&(w=0);this.fullBoundary.colRange=r;this.fullBoundary.paddingRight=w;this.fullBoundary.paddingLeft=Math.round((r*f*d.x+u.x-t-(this.tileInfo.applyGCS360Transform?0:u.x+m))/d.x)}this.hasNewData=!0}},getXformGrid:function(){var d=this.mapExtent,f=this.layer._hasTilingEffects?this.extent:this.fullExtent,m=this.layer.getCurrentResolution(),u=JSON.stringify(d.toJson())+JSON.stringify(f.toJson());this._datumTransformationInitialized||(this._datumTransformationInitialized=
!0,this._datumTransformation=h.getDefaultDatumTransformationForDataset(this.layer.raster.rasterInfo.extent,d.spatialReference,!0));this._cachedExtentString&&this._cachedExtentString===u||(this._cachedExtentString=u,this._xformGrid=d=h.getProjectionOffsetGrid(d,f,m,this.tileInfo.applyGCS360Transform,this.halfWorldWidth,this._datumTransformation));d=this._xformGrid;this.xformSetting.meshSize=d&&d.size;return d},getWrapTimes:function(d){var f=h.getHalfWorldWidth(d.spatialReference);if(!f)return 0;var m=
2*f;f=this.tileInfo.applyGCS360Transform?0:-f;return Math.floor((d.xmax-f)/m)-Math.floor((d.xmin-f)/m)},normalizeCoordinate:function(d,f){if(!f)return 0;var m=2*f;if(0<d){for(;d>f;)d-=m;return d}for(;d<-f;)d+=m;return d},resetTiles:function(){this.tiles.forEach(e.hitch(this,function(d){d.fetch&&!d.fetch.isCanceled()&&d.fetch.cancel();d.update&&!d.update.isCanceled()&&d.update.cancel()}));this.tiles.length=0},updateExtent:function(d,f){this.mapExtent=this.extent=d;var m=this.xformSetting.requireProjection;
if(m){this.extent=h.project(d,this.tileInfo.spatialReference,this.tileInfo.applyGCS360Transform);if(!this.extent)return;this.extent.spatialReference=new c(this.extent.spatialReference.toJson())}this.updateResolution(f,d);var u=this.extent,r=this.tileInfo,t=r.cols,w=r.rows;f=this.resolution;var v=u;m=m?this.layer.raster.rasterInfo.extent:this.layer.raster.projectedFullExtent;this.ooe&&(v=this._getIntersect(u,m));var y=Math.floor((v.xmin-r.origin.x)/f.x/t)-this.prefetchBufferSize,x=Math.floor((v.xmax-
r.origin.x)/f.x/t)+this.prefetchBufferSize,A=null;d=this.getWrapTimes(d);var C=this.fullBoundary&&this.fullBoundary.colRange;d&&this.halfWorldWidth&&(x===y&&(A=y),x+=d*C);var E=this.halfWorldWidth&&this.tiles.length&&(d!==this.wrapTimes||A!==this._circlularColId);E&&(this._wrapSwitchCount=this._wrapSwitchCount?this._wrapSwitchCount+1:1);this.wrapTimes=d;this._circlularColId=A;var H=Math.floor((r.origin.y-v.ymax)/f.y/w)-this.prefetchBufferSize;A=Math.floor((r.origin.y-v.ymin)/f.y/w)+this.prefetchBufferSize;
this.tileBoundary={rowStart:H,rowEnd:A,colStart:y,colEnd:x};var B,z;((v=(A-H+1)*(x-y+1)>this._MAX_TILES||!this.virtual&&this._resolution.x>8*this.tileInfo.lods[0].resolution)||2<d||E)&&this.resetTiles();if(!(v||2<d)){E=this.tiles;v=!1;for(B=E.length-1;0<=B;B--){var F=E[B].row;var K=E[B].wrapCol;if(F<H||F>A||K<y||K>x)E[B].fetch&&!E[B].fetch.isCanceled()&&E[B].fetch.cancel(),E[B].update&&!E[B].update.isCanceled()&&E[B].update.cancel(),E.splice(B,1),v=!0}for(B=H;B<=A;B++)for(z=y;z<=x;z++){H=new k(r.origin.x+
f.x*t*z,r.origin.y-f.y*w*(B+1),r.origin.x+f.x*t*(z+1),r.origin.y-f.y*w*B,u.spatialReference);var L=d&&C?0<=z?z%C:C- -z%C:z;F=g(E,function(N){return N.row===B&&N.col===L&&N.wrapCol===z});K=m.xmax>=H.xmax?t:Math.round((m.xmax-H.xmin)/f.x);-1===F&&(E.push({row:B,col:L,wrapCol:z,cellsizeX:f.x,cellsizeY:f.y,width:t,height:w,actualWidth:K,extent:H,normalizedExtent:this._wrapExtent(H,L),pixelBlock:null,virtual:this.virtual,level:this.level,tileType:this.tileInfo.tileType||"Raster"}),v=!0)}v&&this._sortTiles();
f=this.tileInfo.rows*(this.tileBoundary.rowEnd-this.tileBoundary.rowStart+1);this.width=this.tileInfo.cols*(this.tileBoundary.colEnd-this.tileBoundary.colStart+1);this.height=f;this.count=E.length;f=Math.min.apply(null,E.map(function(N){return N.extent.xmin}));r=Math.max.apply(null,E.map(function(N){return N.extent.xmax}));t=Math.min.apply(null,E.map(function(N){return N.extent.ymin}));w=Math.max.apply(null,E.map(function(N){return N.extent.ymax}));f=this.fullExtent=new k(f,t,r,w,u.spatialReference);
if(this.layer.roaming||this.layer.useWebGL)this.layer._hasTilingEffects?(this.xformSetting.offset=[0,0],this.xformSetting.scale=[1,1]):(v&&(this._tilesChanged=!0),this.xformSetting.offset=[(u.xmin-f.xmin)/(f.xmax-f.xmin),-(f.ymin-u.ymin)/(f.ymax-f.ymin)],this.xformSetting.scale=[(u.xmax-u.xmin)/(f.xmax-f.xmin),(u.ymax-u.ymin)/(f.ymax-f.ymin)])}},fetchTiles:function(d){(this._tilesChanged||d)&&this._fetchTiles(d)},_fetchTiles:function(d){this._fetchCounter=0;var f=this.extent;this.fetchAllCompleted=
d?new q:null;(this._tilesChanged||d&&this.layer._hasTilingEffects)&&this.tiles.forEach(e.hitch(this,function(u){u.updateCompleted=!1}));var m={};!this.layer.roaming&&this.layer._hasTilingEffects&&d?(this.identifiers.forEach(function(u,r){m[u]={extent:this.extent,pixelBlock:new b({width:this.layer._map.width,height:this.layer._map.height,pixels:[],pixelType:"",mask:null,statistics:[]})}}.bind(this)),this.originalPixelData={extent:this.extent,src:m,isEmpty:!0}):this._tilesChanged&&(this.identifiers.forEach(function(u,
r){m[u]={extent:this.fullExtent,pixelBlock:new b({width:128,height:128,pixels:[],pixelType:"",mask:null,statistics:[]})}}.bind(this)),this.originalPixelData={extent:this.fullExtent,src:m,isEmpty:!0});this.tiles.forEach(e.hitch(this,function(u){if(u.fetch)u.update||(u.update=this.updateTile(u));else{if(this._isTileOutSide(u,f)){u.updateCompleted=!0;return}this._requestTile(u)}this.layer.roaming&&this.layer.useWebGL?this._fillPixelData(u):u.src&&d&&(this.layer._hasTilingEffects||this.layer.useWebGL)&&
(this._fillPixelData(u),this.layer._hasTilingEffects&&(u.updateCompleted=!0),u.processedPixelBlock=null,u.renderedPixelBlock=null)}));0===this._fetchCounter&&(this._fetched=!0);this._tilesChanged=!1;d&&this._updateFetchStatus()},updateTile:function(d,f){var m=new q;if(!d.src&&!d.fetch)return m.resolve(d),m.promise;n(d.src||d._fetched||d.fetch,e.hitch(this,function(){var u=this.layer.tileMode&&this.layer._rasterHandler&&!(this.layer._hasTilingEffects||this.layer.useWebGL),r=this.layer._drawTile,t=
this._validateRawPixelBlocks(d);this.layer._hasTilingEffects&&!this.layer.useWebGL&&(r=r&&(this._progressiveGlobal||f));if((f||!f&&t)&&(u||r||this.layer.roaming)){if(this.xformSetting.requireProjection&&this.layer.useWebGL&&(this.xformSetting.gridConfig=this.getXformGrid(),null==this.xformSetting.gridConfig))return m.cancel(),m.promise;this._processTile(d,f).then(e.hitch(this,function(w){m.isCanceled()||this._renderTile(w,f).then(e.hitch(this,function(v){this.hasNewData=!1;m.isCanceled()||m.resolve(v)}))}))}else f||
t||(d.updateCompleted=!0),this.layer.useWebGL||this.layer._hasTilingEffects?m.resolve(this.originalPixelData):m.resolve()}));return m.promise},setLayer:function(d){this.layer=d},fillupTiles:function(){this.tiles.forEach(e.hitch(this,function(d){d.update&&d.updateCompleted&&!d.filled&&(d.updateCompleted=!1,this._fillPixelData(d),d.updateCompleted=!0)}))},_validateRawPixelBlocks:function(d){return d&&d.src&&!this.identifiers.some(function(f){return!(d.src[f].pixelBlock&&0!==d.src[f].pixelBlock.validPixelCount&&
d.src[f].pixelBlock.pixels&&0<d.src[f].pixelBlock.pixels.length)})},_wrapExtent:function(d,f){if(d){if(this.tileInfo.applyGCS360Transform){var m=this.normalizeCoordinate(d.xmin,180);0>m&&(m+=360);return new k({xmin:m,ymin:d.ymin,xmax:d.xmax-d.xmin+m,ymax:d.ymax,spatialReference:d.spatialReference})}if(this.halfWorldWidth){m=null!=f?new k({xmin:this.tileInfo.origin.x+this.tileInfo.cols*f*this.resolution.x,ymin:d.ymin,xmax:this.tileInfo.origin.x+this.tileInfo.cols*(f+1)*this.resolution.x,ymax:d.ymax,
spatialReference:d.spatialReference}):new k({xmin:d.xmin,ymin:d.ymin,xmax:d.xmax,ymax:d.ymax,spatialReference:d.spatialReference});f=this.normalizeCoordinate(m.xmin,this.halfWorldWidth);var u=f-m.xmin;.01<Math.abs(u)&&(m.xmin=f,m.xmax+=u)}return m||d}},_getIntersect:function(d,f){return new k(Math.max(d.xmin,f.xmin),Math.max(d.ymin,f.ymin),Math.min(d.xmax,f.xmax),Math.min(d.ymax,f.ymax),d.spatialReference)},_isTileOutSide:function(d,f){var m=!1;if(d.virtual){var u=d.normalizedExtent;if(f=f||(this.xformSetting.requireProjection?
this.layer.raster.rasterInfo.extent:this.layer.raster.projectedFullExtent)){d=u.xmin-this.prefetchBufferSize*this.tileInfo.cols*this.resolution.x;m=u.ymin-this.prefetchBufferSize*this.tileInfo.rows*this.resolution.y;var r=u.xmax+this.prefetchBufferSize*this.tileInfo.cols*this.resolution.x;u=u.ymax+this.prefetchBufferSize*this.tileInfo.rows*this.resolution.y;m=r<=f.xmin||d>=f.xmax||u<=f.ymin||m>=f.ymax}else m=!1}else m=0>d.level||d.row<this.fullBoundary.rowStart||d.row>this.fullBoundary.rowEnd||d.col<
this.fullBoundary.colStart||d.col>this.fullBoundary.colEnd;return m},_resolutionEqual:function(d,f){return d===f||d&&f&&Math.abs(d-f)<Math.abs(f/1E4)?!0:!1},_requestTile:function(d){var f=this.identifiers,m;if(this._isTileOutSide(d)){var u=new q;d.updateCompleted=!0;u.resolve(null);u=u.promise}else u=this.layer.raster.rasterFunction?new p(this.layer.raster.getMemberRasters().map(function(r){return r.read(d)})):new p([this.layer.raster.read(d)]);d.fetch=u;this._fetchCounter++;n(d.src||d._fetched||
u,e.hitch(this,function(r){if(m=r&&r.some(function(w){return w[0]})){var t={};r.forEach(function(w,v){t[f[v]]=w[0]&&w[1]?{extent:w[1].extent,pixelBlock:w[1].pixelBlock,width:w[1].width,height:w[1].height}:null});d.src=t}else d.src=null;this._fetchCounter--;0===this._fetchCounter&&(this._fetched=!0);d._fetched=!0;this._updateFetchStatus()}),e.hitch(this,function(){this._fetchCounter--;0===this._fetchCounter&&(this._fetched=!0);d._fetched=!0;this._updateFetchStatus()}));d.update=this.updateTile(d)},
_updateFetchStatus:function(){this.layer._drawTile&&this.fetchAllCompleted&&!this.fetchAllCompleted.isResolved()&&!this.tiles.some(function(d){return!d._fetched})&&(this.tiles.forEach(e.hitch(this,function(d){this._fillPixelData(d)})),this.fetchAllCompleted.resolve())},_fillPixelData:function(d,f){if(d&&!d.updateCompleted)if(Math.abs(d.cellsizeX-this.resolution.x)>d.cellsizeX/10)d.updateCompleted=!0;else if(!1===this._validateRawPixelBlocks(d))d.updateCompleted=!0;else{var m=d.extent;if(this.layer.roaming||
this.layer.useWebGL&&!this.layer._hasTilingEffects){var u=this.fullExtent;var r=this.tileInfo.cols*(this.tileBoundary.colEnd-this.tileBoundary.colStart+1);var t=this.tileInfo.rows*(this.tileBoundary.rowEnd-this.tileBoundary.rowStart+1);f?this.originalPixelData.renderedPixelBlock||(this.originalPixelData.renderedPixelBlock=new b({width:r,height:t,pixels:[],pixelType:"",mask:null,statistics:[]})):this.identifiers.forEach(e.hitch(this,function(v){this.originalPixelData.src[v].pixelBlock.width=r;this.originalPixelData.src[v].pixelBlock.height=
t}))}else u=this.extent,r=this.layer._map.width,t=this.layer._map.height,f?this.originalPixelData.renderedPixelBlock||(this.originalPixelData.renderedPixelBlock=new b({width:r,height:t,pixels:[],pixelType:"",mask:null,statistics:[]})):this.identifiers.forEach(e.hitch(this,function(v){this.originalPixelData.src[v].pixelBlock.width=r;this.originalPixelData.src[v].pixelBlock.height=t}));if(u.xmax<=m.xmin||u.xmin>=m.xmax||u.ymax<=m.ymin||u.ymin>=m.ymax)return null;var w=this.originalPixelData.isEmpty=
!1;this.identifiers.forEach(e.hitch(this,function(v){d.src&&(this._fillPixelBlock(d.src[v],this.originalPixelData.src[v],{extent:u,width:r,height:t,normalizedExtent:d.normalizedExtent},!1),w=!0)}));d.filled=w;this.hasNewData=!0}},_fillPixelBlock:function(d,f,m,u){var r=d.extent,t=m.extent;u=m.width;var w=m.height;if(d.pixelBlock&&d.pixelBlock.pixels&&d.pixelBlock.pixels[0]){var v=(r.xmax-r.xmin)/d.width,y=Math.max(r.xmin,t.xmin),x=Math.min(r.ymax,t.ymax),A=Math.round((y-r.xmin)/v),C=d.width-Math.round(Math.abs(r.xmax-
Math.min(r.xmax,t.xmax))/v),E=Math.round(Math.abs(r.ymax-x)/v),H=d.height-Math.round((Math.max(r.ymin,t.ymin)-r.ymin)/v),B=this.halfWorldWidth;y=Math.round((y-t.xmin)/v);m=m.normalizedExtent;if(!(this.wrapTimes&&B&&r.xmin<-B)){if(this.wrapTimes&&B){if(this.tileInfo.applyGCS360Transform)360<r.xmin&&(y-=this.fullBoundary.paddingLeft);else if(r.xmin>B){y-=this.fullBoundary.paddingLeft;var z=this.normalizeCoordinate(r.xmin,B);var F=this.normalizeCoordinate(r.xmax,B)}else z=r.xmin,F=r.xmax;this.tileInfo.applyGCS360Transform?
m&&360>m.xmin&&360<m.xmax&&(C-=this.fullBoundary.paddingRight):m&&m.xmin<B&&m.xmax>B?C-=this.fullBoundary.paddingRight:z<B&&F>B&&(C-=this.fullBoundary.paddingRight)}z=Math.round(Math.abs(t.ymax-x)/v);F=d.pixelBlock.pixels.length;f=f.pixelBlock;m=d.width;r=f.mask||new Uint8Array(u*w);var K=d.pixelBlock,L=K.mask,N=0;for(v=0;v<F;v++){x=K.pixels[v];B=f.pixels[v]||new x.constructor(u*w);for(d=E;d<H;d++)for(N=(z+d-E)*u+y,t=A;t<C;t++)B[N+t-A]=x[d*m+t];f.pixels[v]=B}if(L)for(d=E;d<H;d++)for(N=(z+d-E)*u+y,
t=A;t<C;t++)r[N+t-A]=L[d*m+t];else for(d=E;d<H;d++)for(N=(z+d-E)*u+y,t=A;t<C;t++)r[N+t-A]=1;f.pixelType=f.pixelType||K.pixelType;f.mask=r;if(!(f.statistics&&0<f.statistics.length))for(f.statistics=[],d=0;d<K.statistics.length;d++)f.statistics[d]={minValue:K.statistics[d].minValue,maxValue:K.statistics[d].maxValue};else if(K.statistics&&f.statistics)for(d=0;d<f.statistics.length;d++)f.statistics[d].minValue=Math.min(K.statistics[d].minValue,f.statistics[d].minValue),f.statistics[d].maxValue=Math.max(K.statistics[d].maxValue,
f.statistics[d].maxValue)}}},_processTile:function(d,f){var m=new q,u=this.layer._hasTilingEffects,r=this.layer.useWebGL,t=u||r,w=this.layer.raster.rasterFunction&&d&&(u||r||!d.processedPixelBlock);if(f)var v=d;else this._fillPixelData(d),v=t?this.originalPixelData:d;this.xformSetting.hasNewTexture=this.hasNewData;var y;w?(this.identifiers.forEach(function(x){if(0===v.src[x].pixelBlock.pixels.length||0===v.src[x].pixelBlock.pixels[0].length)y=!0}),y?m.resolve({extent:v.extent,processedPixelBlock:v.src[this.identifiers[0]],
pixelBlock:v.src[this.identifiers[0]]}):r?(this.processedPixelData=this.layer.raster.rasterFunction.read(v),m.resolve(this.processedPixelData)):this.layer._rasterHandler?this.layer._rasterHandler.process({extent:v.extent,src:v.src}).then(function(x){u?(this.processedPixelData=x,m.resolve(this.processedPixelData)):(d.processedPixelBlock=x.pixelBlock,m.resolve(d))}):(f=this.layer.raster.rasterFunction.read(d),d.processedPixelBlock=f.pixelBlock,m.resolve(d))):t?m.resolve(v.src[this.identifiers[0]]):
(d.pixelBlock=v.src[this.identifiers[0]]&&v.src[this.identifiers[0]].pixelBlock,m.resolve(d));return m.promise},_renderTile:function(d){var f=new q,m=this.layer._hasTilingEffects,u=this.layer.useWebGL,r=Math.abs((d.extent.xmax-d.extent.xmin)/d.width-this.layer.getCurrentResolution().x)>this.resolution.x/10;r=this.layer.useWebGL&&(r||this._isTileOutSide(d,this.layer._map.extent));this.xformSetting.hasNewTexture=this.hasNewData;this.layer._rasterRenderer&&d&&(d.texture||d.src||d.pixelBlock||d.processedPixelBlock)?
(this.layer._rasterRenderer.interpolation=this.layer.interpolation,u&&!r?(this.layer.raster.rasterFunction&&this.layer.raster.rasterFunction.renderTexture||this.layer._rasterRenderer.draw(d),f.resolve(d)):this.layer._rasterHandler?this.layer._rasterHandler.render({extent:d.extent,pixelBlock:d.processedPixelBlock||d.pixelBlock}).then(function(t){m?(t.renderedPixelBlock=t.pixelBlock,f.resolve(t)):(d.renderedPixelBlock=t.pixelBlock,f.resolve(d))}.bind(this)):(d.renderedPixelBlock=this.layer._rasterRenderer.draw(d).pixelBlock,
f.resolve(d))):(d.renderedPixelBlock=d.processedPixelBlock||d.pixelBlock,f.resolve(d));return f.promise},_sortTiles:function(){this.tiles.sort(function(d,f){return d.row<f.row||d.row==f.row&&d.col<f.col?-1:1})}})})},"esri/virtualearth/VETiledLayer":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/json dojo/_base/array dojo/_base/config dojo/has dojo/string dojo/_base/Deferred ../kernel ../urlUtils ../SpatialReference ../layers/TileInfo ../layers/TiledMapServiceLayer ../geometry/Extent ../request".split(" "),
function(G,e,q,n,p,k,c,a,b,l,h,g,d,f,m){G=G(d,{declaredClass:"esri.virtualearth.VETiledLayer",constructor:function(u){try{if(u=e.mixin({bingMapsKey:null,culture:"en-US"},u||{}),this.url=l.getProtocolForWebResource()+"//dev.virtualearth.net/REST/v1",this._url=l.urlToObject(this.url),this.spatialReference=new h({wkid:102100}),this.tileInfo=new g({rows:256,cols:256,dpi:96,origin:{x:-2.0037508342787E7,y:2.0037508342787E7},spatialReference:{wkid:102100},lods:[{level:1,resolution:78271.5169639999,scale:2.95828763795777E8},
{level:2,resolution:39135.7584820001,scale:1.47914381897889E8},{level:3,resolution:19567.8792409999,scale:7.3957190948944E7},{level:4,resolution:9783.93962049996,scale:3.6978595474472E7},{level:5,resolution:4891.96981024998,scale:1.8489297737236E7},{level:6,resolution:2445.98490512499,scale:9244648.868618},{level:7,resolution:1222.99245256249,scale:4622324.434309},{level:8,resolution:611.49622628138,scale:2311162.217155},{level:9,resolution:305.748113140558,scale:1155581.108577},{level:10,resolution:152.874056570411,
scale:577790.554289},{level:11,resolution:76.4370282850732,scale:288895.277144},{level:12,resolution:38.2185141425366,scale:144447.638572},{level:13,resolution:19.1092570712683,scale:72223.819286},{level:14,resolution:9.55462853563415,scale:36111.909643},{level:15,resolution:4.77731426794937,scale:18055.954822},{level:16,resolution:2.38865713397468,scale:9027.977411},{level:17,resolution:1.19432856685505,scale:4513.988705},{level:18,resolution:.597164283559817,scale:2256.994353},{level:19,resolution:.298582141647617,
scale:1128.497176},{level:20,resolution:.1492910708238085,scale:564.248588}]}),this.initialExtent=this.fullExtent=new f(-2.0037508342787E7,-2.003750834278E7,2.003750834278E7,2.0037508342787E7,new h({wkid:102100})),e.mixin(this,u),this.hasAttributionData=this.showAttribution,this._initLayer=e.hitch(this,this._initLayer),this._errorHandler=e.hitch(this,this._errorHandler),this._getTileInfo=e.hitch(this,this._getTileInfo),this.bingMapsKey)this._getTileInfo();else throw Error("BingMapsKey must be provided.");
}catch(r){throw this.onError(r),r;}},_unsetMap:function(u,r){this.inherited("_unsetMap",arguments)},_getTileInfo:function(){if(this.mapStyle){var u=this._url.path+"/Imagery/Metadata/"+this.mapStyle,r=window.location.protocol;if(this.bingMapsKey){var t=this.resourceInfo;!this.loaded&&t?this._initLayer(t):m({url:u,content:e.mixin({},{uriScheme:"https:"===r?"https":"http",key:this.bingMapsKey,ss:!0,c:this.culture,include:this.hasAttributionData?"imageryProviders":null}),callbackParamName:"jsonp",load:this._initLayer,
error:this._errorHandler})}}},_initLayer:function(u,r){if(200!==u.statusCode)r=Error(),r.code=u.statusCode,r.message=u.statusDescription,r.details=u.errorDetails,r.authenticationResultCode=u.authenticationResultCode,this.onError(r);else try{this.resourceInfo=q.toJson(u);var t=u.resourceSets[0].resources[0],w=t.imageUrl.replace("{","${");this.tileServers=n.map(t.imageUrlSubdomains,function(y){var x=l.getProtocolForWebResource();return c.substitute(w,{subdomain:y}).replace("http:",x)});this._tsLength=
this.tileServers.length;if(this.loaded)this.refresh(),this.onMapStyleChange();else{this.copyright=this.copyright||"\x26copy; 2017 Microsoft Corporation and its data suppliers";this.loaded=!0;this.onLoad(this);var v=this.loadCallback;v&&(delete this.loadCallback,v(this))}}catch(y){this.onError(y)}},getAttributionData:function(){var u=new a,r=q.fromJson(this.resourceInfo),t;this.hasAttributionData&&r&&(t=e.getObject("resourceSets.0.resources.0.imageryProviders",!1,r));t?u.callback({contributors:t}):
(r=Error("Layer does not have attribution data"),r.log=p.isDebug,u.errback(r));return u},getTileUrl:function(u,r,t){return c.substitute(this.tileServers[r%this._tsLength].replace(/\{/g,"${"),{quadkey:this._getQuadKey(u,r,t),culture:this.culture,token:this.bingMapsKey})},_getQuadKey:function(u,r,t){var w="",v;for(v=u;0<v;v--){u="0";var y=1<<v-1;0!=(t&y)&&u++;0!=(r&y)&&(u++,u++);w+=u}return w},setMapStyle:function(u){this.mapStyle=u;this._getTileInfo()},setCulture:function(u){this.culture=u;this._getTileInfo()},
setBingMapsKey:function(u){this.bingMapsKey=u},onMapStyleChange:function(){}});e.mixin(G,{MAP_STYLE_AERIAL:"aerial",MAP_STYLE_AERIAL_WITH_LABELS:"aerialWithLabelsOnDemand",MAP_STYLE_ROAD:"roadOnDemand"});k("extend-esri")&&e.setObject("virtualearth.VETiledLayer",G,b);return G})},"widgets/OverviewMap/utils":function(){define("dojo/_base/lang dojo/_base/array dojo/string dojo/Deferred esri/lang esri/request dojo/_base/url esri/layers/TileInfo jimu/portalUtils esri/layers/ArcGISTiledMapServiceLayer esri/layers/ArcGISDynamicMapServiceLayer esri/layers/ArcGISImageServiceLayer esri/virtualearth/VETiledLayer esri/layers/OpenStreetMapLayer esri/layers/ImageParameters".split(" "),
function(G,e,q,n,p,k,c,a,b,l,h,g,d,f,m){var u={TYPE:{BASE_MAP:"baseMap",ARCGIS_TILED_MAP:"tiledMapService",ARCGIS_DYNAMIC_MAP_SERVICE:"dynamicMapService",ARCGIS_IMAGE_SERVICE:"imageService",OSM:"openStreetMap",BING_ROAD:"bingMapsRoad",BING_AERIAL:"bingMapsAerial",BING_HYBRID:"bingMapsHybrid"},createBaseLayer:function(r,t,w){var v=new n,y=null,x=r.url,A=r.type;r=r.veLayerInfo;A===u.TYPE.BASE_MAP?v.resolve({layer:"BaseMap"}):A===u.TYPE.ARCGIS_TILED_MAP?u.valid.isArcGISLayersValid(x,t,A).then(function(C){C&&
!0===C.res?(y=new l(x),v.resolve({layer:y})):v.resolve({layer:null,err:C.err})},function(C){v.resolve({res:!1,err:C})}):A===u.TYPE.ARCGIS_DYNAMIC_MAP_SERVICE?u.valid.isArcGISLayersValid(x,t,A).then(function(C){if(C&&!0===C.res){C=C.info;var E={};C&&C.supportedImageFormatTypes&&-1!==C.supportedImageFormatTypes.indexOf("PNG24")&&(E.imageParameters=new m,E.imageParameters.format="png24");y=new h(x,E);v.resolve({layer:y})}else v.resolve({layer:null,err:C.err})},function(C){v.resolve({res:!1,err:C})}):
A===u.TYPE.ARCGIS_IMAGE_SERVICE?u.valid.isArcGISLayersValid(x,t,A).then(function(C){C&&!0===C.res?(y=new g(x,{}),v.resolve({layer:y})):v.resolve({layer:null,err:C.err})},function(C){v.resolve({res:!1,err:C})}):A===u.TYPE.OSM?(y=new f(x,{}),v.resolve({layer:y})):A!==u.TYPE.BING_ROAD&&A!==u.TYPE.BING_AERIAL&&A!==u.TYPE.BING_HYBRID||!r?v.resolve({layer:null}):(t=u.layers.getBingMapKey(w),t&&r.isKeyInPortal||(t="__invalidKey",console.error("OverviewMap Error: BingMapsKey must be provided")),y=new d({bingMapsKey:t,
mapStyle:u.layers._getVEStyle(A)}),v.resolve({layer:y}));return v},layers:{_getLayerInfoSR:function(r){return r.spatialReference||r.extent&&r.extent.spatialReference},_getTileServers:function(r){var t=[],w=new c(r.url);if(r.subDomains&&0<r.subDomains.length&&1<w.authority.split(".").length){var v;e.forEach(r.subDomains,function(y){-1<w.authority.indexOf("${subDomain}")?v=w.scheme+"://"+q.substitute(w.authority,{subDomain:y})+"/":-1<w.authority.indexOf("{subDomain}")&&(v=w.scheme+"://"+w.authority.replace(/\{subDomain\}/gi,
y)+"/");t.push(v)},this)}return t&&0<t.length?t:null},_getVEStyle:function(r){switch(r){case u.TYPE.BING_AERIAL:return d.MAP_STYLE_AERIAL;case u.TYPE.BING_HYBRID:return d.MAP_STYLE_AERIAL_WITH_LABELS;case u.TYPE.BING_ROAD:return d.MAP_STYLE_ROAD;default:return d.MAP_STYLE_AERIAL}},fetchLayerInfo:function(r){var t=new n;k({url:r,handleAs:"json",callbackParamName:"callback",timeout:15E3,content:{f:"json"}}).then(G.hitch(this,function(w){t.resolve(w)}),function(w){t.reject(w)});return t},getBingMapKey:function(r){return(r=
window.portalSelf||r&&b.getPortal(r.appConfig.portalUrl))&&r.bingKey?r.bingKey:""}},valid:{baseLayerVerification:function(r,t){var w=new n,v=t.spatialReference;u.createBaseLayer(r,t).then(function(y){if(y.layer){var x=u.layers._getLayerInfoSR(y.layer);u.valid.sameSpatialReference(v,x)||"BaseMap"===y.layer?w.resolve({res:!0}):w.resolve({res:!1})}else w.resolve({res:!1,err:y.err})},function(y){w.resolve({res:!1,err:y})});return w},ArcGISLayersTypeVerification:function(r,t,w){r=r.toLowerCase();if(0<
r.indexOf("/featureserver")||0<r.indexOf("/mapserver"))if(!t||"string"!==typeof t.type||"Feature Layer"!==t.type&&"Table"!==t.type){if(0<r.indexOf("/featureserver"))return!1;if(0<r.indexOf("/mapserver"))return t.tileInfo?w===u.TYPE.ARCGIS_TILED_MAP||w===u.TYPE.ARCGIS_DYNAMIC_MAP_SERVICE?!0:!1:w===u.TYPE.ARCGIS_DYNAMIC_MAP_SERVICE?!0:!1}else return!1;else if(0<r.indexOf("/imageserver"))return w===u.TYPE.ARCGIS_IMAGE_SERVICE?!0:!1},isArcGISLayersValid:function(r,t,w){var v=new n;u.layers.fetchLayerInfo(r).then(function(y){var x=
null,A=null;x=u.layers._getLayerInfoSR(y);A=t&&t.spatialReference;x&&A&&u.valid.sameSpatialReference(A,x)?!0===u.valid.ArcGISLayersTypeVerification(r,y,w)?v.resolve({res:!0,info:y}):v.resolve({res:!1,err:"layerType"}):x&&A&&!u.valid.sameSpatialReference(A,x)?v.resolve({res:!1,err:"wkid"}):v.resolve({res:!1})},function(y){v.resolve({res:!1,err:y})});return v},tileInfoStr:function(r){try{return new a(JSON.parse(r)),!0}catch(t){return t}},isHaveBingKey:function(){return u.layers.getBingMapKey()?!0:!1},
sameSpatialReference:function(r,t){var w=[102113,102100,3857,4326];return r&&t&&p.isDefined(r.wkid)&&p.isDefined(t.wkid)&&-1!==w.indexOf(r.wkid)&&-1!==w.indexOf(t.wkid)||r&&t&&(p.isDefined(r.wkid)&&p.isDefined(t.wkid)&&r.wkid===t.wkid||p.isDefined(r.latestWkid)&&p.isDefined(t.wkid)&&r.latestWkid===t.wkid||p.isDefined(r.wkid)&&p.isDefined(t.latestWkid)&&r.wkid===t.latestWkid||p.isDefined(r.latestWkid)&&p.isDefined(t.latestWkid)&&r.latestWkid===t.latestWkid)||r&&t&&p.isDefined(r.wkt)&&p.isDefined(t.wkt)&&
r.wkt===t.wkt?!0:!1}}};return u})},"widgets/OverviewMap/a11y/Widget":function(){define("dojo/_base/lang dojo/on dojo/_base/html jimu/utils dojo/aspect dojo/keys".split(" "),function(G,e,q,n,p,k){return{a11y_init:function(){q.setAttr(this.overviewMapDijit._maximizerDiv,"tabindex",0);"LaunchpadTheme"===window.getAppConfig().theme.name&&(this._a11y_isLaunchpadTheme=!0);this._a11y_isLaunchpadTheme?(this._a11y_index||(this._a11y_index=q.getAttr(this.domNode,"tabindex"),q.removeAttr(this.domNode,"tabindex")),
this._a11y_index&&q.setAttr(this.overviewMapDijit._controllerDiv,"tabindex",parseInt(this._a11y_index,10)),n.initFirstFocusNode(this.domNode,this.overviewMapDijit._maximizerDiv)):(q.setAttr(this.overviewMapDijit._controllerDiv,"tabindex",0),n.initFirstFocusNode(this.domNode,this.overviewMapDijit._controllerDiv));n.initLastFocusNode(this.domNode,this.overviewMapDijit._maximizerDiv)},a11y_initEvents:function(){this._a11y_RAW_DOM_NODE_HEIGHT=q.getStyle(this.domNode,"height");this._closedBy508Controller=
this._openedBy508Enter=!1;this._initToShow=!!this.config.overviewMap.visible;this.own(e(this.domNode,"keydown",G.hitch(this,function(c){var a=c.target;!1===this._initToShow&&c.keyCode===k.ENTER&&q.hasClass(a,this.baseClass)&&(this._openedBy508Enter=!0);!0===this._a11y_isLaunchpadTheme||c.keyCode!==k.TAB||q.hasClass(a,this.baseClass)||(c.preventDefault(),q.hasClass(a,"ovwController")?this.overviewMapDijit._maximizerDiv.focus():q.hasClass(a,"ovwMaximizer")&&this.overviewMapDijit._controllerDiv.focus())})));
this.own(e(this.domNode,"focus",G.hitch(this,function(){!0===this._closedBy508Controller||this._a11y_isLaunchpadTheme||!1===this._initToShow&&n.isInNavMode()&&!this._openedBy508Enter&&10>=q.getStyle(this.domNode,"height")&&this.overviewMapDijit.show()})));this.own(e(this.domNode,"blur",G.hitch(this,function(){!1===this._initToShow&&n.isInNavMode()&&!this._openedBy508Enter&&!0!==this._a11y_isLaunchpadTheme&&setTimeout(G.hitch(this,function(){q.isDescendant(document.activeElement,this.domNode)||this.overviewMapDijit.hide()}),
10)})));this.own(e(this.overviewMapDijit._controllerDiv,"keydown",G.hitch(this,function(c){c.keyCode===k.ENTER&&(this.overviewMapDijit.visible?(this.overviewMapDijit.hide(),this._openedBy508Enter=!1,this._closedBy508Controller=!0,!0!==this._a11y_isLaunchpadTheme?this.domNode.focus():this.overviewMapDijit._controllerDiv.focus()):(this.overviewMapDijit.show(),!1===this._initToShow&&(this._openedBy508Enter=!0,this._closedBy508Controller=!1),!0===this._a11y_isLaunchpadTheme&&this.overviewMapDijit._maximizerDiv.focus()))})));
this.own(e(this.overviewMapDijit._maximizerDiv,"keydown",G.hitch(this,function(c){c.keyCode===k.ENTER&&this.overviewMapDijit._maximizeHandler();!0===this._a11y_isLaunchpadTheme&&this.overviewMapDijit.visible&&c.keyCode===k.ESCAPE&&(this.overviewMapDijit.hide(),this.overviewMapDijit._controllerDiv.focus())})))},a11y_forLaunchpadThemeStyle:function(){this.own(p.after(this.overviewMapDijit,"_maximizeHandler",G.hitch(this,function(){var c=this.overviewMapDijit.overviewMap.container.parentElement||this.overviewMapDijit.overviewMap.container.parentNode,
a=c.parentElement||c.parentNode;this.overviewMapDijit._maximized?(q.addClass(c,"a11y_maximized"),q.addClass(a,"a11y_maximized")):(q.removeClass(c,"a11y_maximized"),q.removeClass(a,"a11y_maximized"))}),this))}}})},"widgets/OverviewMap/_build-generate_module":function(){define(["dojo/i18n!./nls/strings"],function(){})},"url:esri/dijit/templates/OverviewMap.html":'\x3cdiv class\x3d"esriOverviewMap"\x3e\r\n  \x3cdiv class\x3d"ovwContainer" dojoattachpoint\x3d"_body" style\x3d"width: ${width}px; height: ${height}px;"\x3e\r\n    \x3cdiv id\x3d"${id}-map" style\x3d"width: 100%; height: 100%;"\x3e\r\n      \x3cdiv class\x3d"ovwHighlight" dojoattachpoint\x3d"_focusDiv" title\x3d"${NLS_drag}" style\x3d"border: 1px solid ${color}; background-color: ${color};"\x3e\x3c/div\x3e\r\n    \x3c/div\x3e\r\n  \x3c/div\x3e\r\n  \x3cdiv class\x3d"ovwButton ovwController" title\x3d"${NLS_show}" dojoattachpoint\x3d"_controllerDiv" dojoattachevent\x3d"onclick: _visibilityHandler"\x3e\r\n  \x3c/div\x3e\r\n  \x3cdiv class\x3d"ovwButton ovwMaximizer" title\x3d"${NLS_maximize}" dojoattachpoint\x3d"_maximizerDiv" dojoattachevent\x3d"onclick: _maximizeHandler"\x3e\r\n  \x3c/div\x3e\r\n\x3c/div\x3e\r\n',
"*now":function(G){G(['dojo/i18n!*preload*widgets/OverviewMap/nls/Widget*["ar","bs","ca","cs","da","de","en","el","es","et","fi","fr","he","hr","hu","id","it","ja","ko","lt","lv","nb","nl","pl","pt-br","pt-pt","ro","ru","sk","sl","sr","sv","th","tr","zh-cn","uk","vi","zh-hk","zh-tw","ROOT"]'])},"*noref":1}});
define("dojo/_base/declare dojo/_base/lang dojo/_base/html dojo/_base/array dojo/on dojo/Deferred dojo/aspect jimu/BaseWidget esri/dijit/OverviewMap jimu/utils ./utils dojo/dom-style ./a11y/Widget".split(" "),function(G,e,q,n,p,k,c,a,b,l,h,g,d){G=G([a],{baseClass:"jimu-widget-overview",overviewMapDijit:null,_showDijit:!1,_handles:null,startup:function(){this._handles=[];this.inherited(arguments);this.createOverviewMap();this.map&&this.own(p(this.map,"layer-add",e.hitch(this,this._onMainMapBasemapChange)))},
setPosition:function(f){this.position=f;q.place(this.domNode,this.map.id);this._processAttachTo(this.config,f);this.started&&this._updateDomPosition(this.config.overviewMap.attachTo)},_processAttachTo:function(f,m){"undefined"===typeof f.overviewMap&&(f.overviewMap={});"undefined"===typeof f.overviewMap.attachTo&&m&&(void 0!==m.top&&void 0!==m.left?f.overviewMap.attachTo=window.isRTL?"top-right":"top-left":void 0!==m.top&&void 0!==m.right?f.overviewMap.attachTo=window.isRTL?"top-left":"top-right":
void 0!==m.bottom&&void 0!==m.left?f.overviewMap.attachTo=window.isRTL?"bottom-right":"bottom-left":void 0!==m.bottom&&void 0!==m.right&&(f.overviewMap.attachTo=window.isRTL?"bottom-left":"bottom-right"))},_updateDomPosition:function(f){if(this.overviewMapDijit){var m={left:"auto",right:"auto",top:"auto",bottom:"auto",width:"auto",zIndex:this.position&&this.position.zIndex||0},u=this._getOverviewPositionByAttach(f);e.mixin(m,u);m=l.getPositionStyle(m);m.position="absolute";g.set(this.domNode,m);g.set(this.overviewMapDijit.domNode,
m);if(this.overviewMapDijit.domNode){q.removeClass(this.overviewMapDijit.domNode,["ovwTL","ovwTR","ovwBL","ovwBR"]);m="";switch(f){case "top-left":m="ovwTL";break;case "top-right":m="ovwTR";break;case "bottom-left":m="ovwBL";break;case "bottom-right":m="ovwBR";break;default:m="ovwTL"}q.addClass(this.overviewMapDijit.domNode,m);q.addClass(this.domNode,m)}}},createOverviewMap:function(f){var m=e.clone(this.config.overviewMap);m.map=this.map;void 0!==f&&(m.visible=f);var u=m.visible;m.visible=!1;m.maximizeButton=
"maximizeButton"in m?m.maximizeButton:!0;m.width=200;m.height=200;m.expandFactor=2;m.attachTo=this.config.overviewMap.attachTo;this._getBaseLayerMap().then(e.hitch(this,function(r){r&&r.layer&&"string"!==typeof r.layer?m.baseLayer=r.layer:m.baseLayer&&delete m.baseLayer;this.overviewMapDijit=new b(m);this._handles.push(c.after(this.overviewMapDijit,"show",e.hitch(this,"_afterOverviewShow")));this._handles.push(c.after(this.overviewMapDijit,"hide",e.hitch(this,"_afterOverviewHide")));this.overviewMapDijit.startup();
this._updateDomPosition(m.attachTo);this.domNode.appendChild(this.overviewMapDijit.domNode);this.a11y_init();this.a11y_initEvents();this.a11y_forLaunchpadThemeStyle();u&&this.overviewMapDijit.show()}))},_getOverviewPositionByAttach:function(f){var m={};"top-left"===f?(m.left=0,m.top=0):"top-right"===f?(m.right=0,m.top=0):"bottom-left"===f?(m.bottom=0,m.left=0):"bottom-right"===f&&(m.bottom=0,m.right=0);window.isRTL&&(isFinite(m.left)?(m.right=m.left,delete m.left):(m.left=m.right,delete m.right));
return m},_onMainMapBasemapChange:function(f){f.layer&&f.layer._basemapGalleryLayerType&&(this._destroyOverviewMap(),this.createOverviewMap(this._showDijit))},onPositionChange:function(f){this.position=f;this.config.overviewMap.attachTo||(this._destroyOverviewMap(),this.createOverviewMap(this._showDijit))},_destroyOverviewMap:function(){n.forEach(this._handles,function(f){f&&"function"===typeof f.remove&&f.remove()});this.overviewMapDijit&&this.overviewMapDijit.destroy&&(this.overviewMapDijit.destroy(),
this.overviewMapDijit=null,q.empty(this.domNode))},onReceiveData:function(f){"BasemapGallery"===f&&(this._destroyOverviewMap(),this.createOverviewMap(this._showDijit))},onOpen:function(){this._destroyOverviewMap();this.createOverviewMap(this._showDijit)},onClose:function(){this._destroyOverviewMap()},_afterOverviewHide:function(){this._showDijit=!1;g.set(this.domNode,{width:"auto",height:"auto"})},_afterOverviewShow:function(){this._showDijit=!0;g.set(this.domNode,{width:this.overviewMapDijit.width+
"px",height:this.overviewMapDijit.height+"px"})},_getBaseLayerMap:function(){var f=new k;this.config.overviewMap&&this.config.overviewMap.baseLayer?h.createBaseLayer(this.config.overviewMap.baseLayer,this.map,this).then(function(m){f.resolve(m)}):f.resolve(null);return f}});G.extend(d);return G});