UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

1 lines • 139 kB
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[6049],{77359:(t,e,n)=>{n.d(e,{$Q:()=>a,Sd:()=>u,b7:()=>l});var s=n(83047),r=n(5443),o=n(86738),i=n(14140);async function a(t,e,s){if("extent"===s.type)return function(t,e,n){const{width:s,height:r}=t,o=new Uint8Array(s*r),a=e.width/s,u=e.height/r;if(n.width/a<.5||n.height/u<.5)return new i.A({pixelType:t.pixelType,width:s,height:r,mask:o,pixels:[...t.pixels]});const{xmin:l,xmax:c,ymin:p,ymax:h}=e,{xmin:m,xmax:f,ymin:d,ymax:g}=n,y=Math.max(l,m),x=Math.min(c,f),w=Math.max(p,d),A=Math.min(h,g),b=.5*a,v=.5*u;if(x-y<b||A-w<v||x<l+b||y>c-b||w>h-v||A<p+v)return new i.A({pixelType:t.pixelType,width:s,height:r,mask:o,pixels:[...t.pixels]});const _=Math.max(0,(y-l)/a),M=Math.min(s,Math.max(0,(x-l)/a)),P=Math.max(0,(h-A)/u),T=Math.min(r,Math.max(0,(h-w)/u)),R=Math.round(_),N=Math.round(M)-1,F=Math.round(P),k=Math.round(T)-1;if(R===N&&_%1>.5&&M%1<.5||F===k&&P%1>.5&&T%1<.5)return new i.A({pixelType:t.pixelType,width:s,height:r,mask:o,pixels:[...t.pixels]});if(0===R&&0===F&&N===s&&k===r)return t;const I=t.mask;for(let t=F;t<=k;t++)for(let e=R;e<=N;e++){const n=t*s+e;o[n]=I?I[n]:255}return new i.A({pixelType:t.pixelType,width:s,height:r,mask:o,pixels:[...t.pixels]})}(t,e,s);const{width:r,height:o}=t,a=new Uint8Array(r*o),{contains:u,intersects:l}=await Promise.all([n.e(9930),n.e(3209)]).then(n.bind(n,33209));return l(e,s)?"polyline"===s.type?function(t,e,n){const{width:s,height:r}=t,o=new Uint8Array(s*r),a=e.width/s,u=e.height/r,{xmin:l,ymax:c}=e,{paths:p}=n,h=t.mask;for(let t=0;t<p.length;t++){const e=p[t];for(let t=0;t<e.length-1;t++){const[n,i]=e[t],[p,m]=e[t+1];let f=Math.floor((c-i)/u),d=Math.floor((c-m)/u);if(d<f){const t=f;f=d,d=t}f=Math.max(0,f),d=Math.min(r-1,d);const g=(p-n)/(m-i);for(let t=f;t<=d;t++){const e=t===f?Math.max(i,m):(r+1-t)*u,c=t===d?Math.min(i,m):e-u;let y=m===i?Math.floor((n-l)/a):Math.floor((g*(e-i)+n-l)/a),x=m===i?Math.floor((p-l)/a):Math.floor((g*(c-i)+n-l)/a);if(x<y){const t=y;y=x,x=t}const w=t*s;y=Math.max(0,y),x=Math.min(s-1,x);for(let t=w+y;t<=w+x;t++)o[t]=h?h[t]:255}}}return new i.A({pixelType:t.pixelType,width:s,height:r,mask:o,pixels:[...t.pixels]})}(t,e,s):u(s,e)?t:function(t,e,n){if(!t)return t;const{width:s,height:r}=t,o=e.width/s,a=e.height/r,{xmin:u,ymax:l}=e;let c;if("extent"===n.type){const t=(n.xmin-u)/o,e=(n.xmax-u)/o,s=(l-n.ymax)/a,r=(l-n.ymin)/a;c=[[[t,s],[t,r],[e,r],[e,s],[t,s]]]}else c=n.rings.map((t=>t.map((([t,e])=>[(t-u)/o,(l-e)/a]))));const p=document.createElement("canvas");p.width=s,p.height=r;const h=p.getContext("2d");h.fillStyle="#f00",h.beginPath(),c.forEach((t=>{h.moveTo(t[0][0],t[0][1]);for(let e=0;e<t.length;e++)h.lineTo(t[e][0],t[e][1]);h.closePath()})),h.fill();const m=h.getImageData(0,0,s,r).data,f=t.mask,d=s*r,g=new Uint8Array(d);for(let t=0;t<d;t++)f&&!f[t]||(g[t]=m[4*t+3]>127?255:0);return new i.A({pixelType:t.pixelType,width:s,height:r,mask:g,maskIsAlpha:!1,pixels:[...t.pixels]})}(t,e,s):new i.A({pixelType:t.pixelType,width:r,height:o,mask:a,maskIsAlpha:!1,pixels:[...t.pixels]})}function u(t,e){const{extent:n}=l(t,e,new o.A({x:t.pixelSize.x,y:t.pixelSize.y,spatialReference:t.spatialReference})),{extent:s}=t.extent;if(n.xmax=Math.min(n.xmax,s.xmax),n.ymax=Math.min(n.ymax,s.ymax),n.xmin<n.xmax&&n.ymin<n.ymax){const{x:e,y:s}=t.pixelSize,r=Math.round(n.width/e),o=Math.round(n.height/s);t.extent=n,t.width=r,t.height=o}}function l(t,e,n,o=!0){const{spatialReference:i}=t,{x:a,y:u}=function(t,e){if(t.spatialReference.equals(e))return t;const n=(0,s.GA)(t.spatialReference),r=(0,s.GA)(e);if(n===r)return t;const o=n/r;return{x:t.x*o,y:t.y*o}}(n,i);let l,c,p;const h="extent"===e.type?e:e.extent;let{xmin:m,xmax:f,ymax:d,ymin:g}=h;const{xmin:y,ymax:x}=t.extent;return o?(m=y+(m>y?a*Math.round((m-y)/a):0),d=x-(d<x?u*Math.round((x-d)/u):0),f=y+(f>y?a*Math.round((f-y)/a):0),g=x-(g<x?u*Math.round((x-g)/u):0),l=new r.A({xmin:m,ymax:d,xmax:f,ymin:g,spatialReference:i}),c=Math.round(l.width/a),p=Math.round(l.height/u)):(c=Math.floor((f-m)/a+.8),p=Math.floor((d-g)/u+.8),m=y+(m>y?a*Math.floor((m-y)/a+.1):0),d=x-(d<x?u*Math.floor((x-d)/u+.1):0),f=m+c*a,g=d-p*u,l=new r.A({xmin:m,ymax:d,xmax:f,ymin:g,spatialReference:i})),{extent:l,width:c,height:p}}},6049:(t,e,n)=>{n.d(e,{vt:()=>zs,UD:()=>Gs});var s=n(85334),r=n(49186),o=n(4718),i=n(90237),a=n(10107),u=(n(44208),n(53966),n(87811),n(40608)),l=n(16019),c=n(25482);let p=class extends c.A{constructor(){super(...arguments),this.raster=void 0}};(0,i._)([(0,a.MZ)({json:{write:!0}})],p.prototype,"raster",void 0),p=(0,i._)([(0,u.$)("esri.layers.support.rasterFunctions.BaseFunctionArguments")],p);const h=p;var m;let f=m=class extends h{constructor(){super(...arguments),this.raster2=void 0}get rasters(){return[this.raster,this.raster2]}clone(){return new m({raster:this.raster,raster2:this.raster2,operation:this.operation})}};(0,i._)([(0,a.MZ)({json:{write:!0}})],f.prototype,"operation",void 0),(0,i._)([(0,a.MZ)({json:{write:!0}})],f.prototype,"raster2",void 0),(0,i._)([(0,a.MZ)({readOnly:!0})],f.prototype,"rasters",null),f=m=(0,i._)([(0,u.$)("esri.layers.support.rasterFunctions.ArithmeticFunctionArguments")],f);const d=f;var g=n(79901),y=n(14140),x=n(87186);const w=new Set(["slope","aspect","curvature","hillshade","shadedrelief","statistics"]);let A=class extends c.A{constructor(){super(...arguments),this.functionArguments=null,this.readingBufferSize=0,this.id=-1,this.isNoopProcess=!1,this.rawInputBandIds=[],this.rawSourceRasterInfos=null,this.isInputBandIdsSwizzled=!1,this.swizzledBandSelection=[],this.isBranch=!1,this._bindingResult=null}get supportsGPU(){return this._bindingResult.supportsGPU}get flatWebGLFunctionChain(){const t=this.getWebGLProcessorDefinition();if(!t)return null;const e=[t],{parameters:n}=t;let s=n.rasters||n.raster&&[n.raster];for(;s?.length;){e.unshift(...s);const t=[];for(let e=0;e<s.length;e++){const{parameters:n}=s[e],r=n.rasters||n.raster&&[n.raster];r?.length&&t.push(...r)}s=t}for(let t=e.length-1;t>=0;t--)e[t].isNoopProcess&&e.splice(t,1);let r=!1;for(let t=0;t<e.length;t++){const n=e[t];n.id=e.length-t-1;const{rasters:s}=n.parameters;r=r||null!=s&&s.length>1}const o=e.some((({name:t})=>w.has(t.toLowerCase()))),{rawSourceRasterInfos:i}=this;return{functions:e,hasBranches:r,hasFocalFunction:o,isSourceSingleBand:1===i?.[0]?.bandCount}}bind(t,e=!1,n=-1){this.id=n+1;const s=this._getRasterValues();let r=!0;for(let n=0;n<s.length;n++){const o=s[n];if(null!=o&&this._isRasterFunctionValue(o)){const s=o.bind(t,e,this.id+n);if(!s.success)return this._bindingResult=s,s;r=r&&s.supportsGPU}}return!this.rasterInfo||e?(this.sourceRasterInfos=this._getSourceRasterInfos(t),this._bindingResult=this._bindSourceRasters(),this._bindingResult.success&&this._patchRasterInfo(),this._bindingResult.supportsGPU=r&&this._bindingResult.supportsGPU,this.processInputBandIds(),this._bindingResult):(this._bindingResult={success:!0,supportsGPU:!0},this.processInputBandIds(),this._bindingResult)}process(t){const e=this._getRasterValues(),n=0===e.length?t.pixelBlocks??t.primaryPixelBlocks:e.map((e=>this._readRasterValue(e,t)));return this._processPixels({...t,pixelBlocks:n})}processInputBandIds(){const t=this._getRasterValues().filter(this._isRasterFunctionValue);let e;if(t.length>1){const e=t.map((t=>t.processInputBandIds()[0]));this.rawInputBandIds=e,this.isInputBandIdsSwizzled=this.rawInputBandIds.some(((t,e)=>t!==e));const n=t.filter((t=>"ExtractBand"===t.functionName));return n.length&&n.forEach(((t,e)=>{t.isInputBandIdsSwizzled=!0,t.swizzledBandSelection=[e,e,e]})),this.rawInputBandIds}const n=t[0];if(n){if(e=n.processInputBandIds(),n.isInputBandIdsSwizzled)return this.rawInputBandIds=e,e}else{e=[];const{bandCount:t}=this.sourceRasterInfos[0];for(let n=0;n<t;n++)e.push(n)}const s=this._getInputBandIds(e);return this.isInputBandIdsSwizzled=s.some(((t,e)=>t!==e)),this.rawInputBandIds=s,this.rawInputBandIds}getPrimaryRasters(){const t=[],e=[];return this._getPrimaryRasters(this,t,e),{rasters:t,rasterIds:e}}getWebGLProcessorDefinition(){const t=this._getWebGLParameters(),{raster:e,rasters:n}=this.functionArguments;return n&&Array.isArray(n)&&n.length?(t.rasters=n.map((t=>this._isRasterFunctionValue(t)?t.getWebGLProcessorDefinition():"number"==typeof t?{name:"Constant",parameters:{value:t},pixelType:"f32",id:-1,isNoopProcess:!1}:{name:"Identity",parameters:{value:t},pixelType:"f32",id:-1,isNoopProcess:!1})),t.rasters.some((t=>null!=t))||(t.rasters=null)):this._isRasterFunctionValue(e)&&(t.raster=e.getWebGLProcessorDefinition()),{name:this.functionName,parameters:t,pixelType:this.outputPixelType,id:this.id,isNoopProcess:this.isNoopProcess}}getClippingGeometries(){const t=[];"Clip"===this.functionName&&t.push(this.functionArguments);const{raster:e,rasters:n}=this.functionArguments;if(n&&Array.isArray(n)&&n.length)n.forEach((e=>{if(this._isRasterFunctionValue(e)){const n=e.getClippingGeometries();t.push(...n)}}));else if(this._isRasterFunctionValue(e)){const n=e.getClippingGeometries();t.push(...n)}return t}_getOutputPixelType(t){return"unknown"===this.outputPixelType?t:this.outputPixelType??t}_getWebGLParameters(){return{}}_getInputBandIds(t){return t}_removeStatsHistColormapVAT(t){t.statistics=null,t.histograms=null,t.colormap=null,t.attributeTable=null,t.multidimensionalInfo?.variables.forEach((t=>{t.statistics=void 0,t.histograms=void 0}))}_getRasterValues(){const{rasterArgumentNames:t}=this;return"rasters"===t[0]?this.functionArguments.rasters??[]:t.flatMap((t=>this.functionArguments[t]))}_getSourceRasterInfos(t){const e=this._getRasterValues(),{rasterInfos:n,rasterIds:s}=t;if(0===e.length)return n;const r=e.map((t=>t&&"object"==typeof t&&"bind"in t&&t.rasterInfo?t.rasterInfo:"string"==typeof t&&s.includes(t)?n[s.indexOf(t)]:"number"!=typeof t?n[0]:void 0)),o=r.find((t=>t))??n[0];return r.forEach(((t,e)=>{void 0===t&&(r[e]=o)})),r}_getPrimaryRasterId(t){return t?.rasterId}_getPrimaryRasters(t,e=[],n=[]){for(let s=0;s<t.sourceRasters.length;s++){const r=t.sourceRasters[s];if("number"!=typeof r)if("bind"in r)this._getPrimaryRasters(r,e,n);else{const t=r,s=this._getPrimaryRasterId(t);if(null==s)continue;n.includes(s)||(this.mainPrimaryRasterId===s?(e.unshift(t),n.unshift(s)):(e.push(t),n.push(s)))}}}_isRasterFunctionValue(t){return null!=t&&"object"==typeof t&&"getWebGLProcessorDefinition"in t}_readRasterValue(t,e){const{primaryPixelBlocks:n}=e;if(null==t||"$$"===t){const t=n[0];return null==t?null:t.clone()}if("string"==typeof t){const s=e.primaryRasterIds.indexOf(t);return-1===s?null:n[s]}if("number"==typeof t){const e=n[0];if(null==e)return null;const{width:s,height:r,pixelType:o}=e,i=new Float32Array(s*r);i.fill(t);const a=this.sourceRasterInfos[0].bandCount,u=new Array(a).fill(i);return new y.A({width:s,height:r,pixelType:o,pixels:u})}return t.process(e)}_patchRasterInfo(){const{rasterInfo:t}=this;if(!t?.keyProperties)return;const{bandCount:e,keyProperties:n,statistics:s,histograms:r}=t,o=n.BandProperties;o&&o.length!==e&&(t.keyProperties={...n,BandProperties:void 0}),s&&s.length!==e&&(t.statistics=s.length>e?s.slice(0,e):null),r&&r.length!==e&&(t.histograms=r.length>e?r.slice(0,e):null),n.BAND_COUNT&&Number(n.BAND_COUNT)!==e&&(t.keyProperties={...n,BAND_COUNT:"string"==typeof n.BAND_COUNT?String(e):e})}};(0,i._)([(0,a.MZ)({json:{write:!0}})],A.prototype,"functionName",void 0),(0,i._)([(0,a.MZ)({json:{write:!0}})],A.prototype,"functionArguments",void 0),(0,i._)([(0,a.MZ)()],A.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.MZ)({json:{write:!0}}),(0,g.w)((t=>t?.toLowerCase()))],A.prototype,"outputPixelType",void 0),(0,i._)([(0,a.MZ)({json:{write:!0}})],A.prototype,"mainPrimaryRasterId",void 0),(0,i._)([(0,a.MZ)()],A.prototype,"sourceRasters",void 0),(0,i._)([(0,a.MZ)({type:[x.A],json:{write:!0}})],A.prototype,"sourceRasterInfos",void 0),(0,i._)([(0,a.MZ)({json:{write:!0}})],A.prototype,"rasterInfo",void 0),(0,i._)([(0,a.MZ)({json:{write:!0}})],A.prototype,"readingBufferSize",void 0),(0,i._)([(0,a.MZ)({json:{write:!0}})],A.prototype,"id",void 0),(0,i._)([(0,a.MZ)()],A.prototype,"isNoopProcess",void 0),(0,i._)([(0,a.MZ)()],A.prototype,"supportsGPU",null),(0,i._)([(0,a.MZ)()],A.prototype,"rawInputBandIds",void 0),(0,i._)([(0,a.MZ)()],A.prototype,"rawSourceRasterInfos",void 0),(0,i._)([(0,a.MZ)()],A.prototype,"isInputBandIdsSwizzled",void 0),(0,i._)([(0,a.MZ)()],A.prototype,"swizzledBandSelection",void 0),(0,i._)([(0,a.MZ)()],A.prototype,"isBranch",void 0),(0,i._)([(0,a.MZ)({readOnly:!0})],A.prototype,"flatWebGLFunctionChain",null),(0,i._)([(0,a.MZ)()],A.prototype,"_bindingResult",void 0),A=(0,i._)([(0,u.$)("esri.layers.support.rasterFunctions.BaseRasterFunction")],A);const b=A,v={userDefined:-1,lineDetectionHorizontal:0,lineDetectionVertical:1,lineDetectionLeftDiagonal:2,lineDetectionRightDiagonal:3,gradientNorth:4,gradientWest:5,gradientEast:6,gradientSouth:7,gradientNorthEast:8,gradientNorthWest:9,smoothArithmeticMean:10,smoothing3x3:11,smoothing5x5:12,sharpening3x3:13,sharpening5x5:14,laplacian3x3:15,laplacian5x5:16,sobelHorizontal:17,sobelVertical:18,sharpen:19,sharpen2:20,pointSpread:21,none:255},_={bitwiseAnd:11,bitwiseLeftShift:12,bitwiseNot:13,bitwiseOr:14,bitwiseRightShift:15,bitwiseXOr:16,booleanAnd:17,booleanNot:18,booleanOr:19,booleanXOr:20,equalTo:24,greaterThan:28,greaterThanEqual:29,lessThan:33,lessThanEqual:34,isNull:31,notEqual:46},M={acos:6,asin:7,atan:8,atanh:9,cos:21,cosh:22,sin:51,sinh:52,tan:56,tanh:57,acosh:59,asinh:60,atan2:61},P={setNull:50,conditional:78},T={plus:1,minus:2,times:3,sqrt:4,power:5,abs:10,divide:23,exp:25,exp10:26,exp2:27,int:30,float:32,ln:35,log10:36,log2:37,mod:44,negate:45,roundDown:48,roundUp:49,square:53,floatDivide:64,floorDivide:65,..._,...M,majority:38,max:39,mean:40,med:41,min:42,minority:43,range:47,stddev:54,sum:55,variety:58,majorityIgnoreNoData:66,maxIgnoreNoData:67,meanIgnoreNoData:68,medIgnoreNoData:69,minIgnoreNoData:70,minorityIgnoreNoData:71,rangeIgnoreNoData:72,stddevIgnoreNoData:73,sumIgnoreNoData:74,varietyIgnoreNoData:75,...P},R=new Map([[M.acos,{domain:[0,Math.PI],isInteger:!1}],[M.asin,{domain:[-Math.PI/2,Math.PI/2],isInteger:!1}],[M.atan,{domain:[-Math.PI/2,Math.PI/2],isInteger:!1}],[M.cos,{domain:[-1,1],isInteger:!1}],[M.sin,{domain:[-1,1],isInteger:!1}],[_.booleanAnd,{domain:[0,1],isInteger:!0}],[_.booleanNot,{domain:[0,1],isInteger:!0}],[_.booleanOr,{domain:[0,1],isInteger:!0}],[_.booleanXOr,{domain:[0,1],isInteger:!0}],[_.equalTo,{domain:[0,1],isInteger:!0}],[_.notEqual,{domain:[0,1],isInteger:!0}],[_.greaterThan,{domain:[0,1],isInteger:!0}],[_.greaterThanEqual,{domain:[0,1],isInteger:!0}],[_.lessThan,{domain:[0,1],isInteger:!0}],[_.lessThanEqual,{domain:[0,1],isInteger:!0}],[_.isNull,{domain:[0,1],isInteger:!0}]]);function N(t){return R.get(t)}const F=[0,2,2,2,1,2,1,1,1,1,1,2,2,1,2,2,2,2,1,2,2,1,1,2,2,1,1,1,2,2,1,1,1,2,2,1,1,1,999,999,999,999,999,999,2,1,2,999,1,1,2,1,1,1,999,999,1,1,999,1,1,2,999,999,2,2,999,999,999,999,999,999,999,999,999,999,3,999,3];function k(t,e,n){const[s,r]=t,o=s.length,i=y.A.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]+r[t]);return i}function I(t,e,n){const[s]=t,r=s.length,o=y.A.createEmptyBand("f32",r);return o.set(s),o}function S(t,e,n){const[s]=t,r=s.length,o=y.A.createEmptyBand(n,r);for(let t=0;t<r;t++)e&&!e[t]||(o[t]=s[t]*s[t]);return o}function C(t,e,n){const[s,r]=t,o=s.length,i=y.A.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]-r[t]);return i}function B(t,e,n){const[s,r]=t,o=s.length,i=y.A.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]*r[t]);return i}function j(t,e,n){const[s]=t,r=s.length,o=y.A.createEmptyBand(n,r);for(let t=0;t<r;t++)e&&!e[t]||(o[t]=Math.sign(s[t])*Math.floor(Math.abs(s[t])));return o}function Z(t,e,n){const[s,r]=t,o=s.length,i=y.A.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]/r[t]);return i}function G(t,e,n){return Z(t,e,"f32")}function z(t,e,n){const[s,r]=t,o=s.length,i=y.A.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=Math.floor(s[t]/r[t]));return i}function E(t,e,n,s){const r=t[0],o=r.length,i=y.A.createEmptyBand(n,o);if(s===M.atanh){for(let t=0;t<o;t++)if(e[t]){const n=r[t];Math.abs(n)>=1?e[t]=0:i[t]=Math.atanh(n)}return i}const a=s===M.asin?Math.asin:Math.acos;for(let t=0;t<o;t++)if(e[t]){const n=r[t];Math.abs(n)>1?e[t]=0:i[t]=a(n)}return i}function O(t,e,n,s){const[r]=t,o=r.length,i=y.A.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s(r[t]));return i}function D(t,e,n,s){const[r,o]=t,i=r.length,a=y.A.createEmptyBand(n,i);for(let t=0;t<i;t++)e&&!e[t]||(a[t]=s(r[t],o[t]));return a}function U(t,e,n){const[s,r]=t,o=s.length,i=y.A.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]&r[t]);return i}function L(t,e,n){const[s,r]=t,o=s.length,i=y.A.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]<<r[t]);return i}function V(t,e,n){const[s]=t,r=s.length,o=y.A.createEmptyBand(n,r);for(let t=0;t<r;t++)e&&!e[t]||(o[t]=~s[t]);return o}function W(t,e,n){const[s,r]=t,o=s.length,i=y.A.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]|r[t]);return i}function $(t,e,n){const[s,r]=t,o=s.length,i=y.A.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]>>r[t]);return i}function H(t,e,n){const[s,r]=t,o=s.length,i=y.A.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]^r[t]);return i}function q(t,e,n){const[s,r]=t,o=s.length,i=y.A.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]&&r[t]?1:0);return i}function J(t,e,n){const[s]=t,r=s.length,o=y.A.createEmptyBand(n,r);for(let t=0;t<r;t++)e&&!e[t]||(o[t]=s[t]?0:1);return o}function K(t,e,n){const[s,r]=t,o=s.length,i=y.A.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]||r[t]?1:0);return i}function X(t,e,n){const[s,r]=t,o=s.length,i=y.A.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=(s[t]?1:0)^(r[t]?1:0));return i}function Y(t,e,n){const[s,r]=t,o=s.length,i=y.A.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]===r[t]?1:0);return i}function Q(t,e,n,s){const[r]=t,o=r.length,i=y.A.createEmptyBand(n,o),a=s===Math.E;for(let t=0;t<o;t++)e&&!e[t]||(i[t]=a?Math.exp(r[t]):s**r[t]);return i}function tt(t,e,n){return Q(t,e,n,10)}function et(t,e,n){return Q(t,e,n,2)}function nt(t,e,n){return Q(t,e,n,Math.E)}function st(t,e,n,s){const[r]=t,o=r.length,i=y.A.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(r[t]<=0?e[t]=0:i[t]=s(r[t]));return i}function rt(t,e,n){return st(t,e,n,Math.log10)}function ot(t,e,n){return st(t,e,n,Math.log2)}function it(t,e,n){return st(t,e,n,Math.log)}function at(t,e,n){const[s,r]=t,o=s.length,i=y.A.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]>r[t]?1:0);return i}function ut(t,e,n){const[s,r]=t,o=s.length,i=y.A.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]>=r[t]?1:0);return i}function lt(t,e,n){const[s,r]=t,o=s.length,i=y.A.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]<r[t]?1:0);return i}function ct(t,e,n){const[s,r]=t,o=s.length,i=y.A.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]<=r[t]?1:0);return i}function pt(t,e,n){const[s]=t,r=s.length,o=y.A.createEmptyBand(n,r);if(!e)return o;for(let t=0;t<r;t++)o[t]=e[t]?0:1;return o}function ht(t,e,n){const[s,r]=t,o=s.length,i=y.A.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]%r[t]);return i}function mt(t,e,n){const[s]=t,r=s.length,o=y.A.createEmptyBand(n,r);for(let t=0;t<r;t++)e&&!e[t]||(o[t]=-s[t]);return o}function ft(t,e,n){const[s,r]=t,o=s.length,i=y.A.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]===r[t]?0:1);return i}function dt(t,e,n){const[s,r]=t,o=s.length,i=y.A.createEmptyBand(n,o),a=new Uint8Array(o);for(let t=0;t<o;t++)null!=e&&!e[t]||0!==s[t]||(i[t]=r[t],a[t]=255);return{band:i,mask:a}}function gt(t,e,n){const[s,r,o]=t,i=s.length,a=y.A.createEmptyBand(n,i);for(let t=0;t<i;t++)e&&!e[t]||(a[t]=s[t]?r[t]:o[t]);return a}function yt(t,e,n){const s=t.length;if(s<2)return t[0];const[r]=t,o=r.length,i=y.A.createEmptyBand(n,o);for(let n=0;n<o;n++)if(!e||e[n]){let e=r[n];for(let r=1;r<s;r++){const s=t[r][n];e<s&&(e=s)}i[n]=e}return i}function xt(t,e,n){const s=t.length;if(s<2)return t[0];const[r]=t,o=r.length,i=y.A.createEmptyBand(n,o);for(let n=0;n<o;n++)if(!e||e[n]){let e=r[n];for(let r=1;r<s;r++){const s=t[r][n];e>s&&(e=s)}i[n]=e}return i}function wt(t,e,n){const s=t.length;if(s<2)return t[0];const[r]=t,o=r.length,i=y.A.createEmptyBand(n,o);for(let n=0;n<o;n++)if(!e||e[n]){let e=r[n],o=e;for(let r=1;r<s;r++){const s=t[r][n];o<s?o=s:e>s&&(e=s)}i[n]=o-e}return i}function At(t,e,n){const s=t.length;if(s<2)return t[0];const[r]=t,o=r.length,i=y.A.createEmptyBand(n,o);for(let n=0;n<o;n++)if(!e||e[n]){let e=0;for(let r=0;r<s;r++)e+=t[r][n];i[n]=e/s}return i}function bt(t,e,n){const s=t.length;if(s<2)return t[0];const[r]=t,o=r.length,i=y.A.createEmptyBand(n,o);for(let n=0;n<o;n++)if(!e||e[n])for(let e=0;e<s;e++){const s=t[e];i[n]+=s[n]}return i}function vt(t,e,n){const s=t.length;if(s<2)return t[0];const[r]=t,o=r.length,i=y.A.createEmptyBand(n,o);for(let n=0;n<o;n++)if(!e||e[n]){const e=new Float32Array(s);let r=0;for(let o=0;o<s;o++){const s=t[o];r+=s[n],e[o]=s[n]}r/=s;let o=0;for(let t=0;t<s;t++)o+=(e[t]-r)**2;i[n]=Math.sqrt(o/s)}return i}function _t(t,e,n){const s=t.length;if(s<2)return t[0];const r=Math.floor(s/2),[o]=t,i=o.length,a=y.A.createEmptyBand(n,i),u=new Float32Array(s),l=s%2==1;for(let n=0;n<i;n++)if(!e||e[n]){for(let e=0;e<s;e++)u[e]=t[e][n];u.sort(),a[n]=l?u[r]:(u[r]+u[r-1])/2}return a}function Mt(t,e,n){const[s,r]=t;if(null==r)return s;const o=s.length,i=y.A.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]<r[t]?s[t]:r[t]);return i}function Pt(t,e,n){const s=t.length;if(s<=2)return Mt(t,e,n);const r=t[0].length,o=y.A.createEmptyBand(n,r),i=new Map;for(let n=0;n<r;n++)if(!e||e[n]){i.clear();for(let e=0;e<s;e++){const s=t[e][n];i.set(s,i.has(s)?i.get(s)+1:1)}let e=0,r=0;const a=[];for(const t of i.keys())e=i.get(t),e>r?(r=e,a.length=0,a.push(t)):e===r&&a.push(t);a.length>1&&a.sort(((t,e)=>t-e)),o[n]=a[0]}return o}function Tt(t,e,n){const s=t.length;if(s<=2)return Mt(t,e,n);const r=t[0].length,o=y.A.createEmptyBand(n,r),i=new Map;for(let n=0;n<r;n++)if(!e||e[n]){i.clear();for(let e=0;e<s;e++){const s=t[e][n];i.set(s,i.has(s)?i.get(s)+1:1)}let e=0,r=t.length;const a=[];for(const t of i.keys())e=i.get(t),e<r?(r=e,a.length=0,a.push(t)):e===r&&a.push(t);a.length>1&&a.sort(((t,e)=>t-e)),o[n]=a[0]}return o}function Rt(t,e,n){const s=t.length;if(s<2)return t[0];const[r]=t,o=r.length,i=y.A.createEmptyBand(n,o),a=new Set;for(let n=0;n<o;n++)if(!e||e[n]){let e;a.clear();for(let r=0;r<s;r++)e=t[r][n],a.add(e);i[n]=a.size}return i}const Nt=new Map,Ft=new Map,kt=new Map,It=new Map;function St(t,e,n={}){Nt.size||(Nt.set(4,Math.sqrt),Nt.set(6,Math.acos),Nt.set(7,Math.asin),Nt.set(8,Math.atan),Nt.set(9,Math.atanh),Nt.set(10,Math.abs),Nt.set(21,Math.cos),Nt.set(22,Math.cosh),Nt.set(48,Math.floor),Nt.set(49,Math.ceil),Nt.set(51,Math.sin),Nt.set(52,Math.sinh),Nt.set(56,Math.tan),Nt.set(57,Math.tanh),Nt.set(59,Math.acosh),Nt.set(60,Math.asinh),Nt.set(65,Math.floor),Ft.set(5,Math.pow),Ft.set(61,Math.atan2),kt.set(1,k),kt.set(2,C),kt.set(3,B),kt.set(11,U),kt.set(12,L),kt.set(13,V),kt.set(14,W),kt.set(15,$),kt.set(16,H),kt.set(17,q),kt.set(18,J),kt.set(19,K),kt.set(20,X),kt.set(23,Z),kt.set(24,Y),kt.set(25,nt),kt.set(26,tt),kt.set(27,et),kt.set(28,at),kt.set(29,ut),kt.set(30,j),kt.set(31,pt),kt.set(32,I),kt.set(33,lt),kt.set(34,ct),kt.set(35,it),kt.set(36,rt),kt.set(37,ot),kt.set(44,ht),kt.set(45,mt),kt.set(46,ft),kt.set(53,S),kt.set(64,G),kt.set(65,z),kt.set(76,gt),kt.set(78,gt),It.set(38,Pt),It.set(39,yt),It.set(40,At),It.set(41,_t),It.set(42,xt),It.set(43,Tt),It.set(47,wt),It.set(54,vt),It.set(55,bt),It.set(58,Rt),It.set(66,Pt),It.set(67,yt),It.set(68,At),It.set(69,_t),It.set(70,xt),It.set(71,Tt),It.set(72,wt),It.set(73,vt),It.set(74,bt),It.set(75,Rt));let s=function(t,e=!1){const n=t.map((t=>t.mask)),s=n.filter((t=>null!=t)),r=t[0].pixels[0].length;if(0===s.length||e&&s.length!==n.length)return new Uint8Array(r).fill(255);const o=s[0],i=new Uint8Array(o);if(1===s.length)return i;if(!e){for(let t=1;t<s.length;t++){const e=s[t];for(let t=0;t<i.length;t++)i[t]&&(i[t]=e[t]?255:0)}return i}for(let t=1;t<s.length;t++){const e=s[t];for(let t=0;t<i.length;t++)0===i[t]&&(i[t]=e[t]?255:0)}return i}(t,e>=66&&e<=75);const{outputPixelType:r="f32"}=n,o=!It.has(e)||n.processAsMultiband,i=o?t[0].pixels.length:1,a=[];for(let n=0;n<i;n++){const i=It.has(e)&&!o?t.flatMap((t=>t.pixels)):t.map((t=>t.pixels[n]));let u,c=!0;if(e===P.setNull){const t=dt(i,s,r);u=t.band,s=t.mask,c=!1}else kt.has(e)?u=kt.get(e)(i,s,"f64"):Nt.has(e)?u=e===M.asin||e===M.acos||e===M.atanh?E(i,s,"f64",e):O(i,s,"f64",Nt.get(e)):Ft.has(e)?u=D(i,s,"f64",Ft.get(e)):It.has(e)?u=It.get(e)(i,s,"f64"):(u=i[0],c=!1);if(c&&e!==_.isNull&&!R.has(e)){const t=y.A.createEmptyBand(r,u.length);s||(s=new Uint8Array(u.length).fill(255)),(0,l.$p)(u,s),(0,l.yM)(u,s,r,t),u=t}a.push(u)}const u=t[0];return new y.A({width:u.width,height:u.height,pixelType:r,mask:e===_.isNull?null:s,pixels:a})}let Ct=class extends b{constructor(){super(...arguments),this.functionName="Arithmetic",this.functionArguments=null,this.rasterArgumentNames=["raster","raster2"]}_bindSourceRasters(){const{operation:t}=this.functionArguments;if(t<1||t>6)return{success:!1,supportsGPU:!1,error:"unsupported operation"};const e=this.sourceRasterInfos[0].clone();return this.outputPixelType=this._getOutputPixelType(e.pixelType),e.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(e),this.rasterInfo=e,{success:!0,supportsGPU:e.bandCount<=3}}_processPixels(t){const{pixelBlocks:e}=t;return null==e?.[0]||null==e?.[1]?null:function(t,e,n){return St(t,e=[null,1,2,3,23,5,44][e]??1,{outputPixelType:n})}(e,this.functionArguments.operation,this.outputPixelType)}_getWebGLParameters(){const{operation:t}=this.functionArguments,e=["","plus","minus","times","divide","power","mod"][t],n=this.outputPixelType??"f32";let[s,r]=(0,l.hP)(n);const o=(0,l.zw)(n);return o&&(s-=1e-4,r+=1e-4),{imageCount:2,operationName:e,domainRange:[s,r],isOutputRounded:o}}};(0,i._)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Ct.prototype,"functionName",void 0),(0,i._)([(0,a.MZ)({type:d,json:{write:!0,name:"rasterFunctionArguments"}})],Ct.prototype,"functionArguments",void 0),(0,i._)([(0,a.MZ)()],Ct.prototype,"rasterArgumentNames",void 0),Ct=(0,i._)([(0,u.$)("esri.layers.support.rasterFunctions.ArithmeticFunction")],Ct);const Bt=Ct;var jt;let Zt=jt=class extends h{clone(){return new jt({raster:this.raster})}};Zt=jt=(0,i._)([(0,u.$)("esri.layers.support.rasterFunctions.AspectFunctionArguments")],Zt);const Gt=Zt;var zt=n(39062);let Et=class extends b{constructor(){super(...arguments),this.functionName="Aspect",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){const t=this.sourceRasterInfos[0];this.isGCS=t.spatialReference?.isGeographic??!1,this.outputPixelType=this._getOutputPixelType("f32");const e=t.clone();return e.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(e),e.statistics=[{min:-1,max:360,avg:180,stddev:30}],e.bandCount=1,this.rasterInfo=e,{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{extent:n,primaryPixelSizes:s}=t,r=s?.[0],o=r??(n?{x:n.width/e.width,y:n.height/e.height}:{x:1,y:1});return(0,zt.di)(e,{resolution:o})}};(0,i._)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Et.prototype,"functionName",void 0),(0,i._)([(0,a.MZ)({type:Gt,json:{write:!0,name:"rasterFunctionArguments"}})],Et.prototype,"functionArguments",void 0),(0,i._)([(0,a.MZ)()],Et.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.MZ)({json:{write:!0}})],Et.prototype,"isGCS",void 0),Et=(0,i._)([(0,u.$)("esri.layers.support.rasterFunctions.AspectFunction")],Et);const Ot=Et;var Dt=n(93223),Ut=n(66552);const Lt=new Set(["+","-","*","/","(",")"]);function Vt(t,e){return t.toLowerCase().startsWith("b")?e[parseInt(t.slice(1),10)-1]:parseFloat(t)}function Wt(t,e,n,s){if("number"==typeof n&&"number"==typeof s)return n+s;let r,o,i;"number"==typeof n?(i=s,r=i.length,o=new Float32Array(r),o.fill(n)):(r=n.length,o=n,s.constructor===Number?(i=new Float32Array(r),i.fill(s)):i=s);const a=new Float32Array(r);switch(e){case"+":for(let e=0;e<r;e++)(null==t||t[e])&&(a[e]=o[e]+i[e]);break;case"-":for(let e=0;e<r;e++)(null==t||t[e])&&(a[e]=o[e]-i[e]);break;case"*":for(let e=0;e<r;e++)(null==t||t[e])&&(a[e]=o[e]*i[e]);break;case"/":for(let e=0;e<r;e++)(null==t||t[e])&&i[e]&&(a[e]=o[e]/i[e]);break;case"(":case")":throw new Error("encountered error with custom band index equation")}return a}function $t(t,e){t.splice(e,1);let n=0,s=0;do{n=0,s=0;for(let e=0;e<t.length;e++)if("("===t[e])n=e;else if(")"===t[e]){s=e;break}s===n+1&&t.splice(n,2)}while(s===n+1);return t}function Ht(t){if(1===t.length)return{opIndex:0,numIndex:0};let e=0,n=0;for(let s=0;s<t.length;s++)if("("===t[s])e=s;else if(")"===t[s]){n=s;break}const s=0===n?t:t.slice(e+1,n);let r=-1;for(let t=0;t<s.length;t++)if("*"===s[t]||"/"===s[t]){r=t;break}if(r>-1)n>0&&(r+=e+1);else{for(let t=0;t<s.length;t++)if("+"===s[t]||"-"===s[t]){r=t;break}n>0&&(r+=e+1)}let o=0;for(let e=0;e<r;e++)"("===t[e]&&o++;return{opIndex:r,numIndex:r-o}}var qt=n(28435);const Jt=new Ut.J({0:"custom",1:"ndvi",2:"savi",3:"tsavi",4:"msavi",5:"gemi",6:"pvi",7:"gvitm",8:"sultan",9:"vari",10:"gndvi",11:"sr",12:"ndvi-re",13:"sr-re",14:"mtvi2",15:"rtvi-core",16:"ci-re",17:"ci-g",18:"ndwi",19:"evi",20:"iron-oxide",21:"ferrous-minerals",22:"clay-minerals",23:"wndwi",24:"bai",25:"nbr",26:"ndbi",27:"ndmi",28:"ndsi",29:"mndwi"},{useNumericKeys:!0});function Kt(t,e){if(!(0,qt.AB)(t))return t;const{equation:n,method:s}=e,r=e.bandIndexes.map((t=>t-1)),{pixels:o,mask:i}=t;let a;switch(s){case"gndvi":case"nbr":case"ndbi":case"ndvi":case"ndvi-re":case"ndsi":case"ndmi":case"mndwi":a=Yt(i,o[r[0]],o[r[1]]);break;case"ndwi":a=Yt(i,o[r[1]],o[r[0]]);break;case"sr":case"sr-re":case"iron-oxide":case"ferrous-minerals":case"clay-minerals":a=function(t,e,n){const s=n.length,r=new Float32Array(s);for(let o=0;o<s;o++)if(null==t||t[o]){const t=e[o],s=n[o];s&&(r[o]=t/s)}return[r]}(i,o[r[0]],o[r[1]]);break;case"ci-g":case"ci-re":a=function(t,e,n){const s=e.length,r=new Float32Array(s);for(let o=0;o<s;o++)if(null==t||t[o]){const t=e[o],s=n[o];s&&(r[o]=t/s-1)}return[r]}(i,o[r[0]],o[r[1]]);break;case"savi":a=function(t,e,n,s){const r=n.length,o=new Float32Array(r);for(let i=0;i<r;i++)if(null==t||t[i]){const t=n[i],r=e[i],a=r+t+s;a&&(o[i]=(r-t)/a*(1+s))}return[o]}(i,o[r[0]],o[r[1]],r[2]+1);break;case"tsavi":a=function(t,e,n,s,r,o){const i=n.length,a=new Float32Array(i),u=-r*s+o*(1+s*s);for(let o=0;o<i;o++)if(null==t||t[o]){const t=n[o],i=e[o],l=r*i+t+u;l&&(a[o]=s*(i-s*t-r)/l)}return[a]}(i,o[r[0]],o[r[1]],r[2]+1,r[3]+1,r[4]+1);break;case"msavi":a=function(t,e,n){const s=n.length,r=new Float32Array(s);for(let o=0;o<s;o++)if(null==t||t[o]){const t=n[o],s=e[o],i=2*s+1;r[o]=.5*(i-Math.sqrt(i*i-8*(s-t)))}return[r]}(i,o[r[0]],o[r[1]]);break;case"gemi":a=function(t,e,n){const s=n.length,r=new Float32Array(s);for(let o=0;o<s;o++)if(null==t||t[o]){const t=n[o],s=e[o];if(1!==t&&s+t+.5!==0){const e=(2*(s*s-t*t)+1.5*s+.5*t)/(s+t+.5);r[o]=e*(1-.25*e)-(t-.125)/(1-t)}}return[r]}(i,o[r[0]],o[r[1]]);break;case"pvi":a=function(t,e,n,s,r){const o=n.length,i=new Float32Array(o),a=1/Math.sqrt(1+s*s);for(let u=0;u<o;u++)if(null==t||t[u]){const t=n[u],o=e[u];i[u]=(o-s*t-r)*a}return[i]}(i,o[r[0]],o[r[1]],r[2]+1,r[3]+1);break;case"gvitm":a=function(t,e){const[n,s,r,o,i,a]=e,u=n.length,l=new Float32Array(u);for(let e=0;e<u;e++)(null==t||t[e])&&(l[e]=-.2848*n[e]-.2435*s[e]-.5436*r[e]+.7243*o[e]+.084*i[e]-.18*a[e]);return[l]}(i,[o[r[0]],o[r[1]],o[r[2]],o[r[3]],o[r[4]],o[r[5]]]);break;case"sultan":a=function(t,e){const[n,s,r,o,i]=e,a=n.length,u=new Float32Array(a),l=new Float32Array(a),c=new Float32Array(a);for(let e=0;e<a;e++)(null==t||t[e])&&(u[e]=i[e]?o[e]/i[e]*100:0,l[e]=n[e]?o[e]/n[e]*100:0,c[e]=r[e]?s[e]/r[e]*(o[e]/r[e])*100:0);return[u,l,c]}(i,[o[r[0]],o[r[1]],o[r[2]],o[r[3]],o[r[4]]]);break;case"vari":a=function(t,e){const[n,s,r]=e,o=n.length,i=new Float32Array(o);for(let e=0;e<o;e++)if(null==t||t[e])for(e=0;e<o;e++){const t=n[e],o=s[e],a=o+t-r[e];a&&(i[e]=(o-t)/a)}return[i]}(i,[o[r[0]],o[r[1]],o[r[2]]]);break;case"mtvi2":a=function(t,e){const[n,s,r]=e,o=n.length,i=new Float32Array(o);for(let e=0;e<o;e++)if(null==t||t[e])for(e=0;e<o;e++){const t=n[e],o=s[e],a=r[e],u=Math.sqrt((2*t+1)**2-(6*t-5*Math.sqrt(o))-.5);if(u){const n=1.5*(1.2*(t-a)-2.5*(o-a));i[e]=n/u}}return[i]}(i,[o[r[0]],o[r[1]],o[r[2]]]);break;case"rtvi-core":a=function(t,e){const[n,s,r]=e,o=n.length,i=new Float32Array(o);for(let e=0;e<o;e++)if(null==t||t[e])for(e=0;e<o;e++){const t=n[e],o=s[e],a=r[e];i[e]=100*(t-o)-10*(t-a)}return[i]}(i,[o[r[0]],o[r[1]],o[r[2]]]);break;case"evi":a=function(t,e){const[n,s,r]=e,o=n.length,i=new Float32Array(o);for(let e=0;e<o;e++)if(null==t||t[e])for(e=0;e<o;e++){const t=n[e],o=s[e],a=t+6*o-7.5*r[e]+1;a&&(i[e]=2.5*(t-o)/a)}return[i]}(i,[o[r[0]],o[r[1]],o[r[2]]]);break;case"wndwi":a=function(t,e,n=.5){const[s,r,o]=e,i=r.length,a=new Float32Array(i);for(let e=0;e<i;e++)if(null==t||t[e])for(e=0;e<i;e++){const t=s[e],i=r[e],u=o[e],l=t+n*i+(1-n)*u;l&&(a[e]=(t-n*i-(1-n)*u)/l)}return[a]}(i,[o[r[0]],o[r[1]],o[r[2]]],r[3]?r[3]+1:.5);break;case"bai":a=function(t,e,n){const s=n.length,r=new Float32Array(s);for(let o=0;o<s;o++)if(null==t||t[o])for(o=0;o<s;o++){const t=(.1-e[o])**2+(.06-n[o])**2;t&&(r[o]=1/t)}return[r]}(i,o[r[0]],o[r[1]]);break;case"custom":a=function(t,e,n){let s,{ops:r,nums:o}=function(t,e){(t=t.replaceAll(" ","")).startsWith("-")&&(t="0"+t),t.startsWith("+")&&(t=t.slice(1));const n=t.split(""),s=[],r=[];let o="";for(let t=0;t<n.length;t++){const i=n[t];Lt.has(i)?(o.length&&r.push(Vt(o,e)),s.push(i),o=""):o=o.concat(i)}return o.length&&r.push(Vt(o,e)),{ops:s,nums:r}}(n,e);if(0===r.length){const t=1===o.length?o[0]:e[0];if(t instanceof Float32Array)return[t];const n=new Float32Array(e[0].length);return"number"==typeof t?n.fill(t):n.set(t),[n]}for(;r.length>0;){const{numIndex:e,opIndex:n}=Ht(r);if(s=Wt(t,r[n],o[e],o[e+1]),1===r.length)break;r=$t(r,n),o.splice(e,2,s)}return[s]}(i,o,n);break;default:return t}const{outputPixelType:u="f32"}=e,c=null!=u&&(0,l.zw)(u);let p;i?(p=new Uint8Array(t.width*t.height),p.set(i)):c&&(p=new Uint8Array(t.width*t.height).fill(255)),c&&(a=a.map((t=>{const e=y.A.createEmptyBand(u,t.length);return(0,l.yM)(t,p,u,e),e})));const h=new y.A({width:t.width,height:t.height,pixelType:u,pixels:a,mask:p});return h.updateStatistics(),h}function Xt(t){const e=new Float32Array(9);return e[3*t[0]]=1,e[3*t[1]+1]=1,e[3*t[2]+2]=1,e}function Yt(t,e,n){const s=n.length,r=new Float32Array(s);for(let o=0;o<s;o++)if(null==t||t[o]){const t=e[o],s=n[o],i=t+s;i&&(r[o]=(t-s)/i)}return[r]}var Qt;let te=Qt=class extends h{constructor(){super(...arguments),this.method="custom"}clone(){return new Qt({method:this.method,bandIndexes:this.bandIndexes,raster:(0,o.o8)(this.raster)})}};(0,i._)([(0,a.MZ)({json:{type:String,write:!0}})],te.prototype,"bandIndexes",void 0),(0,i._)([(0,Dt.e)(Jt)],te.prototype,"method",void 0),te=Qt=(0,i._)([(0,u.$)("esri.layers.support.rasterFunctions.BandArithmeticFunctionArguments")],te);const ee=te,ne=new Set(["vari","mtvi2","rtvi-core","evi"]);let se=class extends b{constructor(){super(...arguments),this.functionName="BandArithmetic",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){this.outputPixelType=this._getOutputPixelType("f32");const t=this.sourceRasterInfos[0];if(t.bandCount<2)return{success:!1,supportsGPU:!1,error:"band-arithmetic-function: source raster has insufficient amount of raster bands"};const e=t.clone();return e.pixelType=this.outputPixelType,e.bandCount="sultan"===this.functionArguments.method?3:1,this._removeStatsHistColormapVAT(e),e.keyProperties={...e.keyProperties,BandProperties:void 0},this.rasterInfo=e,{success:!0,supportsGPU:!["custom","gvitm","sultan"].includes(this.functionArguments.method)}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return e;const{method:n,bandIndexes:s}=this.functionArguments,r=s.split(" ").map((t=>parseFloat(t)));return Kt(e,{method:n,bandIndexes:r,equation:s,outputPixelType:this.outputPixelType})}_getWebGLParameters(){const t=this.functionArguments.bandIndexes.split(" ").map((t=>parseFloat(t)-1));2===t.length&&t.push(0);const e=this.isInputBandIdsSwizzled?[0,1,2]:t;let n,s;const r=new Float32Array(3),{method:o}=this.functionArguments;switch(o){case"gndvi":case"nbr":case"ndbi":case"ndvi":case"ndvi-re":case"ndsi":case"ndmi":case"mndwi":n=Xt([e[0],e[1],0]),s="ndxi";break;case"ndwi":n=Xt([e[1],e[0],0]),s="ndxi";break;case"sr":case"sr-re":case"iron-oxide":case"ferrous-minerals":case"clay-minerals":n=Xt([e[0],e[1],0]),s="sr";break;case"ci-g":case"ci-re":n=Xt([e[0],e[1],0]),s="ci";break;case"savi":n=Xt([e[0],e[1],0]),s="savi",r[0]=t[2]+1;break;case"tsavi":n=Xt([e[0],e[1],0]),s="tsavi",r[0]=t[2]+1,r[1]=t[3]+1,r[2]=t[4]+1;break;case"msavi":n=Xt([e[0],e[1],0]),s="msavi";break;case"gemi":n=Xt([e[0],e[1],0]),s="gemi";break;case"pvi":n=Xt([e[0],e[1],0]),s="tsavi",r[0]=t[2]+1,r[1]=t[3]+1;break;case"vari":n=Xt([e[0],e[1],e[2]]),s="vari";break;case"mtvi2":n=Xt([e[0],e[1],e[2]]),s="mtvi";break;case"rtvi-core":n=Xt([e[0],e[1],e[2]]),s="rtvicore";break;case"evi":n=Xt([e[0],e[1],e[2]]),s="evi";break;case"wndwi":n=Xt([e[0],e[1],0]),s="wndwi",r[0]=t[3]?t[3]+1:.5;break;case"bai":n=Xt([e[1],e[0],0]),s="bai";break;default:n=Xt([0,1,2]),s="custom"}return{bandIndexMat3:n,indexType:s,adjustments:r,isOutputRounded:(0,l.zw)(this.outputPixelType)}}_getInputBandIds(t){if("custom"===this.functionArguments.method)return t;const e=this.functionArguments.bandIndexes.split(" ").map((t=>parseFloat(t)-1)),n=t.length,s=e.map((t=>t>=n?n-1:t)),r=ne.has(this.functionArguments.method)?3:2,o=s.slice(0,r).map((e=>t[e]));return 2===o.length&&o.push(0),o}};(0,i._)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],se.prototype,"functionName",void 0),(0,i._)([(0,a.MZ)({type:ee,json:{write:!0,name:"rasterFunctionArguments"}})],se.prototype,"functionArguments",void 0),(0,i._)([(0,a.MZ)()],se.prototype,"rasterArgumentNames",void 0),se=(0,i._)([(0,u.$)("esri.layers.support.rasterFunctions.BandArithmeticFunction")],se);const re=se;var oe,ie=n(65864),ae=n(50498);const ue=new Ut.J({1:"outside",2:"inside"},{useNumericKeys:!0});let le=oe=class extends h{constructor(){super(...arguments),this.clippingType="outside"}clone(){return new oe({clippingGeometry:this.clippingGeometry.clone(),clippingType:this.clippingType})}};(0,i._)([(0,a.MZ)({types:ae.yR,json:{read:ie.rS,write:!0}})],le.prototype,"clippingGeometry",void 0),(0,i._)([(0,a.MZ)({json:{read:ue.read,write:ue.write}})],le.prototype,"clippingType",void 0),le=oe=(0,i._)([(0,u.$)("esri.layers.support.rasterFunctions.ClipFunctionArguments")],le);const ce=le;var pe=n(77359),he=n(70834);let me=class extends b{constructor(){super(...arguments),this.functionName="Clip",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isNoopProcess=!0}_bindSourceRasters(){const t=this.sourceRasterInfos[0].clone();this.outputPixelType=this._getOutputPixelType(t.pixelType),t.pixelType=this.outputPixelType,this.rasterInfo=t;const{functionArguments:e}=this,{clippingGeometry:n,clippingType:s}=e;if(!n)return{success:!1,supportsGPU:!1,error:"missing clipping geometry"};if("outside"===s)try{const{spatialReference:e}=t,s="extent"===n.type?(0,he._l)(n,e):(0,he.uk)(n,e).extent;s&&(0,pe.Sd)(t,s)}catch{}return{success:!0,supportsGPU:!0}}_processPixels(t){return t.pixelBlocks?.[0]}_getWebGLParameters(){const{clippingGeometry:t,clippingType:e}=this.functionArguments;return{clippingGeometry:t.toJSON(),clippingType:e}}};(0,i._)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],me.prototype,"functionName",void 0),(0,i._)([(0,a.MZ)({type:ce,json:{write:!0,name:"rasterFunctionArguments"}})],me.prototype,"functionArguments",void 0),(0,i._)([(0,a.MZ)()],me.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.MZ)()],me.prototype,"isNoopProcess",void 0),me=(0,i._)([(0,u.$)("esri.layers.support.rasterFunctions.ClipFunction")],me);const fe=me;var de,ge=n(36005),ye=n(67369),xe=n(95349);let we=de=class extends h{castColormapName(t){if(!t)return null;const e=t.toLowerCase();return ye.L7.includes(e)?e:null}readColorRamp(t){return(0,xe.r)(t)}readColorRampName(t,e){if(!t)return null;const n=ye.kH.jsonValues.find((e=>e.toLowerCase()===t.toLowerCase()));return n?ye.kH.fromJSON(n):null}clone(){return new de({colormap:(0,o.o8)(this.colormap),colormapName:this.colormapName,colorRamp:this.colorRamp?.clone(),colorRampName:this.colorRampName})}};(0,i._)([(0,a.MZ)({type:[[Number]],json:{write:!0}})],we.prototype,"colormap",void 0),(0,i._)([(0,a.MZ)({type:String,json:{write:!0}})],we.prototype,"colormapName",void 0),(0,i._)([(0,g.w)("colormapName")],we.prototype,"castColormapName",null),(0,i._)([(0,a.MZ)({types:xe.g,json:{write:!0}})],we.prototype,"colorRamp",void 0),(0,i._)([(0,ge.w)("colorRamp")],we.prototype,"readColorRamp",null),(0,i._)([(0,a.MZ)({type:ye.kH.apiValues,json:{type:ye.kH.jsonValues,write:ye.kH.write}})],we.prototype,"colorRampName",void 0),(0,i._)([(0,ge.w)("colorRampName")],we.prototype,"readColorRampName",null),we=de=(0,i._)([(0,u.$)("esri.layers.support.rasterFunctions.ColormapFunctionArguments")],we);const Ae=we,be=[[36,0,255],[36,0,255],[36,0,255],[36,0,255],[112,75,3],[113,76,3],[114,77,3],[115,77,3],[116,78,3],[117,79,3],[118,79,3],[119,80,3],[121,81,4],[122,82,4],[123,82,4],[124,83,4],[125,84,4],[126,84,4],[127,85,4],[128,86,4],[129,86,4],[130,87,4],[131,88,4],[132,89,4],[133,89,4],[134,90,4],[135,91,4],[136,91,4],[137,92,4],[138,93,4],[139,94,4],[140,94,4],[142,95,5],[143,96,5],[144,96,5],[145,97,5],[146,98,5],[147,99,5],[148,99,5],[149,100,5],[150,101,5],[151,101,5],[152,102,5],[153,103,5],[154,104,5],[155,104,5],[156,105,5],[157,106,5],[158,106,5],[159,107,5],[160,108,5],[161,108,5],[162,109,5],[164,110,6],[165,111,6],[166,111,6],[167,112,6],[168,113,6],[169,113,6],[170,114,6],[171,115,6],[172,116,6],[173,116,6],[174,117,6],[245,0,0],[245,5,0],[245,10,0],[246,15,0],[246,20,0],[246,25,0],[246,30,0],[247,35,0],[247,40,0],[247,45,0],[247,50,0],[247,55,0],[248,60,0],[248,65,0],[248,70,0],[248,75,0],[249,81,0],[249,86,0],[249,91,0],[249,96,0],[250,101,0],[250,106,0],[250,111,0],[250,116,0],[250,121,0],[251,126,0],[251,131,0],[251,136,0],[251,141,0],[252,146,0],[252,151,0],[252,156,0],[252,156,0],[251,159,0],[250,162,0],[249,165,0],[248,168,0],[247,171,0],[246,174,0],[245,177,0],[245,179,0],[244,182,0],[243,185,0],[242,188,0],[241,191,0],[240,194,0],[239,197,0],[238,200,0],[237,203,0],[236,206,0],[235,209,0],[234,212,0],[233,215,0],[232,218,0],[231,221,0],[230,224,0],[230,226,0],[229,229,0],[228,232,0],[227,235,0],[226,238,0],[225,241,0],[224,244,0],[223,247,0],[165,247,0],[163,244,0],[161,240,0],[158,237,0],[156,233,1],[154,230,1],[152,227,1],[149,223,1],[147,220,1],[145,216,1],[143,213,1],[140,210,2],[138,206,2],[136,203,2],[134,200,2],[132,196,2],[129,193,2],[127,189,2],[125,186,3],[123,183,3],[120,179,3],[118,176,3],[116,172,3],[114,169,3],[111,166,3],[109,162,4],[107,159,4],[105,155,4],[103,152,4],[100,149,4],[98,145,4],[96,142,4],[94,138,5],[91,135,5],[89,132,5],[87,128,5],[85,125,5],[82,121,5],[80,118,5],[78,115,6],[76,111,6],[73,108,6],[71,105,6],[69,101,6],[67,98,6],[65,94,6],[62,91,7],[60,88,7],[58,84,7],[56,81,7],[53,77,7],[51,74,7],[49,71,7],[47,67,8],[44,64,8],[42,60,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8]],ve=[[36,0,255],[36,0,255],[36,0,255],[36,0,255],[245,20,0],[245,24,0],[245,29,0],[245,31,0],[247,33,0],[247,33,0],[247,37,0],[247,41,0],[247,41,0],[247,41,0],[247,45,0],[247,45,0],[247,47,0],[247,49,0],[247,49,0],[247,54,0],[247,54,0],[247,56,0],[247,58,0],[247,58,0],[250,62,0],[250,62,0],[250,62,0],[250,67,0],[250,67,0],[250,67,0],[250,69,0],[250,71,0],[250,71,0],[250,75,0],[250,75,0],[250,78,0],[250,79,0],[250,79,0],[250,79,0],[250,81,0],[250,83,0],[250,83,0],[250,87,0],[250,87,0],[250,90,0],[250,92,0],[252,93,0],[252,93,0],[252,97,0],[252,97,0],[252,97,0],[252,97,0],[252,101,0],[252,101,0],[252,101,0],[252,101,0],[252,105,0],[252,105,0],[252,107,0],[252,109,0],[252,109,0],[252,113,13],[255,118,20],[255,119,23],[255,121,25],[255,126,33],[255,132,38],[255,133,40],[255,135,43],[255,141,48],[255,144,54],[255,150,59],[255,152,61],[255,153,64],[255,159,69],[255,163,77],[255,165,79],[255,168,82],[255,174,87],[255,176,92],[255,181,97],[255,183,99],[255,186,102],[255,191,107],[255,197,115],[255,201,120],[255,203,123],[255,205,125],[255,209,130],[255,214,138],[255,216,141],[255,218,143],[255,224,150],[255,228,156],[255,234,163],[255,236,165],[255,238,168],[255,243,173],[255,248,181],[255,252,186],[253,252,186],[250,252,187],[244,250,180],[238,247,176],[234,246,173],[231,245,169],[223,240,163],[217,237,157],[211,235,150],[205,233,146],[200,230,142],[195,227,136],[189,224,132],[184,222,126],[180,220,123],[174,217,119],[169,214,114],[163,212,108],[160,210,105],[154,207,101],[148,204,96],[143,201,93],[138,199,88],[134,197,84],[130,194,81],[126,191,77],[117,189,70],[115,186,68],[112,184,64],[106,181,60],[100,179,55],[94,176,49],[92,174,47],[90,173,45],[81,168,37],[75,166,33],[71,163,28],[66,160,24],[62,158,21],[56,156,14],[51,153,0],[51,153,0],[51,153,0],[50,150,0],[50,150,0],[50,150,0],[50,150,0],[49,148,0],[49,148,0],[49,148,0],[48,145,0],[48,145,0],[48,145,0],[48,145,0],[48,143,0],[48,143,0],[48,143,0],[48,143,0],[47,140,0],[47,140,0],[47,140,0],[47,140,0],[46,138,0],[46,138,0],[46,138,0],[46,138,0],[45,135,0],[45,135,0],[45,135,0],[45,135,0],[44,133,0],[44,133,0],[44,133,0],[43,130,0],[43,130,0],[43,130,0],[43,130,0],[43,130,0],[43,130,0],[42,128,0],[42,128,0],[42,128,0],[42,125,0],[42,125,0],[42,125,0],[42,125,0],[41,122,0],[41,122,0],[41,122,0],[41,122,0],[40,120,0],[40,120,0],[40,120,0],[40,120,0],[40,120,0],[39,117,0],[39,117,0],[39,117,0],[39,117,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0]];function _e(t,e){const n=[],s=[];for(let e=0;e<t.length-1;e++)n.push({type:"algorithmic",algorithm:"esriHSVAlgorithm",fromColor:t[e].slice(1),toColor:t[e+1].slice(1)}),s.push(t[e+1][0]-t[e][0]);const r=t[t.length-1][0];return(0,ye.iv)({type:"multipart",colorRamps:n},{numColors:r,weights:e=e??s})}let Me=class extends b{constructor(){super(...arguments),this.functionName="Colormap",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isNoopProcess=!0}_bindSourceRasters(){const t=this.sourceRasterInfos[0];if(t.bandCount>1)return{success:!1,supportsGPU:!1,error:"colormap-function: source data must be single band"};let{colormap:e,colormapName:n,colorRamp:s,colorRampName:r}=this.functionArguments;if(!e?.length)if(s)this.colorRamp=s,e=(0,ye.R8)(s,{interpolateAlpha:!0});else if(r){const t=(0,ye.M5)(r);t&&(e=(0,ye.R8)(t),this.colorRamp=(0,xe.r)(t))}else n&&(e=function(t){let e;switch(t){case"elevation":e=_e([[0,0,191,191],[51,0,0,255],[102,255,0,255],[153,255,0,127],[204,191,63,127],[256,20,20,20]]);break;case"gray":e=(0,ye.iv)({type:"algorithmic",algorithm:"esriHSVAlgorithm",fromColor:[0,0,0],toColor:[255,255,255]});break;case"hillshade":e=_e([[0,38,41,54],[69,79,82,90],[131,156,156,156],[256,253,253,241]],[.268,.238,.495]);break;case"ndvi":e=be;break;case"ndvi2":e=function(){const t=_e([[0,255,255,255],[70,0,255,0],[80,205,173,193],[100,150,150,150],[110,120,51,100],[130,120,100,200],[140,28,3,144],[160,6,0,55],[180,10,25,30],[201,6,7,27]]);for(let e=t.length;e<256;e++)t.push([6,27,7]);return t}();break;case"ndvi3":e=ve;break;case"random":e=function(){const t=[];for(let e=0;e<256;e++){const e=[];for(let t=0;t<3;t++)e.push(Math.round(255*Math.random()));t.push(e)}return t}()}return e?(e=e.map(((t,e)=>[e,...t])),e):null}(n));if(!e?.length)return{success:!1,supportsGPU:!1,error:"colormap-function: missing colormap argument"};const o=this._getOutputPixelType(t.pixelType);this.outputPixelType=o.startsWith("f")?"s32":o;const i=t.clone();return i.pixelType=this.outputPixelType,i.colormap=e,i.bandCount=1,this.rasterInfo=i,{success:!0,supportsGPU:!0}}_processPixels(t){let e=t.pixelBlocks?.[0];return!e||(0,l.zw)(e.pixelType)||(e=e.clone(),e.clamp(this.outputPixelType)),e}};(0,i._)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Me.prototype,"functionName",void 0),(0,i._)([(0,a.MZ)({type:Ae,json:{write:!0,name:"rasterFunctionArguments"}})],Me.prototype,"functionArguments",void 0),(0,i._)([(0,a.MZ)()],Me.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.MZ)()],Me.prototype,"isNoopProcess",void 0),(0,i._)([(0,a.MZ)({json:{write:!0}})],Me.prototype,"indexedColormap",void 0),(0,i._)([(0,a.MZ)()],Me.prototype,"colorRamp",void 0),Me=(0,i._)([(0,u.$)("esri.layers.support.rasterFunctions.ColormapFunction")],Me);const Pe=Me;var Te,Re=