(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-749eb15a"],{"0f1d":function(e,t,i){"use strict";i.d(t,"a",(function(){return l}));var n=i("a4ee"),r=i("6a0ed"),a=i("59b2"),s=(i("b50f"),i("c120"),i("cea0"),i("d386"));let o=class extends r["a"]{get affectsPixelSize(){return!1}forwardTransform(e){return e}inverseTransform(e){return e}};Object(n["a"])([Object(a["b"])()],o.prototype,"affectsPixelSize",null),Object(n["a"])([Object(a["b"])({json:{write:!0}})],o.prototype,"spatialReference",void 0),o=Object(n["a"])([Object(s["a"])("esri.layers.support.rasterTransforms.BaseRasterTransform")],o);const l=o},"218c":function(e,t,i){"use strict";i.d(t,"a",(function(){return h})),i.d(t,"b",(function(){return p})),i.d(t,"c",(function(){return d})),i.d(t,"d",(function(){return c})),i.d(t,"e",(function(){return m})),i.d(t,"f",(function(){return u})),i.d(t,"g",(function(){return f})),i.d(t,"h",(function(){return y}));i("e06a");var n=i("b2b2");class r{constructor(e=15e3,t=5e3){this._timer=null,this._cachedBlocks=new Map,this._size=-1,this._duration=e,this._interval=Math.min(e,t)}decreaseRefCount(e,t){const i=e+"/"+t,n=this._cachedBlocks;if(n.has(i)){const e=n.get(i);return e.refCount--,e.refCount<=0&&(n.delete(i),e.controller&&e.controller.abort()),e.refCount}return 0}getBlock(e,t){const i=e+"/"+t,n=this._cachedBlocks;if(n.has(i)){const e=n.get(i);return e.ts=Date.now(),e.refCount++,n.delete(i),n.set(i,e),e.block}return null}putBlock(e,t,i,n=null){const r=this._cachedBlocks,a=e+"/"+t;if(r.has(a)){const e=r.get(a);e.ts=Date.now(),e.refCount++}else r.set(a,{block:i,ts:Date.now(),refCount:1,controller:n});this._trim(),this._updateTimer()}deleteBlock(e,t){const i=this._cachedBlocks,n=e+"/"+t;i.has(n)&&i.delete(n)}updateMaxSize(e){this._size=e,this._trim()}empty(){this._cachedBlocks.clear(),this._clearTimer()}getCurrentSize(){return this._cachedBlocks.size}_updateTimer(){if(null!=this._timer)return;const e=this._cachedBlocks;this._timer=setInterval(()=>{const t=Array.from(e),i=Date.now();for(let n=0;n=e.size)return;const t=Array.from(e);for(let i=0;inull!=e)||o.delete(e)}}function h(e,t,i){if(!o.has(e))return null==t?l.decreaseRefCount(e,i):0;const n=o.get(e);if(null==n[t])return l.decreaseRefCount(e,i);const r=n[t].cache;if(r.has(i)){const e=r.get(i);if(e.refCount--,0===e.refCount){r.delete(i);for(let e=0;es.isResolved=!0).catch(()=>s.isRejected=!0),a[t].cache.set(i,s)}function p(e,t,i){if(!o.has(e))return void(null==t&&l.deleteBlock(e,i));const n=o.get(e);null!=n[t]?n[t].cache.delete(i):l.deleteBlock(e,i)}function b(e,t){if(!o.has(e))return null;const i=o.get(e);return null==i[t]?null:i[t]}function y(e,t,i,r,o,l,c=null){const u=b(e,t),f=u.extent,{cache:h,rasterInfo:d}=u;if(f&&f.xmin===i.xmin&&f.xmax===i.xmax&&f.ymin===i.ymin&&f.ymax===i.ymax)return;const m=i.clone().normalize(),{spatialReference:p,transform:y}=d,g=new Set;for(let b=0;b0?x.pyramidBlockWidth:x.blockWidth,S=u>0?x.pyramidBlockHeight:x.blockHeight,R=1,T=Math.max(0,Math.floor(O.x/I)-R),_=Math.max(0,Math.floor(O.y/S)-R),k=Math.floor((O.x+w-1)/I)+R,C=Math.floor((O.y+j-1)/S)+R;for(let n=_;n<=C;n++)for(let e=T;e<=k;e++)g.add(`${u}/${n}/${e}`)}h.forEach((e,t)=>{if(!g.has(t)){const e=h.get(t);(null==e||e.isResolved||e.isRejected)&&h.delete(t)}}),u.extent={xmin:i.xmin,ymin:i.ymin,xmax:i.xmax,ymax:i.ymax}}},"773d":function(e,t,i){"use strict";i.d(t,"a",(function(){return c}));var n=i("a4ee"),r=i("59b2"),a=(i("b50f"),i("c120"),i("cea0"),i("448d")),s=i("d386"),o=i("0f1d");let l=class extends o["a"]{constructor(){super(...arguments),this.type="gcs-shift",this.tolerance=1e-8}forwardTransform(e){return"point"===(e=e.clone()).type?(e.x>180+this.tolerance&&(e.x-=360),e):(e.xmin>=180-this.tolerance?(e.xmax-=360,e.xmin-=360):e.xmax>180+this.tolerance&&(e.xmin=-180,e.xmax=180),e)}inverseTransform(e){return"point"===(e=e.clone()).type?(e.x<-this.tolerance&&(e.x+=360),e):(e.xmin<-this.tolerance&&(e.xmin+=360,e.xmax+=360),e)}};Object(n["a"])([Object(a["a"])({GCSShiftXform:"gcs-shift"})],l.prototype,"type",void 0),Object(n["a"])([Object(r["b"])()],l.prototype,"tolerance",void 0),l=Object(n["a"])([Object(s["a"])("esri.layers.support.rasterTransforms.GCSShiftTransform")],l);const c=l},"7fb1":function(e,t,i){"use strict";i.d(t,"a",(function(){return b}));var n=i("a4ee"),r=(i("e06a"),i("59b2")),a=(i("b50f"),i("c120"),i("cea0"),i("448d")),s=i("afcf"),o=i("d386"),l=i("09db"),c=i("0f1d"),u=i("4ae5"),f=i("3af1");function h(e,t,i){const{x:n,y:r}=t;if(i<2)return{x:e[0]+n*e[2]+r*e[4],y:e[1]+n*e[3]+r*e[5]};if(2===i){const t=n*n,i=r*r,a=n*r;return{x:e[0]+n*e[2]+r*e[4]+t*e[6]+a*e[8]+i*e[10],y:e[1]+n*e[3]+r*e[5]+t*e[7]+a*e[9]+i*e[11]}}const a=n*n,s=r*r,o=n*r,l=a*n,c=a*r,u=n*s,f=r*s;return{x:e[0]+n*e[2]+r*e[4]+a*e[6]+o*e[8]+s*e[10]+l*e[12]+c*e[14]+u*e[16]+f*e[18],y:e[1]+n*e[3]+r*e[5]+a*e[7]+o*e[9]+s*e[11]+l*e[13]+c*e[15]+u*e[17]+f*e[19]}}function d(e,t,i){const{xmin:n,ymin:r,xmax:a,ymax:s,spatialReference:o}=t;let l=[];if(i<2)l.push({x:n,y:s}),l.push({x:a,y:s}),l.push({x:n,y:r}),l.push({x:a,y:r});else{let e=10;for(let t=0;th(e,t,i));const c=l.map(e=>e.x),u=l.map(e=>e.y);return new f["a"]({xmin:Math.min.apply(null,c),xmax:Math.max.apply(null,c),ymin:Math.min.apply(null,u),ymax:Math.max.apply(null,u),spatialReference:o})}function m(e){const[t,i,n,r,a,s]=e,o=n*s-a*r,l=a*r-n*s;return[(a*i-t*s)/o,(n*i-t*r)/l,s/o,r/l,-a/o,-n/l]}let p=class extends c["a"]{constructor(){super(...arguments),this.polynomialOrder=1,this.type="polynomial"}readForwardCoefficients(e,t){const{coeffX:i,coeffY:n}=t;if(null==i||!i.length||null==n||!n.length||i.length!==n.length)return null;const r=[];for(let a=0;a0}forwardTransform(e){if("point"===e.type){const t=h(this.forwardCoefficients,e,this.polynomialOrder);return new u["a"]({x:t.x,y:t.y,spatialReference:e.spatialReference})}return d(this.forwardCoefficients,e,this.polynomialOrder)}inverseTransform(e){if("point"===e.type){const t=h(this.inverseCoefficients,e,this.polynomialOrder);return new u["a"]({x:t.x,y:t.y,spatialReference:e.spatialReference})}return d(this.inverseCoefficients,e,this.polynomialOrder)}};Object(n["a"])([Object(r["b"])({json:{write:!0}})],p.prototype,"polynomialOrder",void 0),Object(n["a"])([Object(r["b"])()],p.prototype,"forwardCoefficients",void 0),Object(n["a"])([Object(s["a"])("forwardCoefficients",["coeffX","coeffY"])],p.prototype,"readForwardCoefficients",null),Object(n["a"])([Object(l["a"])("forwardCoefficients")],p.prototype,"writeForwardCoefficients",null),Object(n["a"])([Object(r["b"])({json:{write:!0}})],p.prototype,"inverseCoefficients",null),Object(n["a"])([Object(s["a"])("inverseCoefficients",["inverseCoeffX","inverseCoeffY"])],p.prototype,"readInverseCoefficients",null),Object(n["a"])([Object(l["a"])("inverseCoefficients")],p.prototype,"writeInverseCoefficients",null),Object(n["a"])([Object(r["b"])()],p.prototype,"affectsPixelSize",null),Object(n["a"])([Object(a["a"])({PolynomialXform:"polynomial"})],p.prototype,"type",void 0),p=Object(n["a"])([Object(o["a"])("esri.layers.support.rasterTransforms.PolynomialTransform")],p);const b=p},"8c6a":function(e,t,i){"use strict";i.d(t,"a",(function(){return d})),i.d(t,"b",(function(){return m}));var n=i("773d"),r=i("a4ee"),a=(i("e92d"),i("cea0"),i("b50f"),i("c120"),i("2dd4"),i("448d")),s=i("d386"),o=i("0f1d");let l=class extends o["a"]{constructor(){super(...arguments),this.type="identity"}};Object(r["a"])([Object(a["a"])({IdentityXform:"identity"})],l.prototype,"type",void 0),l=Object(r["a"])([Object(s["a"])("esri.layers.support.rasterTransforms.IdentityTransform")],l);const c=l;var u=i("7fb1");const f={GCSShiftXform:n["a"],IdentityXform:c,PolynomialXform:u["a"]},h=Object.keys(f);function d(e){const t=null==e?void 0:e.type;return!e||h.includes(t)}function m(e){if(!(null==e?void 0:e.type))return null;const t=f[null==e?void 0:e.type];if(t){const i=new t;return i.read(e),i}return null}},9651:function(e,t,i){"use strict";i.d(t,"a",(function(){return R}));var n,r=i("a4ee"),a=i("2eab"),s=i("fc29"),o=i("f0b9"),l=i("ce50"),c=i("9096"),u=i("e92d"),f=i("c24e"),h=i("8a44"),d=i("f4cc"),m=i("477c"),p=i("5815"),b=i("e041"),y=i("59b2"),g=i("b50f"),x=(i("c120"),i("1a3e")),v=i("d386"),O=i("7ffa");class w{constructor(){this.location={left:0,top:0,width:0,height:0},this._allAvailability="unknown",this.byteSize=40}getAvailability(e,t){if("unknown"!==this._allAvailability)return this._allAvailability;const i=(e-this.location.top)*this.location.width+(t-this.location.left),n=i%8,r=i>>3,a=this._tileAvailabilityBitSet;return r<0||r>a.length?"unknown":a[r]&1<e.data).catch(e=>{if(e&&e.details&&422===e.details.httpStatus)return{location:{top:n,left:r,width:s,height:o},valid:!0,data:Object(g["c"])(s*o,0)};throw e}).then(e=>{if(e.location&&(e.location.top!==n||e.location.left!==r||e.location.width!==s||e.location.height!==o))throw new l["a"]("tilemap:location-mismatch","Tilemap response for different location than requested",{response:e,definition:{top:n,left:r,width:s,height:o}});return w.fromJSON(e)})}static fromJSON(e){w._validateJSON(e);const t=new w;return t.location=Object.freeze(Object(O["a"])(e.location)),t._updateFromData(e.data),Object.freeze(t)}static _validateJSON(e){if(!e||!e.location)throw new l["a"]("tilemap:missing-location","Location missing from tilemap response");if(!1===e.valid)throw new l["a"]("tilemap:invalid","Tilemap response was marked as invalid");if(!e.data)throw new l["a"]("tilemap:missing-data","Data missing from tilemap response");if(!Array.isArray(e.data))throw new l["a"]("tilemap:data-mismatch","Data must be an array of numbers");if(e.data.length!==e.location.width*e.location.height)throw new l["a"]("tilemap:data-mismatch","Number of data items does not match width/height of tilemap")}}function j(e){return`${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`}function I(e){let t;if("vector-tile"===e.service.type)t=`${e.service.url}/tilemap/${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`;else{const i=e.service.tileServers;t=`${i&&i.length?i[e.row%i.length]:e.service.url}/tilemap/${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`}const i=e.service.query;return i&&(t=`${t}?${i}`),t}const S=u["a"].getLogger("esri.layers.support.TilemapCache");let R=n=class extends(Object(c["b"])(s["a"])){constructor(e){super(e),this._pendingTilemapRequests={},this._availableLevels={},this.levels=5,this.cacheByteSize=2*o["a"].MEGABYTES,this.request=a["default"],this._prefetchingEnabled=!0}initialize(){this._tilemapCache=new f["a"](this.cacheByteSize),this.handles.add([this.watch(["layer.parsedUrl","layer.tileServers?","layer.apiKey?","layer.customParameters?"],()=>this._initializeTilemapDefinition()),Object(m["e"])(()=>{var e,t;return null==(e=this.layer)||null==(t=e.tileInfo)?void 0:t.lods},e=>this._initializeAvailableLevels(e),m["d"])]),this._initializeTilemapDefinition()}castLevels(e){return e<=2?(S.error("Minimum levels for Tilemap is 3, but got ",e),3):e}get size(){return 1<{Object(d["q"])(s,()=>t(Object(d["e"])()));const i=j(r);let a=this._pendingTilemapRequests[i];if(!a){a=w.fromDefinition(r,n).then(e=>(this._tilemapCache.put(i,e,e.byteSize),e));const e=()=>delete this._pendingTilemapRequests[i];this._pendingTilemapRequests[i]=a,a.then(e,e)}a.then(e,t)})}getAvailability(e,t,i){if(!this._availableLevels[e])return"unavailable";const n=this._tilemapFromCache(e,t,i,this._tmpTilemapDefinition);return n?n.getAvailability(t,i):"unknown"}fetchAvailability(e,t,i,n){return this._availableLevels[e]?this.fetchTilemap(e,t,i,n).catch(e=>e).then(n=>{if(n instanceof w){const r=n.getAvailability(t,i);return"unavailable"===r?Promise.reject(new l["a"]("tile-map:tile-unavailable","Tile is not available",{level:e,row:t,col:i})):r}if(Object(d["m"])(n))throw n;return"unknown"}):Promise.reject(new l["a"]("tilemap-cache:level-unavailable",`Level ${e} is unavailable in the service`))}fetchAvailabilityUpsample(e,t,i,n,r){n.level=e,n.row=t,n.col=i;const a=this.layer.tileInfo;a.updateTileInfo(n);const s=this.fetchAvailability(e,t,i,r).catch(e=>{if(Object(d["m"])(e))throw e;if(a.upsampleTile(n))return this.fetchAvailabilityUpsample(n.level,n.row,n.col,n);throw e});return this._fetchAvailabilityUpsamplePrefetch(n.id,e,t,i,r,s),s}async _fetchAvailabilityUpsamplePrefetch(e,t,i,r,a,s){if(!this._prefetchingEnabled)return;const o="prefetch-"+e;if(this.handles.has(o))return;const l=new AbortController;s.then(()=>l.abort(),()=>l.abort());let c=!1;const u={remove(){c||(c=!0,l.abort())}};if(this.handles.add(u,o),await Object(p["d"])(10,l.signal).catch(()=>{}),c||(c=!0,this.handles.remove(o)),Object(d["n"])(l))return;const f={id:e,level:t,row:i,col:r},h={...a,signal:l.signal},m=this.layer.tileInfo;for(let d=0;n._prefetches.length{n._prefetches.removeUnordered(e)};e.then(t,t)}}_initializeTilemapDefinition(){var e;if(!this.layer.parsedUrl)return;const{parsedUrl:t,apiKey:i,customParameters:n}=this.layer;this._tilemapCache.clear(),this._tmpTilemapDefinition={service:{url:t.path,query:Object(b["G"])({...t.query,...n,token:null!=i?i:null==(e=t.query)?void 0:e.token}),tileServers:this.layer.tileServers,request:this.request,type:this.layer.type},width:this.size,height:this.size,level:0,row:0,col:0}}_tilemapFromCache(e,t,i,n){n.level=e,n.row=t-t%this.size,n.col=i-i%this.size;const r=j(n);return this._tilemapCache.get(r)}_initializeAvailableLevels(e){this._availableLevels={},e&&e.forEach(e=>this._availableLevels[e.level]=!0)}get test(){const e=this;return{get prefetchingEnabled(){return e._prefetchingEnabled},set prefetchingEnabled(t){e._prefetchingEnabled=t},hasTilemap:(t,i,n)=>!!e._tilemapFromCache(t,i,n,e._tmpTilemapDefinition)}}};R._maxPrefetch=4,R._prefetches=new h["a"]({initialSize:n._maxPrefetch}),Object(r["a"])([Object(y["b"])({constructOnly:!0,type:Number})],R.prototype,"levels",void 0),Object(r["a"])([Object(x["a"])("levels")],R.prototype,"castLevels",null),Object(r["a"])([Object(y["b"])({readOnly:!0,type:Number})],R.prototype,"size",null),Object(r["a"])([Object(y["b"])({constructOnly:!0,type:Number})],R.prototype,"cacheByteSize",void 0),Object(r["a"])([Object(y["b"])({constructOnly:!0})],R.prototype,"layer",void 0),Object(r["a"])([Object(y["b"])({constructOnly:!0})],R.prototype,"request",void 0),R=n=Object(r["a"])([Object(v["a"])("esri.layers.support.TilemapCache")],R)},9917:function(e,t,i){"use strict";i.r(t),i.d(t,"default",(function(){return Ve}));var n=i("a4ee"),r=i("4856"),a=i("ba40"),s=i("ce50"),o=i("b2b2"),l=i("e694"),c=i("f4cc"),u=i("59b2"),f=(i("b50f"),i("c120"),i("cea0")),h=i("448d"),d=i("afcf"),m=i("d386"),p=i("a6a3"),b=i("997b"),y=i("8b28"),g=(i("e06a"),i("2eab")),x=i("e92d"),v=i("4adc"),O=i("7f83"),w=i("54b4"),j=i("22f4"),I=i("b627"),S=i("da6b"),R=i("dff3"),T=i("19db"),_=i("1ccd"),k=i("7220"),C=i("2616"),M=i("3af1"),P=i("5996");const F=x["a"].getLogger("esri.layers.mixins.ImageryTileMixin"),E=e=>{let t=class extends e{constructor(){super(...arguments),this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this.bandIds=null,this.copyright=null,this.fullExtent=null,this.interpolation="nearest",this.multidimensionalDefinition=null,this.raster=null,this.rasterInfo=null,this.sourceJSON=null,this.spatialReference=null,this.tileInfo=null,this.symbolizer=null}set url(e){this._set("url",Object(w["g"])(e,F))}set renderer(e){this._set("renderer",e),this.updateRenderer()}async convertVectorFieldData(e,t){if(Object(o["j"])(e))return null;const i=this._rasterJobHandler.instance,n=this.rasterInfo.dataType;return i?i.convertVectorFieldData({pixelBlock:e,dataType:n},t):Object(T["b"])(e,n)}async createStreamlinesMesh(e,t){const i=this._rasterJobHandler.instance;return i?i.createStreamlinesMesh(e,t):Object(C["a"])(e.rendererSettings,e.flowData,Object(o["k"])(t.signal)?t.signal:(new AbortController).signal)}normalizeRasterFetchOptions(e){const{multidimensionalInfo:t}=this.rasterInfo;if(Object(o["j"])(t))return e;let i=e.multidimensionalDefinition||this.multidimensionalDefinition;!Object(o["j"])(i)&&i.length||(i=this._getDefaultSlice());const n=e.timeExtent||this.timeExtent;if(Object(o["k"])(i)&&Object(o["k"])(n)&&(Object(o["k"])(n.start)||Object(o["k"])(n.end))){var r,a;i=i.map(e=>e.clone());const s=null==(r=t.variables.find(({name:e})=>e===i[0].variableName))||null==(a=r.dimensions)?void 0:a.find(({name:e})=>"StdTime"===e),l=i.find(({dimensionName:e})=>"StdTime"===e);if(!s||!l)return{...e,multidimensionalDefinition:null};const{start:c,end:u}=n,f=Object(o["j"])(c)?null:c.getTime(),h=Object(o["j"])(u)?null:u.getTime(),d=null!=f?f:h,m=null!=h?h:f;if(Object(o["k"])(s.values)){const e=s.values.filter(e=>{if(Array.isArray(e)){if(d===m)return e[0]<=d&&e[1]>=d;const t=e[0]<=d&&e[1]>d||e[0]=m,i=e[0]>=d&&e[1]<=m||e[0]m;return t||i}return d===m?e===d:e>=d&&e<=m});if(e.length){const t=e.sort((e,t)=>{var i,n,r,a;return d===m?(null!=(r=e[0])?r:e)-(null!=(a=t[0])?a:t):Math.abs((null!=(i=e[1])?i:e)-m)-Math.abs((null!=(n=t[1])?n:t)-m)})[0];l.values=[t]}else i=null}else if(s.hasRegularIntervals&&s.extent){const[e,t]=s.extent;d>t||m0))return null;let n;await this.updateRenderer();const r=this._rasterJobHandler.instance,{bandIds:a}=this;return n=r?await r.symbolize({...e,simpleStretchParams:t,bandIds:a}):this.symbolizer.symbolize({...e,simpleStretchParams:t,bandIds:a}),n}getTileUrl(e,t,i){return"RasterTileServer"===this.raster.datasetFormat?`${this.url}/tile/${e}/${t}/${i}`:""}getCompatibleTileInfo(e,t,i=!1){if(!this.loaded||Object(o["j"])(t))return null;if(i&&e.equals(this.spatialReference))return this.tileInfo;const n=Object(O["e"])(e);return R["a"].create({size:256,spatialReference:e,origin:n?{x:n.origin[0],y:n.origin[1]}:{x:t.xmin,y:t.ymax}})}getCompatibleFullExtent(e){return this.loaded?(this._compatibleFullExtent&&this._compatibleFullExtent.spatialReference.equals(e)||(this._compatibleFullExtent=this.raster.computeExtent(e)),this._compatibleFullExtent):null}async fetchTile(e,t,i,n={}){if(n.requestAsImageElement){const r=this.getTileUrl(e,t,i);return Object(g["default"])(r,{responseType:"image",query:{...this.refreshParameters,...this.raster.ioConfig.customFetchParameters},signal:n.signal}).then(e=>e.data)}if(Object(o["k"])(this.rasterInfo.multidimensionalInfo)&&(n=this.normalizeRasterFetchOptions(n),Object(o["j"])(n.multidimensionalDefinition))){const r=n.tileInfo||this.rasterInfo.storageInfo.tileInfo;return{extent:this.raster.getTileExtentFromTileInfo(e,t,i,r),pixelBlock:null}}return await this._initJobHandler(),"raster-shaded-relief"===this.renderer.type&&(n={...n,buffer:{cols:1,rows:1}}),this.raster.fetchTile(e,t,i,n)}async fetchPixels(e,t,i,n={}){return Object(o["k"])(this.rasterInfo.multidimensionalInfo)&&(n=this.normalizeRasterFetchOptions(n),Object(o["j"])(n.multidimensionalDefinition))?{extent:e,pixelBlock:null}:(await this._initJobHandler(),this.raster.fetchPixels(e,t,i,n))}async identify(e,t={}){return Object(o["k"])(this.rasterInfo.multidimensionalInfo)&&(t=this.normalizeRasterFetchOptions(t),Object(o["j"])(t.multidimensionalDefinition))?{location:e,value:null}:this.raster.identify(e,t)}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}hasStandardTime(){var e;const t=this.rasterInfo.multidimensionalInfo;if(!Object(o["k"])(t)||"standard-time"!==this.rasterInfo.dataType)return!1;const i=null==(e=this.multidimensionalDefinition[0])?void 0:e.variableName;return t.variables.some(e=>e.name===i&&e.dimensions.some(e=>"StdTime"===e.name))}getStandardTimeValue(e){return new Date(24*(e-25569)*3600*1e3).toString()}_configDefaultSettings(){this._configDefaultInterpolation(),this.multidimensionalDefinition||(this.multidimensionalDefinition=this._getDefaultSlice()),this._configDefaultRenderer()}_initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const e=new S["a"];return this._rasterJobHandler.connectionPromise=e.initialize().then(()=>{this._rasterJobHandler.instance=e,this.raster.rasterJobHandler=e,this.renderer&&this.updateRenderer()}).catch(()=>null),this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0,this.raster.rasterJobHandler=null}_configDefaultInterpolation(){if(null==this.interpolation){var e;const t=Object(_["c"])(this.rasterInfo,this.raster.tileType,null==(e=this.sourceJSON)?void 0:e.defaultResamplingMethod);this._set("interpolation",t)}}_getDefaultSlice(){const{multidimensionalInfo:e}=this.raster.rasterInfo;if(!Object(o["k"])(e))return null;const t=e.variables[0];return t.dimensions.map(e=>{var i,n;return new I["a"]({variableName:t.name,dimensionName:e.name,values:[null!=(i=null==(n=e.values)?void 0:n[0])?i:e.extent[0]],isSlice:!0})})}_configDefaultRenderer(){const e=this.raster.rasterInfo;var t;this.bandIds||(this.bandIds=Object(_["b"])(e)),this.renderer||(this.renderer=Object(_["a"])(e,{bandIds:this.bandIds,variableName:Object(o["k"])(this.multidimensionalDefinition)?null==(t=this.multidimensionalDefinition[0])?void 0:t.variableName:null})),this.symbolizer?(this.symbolizer.rendererJSON=Object(_["e"])(this.renderer.toJSON()),this.symbolizer.rasterInfo=e):this.symbolizer=new k["a"]({rendererJSON:this.renderer.toJSON(),rasterInfo:e});const i=this.symbolizer.bind();i.success||F.warn("imagery-tile-mixin",i.error||"The given renderer is not supported by the layer.")}};return Object(n["a"])([Object(u["b"])()],t.prototype,"_cachedRendererJson",void 0),Object(n["a"])([Object(u["b"])()],t.prototype,"_compatibleFullExtent",void 0),Object(n["a"])([Object(u["b"])()],t.prototype,"_rasterJobHandler",void 0),Object(n["a"])([Object(u["b"])()],t.prototype,"bandIds",void 0),Object(n["a"])([Object(u["b"])({json:{origins:{service:{read:{source:"copyrightText"}}}}})],t.prototype,"copyright",void 0),Object(n["a"])([Object(u["b"])({type:M["a"],json:{read:!1}}),Object(v["a"])("rasterInfo.extent")],t.prototype,"fullExtent",void 0),Object(n["a"])([Object(u["b"])()],t.prototype,"interpolation",void 0),Object(n["a"])([Object(u["b"])()],t.prototype,"ioConfig",void 0),Object(n["a"])([Object(u["b"])({type:[I["a"]]})],t.prototype,"multidimensionalDefinition",void 0),Object(n["a"])([Object(u["b"])()],t.prototype,"raster",void 0),Object(n["a"])([Object(u["b"])({readOnly:!0}),Object(v["a"])("raster.rasterInfo")],t.prototype,"rasterInfo",void 0),Object(n["a"])([Object(u["b"])()],t.prototype,"sourceJSON",void 0),Object(n["a"])([Object(u["b"])({type:P["a"],json:{read:!1}}),Object(v["a"])("rasterInfo.spatialReference")],t.prototype,"spatialReference",void 0),Object(n["a"])([Object(u["b"])({type:R["a"],json:{read:!1}}),Object(v["a"])("rasterInfo.storageInfo.tileInfo")],t.prototype,"tileInfo",void 0),Object(n["a"])([Object(u["b"])(j["n"])],t.prototype,"url",null),Object(n["a"])([Object(u["b"])({types:a["a"]})],t.prototype,"renderer",null),Object(n["a"])([Object(u["b"])()],t.prototype,"symbolizer",void 0),t=Object(n["a"])([Object(m["a"])("esri.layers.ImageryTileMixin")],t),t};var B=i("b911"),z=i("0db5"),D=i("8e17"),A=i("5a62"),N=i("601a"),L=i("a1f3"),J=i("4607"),H=i("a4f3"),G=i("53d3"),W=i("6a0ed"),q=i("fab3"),$=i("218c"),U=i("1451"),Y=i("9dee"),V=i("b4e0"),X=i("4ae5");const K=8;let Q=class extends(Object(q["b"])(W["a"])){constructor(){super(...arguments),this.rasterJobHandler=null,this.datasetName=null,this.datasetFormat=null,this.rasterInfo=null,this.ioConfig={sampling:"closest"}}async init(){const e=Object(V["g"])();this.addResolvingPromise(e),await this.when()}normalizeCtorArgs(e){return e&&e.ioConfig&&(e={...e,ioConfig:{resolution:null,bandIds:null,sampling:"closest",tileInfo:R["a"].create(),...e.ioConfig}}),e}get _isGlobalWrappableSource(){const{rasterInfo:e}=this,t=Object(V["e"])(e.spatialReference);return Object(o["k"])(t)&&e.extent.width>=t/2}set url(e){this._set("url",Object(w["g"])(e,x["a"].getLogger(this.declaredClass)))}async open(e){throw new s["a"]("BaseRaster:open-not-implemented","open() is not implemented")}async fetchTile(e,t,i,n={}){const r=n.tileInfo||this.rasterInfo.storageInfo.tileInfo,a=this.getTileExtentFromTileInfo(e,t,i,r);return this.fetchPixels(a,r.size[0],r.size[1],n)}async identify(e,t={}){t=this._getRequestOptionsWithSliceId(t);const{spatialReference:i,extent:n}=this.rasterInfo,{datumTransformation:r}=t;let a=Object(V["i"])(e,i,r);if(!n.intersects(a))return{location:a,value:null};if(Object(o["k"])(this.rasterInfo.transform)){const e=this.rasterInfo.transform.inverseTransform(a);if(!this.rasterInfo.nativeExtent.intersects(e))return{location:e,value:null};a=e}let s=0;if(t.srcResolution)s=Object(V["m"])(t.srcResolution,this.rasterInfo,this.ioConfig.sampling).pyramidLevel;else if(s=await this.computeBestPyramidLevelForLocation(e,t),null==s)return{location:a,value:null};const l=this.identifyPixelLocation(a,s,null);if(null===l)return{location:a,value:null};const{row:c,col:u,rowOffset:f,colOffset:h}=l,d=Object($["d"])(this.url,t.sliceId),m=`${s}/${c}/${u}`;let p=Object($["c"])(d,null,m);Object(o["j"])(p)&&(p=this.fetchRawTile(s,c,u,t),Object($["e"])(d,null,m,p));const b=await p;if(Object(o["j"])(b)||!b.pixels||0===b.pixels.length)return{location:a,value:null};const y=f*this.rasterInfo.storageInfo.blockHeight+h,g=!b.mask||b.mask[y]?b.pixels.map(e=>e[y]):null,x=this.rasterInfo.dataType;return("vector-magdir"===x||"vector-uv"===x)&&(null==g?void 0:g.length)>1?{location:a,value:g,magdirValue:"vector-magdir"===x?[g[0],g[1]]:Object(T["j"])([g[0],g[1]]),pyramidLevel:s}:{location:a,value:g,pyramidLevel:s}}async fetchPixels(e,t,i,n={}){if(e=Object(V["l"])(e),(n=this._getRequestOptionsWithSliceId(n)).requestRawData)return this._fetchPixels(e,t,i,n);const r=Object(V["e"])(e.spatialReference),a=Object(V["f"])(e);if(Object(o["j"])(r)||0===a||1===a&&this._isGlobalWrappableSource)return this._fetchPixels(e,t,i,n);if(a>=3)return{extent:e,pixelBlock:null};const s=[],{xmin:l,xmax:c}=e,u=Math.round(r/(c-l)*t),f=u-Math.round((r/2-l)/(c-l)*t);let h=0;const d=[];for(let o=0;o<=a;o++){const m=new M["a"]({xmin:0===o?l:-r/2,xmax:o===a?c-r*o:r/2,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference}),p=0===o?u-f:o===a?t-h:u;h+=p,d.push(p);const b=n.disableWrapAround&&o>0?null:this._fetchPixels(m,p,i,n);s.push(b)}const m=(await Promise.all(s)).map(e=>null==e?void 0:e.pixelBlock);let p=null;const b={width:t,height:i};return p=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:m,srcMosaicSize:b,destDimension:null,coefs:null,sampleSpacing:null,interpolation:"nearest",alignmentInfo:null,blockWidths:d},n)).pixelBlock:Object(Y["l"])(m,b,{blockWidths:d}),{extent:e,srcExtent:Object(V["h"])(e,this.rasterInfo.spatialReference,n.datumTransformation),pixelBlock:p}}async fetchRawPixels(e,t,i,n={}){t={x:Math.floor(t.x),y:Math.floor(t.y)};const r=await this._fetchRawTiles(e,t,i,n),{nativeExtent:a,nativePixelSize:s,storageInfo:l}=this.rasterInfo,c=2**e,u=s.x*c,f=s.y*c,h=new M["a"]({xmin:a.xmin+u*t.x,xmax:a.xmin+u*(t.x+i.width-1),ymin:a.ymax-f*(t.y+i.height-1),ymax:a.ymax-f*t.y,spatialReference:a.spatialReference});if(!r)return{extent:h,srcExtent:h,pixelBlock:null};const{pixelBlocks:d,mosaicSize:m}=r;if(1===d.length&&Object(o["k"])(d[0])&&d[0].width===i.width&&d[0].height===i.height)return{extent:h,srcExtent:h,pixelBlock:r.pixelBlocks[0]};const p=e>0?l.pyramidBlockWidth:l.blockWidth,b=e>0?l.pyramidBlockHeight:l.blockHeight,y={x:t.x%p,y:t.y%b};let g;return g=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:d,srcMosaicSize:m,destDimension:i,clipOffset:y,clipSize:i,coefs:null,sampleSpacing:null,interpolation:n.interpolation,alignmentInfo:null,blockWidths:null},n)).pixelBlock:Object(Y["l"])(d,m,{clipOffset:y,clipSize:i}),{extent:h,srcExtent:h,pixelBlock:g}}fetchRawTile(e,t,i,n){throw new s["a"]("BaseRaster:read-not-implemented","fetchRawTile() is not implemented")}computeExtent(e){return Object(V["h"])(this.rasterInfo.extent,e)}decodePixelBlock(e,t){return!this.rasterJobHandler||t.useCanvas?Object(U["a"])(e,t):this.rasterJobHandler.decode({data:e,options:t})}async request(e,t,i){var n,r;const{customFetchParameters:a}=this.ioConfig,{range:s,query:o,headers:l}=t;i=null!=(n=null!=(r=i)?r:t.retryCount)?n:this.ioConfig.retryCount;const c=s?{Range:`bytes=${s.from}-${s.to}`}:null;try{return await Object(g["default"])(e,{...t,query:{...o,...a},headers:{...l,...c}})}catch(u){if(i>0)return i--,this.request(e,t,i);throw u}}getSliceIndex(e){const{multidimensionalInfo:t}=this.rasterInfo;if(!Object(o["k"])(t))return null;if(!Object(o["k"])(e)||0===e.length)return null;let i=0;const n=e[0].variableName;for(let r=0;rthis._getDimensionValuesCount(e)).reduce((e,t)=>e+t);break}const o=s.map(e=>this._getDimensionValuesCount(e)),l=s.length;for(let t=0;te.dimensionName===s[t].name);if(null==n)return null;const r=Array.isArray(n.values[0])?n.values[0][0]:n.values[0],a=this._getIndexFromDimensions(r,s[t]);if(-1===a)return null;o.shift(),i+=t===l-1?a:a*o.reduce((e,t)=>e+t)}}return i}getTileExtentFromTileInfo(e,t,i,n){const r=n.lodAt(e);return this.getTileExtent({x:r.resolution,y:r.resolution},t,i,n.origin,n.spatialReference,n.size)}updateTileInfo(){const{storageInfo:e,spatialReference:t,extent:i,pixelSize:n}=this.rasterInfo;if(!e.tileInfo){const r=[],a=e.maximumPyramidLevel||0;let s=Math.max(n.x,n.y),o=1/.0254*96*s;for(let e=0;e<=a;e++)r.push({level:a-e,resolution:s,scale:o}),s*=2,o*=2;const l=new X["a"]({x:i.xmin,y:i.ymax,spatialReference:t});e.tileInfo=new R["a"]({origin:l,size:[e.blockWidth,e.blockHeight],spatialReference:t,lods:r}),e.isVirtualTileInfo=!0}}createRemoteDatasetStorageInfo(e,t=512,i=512,n){const{width:r,height:a,nativeExtent:s,pixelSize:o,spatialReference:l}=e,c=new X["a"]({x:s.xmin,y:s.ymax,spatialReference:l});null==n&&(n=Math.max(0,Math.round(Math.log(Math.max(r,a))/Math.LN2-8)));const u=this.computeBlockBoundary(s,512,512,{x:s.xmin,y:s.ymax},[o],n);e.storageInfo=new G["a"]({blockWidth:t,blockHeight:i,pyramidBlockWidth:t,pyramidBlockHeight:i,origin:c,firstPyramidLevel:1,maximumPyramidLevel:n,blockBoundary:u})}async computeBestPyramidLevelForLocation(e,t={}){return 0}computeBlockBoundary(e,t,i,n,r,a=0,s=2){if(1===r.length&&a>0){r=[...r];let{x:e,y:t}=r[0];for(let i=0;io)return null;const u=this.getPyramidPixelSize(t),{x:f,y:h}=u,d=(l.y-c.y)/h/s,m=(c.x-l.x)/f/a,p=Math.min(s-1,Math.floor((d-Math.floor(d))*s)),b=Math.min(a-1,Math.floor((m-Math.floor(m))*a));return{pyramidLevel:t,row:Math.floor(d),col:Math.floor(m),rowOffset:p,colOffset:b,srcLocation:c}}getTileExtent(e,t,i,n,r,a){const[s,o]=a,l=n.x+i*s*e.x,c=l+s*e.x,u=n.y-t*o*e.y,f=u-o*e.y;return new M["a"]({xmin:l,xmax:c,ymin:f,ymax:u,spatialReference:r})}getBlockWidthHeight(e){return{blockWidth:e>0?this.rasterInfo.storageInfo.pyramidBlockWidth:this.rasterInfo.storageInfo.blockWidth,blockHeight:e>0?this.rasterInfo.storageInfo.pyramidBlockHeight:this.rasterInfo.storageInfo.blockHeight}}isBlockOutside(e,t,i){const n=this.rasterInfo.storageInfo.blockBoundary[e];return!n||n.maxRowt||n.minCol>i}async _fetchPixels(e,t,i,n={}){let r=Object(V["f"])(e);if(r>=2)return{extent:e,pixelBlock:null};const a=this._getSourceDataInfo(e,t,i,n),{pyramidLevel:s,pyramidResolution:l,srcResolution:c,srcExtent:u,srcWidth:f,srcHeight:h}=a;if(0===f||0===h)return{extent:e,srcExtent:u,pixelBlock:null};const d=Object(o["t"])(this.rasterInfo.transform),m="gcs-shift"===(null==d?void 0:d.type),p=Object(o["k"])(Object(V["e"])(e.spatialReference));!m&&p||(r=Object(V["f"])(a.srcExtent,m));const b=this.rasterInfo.storageInfo,y={x:Math.floor((u.xmin-b.origin.x)/l.x+.1),y:Math.floor((b.origin.y-u.ymax)/l.y+.1)},g=await this._fetchRawTiles(s,y,{width:f,height:h,wrapCount:r},n);if(!g)return{extent:e,srcExtent:u,pixelBlock:null};const x=s>0?b.pyramidBlockWidth:b.blockWidth,v=s>0?b.pyramidBlockHeight:b.blockHeight,O=x===f&&v===h&&y.x%x==0&&y.y%v==0,w=new X["a"]({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference}),j=!e.spatialReference.equals(this.rasterInfo.spatialReference),{datumTransformation:I}=n;if(!j&&O&&1===g.pixelBlocks.length&&x===t&&v===i&&c.x===w.x&&c.y===w.y)return{extent:e,srcExtent:u,pixelBlock:g.pixelBlocks[0]};const S=p&&Object(o["k"])(Object(V["e"])(u.spatialReference)),R=n.requestProjectedLocalDirections&&this.rasterInfo.dataType.startsWith("vector");R&&!this.rasterJobHandler&&await Object(V["g"])();const _=this.rasterJobHandler?await this.rasterJobHandler.getProjectionOffsetGrid({projectedExtent:e,srcBufferExtent:g.extent,pixelSize:w.toJSON(),datumTransformation:I,rasterTransform:d,hasWrapAround:r>0||S,isAdaptive:!1!==this.ioConfig.optimizeProjectionAccuracy,includeGCSGrid:R},n):Object(V["c"])({projectedExtent:e,srcBufferExtent:g.extent,pixelSize:w,datumTransformation:I,rasterTransform:d,hasWrapAround:r>0||S,isAdaptive:!1,includeGCSGrid:R});let k;const C=!n.requestRawData,M={rows:_.spacing[0],cols:_.spacing[1]},P=Object(o["t"])(this._getRasterTileAlignmentInfo(s,g.extent.xmin)),{pixelBlocks:F,mosaicSize:E,isPartiallyFilled:B}=g;let z=null;if(this.rasterJobHandler){const e=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:F,srcMosaicSize:E,destDimension:C?{width:t,height:i}:null,coefs:C?_.coefficients:null,sampleSpacing:C?M:null,projectDirections:R,gcsGrid:R?_.gcsGrid:null,isUV:"vector-uv"===this.rasterInfo.dataType,interpolation:n.interpolation,alignmentInfo:P,blockWidths:null},n);({pixelBlock:k,localNorthDirections:z}=e)}else{const e=Object(Y["l"])(F,E,{alignmentInfo:P});k=C?Object(Y["a"])(e,{width:t,height:i},_.coefficients,M,n.interpolation):e,R&&_.gcsGrid&&(z=Object(Y["i"])({width:t,height:i},_.gcsGrid),k=Object(T["a"])(k,this.rasterInfo.dataType,z))}return n.requestRawData||R?{srcExtent:u,pixelBlock:k,transformGrid:_,localNorthDirections:z,extent:e,isPartiallyFilled:B}:{srcExtent:u,extent:e,pixelBlock:k}}async _fetchRawTiles(e,t,i,n){const{origin:r,blockBoundary:a}=this.rasterInfo.storageInfo,{blockWidth:s,blockHeight:l}=this.getBlockWidthHeight(e);let{x:c,y:u}=t,{width:f,height:h,wrapCount:d}=i;const m=this._getRasterTileAlignmentInfo(e,0);n.buffer&&(c-=n.buffer.cols,u-=n.buffer.rows,f+=2*n.buffer.cols,h+=2*n.buffer.rows);let p=0,b=0,y=0;d&&Object(o["k"])(m)&&(({worldColumnCountFromOrigin:b,originColumnOffset:y,rightPadding:p}=m),b*m.blockWidth-p>=c+f&&(p=0));const g=Math.floor(c/s),x=Math.floor(u/l),v=Math.floor((c+f+p-1)/s),O=Math.floor((u+h+p-1)/l),w=a[e];if(!w)return null;const{minRow:j,minCol:I,maxCol:S,maxRow:R}=w;if(0===d&&(OR||g>S))return null;const T=new Array;let _=!1;const k=null==this.ioConfig.allowPartialFill?n.allowPartialFill:this.ioConfig.allowPartialFill;for(let M=x;M<=O;M++)for(let t=g;t<=v;t++){let i=t;if(!n.disableWrapAround&&d&&Object(o["k"])(m)&&b<=t&&(i=t-b-y),M>=j&&i>=I&&R>=M&&S>=i){const t=this._fetchRawTile(e,M,i,n);k?T.push(new Promise(e=>{t.then(t=>e(t)).catch(()=>{_=!0,e(null)})})):T.push(t)}else T.push(null)}if(0===T.length)return null;const C=await Promise.all(T),P={height:(O-x+1)*l,width:(v-g+1)*s},{spatialReference:F}=this.rasterInfo,E=this.getPyramidPixelSize(e),{x:B,y:z}=E;return{extent:new M["a"]({xmin:r.x+g*s*B,xmax:r.x+(v+1)*s*B,ymin:r.y-(O+1)*l*z,ymax:r.y-x*l*z,spatialReference:F}),pixelBlocks:C,mosaicSize:P,isPartiallyFilled:_}}_fetchRawTile(e,t,i,n){const r=this.rasterInfo.storageInfo.blockBoundary[e];if(!r)return Promise.resolve(null);const{minRow:a,minCol:s,maxCol:l,maxRow:u}=r;if(tu||i>l)return Promise.resolve(null);const f=Object($["d"])(this.url,n.sliceId),h=`${e}/${t}/${i}`;let d=Object($["c"])(f,n.registryId,h);if(Object(o["j"])(d)){const r=new AbortController;d=this.fetchRawTile(e,t,i,{...n,signal:r.signal}),Object($["e"])(f,n.registryId,h,d,r),d.catch(()=>Object($["b"])(f,n.registryId,h))}return n.signal&&Object(c["q"])(n,()=>{Object($["a"])(f,n.registryId,h)}),d}_getIndexFromDimensions(e,t){const{extent:i,interval:n,unit:r,values:a}=t;if(null!=a&&a.length)return Array.isArray(a[0])?a.findIndex(t=>t[0]<=e&&t[1]>=e):a.indexOf(e);if(e>i[1])return-1;const s=i[0];let o=-1;if("ISO8601"===r){var l;switch((null==(l=t.intervalUnit)?void 0:l.toLowerCase())||"seconds"){case"seconds":o=Math.round((e-s)/1e3/n);break;case"minutes":o=Math.round((e-s)/6e4/n);break;case"hours":o=Math.round((e-s)/36e5/n);break;case"days":o=Math.round((e-s)/864e5/n);break;case"years":o=Math.round((new Date(e).getUTCFullYear()-new Date(s).getUTCFullYear())/n);break;case"decades":o=Math.round((new Date(e).getUTCFullYear()-new Date(s).getUTCFullYear())/10/n)}return o}return Math.round((e-s)/n)}_getDimensionValuesCount(e){const{extent:t,interval:i,unit:n,values:r}=e;let a=(null==r?void 0:r.length)||0;if(a)return a;const s=t[0];if(0===a&&"ISO8601"===n){var o;switch((null==(o=e.intervalUnit)?void 0:o.toLowerCase())||"seconds"){case"seconds":a=Math.round((t[1]-t[0])/1e3/i);break;case"minutes":a=Math.round((t[1]-t[0])/6e4/i);break;case"hours":a=Math.round((t[1]-t[0])/36e5/i);break;case"days":a=Math.round((t[1]-t[0])/864e5/i);break;case"years":a=Math.round((new Date(t[1]).getUTCFullYear()-new Date(s).getUTCFullYear())/i);break;case"decades":a=Math.round((new Date(t[1]).getUTCFullYear()-new Date(s).getUTCFullYear())/10/i)}return a}return Math.round((t[1]-t[0])/i)}_getRasterTileAlignmentInfo(e,t){return null==this._rasterTileAlighmentInfo&&(this._rasterTileAlighmentInfo=Object(V["d"])(this.rasterInfo)),Object(o["k"])(this._rasterTileAlighmentInfo.pyramidsInfo)?{startX:t,halfWorldWidth:this._rasterTileAlighmentInfo.halfWorldWidth,hasGCSSShiftTransform:this._rasterTileAlighmentInfo.hasGCSSShiftTransform,...this._rasterTileAlighmentInfo.pyramidsInfo[e]}:null}_getSourceDataInfo(e,t,i,n={}){const r={datumTransformation:n.datumTransformation,pyramidLevel:0,pyramidResolution:null,srcExtent:null,srcHeight:0,srcResolution:null,srcWidth:0};n.srcResolution&&(r.srcResolution=n.srcResolution,this._updateSourceDataInfo(e,r));const a=this.rasterInfo.storageInfo.maximumPyramidLevel||0,{srcWidth:s,srcHeight:o,pyramidLevel:l}=r,c=s/t,u=o/i,f=l=16;if(f||l===a&&(c>K||u>K)||0===s||0===o){const s=new X["a"]({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference});let o=Object(V["j"])(s,this.rasterInfo.spatialReference,e,r.datumTransformation);const h=!o||n.srcResolution&&o.x+o.y=e){const t=2**e;o={x:n.srcResolution.x*t,y:n.srcResolution.y*t}}}o&&(r.srcResolution=o,this._updateSourceDataInfo(e,r))}return(r.srcWidth/t>K||r.srcHeight/i>K)&&(r.srcWidth=0,r.srcHeight=0),r}_updateSourceDataInfo(e,t){t.srcWidth=0,t.srcHeight=0;const i=this.rasterInfo.spatialReference,{srcResolution:n,datumTransformation:r}=t,{pyramidLevel:a,pyramidResolution:s,excessiveReading:l}=Object(V["m"])(n,this.rasterInfo,this.ioConfig.sampling);if(l)return;let c=t.srcExtent||Object(V["h"])(e,i,r);if(null==c)return;const u=Object(o["t"])(this.rasterInfo.transform);u&&(c=u.inverseTransform(c)),t.srcExtent=c;const f=Math.ceil((c.xmax-c.xmin)/s.x-.1),h=Math.ceil((c.ymax-c.ymin)/s.y-.1);t.pyramidLevel=a,t.pyramidResolution=s,t.srcWidth=f,t.srcHeight=h}_getRequestOptionsWithSliceId(e){return Object(o["k"])(this.rasterInfo.multidimensionalInfo)&&null==e.sliceId&&(e={...e,sliceId:this.getSliceIndex(e.multidimensionalDefinition)}),e}};Object(n["a"])([Object(u["b"])()],Q.prototype,"_rasterTileAlighmentInfo",void 0),Object(n["a"])([Object(u["b"])({readOnly:!0})],Q.prototype,"_isGlobalWrappableSource",null),Object(n["a"])([Object(u["b"])(j["n"])],Q.prototype,"url",null),Object(n["a"])([Object(u["b"])({type:String,json:{write:!0}})],Q.prototype,"datasetName",void 0),Object(n["a"])([Object(u["b"])({type:String,json:{write:!0}})],Q.prototype,"datasetFormat",void 0),Object(n["a"])([Object(u["b"])()],Q.prototype,"rasterInfo",void 0),Object(n["a"])([Object(u["b"])()],Q.prototype,"ioConfig",void 0),Object(n["a"])([Object(u["b"])()],Q.prototype,"sourceJSON",void 0),Q=Object(n["a"])([Object(m["a"])("esri.layers.support.rasterDatasets.BaseRaster")],Q);const Z=Q;var ee=i("742a");function te(e){const t=e.fields,i=e.records,n=t.some(e=>"oid"===e.name.toLowerCase())?"OBJECTID":"OID",r=[{name:n,type:"esriFieldTypeOID",alias:"OID"}].concat(t.map(e=>({name:e.name,type:"esriFieldType"+e.typeName,alias:e.name}))),a=r.map(e=>e.name),s=[];let o=0,l=0;return i.forEach(e=>{const t={};for(t[n]=o++,l=1;l0)for(;c.lengtha;){const i=[];32===t.getUint8(o)?(o+=1,l.forEach(t=>{if("C"===t.type)i.push(Object(ee["a"])(new Uint8Array(e,o,t.length)).trim());else if("N"===t.type)i.push(parseInt(String.fromCharCode.apply(null,new Uint8Array(e,o,t.length)).trim(),10));else if("F"===t.type)i.push(parseFloat(String.fromCharCode.apply(null,new Uint8Array(e,o,t.length)).trim()));else if("D"===t.type){const n=String.fromCharCode.apply(null,new Uint8Array(e,o,t.length)).trim();i.push(new Date(parseInt(n.substring(0,4),10),parseInt(n.substring(4,6),10)-1,parseInt(n.substring(6,8),10)))}o+=t.length}),c.push(i)):o+=a}}return{header:s,fields:l,records:c,recordSet:te({fields:l,records:c})}}}var ne=i("8c6a"),re=i("2edc");const ae=new Map;ae.set("int16","esriFieldTypeSmallInteger"),ae.set("int32","esriFieldTypeInteger"),ae.set("int64","esriFieldTypeInteger"),ae.set("float32","esriFieldTypeSingle"),ae.set("float64","esriFieldTypeDouble"),ae.set("text","esriFieldTypeString");const se=8;let oe=class extends Z{constructor(){super(...arguments),this.storageInfo=null,this.datasetFormat="CRF"}async open(e){await this.init();const{data:t}=await this.request(this.url+"/conf.json",{signal:null==e?void 0:e.signal});if(!this._validateHeader(t))throw new s["a"]("cloudraster:open","Invalid or unsupported conf.json.");this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);const{storageInfo:i,rasterInfo:n}=this._parseHeader(t);if("thematic"===n.dataType){const e=await this._fetchAuxiliaryInformation();n.attributeTable=e}this._set("storageInfo",i),this._set("rasterInfo",n),this.ioConfig.retryCount=this.ioConfig.retryCount||0}async fetchRawTile(e,t,i,n={}){const r=this.rasterInfo.storageInfo.maximumPyramidLevel-e;if(r<0)return null;const a=this._buildCacheFilePath(r,t,i,n.multidimensionalDefinition),s=this._getIndexRecordFromBundle(t,i),o=await this.request(a,{range:{from:0,to:this.storageInfo.headerSize-1},responseType:"array-buffer",signal:n.signal});if(!o)return null;const l=new Uint8Array(o.data),c=this._getTileEndAndContentType(l,s);if(0===c.recordSize)return null;const u=await this.request(a,{range:{from:c.position,to:c.position+c.recordSize},responseType:"array-buffer",signal:n.signal});return u?this.decodePixelBlock(u.data,{width:this.rasterInfo.storageInfo.tileInfo.size[0],height:this.rasterInfo.storageInfo.tileInfo.size[1],planes:null,pixelType:null}):null}_validateHeader(e){const t=["origin","extent","geodataXform","LODInfos","blockWidth","blockHeight","bandCount","pixelType","pixelSizeX","pixelSizeY","format","packetSize"];return e&&"RasterInfo"===e.type&&!t.some(t=>!e[t])}_parseHeader(e){var t,i;const n=["u1","u2","u4","u8","s8","u16","s16","u32","s32","f32","f64"][e.pixelType],{bandCount:r,histograms:a,colormap:s,blockWidth:o,blockHeight:l,firstPyramidLevel:c,maximumPyramidLevel:u}=e,f=e.statistics&&e.statistics.map(e=>({min:e.min,max:e.max,avg:e.mean,stddev:e.standardDeviation,median:e.median,mode:e.mode})),h=e.extent.spatialReference,d=null==(t=e.geodataXform)?void 0:t.spatialReference,m=new P["a"](null!=h&&h.wkid||null!=h&&h.wkt?h:d);let p=new M["a"]({xmin:e.extent.xmin,ymin:e.extent.ymin,xmax:e.extent.xmax,ymax:e.extent.ymax,spatialReference:m});const b=new X["a"]({x:e.pixelSizeX,y:e.pixelSizeY,spatialReference:m}),y=Math.round((p.xmax-p.xmin)/b.x),g=Math.round((p.ymax-p.ymin)/b.y),x=this._parseTransform(e.geodataXform),v=x?p:null;x&&(p=x.forwardTransform(p),b.x=(p.xmax-p.xmin)/y,b.y=(p.ymax-p.ymin)/g);const O=null!=(i=e.properties)?i:{},w=e.format.toLowerCase().replace("cache/",""),j=new X["a"](e.origin.x,e.origin.y,m);let I,S,T,_;if(s&&s.colors)for(I=[],S=0;S>>24,T<<8>>>24,T>>>24]);const k=e.LODInfos,C=[];for(S=0;S0)for(S=0;Se.data).catch(()=>null),i=this.request(this.url+"/conf.vat.dbf",{responseType:"array-buffer",signal:e}).then(e=>e.data).catch(()=>null),n=await Promise.all([t,i]);let r;if(n[0]){let e=n[0].fields;const t=n[0].values;if(e&&t){e=e.map(e=>({type:"OID"===e.name?"esriFieldTypeOID":ae.get(e.type),name:e.name,alias:e.alias||e.name}));const i=t.map(e=>({attributes:e}));e&&t&&(r={fields:e,features:i})}}return!r&&n[1]&&(r=ie.parse(n[1]).recordSet),re["default"].fromJSON(r)}_buildCacheFilePath(e,t,i,n){const r=this.storageInfo.packetSize,a=Math.floor(t/r)*r,s=Math.floor(i/r)*r,l="R"+this._toHexString4(a)+"C"+this._toHexString4(s);let c="L";c+=e>=10?e.toString():"0"+e.toString();const{multidimensionalInfo:u}=this.rasterInfo,f=null==n?void 0:n[0];if(!Object(o["k"])(u)||!f)return`${this.url}/_alllayers/${c}/${l}.bundle`;let h=u.variables.find(e=>e.name===f.variableName).dimensions[0].values.indexOf(f.values[0]).toString(16);const d=4-h.length;for(let o=0;o0;)t="0"+t}return t}};Object(n["a"])([Object(u["b"])({readOnly:!0})],oe.prototype,"storageInfo",void 0),Object(n["a"])([Object(u["b"])({type:String,json:{write:!0}})],oe.prototype,"datasetFormat",void 0),oe=Object(n["a"])([Object(m["a"])("esri.layers.support.rasterDatasets.CloudRaster")],oe);const le=oe;let ce=class extends Z{constructor(){super(...arguments),this.datasetFormat="MEMORY"}async open(e){var t;await this.init();const{pixelBlock:i,statistics:n,histograms:r,name:a,keyProperties:s,nativeExtent:o,transform:l}=this.data,{width:c,height:u,pixelType:f}=i,h=this.data.extent||new M["a"]({xmin:-.5,ymin:.5,xmax:c-.5,ymax:u-.5,spatialReference:new P["a"]({wkid:3857})}),d=null!=(t=this.data.isPseudoSpatialReference)?t:!this.data.extent,m={x:h.width/c,y:h.height/u},p=new H["a"]({width:c,height:u,pixelType:f,extent:h,nativeExtent:o,transform:l,pixelSize:m,spatialReference:h.spatialReference,bandCount:3,keyProperties:s||{},statistics:n,isPseudoSpatialReference:d,histograms:r});this.createRemoteDatasetStorageInfo(p,512,512),this._set("rasterInfo",p),this.updateTileInfo(),await this._buildInMemoryRaster(i,{width:512,height:512},e),this.datasetName=a,this.url="/InMemory/"+a}fetchRawTile(e,t,i,n={}){const r=this._pixelBlockTiles.get(`${e}/${t}/${i}`);return Promise.resolve(r)}async _buildInMemoryRaster(e,t,i){const n=this.rasterInfo.storageInfo.maximumPyramidLevel,r=this.rasterJobHandler?this.rasterJobHandler.split({pixelBlock:e,tileSize:t,maximumPyramidLevel:n},i):Promise.resolve(Object(Y["p"])(e,t,n)),a=Object(o["k"])(this.rasterInfo.statistics),l=Object(o["k"])(this.rasterInfo.histograms),u=a&&l?Promise.resolve({statistics:null,histograms:null}):this.rasterJobHandler?this.rasterJobHandler.estimateStatisticsHistograms({pixelBlock:e},i):Promise.resolve(Object(Y["g"])(e)),f=await Object(c["j"])([r,u]);if(!f[0].value&&f[1].value)throw new s["a"]("inmemory-raster:open","failed to build in memory raster");var h,d;this._pixelBlockTiles=f[0].value,a||(this.rasterInfo.statistics=null==(h=f[1].value)?void 0:h.statistics),l&&(this.rasterInfo.histograms=null==(d=f[1].value)?void 0:d.histograms)}};Object(n["a"])([Object(u["b"])({type:String,json:{write:!0}})],ce.prototype,"datasetFormat",void 0),Object(n["a"])([Object(u["b"])()],ce.prototype,"data",void 0),ce=Object(n["a"])([Object(m["a"])("esri.layers.support.rasterDatasets.InMemoryRaster")],ce);const ue=ce;function fe(e,t){if(!e||!t)return[];let i=t;t.indexOf("/")>-1?(i=t.slice(0,t.indexOf("/")),t=t.slice(t.indexOf("/")+1)):t="";const n=[];if(t){const r=fe(e,i);for(let e=0;en.push(e));return n}const r=e.getElementsByTagNameNS("*",i);if(!r||0===r.length)return[];for(let a=0;a-1?(i=t.slice(0,t.indexOf("/")),t=t.slice(t.indexOf("/")+1)):t="";const n=fe(e,i);return n.length>0?t?he(n[0],t):n[0]:null}function de(e,t=null){const i=t?he(e,t):e;let n;return i?(n=i.textContent||i.nodeValue,n?n.trim():null):null}function me(e,t){const i=fe(e,t),n=[];let r;for(let a=0;aNumber(e))}function be(e,t){const i=de(e,t);return Number(i)}function ye(e,t){var i;const n=null==e||null==(i=e.nodeName)?void 0:i.toLowerCase(),r=t.toLowerCase();return n.slice(n.lastIndexOf(":")+1)===r}var ge=i("7fb1");function xe(e,t){if(!e||!t)return null;const i=[];for(let n=0;nNumber(e));let l,c,u,f;fe(e,"Metadata/MDI").forEach(e=>{var t;const i=Number(null!=(t=e.textContent)?t:e.nodeValue);switch(e.getAttribute("key").toUpperCase()){case"STATISTICS_MINIMUM":l=i;break;case"STATISTICS_MAXIMUM":c=i;break;case"STATISTICS_MEAN":u=i;break;case"STATISTICS_STDDEV":f=i}});const h=be(e,"Metadata/SourceBandIndex");return{noDataValue:i,histogram:null!=o&&o.length&&null!=l&&null!=c?{min:r,max:a,size:s||o.length,counts:o}:null,sourceBandIndex:h,statistics:null!=l&&null!=c?{min:l,max:c,avg:u,stddev:f}:null}}function we(e){if(!e)return null;let t=Number(e);if(!isNaN(t)&&0!==t)return new P["a"]({wkid:t});if((e=String(e)).startsWith("COMPD_CS")){if(!e.includes("VERTCS")||!e.includes("GEOGCS")&&!e.startsWith("PROJCS"))return null;const i=e.indexOf("VERTCS"),n=e.indexOf("PROJCS"),r=n>-1?n:e.indexOf("GEOGCS");if(-1===r)return null;const a=e.slice(r,e.lastIndexOf("]",i)+1).trim(),s=e.slice(i,e.lastIndexOf("]")).trim();t=je(a);const o=new P["a"](t?{wkid:t}:{wkt:a}),l=je(s);return l&&(o.vcsWkid=l),o}return e.startsWith("GEOGCS")||e.startsWith("PROJCS")?(t=je(e),new P["a"](0!==t?{wkid:t}:{wkt:e})):null}function je(e){var t;const i=e.replace(/\]/g,"[").replace(/\"/g,"").split("[").map(e=>e.trim()).filter(e=>""!==e),n=i[i.length-1].split(","),r=null==(t=n[0])?void 0:t.toLowerCase();if(("epsg"===r||"esri"===r)&&e.endsWith('"]]')){const e=Number(n[1]);if(!isNaN(e)&&0!==e)return e}return 0}function Ie(e){var t;if("pamdataset"!==(null==e||null==(t=e.documentElement.tagName)?void 0:t.toLowerCase()))return{};const i={spatialReference:null,transform:null,metadata:{},rasterBands:[],statistics:null,histograms:null};e.documentElement.childNodes.forEach(e=>{if(1===e.nodeType)if(ye(e,"SRS")){if(!i.spatialReference){const t=de(e);i.spatialReference=we(t)}}else if(ye(e,"Metadata"))if("xml:ESRI"===e.getAttribute("domain")){const{spatialReference:t,transform:n}=ve(e);i.transform=n,i.spatialReference||(i.spatialReference=t)}else fe(e,"MDI").forEach(e=>i.metadata[e.getAttribute("key")]=de(e));else if(ye(e,"PAMRasterBand")){const t=Oe(e);null!=t.sourceBandIndex&&null==i.rasterBands[t.sourceBandIndex]?i.rasterBands[t.sourceBandIndex]=t:i.rasterBands.push(t)}});const n=i.rasterBands;if(n){const e=!!n[0].statistics;i.statistics=e?n.map(e=>e.statistics):null;const t=!!n[0].histogram;i.histograms=t?n.map(e=>e.histogram):null}return i}let Se=class extends Z{async open(e){await this.init();const t=await this._fetchData(e);let{spatialReference:i,statistics:n,histograms:r,transform:a}=await this._fetchAuxiliaryData(e);const s=!i;s&&(i=new P["a"]({wkid:3857})),null!=r&&r.length&&null==n&&(n=Object(Y["f"])(r));const{width:o,height:l}=t;let c=new M["a"]({xmin:-.5,ymin:.5-l,xmax:o-.5,ymax:.5,spatialReference:i});const u=a?a.forwardTransform(c):c;let f=!0;if(a){const e=a.forwardCoefficients;f=e&&0===e[1]&&0===e[2],f&&(a=null,c=u)}const h=new ue({data:{extent:u,nativeExtent:c,transform:a,pixelBlock:t,statistics:n,histograms:r,keyProperties:{DateType:"Processed"},isPseudoSpatialReference:s}});await h.open(),this._set("rasterInfo",h.rasterInfo),this._inMemoryRaster=h}fetchRawTile(e,t,i,n={}){return this._inMemoryRaster.fetchRawTile(e,t,i,n)}async _fetchData(e){const{data:t}=await this.request(this.url,{responseType:"array-buffer",signal:null==e?void 0:e.signal}),i=Object(U["b"])(t).toUpperCase();if("JPG"!==i&&"PNG"!==i&&"GIF"!==i&&"BMP"!==i)throw new s["a"]("image-aux-raster:open","the data is not a supported format");return this._set("datasetFormat",i),await this.decodePixelBlock(t,{format:"jpg",width:1,height:1,useCanvas:!0})}async _fetchAuxiliaryData(e){var t,i;const n=Object(o["t"])(null==e?void 0:e.signal),r=null!=(t=this.ioConfig.skipExtensions)?t:[],a=r.indexOf("aux.xml")>-1?null:this.request(this.url+".aux.xml",{responseType:"xml",signal:n}),s=this.datasetFormat,l="JPG"===s?"jgw":"PNG"===s?"pgw":"BMP"===s?"bpw":null,u=r.indexOf(l)>-1?null:this.request(this.url.slice(0,this.url.lastIndexOf("."))+"."+l,{responseType:"text",signal:n}),f=await Object(c["j"])([a,u]);if(null!=n&&n.aborted)throw Object(c["e"])();const h=Ie(null==(i=f[0].value)?void 0:i.data);if(!h.transform){const e=f[1].value?f[1].value.data.split("\n").slice(0,6).map(e=>Number(e)):null;h.transform=6===(null==e?void 0:e.length)?new ge["a"]({forwardCoefficients:[e[4],e[5],e[0],-e[1],e[2],-e[3]]}):null}return h}};Object(n["a"])([Object(u["b"])({type:String,json:{write:!0}})],Se.prototype,"datasetFormat",void 0),Se=Object(n["a"])([Object(m["a"])("esri.layers.support.rasterDatasets.ImageAuxRaster")],Se);const Re=Se;var Te=i("e041"),_e=i("ab68"),ke=i("9651"),Ce=i("773d");let Me=class extends Z{constructor(){super(...arguments),this._levelOffset=0,this._slices=null,this._tilemapCache=null,this.datasetFormat="RasterTileServer"}async open(e){await this.init();const t=e&&e.signal,i=this.sourceJSON?{data:this.sourceJSON}:await this.request(this.url,{query:{f:"json"},signal:t});i.ssl&&(this.url=this.url.replace(/^http:/i,"https:"));const n=i.data;if(this.sourceJSON=n,!n)throw new s["a"]("imageserverraster:open","cannot initialize tiled image service, missing service info");if(!n.tileInfo)throw new s["a"]("imageserverraster:open","use ImageryLayer to open non-tiled image services");this._fixScaleInServiceInfo();const r=["jpg","jpeg","png","png8","png24","png32","mixed"];this.tileType=n.cacheType,null==this.tileType&&(r.indexOf(n.tileInfo.format.toLowerCase())>-1?this.tileType="Map":"lerc"===n.tileInfo.format.toLowerCase()?this.tileType="Elevation":this.tileType="Raster"),this.datasetName=n.name.slice(n.name.indexOf("/")+1);const a=await this._fetchRasterInfo({signal:t});if(!Object(o["k"])(a))throw new s["a"]("image-server-raster:open","cannot initialize image service");{const e="Map"===this.tileType?Object(_e["a"])(n.tileInfo,n):R["a"].fromJSON(n.tileInfo),{extent:t,pixelSize:i}=a,r=.5/a.width*i.x;let s,o;const l=e.lodAt(Math.max.apply(null,e.lods.map(e=>e.level)));"Map"!==this.tileType&&0!==n.maxScale&&("Raster"===this.tileType?(s=e.lods.find(e=>e.resolution===i.x),s||(s=e.lods[e.lods.length-1])):(s=e.lods.find(e=>Math.abs(e.scale-n.maxScale)e.scale>n.maxScale).sort((e,t)=>e.scale>t.scale?1:-1)[0])),i.x=i.y=s.resolution,a.width=Math.ceil((t.xmax-t.xmin)/i.x-.1),a.height=Math.ceil((t.ymax-t.ymin)/i.y-.1)),s||(s=l);const c=e.lodAt(Math.min.apply(null,e.lods.map(e=>e.level)));"Map"===this.tileType?this._levelOffset=e.lods[0].level:0!==n.minScale&&"Elevation"===this.tileType&&(o=e.lods.find(e=>Math.abs(e.scale-n.minScale)r||!e.lods.some(e=>Math.abs(e.resolution-u){e.level>=o.level&&e.level<=s.level&&m.push({x:e.resolution,y:e.resolution})}),m.sort((e,t)=>e.x-t.x);const p=this.computeBlockBoundary(t,h,d,e.origin,m,f),b=m.length>1?m.slice(1):null;a.storageInfo=new G["a"]({blockWidth:e.size[0],blockHeight:e.size[1],pyramidBlockWidth:e.size[0],pyramidBlockHeight:e.size[1],pyramidResolutions:b,compression:e.format,origin:e.origin,firstPyramidLevel:1,maximumPyramidLevel:f,tileInfo:e,blockBoundary:p}),this._fixGCSShift(a),this._set("rasterInfo",a)}if(n.capabilities.toLowerCase().indexOf("tilemap")>-1){const e={tileInfo:a.storageInfo.tileInfo,parsedUrl:Object(Te["M"])(this.url),url:this.url,tileServers:[],type:"tile"};this._tilemapCache=new ke["a"]({layer:e})}}async fetchRawTile(e,t,i,n={}){if(this._slices&&null==n.sliceId)return null;const{storageInfo:r,extent:a}=this.rasterInfo,s=r.maximumPyramidLevel-e+this._levelOffset,o=`${this.url}/tile/${s}/${t}/${i}`,l=this._slices?{sliceId:n.sliceId||0}:null,{data:c}=await this.request(o,{query:l,responseType:"array-buffer",signal:n.signal});if(!c)return null;const u=await this.decodePixelBlock(c,{width:r.tileInfo.size[0],height:r.tileInfo.size[1],planes:null,pixelType:null,isPoint:"Elevation"===this.tileType}),f=r.blockBoundary[e];if("jpg"!==r.compression||i>f.minCol&&if.minRow&&t{const i=t.find(t=>e.variableName===t.variableName&&t.dimensionName===e.dimensionName);return!i||(Array.isArray(e.values[0])?`${e.values[0][0]}-${e.values[0][1]}`:e.values[0])!==(Array.isArray(i.values[0])?`${i.values[0][0]}-${i.values[0][1]}`:i.values[0])}))return i}return null}async fetchVariableStatisticsHistograms(e,t){const i=this.request(this.url+"/statistics",{query:{variable:e,f:"json"},signal:t}).then(e=>{var t;return null==(t=e.data)?void 0:t.statistics}),n=this.request(this.url+"/histograms",{query:{variable:e,f:"json"},signal:t}).then(e=>{var t;return null==(t=e.data)?void 0:t.histograms}),r=await Promise.all([i,n]);return r[0]&&r[0].forEach(e=>{e.avg=e.mean,e.stddev=e.standardDeviation}),{statistics:r[0]||null,histograms:r[1]||null}}async computeBestPyramidLevelForLocation(e,t={}){if(!this._tilemapCache)return 0;let i=this.identifyPixelLocation(e,0,Object(o["t"])(t.datumTransformation));if(null===i)return null;let n=0;const{maximumPyramidLevel:r}=this.rasterInfo.storageInfo;let a=r-n+this._levelOffset;const s=i.srcLocation;for(;a>=0;){try{if("available"===await this._tilemapCache.fetchAvailability(a,i.row,i.col,t))break}catch{}if(a--,n++,i=this.identifyPixelLocation(s,n,Object(o["t"])(t.datumTransformation)),null===i)return null}return-1===a||null==i?null:n}async _fetchRasterInfo(e){const t=this.sourceJSON,i=Math.ceil((t.extent.xmax-t.extent.xmin)/t.pixelSizeX-.1),n=Math.ceil((t.extent.ymax-t.extent.ymin)/t.pixelSizeY-.1),r=P["a"].fromJSON(t.spatialReference||t.extent.spatialReference);if("Map"===this.tileType)return new H["a"]({width:i,height:n,bandCount:3,extent:M["a"].fromJSON(t.extent),spatialReference:r,pixelSize:new X["a"]({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:r}),pixelType:"u8",statistics:null,keyProperties:{DataType:"processed"}});const{slice:a,signal:s}=e,o=!!t.hasRasterAttributeTable&&this.request(this.url+"/rasterAttributeTable",{query:{slice:a,f:"json"},signal:s}).then(e=>re["default"].fromJSON(e.data)).catch(()=>null),l=!!t.hasColormap&&this.request(this.url+"/colormap",{query:{slice:a,f:"json"},signal:s}).then(e=>{var t;return null==(t=e.data)?void 0:t.colormap}),c=!!t.hasHistograms&&this.request(this.url+"/histograms",{query:{slice:a,f:"json"},signal:s}).then(e=>{var t;return null==(t=e.data)?void 0:t.histograms}),u=this.request(this.url+"/keyProperties",{query:{f:"json"},signal:s}).then(e=>e.data).catch(()=>{}),f=!!t.hasMultidimensions&&this._fetchMultidimensionalInfo(),h=!!t.hasMultidimensions&&this.request(this.url+"/slices",{query:{f:"json"},signal:s}).then(e=>e.data&&e.data.slices).catch(()=>{});return Promise.all([o,l,c,u,f,h]).then(e=>{let a=null;if(t.minValues&&t.minValues.length===t.bandCount){a=[];for(let e=0;e{var t;return null==(t=e.data)?void 0:t.multidimensionalInfo});return null!=(t=i.variables)&&t.length&&i.variables.forEach(e=>{var t;null!=(t=e.statistics)&&t.length&&e.statistics.forEach(e=>{e.avg=e.mean,e.stddev=e.standardDeviation})}),i}_fixScaleInServiceInfo(){const{sourceJSON:e}=this;e.minScale&&e.minScale<0&&(e.minScale=0),e.maxScale&&e.maxScale<0&&(e.maxScale=0)}_fixGCSShift(e){const{extent:t,spatialReference:i}=e;0===t.xmin&&360===t.xmax&&i.wkid&&i.isGeographic&&(e.nativeExtent=e.extent,e.transform=new Ce["a"],e.extent=e.transform.forwardTransform(t))}};Object(n["a"])([Object(u["b"])({type:String,json:{write:!0}})],Me.prototype,"datasetFormat",void 0),Object(n["a"])([Object(u["b"])()],Me.prototype,"tileType",void 0),Me=Object(n["a"])([Object(m["a"])("esri.layers.support.rasterDatasets.ImageServerRaster")],Me);const Pe=Me;var Fe=i("3e27"),Ee=i("e55a");const Be=new Map;Be.set("Int8","s8"),Be.set("UInt8","u8"),Be.set("Int16","s16"),Be.set("UInt16","u16"),Be.set("Int32","s32"),Be.set("UInt32","u32"),Be.set("Float32","f32"),Be.set("Float64","f32"),Be.set("Double64","f32");const ze=new Map;ze.set("none",{blobExtension:".til",isOneSegment:!0,decoderFormat:"bip"}),ze.set("lerc",{blobExtension:".lrc",isOneSegment:!1,decoderFormat:"lerc"}),ze.set("deflate",{blobExtension:".pzp",isOneSegment:!0,decoderFormat:"deflate"}),ze.set("jpeg",{blobExtension:".pjg",isOneSegment:!0,decoderFormat:"jpg"});let De=class extends Z{constructor(){super(...arguments),this._files=null,this._storageIndex=null,this.datasetFormat="MRF"}async open(e){var t;await this.init(),this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);const i=e?Object(o["t"])(e.signal):null,n=await this.request(this.url,{responseType:"xml",signal:i}),{rasterInfo:r,files:a}=this._parseHeader(n.data);if(-1===(null==(t=this.ioConfig.skipExtensions)?void 0:t.indexOf("aux.xml"))){const t=await this._fetchAuxiliaryData(e);var s;null!=t&&(r.statistics=null!=(s=t.statistics)?s:r.statistics,r.histograms=t.histograms,t.histograms&&!Object(o["k"])(r.statistics)&&(r.statistics=Object(Y["f"])(t.histograms)))}this._set("rasterInfo",r),this._files=a;const l=await this.request(a.index,{responseType:"array-buffer",signal:i});this._storageIndex=this._parseIndex(l.data);const{blockWidth:c,blockHeight:u}=this.rasterInfo.storageInfo,f=this.rasterInfo.storageInfo.pyramidScalingFactor,{width:h,height:d}=this.rasterInfo,m=[],p=this._getBandSegmentCount();let b=0,y=-1;for(;b0&&(this.rasterInfo.storageInfo.firstPyramidLevel=1,this.rasterInfo.storageInfo.maximumPyramidLevel=y),this.updateTileInfo()}async fetchRawTile(e,t,i,n={}){const{blockWidth:r,blockHeight:a,blockBoundary:s}=this.rasterInfo.storageInfo,l=s[e];if(!l||l.maxRowt||l.minCol>i)return null;const{bandCount:c,pixelType:u}=this.rasterInfo,{ranges:f,actualTileWidth:h,actualTileHeight:d}=this._getTileLocation(e,t,i);if(!f||0===f.length)return null;if(0===f[0].from&&0===f[0].to){const e=new Uint8Array(r*a);return new Fe["a"]({width:r,height:a,pixels:null,mask:e,validPixelCount:0})}const{bandIds:m}=this.ioConfig,p=this._getBandSegmentCount(),b=[];let y=0;for(y=0;y-1)&&b.push(this.request(this._files.data,{range:{from:f[y].from,to:f[y].to},responseType:"array-buffer",signal:n.signal}));const g=await Promise.all(b),x=g.map(e=>e.data.byteLength).reduce((e,t)=>e+t),v=new Uint8Array(x);let O=0;for(y=0;y1e24)for(y=0;y1e-6&&(i[y]=1);else for(y=0;y0)throw"invalid array buffer must be multiples of 16";let t,i,n,r,a,s;if(Ee["a"]){for(i=new Uint8Array(e),r=new ArrayBuffer(e.byteLength),n=new Uint8Array(r),a=0;aparseFloat(e)))),he(e,"MRF_META/CachedSource"))throw new s["a"]("mrf:open","currently does not support MRF referencing other data files");const b=he(e,"MRF_META/GeoTags"),y=he(b,"BoundingBox");let g,x=!1;if(null!=y){const e=parseFloat(y.getAttribute("minx")),t=parseFloat(y.getAttribute("miny")),i=parseFloat(y.getAttribute("maxx")),n=parseFloat(y.getAttribute("maxy")),r=de(b,"Projection")||"";let a;if("LOCAL_CS[]"!==r)if(r.toLowerCase().startsWith("epsg:")){const e=Number(r.slice(5));isNaN(e)||0===e||(a=new P["a"]({wkid:e}))}else a=we(r);else x=!0,a=new P["a"]({wkid:3857});g=new M["a"](e,t,i,n),g.spatialReference=a}else x=!0,g=new M["a"]({xmin:-.5,ymin:.5-r,xmax:n-.5,ymax:.5,spatialReference:new P["a"]({wkid:3857})});const v=he(e,"MRF_META/Rsets"),O=parseInt(v&&v.getAttribute("scale")||"2",10),w=g.spatialReference,j=new G["a"]({origin:new X["a"]({x:g.xmin,y:g.ymax,spatialReference:w}),blockWidth:f,blockHeight:h,pyramidBlockWidth:f,pyramidBlockHeight:h,compression:o,pyramidScalingFactor:O}),I=new X["a"]({x:g.width/n,y:g.height/r,spatialReference:w}),S=new H["a"]({width:n,height:r,extent:g,isPseudoSpatialReference:x,spatialReference:w,bandCount:a,pixelType:c,pixelSize:I,noDataValue:m,storageInfo:j}),R=de(e,"datafile"),T=de(e,"IndexFile");return{rasterInfo:S,files:{mrf:this.url,index:T||this.url.replace(".mrf",".idx"),data:R||this.url.replace(".mrf",ze.get(o).blobExtension)}}}async _fetchAuxiliaryData(e){try{const{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:null==e?void 0:e.signal});return Ie(t)}catch{return null}}};Object(n["a"])([Object(u["b"])()],De.prototype,"_files",void 0),Object(n["a"])([Object(u["b"])()],De.prototype,"_storageIndex",void 0),Object(n["a"])([Object(u["b"])({type:String,json:{write:!0}})],De.prototype,"datasetFormat",void 0),De=Object(n["a"])([Object(m["a"])("esri.layers.support.rasterIO.MRFRaster")],De);const Ae=De;var Ne=i("6d3d"),Le=i("0ffd");const Je=function(e,t){const i=e.get(t);return i&&i.values},He=function(e,t){const i=e.get(t);return i&&i.values[0]};let Ge=class extends Z{constructor(){super(...arguments),this._files=null,this._headerInfo=null,this._bufferSize=1048576,this.datasetFormat="TIFF"}async open(e){var t,i,n;await this.init();const r=e?Object(o["t"])(e.signal):null,{data:a}=await this.request(this.url,{range:{from:0,to:this._bufferSize},responseType:"array-buffer",signal:r});if(!a)throw new s["a"]("tiffraster:open","failed to open url "+this.url);this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);const{littleEndian:l,firstIFD:c,isBigTiff:u}=Object(Ne["g"])(a),f=[];await this._readIFDs(f,a,l,c,0,u?8:4,r);const h=Object(Ne["c"])(f),{width:d,height:m,tileWidth:p,tileHeight:b,planes:y,pixelType:g,compression:x,firstPyramidLevel:v,maximumPyramidLevel:O,pyramidBlockWidth:w,pyramidBlockHeight:j,tileBoundary:I,affine:S,metadata:R}=h,T=(null==(t=h.extent.spatialReference)?void 0:t.wkt)||(null==(i=h.extent.spatialReference)?void 0:i.wkid);let _=we(T),k=!1;null==_&&(k=!0,_=new P["a"]({wkid:3857}));const C=new M["a"]({...h.extent,spatialReference:_}),F=new X["a"](C?{x:C.xmin,y:C.ymax,spatialReference:_}:{x:0,y:0}),E=new G["a"]({blockWidth:p,blockHeight:b,pyramidBlockWidth:w,pyramidBlockHeight:j,compression:x,origin:F,firstPyramidLevel:v,maximumPyramidLevel:O,blockBoundary:I}),B=new X["a"]({x:(C.xmax-C.xmin)/d,y:(C.ymax-C.ymin)/m,spatialReference:_}),z=R?{BandProperties:R.bandProperties,DataType:R.dataType}:{},D=new H["a"]({width:d,height:m,bandCount:y,pixelType:g,compression:x,pixelSize:B,storageInfo:E,spatialReference:_,isPseudoSpatialReference:k,keyProperties:z,extent:C,statistics:R?R.statistics:null});if(null!=S&&S.length&&(D.nativeExtent=new M["a"]({xmin:-.5,ymin:.5-m,xmax:d-.5,ymax:.5,spatialReference:_}),D.transform=new ge["a"]({polynomialOrder:1,forwardCoefficients:[S[2]+S[0]/2,S[5]-S[3]/2,S[0],S[3],-S[1],-S[4]]}),D.extent=D.transform.forwardTransform(D.nativeExtent),D.pixelSize=new X["a"]({x:(C.xmax-C.xmin)/d,y:(C.ymax-C.ymin)/m,spatialReference:_}),E.origin.x=-.5,E.origin.y=.5),null==(n=this.ioConfig.skipExtensions)||!n.includes("aux.xml")){const t=await this._fetchAuxiliaryData(e);if(null!=t){var A;if(D.statistics=null!=(A=t.statistics)?A:D.statistics,D.histograms=t.histograms,t.histograms&&!Object(o["k"])(D.statistics)&&(D.statistics=Object(Y["f"])(t.histograms)),t.transform&&!S){D.transform=t.transform,D.nativeExtent=D.extent;const e=D.transform.forwardTransform(D.nativeExtent);D.pixelSize=new X["a"]({x:(e.xmax-e.xmin)/d,y:(e.ymax-e.ymin)/m,spatialReference:_}),D.extent=e}D.spatialReference||(D.spatialReference=t.spatialReference)}}if(this._set("rasterInfo",D),this._headerInfo={littleEndian:l,isBigTiff:u,ifds:f,...h},!this._headerInfo.isSupported)throw new s["a"]("tiffraster:open","this tiff is not supported: "+this._headerInfo.message);this.updateTileInfo()}async fetchRawTile(e,t,i,n={}){var r;if(null==(r=this._headerInfo)||!r.isSupported||this.isBlockOutside(e,t,i))return null;const a=this._getTileLocation(e,t,i);if(!a)return null;const{ranges:s,actualTileWidth:o,actualTileHeight:l,ifd:c}=a,u=s.map(e=>this.request(this.url,{range:e,responseType:"array-buffer",signal:n.signal})),f=await Promise.all(u),h=f.map(e=>e.data.byteLength).reduce((e,t)=>e+t),d=1===f.length?f[0].data:new ArrayBuffer(h),m=[0],p=[0];if(f.length>1){const e=new Uint8Array(d);for(let t=0,i=0;t=t.byteLength||n<0)&&(t=(await this.request(this.url,{range:{from:n+r,to:n+r+this._bufferSize},responseType:"array-buffer",signal:s})).data,r=n+r,n=0);const o=await this._readIFD(t,i,n,r,Le["a"].TIFF_TAGS,a,s);if(e.push(o.ifd),!o.nextIFD)return null;await this._readIFDs(e,t,i,o.nextIFD-r,r,a,s)}async _readIFD(e,t,i,n,r=Le["a"].TIFF_TAGS,a=4,s){if(!e)return null;const o=Object(Ne["f"])(e,t,i,n,r,a);if(o.success){const i=[];if(o.ifd.forEach(e=>{e.values||i.push(e)}),i.length>0){const r=i.map(e=>e.offlineOffsetSize),a=Math.min.apply(null,r.map(e=>e[0]));if(Math.min.apply(null,r.map(e=>e[0]+e[1]))-a<=this._bufferSize){const{data:r}=await this.request(this.url,{range:{from:a,to:a+this._bufferSize},responseType:"array-buffer",signal:s});e=r,n=a,i.forEach(i=>Object(Ne["e"])(e,t,i,n))}}if(o.ifd.has("GEOKEYDIRECTORY")){const i=o.ifd.get("GEOKEYDIRECTORY"),r=i.values;if(r&&r.length>4){const a=r[0]+"."+r[1]+"."+r[2],o=await this._readIFD(e,t,i.valueOffset+6-n,n,Le["a"].GEO_KEYS,2,s);i.data=o.ifd,i.data&&i.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[a]})}}return o}if(o.requiredBufferSize&&o.requiredBufferSize!==e.byteLength){const i=await this.request(this.url,{range:{from:n,to:n+o.requiredBufferSize+4},responseType:"array-buffer",signal:s});return(e=i.data).byteLengthh||i>d||te.add(i)),e}static async open(e){const{url:t,ioConfig:i,sourceJSON:n}=e;let r=e.datasetFormat;null==r&&t.lastIndexOf(".")&&(r=t.slice(t.lastIndexOf(".")+1).toUpperCase()),"OVR"===r||"TIF"===r?r="TIFF":"JPG"!==r&&"JPEG"!==r&&"JFIF"!==r||(r="JPG"),t.toLowerCase().indexOf("/imageserver")>-1&&-1===t.toLowerCase().indexOf("/wcsserver")&&(r="RasterTileServer");const a={url:t,sourceJSON:n,datasetFormat:r,ioConfig:i||{bandIds:null,sampling:null}};let o,l;if(this.supportedFormats.has(r))return o=qe.get(r).constructor,l=new o(a),await l.open({signal:e.signal}),l;if(r)throw new s["a"]("rasterfactory:open","not a supported format "+r);const c=Array.from(qe.keys());let u=0;const f=function(){return r=c[u++],r?(o=qe.get(r).constructor,l=new o(a),l.open({signal:e.signal}).then(()=>l).catch(()=>f())):null};return f()}static register(e,t,i){qe.has(e.toUpperCase())||qe.set(e.toUpperCase(),{desc:t,constructor:i})}}var Ue=i("f51b");let Ye=class extends(Object(b["a"])(Object(A["a"])(Object(B["a"])(Object(z["a"])(Object(y["a"])(E(Object(N["a"])(Object(D["a"])(Object(l["a"])(p["a"])))))))))){constructor(...e){super(...e),this.bandIds=null,this.interpolation=null,this.legendEnabled=!0,this.isReference=null,this.listMode="show",this.sourceJSON=null,this.version=null,this.title=null,this.type="imagery-tile",this.operationalLayerType="ArcGISTiledImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.fields=null}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=Object(o["k"])(e)?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(c["u"]).then(()=>this._openRaster(t))),Promise.resolve(this)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){var e,t;let i=[new L["a"]({name:"Raster.ServicePixelValue",alias:"Pixel Value",domain:null,editable:!1,length:50,type:"string"})];const n=null==(e=this.rasterInfo)||null==(t=e.attributeTable)?void 0:t.fields,r="Raster.";if(n){const e=n.filter(e=>"oid"!==e.type&&"value"!==e.name.toLowerCase()).map(e=>{const t=e.clone();return t.name=r+e.name,t});i=i.concat(e)}const a=this.rasterInfo.dataType;if(("vector-magdir"===a||"vector-uv"===a)&&Object(o["k"])(this.rasterInfo.multidimensionalInfo)){var s;const e=null==(s=this.rasterInfo.multidimensionalInfo.variables[0].unit)?void 0:s.trim(),t="Magnitude"+(e?` (${e})`:"");i.push(new L["a"]({name:"Raster.Magnitude",alias:t,domain:null,editable:!1,type:"double"})),i.push(new L["a"]({name:"Raster.Direction",alias:"Direction (°)",domain:null,editable:!1,type:"double"}))}return i}set renderer(e){this._set("renderer",e),this.updateRenderer()}readRenderer(e,t,i){const n=t&&t.layerDefinition&&t.layerDefinition.drawingInfo&&t.layerDefinition.drawingInfo.renderer,r=Object(a["b"])(n,i)||void 0;if(null!=r)return r}createPopupTemplate(e){return Object(Ue["a"])({fields:this.rasterFields,title:this.title},e)}write(e,t){const{raster:i}=this;if(this.loaded?"RasterTileServer"===i.datasetFormat&&("Raster"===i.tileType||"Map"===i.tileType):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))return super.write(e,t);if(t&&t.messages){const e=`${t.origin}/${t.layerContainerType||"operational-layers"}`;t.messages.push(new s["a"]("layer:unsupported",`Layers (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${e}'`,{layer:this}))}return null}async _openRaster(e){this.raster?(this.raster.rasterInfo||await this.raster.open(),this.url=this.raster.url):this.raster=await $e.open({url:this.url,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:e});const{rasterInfo:t}=this.raster;if(!t)throw new s["a"]("imagery-tile-layer:load","cannot load resources on "+this.url);if(this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON){const e="Map"===this.raster.tileType&&null!=this.sourceJSON.minLOD&&null!=this.sourceJSON.maxLOD?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(e,{origin:"service"})}null==this.title&&(this.title=this.raster.datasetName),"Map"===this.raster.tileType&&(this.popupEnabled=!1),this._configDefaultSettings(),this.watch("customParameters",e=>this.raster.ioConfig.customFetchParameters=e)}};Object(n["a"])([Object(u["b"])({type:[f["a"]],json:{write:{overridePolicy(){var e;return{enabled:!this.loaded||"Raster"===this.raster.tileType||"0,1,2"!==(null==(e=this.bandIds)?void 0:e.join(","))}}}}})],Ye.prototype,"bandIds",void 0),Object(n["a"])([Object(u["b"])({json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"bilinear"!==this.interpolation}}}}}),Object(h["a"])(J["a"])],Ye.prototype,"interpolation",void 0),Object(n["a"])([Object(u["b"])({json:{write:!0}})],Ye.prototype,"multidimensionalDefinition",void 0),Object(n["a"])([Object(u["b"])(j["e"])],Ye.prototype,"legendEnabled",void 0),Object(n["a"])([Object(u["b"])({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],Ye.prototype,"isReference",void 0),Object(n["a"])([Object(u["b"])({type:["show","hide"]})],Ye.prototype,"listMode",void 0),Object(n["a"])([Object(u["b"])()],Ye.prototype,"sourceJSON",void 0),Object(n["a"])([Object(u["b"])({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],Ye.prototype,"version",void 0),Object(n["a"])([Object(u["b"])()],Ye.prototype,"title",void 0),Object(n["a"])([Object(u["b"])({readOnly:!0,json:{read:!1}})],Ye.prototype,"type",void 0),Object(n["a"])([Object(u["b"])({type:["ArcGISTiledImageServiceLayer"]})],Ye.prototype,"operationalLayerType",void 0),Object(n["a"])([Object(u["b"])({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,t)=>!t.disablePopup},write:{target:"disablePopup",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}},writer(e,t,i){t[i]=!e}}}})],Ye.prototype,"popupEnabled",void 0),Object(n["a"])([Object(u["b"])({type:r["a"],json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}}}}})],Ye.prototype,"popupTemplate",void 0),Object(n["a"])([Object(u["b"])({readOnly:!0})],Ye.prototype,"defaultPopupTemplate",null),Object(n["a"])([Object(u["b"])({readOnly:!0,type:[L["a"]]})],Ye.prototype,"fields",void 0),Object(n["a"])([Object(u["b"])({readOnly:!0,type:[L["a"]]})],Ye.prototype,"rasterFields",null),Object(n["a"])([Object(u["b"])({types:a["a"],json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy(){var e;const t="raster-stretch"===(null==(e=this.renderer)?void 0:e.type)&&"none"===this.renderer.stretchType&&!this.renderer.useGamma;return{enabled:!this.loaded||"Raster"===this.raster.tileType||!t}}},origins:{"web-scene":{types:a["c"],name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"flow"!==e.type})}}}}})],Ye.prototype,"renderer",null),Object(n["a"])([Object(d["a"])("renderer")],Ye.prototype,"readRenderer",null),Ye=Object(n["a"])([Object(m["a"])("esri.layers.ImageryTileLayer")],Ye);const Ve=Ye},ab68:function(e,t,i){"use strict";i.d(t,"a",(function(){return a})),i.d(t,"b",(function(){return r}));var n=i("dff3");const r={type:n["a"],json:{origins:{service:{read:{source:["tileInfo","minScale","maxScale","minLOD","maxLOD"],reader:a}}}}};function a(e,t,i,r){if(!e)return null;const{minScale:a,maxScale:s,minLOD:o,maxLOD:l}=t;if(null!=o&&null!=l)return r&&r.ignoreMinMaxLOD?n["a"].fromJSON(e):n["a"].fromJSON({...e,lods:e.lods.filter(({level:e})=>null!=e&&e>=o&&e<=l)});if(0!==a&&0!==s){const t=e=>Math.round(1e4*e)/1e4,i=a?t(a):1/0,r=s?t(s):-1/0;return n["a"].fromJSON({...e,lods:e.lods.filter(e=>{const n=t(e.scale);return n<=i&&n>=r})})}return n["a"].fromJSON(e)}},b4e0:function(e,t,i){"use strict";i.d(t,"a",(function(){return U})),i.d(t,"b",(function(){return O})),i.d(t,"c",(function(){return H})),i.d(t,"d",(function(){return L})),i.d(t,"e",(function(){return z})),i.d(t,"f",(function(){return N})),i.d(t,"g",(function(){return v})),i.d(t,"h",(function(){return E})),i.d(t,"i",(function(){return I})),i.d(t,"j",(function(){return w})),i.d(t,"k",(function(){return f})),i.d(t,"l",(function(){return q})),i.d(t,"m",(function(){return $}));i("e06a");var n=i("ce50"),r=i("b2b2"),a=i("8048"),s=i("9415"),o=i("8188"),l=i("3af1"),c=i("4ae5"),u=i("5996");function f(e,t,i){return!Object(o["b"])(e,t,i)}function h(e,t,i){const r=f(e,t,i);if(r&&!Object(o["h"])())throw new n["a"]("rasterprojectionhelper-project","projection engine is not loaded");return r}const d=function(e,t,i,n=0){if(1===i[0])return[0,0];let r=1,a=-1,s=1,o=-1;for(let b=0;be[b]?e[b]:r,a=a>e[b]?a:e[b],s=s>e[b+1]?e[b+1]:s,o=o>e[b+1]?o:e[b+1]);const{cols:l,rows:c}=t,u=(a-r)/l/i[0],f=(o-s)/c/i[1],h=2*n;let d=0,m=!1,p=[0,0];for(let b=0;bd&&(d=a+s,p=[a,s]),h&&d>h){m=!0;break}}if(m)break}return p},m={3395:20037508.342789244,3410:17334193.943686873,3857:20037508.342788905,3975:17367530.445161372,4087:20037508.342789244,4088:20015108.787169147,6933:17367530.445161372,32662:20037508.342789244,53001:20015086.79602057,53002:10007543.39801029,53003:20015086.79602057,53004:20015086.79602057,53016:14152803.599503474,53017:17333573.624304302,53034:20015086.79602057,53079:20015114.352186374,53080:20015114.352186374,54001:20037508.342789244,54002:10018754.171394624,54003:20037508.342789244,54004:20037508.342789244,54016:14168658.027268292,54017:17367530.44516137,54034:20037508.342789244,54079:20037508.342789244,54080:20037508.342789244,54100:20037508.342789244,54101:20037508.342789244},p=32,b=4,y=b,g=new Map,x=new Map;async function v(){if(Object(o["h"])())return null;await Object(o["i"])()}function O(e,t,i){return h(e.spatialReference,t)?i?Object(o["f"])(t,e.spatialReference,e):Object(o["f"])(e.spatialReference,t,e):null}function w(e,t,i,n=null){const s=e.spatialReference;if(s.equals(t))return e;h(s,t,n);const c=i.center,u=new l["a"]({xmin:c.x-e.x/2,xmax:c.x+e.x/2,ymin:c.y-e.y/2,ymax:c.y+e.y/2,spatialReference:s}),f=Object(o["m"])(u,t,n);if(Object(r["j"])(f))return null;const d={x:f.xmax-f.xmin,y:f.ymax-f.ymin},m=z(t);if(Object(r["k"])(m)&&d.x>=m){const i=Object(a["f"])(s)/Object(a["f"])(t);d.x=e.x*i,d.y=e.y*i}return d}function j(e,t=.01){return Object(a["f"])(e)?t/Object(a["f"])(e):0}function I(e,t,i=null,n=!0){const a=e.spatialReference;if(a.equals(t))return e;h(a,t,i);const s=Object(o["m"])(e,t,i);if(!n||!s)return s;const l=D(a,!0),c=D(t,!0),u=j(a);return u&&Object(r["k"])(l)&&Object(r["k"])(c)&&(s.x>0&&Math.abs(e.x-l[0])new c["a"](t[0],t[1],e.inSR));return Object(o["m"])(i,e.outSR,e.datumTransformation).map(e=>e?[e.x,e.y]:[NaN,NaN])}function T(e){const{inSR:t,outSR:i,datumTransformation:n}=e,a=k(t),{points:o,mask:l}=M(e,a);if(!t.isGeographic){const e=t.wkid?s["a"].coordsys(t.wkid):s["a"].fromString(t.isGeographic?s["b"].PE_TYPE_GEOGCS:s["b"].PE_TYPE_PROJCS,t.wkt);s["c"].projToGeog(e,o.length,o)}if(Object(r["k"])(n)&&n.steps.length&&n.steps.forEach(e=>{const t=e.wkid?s["a"].geogtran(e.wkid):s["a"].fromString(s["b"].PE_TYPE_GEOGTRAN,e.wkt);s["d"].geogToGeog(t,o.length,o,null,e.isInverse?s["b"].PE_TRANSFORM_2_TO_1:s["b"].PE_TRANSFORM_1_TO_2)}),!i.isGeographic){const e=k(i,!0),t=Object(r["k"])(e)&&e.isEnvelope?[e.bbox[1],e.bbox[3]]:[-90,90];P(o,t);const n=i.wkid?s["a"].coordsys(i.wkid):s["a"].fromString(i.isGeographic?s["b"].PE_TYPE_GEOGCS:s["b"].PE_TYPE_PROJCS,i.wkt);s["c"].geogToProj(n,o.length,o)}let c=o;if(l&&o.length!==l.length){c=[];for(let e=0,t=0;e1===e.getInclusive()&&1===e.getKind());if(!o){if(o=r.find(e=>1===e.getInclusive()&&0===e.getKind()),!o)return null;a=!0}const l=n.isPannableRectangle(),c=o.getCoord();if(a)return{isEnvelope:a,isPannable:l,vertices:c,coef:null,bbox:[c[0][0]-t,c[0][1]-t,c[1][0]+t,c[1][1]+t]};let u=0;const f=[];let[h,d]=c[0],[m,p]=c[0];for(let s=0,b=c.length;se?m:e,p=p>t?p:t}return{isEnvelope:!1,isPannable:l,vertices:c,coef:f,bbox:[h,d,m,p]}}function M(e,t){const i=[],{cols:n,rows:a,xres:s,yres:o,usePixelCenter:l}=e;let{xmin:c,ymax:u}=e;if(l&&(c+=s/2,u-=o/2),!Object(r["k"])(t)){for(let e=0;e=e&&n<=l;for(let e=0;e=r&&t<=h&&(i.push([n,t]),f[m]=1)}}return{points:i,mask:f}}const{coef:h}=t,d=[];for(let r=0;r=s&&e<=o){const r=n*e+a;t.push(r),i.push(l)}}let n=t;if(t.length>2){let e=2===i[0]?0:i[0],r=t[0];n=[];for(let a=1;ae-t)}else t[0]>t[1]&&(n=[t[1],t[0]]);d.push(n)}for(let r=0,m=0;r=r[0]&&e<=r[1]&&(i.push([e,n]),f[m]=1);else if(r.length>2){let t=!1;for(let i=0;i=r[i]&&e<=r[i+1]){t=!0;break}t&&(i.push([e,n]),f[m]=1)}}}return{points:i,mask:f}}function P(e,t){const[i,n]=t;for(let r=0;rn)&&(e[r]=[NaN,NaN])}}function F(e){const t=z(e[0].spatialReference);if(e.length<2||!Object(r["k"])(t))return e[0];let{xmin:i,xmax:n,ymin:a,ymax:s}=e[0];for(let r=1;rj(e.spatialReference)){const{xmin:t,xmax:i}=e;for(let n=0;n<=a;n++){const r=0===n?t:-s/2,o=n===a?i-s*n:s/2;c[n]=new l["a"]({xmin:r,xmax:o,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference})}}return F(c.map(e=>B(e,t,i,n)).filter(e=>!!e))}function B(e,t,i=null,n=!0,a=!0){const s=e.spatialReference;if(s.equals(t))return e;h(s,t,i);const l=Object(o["m"])(e,t,i);if(a&&t.isWebMercator&&l&&(l.ymax=Math.min(20037508.342787,l.ymax),l.ymin=Math.max(-20037508.342787,l.ymin),l.ymin>=l.ymax))return null;if(!n||!l)return l;const u=D(s,!0),f=D(t,!0);if(Object(r["j"])(u)||Object(r["j"])(f))return l;const d=j(s,.001),m=j(s,500),p=j(t,.001);if(Math.abs(l.xmin-f[0])m){l.xmin=f[0];const n=[];n.push(new c["a"](e.xmax,e.ymin,s)),n.push(new c["a"](e.xmax,(e.ymin+e.ymax)/2,s)),n.push(new c["a"](e.xmax,e.ymax,s));const r=n.map(e=>I(e,t,i)).filter(e=>!isNaN(null==e?void 0:e.x)).map(e=>e.x);l.xmax=Math.max.apply(null,r)}if(rm){l.xmax=f[1];const n=[];n.push(new c["a"](e.xmin,e.ymin,s)),n.push(new c["a"](e.xmin,(e.ymin+e.ymax)/2,s)),n.push(new c["a"](e.xmin,e.ymax,s));const r=n.map(e=>I(e,t,i)).filter(e=>!isNaN(null==e?void 0:e.x)).map(e=>e.x);l.xmin=Math.min.apply(null,r)}}else{const e=j(t,.001);Math.abs(l.xmin-f[0])0&&n.outofBoundPointCounty)&&(f(c,u,e.datumTransformation)&&(c.isGeographic||Object(r["k"])(k(c))),i=[b,b],n=G({...e,spacing:i}),a={cols:n.size[0]+1,rows:n.size[1]+1},o=d(n.offsets,a,i,y)),n.error=o,i[0]>1&&(n.coefficients=W(n.offsets,a,s)),e.includeGCSGrid&&!c.isGeographic&&!c.isWebMercator)if(u.isGeographic)n.gcsGrid={offsets:n.offsets,coefficients:n.coefficients,spacing:i};else{const t=k(c);if(Object(r["k"])(t)&&!t.isEnvelope){const t=J(c),r=E(e.projectedExtent,t),{offsets:o}=G({...e,srcBufferExtent:r,spacing:i}),l=W(o,a,s);n.gcsGrid={offsets:o,coefficients:l,spacing:i}}}return n}function G(e){const{projectedExtent:t,srcBufferExtent:i,pixelSize:n,datumTransformation:a,rasterTransform:s}=e,o=t.spatialReference,l=i.spatialReference;h(o,l);const{xmin:u,ymin:f,xmax:d,ymax:m}=t,y=z(l),g=Object(r["k"])(y)&&(e.hasWrapAround||"gcs-shift"===(null==s?void 0:s.type)),x=e.spacing||[p,p],v=x[0]*n.x,O=x[1]*n.y,w=1===x[0],I=Math.ceil((d-u)/v-.1/x[0])+(w?0:1),R=Math.ceil((m-f)/O-.1/x[1])+(w?0:1),T=S({cols:I,rows:R,xmin:u,ymax:m,xres:v,yres:O,inSR:o,outSR:l,datumTransformation:a,preferPE:x[0]<=b,usePixelCenter:w}),_=[];let k,C=0;const M=w?-1:NaN,{xmin:P,xmax:F,ymax:E,width:B,height:D}=i,A=j(l,500);for(let r=0;rF&&i[0]>y/2-A&&(i[0]-=y),!i||isNaN(i[0])||isNaN(i[1]))_.push(M),_.push(M),e.push(null),C++;else{if(s){const e=s.inverseTransform(new c["a"]({x:i[0],y:i[1],spatialReference:l}));i=[e.x,e.y]}e.push(i),r>0&&g&&k[t]&&i[0]=u)s=l.length,o=n/u>8;else{let e,t=f;for(let r=1;r<=l.length;r++){if(e=(l[r-1].x+l[r-1].y)/2,n<=e){n===e?s=r:"down"===i?(s=r-1,o=n/t>8):s="up"===i||n-t>e-n||n/t>2?r:r-1;break}t=e}}const h=0===s?a:l[s-1];return{pyramidLevel:s,pyramidResolution:new c["a"]({x:h.x,y:h.y,spatialReference:t.spatialReference}),excessiveReading:o}}const u=Math.log(e.x/a.x)/Math.LN2,f=Math.log(e.y/a.y)/Math.LN2,h=t.storageInfo.maximumPyramidLevel||0;s="down"===i?Math.floor(Math.min(u,f)):"up"===i?Math.ceil(Math.max(u,f)):Math.round((u+f)/2),s<0?s=0:s>h&&(o=s>h+3,s=h);const d=2**s;return{pyramidLevel:s,pyramidResolution:new c["a"]({x:d*t.nativePixelSize.x,y:d*t.nativePixelSize.y,spatialReference:t.spatialReference}),excessiveReading:o}}function U(e,t,i=512,n=!0){const{extent:r,spatialReference:s,pixelSize:o}=e,l=w(new c["a"]({x:o.x,y:o.y,spatialReference:s}),t,r);if(null==l)return{projectedPixelSize:null,scales:null,srcResolutions:null,isCustomTilingScheme:!1};const u=(l.x+l.y)/2,f=Object(a["f"])(t),h=u*f*96*39.37,d=t.isGeographic?256/i*295828763.7958547:256/i*591657527.591555;let m="vector-magdir"===e.dataType||"vector-uv"===e.dataType;const p=E(r,t);m||n&&(t.isGeographic||t.isWebMercator)&&(m=p.xmin*p.xmax<0);let b,y=h;const g=1.001;if(m){y=d;const e=t.isGeographic?1341104507446289e-21:.29858214164761665,i=e*(96*f*39.37),n=t.isGeographic?4326:3857;b=w(new c["a"]({x:e,y:e,spatialReference:{wkid:n}}),s,p),b.x*=y/i,b.y*=y/i}else{b={x:o.x,y:o.y};const t=Math.ceil(Math.log(Math.min(e.width,e.height)/32)/Math.LN2);let i=0;for(;y=j;)y/=2,b.x/=2,b.y/=2,x.push(y),v.push({x:b.x,y:b.y});return{projectedPixelSize:l,scales:x,srcResolutions:v,isCustomTilingScheme:!m}}}}]); //# sourceMappingURL=chunk-749eb15a.2fe5f5b7.js.map