import{y as Ae}from"./colorUtils-23771bca.js";import{A as c,B as f,C as A,a6 as de,ea as We,a1 as Mt,bV as Z,bb as W,kN as rs,a8 as Nt,kO as os,a9 as Ft,m0 as $t,s as It,aH as Pe,ab as is}from"./index-b5c8f851.js";import{u as x,o as as,r as us,k as ge,h as Dt,q as qe,t as Xe,w as ls,v as Y,x as cs,y as ps,z as hs,A as fs}from"./dataUtils-c2b057a0.js";import{a as ms,v as ds,w as St,C as gs,x as He,e as Te,y as ys,z as ws,E as Vt,H as bs,I as xs,J as Ut,K as vs,M as As,O as Ps}from"./RasterSymbolizer-a162ee17.js";let Ot=class extends de{constructor(){super(...arguments),this.raster=void 0}};c([f({json:{write:!0}})],Ot.prototype,"raster",void 0),Ot=c([A("esri.layers.support.rasterFunctions.AspectFunctionArguments")],Ot);const U=Ot;var Lt;let Wt=Lt=class extends U{clone(){return new Lt({raster:this.raster})}};Wt=Lt=c([A("esri.layers.support.rasterFunctions.AspectFunctionArguments")],Wt);const Ts=Wt,$s=new Set(["slope","aspect","curvature","hillshade","shadedrelief","statistics"]);let S=class extends de{constructor(){super(...arguments),this.functionArguments=null,this.readingBufferSize=0,this.id=-1,this.isNoopProcess=!1,this.rawInputBandIds=[],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:s}=t;let o=s.rasters||s.raster&&[s.raster];for(;o!=null&&o.length;){e.unshift(...o);const n=[];for(let u=0;u=0;n--)e[n].isNoopProcess&&e.splice(n,1);let r=!1;for(let n=0;n1}const a=e.some(({name:n})=>$s.has(n.toLowerCase()));return{functions:e,hasBranches:r,hasFocalFunction:a}}bind(t,e=!1,s=-1){this.id=s+1;const o=this._getRasterValues();let r=!0;for(let a=0;athis._readRasterValue(o,t));return this._processPixels({...t,pixelBlocks:s})}processInputBandIds(){const t=this._getRasterValues().filter(this._isRasterFunctionValue);let e;if(t.length>1){const r=t.map(n=>n.processInputBandIds()[0]);this.rawInputBandIds=r,this.isInputBandIdsSwizzled=this.rawInputBandIds.some((n,u)=>n!==u);const a=t.filter(n=>n.functionName==="ExtractBand");return a.length&&a.forEach((n,u)=>{n.isInputBandIdsSwizzled=!0,n.swizzledBandSelection=[u,u,u]}),this.rawInputBandIds}const s=t[0];if(s){if(e=s.processInputBandIds(),s.isInputBandIdsSwizzled)return this.rawInputBandIds=e,e}else{e=[];const{bandCount:r}=this.sourceRasterInfos[0];for(let a=0;ar!==a),this.rawInputBandIds=o,this.rawInputBandIds}getPrimaryRasters(){const t=[],e=[];return this._getPrimaryRasters(this,t,e),{rasters:t,rasterIds:e}}getWebGLProcessorDefinition(){const t=this._getWebGLParameters(),{raster:e,rasters:s}=this.functionArguments;return s&&Array.isArray(s)&&s.length?(t.rasters=s.map(o=>this._isRasterFunctionValue(o)?o.getWebGLProcessorDefinition():typeof o=="number"?{name:"Constant",parameters:{value:o},pixelType:"f32",id:-1,isNoopProcess:!1}:{name:"Identity",parameters:{value:o},pixelType:"f32",id:-1,isNoopProcess:!1}),t.rasters.some(o=>o!=null)||(t.rasters=null)):this._isRasterFunctionValue(e)&&(t.raster=e.getWebGLProcessorDefinition()),{name:this.functionName,parameters:t,pixelType:this.outputPixelType,id:this.id,isNoopProcess:this.isNoopProcess}}_getOutputPixelType(t){return this.outputPixelType==="unknown"?t:this.outputPixelType??t}_getWebGLParameters(){return{}}_getInputBandIds(t){return t}_isOutputRoundingNeeded(){const{outputPixelType:t}=this;return((t==null?void 0:t.startsWith("u"))||(t==null?void 0:t.startsWith("s")))??!1}_getRasterValues(){const{rasterArgumentNames:t}=this;return t[0]==="rasters"?this.functionArguments.rasters??[]:t.flatMap(e=>this.functionArguments[e])}_getSourceRasterInfos(t){const e=this._getRasterValues(),{rasterInfos:s,rasterIds:o}=t;if(e.length===0)return s;const r=e.map(n=>n&&typeof n=="object"&&"bind"in n&&n.rasterInfo?n.rasterInfo:typeof n=="string"&&o.includes(n)?s[o.indexOf(n)]:typeof n!="number"?s[0]:void 0),a=r.find(n=>n)??s[0];return r.forEach((n,u)=>{n===void 0&&(r[u]=a)}),r}_getPrimaryRasterId(t){return t==null?void 0:t.url}_getPrimaryRasters(t,e=[],s=[]){for(let o=0;oe?o.slice(0,e):null),r&&r.length!==e&&(t.histograms=r.length>e?r.slice(0,e):null),s.BAND_COUNT&&Number(s.BAND_COUNT)!==e&&(t.keyProperties={...s,BAND_COUNT:typeof s.BAND_COUNT=="string"?String(e):e})}};c([f({json:{write:!0}})],S.prototype,"functionName",void 0),c([f({json:{write:!0}})],S.prototype,"functionArguments",void 0),c([f()],S.prototype,"rasterArgumentNames",void 0),c([f({json:{write:!0}}),We(i=>i==null?void 0:i.toLowerCase())],S.prototype,"outputPixelType",void 0),c([f({json:{write:!0}})],S.prototype,"mainPrimaryRasterId",void 0),c([f()],S.prototype,"sourceRasters",void 0),c([f({type:[ms],json:{write:!0}})],S.prototype,"sourceRasterInfos",void 0),c([f({json:{write:!0}})],S.prototype,"rasterInfo",void 0),c([f({json:{write:!0}})],S.prototype,"readingBufferSize",void 0),c([f({json:{write:!0}})],S.prototype,"id",void 0),c([f()],S.prototype,"isNoopProcess",void 0),c([f()],S.prototype,"supportsGPU",null),c([f()],S.prototype,"rawInputBandIds",void 0),c([f()],S.prototype,"isInputBandIdsSwizzled",void 0),c([f()],S.prototype,"swizzledBandSelection",void 0),c([f()],S.prototype,"isBranch",void 0),c([f()],S.prototype,"flatWebGLFunctionChain",null),c([f()],S.prototype,"_bindingResult",void 0),S=c([A("esri.layers.support.rasterFunctions.BaseRasterFunction")],S);const V=S;let rt=class extends V{constructor(){super(...arguments),this.functionName="Aspect",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){var s;const t=this.sourceRasterInfos[0];this.isGCS=((s=t.spatialReference)==null?void 0:s.isGeographic)??!1,this.outputPixelType=this._getOutputPixelType("f32");const e=t.clone();return e.pixelType=this.outputPixelType,e.statistics=[{min:-1,max:360,avg:180,stddev:30}],e.histograms=null,e.colormap=null,e.attributeTable=null,e.bandCount=1,this.rasterInfo=e,{success:!0,supportsGPU:!0}}_processPixels(t){var n;const e=(n=t.pixelBlocks)==null?void 0:n[0];if(e==null)return null;const{extent:s,primaryPixelSizes:o}=t,r=o==null?void 0:o[0],a=r??(s?{x:s.width/e.width,y:s.height/e.height}:{x:1,y:1});return ds(e,{resolution:a})}};c([f({json:{write:!0,name:"rasterFunction"}})],rt.prototype,"functionName",void 0),c([f({type:Ts,json:{write:!0,name:"rasterFunctionArguments"}})],rt.prototype,"functionArguments",void 0),c([f()],rt.prototype,"rasterArgumentNames",void 0),c([f({json:{write:!0}})],rt.prototype,"isGCS",void 0),rt=c([A("esri.layers.support.rasterFunctions.AspectFunction")],rt);const Ns=rt,Fs=new Set(["+","-","*","/","(",")"]);function Is(i,t){(i=i.replaceAll(" ","")).startsWith("-")&&(i="0"+i),i.startsWith("+")&&(i=i.slice(1,i.length));const e=i.split(""),s=[],o=[];let r="";for(let a=0;a-1)e>0&&(o+=t+1);else{for(let a=0;a0&&(o+=t+1)}let r=0;for(let a=0;a0;){const{numIndex:a,opIndex:n}=Cs(o);if(s=Rs(i,o[n],r[a],r[a+1]),o.length===1)break;o=ks(o,n),r.splice(a,2,s)}return[s]}const js=new Mt({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 _s(i,t){if(!as(i))return i;const{equation:e,method:s}=t,o=t.bandIndexes.map(p=>p-1),{pixels:r,mask:a}=i;let n;switch(s){case"gndvi":case"nbr":case"ndbi":case"ndvi":case"ndvi-re":case"ndsi":case"ndmi":case"mndwi":n=$e(a,r[o[0]],r[o[1]]);break;case"ndwi":n=$e(a,r[o[1]],r[o[0]]);break;case"sr":case"sr-re":case"iron-oxide":case"ferrous-minerals":case"clay-minerals":n=Ms(a,r[o[0]],r[o[1]]);break;case"ci-g":case"ci-re":n=Ds(a,r[o[0]],r[o[1]]);break;case"savi":n=Os(a,r[o[0]],r[o[1]],o[2]+1);break;case"tsavi":n=Es(a,r[o[0]],r[o[1]],o[2]+1,o[3]+1,o[4]+1);break;case"msavi":n=Gs(a,r[o[0]],r[o[1]]);break;case"gemi":n=zs(a,r[o[0]],r[o[1]]);break;case"pvi":n=Us(a,r[o[0]],r[o[1]],o[2]+1,o[3]+1);break;case"gvitm":n=Vs(a,[r[o[0]],r[o[1]],r[o[2]],r[o[3]],r[o[4]],r[o[5]]]);break;case"sultan":n=Ls(a,[r[o[0]],r[o[1]],r[o[2]],r[o[3]],r[o[4]],r[o[5]]]);break;case"vari":n=Ws(a,[r[o[0]],r[o[1]],r[o[2]]]);break;case"mtvi2":n=qs(a,[r[o[0]],r[o[1]],r[o[2]]]);break;case"rtvi-core":n=Xs(a,[r[o[0]],r[o[1]],r[o[2]]]);break;case"evi":n=Hs(a,[r[o[0]],r[o[1]],r[o[2]]]);break;case"wndwi":n=Js(a,[r[o[0]],r[o[1]],r[o[2]]],o[3]?o[3]+1:.5);break;case"bai":n=Ks(a,r[o[0]],r[o[1]]);break;case"custom":n=Bs(a,r,e);break;default:return i}const u=a!=null?new Uint8Array(a.length):null;a!=null&&u!=null&&u.set(a);const l=new x({width:i.width,height:i.height,pixelType:"f32",pixels:n,mask:u});return l.updateStatistics(),l}function Ss(i,t,e,s){const{mask:o,pixels:r,width:a,height:n}=i,u=r[e],l=r[t],p=l.length,h=s?new Uint8Array(p):new Float32Array(p),m=s?100:1,g=s?100.5:0;for(let y=0;yparseFloat(n));return _s(e,{method:s,bandIndexes:r,equation:o})}_getWebGLParameters(){const t=this.functionArguments.bandIndexes.split(" ").map(n=>parseFloat(n)-1);t.length===2&&t.push(0);const e=this.isInputBandIdsSwizzled?[0,1,2]:t;let s,o;const r=new Float32Array(3),{method:a}=this.functionArguments;switch(a){case"gndvi":case"nbr":case"ndbi":case"ndvi":case"ndvi-re":case"ndsi":case"ndmi":case"mndwi":s=O([e[0],e[1],0]),o="ndxi";break;case"ndwi":s=O([e[1],e[0],0]),o="ndxi";break;case"sr":case"sr-re":case"iron-oxide":case"ferrous-minerals":case"clay-minerals":s=O([e[0],e[1],0]),o="sr";break;case"ci-g":case"ci-re":s=O([e[0],e[1],0]),o="ci";break;case"savi":s=O([e[0],e[1],0]),o="savi",r[0]=t[2]+1;break;case"tsavi":s=O([e[0],e[1],0]),o="tsavi",r[0]=t[2]+1,r[1]=t[3]+1,r[2]=t[4]+1;break;case"msavi":s=O([e[0],e[1],0]),o="msavi";break;case"gemi":s=O([e[0],e[1],0]),o="gemi";break;case"pvi":s=O([e[0],e[1],0]),o="tsavi",r[0]=t[2]+1,r[1]=t[3]+1;break;case"vari":s=O([e[0],e[1],e[2]]),o="vari";break;case"mtvi2":s=O([e[0],e[1],e[2]]),o="mtvi2";break;case"rtvi-core":s=O([e[0],e[1],e[2]]),o="rtvicore";break;case"evi":s=O([e[0],e[1],e[2]]),o="evi";break;case"wndwi":s=O([e[0],e[1],0]),o="wndwi",r[0]=t[3]?t[3]+1:.5;break;case"bai":s=O([e[1],e[0],0]),o="bai";break;default:s=O([0,1,2]),o="custom"}return{bandIndexMat3:s,indexType:o,adjustments:r}}_getInputBandIds(t){if(this.functionArguments.method==="custom")return t;const e=this.functionArguments.bandIndexes.split(" ").map(n=>parseFloat(n)-1),s=t.length,o=e.map(n=>n>=s?s-1:n),r=Zs.has(this.functionArguments.method)?3:2,a=o.slice(0,r).map(n=>t[n]);return a.length===2&&a.push(0),a}};c([f({json:{write:!0,name:"rasterFunction"}})],gt.prototype,"functionName",void 0),c([f({type:Ys,json:{write:!0,name:"rasterFunctionArguments"}})],gt.prototype,"functionArguments",void 0),c([f()],gt.prototype,"rasterArgumentNames",void 0),gt=c([A("esri.layers.support.rasterFunctions.BandArithmeticFunction")],gt);const Qs=gt;var Xt;let J=Xt=class extends U{castColormapName(i){if(!i)return null;const t=i.toLowerCase();return gs.includes(t)?t:null}readColorRamp(i){return os(i)}readColorRampName(i,t){if(!i)return null;const e=St.jsonValues.find(s=>s.toLowerCase()===i.toLowerCase());return e?St.fromJSON(e):null}clone(){var i;return new Xt({colormap:W(this.colormap),colormapName:this.colormapName,colorRamp:(i=this.colorRamp)==null?void 0:i.clone(),colorRampName:this.colorRampName})}};c([f({type:[[Number]],json:{write:!0}})],J.prototype,"colormap",void 0),c([f({type:String,json:{write:!0}})],J.prototype,"colormapName",void 0),c([We("colormapName")],J.prototype,"castColormapName",null),c([f({types:rs,json:{write:!0}})],J.prototype,"colorRamp",void 0),c([Nt("colorRamp")],J.prototype,"readColorRamp",null),c([f({type:St.apiValues,json:{type:St.jsonValues,write:St.write}})],J.prototype,"colorRampName",void 0),c([Nt("colorRampName")],J.prototype,"readColorRampName",null),J=Xt=c([A("esri.layers.support.rasterFunctions.ColormapFunctionArguments")],J);const tn=J,en=[[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]],sn=[[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 ye(i,t){const e=[],s=[];for(let r=0;r[s,...e]),t):null}let Q=class extends V{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:s,colorRamp:o,colorRampName:r}=this.functionArguments;if(!(e!=null&&e.length))if(o)e=Te(o,{interpolateAlpha:!0});else if(r){const n=ys(r);n&&(e=Te(n))}else s&&(e=ln(s));if(!(e!=null&&e.length))return{success:!1,supportsGPU:!1,error:"colormap-function: missing colormap argument"};this.outputPixelType=this._getOutputPixelType("u8");const a=t.clone();return a.pixelType=this.outputPixelType,a.colormap=e,a.bandCount=1,this.rasterInfo=a,{success:!0,supportsGPU:!0}}_processPixels(t){var e;return(e=t.pixelBlocks)==null?void 0:e[0]}};c([f({json:{write:!0,name:"rasterFunction"}})],Q.prototype,"functionName",void 0),c([f({type:tn,json:{write:!0,name:"rasterFunctionArguments"}})],Q.prototype,"functionArguments",void 0),c([f()],Q.prototype,"rasterArgumentNames",void 0),c([f()],Q.prototype,"isNoopProcess",void 0),c([f({json:{write:!0}})],Q.prototype,"indexedColormap",void 0),Q=c([A("esri.layers.support.rasterFunctions.ColormapFunction")],Q);const cn=Q;var Ht;let Ct=Ht=class extends U{constructor(){super(...arguments),this.rasters=[]}writeRasters(i,t){t.rasters=i.map(e=>typeof e=="number"||typeof e=="string"?e:e.toJSON())}clone(){return new Ht({rasters:W(this.rasters)})}};c([f({json:{write:!0}})],Ct.prototype,"rasters",void 0),c([Ft("rasters")],Ct.prototype,"writeRasters",null),Ct=Ht=c([A("esri.layers.support.rasterFunctions.CompositeBandFunctionArguments")],Ct);const pn=Ct;let yt=class extends V{constructor(){super(...arguments),this.functionName="CompositeBand",this.functionArguments=null,this.rasterArgumentNames=["rasters"]}_bindSourceRasters(){const{sourceRasterInfos:t}=this,e=t[0];this.outputPixelType=this._getOutputPixelType(e.pixelType);const s=e.clone();if(s.attributeTable=null,s.colormap=null,s.pixelType=this.outputPixelType,s.bandCount=t.map(({bandCount:r})=>r).reduce((r,a)=>r+a),t.every(({statistics:r})=>r!=null&&r.length)){const r=[];t.forEach(({statistics:a})=>a!=null&&r.push(...a)),s.statistics=r}if(t.every(({histograms:r})=>r!=null&&r.length)){const r=[];t.forEach(({histograms:a})=>a!=null&&r.push(...a)),s.histograms=r}s.bandCount>1&&(s.colormap=null,s.attributeTable=null);const o=t.every(r=>{var a;return(a=r.keyProperties.BandProperties)==null?void 0:a.length})?t.flatMap(r=>r.keyProperties.BandProperties):void 0;return s.keyProperties={...s.keyProperties,BandProperties:o},this.rasterInfo=s,{success:!0,supportsGPU:s.bandCount<=3}}_processPixels(t){const{pixelBlocks:e}=t;return e?(e==null?void 0:e[0])==null?null:us(e):null}_getWebGLParameters(){return{bandCount:this.rasterInfo.bandCount}}};c([f({json:{write:!0,name:"rasterFunction"}})],yt.prototype,"functionName",void 0),c([f({type:pn,json:{write:!0,name:"rasterFunctionArguments"}})],yt.prototype,"functionArguments",void 0),c([f()],yt.prototype,"rasterArgumentNames",void 0),yt=c([A("esri.layers.support.rasterFunctions.CompositeBandFunction")],yt);const hn=yt;var Jt;let Bt=Jt=class extends U{constructor(){super(...arguments),this.contrastOffset=0,this.brightnessOffset=0}clone(){return new Jt({contrastOffset:this.contrastOffset,brightnessOffset:this.brightnessOffset,raster:this.raster})}};c([f({json:{write:!0}})],Bt.prototype,"contrastOffset",void 0),c([f({json:{write:!0}})],Bt.prototype,"brightnessOffset",void 0),Bt=Jt=c([A("esri.layers.support.rasterFunctions.ContrastBrightnessFunctionArguments")],Bt);const fn=Bt;let ot=class extends V{constructor(){super(...arguments),this.functionName="ContrastBrightness",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.lookup=null}_bindSourceRasters(){const{sourceRasterInfos:t}=this,e=t[0];if(e.pixelType!=="u8")return{success:!1,supportsGPU:!1,error:"Only unsigned 8 bit raster is supported by ContrastBrightness function."};this.outputPixelType=this._getOutputPixelType("u8");const s=e.clone();s.colormap=null,s.statistics=null,s.histograms=null,this.rasterInfo=s;const{contrastOffset:o,brightnessOffset:r}=this.functionArguments;return this.lookup=ws(o,r),{success:!0,supportsGPU:!0}}_processPixels(t){var s;const e=(s=t.pixelBlocks)==null?void 0:s[0];return e==null?null:ge(e,{lut:e.pixels.map(()=>this.lookup),offset:0,outputPixelType:"u8"})}_getWebGLParameters(){const{contrastOffset:t,brightnessOffset:e}=this.functionArguments;return{contrastOffset:t,brightnessOffset:e}}};c([f({json:{write:!0,name:"rasterFunction"}})],ot.prototype,"functionName",void 0),c([f({type:fn,json:{write:!0,name:"rasterFunctionArguments"}})],ot.prototype,"functionArguments",void 0),c([f()],ot.prototype,"rasterArgumentNames",void 0),c([f({json:{write:!0}})],ot.prototype,"lookup",void 0),ot=c([A("esri.layers.support.rasterFunctions.ContrastBrightnessFunction")],ot);const mn=ot,N={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},dn={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},L={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},H={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},gn={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},Je={setNull:50,conditional:78},Ne={...dn,...L,...H,...gn,...Je};function we(i,t,e,s,o){const r=Math.floor(s/2);for(let n=0;nu+l);return a!==0&&a!==1&&(s=s.map(u=>u/a)),vn(e,{kernel:s,rows:o,cols:r,outputPixelType:this.outputPixelType})}_getWebGLParameters(){let{kernel:t}=this.functionArguments;const e=t.reduce((o,r)=>o+r);e!==0&&e!==1&&(t=t.map(o=>o/e));const s=new Float32Array(Ie);return s.set(t),{kernelRows:this.functionArguments.rows,kernelCols:this.functionArguments.cols,kernel:s,clampRange:Dt(this.outputPixelType)}}};c([f({json:{write:!0,name:"rasterFunction"}})],wt.prototype,"functionName",void 0),c([f({type:An,json:{write:!0,name:"rasterFunctionArguments"}})],wt.prototype,"functionArguments",void 0),c([f()],wt.prototype,"rasterArgumentNames",void 0),wt=c([A("esri.layers.support.rasterFunctions.ConvolutionFunction")],wt);const Pn=wt;var Yt;const Ke=new Mt({0:"standard",1:"platform",2:"profile"},{useNumericKeys:!0});let bt=Yt=class extends U{constructor(){super(...arguments),this.curvatureType="standard",this.zFactor=1}readCurvatureType(i,t){return Ke.fromJSON(t.type??t.curvatureType??0)}clone(){return new Yt({curvatureType:this.curvatureType,zFactor:this.zFactor,raster:this.raster})}};c([f({json:{write:{target:"type"}}}),Z(Ke)],bt.prototype,"curvatureType",void 0),c([Nt("curvatureType",["type","curvatureType"])],bt.prototype,"readCurvatureType",null),c([f({type:Number,json:{write:!0}})],bt.prototype,"zFactor",void 0),bt=Yt=c([A("esri.layers.support.rasterFunctions.CurvatureFunctionArguments")],bt);const Tn=bt;let at=class extends V{constructor(){super(...arguments),this.functionName="Curvature",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){var e;this.outputPixelType=this._getOutputPixelType("f32");const t=this.sourceRasterInfos[0].clone();return t.pixelType=this.outputPixelType,t.statistics=null,t.histograms=null,t.colormap=null,t.attributeTable=null,t.bandCount=1,this.rasterInfo=t,this.isGCS=((e=t.spatialReference)==null?void 0:e.isGeographic)??!1,{success:!0,supportsGPU:!0}}_processPixels(t){var p;const e=(p=t.pixelBlocks)==null?void 0:p[0];if(e==null)return null;const{zFactor:s,curvatureType:o}=this.functionArguments,{extent:r,primaryPixelSizes:a}=t,n=a==null?void 0:a[0],u=n??(r?{x:r.width/e.width,y:r.height/e.height}:{x:1,y:1}),l=this.isGCS&&s>=1?s*Vt:s;return bs(e,{zFactor:l,curvatureType:o,resolution:u})}_getWebGLParameters(){const{zFactor:t,curvatureType:e}=this.functionArguments;return{curvatureType:e,zFactor:this.isGCS&&t>=1?t*Vt:t}}};c([f({json:{write:!0,name:"rasterFunction"}})],at.prototype,"functionName",void 0),c([f({type:Tn,json:{write:!0,name:"rasterFunctionArguments"}})],at.prototype,"functionArguments",void 0),c([f()],at.prototype,"rasterArgumentNames",void 0),c([f({json:{write:!0}})],at.prototype,"isGCS",void 0),at=c([A("esri.layers.support.rasterFunctions.CurvatureFunction")],at);const $n=at;var Zt;let K=Zt=class extends U{constructor(){super(...arguments),this.bandIds=[],this.bandNames=[],this.bandWavelengths=[],this.missingBandAction=qe.bestMatch}clone(){var i,t,e;return new Zt({bandIds:(i=this.bandIds)==null?void 0:i.slice(),bandNames:(t=this.bandNames)==null?void 0:t.slice(),bandWavelengths:(e=this.bandWavelengths)==null?void 0:e.slice(),missingBandAction:this.missingBandAction,method:this.method,wavelengthMatchTolerance:this.wavelengthMatchTolerance})}};c([f({json:{write:!0}})],K.prototype,"bandIds",void 0),c([f({json:{write:!0}})],K.prototype,"bandNames",void 0),c([f({json:{write:!0}})],K.prototype,"bandWavelengths",void 0),c([Z({0:"name",1:"wavelength",2:"id"})],K.prototype,"method",void 0),c([f({json:{write:!0}})],K.prototype,"missingBandAction",void 0),c([f({json:{write:!0}})],K.prototype,"wavelengthMatchTolerance",void 0),K=Zt=c([A("esri.layers.support.rasterFunctions.ExtractBandFunctionArguments")],K);const Nn=K;let xt=class extends V{constructor(){super(...arguments),this.functionName="ExtractBand",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){var v;const{functionArguments:t,sourceRasterInfos:e}=this,s=e[0],{method:o,bandNames:r,bandWavelengths:a,bandIds:n,missingBandAction:u}=t,l=(r==null?void 0:r.length)&&(o==="name"||o!=="id"&&!(n!=null&&n.length)),p=(a==null?void 0:a.length)&&(o==="wavelength"||o!=="id"&&!(n!=null&&n.length)),h=u===qe.fail,m=l?this._matchBandNames(s,r):p?this._matchBandWavelengths(s,a,h):this._matchBandIds(s,n,h);if(m==null)return{success:!1,supportsGPU:!1,error:`extract-band-function: Invalid ${l?"band names":p?"band wavelengths":"band ids"} for the imagery data source`};this.functionArguments.bandIds=m,this.functionArguments.method="id",this.outputPixelType=this._getOutputPixelType("f32");const g=s.clone();g.pixelType=this.outputPixelType,g.bandCount=m.length;const{statistics:w,histograms:y}=g;w!=null&&w.length&&(g.statistics=m.map(b=>w[b]||w[w.length-1])),y!=null&&y.length&&(g.histograms=m.map(b=>y[b]||y[y.length-1]));let d=(v=g.keyProperties)==null?void 0:v.BandProperties;return d!=null&&d.length&&(d=m.map(b=>b>=d.length?d[d.length-1]:d[b]),g.keyProperties={...g.keyProperties,BandProperties:d}),this.rasterInfo=g,{success:!0,supportsGPU:g.bandCount<=3}}_processPixels(t){var r;const e=(r=t.pixelBlocks)==null?void 0:r[0];if(e==null)return null;const s=e.pixels.length,o=this.functionArguments.bandIds.map(a=>a>=s?s-1:a);return e.extractBands(o)}_getWebGLParameters(){let t;if(this.isInputBandIdsSwizzled)t=this.swizzledBandSelection.length?this.swizzledBandSelection:[0,1,2];else{t=[...this.functionArguments.bandIds],t.length===0?t=[0,1,2]:t.length<3&&(t[1]=t[1]??t[0],t[2]=t[2]??t[1]);for(let e=0;e<3;e++)t[e]=Math.min(t[e],2)}return{bandIndexMat3:O(t)}}_getInputBandIds(t){const e=t.length;return this.functionArguments.bandIds.map(s=>s>=e?e-1:s).map(s=>t[s])}_matchBandNames(t,e){const s=t.bandInfos.map(({name:r})=>r.toLowerCase()),o=[];for(let r=0;ru.startsWith("nearinfrared_1")),n===-1&&(n=s.findIndex(u=>u.startsWith("nearinfrared")))),n===-1)return null;o.push(n)}return o}_matchBandIds(t,e,s){const{bandCount:o}=t;return!(e!=null&&e.length)||s&&e.some(r=>r<0||r>=o)?null:e}_matchBandWavelengths(t,e,s){const{bandInfos:o}=t,r=[];for(let u=0;u=w.minWavelength&&l<=w.maxWavelength,d=Math.abs(l-(w.minWavelength+w.maxWavelength)/2);y?dtypeof e=="number"||typeof e=="string"?e:e.toJSON())}clone(){return new Qt({operation:this.operation,processAsMultiband:this.processAsMultiband,rasters:W(this.rasters)})}};c([f({json:{write:!0}})],ut.prototype,"operation",void 0),c([f({json:{write:!0}})],ut.prototype,"rasters",void 0),c([Ft("rasters")],ut.prototype,"writeRasters",null),c([f({json:{write:!0}})],ut.prototype,"processAsMultiband",void 0),ut=Qt=c([A("esri.layers.support.rasterFunctions.LocalFunctionArguments")],ut);const In=ut,E=new Map;function Rn(i){return E.get(i)}E.set(H.acos,[0,Math.PI]),E.set(H.asin,[-Math.PI/2,Math.PI/2]),E.set(H.atan,[-Math.PI/2,Math.PI/2]),E.set(H.cos,[-1,1]),E.set(H.sin,[-1,1]),E.set(L.booleanAnd,[0,1]),E.set(L.booleanNot,[0,1]),E.set(L.booleanOr,[0,1]),E.set(L.booleanXOr,[0,1]),E.set(L.equalTo,[0,1]),E.set(L.notEqual,[0,1]),E.set(L.greaterThan,[0,1]),E.set(L.greaterThanEqual,[0,1]),E.set(L.lessThan,[0,1]),E.set(L.lessThanEqual,[0,1]),E.set(L.isNull,[0,1]);const Re=[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 kn(i,t=!1){const e=i.map(n=>n.mask),s=e.filter(n=>n!=null),o=i[0].pixels[0].length;if(s.length===0)return new Uint8Array(o).fill(255);const r=s[0],a=new Uint8Array(r);if(s.length===1)return a;if(!t){for(let n=1;n=1?t[u]=0:a[u]=Math.atanh(l)}return a}const n=s===H.asin?Math.asin:Math.acos;for(let u=0;u1?t[u]=0:a[u]=n(l)}return a}function En(i,t,e,s){const[o]=i,r=o.length,a=x.createEmptyBand(e,r);for(let n=0;n>o[n]);return a}function qn(i,t,e){const[s,o]=i,r=s.length,a=x.createEmptyBand(e,r);for(let n=0;no[n]?1:0);return a}function or(i,t,e){const[s,o]=i,r=s.length,a=x.createEmptyBand(e,r);for(let n=0;n=o[n]?1:0);return a}function ir(i,t,e){const[s,o]=i,r=s.length,a=x.createEmptyBand(e,r);for(let n=0;np&&(u=p)}a[n]=u}return a}function je(i,t,e){const s=i.length;if(s<2)return i[0];const[o]=i,r=o.length,a=x.createEmptyBand(e,r);for(let n=0;nh&&(u=h)}a[n]=l-u}return a}function _e(i,t,e){const s=i.length;if(s<2)return i[0];const[o]=i,r=o.length,a=x.createEmptyBand(e,r);for(let n=0;np&&(p=l,u=h);r[n]=u}return r}function Ee(i,t,e){const s=i.length;if(s<=2)return Ze(i,t,e);const o=i[0].length,r=x.createEmptyBand(e,o),a=new Map;for(let n=0;nr?t[n]=0:s[n]=a?Math.round(u):u}}function dr(i,t,e={}){fr();let s=kn(i,t>=66&&t<=75);const{outputPixelType:o="f32"}=e,r=!_.has(t)||e.processAsMultiband,a=r?i[0].pixels.length:1,n=[];for(let l=0;lg.pixels):i.map(g=>g.pixels[l]);let h,m=!0;if(t===Je.setNull){const g=hr(p,s,o);h=g.band,s=g.mask,m=!1}else P.has(t)?h=P.get(t)(p,s,"f64"):M.has(t)?h=t===H.asin||t===H.acos||t===H.atanh?On(p,s,"f64",t):En(p,s,"f64",M.get(t)):zt.has(t)?h=Gn(p,s,"f64",zt.get(t)):_.has(t)?h=_.get(t)(p,s,"f64"):(h=p[0],m=!1);if(m&&t!==L.isNull&&!E.has(t)){const g=x.createEmptyBand(o,h.length);s||(s=new Uint8Array(h.length).fill(255)),mr(h,s,o,g),h=g}n.push(h)}const u=i[0];return new x({width:u.width,height:u.height,pixelType:o,mask:t===L.isNull?null:s,pixels:n})}let vt=class extends V{constructor(){super(...arguments),this.functionName="Local",this.functionArguments=null,this.rasterArgumentNames=["rasters"]}_bindSourceRasters(){const{sourceRasterInfos:t}=this,e=t[0],{bandCount:s}=e,{processAsMultiband:o}=this.functionArguments;if(t.some(p=>p.bandCount!==s))return{success:!1,supportsGPU:!1,error:"local-function: input rasters do not have same band count"};const{operation:r,rasters:a}=this.functionArguments,n=Re[r];if(!(n===999||a.length===n||a.length<=1&&n===1))return{success:!1,supportsGPU:!1,error:`local-function: the length of functionArguments.rasters does not match operation's requirement: ${n}`};this.outputPixelType=this._getOutputPixelType("f32");const u=e.clone();u.pixelType=this.outputPixelType,u.statistics=null,u.histograms=null,u.colormap=null,u.attributeTable=null,u.bandCount=n!==999||o?s:1;const l=Rn(r);if(l){u.statistics=[];for(let p=0;p16)}}_processPixels(t){const{pixelBlocks:e}=t;return e==null||e.some(s=>s==null)?null:dr(e,this.functionArguments.operation,{processAsMultiband:this.functionArguments.processAsMultiband,outputPixelType:this.outputPixelType??void 0})}_getWebGLParameters(){var u;const{operation:t}=this.functionArguments,e=Re[t],s=((u=Object.keys(Ne).find(l=>Ne[l]===t))==null?void 0:u.toLowerCase())??"undefined",o=this.outputPixelType??"f32";let[r,a]=Dt(o);const n=o.startsWith("u")||o.startsWith("s");return n&&(r-=1e-4,a+=1e-4),{imageCount:e,operationName:s,domainRange:[r,a],isOutputRounded:n}}};c([f({json:{write:!0,name:"rasterFunction"}})],vt.prototype,"functionName",void 0),c([f({type:In,json:{write:!0,name:"rasterFunctionArguments"}})],vt.prototype,"functionArguments",void 0),c([f()],vt.prototype,"rasterArgumentNames",void 0),vt=c([A("esri.layers.support.rasterFunctions.LocalFunction")],vt);const gr=vt;var te;let lt=te=class extends U{constructor(){super(...arguments),this.includedRanges=null,this.noDataValues=null,this.noDataInterpretation=Xe.matchAny}get normalizedNoDataValues(){const{noDataValues:i}=this;if(!(i!=null&&i.length))return null;let t=!1;const e=i.map(s=>{if(typeof s=="number")return t=!0,[s];if(typeof s=="string"){const o=s.trim().split(" ").filter(r=>r.trim()!=="").map(r=>Number(r));return t=t||o.length>0,o.length===0?null:o}return null});return t?e:null}clone(){var i,t;return new te({includedRanges:((i=this.includedRanges)==null?void 0:i.slice())??[],noDataValues:((t=this.noDataValues)==null?void 0:t.slice())??[],noDataInterpretation:this.noDataInterpretation})}};c([f({json:{write:!0}})],lt.prototype,"includedRanges",void 0),c([f({json:{write:!0}})],lt.prototype,"noDataValues",void 0),c([f()],lt.prototype,"normalizedNoDataValues",null),c([f({json:{write:!0}})],lt.prototype,"noDataInterpretation",void 0),lt=te=c([A("esri.layers.support.rasterFunctions.MaskFunctionArguments")],lt);const yr=lt;let ct=class extends V{constructor(){super(...arguments),this.functionName="Mask",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const t=this.sourceRasterInfos[0].clone(),{pixelType:e}=t;this.outputPixelType=this._getOutputPixelType(e),t.pixelType=this.outputPixelType,this.rasterInfo=t;const{includedRanges:s,normalizedNoDataValues:o}=this.functionArguments;if(!(s!=null&&s.length)&&!(o!=null&&o.length))return{success:!1,supportsGPU:!1,error:"missing includedRanges or noDataValues argument"};let r=[];for(let n=0;n{var u;return(n==null?void 0:n.length)===((u=o[0])==null?void 0:u.length)});return{success:!0,supportsGPU:(!s||s.length<=2*Y)&&(!o||a&&o[0].length<=Y)}}_processPixels(t){var l;const e=(l=t.pixelBlocks)==null?void 0:l[0];if(e==null)return null;const{outputPixelType:s,lookups:o}=this,{includedRanges:r,noDataInterpretation:a,normalizedNoDataValues:n}=this.functionArguments,u=a===Xe.matchAll;return cs(e,{includedRanges:r,noDataValues:n,outputPixelType:s,matchAll:u,lookups:o})}_getWebGLParameters(){var r;const{includedRanges:t,normalizedNoDataValues:e}=this.functionArguments,s=new Float32Array(Y);s.fill($t),(r=e==null?void 0:e[0])!=null&&r.length&&s.set(e[0]);const o=new Float32Array(Y);for(let a=0;a=o.bandCount)return{success:!1,supportsGPU:!1,error:"ndvi-function: source raster has insufficient amount of raster bands"};const a=o.clone();a.pixelType=this.outputPixelType,a.colormap=null,a.histograms=null,a.bandCount=1,a.keyProperties={...a.keyProperties,BandProperties:void 0};const[n,u,l,p]=t?[-1,1,0,.1]:[0,200,100,10];return a.statistics=[{min:n,max:u,avg:l,stddev:p}],this.rasterInfo=a,{success:!0,supportsGPU:!0}}_processPixels(t){var a;const e=(a=t.pixelBlocks)==null?void 0:a[0];if(e==null)return null;const{visibleBandID:s,infraredBandID:o,scientificOutput:r}=this.functionArguments;return Ss(e,s,o,!r)}_getWebGLParameters(){const{visibleBandID:t,infraredBandID:e,scientificOutput:s}=this.functionArguments,o=this.isInputBandIdsSwizzled?[0,1,2]:[e,t,0];return{bandIndexMat3:O(o),scaled:!s}}_getInputBandIds(t){const{visibleBandID:e,infraredBandID:s}=this.functionArguments;return[s,e,0].map(o=>t[o])}};c([f({json:{write:!0,name:"rasterFunction"}})],Pt.prototype,"functionName",void 0),c([f({type:br,json:{write:!0,name:"rasterFunctionArguments"}})],Pt.prototype,"functionArguments",void 0),c([f()],Pt.prototype,"rasterArgumentNames",void 0),Pt=c([A("esri.layers.support.rasterFunctions.NDVIFunction")],Pt);const xr=Pt;var se;let tt=se=class extends U{constructor(){super(...arguments),this.inputRanges=null,this.outputValues=null,this.noDataRanges=null,this.allowUnmatched=!1,this.isLastInputRangeInclusive=!1}clone(){return new se({inputRanges:[...this.inputRanges],outputValues:[...this.outputValues],noDataRanges:[...this.noDataRanges],allowUnmatched:this.allowUnmatched,isLastInputRangeInclusive:this.isLastInputRangeInclusive})}};c([f({json:{write:!0}})],tt.prototype,"inputRanges",void 0),c([f({json:{write:!0}})],tt.prototype,"outputValues",void 0),c([f({json:{write:!0}})],tt.prototype,"noDataRanges",void 0),c([f({json:{write:!0}})],tt.prototype,"allowUnmatched",void 0),c([f({json:{write:!0}})],tt.prototype,"isLastInputRangeInclusive",void 0),tt=se=c([A("esri.layers.support.rasterFunctions.RemapFunctionArguments")],tt);const vr=tt;let pt=class extends V{constructor(){super(...arguments),this.functionName="Remap",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.lookup=null}_bindSourceRasters(){const t=this.sourceRasterInfos[0].clone(),{pixelType:e}=t;this.outputPixelType=this._getOutputPixelType(e),t.pixelType=this.outputPixelType,t.colormap=null,t.histograms=null,t.bandCount=1,t.attributeTable=null;const{statistics:s}=t,{allowUnmatched:o,outputValues:r,inputRanges:a,noDataRanges:n,isLastInputRangeInclusive:u}=this.functionArguments;if(s!=null&&s.length&&(r!=null&&r.length))if(o){const l=Math.min.apply(null,[...r,s[0].min]),p=Math.max.apply(null,[...r,s[0].max]);t.statistics=[{...s[0],min:l,max:p}]}else{let l=r[0],p=l;for(let h=0;hr[h]?r[h]:l,p=p>r[h]?p:r[h];t.statistics=[{...s[0],min:l,max:p}]}return this.rasterInfo=t,this.lookup=o?null:ps({srcPixelType:e,inputRanges:a,outputValues:r,noDataRanges:n,allowUnmatched:o,isLastInputRangeInclusive:u,outputPixelType:this.outputPixelType}),{success:!0,supportsGPU:(!r||r.length<=Y)&&(!n||n.length<=Y)}}_processPixels(t){var p;const e=(p=t.pixelBlocks)==null?void 0:p[0];if(e==null)return null;const{lookup:s,outputPixelType:o}=this;if(s){const h=ge(e,{lut:[s.lut],offset:s.offset,outputPixelType:o});return h!=null&&s.mask&&(h.mask=hs(e.pixels[0],e.mask,s.mask,s.offset,"u8")),h}const{inputRanges:r,outputValues:a,noDataRanges:n,allowUnmatched:u,isLastInputRangeInclusive:l}=this.functionArguments;return fs(e,{inputRanges:r,outputValues:a,noDataRanges:n,outputPixelType:o,allowUnmatched:u,isLastInputRangeInclusive:l})}_getWebGLParameters(){const{allowUnmatched:t,noDataRanges:e,isLastInputRangeInclusive:s}=this.functionArguments,o=new Float32Array(3*Y),r=1e-5,a=this.functionArguments.inputRanges??[],n=this.functionArguments.outputValues??[],u=n.length;for(let p=0;p0&&(o[3*p]-=r),(p=1?t*Vt:t,slopeType:e,pixelSizeFactor:s??0,pixelSizePower:o??0}}};c([f({json:{write:!0,name:"rasterFunction"}})],ht.prototype,"functionName",void 0),c([f({type:Tr,json:{write:!0,name:"rasterFunctionArguments"}})],ht.prototype,"functionArguments",void 0),c([f()],ht.prototype,"rasterArgumentNames",void 0),c([f({json:{write:!0}})],ht.prototype,"isGCS",void 0),ht=c([A("esri.layers.support.rasterFunctions.SlopeFunction")],ht);const $r=ht,ze=new Mt({1:"min",2:"max",3:"mean",4:"stddev",5:"median",6:"majority",7:"minority"},{useNumericKeys:!0});function Nr(i,t){const{fillNoDataOnly:e}=t,{band:s,width:o,height:r,mask:a,outBand:n}=i;if(e&&!a)return void n.set(s);const{statisticsType:u,kernelRows:l,kernelCols:p}=t,h=u==="stddev",m=o*r,g=new Float64Array(m),w=new Float64Array(m),y=new Uint32Array(m);for(let T=0;Tb-R),a?(m[y+d]=v[Math.floor((v.length-1)/2)],g[y+d]=v.length):n[y+d]=v[Math.floor((v.length-1)/2)])}}if(a)for(let w=p;wT&&(T=G,k=$);a?(w[v+b]=k,y[v+b]=R.size):n[v+b]=k}}if(a)for(let d=p;d1&&(n==null?void 0:n.length)){b=new Uint8Array(p),b.set(v[0]);for(let k=1;kNumber(i??(t==null?void 0:t.kernelRows)??3)}}})],ft.prototype,"rows",void 0),c([f({json:{write:!0,read:{source:["kernelCols","cols"],reader:(i,t)=>Number(i??(t==null?void 0:t.kernelCols)??3)}}})],ft.prototype,"cols",void 0),c([f({json:{write:!0}})],ft.prototype,"fillNoDataOnly",void 0),c([f({json:{read:{source:["statisticsType","type"],reader:(i,t)=>ze.fromJSON((t==null?void 0:t.statisticsType)??(t==null?void 0:t.type))??"min"},write:{target:"type"}}}),Z(ze)],ft.prototype,"statisticsType",void 0),ft=re=c([A("esri.layers.support.rasterFunctions.StatisticsFunctionArguments")],ft);const Cr=ft,Br=new Set(["min","max","mean","median","majority","minority"]);let Tt=class extends V{constructor(){super(...arguments),this.functionName="Statistics",this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const{type:t}=this.functionArguments.toJSON();if(t<1||t>7)return{success:!1,supportsGPU:!1,error:`statistics-function: the given statistics type is not supported ${t}`};const e=this.sourceRasterInfos[0];this.outputPixelType=this._getOutputPixelType(e.pixelType);const s=e.clone();s.pixelType=this.outputPixelType;const{statisticsType:o}=this.functionArguments;return Br.has(o)||(s.statistics=null,s.histograms=null,s.colormap=null,s.attributeTable=null),this.rasterInfo=s,{success:!0,supportsGPU:s.bandCount<=3&&t<5}}_processPixels(t){var n;const e=(n=t.pixelBlocks)==null?void 0:n[0];if(e==null)return e;const{statisticsType:s,rows:o,cols:r,fillNoDataOnly:a}=this.functionArguments;return kr(e,{kernelRows:o,kernelCols:r,fillNoDataOnly:a,outputPixelType:this.outputPixelType,statisticsType:s,mirrorEdges:!0})}_getWebGLParameters(){const{rows:t,cols:e,statisticsType:s,fillNoDataOnly:o}=this.functionArguments;return{fillNoDataOnly:o,kernelRows:t,kernelCols:e,statisticsType:s,clampRange:Dt(this.outputPixelType)}}};c([f({json:{write:!0,name:"rasterFunction"}})],Tt.prototype,"functionName",void 0),c([f({type:Cr,json:{write:!0,name:"rasterFunctionArguments"}})],Tt.prototype,"functionArguments",void 0),c([f()],Tt.prototype,"rasterArgumentNames",void 0),Tt=c([A("esri.layers.support.rasterFunctions.StatisticsFunction")],Tt);const jr=Tt;var oe;let mt=oe=class extends U{constructor(){super(...arguments),this.statistics=null,this.histograms=null}readStatistics(i,t){if(!(i!=null&&i.length))return null;const e=[];return i.forEach(s=>{const o={min:s.min,max:s.max,avg:s.avg??s.mean,stddev:s.stddev??s.standardDeviation};e.push(o)}),e}writeStatistics(i,t,e){if(!(i!=null&&i.length))return;const s=[];i.forEach(o=>{const r={...o,mean:o.avg,standardDeviation:o.stddev};delete r.avg,delete r.stddev,s.push(r)}),t[e]=s}clone(){return new oe({statistics:W(this.statistics),histograms:W(this.histograms)})}};c([f({json:{write:!0}})],mt.prototype,"statistics",void 0),c([Nt("statistics")],mt.prototype,"readStatistics",null),c([Ft("statistics")],mt.prototype,"writeStatistics",null),c([f({json:{write:!0}})],mt.prototype,"histograms",void 0),mt=oe=c([A("esri.layers.support.rasterFunctions.StatisticsHistogramFunctionArguments")],mt);const _r=mt;let st=class extends V{constructor(){super(...arguments),this.functionName="StatisticsHistogram",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isNoopProcess=!0}_bindSourceRasters(){const t=this.sourceRasterInfos[0];this.outputPixelType=this._getOutputPixelType("u8");const e=t.clone(),{statistics:s,histograms:o}=this.functionArguments;return o&&(e.histograms=o),s&&(e.statistics=s),this.rasterInfo=e,{success:!0,supportsGPU:!0}}_processPixels(t){var e;return(e=t.pixelBlocks)==null?void 0:e[0]}};c([f({json:{write:!0,name:"rasterFunction"}})],st.prototype,"functionName",void 0),c([f({type:_r,json:{write:!0,name:"rasterFunctionArguments"}})],st.prototype,"functionArguments",void 0),c([f()],st.prototype,"rasterArgumentNames",void 0),c([f({json:{write:!0}})],st.prototype,"indexedColormap",void 0),c([f()],st.prototype,"isNoopProcess",void 0),st=c([A("esri.layers.support.rasterFunctions.StatisticsHistogramFunction")],st);const Sr=st;var ie;const Mr=new Mt({0:"none",3:"standard-deviation",4:"histogram-equalization",5:"min-max",6:"percent-clip",9:"sigmoid"},{useNumericKeys:!0});let z=ie=class extends U{constructor(){super(...arguments),this.computeGamma=!1,this.dynamicRangeAdjustment=!1,this.gamma=[],this.histograms=null,this.statistics=null,this.stretchType="none",this.useGamma=!1}writeStatistics(i,t,e){i!=null&&i.length&&(Array.isArray(i[0])||(i=i.map(s=>[s.min,s.max,s.avg,s.stddev])),t[e]=i)}clone(){return new ie({stretchType:this.stretchType,outputMin:this.outputMin,outputMax:this.outputMax,useGamma:this.useGamma,computeGamma:this.computeGamma,statistics:W(this.statistics),gamma:W(this.gamma),sigmoidStrengthLevel:this.sigmoidStrengthLevel,numberOfStandardDeviations:this.numberOfStandardDeviations,minPercent:this.minPercent,maxPercent:this.maxPercent,histograms:W(this.histograms),dynamicRangeAdjustment:this.dynamicRangeAdjustment,raster:this.raster})}};c([f({type:Boolean,json:{write:!0}})],z.prototype,"computeGamma",void 0),c([f({type:Boolean,json:{name:"dra",write:!0}})],z.prototype,"dynamicRangeAdjustment",void 0),c([f({type:[Number],json:{write:!0}})],z.prototype,"gamma",void 0),c([f()],z.prototype,"histograms",void 0),c([f({type:Number,json:{write:!0}})],z.prototype,"maxPercent",void 0),c([f({type:Number,json:{write:!0}})],z.prototype,"minPercent",void 0),c([f({type:Number,json:{write:!0}})],z.prototype,"numberOfStandardDeviations",void 0),c([f({type:Number,json:{name:"max",write:!0}})],z.prototype,"outputMax",void 0),c([f({type:Number,json:{name:"min",write:!0}})],z.prototype,"outputMin",void 0),c([f({type:Number,json:{write:!0}})],z.prototype,"sigmoidStrengthLevel",void 0),c([f({json:{type:[[Number]],write:!0}})],z.prototype,"statistics",void 0),c([Ft("statistics")],z.prototype,"writeStatistics",null),c([Z(Mr)],z.prototype,"stretchType",void 0),c([f({type:Boolean,json:{write:!0}})],z.prototype,"useGamma",void 0),z=ie=c([A("esri.layers.support.rasterFunctions.StretchFunctionArguments")],z);const Dr=z;let nt=class extends V{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:e}=t,{functionArguments:s}=this,{dynamicRangeAdjustment:o,gamma:r,useGamma:a}=s;if(!o&&["u8","u16","s8","s16"].includes(e)){const u=Ut(s.toJSON(),{rasterInfo:t}),l=this._isOutputRoundingNeeded()?"round":"float";this.lookup=vs({pixelType:e,...u,gamma:a?r:null,rounding:l}),this.cutOffs=u}else o||(this.cutOffs=Ut(s.toJSON(),{rasterInfo:t}));this.outputPixelType=this._getOutputPixelType(e);const n=t.clone();return n.pixelType=this.outputPixelType,n.statistics=null,n.histograms=null,n.colormap=null,n.attributeTable=null,this.outputPixelType==="u8"&&(n.keyProperties.DataType="processed"),this.rasterInfo=n,{success:!0,supportsGPU:!o}}_processPixels(t){var n;const e=(n=t.pixelBlocks)==null?void 0:n[0];if(e==null)return e;const{lookup:s}=this;if(s)return ge(e,{...s,outputPixelType:this.rasterInfo.pixelType});const{functionArguments:o}=this,r=this.cutOffs||Ut(o.toJSON(),{rasterInfo:this.sourceRasterInfos[0],pixelBlock:e}),a=o.useGamma?o.gamma:null;return As(e,{...r,gamma:a,outputPixelType:this.outputPixelType})}_getWebGLParameters(){const{outputMin:t=0,outputMax:e=255,gamma:s,useGamma:o}=this.functionArguments,r=this.rasterInfo.bandCount>=2?3:1,a=o&&(s!=null&&s.length)?Ps(r,s):[1,1,1],{minCutOff:n,maxCutOff:u}=this.cutOffs??{minCutOff:[0,0,0],maxCutOff:[255,255,255]};n.length===1&&(n[1]=n[2]=n[0],u[1]=u[2]=u[0]);const l=new Float32Array(r);let p;for(p=0;p1||t.pixelType.startsWith("f"))return{success:!1,supportsGPU:!1,error:"table-function: Source data must be single band and integer pixel type."};const{attributeTableAsRecordSet:e}=this.functionArguments;if(!e)return{success:!1,supportsGPU:!1,error:"table-function: Missing attributeTableAsRecordSet argument."};this.outputPixelType=this._getOutputPixelType(t.pixelType);const s=t.clone();return s.pixelType=this.outputPixelType,s.bandCount=1,s.dataType!=="thematic"&&(s.keyProperties=s.keyProperties?{...s.keyProperties,DataType:"thematic"}:{DataType:"thematic"}),this.rasterInfo=s,{success:!0,supportsGPU:!0}}_processPixels(t){var e;return(e=t.pixelBlocks)==null?void 0:e[0]}};c([f({json:{write:!0,name:"rasterFunction"}})],dt.prototype,"functionName",void 0),c([f({type:Er,json:{write:!0,name:"rasterFunctionArguments"}})],dt.prototype,"functionArguments",void 0),c([f()],dt.prototype,"rasterArgumentNames",void 0),c([f()],dt.prototype,"isNoopProcess",void 0),dt=c([A("esri.layers.support.rasterFunctions.TableFunction")],dt);const Gr=dt,D=new Map;function zr(i,t){const{rasterFunctionArguments:e}=i;e&&(e.rasters||[e.raster]).forEach(s=>{s&&typeof s!="number"&&(typeof s=="string"?s.startsWith("http")&&(t.includes(s)||t.push(s)):"rasterFunctionArguments"in s&&zr(s,t))})}function Ao(i,t){if(t=t??{},"function"in(i=W(i))&&"arguments"in i&&i.arguments){const e=es(i,new Map,t);if(ce(e),!e.renderingRule)throw new It("raster-function-helper","Unsupported raster function json.");i=e.renderingRule}if("rasterFunction"in i)return Qe(i=ue(i),t);throw new It("raster-function-helper","unsupported raster function json.")}function Ur(i,t){return t[0]==="rasters"&&Array.isArray(i.rasters)?i.rasters:t.map(e=>i[e])}function Ue(i){return!!(i&&typeof i=="object"&&i.rasterFunction&&i.rasterFunctionArguments)}function ue(i){var o;const{rasterFunction:t,rasterFunctionArguments:e}=i,s={};for(const r in e){let a=e[r];const n=r.toLowerCase();if(n==="rasters"&&Array.isArray(a))s.rasters=a.map(u=>Ue(u)?ue(u):u);else switch(Ue(a)&&(a=ue(a)),n){case"dra":s.dra=a;break;case"pspower":s.psPower=a;break;case"pszfactor":s.psZFactor=a;break;case"bandids":s.bandIds=a;break;default:s[r[0].toLowerCase()+r.slice(1)]=a}}return t!=="Local"||(o=s.rasters)!=null&&o.length||(s.rasters=["$$"]),{...i,rasterFunctionArguments:s}}function Qe(i,t){var m,g;const{rasterFunction:e,rasterFunctionArguments:s}=i,o=(m=i.outputPixelType)==null?void 0:m.toLowerCase();if(e==null||!D.has(e))throw new It("raster-function-helper",`unsupported raster function: ${e}`);const r=D.get(e),a=(typeof r.ctor=="function"?r.ctor:r.ctor.default).fromJSON({...i,outputPixelType:o}),{rasterArgumentNames:n}=a,u=[],l=Ur(s,n),p=n[0]==="rasters",h=[];for(let w=0;wtypeof r=="object"&&r.type==="RasterFunctionVariable"?le(r,t):r);if("value"in e&&["number","string","boolean"].includes(typeof e.value))return e.value;if(i.isDataset&&e.type!=="Scalar")return"$$";if(!("type"in e))return e;let s=e;switch(e.type){case"Scalar":s=e.value;break;case"AlgorithmicColorRamp":s=Ve(e);break;case"MultiPartColorRamp":s={type:"multipart",colorRamps:e.ArrayOfColorRamp.map(Ve)};break;case"ArgumentArray":if((o=e.elements)!=null&&o.length&&e.elements[0].type!=="RasterStatistics"){const r=[];for(let a=0;a{if(typeof n=="object")if(n._object_ref_id!=null){if(!e.has(n._object_ref_id))throw new It("raster-function-helper",`unsupported raster function json. _object_ref_id: ${r} does not exist`);const l=e.get(a);l&&typeof l=="object"?Object.assign(n,l):r[u]=l}else ce({renderingRule:n,templates:e})}));else{if(!e.has(a))throw new It("raster-function-helper",`unsupported raster function json. _object_ref_id: ${a} does not exist`);const n=e.get(a);o!=="_object_ref_id"?s[o]=n:n&&typeof n=="object"&&Object.assign(s,n)}}}function Vr(i){var t;(t=i.Statistics)!=null&&t.length&&typeof i.Statistics=="object"&&(i.Statistics=i.Statistics.map(e=>[e.min,e.max,e.mean,e.standardDeviation])),i.NumberOfStandardDeviation!=null&&(i.NumberOfStandardDeviations=i.NumberOfStandardDeviation,delete i.NumberOfStandardDeviation)}function Lr(i){var t,e;((e=(t=i.ColorRamp)==null?void 0:t.type)==null?void 0:e.toLowerCase())==="randomcolorramp"&&(delete i.ColorRamp,i.ColormapName="Random"),i.ColorSchemeType===0&&delete i.ColorRamp}function Wr(i){i.ConvolutionType!=null&&(i.Type=i.ConvolutionType,delete i.ConvolutionType)}function qr(i){var t;(t=i.NoDataValues)!=null&&t.length&&typeof i.NoDataValues[0]=="string"&&(i.NoDataValues=i.NoDataValues.filter(e=>e!=="").map(e=>Number(e)))}D.set("Aspect",{desc:"Aspect Function",ctor:Ns,rasterArgumentNames:["raster"]}),D.set("BandArithmetic",{desc:"Band Arithmetic Function",ctor:Qs,rasterArgumentNames:["raster"]}),D.set("Colormap",{desc:"Colormap Function",ctor:cn,rasterArgumentNames:["raster"]}),D.set("CompositeBand",{desc:"CompositeBand Function",ctor:hn,rasterArgumentNames:["rasters"]}),D.set("Convolution",{desc:"Convolution Function",ctor:Pn,rasterArgumentNames:["raster"]}),D.set("ContrastBrightness",{desc:"Contrast Brightness Function",ctor:mn,rasterArgumentNames:["raster"]}),D.set("ExtractBand",{desc:"ExtractBand Function",ctor:Fn,rasterArgumentNames:["raster"]}),D.set("Curvature",{desc:"Curvature Function",ctor:$n,rasterArgumentNames:["raster"]}),D.set("Local",{desc:"Local Function",ctor:gr,rasterArgumentNames:["rasters"]}),D.set("Mask",{desc:"Mask Function",ctor:wr,rasterArgumentNames:["raster"]}),D.set("NDVI",{desc:"NDVI Function",ctor:xr,rasterArgumentNames:["raster"]}),D.set("Remap",{desc:"Remap Function",ctor:Ar,rasterArgumentNames:["raster"]}),D.set("Slope",{desc:"Slope Function",ctor:$r,rasterArgumentNames:["raster"]}),D.set("Statistics",{desc:"Focal Statistics Function",ctor:jr,rasterArgumentNames:["raster"]}),D.set("StatisticsHistogram",{desc:"Statistics Histogram Function",ctor:Sr,rasterArgumentNames:["raster"]}),D.set("Stretch",{desc:"Stretch Function",ctor:Or,rasterArgumentNames:["raster"]}),D.set("Table",{desc:"Attribute Table Function",ctor:Gr,rasterArgumentNames:["raster"]});let jt=class extends de{get affectsPixelSize(){return!1}forwardTransform(i){return i}inverseTransform(i){return i}};c([f()],jt.prototype,"affectsPixelSize",null),c([f({json:{write:!0}})],jt.prototype,"spatialReference",void 0),jt=c([A("esri.layers.support.rasterTransforms.BaseRasterTransform")],jt);const ve=jt;var pe;let _t=pe=class extends ve{constructor(){super(...arguments),this.type="gcs-shift",this.tolerance=1e-8}forwardTransform(i){return(i=i.clone()).type==="point"?(i.x>180+this.tolerance&&(i.x-=360),i):(i.xmin>=180-this.tolerance?(i.xmax-=360,i.xmin-=360):i.xmax>180+this.tolerance&&(i.xmin=-180,i.xmax=180),i)}inverseTransform(i){return(i=i.clone()).type==="point"?(i.x<-this.tolerance&&(i.x+=360),i):(i.xmin<-this.tolerance&&(i.xmin+=360,i.xmax+=360),i)}clone(){return new pe({tolerance:this.tolerance})}};c([Z({GCSShiftXform:"gcs-shift"})],_t.prototype,"type",void 0),c([f()],_t.prototype,"tolerance",void 0),_t=pe=c([A("esri.layers.support.rasterTransforms.GCSShiftTransform")],_t);const Xr=_t;var he;let Gt=he=class extends ve{constructor(){super(...arguments),this.type="identity"}clone(){return new he}};c([Z({IdentityXform:"identity"})],Gt.prototype,"type",void 0),Gt=he=c([A("esri.layers.support.rasterTransforms.IdentityTransform")],Gt);const Hr=Gt;var fe;function me(i,t,e){const{x:s,y:o}=t;if(e<2)return{x:i[0]+s*i[2]+o*i[4],y:i[1]+s*i[3]+o*i[5]};if(e===2){const m=s*s,g=o*o,w=s*o;return{x:i[0]+s*i[2]+o*i[4]+m*i[6]+w*i[8]+g*i[10],y:i[1]+s*i[3]+o*i[5]+m*i[7]+w*i[9]+g*i[11]}}const r=s*s,a=o*o,n=s*o,u=r*s,l=r*o,p=s*a,h=o*a;return{x:i[0]+s*i[2]+o*i[4]+r*i[6]+n*i[8]+a*i[10]+u*i[12]+l*i[14]+p*i[16]+h*i[18],y:i[1]+s*i[3]+o*i[5]+r*i[7]+n*i[9]+a*i[11]+u*i[13]+l*i[15]+p*i[17]+h*i[19]}}function Le(i,t,e){const{xmin:s,ymin:o,xmax:r,ymax:a,spatialReference:n}=t;let u=[];if(e<2)u.push({x:s,y:a}),u.push({x:r,y:a}),u.push({x:s,y:o}),u.push({x:r,y:o});else{let h=10;for(let m=0;mme(i,h,e));const l=u.map(h=>h.x),p=u.map(h=>h.y);return new is({xmin:Math.min.apply(null,l),xmax:Math.max.apply(null,l),ymin:Math.min.apply(null,p),ymax:Math.max.apply(null,p),spatialReference:n})}function Jr(i){const[t,e,s,o,r,a]=i,n=s*a-r*o,u=r*o-s*a;return[(r*e-t*a)/n,(s*e-t*o)/u,a/n,o/u,-r/n,-s/u]}let X=fe=class extends ve{constructor(){super(...arguments),this.polynomialOrder=1,this.type="polynomial"}readForwardCoefficients(i,t){const{coeffX:e,coeffY:s}=t;if(!(e!=null&&e.length)||!(s!=null&&s.length)||e.length!==s.length)return null;const o=[];for(let r=0;r0}forwardTransform(i){if(i.type==="point"){const t=me(this.forwardCoefficients,i,this.polynomialOrder);return new Pe({x:t.x,y:t.y,spatialReference:i.spatialReference})}return Le(this.forwardCoefficients,i,this.polynomialOrder)}inverseTransform(i){if(i.type==="point"){const t=me(this.inverseCoefficients,i,this.polynomialOrder);return new Pe({x:t.x,y:t.y,spatialReference:i.spatialReference})}return Le(this.inverseCoefficients,i,this.polynomialOrder)}clone(){return new fe({polynomialOrder:this.polynomialOrder,forwardCoefficients:this.forwardCoefficients?[...this.forwardCoefficients]:null,inverseCoefficients:this.inverseCoefficients?[...this.inverseCoefficients]:null})}};c([f({json:{write:!0}})],X.prototype,"polynomialOrder",void 0),c([f()],X.prototype,"forwardCoefficients",void 0),c([Nt("forwardCoefficients",["coeffX","coeffY"])],X.prototype,"readForwardCoefficients",null),c([Ft("forwardCoefficients")],X.prototype,"writeForwardCoefficients",null),c([f({json:{write:!0}})],X.prototype,"inverseCoefficients",null),c([Nt("inverseCoefficients",["inverseCoeffX","inverseCoeffY"])],X.prototype,"readInverseCoefficients",null),c([Ft("inverseCoefficients")],X.prototype,"writeInverseCoefficients",null),c([f()],X.prototype,"affectsPixelSize",null),c([Z({PolynomialXform:"polynomial"})],X.prototype,"type",void 0),X=fe=c([A("esri.layers.support.rasterTransforms.PolynomialTransform")],X);const Kr=X,ns={GCSShiftXform:Xr,IdentityXform:Hr,PolynomialXform:Kr},Yr=Object.keys(ns);function Po(i){const t=i==null?void 0:i.type;return!i||Yr.includes(t)}function To(i){if(!(i==null?void 0:i.type))return null;const e=ns[i==null?void 0:i.type];if(e){const s=new e;return s.read(i),s}return null}export{zr as C,Ao as R,Po as f,To as i,Xr as n,Kr as y};