PageSourceSearch

https://tapped-demo-csun-cgst.netlify.app/tapped/_next/static/chunks/943.c1bc76dcfcae2ba0.js

js tapped-demo-csun-cgst.netlify.app collected 2026-10-03 11:30:23 UTC 83,903 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[943],{50943:function(e,t,i){i.r(t),i.d(t,{default:function(){return Ge}});var n=i(36663),r=(i(39994),i(61681)),s=i(13802),a=i(7283),o=i(81977),l=i(25709),c=i(79438),u=i(34248),h=i(66645),f=i(70375),d=i(3466),p=(i(12173),i(51876),i(66636)),m=i(76136),y=i(63314),g=i(23072),x=i(16908),v=i(98549),w=i(12512),b=i(27668),I=i(18241),_=i(67827),C=i(95874),R=i(10171),S=i(42730),T=i(35925),M=i(14685),k=i(91772),P=(i(91957),i(11509)),F=i(20692),D=i(81590),O=i(59510),B=i(29410),z=i(96389),N=i(64590);const Z=s.Z.getLogger("esri.layers.mixins.ImageryTileMixin"),L=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.raster=null,this.rasterInfo=null,this.sourceJSON=null,this.spatialReference=null,this.tileInfo=null,this.symbolizer=null}set multidimensionalDefinition(e){this.raster&&(this._sliceId=this.raster.getSliceIndex(e)),this._set("multidimensionalDefinition",e)}set url(e){this._set("url",(0,F.Nm)(e,Z))}set renderer(e){this._set("renderer",e),this.updateRenderer()}async updateRenderer(){if(!this.loaded)return;if(JSON.stringify(this._cachedRendererJson)===JSON.stringify(this.renderer))return;const e=this._rasterJobHandler.instance;e&&(this.symbolizer.rendererJSON=(0,z.ol)(this.renderer.toJSON()),this.symbolizer.bind(),await e.updateSymbolizer(this.symbolizer),this._cachedRendererJson=this.renderer.toJSON())}async applyRenderer(e,t){const i=e&&e.pixelBlock;if(!(i&&i.pixels&&i.pixels.length>0))return null;let n;this.updateRenderer();const r=this._rasterJobHandler.instance,{bandIds:s}=this;return n=r?await r.symbolize({...e,simpleStretchParams:t,bandIds:s}):this.symbolizer.symbolize({...e,simpleStretchParams:t,bandIds:s}),n}getTileUrl(e,t,i){return"RasterTileServer"===this.raster.datasetFormat?`${this.url}/tile/${e}/${t}/${i}`:""}getCompatibleTileInfo(e,t){if(!this.loaded)return null;const i=(0,T.C5)(e);return D.Z.create({size:256,spatialReference:e,origin:i?{x:i.origin[0],y:i.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(0,P.default)(r,{responseType:"image",query:{sliceId:this._sliceId,_ts:n.timestamp},signal:n.signal}).then((e=>e.data))}await this._initJobHandler();const r="raster-shaded-relief"===this.renderer.type?{cols:1,rows:1}:null;if(this.multidimensionalDefinition){const e=this._sliceId;n={multidimensionalDefinition:this.multidimensionalDefinition,sliceId:e,buffer:r,...n}}return this.raster.fetchTile(e,t,i,n)}async fetchPixels(e,t,i,n){if(await this._initJobHandler(),this.multidimensionalDefinition){const e=this._sliceId;n={multidimensionalDefinition:this.multidimensionalDefinition,sliceId:e,...n}}return this.raster.fetchPixels(e,t,i,n)}identify(e,t={}){return this.multidimensionalDefinition&&!t.multidimensionalDefinition&&(t={...t,multidimensionalDefinition:this.multidimensionalDefinition}),this.raster.identify(e,t)}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}_configDefaultSettings(){this._configDefaultInterpolation(),this._configDefaultSlice(),this._configDefaultRenderer()}_initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const e=new B.Z;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=(0,z.In)(this.rasterInfo,this.raster.tileType,null==(e=this.sourceJSON)?void 0:e.defaultResamplingMethod);this._set("interpolation",t)}}_configDefaultSlice(){const{multidimensionalInfo:e}=this.raster.rasterInfo;if((0,r.pC)(e)){if(!this.multidimensionalDefinition){const t=e.variables[0],i=[];t.dimensions.forEach((e=>
1{i.push(new O.Z({variableName:t.name,dimensionName:e.name,values:e.hasRegularIntervals?e.extent[0]:e.values[0],isSlice:!0}))})),this.multidimensionalDefinition=i}this._sliceId=this.raster.getSliceIndex(this.multidimensionalDefinition)}}_configDefaultRenderer(){const e=this.raster.rasterInfo;var t,i;this.bandIds||(this.bandIds=(0,z.YD)(e)),this.renderer||(this.renderer=(0,z.Ob)(e,{bandIds:this.bandIds,variableName:null==(t=this.multidimensionalDefinition)||null==(i=t[0])?void 0:i.variableName})),this.symbolizer?(this.symbolizer.rendererJSON=(0,z.ol)(this.renderer.toJSON()),this.symbolizer.rasterInfo=e):this.symbolizer=new N.Z({rendererJSON:this.renderer.toJSON(),rasterInfo:e}),this.symbolizer.bind()||Z.warn("imagery-tile-mixin","The given renderer is not supported by the layer.")}};return(0,n._)([(0,o.Cb)()],t.prototype,"_cachedRendererJson",void 0),(0,n._)([(0,o.Cb)()],t.prototype,"_sliceId",void 0),(0,n._)([(0,o.Cb)()],t.prototype,"_compatibleFullExtent",void 0),(0,n._)([(0,o.Cb)()],t.prototype,"_rasterJobHandler",void 0),(0,n._)([(0,o.Cb)()],t.prototype,"bandIds",void 0),(0,n._)([(0,o.Cb)()],t.prototype,"copyright",void 0),(0,n._)([(0,o.Cb)({type:k.Z}),(0,S.B)("rasterInfo.extent")],t.prototype,"fullExtent",void 0),(0,n._)([(0,o.Cb)()],t.prototype,"interpolation",void 0),(0,n._)([(0,o.Cb)()],t.prototype,"ioConfig",void 0),(0,n._)([(0,o.Cb)({type:[O.Z]})],t.prototype,"multidimensionalDefinition",null),(0,n._)([(0,o.Cb)()],t.prototype,"raster",void 0),(0,n._)([(0,o.Cb)({readOnly:!0}),(0,S.B)("raster.rasterInfo")],t.prototype,"rasterInfo",void 0),(0,n._)([(0,o.Cb)()],t.prototype,"sourceJSON",void 0),(0,n._)([(0,o.Cb)({type:M.Z}),(0,S.B)("rasterInfo.spatialReference")],t.prototype,"spatialReference",void 0),(0,n._)([(0,o.Cb)({type:D.Z}),(0,S.B)("rasterInfo.storageInfo.tileInfo")],t.prototype,"tileInfo",void 0),(0,n._)([(0,o.Cb)(g.HQ)],t.prototype,"url",null),(0,n._)([(0,o.Cb)({types:v.dr})],t.prototype,"renderer",null),(0,n._)([(0,o.Cb)()],t.prototype,"symbolizer",void 0),t=(0,n._)([(0,h.j)("esri.layers.ImageryTileMixin")],t),t};var A=i(86566),E=i(41017),H=i(71429),J=i(49004);let j=class extends J.wq{constructor(){super(...arguments),this.blockWidth=void 0,this.blockHeight=void 0,this.compression=null,this.origin=null,this.firstPyramidLevel=null,this.maximumPyramidLevel=null,this.pyramidScalingFactor=2,this.pyramidBlockWidth=null,this.pyramidBlockHeight=null,this.isVirtualTileInfo=!1,this.tileInfo=null,this.blockBoundary=null}};(0,n._)([(0,o.Cb)({type:Number,json:{write:!0}})],j.prototype,"blockWidth",void 0),(0,n._)([(0,o.Cb)({type:Number,json:{write:!0}})],j.prototype,"blockHeight",void 0),(0,n._)([(0,o.Cb)({type:String,json:{write:!0}})],j.prototype,"compression",void 0),(0,n._)([(0,o.Cb)({type:A.Z,json:{write:!0}})],j.prototype,"origin",void 0),(0,n._)([(0,o.Cb)({type:Number,json:{write:!0}})],j.prototype,"firstPyramidLevel",void 0),(0,n._)([(0,o.Cb)({type:Number,json:{write:!0}})],j.prototype,"maximumPyramidLevel",void 0),(0,n._)([(0,o.Cb)()],j.prototype,"pyramidScalingFactor",void 0),(0,n._)([(0,o.Cb)({type:Number,json:{write:!0}})],j.prototype,"pyramidBlockWidth",void 0),(0,n._)([(0,o.Cb)({type:Number,json:{write:!0}})],j.prototype,"pyramidBlockHeight",void 0),(0,n._)([(0,o.Cb)({type:Boolean,json:{write:!0}})],j.prototype,"isVirtualTileInfo",void 0),(0,n._)([(0,o.Cb)({json:{write:!0}})],j.prototype,"tileInfo",void 0),(0,n._)([(0,o.Cb)()],j.prototype,"blockBoundary",void 0),j=(0,n._)([(0,h.j)("esri.layers.support.RasterStorageInfo")],j);var q=j,W=i(78668),U=i(64189),$=i(21859),G=i(31329),V=i(18486),Y=i(6815);let X=class extends((0,U.v)(J.wq)){constructor(){super(...arguments),this.rasterJobHandler=null,this.datasetName=null,this.datasetFormat=null,this.rasterInfo=null,this.ioConfig={sampling:"closest"}}
1async init(){const e=(0,V.zD)();this.addResolvingPromise(e),await this.when()}normalizeCtorArgs(e){return e&&e.ioConfig&&(e={...e,ioConfig:{resolution:null,bandIds:null,sampling:"closest",tileInfo:D.Z.create(),...e.ioConfig}}),e}set url(e){this._set("url",(0,F.Nm)(e,s.Z.getLogger(this.declaredClass)))}async open(e){throw new f.Z("BaseRaster:open-not-implemented","open() is not implemented")}async fetchTile(e,t,i,n={}){var s;const{tileInfo:a}=n,o=a.lodAt(e),l=this.getTileExtent({x:o.resolution,y:o.resolution},t,i,a.origin,a.spatialReference,a.size);return null!=(s=n.multidimensionalDefinition)&&s.length&&(0,r.pC)(this.rasterInfo.multidimensionalInfo)&&null==n.sliceId&&(n={...n,sliceId:this.getSliceIndex(n.multidimensionalDefinition)||0}),this.fetchPixels(l,a.size[0],a.size[1],n)}async identify(e,t={}){const{spatialReference:i,extent:n}=this.rasterInfo,{datumTransformation:s}=t;let a=(0,V.nF)(e,i,s);if(!n.intersects(a))return{location:a,value:null};if((0,r.pC)(this.rasterInfo.transform)){const e=this.rasterInfo.transform.inverseTransform(a);if(!this.rasterInfo.nativeExtent.intersects(e))return{location:e,value:null};a=e}let o=0;if(t.srcResolution)o=(0,V.kr)(t.srcResolution,this.rasterInfo,this.ioConfig.sampling).pyramidLevel;else if(o=await this.computeBestPyramidLevelForLocation(e,t),null==o)return{location:a,value:null};const l=this.identifyPixelLocation(a,o,null);if(null===l)return{location:a,value:null};const{row:c,col:u,rowOffset:h,colOffset:f}=l,d=(0,Y.Rq)(this.url,t.sliceId),p=`${o}/${c}/${u}`;let m=(0,Y.Qg)(d,null,p);(0,r.pC)(m)||(m=this.fetchRawTile(o,c,u,t),(0,Y.gX)(d,null,p,m));const y=await m;if(!(y&&y.pixels&&y.pixels.length>0))return{location:a,value:null};const g=h*this.rasterInfo.storageInfo.blockHeight+f;return{location:a,value:!y.mask||y.mask[g]?y.pixels.map((e=>e[g])):null,pyramidLevel:o}}async fetchPixels(e,t,i,n={}){const s=e.clone().normalize();e=s[0];const a=this.rasterInfo.spatialReference,o=!e.spatialReference.equals(a),{datumTransformation:l}=n,c=new A.Z({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference}),u=n.srcResolution||(o?(0,V.VO)(c,a,e,l):c);if(!u)return null;const{pyramidLevel:h,pyramidResolution:f,excessiveReading:d}=(0,V.kr)(u,this.rasterInfo,this.ioConfig.sampling);if(d)return null;const p=this.rasterInfo.storageInfo;let m=o?(0,V.tB)(e,a,l):e;const y=(0,r.Wg)(this.rasterInfo.transform);if(y&&(m=y.inverseTransform(m)),null==m)return null;const g={x:Math.floor((m.xmin-p.origin.x)/f.x+.1),y:Math.floor((p.origin.y-m.ymax)/f.y+.1)},x=Math.ceil((m.xmax-m.xmin)/f.x-.1),v=Math.ceil((m.ymax-m.ymin)/f.y-.1);if(x/t>8||v/i>8)return null;const w=await this.fetchRawPixels(h,g,{width:x,height:v},n);if(!w)return null;const b=h>0?p.pyramidBlockWidth:p.blockWidth,I=h>0?p.pyramidBlockHeight:p.blockHeight;if(!o&&1===w.pixelBlocks.length&&b===t&&I===i&&u.x===c.x&&u.y===c.y)return{extent:e,srcExtent:m,pixelBlock:w.pixelBlocks[0]};const _=(0,V.Qp)(e,w.extent,c,l,y);let C;const R=!n.requestRawData,S={rows:_.spacing[0],cols:_.spacing[1]},{pixelBlocks:T,mosaicSize:M,isPartiallyFilled:k}=w;if(this.rasterJobHandler)C=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:T,srcMosaicSize:M,destDimension:R?{width:t,height:i}:null,coefs:R?_.coefficients:null,sampleSpacing:R?S:null,interpolation:n.interpolation},n);else{const e=(0,G.us)(T,M);C=R?(0,G.Uk)(e,{width:t,height:i},_.coefficients,S,n.interpolation):e}return n.requestRawData?{srcExtent:m,pixelBlock:C,transformGrid:_,extent:e,isPartiallyFilled:k}:{srcExtent:m,extent:e,pixelBlock:C}}async fetchRawPixels(e,t,i,n){const{origin:r,blockBoundary:s}=this.rasterInfo.storageInfo,{blockWidth:a,blockHeight:o}=this.getBlockWidthHeight(e);let{x:l,y:c}=t,{width:u,height:h}=i;n.buffer&&(l-=n.buffer.cols,c-=n.buffer.rows,u+=2*n.buffer.cols,h+=2*n.buffer.rows);const f=Math.floor(l/a),d=Math.floor(c/o),p=Math.floor((l+u-1)/a),m=Math.floor((c+h-1)/o),y=s[e];if(!y)return null;const{minRow:g,minCol:x,maxCol:v,maxRow:w}=y;if(m<g||p<x||d>w||f>v)return null;const b=[];let I,_=!1;for(let k=d;k<=m;k++)for(let t=f;t<=p;t++)k>=g&&t>=x&&w>=k&&v>=t?(I=this._fetchRawTile(e,k,t,n),this.ioConfig.allowPartialFill&&(I=new Promise((e=>{I.then((t=>e(t))).catch((()=>{_=!0,e(null)}))}
1))),b.push(I)):b.push(null);if(0===b.length)return null;const C=await Promise.all(b),R={height:(m-d+1)*a,width:(p-f+1)*o},{nativePixelSize:S,spatialReference:T}=this.rasterInfo,M=S.x*2**e,P=S.y*2**e;return{extent:new k.Z({xmin:r.x+f*a*M,xmax:r.x+(p+1)*a*M,ymin:r.y-(m+1)*o*P,ymax:r.y-d*o*P,spatialReference:T}),pixelBlocks:C,mosaicSize:R,isPartiallyFilled:_}}async fetchRawTile(e,t,i,n){throw new f.Z("BaseRaster:read-not-implemented","fetchRawTile() is not implemented")}computeExtent(e){return(0,V.tB)(this.rasterInfo.extent,e)}decodePixelBlock(e,t){return!this.rasterJobHandler||t.useCanvas?(0,$.J)(e,t):this.rasterJobHandler.decode({data:e,options:t})}async request(e,t,i){var n,r;const{customFetchParameters:s}=this.ioConfig,{range:a,query:o,headers:l}=t;i=null!=(n=null!=(r=i)?r:t.retryCount)?n:this.ioConfig.retryCount;const c=a?{Range:`bytes=${a.from}-${a.to}`}:null;try{return await(0,P.default)(e,{...t,query:{...o,...s},headers:{...l,...c}})}catch(oe){if(i>0)return i--,this.request(e,t,i);throw oe}}getSliceIndex(e){const{multidimensionalInfo:t}=this.rasterInfo;if(!(0,r.pC)(t)||null==e||!e.length)return null;let i=0;const n=e[0].variableName;for(let r=0;r<t.variables.length;r++){const s=t.variables[r],a=s.dimensions;if(s.name!==n){i+=a.map((e=>this._getDimensionValuesCount(e))).reduce(((e,t)=>e+t));break}const o=a.map((e=>this._getDimensionValuesCount(e))),l=a.length;for(let t=0;t<l;t++){const n=e.filter((e=>e.dimensionName===a[t].name))[0];if(null==n)return null;const r=Array.isArray(n.values[0])?n.values[0][0]:n.values[0],s=this._getIndexFromDimensions(r,a[t]);if(-1===s)return null;o.shift(),i+=t===l-1?s:s*o.reduce(((e,t)=>e+t))}}return i}updateTileInfo(){const{storageInfo:e,spatialReference:t,extent:i,pixelSize:n}=this.rasterInfo;if(!e.tileInfo){const r=[],s=e.maximumPyramidLevel||0;let a=Math.max(n.x,n.y),o=1/.0254*96*a;for(let e=0;e<=s;e++)r.push({level:s-e,resolution:a,scale:o}),a*=2,o*=2;const l=new A.Z({x:i.xmin,y:i.ymax,spatialReference:t});e.tileInfo=new D.Z({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:s,nativeExtent:a,pixelSize:o,spatialReference:l}=e,c=new A.Z({x:a.xmin,y:a.ymax,spatialReference:l});null==n&&(n=Math.max(0,Math.round(Math.log(Math.max(r,s))/Math.LN2-8)));const u=this._computeBlockBoundary(a,o,n,512,512);e.storageInfo=new q({blockWidth:t,blockHeight:i,pyramidBlockWidth:t,pyramidBlockHeight:i,origin:c,firstPyramidLevel:1,maximumPyramidLevel:n,blockBoundary:u})}async computeBestPyramidLevelForLocation(e,t={}){return 0}identifyPixelLocation(e,t,i){const{spatialReference:n,nativePixelSize:r,nativeExtent:s}=this.rasterInfo,{blockWidth:a,blockHeight:o,maximumPyramidLevel:l,pyramidScalingFactor:c,origin:u}=this.rasterInfo.storageInfo,h=(0,V.nF)(e,n,i);if(!s.intersects(h))return null;if(t<0||t>l)return null;const f=c**t,d=f*r.x,p=f*r.y,m=(u.y-h.y)/p/o,y=(h.x-u.x)/d/a,g=Math.min(o-1,Math.floor((m-Math.floor(m))*o)),x=Math.min(a-1,Math.floor((y-Math.floor(y))*a));return{pyramidLevel:t,row:Math.floor(m),col:Math.floor(y),rowOffset:g,colOffset:x,srcLocation:h}}getTileExtent(e,t,i,n,r,s){const[a,o]=s,l=n.x+i*a*e.x,c=l+a*e.x,u=n.y-t*o*e.y,h=u-o*e.y;return new k.Z({xmin:l,xmax:c,ymin:h,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.maxRow<t||n.maxCol<i||n.minRow>t||n.minCol>i}_computeBlockBoundary(e,t,i,n,r){let{x:s,y:a}=t;const o=e.xmin,l=e.ymax,c=[{minCol:Math.floor((e.xmin-o+.1*s)/n/s),maxCol:Math.floor((e.xmax-o-.1*s)/n/s),minRow:Math.floor((l-e.ymax+.1*a)/r/a),maxRow:Math.floor((l-e.ymin-.1*a)/r/a)}];if(i>0)for(let u=0;u<i;u++)s*=2,a*=2,c.push({minCol:Math.floor((e.xmin-o+.1*s)/n/s),maxCol:Math.floor((e.xmax-o-.1*s)/n/s),minRow:Math.floor((l-e.ymax+.1*a)/r/s),maxRow:Math.floor((l-e.ymin-.1*a)/r/s)});return c}_fetchRawTile(e,t,i,n){const s=this.rasterInfo.storageInfo.blockBoundary[e];if(!s)return Promise.resolve(null);
1const{minRow:a,minCol:o,maxCol:l,maxRow:c}=s;if(t<a||i<o||t>c||i>l)return Promise.resolve(null);const u=(0,Y.Rq)(this.url,n.sliceId),h=`${e}/${t}/${i}`;let f=(0,Y.Qg)(u,n.registryId,h);if(!(0,r.pC)(f)){const r=(0,W.yi)();f=this.fetchRawTile(e,t,i,{...n,signal:r.signal}),(0,Y.gX)(u,n.registryId,h,f,r),f.catch((()=>{(0,Y.Gc)(u,n.registryId,h)}))}return n.signal&&(0,W.fu)(n,(()=>{(0,Y.OE)(u,n.registryId,h)})),f}_getIndexFromDimensions(e,t){const{extent:i,interval:n,unit:r,values:s}=t;if(null!=s&&s.length)return Array.isArray(s[0])?s.findIndex((t=>t[0]<=e&&t[1]>=e)):s.indexOf(e);if(e>i[1])return-1;const a=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-a)/1e3/n);break;case"minutes":o=Math.round((e-a)/6e4/n);break;case"hours":o=Math.round((e-a)/36e5/n);break;case"days":o=Math.round((e-a)/864e5/n);break;case"years":o=Math.round((new Date(e).getUTCFullYear()-new Date(a).getUTCFullYear())/n);break;case"decades":o=Math.round((new Date(e).getUTCFullYear()-new Date(a).getUTCFullYear())/10/n)}return o}return Math.round((e-a)/n)}_getDimensionValuesCount(e){const{extent:t,interval:i,unit:n,values:r}=e;let s=(null==r?void 0:r.length)||0;if(s)return s;const a=t[0];if(0===s&&"ISO8601"===n){var o;switch((null==(o=e.intervalUnit)?void 0:o.toLowerCase())||"seconds"){case"seconds":s=Math.round((t[1]-t[0])/1e3/i);break;case"minutes":s=Math.round((t[1]-t[0])/6e4/i);break;case"hours":s=Math.round((t[1]-t[0])/36e5/i);break;case"days":s=Math.round((t[1]-t[0])/864e5/i);break;case"years":s=Math.round((new Date(t[1]).getUTCFullYear()-new Date(a).getUTCFullYear())/i);break;case"decades":s=Math.round((new Date(t[1]).getUTCFullYear()-new Date(a).getUTCFullYear())/10/i)}return s}return Math.round((t[1]-t[0])/i)}};(0,n._)([(0,o.Cb)(g.HQ)],X.prototype,"url",null),(0,n._)([(0,o.Cb)({type:String,json:{write:!0}})],X.prototype,"datasetName",void 0),(0,n._)([(0,o.Cb)({type:String,json:{write:!0}})],X.prototype,"datasetFormat",void 0),(0,n._)([(0,o.Cb)()],X.prototype,"rasterInfo",void 0),(0,n._)([(0,o.Cb)()],X.prototype,"ioConfig",void 0),(0,n._)([(0,o.Cb)()],X.prototype,"sourceJSON",void 0),X=(0,n._)([(0,h.j)("esri.layers.support.rasterDatasets.BaseRaster")],X);var Q=X,K=i(30979);function ee(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})))),s=r.map((e=>e.name)),a=[];let o=0,l=0;return i.forEach((e=>{const t={};for(t[n]=o++,l=1;l<s.length;l++)t[s[l]]=e[l-1];a.push({attributes:t})})),{displayFieldName:"",fields:r,features:a}}var te=class{static get supportedVersions(){return[5]}static parse(e){const t=new DataView(e),i=3&t.getUint8(0);if(3!==i)return{header:{version:i},recordSet:null};const n=t.getUint32(4,!0),r=t.getUint16(8,!0),s=t.getUint16(10,!0),a={version:i,recordCount:n,headerByteCount:r,recordByteCount:s};let o=32;const l=[],c=[];let u;if(3===i){for(;13!==t.getUint8(o);)u=String.fromCharCode(t.getUint8(o+11)).trim(),l.push({name:(0,K.f)(new Uint8Array(e,o,11)),type:u,typeName:["String","Date","Double","Boolean","String","Integer"][["C","D","F","L","M","N"].indexOf(u)],length:t.getUint8(o+16)}),o+=32;if(o+=1,l.length>0)for(;c.length<n&&e.byteLength-o>s;){const i=[];32===t.getUint8(o)?(o+=1,l.forEach((t=>{if("C"===t.type)i.push((0,K.f)(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+=s}}return{header:a,fields:l,records:c,recordSet:ee({fields:l,records:c})}}};let ie=class extends J.wq{constructor(){super(...arguments),this.type="identity"}forwardTransform(e){return e}inverseTransform(e){return e}};(0,n._)([(0,o.Cb)({json:{write:!0}})],ie.prototype,"spatialReference",void 0),(0,n._)([(0,c.J)({IdentityXform:"identity"})],ie.prototype,"type",void 0),ie=(0,n._)([(0,h.j)("esri.layers.support.rasterTransforms.IdentityTransform")],ie);var ne=ie,re=i(39835);function se(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,s=n*r;return{x:e[0]+n*e[2]+r*e[4]+t*e[6]+s*e[8]+i*e[10],y:e[1]+n*e[3]+r*e[5]+t*e[7]+s*e[9]+i*e[11]}}
1const s=n*n,a=r*r,o=n*r,l=s*n,c=s*r,u=n*a,h=r*a;return{x:e[0]+n*e[2]+r*e[4]+s*e[6]+o*e[8]+a*e[10]+l*e[12]+c*e[14]+u*e[16]+h*e[18],y:e[1]+n*e[3]+r*e[5]+s*e[7]+o*e[9]+a*e[11]+l*e[13]+c*e[15]+u*e[17]+h*e[19]}}function ae(e,t,i){const{xmin:n,ymin:r,xmax:s,ymax:a,spatialReference:o}=t;let l=[];if(i<2)l.push({x:n,y:a}),l.push({x:s,y:a}),l.push({x:n,y:r}),l.push({x:s,y:r});else{let e=10;for(let t=0;t<e;t++)l.push({x:n,y:r+(a-r)*t/(e-1)}),l.push({x:s,y:r+(a-r)*t/(e-1)});e=8;for(let t=1;t<=e;t++)l.push({x:n+(s-n)*t/e,y:r}),l.push({x:n+(s-n)*t/e,y:a})}l=l.map((t=>se(e,t,i)));const c=l.map((e=>e.x)),u=l.map((e=>e.y));return new k.Z({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})}let oe=class extends J.wq{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 s=0;s<i.length;s++)r.push(i[s]),r.push(n[s]);return r}writeForwardCoefficients(e,t,i){const n=[],r=[];for(let s=0;s<(null==e?void 0:e.length);s++)s%2==0?n.push(e[s]):r.push(e[s]);t.coeffX=n,t.coeffY=r}get inverseCoefficients(){let e=this._get("inverseCoefficients");const t=this._get("forwardCoefficients");return!e&&t&&this.polynomialOrder<2&&(e=function(e){const[t,i,n,r,s,a]=e,o=n*a-s*r,l=s*r-n*a;return[(s*i-t*a)/o,(n*i-t*r)/l,a/o,r/l,-s/o,-n/l]}(t)),e}set inverseCoefficients(e){this._set("inverseCoefficients",e)}readInverseCoefficients(e,t){const{inverseCoeffX:i,inverseCoeffY:n}=t;if(null==i||!i.length||null==n||!n.length||i.length!==n.length)return null;const r=[];for(let s=0;s<i.length;s++)r.push(i[s]),r.push(n[s]);return r}writeInverseCoefficients(e,t,i){const n=[],r=[];for(let s=0;s<(null==e?void 0:e.length);s++)s%2==0?n.push(e[s]):r.push(e[s]);t.inverseCoeffX=n,t.inverseCoeffY=r}forwardTransform(e){if("point"===e.type){const t=se(this.forwardCoefficients,e,this.polynomialOrder);return new A.Z({x:t.x,y:t.y,spatialReference:e.spatialReference})}return ae(this.forwardCoefficients,e,this.polynomialOrder)}inverseTransform(e){if("point"===e.type){const t=se(this.inverseCoefficients,e,this.polynomialOrder);return new A.Z({x:t.x,y:t.y,spatialReference:e.spatialReference})}return ae(this.inverseCoefficients,e,this.polynomialOrder)}};(0,n._)([(0,o.Cb)({json:{write:!0}})],oe.prototype,"polynomialOrder",void 0),(0,n._)([(0,o.Cb)()],oe.prototype,"forwardCoefficients",void 0),(0,n._)([(0,u.r)("forwardCoefficients",["coeffX","coeffY"])],oe.prototype,"readForwardCoefficients",null),(0,n._)([(0,re.c)("forwardCoefficients")],oe.prototype,"writeForwardCoefficients",null),(0,n._)([(0,o.Cb)({json:{write:!0}})],oe.prototype,"inverseCoefficients",null),(0,n._)([(0,u.r)("inverseCoefficients",["inverseCoeffX","inverseCoeffY"])],oe.prototype,"readInverseCoefficients",null),(0,n._)([(0,re.c)("inverseCoefficients")],oe.prototype,"writeInverseCoefficients",null),(0,n._)([(0,o.Cb)({json:{write:!0}})],oe.prototype,"spatialReference",void 0),(0,n._)([(0,c.J)({PolynomialXform:"polynomial"})],oe.prototype,"type",void 0),oe=(0,n._)([(0,h.j)("esri.layers.support.rasterTransforms.PolynomialTransform")],oe);var le=oe;const ce={PolynomialXform:le,IdentityXform:ne},ue=Object.keys(ce);const he=new Map;he.set("int16","esriFieldTypeSmallInteger"),he.set("int32","esriFieldTypeInteger"),he.set("int64","esriFieldTypeInteger"),he.set("float32","esriFieldTypeSingle"),he.set("float64","esriFieldTypeDouble"),he.set("text","esriFieldTypeString");let fe=class extends Q{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 f.Z("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 s=this._buildCacheFilePath(r,t,i,n.multidimensionalDefinition),a=this._getIndexRecordFromBundle(t,i),o=await this.request(s,{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,a);if(0===c.recordSize)return null;const u=await this.request(s,{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){return e&&"RasterInfo"===e.type&&!["origin","extent","geodataXform","LODInfos","blockWidth","blockHeight","bandCount","pixelType","pixelSizeX","pixelSizeY","format","packetSize"].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:s,colormap:a,blockWidth:o,blockHeight:l,firstPyramidLevel:c,maximumPyramidLevel:u}=e,h=e.statistics&&e.statistics.map((e=>({min:e.min,max:e.max,avg:e.mean,stddev:e.standardDeviation,median:e.median,mode:e.mode}))),f=e.extent.spatialReference,d=null==(t=e.geodataXform)?void 0:t.spatialReference,p=new M.Z(null!=f&&f.wkid||null!=f&&f.wkt?f:d);let m=new k.Z({xmin:e.extent.xmin,ymin:e.extent.ymin,xmax:e.extent.xmax,ymax:e.extent.ymax,spatialReference:p});const y=new A.Z({x:e.pixelSizeX,y:e.pixelSizeY,spatialReference:p}),g=Math.round((m.xmax-m.xmin)/y.x),x=Math.round((m.ymax-m.ymin)/y.y),v=this._parseTransform(e.geodataXform),w=v?m:null;v&&(m=v.forwardTransform(m),y.x=(m.xmax-m.xmin)/g,y.y=(m.ymax-m.ymin)/x);const b=null!=(i=e.properties)?i:{},I=e.format.toLowerCase().replace("cache/",""),_=new A.Z(e.origin.x,e.origin.y,p);let C,R,S,T;if(a&&a.colors)for(C=[],R=0;R<a.colors.length;R++)S=a.colors[R],T=a.values?a.values[R]:R,C.push([T,255&S,S<<16>>>24,S<<8>>>24,S>>>24]);const P=e.LODInfos,F=[];for(R=0;R<P.levels.length;R++)F.push({level:P.levels[R],resolution:P.resolutions[R],scale:96/.0254*P.resolutions[R]});const O=new D.Z({dpi:96,lods:F,format:I,origin:_,size:[o,l],spatialReference:p}),B={recordSize:8,packetSize:e.packetSize,headerSize:e.packetSize*e.packetSize*8+64},z=[{maxCol:Math.ceil(g/o)-1,maxRow:Math.ceil(x/l)-1,minCol:0,minRow:0}];let N=2;if(u>0)for(R=0;R<u;R++)z.push({maxCol:Math.ceil(g/N/o)-1,maxRow:Math.ceil(x/N/l)-1,minCol:0,minRow:0}),N*=2;const Z=e.mdInfo;return{storageInfo:B,rasterInfo:new H.Z({width:g,height:x,pixelType:n,bandCount:r,extent:m,nativeExtent:w,transform:v,spatialReference:p,pixelSize:y,keyProperties:b,
1statistics:h,histograms:s,multidimensionalInfo:Z,colormap:C,storageInfo:new q({blockWidth:o,blockHeight:l,pyramidBlockWidth:o,pyramidBlockHeight:l,origin:_,tileInfo:O,firstPyramidLevel:c,maximumPyramidLevel:u,blockBoundary:z})})}}_parseTransform(e){var t,i;if(!function(e){const t=null==e?void 0:e.type;return!e||ue.includes(t)}(e))throw new f.Z("cloudraster:open","the data contains unsupported geodata transform types");const n=function(e){if(!(null==e?void 0:e.type))return null;const t=ce[null==e?void 0:e.type];if(t){const i=new t;return i.read(e),i}return null}(e);if("identity"===n.type)return null;if(null==(t=n.forwardCoefficients)||!t.length||null==(i=n.inverseCoefficients)||!i.length)throw new f.Z("cloudraster:open","the data contains unsupported geodata transforms - both forward and inverse coefficients are required currently");return n}async _fetchAuxiliaryInformation(e){const t=this.request(this.url+"/conf.vat.json",{signal:e}).then((e=>e.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":he.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=te.parse(n[1]).recordSet),E.default.fromJSON(r)}_buildCacheFilePath(e,t,i,n){const s=this.storageInfo.packetSize,a=Math.floor(t/s)*s,o=Math.floor(i/s)*s,l="R"+this._toHexString4(a)+"C"+this._toHexString4(o);let c="L";c+=e>=10?e.toString():"0"+e.toString();const{multidimensionalInfo:u}=this.rasterInfo,h=null==n?void 0:n[0];if(!(0,r.pC)(u)||!h)return`${this.url}/_alllayers/${c}/${l}.bundle`;let f=u.variables.filter((e=>e.name===h.variableName))[0].dimensions[0].values.indexOf(h.values[0]).toString(16);const d=4-f.length;for(let r=0;r<d;r++)f="0"+f;return f="S"+f,`${this.url}/_alllayers/${h.variableName}/${f}/${c}/${l}.bundle`}_getIndexRecordFromBundle(e,t){const i=this.storageInfo.packetSize,n=i*(e%i)+t%i;if(n<0)throw"Invalid level / row / col";return 20+n*this.storageInfo.recordSize+44}_getTileEndAndContentType(e,t){const i=e.subarray(t,t+8);let n,r=0;for(n=0;n<5;n++)r|=(255&i[n])<<8*n;const s=0xffffffffff&r;for(r=0,n=5;n<8;n++)r|=(255&i[n])<<8*(n-5);return{position:s,recordSize:0xffffffffff&r}}_toHexString4(e){let t=e.toString(16);if(4!==t.length){let e=4-t.length;for(;e-- >0;)t="0"+t}return t}};(0,n._)([(0,o.Cb)({readOnly:!0})],fe.prototype,"storageInfo",void 0),(0,n._)([(0,o.Cb)({type:String,json:{write:!0}})],fe.prototype,"datasetFormat",void 0),fe=(0,n._)([(0,h.j)("esri.layers.support.rasterDatasets.CloudRaster")],fe);var de=fe;let pe=class extends Q{constructor(){super(...arguments),this.datasetFormat="MEMORY"}async open(e){var t;await this.init();const{pixelBlock:i,statistics:n,histograms:r,name:s,keyProperties:a,nativeExtent:o,transform:l}=this.data,{width:c,height:u,pixelType:h}=i,f=this.data.extent||new k.Z({xmin:-.5,ymin:.5,xmax:c-.5,ymax:u-.5,spatialReference:new M.Z({wkid:3857})}),d=null!=(t=this.data.isPseudoSpatialReference)?t:!this.data.extent,p={x:f.width/c,y:f.height/u},m=new H.Z({width:c,height:u,pixelType:h,extent:f,nativeExtent:o,transform:l,pixelSize:p,spatialReference:f.spatialReference,bandCount:3,keyProperties:a||{},statistics:n,isPseudoSpatialReference:d,histograms:r});this.createRemoteDatasetStorageInfo(m,512,512),this._set("rasterInfo",m),this.updateTileInfo(),await this._buildInMemoryRaster(i,{width:512,height:512},e),this.datasetName=s,this.url="/InMemory/"+s}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,s=this.rasterJobHandler?this.rasterJobHandler.split({pixelBlock:e,tileSize:t,maximumPyramidLevel:n},i):Promise.resolve((0,G.Vl)(e,t,n)),a=(0,r.pC)(this.rasterInfo.statistics),o=(0,r.pC)(this.rasterInfo.histograms),l=a&&o?Promise.resolve({statistics:null,histograms:null}):this.rasterJobHandler?this.rasterJobHandler.estimateStatisticsHistograms({pixelBlock:e},i):Promise.resolve((0,G.Hv)(e)),c=await(0,W.as)([s,l]);if(!c[0].value&&c[1].value)throw new f.Z("inmemory-raster:open","failed to build in memory raster");var u,h;this._pixelBlockTiles=c[0].value,a||(this.rasterInfo.statistics=null==(u=c[1].value)?void 0:u.statistics),o&&(this.rasterInfo.histograms=null==(h=c[1].value)?void 0:h.histograms)}};(0,n._)([(0,o.Cb)({type:String,json:{write:!0}})],pe.prototype,"datasetFormat",void 0),(0,n._)([(0,o.Cb)()],pe.prototype,"data",void 0),pe=(0,n._)([(0,h.j)("esri.layers.support.rasterDatasets.InMemoryRaster")],pe);var me=pe;function ye(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=ye(e,i);for(let e=0;e<r.length;e++)ye(r[e],t).forEach((e=>n.push(e)));return n}const r=e.getElementsByTagNameNS("*",i);if(!r||0===r.length)return[];for(let s=0;s<r.length;s++)n.push(r[s]||r.item[s]);return n}function ge(e,t){if(!e||!t)return null;let i=t;t.indexOf("/")>-1?(i=t.slice(0,t.indexOf("/")),t=t.slice(t.indexOf("/")+1)):t="";const n=ye(e,i);return n.length>0?t?ge(n[0],t):n[0]:null}function xe(e,t=null){const i=t?ge(e,t):e;let n;return i?(n=i.textContent||i.nodeValue,n?n.trim():null):null}function ve(e,t){return function(e,t){const i=ye(e,t),n=[];let r;for(let s=0;s<i.length;s++)r=i[s].textContent||i[s].nodeValue,r&&(r=r.trim(),""!==r&&n.push(r));return n}(e,t).map((e=>Number(e)))}function we(e,t){const i=xe(e,t);return Number(i)}function be(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}function Ie(e,t){if(!e||!t)return null;const i=[];for(let n=0;n<e.length;n++)i.push(e[n]),i.push(t[n]);return i}function _e(e){if(!e)return null;let t=Number(e);if(!isNaN(t)&&0!==t)return new M.Z({wkid:t});if(!(e=String(e)).startsWith("GEOGCS")&&!e.startsWith("PROJCS"))return null;const i=e.replace(/\]/g,"[").replace(/\"/g,"").split("[").map((e=>e.trim())).filter((e=>""!==e)),n=i[i.length-1].split(",");return"EPSG"===n[0]&&e.endsWith('"]]')&&(t=Number(n[1]),!isNaN(t)&&0!==t)?new M.Z({wkid:t}):new M.Z({wkt:e})}function Ce(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};
1e.documentElement.childNodes.forEach((e=>{if(1===e.nodeType)if(be(e,"SRS")){if(!i.spatialReference){const t=xe(e);i.spatialReference=_e(t)}}else if(be(e,"Metadata"))if("xml:ESRI"===e.getAttribute("domain")){const{spatialReference:t,transform:n}=function(e){var t;const i=ge(e,"GeodataXform"),n=_e(we(i,"SpatialReference/WKID")||xe(i,"SpatialReference/WKT"));if("typens:PolynomialXform"!==i.getAttribute("xsi:type"))return{spatialReference:n,transform:null};const r=null!=(t=we(i,"PolynomialOrder"))?t:1,s=ve(i,"CoeffX/Double"),a=ve(i,"CoeffY/Double"),o=ve(i,"InverseCoeffX/Double"),l=ve(i,"InverseCoeffY/Double"),c=Ie(s,a),u=Ie(o,l);return{spatialReference:n,transform:new le({spatialReference:n,polynomialOrder:r,forwardCoefficients:c,inverseCoefficients:u})}}(e);i.transform=n,i.spatialReference||(i.spatialReference=t)}else ye(e,"MDI").forEach((e=>i.metadata[e.getAttribute("key")]=xe(e)));else if(be(e,"PAMRasterBand")){const t=function(e){var t;const i=we(e,"NoDataValue"),n=ge(e,"Histograms/HistItem"),r=we(n,"HistMin"),s=we(n,"HistMax"),a=we(n,"BucketCount"),o=null==(t=xe(n,"HistCounts"))?void 0:t.split("|").map((e=>Number(e)));let l,c,u,h;ye(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":h=i}}));const f=we(e,"Metadata/SourceBandIndex");return{noDataValue:i,histogram:null!=o&&o.length&&null!=l&&null!=c?{min:r,max:s,size:a||o.length,counts:o}:null,sourceBandIndex:f,statistics:null!=l&&null!=c?{min:l,max:c,avg:u,stddev:h}:null}}(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 Re=class extends Q{async open(e){await this.init();const t=await this._fetchData(e);let{spatialReference:i,statistics:n,histograms:r,transform:s}=await this._fetchAuxiliaryData(e);const a=!i;a&&(i=new M.Z({wkid:3857})),null!=r&&r.length&&null==n&&(n=(0,G.Oh)(r));const{width:o,height:l}=t;let c=new k.Z({xmin:-.5,ymin:.5-l,xmax:o-.5,ymax:.5,spatialReference:i});const u=s?s.forwardTransform(c):c;let h=!0;if(s){const e=s.forwardCoefficients;h=e&&0===e[1]&&0===e[2],h&&(s=null,c=u)}const f=new me({data:{extent:u,nativeExtent:c,transform:s,pixelBlock:t,statistics:n,histograms:r,keyProperties:{DateType:"Processed"},isPseudoSpatialReference:a}});await f.open(),this._set("rasterInfo",f.rasterInfo),this._inMemoryRaster=f}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=(0,$.y)(t).toUpperCase();if("JPG"!==i&&"PNG"!==i&&"GIF"!==i&&"BMP"!==i)throw new f.Z("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=(0,r.Wg)(null==e?void 0:e.signal),s=null!=(t=this.ioConfig.skipExtensions)?t:[],a=s.indexOf("aux.xml")>-1?null:this.request(this.url+".aux.xml",{responseType:"xml",signal:n}),o=this.datasetFormat,l="JPG"===o?"jgw":"PNG"===o?"pgw":"BMP"===o?"bpw":null,c=s.indexOf(l)>-1?null:this.request(this.url.slice(0,this.url.lastIndexOf("."))+"."+l,{responseType:"text",signal:n}),u=await(0,W.as)([a,c]);if(null!=n&&n.aborted)throw(0,W.zE)();const h=Ce(null==(i=u[0].value)?void 0:i.data);if(!h.transform){const e=u[1].value?u[1].value.data.split("\n").slice(0,6).map((e=>Number(e))):null;h.transform=6===(null==e?void 0:e.length)?new le({forwardCoefficients:[e[4],e[5],e[0],-e[1],e[2],-e[3]]}):null}return h}};(0,n._)([(0,o.Cb)({type:String,json:{write:!0}})],Re.prototype,"datasetFormat",void 0),Re=(0,n._)([(0,h.j)("esri.layers.support.rasterDatasets.ImageAuxRaster")],Re);var Se=Re,Te=i(58269),Me=i(47907);let ke=class extends Q{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 f.Z("imageserverraster:open","cannot initialize tiled image service, missing service info");if(!n.tileInfo)throw new f.Z("imageserverraster:open","use ImageryLayer to open non-tiled image services");this._fixScaleInServiceInfo();this.tileType=n.cacheType,null==this.tileType&&(["jpg","jpeg","png","png8","png24","png32","mixed"].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 s=await this._fetchRasterInfo({signal:t});if(!(0,r.pC)(s))throw new f.Z("image-server-raster:open","cannot initialize image service");{const e="Map"===this.tileType?(0,Te.d)(n.tileInfo,n):D.Z.fromJSON(n.tileInfo),{extent:t,pixelSize:i}=s,r=.5/s.width*i.x;let a,o;const l=e.lodAt(Math.max.apply(null,e.lods.map((e=>e.level))));"Map"!==this.tileType&&0!==n.maxScale&&("Raster"===this.tileType?(a=e.lods.filter((e=>e.resolution===i.x))[0],a||(a=e.lods[e.lods.length-1])):(a=e.lods.filter((e=>Math.abs(e.scale-n.maxScale)<r))[0],a||(a=e.lods.filter((e=>e.scale>n.maxScale)).sort(((e,t)=>e.scale>t.scale?1:-1))[0])),i.x=i.y=a.resolution,s.width=Math.ceil((t.xmax-t.xmin)/i.x-.1),s.height=Math.ceil((t.ymax-t.ymin)/i.y-.1)),a||(a=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.filter((e=>Math.abs(e.scale-n.minScale)<r))[0],this._levelOffset=o.level-c.level),o||(o=c);const u=Math.max(i.x,i.y);(Math.abs(i.x-i.y)>r||!e.lods.some((e=>Math.abs(e.resolution-u)<r)))&&(i.x=i.y=a.resolution,s.width=Math.ceil((t.xmax-t.xmin)/i.x-.1),s.height=Math.ceil((t.ymax-t.ymin)/i.y-.1));const h=a.level-o.level,[f,d]=e.size,p=e.origin;let{x:m,y:y}=i;const g=[{minCol:Math.floor((t.xmin-p.x+.1*m)/f/m),maxCol:Math.floor((t.xmax-p.x-.1*m)/f/m),minRow:Math.floor((p.y-t.ymax+.1*y)/d/y),maxRow:Math.floor((p.y-t.ymin-.1*y)/d/y)}];if(h>0)for(let n=0;n<h;n++)m*=2,y*=2,g.push({minCol:Math.floor((t.xmin-p.x+.1*m)/f/m),maxCol:Math.floor((t.xmax-p.x-.1*m)/f/m),minRow:Math.floor((p.y-t.ymax+.1*y)/d/m),maxRow:Math.floor((p.y-t.ymin-.1*y)/d/m)});s.storageInfo=new q({blockWidth:e.size[0],blockHeight:e.size[1],pyramidBlockWidth:e.size[0],pyramidBlockHeight:e.size[1],compression:e.format,origin:e.origin,firstPyramidLevel:1,maximumPyramidLevel:h,tileInfo:e,blockBoundary:g}),this._set("rasterInfo",s)}if(n.capabilities.toLowerCase().indexOf("tilemap")>
1-1){const e={tileInfo:s.storageInfo.tileInfo,parsedUrl:(0,d.mN)(this.url),url:this.url,tileServers:[],type:"tile"};this._tilemapCache=new Me.y({layer:e})}}async fetchRawTile(e,t,i,n={}){const{storageInfo:r,extent:s,pixelSize:a}=this.rasterInfo,o=r.maximumPyramidLevel-e+this._levelOffset,l=`${this.url}/tile/${o}/${t}/${i}`,c=this._slices?{sliceId:n.sliceId||0}:null,{data:u}=await this.request(l,{query:c,responseType:"array-buffer",signal:n.signal});if(!u)return null;const h=await this.decodePixelBlock(u,{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&&i<f.maxCol&&t>f.minRow&&t<f.maxRow)return h;const{origin:d,blockWidth:p,blockHeight:m}=r,y=2**e,g=Math.round((s.xmin-d.x)/(a.x*y))%p,x=Math.round((s.xmax-d.x)/(a.x*y))%p,v=Math.round((d.y-s.ymax)/(a.x*y))%m,w=Math.round((d.y-s.ymin)/(a.x*y))%m,b=i===f.minCol?g:0,I=t===f.minRow?v:0,_=i===f.maxCol?x:p,C=t===f.maxRow?w:m;return(0,G.pW)(h,{x:b,y:I},{width:_-b,height:C-I}),h}getSliceIndex(e){if(null==e||!e.length||!this._slices)return null;const t=e;for(let i=0;i<this._slices.length;i++){const e=this._slices[i].multidimensionalDefinition;if(e.length===t.length&&!e.some((e=>{const i=t.filter((t=>e.variableName===t.variableName&&t.dimensionName===e.dimensionName))[0];return!i||(Array.isArray(e.values[0])?e.values[0][0]:e.values[0])!==(Array.isArray(i.values[0])?i.values[0][0]: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,(0,r.Wg)(t.datumTransformation));if(null===i)return null;let n=0;const{maximumPyramidLevel:s}=this.rasterInfo.storageInfo;let a=s-n+this._levelOffset;const o=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(o,n,(0,r.Wg)(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=M.Z.fromJSON(t.spatialReference||t.extent.spatialReference);if("Map"===this.tileType)return new H.Z({width:i,height:n,bandCount:3,extent:k.Z.fromJSON(t.extent),spatialReference:r,pixelSize:new A.Z({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:r}),pixelType:"u8",statistics:null,keyProperties:{DataType:"processed"}});const{slice:s,signal:a}=e,o=!!t.hasRasterAttributeTable&&this.request(this.url+"/rasterAttributeTable",{query:{slice:s,f:"json"},signal:a}).then((e=>E.default.fromJSON(e.data))).catch((()=>null)),l=!!t.hasColormap&&this.request(this.url+"/colormap",{query:{slice:s,f:"json"},signal:a}).then((e=>{var t;return null==(t=e.data)?void 0:t.colormap})),c=!!t.hasHistograms&&this.request(this.url+"/histograms",{query:{slice:s,f:"json"},signal:a}).then((e=>{var t;return null==(t=e.data)?void 0:t.histograms})),u=this.request(this.url+"/keyProperties",{query:{f:"json"},signal:a}).then((e=>e.data)).catch((()=>{})),h=!!t.hasMultidimensions&&this._fetchMultidimensionalInfo(),f=!!t.hasMultidimensions&&this.request(this.url+"/slices",{query:{f:"json"},signal:a}).then((e=>e.data&&e.data.slices)).catch((()=>{}));return Promise.all([o,l,c,u,h,f]).then((e=>{let s=null;if(t.minValues&&t.minValues.length===t.bandCount){s=[];for(let e=0;e<t.minValues.length;e++)s.push({min:t.minValues[e],max:t.maxValues[e],avg:t.meanValues[e],stddev:t.stdvValues[e]})}return this._slices=e[5]||null,new H.Z({width:i,height:n,bandCount:t.bandCount,extent:k.Z.fromJSON(t.extent),spatialReference:r,pixelSize:new A.Z({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:r}),pixelType:t.pixelType.toLowerCase(),statistics:s,attributeTable:e[0]||null,colormap:e[1]||null,histograms:e[2]||null,keyProperties:e[3]||{},multidimensionalInfo:e[4]||null})}))}async _fetchMultidimensionalInfo(e){var t;const i=await this.request(this.url+"/multidimensionalInfo",{query:{f:"json"},signal:e}).then((e=>{var t;return null==(t=e.data)?void 0:t.multidimensionalInfo}));
1return 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)}};(0,n._)([(0,o.Cb)({type:String,json:{write:!0}})],ke.prototype,"datasetFormat",void 0),(0,n._)([(0,o.Cb)()],ke.prototype,"tileType",void 0),ke=(0,n._)([(0,h.j)("esri.layers.support.rasterDatasets.ImageServerRaster")],ke);var Pe=ke,Fe=i(34780),De=i(32603);const Oe=new Map;Oe.set("Int8","s8"),Oe.set("UInt8","u8"),Oe.set("Int16","s16"),Oe.set("UInt16","u16"),Oe.set("Int32","s32"),Oe.set("UInt32","u32"),Oe.set("Float32","f32"),Oe.set("Float64","f32"),Oe.set("Double64","f32");const Be=new Map;Be.set("lerc",".lrc"),Be.set("none",".til"),Be.set("deflate",".pzp"),Be.set("jpeg",".jzp");let ze=class extends Q{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?(0,r.Wg)(e.signal):null,n=await this.request(this.url,{responseType:"xml",signal:i}),{rasterInfo:s,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 o;null!=t&&(s.statistics=null!=(o=t.statistics)?o:s.statistics,s.histograms=t.histograms,t.histograms&&!(0,r.pC)(s.statistics)&&(s.statistics=(0,G.Oh)(t.histograms)))}this._set("rasterInfo",s),this._files=a;const l=await this.request(a.index,{responseType:"array-buffer",signal:i});this._storageIndex=this._parseIndex(l.data);let c,u,h=0,f=-1;const{blockWidth:d,blockHeight:p,compression:m}=this.rasterInfo.storageInfo,y=this.rasterInfo.storageInfo.pyramidScalingFactor,{width:g,height:x,bandCount:v}=this.rasterInfo,w=[],b="none"===m?1:v;for(;h<this._storageIndex.length;)f++,c=Math.ceil(g/d/y**f),u=Math.ceil(x/p/y**f),h+=c*u*b*4,w.push({maxRow:u,maxCol:c,minCol:0,minRow:0});this.rasterInfo.storageInfo.blockBoundary=w,f>0&&(this.rasterInfo.storageInfo.firstPyramidLevel=1,this.rasterInfo.storageInfo.maximumPyramidLevel=f),this.updateTileInfo()}async fetchRawTile(e,t,i,n={}){const{blockWidth:r,blockHeight:s,blockBoundary:a,compression:o}=this.rasterInfo.storageInfo,l=a[e];if(!l||l.maxRow<t||l.maxCol<i||l.minRow>t||l.minCol>i)return null;const{bandCount:c,pixelType:u}=this.rasterInfo,{ranges:h,actualTileWidth:f,actualTileHeight:d}=this._getTileLocation(e,t,i);if(!h||0===h.length)return null;if(0===h[0].from&&0===h[0].to){const e=new Uint8Array(r*s);return new Fe.Z({width:r,height:s,pixels:null,mask:e,validPixelCount:0})}const{bandIds:p}=this.ioConfig,m="none"===o?1:c,y=[];let g=0;for(g=0;g<m;g++)(!p||p.indexOf[g]>-1)&&y.push(this.request(this._files.data,{range:{from:h[g].from,to:h[g].to},responseType:"array-buffer",signal:n.signal}));const x=await Promise.all(y),v=x.map((e=>e.data.byteLength)).reduce(((e,t)=>e+t)),w=new Uint8Array(v);let b=0;for(g=0;g<m;g++)w.set(new Uint8Array(x[g].data),b),b+=x[g].data.byteLength;const I="lerc"===this.rasterInfo.storageInfo.compression?"lerc":"bip",_=await this.decodePixelBlock(w.buffer,{width:r,height:s,format:I,pixelType:u});let C=0,R=0;if(f!==r||d!==s){let e=_.mask;if(e)for(g=0;g<s;g++)if(R=g*r,g<d)for(C=f;C<r;C++)e[R+C]=0;else for(C=0;C<r;C++)e[R+C]=0;else for(e=new Uint8Array(r*s),_.mask=e,g=0;g<d;g++)for(R=g*r,C=0;C<f;C++)e[R+C]=1}return _}_parseIndex(e){if(e.byteLength%16>0)throw"invalid array buffer must be multiples of 16";let t,i,n,r,s,a;if(De.f){for(i=new Uint8Array(e),r=new ArrayBuffer(e.byteLength),n=new Uint8Array(r),s=0;s<e.byteLength/4;s++)for(a=0;a<4;a++)n[4*s+a]=i[4*s+3-a];t=new Uint32Array(r)}else t=new Uint32Array(e);return t}_getTileLocation(e,t,i){const{blockWidth:n,blockHeight:r,pyramidScalingFactor:s,compression:a}=this.rasterInfo.storageInfo,{width:o,height:l,bandCount:c}=this.rasterInfo,u="none"===a?1:c;let h,f,d,p=0,m=0;for(d=0;d<e;d++)m=s**d,h=Math.ceil(o/n/m),f=Math.ceil(l/r/m),p+=h*f;m=s**e,h=Math.ceil(o/n/m),f=Math.ceil(l/r/m),p+=t*h+i,p*=4*u;const y=this._storageIndex.subarray(p,p+4*u);let g=0,x=0;const v=[];for(let w=0;w<u;w++)g=y[4*w+0]*2**32+y[4*w+1],x=g+y[4*w+2]*2**32+y[4*w+3],v.push({from:g,to:x});return{ranges:v,actualTileWidth:i<h-1?n:Math.ceil(o/m)-n*(h-1),actualTileHeight:t<f-1?r:Math.ceil(l/m)-r*(f-1)}}_parseHeader(e){const t=ge(e,"MRF_META/Raster");if(!t)throw new f.Z("mrf:open","not a valid MRF format");const i=ge(t,"Size"),n=parseInt(i.getAttribute("x"),10),r=parseInt(i.getAttribute("y"),10),s=parseInt(i.getAttribute("c"),10),a=(xe(t,"Compression")||"none").toLowerCase();if(!a||-1===["none","lerc"].indexOf(a))throw new f.Z("mrf:open","currently does not support compression "+a);const o=xe(t,"DataType")||"UInt8",l=Oe.get(o);if(null==l)throw new f.Z("mrf:open","currently does not support pixel type "+o
1);const c=ge(t,"PageSize"),u=parseInt(c.getAttribute("x"),10),h=parseInt(c.getAttribute("y"),10),d=ge(t,"DataValues");let p,m;if(d&&(m=d.getAttribute("NoData"),null!=m&&(p=m.trim().split(" ").map((e=>parseFloat(e))))),ge(e,"MRF_META/CachedSource"))throw new f.Z("mrf:open","currently does not support MRF referencing other data files");const y=ge(e,"MRF_META/GeoTags"),g=ge(y,"BoundingBox");if(null==g)throw new f.Z("mrf:open","missing node MRF_META/GeoTags/BoundingBox");const x=parseFloat(g.getAttribute("minx")),v=parseFloat(g.getAttribute("miny")),w=parseFloat(g.getAttribute("maxx")),b=parseFloat(g.getAttribute("maxy")),I=xe(y,"Projection")||"",_=xe(e,"datafile"),C=xe(e,"IndexFile");let R;if("LOCAL_CS[]"!==I)if(I.toLowerCase().startsWith("epsg:")){const e=Number(I.slice(5));isNaN(e)||0===e||(R=new M.Z({wkid:e}))}else R=_e(I);const S=new k.Z(x,v,w,b);S.spatialReference=R;const T=ge(e,"MRF_META/Rsets"),P=parseInt(T&&T.getAttribute("scale")||"2",10),F=new q({origin:new A.Z({x:S.xmin,y:S.ymax,spatialReference:R}),blockWidth:u,blockHeight:h,pyramidBlockWidth:u,pyramidBlockHeight:h,compression:a,pyramidScalingFactor:P}),D=new A.Z({x:(w-x)/n,y:(b-v)/r,spatialReference:R});return{rasterInfo:new H.Z({width:n,height:r,extent:S,spatialReference:R,bandCount:s,pixelType:l,pixelSize:D,noDataValue:p,storageInfo:F}),files:{mrf:this.url,index:C||this.url.replace(".mrf",".idx"),data:_||this.url.replace(".mrf",Be.get(a))}}}async _fetchAuxiliaryData(e){try{const{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:null==e?void 0:e.signal});return Ce(t)}catch{return null}}};(0,n._)([(0,o.Cb)()],ze.prototype,"_files",void 0),(0,n._)([(0,o.Cb)()],ze.prototype,"_storageIndex",void 0),(0,n._)([(0,o.Cb)({type:String,json:{write:!0}})],ze.prototype,"datasetFormat",void 0),ze=(0,n._)([(0,h.j)("esri.layers.support.rasterIO.MRFRaster")],ze);var Ne=ze,Ze=i(11139),Le=i(27155);const Ae=function(e,t){const i=e.get(t);return i&&i.values},Ee=function(e,t){const i=e.get(t);return i&&i.values[0]};let He=class extends Q{constructor(){super(...arguments),this._files=null,this._headerInfo=null,this._bufferSize=1048576,this.datasetFormat="TIFF"}async open(e){var t;await this.init();const i=e?(0,r.Wg)(e.signal):null,{data:n}=await this.request(this.url,{range:{from:0,to:this._bufferSize},responseType:"array-buffer",signal:i});if(!n)throw new f.Z("tiffraster:open","failed to open url "+this.url);this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);const{littleEndian:s,firstIFD:a,isBigTiff:o}=(0,Le.cK)(n),l=[];await this.readIFDs(l,n,s,a,0,o?8:4,i);const c=(0,Le.FI)(l),{width:u,height:h,tileWidth:d,tileHeight:p,planes:m,pixelType:y,compression:g,firstPyramidLevel:x,maximumPyramidLevel:v,pyramidBlockWidth:w,pyramidBlockHeight:b,tileBoundary:I,affine:_,metadata:C}=c,R=k.Z.fromJSON(c.extent),S=R.spatialReference,T=new A.Z(R?{x:R.xmin,y:R.ymax,spatialReference:S}:{x:0,y:0}),M=new q({blockWidth:d,blockHeight:p,pyramidBlockWidth:w,pyramidBlockHeight:b,compression:g,origin:T,firstPyramidLevel:x,maximumPyramidLevel:v,blockBoundary:I}),P=new A.Z({x:(R.xmax-R.xmin)/u,y:(R.ymax-R.ymin)/h,spatialReference:S}),F=C?{BandProperties:C.bandProperties,DataType:C.dataType}:{},D=new H.Z({width:u,height:h,bandCount:m,pixelType:y,compression:g,pixelSize:P,storageInfo:M,spatialReference:S,keyProperties:F,extent:R,statistics:C?C.statistics:null});if(null!=_&&_.length&&(D.nativeExtent=new k.Z({xmin:-.5,ymin:.5-h,xmax:u-.5,ymax:.5,spatialReference:S}),D.transform=new le({polynomialOrder:1,forwardCoefficients:[_[2]+_[0]/2,_[5]-_[3]/2,_[0],_[3],-_[1],-_[4]]}),D.extent=D.transform.forwardTransform(D.nativeExtent),D.pixelSize=new A.Z({x:(R.xmax-R.xmin)/u,y:(R.ymax-R.ymin)/h,spatialReference:S}),M.origin.x=-.5,M.origin.y=.5),null==(t=this.ioConfig.skipExtensions)||!t.includes("aux.xml")){const t=await this._fetchAuxiliaryData(e);if(null!=t){var O;if(D.statistics=null!=(O=t.statistics)?O:D.statistics,D.histograms=t.histograms,t.histograms&&!(0,r.pC)(D.statistics)&&(D.statistics=(0,G.Oh)(t.histograms)),t.transform&&!_){D.transform=t.transform,D.nativeExtent=D.extent;const e=D.transform.forwardTransform(D.nativeExtent);D.pixelSize=new A.Z({x:(e.xmax-e.xmin)/u,y:(e.ymax-e.ymin)/h,spatialReference:S}),D.extent=e}D.spatialReference||(D.spatialReference=t.spatialReference)}}if(this._set("rasterInfo",D),this._headerInfo={littleEndian:s,isBigTiff:o,ifds:l,...c},!this._headerInfo.isSupported)throw new f.Z("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 s=this.getTileLocation(e,t,i);if(!s)return null;const{range:a,actualTileWidth:o,actualTileHeight:l,ifd:c}=s,{data:u}=await this.request(this.url,{range:a,responseType:"array-buffer",signal:n.signal}),{blockWidth:h,blockHeight:f}=this.getBlockWidthHeight(e),d=await this.decodePixelBlock(u,{format:"tiff",customOptions:{headerInfo:this._headerInfo,ifd:c,offset:0,size:0},width:h,height:f,planes:null,pixelType:null});let p,m,y;if(o!==h||l!==f){let e=d.mask;if(e)for(p=0;p<f;p++)if(y=p*h,p<l)for(m=o;m<h;m++)e[y+m]=0;else for(m=0;m<h;m++)e[y+m]=0;else for(e=new Uint8Array(h*f),d.mask=e,p=0;p<l;p++)for(y=p*h,m=0;m<o;m++)e[y+m]=1}return d}async readIFDs(e,t,i,n,r,s=4,a){if(!n)return null;(n>=t.byteLength||n<0)&&(t=(await this.request(this.url,{range:{from:n+r,to:n+r+this._bufferSize},responseType:"array-buffer",signal:a})).data,r=n+r,n=0);const o=await this.readIFD(t,i,n,r,Ze.Z.TIFF_TAGS,s,a);if(e.push(o.ifd),!o.nextIFD)return null;await this.readIFDs(e,t,i,o.nextIFD-r,r,s,a)}async readIFD(e,t,i,n,r=Ze.Z.TIFF_TAGS,s=4,a){if(!e)return null;const o=(0,Le.vr)(e,t,i,n,r,s);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)),s=Math.min.apply(null,r.map((e=>e[0])));if(Math.min.apply(null,r.map((e=>e[0]+e[1])))-s<=this._bufferSize){const{data:r}=await this.request(this.url,{range:{from:s,to:s+this._bufferSize},responseType:"array-buffer",signal:a});
1e=r,n=s,i.forEach((i=>(0,Le.Dq)(e,t,i,n)))}}if(o.ifd.has("GEOKEYDIRECTORY")){const i=o.ifd.get("GEOKEYDIRECTORY"),r=i.values;if(r&&r.length>4){const s=r[0]+"."+r[1]+"."+r[2],o=await this.readIFD(e,t,i.valueOffset+6-n,n,Ze.Z.GEO_KEYS,2,a);i.data=o.ifd,i.data&&i.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[s]})}}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:a});return(e=i.data).byteLength<o.requiredBufferSize?null:this.readIFD(e,t,0,n,Ze.Z.TIFF_TAGS,4,a)}}getTileLocation(e,t,i){const{firstPyramidLevel:n,blockBoundary:r}=this.rasterInfo.storageInfo,s=0===e?0:e-(n-1),a=this._headerInfo.ifds[s];if(!a)return null;const o=Ae(a,"TILEOFFSETS");if(void 0===o)return null;const l=Ae(a,"TILEBYTECOUNTS"),{minRow:c,minCol:u,maxRow:h,maxCol:f}=r[s];if(t>h||i>f||t<c||i<u)return null;const d=Ee(a,"IMAGEWIDTH"),p=Ee(a,"IMAGELENGTH"),m=Ee(a,"TILEWIDTH"),y=Ee(a,"TILELENGTH"),g=t*(f+1)+i,x=o[g],v=l[g];return null==x||null==v?null:{range:{from:x,to:x+v-1},ifd:a,actualTileWidth:i===f?d%m:m,actualTileHeight:t===h?p%y:y}}async _fetchAuxiliaryData(e){try{const{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:null==e?void 0:e.signal});return Ce(t)}catch{return null}}};(0,n._)([(0,o.Cb)()],He.prototype,"_files",void 0),(0,n._)([(0,o.Cb)()],He.prototype,"_headerInfo",void 0),(0,n._)([(0,o.Cb)()],He.prototype,"_bufferSize",void 0),(0,n._)([(0,o.Cb)({type:String,json:{write:!0}})],He.prototype,"datasetFormat",void 0),He=(0,n._)([(0,h.j)("esri.layers.support.rasterDatasets.TIFFRaster")],He);var Je=He;const je=new Map;je.set("CRF",{desc:"Cloud Raster Format",constructor:de}),je.set("MRF",{desc:"Meta Raster Format",constructor:Ne}),je.set("TIFF",{desc:"GeoTIFF",constructor:Je}),je.set("RasterTileServer",{desc:"Raster Tile Server",constructor:Pe}),je.set("JPG",{desc:"JPG Raster Format",constructor:Se}),je.set("PNG",{desc:"PNG Raster Format",constructor:Se}),je.set("GIF",{desc:"GIF Raster Format",constructor:Se}),je.set("BMP",{desc:"BMP Raster Format",constructor:Se});var qe=class{static get supportedFormats(){const e=new Set;return je.forEach(((t,i)=>e.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 s={url:t,sourceJSON:n,datasetFormat:r,ioConfig:i||{bandIds:null,sampling:null}};let a,o;if(this.supportedFormats.has(r))return a=je.get(r).constructor,o=new a(s),await o.open({signal:e.signal}),o;if(r)throw new f.Z("rasterfactory:open","not a supported format "+r);const l=Array.from(je.keys());let c=0;const u=function(){return r=l[c++],r?(a=je.get(r).constructor,o=new a(s),o.open({signal:e.signal}).then((()=>o)).catch((()=>u()))):null};return u()}static register(e,t,i){je.has(e.toUpperCase())||je.set(e.toUpperCase(),{desc:t,constructor:i})}};const We=(0,l.wY)()({RSP_NearestNeighbor:"nearest",RSP_BilinearInterpolation:"bilinear",RSP_CubicConvolution:"cubic",RSP_Majority:"majority"});function Ue(){return{enabled:!this.loaded||"RasterTileServer"===this.raster.datasetFormat&&"Raster"===this.raster.tileType}}let $e=class extends((0,b.h)((0,C.M)((0,_.Q)((0,x.q)((0,I.I)(L((0,y.R)(m.Z)))))))){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}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=(0,r.pC)(e)?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).then((()=>this._openRaster(t)),(()=>this._openRaster(t)))),Promise.resolve(this)}get defaultPopupTemplate(){return this.createPopupTemplate()}get fields(){var e,t;
1let i=[new w.Z({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;if(n){const e=n.filter((e=>"oid"!==e.type&&"value"!==e.name.toLowerCase())).map((e=>{const t=e.clone();return t.name="Raster."+e.name,t}));i=i.concat(e)}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=(0,v.ij)(n,i)||void 0;if(null!=r)return r}createPopupTemplate(e){return(0,R.eZ)(this,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 f.Z("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 qe.open({url:this.url,sourceJSON:this.sourceJSON,ioConfig:this.ioConfig,signal:e});const{rasterInfo:t}=this.raster;if(!t)throw new f.Z("imagery-tile-layer:load","cannot load resources on "+this.url);this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON&&(this._set("version",this.sourceJSON.currentVersion),this._set("copyright",this.sourceJSON.copyrightText)),null==this.title&&(this.title=this.raster.datasetName),"Map"===this.raster.tileType&&(this.popupEnabled=!1),this._configDefaultSettings()}};(0,n._)([(0,o.Cb)({type:[a.z8],json:{write:{overridePolicy:Ue}}})],$e.prototype,"bandIds",void 0),(0,n._)([(0,o.Cb)({json:{write:{overridePolicy:Ue}}}),(0,c.J)(We)],$e.prototype,"interpolation",void 0),(0,n._)([(0,o.Cb)({json:{write:!0}})],$e.prototype,"multidimensionalDefinition",void 0),(0,n._)([(0,o.Cb)(g.rn)],$e.prototype,"legendEnabled",void 0),(0,n._)([(0,o.Cb)({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],$e.prototype,"isReference",void 0),(0,n._)([(0,o.Cb)({type:["show","hide"]})],$e.prototype,"listMode",void 0),(0,n._)([(0,o.Cb)()],$e.prototype,"sourceJSON",void 0),(0,n._)([(0,o.Cb)({readOnly:!0})],$e.prototype,"version",void 0),(0,n._)([(0,o.Cb)()],$e.prototype,"title",void 0),(0,n._)([(0,o.Cb)({readOnly:!0,json:{read:!1}})],$e.prototype,"type",void 0),(0,n._)([(0,o.Cb)({type:["ArcGISTiledImageServiceLayer"]})],$e.prototype,"operationalLayerType",void 0),(0,n._)([(0,o.Cb)({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,t)=>!t.disablePopup},write:{target:"disablePopup",overridePolicy:Ue,writer(e,t,i){t[i]=!e}}}})],$e.prototype,"popupEnabled",void 0),(0,n._)([(0,o.Cb)({type:p.Z,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy:Ue}}})],$e.prototype,"popupTemplate",void 0),(0,n._)([(0,o.Cb)({readOnly:!0})],$e.prototype,"defaultPopupTemplate",null),(0,n._)([(0,o.Cb)({readOnly:!0,type:[w.Z]})],$e.prototype,"fields",null),(0,n._)([(0,o.Cb)({types:v.dr,json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:Ue},origins:{"web-scene":{types:v.FK,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type})}}}}})],$e.prototype,"renderer",null),(0,n._)([(0,u.r)("renderer")],$e.prototype,"readRenderer",null),$e=(0,n._)([(0,h.j)("esri.layers.ImageryTileLayer")],$e);var Ge=$e},47907:function(e,t,i){i.d(t,{y:function(){return C}});var n=i(36663),r=(i(39994),i(13802)),s=i(81977),a=i(69236),o=i(66645),l=i(70375),c=i(3466),u=(i(12173),i(51876),i(17993)),h=i(78668),f=i(17262),d=i(36900),p=i(11509),m=i(44584),y=i(15071),g=i(55854),x=i(67134),v=i(7753);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,s=this._tileAvailabilityBitSet;return r<0||r>s.length?"unknown":s[r]&1<<n?"available":"unavailable"}_updateFromData(e){const t=this.location.width,i=this.location.height;let n=!0,r=!0;const s=Math.ceil(t*i/8),a=new Uint8Array(s);let o=0;for(let l=0;l<e.length;l++){const t=l%8;e[l]?(r=!1,a[o]|=1<<t):n=!1,7===t&&++o}r?this._allAvailability="unavailable":n?this._allAvailability="available":(this._allAvailability="unknown",this._tileAvailabilityBitSet=a,this.byteSize+=a.length)}static fromDefinition(e,t){const i=e.service.request||p.default,{row:n,col:r,width:s,height:a}=e,o={query:{f:"json"}};return t=t?{...o,...t}:o,i(function(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}(e),t).then((e=>e.data)).catch((e=>{if(e&&e.details&&422===e.details.httpStatus)return{location:{top:n,left:r,width:s,height:a},valid:!0,data:(0,v.a9)(s*a,0)};throw e})).then((e=>{if(e.location&&(e.location.top!==n||e.location.left!==r||e.location.width!==s||e.location.height!==a))throw new l.Z("tilemap:location-mismatch","Tilemap response for different location than requested",{response:e,definition:{top:n,left:r,width:s,height:a}});return w.fromJSON(e)}))}static fromJSON(e){w.validateJSON(e);const t=new w;return t.location=Object.freeze((0,x.d9)(e.location)),t._updateFromData(e.data),Object.freeze(t)}static validateJSON(e){if(!e||!e.location)throw new l.Z("tilemap:missing-location","
1Location missing from tilemap response");if(!1===e.valid)throw new l.Z("tilemap:invalid","Tilemap response was marked as invalid");if(!e.data)throw new l.Z("tilemap:missing-data","Data missing from tilemap response");if(!Array.isArray(e.data))throw new l.Z("tilemap:data-mismatch","Data must be an array of numbers");if(e.data.length!==e.location.width*e.location.height)throw new l.Z("tilemap:data-mismatch","Number of data items does not match width/height of tilemap")}}function b(e){return`${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`}var I;const _=r.Z.getLogger("esri.layers.support.TilemapCache");let C=I=class extends d.Z{constructor(e){super(e),this._handles=new m.Z,this._pendingTilemapRequests={},this._availableLevels={},this.levels=5,this.cacheByteSize=2097152,this.request=p.default,this._prefetchingEnabled=!0}initialize(){this._tilemapCache=new g.Z(this.cacheByteSize),this._handles.add([this.watch(["layer.parsedUrl","layer.tileServers?"],(()=>this._initializeTilemapDefinition())),(0,y.S1)(this,"layer.tileInfo.lods",(e=>this._initializeAvailableLevels(e)),!0)]),this._initializeTilemapDefinition()}destroy(){this._handles&&(this._handles.destroy(),this._handles=null)}castLevels(e){return e<=2?(_.error("Minimum levels for Tilemap is 3, but got ",e),3):e}get size(){return 1<<this.levels}fetchTilemap(e,t,i,n){if(!this._availableLevels[e])return Promise.reject(new l.Z("tilemap-cache:level-unavailable",`Level ${e} is unavailable in the service`));const r=this._tmpTilemapDefinition,s=this._tilemapFromCache(e,t,i,r);if(s)return Promise.resolve(s);const a=n&&n.signal;return n={...n,signal:null},new Promise(((e,t)=>{(0,h.fu)(a,(()=>t((0,h.zE)())));const i=b(r);let s=this._pendingTilemapRequests[i];if(!s){s=w.fromDefinition(r,n).then((e=>(this._tilemapCache.put(i,e,e.byteSize),e)));const e=()=>delete this._pendingTilemapRequests[i];this._pendingTilemapRequests[i]=s,s.then(e,e)}s.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"}getAvailabilityUpsample(e,t,i,n){n.level=e,n.row=t,n.col=i;const r=this.layer.tileInfo;for(r.updateTileInfo(n);;){const e=this.getAvailability(n.level,n.row,n.col);if("unavailable"!==e)return e;if(!r.upsampleTile(n))return"unavailable"}}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.Z("tile-map:tile-unavailable","Tile is not available",{level:e,row:t,col:i})):r}if((0,h.D_)(n))throw n;return"unknown"})):Promise.reject(new l.Z("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 s=this.layer.tileInfo;s.updateTileInfo(n);const a=this.fetchAvailability(e,t,i,r).catch((e=>{if((0,h.D_)(e))throw e;if(s.upsampleTile(n))return this.fetchAvailabilityUpsample(n.level,n.row,n.col,n);throw e}));return this._fetchAvailabilityUpsamplePrefetch(n.id,e,t,i,r,a),a}async _fetchAvailabilityUpsamplePrefetch(e,t,i,n,r,s){if(!this._prefetchingEnabled)return;const a=`prefetch-${e}`;if(this._handles.has(a))return;const o=(0,h.yi)();s.then((()=>o.abort()),(()=>o.abort()));let l=!1;const c={remove(){l||(l=!0,o.abort())}};if(this._handles.add(c,a),await(0,f.MU)(10,o.signal).catch((()=>{})),l||(l=!0,this._handles.remove(a)),(0,h.Hc)(o))return;const u={id:e,level:t,row:i,col:n},d={...r,signal:o.signal},p=this.layer.tileInfo;for(let h=0;I._prefetches.length<I._maxPrefetch&&p.upsampleTile(u);++h){const e=this.fetchAvailability(u.level,u.row,u.col,d);I._prefetches.push(e);const t=()=>{I._prefetches.removeUnordered(e)};e.then(t,t)}}_initializeTilemapDefinition(){if(!this.layer.parsedUrl)return;const e=this.layer.parsedUrl,t=e.query;this._tilemapCache.clear(),this._tmpTilemapDefinition={service:{url:e.path,query:t?(0,c.B7)(t):null,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=b(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)}}};C._maxPrefetch=4,C._prefetches=new u.Z({initialSize:I._maxPrefetch}
1),(0,n._)([(0,s.Cb)({constructOnly:!0,type:Number})],C.prototype,"levels",void 0),(0,n._)([(0,a.p)("levels")],C.prototype,"castLevels",null),(0,n._)([(0,s.Cb)({readOnly:!0,type:Number})],C.prototype,"size",null),(0,n._)([(0,s.Cb)({constructOnly:!0,type:Number})],C.prototype,"cacheByteSize",void 0),(0,n._)([(0,s.Cb)({constructOnly:!0})],C.prototype,"layer",void 0),(0,n._)([(0,s.Cb)({constructOnly:!0})],C.prototype,"request",void 0),C=I=(0,n._)([(0,o.j)("esri.layers.support.TilemapCache")],C)},6815:function(e,t,i){i.d(t,{OE:function(){return f},Gc:function(){return m},Qg:function(){return d},Rq:function(){return c},gX:function(){return p},z2:function(){return u},ET:function(){return h},Vx:function(){return g}});var n=i(61681),r=i(86566);i(91957);var s=class{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;
1if(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,s=e+"/"+t;if(r.has(s)){const e=r.get(s);e.ts=Date.now(),e.refCount++}else r.set(s,{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<t.length&&t[n][1].ts<=i-this._duration;n++)e.delete(t[n][0]);0===e.size&&this.clearTimer()}),this._interval)}trim(){const e=this._cachedBlocks;if(-1===this._size||this._size>=e.size)return;const t=Array.from(e);for(let i=0;i<t.length-this._size;i++)e.delete(t[i][0])}clearTimer(){null!=this._timer&&(clearInterval(this._timer),this._timer=null)}},a=i(18486);const o=new Map,l=new s;function c(e,t){return null==t?e:`${e}?sliceId=${t}`}function u(e,t){const i={extent:null,rasterInfo:t,cache:new Map};if(o.has(e)){const t=o.get(e);return t.push(i),t.length-1}return o.set(e,[i]),0}function h(e,t){if(o.has(e)){const i=o.get(e);i[t]=null,i.some((e=>null!=e))||o.delete(e)}}function f(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;e<n.length;e++)n[e]&&n[e].cache.has(i)&&n[e].cache.delete(i);e.controller&&e.controller.abort()}return e.refCount}return 0}function d(e,t,i){if(!o.has(e))return null==t?l.getBlock(e,i):null;const n=o.get(e);if(null==n[t]){for(let e=0;e<n.length;e++)if(n[e]&&n[e].cache.has(i)){const t=n[e].cache.get(i);return t.refCount++,t.block}return l.getBlock(e,i)}const r=n[t].cache;if(r.has(i)){const e=r.get(i);return e.refCount++,e.block}for(let s=0;s<n.length;s++)if(s!==t&&n[s]&&n[s]&&n[s].cache.has(i)){const e=n[s].cache.get(i);return e.refCount++,r.set(i,e),e.block}return null}function p(e,t,i,n,r=null){if(!o.has(e))return void(null==t&&l.putBlock(e,i,n,r));const s=o.get(e);if(null==s[t])return void l.putBlock(e,i,n,r);const a={refCount:1,block:n,isResolved:!1,isRejected:!1,controller:r};n.then((()=>a.isResolved=!0)).catch((()=>a.isRejected=!0)),s[t].cache.set(i,a)}function m(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 y(e,t){if(!o.has(e))return null;const i=o.get(e);return null==i[t]?null:i[t]}function g(e,t,i,s,o,l,c=null){const u=y(e,t),h=u.extent,{cache:f,rasterInfo:d}=u;if(h&&h.xmin===i.xmin&&h.xmax===i.xmax&&h.ymin===i.ymin&&h.ymax===i.ymax)return;const p=i.clone().normalize(),{spatialReference:m,transform:g}=d,x=new Set;for(let y=0;y<p.length;y++){const e=p[y];if(e.xmax-e.xmin<=s||e.ymax-e.ymin<=s)continue;let t=(0,a.tB)(e,m,c);(0,n.pC)(g)&&(t=g.inverseTransform(t));const i=new r.Z({x:s,y:s,spatialReference:e.spatialReference});if(null==o&&!(o=(0,a.VO)(i,m,e,c)))return;const{pyramidLevel:u,pyramidResolution:h,excessiveReading:f}=(0,a.kr)(o,d,l||"closest");if(f)return;const{storageInfo:v}=d,{origin:w}=v,b={x:Math.max(0,Math.floor((t.xmin-w.x)/h.x)),y:Math.max(0,Math.floor((w.y-t.ymax)/h.y))},I=Math.ceil((t.xmax-t.xmin)/h.x-.1),_=Math.ceil((t.ymax-t.ymin)/h.y-.1),C=u>0?v.pyramidBlockWidth:v.blockWidth,R=u>0?v.pyramidBlockHeight:v.blockHeight,S=1,T=Math.max(0,Math.floor(b.x/C)-S),M=Math.max(0,Math.floor(b.y/R)-S),k=Math.floor((b.x+I-1)/C)+S,P=Math.floor((b.y+_-1)/R)+S;for(let n=M;n<=P;n++)for(let e=T;e<=k;e++)x.add(`${u}/${n}/${e}`)}f.forEach(((e,t)=>{if(!x.has(t)){const e=f.get(t);(null==e||e.isResolved||e.isRejected)&&f.delete(t)}})),u.extent={xmin:i.xmin,ymin:i.ymin,xmax:i.xmax,ymax:i.ymax}}},18486:function(e,t,i){i.d(t,{vF:function(){return w},_D:function(){return d},Qp:function(){return x},zD:function(){return f},tB:function(){return g},nF:function(){return y},VO:function(){return p},kr:function(){return v}});var n=i(70375),r=i(35925),s=i(39536),a=i(86566),o=i(91772),l=(i(91957),i(17321)),c=i(56060);const u=5e-4,h=function(e,t){const i=(e.isWGS84||e.isWebMercator)&&(t.isWGS84||t.isWebMercator);return!(e.equals(t)||i)};async function f(){if((0,c.kR)()||!(0,c.Gb)())return null;await(0,c.zD)()}function d(e,t,i){if(!h(e.spatialReference,t))return null;if(!(0,c.kR)())throw new n.Z("rasterprojectionhelper-projectResolution","projection engine is not loaded");return i?(0,c.rS)(t,e.spatialReference,e):(0,c.rS)(e.spatialReference,t,e)}function p(e,t,i,r=null){if(e.spatialReference.equals(t))return e;const a=h(e.spatialReference,t);if(a&&!(0,c.kR)())throw new n.Z("rasterprojectionhelper-projectResolution","projection engine is not loaded");const l=i.center,u=new o.Z({xmin:l.x-e.x/2,xmax:l.x+e.x/2,ymin:l.y-e.y/2,ymax:l.y+e.y/2,spatialReference:e.spatialReference}),f=a?(0,c.iV)(u,t,r):(0,s.iV)(u,t);return null==f?null:{x:f.xmax-f.xmin,y:f.ymax-f.ymin}}function m(e,t=.01){return(0,l.c9)(e)?t/(0,l.c9)(e):0}function y(e,t,i=null,a=!0){const o=e.spatialReference;if(o.equals(t))return e;const l=h(o,t);
1if(l&&!(0,c.kR)())throw new n.Z("rasterprojectionhelper-projectResolution","projection engine is not loaded");const f=l?(0,c.iV)(e,t,i):(0,s.iV)(e,t);if(f&&a&&t.isGeographic){var d,p;const[t,i]=o.isWebMercator?(0,r.C5)(o).origin:null!=(d=null==(p=(0,r.C5)(o))?void 0:p.valid)?d:[],n=m(o);n&&null!=t&&null!=i&&(Math.abs(e.x-t)<n&&Math.abs(180-f.x)<u?f.x-=360:Math.abs(e.x-i)<n&&Math.abs(180+f.x)<u&&(f.x+=360))}return f}function g(e,t,i=null,o=!0){var l,f,d,p;const g=e.spatialReference;if(g.equals(t))return e;const x=h(g,t);if(x&&!(0,c.kR)())throw new n.Z("rasterprojectionhelper-projectExtent","projection engine is not loaded");const v=x?(0,c.iV)(e,t,i):(0,s.iV)(e,t);let[w,b]=null!=(l=null==(f=(0,r.C5)(g))?void 0:f.origin)?l:[];if(v&&o&&g.isWebMercator&&t.isGeographic&&null!=w&&null!=b){const n=.001,r=1e3;if(Math.abs(e.xmin-w)<n&&Math.abs(b-e.xmax)>r&&Math.abs(180-v.xmax)<u){v.xmin=-180;const n=[];n.push(new a.Z(e.xmax,e.ymin,g)),n.push(new a.Z(e.xmax,(e.ymin+e.ymax)/2,g)),n.push(new a.Z(e.xmax,e.ymax,g));const r=n.map((e=>y(e,t,i))).filter((e=>!isNaN(null==e?void 0:e.x))).map((e=>e.x));v.xmax=Math.max.apply(null,r)}if(Math.abs(e.xmax-b)<n&&Math.abs(w-e.xmin)>r&&Math.abs(180+v.xmin)<u){v.xmax=180;const n=[];n.push(new a.Z(e.xmin,e.ymin,g)),n.push(new a.Z(e.xmin,(e.ymin+e.ymax)/2,g)),n.push(new a.Z(e.xmin,e.ymax,g));const r=n.map((e=>y(e,t,i))).filter((e=>!isNaN(null==e?void 0:e.x))).map((e=>e.x));v.xmin=Math.min.apply(null,r)}}[w,b]=t.isWebMercator?(0,r.C5)(t).origin:null!=(d=null==(p=(0,r.C5)(t))?void 0:p.valid)?d:[];const I=m(t);return I&&null!=w&&null!=b&&(Math.abs(v.xmin-w)<I&&(v.xmin=w),Math.abs(v.xmax-b)<I&&(v.xmax=b)),v}function x(e,t,i,s=null,o=null,l=!1,u=[32,32]){var f,d;if(h(e.spatialReference,t.spatialReference)&&!(0,c.kR)())throw new n.Z("rasterprojectionhelper-projectResolution","projection engine is not loaded");if(!(e&&t&&i))return null;const{xmin:p,ymin:m,xmax:g,ymax:x}=e,v=e.spatialReference,w=t.spatialReference,[b,I]=null!=(f=null==(d=(0,r.C5)(v))?void 0:d.valid)?f:[],_={x:u[0]*i.x,y:u[1]*i.y},C={cols:Math.ceil((g-p)/_.x-.1)+1,rows:Math.ceil((x-m)/_.y-.1)+1},R=_.x,S=_.y,T=[];let M,k=!1;for(let n=0;n<C.cols;n++){const e=[];for(let i=0;i<C.rows;i++){let r=y(new a.Z({x:p+R*n,y:x-S*i,spatialReference:v}),w,s);o&&(r=o.inverseTransform(r)),e.push(r),n>0&&l&&r&&M[i]&&null!=b&&r.x<M[i].x&&(r.x+=I-b),r?(T.push((r.x-t.xmin)/(t.xmax-t.xmin)),T.push((t.ymax-r.y)/(t.ymax-t.ymin))):(T.push(NaN),T.push(NaN),k=!0)}M=e}const P=function(e,t){const i=(e[0]+e[4]+e[4*t.cols]+e[4*t.cols+4])/4,n=(e[1]+e[5]+e[4*t.rows+1]+e[4*t.rows+5])/4;return[Math.abs(i-e[2*t.rows+2]),Math.abs(n-e[2*t.rows+3])]}(T,C),F=new Float32Array((C.cols-1)*(C.rows-1)*2*6),D=new Float32Array([-0,-1,1,-1,1,-0,1,-0,-0]),O=new Float32Array([-1,1,0,0,-1,1,1,0,0]);for(let n=0;n<C.cols-1;n++){for(let e=0;e<C.rows-1;e++){let t=n*C.rows*2+2*e;const i=T[t],r=T[t+1],s=T[t+2],a=T[t+3];t+=2*C.rows;const o=T[t],l=T[t+1],c=T[t+2],u=T[t+3];let h=0,f=12*(e*(C.cols-1)+n);for(let e=0;e<3;e++)F[f++]=D[h++]*i+D[h++]*s+D[h++]*c;h=0;for(let e=0;e<3;e++)F[f++]=D[h++]*r+D[h++]*a+D[h++]*u;h=0;for(let e=0;e<3;e++)F[f++]=O[h++]*i+O[h++]*o+O[h++]*c;h=0;for(let e=0;e<3;e++)F[f++]=O[h++]*r+O[h++]*l+O[h++]*u}if(k)for(let e=0;e<F.length;e++)isNaN(F[e])&&(F[e]=-1)}return{offsets:T,error:P,coefficients:F,spacing:u,size:[C.cols-1,C.rows-1]}}function v(e,t,i){const n=Math.log(e.x/t.pixelSize.x)/Math.LN2,r=Math.log(e.y/t.pixelSize.y)/Math.LN2,s=t.storageInfo.maximumPyramidLevel||0;let o="down"===i?Math.floor(Math.min(n,r)):"up"===i?Math.ceil(Math.max(n,r)):Math.round((n+r)/2),l=!1;o<0?o=0:o>s&&(l=o>s+3,o=s);const c=2**o;return{pyramidLevel:o,pyramidResolution:new a.Z({x:c*t.nativePixelSize.x,y:c*t.nativePixelSize.y,spatialReference:t.spatialReference}),excessiveReading:l}}function w(e,t,i=512,n=!0){const{extent:r,spatialReference:s,pixelSize:o}=e,c=p(new a.Z({x:o.x,y:o.y,spatialReference:s}),t,r);if(null==c)return{projectedPixelSize:null,scales:null,srcResolutions:null,isCustomTilingScheme:!1};const u=(c.x+c.y)/2,h=(0,l.c9)(t),f=u*h*96*39.37,d=t.isGeographic?512/i*295828763.7958547:512/i*591657527.591555;let m=!1;const y=g(r,t);n&&(t.isGeographic||t.isWebMercator)&&(m=y.xmin*y.xmax<0);let x,v=f;const w=1.001;
1if(m){v=d;const e=.29858214164761665,t=e*(96*h*39.37);x=p(new a.Z({x:e,y:e,spatialReference:{wkid:3857}}),s,y),x.x*=v/t,x.y*=v/t}else{x={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(;v<d*(w/2)&&i<t;)i++,v*=2,x.x*=2,x.y*=2;Math.max(v,d)/Math.min(v,d)<=w&&(v=d)}const b=[v],I=[{x:x.x,y:x.y}],_=Math.min(70.5310735,f)/w;for(;v>=_;)v/=2,x.x/=2,x.y/=2,b.push(v),I.push({x:x.x,y:x.y});return{projectedPixelSize:c,scales:b,srcResolutions:I,isCustomTilingScheme:!m}}},58269:function(e,t,i){i.d(t,{d:function(){return s},h:function(){return r}});var n=i(81590);const r={type:n.Z,json:{origins:{service:{read:{source:["tileInfo","minScale","maxScale","minLOD","maxLOD"],reader:s}}}}};function s(e,t,i,r){if(!e)return null;const{minScale:s,maxScale:a,minLOD:o,maxLOD:l}=t;if(null!=o&&null!=l)return r&&r.ignoreMinMaxLOD?n.Z.fromJSON(e):n.Z.fromJSON({...e,lods:e.lods.filter((({level:e})=>null!=e&&e>=o&&e<=l))});if(0!==s&&0!==a){const t=e=>Math.round(1e4*e)/1e4,i=s?t(s):1/0,r=a?t(a):-1/0;return n.Z.fromJSON({...e,lods:e.lods.filter((e=>{const n=t(e.scale);return n<=i&&n>=r}))})}return n.Z.fromJSON(e)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.