// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://js.arcgis.com/3.23/esri/copyright.txt for details.
//>>built
require({cache:{"dojo/DeferredList":function(){define(["./_base/kernel","./_base/Deferred","./_base/array"],function(l,n,g){l.DeferredList=function(f,a,c,d,b){var e=[];n.call(this);var h=this;0!==f.length||a||this.resolve([0,[]]);var t=0;g.forEach(f,function(b,k){function p(a,b){e[k]=[a,b];t++;t===f.length&&h.resolve(e)}b.then(function(b){a?h.resolve([k,b]):p(!0,b)},function(a){c?h.reject(a):p(!1,a);if(d)return null;throw a;})})};l.DeferredList.prototype=new n;l.DeferredList.prototype.gatherResults=
function(f){f=new l.DeferredList(f,!1,!0,!1);f.addCallback(function(a){var c=[];g.forEach(a,function(a){c.push(a[1])});return c});return f};return l.DeferredList})},"dijit/_Widget":function(){define("dojo/aspect dojo/_base/config dojo/_base/connect dojo/_base/declare dojo/has dojo/_base/kernel dojo/_base/lang dojo/query dojo/ready ./registry ./_WidgetBase ./_OnDijitClickMixin ./_FocusMixin dojo/uacss ./hccss".split(" "),function(l,n,g,f,a,c,d,b,e,h,t,q,k){function p(){}function m(a){return function(b,
c,e,f){return b&&"string"==typeof c&&b[c]==p?b.on(c.substring(2).toLowerCase(),d.hitch(e,f)):a.apply(g,arguments)}}l.around(g,"connect",m);c.connect&&l.around(c,"connect",m);l=f("dijit._Widget",[t,q,k],{onClick:p,onDblClick:p,onKeyDown:p,onKeyPress:p,onKeyUp:p,onMouseDown:p,onMouseMove:p,onMouseOut:p,onMouseOver:p,onMouseLeave:p,onMouseEnter:p,onMouseUp:p,constructor:function(a){this._toConnect={};for(var b in a)this[b]===p&&(this._toConnect[b.replace(/^on/,"").toLowerCase()]=a[b],delete a[b])},postCreate:function(){this.inherited(arguments);
for(var a in this._toConnect)this.on(a,this._toConnect[a]);delete this._toConnect},on:function(a,b){return this[this._onMap(a)]===p?g.connect(this.domNode,a.toLowerCase(),this,b):this.inherited(arguments)},_setFocusedAttr:function(a){this._focused=a;this._set("focused",a)},setAttribute:function(a,b){c.deprecated(this.declaredClass+"::setAttribute(attr, value) is deprecated. Use set() instead.","","2.0");this.set(a,b)},attr:function(a,b){return 2<=arguments.length||"object"===typeof a?this.set.apply(this,
arguments):this.get(a)},getDescendants:function(){c.deprecated(this.declaredClass+"::getDescendants() is deprecated. Use getChildren() instead.","","2.0");return this.containerNode?b("[widgetId]",this.containerNode).map(h.byNode):[]},_onShow:function(){this.onShow()},onShow:function(){},onHide:function(){},onClose:function(){return!0}});a("dijit-legacy-requires")&&e(0,function(){require(["dijit/_base"])});return l})},"dijit/_WidgetBase":function(){define("require dojo/_base/array dojo/aspect dojo/_base/config dojo/_base/connect dojo/_base/declare dojo/dom dojo/dom-attr dojo/dom-class dojo/dom-construct dojo/dom-geometry dojo/dom-style dojo/has dojo/_base/kernel dojo/_base/lang dojo/on dojo/ready dojo/Stateful dojo/topic dojo/_base/window ./Destroyable dojo/has!dojo-bidi?./_BidiMixin ./registry".split(" "),
function(l,n,g,f,a,c,d,b,e,h,t,q,k,p,m,r,w,E,x,C,B,y,A){function G(a){return function(c){b[c?"set":"remove"](this.domNode,a,c);this._set(a,c)}}k.add("dijit-legacy-requires",!p.isAsync);k.add("dojo-bidi",!1);k("dijit-legacy-requires")&&w(0,function(){l(["dijit/_base/manager"])});var v={};f=c("dijit._WidgetBase",[E,B],{id:"",_setIdAttr:"domNode",lang:"",_setLangAttr:G("lang"),dir:"",_setDirAttr:G("dir"),"class":"",_setClassAttr:{node:"domNode",type:"class"},_setTypeAttr:null,style:"",title:"",tooltip:"",
baseClass:"",srcNodeRef:null,domNode:null,containerNode:null,ownerDocument:null,_setOwnerDocumentAttr:function(a){this._set("ownerDocument",a)},attributeMap:{},_blankGif:f.blankGif||l.toUrl("dojo/resources/blank.gif"),textDir:"",_introspect:function(){var a=this.constructor;if(!a._setterAttrs){var b=a.prototype,c=a._setterAttrs=[],a=a._onMap={},e;for(e in b.attributeMap)c.push(e);for(e in b)/^on/.test(e)&&(a[e.substring(2).toLowerCase()]=e),/^_set[A-Z](.*)Attr$/.test(e)&&(e=e.charAt(4).toLowerCase()+
e.substr(5,e.length-9),b.attributeMap&&e in b.attributeMap||c.push(e))}},postscript:function(a,b){this.create(a,b)},create:function(a,b){this._introspect();this.srcNodeRef=d.byId(b);this._connects=[];this._supportingWidgets=[];this.srcNodeRef&&this.srcNodeRef.id&&"string"==typeof this.srcNodeRef.id&&(this.id=this.srcNodeRef.id);a&&(this.params=a,m.mixin(this,a));this.postMixInProperties();this.id||(this.id=A.getUniqueId(this.declaredClass.replace(/\./g,"_")),this.params&&delete this.params.id);this.ownerDocument=
this.ownerDocument||(this.srcNodeRef?this.srcNodeRef.ownerDocument:document);this.ownerDocumentBody=C.body(this.ownerDocument);A.add(this);this.buildRendering();var e;if(this.domNode){this._applyAttributes();var c=this.srcNodeRef;c&&c.parentNode&&this.domNode!==c&&(c.parentNode.replaceChild(this.domNode,c),e=!0);this.domNode.setAttribute("widgetId",this.id)}this.postCreate();e&&delete this.srcNodeRef;this._created=!0},_applyAttributes:function(){var a={},b;for(b in this.params||{})a[b]=this._get(b);
n.forEach(this.constructor._setterAttrs,function(b){if(!(b in a)){var c=this._get(b);c&&this.set(b,c)}},this);for(b in a)this.set(b,a[b])},postMixInProperties:function(){},buildRendering:function(){this.domNode||(this.domNode=this.srcNodeRef||this.ownerDocument.createElement("div"));if(this.baseClass){var a=this.baseClass.split(" ");this.isLeftToRight()||(a=a.concat(n.map(a,function(a){return a+"Rtl"})));e.add(this.domNode,a)}},postCreate:function(){},startup:function(){this._started||(this._started=
!0,n.forEach(this.getChildren(),function(a){a._started||a._destroyed||!m.isFunction(a.startup)||(a.startup(),a._started=!0)}))},destroyRecursive:function(a){this._beingDestroyed=!0;this.destroyDescendants(a);this.destroy(a)},destroy:function(a){function b(b){b.destroyRecursive?b.destroyRecursive(a):b.destroy&&b.destroy(a)}this._beingDestroyed=!0;this.uninitialize();n.forEach(this._connects,m.hitch(this,"disconnect"));n.forEach(this._supportingWidgets,b);this.domNode&&n.forEach(A.findWidgets(this.domNode,
this.containerNode),b);this.destroyRendering(a);A.remove(this.id);this._destroyed=!0},destroyRendering:function(a){this.bgIframe&&(this.bgIframe.destroy(a),delete this.bgIframe);this.domNode&&(a?b.remove(this.domNode,"widgetId"):h.destroy(this.domNode),delete this.domNode);this.srcNodeRef&&(a||h.destroy(this.srcNodeRef),delete this.srcNodeRef)},destroyDescendants:function(a){n.forEach(this.getChildren(),function(b){b.destroyRecursive&&b.destroyRecursive(a)})},uninitialize:function(){return!1},_setStyleAttr:function(a){var b=
this.domNode;m.isObject(a)?q.set(b,a):b.style.cssText=b.style.cssText?b.style.cssText+("; "+a):a;this._set("style",a)},_attrToDom:function(a,c,d){d=3<=arguments.length?d:this.attributeMap[a];n.forEach(m.isArray(d)?d:[d],function(d){var f=this[d.node||d||"domNode"];switch(d.type||"attribute"){case "attribute":m.isFunction(c)&&(c=m.hitch(this,c));d=d.attribute?d.attribute:/^on[A-Z][a-zA-Z]*$/.test(a)?a.toLowerCase():a;f.tagName?b.set(f,d,c):f.set(d,c);break;case "innerText":f.innerHTML="";f.appendChild(this.ownerDocument.createTextNode(c));
break;case "innerHTML":f.innerHTML=c;break;case "class":e.replace(f,c,this[a]);break;case "toggleClass":e.toggle(f,d.className||a,c)}},this)},get:function(a){var b=this._getAttrNames(a);return this[b.g]?this[b.g]():this._get(a)},set:function(a,b){if("object"===typeof a){for(var c in a)this.set(c,a[c]);return this}c=this._getAttrNames(a);var e=this[c.s];if(m.isFunction(e))var d=e.apply(this,Array.prototype.slice.call(arguments,1));else{var e=this.focusNode&&!m.isFunction(this.focusNode)?"focusNode":
"domNode",f=this[e]&&this[e].tagName,u;if((u=f)&&!(u=v[f])){u=this[e];var z={},h;for(h in u)z[h.toLowerCase()]=!0;u=v[f]=z}h=u;c=a in this.attributeMap?this.attributeMap[a]:c.s in this?this[c.s]:h&&c.l in h&&"function"!=typeof b||/^aria-|^data-|^role$/.test(a)?e:null;null!=c&&this._attrToDom(a,b,c);this._set(a,b)}return d||this},_attrPairNames:{},_getAttrNames:function(a){var b=this._attrPairNames;if(b[a])return b[a];var c=a.replace(/^[a-z]|-[a-zA-Z]/g,function(a){return a.charAt(a.length-1).toUpperCase()});
return b[a]={n:a+"Node",s:"_set"+c+"Attr",g:"_get"+c+"Attr",l:c.toLowerCase()}},_set:function(a,b){var c=this[a];this[a]=b;!this._created||c===b||c!==c&&b!==b||(this._watchCallbacks&&this._watchCallbacks(a,c,b),this.emit("attrmodified-"+a,{detail:{prevValue:c,newValue:b}}))},_get:function(a){return this[a]},emit:function(a,b,c){b=b||{};void 0===b.bubbles&&(b.bubbles=!0);void 0===b.cancelable&&(b.cancelable=!0);b.detail||(b.detail={});b.detail.widget=this;var e,d=this["on"+a];d&&(e=d.apply(this,c?
c:[b]));this._started&&!this._beingDestroyed&&r.emit(this.domNode,a.toLowerCase(),b);return e},on:function(a,b){var c=this._onMap(a);return c?g.after(this,c,b,!0):this.own(r(this.domNode,a,b))[0]},_onMap:function(a){var b=this.constructor,c=b._onMap;if(!c){var c=b._onMap={},e;for(e in b.prototype)/^on/.test(e)&&(c[e.replace(/^on/,"").toLowerCase()]=e)}return c["string"==typeof a&&a.toLowerCase()]},toString:function(){return"[Widget "+this.declaredClass+", "+(this.id||"NO ID")+"]"},getChildren:function(){return this.containerNode?
A.findWidgets(this.containerNode):[]},getParent:function(){return A.getEnclosingWidget(this.domNode.parentNode)},connect:function(b,c,e){return this.own(a.connect(b,c,this,e))[0]},disconnect:function(a){a.remove()},subscribe:function(a,b){return this.own(x.subscribe(a,m.hitch(this,b)))[0]},unsubscribe:function(a){a.remove()},isLeftToRight:function(){return this.dir?"ltr"==this.dir.toLowerCase():t.isBodyLtr(this.ownerDocument)},isFocusable:function(){return this.focus&&"none"!=q.get(this.domNode,"display")},
placeAt:function(a,b){var c=!a.tagName&&A.byId(a);!c||!c.addChild||b&&"number"!==typeof b?(c=c&&"domNode"in c?c.containerNode&&!/after|before|replace/.test(b||"")?c.containerNode:c.domNode:d.byId(a,this.ownerDocument),h.place(this.domNode,c,b),!this._started&&(this.getParent()||{})._started&&this.startup()):c.addChild(this,b);return this},defer:function(a,b){var c=setTimeout(m.hitch(this,function(){c&&(c=null,this._destroyed||m.hitch(this,a)())}),b||0);return{remove:function(){c&&(clearTimeout(c),
c=null);return null}}}});k("dojo-bidi")&&f.extend(y);return f})},"dijit/Destroyable":function(){define(["dojo/_base/array","dojo/aspect","dojo/_base/declare"],function(l,n,g){return g("dijit.Destroyable",null,{destroy:function(f){this._destroyed=!0},own:function(){var f=["destroyRecursive","destroy","remove"];l.forEach(arguments,function(a){function c(){b.remove();l.forEach(e,function(a){a.remove()})}var d,b=n.before(this,"destroy",function(b){a[d](b)}),e=[];a.then?(d="cancel",a.then(c,c)):l.forEach(f,
function(b){"function"===typeof a[b]&&(d||(d=b),e.push(n.after(a,b,c,!0)))})},this);return arguments}})})},"dijit/_OnDijitClickMixin":function(){define("dojo/on dojo/_base/array dojo/keys dojo/_base/declare dojo/has ./a11yclick".split(" "),function(l,n,g,f,a,c){l=f("dijit._OnDijitClickMixin",null,{connect:function(a,b,e){return this.inherited(arguments,[a,"ondijitclick"==b?c:b,e])}});l.a11yclick=c;return l})},"dijit/_FocusMixin":function(){define(["./focus","./_WidgetBase","dojo/_base/declare","dojo/_base/lang"],
function(l,n,g,f){f.extend(n,{focused:!1,onFocus:function(){},onBlur:function(){},_onFocus:function(){this.onFocus()},_onBlur:function(){this.onBlur()}});return g("dijit._FocusMixin",null,{_focusManager:l})})},"dijit/hccss":function(){define(["dojo/dom-class","dojo/hccss","dojo/domReady","dojo/_base/window"],function(l,n,g,f){g(function(){n("highcontrast")&&l.add(f.body(),"dijit_a11y")});return n})},"dojo/hccss":function(){define("require ./_base/config ./dom-class ./dom-style ./has ./domReady ./_base/window".split(" "),
function(l,n,g,f,a,c,d){a.add("highcontrast",function(){var b=d.doc.createElement("div");try{b.style.cssText='border: 1px solid; border-color:red green; position: absolute; height: 5px; top: -999px;background-image: url("'+(n.blankGif||l.toUrl("./resources/blank.gif"))+'");';d.body().appendChild(b);var c=f.getComputedStyle(b),h=c.backgroundImage;return c.borderTopColor==c.borderRightColor||h&&("none"==h||"url(invalid-url:)"==h)}catch(t){return console.warn("hccss: exception detecting high-contrast mode, document is likely hidden: "+
t.toString()),!1}finally{8>=a("ie")?b.outerHTML="":d.body().removeChild(b)}});c(function(){a("highcontrast")&&g.add(d.body(),"dj_a11y")});return a})},"dijit/_Templated":function(){define("./_WidgetBase ./_TemplatedMixin ./_WidgetsInTemplateMixin dojo/_base/array dojo/_base/declare dojo/_base/lang dojo/_base/kernel".split(" "),function(l,n,g,f,a,c,d){c.extend(l,{waiRole:"",waiState:""});return a("dijit._Templated",[n,g],{constructor:function(){d.deprecated(this.declaredClass+": dijit._Templated deprecated, use dijit._TemplatedMixin and if necessary dijit._WidgetsInTemplateMixin",
"","2.0")},_processNode:function(a,c){var b=this.inherited(arguments),e=c(a,"waiRole");e&&a.setAttribute("role",e);(e=c(a,"waiState"))&&f.forEach(e.split(/\s*,\s*/),function(b){-1!=b.indexOf("-")&&(b=b.split("-"),a.setAttribute("aria-"+b[0],b[1]))});return b}})})},"dijit/_TemplatedMixin":function(){define("dojo/cache dojo/_base/declare dojo/dom-construct dojo/_base/lang dojo/on dojo/sniff dojo/string ./_AttachMixin".split(" "),function(l,n,g,f,a,c,d,b){var e=n("dijit._TemplatedMixin",b,{templateString:null,
templatePath:null,_skipNodeCache:!1,searchContainerNode:!0,_stringRepl:function(a){var b=this.declaredClass,c=this;return d.substitute(a,this,function(a,e){"!"==e.charAt(0)&&(a=f.getObject(e.substr(1),!1,c));if("undefined"==typeof a)throw Error(b+" template:"+e);return null==a?"":"!"==e.charAt(0)?a:this._escapeValue(""+a)},this)},_escapeValue:function(a){return a.replace(/["'<>&]/g,function(a){return{"\x26":"\x26amp;","\x3c":"\x26lt;","\x3e":"\x26gt;",'"':"\x26quot;","'":"\x26#x27;"}[a]})},buildRendering:function(){if(!this._rendered){this.templateString||
(this.templateString=l(this.templatePath,{sanitize:!0}));var a=e.getCachedTemplate(this.templateString,this._skipNodeCache,this.ownerDocument),b;if(f.isString(a)){if(b=g.toDom(this._stringRepl(a),this.ownerDocument),1!=b.nodeType)throw Error("Invalid template: "+a);}else b=a.cloneNode(!0);this.domNode=b}this.inherited(arguments);this._rendered||this._fillContent(this.srcNodeRef);this._rendered=!0},_fillContent:function(a){var b=this.containerNode;if(a&&b)for(;a.hasChildNodes();)b.appendChild(a.firstChild)}});
e._templateCache={};e.getCachedTemplate=function(a,b,c){var f=e._templateCache,h=a,m=f[h];if(m){try{if(!m.ownerDocument||m.ownerDocument==(c||document))return m}catch(r){}g.destroy(m)}a=d.trim(a);if(b||a.match(/\$\{([^\}]+)\}/g))return f[h]=a;b=g.toDom(a,c);if(1!=b.nodeType)throw Error("Invalid template: "+a);return f[h]=b};c("ie")&&a(window,"unload",function(){var a=e._templateCache,b;for(b in a){var c=a[b];"object"==typeof c&&g.destroy(c);delete a[b]}});return e})},"dojo/cache":function(){define(["./_base/kernel",
"./text"],function(l){return l.cache})},"dijit/_AttachMixin":function(){define("require dojo/_base/array dojo/_base/connect dojo/_base/declare dojo/_base/lang dojo/mouse dojo/on dojo/touch ./_WidgetBase".split(" "),function(l,n,g,f,a,c,d,b,e){var h=a.delegate(b,{mouseenter:c.enter,mouseleave:c.leave,keypress:g._keypress}),t;g=f("dijit._AttachMixin",null,{constructor:function(){this._attachPoints=[];this._attachEvents=[]},buildRendering:function(){this.inherited(arguments);this._attachTemplateNodes(this.domNode);
this._beforeFillContent()},_beforeFillContent:function(){},_attachTemplateNodes:function(a){for(var b=a;;)if(1==b.nodeType&&(this._processTemplateNode(b,function(a,b){return a.getAttribute(b)},this._attach)||this.searchContainerNode)&&b.firstChild)b=b.firstChild;else{if(b==a)break;for(;!b.nextSibling;)if(b=b.parentNode,b==a)return;b=b.nextSibling}},_processTemplateNode:function(b,c,e){var d=!0,f=this.attachScope||this,h=c(b,"dojoAttachPoint")||c(b,"data-dojo-attach-point");if(h)for(var k=h.split(/\s*,\s*/);h=
k.shift();)a.isArray(f[h])?f[h].push(b):f[h]=b,d="containerNode"!=h,this._attachPoints.push(h);if(c=c(b,"dojoAttachEvent")||c(b,"data-dojo-attach-event"))for(h=c.split(/\s*,\s*/),k=a.trim;c=h.shift();)if(c){var p=null;-1!=c.indexOf(":")?(p=c.split(":"),c=k(p[0]),p=k(p[1])):c=k(c);p||(p=c);this._attachEvents.push(e(b,c,a.hitch(f,p)))}return d},_attach:function(a,b,c){b=b.replace(/^on/,"").toLowerCase();b="dijitclick"==b?t||(t=l("./a11yclick")):h[b]||b;return d(a,b,c)},_detachTemplateNodes:function(){var a=
this.attachScope||this;n.forEach(this._attachPoints,function(b){delete a[b]});this._attachPoints=[];n.forEach(this._attachEvents,function(a){a.remove()});this._attachEvents=[]},destroyRendering:function(){this._detachTemplateNodes();this.inherited(arguments)}});a.extend(e,{dojoAttachEvent:"",dojoAttachPoint:""});return g})},"dijit/_WidgetsInTemplateMixin":function(){define(["dojo/_base/array","dojo/aspect","dojo/_base/declare","dojo/_base/lang","dojo/parser"],function(l,n,g,f,a){return g("dijit._WidgetsInTemplateMixin",
null,{_earlyTemplatedStartup:!1,contextRequire:null,_beforeFillContent:function(){if(/dojoType|data-dojo-type/i.test(this.domNode.innerHTML)){var c=this.domNode;this.containerNode&&!this.searchContainerNode&&(this.containerNode.stopParser=!0);a.parse(c,{noStart:!this._earlyTemplatedStartup,template:!0,inherited:{dir:this.dir,lang:this.lang,textDir:this.textDir},propsThis:this,contextRequire:this.contextRequire,scope:"dojo"}).then(f.hitch(this,function(a){this._startupWidgets=a;for(var b=0;b<a.length;b++)this._processTemplateNode(a[b],
function(a,b){return a[b]},function(a,b,c){return b in a?a.connect(a,b,c):a.on(b,c,!0)});this.containerNode&&this.containerNode.stopParser&&delete this.containerNode.stopParser}));if(!this._startupWidgets)throw Error(this.declaredClass+": parser returned unfilled promise (probably waiting for module auto-load), unsupported by _WidgetsInTemplateMixin.   Must pre-load all supporting widgets before instantiation.");}},_processTemplateNode:function(a,d,b){return d(a,"dojoType")||d(a,"data-dojo-type")?
!0:this.inherited(arguments)},startup:function(){l.forEach(this._startupWidgets,function(a){a&&!a._started&&a.startup&&a.startup()});this._startupWidgets=null;this.inherited(arguments)}})})},"dojo/parser":function(){define("require ./_base/kernel ./_base/lang ./_base/array ./_base/config ./dom ./_base/window ./_base/url ./aspect ./promise/all ./date/stamp ./Deferred ./has ./query ./on ./ready".split(" "),function(l,n,g,f,a,c,d,b,e,h,t,q,k,p,m,r){function w(a){return eval("("+a+")")}function E(a){var b=
a._nameCaseMap,c=a.prototype;if(!b||b._extendCnt<C){var b=a._nameCaseMap={},e;for(e in c)"_"!==e.charAt(0)&&(b[e.toLowerCase()]=e);b._extendCnt=C}return b}function x(a,b){b||(b=l);var c=b._dojoParserCtorMap||(b._dojoParserCtorMap={}),e=a.join();if(!c[e]){for(var d=[],f=0,h=a.length;f<h;f++){var k=a[f];d[d.length]=c[k]=c[k]||g.getObject(k)||~k.indexOf("/")&&b(k)}f=d.shift();c[e]=d.length?f.createSubclass?f.createSubclass(d):f.extend.apply(f,d):f}return c[e]}new Date("X");var C=0;e.after(g,"extend",
function(){C++},!0);var B={_clearCache:function(){C++;_ctorMap={}},_functionFromScript:function(a,b){var c="",e="",d=a.getAttribute(b+"args")||a.getAttribute("args"),h=a.getAttribute("with"),d=(d||"").split(/\s*,\s*/);h&&h.length&&f.forEach(h.split(/\s*,\s*/),function(a){c+="with("+a+"){";e+="}"});return new Function(d,c+a.innerHTML+e)},instantiate:function(a,b,c){b=b||{};c=c||{};var e=(c.scope||n._scopeName)+"Type",d="data-"+(c.scope||n._scopeName)+"-",h=d+"type",k=d+"mixins",p=[];f.forEach(a,function(a){var c=
e in b?b[e]:a.getAttribute(h)||a.getAttribute(e);if(c){var u=a.getAttribute(k),c=u?[c].concat(u.split(/\s*,\s*/)):[c];p.push({node:a,types:c})}});return this._instantiate(p,b,c)},_instantiate:function(a,b,c,e){function d(a){b._started||c.noStart||f.forEach(a,function(a){"function"!==typeof a.startup||a._started||a.startup()});return a}a=f.map(a,function(a){var e=a.ctor||x(a.types,c.contextRequire);if(!e)throw Error("Unable to resolve constructor for: '"+a.types.join()+"'");return this.construct(e,
a.node,b,c,a.scripts,a.inherited)},this);return e?h(a).then(d):d(a)},construct:function(a,c,d,h,q,r){function H(a){J&&g.setObject(J,a);for(F=0;F<A.length;F++)e[A[F].advice||"after"](a,A[F].method,g.hitch(a,A[F].func),!0);for(F=0;F<x.length;F++)x[F].call(a);for(F=0;F<y.length;F++)a.watch(y[F].prop,y[F].func);for(F=0;F<S.length;F++)m(a,S[F].event,S[F].func);return a}var I=a&&a.prototype;h=h||{};var l={};h.defaults&&g.mixin(l,h.defaults);r&&g.mixin(l,r);var v;k("dom-attributes-explicit")?v=c.attributes:
k("dom-attributes-specified-flag")?v=f.filter(c.attributes,function(a){return a.specified}):(r=(/^input$|^img$/i.test(c.nodeName)?c:c.cloneNode(!1)).outerHTML.replace(/=[^\s"']+|="[^"]*"|='[^']*'/g,"").replace(/^\s*<[a-zA-Z0-9]*\s*/,"").replace(/\s*>.*$/,""),v=f.map(r.split(/\s+/),function(a){var b=a.toLowerCase();return{name:a,value:"LI"==c.nodeName&&"value"==a||"enctype"==b?c.getAttribute(b):c.getAttributeNode(b).value}}));var u=h.scope||n._scopeName;r="data-"+u+"-";var z={};"dojo"!==u&&(z[r+"props"]=
"data-dojo-props",z[r+"type"]="data-dojo-type",z[r+"mixins"]="data-dojo-mixins",z[u+"type"]="dojotype",z[r+"id"]="data-dojo-id");for(var F=0,K,u=[],J,L;K=v[F++];){var N=K.name,O=N.toLowerCase();K=K.value;switch(z[O]||O){case "data-dojo-type":case "dojotype":case "data-dojo-mixins":break;case "data-dojo-props":L=K;break;case "data-dojo-id":case "jsid":J=K;break;case "data-dojo-attach-point":case "dojoattachpoint":l.dojoAttachPoint=K;break;case "data-dojo-attach-event":case "dojoattachevent":l.dojoAttachEvent=
K;break;case "class":l["class"]=c.className;break;case "style":l.style=c.style&&c.style.cssText;break;default:if(N in I||(N=E(a)[O]||N),N in I)switch(typeof I[N]){case "string":l[N]=K;break;case "number":l[N]=K.length?Number(K):NaN;break;case "boolean":l[N]="false"!=K.toLowerCase();break;case "function":""===K||-1!=K.search(/[^\w\.]+/i)?l[N]=new Function(K):l[N]=g.getObject(K,!1)||new Function(K);u.push(N);break;default:O=I[N],l[N]=O&&"length"in O?K?K.split(/\s*,\s*/):[]:O instanceof Date?""==K?new Date(""):
"now"==K?new Date:t.fromISOString(K):O instanceof b?n.baseUrl+K:w(K)}else l[N]=K}}for(v=0;v<u.length;v++)z=u[v].toLowerCase(),c.removeAttribute(z),c[z]=null;if(L)try{L=w.call(h.propsThis,"{"+L+"}"),g.mixin(l,L)}catch(T){throw Error(T.toString()+" in data-dojo-props\x3d'"+L+"'");}g.mixin(l,d);q||(q=a&&(a._noScript||I._noScript)?[]:p("\x3e script[type^\x3d'dojo/']",c));var A=[],x=[],y=[],S=[];if(q)for(F=0;F<q.length;F++)z=q[F],c.removeChild(z),d=z.getAttribute(r+"event")||z.getAttribute("event"),h=
z.getAttribute(r+"prop"),L=z.getAttribute(r+"method"),u=z.getAttribute(r+"advice"),v=z.getAttribute("type"),z=this._functionFromScript(z,r),d?"dojo/connect"==v?A.push({method:d,func:z}):"dojo/on"==v?S.push({event:d,func:z}):l[d]=z:"dojo/aspect"==v?A.push({method:L,advice:u,func:z}):"dojo/watch"==v?y.push({prop:h,func:z}):x.push(z);a=(q=a.markupFactory||I.markupFactory)?q(l,c,a):new a(l,c);return a.then?a.then(H):H(a)},scan:function(a,b){function c(a){if(!a.inherited){a.inherited={};var b=a.node,u=
c(a.parent),b={dir:b.getAttribute("dir")||u.dir,lang:b.getAttribute("lang")||u.lang,textDir:b.getAttribute(r)||u.textDir},e;for(e in b)b[e]&&(a.inherited[e]=b[e])}return a.inherited}var e=[],d=[],h={},p=(b.scope||n._scopeName)+"Type",m="data-"+(b.scope||n._scopeName)+"-",t=m+"type",r=m+"textdir",m=m+"mixins",u=a.firstChild,z=b.inherited;if(!z){var F=function(a,b){return a.getAttribute&&a.getAttribute(b)||a.parentNode&&F(a.parentNode,b)},z={dir:F(a,"dir"),lang:F(a,"lang"),textDir:F(a,r)},g;for(g in z)z[g]||
delete z[g]}for(var z={inherited:z},J,L;;)if(u)if(1!=u.nodeType)u=u.nextSibling;else if(J&&"script"==u.nodeName.toLowerCase())(w=u.getAttribute("type"))&&/^dojo\/\w/i.test(w)&&J.push(u),u=u.nextSibling;else if(L)u=u.nextSibling;else{var w=u.getAttribute(t)||u.getAttribute(p);g=u.firstChild;if(w||g&&(3!=g.nodeType||g.nextSibling)){L=null;if(w){var O=u.getAttribute(m);J=O?[w].concat(O.split(/\s*,\s*/)):[w];try{L=x(J,b.contextRequire)}catch(U){}L||f.forEach(J,function(a){~a.indexOf("/")&&!h[a]&&(h[a]=
!0,d[d.length]=a)});O=L&&!L.prototype._noScript?[]:null;z={types:J,ctor:L,parent:z,node:u,scripts:O};z.inherited=c(z);e.push(z)}else z={node:u,scripts:J,parent:z};J=O;L=u.stopParser||L&&L.prototype.stopParser&&!b.template;u=g}else u=u.nextSibling}else{if(!z||!z.node)break;u=z.node.nextSibling;L=!1;z=z.parent;J=z.scripts}var E=new q;d.length?(k("dojo-debug-messages")&&console.warn("WARNING: Modules being Auto-Required: "+d.join(", ")),(b.contextRequire||l)(d,function(){E.resolve(f.filter(e,function(a){if(!a.ctor)try{a.ctor=
x(a.types,b.contextRequire)}catch(T){}for(var c=a.parent;c&&!c.types;)c=c.parent;var u=a.ctor&&a.ctor.prototype;a.instantiateChildren=!(u&&u.stopParser&&!b.template);a.instantiate=!c||c.instantiate&&c.instantiateChildren;return a.instantiate}))})):E.resolve(e);return E.promise},_require:function(a,b){var c=w("{"+a.innerHTML+"}"),e=[],d=[],f=new q,h=b&&b.contextRequire||l,k;for(k in c)e.push(k),d.push(c[k]);h(d,function(){for(var a=0;a<e.length;a++)g.setObject(e[a],arguments[a]);f.resolve(arguments)});
return f.promise},_scanAmd:function(a,b){var c=new q,e=c.promise;c.resolve(!0);var d=this;p("script[type\x3d'dojo/require']",a).forEach(function(a){e=e.then(function(){return d._require(a,b)});a.parentNode.removeChild(a)});return e},parse:function(a,b){!a||"string"==typeof a||"nodeType"in a||(b=a,a=b.rootNode);var e=a?c.byId(a):d.body();b=b||{};var f=b.template?{template:!0}:{},h=[],k=this,p=this._scanAmd(e,b).then(function(){return k.scan(e,b)}).then(function(a){return k._instantiate(a,f,b,!0)}).then(function(a){return h=
h.concat(a)}).otherwise(function(a){console.error("dojo/parser::parse() error",a);throw a;});g.mixin(h,p);return h}};n.parser=B;a.parseOnLoad&&r(100,B,"parse");return B})},"dojo/date/stamp":function(){define(["../_base/lang","../_base/array"],function(l,n){var g={};l.setObject("dojo.date.stamp",g);g.fromISOString=function(f,a){g._isoRegExp||(g._isoRegExp=/^(?:(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(.\d+)?)?((?:[+-](\d{2}):(\d{2}))|Z)?)?$/);var c=g._isoRegExp.exec(f),d=null;
if(c){c.shift();c[1]&&c[1]--;c[6]&&(c[6]*=1E3);a&&(a=new Date(a),n.forEach(n.map("FullYear Month Date Hours Minutes Seconds Milliseconds".split(" "),function(b){return a["get"+b]()}),function(a,b){c[b]=c[b]||a}));d=new Date(c[0]||1970,c[1]||0,c[2]||1,c[3]||0,c[4]||0,c[5]||0,c[6]||0);100>c[0]&&d.setFullYear(c[0]||1970);var b=0,e=c[7]&&c[7].charAt(0);"Z"!=e&&(b=60*(c[8]||0)+(Number(c[9])||0),"-"!=e&&(b*=-1));e&&(b-=d.getTimezoneOffset());b&&d.setTime(d.getTime()+6E4*b)}return d};g.toISOString=function(f,
a){var c=function(a){return 10>a?"0"+a:a};a=a||{};var d=[],b=a.zulu?"getUTC":"get",e="";"time"!=a.selector&&(e=f[b+"FullYear"](),e=["0000".substr((e+"").length)+e,c(f[b+"Month"]()+1),c(f[b+"Date"]())].join("-"));d.push(e);if("date"!=a.selector){e=[c(f[b+"Hours"]()),c(f[b+"Minutes"]()),c(f[b+"Seconds"]())].join(":");b=f[b+"Milliseconds"]();a.milliseconds&&(e+="."+(100>b?"0":"")+c(b));if(a.zulu)e+="Z";else if("time"!=a.selector)var b=f.getTimezoneOffset(),h=Math.abs(b),e=e+((0<b?"-":"+")+c(Math.floor(h/
60))+":"+c(h%60));d.push(e)}return d.join("T")};return g})},"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(l,n,g,f,a,c,d,b,e,h,t,q,k,p,m){l=l(k,{declaredClass:"esri.virtualearth.VETiledLayer",constructor:function(a){try{if(a=n.mixin({bingMapsKey:null,
culture:"en-US"},a||{}),this.url=h.getProtocolForWebResource()+"//dev.virtualearth.net/REST/v1",this._url=h.urlToObject(this.url),this.spatialReference=new t({wkid:102100}),this.tileInfo=new q({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 p(-2.0037508342787E7,-2.003750834278E7,2.003750834278E7,2.0037508342787E7,new t({wkid:102100})),n.mixin(this,a),this.hasAttributionData=this.showAttribution,this._initLayer=n.hitch(this,this._initLayer),this._errorHandler=n.hitch(this,this._errorHandler),this._getTileInfo=n.hitch(this,this._getTileInfo),this.bingMapsKey)this._getTileInfo();else throw Error("BingMapsKey must be provided.");}catch(w){throw this.onError(w),w;}},_unsetMap:function(a,b){this.inherited("_unsetMap",arguments)},
_getTileInfo:function(){if(this.mapStyle){var a=this._url.path+"/Imagery/Metadata/"+this.mapStyle,b=window.location.protocol;if(this.bingMapsKey){var c=this.resourceInfo;!this.loaded&&c?this._initLayer(c):m({url:a,content:n.mixin({},{uriScheme:"https:"===b?"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(a,b){if(200!==a.statusCode){var c=
Error();c.code=a.statusCode;c.message=a.statusDescription;c.details=a.errorDetails;c.authenticationResultCode=a.authenticationResultCode;this.onError(c)}else try{this.resourceInfo=g.toJson(a);var c=a.resourceSets[0].resources[0],e=c.imageUrl.replace("{","${");this.tileServers=f.map(c.imageUrlSubdomains,function(a){var b=h.getProtocolForWebResource();return d.substitute(e,{subdomain:a}).replace("http:",b)});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 k=this.loadCallback;k&&(delete this.loadCallback,k(this))}}catch(B){this.onError(B)}},getAttributionData:function(){var c=new b,e=g.fromJson(this.resourceInfo),d;this.hasAttributionData&&e&&(d=n.getObject("resourceSets.0.resources.0.imageryProviders",!1,e));d?c.callback({contributors:d}):(e=Error("Layer does not have attribution data"),e.log=a.isDebug,c.errback(e));
return c},getTileUrl:function(a,b,c){return d.substitute(this.tileServers[b%this._tsLength].replace(/\{/g,"${"),{quadkey:this._getQuadKey(a,b,c),culture:this.culture,token:this.bingMapsKey})},_getQuadKey:function(a,b,c){var e="",d,f;for(f=a;0<f;f--)a="0",d=1<<f-1,0!=(c&d)&&a++,0!=(b&d)&&(a++,a++),e+=a;return e},setMapStyle:function(a){this.mapStyle=a;this._getTileInfo()},setCulture:function(a){this.culture=a;this._getTileInfo()},setBingMapsKey:function(a){this.bingMapsKey=a},onMapStyleChange:function(){}});
n.mixin(l,{MAP_STYLE_AERIAL:"aerial",MAP_STYLE_AERIAL_WITH_LABELS:"aerialWithLabelsOnDemand",MAP_STYLE_ROAD:"roadOnDemand"});c("extend-esri")&&n.setObject("virtualearth.VETiledLayer",l,e);return l})},"esri/layers/WebTiledLayer":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/_base/url dojo/sniff dojo/string ../config ../kernel ../request ../urlUtils ../SpatialReference ../geometry/Extent ./TiledMapServiceLayer ./TileInfo".split(" "),function(l,n,g,f,a,c,d,b,e,h,t,q,k,p){function m(a,
b){var c=[],e,d;if(a&&b&&(b.customLayerParameters||b.customParameters)){e=n.clone(b.customParameters||{});n.mixin(e,b.customLayerParameters||{});d=h.urlToObject(a);for(var f in d.query)e.hasOwnProperty(f)||c.push(f+"\x3d"+d.query[f]);a=d.path+(c.length?"?"+c.join("\x26"):"")}return a}l=l(k,{declaredClass:"esri.layers.WebTiledLayer",constructor:function(b,k){k||(k={});this.urlTemplate=b=m(b,k.wmtsInfo);var l=new q(-2.0037508342787E7,-2.003750834278E7,2.003750834278E7,2.0037508342787E7,new t({wkid:102100})),
r=new q(-2.0037508342787E7,-2.003750834278E7,2.003750834278E7,2.0037508342787E7,new t({wkid:102100}));this.initialExtent=k.initialExtent||l;this.fullExtent=k.fullExtent||r;this.tileInfo=k.tileInfo?k.tileInfo:new p({dpi:96,rows:256,cols:256,origin:{x:-2.0037508342787E7,y:2.0037508342787E7},spatialReference:{wkid:102100},lods:[{level:0,resolution:156543.033928,scale:5.91657527591555E8},{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:.14929107082380833,
scale:564.248588},{level:21,resolution:.07464553541190416,scale:282.124294},{level:22,resolution:.03732276770595208,scale:141.062147},{level:23,resolution:.01866138385297604,scale:70.5310735}]});this.spatialReference=new t(this.tileInfo.spatialReference.toJson());this.copyright=k.copyright||"";var w=new f(b),l=w.scheme+"://"+w.authority+"/";this.urlPath=b.substring(l.length);this.tileServers=k.tileServers||[];-1===w.authority.indexOf("{subDomain}")&&this.tileServers.push(l);if(k.subDomains&&0<k.subDomains.length&&
1<w.authority.split(".").length){this.subDomains=k.subDomains;var B;g.forEach(k.subDomains,function(a){-1<w.authority.indexOf("${subDomain}")?B=w.scheme+"://"+c.substitute(w.authority,{subDomain:a})+"/":-1<w.authority.indexOf("{subDomain}")&&(B=w.scheme+"://"+w.authority.replace(/\{subDomain\}/gi,a)+"/");this.tileServers.push(B)},this)}this.tileServers=g.map(this.tileServers,function(a){"/"!==a.charAt(a.length-1)&&(a+="/");return a});this._levelToLevelValue=[];var y=0;g.forEach(this.tileInfo.lods,
function(a,b){this._levelToLevelValue[a.level]=a.levelValue||a.level;0===b&&(y=this._levelToLevelValue[a.level])},this);this._wmtsInfo=k.wmtsInfo;var A=n.hitch(this,function(){this.loaded=!0;this.onLoad(this)});if(a("chrome")){var l=this.getTileUrl(y,0,0),r=d.defaults.io,G="with-credentials"===r.useCors?h.canUseXhr(l,!0):-1;(r=-1<G?r.corsEnabledServers[G]:null)&&r.withCredentials?e({url:l,handleAs:"arraybuffer"}).addBoth(function(){A()}):A()}else A()},getTileUrl:function(a,b,e){a=this._levelToLevelValue[a];
var d=this.tileServers[b%this.tileServers.length]+c.substitute(this.urlPath,{level:a,col:e,row:b}),d=d.replace(/\{level\}/gi,a).replace(/\{row\}/gi,b).replace(/\{col\}/gi,e),d=this._appendCustomLayerParameters(d),d=this.addTimestampToURL(d);return h.addProxy(d)},_appendCustomLayerParameters:function(a){var b,c;if(this._wmtsInfo&&(this._wmtsInfo.customLayerParameters||this._wmtsInfo.customParameters))for(b in c=n.clone(this._wmtsInfo.customParameters||{}),n.mixin(c,this._wmtsInfo.customLayerParameters||
{}),c)a+=(-1===a.indexOf("?")?"?":"\x26")+b+"\x3d"+encodeURIComponent(c[b]);return a}});a("extend-esri")&&n.setObject("layers.WebTiledLayer",l,b);return l})},"esri/layers/ArcGISImageServiceLayer":function(){define("dojo/_base/declare dojo/_base/lang dojo/has ../kernel ../config ./DynamicMapServiceLayer ./ImageServiceLayerMixin".split(" "),function(l,n,g,f,a,c,d){l=l([c,d],{declaredClass:"esri.layers.ArcGISImageServiceLayer",constructor:function(a,c){this._initialize(a,c);this.useMapImage=c&&c.useMapImage||
!1},refresh:function(a){if(a)this.inherited(arguments);else{var b=this.disableClientCaching;this.disableClientCaching=!0;this.inherited(arguments);this.disableClientCaching=b}},setRenderer:function(a,c){this.renderer=a;this.onRendererChange();c||this.refresh(!0)},exportMapImage:function(b,c){var e=a.defaults.map,e=n.mixin({size:e.width+","+e.height},this._params,b?b.toJson(this.normalization):{},{f:"json"});delete e._ts;this._exportMapImage(this._url.path+"/exportImage",e,c)}});g("extend-esri")&&
n.setObject("layers.ArcGISImageServiceLayer",l,f);return l})},"esri/layers/ImageServiceLayerMixin":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/Deferred dojo/_base/array dojo/_base/json dojo/_base/config dojo/_base/connect dojo/has dojo/io-query dojo/DeferredList ../kernel ../config ../lang ../request ../deferredUtils ../urlUtils ../geometry/Extent ../geometry/Point ../geometry/Polygon ./MosaicRule ./RasterFunction ./DimensionalDefinition ./Raster ./PixelBlock ./pixelFilters/VectorFieldPixelFilter ./rasterFormats/ImageCanvasDecoder ./TimeInfo ./Field ../graphic ../tasks/ImageServiceIdentifyTask ../tasks/ImageServiceIdentifyParameters".split(" "),
function(l,n,g,f,a,c,d,b,e,h,t,q,k,p,m,r,w,E,x,C,B,y,A,G,v,D,Q,H,I,M,P){l=l(null,{declaredClass:"esri.layers.ImageServiceLayerMixin",_rasterFieldPrefix:"Raster.",_renderingRuleFieldSubPrefix:"ServicePixelValue.",_rasterFunctionServiceInfoProps:"bandCount pixelType hasRasterAttributeTable hasHistograms minValues maxValues meanValues stdvValues".split(" "),_rasterFunctionTemplateInfos:{},_pixelTypeRanges:{U1:[0,1],U2:[0,3],U4:[0,15],U8:[0,255],S8:[-128,127],U16:[0,65535],S16:[-32768,32767]},_eventMap:{"rendering-change":!0,
"mosaic-rule-change":!0,"spatial-reference-change":!0,"renderer-change":!0},constructor:function(a,b){this.useMapTime=b&&b.hasOwnProperty("useMapTime")?!!b.useMapTime:!0},_initialize:function(a,b){this._url=r.urlToObject(a);this.raster=new A(this._url.path);this.infoTemplate=b&&b.infoTemplate;var c=b&&b.imageServiceParameters;this.format=c&&c.format;this.compressionTolerance=c&&c.compressionTolerance?c.compressionTolerance:.01;this.interpolation=c?c.interpolation:null;this.compressionQuality=c?c.compressionQuality:
null;this.bandIds=c?c.bandIds:null;this.mosaicRule=c?c.mosaicRule:null;this.renderingRule=c?c.renderingRule:null;this.renderer=c?c.renderer:null;this.useMapDimensionValue=b&&b.hasOwnProperty("useMapDimensionValue")?!!b.useMapDimensionValue:!0;this.activeMapDimensions=b&&b.activeMapDimensions;this._params=n.mixin({},this._url.query,{f:"image",interpolation:this.interpolation,format:this.format,compressionQuality:this.compressionQuality,bandIds:this.bandIds?this.bandIds.join(","):null},c?c.toJson():
{});this.pixelFilter=b&&b.pixelFilter;this.originalPixelData=this.pixelData=null;this.hasDataChanged=!0;this._requestDataHandler=n.hitch(this,this._requestDataHandler);this._requestDataErrorHandler=n.hitch(this,this._requestDataErrorHandler);this._rasterReadPromise=null;this._initLayer=n.hitch(this,this._initLayer);this._queryVisibleRastersHandler=n.hitch(this,this._queryVisibleRastersHandler);this._visibleRasters=[];this._rasterAttributeTableFields=[];this._rasterAttributeTableFeatures=[];this._renderingRuleAttributeTable=
{};this._useRenderingRuleAttributeTable=!1;this._loadCallback=b&&b.loadCallback;(c=b&&b.resourceInfo)?this._initLayer(c):p({url:this._url.path,content:n.mixin({f:"json"},this._url.query),callbackParamName:"callback",load:this._initLayer,error:this._errorHandler});this.registerConnectEvents()},disableClientCaching:!1,_initLayer:function(a,b){if(null!==a&&void 0!==a){this._findCredential();(this.credential&&this.credential.ssl||a&&a._ssl)&&this._useSSL();var c=this.minScale,e=this.maxScale;n.mixin(this,
a);this.minScale=c;this.maxScale=e;this.initialExtent=this.fullExtent=this.extent=new w(a.extent);this.spatialReference=this.initialExtent.spatialReference;this.pixelSizeX=parseFloat(this.pixelSizeX);this.pixelSizeY=parseFloat(this.pixelSizeY);for(var u=this.minValues,d=this.maxValues,f=this.meanValues,z=this.stdvValues,h=this.bands=[],c=0,e=this.bandCount;c<e;c++)h[c]={min:u[c],max:d[c],mean:f[c],stddev:z[c]};this.timeInfo=(c=this.timeInfo)&&c.timeExtent?new Q(c):null;e=this.fields=[];if(u=a.fields)for(c=
0;c<u.length;c++)e.push(new H(u[c]));this.version=a.currentVersion;this.version||(this.version="fields"in a||"objectIdField"in a||"timeInfo"in a?10:9.3);k.isDefined(a.minScale)&&!this._hasMin&&this.setMinScale(a.minScale);k.isDefined(a.maxScale)&&!this._hasMax&&this.setMaxScale(a.maxScale);c={};a.defaultMosaicMethod?(c.method=a.defaultMosaicMethod,c.operation=a.mosaicOperator,c.sortField=a.sortField,c.sortValue=a.sortValue):c.method=C.METHOD_NONE;this.defaultMosaicRule=new C(c);this.defaultMosaicRule.ascending=
!0;this._useRenderingRuleAttributeTable=10<this.version&&"esriImageServiceDataTypeThematic"===this.serviceDataType&&!this.hasRasterAttributeTable;this._setDefaultRenderingRule(!0);this._isScientificData()&&(!this.mosaicRule||this.mosaicRule&&!this.mosaicRule.multidimensionalDefinition)&&this._setDefaultMultidimensionalDefinition(!0);10<this.version&&this.hasRasterAttributeTable&&this.getRasterAttributeTable().then(n.hitch(this,function(a){a&&(a.features&&a.fields&&(this.rasterAttributeTable=n.clone(a)),
a.features&&0<a.features.length&&(this._rasterAttributeTableFeatures=n.clone(a.features)),a.fields&&0<a.fields.length&&(this._rasterAttributeTableFields=n.clone(a.fields)),!this.renderer||"esri.renderer.ClassBreaksRenderer"!==this.renderer.declaredClass&&"esri.renderer.UniqueValueRenderer"!==this.renderer.declaredClass||this.refresh())}));this._isVectorData()&&!k.isDefined(this.pixelFilter)&&(this.vectorFieldPixelFilter=new v,this.vectorFieldPixelFilter.isDataUV="esriImageServiceDataTypeVector-UV"===
this.serviceDataType,this.pixelFilter=this.vectorFieldPixelFilter.computeMagnitudeAndDirection,this.getKeyProperties().then(n.hitch(this,this._setFlowRepresentation)));this.loaded=!0;this._setDefaultFilter();this.onLoad(this);if(c=this._loadCallback)delete this._loadCallback,c(this)}},getKeyProperties:function(b){var e=this._url.path+"/keyProperties",d=new g(m._dfdCanceller),u={f:"json"};b&&b.renderingRule&&(u.renderingRule=a.toJson(b.renderingRule.toJson()));10<this.version?(d._pendingDfd=p({url:e,
content:u,handleAs:"json",callbackParamName:"callback"}),d._pendingDfd.then(function(a){d.callback(a)},function(a){d.errback(a)})):(b=Error("Layer does not have key properties"),b.log=!!c.isDebug,d.errback(b));return d},getRasterAttributeTable:function(b){var e=this._url.path+"/rasterAttributeTable",d=new g(m._dfdCanceller),u={f:"json"},f=this.hasRasterAttributeTable;b&&b.renderingRule&&(u.renderingRule=a.toJson(b.renderingRule.toJson()),f=!0);10<this.version&&f?(d._pendingDfd=p({url:e,content:u,
handleAs:"json",callbackParamName:"callback"}),d._pendingDfd.then(function(a){d.callback(a)},function(a){d.errback(a)})):(b=Error("Layer does not support raster attribute table"),b.log=!!c.isDebug,d.errback(b));return d},getRenderingRuleAttributeTable:function(a){var b=new g(m._dfdCanceller);if(!a||!a.renderingRule)return b.errback(Error("Rendering rule is not specified")),b;a=a.renderingRule;var c=a.functionName;this._renderingRuleAttributeTable&&c&&this._renderingRuleAttributeTable.hasOwnProperty(c)?
b.resolve(this._renderingRuleAttributeTable[c]):b=this.getRasterAttributeTable({renderingRule:a}).then(n.hitch(this,function(a){var b;a&&a.features&&a.features.length&&a.fields&&a.fields.length&&(b={features:n.clone(a.features),fields:n.clone(a.fields)},c&&(this._renderingRuleAttributeTable[c]=b));return b}));return b},_getRasterAttributeTableFeatures:function(){var a=new g;if(this._rasterAttributeTableFeatures&&0<this._rasterAttributeTableFeatures.length)return a.resolve(this._rasterAttributeTableFeatures),
a;if(10<this.version&&this.hasRasterAttributeTable)return a=this.getRasterAttributeTable(),a.then(n.hitch(this,function(a){a&&a.features&&0<a.features.length&&(this._rasterAttributeTableFeatures=n.clone(a.features))})),a;a.resolve(this._rasterAttributeTableFeatures);return a},_getRenderingRuleAttributeTableFeatures:function(a){a=a&&a.renderingRule;return a?this.getRenderingRuleAttributeTable({renderingRule:a}).then(function(a){return a&&a.features}):(a=new g,a.errback(Error("Rendering rule is not specified")),
a)},getCustomRasterFields:function(a){var b=a?a.rasterAttributeTableFieldPrefix:this._rasterFieldPrefix;a=10.3<=this.version?"esriFieldTypeDouble":"esriFieldTypeString";var c={name:this._rasterFieldPrefix+"ItemPixelValue",alias:"Item Pixel Value",domain:null,editable:!1,length:50,type:a},e={name:this._rasterFieldPrefix+"ServicePixelValue",alias:"Service Pixel Value",domain:null,editable:!1,length:50,type:a},d={name:this._rasterFieldPrefix+"ServicePixelValue.Raw",alias:"Raw Service Pixel Value",domain:null,
editable:!1,length:50,type:"esriFieldTypeDouble"},u=this.fields?n.clone(this.fields):[];a=u.length;u[a]=e;10.4<=this.version&&"esri.layers.ArcGISImageServiceLayer"===this.declaredClass&&(!this.rasterFunctionInfos||!this.rasterFunctionInfos.length||this._isRasterFunctionInfoAvailable("none"))&&(a++,u[a]=d);if(this.capabilities&&-1<this.capabilities.toLowerCase().indexOf("catalog")||this.fields&&0<this.fields.length)a++,u[a]=c;!k.isDefined(this.pixelFilter)||"esriImageServiceDataTypeVector-UV"!==this.serviceDataType&&
"esriImageServiceDataTypeVector-MagDir"!==this.serviceDataType||(c={name:this._rasterFieldPrefix+"Magnitude",alias:"Magnitude",domain:null,editable:!1,type:"esriFieldTypeDouble"},e={name:this._rasterFieldPrefix+"Direction",alias:"Direction",domain:null,editable:!1,type:"esriFieldTypeDouble"},a++,u[a]=c,a++,u[a]=e);a=this._rasterAttributeTableFields;(c=this.renderingRule&&this.renderingRule.functionName)&&this._renderingRuleAttributeTable&&this._renderingRuleAttributeTable.hasOwnProperty(c)&&(a=this._renderingRuleAttributeTable[c].fields);
a&&0<a.length&&(a=f.filter(a,function(a){return"esriFieldTypeOID"!==a.type&&"value"!==a.name.toLowerCase()}),a=f.map(a,function(a){var c=n.clone(a);c.name=b+a.name;return c}),u=u.concat(a));var h=this._rasterFieldPrefix+this._renderingRuleFieldSubPrefix;10.4<=this.version&&this.rasterFunctionInfos&&f.forEach(this.rasterFunctionInfos,function(a){a&&a.name&&"none"!==a.name.toLowerCase()&&(a={name:h+a.name.replace(/ /gi,"_"),alias:a.name,domain:null,editable:!1,type:"esriFieldTypeDouble"},u.push(a))});
return u},_prepareGetImageParameters:function(b,c,e,d){d=k.isDefined(d)?d:this._params;if(this.renderer){var f=this.getExportImageRenderingRule();d.renderingRule=f?a.toJson(f.toJson()):null}f=b.spatialReference.wkid||a.toJson(b.spatialReference.toJson(!1));delete d._ts;n.mixin(d,{bbox:b.xmin+","+b.ymin+","+b.xmax+","+b.ymax,imageSR:f,bboxSR:f,size:c+","+e},this.disableClientCaching?{_ts:(new Date).getTime()}:{});delete d.compressionTolerance;d.format&&"LERC"===d.format.toUpperCase()&&(d.compressionTolerance=
this.compressionTolerance);d.token=this._getToken()},getImageUrl:function(a,b,c,d,f){f=k.isDefined(f)?f:this._params;this._prepareGetImageParameters(a,b,c,f);a=n.clone(f);this._cleanupRequestParams(a);b=this._url.path+"/exportImage?";c=r.addProxy(b+e.objectToQuery(n.mixin(a,{f:"image"})));var u=a.token;c.length>q.defaults.io.postLength||this.useMapImage?this._jsonRequest=p({url:b,content:n.mixin(a,{f:"json"}),callbackParamName:"callback",load:function(a,b){var c=a.href;u&&(c+=-1===c.indexOf("?")?
"?token\x3d"+u:"\x26token\x3d"+u);d(r.addProxy(c))},error:this._errorHandler}):d(c)},onRenderingChange:function(){},onMosaicRuleChange:function(){},onRendererChange:function(){},setInterpolation:function(a,b){this.interpolation=this._params.interpolation=a;b||this.refresh(!0)},setCompressionQuality:function(a,b){this.compressionQuality=this._params.compressionQuality=a;b||this.refresh(!0)},setCompressionTolerance:function(a,b){this.compressionTolerance=a;b||this.refresh(!0)},setBandIds:function(a,
b){var c=!1;this.bandIds!==a&&(c=!0);this.bandIds=a;this._params.bandIds=a.join(",");if(c&&!b)this.onRenderingChange();b||this.refresh(!0)},setDefaultBandIds:function(a){this.bandIds=this._params.bandIds=null;a||this.refresh(!0)},setDisableClientCaching:function(a){this.disableClientCaching=a},setMosaicRule:function(b,c){var e=!1;this.mosaicRule!==b&&(e=!0);this.mosaicRule=b;this._params.mosaicRule=a.toJson(b.toJson());if(e&&!c)this.onMosaicRuleChange();c||this.refresh(!0)},setRenderingRule:function(b,
c){var e=!1;this.renderingRule!==b&&(e=!0);this.renderingRule=b;this._params.renderingRule=b?a.toJson(b.toJson()):null;this._useRenderingRuleAttributeTable&&this.getRenderingRuleAttributeTable({renderingRule:b});if(e)this.onRenderingChange();this._setDefaultFilter();c||this.refresh(!0)},setImageFormat:function(a,b){this.format=this._params.format=a;this._setDefaultFilter();b||this.refresh(!0)},setInfoTemplate:function(a){this.infoTemplate=a},setDefinitionExpression:function(a,b){var c=this.mosaicRule?
this.mosaicRule.toJson():{};this.mosaicRule||(this.defaultMosaicRule?c=this.defaultMosaicRule.toJson():c.method=C.METHOD_NONE);c.where=a;c=new C(c);this.setMosaicRule(c,b);return this},getDefinitionExpression:function(){return this.mosaicRule?this.mosaicRule.where:null},setPixelFilter:function(a){this.pixelFilter=a;this._isDefaultPixelFilter=!1},getPixelData:function(a){return a?(this._useBrowserDecoding()&&(this.originalPixelData={pixelBlock:this._getPixelBlockFromCanvas(this._context,this._map.width,
this._map.height),extent:this._map.extent}),this.originalPixelData):this.pixelData},getExportImageRenderingRule:function(){return this._combineRenderingRule(this._convertRendererToRenderingRule(this.renderer),this.renderingRule)},redraw:function(){this.hasDataChanged=!1;this._setPixelData(this.originalPixelData)},getHistograms:function(){var a=new g(m._dfdCanceller);if(this.hasHistograms)a._pendingDfd=p({url:this._url.path+"/histograms",content:{f:"json"},handleAs:"json",callbackParamName:"callback"}),
a._pendingDfd.then(function(b){a.callback(b)},function(b){a.errback(b)});else{var b=Error("Layer does not have histograms.");b.log=!!c.isDebug;a.errback(b)}return a},computeHistograms:function(a){var b=new g(m._dfdCanceller);if(10.1<=this.currentVersion){a=a||{};var e=a.geometry||this.fullExtent,d=(a.geometry||this.fullExtent).toJson(),e="extent"===e.type?"esriGeometryEnvelope":"esriGeometryPolygon",f=a.renderingRule||this.renderingRule||this.defaultRenderingRule,f=f?f.toJson():null,u=a.mosaicRule||
this.mosaicRule||this.defaultMosaicRule,u=u?u.toJson():null;a=a.pixelSize||{x:this.pixelSizeX,y:this.pixelSizeY};b._pendingDfd=p({url:this._url.path+"/computeHistograms",content:n.mixin({f:"json",geometry:JSON.stringify(d),geometryType:e,renderingRule:JSON.stringify(f),mosaicRule:JSON.stringify(u),pixelSize:JSON.stringify(a),callbackParamName:"callback"}),handleAs:"json"});b._pendingDfd.then(function(a){b.callback(a)},function(a){b.errback(a)})}else d=Error("Layer doesn't support computeHistograms."),
d.log=!!c.isDebug,b.errback(d);return b},getRenderingRuleServiceInfo:function(a){var b=new m._fixDfd(new g(m._dfdCanceller));if(!a)return b.errback(Error("Rendering rule is not specified")),b;var c=a&&a.functionName&&!a.functionArguments?a.functionName:null;return c&&this._rasterFunctionTemplateInfos[c]?(b.resolve(this._rasterFunctionTemplateInfos[c]),b):p({url:this._url.path,content:n.mixin(n.mixin({f:"json",renderingRule:JSON.stringify(a.toJson())},this._url.query)),callbackParamName:"callback",
load:n.hitch(this,function(a){var b={};f.forEach(this._rasterFunctionServiceInfoProps,function(c){b[c]=a[c]});return this._rasterFunctionTemplateInfos[c]=b}),error:this._errorHandler})},queryVisibleRasters:function(a,b,c,e){var d=this._map,u=m._fixDfd(new g(m._dfdCanceller));this._visibleRasters=[];var h,k,z=!0,p=this.infoTemplate?this.infoTemplate.info:null,t=p?n.clone(this.infoTemplate.info.fieldInfos):null;b=b||{};if(p&&this.infoTemplate.info.mediaInfos&&this.infoTemplate.info.mediaInfos.length){var q=
[];f.forEach(this.infoTemplate.info.mediaInfos,function(a){q=q.concat(a&&a.value&&a.value.fields||[])});q.length&&f.forEach(t,function(a){a&&-1<q.indexOf(a.fieldName)&&(a.visible=!0)})}if(t&&0<t.length)for(z=!1,h=0;h<t.length;h++)if((k=t[h])&&k.fieldName.toLowerCase()!==this._rasterFieldPrefix.toLowerCase()+"servicepixelvalue"&&(k.visible||p.title&&-1<p.title.toLowerCase().indexOf(k.fieldName.toLowerCase()))){z=!0;break}var l=(k=this._removeVisualizationStretchFunction(this.renderingRule))&&k.functionName,
H=[];if(10.4<=this.version){var I=!1;if(this.rasterFunctionInfos&&t){var r=this._rasterFieldPrefix+this._renderingRuleFieldSubPrefix;f.forEach(this.rasterFunctionInfos,function(a){var b=r+a.name.replace(/ /gi,"_");f.some(t,function(a){return a.visible&&a.fieldName===b})&&(I=I||l&&l===a.name,H.push(new B({rasterFunction:a.name})))})}k&&!I&&H.push(k)}h=new P;h.geometry=a.geometry;h.returnGeometry=this._map.spatialReference.equals(this.spatialReference);h.returnCatalogItems=z;h.timeExtent=a.timeExtent;
this._params.time&&this.mosaicRule?(a=n.clone(this.mosaicRule),a=this._filterOutTimeDimension(a),h.mosaicRule=a):h.mosaicRule=this.mosaicRule||null;h.renderingRule=10.4>this.version&&k||null;h.renderingRules=H||null;d&&(d=new E((d.extent.xmax-d.extent.xmin)/d.width,(d.extent.ymax-d.extent.ymin)/d.height,d.extent.spatialReference),h.pixelSize=d);b.requestParams=h;var F=this,d=new M(this.url);(u._pendingDfd=d.execute(h)).addCallbacks(function(a){F._queryVisibleRastersHandler(a,b,c,e,u)},function(a){F._resolve([a],
null,e,u,!0)});return u},_queryVisibleRastersHandler:function(b,c,e,d,h){function u(){var a=this.getCustomRasterFields(c),b=this._getDomainFields(a),d=c?c.returnDomainValues:!1,u=c&&c.rasterAttributeTableFieldPrefix,p,q,L,l,g,H,I,r,F,M;this._useRenderingRuleAttributeTable&&this.renderingRule?(a=this._getRenderingRuleAttributeTableFeatures({renderingRule:this.renderingRule}),M=J):a=this._getRasterAttributeTableFeatures();a.then(n.hitch(this,function(a){for(p=0;p<t.length;p++){D=t[p];D.setInfoTemplate(this.infoTemplate);
D._layer=this;if(J){F=J.replace(/ /gi,"").split(",");q=J;L=F;m&&m.length>=p&&(q=m[p].replace(/ /gi,", "),L=m[p].split(" "));D.attributes[this._rasterFieldPrefix+"ItemPixelValue"]=L;D.attributes[this._rasterFieldPrefix+"ServicePixelValue"]=F;z&&(D.attributes[this._rasterFieldPrefix+"ServicePixelValue.Raw"]=z.replace(/ /gi,"").split(","));if(this.pixelFilter){var c=new G({height:1,width:1,pixelType:"F32",pixels:[],statistics:[]});f.forEach(L,function(a){c.addData({pixels:[a],statistics:{minValue:a,
maxValue:a,noDataValue:null}})});this.pixelFilter({pixelBlock:c,extent:new w(0,0,0,0,this._map.spatialReference)});if("esriImageServiceDataTypeVector-UV"===this.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===this.serviceDataType)D.attributes[this._rasterFieldPrefix+"Magnitude"]=c.pixels[0][0],D.attributes[this._rasterFieldPrefix+"Direction"]=c.pixels[1][0]}f.forEach(v,function(a){D.attributes[a.name]=a.value});var N=M||q;if(a&&0<a.length&&(l=f.filter(a,function(a){if(a&&a.attributes)return a.attributes.hasOwnProperty("Value")?
a.attributes.Value==N:a.attributes.VALUE==N}),0<l.length&&(g=n.clone(l[0]),u&&g))){r={};for(H in g.attributes)g.attributes.hasOwnProperty(H)&&(I=u+H,r[I]=g.attributes[H]);g.attributes=r;D.attributes=n.mixin(D.attributes,g.attributes)}}d&&b&&0<b.length&&f.forEach(b,function(a){if(a){var b=D.attributes[a.name];k.isDefined(b)&&(b=this._getDomainValue(a.domain,b),k.isDefined(b)&&(D.attributes[a.name]=b))}},this);B.push(D);this._visibleRasters.push(D)}this._resolve([B,null,!0],null,e,h)}))}var J=b.value,
z=b.value,m,t,q=0,l=0,g=this,H=this.objectIdField,r,F,v=[];d=c.requestParams.renderingRules;var M=b.processedValues,A=this.renderingRule&&a.toJson(this._removeVisualizationStretchFunction(this.renderingRule).toJson());if(d&&M&&d.length===M.length){var y=this._rasterFieldPrefix+this._renderingRuleFieldSubPrefix;f.forEach(d,function(b,c){if(b.functionName){var e={name:y+b.functionName.replace(/ /gi,"_"),value:M[c].replace(/ /gi,"").split(",")};v.push(e);A&&A===a.toJson(b.toJson())&&(J=M[c])}})}d=this.infoTemplate&&
this.infoTemplate.info&&this.infoTemplate.info.layerOptions&&this.infoTemplate.info.layerOptions.hasOwnProperty("showNoDataRecords")?this.infoTemplate.info.layerOptions.showNoDataRecords:!0;if(b.catalogItems){var K=0,E,P,C=b.catalogItems.features.length;F=0;t=Array(C);m=Array(C);r=Array(C);for(q=0;q<C;q++)-1<b.properties.Values[q].toLowerCase().indexOf("nodata")&&F++;E=C-F;for(q=0;q<C;q++)F=!0,-1<b.properties.Values[q].toLowerCase().indexOf("nodata")?(P=E++,d||(F=!1,t.length--,m.length--,r.length--)):
P=K++,F&&(t[P]=b.catalogItems.features[q],m[P]=b.properties.Values[q],r[P]=t[P].attributes[H])}this._visibleRasters=[];var D;(b=-1<J.toLowerCase().indexOf("nodata"))&&!d&&(t=[],m=[],r=[]);!J||t||b||(H="ObjectId",t=[],D=new I(new w(this.fullExtent),null,{ObjectId:0}),t.push(D));var B=[];t?!this._map.spatialReference.equals(this.spatialReference)&&r&&0<r.length?p({url:this._url.path+"/query",content:{f:"json",objectIds:r.join(","),returnGeometry:!0,outSR:a.toJson(g._map.spatialReference.toJson()),outFields:H},
handleAs:"json",callbackParamName:"callback",load:function(a){if(0===a.features.length)g._resolve([B,null,null],null,e,h);else{for(q=0;q<a.features.length;q++)for(l=0;l<t.length;l++)t[l].attributes[H]==a.features[q].attributes[H]&&(t[l].geometry=new x(a.features[q].geometry),t[l].geometry.setSpatialReference(g._map.spatialReference));u.call(g)}},error:function(a){g._resolve([B,null,null],null,e,h)}}):u.call(this):this._resolve([B,null,null],null,e,h)},getVisibleRasters:function(){var a=this._visibleRasters,
b=[],c;for(c in a)a.hasOwnProperty(c)&&b.push(a[c]);return b},_getDomainFields:function(a){if(a){var b=[];f.forEach(a,function(a){if(a.domain){var c={};c.name=a.name;c.domain=a.domain;b.push(c)}});return b}},_getDomainValue:function(a,b){if(a&&a.codedValues){var c;f.some(a.codedValues,function(a){return a.code===b?(c=a.name,!0):!1});return c}},_requestData:function(a,b,c){this._rasterReadPromise&&this._rasterReadPromise.cancel();a=n.clone(a);var e=a._normalize(!0);this._prepareGetImageParameters(e,
b,c);b=n.clone(this._params);this._cleanupRequestParams(b);b.extent=a;b.format=b.format||(10.3<=this.version?"lerc":"jpgpng");"lerc"===b.format.toLowerCase()&&!b.lercVersion&&10.5<=this.version&&(b.lercVersion=2);c=null;this._useBrowserDecoding()&&(c=new D({ctx:this._context}));b={imageServiceParameters:b,nBands:Math.min(this.bandCount,3),pixelType:this.pixelType,decodeFunc:c?n.hitch(c,"decode"):null};this._rasterReadPromise=this.raster.read(b,this._requestDataHandler,this._requestDataErrorHandler)},
_requestDataHandler:function(a){this._rasterReadPromise&&this._rasterReadPromise.isCanceled()||(this.originalPixelData=a,this.hasDataChanged=!0,this._setPixelData(a))},_setPixelData:function(a){a=this._clonePixelData(a);this.pixelFilter&&this.pixelFilter(a);this.pixelData=a;this._rasterReadPromise&&this._rasterReadPromise.isCanceled()||(this._drawPixelData(),this._rasterReadPromise=null)},_clonePixelData:function(a){if(null===a||void 0===a)return a;var b={};a.extent&&(b.extent=n.clone(a.extent));
a=a.pixelBlock;if(null===a||void 0===a)return b;b.pixelBlock=a.clone();return b},_setDefaultFilter:function(){},_getPixelBlockFromCanvas:function(a,b,c){a=a.getImageData(0,0,b,c).data;for(var e=b*c,d=0,f=0,h=new Uint8Array(e),k=new Uint8Array(e),u=new Uint8Array(e),p=new Uint8Array(e),m=Infinity,t=Infinity,z=Infinity,q=-Infinity,g=-Infinity,l=-Infinity,H,n,I,d=0;d<e;d++)H=a[f++],n=a[f++],I=a[f++],m=m<H?m:H,q=q>H?q:H,t=t<n?t:n,g=g>n?g:n,z=z<I?z:I,l=l>I?l:I,h[d]=H,k[d]=n,u[d]=I,p[d]=a[f++]&1;return new G({width:b,
height:c,pixels:[h,k,u],pixelType:"U8",mask:p,statistics:[{minValue:m,maxValue:q},{minValue:t,maxValue:g},{minValue:z,maxValue:l}]})},_useBrowserDecoding:function(){return(void 0===this.pixelFilter||null===this.pixelFilter)&&("jpeg"===this.format.toLowerCase()||"jpg"===this.format.toLowerCase()||-1<this.format.toLowerCase().indexOf("png"))},getMultidimensionalInfo:function(){var a=this._url.path+"/multiDimensionalInfo",b=new g(m._dfdCanceller);if(this._multidimensionalInfo)return b.resolve(this._multidimensionalInfo),
b;10.3<=this.version&&this.hasMultidimensions?(b._pendingDfd=p({url:a,content:{f:"json"},handleAs:"json",callbackParamName:"callback"}),b._pendingDfd.then(n.hitch(this,function(a){this._multidimensionalInfo=a.multidimensionalInfo;b.callback(a.multidimensionalInfo)}),function(a){b.errback(a)})):(a=Error("Layer does not support multidimensional info"),a.log=!!c.isDebug,b.errback(a));return b},getDefaultMultidimensionalDefinition:function(){var a,b,c,e=[],d=new g(m._dfdCanceller),f;if(this._defaultMultidimensionalDefinition)return d.resolve(this._defaultMultidimensionalDefinition),
d;d._pendingDfd=this.getMultidimensionalInfo();d._pendingDfd.then(n.hitch(this,function(h){a=h;b=a.variables[0].dimensions;for(c in b)b.hasOwnProperty(c)&&"StdTime"!==b[c].name&&(f=b[c],e.push(new y({variableName:"",dimensionName:f.name,isSlice:!f.hasRanges,values:[this._getDefaultDimensionValue(f)]})));this._defaultMultidimensionalDefinition=e;d.callback(e)}),function(a){d.errback(a)});return d},_getDefaultDimensionValue:function(a){if(a&&a.values&&a.values.length){var b,c,e=Infinity,d,f;if(a.hasRanges)return a.values[0];
if(a.name&&"stdz"===a.name.toLowerCase()){for(f=0;f<a.values.length&&(d=a.values[f],c=Math.abs(d-0),c<e&&(e=c,b=d),0!==c);f++);return b}return a.extent[0]}},_setDefaultMultidimensionalDefinition:function(a){var b,c={};this.getDefaultMultidimensionalDefinition().then(n.hitch(this,function(e){b=e;0<b.length&&(this.mosaicRule?(c=n.clone(this.mosaicRule),c.multidimensionalDefinition=b):this.defaultMosaicRule?(c=n.clone(this.defaultMosaicRule),c.multidimensionalDefinition=b):c=new C({multidimensionalDefinition:b}),
this.setMosaicRule(c,a))}))},_setDefaultRenderingRule:function(a){var b={};if(!this.renderingRule&&"esri.layers.ArcGISImageServiceVectorLayer"!==this.declaredClass&&!this.bandIds&&this.rasterFunctionInfos&&this.rasterFunctionInfos.length&&"none"!==this.rasterFunctionInfos[0].name.toLowerCase())b.rasterFunction=this.rasterFunctionInfos[0].name;else if(!this.renderingRule&&"esri.layers.ArcGISImageServiceVectorLayer"===this.declaredClass&&10.3<this.version){var c="esriImageServiceDataTypeVector-UV"===
this.serviceDataType?7:10;b.rasterFunction="Resample";b.rasterFunctionArguments={ResamplingType:c,InputCellSize:{x:this.pixelSizeX,y:this.pixelSizeY}}}b.hasOwnProperty("rasterFunction")&&(this.defaultRenderingRule=new B(b),this.setRenderingRule(this.defaultRenderingRule,a))},_cleanupRequestParams:function(b){if(!b)return b;if(b.time&&b.mosaicRule){var c=new C(a.fromJson(b.mosaicRule)),c=this._filterOutTimeDimension(c);b.mosaicRule=a.toJson(c.toJson())}var c="displayOnPan drawMode styling id opacity visible resourceInfo useMapDimensionValue extent renderer".split(" "),
e;for(e in c)b.hasOwnProperty(c[e])&&delete b[c[e]];return b},_filterOutTimeDimension:function(a){if(a&&a.multidimensionalDefinition&&0<a.multidimensionalDefinition.length){var b=f.filter(a.multidimensionalDefinition,function(a){return"StdTime"!==a.dimensionName});a.multidimensionalDefinition=b}return a},_removeVisualizationStretchFunction:function(a){var b=a&&a.functionName;if(!b||"stretch"!==b.toLowerCase())return a;var c=a.functionArguments.Raster;return c&&c.functionName&&f.some(this.rasterFunctionInfos,
function(a){return c.functionName===a.name})?c:a},_isScientificData:function(){return"esriImageServiceDataTypeVector-UV"===this.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===this.serviceDataType||"esriImageServiceDataTypeScientific"===this.serviceDataType},_isVectorData:function(){return"esriImageServiceDataTypeVector-UV"===this.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===this.serviceDataType},_isRasterFunctionInfoAvailable:function(a){return f.some(a&&(this.rasterFunctionInfos||
[]),function(b){return b&&b.name&&b.name.toLowerCase()===a.toLowerCase()})},_createPixelData:function(a){a=new G({width:2,height:2,pixels:a,pixelType:this.pixelType,statistics:a});var b=this.fullExtent.getCenter(),b=new w(b.x,b.y,b.x+this.pixelSizeX,b.y+this.pixelSizeY,this.spatialReference);return{pixelBlock:a,extent:b}},_convertRendererToRenderingRule:function(a){var b=a&&a.declaredClass;if(!b||"esri.renderer.UniqueValueRenderer"!==b&&"esri.renderer.ClassBreaksRenderer"!==b&&"esri.renderer.StretchRenderer"!==
b)return null;var c=null;"esri.renderer.StretchRenderer"===b?c=a.toRenderingRule({convertToColormap:10.6>this.version}):"esri.renderer.ClassBreaksRenderer"===b?c=this._convertClassifyRenderer(a):"esri.renderer.UniqueValueRenderer"===b&&(c=this._convertUniqueValueRenderer(a));return c},_getValueField:function(a){if(a&&a.length){var b,c;f.some(a,function(a){if((c=a.name)&&"value"===c.toLowerCase())return b=c,!0});return b}},_convertClassifyRenderer:function(a){var b,c=[],e=[],d=[],h=[],k;b=this.renderingRule&&
this.renderingRule.functionName;var p,m,t=this.hasRasterAttributeTable,q,g;b&&(t=this._rasterFunctionTemplateInfos[b]?this._rasterFunctionTemplateInfos[b].hasRasterAttributeTable:this.hasRasterAttributeTable,m=this._renderingRuleAttributeTable[b],g=this._rasterFunctionTemplateInfos[b]);p=m&&m.features?m.features:this._rasterAttributeTableFeatures;q=this._getValueField(m&&m.fields?m.fields:this._rasterAttributeTableFields);t&&p?(f.forEach(a.infos,function(b,c){var e,d=b.symbol.color;d.a&&f.forEach(p,
function(f){e=f.attributes[a.attributeField];(e>=b.minValue&&e<b.maxValue||c===a.infos.length-1&&e>=b.minValue)&&h.push([f.attributes[q],d.r,d.g,d.b])},this)},this),b=g&&g.pixelType||this.pixelType,this._adjustColormapToPixelTypeRange(h,b),b=new B,b.functionName="Colormap",b.functionArguments={},b.functionArguments.Colormap=h,b.variableName="Raster"):(f.forEach(a.infos,function(a,b){k=a.symbol&&a.symbol.color;k.a?(c.push.call(c,a.minValue,a.maxValue),e.push(b),h.push([b,k.r,k.g,k.b])):d.push(a.minValue,
a.maxValue)}),b=new B,b.functionName="Remap",b.functionArguments={InputRanges:c,OutputValues:e,NoDataRanges:d},b.variableName="Raster",m=new B,m.functionName="Colormap",m.functionArguments={Colormap:h,Raster:b},b=m);return b},_convertUniqueValueRenderer:function(a){var b=[],c=this.renderingRule&&this.renderingRule.functionName,e,d,h,k;c&&(d=this._renderingRuleAttributeTable[c],k=this._rasterFunctionTemplateInfos[c]);e=d&&d.features?d.features:this._rasterAttributeTableFeatures;h=this._getValueField(d&&
d.fields?d.fields:this._rasterAttributeTableFields);f.forEach(a.infos,function(c){var d=c.symbol.color;d.a&&(a.attributeField!==h&&e?f.forEach(e,function(e){e.attributes[a.attributeField]==c.value&&b.push([e.attributes[h],d.r,d.g,d.b])},this):b.push([c.value,d.r,d.g,d.b]))},this);this._adjustColormapToPixelTypeRange(b,k&&k.pixelType||this.pixelType);c=new B;c.functionName="Colormap";c.functionArguments={};c.functionArguments.Colormap=b;c.variableName="Raster";return c},_adjustColormapToPixelTypeRange:function(a,
b){var c=this._pixelTypeRanges[b];c&&a.push([Math.floor(c[0]-1),0,0,0],[Math.ceil(c[1]+1),0,0,0]);return a},_combineRenderingRule:function(a,b){if(!a||!b)return a||b;var c=function(a){var b=a.Raster;return b=b&&"esri.layers.RasterFunction"===b.declaredClass?c(b.functionArguments):a},e=n.clone(a);c(e.functionArguments).Raster=b;return e},_resolve:function(a,b,c,e,d){b&&this[b].apply(this,a);c&&c.apply(null,a);e&&m._resDfd(e,a,d)},_toggleTime:function(){var a=this._map;this.timeInfo&&this.useMapTime&&
a&&!this.suspended?(this._timeConnect||(this._timeConnect=d.connect(a,"onTimeExtentChange",this,this._onTimeExtentChangeHandler)),this._setTime(a.timeExtent)):(d.disconnect(this._timeConnect),this._timeConnect=null,this._setTime(null))},setUseMapTime:function(a,b){this.useMapTime=a;this._toggleTime();!b&&this._map&&this.refresh(!0)},_setTime:function(a){this._params&&(this._params.time=a?a.toJson().join(","):null)},_onTimeExtentChangeHandler:function(a){this.suspended||(this._setTime(a),this.refresh(!0))},
handleSpatialReferenceChange:function(){this.onSpatialReferenceChange()}});b("extend-esri")&&n.setObject("layers.ImageServiceLayerMixin",l,t);return l})},"esri/layers/MosaicRule":function(){define("dojo/_base/declare dojo/_base/lang dojo/has ../kernel ../lang ../geometry/Point".split(" "),function(l,n,g,f,a,c){var d=l(null,{declaredClass:"esri.layers.MosaicRule",method:null,where:null,sortField:null,sortValue:null,ascending:!1,lockRasterIds:null,viewpoint:null,objectIds:null,operation:null,multidimensionalDefinition:[],
constructor:function(a){n.isObject(a)&&(n.mixin(this,a),a.mosaicMethod&&(this.method=a.mosaicMethod),this.method&&"esri"!==this.method.toLowerCase().substring(0,4)&&(this.method=this._getMethodEnum(this.method)),a.mosaicOperation&&(this.operation=a.mosaicOperation),this.operation&&"MT_"!==this.operation.toUpperCase().substring(0,3)&&(this.operation=this._getOperatorEnum(this.operation)),a.fids&&(this.objectIds=a.fids),a.viewpoint&&(this.viewpoint=new c(a.viewpoint)),this.multidimensionalDefinition=
a.multidimensionalDefinition||[])},toJson:function(){var b=null,c=this.multidimensionalDefinition?this.multidimensionalDefinition.length:0;if(c)for(var b=[],d=0;d<c;d++)b.push("esri.layers.DimensionalDefinition"===this.multidimensionalDefinition[d].declaredClass?this.multidimensionalDefinition[d].toJson():this.multidimensionalDefinition[d]);b={mosaicMethod:this.method,where:this.where,sortField:this.sortField,sortValue:this.sortValue,ascending:this.ascending,lockRasterIds:this.lockRasterIds,viewpoint:this.viewpoint?
this.viewpoint.toJson():null,fids:this.objectIds,mosaicOperation:this.operation,multidimensionalDefinition:b};return a.filter(b,function(a){if(null!==a)return!0})},_getMethodEnum:function(a){if(a){var b=d.METHOD_NONE;switch(a.toLowerCase()){case "byattribute":b=d.METHOD_ATTRIBUTE;break;case "center":b=d.METHOD_CENTER;break;case "lockraster":b=d.METHOD_LOCKRASTER;break;case "nadir":b=d.METHOD_NADIR;break;case "northwest":b=d.METHOD_NORTHWEST;break;case "seamline":b=d.METHOD_SEAMLINE;break;case "viewpoint":b=
d.METHOD_VIEWPOINT}return b}},_getOperatorEnum:function(a){if(a)switch(a.toLowerCase()){case "first":return d.OPERATION_FIRST;case "last":return d.OPERATION_LAST;case "max":return d.OPERATION_MAX;case "min":return d.OPERATION_MIN;case "blend":return d.OPERATION_BLEND;case "mean":return d.OPERATION_MEAN;case "sum":return d.OPERATION_SUM}}});n.mixin(d,{METHOD_NONE:"esriMosaicNone",METHOD_CENTER:"esriMosaicCenter",METHOD_NADIR:"esriMosaicNadir",METHOD_VIEWPOINT:"esriMosaicViewpoint",METHOD_ATTRIBUTE:"esriMosaicAttribute",
METHOD_LOCKRASTER:"esriMosaicLockRaster",METHOD_NORTHWEST:"esriMosaicNorthwest",METHOD_SEAMLINE:"esriMosaicSeamline",OPERATION_FIRST:"MT_FIRST",OPERATION_LAST:"MT_LAST",OPERATION_MIN:"MT_MIN",OPERATION_MAX:"MT_MAX",OPERATION_MEAN:"MT_MEAN",OPERATION_BLEND:"MT_BLEND",OPERATION_SUM:"MT_SUM"});g("extend-esri")&&n.setObject("layers.MosaicRule",d,f);return d})},"esri/layers/DimensionalDefinition":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/has","../kernel","../lang"],function(l,n,g,
f,a){l=l(null,{declaredClass:"esri.layers.DimensionalDefinition",variableName:null,dimensionName:null,values:[],isSlice:!1,constructor:function(a){n.isObject(a)&&n.mixin(this,a)},toJson:function(){return a.filter({variableName:this.variableName,dimensionName:this.dimensionName,values:this.values,isSlice:this.isSlice},function(a){return null!==a})}});g("extend-esri")&&n.setObject("layers.DimensionalDefinition",l,f);return l})},"esri/layers/Raster":function(){define("require dojo/_base/declare dojo/_base/lang dojo/_base/Deferred dojo/_base/array dojo/_base/config dojo/json dojo/sniff ../kernel ../Evented ../request ../geometry/Extent ../SpatialReference ../deferredUtils ./PixelBlock ./rasterFormats/LercCodec ./rasterFormats/Lerc2Codec".split(" "),
function(l,n,g,f,a,c,d,b,e,h,t,q,k,p,m,r,w){var E,x,C,B,y,A;n=n(h,{declaredClass:"esri.layers.Raster",imageServiceUrl:null,validPixelTypes:"U1 U2 U4 U8 U16 U32 S8 S16 S32 F32".split(" "),validFormats:"lerc jpeg jpg jpgpng png png8 png24 png32 bip bsq tiff".split(" "),_eventMap:{"raster-read-complete":["pixelData","params"]},constructor:function(a){this.imageServiceUrl=a;this.registerConnectEvents();this._loadRasterFormatModules()},read:function(c,d,e){var h=this,k=new f(p._dfdCanceller);if(10>b("ie"))throw"This browser is not supported.";
if(!c.imageServiceParameters)throw"Insufficient parameters to read data";var m=g.clone(c.imageServiceParameters),q=c.pixelType;a.some(this.validPixelTypes,function(a){return a===q})||(m.pixelType="F32");a.some(this.validFormats,function(a){return a.toLowerCase()===m.format.toLowerCase()})||(m.format="lerc");var l=c.decodeFunc,J;this._prepareGetImageParameters(m);var n=m.width,H=m.height,I=m.extent;delete m.width;delete m.height;delete m.extent;k._pendingDfd=t({url:this.imageServiceUrl+"/exportImage",
handleAs:"arraybuffer",content:g.mixin(m,{f:"image"}),load:function(a){h.decode(a,{width:n,height:H,planes:null,pixelType:q,noDataValue:m.noData,format:m.format,decodeFunc:l}).then(function(a){J={pixelBlock:a,extent:I};h._resolve([J,m],"onRasterReadComplete",d,k)},function(a){h._resolve([a],null,e,k,!0)})},error:function(a){h._resolve([a],null,e,k,!0)}});return k.promise},decode:function(a,b){if(void 0===b||null===b)throw"missing decode options";var c,d;b.format&&(c=b.format.toUpperCase());"BSQ"!==
c&&"BIP"!==c&&(c=this._getFormat(a));d=b.decodeFunc;if(void 0===d||null===d)d=this._getFormatDecoderDfd(c);return d(a,b)},onRasterReadComplete:function(){},_prepareGetImageParameters:function(a){if(a.size&&a.bbox){var b=a.size.split(",");a.width=parseFloat(b[0]);a.height=parseFloat(b[1]);a.extent||(b=a.bbox.split(","),a.extent=new q(parseFloat(b[0]),parseFloat(b[1]),parseFloat(b[2]),parseFloat(b[3]),new k(a.bboxSR)))}else{if(!a.width||Math.floor(a.width)!==a.width||!a.height||Math.floor(a.height)!==
a.height)throw"Incorrect Image Dimensions";if(!a.extent||"esri.geometry.Extent"!==a.extent.declaredClass)throw"Incorrect extent";var b=a.extent,c=b.spatialReference.wkid||d.toJson(b.spatialReference.toJson());delete a._ts;g.mixin(a,{bbox:b.xmin+","+b.ymin+","+b.xmax+","+b.ymax,imageSR:c,bboxSR:c,size:a.width+","+a.height},a.disableClientCaching?{_ts:(new Date).getTime()}:{})}},_adjustExtent:function(a,b,c){var d=a.ymax-a.ymin,e=a.xmax-a.xmin;c>=b?a.ymax=a.ymin+e*b/c:a.xmax=a.xmin+d*c/b;return a},
_resolve:function(a,b,c,d,e){b&&this[b].apply(this,a);c&&c.apply(null,a);d&&p._resDfd(d,a,e)},_getFormatDecoderDfd:function(a){var b=null;switch(a){case "LERC":b=this._decodeLerc;break;case "LERC2":b=this._decodeLerc2;break;case "JPEG":b=this._decodeJpeg;break;case "PNG":b=this._decodePng;break;case "BSQ":b=this._decodeBsq;break;case "BIP":b=this._decodeBip;break;case "TIFF":b=this._decodeTiff;break;default:b=function(a,b){throw"The raster format is not supported";}}b=g.hitch(this,b);return function(c,
d){var e=new f;try{var h;"LERC"===a||!0===y?(h=b(c,d),e.resolve(h)):A.then(function(){h=b(c,d);e.resolve(h)})}catch(F){e.reject(F)}return e}},_getFormat:function(a){a=new Uint8Array(a,0,10);var b="";if(255===a[0]&&216===a[1])b="JPEG";else if(137===a[0]&&80===a[1]&&78===a[2]&&71===a[3])b="PNG";else if(67===a[0]&&110===a[1]&&116===a[2]&&90===a[3]&&73===a[4]&&109===a[5]&&97===a[6]&&103===a[7]&&101===a[8]&&32===a[9])b="LERC";else if(76===a[0]&&101===a[1]&&114===a[2]&&99===a[3]&&50===a[4]&&32===a[5])b=
"LERC2";else if(-1<String.fromCharCode.apply(null,a).toLowerCase().indexOf("error"))b="ERROR";else if(73===a[0]&&73===a[1]&&42===a[2]&&0===a[3]||77===a[0]&&77===a[1]&&0===a[2]&&42===a[3])b="TIFF";return b},_validateDecodeParams:function(a){if(!a.height||Math.floor(a.height)!==a.height)throw"Height not provided.";if(!a.width||Math.floor(a.width)!==a.width)throw"Width not provided.";},_decodeJpeg:function(a,b){if(!E)throw"The jpeg decoder module is not loaded.";this._validateDecodeParams(b);var c=(new E).decode(a);
if(!Q(c,b))throw"The decoded image dimensions are incorrect.";var d=[],e,f;for(e=0;e<c.pixels.length;e++)f=c.pixels[e],d.push(this._calculateBandStatistics(f));return new m({width:c.width,height:c.height,pixels:c.pixels,pixelType:"U8",mask:c.mask,statistics:d})},_decodePng:function(a,b){if(!x)throw"The png decoder module is not loaded.";this._validateDecodeParams(b);var c=new Uint8Array(a),d=new x(c),c=new Uint8Array(b.width*b.height*4);d.copyToImageData(c,d.decodePixels());for(var e=d=0,f,e=new Uint8Array(b.width*
b.height),d=0;d<b.width*b.height;d++)e[d]=c[4*d+3];for(var h=new m({width:b.width,height:b.height,pixels:[],pixelType:"U8",mask:e,statistics:[]}),d=0;3>d;d++){f=new Uint8Array(b.width*b.height);for(e=0;e<b.width*b.height;e++)f[e]=c[4*e+d];h.addData({pixels:f,statistics:this._calculateBandStatistics(f)})}return h},_decodeBsq:function(a,b){if(!C)throw"The bsq decoder module is not loaded.";this._validateDecodeParams(b);v=b.noDataValue;b.pixelType=D(b.pixelType);var c=C.decodeBSQ(a,{bandCount:b.planes,
width:b.width,height:b.height,pixelType:G,noDataValue:v}),d=[],e,f=null;for(e=0;e<c.pixels.length;e++)f=c.pixels[e],d.push(this._calculateBandStatistics(f));return new m({width:b.width,height:b.height,pixels:c.pixels,pixelType:b.pixelType,mask:c.maskData,statistics:d})},_decodeBip:function(a,b){this._validateDecodeParams(b);v=b.noDataValue;b.pixelType=D(b.pixelType);var c=C.decodeBIP(a,{bandCount:b.planes,width:b.width,height:b.height,pixelType:G,noDataValue:v}),d=[],e,f=null;for(e=0;e<c.pixels.length;e++)f=
c.pixels[e],d.push(this._calculateBandStatistics(f));return new m({width:b.width,height:b.height,pixels:c.pixels,pixelType:b.pixelType,mask:c.maskData,statistics:d})},_decodeTiff:function(a,b){this._validateDecodeParams(b);v=b.noDataValue;b.pixelType=D(b.pixelType);var c=B.decode(a),d=[],e,f=null;for(e=0;e<c.pixels.length;e++)f=c.pixels[e],d.push(this._calculateBandStatistics(f,c.maskData));return new m({width:c.width,height:c.height,pixels:c.pixels,pixelType:c.pixelType,mask:c.maskData,statistics:d})},
_decodeLerc:function(a,b){this._validateDecodeParams(b);v=b.noDataValue;b.pixelType=D(b.pixelType);for(var c=0,d,e=0,f,h=a.byteLength-10;e<h;){var k=r.decode(a,{inputOffset:e,encodedMaskData:d,returnMask:0===c?!0:!1,returnEncodedMask:0===c?!0:!1,returnFileInfo:!0,pixelType:G,noDataValue:v}),e=k.fileInfo.eofOffset;0===c&&(d=k.encodedMaskData,f=new m({width:b.width,height:b.height,pixels:[],pixelType:b.pixelType,mask:k.maskData,statistics:[]}));c++;if(!Q(k,b))throw"The decoded image dimensions are incorrect";
f.addData({pixels:k.pixelData,statistics:{minValue:k.minValue,maxValue:k.maxValue,noDataValue:k.noDataValue}})}return f},_decodeLerc2:function(a,b){this._validateDecodeParams(b);v=b.noDataValue;b.pixelType=D(b.pixelType);for(var c=0,d,e,f=0,h,k=a.byteLength-10;f<k;){e=w.decode(a,{inputOffset:f,maskData:d,returnFileInfo:!0});f=e.fileInfo.eofOffset;0===c&&(d=e.maskData,h=new m({width:b.width,height:b.height,pixels:[],pixelType:e.fileInfo.pixelType,mask:e.maskData,statistics:[]}));c++;if(!Q(e,b))throw"The decoded image dimensions are incorrect";
h.addData({pixels:e.pixelData,statistics:{minValue:e.minValue,maxValue:e.maxValue,noDataValue:e.noDataValue}})}return h},_calculateBandStatistics:function(a,b){var c=Infinity,e=-Infinity,d=a.length,f,h=0;if(b)for(f=0;f<d;f++)b[f]&&(h=a[f],c=h<c?h:c,e=h>e?h:e);else for(f=0;f<d;f++)h=a[f],c=h<c?h:c,e=h>e?h:e;return{minValue:c,maxValue:e}},_loadRasterFormatModules:function(){y||(A||(A=new f),10>b("ie")?A.isRejected()||A.reject("unsupported browser version"):l(["./rasterFormats/JpgPlus","./rasterFormats/Png",
"./rasterFormats/Raw","./rasterFormats/TiffDecoder","./rasterFormats/Zlib"],function(a,b,c,e){E=a;x=b;C=c;B=e;y=!0;A.isResolved()||A.resolve(!0)}))}});var G=null,v=null,D=function(a){if("U1"===a||"U2"===a||"U4"===a||"U8"===a)return v=Math.pow(2,8)-1,G=Uint8Array,"U8";"U16"===a?(v=v||Math.pow(2,16)-1,G=Uint16Array):"U32"===a?(v=v||Math.pow(2,32)-1,G=Uint32Array):"S8"===a?(v=v||0-Math.pow(2,7),G=Int8Array):"S16"===a?(v=v||0-Math.pow(2,15),G=Int16Array):"S32"===a?(v=v||0-Math.pow(2,31),G=Int32Array):
G=Float32Array;return a},Q=function(a,b){return a.height!==b.height||a.width!==b.width?!1:!0};b("extend-esri")&&g.setObject("layers.Raster",n,e);return n})},"esri/layers/PixelBlock":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/has","../kernel"],function(l,n,g,f){l=l([],{declaredClass:"esri.layers.PixelBlock",planes:null,width:null,height:null,pixelType:null,pixels:[],statistics:[],constructor:function(a){if(a){if(!a.width||Math.floor(a.width)!==a.width)throw"PixelBlock: incorrect width";
if(!a.height||Math.floor(a.height)!==a.height)throw"PixelBlock: incorrect height";if(!a.pixels||!a.statistics)throw"PixelBlock: pixel data or statistics not present";this.width=a.width;this.height=a.height;this.pixels=a.pixels;this.pixelType=a.pixelType||null;this.statistics=a.statistics;this.mask=a.mask||null}},getPlaneCount:function(){return this.pixels.length!==this.statistics.length?console.error("Inconsistent pixel data and statistics"):this.statistics.length},addData:function(a){if(!a.pixels||
!a.statistics)throw"Pixel data or statistics are not present";if(a.pixels.length!==this.width*this.height)throw"Inconsistent pixel data size";this.statistics.push(a.statistics);this.pixels.push(a.pixels)},getAsRGBA:function(){var a=new ArrayBuffer(this.width*this.height*4);switch(this.pixelType){case "S8":case "S16":case "U16":case "S32":case "U32":case "F32":case "F64":this._fillFromNon8Bit(a);break;default:this._fillFrom8Bit(a)}return new Uint8ClampedArray(a)},getAsRGBAFloat:function(){var a=new Float32Array(this.width*
this.height*4);this._fillFrom32Bit(a);return a},clone:function(){var a=new this.constructor;a.width=this.width;a.height=this.height;a.pixelType=this.pixelType;this.mask&&(a.mask=new Uint8Array(this.mask));var c,d;if(this.pixels)for(a.pixels=[],d=this.pixels.length,c=0;c<d;c++)a.pixels[c]=new Float32Array(this.pixels[c]);if(this.statistics)for(a.statistics=[],d=this.statistics.length,c=0;c<d;c++)a.statistics[c]=n.clone(this.statistics[c]);return a},_fillFrom8Bit:function(a){var c=this.pixels,d=this.mask;
if(!a||!c||!c.length)return console.error("Unable to convert to RGBA. The input pixel block is empty.");var b,e,f;b=e=f=c[0];3<=c.length&&(e=c[1],f=c[2]);var c=new Uint32Array(a),t=this.width*this.height;if(b.length!==t)return console.error("Unable to convert to RGBA. The pixelblock is invalid.");if(d&&d.length===t)for(a=0;a<t;a++)d[a]&&(c[a]=-16777216|f[a]<<16|e[a]<<8|b[a]);else for(a=0;a<t;a++)c[a]=-16777216|f[a]<<16|e[a]<<8|b[a]},_fillFromNon8Bit:function(a){var c=this.pixels,d=this.mask,b=this.statistics;
if(!a||!c||!c.length)return console.error("Unable to convert to RGBA. The input pixel block is empty.");var e=1,f=0;b&&0<b.length?(f=b[0].minValue,e=255/(b[0].maxValue-b[0].minValue)):(e=255,"S8"===this.pixelType?(f=-128,e=127):"U16"===this.pixelType?e=65535:"S16"===this.pixelType?(f=-32768,e=32767):"U32"===this.pixelType?e=4294967295:"S32"===this.pixelType?(f=-2147483648,e=2147483647):"F32"===this.pixelType?(f=-3.4*1E39,e=3.4*1E39):"F64"===this.pixelType&&(f=-Number.MAX_VALUE,e=Number.MAX_VALUE),
e=255/(e-f));a=new Uint32Array(a);var b=this.width*this.height,t,q,k;t=c[0];if(t.length!==b)return console.error("Unable to convert to RGBA. The pixelblock is invalid.");if(3<=c.length)if(q=c[1],k=c[2],d&&d.length===b)for(c=0;c<b;c++)d[c]&&(a[c]=-16777216|(k[c]-f)*e<<16|(q[c]-f)*e<<8|(t[c]-f)*e);else for(c=0;c<b;c++)a[c]=-16777216|(k[c]-f)*e<<16|(q[c]-f)*e<<8|(t[c]-f)*e;else if(d&&d.length===b)for(c=0;c<b;c++)q=(t[c]-f)*e,d[c]&&(a[c]=-16777216|q<<16|q<<8|q);else for(c=0;c<b;c++)q=(t[c]-f)*e,a[c]=
-16777216|q<<16|q<<8|q},_fillFrom32Bit:function(a){var c=this.pixels,d=this.mask;if(!a||!c||!c.length)return console.error("Unable to convert to RGBA. The input pixel block is empty.");var b,e,f;b=e=f=c[0];3<=c.length&&(e=c[1],f=c[2]);var t=this.width*this.height;if(b.length!==t)return console.error("Unable to convert to RGBA. The pixelblock is invalid.");var q=0;if(d&&d.length===t)for(c=0;c<t;c++)a[q++]=b[c],a[q++]=e[c],a[q++]=f[c],a[q++]=d[c];else for(c=0;c<t;c++)a[q++]=b[c],a[q++]=e[c],a[q++]=
f[c],a[q++]=255}});g("extend-esri")&&n.setObject("layers.PixelBlock",l,f);return l})},"esri/layers/rasterFormats/LercCodec":function(){define([],function(){var l={defaultNoDataValue:-3.4027999387901484E38,decode:function(g,f){var a;f=f||{};var c=f.inputOffset||0,d=f.encodedMaskData||null===f.encodedMaskData,b={},e=new Uint8Array(g,c,10);b.fileIdentifierString=String.fromCharCode.apply(null,e);if("CntZImage"!=b.fileIdentifierString.trim())throw"Unexpected file identifier string: "+b.fileIdentifierString;
c+=10;e=new DataView(g,c,24);b.fileVersion=e.getInt32(0,!0);b.imageType=e.getInt32(4,!0);b.height=e.getUint32(8,!0);b.width=e.getUint32(12,!0);b.maxZError=e.getFloat64(16,!0);c+=24;if(!d)if(e=new DataView(g,c,16),b.mask={},b.mask.numBlocksY=e.getUint32(0,!0),b.mask.numBlocksX=e.getUint32(4,!0),b.mask.numBytes=e.getUint32(8,!0),b.mask.maxValue=e.getFloat32(12,!0),c+=16,0<b.mask.numBytes){var d=new Uint8Array(Math.ceil(b.width*b.height/8)),e=new DataView(g,c,b.mask.numBytes),h=e.getInt16(0,!0),t=2,
q=0;do{if(0<h)for(;h--;)d[q++]=e.getUint8(t++);else for(var k=e.getUint8(t++),h=-h;h--;)d[q++]=k;h=e.getInt16(t,!0);t+=2}while(t<b.mask.numBytes);if(-32768!==h||q<d.length)throw"Unexpected end of mask RLE encoding";b.mask.bitset=d;c+=b.mask.numBytes}else 0===(b.mask.numBytes|b.mask.numBlocksY|b.mask.maxValue)&&(d=new Uint8Array(Math.ceil(b.width*b.height/8)),b.mask.bitset=d);e=new DataView(g,c,16);b.pixels={};b.pixels.numBlocksY=e.getUint32(0,!0);b.pixels.numBlocksX=e.getUint32(4,!0);b.pixels.numBytes=
e.getUint32(8,!0);b.pixels.maxValue=e.getFloat32(12,!0);c+=16;d=b.pixels.numBlocksX;e=b.pixels.numBlocksY;d+=0<b.width%d?1:0;h=e+(0<b.height%e?1:0);b.pixels.blocks=Array(d*h);for(q=t=0;q<h;q++)for(k=0;k<d;k++){var p=0,e=new DataView(g,c,Math.min(10,g.byteLength-c)),m={};b.pixels.blocks[t++]=m;var r=e.getUint8(0);p++;m.encoding=r&63;if(3<m.encoding)throw"Invalid block encoding ("+m.encoding+")";if(2===m.encoding)c++;else{if(0!==r&&2!==r){r>>=6;m.offsetType=r;if(2===r)m.offset=e.getInt8(1),p++;else if(1===
r)m.offset=e.getInt16(1,!0),p+=2;else if(0===r)m.offset=e.getFloat32(1,!0),p+=4;else throw"Invalid block offset type";if(1===m.encoding)if(r=e.getUint8(p),p++,m.bitsPerPixel=r&63,r>>=6,m.numValidPixelsType=r,2===r)m.numValidPixels=e.getUint8(p),p++;else if(1===r)m.numValidPixels=e.getUint16(p,!0),p+=2;else if(0===r)m.numValidPixels=e.getUint32(p,!0),p+=4;else throw"Invalid valid pixel count type";}c+=p;if(3!=m.encoding)if(0===m.encoding){r=(b.pixels.numBytes-1)/4;if(r!==Math.floor(r))throw"uncompressed block has invalid length";
e=new ArrayBuffer(4*r);p=new Uint8Array(e);p.set(new Uint8Array(g,c,4*r));e=new Float32Array(e);m.rawData=e;c+=4*r}else 1===m.encoding&&(r=Math.ceil(m.numValidPixels*m.bitsPerPixel/8),e=new ArrayBuffer(4*Math.ceil(r/4)),p=new Uint8Array(e),p.set(new Uint8Array(g,c,r)),m.stuffedData=new Uint32Array(e),c+=r)}}b.eofOffset=c;var c=null!=f.noDataValue?f.noDataValue:l.defaultNoDataValue,h=f.encodedMaskData,w=f.returnMask,t=0,q=b.pixels.numBlocksX,k=b.pixels.numBlocksY,m=Math.floor(b.width/q),p=Math.floor(b.height/
k),r=2*b.maxZError,e=Number.MAX_VALUE,E,h=h||(b.mask?b.mask.bitset:null),x,d=new (f.pixelType||Float32Array)(b.width*b.height);w&&h&&(x=new Uint8Array(b.width*b.height));for(var w=new Float32Array(m*p),C,B,y=0;y<=k;y++){var A=y!==k?p:b.height%k;if(0!==A)for(var G=0;G<=q;G++){var v=G!==q?m:b.width%q;if(0!==v){var D=y*b.width*p+G*m,Q=b.width-v,H=b.pixels.blocks[t],I,M;if(2>H.encoding){if(0===H.encoding)I=H.rawData;else{I=H.stuffedData;M=H.bitsPerPixel;E=H.numValidPixels;C=H.offset;B=r;var P=w,u=b.pixels.maxValue,
z=(1<<M)-1,F=0,K=void 0,J=0,L=void 0,N=void 0,O=Math.ceil((u-C)/B);I[I.length-1]<<=8*(4*I.length-Math.ceil(M*E/8));for(K=0;K<E;K++)0===J&&(N=I[F++],J=32),J>=M?(L=N>>>J-M&z,J-=M):(J=M-J,L=(N&z)<<J&z,N=I[F++],J=32-J,L+=N>>>J),P[K]=L<O?C+L*B:u;I=w}M=0}else a=2===H.encoding?0:H.offset;var R;if(h)for(B=0;B<A;B++){D&7&&(R=h[D>>3],R<<=D&7);for(C=0;C<v;C++)D&7||(R=h[D>>3]),R&128?(x&&(x[D]=1),E=2>H.encoding?I[M++]:a,e=e>E?E:e,d[D++]=E):(x&&(x[D]=0),d[D++]=c),R<<=1;D+=Q}else if(2>H.encoding)for(B=0;B<A;B++){for(C=
0;C<v;C++)E=I[M++],e=e>E?E:e,d[D++]=E;D+=Q}else for(e=e>a?a:e,B=0;B<A;B++){for(C=0;C<v;C++)d[D++]=a;D+=Q}if(1===H.encoding&&M!==H.numValidPixels)throw"Block and Mask do not match";t++}}}a=x;x={width:b.width,height:b.height,pixelData:d,minValue:e,maxValue:b.pixels.maxValue,noDataValue:c};a&&(x.maskData=a);f.returnEncodedMask&&b.mask&&(x.encodedMaskData=b.mask.bitset?b.mask.bitset:null);if(f.returnFileInfo&&(x.fileInfo=n(b),f.computeUsedBitDepths)){a=x.fileInfo;R=b.pixels.numBlocksX*b.pixels.numBlocksY;
I={};for(M=0;M<R;M++)c=b.pixels.blocks[M],0===c.encoding?I.float32=!0:1===c.encoding?I[c.bitsPerPixel]=!0:I[0]=!0;b=Object.keys(I);a.bitDepths=b}return x}},n=function(g){return{fileIdentifierString:g.fileIdentifierString,fileVersion:g.fileVersion,imageType:g.imageType,height:g.height,width:g.width,maxZError:g.maxZError,eofOffset:g.eofOffset,mask:g.mask?{numBlocksX:g.mask.numBlocksX,numBlocksY:g.mask.numBlocksY,numBytes:g.mask.numBytes,maxValue:g.mask.maxValue}:null,pixels:{numBlocksX:g.pixels.numBlocksX,
numBlocksY:g.pixels.numBlocksY,numBytes:g.pixels.numBytes,maxValue:g.pixels.maxValue,noDataValue:this.noDataValue}}};return l})},"esri/layers/rasterFormats/Lerc2Codec":function(){define([],function(){var l={unstuff:function(f,a,c,d,b,e,h,t){var q=(1<<c)-1,k=0,p,m=0,g,l;f[f.length-1]<<=8*(4*f.length-Math.ceil(c*d/8));if(b)for(p=0;p<d;p++)0===m&&(l=f[k++],m=32),m>=c?(g=l>>>m-c&q,m-=c):(m=c-m,g=(l&q)<<m&q,l=f[k++],m=32-m,g+=l>>>m),a[p]=b[g];else for(b=Math.ceil((t-e)/h),p=0;p<d;p++)0===m&&(l=f[k++],
m=32),m>=c?(g=l>>>m-c&q,m-=c):(m=c-m,g=(l&q)<<m&q,l=f[k++],m=32-m,g+=l>>>m),a[p]=g<b?e+g*h:t},unstuffLUT:function(f,a,c,d,b,e){var h=(1<<a)-1,t=0,q=0,k=0,p=k=0,m,g=[];f[f.length-1]<<=8*(4*f.length-Math.ceil(a*c/8));for(var l=Math.ceil((e-d)/b),q=0;q<c;q++)0===k&&(m=f[t++],k=32),k>=a?(p=m>>>k-a&h,k-=a):(k=a-k,p=(m&h)<<k&h,m=f[t++],k=32-k,p+=m>>>k),g[q]=p<l?d+p*b:e;g.unshift(d);return g},unstuff2:function(f,a,c,d,b,e,h,t){var q=(1<<c)-1,k=0,p,m=0,g=0,l,n,x;if(b)for(p=0;p<d;p++)0===m&&(n=f[k++],m=32,
g=0),m>=c?(l=n>>>g&q,m-=c,g+=c):(x=c-m,l=n>>>g&q,n=f[k++],m=32-x,l|=(n&(1<<x)-1)<<c-x,g=x),a[p]=b[l];else for(b=Math.ceil((t-e)/h),p=0;p<d;p++)0===m&&(n=f[k++],m=32,g=0),m>=c?(l=n>>>g&q,m-=c,g+=c):(x=c-m,l=n>>>g&q,n=f[k++],m=32-x,l|=(n&(1<<x)-1)<<c-x,g=x),a[p]=l<b?e+l*h:t;return a},unstuffLUT2:function(f,a,c,d,b,e){for(var h=(1<<a)-1,t=0,q=0,k=0,p=0,m=0,g=0,l,n=[],x=Math.ceil((e-d)/b),q=0;q<c;q++)0===p&&(l=f[t++],p=32,g=0),p>=a?(m=l>>>g&h,p-=a,g+=a):(k=a-p,m=l>>>g&h,l=f[t++],p=32-k,m|=(l&(1<<k)-1)<<
a-k,g=k),n[q]=m<x?d+m*b:e;n.unshift(d);return n},originalUnstuff:function(f,a,c,d){var b=(1<<c)-1,e=0,h,g=0,q,k;f[f.length-1]<<=8*(4*f.length-Math.ceil(c*d/8));for(h=0;h<d;h++)0===g&&(k=f[e++],g=32),g>=c?(q=k>>>g-c&b,g-=c):(g=c-g,q=(k&b)<<g&b,k=f[e++],g=32-g,q+=k>>>g),a[h]=q;return a},originalUnstuff2:function(f,a,c,d){var b=(1<<c)-1,e=0,h,g=0,q=0,k,p,m;for(h=0;h<d;h++)0===g&&(p=f[e++],g=32,q=0),g>=c?(k=p>>>q&b,g-=c,q+=c):(m=c-g,k=p>>>q&b,p=f[e++],g=32-m,k|=(p&(1<<m)-1)<<c-m,q=m),a[h]=k;return a}},
n={HUFFMAN_LUT_BITS_MAX:12,computeChecksumFletcher32:function(f){for(var a=65535,c=65535,d=f.length,b=Math.floor(d/2),e=0;b;){var h=359<=b?359:b,b=b-h;do a+=f[e++]<<8,c+=a+=f[e++];while(--h);a=(a&65535)+(a>>>16);c=(c&65535)+(c>>>16)}d&1&&(c+=a+=f[e]<<8);return((c&65535)+(c>>>16)<<16|(a&65535)+(a>>>16))>>>0},readHeaderInfo:function(f,a){var c=a.ptr,d=new Uint8Array(f,c,6),b={};b.fileIdentifierString=String.fromCharCode.apply(null,d);if(0!==b.fileIdentifierString.lastIndexOf("Lerc2",0))throw"Unexpected file identifier string (expect Lerc2 ): "+
b.fileIdentifierString;c+=6;d=new DataView(f,c,52);b.fileVersion=d.getInt32(0,!0);c+=4;3<=b.fileVersion&&(b.checksum=d.getUint32(4,!0),c+=4);d=new DataView(f,c,48);b.height=d.getUint32(0,!0);b.width=d.getUint32(4,!0);b.numValidPixel=d.getUint32(8,!0);b.microBlockSize=d.getInt32(12,!0);b.blobSize=d.getInt32(16,!0);b.imageType=d.getInt32(20,!0);b.maxZError=d.getFloat64(24,!0);b.zMin=d.getFloat64(32,!0);b.zMax=d.getFloat64(40,!0);c+=48;a.headerInfo=b;a.ptr=c;if(3<=b.fileVersion&&(c=this.computeChecksumFletcher32(new Uint8Array(f,
c-48,b.blobSize-14)),c!==b.checksum))throw"Checksum failed.";return!0},readMask:function(f,a){var c=a.ptr,d=a.headerInfo,b=d.width*d.height,e=d.numValidPixel,h=new DataView(f,c,4),d={};d.numBytes=h.getUint32(0,!0);c+=4;if((0===e||b===e)&&0!==d.numBytes)throw"invalid mask";if(0===e)e=new Uint8Array(Math.ceil(b/8)),d.bitset=e,h=new Uint8Array(b),a.pixels.resultMask=h,c+=d.numBytes;else if(0<d.numBytes){var e=new Uint8Array(Math.ceil(b/8)),h=new DataView(f,c,d.numBytes),g=h.getInt16(0,!0),q=2,k=0,p=
0;do{if(0<g)for(;g--;)e[k++]=h.getUint8(q++);else for(p=h.getUint8(q++),g=-g;g--;)e[k++]=p;g=h.getInt16(q,!0);q+=2}while(q<d.numBytes);if(-32768!==g||k<e.length)throw"Unexpected end of mask RLE encoding";h=new Uint8Array(b);for(q=q=g=0;q<b;q++)q&7?(g=e[q>>3],g<<=q&7):g=e[q>>3],g&128&&(h[q]=1);a.pixels.resultMask=h;d.bitset=e;c+=d.numBytes}a.ptr=c;a.mask=d;return!0},readDataOneSweep:function(f,a,c){var d=a.ptr,b=a.headerInfo,e=b.width*b.height,b=b.numValidPixel*n.getDateTypeSize(b.imageType);if(c===
Uint8Array)f=new Uint8Array(f,d,b);else{var h=new ArrayBuffer(b);(new Uint8Array(h)).set(new Uint8Array(f,d,b));f=new c(h)}if(f.length===e)a.pixels.resultPixels=f;else for(a.pixels.resultPixels=new c(e),h=h=c=0;h<e;h++)a.pixels.resultMask[h]&&(a.pixels.resultPixels[h]=f[c++]);a.ptr=d+b;return!0},readHuffman:function(f,a,c){var d=a.headerInfo,b=d.width*d.height,e=this.HUFFMAN_LUT_BITS_MAX,d=new DataView(f,a.ptr,16);a.ptr+=16;if(2>d.getInt32(0,!0))throw"unsupported Huffman version";var h=d.getInt32(4,
!0),l=d.getInt32(8,!0),q=d.getInt32(12,!0);if(l>=q)return!1;var k=new Uint32Array(q-l);n.decodeBits(f,a,k);for(var p=[],m,r,d=l;d<q;d++)m=d-(d<h?0:h),p[m]={first:k[d-l],second:null};d=f.byteLength-a.ptr;k=new ArrayBuffer(4*Math.ceil(d/4));(new Uint8Array(k)).set(new Uint8Array(f,a.ptr,d));f=new Uint32Array(k);var k=0,w,E=0;w=f[0];for(d=l;d<q;d++)m=d-(d<h?0:h),r=p[m].first,0<r&&(p[m].second=w<<k>>>32-r,32-k>=r?(k+=r,32===k&&(k=0,E++,w=f[E])):(k+=r-32,E++,w=f[E],p[m].second|=w>>>32-k));for(var x=0===
a.headerInfo.imageType?128:0,C=a.headerInfo.height,B=a.headerInfo.width,y=0,A=0,G=new g,d=0;d<p.length;d++)void 0!==p[d]&&(y=Math.max(y,p[d].first));A=y>=e?e:y;30<=y&&console.log("WARning, large NUM LUT BITS IS "+y);for(var e=[],v,d=l;d<q;d++)if(m=d-(d<h?0:h),r=p[m].first,0<r)if(w=[r,m],r<=A)for(m=p[m].second<<A-r,v=1<<A-r,l=0;l<v;l++)e[m|l]=w;else for(m=p[m].second,v=G,l=r-1;0<=l;l--)(r=m>>>l&1)?(v.right||(v.right=new g),v=v.right):(v.left||(v.left=new g),v=v.left),0!==l||v.val||(v.val=w[1]);var h=
a.pixels.resultMask,D,p=q=0;0<k&&(E++,k=0);w=f[E];c=new c(b);if(a.headerInfo.numValidPixel===B*C)for(d=l=0;d<C;d++)for(m=0;m<B;m++,l++){b=0;p=D=w<<k>>>32-A;32-k<A&&(p=D|=f[E+1]>>>64-k-A);if(e[p])b=e[p][1],k+=e[p][0];else for(p=D=w<<k>>>32-y,32-k<y&&(p=D|=f[E+1]>>>64-k-y),v=G,p=0;p<y;p++)if(v=(r=D>>>y-p-1&1)?v.right:v.left,!v.left&&!v.right){b=v.val;k=k+p+1;break}32<=k&&(k-=32,E++,w=f[E]);b-=x;b=0<m?b+q:0<d?b+c[l-B]:b+q;b&=255;q=c[l]=b}else for(d=l=0;d<C;d++)for(m=0;m<B;m++,l++)if(h[l]){b=0;p=D=w<<
k>>>32-A;32-k<A&&(p=D|=f[E+1]>>>64-k-A);if(e[p])b=e[p][1],k+=e[p][0];else for(p=D=w<<k>>>32-y,32-k<y&&(p=D|=f[E+1]>>>64-k-y),v=G,p=0;p<y;p++)if(v=(r=D>>>y-p-1&1)?v.right:v.left,!v.left&&!v.right){b=v.val;k=k+p+1;break}32<=k&&(k-=32,E++,w=f[E]);b-=x;b=0<m&&h[l-1]?b+q:0<d&&h[l-B]?b+c[l-B]:b+q;b&=255;q=c[l]=b}a.pixels.resultPixels=c;a.ptr=a.ptr+4*(E+1)+(0<k?4:0)},decodeBits:function(f,a,c,d){var b=a.headerInfo.fileVersion,e=0,h=new DataView(f,a.ptr,5),g=h.getUint8(0);e++;var q=g>>6,k=0===q?4:3-q,p=0<
(g&32)?!0:!1,q=g&31,g=0;if(1===k)g=h.getUint8(e),e++;else if(2===k)g=h.getUint16(e,!0),e+=2;else if(4===k)g=h.getUint32(e,!0),e+=4;else throw"Invalid valid pixel count type";var k=2*a.headerInfo.maxZError,m,n,w;if(p){a.counter.lut++;w=h.getUint8(e);e++;p=Math.ceil((w-1)*q/8);m=Math.ceil(p/4);m=new ArrayBuffer(4*m);n=new Uint8Array(m);a.ptr+=e;n.set(new Uint8Array(f,a.ptr,p));e=new Uint32Array(m);a.ptr+=p;for(h=0;w-1>>>h;)h++;p=Math.ceil(g*h/8);m=Math.ceil(p/4);m=new ArrayBuffer(4*m);n=new Uint8Array(m);
n.set(new Uint8Array(f,a.ptr,p));f=new Uint32Array(m);a.ptr+=p;a=3<=b?l.unstuffLUT2(e,q,w-1,d,k,a.headerInfo.zMax):l.unstuffLUT(e,q,w-1,d,k,a.headerInfo.zMax);3<=b?l.unstuff2(f,c,h,g,a):l.unstuff(f,c,h,g,a)}else a.counter.bitstuffer++,h=q,a.ptr+=e,0<h&&(p=Math.ceil(g*h/8),m=Math.ceil(p/4),m=new ArrayBuffer(4*m),n=new Uint8Array(m),n.set(new Uint8Array(f,a.ptr,p)),f=new Uint32Array(m),a.ptr+=p,3<=b?null==d?l.originalUnstuff2(f,c,h,g):l.unstuff2(f,c,h,g,!1,d,k,a.headerInfo.zMax):null==d?l.originalUnstuff(f,
c,h,g):l.unstuff(f,c,h,g,!1,d,k,a.headerInfo.zMax))},readTiles:function(f,a,c){var d=a.headerInfo,b=d.width,e=d.height,h=d.microBlockSize,d=d.imageType,g=Math.ceil(b/h),l=Math.ceil(e/h);a.pixels.numBlocksY=l;a.pixels.numBlocksX=g;for(var k=a.pixels.ptr=0,p=0,m=0,r=0,w=0,E=0,x=0,C=0,B=k=0,y=0,A=0,x=x=k=x=0,G,v=new c(h*h),e=e%h||h,D=b%h||h,m=0;m<l;m++)for(w=m!==l-1?h:e,r=0;r<g;r++){E=r!==g-1?h:D;y=m*b*h+r*h;A=b-E;x=f.byteLength-a.ptr;p=new DataView(f,a.ptr,Math.min(10,x));G={};x=0;C=p.getUint8(0);x++;
k=C>>6&255;B=C>>2&15;if(B!==(r*h>>3&15))throw"integrity issue";C&=3;if(3<C)throw a.ptr+=x,"Invalid block encoding ("+C+")";if(2===C)a.counter.constant++,a.ptr+=x;else if(0===C){a.counter.uncompressed++;a.ptr+=x;x=w*E*n.getDateTypeSize(d);k=f.byteLength-a.ptr;x=x<k?x:k;k=new ArrayBuffer(x);p=new Uint8Array(k);p.set(new Uint8Array(f,a.ptr,x));G=new c(k);x=0;if(a.pixels.resultMask)for(k=0;k<w;k++){for(p=0;p<E;p++)a.pixels.resultMask[y]&&(a.pixels.resultPixels[y]=G[x++]),y++;y+=A}else for(k=0;k<w;k++){for(p=
0;p<E;p++)a.pixels.resultPixels[y++]=G[x++];y+=A}a.ptr+=x*n.getDateTypeSize(d)}else if(k=n.getDataTypeUsed(d,k),G=n.getOnePixel(G,x,k,p),x+=n.getDateTypeSize(k),3===C)if(a.ptr+=x,a.counter.constantoffset++,a.pixels.resultMask)for(k=0;k<w;k++){for(p=0;p<E;p++)a.pixels.resultMask[y]&&(a.pixels.resultPixels[y]=G),y++;y+=A}else for(k=0;k<w;k++){for(p=0;p<E;p++)a.pixels.resultPixels[y++]=G;y+=A}else if(a.ptr+=x,n.decodeBits(f,a,v,G),x=0,a.pixels.resultMask)for(k=0;k<w;k++){for(p=0;p<E;p++)a.pixels.resultMask[y]&&
(a.pixels.resultPixels[y]=v[x++]),y++;y+=A}else for(k=0;k<w;k++){for(p=0;p<E;p++)a.pixels.resultPixels[y++]=v[x++];y+=A}}},formatFileInfo:function(f){return{fileIdentifierString:f.headerInfo.fileIdentifierString,fileVersion:f.headerInfo.fileVersion,imageType:f.headerInfo.imageType,height:f.headerInfo.height,width:f.headerInfo.width,numValidPixel:f.headerInfo.numValidPixel,microBlockSize:f.headerInfo.microBlockSize,blobSize:f.headerInfo.blobSize,maxZError:f.headerInfo.maxZError,pixelType:n.getPixelType(f.headerInfo.imageType),
eofOffset:f.eofOffset,mask:f.mask?{numBytes:f.mask.numBytes}:null,pixels:{numBlocksX:f.pixels.numBlocksX,numBlocksY:f.pixels.numBlocksY,maxValue:f.headerInfo.zMax,minValue:f.headerInfo.zMin,noDataValue:f.noDataValue}}},constructConstantSurface:function(f){var a=f.headerInfo.zMax,c=f.headerInfo.height*f.headerInfo.width,d=0;if(f.pixels.resultMask)for(d=0;d<c;d++)f.pixels.resultMask[d]&&(f.pixels.resultPixels[d]=a);else for(d=0;d<c;d++)f.pixels.resultPixels[d]=a},getDataTypeArray:function(f){switch(f){case 0:f=
Int8Array;break;case 1:f=Uint8Array;break;case 2:f=Int16Array;break;case 3:f=Uint16Array;break;case 4:f=Int32Array;break;case 5:f=Uint32Array;break;case 6:f=Float32Array;break;case 7:f=Float64Array;break;default:f=Float32Array}return f},getPixelType:function(f){switch(f){case 0:f="S8";break;case 1:f="U8";break;case 2:f="S16";break;case 3:f="U16";break;case 4:f="S32";break;case 5:f="U32";break;case 6:f="F32";break;case 7:f="F64";break;default:f="F32"}return f},isValidPixelValue:function(f,a){if(null===
a||void 0===a)return!1;var c;switch(f){case 0:c=-128<=a&&127>=a;break;case 1:c=0<=a&&255>=a;break;case 2:c=-32768<=a&&32767>=a;break;case 3:c=0<=a&&65536>=a;break;case 4:c=-2147483648<=a&&2147483647>=a;break;case 5:c=0<=a&&4294967296>=a;break;case 6:c=-3.4027999387901484E38<=a&&3.4027999387901484E38>=a;break;case 7:c=4.9E-324<=a&&1.7976931348623157E308>=a;break;default:c=!1}return c},getDateTypeSize:function(f){var a=0;switch(f){case 0:case 1:a=1;break;case 2:case 3:a=2;break;case 4:case 5:case 6:a=
4;break;case 7:a=8;break;default:a=f}return a},getDataTypeUsed:function(f,a){var c=f;switch(f){case 2:case 4:c=f-a;break;case 3:case 5:c=f-2*a;break;case 6:c=0===a?f:1===a?2:1;break;case 7:c=0===a?f:f-2*a+1;break;default:c=f}return c},getOnePixel:function(f,a,c,d){f=0;switch(c){case 0:f=d.getInt8(a);break;case 1:f=d.getUint8(a);break;case 2:f=d.getInt16(a,!0);break;case 3:f=d.getUint16(a,!0);break;case 4:f=d.getInt32(a,!0);break;case 5:f=d.getUInt32(a,!0);break;case 6:f=d.getFloat32(a,!0);break;case 7:f=
d.getFloat64(a,!0);break;default:throw"the decoder does not understand this pixel type";}return f}},g=function(f,a,c){this.val=f;this.left=a;this.right=c};return{decode:function(f,a){a=a||{};var c=a.maskData||null===a.maskData,d=a.noDataValue,b=0,e={};e.ptr=a.inputOffset||0;e.pixels={};if(n.readHeaderInfo(f,e)){var b=e.headerInfo,h=n.getDataTypeArray(b.imageType);if(c)e.pixels.resultMask=a.maskData,e.ptr+=4;else if(!n.readMask(f,e))return;c=b.width*b.height;e.pixels.resultPixels=new h(c);e.counter=
{onesweep:0,uncompressed:0,lut:0,bitstuffer:0,constant:0,constantoffset:0};if(0!==b.numValidPixel)if(b.zMax===b.zMin)n.constructConstantSurface(e);else{var g=new DataView(f,e.ptr,2),l=g.getUint8(0,!0);e.ptr++;l?n.readDataOneSweep(f,e,h):1<b.fileVersion&&1>=b.imageType&&1E-5>Math.abs(b.maxZError-.5)?(g=g.getUint8(1,!0),e.ptr++,g?n.readHuffman(f,e,h):n.readTiles(f,e,h)):n.readTiles(f,e,h)}e.eofOffset=e.ptr;a.inputOffset?(h=e.headerInfo.blobSize+a.inputOffset-e.ptr,1<=Math.abs(h)&&(e.eofOffset=a.inputOffset+
e.headerInfo.blobSize)):(h=e.headerInfo.blobSize-e.ptr,1<=Math.abs(h)&&(e.eofOffset=e.headerInfo.blobSize));h={width:b.width,height:b.height,pixelData:e.pixels.resultPixels,minValue:b.zMin,maxValue:b.zMax,maskData:e.pixels.resultMask};if(e.pixels.resultMask&&n.isValidPixelValue(b.imageType,d)){g=e.pixels.resultMask;for(b=0;b<c;b++)g[b]||(h.pixelData[b]=d);h.noDataValue=d}e.noDataValue=d;a.returnFileInfo&&(h.fileInfo=n.formatFileInfo(e));return h}},getBandCount:function(f){for(var a=0,c=0,d={ptr:0,
pixels:{}};c<f.byteLength-58;)n.readHeaderInfo(f,d),c+=d.headerInfo.blobSize,a++,d.ptr=c;return a}}})},"esri/layers/pixelFilters/VectorFieldPixelFilter":function(){define("dojo/_base/declare dojo/_base/lang dojo/has ../../kernel ../../lang dojo/_base/array".split(" "),function(l,n,g,f,a,c){l=l(null,{declaredClass:"esri.layers.pixelFilters.VectorFieldPixelFilter",speedUnits:["esriMetersPerSecond","esriKilometersPerHour","esriKnots","esriFeetPerSecond","esriMilesPerHour"],constructor:function(a){n.mixin(this,
a);this.isDataUV=a&&a.isDataUV?a.isDataUV:!1;this.computeMagnitudeAndDirection=n.hitch(this,this.computeMagnitudeAndDirection);this.unitConversionFactor=1;this._updateUnitConvFactor()},setUnits:function(a,b){this.inputUnit=a;this.outputUnit=b;this.unitConversionFactor=1;this._updateUnitConvFactor()},_updateUnitConvFactor:function(){var a=c.indexOf(this.speedUnits,this.inputUnit),b=c.indexOf(this.speedUnits,this.outputUnit);if(this.inputUnit&&this.outputUnit&&0<=a&&0<=b){var e=[1,.277778,.514444,.3048,
.44704,0];this.unitConversionFactor=e[a]/e[b]}},computeMagnitudeAndDirection:function(c){if(!a.isDefined(c))throw"Could not compute magnitude and direction. No pixel data is available.";var b=c.pixelBlock;if(!a.isDefined(b)||2!==b.getPlaneCount())throw"Could not compute magnitude and direction. Pixel data does not contain two bands.";var e=c.extent,d=(e.xmax-e.xmin)/b.width,f=(e.ymax-e.ymin)/b.height,g=e.xmin+d/2,e=e.ymax-f/2;b.statistics[0].minValue=0;b.statistics[0].maxValue=0;var k=180/Math.PI,
l=[],m=0,n=0,w=0,E=!a.isDefined(b.mask),x,C,B,y,A,G,v,D;A=v=Infinity;G=D=-Infinity;for(m=0;m<b.height;m++)for(n=0;n<b.width;n++,w++)if(l.push([g+d*n,e-f*m]),E||b.mask[w])B=x=b.pixels[0][w]*this.unitConversionFactor,y=C=b.pixels[1][w],this.isDataUV&&(B=Math.sqrt(x*x+C*C),y=90-k*Math.atan2(C,x),b.pixels[0][w]=B*this.unitConversionFactor,b.pixels[1][w]=y),B>G&&(G=B),B<A&&(A=B),y>D&&(D=y),y<v&&(v=y);b.statistics[0].maxValue=G;b.statistics[0].minValue=A;b.statistics[1].maxValue=D;b.statistics[1].minValue=
v;c.locations=l;return c}});g("extend-esri")&&n.setObject("layers.pixelFilters.VectorFieldPixelFilter",l,f);return l})},"esri/layers/rasterFormats/ImageCanvasDecoder":function(){define(["require","dojo/_base/declare","dojo/Deferred","dojo/sniff"],function(l,n,g,f){var a;return n(null,{constructor:function(a){this.ctx=a.ctx;this._loadRasterFormatModule()},decode:function(a,d){if(!d.width||!d.height)throw"Native decoding requires the image format, width and height";var b=new g,c,f=new Uint8Array(a),
l=this._getFormat(a);if("error"===l)throw"invalid format";"jpeg"===l&&(c=this._getMask(f,d));var q="",k,p;for(k=0;k<f.length;k+=65535)p=f.subarray(k,k+65535>f.length-1?f.length-1:k+65535),q+=String.fromCharCode.apply(null,p);var f="data:image/"+l+";base64,"+window.btoa(q),m=new Image,n;m.src=f;var w=this;m.onload=function(){w.ctx.clearRect(0,0,d.width,d.height);w.ctx.drawImage(m,0,0);var a=w.ctx.getImageData(0,0,m.width,m.height);n=a.data;if(c)for(k=0;k<c.length;k++)n[4*k+3]=c[k]?255:0;w.ctx.putImageData(a,
0,0);b.resolve(null)};m.onerror=function(){b.reject("cannot load image")};return b},_getFormat:function(a){a=new Uint8Array(a,0,10);var c="error";255===a[0]&&216===a[1]?c="jpeg":137===a[0]&&80===a[1]&&78===a[2]&&71===a[3]&&(c="png");return c},_getMask:function(c,d){var b;try{if(!a)throw"The zlib decoder module is not loaded.";var e=0,f=0,g=Math.round(c.length/2);1===g%2&&(g+=1);for(var l=c.length-2,e=g;e<l&&(255!==c[e]||217!==c[e+1]);e++);g=e+=2;if(g<c.length-1){var k=(new a(c.subarray(g))).getBytes();
b=new Uint8Array(d.width*d.height);for(e=g=0;e<k.length;e++)for(f=7;0<=f;f--)b[g++]=k[e]>>f&1}}catch(p){}return b},_loadRasterFormatModule:function(){10>f("ie")||l(["./Zlib"],function(c){a=c})}})})},"esri/tasks/ImageServiceIdentifyTask":function(){define("dojo/_base/declare dojo/_base/lang dojo/has ../kernel ../request ../geometry/normalizeUtils ./Task ./ImageServiceIdentifyResult".split(" "),function(l,n,g,f,a,c,d,b){l=l(d,{declaredClass:"esri.tasks.ImageServiceIdentifyTask",constructor:function(a){this._url.path+=
"/identify";this._handler=n.hitch(this,this._handler)},__msigns:[{n:"execute",c:3,a:[{i:0,p:["geometry"]}],e:2}],_handler:function(a,c,d,f,k){try{var e=new b(a);this._successHandler([e],"onComplete",d,k)}catch(m){this._errorHandler(m,f,k)}},execute:function(b,c,d,f){var e=f.assembly;b=this._encode(n.mixin({},this._url.query,{f:"json"},b.toJson(e&&e[0])));var h=this._handler,g=this._errorHandler;return a({url:this._url.path,content:b,callbackParamName:"callback",load:function(a,b){h(a,b,c,d,f.dfd)},
error:function(a){g(a,d,f.dfd)}})},onComplete:function(){}});c._createWrappers(l);g("extend-esri")&&n.setObject("tasks.ImageServiceIdentifyTask",l,f);return l})},"esri/tasks/Task":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/json dojo/has ../kernel ../deferredUtils ../urlUtils ../Evented".split(" "),function(l,n,g,f,a,c,d,b){l=l(b,{declaredClass:"esri.tasks._Task",_eventMap:{error:["error"],complete:["result"]},constructor:function(a,b){a&&n.isString(a)&&(this._url=d.urlToObject(this.url=
a));b&&b.requestOptions&&(this.requestOptions=b.requestOptions);this.normalization=!0;this._errorHandler=n.hitch(this,this._errorHandler);this.registerConnectEvents()},_useSSL:function(){var a=this._url,b=/^http:/i;this.url&&(this.url=this.url.replace(b,"https:"));a&&a.path&&(a.path=a.path.replace(b,"https:"))},_encode:function(a,b,c){var e,d,f={},h,l;for(h in a)if("declaredClass"!==h&&(e=a[h],d=typeof e,null!==e&&void 0!==e&&"function"!==d))if(n.isArray(e))for(f[h]=[],l=e.length,d=0;d<l;d++)f[h][d]=
this._encode(e[d]);else"object"===d?e.toJson&&(d=e.toJson(c&&c[h]),"esri.tasks.FeatureSet"===e.declaredClass&&d.spatialReference&&(d.sr=d.spatialReference,delete d.spatialReference),f[h]=b?d:g.toJson(d)):f[h]=e;return f},_successHandler:function(a,b,d,f){b&&this[b].apply(this,a);d&&d.apply(null,a);f&&c._resDfd(f,a)},_errorHandler:function(a,b,c){this.onError(a);b&&b(a);c&&c.errback(a)},setNormalization:function(a){this.normalization=a},onError:function(){}});f("extend-esri")&&(a.Task=l);return l})},
"esri/tasks/ImageServiceIdentifyResult":function(){define("dojo/_base/declare dojo/_base/lang dojo/has ../kernel ../geometry/jsonUtils ./FeatureSet".split(" "),function(l,n,g,f,a,c){l=l(null,{declaredClass:"esri.tasks.ImageServiceIdentifyResult",constructor:function(d){d.catalogItems&&(this.catalogItems=new c(d.catalogItems));d.location&&(this.location=a.fromJson(d.location));this.catalogItemVisibilities=d.catalogItemVisibilities;this.name=d.name;this.objectId=d.objectId;this.value=d.value;this.processedValues=
d.processedValues;this.properties=d.properties}});g("extend-esri")&&n.setObject("tasks.ImageServiceIdentifyResult",l,f);return l})},"esri/tasks/FeatureSet":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/has ../kernel ../lang ../graphic ../SpatialReference ../graphicsUtils ../geometry/jsonUtils ../symbols/jsonUtils".split(" "),function(l,n,g,f,a,c,d,b,e,h,t){l=l(null,{declaredClass:"esri.tasks.FeatureSet",constructor:function(a){if(a){n.mixin(this,a);var c=this.features,
e=a.spatialReference,f=h.getGeometryType(a.geometryType),e=this.spatialReference=new b(e);this.geometryType=a.geometryType;a.fields&&(this.fields=a.fields);g.forEach(c,function(a,b){var h=a.geometry&&a.geometry.spatialReference;c[b]=new d(f&&a.geometry?new f(a.geometry):null,a.symbol&&t.fromJson(a.symbol),a.attributes);c[b].geometry&&!h&&c[b].geometry.setSpatialReference(e)});this._hydrate()}else this.features=[]},displayFieldName:null,geometryType:null,spatialReference:null,fieldAliases:null,toJson:function(a){var b=
{};this.displayFieldName&&(b.displayFieldName=this.displayFieldName);this.fields&&(b.fields=this.fields);this.spatialReference?b.spatialReference=this.spatialReference.toJson():this.features[0]&&this.features[0].geometry&&(b.spatialReference=this.features[0].geometry.spatialReference.toJson());this.features[0]&&(this.features[0].geometry&&(b.geometryType=h.getJsonType(this.features[0].geometry)),b.features=e._encodeGraphics(this.features,a));b.geometryType=b.geometryType||this.geometryType;b.exceededTransferLimit=
this.exceededTransferLimit;b.transform=this.transform;return c.fixJson(b)},_hydrate:function(){var a=this.transform,b=this.geometryType;if(a&&b)for(var c=this.features,d=a.translate[0],e=a.translate[1],f=a.scale[0],h=a.scale[1],g=function(a,b,c){if("esriGeometryPoint"===a)return function(a){a.x=b(a.x);a.y=c(a.y)};if("esriGeometryPolyline"===a||"esriGeometryPolygon"===a)return function(a){a=a.rings||a.paths;var d,e,f,h,g,k,l,m;d=0;for(e=a.length;d<e;d++)for(g=a[d],f=0,h=g.length;f<h;f++)k=g[f],0<f?
(l+=k[0],m+=k[1]):(l=k[0],m=k[1]),k[0]=b(l),k[1]=c(m)};if("esriGeometryEnvelope"===a)return function(a){a.xmin=b(a.xmin);a.ymin=c(a.ymin);a.xmax=b(a.xmax);a.ymax=c(a.ymax)};if("esriGeometryMultipoint"===a)return function(a){a=a.points;var d,e,f,h,g;d=0;for(e=a.length;d<e;d++)f=a[d],0<d?(h+=f[0],g+=f[1]):(h=f[0],g=f[1]),f[0]=b(h),f[1]=c(g)}}(b,function(a){return a*f+d},function(a){return e-a*h}),a=0,b=c.length;a<b;a++)c[a].geometry&&g(c[a].geometry);this.transform=null},quantize:function(a){if(!this.geometryType)return this.transform=
null,this;var b=a.translate[0],c=a.translate[1],d=a.scale[0],e=a.scale[1],f=this.features,h=function(a,b,c){var d,e,f,h,g,k,l=[];d=0;for(e=a.length;d<e;d++)if(f=a[d],0<d){if(k=b(f[0]),f=c(f[1]),k!==h||f!==g)l.push([k-h,f-g]),h=k,g=f}else h=b(f[0]),g=c(f[1]),l.push([h,g]);return 0<l.length?l:null},g=function(a,b,c){if("esriGeometryPoint"===a)return function(a){a.x=b(a.x);a.y=c(a.y);return a};if("esriGeometryPolyline"===a||"esriGeometryPolygon"===a)return function(a){var d,e,f,g,k;f=a.rings||a.paths;
k=[];d=0;for(e=f.length;d<e;d++)g=f[d],(g=h(g,b,c))&&k.push(g);return 0<k.length?(a.rings?a.rings=k:a.paths=k,a):null};if("esriGeometryMultipoint"===a)return function(a){var d;d=h(a.points,b,c);return 0<d.length?(a.points=d,a):null};if("esriGeometryEnvelope"===a)return function(a){return a}}(this.geometryType,function(a){return Math.round((a-b)/d)},function(a){return Math.round((c-a)/e)}),l,n;l=0;for(n=f.length;l<n;l++)f[l].geometry&&(g(f[l].geometry)||f[l].setGeometry(null));this.transform=a;return this}});
f("extend-esri")&&n.setObject("tasks.FeatureSet",l,a);return l})},"esri/tasks/ImageServiceIdentifyParameters":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/json dojo/_base/array dojo/has ../kernel ../lang ../geometry/jsonUtils".split(" "),function(l,n,g,f,a,c,d,b){l=l(null,{declaredClass:"esri.tasks.ImageServiceIdentifyParameters",geometry:null,mosaicRule:null,renderingRule:null,renderingRules:null,pixelSizeX:null,pixelSizeY:null,pixelSize:null,returnGeometry:!1,returnCatalogItems:!0,
timeExtent:null,toJson:function(a){var c=a&&a.geometry||this.geometry;a={geometry:c,returnGeometry:this.returnGeometry,returnCatalogItems:this.returnCatalogItems,mosaicRule:this.mosaicRule?g.toJson(this.mosaicRule.toJson()):null,renderingRule:this.renderingRule?g.toJson(this.renderingRule.toJson()):null};c&&(a.geometryType=b.getJsonType(c));c=this.timeExtent;a.time=c?c.toJson().join(","):null;d.isDefined(this.pixelSizeX)&&d.isDefined(this.pixelSizeY)?a.pixelSize=g.toJson({x:parseFloat(this.pixelSizeX),
y:parseFloat(this.pixelSizeY)}):this.pixelSize&&(a.pixelSize=this.pixelSize?g.toJson(this.pixelSize.toJson()):null);this.renderingRules&&(a.renderingRules=g.toJson(f.map(this.renderingRules,function(a){return a.toJson()})));return a}});a("extend-esri")&&n.setObject("tasks.ImageServiceIdentifyParameters",l,c);return l})},"esri/layers/ImageServiceParameters":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/json dojo/has ../kernel ../lang".split(" "),function(l,n,g,f,a,c){l=l(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(a){var b=this.bbox||this.extent;a=(b=b&&a&&b._normalize(!0))?b.spatialReference.wkid||g.toJson(b.spatialReference.toJson()):null;var d=this.imageSpatialReference,b={bbox:b?b.xmin+","+b.ymin+","+b.xmax+","+b.ymax:
null,bboxSR:a,size:null!==this.width&&null!==this.height?this.width+","+this.height:null,imageSR:d?d.wkid||g.toJson(d.toJson()):a,format:this.format,interpolation:this.interpolation,compressionQuality:this.compressionQuality,bandIds:this.bandIds?this.bandIds.join(","):null,mosaicRule:this.mosaicRule?g.toJson(this.mosaicRule.toJson()):null,renderingRule:this.renderingRule?g.toJson(this.renderingRule.toJson()):null,renderer:this.renderer?g.toJson(this.renderer.toJson()):null,noData:this.noData,noDataInterpretation:this.noDataInterpretation,
compressionTolerance:this.compressionTolerance,adjustAspectRatio:this.adjustAspectRatio,lercVersion:this.lercVersion};a=this.timeExtent;b.time=a?a.toJson().join(","):null;return c.filter(b,function(a){if(null!==a&&void 0!==a)return!0})}});n.mixin(l,{INTERPOLATION_BILINEAR:"RSP_BilinearInterpolation",INTERPOLATION_CUBICCONVOLUTION:"RSP_CubicConvolution",INTERPOLATION_MAJORITY:"RSP_Majority",INTERPOLATION_NEARESTNEIGHBOR:"RSP_NearestNeighbor",NODATA_MATCH_ALL:"esriNoDataMatchAll",NODATA_MATCH_ANY:"esriNoDataMatchAny"});
f("extend-esri")&&n.setObject("layers.ImageServiceParameters",l,a);return l})},"esri/dijit/Basemap":function(){define("dojo/_base/declare dojo/_base/array dojo/_base/lang dojo/has ../kernel ../request ./BasemapLayer".split(" "),function(l,n,g,f,a,c,d){l=l(null,{declaredClass:"esri.dijit.Basemap",id:null,title:"",thumbnailUrl:null,layers:null,itemId:null,basemapGallery:null,constructor:function(a,c){a=a||{};a.layers||a.itemId||console.error("esri.dijit.Basemap: unable to find the 'layers' property in parameters");
this.id=a.id;this.itemId=a.itemId;this.layers=a.layers;this.title=a.title||"";this.thumbnailUrl=a.thumbnailUrl;this.basemapGallery=c},getLayers:function(b){if(this.layers)return this.layers;if(this.itemId)return b=c({url:(b||a.dijit._arcgisUrl)+"/content/items/"+this.itemId+"/data",content:{f:"json"},callbackParamName:"callback",error:g.hitch(this,function(a,b){if(this.basemapGallery)this.basemapGallery.onError("esri.dijit.Basemap: could not access basemap item.");else console.error("esri.dijit.Basemap: could not access basemap item.")})}),
b.addCallback(g.hitch(this,function(a,b){if(a.baseMap)return this.layers=[],n.forEach(a.baseMap.baseMapLayers,function(a){this.layers.push(new d(a))},this),this.layers;if(this.basemapGallery)this.basemapGallery.onError("esri.dijit.Basemap: could not access basemap item.");else console.error("esri.dijit.Basemap: could not access basemap item.");return[]})),b}});f("extend-esri")&&g.setObject("dijit.Basemap",l,a);return l})},"esri/dijit/BasemapLayer":function(){define(["dojo/_base/declare","dojo/_base/lang",
"dojo/has","../kernel"],function(l,n,g,f){l=l(null,{declaredClass:"esri.dijit.BasemapLayer",constructor:function(a){a=a||{};a.url||a.type||console.error("esri.dijit.BasemapLayer: unable to find the 'url' or 'type' property in parameters");this.url=a.url;this.type=a.type;this.isReference=!0===a.isReference?!0:!1;this.opacity=a.opacity;this.visibleLayers=a.visibleLayers;this.displayLevels=a.displayLevels;this.exclusionAreas=a.exclusionAreas;this.bandIds=a.bandIds;this.templateUrl=a.templateUrl;this.copyright=
a.copyright;this.subDomains=a.subDomains;this.fullExtent=a.fullExtent;this.initialExtent=a.initialExtent;this.tileInfo=a.tileInfo;this.tileServers=a.tileServers;this.styleUrl=a.styleUrl}});g("extend-esri")&&n.setObject("dijit.BasemapLayer",l,f);return l})},"esri/dijit/_EventedWidget":function(){define("dojo/_base/declare dojo/_base/lang dojo/aspect dojo/on ../Evented dijit/_WidgetBase".split(" "),function(l,n,g,f,a,c){return l([c,a],{_onMap:function(a){var b=this.constructor._onMap,c;b&&b.FINAL||
(delete this.constructor._onMap,b=this.registerConnectEvents(),b.FINAL=!0);a=a.toLowerCase();b[a]?c=this[b[a].method]:(a=this._onCamelCase(a),this[a]&&(c=a));return c},on:function(a,b){var c=this._onMap(a),d=a.replace(/\-/g,""),g="on"+d in this.domNode;return c||!g?this.inherited(arguments):this.own(f(this.domNode,d,b))[0]},emit:function(a,b,c){var d,e,f,g=a.toLowerCase(),l=this.constructor._onMap||this.registerConnectEvents();e=this[this._onMap(g)];b=b||{};b.target||(b.target=this);e&&l&&l[g]&&(this._onObj2Arr(function(){d=
Array.prototype.slice.call(arguments)},l[g].argKeys)(b),f=n.mixin({},arguments),f[2]=d,f[0]=l[g].name.replace(/^on/,""));return this.inherited(f||arguments)}})})},"url:esri/dijit/templates/BasemapGallery.html":'\x3cdiv class\x3d"esriBasemapGallery"\x3e\r\n  \x3cdiv dojoAttachPoint\x3d"flowContainer"\x3e\r\n  \x3c/div\x3e\r\n\x3c/div\x3e',"*noref":1}});
define("esri/dijit/BasemapGallery","require dojo/_base/declare dojo/_base/array dojo/_base/connect dojo/_base/lang dojo/_base/kernel dojo/_base/sniff dojo/has dojo/query dojo/Deferred dojo/DeferredList dojo/dom dojo/dom-construct dojo/dom-class dijit/_Widget dijit/_Templated ../kernel ../lang ../urlUtils ../request ../geometry/Extent ../SpatialReference ../virtualearth/VETiledLayer ../layers/OpenStreetMapLayer ../layers/ArcGISTiledMapServiceLayer ../layers/ArcGISDynamicMapServiceLayer ../layers/WebTiledLayer ../layers/VectorTileLayer ../layers/TileInfo ../layers/ArcGISImageServiceLayer ../layers/ImageServiceParameters ../layers/ImageParameters ./Basemap ./_EventedWidget dojo/text!./templates/BasemapGallery.html".split(" "),function(l,
n,g,f,a,c,d,b,e,h,t,q,k,p,m,r,w,E,x,C,B,y,A,G,v,D,Q,H,I,M,P,u,z,F,K){n=n([F,m,r],{declaredClass:"esri.dijit.BasemapGallery",widgetsInTemplate:!0,templateString:K,loaded:!1,basemaps:[],bingMapsKey:null,flowContainer:null,_hasUI:!1,_supportsVTL:null,_selectedBasemap:null,_selectBasemapInProgress:!1,_eventMap:{load:!0,"selection-change":!0,add:["basemap"],remove:["basemap"],error:["message"]},constructor:function(a,b){a=a||{};a.map||console.error("esri.dijit.BasemapGallery: Unable to find the 'map' property in parameters");
this.map=a.map;this._hasUI=b?!0:!1;this.bingMapsKey=a.bingMapsKey&&0<a.bingMapsKey.length?a.bingMapsKey:null;this.showArcGISBasemaps=!1!==a.showArcGISBasemaps;this.basemaps=a.basemaps||[];this.basemapIds=a.basemapIds;this.referenceIds=a.referenceIds;this.basemapsGroup=a.basemapsGroup;this.arcgisUrl=w.dijit._arcgisUrl;a.portalUrl&&(this.arcgisUrl=a.portalUrl+"/sharing/rest");0>this.arcgisUrl.indexOf("://")?this.arcgisUrl=x.getProtocolForWebResource()+"//"+this.arcgisUrl:"https:"===window.location.protocol&&
(this.arcgisUrl=this.arcgisUrl.replace("http:","https:"));this.init()},init:function(){this.inherited(arguments);g.forEach(this.basemaps,function(a){a.id&&0!==a.id.length||(a.id=this._getUniqueId());g.forEach(a.layers,function(a){a.opacity=0<=a.opacity?a.opacity:1;a.visibility=!0},this)},this);this.basemapIds&&0<this.basemapIds.length&&g.forEach(this.basemapIds,function(a){this.map.getLayer(a)._basemapGalleryLayerType="basemap"},this);this.referenceIds&&0<this.referenceIds.length&&g.forEach(this.referenceIds,
function(a){a=this.map.getLayer(a);a._basemapGalleryLayerType="reference";a.attr("data-reference",!0)},this);this.basemapsGroup&&(this.basemapsGroup.owner&&this.basemapsGroup.title||this.basemapsGroup.id)?this._findCustomBasemapsGroup(a.hitch(this,"_handleArcGISBasemapsResponse")):this.showArcGISBasemaps?this._findArcGISBasemapsGroup(a.hitch(this,"_handleArcGISBasemapsResponse")):this._finishStartup();this._checkVTLSupport().then(a.hitch(this,function(a){this._supportsVTL=a}))},startup:function(){this.loaded?
this._refreshUI():f.connect(this,"onLoad",a.hitch(this,function(){this._refreshUI()}))},select:function(a){this._select(a)},getSelected:function(){return this._selectedBasemap},get:function(a){var b;for(b=0;b<this.basemaps.length;b++)if(this.basemaps[b].id===a)return this.basemaps[b];return null},add:function(a){return a&&!a.id?(a.id=this._getUniqueId(),this.basemaps.push(a),this._refreshUI(),this.onAdd(a),!0):a&&this._isUniqueId(a.id)?(this.basemaps.push(a),this._refreshUI(),this.onAdd(a),!0):!1},
remove:function(a){var b;for(b=0;b<this.basemaps.length;b++){var c=this.basemaps[b];if(c.id===a)return this._selectedBasemap&&this._selectedBasemap.id===c.id&&(this._selectedBasemap=null),this.basemaps.splice(b,1),this._refreshUI(),this.onRemove(c),c}return null},onLoad:function(){},onSelectionChange:function(){},onAdd:function(a){},onRemove:function(a){},onError:function(a){},_defaultBasemapGalleryGroupQuery:'title:"ArcGIS Online Basemaps" AND owner:esri',_basemapGalleryGroupQuery:null,_finishStartup:function(){this.loaded=
!0;this.onLoad();0===this.map.layerIds.length&&0<this.basemaps.length&&!this._selectBasemapInProgress&&this._select(this.basemaps[0].id)},_findCustomBasemapsGroup:function(a){this.basemapsGroup&&this.basemapsGroup.id?this._findArcGISBasemaps(this.basemapsGroup.id,a):(this._basemapGalleryGroupQuery='title:"'+this.basemapsGroup.title+'" AND owner:'+this.basemapsGroup.owner,this._findArcGISBasemapsGroup(a))},_findArcGISBasemapsGroup:function(b){if(this._basemapGalleryGroupQuery)this._findArcGISBasemapsGroupContent(b);
else{var d=this.arcgisUrl+"/portals/self",e={f:"json"};e.culture=c.locale;C({url:d,content:e,callbackParamName:"callback",load:a.hitch(this,function(c,d){c&&c.useVectorBasemaps&&c.vectorBasemapGalleryGroupQuery?this._checkVTLSupport().then(a.hitch(this,function(a){this._basemapGalleryGroupQuery=a?c.vectorBasemapGalleryGroupQuery:c&&c.basemapGalleryGroupQuery?c.basemapGalleryGroupQuery:this._defaultBasemapGalleryGroupQuery;this._findArcGISBasemapsGroupContent(b)})):(this._basemapGalleryGroupQuery=
c&&c.basemapGalleryGroupQuery?c.basemapGalleryGroupQuery:this._defaultBasemapGalleryGroupQuery,this._findArcGISBasemapsGroupContent(b))}),error:a.hitch(this,function(a,b){this._basemapGalleryGroupQuery=this._defaultBasemapGalleryGroupQuery})})}},_findArcGISBasemapsGroupContent:function(b){var c=a.hitch(this,"_findArcGISBasemaps"),d=this.arcgisUrl+"/community/groups",e={};e.q=this._basemapGalleryGroupQuery;e.f="json";C({url:d,content:e,callbackParamName:"callback",load:a.hitch(this,function(a,d){if(0<
a.results.length)c(a.results[0].id,b,a.results[0].sortField,a.results[0].sortOrder);else this.onError("esri.dijit.BasemapGallery: could not find group for basemaps.")}),error:a.hitch(this,function(a){this.onError("esri.dijit.BasemapGallery: could not find group for basemaps.")})})},_findArcGISBasemaps:function(b,c,d,e){var f=a.hitch(this,function(b,c,d,e){var f=this.arcgisUrl+"/search",g={};g.q="group:"+b+' AND type:"web map" NOT type:"web mapping application"';g.sortField=d;g.sortOrder="asc"===e?
"desc":"asc";g.num=50;g.f="json";C({url:f,content:g,callbackParamName:"callback",load:a.hitch(this,function(a,b){if(0<a.results.length)c(a.results);else this.onError("esri.dijit.BasemapGallery: could not find group for basemaps.")}),error:a.hitch(this,function(a,b){this.onError("esri.dijit.BasemapGallery: could not find group for basemaps.")})})});d&&e?f(b,c,d,e):C({url:this.arcgisUrl+"/community/groups/"+b,content:{f:"json"},callbackParamName:"callback",load:a.hitch(this,function(a,d){a.sortField?
f(b,c,a.sortField,a.sortOrder):f(b,c,"name","desc")}),error:a.hitch(this,function(a,d){f(b,c,"name","desc")})})},_handleArcGISBasemapsResponse:function(a){0<a.length&&(g.forEach(a,function(a,b){if(this.bingMapsKey||!this.bingMapsKey&&a.title&&-1===a.title.indexOf("Bing Maps")){var c={};c.id=this._getUniqueId();c.title=a.title;c.thumbnailUrl="";if(a.thumbnail&&a.thumbnail.length&&(c.thumbnailUrl=this.arcgisUrl+"/content/items/"+a.id+"/info/"+a.thumbnail,w.id)){var d=w.id.findCredential(x.urlToObject(this.arcgisUrl).path);
d&&(c.thumbnailUrl+="?token\x3d"+d.token)}c.itemId=a.id;c=new z(c,this);this.basemaps.splice(0,0,c)}},this),this._finishStartup())},_refreshUI:function(){this._hasUI&&(k.empty(this.flowContainer),g.forEach(this.basemaps,function(a,b){a.id||(a.id="basemap_"+b);this.flowContainer.appendChild(this._buildNodeLayout(a))},this),k.create("br",{style:{clear:"both"}},this.flowContainer),this._markSelected(this._selectedBasemap))},_buildNodeLayout:function(b){var c=k.create("div",{id:"galleryNode_"+b.id,"class":"esriBasemapGalleryNode"}),
d=k.create("a",{href:"javascript:void(0);"},c);f.connect(d,"onclick",a.hitch(this,"_onNodeClick",b));var e=b.title||"";b.thumbnailUrl?k.create("img",{"class":"esriBasemapGalleryThumbnail",src:b.thumbnailUrl,title:e,alt:e},d):k.create("img",{"class":"esriBasemapGalleryThumbnail",src:l.toUrl("./images/transparent.gif"),title:e,alt:e},d);b=k.create("div",{"class":"esriBasemapGalleryLabelContainer"},c);k.create("span",{innerHTML:e,alt:e,title:e},b);return c},_onNodeClick:function(a,b){b.preventDefault();
this._markSelected(a);this.select(a.id)},_markSelected:function(a){a&&(g.forEach(c.query(".esriBasemapGallerySelectedNode",this.domNode),function(a){p.remove(a,"esriBasemapGallerySelectedNode")}),(a=q.byId("galleryNode_"+a.id))&&p.add(a,"esriBasemapGallerySelectedNode"))},_select:function(b){this._selectBasemapInProgress=!0;var c=this.get(b);c?(c.layers?this._getServiceInfos(c):(b=c.getLayers(this.arcgisUrl),a.isArray(b)?this._getServiceInfos(c):b.addCallback(a.hitch(this,function(a){this._getServiceInfos(c)}))),
this._markSelected(c)):this._selectBasemapInProgress=!1},_getServiceInfos:function(b){"https:"===location.protocol&&g.forEach(b.layers,function(a){if(this._isAgolService(a.url)||this._isHostedService(a.url))a.url=a.url.replace("http:","https:")},this);this._selectedBasemap=b;var c=[];g.forEach(b.layers,function(a){a.url&&0<a.url.length&&!a.isReference&&!a.type&&(a.deferredsPos=c.length,c.push(this._getServiceInfo(a.url)))},this);0<c.length?(new t(c)).addCallback(a.hitch(this,function(a){var c=null;
g.forEach(b.layers,function(b){if(0===b.deferredsPos||b.deferredsPos){b.serviceInfoResponse=a[b.deferredsPos][1];var d=b.serviceInfoResponse.fullExtent;d||(d=b.serviceInfoResponse.extent);c=c?c.union(new B(d)):new B(d)}},this);this.map.extent&&5>this._getIntersectionPercent(c,this.map.extent)&&this.map.setExtent(c,!0);this._switchBasemapLayers(b);this._updateReferenceLayer(b)})):(this._switchBasemapLayers(b),this._updateReferenceLayer(b))},_checkVTLSupport:function(){var a=new h;d("ie")?a.resolve(!1):
a.resolve(H.supported());return a},_switchBasemapLayers:function(b){var c=b.layers,d=!1,e,h,k;g.forEach(c,function(a){"VectorTileLayer"===a.type&&(d=!0)});if(d&&!0!==this._supportsVTL)this.onError("esri.dijit.BasemapGallery: Unable to switch basemap because layer type is not supported by your current browser version.");else if(0<this.map.layerIds.length&&0===this.map.getNumLevels()&&("OpenStreetMap"===c[0].type||c[0].type&&-1<c[0].type.indexOf("BingMaps")||"WebTiledLayer"===c[0].type||"VectorTileLayer"===
c[0].type))this.onError("esri.dijit.BasemapGallery: Unable to switch basemap because new basemap is a tiled service and cannot be loaded as a dynamic layer.");else{g.forEach(c,function(a){if(!a.isReference&&a.type&&-1<a.type.indexOf("BingMaps")&&!this.bingMapsKey)this.onError("esri.dijit.BasemapGallery: Invalid Bing Maps key.")},this);var l=0;g.forEach(c,function(b,d){if(!b.isReference){var g;if("OpenStreetMap"===b.type){if(0<this.map.layerIds.length&&0===this.map.getNumLevels()){this.onError("esri.dijit.BasemapGallery: Unable to switch basemap because new basemap is a tiled service and cannot be loaded as a dynamic layer.");
return}g=new G({id:"layer_osm",opacity:b.opacity})}else if(b.type&&-1<b.type.indexOf("BingMaps")){if(0<this.map.layerIds.length&&0===this.map.getNumLevels()){this.onError("esri.dijit.BasemapGallery: Unable to switch basemap because new basemap is a tiled service and cannot be loaded as a dynamic layer.");return}g=A.MAP_STYLE_AERIAL_WITH_LABELS;"BingMapsAerial"===b.type?g=A.MAP_STYLE_AERIAL:"BingMapsRoad"===b.type&&(g=A.MAP_STYLE_ROAD);g=new A({id:"layer_bing",bingMapsKey:this.bingMapsKey,mapStyle:g,
opacity:b.opacity})}else if("WebTiledLayer"===b.type){if(0<this.map.layerIds.length&&0===this.map.getNumLevels()){this.onError("esri.dijit.BasemapGallery: Unable to switch basemap because new basemap is a tiled service and cannot be loaded as a dynamic layer.");return}g=b.initialExtent||b.fullExtent;g=new Q(b.templateUrl||b.url,{visible:b.visibility,opacity:b.opacity,copyright:b.copyright,fullExtent:b.fullExtent&&new B(b.fullExtent),initialExtent:g&&new B(g),subDomains:b.subDomains,tileInfo:b.tileInfo?
new I(b.tileInfo):null,tileServers:b.tileServers})}else if("VectorTileLayer"===b.type){g=new H(b.styleUrl,{visible:b.visibility,opacity:b.opacity});0===d&&1<c.length&&this._removeBasemapLayers();var m=this;f.connect(g,"onLoad",a.hitch(this,function(a,b,d){var e;if(m._sameSpatialReference(d.spatialReference,m.map.spatialReference))if(0<m.map.getNumLevels())if(e=m._sameTilingScheme(d.tileInfo,m.map.__tileInfo))0===b&&1===c.length&&m._removeBasemapLayers(),d._basemapGalleryLayerType="basemap",m.map.addLayer(d,
a);else m.onError("esri.dijit.BasemapGallery: Unable to switch basemap because new basemap has a different tiling scheme.");else m.onError("esri.dijit.BasemapGallery: Unable to switch basemap because new basemap is a tiled service and cannot be loaded as a dynamic layer.");else m.onError("esri.dijit.BasemapGallery: Unable to switch basemap because new basemap has a different spatial reference.")},l,d))}else if(b.serviceInfoResponse&&b.serviceInfoResponse.mapName){e=new y(b.serviceInfoResponse.spatialReference);
h=this._sameSpatialReference(e,this.map.spatialReference);if(this.map.spatialReference&&!h){this.onError("esri.dijit.BasemapGallery: Unable to switch basemap because new basemap has a different spatial reference.");return}if(!0===b.serviceInfoResponse.singleFusedMapCache&&0<this.map.getNumLevels()){if(k=this._sameTilingScheme(b.serviceInfoResponse.tileInfo,this.map.__tileInfo),!k){this.onError("esri.dijit.BasemapGallery: Unable to switch basemap because new basemap has a different tiling scheme.");
return}}else if(!0===b.serviceInfoResponse.singleFusedMapCache&&-1<b.serviceInfoResponse.capabilities.toLowerCase().indexOf("tilesonly")&&0===this.map.getNumLevels()){this.onError("esri.dijit.BasemapGallery: Unable to switch basemap because new basemap is a tiled service and cannot be loaded as a dynamic layer.");return}g=(0===this.map.layerIds.length||0<this.map.getNumLevels())&&!0===b.serviceInfoResponse.singleFusedMapCache?this._loadAsCached(b):this._loadAsDynamic(b)}else if(b.serviceInfoResponse&&
b.serviceInfoResponse.pixelSizeX){e=new y(b.serviceInfoResponse.spatialReference);h=this._sameSpatialReference(e,this.map.spatialReference);if(!h){this.onError("esri.dijit.BasemapGallery: Unable to switch basemap because new basemap has a different spatial reference.");return}if(!0===b.serviceInfoResponse.singleFusedMapCache&&0<this.map.getNumLevels()&&(k=this._sameTilingScheme(b.serviceInfoResponse.tileInfo,this.map.__tileInfo),!k)){this.onError("esri.dijit.BasemapGallery: Unable to switch basemap because new basemap has a different tiling scheme.");
return}b.serviceInfoResponse.singleFusedMapCache?g=new v(b.url,{resourceInfo:b.serviceInfoResponse,opacity:b.opacity,visible:b.visibility}):b.serviceInfoResponse.pixelSizeX?(g=new P,g.bandIds=b.bandIds,!b.bandIds&&b.serviceInfoResponse.bandCount&&3<parseInt(b.serviceInfoResponse.bandCount,10)&&(g.bandIds=[0,1,2]),g=new M(b.url,{resourceInfo:b.serviceInfoResponse,opacity:b.opacity,visible:b.visibility,imageServiceParameters:g})):(g=new u,g.format="png24",b.serviceInfoResponse.supportedImageFormatTypes&&
-1<b.serviceInfoResponse.supportedImageFormatTypes.indexOf("PNG32")&&(g.format="png32"),g=new D(b.url,{resourceInfo:b.serviceInfoResponse,opacity:b.opacity,visible:b.visibility,imageParameters:g}))}"VectorTileLayer"===b.type?l++:g&&(0===d&&this._removeBasemapLayers(),g._basemapGalleryLayerType="basemap",this.map.addLayer(g,l),l++)}},this);this._selectBasemapInProgress=!1;this.onSelectionChange()}},_removeBasemapLayers:function(){var a=this.map.layerIds,b=[];g.forEach(a,function(a){a=this.map.getLayer(a);
"basemap"===a._basemapGalleryLayerType&&b.push(a)},this);0===b.length&&0<a.length&&b.push(this.map.getLayer(a[0]));0<b.length&&g.forEach(b,function(a){this.map.removeLayer(a)},this)},_updateReferenceLayer:function(a){var b;this._removeReferenceLayer();for(b=0;b<a.layers.length;b++)!0===a.layers[b].isReference&&this._addReferenceLayer(a.layers[b])},_removeReferenceLayer:function(){var a;for(a=this.map.layerIds.length-1;0<=a;a--){var b=this.map.getLayer(this.map.layerIds[a]);"reference"===b._basemapGalleryLayerType&&
this.map.removeLayer(b)}},_addReferenceLayer:function(b){"VectorTileLayer"===b.type?this._handleReferenceServiceInfoResponse(b):this._getServiceInfo(b.url,a.hitch(this,"_handleReferenceServiceInfoResponse",b))},_handleReferenceServiceInfoResponse:function(a,b,c){var d;a.serviceInfoResponse=b;"VectorTileLayer"===a.type?d=new H(a.styleUrl,{visible:a.visibility,opacity:a.opacity}):b&&b.mapName?d=!0===b.singleFusedMapCache?this._loadAsCached(a):this._loadAsDynamic(a):b&&b.pixelSizeX&&(a.serviceInfoResponse.singleFusedMapCache?
d=new v(a.url,{resourceInfo:a.serviceInfoResponse,opacity:a.opacity,visible:a.visibility}):a.serviceInfoResponse.pixelSizeX?(c=new P,c.bandIds=a.bandIds,!a.bandIds&&b.bandCount&&3<parseInt(b.bandCount,10)&&(c.bandIds=[0,1,2]),d=new M(a.url,{resourceInfo:b,opacity:a.opacity,visible:a.visibility,imageServiceParameters:c})):(b=new u,b.format="png24",a.serviceInfoResponse.supportedImageFormatTypes&&-1<a.serviceInfoResponse.supportedImageFormatTypes.indexOf("PNG32")&&(b.format="png32"),b.transparent=!0,
d=new D(a.url,{resourceInfo:a.serviceInfoResponse,opacity:a.opacity,visible:a.visibility,imageParameters:b})));d&&(d._basemapGalleryLayerType="reference",d.attr("data-reference",!0),this.map.addLayer(d))},_getServiceInfo:function(b,c){return C({url:b,content:{f:"json"},callbackParamName:"callback",load:function(a,b){c&&c(a,b)},error:a.hitch(this,function(a,b){this.onError("esri.dijit.BasemapGallery: service not accessible.")})})},_loadAsCached:function(a){var b=[];a.displayLevels||(b=g.map(a.serviceInfoResponse.tileInfo.lods,
function(a){return a.level}));var c=null;a.exclusionAreas&&a.exclusionAreas.length&&(c=[],g.forEach(a.exclusionAreas,function(a){c.push({minZoom:a.minZoom,maxZoom:a.maxZoom,minScale:a.minScale,maxScale:a.maxScale,geometry:new B(a.geometry)})}));return new v(a.url,{resourceInfo:a.serviceInfoResponse,opacity:a.opacity,visible:a.visibility,exclusionAreas:c,displayLevels:a.displayLevels||b})},_loadAsDynamic:function(a){var b=new D(a.url,{resourceInfo:a.serviceInfoResponse,opacity:a.opacity,visible:a.visibility});
a.visibleLayers&&b.setVisibleLayers(a.visibleLayers);return b},_getIntersectionPercent:function(a,b){var c=b.intersects(a);if(c){var c=c.getWidth()*c.getHeight(),d=b.getWidth()*b.getHeight();return c/d*100}return 0},_getIds:function(){var a=[];g.forEach(this.basemaps,function(b){a.push(b.id)},this);return a},_getUniqueId:function(){for(var a=","+this._getIds().toString()+",",b=0;;)if(-1<a.indexOf(",basemap_"+b+","))b++;else return"basemap_"+b},_isUniqueId:function(a){return-1===(","+this._getIds().toString()+
",").indexOf(","+a+",")?!0:!1},_isAgolService:function(a){return a?-1!==a.indexOf("/services.arcgisonline.com/")||-1!==a.indexOf("/server.arcgisonline.com/"):!1},_isHostedService:function(a){return a?-1!==a.indexOf(".arcgis.com/"):!1},_sameSpatialReference:function(a,b){return a&&b&&a.wkt==b.wkt&&(a.wkid===b.wkid||E.isDefined(a.latestWkid)&&a.latestWkid===b.wkid||E.isDefined(b.latestWkid)&&a.wkid===b.latestWkid||E.isDefined(a.latestWkid)&&a.latestWkid===b.latestWkid)||a&&b&&a.isWebMercator()&&b.isWebMercator()?
!0:!1},_sameTilingScheme:function(a,b){var c=this.map,c=c.width>c.height?c.width:c.height,d=!1,e=!1,f,g;for(f=0;f<a.lods.length;f++){var h=a.lods[f].scale;a.dpi!==b.dpi&&(h=a.lods[f].scale/a.dpi);for(g=0;g<b.lods.length;g++){var k=b.lods[g].scale;a.dpi!==b.dpi&&(k=b.lods[g].scale/b.dpi);if(Math.abs(k-h)/k<1/c)if(d){e=!0;break}else d=!0;if(k<h)break}if(e)break}return e||d&&(1===a.lods.length||1===b.lods.length)?!0:!1}});b("extend-esri")&&a.setObject("dijit.BasemapGallery",n,w);return n});