12 |
- import{cI as nt,db as fe,a as C,jf as qe,s as Ue,g as $,dM as at,a7 as J,k as X,t as M,cA as q,U as Ve,b2 as ot,v as lt,_ as I,$ as S,eH as Xe,a0 as Q,cp as ct,aL as H,ap as ut,cL as Ye,cq as Ke,h as ht,w as ft,jg as dt,ea as mt,bP as pt,jh as yt,i5 as gt,ih as xt,eC as It,eD as wt,iN as bt,iQ as St,iG as vt,eE as Rt,aM as Tt,gB as he,i9 as _t,R as kt,gX as Ct,e4 as Pt,iI as Ft,dc as Mt,cK as $t,cu as Ot}from"./index.6c049565.js";import{c as Bt,w as Dt,l as Qe,$ as Be,V as Et,L as Nt,j as zt,n as Jt,m as Ht,u as Lt,o as At,a as Wt}from"./fetchRasterInfo.4a5e5120.js";import{f as Ze,g as jt,i as Gt,s as qt,p as et,c as De,m as Ut,d as Vt}from"./multidimensionalUtils.6150b3b3.js";import{S as Xt,b as de,T as Yt,r as Ee,e as me,p as Kt,j as Pe,P as Qt,l as Zt,N as ei,D as ti,m as ye,G as ii,q as si,O as ri}from"./RasterSymbolizer.04994a43.js";import{a as Ne,x as ze,h as Je,d as ni,m as ai}from"./RawBlockCache.cda67491.js";import{T as ve,D as oi,j as li,W as ci,b as ui,g as hi}from"./pixelUtils.f4eba4af.js";import{T as He,U as ge,j as Le,o as Ae,n as fi,Q as Re,J as Te,$ as di,V as mi,C as pi}from"./rasterProjectionHelper.3c27ded5.js";import{m as yi,b as gi,d as xi,f as Ii}from"./dataUtils.97a7b38c.js";import{l as tt,f as wi,i as bi,m as Fe,c as Si}from"./utils.80cbb8ab.js";import"./generateRendererUtils.03b1f269.js";import"./colorUtils.bb6424b7.js";const xe=8;let V=class extends nt(ct){constructor(){super(...arguments),this.rasterJobHandler=null,this.datasetName=null,this.datasetFormat=null,this.rasterInfo=null,this.ioConfig={sampling:"closest"}}async init(){const e=He();this.addResolvingPromise(e),await this.when()}normalizeCtorArgs(e){return e&&e.ioConfig&&(e={...e,ioConfig:{resolution:null,bandIds:null,sampling:"closest",tileInfo:fe.create(),...e.ioConfig}}),e}get _isGlobalWrappableSource(){const{rasterInfo:e}=this,t=ge(e.spatialReference);return C(t)&&e.extent.width>=t/2}set url(e){this._set("url",qe(e,Ue.getLogger(this.declaredClass)))}async open(e){throw new $("BaseRaster:open-not-implemented","open() is not implemented")}async fetchTile(e,t,s,i={}){const r=i.tileInfo||this.rasterInfo.storageInfo.tileInfo,n=this.getTileExtentFromTileInfo(e,t,s,r);return this.fetchPixels(n,r.size[0],r.size[1],i)}async identify(e,t={}){var _,F;e=at(J,e).clone().normalize();const{multidimensionalDefinition:s,timeExtent:i}=t,{hasMultidimensionalTranspose:r,multidimensionalInfo:n}=this.rasterInfo;let{transposedVariableName:a}=t;const c=C(n)&&r&&(i!=null||Ze(s));c&&!a&&(a=C(s)&&s.length>0?(_=s[0].variableName)!=null?_:void 0:n.variables[0].name,t={...t,transposedVariableName:a}),t=this._getRequestOptionsWithSliceId(t);const{spatialReference:o,extent:l}=this.rasterInfo,{datumTransformation:u}=t;let h=Le(e,o,u);if(!l.intersects(h))return{location:h,value:null};if(C(this.rasterInfo.transform)){const B=this.rasterInfo.transform.inverseTransform(h);if(!this.rasterInfo.nativeExtent.intersects(B))return{location:B,value:null};h=B}let f=0;const d=C(a)&&C(n)&&this.rasterInfo.hasMultidimensionalTranspose;if(!d){if(t.srcResolution)f=Ae(t.srcResolution,this.rasterInfo,this.ioConfig.sampling).pyramidLevel;else if(f=await this.computeBestPyramidLevelForLocation(e,t),f==null)return{location:h,value:null}}const p=this.identifyPixelLocation(h,f,null,d);if(p===null)return{location:h,value:null};const{row:y,col:m,rowOffset:g,colOffset:w,blockWidth:x}=p,P=a!=null?a:X(t.sliceId),k=Ne(this.url,P),R=`${f}/${y}/${m}`;let v=ze(k,null,R);M(v)&&(v=this.fetchRawTile(f,y,m,t),Je(k,null,R,v));const T=await v;if(M(T)||!((F=T.pixels)!=null&&F.length))return{location:h,value:null};const b=g*x+w;return this._processIdentifyResult(T,{srcLocation:h,position:b,pyramidLevel:f,useTransposedTile:!!d,requestSomeSlices:c,identifyOptions:t})}async fetchPixels(e,t,s,i={}){if(e=fi(e),(i=this._getRequestOptionsWithSliceId(i)).requestRawData)return this._fetchPixels(e,t,s,i);const r=ge(e.spatialReference),n=Re(e);if(M(r)||n===0||n===1&&this._isGlobalWrappableSource)return this._fetchPixels(e,t,s,i);if(n>=3)return{extent:e,pixelBlock:null};const a=[],{xmin:c,xmax:o}=e,l=Math.round(r/(o-c)*t),u=l-Math.round((r/2-c)/(o-c)*t);let h=0;const f=[];for(let m=0;m<=n;m++){const g=new q({xmin:m===0?c:-r/2,xmax:m===n?o-r*m:r/2,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference}),w=m===0?l-u:m===n?t-h:l;h+=w,f.push(w);const x=i.disableWrapAround&&m>0?null:this._fetchPixels(g,w,s,i);a.push(x)}const d=(await Promise.all(a)).map(m=>m==null?void 0:m.pixelBlock);let p=null;const y={width:t,height:s};return this.rasterJobHandler?p=(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:d,srcMosaicSize:y,destDimension:null,coefs:null,sampleSpacing:null,interpolation:"nearest",alignmentInfo:null,blockWidths:f},i)).pixelBlock:p=ve(d,y,{blockWidths:f}),{extent:e,srcExtent:Te(e,this.rasterInfo.spatialReference,i.datumTransformation),pixelBlock:p}}async fetchRawPixels(e,t,s,i={}){t={x:Math.floor(t.x),y:Math.floor(t.y)};const r=await this._fetchRawTiles(e,t,s,i),{nativeExtent:n,nativePixelSize:a,storageInfo:c}=this.rasterInfo,o=2**e,l=a.x*o,u=a.y*o,h=new q({xmin:n.xmin+l*t.x,xmax:n.xmin+l*(t.x+s.width-1),ymin:n.ymax-u*(t.y+s.height-1),ymax:n.ymax-u*t.y,spatialReference:n.spatialReference});if(!r)return{extent:h,srcExtent:h,pixelBlock:null};const{pixelBlocks:f,mosaicSize:d}=r;if(f.length===1&&C(f[0])&&f[0].width===s.width&&f[0].height===s.height)return{extent:h,srcExtent:h,pixelBlock:r.pixelBlocks[0]};const p=e>0?c.pyramidBlockWidth:c.blockWidth,y=e>0?c.pyramidBlockHeight:c.blockHeight,m={x:t.x%p,y:t.y%y};let g;return this.rasterJobHandler?g=(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:f,srcMosaicSize:d,destDimension:s,clipOffset:m,clipSize:s,coefs:null,sampleSpacing:null,interpolation:i.interpolation,alignmentInfo:null,blockWidths:null},i)).pixelBlock:g=ve(f,d,{clipOffset:m,clipSize:s}),{extent:h,srcExtent:h,pixelBlock:g}}fetchRawTile(e,t,s,i){throw new $("BaseRaster:read-not-implemented","fetchRawTile() is not implemented")}computeExtent(e){return Te(this.rasterInfo.extent,e)}decodePixelBlock(e,t){return!this.rasterJobHandler||t.useCanvas?Xt(e,t):this.rasterJobHandler.decode({data:e,options:t})}async request(e,t,s=0){var o;const{customFetchParameters:i}=this.ioConfig,{range:r,query:n,headers:a}=t;s=(o=s!=null?s:t.retryCount)!=null?o:this.ioConfig.retryCount;const c=r?{Range:`bytes=${r.from}-${r.to}`}:null;try{return await Ve(e,{...t,query:{...n,...i},headers:{...a,...c}})}catch(l){if(s>0)return s--,this.request(e,t,s);throw l}}getSliceIndex(e){const{multidimensionalInfo:t}=this.rasterInfo;return M(t)||M(e)||e.length===0?null:jt(e,t)}getTileExtentFromTileInfo(e,t,s,i){const r=ot(i.lodAt(e));return this.getTileExtent({x:r.resolution,y:r.resolution},t,s,i.origin,i.spatialReference,i.size)}updateTileInfo(){const{storageInfo:e,spatialReference:t,extent:s,pixelSize:i}=this.rasterInfo;if(!e.tileInfo){const r=[],n=e.maximumPyramidLevel||0;let a=Math.max(i.x,i.y),c=1/.0254*96*a;for(let l=0;l<=n;l++)r.push({level:n-l,resolution:a,scale:c}),a*=2,c*=2;const o=new J({x:s.xmin,y:s.ymax,spatialReference:t});e.tileInfo=new fe({origin:o,size:[e.blockWidth,e.blockHeight],spatialReference:t,lods:r}),e.isVirtualTileInfo=!0}}createRemoteDatasetStorageInfo(e,t=512,s=512,i){const{width:r,height:n,nativeExtent:a,pixelSize:c,spatialReference:o}=e,l=new J({x:a.xmin,y:a.ymax,spatialReference:o});i==null&&(i=Math.max(0,Math.round(Math.log(Math.max(r,n))/Math.LN2-8)));const u=this.computeBlockBoundary(a,512,512,{x:a.xmin,y:a.ymax},[c],i);e.storageInfo=new de({blockWidth:t,blockHeight:s,pyramidBlockWidth:t,pyramidBlockHeight:s,origin:l,firstPyramidLevel:1,maximumPyramidLevel:i,blockBoundary:u})}async computeBestPyramidLevelForLocation(e,t={}){return 0}computeBlockBoundary(e,t,s,i,r,n=0,a=2){if(r.length===1&&n>0){r=[...r];let{x:u,y:h}=r[0];for(let f=0;f<n;f++)u*=a,h*=a,r.push({x:u,y:h})}const c=[],{x:o,y:l}=i;for(let u=0;u<r.length;u++){const{x:h,y:f}=r[u];c.push({minCol:Math.floor((e.xmin-o+.1*h)/t/h),maxCol:Math.floor((e.xmax-o-.1*h)/t/h),minRow:Math.floor((l-e.ymax+.1*f)/s/f),maxRow:Math.floor((l-e.ymin-.1*f)/s/f)})}return c}getPyramidPixelSize(e){const{nativePixelSize:t}=this.rasterInfo,{pyramidResolutions:s,pyramidScalingFactor:i}=this.rasterInfo.storageInfo;if(e===0)return t;if(C(s)&&s.length)return s[e-1];const r=i**e;return{x:t.x*r,y:t.y*r}}identifyPixelLocation(e,t,s,i){const{spatialReference:r,nativeExtent:n,storageInfo:a}=this.rasterInfo,{maximumPyramidLevel:c,origin:o,transposeInfo:l}=a,u=i&&C(l)?l.tileSize[0]:a.blockWidth,h=i&&C(l)?l.tileSize[1]:a.blockHeight,f=Le(e,r,s);if(!n.intersects(f)||t<0||t>c)return null;const d=this.getPyramidPixelSize(t),{x:p,y}=d,m=(o.y-f.y)/y/h,g=(f.x-o.x)/p/u,w=Math.min(h-1,Math.floor((m-Math.floor(m))*h)),x=Math.min(u-1,Math.floor((g-Math.floor(g))*u));return{pyramidLevel:t,row:Math.floor(m),col:Math.floor(g),rowOffset:w,colOffset:x,blockWidth:u,srcLocation:f}}getTileExtent(e,t,s,i,r,n){const[a,c]=n,o=i.x+s*a*e.x,l=o+a*e.x,u=i.y-t*c*e.y,h=u-c*e.y;return new q({xmin:o,xmax:l,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,s){const i=this.rasterInfo.storageInfo.blockBoundary[e];return!i||i.maxRow<t||i.maxCol<s||i.minRow>t||i.minCol>s}async _fetchPixels(e,t,s,i={}){let r=Re(e);if(r>=2)return{extent:e,pixelBlock:null};const n=this._getSourceDataInfo(e,t,s,i),{pyramidLevel:a,pyramidResolution:c,srcResolution:o,srcExtent:l,srcWidth:u,srcHeight:h}=n;if(u===0||h===0)return{extent:e,srcExtent:l,pixelBlock:null};const f=X(this.rasterInfo.transform),d=(f==null?void 0:f.type)==="gcs-shift",p=C(ge(e.spatialReference));!d&&p||(r=Re(n.srcExtent,d));const y=this.rasterInfo.storageInfo,m={x:Math.floor((l.xmin-y.origin.x)/c.x+.1),y:Math.floor((y.origin.y-l.ymax)/c.y+.1)},g=await this._fetchRawTiles(a,m,{width:u,height:h,wrapCount:r},i);if(!g)return{extent:e,srcExtent:l,pixelBlock:null};const w=a>0?y.pyramidBlockWidth:y.blockWidth,x=a>0?y.pyramidBlockHeight:y.blockHeight,P=w===u&&x===h&&m.x%w==0&&m.y%x==0,k=new J({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/s,spatialReference:e.spatialReference}),R=!e.spatialReference.equals(this.rasterInfo.spatialReference),{datumTransformation:v}=i;if(!R&&P&&g.pixelBlocks.length===1&&w===t&&x===s&&o.x===k.x&&o.y===k.y)return{extent:e,srcExtent:l,pixelBlock:g.pixelBlocks[0]};const T=p&&C(ge(l.spatialReference)),b=i.requestProjectedLocalDirections&&this.rasterInfo.dataType.startsWith("vector");b&&!this.rasterJobHandler&&await He();const _=this.rasterJobHandler?await this.rasterJobHandler.getProjectionOffsetGrid({projectedExtent:e,srcBufferExtent:g.extent,pixelSize:k.toJSON(),datumTransformation:v,rasterTransform:f,hasWrapAround:r>0||T,isAdaptive:this.ioConfig.optimizeProjectionAccuracy!==!1,includeGCSGrid:b},i):di({projectedExtent:e,srcBufferExtent:g.extent,pixelSize:k,datumTransformation:v,rasterTransform:f,hasWrapAround:r>0||T,isAdaptive:!1,includeGCSGrid:b});let F;const B=!i.requestRawData,U={rows:_.spacing[0],cols:_.spacing[1]},L=X(this._getRasterTileAlignmentInfo(a,g.extent.xmin)),{pixelBlocks:D,mosaicSize:A,isPartiallyFilled:W}=g;let N=null;if(this.rasterJobHandler)({pixelBlock:F,localNorthDirections:N}=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:D,srcMosaicSize:A,destDimension:B?{width:t,height:s}:null,coefs:B?_.coefficients:null,sampleSpacing:B?U:null,projectDirections:b,gcsGrid:b?_.gcsGrid:null,isUV:this.rasterInfo.dataType==="vector-uv",interpolation:i.interpolation,alignmentInfo:L,blockWidths:null},i));else{const j=ve(D,A,{alignmentInfo:L});F=B?oi(j,{width:t,height:s},_.coefficients,U,i.interpolation):j,b&&_.gcsGrid&&(N=li({width:t,height:s},_.gcsGrid),F=yi(F,this.rasterInfo.dataType,N))}return i.requestRawData||b?{srcExtent:l,pixelBlock:F,transformGrid:_,localNorthDirections:N,extent:e,isPartiallyFilled:W}:{srcExtent:l,extent:e,pixelBlock:F}}async _fetchRawTiles(e,t,s,i){const{origin:r,blockBoundary:n}=this.rasterInfo.storageInfo,{blockWidth:a,blockHeight:c}=this.getBlockWidthHeight(e);let{x:o,y:l}=t,{width:u,height:h,wrapCount:f}=s;const d=this._getRasterTileAlignmentInfo(e,0);i.buffer&&(o-=i.buffer.cols,l-=i.buffer.rows,u+=2*i.buffer.cols,h+=2*i.buffer.rows);let p=0,y=0,m=0;f&&C(d)&&({worldColumnCountFromOrigin:y,originColumnOffset:m,rightPadding:p}=d,y*d.blockWidth-p>=o+u&&(p=0));const g=Math.floor(o/a),w=Math.floor(l/c),x=Math.floor((o+u+p-1)/a),P=Math.floor((l+h+p-1)/c),k=n[e];if(!k)return null;const{minRow:R,minCol:v,maxCol:T,maxRow:b}=k;if(f===0&&(P<R||x<v||w>b||g>T))return null;const _=new Array;let F=!1;const B=this.ioConfig.allowPartialFill==null?i.allowPartialFill:this.ioConfig.allowPartialFill;for(let j=w;j<=P;j++)for(let E=g;E<=x;E++){let pe=E;if(!i.disableWrapAround&&f&&C(d)&&y<=E&&(pe=E-y-m),j>=R&&pe>=v&&b>=j&&T>=pe){const $e=this._fetchRawTile(e,j,pe,i);B?_.push(new Promise(Oe=>{$e.then(rt=>Oe(rt)).catch(()=>{F=!0,Oe(null)})})):_.push($e)}else _.push(Promise.resolve(null))}if(_.length===0)return null;const U=await Promise.all(_),L={height:(P-w+1)*c,width:(x-g+1)*a},{spatialReference:D}=this.rasterInfo,A=this.getPyramidPixelSize(e),{x:W,y:N}=A;return{extent:new q({xmin:r.x+g*a*W,xmax:r.x+(x+1)*a*W,ymin:r.y-(P+1)*c*N,ymax:r.y-w*c*N,spatialReference:D}),pixelBlocks:U,mosaicSize:L,isPartiallyFilled:F}}_fetchRawTile(e,t,s,i){const r=this.rasterInfo.storageInfo.blockBoundary[e];if(!r)return Promise.resolve(null);const{minRow:n,minCol:a,maxCol:c,maxRow:o}=r;if(t<n||s<a||t>o||s>c)return Promise.resolve(null);const l=Ne(this.url,i.sliceId),u=`${e}/${t}/${s}`;let h=ze(l,i.registryId,u);if(M(h)){const f=new AbortController;h=this.fetchRawTile(e,t,s,{...i,signal:f.signal}),Je(l,i.registryId,u,h,f),h.catch(()=>ni(l,i.registryId,u))}return i.signal&<(i,()=>{ai(l,i.registryId,u)}),h}_computeMagDirValues(e){var o;const{bandCount:t,dataType:s}=this.rasterInfo;if(!(t===2&&s==="vector-magdir"||s==="vector-uv")||(e==null?void 0:e.length)!==2||!((o=e[0])!=null&&o.length))return null;const i=e[0].length;if(s==="vector-magdir"){const l=e[1].map(u=>(u+360)%360);return[e[0],l]}const[r,n]=e,a=[],c=[];for(let l=0;l<i;l++){const[u,h]=gi([r[l],n[l]]);a.push(u),c.push(h)}return[a,c]}_getRasterTileAlignmentInfo(e,t){return this._rasterTileAlighmentInfo==null&&(this._rasterTileAlighmentInfo=mi(this.rasterInfo)),M(this._rasterTileAlighmentInfo.pyramidsInfo)?null:{startX:t,halfWorldWidth:this._rasterTileAlighmentInfo.halfWorldWidth,hasGCSSShiftTransform:this._rasterTileAlighmentInfo.hasGCSSShiftTransform,...this._rasterTileAlighmentInfo.pyramidsInfo[e]}}_getSourceDataInfo(e,t,s,i={}){const r={datumTransformation:i.datumTransformation,pyramidLevel:0,pyramidResolution:null,srcExtent:null,srcHeight:0,srcResolution:null,srcWidth:0};i.srcResolution&&(r.srcResolution=i.srcResolution,this._updateSourceDataInfo(e,r));const n=this.rasterInfo.storageInfo.maximumPyramidLevel||0,{srcWidth:a,srcHeight:c,pyramidLevel:o}=r,l=a/t,u=c/s,h=o<n&&l*u>=16;if(h||o===n&&(l>xe||u>xe)||a===0||c===0){const f=new J({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/s,spatialReference:e.spatialReference});let d=pi(f,this.rasterInfo.spatialReference,e,r.datumTransformation);const p=!d||i.srcResolution&&d.x+d.y<i.srcResolution.x+i.srcResolution.y;if(h&&i.srcResolution&&p){const y=Math.round(Math.log(Math.max(l,u))/Math.LN2)-1;if(n-o+3>=y){const m=2**y;d={x:i.srcResolution.x*m,y:i.srcResolution.y*m}}}d&&(r.srcResolution=d,this._updateSourceDataInfo(e,r))}return(r.srcWidth/t>xe||r.srcHeight/s>xe)&&(r.srcWidth=0,r.srcHeight=0),r}_updateSourceDataInfo(e,t){t.srcWidth=0,t.srcHeight=0;const s=this.rasterInfo.spatialReference,{srcResolution:i,datumTransformation:r}=t,{pyramidLevel:n,pyramidResolution:a,excessiveReading:c}=Ae(i,this.rasterInfo,this.ioConfig.sampling);if(c)return;let o=t.srcExtent||Te(e,s,r);if(o==null)return;const l=X(this.rasterInfo.transform);l&&(o=l.inverseTransform(o)),t.srcExtent=o;const u=Math.ceil((o.xmax-o.xmin)/a.x-.1),h=Math.ceil((o.ymax-o.ymin)/a.y-.1);t.pyramidLevel=n,t.pyramidResolution=a,t.srcWidth=u,t.srcHeight=h}_getRequestOptionsWithSliceId(e){return C(this.rasterInfo.multidimensionalInfo)&&e.sliceId==null&&(e={...e,sliceId:this.getSliceIndex(e.multidimensionalDefinition)}),e}_processIdentifyResult(e,t){const{srcLocation:s,position:i,pyramidLevel:r,useTransposedTile:n}=t,a=e.pixels[0].length/e.width/e.height;if(!(!e.mask||e.mask[i]))return{location:s,value:null};const{multidimensionalInfo:c}=this.rasterInfo;if(M(c)||!n){const d=e.pixels.map(m=>m[i]),p={location:s,value:d,pyramidLevel:r},y=this._computeMagDirValues(d.map(m=>[m]));return y!=null&&y.length&&(p.magdirValue=y.map(m=>m[0])),p}let o=e.pixels.map(d=>Array.prototype.slice.call(d,i*a,i*a+a)),l=this._computeMagDirValues(o);const{requestSomeSlices:u,identifyOptions:h}=t;let f=Gt(c,h.transposedVariableName);if(u){const d=qt(f,X(h.multidimensionalDefinition),X(h.timeExtent));o=o.map(p=>d.map(y=>p[y])),l=l==null?void 0:l.map(p=>d.map(y=>p[y])),f=d.map(p=>f[p])}return{location:s,value:null,dataSeries:f.map((d,p)=>{const y={value:o.map(m=>m[p]),multidimensionalDefinition:d.multidimensionalDefinition.map(m=>new et({...m,isSlice:!0}))};return l!=null&&l.length&&(y.magdirValue=[l[0][p],l[1][p]]),y}),pyramidLevel:r}}};I([S()],V.prototype,"_rasterTileAlighmentInfo",void 0),I([S({readOnly:!0})],V.prototype,"_isGlobalWrappableSource",null),I([S(Xe)],V.prototype,"url",null),I([S({type:String,json:{write:!0}})],V.prototype,"datasetName",void 0),I([S({type:String,json:{write:!0}})],V.prototype,"datasetFormat",void 0),I([S()],V.prototype,"rasterInfo",void 0),I([S()],V.prototype,"ioConfig",void 0),I([S()],V.prototype,"sourceJSON",void 0),V=I([Q("esri.layers.support.rasterDatasets.BaseRaster")],V);const se=V;let re=class extends se{constructor(){super(...arguments),this.datasetFormat="Function",this.tileType="Raster",this.rasterFunction=null,this._primaryRasters=null}async open(e){var c;await this.init();const{rasterFunction:t}=this,{rasters:s,rasterIds:i}=t.getPrimaryRasters(),r=s.map(o=>o.rasterInfo?void 0:o.open(e));await Promise.all(r);const n=s.map(({rasterInfo:o})=>o),a=t.bind({rasterInfos:n,rasterIds:i});if(!a.success)throw new $("raster-function:open",`cannot bind the function: ${(c=a.error)!=null?c:""}`);await this.syncJobHandler(),this.set("sourceJSON",s[0].sourceJSON),this.set("rasterInfo",t.rasterInfo)}async syncJobHandler(){const{rasterFunction:e}=this;if(this._primaryRasters=e.getPrimaryRasters(),this.rasterJobHandler)return this.rasterJobHandler.updateRasterFunction(e)}async fetchPixels(e,t,s,i={}){var h,f;const{rasters:r,rasterIds:n}=this._primaryRasters,a=r.map(d=>d.fetchPixels(e,t,s,i)),c=await Promise.all(a),o=c.map(d=>d.pixelBlock);if(o.every(d=>M(d)))return c[0];const l=(f=(h=c.find(d=>C(d.pixelBlock)))==null?void 0:h.extent)!=null?f:e,u=this.rasterJobHandler?await this.rasterJobHandler.process({extent:l,primaryPixelBlocks:o,primaryRasterIds:n}):this.rasterFunction.process({extent:l,primaryPixelBlocks:o,primaryRasterIds:n});return{...c[0],pixelBlock:u}}};I([S({type:String,json:{write:!0}})],re.prototype,"datasetFormat",void 0),I([S()],re.prototype,"tileType",void 0),I([S()],re.prototype,"rasterFunction",void 0),re=I([Q("esri.layers.support.rasterDatasets.FunctionRaster")],re);const it=re,We=Ue.getLogger("esri.layers.mixins.ImageryTileMixin"),vi=e=>{let t=class extends e{constructor(){super(...arguments),this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this.bandIds=null,this.copyright=null,this.interpolation="nearest",this.multidimensionalDefinition=null,this.multidimensionalSubset=null,this.raster=null,this.rasterFunction=null,this.sourceJSON=null,this.symbolizer=null}get fullExtent(){var i;return(i=this.rasterInfo)==null?void 0:i.extent}get rasterInfo(){var i;return(i=this.raster)==null?void 0:i.rasterInfo}get spatialReference(){var i,r;return(r=(i=this.rasterInfo)==null?void 0:i.spatialReference)!=null?r:H.WGS84}get tileInfo(){var i;return(i=this.rasterInfo)==null?void 0:i.storageInfo.tileInfo}set url(i){this._set("url",qe(i,We))}set renderer(i){this._set("renderer",i),this.updateRenderer()}async convertVectorFieldData(i,r){if(M(i)||!this.rasterInfo)return null;const n=this._rasterJobHandler.instance,a=this.rasterInfo.dataType;return n?n.convertVectorFieldData({pixelBlock:i,dataType:a},r):xi(i,a)}async createFlowMesh(i,r){const n=this._rasterJobHandler.instance;return n?n.createFlowMesh(i,r):Ii(i.meshType,i.simulationSettings,i.flowData,C(r.signal)?r.signal:new AbortController().signal)}normalizeRasterFetchOptions(i){var c,o,l;const{multidimensionalInfo:r}=(c=this.rasterInfo)!=null?c:{};if(M(r))return i;let n=i.multidimensionalDefinition||this.multidimensionalDefinition;!M(n)&&n.length||(n=De(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset}));const a=i.timeExtent||this.timeExtent;if(C(n)&&C(a)&&(C(a.start)||C(a.end))){n=n.map(w=>w.clone());const u=(l=(o=r.variables.find(({name:w})=>w===n[0].variableName))==null?void 0:o.dimensions)==null?void 0:l.find(({name:w})=>w==="StdTime"),h=n.find(({dimensionName:w})=>w==="StdTime");if(!u||!h)return{...i,multidimensionalDefinition:null};const{start:f,end:d}=a,p=M(f)?null:f.getTime(),y=M(d)?null:d.getTime(),m=p!=null?p:y,g=y!=null?y:p;if(C(u.values)){const w=u.values.filter(x=>{if(Array.isArray(x)){if(m===g)return x[0]<=m&&x[1]>=m;const P=x[0]<=m&&x[1]>m||x[0]<g&&x[1]>=g,k=x[0]>=m&&x[1]<=g||x[0]<m&&x[1]>g;return P||k}return m===g?x===m:x>=m&&x<=g});if(w.length){const x=w.sort((P,k)=>{var R,v,T,b;return m===g?((R=P[0])!=null?R:P)-((v=k[0])!=null?v:k):Math.abs(((T=P[1])!=null?T:P)-g)-Math.abs(((b=k[1])!=null?b:k)-g)})[0];h.values=[x]}else n=null}else if(u.hasRegularIntervals&&u.extent){const[w,x]=u.extent;m>x||g<w?n=null:h.values=m===g?[m]:[Math.max(w,m),Math.min(x,g)]}}return C(n)&&Ut(n,this.multidimensionalSubset)?{...i,multidimensionalDefinition:null}:{...i,multidimensionalDefinition:n}}async updateRenderer(){const{loaded:i,symbolizer:r}=this;if(!i||!r||JSON.stringify(this._cachedRendererJson)===JSON.stringify(this.renderer))return;const n=this._rasterJobHandler.instance;n&&(r.rendererJSON=Be(this.renderer.toJSON()),r.bind(),await n.updateSymbolizer(r),this._cachedRendererJson=this.renderer.toJSON())}async applyRenderer(i,r){var l;const n=i&&i.pixelBlock;if(!(C(n)&&n.pixels&&n.pixels.length>0))return null;let a;await this.updateRenderer();const c=this._rasterJobHandler.instance,o=(l=this.bandIds)!=null?l:[];return a=c?await c.symbolize({...i,simpleStretchParams:r,bandIds:o}):this.symbolizer.symbolize({...i,simpleStretchParams:r,bandIds:o}),a}getTileUrl(i,r,n){var a;return((a=this.raster)==null?void 0:a.datasetFormat)==="RasterTileServer"?`${this.url}/tile/${i}/${r}/${n}`:""}getCompatibleTileInfo(i,r,n=!1){if(!this.loaded||M(r))return null;if(n&&i.equals(this.spatialReference))return this.tileInfo;const a=ut(i);return fe.create({size:256,spatialReference:i,origin:a?{x:a.origin[0],y:a.origin[1]}:{x:r.xmin,y:r.ymax}})}getCompatibleFullExtent(i){return this.loaded?(this._compatibleFullExtent&&this._compatibleFullExtent.spatialReference.equals(i)||(this._compatibleFullExtent=this.raster.computeExtent(i)),this._compatibleFullExtent):null}async fetchTile(i,r,n,a={}){if(s(this),a.requestAsImageElement){const c=this.getTileUrl(i,r,n);return Ve(c,{responseType:"image",query:{...this.refreshParameters,...this.raster.ioConfig.customFetchParameters},signal:a.signal}).then(o=>o.data)}if(C(this.rasterInfo.multidimensionalInfo)&&(a=this.normalizeRasterFetchOptions(a),M(a.multidimensionalDefinition))){const c=a.tileInfo||this.rasterInfo.storageInfo.tileInfo;return{extent:this.raster.getTileExtentFromTileInfo(i,r,n,c),pixelBlock:null}}return await this._initJobHandler(),await this._updateRasterFunction(),this.renderer.type==="raster-shaded-relief"&&(a={...a,buffer:{cols:1,rows:1}}),this.raster.fetchTile(i,r,n,a)}async fetchPixels(i,r,n,a={}){return C(this.rasterInfo.multidimensionalInfo)&&(a=this.normalizeRasterFetchOptions(a),M(a.multidimensionalDefinition))?{extent:i,pixelBlock:null}:(await this._initJobHandler(),await this._updateRasterFunction(),this.raster.fetchPixels(i,r,n,a))}async identify(i,r={}){return s(this),C(this.rasterInfo.multidimensionalInfo)&&!(this.rasterInfo.hasMultidimensionalTranspose&&!!(Ze(r.multidimensionalDefinition)||r.transposedVariableName||r.timeExtent))&&(r=this.normalizeRasterFetchOptions(r),M(r.multidimensionalDefinition))?{location:i,value:null}:this.raster.identify(i,r)}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}hasStandardTime(){var a,c,o;const i=(a=this.rasterInfo)==null?void 0:a.multidimensionalInfo;if(M(i)||((c=this.rasterInfo)==null?void 0:c.dataType)!=="standard-time")return!1;const r=this.multidimensionalDefinition,n=(o=r==null?void 0:r[0])==null?void 0:o.variableName;return i.variables.some(l=>l.name===n&&(!(r!=null&&r[0].dimensionName)||l.dimensions.some(u=>u.name==="StdTime")))}getStandardTimeValue(i){return new Date(24*(i-25569)*3600*1e3).toString()}getMultidimensionalSubsetVariables(i){const r=i!=null?i:this.rasterInfo.multidimensionalInfo;return Vt(this.multidimensionalSubset,r)}_configDefaultSettings(){this._configDefaultInterpolation(),this.multidimensionalDefinition||(this.multidimensionalDefinition=De(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset})),this._configDefaultRenderer()}_initJobHandler(){if(this._rasterJobHandler.connectionPromise!=null)return this._rasterJobHandler.connectionPromise;const i=new Jt;return this._rasterJobHandler.connectionPromise=i.initialize().then(()=>{s(this),this._rasterJobHandler.instance=i,this.raster.rasterJobHandler=i,this.renderer&&this.updateRenderer(),this.raster.datasetFormat==="Function"&&this.raster.syncJobHandler()}).catch(()=>{}),this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0,this._cachedRendererJson=null,this.raster&&(this.raster.rasterJobHandler=null)}_configDefaultInterpolation(){var i;if(this.interpolation==null){s(this);const r=Et(this.rasterInfo,this.raster.tileType,(i=this.sourceJSON)==null?void 0:i.defaultResamplingMethod);this._set("interpolation",r)}}_configDefaultRenderer(){var n,a,c,o,l;s(this);const i=this.raster.rasterInfo;if(this.bandIds||(this.bandIds=Nt(i)),!this.renderer){const u=zt(i,{bandIds:this.bandIds,variableName:C(this.multidimensionalDefinition)?(n=this.multidimensionalDefinition[0])==null?void 0:n.variableName:null});this.raster.datasetFormat==="WCSServer"&&u.type==="raster-stretch"&&(((c=(a=i.statistics)==null?void 0:a[0].max)!=null?c:0)>1e24||((l=(o=i.statistics)==null?void 0:o[0].min)!=null?l:0)<-1e24)&&(u.dynamicRangeAdjustment=!0,u.statistics=null,u.stretchType==="none"&&(u.stretchType="min-max")),this.renderer=u}this.symbolizer?(this.symbolizer.rendererJSON=Be(this.renderer.toJSON()),this.symbolizer.rasterInfo=i):this.symbolizer=new Yt({rendererJSON:this.renderer.toJSON(),rasterInfo:i});const r=this.symbolizer.bind();r.success||We.warn("imagery-tile-mixin",r.error||"The given renderer is not supported by the layer.")}async _updateRasterFunction(){var n;if(this.type!=="imagery-tile"||JSON.stringify(this.rasterFunction)===JSON.stringify(this._cachedRasterFunctionJson))return;let i=this.raster;(i==null?void 0:i.datasetFormat)==="Function"&&(i=i.rasterFunction.getPrimaryRasters().rasters[0]);const{rasterFunction:r}=this;if(r){const a=tt(r.toJSON(),{raster:i}),c=new it({rasterFunction:a});c.rasterJobHandler=this._rasterJobHandler.instance,await c.open(),this._cachedRasterFunctionJson=(n=this.rasterFunction)==null?void 0:n.toJSON(),this.raster=c}else this.raster=i}};function s(i){if(!i.raster||!i.rasterInfo)throw new $("imagery-tile","no raster")}return I([S()],t.prototype,"_cachedRendererJson",void 0),I([S()],t.prototype,"_cachedRasterFunctionJson",void 0),I([S()],t.prototype,"_compatibleFullExtent",void 0),I([S()],t.prototype,"_rasterJobHandler",void 0),I([S()],t.prototype,"bandIds",void 0),I([S({json:{origins:{service:{read:{source:"copyrightText"}}}}})],t.prototype,"copyright",void 0),I([S({json:{read:!1}})],t.prototype,"fullExtent",null),I([S()],t.prototype,"interpolation",void 0),I([S()],t.prototype,"ioConfig",void 0),I([S({type:[et]})],t.prototype,"multidimensionalDefinition",void 0),I([S({type:Bt,json:{write:!0}})],t.prototype,"multidimensionalSubset",void 0),I([S()],t.prototype,"raster",void 0),I([S({type:Dt})],t.prototype,"rasterFunction",void 0),I([S()],t.prototype,"rasterInfo",null),I([S()],t.prototype,"sourceJSON",void 0),I([S({json:{read:!1}})],t.prototype,"spatialReference",null),I([S({json:{read:!1}})],t.prototype,"tileInfo",null),I([S(Xe)],t.prototype,"url",null),I([S({types:Qe})],t.prototype,"renderer",null),I([S()],t.prototype,"symbolizer",void 0),t=I([Q("esri.layers.ImageryTileMixin")],t),t};function Ri(e){const t=e.fields,s=e.records,i=t.some(l=>l.name.toLowerCase()==="oid")?"OBJECTID":"OID",r=[{name:i,type:"esriFieldTypeOID",alias:"OID"}].concat(t.map(l=>({name:l.name,type:"esriFieldType"+l.typeName,alias:l.name}))),n=r.map(l=>l.name),a=[];let c=0,o=0;return s.forEach(l=>{const u={};for(u[i]=c++,o=1;o<n.length;o++)u[n[o]]=l[o-1];a.push({attributes:u})}),{displayFieldName:"",fields:r,features:a}}class st{static get supportedVersions(){return[5]}static parse(t){const s=new DataView(t),i=3&s.getUint8(0);if(i!==3)return{header:{version:i},recordSet:null};const r=s.getUint32(4,!0),n=s.getUint16(8,!0),a=s.getUint16(10,!0),c={version:i,recordCount:r,headerByteCount:n,recordByteCount:a};let o=32;const l=[],u=[];let h;if(i===3){for(;s.getUint8(o)!==13;)h=String.fromCharCode(s.getUint8(o+11)).trim(),l.push({name:Ee(new Uint8Array(t,o,11)),type:h,typeName:["String","Date","Double","Boolean","String","Integer"][["C","D","F","L","M","N"].indexOf(h)],length:s.getUint8(o+16)}),o+=32;if(o+=1,l.length>0)for(;u.length<r&&t.byteLength-o>a;){const f=[];s.getUint8(o)===32?(o+=1,l.forEach(d=>{if(d.type==="C")f.push(Ee(new Uint8Array(t,o,d.length)).trim());else if(d.type==="N")f.push(parseInt(String.fromCharCode.apply(null,new Uint8Array(t,o,d.length)).trim(),10));else if(d.type==="F")f.push(parseFloat(String.fromCharCode.apply(null,new Uint8Array(t,o,d.length)).trim()));else if(d.type==="D"){const p=String.fromCharCode.apply(null,new Uint8Array(t,o,d.length)).trim();f.push(new Date(parseInt(p.substring(0,4),10),parseInt(p.substring(4,6),10)-1,parseInt(p.substring(6,8),10)))}o+=d.length}),u.push(f)):o+=a}}return{header:c,fields:l,records:u,recordSet:Ri({fields:l,records:u})}}}const ee=new Map;ee.set("int16","esriFieldTypeSmallInteger"),ee.set("int32","esriFieldTypeInteger"),ee.set("int64","esriFieldTypeInteger"),ee.set("float32","esriFieldTypeSingle"),ee.set("float64","esriFieldTypeDouble"),ee.set("text","esriFieldTypeString");const je=8;let le=class extends se{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:e==null?void 0:e.signal});if(!this._validateHeader(t))throw new $("cloudraster:open","Invalid or unsupported conf.json.");this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);const{storageInfo:s,rasterInfo:i}=this._parseHeader(t);if(i.dataType==="thematic"){const r=await this._fetchAuxiliaryInformation();i.attributeTable=r}this._set("storageInfo",s),this._set("rasterInfo",i),this.ioConfig.retryCount=this.ioConfig.retryCount||0}async fetchRawTile(e,t,s,i={}){const{transposeInfo:r}=this.rasterInfo.storageInfo,{transposedVariableName:n}=i,a=!(!r||!n),c=a?0:this.rasterInfo.storageInfo.maximumPyramidLevel-e;if(c<0)return null;const o=this._buildCacheFilePath(c,t,s,i.multidimensionalDefinition,n),l=this._getIndexRecordFromBundle(t,s,a),u=await this.request(o,{range:{from:0,to:this.storageInfo.headerSize-1},responseType:"array-buffer",signal:i.signal});if(!u)return null;const h=new Uint8Array(u.data),f=this._getTileEndAndContentType(h,l);if(f.recordSize===0)return null;const d=await this.request(o,{range:{from:f.position,to:f.position+f.recordSize},responseType:"array-buffer",signal:i.signal});if(!d)return null;const[p,y]=this._getTileSize(a);return this.decodePixelBlock(d.data,{width:p,height:y,planes:null,pixelType:null,returnInterleaved:a})}_validateHeader(e){const t=["origin","extent","geodataXform","LODInfos","blockWidth","blockHeight","bandCount","pixelType","pixelSizeX","pixelSizeY","format","packetSize"];return e&&e.type==="RasterInfo"&&!t.some(s=>!e[s])}_parseHeader(e){var N,j;const t=["u1","u2","u4","u8","s8","u16","s16","u32","s32","f32","f64"][e.pixelType],{bandCount:s,histograms:i,colormap:r,blockWidth:n,blockHeight:a,firstPyramidLevel:c,maximumPyramidLevel:o}=e,l=e.statistics&&e.statistics.map(E=>({min:E.min,max:E.max,avg:E.mean,stddev:E.standardDeviation,median:E.median,mode:E.mode})),u=e.extent.spatialReference,h=(N=e.geodataXform)==null?void 0:N.spatialReference,f=new H((u==null?void 0:u.wkid)||(u==null?void 0:u.wkt)?u:h);let d=new q({xmin:e.extent.xmin,ymin:e.extent.ymin,xmax:e.extent.xmax,ymax:e.extent.ymax,spatialReference:f});const p=new J({x:e.pixelSizeX,y:e.pixelSizeY,spatialReference:f}),y=Math.round((d.xmax-d.xmin)/p.x),m=Math.round((d.ymax-d.ymin)/p.y),g=this._parseTransform(e.geodataXform),w=g?d:null;g&&(d=g.forwardTransform(d),p.x=(d.xmax-d.xmin)/y,p.y=(d.ymax-d.ymin)/m);const x=(j=e.properties)!=null?j:{},P=e.format.toLowerCase().replace("cache/",""),k=new J(e.origin.x,e.origin.y,f);let R,v,T,b;if(r&&r.colors)for(R=[],v=0;v<r.colors.length;v++)T=r.colors[v],b=r.values?r.values[v]:v,R.push([b,255&T,T<<16>>>24,T<<8>>>24,T>>>24]);const _=e.LODInfos,F=[];for(v=0;v<_.levels.length;v++)F.push({level:_.levels[v],resolution:_.resolutions[v],scale:96/.0254*_.resolutions[v]});const B=new fe({dpi:96,lods:F,format:P,origin:k,size:[n,a],spatialReference:f}),U={recordSize:je,packetSize:e.packetSize,headerSize:e.packetSize*e.packetSize*je+64},L=[{maxCol:Math.ceil(y/n)-1,maxRow:Math.ceil(m/a)-1,minCol:0,minRow:0}];let D=2;if(o>0)for(v=0;v<o;v++)L.push({maxCol:Math.ceil(y/D/n)-1,maxRow:Math.ceil(m/D/a)-1,minCol:0,minRow:0}),D*=2;const A=e.mdInfo;let W=null;if(A&&x._yxs){const E=x._yxs;W={packetSize:E.PacketSize,tileSize:[E.TileXSize,E.TileYSize]}}return{storageInfo:U,rasterInfo:new me({width:y,height:m,pixelType:t,bandCount:s,extent:d,nativeExtent:w,transform:g,spatialReference:f,pixelSize:p,keyProperties:x,statistics:l,histograms:i,multidimensionalInfo:A,colormap:R,storageInfo:new de({blockWidth:n,blockHeight:a,pyramidBlockWidth:n,pyramidBlockHeight:a,origin:k,tileInfo:B,transposeInfo:W,firstPyramidLevel:c,maximumPyramidLevel:o,blockBoundary:L})})}}_parseTransform(e){var s,i;if(!wi(e))throw new $("cloudraster:open","the data contains unsupported geodata transform types");const t=bi(e);if(t.type==="identity")return null;if(t.type!=="polynomial"||!((s=t.forwardCoefficients)!=null&&s.length)||!((i=t.inverseCoefficients)!=null&&i.length))throw new $("cloudraster:open","the data contains unsupported geodata transforms - both forward and inverse coefficients are required currently");return t}async _fetchAuxiliaryInformation(e){const t=this.request(this.url+"/conf.vat.json",{signal:e}).then(n=>n.data).catch(()=>null),s=this.request(this.url+"/conf.vat.dbf",{responseType:"array-buffer",signal:e}).then(n=>n.data).catch(()=>null),i=await Promise.all([t,s]);let r;if(i[0]){let n=i[0].fields;const a=i[0].values;if(n&&a){n=n.map(o=>({type:o.name==="OID"?"esriFieldTypeOID":ee.get(o.type),name:o.name,alias:o.alias||o.name}));const c=a.map(o=>({attributes:o}));n&&a&&(r={fields:n,features:c})}}return!r&&i[1]&&(r=st.parse(i[1]).recordSet),Ye.fromJSON(r)}_buildCacheFilePath(e,t,s,i,r){const n=this._getPackageSize(!!r),a=Math.floor(t/n)*n,c=Math.floor(s/n)*n,o="R"+this._toHexString4(a)+"C"+this._toHexString4(c);let l="L";l+=e>=10?e.toString():"0"+e.toString();const{multidimensionalInfo:u}=this.rasterInfo,h=i==null?void 0:i[0];if(M(u)||!h)return`${this.url}/_alllayers/${l}/${o}.bundle`;let f="_yxs";if(!r){f=u.variables.find(y=>y.name===h.variableName).dimensions[0].values.indexOf(h.values[0]).toString(16);const p=4-f.length;for(let y=0;y<p;y++)f="0"+f;f="S"+f}const d=this._getVariableFolderName(r||h.variableName);return`${this.url}/_alllayers/${d}/${f}/${l}/${o}.bundle`}_getPackageSize(e=!1){var s;const{transposeInfo:t}=this.rasterInfo.storageInfo;return e&&C(t)?(s=t.packetSize)!=null?s:0:this.storageInfo.packetSize}_getTileSize(e=!1){const{storageInfo:t}=this.rasterInfo,{transposeInfo:s}=t;return e&&C(s)?s.tileSize:t.tileInfo.size}_getVariableFolderName(e){return(e=e.trim())===""?"_v":e.replace(/[\{|\}\-]/g,"_").replace("\\*","_v")}_getIndexRecordFromBundle(e,t,s=!1){const i=this._getPackageSize(s),r=i*(e%i)+t%i;if(r<0)throw"Invalid level / row / col";return 20+r*this.storageInfo.recordSize+44}_getTileEndAndContentType(e,t){const s=e.subarray(t,t+8);let i,r=0;for(i=0;i<5;i++)r|=(255&s[i])<<8*i;const n=0xffffffffff&r;for(r=0,i=5;i<8;i++)r|=(255&s[i])<<8*(i-5);return{position:n,recordSize:0xffffffffff&r}}_toHexString4(e){let t=e.toString(16);if(t.length!==4){let s=4-t.length;for(;s-- >0;)t="0"+t}return t}};I([S({readOnly:!0})],le.prototype,"storageInfo",void 0),I([S({type:String,json:{write:!0}})],le.prototype,"datasetFormat",void 0),le=I([Q("esri.layers.support.rasterDatasets.CloudRaster")],le);const Ti=le;let ce=class extends se{constructor(){super(...arguments),this.datasetFormat="MEMORY",this.data=null}async open(e){var m,g;await this.init();const t=this.data,{pixelBlock:s,statistics:i,histograms:r,name:n,keyProperties:a,nativeExtent:c,transform:o}=this.data,{width:l,height:u,pixelType:h}=s,f=(m=t.extent)!=null?m:new q({xmin:-.5,ymin:.5,xmax:l-.5,ymax:u-.5,spatialReference:new H({wkid:3857})}),d=(g=t.isPseudoSpatialReference)!=null?g:!t.extent,p={x:f.width/l,y:f.height/u},y=new me({width:l,height:u,pixelType:h,extent:f,nativeExtent:c,transform:o,pixelSize:p,spatialReference:f.spatialReference,bandCount:3,keyProperties:a||{},statistics:i,isPseudoSpatialReference:d,histograms:r});this.createRemoteDatasetStorageInfo(y,512,512),this._set("rasterInfo",y),this.updateTileInfo(),await this._buildInMemoryRaster(s,{width:512,height:512},e),this.datasetName=n,this.url="/InMemory/"+n}fetchRawTile(e,t,s,i={}){const r=this._pixelBlockTiles.get(`${e}/${t}/${s}`);return Promise.resolve(r)}async _buildInMemoryRaster(e,t,s){var l,u;const i=this.rasterInfo.storageInfo.maximumPyramidLevel,r=this.rasterJobHandler?this.rasterJobHandler.split({pixelBlock:e,tileSize:t,maximumPyramidLevel:i},s):Promise.resolve(ci(e,t,i)),n=C(this.rasterInfo.statistics),a=C(this.rasterInfo.histograms),c=n?Promise.resolve({statistics:null,histograms:null}):this.rasterJobHandler?this.rasterJobHandler.estimateStatisticsHistograms({pixelBlock:e},s):Promise.resolve(Kt(e)),o=await Ke([r,c]);if(!o[0].value&&o[1].value)throw new $("inmemory-raster:open","failed to build in memory raster");this._pixelBlockTiles=o[0].value,n||(this.rasterInfo.statistics=(l=o[1].value)==null?void 0:l.statistics),a||(this.rasterInfo.histograms=(u=o[1].value)==null?void 0:u.histograms)}};I([S({type:String,json:{write:!0}})],ce.prototype,"datasetFormat",void 0),I([S()],ce.prototype,"data",void 0),ce=I([Q("esri.layers.support.rasterDatasets.InMemoryRaster")],ce);const _i=ce;function ae(e,t){if(!e||!t)return[];let s=t;t.includes("/")?(s=t.slice(0,t.indexOf("/")),t=t.slice(t.indexOf("/")+1)):t="";const i=[];if(t){const n=ae(e,s);for(let a=0;a<n.length;a++)ae(n[a],t).forEach(c=>i.push(c));return i}const r=e.getElementsByTagNameNS("*",s);if(!r||r.length===0)return[];for(let n=0;n<r.length;n++)i.push(r[n]||r.item[n]);return i}function G(e,t){if(!e||!t)return null;let s=t;t.includes("/")?(s=t.slice(0,t.indexOf("/")),t=t.slice(t.indexOf("/")+1)):t="";const i=ae(e,s);return i.length>0?t?G(i[0],t):i[0]:null}function K(e,t=null){const s=t?G(e,t):e;let i;return s?(i=s.textContent||s.nodeValue,i?i.trim():null):null}function ki(e,t){const s=ae(e,t),i=[];let r;for(let n=0;n<s.length;n++)r=s[n].textContent||s[n].nodeValue,r&&(r=r.trim(),r!==""&&i.push(r));return i}function Ie(e,t){return ki(e,t).map(s=>Number(s))}function ie(e,t){const s=K(e,t);return Number(s)}function _e(e,t){var r;const s=(r=e==null?void 0:e.nodeName)==null?void 0:r.toLowerCase(),i=t.toLowerCase();return s.slice(s.lastIndexOf(":")+1)===i}function Ge(e,t){if(!e||!t)return null;const s=[];for(let i=0;i<e.length;i++)s.push(e[i]),s.push(t[i]);return s}function Ci(e){var u;const t=G(e,"GeodataXform"),s=Se(ie(t,"SpatialReference/WKID")||K(t,"SpatialReference/WKT"));if(t.getAttribute("xsi:type")!=="typens:PolynomialXform")return{spatialReference:s,transform:null};const i=(u=ie(t,"PolynomialOrder"))!=null?u:1,r=Ie(t,"CoeffX/Double"),n=Ie(t,"CoeffY/Double"),a=Ie(t,"InverseCoeffX/Double"),c=Ie(t,"InverseCoeffY/Double"),o=Ge(r,n),l=Ge(a,c);return{spatialReference:s,transform:o&&l&&o.length&&l.length?new Fe({spatialReference:s,polynomialOrder:i,forwardCoefficients:o,inverseCoefficients:l}):null}}function Pi(e){var f;const t=ie(e,"NoDataValue"),s=G(e,"Histograms/HistItem"),i=ie(s,"HistMin"),r=ie(s,"HistMax"),n=ie(s,"BucketCount"),a=(f=K(s,"HistCounts"))==null?void 0:f.split("|").map(d=>Number(d));let c,o,l,u;ae(e,"Metadata/MDI").forEach(d=>{var y;const p=Number((y=d.textContent)!=null?y:d.nodeValue);switch(d.getAttribute("key").toUpperCase()){case"STATISTICS_MINIMUM":c=p;break;case"STATISTICS_MAXIMUM":o=p;break;case"STATISTICS_MEAN":l=p;break;case"STATISTICS_STDDEV":u=p}});const h=ie(e,"Metadata/SourceBandIndex");return{noDataValue:t,histogram:(a==null?void 0:a.length)&&i!=null&&r!=null?{min:i,max:r,size:n||a.length,counts:a}:null,sourceBandIndex:h,statistics:c!=null&&o!=null?{min:c,max:o,avg:l,stddev:u}:null}}function Se(e){if(!e)return null;let t=Number(e);if(!isNaN(t)&&t!==0)return new H({wkid:t});if((e=String(e)).startsWith("COMPD_CS")){if(!e.includes("VERTCS")||!e.includes("GEOGCS")&&!e.startsWith("PROJCS"))return null;const s=e.indexOf("VERTCS"),i=e.indexOf("PROJCS"),r=i>-1?i:e.indexOf("GEOGCS");if(r===-1)return null;const n=e.slice(r,e.lastIndexOf("]",s)+1).trim(),a=e.slice(s,e.lastIndexOf("]")).trim();t=ke(n);const c=new H(t?{wkid:t}:{wkt:n}),o=ke(a);return o&&(c.vcsWkid=o),c}return e.startsWith("GEOGCS")||e.startsWith("PROJCS")?(t=ke(e),new H(t!==0?{wkid:t}:{wkt:e})):null}function ke(e){var r;const t=e.replace(/\]/g,"[").replace(/\"/g,"").split("[").map(n=>n.trim()).filter(n=>n!==""),s=t[t.length-1].split(","),i=(r=s[0])==null?void 0:r.toLowerCase();if((i==="epsg"||i==="esri")&&e.endsWith('"]]')){const n=Number(s[1]);if(!isNaN(n)&&n!==0)return n}return 0}function Me(e){var i;if(((i=e==null?void 0:e.documentElement.tagName)==null?void 0:i.toLowerCase())!=="pamdataset")return{};const t={spatialReference:null,transform:null,metadata:{},rasterBands:[],statistics:null,histograms:null};e.documentElement.childNodes.forEach(r=>{if(r.nodeType===1){if(_e(r,"SRS")){if(!t.spatialReference){const n=K(r);t.spatialReference=Se(n)}}else if(_e(r,"Metadata"))if(r.getAttribute("domain")==="xml:ESRI"){const{spatialReference:n,transform:a}=Ci(r);t.transform=a,t.spatialReference||(t.spatialReference=n)}else ae(r,"MDI").forEach(n=>t.metadata[n.getAttribute("key")]=K(n));else if(_e(r,"PAMRasterBand")){const n=Pi(r);n.sourceBandIndex!=null&&t.rasterBands[n.sourceBandIndex]==null?t.rasterBands[n.sourceBandIndex]=n:t.rasterBands.push(n)}}});const s=t.rasterBands;if(s.length){const r=!!s[0].statistics;t.statistics=r?s.map(a=>a.statistics).filter(C):null;const n=!!s[0].histogram;t.histograms=n?s.map(a=>a.histogram).filter(C):null}return t}let be=class extends se{async open(e){await this.init();const t=await this._fetchData(e);let{spatialReference:s,statistics:i,histograms:r,transform:n}=await this._fetchAuxiliaryData(e);const a=!s;a&&(s=new H({wkid:3857})),(r==null?void 0:r.length)&&i==null&&(i=Pe(r));const{width:c,height:o}=t;let l=new q({xmin:-.5,ymin:.5-o,xmax:c-.5,ymax:.5,spatialReference:s});const u=n?n.forwardTransform(l):l;let h=!0;if(n){const d=n.forwardCoefficients;h=d&&d[1]===0&&d[2]===0,h&&(n=null,l=u)}const f=new _i({data:{extent:u,nativeExtent:l,transform:n,pixelBlock:t,statistics:i,histograms:r,keyProperties:{DateType:"Processed"},isPseudoSpatialReference:a}});await f.open(),f.data=null,this._set("rasterInfo",f.rasterInfo),this._inMemoryRaster=f}fetchRawTile(e,t,s,i={}){return this._inMemoryRaster.fetchRawTile(e,t,s,i)}async _fetchData(e){const{data:t}=await this.request(this.url,{responseType:"array-buffer",signal:e==null?void 0:e.signal}),s=Qt(t).toUpperCase();if(s!=="JPG"&&s!=="PNG"&&s!=="GIF"&&s!=="BMP")throw new $("image-aux-raster:open","the data is not a supported format");this._set("datasetFormat",s);const i=s.toLowerCase(),r=i==="gif"||i==="bmp"||!ht("ios");return await this.decodePixelBlock(t,{format:i,useCanvas:r,hasNoZlibMask:!0})}async _fetchAuxiliaryData(e){var l,u;const t=X(e==null?void 0:e.signal),s=(l=this.ioConfig.skipExtensions)!=null?l:[],i=s.includes("aux.xml")?null:this.request(this.url+".aux.xml",{responseType:"xml",signal:t}),r=this.datasetFormat,n=r==="JPG"?"jgw":r==="PNG"?"pgw":r==="BMP"?"bpw":null,a=n&&s.includes(n)?null:this.request(this.url.slice(0,this.url.lastIndexOf("."))+"."+n,{responseType:"text",signal:t}),c=await Ke([i,a]);if(t!=null&&t.aborted)throw ft();const o=Me((u=c[0].value)==null?void 0:u.data);if(!o.transform){const h=c[1].value?c[1].value.data.split(`
- `).slice(0,6).map(f=>Number(f)):null;o.transform=(h==null?void 0:h.length)===6?new Fe({forwardCoefficients:[h[4],h[5],h[0],-h[1],h[2],-h[3]]}):null}return o}};I([S({type:String,json:{write:!0}})],be.prototype,"datasetFormat",void 0),be=I([Q("esri.layers.support.rasterDatasets.ImageAuxRaster")],be);const we=be;let ue=class extends se{constructor(){super(...arguments),this._levelOffset=0,this._tilemapCache=null,this._slices=null,this.datasetFormat="RasterTileServer",this.tileType=null}async open(e){var k,R,v,T;await this.init();const t=e&&e.signal,s=this.sourceJSON?{data:this.sourceJSON}:await this.request(this.url,{query:{f:"json"},signal:t});s.ssl&&(this.url=this.url.replace(/^http:/i,"https:"));const i=s.data;if(this.sourceJSON=i,!i)throw new $("imageserverraster:open","cannot initialize tiled image service, missing service info");if(!i.tileInfo)throw new $("imageserverraster:open","use ImageryLayer to open non-tiled image services");this._fixScaleInServiceInfo();const r=["jpg","jpeg","png","png8","png24","png32","mixed"];this.tileType=i.cacheType,this.tileType==null&&(r.includes(i.tileInfo.format.toLowerCase())?this.tileType="Map":i.tileInfo.format.toLowerCase()==="lerc"?this.tileType="Elevation":this.tileType="Raster"),this.datasetName=(R=(k=i.name)==null?void 0:k.slice(i.name.indexOf("/")+1))!=null?R:"";const n=await this._fetchRasterInfo({signal:t});if(M(n))throw new $("image-server-raster:open","cannot initialize image service");const a=this.tileType==="Map"?dt(i.tileInfo,i):fe.fromJSON(i.tileInfo);mt(a);const[c,o]=this._computeMinMaxLOD(n,a),{extent:l,pixelSize:u}=n,h=.5/n.width*u.x,f=Math.max(u.x,u.y),{lods:d}=a;(this.tileType!=="Map"&&i.maxScale!==0||Math.abs(u.x-u.y)>h||!d.some(b=>Math.abs(b.resolution-f)<h))&&(u.x=u.y=c.resolution,n.width=Math.ceil((l.xmax-l.xmin)/u.x-.1),n.height=Math.ceil((l.ymax-l.ymin)/u.y-.1));const p=c.level-o.level,[y,m]=a.size,g=[];d.forEach(b=>{b.level>=o.level&&b.level<=c.level&&g.push({x:b.resolution,y:b.resolution})}),g.sort((b,_)=>b.x-_.x);const w=this.computeBlockBoundary(l,y,m,a.origin,g,p),x=g.length>1?g.slice(1):null;let P;if(i.transposeInfo&&(P={tileSize:[i.transposeInfo.rows,i.transposeInfo.cols],packetSize:(T=(v=n.keyProperties)==null?void 0:v._yxs.PacketSize)!=null?T:0}),n.storageInfo=new de({blockWidth:a.size[0],blockHeight:a.size[1],pyramidBlockWidth:a.size[0],pyramidBlockHeight:a.size[1],pyramidResolutions:x,compression:a.format,origin:a.origin,firstPyramidLevel:1,maximumPyramidLevel:p,tileInfo:a,transposeInfo:P,blockBoundary:w}),this._fixGCSShift(n),this._set("rasterInfo",n),i.capabilities.toLowerCase().includes("tilemap")){const b={tileInfo:n.storageInfo.tileInfo,parsedUrl:pt(this.url),url:this.url,tileServers:[],type:"tile"};this._tilemapCache=new yt({layer:b})}}async fetchRawTile(e,t,s,i={}){const{storageInfo:r,extent:n}=this.rasterInfo,{transposeInfo:a}=r,c=C(a)&&!!i.transposedVariableName;if(this._slices&&!c&&i.sliceId==null)return null;const o=c?0:r.maximumPyramidLevel-e+this._levelOffset,l=`${this.url}/tile/${o}/${t}/${s}`,u=this._slices?c?{variable:i.transposedVariableName}:{sliceId:i.sliceId||0}:null,{data:h}=await this.request(l,{query:u,responseType:"array-buffer",signal:i.signal});if(!h)return null;const f=c?a.tileSize:r.tileInfo.size,d=await this.decodePixelBlock(h,{width:f[0],height:f[1],planes:null,pixelType:null,isPoint:this.tileType==="Elevation",returnInterleaved:c}),p=r.blockBoundary[e];if(r.compression!=="jpg"||s>p.minCol&&s<p.maxCol&&t>p.minRow&&t<p.maxRow)return d;const{origin:y,blockWidth:m,blockHeight:g}=r,{x:w,y:x}=this.getPyramidPixelSize(e),P=Math.round((n.xmin-y.x)/w)%m,k=Math.round((n.xmax-y.x)/w)%m||m,R=Math.round((y.y-n.ymax)/x)%g,v=Math.round((y.y-n.ymin)/x)%g||g,T=s===p.minCol?P:0,b=t===p.minRow?R:0,_=s===p.maxCol?k:m,F=t===p.maxRow?v:g;return ui(d,{x:T,y:b},{width:_-T,height:F-b}),d}getSliceIndex(e){if(!this._slices||M(e)||e.length===0)return null;const t=e;for(let s=0;s<this._slices.length;s++){const i=this._slices[s].multidimensionalDefinition;if(i.length===t.length&&!i.some(r=>{const n=t.find(a=>r.variableName===a.variableName&&a.dimensionName===r.dimensionName);return n?(Array.isArray(r.values[0])?`${r.values[0][0]}-${r.values[0][1]}`:r.values[0])!==(Array.isArray(n.values[0])?`${n.values[0][0]}-${n.values[0][1]}`:n.values[0]):!0}))return s}return null}async fetchVariableStatisticsHistograms(e,t){const s=this.request(this.url+"/statistics",{query:{variable:e,f:"json"},signal:t}).then(n=>{var a;return(a=n.data)==null?void 0:a.statistics}),i=this.request(this.url+"/histograms",{query:{variable:e,f:"json"},signal:t}).then(n=>{var a;return(a=n.data)==null?void 0:a.histograms}),r=await Promise.all([s,i]);return r[0]&&r[0].forEach(n=>{n.avg=n.mean,n.stddev=n.standardDeviation}),{statistics:r[0]||null,histograms:r[1]||null}}async computeBestPyramidLevelForLocation(e,t={}){if(!this._tilemapCache)return 0;let s=this.identifyPixelLocation(e,0,X(t.datumTransformation));if(s===null)return null;let i=0;const{maximumPyramidLevel:r}=this.rasterInfo.storageInfo;let n=r-i+this._levelOffset;const a=s.srcLocation;for(;n>=0;){try{if(await this._tilemapCache.fetchAvailability(n,s.row,s.col,t)==="available")break}catch{}if(n--,i++,s=this.identifyPixelLocation(a,i,X(t.datumTransformation)),s===null)return null}return n===-1||s==null?null:i}async _fetchRasterInfo(e){const t=this.sourceJSON;if(this.tileType==="Map"){const a=t.fullExtent||t.extent,c=Math.ceil((a.xmax-a.xmin)/t.pixelSizeX-.1),o=Math.ceil((a.ymax-a.ymin)/t.pixelSizeY-.1),l=H.fromJSON(t.spatialReference||a.spatialReference),u=new J({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:l});return new me({width:c,height:o,bandCount:3,extent:q.fromJSON(a),spatialReference:l,pixelSize:u,pixelType:"u8",statistics:null,keyProperties:{DataType:"processed"}})}const{signal:s}=e,i=Ht(this.url,this.sourceJSON,{signal:s,query:this.ioConfig.customFetchParameters}),r=t.hasMultidimensions?this.request(`${this.url}/slices`,{query:{f:"json"},signal:s}).then(a=>a.data&&a.data.slices).catch(()=>null):null,n=await Promise.all([i,r]);return this._slices=n[1],n[0]}_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:s}=e;t.xmin>-1&&t.xmax>181&&(s==null?void 0:s.wkid)&&s.isGeographic&&(e.nativeExtent=e.extent,e.transform=new Si,e.extent=e.transform.forwardTransform(t))}_computeMinMaxLOD(e,t){var f,d,p;const{pixelSize:s}=e,i=.5/e.width*s.x,{lods:r}=t,n=t.lodAt(Math.max.apply(null,r.map(y=>y.level))),a=t.lodAt(Math.min.apply(null,r.map(y=>y.level))),{tileType:c}=this;if(c==="Map")return this._levelOffset=r[0].level,[n,a];if(c==="Raster")return[(f=r.find(y=>y.resolution===s.x))!=null?f:n,a];const{minScale:o,maxScale:l}=this.sourceJSON;let u=n;l>0&&(u=r.find(y=>Math.abs(y.scale-l)<i),u||(u=(d=r.filter(y=>y.scale>l).sort((y,m)=>y.scale>m.scale?1:-1)[0])!=null?d:n));let h=a;return o>0&&(h=(p=r.find(y=>Math.abs(y.scale-o)<i))!=null?p:a,this._levelOffset=h.level-a.level),[u,h]}};I([S({type:String,json:{write:!0}})],ue.prototype,"datasetFormat",void 0),I([S()],ue.prototype,"tileType",void 0),ue=I([Q("esri.layers.support.rasterDatasets.ImageServerRaster")],ue);const Fi=ue,Y=new Map;Y.set("Int8","s8"),Y.set("UInt8","u8"),Y.set("Int16","s16"),Y.set("UInt16","u16"),Y.set("Int32","s32"),Y.set("UInt32","u32"),Y.set("Float32","f32"),Y.set("Float64","f32"),Y.set("Double64","f32");const Z=new Map;Z.set("none",{blobExtension:".til",isOneSegment:!0,decoderFormat:"bip"}),Z.set("lerc",{blobExtension:".lrc",isOneSegment:!1,decoderFormat:"lerc"}),Z.set("deflate",{blobExtension:".pzp",isOneSegment:!0,decoderFormat:"deflate"}),Z.set("jpeg",{blobExtension:".pjg",isOneSegment:!0,decoderFormat:"jpg"});let ne=class extends se{constructor(){super(...arguments),this._files=null,this._storageIndex=null,this.datasetFormat="MRF"}async open(e){var y,m;await this.init(),this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);const t=e?X(e.signal):null,s=await this.request(this.url,{responseType:"xml",signal:t}),{rasterInfo:i,files:r}=this._parseHeader(s.data);if(((y=this.ioConfig.skipExtensions)==null?void 0:y.indexOf("aux.xml"))===-1){const g=await this._fetchAuxiliaryData(e);g!=null&&(i.statistics=(m=g.statistics)!=null?m:i.statistics,i.histograms=g.histograms,g.histograms&&M(i.statistics)&&(i.statistics=Pe(g.histograms)))}this._set("rasterInfo",i),this._files=r;const n=await this.request(r.index,{responseType:"array-buffer",signal:t});this._storageIndex=this._parseIndex(n.data);const{blockWidth:a,blockHeight:c}=this.rasterInfo.storageInfo,o=this.rasterInfo.storageInfo.pyramidScalingFactor,{width:l,height:u}=this.rasterInfo,h=[],f=this._getBandSegmentCount();let d=0,p=-1;for(;d<this._storageIndex.length;){p++;const g=Math.ceil(l/a/o**p)-1,w=Math.ceil(u/c/o**p)-1;d+=(g+1)*(w+1)*f*4,h.push({maxRow:w,maxCol:g,minCol:0,minRow:0})}this.rasterInfo.storageInfo.blockBoundary=h,p>0&&(this.rasterInfo.storageInfo.firstPyramidLevel=1,this.rasterInfo.storageInfo.maximumPyramidLevel=p),this.updateTileInfo()}async fetchRawTile(e,t,s,i={}){const{blockWidth:r,blockHeight:n,blockBoundary:a}=this.rasterInfo.storageInfo,c=a[e];if(!c||c.maxRow<t||c.maxCol<s||c.minRow>t||c.minCol>s)return null;const{bandCount:o,pixelType:l}=this.rasterInfo,{ranges:u,actualTileWidth:h,actualTileHeight:f}=this._getTileLocation(e,t,s);if(!u||u.length===0)return null;if(u[0].from===0&&u[0].to===0){const b=new Uint8Array(r*n);return new hi({width:r,height:n,pixels:null,mask:b,validPixelCount:0})}const{bandIds:d}=this.ioConfig,p=this._getBandSegmentCount(),y=[];let m=0;for(m=0;m<p;m++)(!d||d.indexOf[m]>-1)&&y.push(this.request(this._files.data,{range:{from:u[m].from,to:u[m].to},responseType:"array-buffer",signal:i.signal}));const g=await Promise.all(y),w=g.map(b=>b.data.byteLength).reduce((b,_)=>b+_),x=new Uint8Array(w);let P=0;for(m=0;m<p;m++)x.set(new Uint8Array(g[m].data),P),P+=g[m].data.byteLength;const k=Z.get(this.rasterInfo.storageInfo.compression).decoderFormat,R=await this.decodePixelBlock(x.buffer,{width:r,height:n,format:k,planes:(d==null?void 0:d.length)||o,pixelType:l});if(C(this.rasterInfo.noDataValue)&&k!=="lerc"&&!R.mask){const b=this.rasterInfo.noDataValue[0];if(b!=null){const _=R.width*R.height,F=new Uint8Array(_);if(Math.abs(b)>1e24)for(m=0;m<_;m++)Math.abs((R.pixels[0][m]-b)/b)>1e-6&&(F[m]=1);else for(m=0;m<_;m++)R.pixels[0][m]!==b&&(F[m]=1);R.mask=F}}let v=0,T=0;if(h!==r||f!==n){let b=R.mask;if(b)for(m=0;m<n;m++)if(T=m*r,m<f)for(v=h;v<r;v++)b[T+v]=0;else for(v=0;v<r;v++)b[T+v]=0;else for(b=new Uint8Array(r*n),R.mask=b,m=0;m<f;m++)for(T=m*r,v=0;v<h;v++)b[T+v]=1}return R}_parseIndex(e){if(e.byteLength%16>0)throw"invalid array buffer must be multiples of 16";let t,s,i,r,n,a;if(Zt){for(s=new Uint8Array(e),r=new ArrayBuffer(e.byteLength),i=new Uint8Array(r),n=0;n<e.byteLength/4;n++)for(a=0;a<4;a++)i[4*n+a]=s[4*n+3-a];t=new Uint32Array(r)}else t=new Uint32Array(e);return t}_getBandSegmentCount(){return Z.get(this.rasterInfo.storageInfo.compression).isOneSegment?1:this.rasterInfo.bandCount}_getTileLocation(e,t,s){const{blockWidth:i,blockHeight:r,pyramidScalingFactor:n}=this.rasterInfo.storageInfo,{width:a,height:c}=this.rasterInfo,o=this._getBandSegmentCount();let l,u,h,f=0,d=0;for(h=0;h<e;h++)d=n**h,l=Math.ceil(a/i/d),u=Math.ceil(c/r/d),f+=l*u;d=n**e,l=Math.ceil(a/i/d),u=Math.ceil(c/r/d),f+=t*l+s,f*=4*o;const p=this._storageIndex.subarray(f,f+4*o);let y=0,m=0;const g=[];for(let w=0;w<o;w++)y=p[4*w+0]*2**32+p[4*w+1],m=y+p[4*w+2]*2**32+p[4*w+3],g.push({from:y,to:m});return{ranges:g,actualTileWidth:s<l-1?i:Math.ceil(a/d)-i*(l-1),actualTileHeight:t<u-1?r:Math.ceil(c/d)-r*(u-1)}}_parseHeader(e){var F;const t=G(e,"MRF_META/Raster");if(!t)throw new $("mrf:open","not a valid MRF format");const s=G(t,"Size"),i=parseInt(s.getAttribute("x"),10),r=parseInt(s.getAttribute("y"),10),n=parseInt(s.getAttribute("c"),10),a=(K(t,"Compression")||"none").toLowerCase();if(!Z.has(a))throw new $("mrf:open","currently does not support compression "+a);const c=K(t,"DataType")||"UInt8",o=Y.get(c);if(o==null)throw new $("mrf:open","currently does not support pixel type "+c);const l=G(t,"PageSize"),u=parseInt(l.getAttribute("x"),10),h=parseInt(l.getAttribute("y"),10),f=G(t,"DataValues");let d,p;if(f&&(p=f.getAttribute("NoData"),p!=null&&(d=p.trim().split(" ").map(B=>parseFloat(B)))),G(e,"MRF_META/CachedSource"))throw new $("mrf:open","currently does not support MRF referencing other data files");const y=G(e,"MRF_META/GeoTags"),m=G(y,"BoundingBox");let g,w=!1;if(m!=null){const B=parseFloat(m.getAttribute("minx")),U=parseFloat(m.getAttribute("miny")),L=parseFloat(m.getAttribute("maxx")),D=parseFloat(m.getAttribute("maxy")),A=K(y,"Projection")||"";let W=H.WGS84;if(A!=="LOCAL_CS[]")if(A.toLowerCase().startsWith("epsg:")){const N=Number(A.slice(5));isNaN(N)||N===0||(W=new H({wkid:N}))}else W=(F=Se(A))!=null?F:H.WGS84;else w=!0,W=new H({wkid:3857});g=new q(B,U,L,D),g.spatialReference=W}else w=!0,g=new q({xmin:-.5,ymin:.5-r,xmax:i-.5,ymax:.5,spatialReference:new H({wkid:3857})});const x=G(e,"MRF_META/Rsets"),P=parseInt(x&&x.getAttribute("scale")||"2",10),k=g.spatialReference,R=new de({origin:new J({x:g.xmin,y:g.ymax,spatialReference:k}),blockWidth:u,blockHeight:h,pyramidBlockWidth:u,pyramidBlockHeight:h,compression:a,pyramidScalingFactor:P}),v=new J({x:g.width/i,y:g.height/r,spatialReference:k}),T=new me({width:i,height:r,extent:g,isPseudoSpatialReference:w,spatialReference:k,bandCount:n,pixelType:o,pixelSize:v,noDataValue:d,storageInfo:R}),b=K(e,"datafile"),_=K(e,"IndexFile");return{rasterInfo:T,files:{mrf:this.url,index:_||this.url.replace(".mrf",".idx"),data:b||this.url.replace(".mrf",Z.get(a).blobExtension)}}}async _fetchAuxiliaryData(e){try{const{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e==null?void 0:e.signal});return Me(t)}catch{return null}}};I([S()],ne.prototype,"_files",void 0),I([S()],ne.prototype,"_storageIndex",void 0),I([S({type:String,json:{write:!0}})],ne.prototype,"datasetFormat",void 0),ne=I([Q("esri.layers.support.rasterIO.MRFRaster")],ne);const Mi=ne,Ce=(e,t)=>{var s;return(s=e.get(t))==null?void 0:s.values},oe=(e,t)=>{var s,i;return(i=(s=e.get(t))==null?void 0:s.values)==null?void 0:i[0]};let te=class extends se{constructor(){super(...arguments),this._files=null,this._headerInfo=null,this._bufferSize=1048576,this.datasetFormat="TIFF"}async open(e){await this.init();const t=e?X(e.signal):null,{data:s}=await this.request(this.url,{range:{from:0,to:this._bufferSize},responseType:"array-buffer",signal:t});if(!s)throw new $("tiffraster:open","failed to open url "+this.url);this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);const{littleEndian:i,firstIFDPos:r,isBigTiff:n}=ei(s),a=[];await this._readIFDs(a,s,i,r,0,n?8:4,t);const{imageInfo:c,rasterInfo:o}=this._parseIFDs(a);if(this._headerInfo={littleEndian:i,isBigTiff:n,ifds:a,...c},this._set("rasterInfo",o),!c.isSupported)throw new $("tiffraster:open","this tiff is not supported: "+c.message);if(!c.tileWidth)throw new $("tiffraster:open","none-tiled tiff is not optimized for access, convert to COG and retry.");const{skipExtensions:l=[]}=this.ioConfig;if(!l.includes("aux.xml")){const u=await this._fetchAuxiliaryMetaData(e);u!=null&&this._processPAMInfo(u,o)}l.includes("vat.dbf")||o.bandCount!==1||o.pixelType!=="u8"||(o.attributeTable=await this._fetchAuxiliaryTable(e),C(o.attributeTable)&&(o.keyProperties.DataType="thematic")),this.updateTileInfo()}async fetchRawTile(e,t,s,i={}){var k;if(!((k=this._headerInfo)!=null&&k.isSupported)||this.isBlockOutside(e,t,s))return null;const r=this._getTileLocation(e,t,s);if(!r)return null;const{ranges:n,actualTileWidth:a,actualTileHeight:c,ifd:o}=r,l=n.map(R=>this.request(this.url,{range:R,responseType:"array-buffer",signal:i.signal})),u=await Promise.all(l),h=u.map(R=>R.data.byteLength).reduce((R,v)=>R+v),f=u.length===1?u[0].data:new ArrayBuffer(h),d=[0],p=[0];if(u.length>1){const R=new Uint8Array(f);for(let v=0,T=0;v<u.length;v++){const b=u[v].data;R.set(new Uint8Array(b),T),d[v]=T,T+=b.byteLength,p[v]=b.byteLength}}const{blockWidth:y,blockHeight:m}=this.getBlockWidthHeight(e),g=await this.decodePixelBlock(f,{format:"tiff",customOptions:{headerInfo:this._headerInfo,ifd:o,offsets:d,sizes:p},width:y,height:m,planes:null,pixelType:null});let w,x,P;if(a!==y||c!==m){let R=g.mask;if(R)for(w=0;w<m;w++)if(P=w*y,w<c)for(x=a;x<y;x++)R[P+x]=0;else for(x=0;x<y;x++)R[P+x]=0;else for(R=new Uint8Array(y*m),g.mask=R,w=0;w<c;w++)for(P=w*y,x=0;x<a;x++)R[P+x]=1}return g}_parseIFDs(e){var B,U;const t=ti(e),{width:s,height:i,tileWidth:r,tileHeight:n,planes:a,pixelType:c,compression:o,firstPyramidLevel:l,maximumPyramidLevel:u,pyramidBlockWidth:h,pyramidBlockHeight:f,tileBoundary:d,affine:p,metadata:y}=t,m=((B=t.extent.spatialReference)==null?void 0:B.wkt)||((U=t.extent.spatialReference)==null?void 0:U.wkid);let g=Se(m),w=!1;g==null&&(w=!0,g=new H({wkid:3857}));const x=new q({...t.extent,spatialReference:g}),P=new J(x?{x:x.xmin,y:x.ymax,spatialReference:g}:{x:0,y:0}),k=new de({blockWidth:r,blockHeight:n,pyramidBlockWidth:h,pyramidBlockHeight:f,compression:o,origin:P,firstPyramidLevel:l,maximumPyramidLevel:u,blockBoundary:d}),R=new J({x:(x.xmax-x.xmin)/s,y:(x.ymax-x.ymin)/i,spatialReference:g}),v=y?{BandProperties:y.bandProperties,DataType:y.dataType}:{};let T=null;const b=oe(e[0],"PHOTOMETRICINTERPRETATION"),_=Ce(e[0],"COLORMAP");if(b===3&&(_==null?void 0:_.length)>3&&_.length%3==0){T=[];const L=_.length/3;for(let D=0;D<L;D++)T.push([D,_[D]>>>8,_[D+L]>>>8,_[D+2*L]>>>8])}const F=new me({width:s,height:i,bandCount:a,pixelType:c,pixelSize:R,storageInfo:k,spatialReference:g,isPseudoSpatialReference:w,keyProperties:v,extent:x,colormap:T,statistics:y?y.statistics:null});return p!=null&&p.length&&(F.nativeExtent=new q({xmin:-.5,ymin:.5-i,xmax:s-.5,ymax:.5,spatialReference:g}),F.transform=new Fe({polynomialOrder:1,forwardCoefficients:[p[2]+p[0]/2,p[5]-p[3]/2,p[0],p[3],-p[1],-p[4]]}),F.extent=F.transform.forwardTransform(F.nativeExtent),F.pixelSize=new J({x:(x.xmax-x.xmin)/s,y:(x.ymax-x.ymin)/i,spatialReference:g}),k.origin.x=-.5,k.origin.y=.5),{imageInfo:t,rasterInfo:F}}_processPAMInfo(e,t){var s;if(t.statistics=(s=e.statistics)!=null?s:t.statistics,t.histograms=e.histograms,e.histograms&&M(t.statistics)&&(t.statistics=Pe(e.histograms)),e.transform&&M(t.transform)){t.transform=e.transform,t.nativeExtent=t.extent;const i=t.transform.forwardTransform(t.nativeExtent);t.pixelSize=new J({x:(i.xmax-i.xmin)/t.width,y:(i.ymax-i.ymin)/t.height,spatialReference:t.spatialReference}),t.extent=i}t.spatialReference||(t.spatialReference=e.spatialReference)}async _readIFDs(e,t,s,i,r,n=4,a){if(!i)return null;(i>=t.byteLength||i<0)&&(t=(await this.request(this.url,{range:{from:i+r,to:i+r+this._bufferSize},responseType:"array-buffer",signal:a})).data,r=i+r,i=0);const c=await this._readIFD(t,s,i,r,ye.TIFF_TAGS,n,a);if(e.push(c.ifd),!c.nextIFD)return null;await this._readIFDs(e,t,s,c.nextIFD-r,r,n,a)}async _readIFD(e,t,s,i,r=ye.TIFF_TAGS,n=4,a){var o,l;if(!e)return null;const c=ii(e,t,s,i,r,n);if(c.success){const u=[];if((o=c.ifd)==null||o.forEach(h=>{h.values||u.push(h)}),u.length>0){const h=u.map(d=>d.offlineOffsetSize).filter(C),f=Math.min.apply(null,h.map(d=>d[0]));if(Math.min.apply(null,h.map(d=>d[0]+d[1]))-f<=this._bufferSize){const{data:d}=await this.request(this.url,{range:{from:f,to:f+this._bufferSize},responseType:"array-buffer",signal:a});e=d,i=f,u.forEach(p=>si(e,t,p,i))}}if((l=c.ifd)!=null&&l.has("GEOKEYDIRECTORY")){const h=c.ifd.get("GEOKEYDIRECTORY"),f=h==null?void 0:h.values;if(f&&f.length>4){const d=f[0]+"."+f[1]+"."+f[2],p=await this._readIFD(e,t,h.valueOffset+6-i,i,ye.GEO_KEYS,2,a);h.data=p.ifd,h.data&&h.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[d]})}}return c}if(c.requiredBufferSize&&c.requiredBufferSize!==e.byteLength)return(e=(await this.request(this.url,{range:{from:i,to:i+c.requiredBufferSize+4},responseType:"array-buffer",signal:a})).data).byteLength<c.requiredBufferSize?null:this._readIFD(e,t,0,i,ye.TIFF_TAGS,4,a)}_getTileLocation(e,t,s){var v;const{firstPyramidLevel:i,blockBoundary:r}=this.rasterInfo.storageInfo,n=e===0?0:e-(i-1),a=(v=this._headerInfo)==null?void 0:v.ifds[n];if(!a)return null;const c=ri(a,this._headerInfo),o=Ce(a,"TILEOFFSETS");if(o===void 0)return null;const l=Ce(a,"TILEBYTECOUNTS"),{minRow:u,minCol:h,maxRow:f,maxCol:d}=r[n];if(t>f||s>d||t<u||s<h)return null;const p=oe(a,"IMAGEWIDTH"),y=oe(a,"IMAGELENGTH"),m=oe(a,"TILEWIDTH"),g=oe(a,"TILELENGTH"),w=c?this.rasterInfo.bandCount:1,x=w*t*(d+1)+s,P=[{from:o[x],to:o[x+w-1]+l[x+w-1]-1}];if(c){let T=!0;for(let b=0;b<w;b++)if(o[x+b]+l[x+b]!==o[x+b+1]){T=!1;break}if(!T)for(let b=0;b<w;b++)P[b]={from:o[x+b],to:o[x+b]+l[x+b]-1}}const k=o[x],R=l[x];return k==null||R==null?null:{ranges:P,ifd:a,actualTileWidth:s===d&&p%m||m,actualTileHeight:t===f&&y%g||g}}async _fetchAuxiliaryMetaData(e){try{const{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e==null?void 0:e.signal});return Me(t)}catch{return null}}async _fetchAuxiliaryTable(e){try{const{data:t}=await this.request(this.url+".vat.dbf",{responseType:"array-buffer",signal:e==null?void 0:e.signal}),s=st.parse(t);return s!=null&&s.recordSet?Ye.fromJSON(s.recordSet):null}catch{return null}}};I([S()],te.prototype,"_files",void 0),I([S()],te.prototype,"_headerInfo",void 0),I([S()],te.prototype,"_bufferSize",void 0),I([S({type:String,json:{write:!0}})],te.prototype,"datasetFormat",void 0),te=I([Q("esri.layers.support.rasterDatasets.TIFFRaster")],te);const $i=te,z=new Map;z.set("CRF",{desc:"Cloud Raster Format",constructor:Ti}),z.set("MRF",{desc:"Meta Raster Format",constructor:Mi}),z.set("TIFF",{desc:"GeoTIFF",constructor:$i}),z.set("RasterTileServer",{desc:"Raster Tile Server",constructor:Fi}),z.set("JPG",{desc:"JPG Raster Format",constructor:we}),z.set("PNG",{desc:"PNG Raster Format",constructor:we}),z.set("GIF",{desc:"GIF Raster Format",constructor:we}),z.set("BMP",{desc:"BMP Raster Format",constructor:we});class Oi{static get supportedFormats(){const t=new Set;return z.forEach((s,i)=>t.add(i)),t}static async open(t){const{url:s,ioConfig:i,sourceJSON:r}=t;let n=t.datasetFormat;n==null&&s.lastIndexOf(".")&&(n=s.slice(s.lastIndexOf(".")+1).toUpperCase()),n==="OVR"||n==="TIF"?n="TIFF":n!=="JPG"&&n!=="JPEG"&&n!=="JFIF"||(n="JPG"),s.toLowerCase().includes("/imageserver")&&!s.toLowerCase().includes("/wcsserver")&&(n="RasterTileServer");const a={url:s,sourceJSON:r,datasetFormat:n,ioConfig:i!=null?i:{bandIds:null,sampling:null}};let c,o;if(n&&this.supportedFormats.has(n)){if(n==="CRF"&&!(i!=null&&i.enableCRF))throw new $("rasterfactory:open",`cannot open raster: ${s}`);return c=z.get(n).constructor,o=new c(a),await o.open({signal:t.signal}),o}if(n)throw new $("rasterfactory:open","not a supported format "+n);const l=Array.from(z.keys());let u=0;const h=()=>(n=l[u++],n&&(n!=="CRF"||(i==null?void 0:i.enableCRF))?(c=z.get(n).constructor,o=new c(a),o.open({signal:t.signal}).then(()=>o).catch(()=>h())):null);return h()}static register(t,s,i){z.has(t.toUpperCase())||z.set(t.toUpperCase(),{desc:s,constructor:i})}}let O=class extends gt(xt(It(wt(bt(vi(St(vt(Rt(Ot))))))))){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 typeof e=="string"?{url:e,...t}:e}load(e){const t=C(e)?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(Tt).then(()=>this._openRaster(t))),Promise.resolve(this)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){var c;let e=[new he({name:"Raster.ServicePixelValue",alias:"Pixel Value",domain:null,editable:!1,length:50,type:"string"})];const{rasterInfo:t}=this,{attributeTable:s}=t,i=C(s)?s.fields:null,r="Raster.";if(i){const o=i.filter(l=>l.type!=="oid"&&l.name.toLowerCase()!=="value").map(l=>{const u=l.clone();return u.name=r+l.name,u});e=e.concat(o)}const{dataType:n,multidimensionalInfo:a}=t;if((n==="vector-magdir"||n==="vector-uv")&&C(a)){const o=(c=a.variables[0].unit)==null?void 0:c.trim(),l="Magnitude"+(o?` (${o})`:"");e.push(new he({name:"Raster.Magnitude",alias:l,domain:null,editable:!1,type:"double"})),e.push(new he({name:"Raster.Direction",alias:"Direction (\xB0)",domain:null,editable:!1,type:"double"}))}return e}set renderer(e){this._set("renderer",e),this.updateRenderer()}readRenderer(e,t,s){const i=t&&t.layerDefinition&&t.layerDefinition.drawingInfo&&t.layerDefinition.drawingInfo.renderer,r=Lt(i,s)||void 0;if(r!=null)return r}createPopupTemplate(e){return _t({fields:this.rasterFields,title:this.title},e)}write(e,t){const{raster:s}=this;if(this.loaded?s.datasetFormat==="RasterTileServer"&&(s.tileType==="Raster"||s.tileType==="Map"):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))return super.write(e,t);if(t&&t.messages){const i=`${t.origin}/${t.layerContainerType||"operational-layers"}`;t.messages.push(new $("layer:unsupported",`Layers (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${i}'`,{layer:this}))}return null}async _openRaster(e){if(this.raster)this.raster.rasterInfo||await this.raster.open(),this.url=this.raster.url;else{const s=await Oi.open({url:this.url,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:e});if(this.rasterFunction){const i=tt(this.rasterFunction.toJSON(),{raster:s}),r=new it({rasterFunction:i});await r.open(),this.raster=r}else this.raster=s}const{rasterInfo:t}=this.raster;if(!t)throw new $("imagery-tile-layer:load","cannot load resources on "+this.url);if(this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,this.sourceJSON!=null){const s=this.raster.tileType==="Map"&&this.sourceJSON.minLOD!=null&&this.sourceJSON.maxLOD!=null?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(s,{origin:"service"})}this.title==null&&(this.title=this.raster.datasetName),this.raster.tileType==="Map"&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles(kt(()=>this.customParameters,s=>{this.raster.ioConfig.customFetchParameters=s}))}};I([S({type:[Ct],json:{write:{overridePolicy(){var e;return{enabled:!this.loaded||this.raster.tileType==="Raster"||((e=this.bandIds)==null?void 0:e.join(","))!=="0,1,2"}}}}})],O.prototype,"bandIds",void 0),I([S({json:{write:{overridePolicy(){return{enabled:!this.loaded||this.raster.tileType==="Raster"||this.interpolation!=="bilinear"}}}}}),Pt(At)],O.prototype,"interpolation",void 0),I([S({json:{write:!0}})],O.prototype,"multidimensionalDefinition",void 0),I([S(Ft)],O.prototype,"legendEnabled",void 0),I([S({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],O.prototype,"isReference",void 0),I([S({type:["show","hide"]})],O.prototype,"listMode",void 0),I([S({json:{read:!0,write:!0}})],O.prototype,"blendMode",void 0),I([S()],O.prototype,"sourceJSON",void 0),I([S({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],O.prototype,"version",void 0),I([S()],O.prototype,"title",void 0),I([S({readOnly:!0,json:{read:!1}})],O.prototype,"type",void 0),I([S({type:["ArcGISTiledImageServiceLayer"]})],O.prototype,"operationalLayerType",void 0),I([S({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,t)=>!t.disablePopup},write:{target:"disablePopup",overridePolicy(){return{enabled:!this.loaded||this.raster.tileType==="Raster"}},writer(e,t,s){t[s]=!e}}}})],O.prototype,"popupEnabled",void 0),I([S({type:Mt,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||this.raster.tileType==="Raster"}}}}})],O.prototype,"popupTemplate",void 0),I([S({readOnly:!0})],O.prototype,"defaultPopupTemplate",null),I([S({readOnly:!0,type:[he]})],O.prototype,"fields",void 0),I([S({readOnly:!0,type:[he]})],O.prototype,"rasterFields",null),I([S({types:Qe,json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy(){var t;const e=((t=this.renderer)==null?void 0:t.type)==="raster-stretch"&&this.renderer.stretchType==="none"&&!this.renderer.useGamma;return{enabled:!this.loaded||this.raster.tileType==="Raster"||!e}}},origins:{"web-scene":{types:Wt,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&e.type!=="vector-field"&&e.type!=="flow"})}}}}})],O.prototype,"renderer",null),I([$t("renderer")],O.prototype,"readRenderer",null),O=I([Q("esri.layers.ImageryTileLayer")],O);const Gi=O;export{Gi as default};
|