1 |
- import{_ as l,$ as p,a0 as x,cp as It,co as re,t as T,cl as Bt,a as k,e4 as tt,aY as j,eP as oe,cK as ft,eQ as ie,dN as at,k as ae,g as Ot,a7 as Mt,cA as ue}from"./index.6c049565.js";import{o as le,c as ce,a as pe,x as ht,u as he,d as fe}from"./RasterSymbolizer.04994a43.js";import{r as me,g,h as de,o as Gt,i as Lt,k as ge,y as ye,w as xe,c as Vt,x as we}from"./pixelUtils.f4eba4af.js";let ut=class extends It{constructor(){super(...arguments),this.raster=void 0}};l([p({json:{write:!0}})],ut.prototype,"raster",void 0),ut=l([x("esri.layers.support.rasterFunctions.AspectFunctionArguments")],ut);const R=ut;var mt;let dt=mt=class extends R{clone(){return new mt({raster:this.raster})}};dt=mt=l([x("esri.layers.support.rasterFunctions.AspectFunctionArguments")],dt);const Ae=dt;let B=class extends It{constructor(){super(...arguments),this.functionArguments=null,this.readingBufferSize=0}bind(t,n=!1){const a=this._getRasterValues();for(let o=0;o<a.length;o++){const r=a[o];if(r&&typeof r=="object"&&"bind"in r&&(!r.rasterInfo||n)){const s=r.bind(t,n);if(!s.success)return s}}return!this.rasterInfo||n?(this.sourceRasterInfos=this._getSourceRasterInfos(t),this._bindSourceRasters()):{success:!0}}process(t){const n=this._getRasterValues().map(a=>this._readRasterValue(a,t));return this._processPixels({...t,pixelBlocks:n})}getPrimaryRasters(){const t=[],n=[];return this._getPrimaryRasters(this,t,n),{rasters:t,rasterIds:n}}_getOutputPixelType(t){var n;return this.outputPixelType==="unknown"?t:(n=this.outputPixelType)!=null?n:t}_getRasterValues(){const{rasterArgumentNames:t}=this;return t[0]==="rasters"&&Array.isArray(this.functionArguments.rasters)?this.functionArguments.rasters:t.map(n=>this.functionArguments[n])}_getSourceRasterInfos(t){const n=this._getRasterValues(),{rasterInfos:a,rasterIds:o}=t;return n.map(r=>r&&typeof r=="object"&&"bind"in r&&r.rasterInfo?r.rasterInfo:typeof r=="string"&&o.includes(r)?a[o.indexOf(r)]:a[0])}_getPrimaryRasterId(t){return t==null?void 0:t.url}_getPrimaryRasters(t,n=[],a=[]){for(let o=0;o<t.sourceRasters.length;o++){const r=t.sourceRasters[o];if(typeof r!="number")if("bind"in r)this._getPrimaryRasters(r,n,a);else{const s=r,i=this._getPrimaryRasterId(s);if(i==null)continue;a.includes(i)||(this.mainPrimaryRasterId===i?(n.unshift(s),a.unshift(i)):(n.push(s),a.push(i)))}}}_readRasterValue(t,n){const{primaryPixelBlocks:a}=n;if(T(t)||t==="$$"){const o=a[0];return T(o)?null:o.clone()}if(typeof t=="string"){const o=n.primaryRasterIds.indexOf(t);return o===-1?null:a[o]}if(typeof t=="number"){const o=a[0];if(T(o))return null;const r=new Float32Array(o.width*o.height);r.fill(t);const s=o.clone();return s.pixels=s.pixels.map(()=>r),s}return t.process(n)}};l([p({json:{write:!0}})],B.prototype,"functionName",void 0),l([p({json:{write:!0}})],B.prototype,"functionArguments",void 0),l([p()],B.prototype,"rasterArgumentNames",void 0),l([p({json:{write:!0}}),re(t=>t==null?void 0:t.toLowerCase())],B.prototype,"outputPixelType",void 0),l([p({json:{write:!0}})],B.prototype,"mainPrimaryRasterId",void 0),l([p()],B.prototype,"sourceRasters",void 0),l([p({json:{write:!0}})],B.prototype,"sourceRasterInfos",void 0),l([p({json:{write:!0}})],B.prototype,"rasterInfo",void 0),l([p({json:{write:!0}})],B.prototype,"readingBufferSize",void 0),B=l([x("esri.layers.support.rasterFunctions.BaseRasterFunction")],B);const I=B;let C=class extends I{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,this.outputPixelType=this._getOutputPixelType("f32");const n=t.clone();return n.pixelType=this.outputPixelType,n.statistics=null,n.histograms=null,this.rasterInfo=n,{success:!0}}_processPixels(t){var r;const n=(r=t.pixelBlocks)==null?void 0:r[0];if(T(n))return null;const{extent:a}=t,o=a?{x:a.width/n.width,y:a.height/n.height}:{x:1,y:1};return le(n,{resolution:o})}};l([p({json:{write:!0,name:"rasterFunction"}})],C.prototype,"functionName",void 0),l([p({type:Ae,json:{write:!0,name:"rasterFunctionArguments"}})],C.prototype,"functionArguments",void 0),l([p()],C.prototype,"rasterArgumentNames",void 0),l([p({json:{write:!0}})],C.prototype,"isGCS",void 0),C=l([x("esri.layers.support.rasterFunctions.AspectFunction")],C);const ve=C,$e=new Set(["+","-","*","/","(",")"]);function Ne(t,n){(t=t.replace(/ /g,"")).startsWith("-")&&(t="0"+t),t.startsWith("+")&&(t=t.slice(1,t.length));const a=t.split(""),o=[],r=[];let s="";for(let i=0;i<a.length;i++){const e=a[i];if($e.has(e))s!==""&&r.push(parseFloat(s)),o.push(e),s="";else{if(e.toLowerCase()==="b"){i++,s=e.concat(a[i]),r.push(n[parseInt(s[1],10)-1]),s="";continue}s=s.concat(e),i===a.length-1&&r.push(parseFloat(s))}}return{ops:o,nums:r}}function Fe(t,n,a,o){if(typeof a=="number"&&typeof o=="number")return a+o;let r;if(typeof a=="number"){r=o.length;const i=a;(a=new Float32Array(r)).fill(i)}else if(r=a.length,o.constructor===Number){const i=o;(o=new Float32Array(r)).fill(i)}const s=new Float32Array(r);switch(n){case"+":for(let i=0;i<r;i++)(t==null||t[i])&&(s[i]=a[i]+o[i]);break;case"-":for(let i=0;i<r;i++)(t==null||t[i])&&(s[i]=a[i]-o[i]);break;case"*":for(let i=0;i<r;i++)(t==null||t[i])&&(s[i]=a[i]*o[i]);break;case"/":for(let i=0;i<r;i++)(t==null||t[i])&&o[i]&&(s[i]=a[i]/o[i]);break;case"(":case")":throw"encountered error with custom band index equation"}return s}function be(t,n){t.splice(n,1);let a=0,o=0;do{a=0,o=0;for(let r=0;r<t.length;r++)if(t[r]==="(")a=r;else if(t[r]===")"){o=r;break}o===a+1&&t.splice(a,2)}while(o===a+1);return t}function Se(t){if(t.length===1)return{opIndex:0,numIndex:0};let n=0,a=0;for(let i=0;i<t.length;i++)if(t[i]==="(")n=i;else if(t[i]===")"){a=i;break}const o=a===0?t:t.slice(n+1,a);let r=-1;for(let i=0;i<o.length;i++)if(o[i]==="*"||o[i]==="/"){r=i;break}if(r>-1)a>0&&(r+=n+1);else{for(let i=0;i<o.length;i++)if(o[i]==="+"||o[i]==="-"){r=i;break}a>0&&(r+=n+1)}let s=0;for(let i=0;i<r;i++)t[i]==="("&&s++;return{opIndex:r,numIndex:r-s}}function Te(t,n,a){let o,{ops:r,nums:s}=Ne(a,n);if(r.length===0){const i=s.length===1?s[0]:n[0];if(i instanceof Float32Array)return[i];const e=new Float32Array(n[0].length);return typeof i=="number"?e.fill(i):e.set(i),[e]}for(;r.length>0;){const{numIndex:i,opIndex:e}=Se(r);if(o=Fe(t,r[e],s[i],s[i+1]),r.length===1)break;r=be(r,e),s.splice(i,2,o)}return[o]}const Re=new Bt({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 Ie(t,n){var h;if(!me(t))return t;const{equation:a,method:o}=n,r=n.bandIndexes.map(f=>f-1),{pixels:s,mask:i}=t;let e;switch(o){case"gndvi":case"nbr":case"ndbi":case"ndvi":case"ndvi-re":case"ndsi":case"ndmi":case"mndwi":e=Dt(i,s[r[0]],s[r[1]]);break;case"ndwi":e=Dt(i,s[r[1]],s[r[0]]);break;case"sr":case"sr-re":case"iron-oxide":case"ferrous-minerals":case"clay-minerals":e=Pe(i,s[r[0]],s[r[1]]);break;case"ci-g":case"ci-re":e=ke(i,s[r[0]],s[r[1]]);break;case"savi":e=je(i,s[r[0]],s[r[1]],r[2]+1);break;case"tsavi":e=Me(i,s[r[0]],s[r[1]],r[2]+1,r[3]+1,r[4]+1);break;case"msavi":e=De(i,s[r[0]],s[r[1]]);break;case"gemi":e=Ce(i,s[r[0]],s[r[1]]);break;case"pvi":e=Ee(i,s[r[0]],s[r[1]],r[2]+1,r[3]+1);break;case"gvitm":e=_e(i,[s[r[0]],s[r[1]],s[r[2]],s[r[3]],s[r[4]],s[r[5]]]);break;case"sultan":e=Oe(i,[s[r[0]],s[r[1]],s[r[2]],s[r[3]],s[r[4]],s[r[5]]]);break;case"vari":e=Ge(i,[s[r[0]],s[r[1]],s[r[2]]]);break;case"mtvi2":e=Le(i,[s[r[0]],s[r[1]],s[r[2]]]);break;case"rtvi-core":e=Ve(i,[s[r[0]],s[r[1]],s[r[2]]]);break;case"evi":e=ze(i,[s[r[0]],s[r[1]],s[r[2]]]);break;case"wndwi":e=qe(i,[s[r[0]],s[r[1]],s[r[2]]],(h=r[3])!=null?h:.5);break;case"bai":e=He(i,s[r[0]],s[r[1]]);break;case"custom":e=Te(i,s,a);break;default:return t}const u=k(i)?new Uint8Array(i.length):null;k(i)&&k(u)&&u.set(i);const c=new g({width:t.width,height:t.height,pixelType:"f32",pixels:e,mask:u});return c.updateStatistics(),c}function Be(t,n,a,o){const{mask:r,pixels:s,width:i,height:e}=t,u=s[a],c=s[n],h=c.length,f=o?new Uint8Array(h):new Float32Array(h),m=o?100:1,v=o?100:0;for(let A=0;A<h;A++)if(r==null||r[A]){const F=u[A],kt=c[A],jt=F+kt;jt&&(f[A]=(F-kt)/jt*m+v)}const w=new g({width:i,height:e,mask:r,pixelType:o?"u8":"f32",pixels:[f]});return w.updateStatistics(),w}function Dt(t,n,a){const o=a.length,r=new Float32Array(o);for(let s=0;s<o;s++)if(t==null||t[s]){const i=n[s],e=a[s],u=i+e;u&&(r[s]=(i-e)/u)}return[r]}function Pe(t,n,a){const o=a.length,r=new Float32Array(o);for(let s=0;s<o;s++)if(t==null||t[s]){const i=n[s],e=a[s];e&&(r[s]=i/e)}return[r]}function ke(t,n,a){const o=n.length,r=new Float32Array(o);for(let s=0;s<o;s++)if(t==null||t[s]){const i=n[s],e=a[s];e&&(r[s]=i/e-1)}return[r]}function je(t,n,a,o){const r=a.length,s=new Float32Array(r);for(let i=0;i<r;i++)if(t==null||t[i]){const e=a[i],u=n[i],c=u+e+o;c&&(s[i]=(u-e)/c*(1+o))}return[s]}function Me(t,n,a,o,r,s){const i=a.length,e=new Float32Array(i),u=-r*o+s*(1+o*o);for(let c=0;c<i;c++)if(t==null||t[c]){const h=a[c],f=n[c],m=r*f+h+u;m&&(e[c]=o*(f-o*h-r)/m)}return[e]}function De(t,n,a){const o=a.length,r=new Float32Array(o);for(let s=0;s<o;s++)if(t==null||t[s]){const i=a[s],e=n[s];r[s]=.5*(2*(e+1)-Math.sqrt((2*e+1)**2-8*(e-i)))}return[r]}function Ce(t,n,a){const o=a.length,r=new Float32Array(o);for(let s=0;s<o;s++)if(t==null||t[s]){const i=a[s],e=n[s];if(i!==1){const u=(2*(e*e-i*i)+1.5*e+.5*i)/(e+i+.5);r[s]=u*(1-.25*u)-(i-.125)/(1-i)}}return[r]}function Ee(t,n,a,o,r){const s=a.length,i=new Float32Array(s),e=Math.sqrt(1+o*o);for(let u=0;u<s;u++)if(t==null||t[u]){const c=a[u],h=n[u];i[u]=(h-o*c-r)/e}return[i]}function _e(t,n){const[a,o,r,s,i,e]=n,u=a.length,c=new Float32Array(u);for(let h=0;h<u;h++)(t==null||t[h])&&(c[h]=-.2848*a[h]-.2435*o[h]-.5436*r[h]+.7243*s[h]+.084*i[h]-1.18*e[h]);return[c]}function Oe(t,n){const[a,,o,r,s,i]=n,e=a.length,u=new Float32Array(e),c=new Float32Array(e),h=new Float32Array(e);for(let f=0;f<e;f++)(t==null||t[f])&&(u[f]=i[f]?s[f]/i[f]*100:0,c[f]=a[f]?s[f]/a[f]*100:0,h[f]=r[f]?o[f]/r[f]*(s[f]/r[f])*100:0);return[u,c,h]}function Ge(t,n){const[a,o,r]=n,s=a.length,i=new Float32Array(s);for(let e=0;e<s;e++)if(t==null||t[e])for(e=0;e<s;e++){const u=a[e],c=o[e],h=c+u-r[e];h&&(i[e]=(c-u)/h)}return[i]}function Le(t,n){const[a,o,r]=n,s=a.length,i=new Float32Array(s);for(let e=0;e<s;e++)if(t==null||t[e])for(e=0;e<s;e++){const u=a[e],c=o[e],h=r[e],f=Math.sqrt((2*u+1)**2-6*u-5*Math.sqrt(c)-.5);i[e]=1.5*(1.2*(u-h)-2.5*(c-h))*f}return[i]}function Ve(t,n){const[a,o,r]=n,s=a.length,i=new Float32Array(s);for(let e=0;e<s;e++)if(t==null||t[e])for(e=0;e<s;e++){const u=a[e],c=o[e],h=r[e];i[e]=100*(u-c)-10*(u-h)}return[i]}function ze(t,n){const[a,o,r]=n,s=a.length,i=new Float32Array(s);for(let e=0;e<s;e++)if(t==null||t[e])for(e=0;e<s;e++){const u=a[e],c=o[e],h=u+6*c-7.5*r[e]+1;h&&(i[e]=2.5*(u-c)/h)}return[i]}function qe(t,n,a=.5){const[o,r,s]=n,i=r.length,e=new Float32Array(i);for(let u=0;u<i;u++)if(t==null||t[u])for(u=0;u<i;u++){const c=o[u],h=r[u],f=s[u],m=c+a*h+(1-a)*f;m&&(e[u]=(c-a*h-(1-a)*f)/m)}return[e]}function He(t,n,a){const o=a.length,r=new Float32Array(o);for(let s=0;s<o;s++)if(t==null||t[s])for(s=0;s<o;s++){const i=(.1-n[s])**2+(.06-a[s])**2;i&&(r[s]=1/i)}return[r]}var gt;let et=gt=class extends R{constructor(){super(...arguments),this.method="custom"}clone(){return new gt({method:this.method,bandIndexes:this.bandIndexes,raster:j(this.raster)})}};l([p({json:{type:String,write:!0}})],et.prototype,"bandIndexes",void 0),l([tt(Re)],et.prototype,"method",void 0),et=gt=l([x("esri.layers.support.rasterFunctions.BandArithmeticFunctionArguments")],et);const Ue=et;let U=class extends I{constructor(){super(...arguments),this.functionName="BandArithmetic",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){this.outputPixelType=this._getOutputPixelType("f32");const t=this.sourceRasterInfos[0],n=t.clone();return n.pixelType=this.outputPixelType,n.statistics=null,n.histograms=null,n.bandCount=this.functionArguments.method==="sultan"?t.bandCount:1,this.rasterInfo=n,{success:!0}}_processPixels(t){var s;const n=(s=t.pixelBlocks)==null?void 0:s[0];if(T(n))return n;const{method:a,bandIndexes:o}=this.functionArguments,r=o.split(" ").map(i=>parseFloat(i));return Ie(n,{method:a,bandIndexes:r,equation:o})}};l([p({json:{write:!0,name:"rasterFunction"}})],U.prototype,"functionName",void 0),l([p({type:Ue,json:{write:!0,name:"rasterFunctionArguments"}})],U.prototype,"functionArguments",void 0),l([p()],U.prototype,"rasterArgumentNames",void 0),U=l([x("esri.layers.support.rasterFunctions.BandArithmeticFunction")],U);const Xe=U;var yt;let M=yt=class extends R{readColorRamp(t){return ie(t)}clone(){var t;return new yt({colormap:j(this.colormap),colormapName:this.colormapName,colorRamp:(t=this.colorRamp)==null?void 0:t.clone(),colorRampName:this.colorRampName})}};l([p({type:[[Number]],json:{write:!0}})],M.prototype,"colormap",void 0),l([p({type:String,json:{write:!0}})],M.prototype,"colormapName",void 0),l([p({types:oe,json:{write:!0}})],M.prototype,"colorRamp",void 0),l([ft("colorRamp")],M.prototype,"readColorRamp",null),l([p({type:String,json:{write:!0}})],M.prototype,"colorRampName",void 0),M=yt=l([x("esri.layers.support.rasterFunctions.ColormapFunctionArguments")],M);const We=M;let E=class extends I{constructor(){super(...arguments),this.functionName="Colormap",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const t=this.sourceRasterInfos[0];if(t.bandCount>1)return{success:!1,error:"colormap-function: source data must be single band"};let{colormap:n,colorRamp:a}=this.functionArguments;if(n!=null&&n.length||a&&(n=ce(a,256,!0)),!(n!=null&&n.length))return{success:!1,error:"colormap-function: missing colormap argument"};this.outputPixelType=this._getOutputPixelType("u8");const o=t.clone();return o.pixelType=this.outputPixelType,o.colormap=n,this.rasterInfo=o,{success:!0}}_processPixels(t){var n;return(n=t.pixelBlocks)==null?void 0:n[0]}};l([p({json:{write:!0,name:"rasterFunction"}})],E.prototype,"functionName",void 0),l([p({type:We,json:{write:!0,name:"rasterFunctionArguments"}})],E.prototype,"functionArguments",void 0),l([p()],E.prototype,"rasterArgumentNames",void 0),l([p({json:{write:!0}})],E.prototype,"indexedColormap",void 0),E=l([x("esri.layers.support.rasterFunctions.ColormapFunction")],E);const Ye=E;var xt;let nt=xt=class extends R{writeRasters(t,n){n.rasters=t.map(a=>typeof a=="number"||typeof a=="string"?a:a.toJSON())}clone(){return new xt({rasters:j(this.rasters)})}};l([p({json:{write:!0}})],nt.prototype,"rasters",void 0),l([at("rasters")],nt.prototype,"writeRasters",null),nt=xt=l([x("esri.layers.support.rasterFunctions.CompositeBandFunctionArguments")],nt);const Je=nt;let X=class extends I{constructor(){super(...arguments),this.functionName="CompositeBand",this.functionArguments=null,this.rasterArgumentNames=["rasters"]}_bindSourceRasters(){const{sourceRasterInfos:t}=this,n=t[0];this.outputPixelType=this._getOutputPixelType(n.pixelType);const a=n.clone();if(a.attributeTable=null,a.colormap=null,a.pixelType=this.outputPixelType,a.bandCount=t.map(({bandCount:o})=>o).reduce((o,r)=>o+r),t.every(({statistics:o})=>k(o)&&o.length)){const o=[];t.forEach(({statistics:r})=>k(r)&&o.push(...r)),a.statistics=o}if(t.every(({histograms:o})=>k(o)&&o.length)){const o=[];t.forEach(({histograms:r})=>k(r)&&o.push(...r)),a.histograms=o}return this.rasterInfo=a,{success:!0}}_processPixels(t){const{pixelBlocks:n}=t;if(!n)return null;const a=n==null?void 0:n[0];return T(a)?null:de(n)}};l([p({json:{write:!0,name:"rasterFunction"}})],X.prototype,"functionName",void 0),l([p({type:Je,json:{write:!0,name:"rasterFunctionArguments"}})],X.prototype,"functionArguments",void 0),l([p()],X.prototype,"rasterArgumentNames",void 0),X=l([x("esri.layers.support.rasterFunctions.CompositeBandFunction")],X);const Ke=X;var y;(function(t){t[t.UserDefined=-1]="UserDefined",t[t.LineDetectionHorizontal=0]="LineDetectionHorizontal",t[t.LineDetectionVertical=1]="LineDetectionVertical",t[t.LineDetectionLeftDiagonal=2]="LineDetectionLeftDiagonal",t[t.LineDetectionRightDiagonal=3]="LineDetectionRightDiagonal",t[t.GradientNorth=4]="GradientNorth",t[t.GradientWest=5]="GradientWest",t[t.GradientEast=6]="GradientEast",t[t.GradientSouth=7]="GradientSouth",t[t.GradientNorthEast=8]="GradientNorthEast",t[t.GradientNorthWest=9]="GradientNorthWest",t[t.SmoothArithmeticMean=10]="SmoothArithmeticMean",t[t.Smoothing3x3=11]="Smoothing3x3",t[t.Smoothing5x5=12]="Smoothing5x5",t[t.Sharpening3x3=13]="Sharpening3x3",t[t.Sharpening5x5=14]="Sharpening5x5",t[t.Laplacian3x3=15]="Laplacian3x3",t[t.Laplacian5x5=16]="Laplacian5x5",t[t.SobelHorizontal=17]="SobelHorizontal",t[t.SobelVertical=18]="SobelVertical",t[t.Sharpen=19]="Sharpen",t[t.Sharpen2=20]="Sharpen2",t[t.PointSpread=21]="PointSpread",t[t.None=255]="None"})(y||(y={}));const $=new Map;function Qe(t){const n=Math.sqrt(t.length),a=t.slice(0,n),o=[1];for(let r=1;r<n;r++){let s=null;for(let i=0;i<n;i++){const e=t[i+r*n],u=t[i];if(s==null)if(u===0){if(e)return{separable:!1,row:null,col:null}}else s=e/u;else if(e/u!==s)return{separable:!1,row:null,col:null}}if(s==null)return{separable:!1,row:null,col:null};o.push(s)}return{separable:!0,row:a,col:o}}function Ct(t,n,a,o,r,s,i){const e=new Float32Array(n*a),u=s.length,c=i?0:o,h=i?o:0,f=i?1:n;for(let m=c;m<a-c;m++){const v=m*n;for(let w=h;w<n-h;w++){if(r&&!r[v+w])continue;let A=0;for(let F=0;F<u;F++)A+=t[v+w+(F-o)*f]*s[F];e[v+w]=A}}return e}function Ze(t,n,a,o,r,s,i){const e=new Float32Array(n*a),u=Math.floor(o/2),c=Math.floor(r/2);for(let h=u;h<a-u;h++){const f=h*n;for(let m=c;m<n-c;m++){if(s&&!s[f+m])continue;let v=0;for(let w=0;w<o;w++)for(let A=0;A<r;A++)v+=t[f+m+(w-u)*n+A-c]*i[w*r+A];e[f+m]=v}}return e}function tn(t,n,a=!0){const{pixels:o,width:r,height:s,pixelType:i,mask:e}=t,u=o.length,c=[],{kernel:h,rows:f,cols:m}=n;for(let v=0;v<u;v++){const w=Ze(o[v],r,s,f,m,e,h);a&&zt(w,r,s,f,m),c.push(w)}return new g({width:r,height:s,pixelType:i,pixels:c,mask:e})}function zt(t,n,a,o,r){const s=Math.floor(o/2);for(let e=0;e<s;e++)for(let u=0;u<n;u++)t[e*n+u]=t[(r-1-e)*n+u],t[(a-1-e)*n+u]=t[(a-r+e)*n+u];const i=Math.floor(r/2);for(let e=0;e<a;e++){const u=e*n;for(let c=0;c<i;c++)t[u+c]=t[u+r-1-c],t[u+n-c-1]=t[u+n+c-r]}}function en(t,n,a,o=!0){const{pixels:r,width:s,height:i,pixelType:e,mask:u}=t,c=r.length,h=[],f=n.length,m=a.length,v=Math.floor(f/2),w=Math.floor(m/2);for(let A=0;A<c;A++){let F=Ct(r[A],s,i,v,u,n,!0);F=Ct(F,s,i,w,u,a,!1),o&&zt(F,s,i,f,m),h.push(F)}return new g({width:s,height:i,pixelType:e,pixels:h,mask:u})}function nn(t,n){const a=Qe(n.kernel),o=n.mirrorEdges!==!1,r=a.separable?en(t,a.row,a.col,o):tn(t,n,o),{outputPixelType:s}=n;return s&&r.clamp(s),r}$.set(y.None,[0,0,0,0,1,0,0,0,0]),$.set(y.LineDetectionHorizontal,[-1,-1,-1,2,2,2,-1,-1,-1]),$.set(y.LineDetectionVertical,[-1,2,-1,-1,2,-1,-1,2,-1]),$.set(y.LineDetectionLeftDiagonal,[2,-1,-1,-1,2,-1,-1,-1,2]),$.set(y.LineDetectionRightDiagonal,[-1,-1,2,-1,2,-1,2,-1,-1]),$.set(y.GradientNorth,[-1,-2,-1,0,0,0,1,2,1]),$.set(y.GradientWest,[-1,0,1,-2,0,2,-1,0,1]),$.set(y.GradientEast,[1,0,-1,2,0,-2,1,0,-1]),$.set(y.GradientSouth,[1,2,1,0,0,0,-1,-2,-1]),$.set(y.GradientNorthEast,[0,-1,-2,1,0,-1,2,1,0]),$.set(y.GradientNorthWest,[-2,-1,0,-1,0,1,0,1,2]),$.set(y.SmoothArithmeticMean,[.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111]),$.set(y.Smoothing3x3,[.0625,.125,.0625,.125,.25,.125,.0625,.125,.0625]),$.set(y.Smoothing5x5,[1,1,1,1,1,1,4,4,4,1,1,4,12,4,1,1,4,4,4,1,1,1,1,1,1]),$.set(y.Sharpening3x3,[-1,-1,-1,-1,9,-1,-1,-1,-1]),$.set(y.Sharpening5x5,[-1,-3,-4,-3,-1,-3,0,6,0,-3,-4,6,21,6,-4,-3,0,6,0,-3,-1,-3,-4,-3,-1]),$.set(y.Laplacian3x3,[0,-1,0,-1,4,-1,0,-1,0]),$.set(y.Laplacian5x5,[0,0,-1,0,0,0,-1,-2,-1,0,-1,-2,17,-2,-1,0,-1,-2,-1,0,0,0,-1,0,0]),$.set(y.SobelHorizontal,[-1,-2,-1,0,0,0,1,2,1]),$.set(y.SobelVertical,[-1,0,1,-2,0,2,-1,0,1]),$.set(y.Sharpen,[0,-.25,0,-.25,2,-.25,0,-.25,0]),$.set(y.Sharpen2,[-.25,-.25,-.25,-.25,3,-.25,-.25,-.25,-.25]),$.set(y.PointSpread,[-.627,.352,-.627,.352,2.923,.352,-.627,.352,-.627]);var wt;let _=wt=class extends R{constructor(){super(...arguments),this.rows=3,this.cols=3,this.kernel=[0,0,0,0,1,0,0,0,0]}set kernelType(t){this._set("kernelType",t);const n=$.get(t);if(!n||t===y.UserDefined||t===y.None)return;const a=Math.sqrt(n.length);this._set("kernel",n),this._set("cols",a),this._set("rows",a)}clone(){return new wt({cols:this.cols,rows:this.rows,kernel:[...this.kernel],kernelType:this.kernelType,raster:j(this.raster)})}};l([p({json:{type:Number,write:!0}})],_.prototype,"rows",void 0),l([p({json:{type:Number,write:!0}})],_.prototype,"cols",void 0),l([p({json:{name:"type",type:Number,write:!0}})],_.prototype,"kernelType",null),l([p({json:{type:[Number],write:!0}})],_.prototype,"kernel",void 0),_=wt=l([x("esri.layers.support.rasterFunctions.ConvolutionFunctionArguments")],_);const sn=_;let W=class extends I{constructor(){super(...arguments),this.functionName="Convolution",this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const{kernelType:t,rows:n,cols:a,kernel:o}=this.functionArguments;if(!$.has(t))return{success:!1,error:`convolution-function: the specified kernel type is not supported ${t}`};if(t!==y.None&&n*a!==o.length)return{success:!1,error:"convolution-function: the specified rows and cols do not match the length of the kernel"};const r=this.sourceRasterInfos[0];this.outputPixelType=this._getOutputPixelType(r.pixelType);const s=r.clone();s.pixelType=this.outputPixelType;const i=[y.None,y.Sharpen,y.Sharpen2,y.Sharpening3x3,y.Sharpening5x5];return this.outputPixelType==="u8"||i.includes(t)||(s.statistics=null,s.histograms=null),this.rasterInfo=s,{success:!0}}_processPixels(t){var i;const n=(i=t.pixelBlocks)==null?void 0:i[0];if(T(n)||this.functionArguments.kernelType===y.None)return n;let{kernel:a,rows:o,cols:r}=this.functionArguments;const s=a.reduce((e,u)=>e+u);return s!==0&&s!==1&&(a=a.map(e=>e/s)),nn(n,{kernel:a,rows:o,cols:r,outputPixelType:this.outputPixelType})}};l([p({json:{write:!0,name:"rasterFunction"}})],W.prototype,"functionName",void 0),l([p({type:sn,json:{write:!0,name:"rasterFunctionArguments"}})],W.prototype,"functionArguments",void 0),l([p()],W.prototype,"rasterArgumentNames",void 0),W=l([x("esri.layers.support.rasterFunctions.ConvolutionFunction")],W);const rn=W;var At;let st=At=class extends R{constructor(){super(...arguments),this.bandIDs=[],this.missingBandAction=Gt.bestMatch}clone(){return new At({bandIDs:[...this.bandIDs],missingBandAction:this.missingBandAction})}};l([p({json:{write:!0}})],st.prototype,"bandIDs",void 0),l([p({json:{write:!0}})],st.prototype,"missingBandAction",void 0),st=At=l([x("esri.layers.support.rasterFunctions.ExtractBandFunctionArguments")],st);const on=st;let Y=class extends I{constructor(){super(...arguments),this.functionName="ExtractBand",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const{sourceRasterInfos:t}=this,n=t[0],{bandCount:a}=n,{bandIDs:o,missingBandAction:r}=this.functionArguments;if(r===Gt.fail&&o.some(u=>u<0||u>=a))return{success:!1,error:"extract-band-function: invalid bandIDs"};this.outputPixelType=this._getOutputPixelType("f32");const s=n.clone();s.pixelType=this.outputPixelType;const{statistics:i,histograms:e}=s;return k(i)&&i.length&&(s.statistics=o.map(u=>i[u]||i[i.length-1])),k(e)&&e.length&&(s.histograms=o.map(u=>e[u]||e[e.length-1])),this.rasterInfo=s,{success:!0}}_processPixels(t){var r;const n=(r=t.pixelBlocks)==null?void 0:r[0];if(T(n))return null;const a=n.pixels.length,o=this.functionArguments.bandIDs.map(s=>s>=a?a-1:s);return n.extractBands(o)}};l([p({json:{write:!0,name:"rasterFunction"}})],Y.prototype,"functionName",void 0),l([p({type:on,json:{write:!0,name:"rasterFunctionArguments"}})],Y.prototype,"functionArguments",void 0),l([p()],Y.prototype,"rasterArgumentNames",void 0),Y=l([x("esri.layers.support.rasterFunctions.ExtractBandFunction")],Y);const an=Y;var vt;let O=vt=class extends R{constructor(){super(...arguments),this.rasters=[],this.processAsMultiband=!1}writeRasters(t,n){n.rasters=t.map(a=>typeof a=="number"||typeof a=="string"?a:a.toJSON())}clone(){return new vt({method:this.operation,processAsMultiband:this.processAsMultiband,rasters:j(this.rasters)})}};l([p({json:{write:!0}})],O.prototype,"operation",void 0),l([p({json:{write:!0}})],O.prototype,"rasters",void 0),l([at("rasters")],O.prototype,"writeRasters",null),l([p({json:{write:!0}})],O.prototype,"processAsMultiband",void 0),O=vt=l([x("esri.layers.support.rasterFunctions.LocalFunctionArguments")],O);const un=O;var ct;(function(t){t[t.Plus=1]="Plus",t[t.Minus=2]="Minus",t[t.Times=3]="Times",t[t.SquareRoot=4]="SquareRoot",t[t.Power=5]="Power",t[t.ACos=6]="ACos",t[t.ASin=7]="ASin",t[t.ATan=8]="ATan",t[t.ATanH=9]="ATanH",t[t.Abs=10]="Abs",t[t.BitwiseAnd=11]="BitwiseAnd",t[t.BitwiseLeftShift=12]="BitwiseLeftShift",t[t.BitwiseNot=13]="BitwiseNot",t[t.BitwiseOr=14]="BitwiseOr",t[t.BitwiseRightShift=15]="BitwiseRightShift",t[t.BitwiseXOr=16]="BitwiseXOr",t[t.BooleanAnd=17]="BooleanAnd",t[t.BooleanNot=18]="BooleanNot",t[t.BooleanOr=19]="BooleanOr",t[t.BooleanXOr=20]="BooleanXOr",t[t.Cos=21]="Cos",t[t.CosH=22]="CosH",t[t.Divide=23]="Divide",t[t.EqualTo=24]="EqualTo",t[t.Exp=25]="Exp",t[t.Exp10=26]="Exp10",t[t.Exp2=27]="Exp2",t[t.GreaterThan=28]="GreaterThan",t[t.GreaterThanEqual=29]="GreaterThanEqual",t[t.Int=30]="Int",t[t.IsNull=31]="IsNull",t[t.Float=32]="Float",t[t.LessThan=33]="LessThan",t[t.LessThanEqual=34]="LessThanEqual",t[t.Ln=35]="Ln",t[t.Log10=36]="Log10",t[t.Log2=37]="Log2",t[t.Majority=38]="Majority",t[t.Max=39]="Max",t[t.Mean=40]="Mean",t[t.Med=41]="Med",t[t.Min=42]="Min",t[t.Minority=43]="Minority",t[t.Mod=44]="Mod",t[t.Negate=45]="Negate",t[t.NotEqual=46]="NotEqual",t[t.Range=47]="Range",t[t.RoundDown=48]="RoundDown",t[t.RoundUp=49]="RoundUp",t[t.SetNull=50]="SetNull",t[t.Sin=51]="Sin",t[t.SinH=52]="SinH",t[t.Square=53]="Square",t[t.Std=54]="Std",t[t.Sum=55]="Sum",t[t.Tan=56]="Tan",t[t.TanH=57]="TanH",t[t.Variety=58]="Variety",t[t.ACosH=59]="ACosH",t[t.ASinH=60]="ASinH",t[t.ATan2=61]="ATan2",t[t.FloatDivide=64]="FloatDivide",t[t.FloorDivide=65]="FloorDivide",t[t.MajorityIgnoreNoData=66]="MajorityIgnoreNoData",t[t.MaxIgnoreNoData=67]="MaxIgnoreNoData",t[t.MeanIgnoreNoData=68]="MeanIgnoreNoData",t[t.MedIgnoreNoData=69]="MedIgnoreNoData",t[t.MinIgnoreNoData=70]="MinIgnoreNoData",t[t.MinorityIgnoreNoData=71]="MinorityIgnoreNoData",t[t.RangeIgnoreNoData=72]="RangeIgnoreNoData",t[t.StdIgnoreNoData=73]="StdIgnoreNoData",t[t.SumIgnoreNoData=74]="SumIgnoreNoData",t[t.VarietyIgnoreNoData=75]="VarietyIgnoreNoData",t[t.Con=76]="Con"})(ct||(ct={}));function ln(t){const n=t.map(i=>i.mask).filter(i=>k(i));if(n.length===0)return null;const a=n[0].length,o=new Uint8Array(a);if(n.length===1)return o.set(n[0]),o;let r,s=n[0];for(let i=1;i<n.length;i++){r=n[i];for(let e=0;e<a;e++)o[e]=s[e]|r[e];s=r}return o}function cn(t,n,a){const[o,r]=t,s=o.length,i=g.createEmptyBand(a,s);for(let e=0;e<s;e++)n&&!n[e]||(i[e]=o[e]+r[e]);return i}function pn(t,n,a){const[o]=t,r=o.length,s=g.createEmptyBand("f32",r);return s.set(o),s}function hn(t,n,a){const[o,r]=t,s=o.length,i=g.createEmptyBand(a,s);for(let e=0;e<s;e++)n&&!n[e]||(i[e]=o[e]-r[e]);return i}function fn(t,n,a){const[o,r]=t,s=o.length,i=g.createEmptyBand(a,s);for(let e=0;e<s;e++)n&&!n[e]||(i[e]=o[e]*r[e]);return i}function qt(t,n,a){const[o,r]=t,s=o.length,i=g.createEmptyBand(a,s);for(let e=0;e<s;e++)n&&!n[e]||(i[e]=r[e]===0?0:o[e]/r[e]);return i}function mn(t,n,a){return qt(t,n,"f32")}function dn(t,n,a){const[o,r]=t,s=o.length,i=g.createEmptyBand(a,s);for(let e=0;e<s;e++)n&&!n[e]||(i[e]=r[e]===0?0:Math.floor(o[e]/r[e]));return i}function gn(t,n,a,o){const[r]=t,s=r.length,i=g.createEmptyBand(a,s);for(let e=0;e<s;e++)n&&!n[e]||(i[e]=o(r[e]));return i}function yn(t,n,a,o){const[r,s]=t,i=r.length,e=g.createEmptyBand(a,i);for(let u=0;u<i;u++)n&&!n[u]||(e[u]=o(r[u],s[u]));return e}function xn(t,n,a){const[o,r]=t,s=o.length,i=g.createEmptyBand(a,s);for(let e=0;e<s;e++)n&&!n[e]||(i[e]=o[e]&r[e]);return i}function Et(t,n,a){const[o,r]=t,s=o.length,i=g.createEmptyBand(a,s);for(let e=0;e<s;e++)n&&!n[e]||(i[e]=o[e]<<r[e]);return i}function wn(t,n,a){const[o]=t,r=o.length,s=g.createEmptyBand(a,r);for(let i=0;i<r;i++)n&&!n[i]||(s[i]=~o[i]);return s}function An(t,n,a){const[o,r]=t,s=o.length,i=g.createEmptyBand(a,s);for(let e=0;e<s;e++)n&&!n[e]||(i[e]=o[e]|r[e]);return i}function vn(t,n,a){const[o,r]=t,s=o.length,i=g.createEmptyBand(a,s);for(let e=0;e<s;e++)n&&!n[e]||(i[e]=o[e]>>r[e]);return i}function $n(t,n,a){const[o,r]=t,s=o.length,i=g.createEmptyBand(a,s);for(let e=0;e<s;e++)n&&!n[e]||(i[e]=o[e]^r[e]);return i}function Nn(t,n,a){const[o,r]=t,s=o.length,i=g.createEmptyBand(a,s);for(let e=0;e<s;e++)n&&!n[e]||(i[e]=o[e]&&r[e]?1:0);return i}function Fn(t,n,a){const[o]=t,r=o.length,s=g.createEmptyBand(a,r);for(let i=0;i<r;i++)n&&!n[i]||(s[i]=o[i]?0:1);return s}function bn(t,n,a){const[o,r]=t,s=o.length,i=g.createEmptyBand(a,s);for(let e=0;e<s;e++)n&&!n[e]||(i[e]=o[e]||r[e]?1:0);return i}function Sn(t,n,a){const[o,r]=t,s=o.length,i=g.createEmptyBand(a,s);for(let e=0;e<s;e++)n&&!n[e]||(i[e]=(o[e]?1:0)^(r[e]?1:0));return i}function Tn(t,n,a){const[o,r]=t,s=o.length,i=g.createEmptyBand(a,s);for(let e=0;e<s;e++)n&&!n[e]||(i[e]=o[e]===r[e]?1:0);return i}function Ht(t,n,a,o){const[r]=t,s=r.length,i=g.createEmptyBand(a,s);for(let e=0;e<s;e++)n&&!n[e]||(i[e]=o**r[e]);return i}function Rn(t,n,a){return Ht(t,n,a,10)}function In(t,n,a){return Ht(t,n,a,2)}function Bn(t,n,a){const[o,r]=t,s=o.length,i=g.createEmptyBand(a,s);for(let e=0;e<s;e++)n&&!n[e]||(i[e]=o[e]>r[e]?1:0);return i}function Pn(t,n,a){const[o,r]=t,s=o.length,i=g.createEmptyBand(a,s);for(let e=0;e<s;e++)n&&!n[e]||(i[e]=o[e]>=r[e]?1:0);return i}function kn(t,n,a){const[o,r]=t,s=o.length,i=g.createEmptyBand(a,s);for(let e=0;e<s;e++)n&&!n[e]||(i[e]=o[e]<r[e]?1:0);return i}function jn(t,n,a){const[o,r]=t,s=o.length,i=g.createEmptyBand(a,s);for(let e=0;e<s;e++)n&&!n[e]||(i[e]=o[e]<=r[e]?1:0);return i}function Mn(t,n,a){const[o]=t,r=o.length,s=g.createEmptyBand(a,r);if(!n)return s;for(let i=0;i<r;i++)s[i]=n[i]?0:1;return s}function Dn(t,n,a){const[o,r]=t,s=o.length,i=g.createEmptyBand(a,s);for(let e=0;e<s;e++)n&&!n[e]||(i[e]=o[e]%r[e]);return i}function Cn(t,n,a){const[o]=t,r=o.length,s=g.createEmptyBand(a,r);for(let i=0;i<r;i++)n&&!n[i]||(s[i]=-o[i]);return s}function En(t,n,a){const[o,r]=t,s=o.length,i=g.createEmptyBand(a,s);for(let e=0;e<s;e++)n&&!n[e]||(i[e]=o[e]===r[e]?0:1);return i}function _n(t,n,a){const[o,r]=t,s=o.length,i=g.createEmptyBand(a,s),e=new Uint8Array(s);for(let u=0;u<s;u++)n!=null&&!n[u]||o[u]!==0||(i[u]=r[u],e[u]=255);return{band:i,mask:e}}function On(t,n,a){const[o,r,s]=t,i=o.length,e=g.createEmptyBand(a,i);for(let u=0;u<i;u++)n&&!n[u]||(e[u]=o[u]?r[u]:s[u]);return e}function Ut(t,n,a){const o=t.length;if(o<2)return t[0];const[r]=t,s=r.length,i=g.createEmptyBand(a,s);i.set(r);for(let e=0;e<s;e++)if(!n||n[e])for(let u=1;u<o;u++){const c=t[u];i[e]<c[e]&&(i[e]=c[e])}return i}function Xt(t,n,a){const o=t.length;if(o<2)return t[0];const[r]=t,s=r.length,i=g.createEmptyBand(a,s);i.set(r);for(let e=0;e<s;e++)if(!n||n[e])for(let u=1;u<o;u++){const c=t[u];i[e]>c[e]&&(i[e]=c[e])}return i}function Wt(t,n,a){const o=t.length;if(o<2)return t[0];const[r]=t,s=r.length,i=g.createEmptyBand(a,s);i.set(r);for(let e=0;e<s;e++)if(!n||n[e]){let u=i[e];for(let c=1;c<o;c++){const h=t[c];i[e]<h[e]&&(i[e]=h[e]),u>h[e]&&(u=h[e])}i[e]-=u}return i}function Yt(t,n,a){const o=t.length;if(o<2)return t[0];const[r]=t,s=r.length,i=g.createEmptyBand(a,s);i.set(r);for(let e=0;e<s;e++)if(!n||n[e]){for(let u=1;u<o;u++){const c=t[u];i[e]+=c[e]}i[e]/=o}return i}function Jt(t,n,a){const o=t.length;if(o<2)return t[0];const[r]=t,s=r.length,i=g.createEmptyBand(a,s);i.set(r);for(let e=0;e<s;e++)if(!n||n[e])for(let u=1;u<o;u++){const c=t[u];i[e]+=c[e]}return i}function Kt(t,n,a){const o=t.length;if(o<2)return t[0];const[r]=t,s=r.length,i=g.createEmptyBand(a,s);for(let e=0;e<s;e++)if(!n||n[e]){const u=new Float32Array(o);let c=0;for(let f=0;f<o;f++){const m=t[f];c+=m[e],u[f]=m[e]}c/=o;let h=0;for(let f=0;f<o;f++)h+=(u[f]-c)*u[f]-c;i[e]=Math.sqrt(h/o-1)}return i}function Qt(t,n,a){const o=t.length;if(o<2)return t[0];const r=Math.floor(o/2),[s]=t,i=s.length,e=g.createEmptyBand(a,i),u=new Float32Array(o);for(let c=0;c<i;c++)if(!n||n[c]){for(let h=0;h<o;h++)u[h]=t[h][c];u.sort(),e[c]=u[r]}return e}function Zt(t,n,a){const o=t.length;if(o<2)return t[0];const[r]=t,s=r.length,i=g.createEmptyBand(a,s),e=new Map;for(let u=0;u<s;u++)if(!n||n[u]){let c;e.clear();for(let m=0;m<o;m++)c=t[m][u],e.set(c,e.has(c)?e.get(c)+1:1);let h=0,f=0;for(const m of e.keys())h=e.get(m),h>f&&(f=h,c=m);i[u]=c}return i}function te(t,n,a){const o=t.length;if(o<2)return t[0];const[r]=t,s=r.length,i=g.createEmptyBand(a,s),e=new Map;for(let u=0;u<s;u++)if(!n||n[u]){let c;e.clear();for(let m=0;m<o;m++)c=t[m][u],e.set(c,e.has(c)?e.get(c)+1:1);let h=0,f=t.length;for(const m of e.keys())h=e.get(m),h<f&&(f=h,c=m);i[u]=c}return i}function ee(t,n,a){const o=t.length;if(o<2)return t[0];const[r]=t,s=r.length,i=g.createEmptyBand(a,s),e=new Set;for(let u=0;u<s;u++)if(!n||n[u]){let c;e.clear();for(let h=0;h<o;h++)c=t[h][u],e.add(c);i[u]=e.size}return i}function Gn(t,n,a){return Zt(t,null,a)}function Ln(t,n,a){return te(t,null,a)}function Vn(t,n,a){return ee(t,null,a)}function zn(t,n,a){return Ut(t,null,a)}function qn(t,n,a){return Xt(t,null,a)}function Hn(t,n,a){return Kt(t,null,a)}function Un(t,n,a){return Jt(t,null,a)}function Xn(t,n,a){return Yt(t,null,a)}function Wn(t,n,a){return Qt(t,null,a)}function Yn(t,n,a){return Wt(t,null,a)}const N=new Map,pt=new Map,d=new Map;function Jn(){N.size||(N.set(4,Math.sqrt),N.set(6,Math.acos),N.set(7,Math.asin),N.set(8,Math.atan),N.set(9,Math.atanh),N.set(10,Math.abs),N.set(21,Math.cos),N.set(22,Math.cosh),N.set(25,Math.exp),N.set(30,Math.floor),N.set(35,Math.log),N.set(36,Math.log10),N.set(37,Math.log2),N.set(48,Math.floor),N.set(49,Math.ceil),N.set(51,Math.sin),N.set(52,Math.sinh),N.set(56,Math.tan),N.set(57,Math.tanh),N.set(59,Math.acosh),N.set(60,Math.asinh),N.set(65,Math.floor),pt.set(5,Math.pow),pt.set(61,Math.atan2),d.set(1,cn),d.set(2,hn),d.set(3,fn),d.set(11,xn),d.set(12,Et),d.set(12,Et),d.set(13,wn),d.set(14,An),d.set(15,vn),d.set(16,$n),d.set(17,Nn),d.set(18,Fn),d.set(19,bn),d.set(20,Sn),d.set(23,qt),d.set(24,Tn),d.set(26,Rn),d.set(27,In),d.set(28,Bn),d.set(29,Pn),d.set(31,Mn),d.set(32,pn),d.set(33,kn),d.set(34,jn),d.set(44,Dn),d.set(45,Cn),d.set(46,En),d.set(64,mn),d.set(65,dn),d.set(76,On),d.set(38,Zt),d.set(39,Ut),d.set(40,Yt),d.set(41,Qt),d.set(42,Xt),d.set(43,te),d.set(47,Wt),d.set(54,Kt),d.set(55,Jt),d.set(58,ee),d.set(66,Gn),d.set(67,zn),d.set(68,Xn),d.set(69,Wn),d.set(70,qn),d.set(71,Ln),d.set(72,Yn),d.set(73,Hn),d.set(74,Un),d.set(75,Vn))}function Kn(t,n,a={}){Jn();const o=ae(ln(t)),{processAsMultiband:r,outputPixelType:s="f32"}=a,i=r?t[0].pixels.length:1,e=[];let u;for(let h=0;h<i;h++){const f=t.map(v=>v.pixels[h]);let m;if(n===ct.SetNull){const v=_n(f,o,s);m=v.band,u=v.mask}else d.has(n)?m=d.get(n)(f,o,s):N.has(n)?m=gn(f,o,s,N.get(n)):pt.has(n)&&(m=yn(f,o,s,pt.get(n)));if(m==null)return null;e.push(m)}u||n===ct.IsNull||(u=o);const c=t[0];return new g({width:c.width,height:c.height,pixelType:s,mask:u,pixels:e})}let J=class extends I{constructor(){super(...arguments),this.functionName="Local",this.functionArguments=null,this.rasterArgumentNames=["rasters"]}_bindSourceRasters(){const{sourceRasterInfos:t}=this,n=t[0],{bandCount:a}=n,{processAsMultiband:o}=this.functionArguments;if(o&&t.some(s=>s.bandCount!==a))return{success:!1,error:"local-function: input rasters do not have same band count"};this.outputPixelType=this._getOutputPixelType("f32");const r=n.clone();return r.pixelType=this.outputPixelType,r.statistics=null,r.histograms=null,o||(r.bandCount=1),this.rasterInfo=r,{success:!0}}_processPixels(t){var a;const{pixelBlocks:n}=t;return T(n)||n.some(o=>T(o))?null:Kn(n,this.functionArguments.operation,{processAsMultiband:this.functionArguments.processAsMultiband,outputPixelType:(a=this.outputPixelType)!=null?a:void 0})}};l([p({json:{write:!0,name:"rasterFunction"}})],J.prototype,"functionName",void 0),l([p({type:un,json:{write:!0,name:"rasterFunctionArguments"}})],J.prototype,"functionArguments",void 0),l([p()],J.prototype,"rasterArgumentNames",void 0),J=l([x("esri.layers.support.rasterFunctions.LocalFunction")],J);const Qn=J;var $t;let K=$t=class extends R{constructor(){super(...arguments),this.includedRanges=null,this.noDataValues=null,this.noDataInterpretation=Lt.matchAny}clone(){var t,n,a,o;return new $t({includedRanges:(n=(t=this.includedRanges)==null?void 0:t.slice())!=null?n:[],noDataValues:(o=(a=this.noDataValues)==null?void 0:a.slice())!=null?o:[],noDataInterpretation:this.noDataInterpretation})}};l([p({json:{write:!0}})],K.prototype,"includedRanges",void 0),l([p({json:{write:!0}})],K.prototype,"noDataValues",void 0),l([p({json:{write:!0}})],K.prototype,"noDataInterpretation",void 0),K=$t=l([x("esri.layers.support.rasterFunctions.MaskFunctionArguments")],K);const Zn=K;let G=class extends I{constructor(){super(...arguments),this.functionName="Mask",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.lookup=null}_bindSourceRasters(){const t=this.sourceRasterInfos[0].clone(),{pixelType:n}=t;this.outputPixelType=this._getOutputPixelType(n),t.pixelType=this.outputPixelType,this.rasterInfo=t;const{includedRanges:a,noDataValues:o}=this.functionArguments;return(a==null?void 0:a.length)||(o==null?void 0:o.length)?(this.lookup=ge(n,this.functionArguments.includedRanges,this.functionArguments.noDataValues),{success:!0}):{success:!1,error:"missing includedRanges or noDataValues argument"}}_processPixels(t){var u;const n=(u=t.pixelBlocks)==null?void 0:u[0];if(T(n))return null;const{outputPixelType:a,lookup:o}=this,{includedRanges:r,noDataValues:s,noDataInterpretation:i}=this.functionArguments,e=i===Lt.matchAll;return ye(n,{includedRanges:r,noDataValues:s,outputPixelType:a,matchAll:e,lookup:o})}};l([p({json:{write:!0,name:"rasterFunction"}})],G.prototype,"functionName",void 0),l([p({type:Zn,json:{write:!0,name:"rasterFunctionArguments"}})],G.prototype,"functionArguments",void 0),l([p()],G.prototype,"rasterArgumentNames",void 0),l([p({json:{write:!0}})],G.prototype,"lookup",void 0),G=l([x("esri.layers.support.rasterFunctions.MaskFunction")],G);const ts=G;var Nt;let Q=Nt=class extends R{constructor(){super(...arguments),this.visibleBandID=0,this.infraredBandID=1,this.scaled=!0}clone(){const{visibleBandID:t,infraredBandID:n,scaled:a}=this;return new Nt({visibleBandID:t,infraredBandID:n,scaled:a})}};l([p({json:{write:!0}})],Q.prototype,"visibleBandID",void 0),l([p({json:{write:!0}})],Q.prototype,"infraredBandID",void 0),l([p({json:{write:!0}})],Q.prototype,"scaled",void 0),Q=Nt=l([x("esri.layers.support.rasterFunctions.NDVIFunctionArguments")],Q);const es=Q;let Z=class extends I{constructor(){super(...arguments),this.functionName="NDVI",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const{scaled:t}=this.functionArguments;this.outputPixelType=this._getOutputPixelType(t?"u8":"f32");const n=this.sourceRasterInfos[0].clone();n.pixelType=this.outputPixelType,n.colormap=null,n.histograms=null;const[a,o,r,s]=t?[0,200,100,10]:[-1,1,0,.1];return n.statistics=[{min:a,max:o,avg:r,stddev:s}],this.rasterInfo=n,{success:!0}}_processPixels(t){var s;const n=(s=t.pixelBlocks)==null?void 0:s[0];if(T(n))return null;const{visibleBandID:a,infraredBandID:o,scaled:r}=this.functionArguments;return Be(n,a,o,r)}};l([p({json:{write:!0,name:"rasterFunction"}})],Z.prototype,"functionName",void 0),l([p({type:es,json:{write:!0,name:"rasterFunctionArguments"}})],Z.prototype,"functionArguments",void 0),l([p()],Z.prototype,"rasterArgumentNames",void 0),Z=l([x("esri.layers.support.rasterFunctions.NDVIFunction")],Z);const ns=Z;var Ft;let L=Ft=class extends R{constructor(){super(...arguments),this.inputRanges=null,this.outputValues=null,this.noDataRanges=null,this.allowUnmatched=!1}clone(){return new Ft({inputRanges:[...this.inputRanges],outputValues:[...this.outputValues],noDataRanges:[...this.noDataRanges],allowUnmatched:this.allowUnmatched})}};l([p({json:{write:!0}})],L.prototype,"inputRanges",void 0),l([p({json:{write:!0}})],L.prototype,"outputValues",void 0),l([p({json:{write:!0}})],L.prototype,"noDataRanges",void 0),l([p({json:{write:!0}})],L.prototype,"allowUnmatched",void 0),L=Ft=l([x("esri.layers.support.rasterFunctions.RemapFunctionArguments")],L);const ss=L;let V=class extends I{constructor(){super(...arguments),this.functionName="Remap",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.lookup=null}_bindSourceRasters(){const t=this.sourceRasterInfos[0].clone(),{pixelType:n}=t;this.outputPixelType=this._getOutputPixelType(n),t.pixelType=this.outputPixelType,t.colormap=null,t.histograms=null;const{statistics:a}=t,{allowUnmatched:o,outputValues:r}=this.functionArguments;if(k(a)&&a.length&&!o){let s=r[0],i=s;for(let e=0;e<r.length;e++)s=s>r[e]?r[e]:s,i=i>r[e]?i:r[e];for(let e=0;e<a.length;e++)a[e]={...a[e],min:s,max:i}}return this.rasterInfo=t,this.lookup=o?null:xe(n,this.functionArguments.inputRanges,r),{success:!0}}_processPixels(t){var u;const n=(u=t.pixelBlocks)==null?void 0:u[0];if(T(n))return null;const{lookup:a,outputPixelType:o}=this;if(a)return Vt(n,{lut:[a.lut],offset:a.offset,outputPixelType:o});const{inputRanges:r,outputValues:s,noDataRanges:i,allowUnmatched:e}=this.functionArguments;return we(n,{inputRanges:r,outputValues:s,noDataRanges:i,allowUnmatched:e,outputPixelType:o})}};l([p({json:{write:!0,name:"rasterFunction"}})],V.prototype,"functionName",void 0),l([p({type:ss,json:{write:!0,name:"rasterFunctionArguments"}})],V.prototype,"functionArguments",void 0),l([p()],V.prototype,"rasterArgumentNames",void 0),l([p({json:{write:!0}})],V.prototype,"lookup",void 0),V=l([x("esri.layers.support.rasterFunctions.RemapFunction")],V);const rs=V;var bt;const os=new Bt({0:"degree",1:"percent-rise",2:"adjusted"},{useNumericKeys:!0});let z=bt=class extends R{constructor(){super(...arguments),this.slopeType="degree",this.zFactor=1,this.pixelSizePower=.664,this.pixelSizeFactor=.024}clone(){return new bt({slopeType:this.slopeType,zFactor:this.zFactor,pixelSizePower:this.pixelSizePower,pixelSizeFactor:this.pixelSizeFactor,raster:this.raster})}};l([tt(os)],z.prototype,"slopeType",void 0),l([p({type:Number,json:{write:!0}})],z.prototype,"zFactor",void 0),l([p({type:Number,json:{name:"psPower",write:!0}})],z.prototype,"pixelSizePower",void 0),l([p({type:Number,json:{name:"psFactor",write:!0}})],z.prototype,"pixelSizeFactor",void 0),z=bt=l([x("esri.layers.support.rasterFunctions.SlopeFunctionArguments")],z);const is=z;let q=class extends I{constructor(){super(...arguments),this.functionName="Slope",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){this.outputPixelType=this._getOutputPixelType("f32");const t=this.sourceRasterInfos[0].clone();return t.pixelType=this.outputPixelType,t.statistics=null,t.histograms=null,this.rasterInfo=t,this.isGCS=t.spatialReference.isGeographic,{success:!0}}_processPixels(t){var c;const n=(c=t.pixelBlocks)==null?void 0:c[0];if(T(n))return null;const{zFactor:a,slopeType:o,pixelSizePower:r,pixelSizeFactor:s}=this.functionArguments,{isGCS:i}=this,{extent:e}=t,u=e?{x:e.width/n.width,y:e.height/n.height}:{x:1,y:1};return pe(n,{zFactor:a,slopeType:o,pixelSizePower:r,pixelSizeFactor:s,isGCS:i,resolution:u})}};l([p({json:{write:!0,name:"rasterFunction"}})],q.prototype,"functionName",void 0),l([p({type:is,json:{write:!0,name:"rasterFunctionArguments"}})],q.prototype,"functionArguments",void 0),l([p()],q.prototype,"rasterArgumentNames",void 0),l([p({json:{write:!0}})],q.prototype,"isGCS",void 0),q=l([x("esri.layers.support.rasterFunctions.SlopeFunction")],q);const as=q;var St;let rt=St=class extends R{constructor(){super(...arguments),this.statistics=null,this.histograms=null}clone(){return new St({statistics:j(this.statistics),histograms:j(this.histograms)})}};l([p({json:{write:!0}})],rt.prototype,"statistics",void 0),l([p({json:{write:!0}})],rt.prototype,"histograms",void 0),rt=St=l([x("esri.layers.support.rasterFunctions.StatisticsHistogramsFunctionArguments")],rt);const us=rt;let H=class extends I{constructor(){super(...arguments),this.functionName="StatisticsHistograms",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const t=this.sourceRasterInfos[0];this.outputPixelType=this._getOutputPixelType("u8");const n=t.clone(),{statistics:a,histograms:o}=this.functionArguments;return n.histograms=o,a&&(n.statistics=a.map(([r,s,i,e])=>({min:r,max:s,avg:i,stddev:e}))),this.rasterInfo=n,{success:!0}}_processPixels(t){var n;return(n=t.pixelBlocks)==null?void 0:n[0]}};l([p({json:{write:!0,name:"rasterFunction"}})],H.prototype,"functionName",void 0),l([p({type:us,json:{write:!0,name:"rasterFunctionArguments"}})],H.prototype,"functionArguments",void 0),l([p()],H.prototype,"rasterArgumentNames",void 0),l([p({json:{write:!0}})],H.prototype,"indexedColormap",void 0),H=l([x("esri.layers.support.rasterFunctions.StatisticsHistogramsFunction")],H);const ls=H;var Tt;const cs=new Bt({0:"none",3:"standard-deviation",4:"histogram-equalization",5:"min-max",6:"percent-clip",7:"sigmoid"},{useNumericKeys:!0});let b=Tt=class extends R{constructor(){super(...arguments),this.computeGamma=!1,this.dynamicRangeAdjustment=!1,this.gamma=[],this.histograms=null,this.statistics=null,this.stretchType="none",this.useGamma=!1}writeStatistics(t,n,a){t!=null&&t.length&&(Array.isArray(t[0])||(t=t.map(o=>[o.min,o.max,o.avg,o.stddev])),n[a]=t)}clone(){return new Tt({stretchType:this.stretchType,outputMin:this.outputMin,outputMax:this.outputMax,useGamma:this.useGamma,computeGamma:this.computeGamma,statistics:j(this.statistics),gamma:j(this.gamma),sigmoidStrengthLevel:this.sigmoidStrengthLevel,numberOfStandardDeviations:this.numberOfStandardDeviations,minPercent:this.minPercent,maxPercent:this.maxPercent,histograms:j(this.histograms),dynamicRangeAdjustment:this.dynamicRangeAdjustment,raster:this.raster})}};l([p({type:Boolean,json:{write:!0}})],b.prototype,"computeGamma",void 0),l([p({type:Boolean,json:{name:"dra",write:!0}})],b.prototype,"dynamicRangeAdjustment",void 0),l([p({type:[Number],json:{write:!0}})],b.prototype,"gamma",void 0),l([p()],b.prototype,"histograms",void 0),l([p({type:Number,json:{write:!0}})],b.prototype,"maxPercent",void 0),l([p({type:Number,json:{write:!0}})],b.prototype,"minPercent",void 0),l([p({type:Number,json:{write:!0}})],b.prototype,"numberOfStandardDeviations",void 0),l([p({type:Number,json:{name:"max",write:!0}})],b.prototype,"outputMax",void 0),l([p({type:Number,json:{name:"min",write:!0}})],b.prototype,"outputMin",void 0),l([p({type:Number,json:{write:!0}})],b.prototype,"sigmoidStrengthLevel",void 0),l([p({json:{type:[[Number]],write:!0}})],b.prototype,"statistics",void 0),l([at("statistics")],b.prototype,"writeStatistics",null),l([tt(cs)],b.prototype,"stretchType",void 0),l([p({type:Boolean,json:{write:!0}})],b.prototype,"useGamma",void 0),b=Tt=l([x("esri.layers.support.rasterFunctions.StretchFunctionArguments")],b);const ps=b;let D=class extends I{constructor(){super(...arguments),this.functionName="Stretch",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.lookup=null,this.cutOffs=null}_bindSourceRasters(){this.lookup=null,this.cutOffs=null;const t=this.sourceRasterInfos[0],{pixelType:n}=t,{functionArguments:a}=this,{dynamicRangeAdjustment:o,gamma:r,useGamma:s}=a;if(!o&&["u8","u16","s8","s16"].includes(n)){const e=ht(a.toJSON(),{rasterInfo:t});this.lookup=he({pixelType:n,...e,gamma:s?r:null})}else o&&(this.cutOffs=ht(a.toJSON(),{rasterInfo:t}));this.outputPixelType=this._getOutputPixelType(n);const i=t.clone();return i.pixelType=this.outputPixelType,i.statistics=null,i.histograms=null,this.outputPixelType==="u8"&&(i.keyProperties.DataType="processed"),this.rasterInfo=i,{success:!0}}_processPixels(t){var i;const n=(i=t.pixelBlocks)==null?void 0:i[0];if(T(n))return n;const{lookup:a}=this;if(a)return Vt(n,{...a,outputPixelType:this.rasterInfo.pixelType});const{functionArguments:o}=this,r=this.cutOffs||ht(o.toJSON(),{rasterInfo:this.sourceRasterInfos[0],pixelBlock:n}),s=o.useGamma?o.gamma:null;return fe(n,{...r,gamma:s,outputPixelType:this.outputPixelType})}};l([p({json:{write:!0,name:"rasterFunction"}})],D.prototype,"functionName",void 0),l([p({type:ps,json:{write:!0,name:"rasterFunctionArguments"}})],D.prototype,"functionArguments",void 0),l([p()],D.prototype,"rasterArgumentNames",void 0),l([p({json:{write:!0}})],D.prototype,"lookup",void 0),l([p({json:{write:!0}})],D.prototype,"cutOffs",void 0),D=l([x("esri.layers.support.rasterFunctions.StretchFunction")],D);const hs=D,S=new Map;function $s(t,n){if("rasterFunction"in t)return ne(t,n!=null?n:{});throw new Ot("raster-function-helper","unsupported raster function json.")}function fs(t,n){return n[0]==="rasters"&&Array.isArray(t.rasters)?t.rasters:n.map(a=>t[a])}function ne(t,n){var m,v;const{rasterFunction:a,rasterFunctionArguments:o}=t,r=(m=t.outputPixelType)==null?void 0:m.toLowerCase();if(a==null||!S.has(a))throw new Ot("raster-function-helper",`unsupported raster function: ${a}`);const s=S.get(a),i=(typeof s.ctor=="function"?s.ctor:s.ctor.default).fromJSON({...t,outputPixelType:r}),{rasterArgumentNames:e}=i,u=[],c=fs(o,e),h=e[0]==="rasters",f=[];for(let w=0;w<c.length;w++){const A=c[w];let F;A==null||typeof A=="string"&&A.startsWith("$")?u.push(n==null?void 0:n.raster):typeof A=="string"?n[A]&&u.push(n[A]):typeof A!="number"&&"rasterFunction"in A&&(F=ne(A,n),h||(i.functionArguments[e[w]]=F),u.push(F)),h&&f.push(F!=null?F:A)}if(h&&(i.functionArguments.rasters=f),n){i.sourceRasters=u;const w=(v=n.raster)==null?void 0:v.url;w&&(i.mainPrimaryRasterId=w)}return i}S.set("Aspect",{desc:"Aspect Function",ctor:ve,rasterArgumentNames:["raster"]}),S.set("BandArithmetic",{desc:"Band Arithmetic Function",ctor:Xe,rasterArgumentNames:["raster"]}),S.set("Colormap",{desc:"Colormap Function",ctor:Ye,rasterArgumentNames:["raster"]}),S.set("CompositeBand",{desc:"CompositeBand Function",ctor:Ke,rasterArgumentNames:["rasters"]}),S.set("Convolution",{desc:"Convolution Function",ctor:rn,rasterArgumentNames:["raster"]}),S.set("ExtractBand",{desc:"ExtractBand Function",ctor:an,rasterArgumentNames:["raster"]}),S.set("Local",{desc:"Local Function",ctor:Qn,rasterArgumentNames:["rasters"]}),S.set("Mask",{desc:"Mask Function",ctor:ts,rasterArgumentNames:["raster"]}),S.set("NDVI",{desc:"NDVI Function",ctor:ns,rasterArgumentNames:["raster"]}),S.set("Remap",{desc:"Remap Function",ctor:rs,rasterArgumentNames:["raster"]}),S.set("Slope",{desc:"Slope Function",ctor:as,rasterArgumentNames:["raster"]}),S.set("StatisticsHistograms",{desc:"Statistics Histograms Function",ctor:ls,rasterArgumentNames:["raster"]}),S.set("Stretch",{desc:"Stretch Function",ctor:hs,rasterArgumentNames:["raster"]});let ot=class extends It{get affectsPixelSize(){return!1}forwardTransform(t){return t}inverseTransform(t){return t}};l([p()],ot.prototype,"affectsPixelSize",null),l([p({json:{write:!0}})],ot.prototype,"spatialReference",void 0),ot=l([x("esri.layers.support.rasterTransforms.BaseRasterTransform")],ot);const Pt=ot;let it=class extends Pt{constructor(){super(...arguments),this.type="gcs-shift",this.tolerance=1e-8}forwardTransform(t){return(t=t.clone()).type==="point"?(t.x>180+this.tolerance&&(t.x-=360),t):(t.xmin>=180-this.tolerance?(t.xmax-=360,t.xmin-=360):t.xmax>180+this.tolerance&&(t.xmin=-180,t.xmax=180),t)}inverseTransform(t){return(t=t.clone()).type==="point"?(t.x<-this.tolerance&&(t.x+=360),t):(t.xmin<-this.tolerance&&(t.xmin+=360,t.xmax+=360),t)}};l([tt({GCSShiftXform:"gcs-shift"})],it.prototype,"type",void 0),l([p()],it.prototype,"tolerance",void 0),it=l([x("esri.layers.support.rasterTransforms.GCSShiftTransform")],it);const ms=it;let lt=class extends Pt{constructor(){super(...arguments),this.type="identity"}};l([tt({IdentityXform:"identity"})],lt.prototype,"type",void 0),lt=l([x("esri.layers.support.rasterTransforms.IdentityTransform")],lt);const ds=lt;function Rt(t,n,a){const{x:o,y:r}=n;if(a<2)return{x:t[0]+o*t[2]+r*t[4],y:t[1]+o*t[3]+r*t[5]};if(a===2){const m=o*o,v=r*r,w=o*r;return{x:t[0]+o*t[2]+r*t[4]+m*t[6]+w*t[8]+v*t[10],y:t[1]+o*t[3]+r*t[5]+m*t[7]+w*t[9]+v*t[11]}}const s=o*o,i=r*r,e=o*r,u=s*o,c=s*r,h=o*i,f=r*i;return{x:t[0]+o*t[2]+r*t[4]+s*t[6]+e*t[8]+i*t[10]+u*t[12]+c*t[14]+h*t[16]+f*t[18],y:t[1]+o*t[3]+r*t[5]+s*t[7]+e*t[9]+i*t[11]+u*t[13]+c*t[15]+h*t[17]+f*t[19]}}function _t(t,n,a){const{xmin:o,ymin:r,xmax:s,ymax:i,spatialReference:e}=n;let u=[];if(a<2)u.push({x:o,y:i}),u.push({x:s,y:i}),u.push({x:o,y:r}),u.push({x:s,y:r});else{let f=10;for(let m=0;m<f;m++)u.push({x:o,y:r+(i-r)*m/(f-1)}),u.push({x:s,y:r+(i-r)*m/(f-1)});f=8;for(let m=1;m<=f;m++)u.push({x:o+(s-o)*m/f,y:r}),u.push({x:o+(s-o)*m/f,y:i})}u=u.map(f=>Rt(t,f,a));const c=u.map(f=>f.x),h=u.map(f=>f.y);return new ue({xmin:Math.min.apply(null,c),xmax:Math.max.apply(null,c),ymin:Math.min.apply(null,h),ymax:Math.max.apply(null,h),spatialReference:e})}function gs(t){const[n,a,o,r,s,i]=t,e=o*i-s*r,u=s*r-o*i;return[(s*a-n*i)/e,(o*a-n*r)/u,i/e,r/u,-s/e,-o/u]}let P=class extends Pt{constructor(){super(...arguments),this.polynomialOrder=1,this.type="polynomial"}readForwardCoefficients(t,n){const{coeffX:a,coeffY:o}=n;if(!(a!=null&&a.length)||!(o!=null&&o.length)||a.length!==o.length)return null;const r=[];for(let s=0;s<a.length;s++)r.push(a[s]),r.push(o[s]);return r}writeForwardCoefficients(t,n,a){const o=[],r=[];for(let s=0;s<(t==null?void 0:t.length);s++)s%2==0?o.push(t[s]):r.push(t[s]);n.coeffX=o,n.coeffY=r}get inverseCoefficients(){let t=this._get("inverseCoefficients");const n=this._get("forwardCoefficients");return!t&&n&&this.polynomialOrder<2&&(t=gs(n)),t}set inverseCoefficients(t){this._set("inverseCoefficients",t)}readInverseCoefficients(t,n){const{inverseCoeffX:a,inverseCoeffY:o}=n;if(!(a!=null&&a.length)||!(o!=null&&o.length)||a.length!==o.length)return null;const r=[];for(let s=0;s<a.length;s++)r.push(a[s]),r.push(o[s]);return r}writeInverseCoefficients(t,n,a){const o=[],r=[];for(let s=0;s<(t==null?void 0:t.length);s++)s%2==0?o.push(t[s]):r.push(t[s]);n.inverseCoeffX=o,n.inverseCoeffY=r}get affectsPixelSize(){return this.polynomialOrder>0}forwardTransform(t){if(t.type==="point"){const n=Rt(this.forwardCoefficients,t,this.polynomialOrder);return new Mt({x:n.x,y:n.y,spatialReference:t.spatialReference})}return _t(this.forwardCoefficients,t,this.polynomialOrder)}inverseTransform(t){if(t.type==="point"){const n=Rt(this.inverseCoefficients,t,this.polynomialOrder);return new Mt({x:n.x,y:n.y,spatialReference:t.spatialReference})}return _t(this.inverseCoefficients,t,this.polynomialOrder)}};l([p({json:{write:!0}})],P.prototype,"polynomialOrder",void 0),l([p()],P.prototype,"forwardCoefficients",void 0),l([ft("forwardCoefficients",["coeffX","coeffY"])],P.prototype,"readForwardCoefficients",null),l([at("forwardCoefficients")],P.prototype,"writeForwardCoefficients",null),l([p({json:{write:!0}})],P.prototype,"inverseCoefficients",null),l([ft("inverseCoefficients",["inverseCoeffX","inverseCoeffY"])],P.prototype,"readInverseCoefficients",null),l([at("inverseCoefficients")],P.prototype,"writeInverseCoefficients",null),l([p()],P.prototype,"affectsPixelSize",null),l([tt({PolynomialXform:"polynomial"})],P.prototype,"type",void 0),P=l([x("esri.layers.support.rasterTransforms.PolynomialTransform")],P);const ys=P,se={GCSShiftXform:ms,IdentityXform:ds,PolynomialXform:ys},xs=Object.keys(se);function Ns(t){const n=t==null?void 0:t.type;return!t||xs.includes(n)}function Fs(t){if(!(t==null?void 0:t.type))return null;const a=se[t==null?void 0:t.type];if(a){const o=new a;return o.read(t),o}return null}export{ms as c,Ns as f,Fs as i,$s as l,ys as m};
|