@arcgis/core 4.30.0-next.20240210 → 4.30.0-next.20240213

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/05ebb9cec0e1826b283f.js +1 -0
  3. package/assets/esri/core/workers/chunks/0d54451c740f54a59f49.js +1 -0
  4. package/assets/esri/core/workers/chunks/{2b7513fe57eca6cff7c3.js → 0f30059c4e7a9cb85d1d.js} +1 -1
  5. package/assets/esri/core/workers/chunks/18551a7eb5a9b88aa0dc.js +1 -0
  6. package/assets/esri/core/workers/chunks/24d19abc680b341d13bb.js +1 -0
  7. package/assets/esri/core/workers/chunks/{3f4d63436c3de04a6ebb.js → 254b4ee3621bbe345bb1.js} +1 -1
  8. package/assets/esri/core/workers/chunks/2d682ee6e5d66f2ea5cd.js +1 -0
  9. package/assets/esri/core/workers/chunks/{d5484d470121de2b403b.js → 36d091be859bbb1a149b.js} +1 -1
  10. package/assets/esri/core/workers/chunks/50b41f91be903a0977f9.js +1 -0
  11. package/assets/esri/core/workers/chunks/50bb67f2eeace5d50673.js +1 -0
  12. package/assets/esri/core/workers/chunks/784b6a8216b97440b180.js +1 -0
  13. package/assets/esri/core/workers/chunks/{7f7a4de2cd4ab71b9aee.js → 8d119dc0a92ad3612daa.js} +1 -1
  14. package/assets/esri/core/workers/chunks/966cc0b54008c7348678.js +1 -0
  15. package/assets/esri/core/workers/chunks/{2853221e88ed7077a447.js → 9850b0e04cce8c1bdddf.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{0014635097a32ad38895.js → a854611d1a86b838c6ad.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{cf6970b490b98aa0a117.js → be562536212360943388.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{50a5abd75fa7dbb571a5.js → ccd53b81c2688dd11584.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{b2b8e6a0b3f70ada2799.js → e4da908079417cc2f495.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{af0314c2b5b7dc4f5bbd.js → e6dbf0a7b7b1cf64f23f.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{eba72ff1726ff6998204.js → f03d62ab7806b68d0b62.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{5fcda75ed02b8aee3a3c.js → f89278782ddfb154aa9f.js} +1 -1
  23. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  24. package/geometry/Mesh.js +1 -1
  25. package/geometry/support/meshVertexSpaceUtils.js +1 -1
  26. package/interfaces.d.ts +174 -16
  27. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  28. package/layers/SceneLayer.js +1 -1
  29. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  30. package/layers/support/PixelBlock.js +1 -1
  31. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  32. package/layers/support/rasterDatasets/MRFRaster.js +1 -1
  33. package/layers/support/rasterFormats/RasterCodec.js +1 -1
  34. package/layers/support/rasterFunctions/surfaceUtils.js +1 -1
  35. package/package.json +2 -2
  36. package/portal/support/resourceUtils.js +1 -1
  37. package/rest/query/operations/pbfJSONFeatureSet.js +1 -1
  38. package/rest/support/meshFeatureSet.js +1 -1
  39. package/support/revision.js +1 -1
  40. package/symbols/cim/constants.js +1 -1
  41. package/symbols/support/previewSymbol2D.js +1 -1
  42. package/versionManagement/support/versionManagementUtils.js +1 -1
  43. package/views/2d/engine/webgl/collisions/CollisionEngine.js +1 -1
  44. package/views/2d/engine/webgl/collisions/CollisionGrid.js +1 -1
  45. package/views/2d/engine/webgl/collisions/LabelMetric.js +1 -1
  46. package/views/2d/engine/webgl/mesh/templates/segmentUtils.js +1 -1
  47. package/views/2d/engine/webgl/shaderGraph/GLSLShaderModule.js +1 -1
  48. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  49. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js +1 -1
  50. package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartMeshWriter.js +1 -1
  51. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/constants.js +1 -1
  52. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
  53. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
  54. package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
  55. package/views/2d/layers/features/schema/processor/symbols/SymbolSchema.js +1 -1
  56. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  57. package/views/3d/interactive/editingTools/transformGraphic/ExtentScale.js +1 -1
  58. package/views/3d/interactive/editingTools/transformGraphic/extentUtils.js +1 -1
  59. package/views/3d/layers/I3SMeshView3D.js +1 -1
  60. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  61. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  62. package/views/SceneView.js +1 -1
  63. package/views/draw/DrawOperation.js +1 -1
  64. package/views/draw/support/Box.js +1 -1
  65. package/views/interactive/tooltip/components/TooltipEditableField.js +1 -1
  66. package/views/support/automaticLengthMeasurementUtils.js +1 -1
  67. package/views/support/extentUtils.js +5 -0
  68. package/widgets/BasemapLayerList.js +1 -1
  69. package/widgets/Editor/EditorViewModel.js +1 -1
  70. package/widgets/FeatureForm.js +1 -1
  71. package/widgets/LayerList.js +1 -1
  72. package/widgets/TableList.js +1 -1
  73. package/assets/esri/core/workers/chunks/062629a9b4695dea8bf8.js +0 -1
  74. package/assets/esri/core/workers/chunks/3401157faaa8619aaa47.js +0 -1
  75. package/assets/esri/core/workers/chunks/37803888bd9a537481a7.js +0 -1
  76. package/assets/esri/core/workers/chunks/560f677a356c7ebde5d3.js +0 -1
  77. package/assets/esri/core/workers/chunks/5bfc5ffad705aaaafcd4.js +0 -1
  78. package/assets/esri/core/workers/chunks/655f4560fb36a0d9ff0b.js +0 -1
  79. package/assets/esri/core/workers/chunks/b927b655e955abe00d48.js +0 -1
  80. package/assets/esri/core/workers/chunks/d2417d179d015f1193a1.js +0 -1
  81. package/assets/esri/core/workers/chunks/f75ec599f53c66cab194.js +0 -1
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[7048],{89004:(t,e,n)=>{n.d(e,{Su:()=>cs,sJ:()=>ls});var s=n(27576),r=n(20744),o=n(62088),i=n(41948),a=n(1580),u=(n(9456),n(66360),n(72052),n(12552)),l=n(620),c=n(40504);let p=class extends c.am{constructor(){super(...arguments),this.raster=void 0}};(0,i._)([(0,a.qq)({json:{write:!0}})],p.prototype,"raster",void 0),p=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.AspectFunctionArguments")],p);const h=p;var f;let m=f=class extends h{constructor(){super(...arguments),this.raster2=void 0}get rasters(){return[this.raster,this.raster2]}clone(){return new f({raster:this.raster,raster2:this.raster2,operation:this.operation})}};(0,i._)([(0,a.qq)({json:{write:!0}})],m.prototype,"operation",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],m.prototype,"raster2",void 0),(0,i._)([(0,a.qq)({readOnly:!0})],m.prototype,"rasters",null),m=f=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.ArithmeticFunctionArguments")],m);const d=m;var g=n(33392),y=n(66820),x=n(64896);const w=new Set(["slope","aspect","curvature","hillshade","shadedrelief","statistics"]);let v=class extends c.am{constructor(){super(...arguments),this.functionArguments=null,this.readingBufferSize=0,this.id=-1,this.isNoopProcess=!1,this.rawInputBandIds=[],this.rawSourceRasterInfos=null,this.isInputBandIdsSwizzled=!1,this.swizzledBandSelection=[],this.isBranch=!1,this._bindingResult=null}get supportsGPU(){return this._bindingResult.supportsGPU}get flatWebGLFunctionChain(){const t=this.getWebGLProcessorDefinition();if(!t)return null;const e=[t],{parameters:n}=t;let s=n.rasters||n.raster&&[n.raster];for(;s?.length;){e.unshift(...s);const t=[];for(let e=0;e<s.length;e++){const{parameters:n}=s[e],r=n.rasters||n.raster&&[n.raster];r?.length&&t.push(...r)}s=t}for(let t=e.length-1;t>=0;t--)e[t].isNoopProcess&&e.splice(t,1);let r=!1;for(let t=0;t<e.length;t++){const n=e[t];n.id=e.length-t-1;const{rasters:s}=n.parameters;r=r||null!=s&&s.length>1}const o=e.some((({name:t})=>w.has(t.toLowerCase()))),{rawSourceRasterInfos:i}=this;return{functions:e,hasBranches:r,hasFocalFunction:o,isSourceSingleBand:1===i?.[0]?.bandCount}}bind(t,e=!1,n=-1){this.id=n+1;const s=this._getRasterValues();let r=!0;for(let n=0;n<s.length;n++){const o=s[n];if(null!=o&&this._isRasterFunctionValue(o)){const s=o.bind(t,e,this.id+n);if(!s.success)return this._bindingResult=s,s;r=r&&s.supportsGPU}}return!this.rasterInfo||e?(this.sourceRasterInfos=this._getSourceRasterInfos(t),this._bindingResult=this._bindSourceRasters(),this._bindingResult.success&&this._patchRasterInfo(),this._bindingResult.supportsGPU=r&&this._bindingResult.supportsGPU,this.processInputBandIds(),this._bindingResult):(this._bindingResult={success:!0,supportsGPU:!0},this.processInputBandIds(),this._bindingResult)}process(t){const e=this._getRasterValues(),n=0===e.length?t.pixelBlocks??t.primaryPixelBlocks:e.map((e=>this._readRasterValue(e,t)));return this._processPixels({...t,pixelBlocks:n})}processInputBandIds(){const t=this._getRasterValues().filter(this._isRasterFunctionValue);let e;if(t.length>1){const e=t.map((t=>t.processInputBandIds()[0]));this.rawInputBandIds=e,this.isInputBandIdsSwizzled=this.rawInputBandIds.some(((t,e)=>t!==e));const n=t.filter((t=>"ExtractBand"===t.functionName));return n.length&&n.forEach(((t,e)=>{t.isInputBandIdsSwizzled=!0,t.swizzledBandSelection=[e,e,e]})),this.rawInputBandIds}const n=t[0];if(n){if(e=n.processInputBandIds(),n.isInputBandIdsSwizzled)return this.rawInputBandIds=e,e}else{e=[];const{bandCount:t}=this.sourceRasterInfos[0];for(let n=0;n<t;n++)e.push(n)}const s=this._getInputBandIds(e);return this.isInputBandIdsSwizzled=s.some(((t,e)=>t!==e)),this.rawInputBandIds=s,this.rawInputBandIds}getPrimaryRasters(){const t=[],e=[];return this._getPrimaryRasters(this,t,e),{rasters:t,rasterIds:e}}getWebGLProcessorDefinition(){const t=this._getWebGLParameters(),{raster:e,rasters:n}=this.functionArguments;return n&&Array.isArray(n)&&n.length?(t.rasters=n.map((t=>this._isRasterFunctionValue(t)?t.getWebGLProcessorDefinition():"number"==typeof t?{name:"Constant",parameters:{value:t},pixelType:"f32",id:-1,isNoopProcess:!1}:{name:"Identity",parameters:{value:t},pixelType:"f32",id:-1,isNoopProcess:!1})),t.rasters.some((t=>null!=t))||(t.rasters=null)):this._isRasterFunctionValue(e)&&(t.raster=e.getWebGLProcessorDefinition()),{name:this.functionName,parameters:t,pixelType:this.outputPixelType,id:this.id,isNoopProcess:this.isNoopProcess}}getClippingGeometries(){const t=[];"Clip"===this.functionName&&t.push(this.functionArguments);const{raster:e,rasters:n}=this.functionArguments;if(n&&Array.isArray(n)&&n.length)n.forEach((e=>{if(this._isRasterFunctionValue(e)){const n=e.getClippingGeometries();t.push(...n)}}));else if(this._isRasterFunctionValue(e)){const n=e.getClippingGeometries();t.push(...n)}return t}_getOutputPixelType(t){return"unknown"===this.outputPixelType?t:this.outputPixelType??t}_getWebGLParameters(){return{}}_getInputBandIds(t){return t}_removeStatsHistColormapVAT(t){t.statistics=null,t.histograms=null,t.colormap=null,t.attributeTable=null}_getRasterValues(){const{rasterArgumentNames:t}=this;return"rasters"===t[0]?this.functionArguments.rasters??[]:t.flatMap((t=>this.functionArguments[t]))}_getSourceRasterInfos(t){const e=this._getRasterValues(),{rasterInfos:n,rasterIds:s}=t;if(0===e.length)return n;const r=e.map((t=>t&&"object"==typeof t&&"bind"in t&&t.rasterInfo?t.rasterInfo:"string"==typeof t&&s.includes(t)?n[s.indexOf(t)]:"number"!=typeof t?n[0]:void 0)),o=r.find((t=>t))??n[0];return r.forEach(((t,e)=>{void 0===t&&(r[e]=o)})),r}_getPrimaryRasterId(t){return t?.rasterId}_getPrimaryRasters(t,e=[],n=[]){for(let s=0;s<t.sourceRasters.length;s++){const r=t.sourceRasters[s];if("number"!=typeof r)if("bind"in r)this._getPrimaryRasters(r,e,n);else{const t=r,s=this._getPrimaryRasterId(t);if(null==s)continue;n.includes(s)||(this.mainPrimaryRasterId===s?(e.unshift(t),n.unshift(s)):(e.push(t),n.push(s)))}}}_isRasterFunctionValue(t){return null!=t&&"object"==typeof t&&"getWebGLProcessorDefinition"in t}_readRasterValue(t,e){const{primaryPixelBlocks:n}=e;if(null==t||"$$"===t){const t=n[0];return null==t?null:t.clone()}if("string"==typeof t){const s=e.primaryRasterIds.indexOf(t);return-1===s?null:n[s]}if("number"==typeof t){const e=n[0];if(null==e)return null;const{width:s,height:r,pixelType:o}=e,i=new Float32Array(s*r);i.fill(t);const a=this.sourceRasterInfos[0].bandCount,u=new Array(a).fill(i);return new y.c({width:s,height:r,pixelType:o,pixels:u})}return t.process(e)}_patchRasterInfo(){const{rasterInfo:t}=this;if(!t?.keyProperties)return;const{bandCount:e,keyProperties:n,statistics:s,histograms:r}=t,o=n.BandProperties;o&&o.length!==e&&(t.keyProperties={...n,BandProperties:void 0}),s&&s.length!==e&&(t.statistics=s.length>e?s.slice(0,e):null),r&&r.length!==e&&(t.histograms=r.length>e?r.slice(0,e):null),n.BAND_COUNT&&Number(n.BAND_COUNT)!==e&&(t.keyProperties={...n,BAND_COUNT:"string"==typeof n.BAND_COUNT?String(e):e})}};(0,i._)([(0,a.qq)({json:{write:!0}})],v.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],v.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],v.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.qq)({json:{write:!0}}),(0,g.W)((t=>t?.toLowerCase()))],v.prototype,"outputPixelType",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],v.prototype,"mainPrimaryRasterId",void 0),(0,i._)([(0,a.qq)()],v.prototype,"sourceRasters",void 0),(0,i._)([(0,a.qq)({type:[x.c],json:{write:!0}})],v.prototype,"sourceRasterInfos",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],v.prototype,"rasterInfo",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],v.prototype,"readingBufferSize",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],v.prototype,"id",void 0),(0,i._)([(0,a.qq)()],v.prototype,"isNoopProcess",void 0),(0,i._)([(0,a.qq)()],v.prototype,"supportsGPU",null),(0,i._)([(0,a.qq)()],v.prototype,"rawInputBandIds",void 0),(0,i._)([(0,a.qq)()],v.prototype,"rawSourceRasterInfos",void 0),(0,i._)([(0,a.qq)()],v.prototype,"isInputBandIdsSwizzled",void 0),(0,i._)([(0,a.qq)()],v.prototype,"swizzledBandSelection",void 0),(0,i._)([(0,a.qq)()],v.prototype,"isBranch",void 0),(0,i._)([(0,a.qq)({readOnly:!0})],v.prototype,"flatWebGLFunctionChain",null),(0,i._)([(0,a.qq)()],v.prototype,"_bindingResult",void 0),v=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.BaseRasterFunction")],v);const _=v,b={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},A={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},q={acos:6,asin:7,atan:8,atanh:9,cos:21,cosh:22,sin:51,sinh:52,tan:56,tanh:57,acosh:59,asinh:60,atan2:61},P={setNull:50,conditional:78},T={plus:1,minus:2,times:3,sqrt:4,power:5,abs:10,divide:23,exp:25,exp10:26,exp2:27,int:30,float:32,ln:35,log10:36,log2:37,mod:44,negate:45,roundDown:48,roundUp:49,square:53,floatDivide:64,floorDivide:65,...A,...q,majority:38,max:39,mean:40,med:41,min:42,minority:43,range:47,stddev:54,sum:55,variety:58,majorityIgnoreNoData:66,maxIgnoreNoData:67,meanIgnoreNoData:68,medIgnoreNoData:69,minIgnoreNoData:70,minorityIgnoreNoData:71,rangeIgnoreNoData:72,stddevIgnoreNoData:73,sumIgnoreNoData:74,varietyIgnoreNoData:75,...P},N=new Map([[q.acos,{domain:[0,Math.PI],isInteger:!1}],[q.asin,{domain:[-Math.PI/2,Math.PI/2],isInteger:!1}],[q.atan,{domain:[-Math.PI/2,Math.PI/2],isInteger:!1}],[q.cos,{domain:[-1,1],isInteger:!1}],[q.sin,{domain:[-1,1],isInteger:!1}],[A.booleanAnd,{domain:[0,1],isInteger:!0}],[A.booleanNot,{domain:[0,1],isInteger:!0}],[A.booleanOr,{domain:[0,1],isInteger:!0}],[A.booleanXOr,{domain:[0,1],isInteger:!0}],[A.equalTo,{domain:[0,1],isInteger:!0}],[A.notEqual,{domain:[0,1],isInteger:!0}],[A.greaterThan,{domain:[0,1],isInteger:!0}],[A.greaterThanEqual,{domain:[0,1],isInteger:!0}],[A.lessThan,{domain:[0,1],isInteger:!0}],[A.lessThanEqual,{domain:[0,1],isInteger:!0}],[A.isNull,{domain:[0,1],isInteger:!0}]]);function R(t){return N.get(t)}const F=[0,2,2,2,1,2,1,1,1,1,1,2,2,1,2,2,2,2,1,2,2,1,1,2,2,1,1,1,2,2,1,1,1,2,2,1,1,1,999,999,999,999,999,999,2,1,2,999,1,1,2,1,1,1,999,999,1,1,999,1,1,2,999,999,2,2,999,999,999,999,999,999,999,999,999,999,3,999,3];function I(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]+r[t]);return i}function k(t,e,n){const[s]=t,r=s.length,o=y.c.createEmptyBand("f32",r);return o.set(s),o}function C(t,e,n){const[s]=t,r=s.length,o=y.c.createEmptyBand(n,r);for(let t=0;t<r;t++)e&&!e[t]||(o[t]=s[t]*s[t]);return o}function S(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]-r[t]);return i}function M(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]*r[t]);return i}function j(t,e,n){const[s]=t,r=s.length,o=y.c.createEmptyBand(n,r);for(let t=0;t<r;t++)e&&!e[t]||(o[t]=Math.sign(s[t])*Math.floor(Math.abs(s[t])));return o}function B(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]/r[t]);return i}function G(t,e,n){return B(t,e,"f32")}function O(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=Math.floor(s[t]/r[t]));return i}function E(t,e,n,s){const r=t[0],o=r.length,i=y.c.createEmptyBand(n,o);if(s===q.atanh){for(let t=0;t<o;t++)if(e[t]){const n=r[t];Math.abs(n)>=1?e[t]=0:i[t]=Math.atanh(n)}return i}const a=s===q.asin?Math.asin:Math.acos;for(let t=0;t<o;t++)if(e[t]){const n=r[t];Math.abs(n)>1?e[t]=0:i[t]=a(n)}return i}function D(t,e,n,s){const[r]=t,o=r.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s(r[t]));return i}function z(t,e,n,s){const[r,o]=t,i=r.length,a=y.c.createEmptyBand(n,i);for(let t=0;t<i;t++)e&&!e[t]||(a[t]=s(r[t],o[t]));return a}function W(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]&r[t]);return i}function L(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]<<r[t]);return i}function U(t,e,n){const[s]=t,r=s.length,o=y.c.createEmptyBand(n,r);for(let t=0;t<r;t++)e&&!e[t]||(o[t]=~s[t]);return o}function V(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]|r[t]);return i}function K(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]>>r[t]);return i}function H(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]^r[t]);return i}function X(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]&&r[t]?1:0);return i}function J(t,e,n){const[s]=t,r=s.length,o=y.c.createEmptyBand(n,r);for(let t=0;t<r;t++)e&&!e[t]||(o[t]=s[t]?0:1);return o}function $(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]||r[t]?1:0);return i}function Y(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=(s[t]?1:0)^(r[t]?1:0));return i}function Z(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]===r[t]?1:0);return i}function Q(t,e,n,s){const[r]=t,o=r.length,i=y.c.createEmptyBand(n,o),a=s===Math.E;for(let t=0;t<o;t++)e&&!e[t]||(i[t]=a?Math.exp(r[t]):s**r[t]);return i}function tt(t,e,n){return Q(t,e,n,10)}function et(t,e,n){return Q(t,e,n,2)}function nt(t,e,n){return Q(t,e,n,Math.E)}function st(t,e,n,s){const[r]=t,o=r.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(r[t]<=0?e[t]=0:i[t]=s(r[t]));return i}function rt(t,e,n){return st(t,e,n,Math.log10)}function ot(t,e,n){return st(t,e,n,Math.log2)}function it(t,e,n){return st(t,e,n,Math.log)}function at(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]>r[t]?1:0);return i}function ut(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]>=r[t]?1:0);return i}function lt(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]<r[t]?1:0);return i}function ct(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]<=r[t]?1:0);return i}function pt(t,e,n){const[s]=t,r=s.length,o=y.c.createEmptyBand(n,r);if(!e)return o;for(let t=0;t<r;t++)o[t]=e[t]?0:1;return o}function ht(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]%r[t]);return i}function ft(t,e,n){const[s]=t,r=s.length,o=y.c.createEmptyBand(n,r);for(let t=0;t<r;t++)e&&!e[t]||(o[t]=-s[t]);return o}function mt(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]===r[t]?0:1);return i}function dt(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o),a=new Uint8Array(o);for(let t=0;t<o;t++)null!=e&&!e[t]||0!==s[t]||(i[t]=r[t],a[t]=255);return{band:i,mask:a}}function gt(t,e,n){const[s,r,o]=t,i=s.length,a=y.c.createEmptyBand(n,i);for(let t=0;t<i;t++)e&&!e[t]||(a[t]=s[t]?r[t]:o[t]);return a}function yt(t,e,n){const s=t.length;if(s<2)return t[0];const[r]=t,o=r.length,i=y.c.createEmptyBand(n,o);for(let n=0;n<o;n++)if(!e||e[n]){let e=r[n];for(let r=1;r<s;r++){const s=t[r][n];e<s&&(e=s)}i[n]=e}return i}function xt(t,e,n){const s=t.length;if(s<2)return t[0];const[r]=t,o=r.length,i=y.c.createEmptyBand(n,o);for(let n=0;n<o;n++)if(!e||e[n]){let e=r[n];for(let r=1;r<s;r++){const s=t[r][n];e>s&&(e=s)}i[n]=e}return i}function wt(t,e,n){const s=t.length;if(s<2)return t[0];const[r]=t,o=r.length,i=y.c.createEmptyBand(n,o);for(let n=0;n<o;n++)if(!e||e[n]){let e=r[n],o=e;for(let r=1;r<s;r++){const s=t[r][n];o<s?o=s:e>s&&(e=s)}i[n]=o-e}return i}function vt(t,e,n){const s=t.length;if(s<2)return t[0];const[r]=t,o=r.length,i=y.c.createEmptyBand(n,o);for(let n=0;n<o;n++)if(!e||e[n]){let e=0;for(let r=0;r<s;r++)e+=t[r][n];i[n]=e/s}return i}function _t(t,e,n){const s=t.length;if(s<2)return t[0];const[r]=t,o=r.length,i=y.c.createEmptyBand(n,o);for(let n=0;n<o;n++)if(!e||e[n])for(let e=0;e<s;e++){const s=t[e];i[n]+=s[n]}return i}function bt(t,e,n){const s=t.length;if(s<2)return t[0];const[r]=t,o=r.length,i=y.c.createEmptyBand(n,o);for(let n=0;n<o;n++)if(!e||e[n]){const e=new Float32Array(s);let r=0;for(let o=0;o<s;o++){const s=t[o];r+=s[n],e[o]=s[n]}r/=s;let o=0;for(let t=0;t<s;t++)o+=(e[t]-r)**2;i[n]=Math.sqrt(o/s)}return i}function At(t,e,n){const s=t.length;if(s<2)return t[0];const r=Math.floor(s/2),[o]=t,i=o.length,a=y.c.createEmptyBand(n,i),u=new Float32Array(s),l=s%2==1;for(let n=0;n<i;n++)if(!e||e[n]){for(let e=0;e<s;e++)u[e]=t[e][n];u.sort(),a[n]=l?u[r]:(u[r]+u[r-1])/2}return a}function qt(t,e,n){const[s,r]=t;if(null==r)return s;const o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e[t]&&(s[t]===r[t]?i[t]=s[t]:e[t]=0);return i}function Pt(t,e,n){const s=t.length;if(s<=2)return qt(t,e,n);const r=t[0].length,o=y.c.createEmptyBand(n,r),i=new Map;for(let n=0;n<r;n++)if(!e||e[n]){let e;i.clear();for(let r=0;r<s;r++)e=t[r][n],i.set(e,i.has(e)?i.get(e)+1:1);let r=0,a=0;for(const t of i.keys())r=i.get(t),r>a&&(a=r,e=t);o[n]=e}return o}function Tt(t,e,n){const s=t.length;if(s<=2)return qt(t,e,n);const r=t[0].length,o=y.c.createEmptyBand(n,r),i=new Map;for(let n=0;n<r;n++)if(!e||e[n]){let e;i.clear();for(let r=0;r<s;r++)e=t[r][n],i.set(e,i.has(e)?i.get(e)+1:1);let r=0,a=t.length;for(const t of i.keys())r=i.get(t),r<a&&(a=r,e=t);o[n]=e}return o}function Nt(t,e,n){const s=t.length;if(s<2)return t[0];const[r]=t,o=r.length,i=y.c.createEmptyBand(n,o),a=new Set;for(let n=0;n<o;n++)if(!e||e[n]){let e;a.clear();for(let r=0;r<s;r++)e=t[r][n],a.add(e);i[n]=a.size}return i}const Rt=new Map,Ft=new Map,It=new Map,kt=new Map;function Ct(t,e,n,s){let[r,o]=(0,l.mO)(n);const i=(0,l.sZ)(n);i&&(r-=1e-5,o+=1e-5);for(let n=0;n<e.length;n++)if(e[n]){const a=t[n];isNaN(a)||a<r||a>o?e[n]=0:s[n]=i?Math.round(a):a}}function St(t,e,n={}){Rt.size||(Rt.set(4,Math.sqrt),Rt.set(6,Math.acos),Rt.set(7,Math.asin),Rt.set(8,Math.atan),Rt.set(9,Math.atanh),Rt.set(10,Math.abs),Rt.set(21,Math.cos),Rt.set(22,Math.cosh),Rt.set(48,Math.floor),Rt.set(49,Math.ceil),Rt.set(51,Math.sin),Rt.set(52,Math.sinh),Rt.set(56,Math.tan),Rt.set(57,Math.tanh),Rt.set(59,Math.acosh),Rt.set(60,Math.asinh),Rt.set(65,Math.floor),Ft.set(5,Math.pow),Ft.set(61,Math.atan2),It.set(1,I),It.set(2,S),It.set(3,M),It.set(11,W),It.set(12,L),It.set(13,U),It.set(14,V),It.set(15,K),It.set(16,H),It.set(17,X),It.set(18,J),It.set(19,$),It.set(20,Y),It.set(23,B),It.set(24,Z),It.set(25,nt),It.set(26,tt),It.set(27,et),It.set(28,at),It.set(29,ut),It.set(30,j),It.set(31,pt),It.set(32,k),It.set(33,lt),It.set(34,ct),It.set(35,it),It.set(36,rt),It.set(37,ot),It.set(44,ht),It.set(45,ft),It.set(46,mt),It.set(53,C),It.set(64,G),It.set(65,O),It.set(76,gt),It.set(78,gt),kt.set(38,Pt),kt.set(39,yt),kt.set(40,vt),kt.set(41,At),kt.set(42,xt),kt.set(43,Tt),kt.set(47,wt),kt.set(54,bt),kt.set(55,_t),kt.set(58,Nt),kt.set(66,Pt),kt.set(67,yt),kt.set(68,vt),kt.set(69,At),kt.set(70,xt),kt.set(71,Tt),kt.set(72,wt),kt.set(73,bt),kt.set(74,_t),kt.set(75,Nt));let s=function(t,e=!1){const n=t.map((t=>t.mask)),s=n.filter((t=>null!=t)),r=t[0].pixels[0].length;if(0===s.length||e&&s.length!==n.length)return new Uint8Array(r).fill(255);const o=s[0],i=new Uint8Array(o);if(1===s.length)return i;if(!e){for(let t=1;t<s.length;t++){const e=s[t];for(let t=0;t<i.length;t++)i[t]&&(i[t]=e[t]?255:0)}return i}for(let t=1;t<s.length;t++){const e=s[t];for(let t=0;t<i.length;t++)0===i[t]&&(i[t]=e[t]?255:0)}return i}(t,e>=66&&e<=75);const{outputPixelType:r="f32"}=n,o=!kt.has(e)||n.processAsMultiband,i=o?t[0].pixels.length:1,a=[];for(let n=0;n<i;n++){const i=kt.has(e)&&!o?t.flatMap((t=>t.pixels)):t.map((t=>t.pixels[n]));let u,l=!0;if(e===P.setNull){const t=dt(i,s,r);u=t.band,s=t.mask,l=!1}else It.has(e)?u=It.get(e)(i,s,"f64"):Rt.has(e)?u=e===q.asin||e===q.acos||e===q.atanh?E(i,s,"f64",e):D(i,s,"f64",Rt.get(e)):Ft.has(e)?u=z(i,s,"f64",Ft.get(e)):kt.has(e)?u=kt.get(e)(i,s,"f64"):(u=i[0],l=!1);if(l&&e!==A.isNull&&!N.has(e)){const t=y.c.createEmptyBand(r,u.length);s||(s=new Uint8Array(u.length).fill(255)),Ct(u,s,r,t),u=t}a.push(u)}const u=t[0];return new y.c({width:u.width,height:u.height,pixelType:r,mask:e===A.isNull?null:s,pixels:a})}let Mt=class extends _{constructor(){super(...arguments),this.functionName="Arithmetic",this.functionArguments=null,this.rasterArgumentNames=["raster","raster2"]}_bindSourceRasters(){const{operation:t}=this.functionArguments;if(t<1||t>6)return{success:!1,supportsGPU:!1,error:"unsupported operation"};const e=this.sourceRasterInfos[0].clone();return this.outputPixelType=this._getOutputPixelType(e.pixelType),e.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(e),this.rasterInfo=e,{success:!0,supportsGPU:e.bandCount<=3}}_processPixels(t){const{pixelBlocks:e}=t;return null==e?.[0]||null==e?.[1]?null:function(t,e,n){return St(t,e=[null,1,2,3,23,5,44][e]??1,{outputPixelType:n})}(e,this.functionArguments.operation,this.outputPixelType)}_getWebGLParameters(){const{operation:t}=this.functionArguments,e=["","plus","minus","times","divide","power","mod"][t],n=this.outputPixelType??"f32";let[s,r]=(0,l.mO)(n);const o=(0,l.sZ)(n);return o&&(s-=1e-4,r+=1e-4),{imageCount:2,operationName:e,domainRange:[s,r],isOutputRounded:o}}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],Mt.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:d,json:{write:!0,name:"rasterFunctionArguments"}})],Mt.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],Mt.prototype,"rasterArgumentNames",void 0),Mt=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.ArithmeticFunction")],Mt);const jt=Mt;var Bt;let Gt=Bt=class extends h{clone(){return new Bt({raster:this.raster})}};Gt=Bt=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.AspectFunctionArguments")],Gt);const Ot=Gt;var Et=n(92432);let Dt=class extends _{constructor(){super(...arguments),this.functionName="Aspect",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){const t=this.sourceRasterInfos[0];this.isGCS=t.spatialReference?.isGeographic??!1,this.outputPixelType=this._getOutputPixelType("f32");const e=t.clone();return e.pixelType=this.outputPixelType,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){const e=t.pixelBlocks?.[0];if(null==e)return null;const{extent:n,primaryPixelSizes:s}=t,r=s?.[0],o=r??(n?{x:n.width/e.width,y:n.height/e.height}:{x:1,y:1});return(0,Et.c9)(e,{resolution:o})}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],Dt.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:Ot,json:{write:!0,name:"rasterFunctionArguments"}})],Dt.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],Dt.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],Dt.prototype,"isGCS",void 0),Dt=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.AspectFunction")],Dt);const zt=Dt;var Wt=n(9968),Lt=n(14628);const Ut=new Set(["+","-","*","/","(",")"]);function Vt(t,e){return t.toLowerCase().startsWith("b")?e[parseInt(t.slice(1),10)-1]:parseFloat(t)}function Kt(t,e,n,s){if("number"==typeof n&&"number"==typeof s)return n+s;let r,o,i;"number"==typeof n?(i=s,r=i.length,o=new Float32Array(r),o.fill(n)):(r=n.length,o=n,s.constructor===Number?(i=new Float32Array(r),i.fill(s)):i=s);const a=new Float32Array(r);switch(e){case"+":for(let e=0;e<r;e++)(null==t||t[e])&&(a[e]=o[e]+i[e]);break;case"-":for(let e=0;e<r;e++)(null==t||t[e])&&(a[e]=o[e]-i[e]);break;case"*":for(let e=0;e<r;e++)(null==t||t[e])&&(a[e]=o[e]*i[e]);break;case"/":for(let e=0;e<r;e++)(null==t||t[e])&&i[e]&&(a[e]=o[e]/i[e]);break;case"(":case")":throw new Error("encountered error with custom band index equation")}return a}function Ht(t,e){t.splice(e,1);let n=0,s=0;do{n=0,s=0;for(let e=0;e<t.length;e++)if("("===t[e])n=e;else if(")"===t[e]){s=e;break}s===n+1&&t.splice(n,2)}while(s===n+1);return t}function Xt(t){if(1===t.length)return{opIndex:0,numIndex:0};let e=0,n=0;for(let s=0;s<t.length;s++)if("("===t[s])e=s;else if(")"===t[s]){n=s;break}const s=0===n?t:t.slice(e+1,n);let r=-1;for(let t=0;t<s.length;t++)if("*"===s[t]||"/"===s[t]){r=t;break}if(r>-1)n>0&&(r+=e+1);else{for(let t=0;t<s.length;t++)if("+"===s[t]||"-"===s[t]){r=t;break}n>0&&(r+=e+1)}let o=0;for(let e=0;e<r;e++)"("===t[e]&&o++;return{opIndex:r,numIndex:r-o}}var Jt=n(26852);const $t=new Lt.O({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 Yt(t,e){if(!(0,Jt.u8)(t))return t;const{equation:n,method:s}=e,r=e.bandIndexes.map((t=>t-1)),{pixels:o,mask:i}=t;let a;switch(s){case"gndvi":case"nbr":case"ndbi":case"ndvi":case"ndvi-re":case"ndsi":case"ndmi":case"mndwi":a=Qt(i,o[r[0]],o[r[1]]);break;case"ndwi":a=Qt(i,o[r[1]],o[r[0]]);break;case"sr":case"sr-re":case"iron-oxide":case"ferrous-minerals":case"clay-minerals":a=function(t,e,n){const s=n.length,r=new Float32Array(s);for(let o=0;o<s;o++)if(null==t||t[o]){const t=e[o],s=n[o];s&&(r[o]=t/s)}return[r]}(i,o[r[0]],o[r[1]]);break;case"ci-g":case"ci-re":a=function(t,e,n){const s=e.length,r=new Float32Array(s);for(let o=0;o<s;o++)if(null==t||t[o]){const t=e[o],s=n[o];s&&(r[o]=t/s-1)}return[r]}(i,o[r[0]],o[r[1]]);break;case"savi":a=function(t,e,n,s){const r=n.length,o=new Float32Array(r);for(let i=0;i<r;i++)if(null==t||t[i]){const t=n[i],r=e[i],a=r+t+s;a&&(o[i]=(r-t)/a*(1+s))}return[o]}(i,o[r[0]],o[r[1]],r[2]+1);break;case"tsavi":a=function(t,e,n,s,r,o){const i=n.length,a=new Float32Array(i),u=-r*s+o*(1+s*s);for(let o=0;o<i;o++)if(null==t||t[o]){const t=n[o],i=e[o],l=r*i+t+u;l&&(a[o]=s*(i-s*t-r)/l)}return[a]}(i,o[r[0]],o[r[1]],r[2]+1,r[3]+1,r[4]+1);break;case"msavi":a=function(t,e,n){const s=n.length,r=new Float32Array(s);for(let o=0;o<s;o++)if(null==t||t[o]){const t=n[o],s=e[o],i=2*s+1;r[o]=.5*(i-Math.sqrt(i*i-8*(s-t)))}return[r]}(i,o[r[0]],o[r[1]]);break;case"gemi":a=function(t,e,n){const s=n.length,r=new Float32Array(s);for(let o=0;o<s;o++)if(null==t||t[o]){const t=n[o],s=e[o];if(1!==t&&s+t+.5!==0){const e=(2*(s*s-t*t)+1.5*s+.5*t)/(s+t+.5);r[o]=e*(1-.25*e)-(t-.125)/(1-t)}}return[r]}(i,o[r[0]],o[r[1]]);break;case"pvi":a=function(t,e,n,s,r){const o=n.length,i=new Float32Array(o),a=1/Math.sqrt(1+s*s);for(let u=0;u<o;u++)if(null==t||t[u]){const t=n[u],o=e[u];i[u]=(o-s*t-r)*a}return[i]}(i,o[r[0]],o[r[1]],r[2]+1,r[3]+1);break;case"gvitm":a=function(t,e){const[n,s,r,o,i,a]=e,u=n.length,l=new Float32Array(u);for(let e=0;e<u;e++)(null==t||t[e])&&(l[e]=-.2848*n[e]-.2435*s[e]-.5436*r[e]+.7243*o[e]+.084*i[e]-.18*a[e]);return[l]}(i,[o[r[0]],o[r[1]],o[r[2]],o[r[3]],o[r[4]],o[r[5]]]);break;case"sultan":a=function(t,e){const[n,s,r,o,i]=e,a=n.length,u=new Float32Array(a),l=new Float32Array(a),c=new Float32Array(a);for(let e=0;e<a;e++)(null==t||t[e])&&(u[e]=i[e]?o[e]/i[e]*100:0,l[e]=n[e]?o[e]/n[e]*100:0,c[e]=r[e]?s[e]/r[e]*(o[e]/r[e])*100:0);return[u,l,c]}(i,[o[r[0]],o[r[1]],o[r[2]],o[r[3]],o[r[4]]]);break;case"vari":a=function(t,e){const[n,s,r]=e,o=n.length,i=new Float32Array(o);for(let e=0;e<o;e++)if(null==t||t[e])for(e=0;e<o;e++){const t=n[e],o=s[e],a=o+t-r[e];a&&(i[e]=(o-t)/a)}return[i]}(i,[o[r[0]],o[r[1]],o[r[2]]]);break;case"mtvi2":a=function(t,e){const[n,s,r]=e,o=n.length,i=new Float32Array(o);for(let e=0;e<o;e++)if(null==t||t[e])for(e=0;e<o;e++){const t=n[e],o=s[e],a=r[e],u=Math.sqrt((2*t+1)**2-(6*t-5*Math.sqrt(o))-.5);if(u){const n=1.5*(1.2*(t-a)-2.5*(o-a));i[e]=n/u}}return[i]}(i,[o[r[0]],o[r[1]],o[r[2]]]);break;case"rtvi-core":a=function(t,e){const[n,s,r]=e,o=n.length,i=new Float32Array(o);for(let e=0;e<o;e++)if(null==t||t[e])for(e=0;e<o;e++){const t=n[e],o=s[e],a=r[e];i[e]=100*(t-o)-10*(t-a)}return[i]}(i,[o[r[0]],o[r[1]],o[r[2]]]);break;case"evi":a=function(t,e){const[n,s,r]=e,o=n.length,i=new Float32Array(o);for(let e=0;e<o;e++)if(null==t||t[e])for(e=0;e<o;e++){const t=n[e],o=s[e],a=t+6*o-7.5*r[e]+1;a&&(i[e]=2.5*(t-o)/a)}return[i]}(i,[o[r[0]],o[r[1]],o[r[2]]]);break;case"wndwi":a=function(t,e,n=.5){const[s,r,o]=e,i=r.length,a=new Float32Array(i);for(let e=0;e<i;e++)if(null==t||t[e])for(e=0;e<i;e++){const t=s[e],i=r[e],u=o[e],l=t+n*i+(1-n)*u;l&&(a[e]=(t-n*i-(1-n)*u)/l)}return[a]}(i,[o[r[0]],o[r[1]],o[r[2]]],r[3]?r[3]+1:.5);break;case"bai":a=function(t,e,n){const s=n.length,r=new Float32Array(s);for(let o=0;o<s;o++)if(null==t||t[o])for(o=0;o<s;o++){const t=(.1-e[o])**2+(.06-n[o])**2;t&&(r[o]=1/t)}return[r]}(i,o[r[0]],o[r[1]]);break;case"custom":a=function(t,e,n){let s,{ops:r,nums:o}=function(t,e){(t=t.replaceAll(" ","")).startsWith("-")&&(t="0"+t),t.startsWith("+")&&(t=t.slice(1,t.length));const n=t.split(""),s=[],r=[];let o="";for(let t=0;t<n.length;t++){const i=n[t];Ut.has(i)?(o.length&&r.push(Vt(o,e)),s.push(i),o=""):o=o.concat(i)}return o.length&&r.push(Vt(o,e)),{ops:s,nums:r}}(n,e);if(0===r.length){const t=1===o.length?o[0]:e[0];if(t instanceof Float32Array)return[t];const n=new Float32Array(e[0].length);return"number"==typeof t?n.fill(t):n.set(t),[n]}for(;r.length>0;){const{numIndex:e,opIndex:n}=Xt(r);if(s=Kt(t,r[n],o[e],o[e+1]),1===r.length)break;r=Ht(r,n),o.splice(e,2,s)}return[s]}(i,o,n);break;default:return t}const u=null!=i?new Uint8Array(i.length):null;null!=i&&null!=u&&u.set(i);const l=new y.c({width:t.width,height:t.height,pixelType:"f32",pixels:a,mask:u});return l.updateStatistics(),l}function Zt(t){const e=new Float32Array(9);return e[3*t[0]]=1,e[3*t[1]+1]=1,e[3*t[2]+2]=1,e}function Qt(t,e,n){const s=n.length,r=new Float32Array(s);for(let o=0;o<s;o++)if(null==t||t[o]){const t=e[o],s=n[o],i=t+s;i&&(r[o]=(t-s)/i)}return[r]}var te;let ee=te=class extends h{constructor(){super(...arguments),this.method="custom"}clone(){return new te({method:this.method,bandIndexes:this.bandIndexes,raster:(0,o.ct)(this.raster)})}};(0,i._)([(0,a.qq)({json:{type:String,write:!0}})],ee.prototype,"bandIndexes",void 0),(0,i._)([(0,Wt.G)($t)],ee.prototype,"method",void 0),ee=te=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.BandArithmeticFunctionArguments")],ee);const ne=ee,se=new Set(["vari","mtvi2","rtvi-core","evi"]);let re=class extends _{constructor(){super(...arguments),this.functionName="BandArithmetic",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){this.outputPixelType=this._getOutputPixelType("f32");const t=this.sourceRasterInfos[0];if(t.bandCount<2)return{success:!1,supportsGPU:!1,error:"band-arithmetic-function: source raster has insufficient amount of raster bands"};const e=t.clone();return e.pixelType=this.outputPixelType,e.bandCount="sultan"===this.functionArguments.method?3:1,this._removeStatsHistColormapVAT(e),e.keyProperties={...e.keyProperties,BandProperties:void 0},this.rasterInfo=e,{success:!0,supportsGPU:!["custom","gvitm","sultan"].includes(this.functionArguments.method)}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return e;const{method:n,bandIndexes:s}=this.functionArguments,r=s.split(" ").map((t=>parseFloat(t)));return Yt(e,{method:n,bandIndexes:r,equation:s})}_getWebGLParameters(){const t=this.functionArguments.bandIndexes.split(" ").map((t=>parseFloat(t)-1));2===t.length&&t.push(0);const e=this.isInputBandIdsSwizzled?[0,1,2]:t;let n,s;const r=new Float32Array(3),{method:o}=this.functionArguments;switch(o){case"gndvi":case"nbr":case"ndbi":case"ndvi":case"ndvi-re":case"ndsi":case"ndmi":case"mndwi":n=Zt([e[0],e[1],0]),s="ndxi";break;case"ndwi":n=Zt([e[1],e[0],0]),s="ndxi";break;case"sr":case"sr-re":case"iron-oxide":case"ferrous-minerals":case"clay-minerals":n=Zt([e[0],e[1],0]),s="sr";break;case"ci-g":case"ci-re":n=Zt([e[0],e[1],0]),s="ci";break;case"savi":n=Zt([e[0],e[1],0]),s="savi",r[0]=t[2]+1;break;case"tsavi":n=Zt([e[0],e[1],0]),s="tsavi",r[0]=t[2]+1,r[1]=t[3]+1,r[2]=t[4]+1;break;case"msavi":n=Zt([e[0],e[1],0]),s="msavi";break;case"gemi":n=Zt([e[0],e[1],0]),s="gemi";break;case"pvi":n=Zt([e[0],e[1],0]),s="tsavi",r[0]=t[2]+1,r[1]=t[3]+1;break;case"vari":n=Zt([e[0],e[1],e[2]]),s="vari";break;case"mtvi2":n=Zt([e[0],e[1],e[2]]),s="mtvi";break;case"rtvi-core":n=Zt([e[0],e[1],e[2]]),s="rtvicore";break;case"evi":n=Zt([e[0],e[1],e[2]]),s="evi";break;case"wndwi":n=Zt([e[0],e[1],0]),s="wndwi",r[0]=t[3]?t[3]+1:.5;break;case"bai":n=Zt([e[1],e[0],0]),s="bai";break;default:n=Zt([0,1,2]),s="custom"}return{bandIndexMat3:n,indexType:s,adjustments:r}}_getInputBandIds(t){if("custom"===this.functionArguments.method)return t;const e=this.functionArguments.bandIndexes.split(" ").map((t=>parseFloat(t)-1)),n=t.length,s=e.map((t=>t>=n?n-1:t)),r=se.has(this.functionArguments.method)?3:2,o=s.slice(0,r).map((e=>t[e]));return 2===o.length&&o.push(0),o}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],re.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:ne,json:{write:!0,name:"rasterFunctionArguments"}})],re.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],re.prototype,"rasterArgumentNames",void 0),re=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.BandArithmeticFunction")],re);const oe=re;var ie,ae=n(60708),ue=n(6704);const le=new Lt.O({1:"outside",2:"inside"},{useNumericKeys:!0});let ce=ie=class extends h{constructor(){super(...arguments),this.clippingType="outside"}clone(){return new ie({clippingGeometry:this.clippingGeometry.clone(),clippingType:this.clippingType})}};(0,i._)([(0,a.qq)({types:ae.Su,json:{read:ue.h4,write:!0}})],ce.prototype,"clippingGeometry",void 0),(0,i._)([(0,a.qq)({json:{read:le.read,write:le.write}})],ce.prototype,"clippingType",void 0),ce=ie=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.ClipFunctionArguments")],ce);const pe=ce;let he=class extends _{constructor(){super(...arguments),this.functionName="Clip",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isNoopProcess=!0}_bindSourceRasters(){const t=this.sourceRasterInfos[0].clone();return this.outputPixelType=this._getOutputPixelType(t.pixelType),t.pixelType=this.outputPixelType,this.rasterInfo=t,{success:!0,supportsGPU:!0}}_processPixels(t){return t.pixelBlocks?.[0]}_getWebGLParameters(){const{clippingGeometry:t,clippingType:e}=this.functionArguments;return{clippingGeometry:t.toJSON(),clippingType:e}}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],he.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:pe,json:{write:!0,name:"rasterFunctionArguments"}})],he.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],he.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.qq)()],he.prototype,"isNoopProcess",void 0),he=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.ClipFunction")],he);const fe=he;var me,de=n(33600),ge=n(44748),ye=n(55952);let xe=me=class extends h{castColormapName(t){if(!t)return null;const e=t.toLowerCase();return ge.W6.includes(e)?e:null}readColorRamp(t){return(0,ye.h)(t)}readColorRampName(t,e){if(!t)return null;const n=ge.i_.jsonValues.find((e=>e.toLowerCase()===t.toLowerCase()));return n?ge.i_.fromJSON(n):null}clone(){return new me({colormap:(0,o.ct)(this.colormap),colormapName:this.colormapName,colorRamp:this.colorRamp?.clone(),colorRampName:this.colorRampName})}};(0,i._)([(0,a.qq)({type:[[Number]],json:{write:!0}})],xe.prototype,"colormap",void 0),(0,i._)([(0,a.qq)({type:String,json:{write:!0}})],xe.prototype,"colormapName",void 0),(0,i._)([(0,g.W)("colormapName")],xe.prototype,"castColormapName",null),(0,i._)([(0,a.qq)({types:ye.i,json:{write:!0}})],xe.prototype,"colorRamp",void 0),(0,i._)([(0,de.E)("colorRamp")],xe.prototype,"readColorRamp",null),(0,i._)([(0,a.qq)({type:ge.i_.apiValues,json:{type:ge.i_.jsonValues,write:ge.i_.write}})],xe.prototype,"colorRampName",void 0),(0,i._)([(0,de.E)("colorRampName")],xe.prototype,"readColorRampName",null),xe=me=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.ColormapFunctionArguments")],xe);const we=xe,ve=[[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]],_e=[[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 be(t,e){const n=[],s=[];for(let e=0;e<t.length-1;e++)n.push({type:"algorithmic",algorithm:"esriHSVAlgorithm",fromColor:t[e].slice(1),toColor:t[e+1].slice(1)}),s.push(t[e+1][0]-t[e][0]);const r=t[t.length-1][0];return(0,ge.IL)({type:"multipart",colorRamps:n},{numColors:r,weights:e=e??s})}let Ae=class extends _{constructor(){super(...arguments),this.functionName="Colormap",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isNoopProcess=!0}_bindSourceRasters(){const t=this.sourceRasterInfos[0];if(t.bandCount>1)return{success:!1,supportsGPU:!1,error:"colormap-function: source data must be single band"};let{colormap:e,colormapName:n,colorRamp:s,colorRampName:r}=this.functionArguments;if(!e?.length)if(s)e=(0,ge.Ky)(s,{interpolateAlpha:!0});else if(r){const t=(0,ge.GK)(r);t&&(e=(0,ge.Ky)(t))}else n&&(e=function(t){let e;switch(t){case"elevation":e=be([[0,0,191,191],[51,0,0,255],[102,255,0,255],[153,255,0,127],[204,191,63,127],[256,20,20,20]]);break;case"gray":e=(0,ge.IL)({type:"algorithmic",algorithm:"esriHSVAlgorithm",fromColor:[0,0,0],toColor:[255,255,255]});break;case"hillshade":e=be([[0,38,41,54],[69,79,82,90],[131,156,156,156],[256,253,253,241]],[.268,.238,.495]);break;case"ndvi":e=ve;break;case"ndvi2":e=function(){const t=be([[0,255,255,255],[70,0,255,0],[80,205,173,193],[100,150,150,150],[110,120,51,100],[130,120,100,200],[140,28,3,144],[160,6,0,55],[180,10,25,30],[201,6,7,27]]);for(let e=t.length;e<256;e++)t.push([6,27,7]);return t}();break;case"ndvi3":e=_e;break;case"random":e=function(){const t=[];for(let e=0;e<256;e++){const e=[];for(let t=0;t<3;t++)e.push(Math.round(255*Math.random()));t.push(e)}return t}()}return e?(e=e.map(((t,e)=>[e,...t])),e):null}(n));if(!e?.length)return{success:!1,supportsGPU:!1,error:"colormap-function: missing colormap argument"};const o=this._getOutputPixelType(t.pixelType);this.outputPixelType=o.startsWith("f")?"s32":o;const i=t.clone();return i.pixelType=this.outputPixelType,i.colormap=e,i.bandCount=1,this.rasterInfo=i,{success:!0,supportsGPU:!0}}_processPixels(t){let e=t.pixelBlocks?.[0];return!e||(0,l.sZ)(e.pixelType)||(e=e.clone(),e.clamp(this.outputPixelType)),e}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],Ae.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:we,json:{write:!0,name:"rasterFunctionArguments"}})],Ae.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],Ae.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.qq)()],Ae.prototype,"isNoopProcess",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],Ae.prototype,"indexedColormap",void 0),Ae=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.ColormapFunction")],Ae);const qe=Ae;var Pe,Te=n(18996);let Ne=Pe=class extends h{constructor(){super(...arguments),this.rasters=[]}writeRasters(t,e){e.rasters=t.map((t=>"number"==typeof t||"string"==typeof t?t:t.toJSON()))}clone(){return new Pe({rasters:(0,o.ct)(this.rasters)})}};(0,i._)([(0,a.qq)({json:{write:!0}})],Ne.prototype,"rasters",void 0),(0,i._)([(0,Te.G)("rasters")],Ne.prototype,"writeRasters",null),Ne=Pe=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.CompositeBandFunctionArguments")],Ne);const Re=Ne;let Fe=class extends _{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 n=e.clone();if(n.attributeTable=null,n.colormap=null,n.pixelType=this.outputPixelType,n.bandCount=t.map((({bandCount:t})=>t)).reduce(((t,e)=>t+e)),t.every((({statistics:t})=>null!=t&&t.length))){const e=[];t.forEach((({statistics:t})=>null!=t&&e.push(...t))),n.statistics=e}if(t.every((({histograms:t})=>null!=t&&t.length))){const e=[];t.forEach((({histograms:t})=>null!=t&&e.push(...t))),n.histograms=e}n.bandCount>1&&(n.colormap=null,n.attributeTable=null);const s=t.every((t=>t.keyProperties.BandProperties?.length))?t.flatMap((t=>t.keyProperties.BandProperties)):void 0;return n.keyProperties={...n.keyProperties,BandProperties:s},this.rasterInfo=n,{success:!0,supportsGPU:n.bandCount<=3}}_processPixels(t){const{pixelBlocks:e}=t;if(!e)return null;const n=e?.[0];return null==n?null:(0,Jt.WS)(e)}_getWebGLParameters(){return{bandCount:this.rasterInfo.bandCount}}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],Fe.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:Re,json:{write:!0,name:"rasterFunctionArguments"}})],Fe.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],Fe.prototype,"rasterArgumentNames",void 0),Fe=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.CompositeBandFunction")],Fe);const Ie=Fe;var ke;let Ce=ke=class extends h{constructor(){super(...arguments),this.contrastOffset=0,this.brightnessOffset=0}clone(){return new ke({contrastOffset:this.contrastOffset,brightnessOffset:this.brightnessOffset,raster:this.raster})}};(0,i._)([(0,a.qq)({json:{write:!0}})],Ce.prototype,"contrastOffset",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],Ce.prototype,"brightnessOffset",void 0),Ce=ke=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.ContrastBrightnessFunctionArguments")],Ce);const Se=Ce;var Me=n(72116);let je=class extends _{constructor(){super(...arguments),this.functionName="ContrastBrightness",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.lookup=null}_bindSourceRasters(){const{sourceRasterInfos:t}=this,e=t[0];if("u8"!==e.pixelType)return{success:!1,supportsGPU:!1,error:"Only unsigned 8 bit raster is supported by ContrastBrightness function."};this.outputPixelType=this._getOutputPixelType("u8");const n=e.clone();this._removeStatsHistColormapVAT(n),this.rasterInfo=n;const{contrastOffset:s,brightnessOffset:r}=this.functionArguments;return this.lookup=(0,Me.Wc)(s,r),{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];return null==e?null:(0,Jt.sP)(e,{lut:e.pixels.map((()=>this.lookup)),offset:0,outputPixelType:"u8"})}_getWebGLParameters(){const{contrastOffset:t,brightnessOffset:e}=this.functionArguments;return{contrastOffset:t,brightnessOffset:e}}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],je.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:Se,json:{write:!0,name:"rasterFunctionArguments"}})],je.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],je.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],je.prototype,"lookup",void 0),je=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.ContrastBrightnessFunction")],je);const Be=je;function Ge(t,e,n,s,r){const o=Math.floor(s/2);for(let s=0;s<o;s++)for(let o=0;o<e;o++)t[s*e+o]=t[(r-1-s)*e+o],t[(n-1-s)*e+o]=t[(n-r+s)*e+o];const i=Math.floor(r/2);for(let s=0;s<n;s++){const n=s*e;for(let s=0;s<i;s++)t[n+s]=t[n+r-1-s],t[n+e-s-1]=t[n+e+s-r]}}const Oe=new Map;function Ee(t,e,n,s,r,o,i){const a=new Float32Array(e*n),u=o.length,l=i?0:s,c=i?s:0,p=i?1:e;for(let i=l;i<n-l;i++){const n=i*e;for(let i=c;i<e-c;i++){if(r&&!r[n+i])continue;let e=0;for(let r=0;r<u;r++)e+=t[n+i+(r-s)*p]*o[r];a[n+i]=e}}return a}function De(t,e,n,s,r,o,i){const a=new Float32Array(e*n),u=Math.floor(s/2),l=Math.floor(r/2);for(let c=u;c<n-u;c++){const n=c*e;for(let c=l;c<e-l;c++){if(o&&!o[n+c])continue;let p=0;for(let o=0;o<s;o++)for(let s=0;s<r;s++)p+=t[n+c+(o-u)*e+s-l]*i[o*r+s];a[n+c]=p}}return a}var ze;Oe.set(b.none,[0,0,0,0,1,0,0,0,0]),Oe.set(b.lineDetectionHorizontal,[-1,-1,-1,2,2,2,-1,-1,-1]),Oe.set(b.lineDetectionVertical,[-1,2,-1,-1,2,-1,-1,2,-1]),Oe.set(b.lineDetectionLeftDiagonal,[2,-1,-1,-1,2,-1,-1,-1,2]),Oe.set(b.lineDetectionRightDiagonal,[-1,-1,2,-1,2,-1,2,-1,-1]),Oe.set(b.gradientNorth,[-1,-2,-1,0,0,0,1,2,1]),Oe.set(b.gradientWest,[-1,0,1,-2,0,2,-1,0,1]),Oe.set(b.gradientEast,[1,0,-1,2,0,-2,1,0,-1]),Oe.set(b.gradientSouth,[1,2,1,0,0,0,-1,-2,-1]),Oe.set(b.gradientNorthEast,[0,-1,-2,1,0,-1,2,1,0]),Oe.set(b.gradientNorthWest,[-2,-1,0,-1,0,1,0,1,2]),Oe.set(b.smoothArithmeticMean,[.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111]),Oe.set(b.smoothing3x3,[.0625,.125,.0625,.125,.25,.125,.0625,.125,.0625]),Oe.set(b.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]),Oe.set(b.sharpening3x3,[-1,-1,-1,-1,9,-1,-1,-1,-1]),Oe.set(b.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]),Oe.set(b.laplacian3x3,[0,-1,0,-1,4,-1,0,-1,0]),Oe.set(b.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]),Oe.set(b.sobelHorizontal,[-1,-2,-1,0,0,0,1,2,1]),Oe.set(b.sobelVertical,[-1,0,1,-2,0,2,-1,0,1]),Oe.set(b.sharpen,[0,-.25,0,-.25,2,-.25,0,-.25,0]),Oe.set(b.sharpen2,[-.25,-.25,-.25,-.25,3,-.25,-.25,-.25,-.25]),Oe.set(b.pointSpread,[-.627,.352,-.627,.352,2.923,.352,-.627,.352,-.627]);let We=ze=class extends h{constructor(){super(...arguments),this.rows=3,this.cols=3,this.kernel=[0,0,0,0,1,0,0,0,0]}set convolutionType(t){this._set("convolutionType",t);const e=Oe.get(t);if(!e||t===b.userDefined||t===b.none)return;const n=Math.sqrt(e.length);this._set("kernel",e),this._set("cols",n),this._set("rows",n)}clone(){return new ze({cols:this.cols,rows:this.rows,kernel:[...this.kernel],convolutionType:this.convolutionType,raster:(0,o.ct)(this.raster)})}};(0,i._)([(0,a.qq)({json:{type:Number,write:!0}})],We.prototype,"rows",void 0),(0,i._)([(0,a.qq)({json:{type:Number,write:!0}})],We.prototype,"cols",void 0),(0,i._)([(0,a.qq)({json:{name:"type",type:Number,write:!0}})],We.prototype,"convolutionType",null),(0,i._)([(0,a.qq)({json:{type:[Number],write:!0}})],We.prototype,"kernel",void 0),We=ze=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.ConvolutionFunctionArguments")],We);const Le=We;let Ue=class extends _{constructor(){super(...arguments),this.functionName="Convolution",this.rasterArgumentNames=["raster"]}get _normalizedKernel(){const{kernel:t,convolutionType:e}=this.functionArguments,n=t.reduce(((t,e)=>t+e));return-1===e||0===n||1===n?t:t.map((t=>t/n))}_bindSourceRasters(){const{convolutionType:t,rows:e,cols:n,kernel:s}=this.functionArguments;if(!Object.values(b).includes(t))return{success:!1,supportsGPU:!1,error:`convolution-function: the specified kernel type is not supported ${t}`};if(t!==b.none&&e*n!==s.length)return{success:!1,supportsGPU:!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 o=r.clone();o.pixelType=this.outputPixelType;const i=[b.none,b.sharpen,b.sharpen2,b.sharpening3x3,b.sharpening5x5];return(-1===t||"u8"!==this.outputPixelType&&!i.includes(t))&&(o.statistics=null,o.histograms=null),o.colormap=null,o.attributeTable=null,this.rasterInfo=o,{success:!0,supportsGPU:s.length<=25}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e||this.functionArguments.convolutionType===b.none)return e;const{rows:n,cols:s}=this.functionArguments,{_normalizedKernel:r}=this;return function(t,e){const n=function(t){const e=Math.sqrt(t.length),n=t.slice(0,e),s=[1];for(let n=1;n<e;n++){let r=null;for(let s=0;s<e;s++){const o=t[s+n*e],i=t[s];if(null==r)if(0===i){if(o)return{separable:!1,row:null,col:null}}else r=o/i;else if(o/i!==r)return{separable:!1,row:null,col:null}}if(null==r)return{separable:!1,row:null,col:null};s.push(r)}return{separable:!0,row:n,col:s}}(e.kernel),s=!1!==e.mirrorEdges,r=n.separable?function(t,e,n,s=!0){const{pixels:r,width:o,height:i,pixelType:a,mask:u}=t,l=r.length,c=[],p=e.length,h=n.length,f=Math.floor(p/2),m=Math.floor(h/2);for(let t=0;t<l;t++){let a=Ee(r[t],o,i,f,u,e,!0);a=Ee(a,o,i,m,u,n,!1),s&&Ge(a,o,i,p,h),c.push(a)}return new y.c({width:o,height:i,pixelType:a,pixels:c,mask:u})}(t,n.row,n.col,s):function(t,e,n=!0){const{pixels:s,width:r,height:o,pixelType:i,mask:a}=t,u=s.length,l=[],{kernel:c,rows:p,cols:h}=e;for(let t=0;t<u;t++){const e=De(s[t],r,o,p,h,a,c);n&&Ge(e,r,o,p,h),l.push(e)}return new y.c({width:r,height:o,pixelType:i,pixels:l,mask:a})}(t,e,s),{outputPixelType:o}=e;return o&&r.clamp(o),r}(e,{kernel:r,rows:n,cols:s,outputPixelType:this.outputPixelType})}_getWebGLParameters(){const t=new Float32Array(25);return t.set(this._normalizedKernel),{kernelRows:this.functionArguments.rows,kernelCols:this.functionArguments.cols,kernel:t,clampRange:(0,l.mO)(this.outputPixelType)}}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],Ue.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:Le,json:{write:!0,name:"rasterFunctionArguments"}})],Ue.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],Ue.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.qq)()],Ue.prototype,"_normalizedKernel",null),Ue=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.ConvolutionFunction")],Ue);const Ve=Ue;var Ke;const He=new Lt.O({0:"standard",1:"platform",2:"profile"},{useNumericKeys:!0});let Xe=Ke=class extends h{constructor(){super(...arguments),this.curvatureType="standard",this.zFactor=1}readCurvatureType(t,e){return He.fromJSON(e.type??e.curvatureType??0)}clone(){return new Ke({curvatureType:this.curvatureType,zFactor:this.zFactor,raster:this.raster})}};(0,i._)([(0,a.qq)({json:{write:{target:"type"}}}),(0,Wt.G)(He)],Xe.prototype,"curvatureType",void 0),(0,i._)([(0,de.E)("curvatureType",["type","curvatureType"])],Xe.prototype,"readCurvatureType",null),(0,i._)([(0,a.qq)({type:Number,json:{write:!0}})],Xe.prototype,"zFactor",void 0),Xe=Ke=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.CurvatureFunctionArguments")],Xe);const Je=Xe;let $e=class extends _{constructor(){super(...arguments),this.functionName="Curvature",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.bandCount=1,this._removeStatsHistColormapVAT(t),this.rasterInfo=t,this.isGCS=t.spatialReference?.isGeographic??!1,{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{zFactor:n,curvatureType:s}=this.functionArguments,{extent:r,primaryPixelSizes:o}=t,i=o?.[0],a=i??(r?{x:r.width/e.width,y:r.height/e.height}:{x:1,y:1}),u=this.isGCS&&n>=1?n*Et.m_:n;return(0,Et.uI)(e,{zFactor:u,curvatureType:s,resolution:a})}_getWebGLParameters(){const{zFactor:t,curvatureType:e}=this.functionArguments;return{curvatureType:e,zFactor:this.isGCS&&t>=1?t*Et.m_:t}}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],$e.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:Je,json:{write:!0,name:"rasterFunctionArguments"}})],$e.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],$e.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],$e.prototype,"isGCS",void 0),$e=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.CurvatureFunction")],$e);const Ye=$e;var Ze;let Qe=Ze=class extends h{constructor(){super(...arguments),this.bandIds=[],this.bandNames=[],this.bandWavelengths=[],this.missingBandAction=Jt.yO.bestMatch}clone(){return new Ze({bandIds:this.bandIds?.slice(),bandNames:this.bandNames?.slice(),bandWavelengths:this.bandWavelengths?.slice(),missingBandAction:this.missingBandAction,method:this.method,wavelengthMatchTolerance:this.wavelengthMatchTolerance})}};(0,i._)([(0,a.qq)({json:{write:!0}})],Qe.prototype,"bandIds",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],Qe.prototype,"bandNames",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],Qe.prototype,"bandWavelengths",void 0),(0,i._)([(0,Wt.G)({0:"name",1:"wavelength",2:"id"})],Qe.prototype,"method",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],Qe.prototype,"missingBandAction",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],Qe.prototype,"wavelengthMatchTolerance",void 0),Qe=Ze=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.ExtractBandFunctionArguments")],Qe);const tn=Qe;let en=class extends _{constructor(){super(...arguments),this.functionName="ExtractBand",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const{functionArguments:t,sourceRasterInfos:e}=this,n=e[0],{method:s,bandNames:r,bandWavelengths:o,bandIds:i,missingBandAction:a}=t,u=r?.length&&("name"===s||"id"!==s&&!i?.length),l=o?.length&&("wavelength"===s||"id"!==s&&!i?.length),c=a===Jt.yO.fail,p=u?this._matchBandNames(n,r):l?this._matchBandWavelengths(n,o,c):this._matchBandIds(n,i,c);if(null==p)return{success:!1,supportsGPU:!1,error:`extract-band-function: Invalid ${u?"band names":l?"band wavelengths":"band ids"} for the imagery data source`};this.functionArguments.bandIds=p,this.functionArguments.method="id",this.outputPixelType=this._getOutputPixelType("f32");const h=n.clone();h.pixelType=this.outputPixelType,h.bandCount=p.length;const{statistics:f,histograms:m}=h;null!=f&&f.length&&(h.statistics=p.map((t=>f[t]||f[f.length-1]))),null!=m&&m.length&&(h.histograms=p.map((t=>m[t]||m[m.length-1])));let d=h.keyProperties?.BandProperties;return d?.length&&(d=p.map((t=>t>=d.length?d[d.length-1]:d[t])),h.keyProperties={...h.keyProperties,BandProperties:d}),this.rasterInfo=h,{success:!0,supportsGPU:h.bandCount<=3}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const n=e.pixels.length,s=this.functionArguments.bandIds.map((t=>t>=n?n-1:t));return e.extractBands(s)}_getWebGLParameters(){let t;if(this.isInputBandIdsSwizzled)t=this.swizzledBandSelection.length?this.swizzledBandSelection:[0,1,2];else{t=[...this.functionArguments.bandIds],0===t.length?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:Zt(t)}}_getInputBandIds(t){const e=t.length;return this.functionArguments.bandIds.map((t=>t>=e?e-1:t)).map((e=>t[e]))}_matchBandNames(t,e){const n=t.bandInfos.map((({name:t})=>t.toLowerCase())),s=[];for(let t=0;t<e.length;t++){const r=e[t].toLowerCase();let o=n.indexOf(r);if(-1===o&&"nearinfrared"===r&&(o=n.findIndex((t=>t.startsWith("nearinfrared_1"))),-1===o&&(o=n.findIndex((t=>t.startsWith("nearinfrared"))))),-1===o)return null;s.push(o)}return s}_matchBandIds(t,e,n){const{bandCount:s}=t;return!e?.length||n&&e.some((t=>t<0||t>=s))?null:e}_matchBandWavelengths(t,e,n){const{bandInfos:s}=t,r=[];for(let t=0;t<s.length;t++){const{minWavelength:e,maxWavelength:n}=s[t];if(!e||!n)return null;r.push({minWavelength:e,maxWavelength:n})}const{wavelengthMatchTolerance:o}=this.functionArguments,i=[];for(let t=0;t<e.length;t++){const s=e[t];let a=!1,u=-1,l=Number.MAX_VALUE;for(let t=0;t<r.length;t++){const e=r[t],n=s>=e.minWavelength&&s<=e.maxWavelength,o=Math.abs(s-(e.minWavelength+e.maxWavelength)/2);n?o<l&&(a=!0,u=t,l=o):!a&&o<l&&(u=t,l=o)}if(!a&&o&&l<o&&(a=!0),!a&&n)return null;i.push(u)}return i}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],en.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:tn,json:{write:!0,name:"rasterFunctionArguments"}})],en.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],en.prototype,"rasterArgumentNames",void 0),en=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.ExtractBandFunction")],en);const nn=en;var sn;let rn=sn=class extends h{clone(){return new sn({conversionParameters:[...this.conversionParameters],raster:this.raster})}};(0,i._)([(0,a.qq)({type:[Number],json:{write:!0}})],rn.prototype,"conversionParameters",void 0),rn=sn=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.GrayscaleFunctionArguments")],rn);const on=rn;let an=class extends _{constructor(){super(...arguments),this.functionName="Grayscale",this.functionArguments=null,this.rasterArgumentNames=["raster"]}get _normalizedWeights(){const{conversionParameters:t}=this.functionArguments,e=t.reduce(((t,e)=>t+e));return t.map((t=>t/e))}_bindSourceRasters(){const{conversionParameters:t}=this.functionArguments;if(!t?.length)return{success:!1,supportsGPU:!1,error:"missing valid conversion parameters."};const e=this.sourceRasterInfos[0].clone();this.outputPixelType=this._getOutputPixelType(e.pixelType),e.pixelType=this.outputPixelType;const n=3===t.length||3===e.bandCount&&t.length>3;return e.bandCount=1,this._removeStatsHistColormapVAT(e),this.rasterInfo=e,{success:!0,supportsGPU:n}}_processPixels(t){const e=t.pixelBlocks?.[0];return null==e?null:function(t,e,n){const{pixels:s,width:r,height:o,mask:i,bandMasks:a}=t,u=r*o,c=a?.length?y.c.combineBandMasks(a):i,p=Math.min(e.length,s.length),h=n.startsWith("f"),f=!h&&n!==t.pixelType,[m,d]=(0,l.mO)(n),g=y.c.createEmptyBand(n,u);for(let t=0;t<o;t++){let n=t*r;for(let t=0;t<r;t++,n++)if(!c||c[n]){let t=0;for(let r=0;r<p;r++)t+=e[r]*s[r][n];h||(t=Math.round(t),f&&(t=t>d?d:t<m?m:t)),g[n]=t}}const x=new y.c({width:r,height:o,pixels:[g],pixelType:n,mask:c});return x.updateStatistics(),x}(e,this._normalizedWeights,this.outputPixelType)}_getWebGLParameters(){return{weights:this._normalizedWeights}}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],an.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:on,json:{write:!0,name:"rasterFunctionArguments"}})],an.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],an.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.qq)()],an.prototype,"_normalizedWeights",null),an=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.GrayscaleFunction")],an);const un=an;var ln;let cn=ln=class extends h{constructor(){super(...arguments),this.rasters=[],this.processAsMultiband=!0}writeRasters(t,e){e.rasters=t.map((t=>"number"==typeof t||"string"==typeof t?t:t.toJSON()))}clone(){return new ln({operation:this.operation,processAsMultiband:this.processAsMultiband,rasters:(0,o.ct)(this.rasters)})}};(0,i._)([(0,a.qq)({json:{write:!0}})],cn.prototype,"operation",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],cn.prototype,"rasters",void 0),(0,i._)([(0,Te.G)("rasters")],cn.prototype,"writeRasters",null),(0,i._)([(0,a.qq)({json:{write:!0}})],cn.prototype,"processAsMultiband",void 0),cn=ln=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.LocalFunctionArguments")],cn);const pn=cn;let hn=class extends _{constructor(){super(...arguments),this.functionName="Local",this.functionArguments=null,this.rasterArgumentNames=["rasters"]}_bindSourceRasters(){const{sourceRasterInfos:t}=this,e=t[0],{bandCount:n}=e,{processAsMultiband:s}=this.functionArguments;if(t.some((t=>t.bandCount!==n)))return{success:!1,supportsGPU:!1,error:"local-function: input rasters do not have same band count"};const{operation:r,rasters:o}=this.functionArguments,i=F[r];if(!(999===i||o.length===i||o.length<=1&&1===i))return{success:!1,supportsGPU:!1,error:`local-function: the length of functionArguments.rasters does not match operation's requirement: ${i}`};const a=e.clone();return a.bandCount=999!==i||s?n:1,this._removeStatsHistColormapVAT(a),this._updateStatistics(a),this._updatePixelType(a),this.rasterInfo=a,{success:!0,supportsGPU:1===a.bandCount&&i<=3&&(r<11||r>16)}}_processPixels(t){const{pixelBlocks:e}=t;return null==e||e.some((t=>null==t))?null:St(e,this.functionArguments.operation,{processAsMultiband:this.functionArguments.processAsMultiband,outputPixelType:this.outputPixelType??void 0})}_getWebGLParameters(){const{operation:t}=this.functionArguments,e=F[t],n=Object.keys(T).find((e=>T[e]===t))?.toLowerCase()??"undefined",s=this.outputPixelType??"f32";let[r,o]=(0,l.mO)(s);const i=(0,l.sZ)(s);return i&&(r-=1e-4,o+=1e-4),{imageCount:e,operationName:n,domainRange:[r,o],isOutputRounded:i}}_updateStatistics(t){const e=this.sourceRasterInfos[0],{operation:n}=this.functionArguments,s=R(n)?.domain;if(s){t.statistics=[];for(let e=0;e<t.bandCount;e++)t.statistics[e]={min:s[0],max:s[1],avg:(s[0]+s[1])/2,stddev:(s[0]+s[1])/10}}else 45===n&&e.statistics?.length&&(t.statistics=e.statistics.map((t=>({min:-t.max,max:-t.min,avg:null!=t.avg?-t.avg:void 0,stddev:null!=t.stddev?-t.stddev:void 0}))))}_updatePixelType(t){const{statistics:e,pixelType:n}=this.sourceRasterInfos[0],{operation:s}=this.functionArguments,{domain:r,isInteger:o}=R(s)??{domain:null,isInteger:!1};let i="f32";if(r&&o)i=(0,l.E1)(r[0],r[1]);else if(30===s){const t=e?.[0];i=t?(0,l.E1)(t.min,t.max):(0,l.sZ)(n)?n:"s32"}else if(45===s&&(0,l.sZ)(n)){const t=e?.map((({max:t})=>-t)),s=e?.map((({min:t})=>-t)),r=t?.length?Math.min(...t):null,o=s?.length?Math.min(...s):null;i=null!=r&&null!=o?(0,l.E1)(r,o):n.startsWith("s")?n.replace("s","u"):"u1"===n||"u2"===n||"u4"===n?"s8":"u8"===n?"s16":"s32"}t.pixelType=this.outputPixelType=this._getOutputPixelType(i)}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],hn.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:pn,json:{write:!0,name:"rasterFunctionArguments"}})],hn.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],hn.prototype,"rasterArgumentNames",void 0),hn=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.LocalFunction")],hn);const fn=hn;var mn,dn=n(53648);let gn=mn=class extends h{constructor(){super(...arguments),this.includedRanges=null,this.noDataValues=null,this.noDataInterpretation=Jt.yv.matchAny}get normalizedNoDataValues(){const{noDataValues:t}=this;if(!t?.length)return null;let e=!1;const n=t.map((t=>{if("number"==typeof t)return e=!0,[t];if("string"==typeof t){const n=t.trim().split(" ").filter((t=>""!==t.trim())).map((t=>Number(t)));return e=e||n.length>0,0===n.length?null:n}return null}));return e?n:null}clone(){return new mn({includedRanges:this.includedRanges?.slice()??[],noDataValues:this.noDataValues?.slice()??[],noDataInterpretation:this.noDataInterpretation})}};(0,i._)([(0,a.qq)({json:{write:!0}})],gn.prototype,"includedRanges",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],gn.prototype,"noDataValues",void 0),(0,i._)([(0,a.qq)()],gn.prototype,"normalizedNoDataValues",null),(0,i._)([(0,a.qq)({json:{write:!0}})],gn.prototype,"noDataInterpretation",void 0),gn=mn=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.MaskFunctionArguments")],gn);const yn=gn;let xn=class extends _{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:n,normalizedNoDataValues:s}=this.functionArguments;if(!n?.length&&!s?.length)return{success:!1,supportsGPU:!1,error:"missing includedRanges or noDataValues argument"};let r=[];for(let o=0;o<t.bandCount;o++){const t=(0,Jt.K6)(e,n?.slice(2*o,2*o+2),s?.[o]);if(null==t){r=null;break}r.push(t)}this.lookups=r;const o=null!=s&&s.every((t=>t?.length===s[0]?.length));return{success:!0,supportsGPU:(!n||n.length<=2*Jt.WK)&&(!s||o&&s[0].length<=Jt.WK)}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{outputPixelType:n,lookups:s}=this,{includedRanges:r,noDataInterpretation:o,normalizedNoDataValues:i}=this.functionArguments,a=o===Jt.yv.matchAll;return(0,Jt.w7)(e,{includedRanges:r,noDataValues:i,outputPixelType:n,matchAll:a,lookups:s})}_getWebGLParameters(){const{includedRanges:t,normalizedNoDataValues:e}=this.functionArguments,n=new Float32Array(Jt.WK);n.fill(dn.SE),e?.[0]?.length&&n.set(e[0]);const s=new Float32Array(Jt.WK);for(let e=0;e<s.length;e+=2)s[e]=t?.[e]??-dn.SE,s[e+1]=t?.[e+1]??dn.SE;return t&&t.length&&s.set(t),{bandCount:this.sourceRasterInfos[0].bandCount,noDataValues:n,includedRanges:s}}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],xn.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:yn,json:{write:!0,name:"rasterFunctionArguments"}})],xn.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],xn.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],xn.prototype,"lookups",void 0),xn=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.MaskFunction")],xn);const wn=xn;var vn;let _n=vn=class extends h{constructor(){super(...arguments),this.visibleBandID=0,this.infraredBandID=1,this.scientificOutput=!1}clone(){const{visibleBandID:t,infraredBandID:e,scientificOutput:n}=this;return new vn({visibleBandID:t,infraredBandID:e,scientificOutput:n})}};(0,i._)([(0,a.qq)({json:{write:!0}})],_n.prototype,"visibleBandID",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],_n.prototype,"infraredBandID",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],_n.prototype,"scientificOutput",void 0),_n=vn=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.NDVIFunctionArguments")],_n);const bn=_n;let An=class extends _{constructor(){super(...arguments),this.functionName="NDVI",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const{scientificOutput:t,visibleBandID:e,infraredBandID:n}=this.functionArguments;this.outputPixelType=this._getOutputPixelType(t?"f32":"u8");const s=this.sourceRasterInfos[0],r=Math.max(e,n);if(s.bandCount<2||r>=s.bandCount)return{success:!1,supportsGPU:!1,error:"ndvi-function: source raster has insufficient amount of raster bands"};const o=s.clone();o.pixelType=this.outputPixelType,o.colormap=null,o.histograms=null,o.bandCount=1,o.keyProperties={...o.keyProperties,BandProperties:void 0};const[i,a,u,l]=t?[-1,1,0,.1]:[0,200,100,10];return o.statistics=[{min:i,max:a,avg:u,stddev:l}],this.rasterInfo=o,{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{visibleBandID:n,infraredBandID:s,scientificOutput:r}=this.functionArguments;return function(t,e,n,s){const{mask:r,pixels:o,width:i,height:a}=t,u=o[n],l=o[e],c=l.length,p=s?new Uint8Array(c):new Float32Array(c),h=s?100:1,f=s?100.5:0;for(let t=0;t<c;t++)if(null==r||r[t]){const e=u[t],n=l[t],s=e+n;s&&(p[t]=(e-n)/s*h+f)}const m=new y.c({width:i,height:a,mask:r,pixelType:s?"u8":"f32",pixels:[p]});return m.updateStatistics(),m}(e,n,s,!r)}_getWebGLParameters(){const{visibleBandID:t,infraredBandID:e,scientificOutput:n}=this.functionArguments;return{bandIndexMat3:Zt(this.isInputBandIdsSwizzled?[0,1,2]:[e,t,0]),scaled:!n}}_getInputBandIds(t){const{visibleBandID:e,infraredBandID:n}=this.functionArguments;return[n,e,0].map((e=>t[e]))}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],An.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:bn,json:{write:!0,name:"rasterFunctionArguments"}})],An.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],An.prototype,"rasterArgumentNames",void 0),An=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.NDVIFunction")],An);const qn=An;var Pn;let Tn=Pn=class extends h{constructor(){super(...arguments),this.inputRanges=null,this.outputValues=null,this.noDataRanges=null,this.allowUnmatched=!1,this.isLastInputRangeInclusive=!1}clone(){return new Pn({inputRanges:[...this.inputRanges],outputValues:[...this.outputValues],noDataRanges:[...this.noDataRanges],allowUnmatched:this.allowUnmatched,isLastInputRangeInclusive:this.isLastInputRangeInclusive})}};(0,i._)([(0,a.qq)({json:{write:!0}})],Tn.prototype,"inputRanges",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],Tn.prototype,"outputValues",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],Tn.prototype,"noDataRanges",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],Tn.prototype,"allowUnmatched",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],Tn.prototype,"isLastInputRangeInclusive",void 0),Tn=Pn=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.RemapFunctionArguments")],Tn);const Nn=Tn;let Rn=class extends _{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:n}=t,{allowUnmatched:s,outputValues:r,inputRanges:o,noDataRanges:i,isLastInputRangeInclusive:a}=this.functionArguments;if(null!=n&&n.length&&r?.length)if(s){const e=Math.min.apply(null,[...r,n[0].min]),s=Math.max.apply(null,[...r,n[0].max]);t.statistics=[{...n[0],min:e,max:s}]}else{let e=r[0],s=e;for(let t=0;t<r.length;t++)e=e>r[t]?r[t]:e,s=s>r[t]?s:r[t];t.statistics=[{...n[0],min:e,max:s}]}return this.rasterInfo=t,this.lookup=s?null:(0,Jt.Ap)({srcPixelType:e,inputRanges:o,outputValues:r,noDataRanges:i,allowUnmatched:s,isLastInputRangeInclusive:a,outputPixelType:this.outputPixelType}),{success:!0,supportsGPU:(!r||r.length<=Jt.WK)&&(!i||i.length<=Jt.WK)}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{lookup:n,outputPixelType:s}=this;if(n){const t=(0,Jt.sP)(e,{lut:[n.lut],offset:n.offset,outputPixelType:s});return null!=t&&n.mask&&(t.mask=(0,Jt.op)(e.pixels[0],e.mask,n.mask,n.offset,"u8")),t}const{inputRanges:r,outputValues:o,noDataRanges:i,allowUnmatched:a,isLastInputRangeInclusive:u}=this.functionArguments;return(0,Jt.U9)(e,{inputRanges:r,outputValues:o,noDataRanges:i,outputPixelType:s,allowUnmatched:a,isLastInputRangeInclusive:u})}_getWebGLParameters(){const{allowUnmatched:t,noDataRanges:e,isLastInputRangeInclusive:n}=this.functionArguments,s=new Float32Array(3*Jt.WK),r=1e-5,o=this.functionArguments.inputRanges??[],i=this.functionArguments.outputValues??[],a=i.length;for(let t=0;t<Jt.WK;t++)s[3*t]=o[2*t]??dn.SE-1,s[3*t+1]=o[2*t+1]??dn.SE,s[3*t+2]=i[t]??0,t<a&&(t>0&&(s[3*t]-=r),(t<a-1||!n)&&(s[3*t+1]-=r));const u=new Float32Array(2*Jt.WK);return u.fill(dn.SE),e?.length&&u.set(e),{allowUnmatched:t,rangeMaps:s,noDataRanges:u,clampRange:(0,l.mO)(this.outputPixelType)}}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],Rn.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:Nn,json:{write:!0,name:"rasterFunctionArguments"}})],Rn.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],Rn.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],Rn.prototype,"lookup",void 0),Rn=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.RemapFunction")],Rn);const Fn=Rn;var In;const kn=new Lt.O({1:"degree",2:"percent-rise",3:"adjusted"},{useNumericKeys:!0});let Cn=In=class extends h{constructor(){super(...arguments),this.slopeType="degree",this.zFactor=1,this.pixelSizePower=.664,this.pixelSizeFactor=.024,this.removeEdgeEffect=!1}clone(){return new In({slopeType:this.slopeType,zFactor:this.zFactor,pixelSizePower:this.pixelSizePower,pixelSizeFactor:this.pixelSizeFactor,removeEdgeEffect:this.removeEdgeEffect,raster:this.raster})}};(0,i._)([(0,Wt.G)(kn)],Cn.prototype,"slopeType",void 0),(0,i._)([(0,a.qq)({type:Number,json:{write:!0}})],Cn.prototype,"zFactor",void 0),(0,i._)([(0,a.qq)({type:Number,json:{name:"psPower",write:!0}})],Cn.prototype,"pixelSizePower",void 0),(0,i._)([(0,a.qq)({type:Number,json:{name:"psZFactor",write:!0}})],Cn.prototype,"pixelSizeFactor",void 0),(0,i._)([(0,a.qq)({type:Boolean,json:{write:!0}})],Cn.prototype,"removeEdgeEffect",void 0),Cn=In=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.SlopeFunctionArguments")],Cn);const Sn=Cn;let Mn=class extends _{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="percent-rise"!==this.functionArguments.slopeType?[{min:0,max:90,avg:1,stddev:1}]:null,t.histograms=null,t.colormap=null,t.attributeTable=null,t.bandCount=1,this.rasterInfo=t,this.isGCS=t.spatialReference?.isGeographic??!1,{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{zFactor:n,slopeType:s,pixelSizePower:r,pixelSizeFactor:o}=this.functionArguments,{isGCS:i}=this,{extent:a,primaryPixelSizes:u}=t,l=u?.[0],c=l??(a?{x:a.width/e.width,y:a.height/e.height}:{x:1,y:1});return(0,Et.uA)(e,{zFactor:n,slopeType:s,pixelSizePower:r,pixelSizeFactor:o,isGCS:i,resolution:c})}_getWebGLParameters(){const{zFactor:t,slopeType:e,pixelSizeFactor:n,pixelSizePower:s}=this.functionArguments;return{zFactor:this.isGCS&&t>=1?t*Et.m_:t,slopeType:e,pixelSizeFactor:n??0,pixelSizePower:s??0}}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],Mn.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:Sn,json:{write:!0,name:"rasterFunctionArguments"}})],Mn.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],Mn.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],Mn.prototype,"isGCS",void 0),Mn=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.SlopeFunction")],Mn);const jn=Mn,Bn=new Lt.O({1:"min",2:"max",3:"mean",4:"stddev",5:"median",6:"majority",7:"minority"},{useNumericKeys:!0});function Gn(t,e){const{fillNoDataOnly:n}=e,{band:s,width:r,height:o,mask:i,outBand:a}=t;if(n&&!i)return void a.set(s);const{statisticsType:u,kernelRows:l,kernelCols:c}=e,p="stddev"===u,h=r*o,f=new Float64Array(h),m=new Float64Array(h),d=new Uint32Array(h);for(let t=0;t<o;t++){const e=t*r;let n=0,o=0,a=0;for(let t=0;t<c;t++)i&&!i[e+t]||(n+=s[e+t],p&&(o+=s[e+t]**2),a++);f[e]=n,m[e]=o,d[e]=a;for(let t=1;t<=r-c;t++){const r=e+t-1,u=r+c;i?(i[r]&&(a--,n-=s[r],p&&(o-=s[r]**2)),i[u]&&(a++,n+=s[u],p&&(o+=s[u]**2))):(n-=s[r],n+=s[u],p&&(o-=s[r]**2,o+=s[u]**2)),f[e+t]=n,d[e+t]=a,p&&(m[e+t]=o)}}const g=new Float64Array(h),y=new Float64Array(h),x=new Uint32Array(h),w=l*r;for(let t=0;t<=r-c;t++){let e=0,n=0,s=0;for(let o=0;o<l;o++){const i=o*r+t;e+=f[i],s+=d[i],p&&(n+=m[i])}g[t]=e,y[t]=n,x[t]=s;for(let i=1;i<=o-l;i++){const o=(i-1)*r+t,a=o+w;e-=f[o],e+=f[a],s-=d[o],s+=d[a],p&&(n-=m[o],n+=m[a]),g[i*r+t]=e,y[i*r+t]=n,x[i*r+t]=s}}const v=Math.floor(l/2),_=Math.floor(c/2);for(let t=v;t<o-v;t++){const e=t*r;for(let s=_;s<r-_;s++){const o=(t-v)*r+s-_,u=x[o];if(0===u||n&&(!i||i[e+s]))continue;const l=g[o]/u,c=p?Math.sqrt((y[o]-g[o]*l)/u):l;a[e+s]=c,i&&(i[e+s]=255)}}}function On(t,e){const{fillNoDataOnly:n}=e,{band:s,width:r,height:o,mask:i,outBand:a}=t;if(n&&!i)return void a.set(s);const{kernelRows:u,kernelCols:l,statisticsType:c}=e,p=Math.floor(u/2),h=Math.floor(l/2),f="min"===c,m=a.slice(),d=new Uint32Array(r*o);for(let t=p;t<o-p;t++){const e=t*r;for(let t=h;t<r-h;t++){let n=f?Number.MAX_VALUE:-Number.MAX_VALUE,o=0;for(let a=0;a<u;a++)for(let u=0;u<l;u++){const l=e+t+(a-p)*r+u-h;i&&!i[l]||(n=f?Math.min(n,s[l]):Math.max(n,s[l]),o++)}i?(m[e+t]=0===o?0:n,d[e+t]=o):a[e+t]=0===o?0:n}}if(i)for(let t=p;t<o-p;t++){const e=t*r;for(let t=h;t<r-h;t++)if(d[e+t]){if(n&&i[e+t])continue;a[e+t]=m[e+t],i[e+t]=255}}}function En(t,e){const{fillNoDataOnly:n}=e,{band:s,width:r,height:o,mask:i,outBand:a}=t;if(n&&!i)return void a.set(s);const{kernelRows:u,kernelCols:l}=e,c=Math.floor(u/2),p=Math.floor(l/2),h=a.slice(),f=new Uint32Array(r*o);for(let t=c;t<o-c;t++){const e=t*r;for(let t=p;t<r-p;t++){if(n&&i&&i[e+t])continue;const o=[];for(let n=0;n<u;n++)for(let a=0;a<l;a++){const u=e+t+(n-c)*r+a-p;i&&!i[u]||o.push(s[u])}o.length&&(o.sort(((t,e)=>t-e)),i?(h[e+t]=o[Math.floor((o.length-1)/2)],f[e+t]=o.length):a[e+t]=o[Math.floor((o.length-1)/2)])}}if(i)for(let t=c;t<o-c;t++){const e=t*r;for(let t=p;t<r-p;t++)if(f[e+t]){if(n&&i[e+t])continue;a[e+t]=h[e+t],i[e+t]=255}}}function Dn(t,e){const{fillNoDataOnly:n}=e,{band:s,width:r,height:o,mask:i,outBand:a}=t;if(n&&!i)return void a.set(s);const{kernelRows:u,kernelCols:l}=e,c=Math.floor(u/2),p=Math.floor(l/2),h="majority"===e.statisticsType,f=u*l,m=a.slice(),d=new Uint32Array(r*o);for(let t=c;t<o-c;t++){const e=t*r;for(let t=p;t<r-p;t++){if(n&&i&&i[e+t])continue;const o=new Map;for(let n=0;n<u;n++)for(let a=0;a<l;a++){const u=e+t+(n-c)*r+a-p;if(i&&!i[u])continue;const l=s[u];o.set(l,o.has(l)?o.get(l)+1:1)}if(0===o.size)continue;let g=0,y=0,x=h?0:f+1;for(const t of o.keys())y=o.get(t),h===y>x&&(x=y,g=t);i?(m[e+t]=g,d[e+t]=o.size):a[e+t]=g}}if(i)for(let t=c;t<o-c;t++){const e=t*r;for(let t=p;t<r-p;t++)if(d[e+t]){if(n&&i[e+t])continue;a[e+t]=m[e+t],i[e+t]=255}}}var zn;let Wn=zn=class extends h{constructor(){super(...arguments),this.rows=3,this.cols=3,this.fillNoDataOnly=!1,this.statisticsType="min"}clone(){return new zn({rows:this.rows,cols:this.cols,fillNoDataOnly:this.fillNoDataOnly,statisticsType:this.statisticsType,raster:(0,o.ct)(this.raster)})}};(0,i._)([(0,a.qq)({json:{write:!0,read:{source:["kernelRows","rows"],reader:(t,e)=>Number(t??e?.kernelRows??3)}}})],Wn.prototype,"rows",void 0),(0,i._)([(0,a.qq)({json:{write:!0,read:{source:["kernelCols","cols"],reader:(t,e)=>Number(t??e?.kernelCols??3)}}})],Wn.prototype,"cols",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],Wn.prototype,"fillNoDataOnly",void 0),(0,i._)([(0,a.qq)({json:{read:{source:["statisticsType","type"],reader:(t,e)=>Bn.fromJSON(e?.statisticsType??e?.type)??"min"},write:{target:"type"}}}),(0,Wt.G)(Bn)],Wn.prototype,"statisticsType",void 0),Wn=zn=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.StatisticsFunctionArguments")],Wn);const Ln=Wn;let Un=class extends _{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 n=e.clone();n.pixelType=this.outputPixelType;const{statisticsType:s}=this.functionArguments;return"stddev"===s&&this._removeStatsHistColormapVAT(n),this.rasterInfo=n,{success:!0,supportsGPU:n.bandCount<=3&&t<5}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return e;const{statisticsType:n,rows:s,cols:r,fillNoDataOnly:o}=this.functionArguments;return function(t,e){const{mask:n}=t,{fillNoDataOnly:s}=e;if(s&&!n)return t;const{pixels:r,width:o,height:i,bandMasks:a,pixelType:u}=t,l=r.length,c=o*i,p=[],{kernelRows:h,kernelCols:f,statisticsType:m,mirrorEdges:d}=e;if(s&&!n)return t;const g=e.outputPixelType??u,x=[];for(let t=0;t<l;t++){const u=r[t],l=y.c.createEmptyBand(g,c);s&&l.set(u);const w=a?.[t]??n,v=w?.slice()??null,_={band:u,width:o,height:i,mask:v,outBand:l};switch(m){case"min":case"max":On(_,e);break;case"mean":case"stddev":Gn(_,e);break;case"median":En(_,e);break;case"majority":case"minority":Dn(_,e)}d&&!s&&Ge(l,o,i,h,f),p.push(l),v&&x.push(v)}let w=x[0]??n;x.length!==l&&(x.length=0),l>1&&a?.length&&(w=y.c.combineBandMasks(a));const v=new y.c({pixelType:g,width:o,height:i,pixels:p,bandMasks:a&&x.length?x:null,mask:w});return v.updateStatistics(),v}(e,{kernelRows:s,kernelCols:r,fillNoDataOnly:o,outputPixelType:this.outputPixelType,statisticsType:n,mirrorEdges:!0})}_getWebGLParameters(){const{rows:t,cols:e,statisticsType:n,fillNoDataOnly:s}=this.functionArguments;return{fillNoDataOnly:s,kernelRows:t,kernelCols:e,statisticsType:n,clampRange:(0,l.mO)(this.outputPixelType)}}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],Un.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:Ln,json:{write:!0,name:"rasterFunctionArguments"}})],Un.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],Un.prototype,"rasterArgumentNames",void 0),Un=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.StatisticsFunction")],Un);const Vn=Un;var Kn;let Hn=Kn=class extends h{constructor(){super(...arguments),this.statistics=null,this.histograms=null}readStatistics(t,e){if(!t?.length)return null;const n=[];return t.forEach((t=>{const e={min:t.min,max:t.max,avg:t.avg??t.mean,stddev:t.stddev??t.standardDeviation};n.push(e)})),n}writeStatistics(t,e,n){if(!t?.length)return;const s=[];t.forEach((t=>{const e={...t,mean:t.avg,standardDeviation:t.stddev};delete e.avg,delete e.stddev,s.push(e)})),e[n]=s}clone(){return new Kn({statistics:(0,o.ct)(this.statistics),histograms:(0,o.ct)(this.histograms)})}};(0,i._)([(0,a.qq)({json:{write:!0}})],Hn.prototype,"statistics",void 0),(0,i._)([(0,de.E)("statistics")],Hn.prototype,"readStatistics",null),(0,i._)([(0,Te.G)("statistics")],Hn.prototype,"writeStatistics",null),(0,i._)([(0,a.qq)({json:{write:!0}})],Hn.prototype,"histograms",void 0),Hn=Kn=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.StatisticsHistogramFunctionArguments")],Hn);const Xn=Hn;let Jn=class extends _{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:n,histograms:s}=this.functionArguments;return s&&(e.histograms=s),n&&(e.statistics=n),this.rasterInfo=e,{success:!0,supportsGPU:!0}}_processPixels(t){return t.pixelBlocks?.[0]}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],Jn.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:Xn,json:{write:!0,name:"rasterFunctionArguments"}})],Jn.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],Jn.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],Jn.prototype,"indexedColormap",void 0),(0,i._)([(0,a.qq)()],Jn.prototype,"isNoopProcess",void 0),Jn=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.StatisticsHistogramFunction")],Jn);const $n=Jn;var Yn;const Zn=new Lt.O({0:"none",3:"standard-deviation",4:"histogram-equalization",5:"min-max",6:"percent-clip",9:"sigmoid"},{useNumericKeys:!0});let Qn=Yn=class extends h{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,e,n){t?.length&&(Array.isArray(t[0])||(t=t.map((t=>[t.min,t.max,t.avg,t.stddev]))),e[n]=t)}clone(){return new Yn({stretchType:this.stretchType,outputMin:this.outputMin,outputMax:this.outputMax,useGamma:this.useGamma,computeGamma:this.computeGamma,statistics:(0,o.ct)(this.statistics),gamma:(0,o.ct)(this.gamma),sigmoidStrengthLevel:this.sigmoidStrengthLevel,numberOfStandardDeviations:this.numberOfStandardDeviations,minPercent:this.minPercent,maxPercent:this.maxPercent,histograms:(0,o.ct)(this.histograms),dynamicRangeAdjustment:this.dynamicRangeAdjustment,raster:this.raster})}};(0,i._)([(0,a.qq)({type:Boolean,json:{write:!0}})],Qn.prototype,"computeGamma",void 0),(0,i._)([(0,a.qq)({type:Boolean,json:{name:"dra",write:!0}})],Qn.prototype,"dynamicRangeAdjustment",void 0),(0,i._)([(0,a.qq)({type:[Number],json:{write:!0}})],Qn.prototype,"gamma",void 0),(0,i._)([(0,a.qq)()],Qn.prototype,"histograms",void 0),(0,i._)([(0,a.qq)({type:Number,json:{write:!0}})],Qn.prototype,"maxPercent",void 0),(0,i._)([(0,a.qq)({type:Number,json:{write:!0}})],Qn.prototype,"minPercent",void 0),(0,i._)([(0,a.qq)({type:Number,json:{write:!0}})],Qn.prototype,"numberOfStandardDeviations",void 0),(0,i._)([(0,a.qq)({type:Number,json:{name:"max",write:!0}})],Qn.prototype,"outputMax",void 0),(0,i._)([(0,a.qq)({type:Number,json:{name:"min",write:!0}})],Qn.prototype,"outputMin",void 0),(0,i._)([(0,a.qq)({type:Number,json:{write:!0}})],Qn.prototype,"sigmoidStrengthLevel",void 0),(0,i._)([(0,a.qq)({json:{type:[[Number]],write:!0}})],Qn.prototype,"statistics",void 0),(0,i._)([(0,Te.G)("statistics")],Qn.prototype,"writeStatistics",null),(0,i._)([(0,Wt.G)(Zn)],Qn.prototype,"stretchType",void 0),(0,i._)([(0,a.qq)({type:Boolean,json:{write:!0}})],Qn.prototype,"useGamma",void 0),Qn=Yn=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.StretchFunctionArguments")],Qn);const ts=Qn;let es=class extends _{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:n}=this,{dynamicRangeAdjustment:s,gamma:r,useGamma:o}=n;if(!s&&["u8","u16","s8","s16"].includes(e)){const s=(0,Me.A1)(n.toJSON(),{rasterInfo:t}),i=(0,l.sZ)(this.outputPixelType)?"round":"float";this.lookup=(0,Me.iY)({pixelType:e,...s,gamma:o?r:null,rounding:i}),this.cutOffs=s}else s||(this.cutOffs=(0,Me.A1)(n.toJSON(),{rasterInfo:t}));this.outputPixelType=this._getOutputPixelType(e);const i=t.clone();return i.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(i),"u8"===this.outputPixelType&&(i.keyProperties.DataType="processed"),this.rasterInfo=i,{success:!0,supportsGPU:!s}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return e;const{lookup:n}=this;if(n)return(0,Jt.sP)(e,{...n,outputPixelType:this.rasterInfo.pixelType});const{functionArguments:s}=this,r=this.cutOffs||(0,Me.A1)(s.toJSON(),{rasterInfo:this.sourceRasterInfos[0],pixelBlock:e}),o=s.useGamma?s.gamma:null;return(0,Me.MR)(e,{...r,gamma:o,outputPixelType:this.outputPixelType})}_getWebGLParameters(){const{outputMin:t=0,outputMax:e=255,gamma:n,useGamma:s}=this.functionArguments,r=this.rasterInfo.bandCount>=2?3:1,o=s&&n?.length?(0,Me.WO)(r,n):[1,1,1],{minCutOff:i,maxCutOff:a}=this.cutOffs??{minCutOff:[0,0,0],maxCutOff:[255,255,255]};1===i.length&&(i[1]=i[2]=i[0],a[1]=a[2]=a[0]);const u=new Float32Array(r);let c;for(c=0;c<r;c++)u[c]=(e-t)/(a[c]-i[c]);const p=(0,l.sZ)(this.outputPixelType);return{bandCount:r,outMin:t,outMax:e,minCutOff:i,maxCutOff:a,factor:u,useGamma:s,gamma:s&&n?n:[1,1,1],gammaCorrection:s&&o?o:[1,1,1],stretchType:this.functionArguments.stretchType,isOutputRounded:p,type:"stretch"}}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],es.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:ts,json:{write:!0,name:"rasterFunctionArguments"}})],es.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],es.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],es.prototype,"lookup",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],es.prototype,"cutOffs",void 0),es=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.StretchFunction")],es);const ns=es;var ss;let rs=ss=class extends h{constructor(){super(...arguments),this.attributeTableAsRecordSet=null}clone(){return new ss({attributeTableAsRecordSet:(0,o.ct)(this.attributeTableAsRecordSet)})}};(0,i._)([(0,a.qq)({json:{write:!0}})],rs.prototype,"attributeTableAsRecordSet",void 0),rs=ss=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.TableFunctionArguments")],rs);const os=rs;let is=class extends _{constructor(){super(...arguments),this.functionName="Table",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isNoopProcess=!0}_bindSourceRasters(){const t=this.sourceRasterInfos[0];if(t.bandCount>1||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 n=t.clone();return n.pixelType=this.outputPixelType,n.bandCount=1,"thematic"!==n.dataType&&(n.keyProperties=n.keyProperties?{...n.keyProperties,DataType:"thematic"}:{DataType:"thematic"}),this.rasterInfo=n,{success:!0,supportsGPU:!0}}_processPixels(t){return t.pixelBlocks?.[0]}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],is.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:os,json:{write:!0,name:"rasterFunctionArguments"}})],is.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],is.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.qq)()],is.prototype,"isNoopProcess",void 0),is=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.TableFunction")],is);const as=is,us=new Map;function ls(t,e){const{rasterFunctionArguments:n}=t;n&&(n.rasters||[n.raster]).forEach((t=>{t&&"number"!=typeof t&&("string"==typeof t?t.startsWith("http")&&(e.includes(t)||e.push(t)):"rasterFunctionArguments"in t&&ls(t,e))}))}function cs(t,e){if(e=e??{},"function"in(t=(0,o.ct)(t))&&"arguments"in t&&t.arguments){const n=ys(t,new Map,e);if(ws(n),!n.renderingRule)throw new r.c("raster-function-helper","Unsupported raster function json.");t=n.renderingRule}if("rasterFunction"in t)return fs(t=hs(t),e);throw new r.c("raster-function-helper","unsupported raster function json.")}function ps(t){return!!(t&&"object"==typeof t&&t.rasterFunction&&t.rasterFunctionArguments)}function hs(t){const{rasterFunction:e,rasterFunctionArguments:n}=t,s={};for(const t in n){let e=n[t];const r=t.toLowerCase();if("rasters"===r&&Array.isArray(e))s.rasters=e.map((t=>ps(t)?hs(t):t));else switch(ps(e)&&(e=hs(e)),r){case"dra":s.dra=e;break;case"pspower":s.psPower=e;break;case"pszfactor":s.psZFactor=e;break;case"bandids":s.bandIds=e;break;default:s[t[0].toLowerCase()+t.slice(1)]=e}}return"Local"!==e||s.rasters?.length||(s.rasters=["$$"]),{...t,rasterFunctionArguments:s}}function fs(t,e){const{rasterFunction:n,rasterFunctionArguments:s}=t,o=t.outputPixelType?.toLowerCase();if(null==n||!us.has(n))throw new r.c("raster-function-helper",`unsupported raster function: ${n}`);const i=us.get(n),a=("function"==typeof i.ctor?i.ctor:i.ctor.default).fromJSON({...t,outputPixelType:o}),{rasterArgumentNames:u}=a,l=[],c=function(t,e){return"rasters"===e[0]&&Array.isArray(t.rasters)?t.rasters:e.map((e=>t[e]))}(s,u),p="rasters"===u[0],h=[];for(let t=0;t<c.length;t++){const n=c[t];let s;null==n||"string"==typeof n&&n.startsWith("$")?l.push(e?.raster):"string"==typeof n?e[n]&&l.push(e[n]):"number"!=typeof n&&"rasterFunction"in n&&(s=fs(n,e),p||(a.functionArguments[u[t]]=s),l.push(s)),p&&h.push(s??n)}if(p&&(a.functionArguments.rasters=h),e){a.sourceRasters=l;const t=e.raster?.url;t&&(a.mainPrimaryRasterId=t)}return a}function ms(t,e){if(t&&e)for(const n in t){const s=t[n];s&&"object"==typeof s&&"type"in s&&("RasterFunctionTemplate"===s.type?ms(s.arguments,e):"RasterFunctionVariable"===s.type&&null!=e[s.name]&&(s.value=e[s.name]))}}function ds(t,e){if(!t||"object"!=typeof t)return t;const{value:n}=t;if(!n||"object"!=typeof n)return t.isDataset?"$$":n;if(Array.isArray(n))return 0===n.length?[]:n.map((t=>"object"==typeof t&&"RasterFunctionVariable"===t.type?ds(t,e):t));if("value"in n&&["number","string","boolean"].includes(typeof n.value))return n.value;if(t.isDataset&&"Scalar"!==n.type)return"$$";if(!("type"in n))return n;let s=n;switch(n.type){case"Scalar":s=n.value;break;case"AlgorithmicColorRamp":s=gs(n);break;case"MultiPartColorRamp":s={type:"multipart",colorRamps:n.ArrayOfColorRamp.map(gs)};break;case"ArgumentArray":if(n.elements?.length&&"RasterStatistics"!==n.elements[0].type){const t=[];for(let s=0;s<n.elements.length;s++){const o=n.elements[s],{type:i}=o;if(i)if("RasterFunctionTemplate"===i){const{renderingRule:n}=ys(o,e);t.push(n),null!=o._object_id&&e.set(o._object_id,n)}else{if("RasterFunctionVariable"!==i)throw new r.c("raster-function-helper","unsupported raster function json.");{const n=ds(o,e);t.push(n),null!=o._object_id&&e.set(o._object_id,n)}}else t.push(o)}s=t}else s=n.elements}return null!=n._object_id&&e.set(n._object_id,s),s}function gs(t){const e=t.algorithm??"esriHSVAlgorithm";let{FromColor:n,ToColor:r}=t;if(!Array.isArray(n)){const{r:t,g:e,b:r}=(0,s.AE)({h:n.Hue,s:n.Saturation,v:n.Value});n=[t,e,r,n.AlphaValue]}if(!Array.isArray(r)){const{r:t,g:e,b:n}=(0,s.AE)({h:r.Hue,s:r.Saturation,v:r.Value});r=[t,e,n,r.AlphaValue]}return{type:"algorithmic",algorithm:e,fromColor:n,toColor:r}}function ys(t,e,n){n&&ms(t,n);const s={renderingRule:{},templates:e};return xs(t,s),s}function xs(t,e){if(!t||!e.renderingRule)return;const{renderingRule:n,templates:s}=e,{function:r,arguments:o,_object_id:i}=t;if(!r||!o)return;null!=i&&s.set(i,n),n.rasterFunction=r.type.replace("Function",""),n.outputPixelType=r.pixelType;const a={};n.rasterFunctionArguments=a;for(const t in o){if("type"===t||"object_id"===t||"_object_ref_id"===t)continue;const e=o[t];e&&"object"==typeof e&&"type"in e&&("RasterFunctionTemplate"===e.type||"RasterFunctionVariable"===e.type)?("RasterFunctionVariable"===e.type?a[t]=ds(e,s):(n.rasterFunctionArguments[t]={},xs(e,{renderingRule:n.rasterFunctionArguments[t],templates:s})),null!=e._object_id&&s.set(e._object_id,a[t])):a[t]=e}switch(a.DEM&&!a.Raster&&(a.Raster=a.DEM,delete a.DEM),n.rasterFunction){case"Stretch":!function(t){t.Statistics?.length&&"object"==typeof t.Statistics&&(t.Statistics=t.Statistics.map((t=>[t.min,t.max,t.mean,t.standardDeviation]))),null!=t.NumberOfStandardDeviation&&(t.NumberOfStandardDeviations=t.NumberOfStandardDeviation,delete t.NumberOfStandardDeviation)}(a);break;case"Colormap":!function(t){"randomcolorramp"===t.ColorRamp?.type?.toLowerCase()&&(delete t.ColorRamp,t.ColormapName="Random"),0===t.ColorSchemeType&&delete t.ColorRamp}(a);break;case"Convolution":!function(t){null!=t.ConvolutionType&&(t.Type=t.ConvolutionType,delete t.ConvolutionType)}(a);break;case"Mask":!function(t){t.NoDataValues?.length&&"string"==typeof t.NoDataValues[0]&&(t.NoDataValues=t.NoDataValues.filter((t=>""!==t)).map((t=>Number(t))))}(a)}}function ws(t){const{renderingRule:e,templates:n}=t;if("object"!=typeof e||!e?.rasterFunctionArguments||!n.size)return;const{rasterFunctionArguments:s}=e;for(const t in s){const e=s[t],o="_object_ref_id"===t?e:e&&"object"==typeof e&&"_object_ref_id"in e?e._object_ref_id:null;if(null==o)e&&"object"==typeof e&&(e.rasterFunctionArguments&&ws({renderingRule:e,templates:n}),Array.isArray(e)&&e.forEach(((t,s)=>{if("object"==typeof t)if(null!=t._object_ref_id){if(!n.has(t._object_ref_id))throw new r.c("raster-function-helper",`unsupported raster function json. _object_ref_id: ${e} does not exist`);const i=n.get(o);i&&"object"==typeof i?Object.assign(t,i):e[s]=i}else ws({renderingRule:t,templates:n})})));else{if(!n.has(o))throw new r.c("raster-function-helper",`unsupported raster function json. _object_ref_id: ${o} does not exist`);const e=n.get(o);"_object_ref_id"!==t?s[t]=e:e&&"object"==typeof e&&Object.assign(s,e)}}}us.set("Arithmetic",{desc:"Arithmetic Function",ctor:jt,rasterArgumentNames:["rasters"]}),us.set("Aspect",{desc:"Aspect Function",ctor:zt,rasterArgumentNames:["raster"]}),us.set("BandArithmetic",{desc:"Band Arithmetic Function",ctor:oe,rasterArgumentNames:["raster"]}),us.set("Colormap",{desc:"Colormap Function",ctor:qe,rasterArgumentNames:["raster"]}),us.set("CompositeBand",{desc:"CompositeBand Function",ctor:Ie,rasterArgumentNames:["rasters"]}),us.set("Convolution",{desc:"Convolution Function",ctor:Ve,rasterArgumentNames:["raster"]}),us.set("ContrastBrightness",{desc:"Contrast Brightness Function",ctor:Be,rasterArgumentNames:["raster"]}),us.set("ExtractBand",{desc:"ExtractBand Function",ctor:nn,rasterArgumentNames:["raster"]}),us.set("Curvature",{desc:"Curvature Function",ctor:Ye,rasterArgumentNames:["raster"]}),us.set("Grayscale",{desc:"Grayscale Function",ctor:un,rasterArgumentNames:["raster"]}),us.set("Clip",{desc:"Clip Function",ctor:fe,rasterArgumentNames:["raster"]}),us.set("Local",{desc:"Local Function",ctor:fn,rasterArgumentNames:["rasters"]}),us.set("Mask",{desc:"Mask Function",ctor:wn,rasterArgumentNames:["raster"]}),us.set("NDVI",{desc:"NDVI Function",ctor:qn,rasterArgumentNames:["raster"]}),us.set("Remap",{desc:"Remap Function",ctor:Fn,rasterArgumentNames:["raster"]}),us.set("Slope",{desc:"Slope Function",ctor:jn,rasterArgumentNames:["raster"]}),us.set("Statistics",{desc:"Focal Statistics Function",ctor:Vn,rasterArgumentNames:["raster"]}),us.set("StatisticsHistogram",{desc:"Statistics Histogram Function",ctor:$n,rasterArgumentNames:["raster"]}),us.set("Stretch",{desc:"Stretch Function",ctor:ns,rasterArgumentNames:["raster"]}),us.set("Table",{desc:"Attribute Table Function",ctor:as,rasterArgumentNames:["raster"]})},25404:(t,e,n)=>{n.d(e,{AJ:()=>P,C_:()=>R,K_:()=>T,S0:()=>d,Sm:()=>W,_B:()=>z,aG:()=>B,eU:()=>O,eW:()=>H,eo:()=>K,iG:()=>L,yM:()=>j}),n(60708);var s,r,o=n(92400),i=n(20744),a=n(24296),u=n(40800),l=n(60074),c=n(60544),p=n(95247),h=n(67776),f=n(7488),m=n(56156);function d(t,e,n){return!(0,l.canProjectWithoutEngine)(t,e,n)}function g(t,e,n){const s=d(t,e,n);if(s&&!(0,l.isLoaded)())throw new i.c("rasterprojectionhelper-project","projection engine is not loaded");return s}(r=s||(s={}))[r.None=0]="None",r[r.North=1]="North",r[r.South=2]="South",r[r.Both=3]="Both";const y=(t,e,n,s=0)=>{if(1===n[0])return[0,0];let r=1,o=-1,i=1,a=-1;for(let e=0;e<t.length;e+=2)isNaN(t[e])||(r=r>t[e]?t[e]:r,o=o>t[e]?o:t[e],i=i>t[e+1]?t[e+1]:i,a=a>t[e+1]?a:t[e+1]);const{cols:u,rows:l}=e,c=(o-r)/u/n[0],p=(a-i)/l/n[1],h=2*s;let f=0,m=!1,d=[0,0];for(let e=0;e<u-3;e++){for(let n=0;n<l-3;n++){const s=e*l*2+2*n,r=(t[s]+t[s+4]+t[s+4*l]+t[s+4*l+4])/4,o=(t[s+1]+t[s+5]+t[s+4*l+1]+t[s+4*l+5])/4,i=Math.abs((r-t[s+2*l+2])/c),a=Math.abs((o-t[s+2*l+3])/p);if(i+a>f&&(f=i+a,d=[i,a]),h&&f>h){m=!0;break}}if(m)break}return d},x={3395:20037508.342789244,3410:17334193.943686873,3857:20037508.342788905,3975:17367530.445161372,4087:20037508.342789244,4088:20015108.787169147,6933:17367530.445161372,32662:20037508.342789244,53001:20015086.79602057,53002:10007543.39801029,53003:20015086.79602057,53004:20015086.79602057,53016:14152803.599503474,53017:17333573.624304302,53034:20015086.79602057,53079:20015114.352186374,53080:20015114.352186374,54001:20037508.342789244,54002:10018754.171394624,54003:20037508.342789244,54004:20037508.342789244,54016:14168658.027268292,54017:17367530.44516137,54034:20037508.342789244,54079:20037508.342789244,54080:20037508.342789244,54100:20037508.342789244,54101:20037508.342789244},w=32,v=4,_=v,b=new Map,A=new Map,q=500;async function P(){(0,l.isLoaded)()||await(0,l.load)()}function T(t,e,n,s=null){const r=t.spatialReference;if(r.equals(e))return t;g(r,e,s);const o=n.center,i=new p.c({xmin:o.x-t.x/2,xmax:o.x+t.x/2,ymin:o.y-t.y/2,ymax:o.y+t.y/2,spatialReference:r}),u=(0,l.project)(i,e,s),c=O(e);let h;if(null==u||null!=c&&u.width>=c){const n=(0,a.k8)(r)/(0,a.k8)(e);h={x:t.x*n,y:t.y*n}}else h={x:u.width,y:u.height};return h}function N(t,e=.01){return(0,a.k8)(t)?e/(0,a.k8)(t):0}function R(t,e,n=null,s=!0){const r=t.spatialReference;if(r.equals(e))return t;g(r,e,n);const o=(0,l.project)(t,e,n);return s&&o?(F([t],[o],r,e),o):o}function F(t,e,n,s){const r=E(n,!0),o=E(s,!0),i=N(n,q),a=N(s,q);if(i&&null!=r&&null!=o)for(let n=0;n<t.length;n++){const s=e[n];if(!s)continue;const{x:u}=t[n],{x:l}=s;l>=o[1]-a&&Math.abs(u-r[0])<i?s.x-=o[1]-o[0]:l<=o[0]+a&&Math.abs(u-r[1])<i&&(s.x+=o[1]-o[0])}}function I(t){const{inSR:e,outSR:n,datumTransformation:s,preferPE:r}=t;if(e.equals(n)){const{points:e}=M(t,null);return e}if(e.isWebMercator&&n.isWGS84||e.isWGS84&&n.isWebMercator)return function(t){const{cols:e,rows:n,xres:s,yres:r,usePixelCenter:o,inSR:i,outSR:a}=t;let{xmin:u,ymax:c}=t;o&&(u+=s/2,c-=r/2);const p=[],f=[],m=Math.max(e,n);for(let t=0;t<m;t++){const o=u+s*Math.min(e,t),m=c-r*Math.min(n,t),d=(0,l.project)(new h.c({x:o,y:m,spatialReference:i}),a);t<=e&&p.push(d.x),t<=n&&f.push(d.y)}const d=[];for(let t=0;t<e;t++)for(let e=0;e<n;e++)d.push([p[t],f[e]]);return d}(t);if(g(e,n,s)&&r){if(e.isGeographic)return k(t);if(null!=C(e))return k(t)}return function(t){const{points:e}=M(t,null),{inSR:n,outSR:s,datumTransformation:r}=t,o=e.map((t=>new h.c(t[0],t[1],n))),i=(0,l.project)(o,s,r);return r&&F(o,i,n,s),i.map((t=>t?[t.x,t.y]:[NaN,NaN]))}(t)}function k(t){const{inSR:e,outSR:n,datumTransformation:s}=t,r=C(e),{points:o,mask:i}=M(t,r);if(!e.isGeographic){const t=e.wkid?u.P.coordsys(e.wkid):u.P.fromString(e.isGeographic?u.a.PE_TYPE_GEOGCS:u.a.PE_TYPE_PROJCS,e.wkt2||e.wkt);u.g.projToGeog(t,o.length,o)}if(null!=s&&s.steps.length){let t;const e=179.9955;if(n.isGeographic&&(t=o.map((([t])=>t>e?1:t<-e?-1:0))),s.steps.forEach((t=>{const e=t.wkid?u.P.geogtran(t.wkid):u.P.fromString(u.a.PE_TYPE_GEOGTRAN,t.wkt);u.h.geogToGeog(e,o.length,o,null,t.isInverse?u.a.PE_TRANSFORM_2_TO_1:u.a.PE_TRANSFORM_1_TO_2)})),t)for(let n=0;n<o.length;n++){const s=t[n],r=o[n][0],i=r>e?1:r<-e?-1:0;s&&i&&s!==i&&(o[n][0]=s>0?r+360:r-360)}}if(!n.isGeographic){const t=C(n,!0),e=null!=t&&t.isEnvelope?[t.bbox[1],t.bbox[3]]:[-90,90];!function(t,e){const[n,s]=e;for(let e=0;e<t.length;e++){const r=t[e][1];(r<n||r>s)&&(t[e]=[NaN,NaN])}}(o,e);const s=n.wkid?u.P.coordsys(n.wkid):u.P.fromString(n.isGeographic?u.a.PE_TYPE_GEOGCS:u.a.PE_TYPE_PROJCS,n.wkt2||n.wkt);u.g.geogToProj(s,o.length,o)}let a=o;if(i&&o.length!==i.length){a=[];for(let t=0,e=0;t<i.length;t++)i[t]?a.push(o[e++]):a.push([NaN,NaN])}return a}function C(t,e=!1){let n=t.wkid||t.wkt2||t.wkt;if(!n||t.isGeographic)return null;if(n=String(n),b.has(n)){const t=b.get(n);return e?t?.gcs:t?.pcs}const s=t.wkid?u.P.coordsys(t.wkid):u.P.fromString(t.isGeographic?u.a.PE_TYPE_GEOGCS:u.a.PE_TYPE_PROJCS,t.wkt2||t.wkt),r=S(s,N(t,1e-4)),o=S(s,0,!0);return b.set(n,{pcs:r,gcs:o}),e?o:r}function S(t,e=0,n=!1){const s=u.j.generate(t),r=n?t.horizonGcsGenerate():t.horizonPcsGenerate();if(!s||!r?.length)return null;let o=!1,i=r.find((t=>1===t.getInclusive()&&1===t.getKind()));if(!i){if(i=r.find((t=>1===t.getInclusive()&&0===t.getKind())),!i)return null;o=!0}const a=n?0:(2===s.getNorthPoleLocation()?1:0)|(2===s.getSouthPoleLocation()?2:0),l=s.isPannableRectangle(),c=i.getCoord();if(o)return{isEnvelope:o,isPannable:l,vertices:c,coef:null,bbox:[c[0][0]-e,c[0][1]-e,c[1][0]+e,c[1][1]+e],poleLocation:a};let p=0;const h=[];let[f,m]=c[0],[d,g]=c[0];for(let t=0,e=c.length;t<e;t++){p++,p===e&&(p=0);const[n,s]=c[t],[r,o]=c[p];if(o===s)h.push([n,r,s,o,2]);else{const t=(r-n)/(o-s||1e-4),e=n-t*s;s<o?h.push([t,e,s,o,0]):h.push([t,e,o,s,1])}f=f<n?f:n,m=m<s?m:s,d=d>n?d:n,g=g>s?g:s}return{isEnvelope:!1,isPannable:l,vertices:c,coef:h,bbox:[f,m,d,g],poleLocation:a}}function M(t,e){const n=[],{cols:s,rows:r,xres:o,yres:i,usePixelCenter:a}=t;let{xmin:u,ymax:l}=t;if(a&&(u+=o/2,l-=i/2),null==e){for(let t=0;t<s;t++)for(let e=0;e<r;e++)n.push([u+o*t,l-i*e]);return{points:n}}const c=new Uint8Array(s*r);if(e.isEnvelope){const{bbox:[t,a,p,h]}=e;for(let f=0,m=0;f<s;f++){const s=u+o*f,d=e.isPannable||s>=t&&s<=p;for(let t=0;t<r;t++,m++){const e=l-i*t;d&&e>=a&&e<=h&&(n.push([s,e]),c[m]=1)}}return{points:n,mask:c}}const p=e.coef,h=[];for(let t=0;t<r;t++){const e=l-i*t,n=[],s=[];for(let t=0;t<p.length;t++){const[r,o,i,a,u]=p[t];if(e===i&&i===a)n.push(r),n.push(o),s.push(2),s.push(2);else if(e>=i&&e<=a){const t=r*e+o;n.push(t),s.push(u)}}let r=n;if(n.length>2){let t=2===s[0]?0:s[0],e=n[0];r=[];for(let o=1;o<s.length;o++)2===s[o]&&o!==s.length-1||(s[o]!==t&&(r.push(0===t?Math.min(e,n[o-1]):Math.max(e,n[o-1])),t=s[o],e=n[o]),o===s.length-1&&r.push(0===s[o]?Math.min(e,n[o]):Math.max(e,n[o])));r.sort(((t,e)=>t-e))}else n[0]>n[1]&&(r=[n[1],n[0]]);h.push(r)}for(let t=0,e=0;t<s;t++){const s=u+o*t;for(let t=0;t<r;t++,e++){const r=l-i*t,o=h[t];if(2===o.length)s>=o[0]&&s<=o[1]&&(n.push([s,r]),c[e]=1);else if(o.length>2){let t=!1;for(let e=0;e<o.length;e+=2)if(s>=o[e]&&s<=o[e+1]){t=!0;break}t&&(n.push([s,r]),c[e]=1)}}}return{points:n,mask:c}}function j(t,e,n=null,r=!0){const i=t.spatialReference;if(i.equals(e))return t;const a=z(t),u=O(i,!0),c=O(e);if(0===a||null==u||null==c){const o=G(t,e,n,r);if(null==u&&null!=c&&Math.abs(o.width-c)<N(e)&&(0,l.isLoaded)()){const n=C(i);if(null!=n&&n.poleLocation===s.None&&t.width<(n.bbox[2]-n.bbox[0])/2)return function(t,e){const n=O(e);if(null==n)return null;let{xmin:s,ymin:r,xmax:o,ymax:i}=t;const a=t.spatialReference,u=new f.c({spatialReference:a,rings:[[[s,r],[o,r],[o,i],[s,i],[s,r]]]}),c=(0,l.project)(u,e);if(2!==c.rings.length||!c.rings[0].length||!c.rings[1].length)return null;const{rings:h}=c,m=N(a),d=new p.c({spatialReference:e});for(let t=0;t<2;t++){s=o=h[t][0][0],r=i=h[t][0][1];for(let e=0;e<h[t].length;e++)s=s>h[t][e][0]?h[t][e][0]:s,o=o<h[t][e][0]?h[t][e][0]:o,r=r>h[t][e][1]?h[t][e][1]:r,i=i<h[t][e][1]?h[t][e][1]:i;if(0===t)d.ymin=r,d.ymax=i,d.xmin=s,d.xmax=o;else if(d.ymin=Math.min(d.ymin,r),d.ymax=Math.max(d.ymax,i),Math.abs(o-n/2)<m)d.xmin=s,d.xmax=d.xmax+n;else{if(!(Math.abs(s+n/2)<m))return null;d.xmax=o+n}}return d}(t,e)||o}return o}const h=t.clone().normalize();if(1===h.length&&t.xmax<u&&t.xmax-u/2>N(i)){const{xmin:e,xmax:n}=t;for(let s=0;s<=a;s++){const r=0===s?e:-u/2,o=s===a?n-u*s:u/2;h[s]=new p.c({xmin:r,xmax:o,ymin:t.ymin,ymax:t.ymax,spatialReference:i})}}return function(t,e){const n=O(t[0].spatialReference);if(t.length<2||null==n)return t[0];if(e=e??N(t[0].spatialReference),1===(t=t.filter((t=>t.width>e))).length)return t[0];let{xmin:s,xmax:r,ymin:o,ymax:i}=t[0];for(let e=1;e<t.length;e++){const s=t[e];r=s.xmax+n*e,o=Math.min(o,s.ymin),i=Math.max(i,s.ymax)}return new p.c({xmin:s,xmax:r,ymin:o,ymax:i,spatialReference:t[0].spatialReference})}(h.map((t=>G(t,e,n,r))).filter(o.G6))}function B(t,e,n){if("extent"===t.type){const{xmin:e,ymin:n,xmax:s,ymax:r,spatialReference:o}=t;t=new f.c({rings:[[[e,r],[s,r],[s,n],[e,n],[e,r]]],spatialReference:o})}return t.spatialReference.equals(e)?t:(g(t.spatialReference,e,n),(0,l.project)(t,e,n))}function G(t,e,n=null,s=!0,r=!0){const o=t.spatialReference;if(o.equals(e)||!e)return t;g(o,e,n);const i=(0,l.project)(t,e,n);if(r&&e.isWebMercator&&i&&(i.ymax=Math.min(20037508.342787,i.ymax),i.ymin=Math.max(-20037508.342787,i.ymin),i.ymin>=i.ymax))return null;if(!s||!i)return i;const a=E(o,!0),u=E(e,!0);if(null==a||null==u)return i;const c=N(o,.001),p=N(o,q),f=N(e,.001);if(Math.abs(i.xmin-u[0])<f&&Math.abs(i.xmax-u[1])<f){const s=Math.abs(t.xmin-a[0]),r=Math.abs(a[1]-t.xmax);if(s<c&&r>p){i.xmin=u[0];const s=[];s.push(new h.c(t.xmax,t.ymin,o)),s.push(new h.c(t.xmax,(t.ymin+t.ymax)/2,o)),s.push(new h.c(t.xmax,t.ymax,o));const r=s.map((t=>R(t,e,n))).filter((t=>!isNaN(t?.x))).map((t=>t.x));i.xmax=Math.max.apply(null,r)}if(r<c&&s>p){i.xmax=u[1];const s=[];s.push(new h.c(t.xmin,t.ymin,o)),s.push(new h.c(t.xmin,(t.ymin+t.ymax)/2,o)),s.push(new h.c(t.xmin,t.ymax,o));const r=s.map((t=>R(t,e,n))).filter((t=>!isNaN(t?.x))).map((t=>t.x));i.xmin=Math.min.apply(null,r)}}else{const t=N(e,.001);Math.abs(i.xmin-u[0])<t&&(i.xmin=u[0]),Math.abs(i.xmax-u[1])<t&&(i.xmax=u[1])}return i}function O(t,e=!1){if(!t)return null;const n=e?20037508.342787:20037508.342788905;return t.isWebMercator?2*n:t.wkid&&t.isGeographic?360:2*x[t.wkid]||null}function E(t,e=!1){if(t.isGeographic)return[-180,180];const n=O(t,e);return null!=n?[-n/2,n/2]:null}function D(t,e,n,s){let r=(t-e)/n;return r-Math.floor(r)!=0?r=Math.floor(r):s&&(r-=1),r}function z(t,e=!1){const n=O(t.spatialReference);if(null==n)return 0;const s=e?0:-n/2,r=N(t.spatialReference),o=!e&&Math.abs(t.xmax-n/2)<r?n/2:t.xmax,i=!e&&Math.abs(t.xmin+n/2)<r?-n/2:t.xmin;return D(o,s,n,!0)-D(i,s,n,!1)}function W(t){const e=t.storageInfo.origin.x,n=O(t.spatialReference,!0);if(null==n)return{originX:e,halfWorldWidth:null,pyramidsInfo:null};const s=n/2,{nativePixelSize:r,storageInfo:o,extent:i}=t,{maximumPyramidLevel:a,blockWidth:u,pyramidScalingFactor:l}=o;let c=r.x;const p=[],h=null!=t.transform&&"gcs-shift"===t.transform.type,f=e+(h?0:s),m=h?n-e:s-e;for(let t=0;t<=a;t++){const t=(i.xmax-e)/c/u,n=t-Math.floor(t)==0?t:Math.ceil(t),s=m/c/u,r=s-Math.floor(s)==0?s:Math.ceil(s),o=Math.floor(f/c/u),a=Math.round(f/c)%u,h=(u-Math.round(m/c)%u)%u;p.push({resolutionX:c,blockWidth:u,datasetColumnCount:n,worldColumnCountFromOrigin:r,leftMargin:a,rightPadding:h,originColumnOffset:o}),c*=l}return{originX:e,halfWorldWidth:s,pyramidsInfo:p,hasGCSSShiftTransform:h}}function L(t){const e=t.isAdaptive&&null==t.spacing;let n=t.spacing||[w,w],s=U(t),r={cols:s.size[0]+1,rows:s.size[1]+1};const o=s.outofBoundPointCount>0&&s.outofBoundPointCount<s.offsets.length/2;let i=s.outofBoundPointCount===s.offsets.length/2||e&&o?[0,0]:y(s.offsets,r,n,_);const a=(i[0]+i[1])/2,l=t.projectedExtent.spatialReference,c=t.srcBufferExtent.spatialReference;if(e&&(o||a>_)&&(d(l,c,t.datumTransformation)&&(l.isGeographic||C(l)),n=[v,v],s=U({...t,spacing:n}),r={cols:s.size[0]+1,rows:s.size[1]+1},i=y(s.offsets,r,n,_)),s.error=i,n[0]>1&&(s.coefficients=V(s.offsets,r,o)),t.includeGCSGrid&&!l.isGeographic&&!l.isWebMercator)if(c.isGeographic)s.gcsGrid={offsets:s.offsets,coefficients:s.coefficients,spacing:n};else{const e=C(l);if(null!=e&&!e.isEnvelope){const e=function(t){if(!t||t.isGeographic)return t;const e=String(t.wkid||t.wkt2||t.wkt);let n;return A.has(e)?n=A.get(e):(n=(t.wkid?u.P.coordsys(t.wkid):u.P.fromString(u.a.PE_TYPE_PROJCS,t.wkt2||t.wkt)).getGeogcs().getCode(),A.set(e,n)),new m.c({wkid:n})}(l),i=j(t.projectedExtent,e),{offsets:a}=U({...t,srcBufferExtent:i,spacing:n}),c=V(a,r,o);s.gcsGrid={offsets:a,coefficients:c,spacing:n}}}return s}function U(t){const{projectedExtent:e,srcBufferExtent:n,pixelSize:s,datumTransformation:r,rasterTransform:o}=t,i=e.spatialReference,a=n.spatialReference,u=g(i,a),{xmin:l,ymin:c,xmax:p,ymax:f}=e,m=O(a),d=null!=m&&(t.hasWrapAround||"gcs-shift"===o?.type),y=t.spacing||[w,w],x=y[0]*s.x,_=y[1]*s.y,b=1===y[0],A=Math.ceil((p-l)/x-.1/y[0])+(b?0:1),P=Math.ceil((f-c)/_-.1/y[1])+(b?0:1),T=I({cols:A,rows:P,xmin:l,ymax:f,xres:x,yres:_,inSR:i,outSR:a,datumTransformation:r,preferPE:y[0]<=v,usePixelCenter:b}),R=[];let F,k=0;const S=b?-1:NaN,{xmin:M,xmax:j,ymax:B,width:G,height:E}=n,D=N(a,q),z=null!=m&&M>0&&j>m/2;let W=!1;if(u){const t=C(i);W=null!=t&&t.poleLocation>0}for(let t=0;t<A;t++){const e=[];for(let n=0;n<P;n++){let s=T[t*P+n];if(d&&s[0]>j&&s[0]>m/2-D?s[0]-=m:d&&0===t&&s[0]<0&&z&&!o&&(s[0]+=m),!s||isNaN(s[0])||isNaN(s[1]))R.push(S),R.push(S),e.push(null),k++;else{if(o){const t=o.inverseTransform(new h.c({x:s[0],y:s[1],spatialReference:a}));s=[t.x,t.y]}e.push(s),t>0&&d&&F[n]&&s[0]<F[n][0]&&(s[0]+=m,W&&s[0]>j&&s[0]>m&&(s[0]-=m)),R.push((s[0]-M)/G),R.push((B-s[1])/E)}}F=e}return{offsets:R,error:null,coefficients:null,outofBoundPointCount:k,spacing:y,size:b?[A,P]:[A-1,P-1]}}function V(t,e,n){const{cols:s,rows:r}=e,o=new Float32Array((s-1)*(r-1)*2*6),i=new Float32Array([-0,-1,1,-1,1,-0,1,-0,-0]),a=new Float32Array([-1,1,0,0,-1,1,1,0,0]);for(let e=0;e<s-1;e++){for(let n=0;n<r-1;n++){let u=e*r*2+2*n;const l=t[u],c=t[u+1],p=t[u+2],h=t[u+3];u+=2*r;const f=t[u],m=t[u+1],d=t[u+2],g=t[u+3];let y=0,x=12*(n*(s-1)+e);for(let t=0;t<3;t++)o[x++]=i[y++]*l+i[y++]*p+i[y++]*d;y=0;for(let t=0;t<3;t++)o[x++]=i[y++]*c+i[y++]*h+i[y++]*g;y=0;for(let t=0;t<3;t++)o[x++]=a[y++]*l+a[y++]*f+a[y++]*d;y=0;for(let t=0;t<3;t++)o[x++]=a[y++]*c+a[y++]*m+a[y++]*g}if(n)for(let t=0;t<o.length;t++)isNaN(o[t])&&(o[t]=-1)}return o}function K(t){const{spatialReference:e}=t,n=(0,c.Nq)(e);if(!n)return t;const[s,r]=n.valid,o=r-s;let i=0;if(t.xmin<s){const e=s-t.xmin;i=Math.ceil(e/o)}else if(t.xmin>r){const e=t.xmin-r;i=-Math.ceil(e/o)}return new p.c({spatialReference:t.spatialReference,xmin:t.xmin+i*o,ymin:t.ymin,xmax:t.xmax+i*o,ymax:t.ymax})}function H(t,e,n){const{storageInfo:s,pixelSize:r}=e;let o=0,i=!1;const{pyramidResolutions:u}=s,l="mixed"===s.tileInfo.format?.toLowerCase()?Math.max(1,Math.min(3,s.tileInfo.dpi/96)):1,c=(t.x+t.y)/2/l;if(null!=u&&u.length){const t=u[u.length-1],s=(t.x+t.y)/2,l=(r.x+r.y)/2;if(c<=l)o=0;else if(c>=s)o=u.length,i=c/s>8;else{let t,e=l;for(let s=1;s<=u.length;s++){if(t=(u[s-1].x+u[s-1].y)/2,c<=t){c===t?o=s:"down"===n?(o=s-1,i=c/e>8):o="up"===n||c-e>t-c||c/e>2?s:s-1;break}e=t}}const p=0===o?r:u[o-1];return i&&Math.min(p.x,p.y)*(0,a.k8)(e.spatialReference)>19567&&(i=!1),{pyramidLevel:o,pyramidResolution:new h.c({x:p.x,y:p.y,spatialReference:e.spatialReference}),excessiveReading:i}}const p=Math.log(t.x/r.x)/Math.LN2,f=Math.log(t.y/r.y)/Math.LN2,m=e.storageInfo.maximumPyramidLevel||0;o="down"===n?Math.floor(Math.min(p,f)):"up"===n?Math.ceil(Math.max(p,f)):Math.round((p+f)/2),o<0?o=0:o>m&&(i=o>m+3,o=m);const d=2**o;return{pyramidLevel:o,pyramidResolution:new h.c({x:d*e.nativePixelSize.x,y:d*e.nativePixelSize.y,spatialReference:e.spatialReference}),excessiveReading:i}}},24428:(t,e,n)=>{n.d(e,{c:()=>u});var s=n(41948),r=n(40504),o=n(1580),i=(n(9456),n(66360),n(72052),n(12552));let a=class extends r.am{get affectsPixelSize(){return!1}forwardTransform(t){return t}inverseTransform(t){return t}};(0,s._)([(0,o.qq)()],a.prototype,"affectsPixelSize",null),(0,s._)([(0,o.qq)({json:{write:!0}})],a.prototype,"spatialReference",void 0),a=(0,s._)([(0,i.c)("esri.layers.support.rasterTransforms.BaseRasterTransform")],a);const u=a},91288:(t,e,n)=>{n.d(e,{c:()=>c});var s,r=n(41948),o=n(1580),i=(n(9456),n(66360),n(72052),n(9968)),a=n(12552),u=n(24428);let l=s=class extends u.c{constructor(){super(...arguments),this.type="gcs-shift",this.tolerance=1e-8}forwardTransform(t){return"point"===(t=t.clone()).type?(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"point"===(t=t.clone()).type?(t.x<-this.tolerance&&(t.x+=360),t):(t.xmin<-this.tolerance&&(t.xmin+=360,t.xmax+=360),t)}clone(){return new s({tolerance:this.tolerance})}};(0,r._)([(0,i.G)({GCSShiftXform:"gcs-shift"})],l.prototype,"type",void 0),(0,r._)([(0,o.qq)()],l.prototype,"tolerance",void 0),l=s=(0,r._)([(0,a.c)("esri.layers.support.rasterTransforms.GCSShiftTransform")],l);const c=l},79972:(t,e,n)=>{n.d(e,{c:()=>g});var s,r=n(41948),o=(n(60708),n(1580)),i=(n(9456),n(66360),n(72052),n(9968)),a=n(33600),u=n(12552),l=n(18996),c=n(24428),p=n(67776),h=n(95247);function f(t,e,n){const{x:s,y:r}=e;if(n<2)return{x:t[0]+s*t[2]+r*t[4],y:t[1]+s*t[3]+r*t[5]};if(2===n){const e=s*s,n=r*r,o=s*r;return{x:t[0]+s*t[2]+r*t[4]+e*t[6]+o*t[8]+n*t[10],y:t[1]+s*t[3]+r*t[5]+e*t[7]+o*t[9]+n*t[11]}}const o=s*s,i=r*r,a=s*r,u=o*s,l=o*r,c=s*i,p=r*i;return{x:t[0]+s*t[2]+r*t[4]+o*t[6]+a*t[8]+i*t[10]+u*t[12]+l*t[14]+c*t[16]+p*t[18],y:t[1]+s*t[3]+r*t[5]+o*t[7]+a*t[9]+i*t[11]+u*t[13]+l*t[15]+c*t[17]+p*t[19]}}function m(t,e,n){const{xmin:s,ymin:r,xmax:o,ymax:i,spatialReference:a}=e;let u=[];if(n<2)u.push({x:s,y:i}),u.push({x:o,y:i}),u.push({x:s,y:r}),u.push({x:o,y:r});else{let t=10;for(let e=0;e<t;e++)u.push({x:s,y:r+(i-r)*e/(t-1)}),u.push({x:o,y:r+(i-r)*e/(t-1)});t=8;for(let e=1;e<=t;e++)u.push({x:s+(o-s)*e/t,y:r}),u.push({x:s+(o-s)*e/t,y:i})}u=u.map((e=>f(t,e,n)));const l=u.map((t=>t.x)),c=u.map((t=>t.y));return new h.c({xmin:Math.min.apply(null,l),xmax:Math.max.apply(null,l),ymin:Math.min.apply(null,c),ymax:Math.max.apply(null,c),spatialReference:a})}let d=s=class extends c.c{constructor(){super(...arguments),this.polynomialOrder=1,this.type="polynomial"}readForwardCoefficients(t,e){const{coeffX:n,coeffY:s}=e;if(!n?.length||!s?.length||n.length!==s.length)return null;const r=[];for(let t=0;t<n.length;t++)r.push(n[t]),r.push(s[t]);return r}writeForwardCoefficients(t,e,n){const s=[],r=[];for(let e=0;e<t?.length;e++)e%2==0?s.push(t[e]):r.push(t[e]);e.coeffX=s,e.coeffY=r}get inverseCoefficients(){let t=this._get("inverseCoefficients");const e=this._get("forwardCoefficients");return!t&&e&&this.polynomialOrder<2&&(t=function(t){const[e,n,s,r,o,i]=t,a=s*i-o*r,u=o*r-s*i;return[(o*n-e*i)/a,(s*n-e*r)/u,i/a,r/u,-o/a,-s/u]}(e)),t}set inverseCoefficients(t){this._set("inverseCoefficients",t)}readInverseCoefficients(t,e){const{inverseCoeffX:n,inverseCoeffY:s}=e;if(!n?.length||!s?.length||n.length!==s.length)return null;const r=[];for(let t=0;t<n.length;t++)r.push(n[t]),r.push(s[t]);return r}writeInverseCoefficients(t,e,n){const s=[],r=[];for(let e=0;e<t?.length;e++)e%2==0?s.push(t[e]):r.push(t[e]);e.inverseCoeffX=s,e.inverseCoeffY=r}get affectsPixelSize(){return this.polynomialOrder>0}forwardTransform(t){if("point"===t.type){const e=f(this.forwardCoefficients,t,this.polynomialOrder);return new p.c({x:e.x,y:e.y,spatialReference:t.spatialReference})}return m(this.forwardCoefficients,t,this.polynomialOrder)}inverseTransform(t){if("point"===t.type){const e=f(this.inverseCoefficients,t,this.polynomialOrder);return new p.c({x:e.x,y:e.y,spatialReference:t.spatialReference})}return m(this.inverseCoefficients,t,this.polynomialOrder)}clone(){return new s({polynomialOrder:this.polynomialOrder,forwardCoefficients:this.forwardCoefficients?[...this.forwardCoefficients]:null,inverseCoefficients:this.inverseCoefficients?[...this.inverseCoefficients]:null})}};(0,r._)([(0,o.qq)({json:{write:!0}})],d.prototype,"polynomialOrder",void 0),(0,r._)([(0,o.qq)()],d.prototype,"forwardCoefficients",void 0),(0,r._)([(0,a.E)("forwardCoefficients",["coeffX","coeffY"])],d.prototype,"readForwardCoefficients",null),(0,r._)([(0,l.G)("forwardCoefficients")],d.prototype,"writeForwardCoefficients",null),(0,r._)([(0,o.qq)({json:{write:!0}})],d.prototype,"inverseCoefficients",null),(0,r._)([(0,a.E)("inverseCoefficients",["inverseCoeffX","inverseCoeffY"])],d.prototype,"readInverseCoefficients",null),(0,r._)([(0,l.G)("inverseCoefficients")],d.prototype,"writeInverseCoefficients",null),(0,r._)([(0,o.qq)()],d.prototype,"affectsPixelSize",null),(0,r._)([(0,i.G)({PolynomialXform:"polynomial"})],d.prototype,"type",void 0),d=s=(0,r._)([(0,u.c)("esri.layers.support.rasterTransforms.PolynomialTransform")],d);const g=d},95280:(t,e,n)=>{n.d(e,{_:()=>m,O:()=>d});var s,r=n(91288),o=n(41948),i=(n(66360),n(9456),n(72052),n(20744),n(9968)),a=n(12552),u=n(24428);let l=s=class extends u.c{constructor(){super(...arguments),this.type="identity"}clone(){return new s}};(0,o._)([(0,i.G)({IdentityXform:"identity"})],l.prototype,"type",void 0),l=s=(0,o._)([(0,a.c)("esri.layers.support.rasterTransforms.IdentityTransform")],l);const c=l;var p=n(79972);const h={GCSShiftXform:r.c,IdentityXform:c,PolynomialXform:p.c},f=Object.keys(h);function m(t){const e=t?.type;return!t||f.includes(e)}function d(t){const e=t?.type;if(!e)return null;const n=h[t?.type];if(n){const e=new n;return e.read(t),e}return null}}}]);
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[7048],{89004:(t,e,n)=>{n.d(e,{Su:()=>cs,sJ:()=>ls});var s=n(27576),r=n(20744),o=n(62088),i=n(41948),a=n(1580),u=(n(9456),n(66360),n(72052),n(12552)),l=n(620),c=n(40504);let p=class extends c.am{constructor(){super(...arguments),this.raster=void 0}};(0,i._)([(0,a.qq)({json:{write:!0}})],p.prototype,"raster",void 0),p=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.AspectFunctionArguments")],p);const h=p;var f;let m=f=class extends h{constructor(){super(...arguments),this.raster2=void 0}get rasters(){return[this.raster,this.raster2]}clone(){return new f({raster:this.raster,raster2:this.raster2,operation:this.operation})}};(0,i._)([(0,a.qq)({json:{write:!0}})],m.prototype,"operation",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],m.prototype,"raster2",void 0),(0,i._)([(0,a.qq)({readOnly:!0})],m.prototype,"rasters",null),m=f=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.ArithmeticFunctionArguments")],m);const d=m;var g=n(33392),y=n(32104),x=n(64896);const w=new Set(["slope","aspect","curvature","hillshade","shadedrelief","statistics"]);let v=class extends c.am{constructor(){super(...arguments),this.functionArguments=null,this.readingBufferSize=0,this.id=-1,this.isNoopProcess=!1,this.rawInputBandIds=[],this.rawSourceRasterInfos=null,this.isInputBandIdsSwizzled=!1,this.swizzledBandSelection=[],this.isBranch=!1,this._bindingResult=null}get supportsGPU(){return this._bindingResult.supportsGPU}get flatWebGLFunctionChain(){const t=this.getWebGLProcessorDefinition();if(!t)return null;const e=[t],{parameters:n}=t;let s=n.rasters||n.raster&&[n.raster];for(;s?.length;){e.unshift(...s);const t=[];for(let e=0;e<s.length;e++){const{parameters:n}=s[e],r=n.rasters||n.raster&&[n.raster];r?.length&&t.push(...r)}s=t}for(let t=e.length-1;t>=0;t--)e[t].isNoopProcess&&e.splice(t,1);let r=!1;for(let t=0;t<e.length;t++){const n=e[t];n.id=e.length-t-1;const{rasters:s}=n.parameters;r=r||null!=s&&s.length>1}const o=e.some((({name:t})=>w.has(t.toLowerCase()))),{rawSourceRasterInfos:i}=this;return{functions:e,hasBranches:r,hasFocalFunction:o,isSourceSingleBand:1===i?.[0]?.bandCount}}bind(t,e=!1,n=-1){this.id=n+1;const s=this._getRasterValues();let r=!0;for(let n=0;n<s.length;n++){const o=s[n];if(null!=o&&this._isRasterFunctionValue(o)){const s=o.bind(t,e,this.id+n);if(!s.success)return this._bindingResult=s,s;r=r&&s.supportsGPU}}return!this.rasterInfo||e?(this.sourceRasterInfos=this._getSourceRasterInfos(t),this._bindingResult=this._bindSourceRasters(),this._bindingResult.success&&this._patchRasterInfo(),this._bindingResult.supportsGPU=r&&this._bindingResult.supportsGPU,this.processInputBandIds(),this._bindingResult):(this._bindingResult={success:!0,supportsGPU:!0},this.processInputBandIds(),this._bindingResult)}process(t){const e=this._getRasterValues(),n=0===e.length?t.pixelBlocks??t.primaryPixelBlocks:e.map((e=>this._readRasterValue(e,t)));return this._processPixels({...t,pixelBlocks:n})}processInputBandIds(){const t=this._getRasterValues().filter(this._isRasterFunctionValue);let e;if(t.length>1){const e=t.map((t=>t.processInputBandIds()[0]));this.rawInputBandIds=e,this.isInputBandIdsSwizzled=this.rawInputBandIds.some(((t,e)=>t!==e));const n=t.filter((t=>"ExtractBand"===t.functionName));return n.length&&n.forEach(((t,e)=>{t.isInputBandIdsSwizzled=!0,t.swizzledBandSelection=[e,e,e]})),this.rawInputBandIds}const n=t[0];if(n){if(e=n.processInputBandIds(),n.isInputBandIdsSwizzled)return this.rawInputBandIds=e,e}else{e=[];const{bandCount:t}=this.sourceRasterInfos[0];for(let n=0;n<t;n++)e.push(n)}const s=this._getInputBandIds(e);return this.isInputBandIdsSwizzled=s.some(((t,e)=>t!==e)),this.rawInputBandIds=s,this.rawInputBandIds}getPrimaryRasters(){const t=[],e=[];return this._getPrimaryRasters(this,t,e),{rasters:t,rasterIds:e}}getWebGLProcessorDefinition(){const t=this._getWebGLParameters(),{raster:e,rasters:n}=this.functionArguments;return n&&Array.isArray(n)&&n.length?(t.rasters=n.map((t=>this._isRasterFunctionValue(t)?t.getWebGLProcessorDefinition():"number"==typeof t?{name:"Constant",parameters:{value:t},pixelType:"f32",id:-1,isNoopProcess:!1}:{name:"Identity",parameters:{value:t},pixelType:"f32",id:-1,isNoopProcess:!1})),t.rasters.some((t=>null!=t))||(t.rasters=null)):this._isRasterFunctionValue(e)&&(t.raster=e.getWebGLProcessorDefinition()),{name:this.functionName,parameters:t,pixelType:this.outputPixelType,id:this.id,isNoopProcess:this.isNoopProcess}}getClippingGeometries(){const t=[];"Clip"===this.functionName&&t.push(this.functionArguments);const{raster:e,rasters:n}=this.functionArguments;if(n&&Array.isArray(n)&&n.length)n.forEach((e=>{if(this._isRasterFunctionValue(e)){const n=e.getClippingGeometries();t.push(...n)}}));else if(this._isRasterFunctionValue(e)){const n=e.getClippingGeometries();t.push(...n)}return t}_getOutputPixelType(t){return"unknown"===this.outputPixelType?t:this.outputPixelType??t}_getWebGLParameters(){return{}}_getInputBandIds(t){return t}_removeStatsHistColormapVAT(t){t.statistics=null,t.histograms=null,t.colormap=null,t.attributeTable=null}_getRasterValues(){const{rasterArgumentNames:t}=this;return"rasters"===t[0]?this.functionArguments.rasters??[]:t.flatMap((t=>this.functionArguments[t]))}_getSourceRasterInfos(t){const e=this._getRasterValues(),{rasterInfos:n,rasterIds:s}=t;if(0===e.length)return n;const r=e.map((t=>t&&"object"==typeof t&&"bind"in t&&t.rasterInfo?t.rasterInfo:"string"==typeof t&&s.includes(t)?n[s.indexOf(t)]:"number"!=typeof t?n[0]:void 0)),o=r.find((t=>t))??n[0];return r.forEach(((t,e)=>{void 0===t&&(r[e]=o)})),r}_getPrimaryRasterId(t){return t?.rasterId}_getPrimaryRasters(t,e=[],n=[]){for(let s=0;s<t.sourceRasters.length;s++){const r=t.sourceRasters[s];if("number"!=typeof r)if("bind"in r)this._getPrimaryRasters(r,e,n);else{const t=r,s=this._getPrimaryRasterId(t);if(null==s)continue;n.includes(s)||(this.mainPrimaryRasterId===s?(e.unshift(t),n.unshift(s)):(e.push(t),n.push(s)))}}}_isRasterFunctionValue(t){return null!=t&&"object"==typeof t&&"getWebGLProcessorDefinition"in t}_readRasterValue(t,e){const{primaryPixelBlocks:n}=e;if(null==t||"$$"===t){const t=n[0];return null==t?null:t.clone()}if("string"==typeof t){const s=e.primaryRasterIds.indexOf(t);return-1===s?null:n[s]}if("number"==typeof t){const e=n[0];if(null==e)return null;const{width:s,height:r,pixelType:o}=e,i=new Float32Array(s*r);i.fill(t);const a=this.sourceRasterInfos[0].bandCount,u=new Array(a).fill(i);return new y.c({width:s,height:r,pixelType:o,pixels:u})}return t.process(e)}_patchRasterInfo(){const{rasterInfo:t}=this;if(!t?.keyProperties)return;const{bandCount:e,keyProperties:n,statistics:s,histograms:r}=t,o=n.BandProperties;o&&o.length!==e&&(t.keyProperties={...n,BandProperties:void 0}),s&&s.length!==e&&(t.statistics=s.length>e?s.slice(0,e):null),r&&r.length!==e&&(t.histograms=r.length>e?r.slice(0,e):null),n.BAND_COUNT&&Number(n.BAND_COUNT)!==e&&(t.keyProperties={...n,BAND_COUNT:"string"==typeof n.BAND_COUNT?String(e):e})}};(0,i._)([(0,a.qq)({json:{write:!0}})],v.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],v.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],v.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.qq)({json:{write:!0}}),(0,g.W)((t=>t?.toLowerCase()))],v.prototype,"outputPixelType",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],v.prototype,"mainPrimaryRasterId",void 0),(0,i._)([(0,a.qq)()],v.prototype,"sourceRasters",void 0),(0,i._)([(0,a.qq)({type:[x.c],json:{write:!0}})],v.prototype,"sourceRasterInfos",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],v.prototype,"rasterInfo",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],v.prototype,"readingBufferSize",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],v.prototype,"id",void 0),(0,i._)([(0,a.qq)()],v.prototype,"isNoopProcess",void 0),(0,i._)([(0,a.qq)()],v.prototype,"supportsGPU",null),(0,i._)([(0,a.qq)()],v.prototype,"rawInputBandIds",void 0),(0,i._)([(0,a.qq)()],v.prototype,"rawSourceRasterInfos",void 0),(0,i._)([(0,a.qq)()],v.prototype,"isInputBandIdsSwizzled",void 0),(0,i._)([(0,a.qq)()],v.prototype,"swizzledBandSelection",void 0),(0,i._)([(0,a.qq)()],v.prototype,"isBranch",void 0),(0,i._)([(0,a.qq)({readOnly:!0})],v.prototype,"flatWebGLFunctionChain",null),(0,i._)([(0,a.qq)()],v.prototype,"_bindingResult",void 0),v=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.BaseRasterFunction")],v);const _=v,b={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},A={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},q={acos:6,asin:7,atan:8,atanh:9,cos:21,cosh:22,sin:51,sinh:52,tan:56,tanh:57,acosh:59,asinh:60,atan2:61},P={setNull:50,conditional:78},T={plus:1,minus:2,times:3,sqrt:4,power:5,abs:10,divide:23,exp:25,exp10:26,exp2:27,int:30,float:32,ln:35,log10:36,log2:37,mod:44,negate:45,roundDown:48,roundUp:49,square:53,floatDivide:64,floorDivide:65,...A,...q,majority:38,max:39,mean:40,med:41,min:42,minority:43,range:47,stddev:54,sum:55,variety:58,majorityIgnoreNoData:66,maxIgnoreNoData:67,meanIgnoreNoData:68,medIgnoreNoData:69,minIgnoreNoData:70,minorityIgnoreNoData:71,rangeIgnoreNoData:72,stddevIgnoreNoData:73,sumIgnoreNoData:74,varietyIgnoreNoData:75,...P},N=new Map([[q.acos,{domain:[0,Math.PI],isInteger:!1}],[q.asin,{domain:[-Math.PI/2,Math.PI/2],isInteger:!1}],[q.atan,{domain:[-Math.PI/2,Math.PI/2],isInteger:!1}],[q.cos,{domain:[-1,1],isInteger:!1}],[q.sin,{domain:[-1,1],isInteger:!1}],[A.booleanAnd,{domain:[0,1],isInteger:!0}],[A.booleanNot,{domain:[0,1],isInteger:!0}],[A.booleanOr,{domain:[0,1],isInteger:!0}],[A.booleanXOr,{domain:[0,1],isInteger:!0}],[A.equalTo,{domain:[0,1],isInteger:!0}],[A.notEqual,{domain:[0,1],isInteger:!0}],[A.greaterThan,{domain:[0,1],isInteger:!0}],[A.greaterThanEqual,{domain:[0,1],isInteger:!0}],[A.lessThan,{domain:[0,1],isInteger:!0}],[A.lessThanEqual,{domain:[0,1],isInteger:!0}],[A.isNull,{domain:[0,1],isInteger:!0}]]);function R(t){return N.get(t)}const F=[0,2,2,2,1,2,1,1,1,1,1,2,2,1,2,2,2,2,1,2,2,1,1,2,2,1,1,1,2,2,1,1,1,2,2,1,1,1,999,999,999,999,999,999,2,1,2,999,1,1,2,1,1,1,999,999,1,1,999,1,1,2,999,999,2,2,999,999,999,999,999,999,999,999,999,999,3,999,3];function I(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]+r[t]);return i}function k(t,e,n){const[s]=t,r=s.length,o=y.c.createEmptyBand("f32",r);return o.set(s),o}function C(t,e,n){const[s]=t,r=s.length,o=y.c.createEmptyBand(n,r);for(let t=0;t<r;t++)e&&!e[t]||(o[t]=s[t]*s[t]);return o}function S(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]-r[t]);return i}function M(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]*r[t]);return i}function j(t,e,n){const[s]=t,r=s.length,o=y.c.createEmptyBand(n,r);for(let t=0;t<r;t++)e&&!e[t]||(o[t]=Math.sign(s[t])*Math.floor(Math.abs(s[t])));return o}function B(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]/r[t]);return i}function G(t,e,n){return B(t,e,"f32")}function O(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=Math.floor(s[t]/r[t]));return i}function E(t,e,n,s){const r=t[0],o=r.length,i=y.c.createEmptyBand(n,o);if(s===q.atanh){for(let t=0;t<o;t++)if(e[t]){const n=r[t];Math.abs(n)>=1?e[t]=0:i[t]=Math.atanh(n)}return i}const a=s===q.asin?Math.asin:Math.acos;for(let t=0;t<o;t++)if(e[t]){const n=r[t];Math.abs(n)>1?e[t]=0:i[t]=a(n)}return i}function D(t,e,n,s){const[r]=t,o=r.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s(r[t]));return i}function z(t,e,n,s){const[r,o]=t,i=r.length,a=y.c.createEmptyBand(n,i);for(let t=0;t<i;t++)e&&!e[t]||(a[t]=s(r[t],o[t]));return a}function W(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]&r[t]);return i}function L(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]<<r[t]);return i}function U(t,e,n){const[s]=t,r=s.length,o=y.c.createEmptyBand(n,r);for(let t=0;t<r;t++)e&&!e[t]||(o[t]=~s[t]);return o}function V(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]|r[t]);return i}function K(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]>>r[t]);return i}function H(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]^r[t]);return i}function X(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]&&r[t]?1:0);return i}function J(t,e,n){const[s]=t,r=s.length,o=y.c.createEmptyBand(n,r);for(let t=0;t<r;t++)e&&!e[t]||(o[t]=s[t]?0:1);return o}function $(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]||r[t]?1:0);return i}function Y(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=(s[t]?1:0)^(r[t]?1:0));return i}function Z(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]===r[t]?1:0);return i}function Q(t,e,n,s){const[r]=t,o=r.length,i=y.c.createEmptyBand(n,o),a=s===Math.E;for(let t=0;t<o;t++)e&&!e[t]||(i[t]=a?Math.exp(r[t]):s**r[t]);return i}function tt(t,e,n){return Q(t,e,n,10)}function et(t,e,n){return Q(t,e,n,2)}function nt(t,e,n){return Q(t,e,n,Math.E)}function st(t,e,n,s){const[r]=t,o=r.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(r[t]<=0?e[t]=0:i[t]=s(r[t]));return i}function rt(t,e,n){return st(t,e,n,Math.log10)}function ot(t,e,n){return st(t,e,n,Math.log2)}function it(t,e,n){return st(t,e,n,Math.log)}function at(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]>r[t]?1:0);return i}function ut(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]>=r[t]?1:0);return i}function lt(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]<r[t]?1:0);return i}function ct(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]<=r[t]?1:0);return i}function pt(t,e,n){const[s]=t,r=s.length,o=y.c.createEmptyBand(n,r);if(!e)return o;for(let t=0;t<r;t++)o[t]=e[t]?0:1;return o}function ht(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]%r[t]);return i}function ft(t,e,n){const[s]=t,r=s.length,o=y.c.createEmptyBand(n,r);for(let t=0;t<r;t++)e&&!e[t]||(o[t]=-s[t]);return o}function mt(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]===r[t]?0:1);return i}function dt(t,e,n){const[s,r]=t,o=s.length,i=y.c.createEmptyBand(n,o),a=new Uint8Array(o);for(let t=0;t<o;t++)null!=e&&!e[t]||0!==s[t]||(i[t]=r[t],a[t]=255);return{band:i,mask:a}}function gt(t,e,n){const[s,r,o]=t,i=s.length,a=y.c.createEmptyBand(n,i);for(let t=0;t<i;t++)e&&!e[t]||(a[t]=s[t]?r[t]:o[t]);return a}function yt(t,e,n){const s=t.length;if(s<2)return t[0];const[r]=t,o=r.length,i=y.c.createEmptyBand(n,o);for(let n=0;n<o;n++)if(!e||e[n]){let e=r[n];for(let r=1;r<s;r++){const s=t[r][n];e<s&&(e=s)}i[n]=e}return i}function xt(t,e,n){const s=t.length;if(s<2)return t[0];const[r]=t,o=r.length,i=y.c.createEmptyBand(n,o);for(let n=0;n<o;n++)if(!e||e[n]){let e=r[n];for(let r=1;r<s;r++){const s=t[r][n];e>s&&(e=s)}i[n]=e}return i}function wt(t,e,n){const s=t.length;if(s<2)return t[0];const[r]=t,o=r.length,i=y.c.createEmptyBand(n,o);for(let n=0;n<o;n++)if(!e||e[n]){let e=r[n],o=e;for(let r=1;r<s;r++){const s=t[r][n];o<s?o=s:e>s&&(e=s)}i[n]=o-e}return i}function vt(t,e,n){const s=t.length;if(s<2)return t[0];const[r]=t,o=r.length,i=y.c.createEmptyBand(n,o);for(let n=0;n<o;n++)if(!e||e[n]){let e=0;for(let r=0;r<s;r++)e+=t[r][n];i[n]=e/s}return i}function _t(t,e,n){const s=t.length;if(s<2)return t[0];const[r]=t,o=r.length,i=y.c.createEmptyBand(n,o);for(let n=0;n<o;n++)if(!e||e[n])for(let e=0;e<s;e++){const s=t[e];i[n]+=s[n]}return i}function bt(t,e,n){const s=t.length;if(s<2)return t[0];const[r]=t,o=r.length,i=y.c.createEmptyBand(n,o);for(let n=0;n<o;n++)if(!e||e[n]){const e=new Float32Array(s);let r=0;for(let o=0;o<s;o++){const s=t[o];r+=s[n],e[o]=s[n]}r/=s;let o=0;for(let t=0;t<s;t++)o+=(e[t]-r)**2;i[n]=Math.sqrt(o/s)}return i}function At(t,e,n){const s=t.length;if(s<2)return t[0];const r=Math.floor(s/2),[o]=t,i=o.length,a=y.c.createEmptyBand(n,i),u=new Float32Array(s),l=s%2==1;for(let n=0;n<i;n++)if(!e||e[n]){for(let e=0;e<s;e++)u[e]=t[e][n];u.sort(),a[n]=l?u[r]:(u[r]+u[r-1])/2}return a}function qt(t,e,n){const[s,r]=t;if(null==r)return s;const o=s.length,i=y.c.createEmptyBand(n,o);for(let t=0;t<o;t++)e[t]&&(s[t]===r[t]?i[t]=s[t]:e[t]=0);return i}function Pt(t,e,n){const s=t.length;if(s<=2)return qt(t,e,n);const r=t[0].length,o=y.c.createEmptyBand(n,r),i=new Map;for(let n=0;n<r;n++)if(!e||e[n]){let e;i.clear();for(let r=0;r<s;r++)e=t[r][n],i.set(e,i.has(e)?i.get(e)+1:1);let r=0,a=0;for(const t of i.keys())r=i.get(t),r>a&&(a=r,e=t);o[n]=e}return o}function Tt(t,e,n){const s=t.length;if(s<=2)return qt(t,e,n);const r=t[0].length,o=y.c.createEmptyBand(n,r),i=new Map;for(let n=0;n<r;n++)if(!e||e[n]){let e;i.clear();for(let r=0;r<s;r++)e=t[r][n],i.set(e,i.has(e)?i.get(e)+1:1);let r=0,a=t.length;for(const t of i.keys())r=i.get(t),r<a&&(a=r,e=t);o[n]=e}return o}function Nt(t,e,n){const s=t.length;if(s<2)return t[0];const[r]=t,o=r.length,i=y.c.createEmptyBand(n,o),a=new Set;for(let n=0;n<o;n++)if(!e||e[n]){let e;a.clear();for(let r=0;r<s;r++)e=t[r][n],a.add(e);i[n]=a.size}return i}const Rt=new Map,Ft=new Map,It=new Map,kt=new Map;function Ct(t,e,n,s){let[r,o]=(0,l.mO)(n);const i=(0,l.sZ)(n);i&&(r-=1e-5,o+=1e-5);for(let n=0;n<e.length;n++)if(e[n]){const a=t[n];isNaN(a)||a<r||a>o?e[n]=0:s[n]=i?Math.round(a):a}}function St(t,e,n={}){Rt.size||(Rt.set(4,Math.sqrt),Rt.set(6,Math.acos),Rt.set(7,Math.asin),Rt.set(8,Math.atan),Rt.set(9,Math.atanh),Rt.set(10,Math.abs),Rt.set(21,Math.cos),Rt.set(22,Math.cosh),Rt.set(48,Math.floor),Rt.set(49,Math.ceil),Rt.set(51,Math.sin),Rt.set(52,Math.sinh),Rt.set(56,Math.tan),Rt.set(57,Math.tanh),Rt.set(59,Math.acosh),Rt.set(60,Math.asinh),Rt.set(65,Math.floor),Ft.set(5,Math.pow),Ft.set(61,Math.atan2),It.set(1,I),It.set(2,S),It.set(3,M),It.set(11,W),It.set(12,L),It.set(13,U),It.set(14,V),It.set(15,K),It.set(16,H),It.set(17,X),It.set(18,J),It.set(19,$),It.set(20,Y),It.set(23,B),It.set(24,Z),It.set(25,nt),It.set(26,tt),It.set(27,et),It.set(28,at),It.set(29,ut),It.set(30,j),It.set(31,pt),It.set(32,k),It.set(33,lt),It.set(34,ct),It.set(35,it),It.set(36,rt),It.set(37,ot),It.set(44,ht),It.set(45,ft),It.set(46,mt),It.set(53,C),It.set(64,G),It.set(65,O),It.set(76,gt),It.set(78,gt),kt.set(38,Pt),kt.set(39,yt),kt.set(40,vt),kt.set(41,At),kt.set(42,xt),kt.set(43,Tt),kt.set(47,wt),kt.set(54,bt),kt.set(55,_t),kt.set(58,Nt),kt.set(66,Pt),kt.set(67,yt),kt.set(68,vt),kt.set(69,At),kt.set(70,xt),kt.set(71,Tt),kt.set(72,wt),kt.set(73,bt),kt.set(74,_t),kt.set(75,Nt));let s=function(t,e=!1){const n=t.map((t=>t.mask)),s=n.filter((t=>null!=t)),r=t[0].pixels[0].length;if(0===s.length||e&&s.length!==n.length)return new Uint8Array(r).fill(255);const o=s[0],i=new Uint8Array(o);if(1===s.length)return i;if(!e){for(let t=1;t<s.length;t++){const e=s[t];for(let t=0;t<i.length;t++)i[t]&&(i[t]=e[t]?255:0)}return i}for(let t=1;t<s.length;t++){const e=s[t];for(let t=0;t<i.length;t++)0===i[t]&&(i[t]=e[t]?255:0)}return i}(t,e>=66&&e<=75);const{outputPixelType:r="f32"}=n,o=!kt.has(e)||n.processAsMultiband,i=o?t[0].pixels.length:1,a=[];for(let n=0;n<i;n++){const i=kt.has(e)&&!o?t.flatMap((t=>t.pixels)):t.map((t=>t.pixels[n]));let u,l=!0;if(e===P.setNull){const t=dt(i,s,r);u=t.band,s=t.mask,l=!1}else It.has(e)?u=It.get(e)(i,s,"f64"):Rt.has(e)?u=e===q.asin||e===q.acos||e===q.atanh?E(i,s,"f64",e):D(i,s,"f64",Rt.get(e)):Ft.has(e)?u=z(i,s,"f64",Ft.get(e)):kt.has(e)?u=kt.get(e)(i,s,"f64"):(u=i[0],l=!1);if(l&&e!==A.isNull&&!N.has(e)){const t=y.c.createEmptyBand(r,u.length);s||(s=new Uint8Array(u.length).fill(255)),Ct(u,s,r,t),u=t}a.push(u)}const u=t[0];return new y.c({width:u.width,height:u.height,pixelType:r,mask:e===A.isNull?null:s,pixels:a})}let Mt=class extends _{constructor(){super(...arguments),this.functionName="Arithmetic",this.functionArguments=null,this.rasterArgumentNames=["raster","raster2"]}_bindSourceRasters(){const{operation:t}=this.functionArguments;if(t<1||t>6)return{success:!1,supportsGPU:!1,error:"unsupported operation"};const e=this.sourceRasterInfos[0].clone();return this.outputPixelType=this._getOutputPixelType(e.pixelType),e.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(e),this.rasterInfo=e,{success:!0,supportsGPU:e.bandCount<=3}}_processPixels(t){const{pixelBlocks:e}=t;return null==e?.[0]||null==e?.[1]?null:function(t,e,n){return St(t,e=[null,1,2,3,23,5,44][e]??1,{outputPixelType:n})}(e,this.functionArguments.operation,this.outputPixelType)}_getWebGLParameters(){const{operation:t}=this.functionArguments,e=["","plus","minus","times","divide","power","mod"][t],n=this.outputPixelType??"f32";let[s,r]=(0,l.mO)(n);const o=(0,l.sZ)(n);return o&&(s-=1e-4,r+=1e-4),{imageCount:2,operationName:e,domainRange:[s,r],isOutputRounded:o}}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],Mt.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:d,json:{write:!0,name:"rasterFunctionArguments"}})],Mt.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],Mt.prototype,"rasterArgumentNames",void 0),Mt=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.ArithmeticFunction")],Mt);const jt=Mt;var Bt;let Gt=Bt=class extends h{clone(){return new Bt({raster:this.raster})}};Gt=Bt=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.AspectFunctionArguments")],Gt);const Ot=Gt;var Et=n(92432);let Dt=class extends _{constructor(){super(...arguments),this.functionName="Aspect",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){const t=this.sourceRasterInfos[0];this.isGCS=t.spatialReference?.isGeographic??!1,this.outputPixelType=this._getOutputPixelType("f32");const e=t.clone();return e.pixelType=this.outputPixelType,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){const e=t.pixelBlocks?.[0];if(null==e)return null;const{extent:n,primaryPixelSizes:s}=t,r=s?.[0],o=r??(n?{x:n.width/e.width,y:n.height/e.height}:{x:1,y:1});return(0,Et.c9)(e,{resolution:o})}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],Dt.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:Ot,json:{write:!0,name:"rasterFunctionArguments"}})],Dt.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],Dt.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],Dt.prototype,"isGCS",void 0),Dt=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.AspectFunction")],Dt);const zt=Dt;var Wt=n(9968),Lt=n(14628);const Ut=new Set(["+","-","*","/","(",")"]);function Vt(t,e){return t.toLowerCase().startsWith("b")?e[parseInt(t.slice(1),10)-1]:parseFloat(t)}function Kt(t,e,n,s){if("number"==typeof n&&"number"==typeof s)return n+s;let r,o,i;"number"==typeof n?(i=s,r=i.length,o=new Float32Array(r),o.fill(n)):(r=n.length,o=n,s.constructor===Number?(i=new Float32Array(r),i.fill(s)):i=s);const a=new Float32Array(r);switch(e){case"+":for(let e=0;e<r;e++)(null==t||t[e])&&(a[e]=o[e]+i[e]);break;case"-":for(let e=0;e<r;e++)(null==t||t[e])&&(a[e]=o[e]-i[e]);break;case"*":for(let e=0;e<r;e++)(null==t||t[e])&&(a[e]=o[e]*i[e]);break;case"/":for(let e=0;e<r;e++)(null==t||t[e])&&i[e]&&(a[e]=o[e]/i[e]);break;case"(":case")":throw new Error("encountered error with custom band index equation")}return a}function Ht(t,e){t.splice(e,1);let n=0,s=0;do{n=0,s=0;for(let e=0;e<t.length;e++)if("("===t[e])n=e;else if(")"===t[e]){s=e;break}s===n+1&&t.splice(n,2)}while(s===n+1);return t}function Xt(t){if(1===t.length)return{opIndex:0,numIndex:0};let e=0,n=0;for(let s=0;s<t.length;s++)if("("===t[s])e=s;else if(")"===t[s]){n=s;break}const s=0===n?t:t.slice(e+1,n);let r=-1;for(let t=0;t<s.length;t++)if("*"===s[t]||"/"===s[t]){r=t;break}if(r>-1)n>0&&(r+=e+1);else{for(let t=0;t<s.length;t++)if("+"===s[t]||"-"===s[t]){r=t;break}n>0&&(r+=e+1)}let o=0;for(let e=0;e<r;e++)"("===t[e]&&o++;return{opIndex:r,numIndex:r-o}}var Jt=n(26852);const $t=new Lt.O({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 Yt(t,e){if(!(0,Jt.u8)(t))return t;const{equation:n,method:s}=e,r=e.bandIndexes.map((t=>t-1)),{pixels:o,mask:i}=t;let a;switch(s){case"gndvi":case"nbr":case"ndbi":case"ndvi":case"ndvi-re":case"ndsi":case"ndmi":case"mndwi":a=Qt(i,o[r[0]],o[r[1]]);break;case"ndwi":a=Qt(i,o[r[1]],o[r[0]]);break;case"sr":case"sr-re":case"iron-oxide":case"ferrous-minerals":case"clay-minerals":a=function(t,e,n){const s=n.length,r=new Float32Array(s);for(let o=0;o<s;o++)if(null==t||t[o]){const t=e[o],s=n[o];s&&(r[o]=t/s)}return[r]}(i,o[r[0]],o[r[1]]);break;case"ci-g":case"ci-re":a=function(t,e,n){const s=e.length,r=new Float32Array(s);for(let o=0;o<s;o++)if(null==t||t[o]){const t=e[o],s=n[o];s&&(r[o]=t/s-1)}return[r]}(i,o[r[0]],o[r[1]]);break;case"savi":a=function(t,e,n,s){const r=n.length,o=new Float32Array(r);for(let i=0;i<r;i++)if(null==t||t[i]){const t=n[i],r=e[i],a=r+t+s;a&&(o[i]=(r-t)/a*(1+s))}return[o]}(i,o[r[0]],o[r[1]],r[2]+1);break;case"tsavi":a=function(t,e,n,s,r,o){const i=n.length,a=new Float32Array(i),u=-r*s+o*(1+s*s);for(let o=0;o<i;o++)if(null==t||t[o]){const t=n[o],i=e[o],l=r*i+t+u;l&&(a[o]=s*(i-s*t-r)/l)}return[a]}(i,o[r[0]],o[r[1]],r[2]+1,r[3]+1,r[4]+1);break;case"msavi":a=function(t,e,n){const s=n.length,r=new Float32Array(s);for(let o=0;o<s;o++)if(null==t||t[o]){const t=n[o],s=e[o],i=2*s+1;r[o]=.5*(i-Math.sqrt(i*i-8*(s-t)))}return[r]}(i,o[r[0]],o[r[1]]);break;case"gemi":a=function(t,e,n){const s=n.length,r=new Float32Array(s);for(let o=0;o<s;o++)if(null==t||t[o]){const t=n[o],s=e[o];if(1!==t&&s+t+.5!==0){const e=(2*(s*s-t*t)+1.5*s+.5*t)/(s+t+.5);r[o]=e*(1-.25*e)-(t-.125)/(1-t)}}return[r]}(i,o[r[0]],o[r[1]]);break;case"pvi":a=function(t,e,n,s,r){const o=n.length,i=new Float32Array(o),a=1/Math.sqrt(1+s*s);for(let u=0;u<o;u++)if(null==t||t[u]){const t=n[u],o=e[u];i[u]=(o-s*t-r)*a}return[i]}(i,o[r[0]],o[r[1]],r[2]+1,r[3]+1);break;case"gvitm":a=function(t,e){const[n,s,r,o,i,a]=e,u=n.length,l=new Float32Array(u);for(let e=0;e<u;e++)(null==t||t[e])&&(l[e]=-.2848*n[e]-.2435*s[e]-.5436*r[e]+.7243*o[e]+.084*i[e]-.18*a[e]);return[l]}(i,[o[r[0]],o[r[1]],o[r[2]],o[r[3]],o[r[4]],o[r[5]]]);break;case"sultan":a=function(t,e){const[n,s,r,o,i]=e,a=n.length,u=new Float32Array(a),l=new Float32Array(a),c=new Float32Array(a);for(let e=0;e<a;e++)(null==t||t[e])&&(u[e]=i[e]?o[e]/i[e]*100:0,l[e]=n[e]?o[e]/n[e]*100:0,c[e]=r[e]?s[e]/r[e]*(o[e]/r[e])*100:0);return[u,l,c]}(i,[o[r[0]],o[r[1]],o[r[2]],o[r[3]],o[r[4]]]);break;case"vari":a=function(t,e){const[n,s,r]=e,o=n.length,i=new Float32Array(o);for(let e=0;e<o;e++)if(null==t||t[e])for(e=0;e<o;e++){const t=n[e],o=s[e],a=o+t-r[e];a&&(i[e]=(o-t)/a)}return[i]}(i,[o[r[0]],o[r[1]],o[r[2]]]);break;case"mtvi2":a=function(t,e){const[n,s,r]=e,o=n.length,i=new Float32Array(o);for(let e=0;e<o;e++)if(null==t||t[e])for(e=0;e<o;e++){const t=n[e],o=s[e],a=r[e],u=Math.sqrt((2*t+1)**2-(6*t-5*Math.sqrt(o))-.5);if(u){const n=1.5*(1.2*(t-a)-2.5*(o-a));i[e]=n/u}}return[i]}(i,[o[r[0]],o[r[1]],o[r[2]]]);break;case"rtvi-core":a=function(t,e){const[n,s,r]=e,o=n.length,i=new Float32Array(o);for(let e=0;e<o;e++)if(null==t||t[e])for(e=0;e<o;e++){const t=n[e],o=s[e],a=r[e];i[e]=100*(t-o)-10*(t-a)}return[i]}(i,[o[r[0]],o[r[1]],o[r[2]]]);break;case"evi":a=function(t,e){const[n,s,r]=e,o=n.length,i=new Float32Array(o);for(let e=0;e<o;e++)if(null==t||t[e])for(e=0;e<o;e++){const t=n[e],o=s[e],a=t+6*o-7.5*r[e]+1;a&&(i[e]=2.5*(t-o)/a)}return[i]}(i,[o[r[0]],o[r[1]],o[r[2]]]);break;case"wndwi":a=function(t,e,n=.5){const[s,r,o]=e,i=r.length,a=new Float32Array(i);for(let e=0;e<i;e++)if(null==t||t[e])for(e=0;e<i;e++){const t=s[e],i=r[e],u=o[e],l=t+n*i+(1-n)*u;l&&(a[e]=(t-n*i-(1-n)*u)/l)}return[a]}(i,[o[r[0]],o[r[1]],o[r[2]]],r[3]?r[3]+1:.5);break;case"bai":a=function(t,e,n){const s=n.length,r=new Float32Array(s);for(let o=0;o<s;o++)if(null==t||t[o])for(o=0;o<s;o++){const t=(.1-e[o])**2+(.06-n[o])**2;t&&(r[o]=1/t)}return[r]}(i,o[r[0]],o[r[1]]);break;case"custom":a=function(t,e,n){let s,{ops:r,nums:o}=function(t,e){(t=t.replaceAll(" ","")).startsWith("-")&&(t="0"+t),t.startsWith("+")&&(t=t.slice(1,t.length));const n=t.split(""),s=[],r=[];let o="";for(let t=0;t<n.length;t++){const i=n[t];Ut.has(i)?(o.length&&r.push(Vt(o,e)),s.push(i),o=""):o=o.concat(i)}return o.length&&r.push(Vt(o,e)),{ops:s,nums:r}}(n,e);if(0===r.length){const t=1===o.length?o[0]:e[0];if(t instanceof Float32Array)return[t];const n=new Float32Array(e[0].length);return"number"==typeof t?n.fill(t):n.set(t),[n]}for(;r.length>0;){const{numIndex:e,opIndex:n}=Xt(r);if(s=Kt(t,r[n],o[e],o[e+1]),1===r.length)break;r=Ht(r,n),o.splice(e,2,s)}return[s]}(i,o,n);break;default:return t}const u=null!=i?new Uint8Array(i.length):null;null!=i&&null!=u&&u.set(i);const l=new y.c({width:t.width,height:t.height,pixelType:"f32",pixels:a,mask:u});return l.updateStatistics(),l}function Zt(t){const e=new Float32Array(9);return e[3*t[0]]=1,e[3*t[1]+1]=1,e[3*t[2]+2]=1,e}function Qt(t,e,n){const s=n.length,r=new Float32Array(s);for(let o=0;o<s;o++)if(null==t||t[o]){const t=e[o],s=n[o],i=t+s;i&&(r[o]=(t-s)/i)}return[r]}var te;let ee=te=class extends h{constructor(){super(...arguments),this.method="custom"}clone(){return new te({method:this.method,bandIndexes:this.bandIndexes,raster:(0,o.ct)(this.raster)})}};(0,i._)([(0,a.qq)({json:{type:String,write:!0}})],ee.prototype,"bandIndexes",void 0),(0,i._)([(0,Wt.G)($t)],ee.prototype,"method",void 0),ee=te=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.BandArithmeticFunctionArguments")],ee);const ne=ee,se=new Set(["vari","mtvi2","rtvi-core","evi"]);let re=class extends _{constructor(){super(...arguments),this.functionName="BandArithmetic",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){this.outputPixelType=this._getOutputPixelType("f32");const t=this.sourceRasterInfos[0];if(t.bandCount<2)return{success:!1,supportsGPU:!1,error:"band-arithmetic-function: source raster has insufficient amount of raster bands"};const e=t.clone();return e.pixelType=this.outputPixelType,e.bandCount="sultan"===this.functionArguments.method?3:1,this._removeStatsHistColormapVAT(e),e.keyProperties={...e.keyProperties,BandProperties:void 0},this.rasterInfo=e,{success:!0,supportsGPU:!["custom","gvitm","sultan"].includes(this.functionArguments.method)}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return e;const{method:n,bandIndexes:s}=this.functionArguments,r=s.split(" ").map((t=>parseFloat(t)));return Yt(e,{method:n,bandIndexes:r,equation:s})}_getWebGLParameters(){const t=this.functionArguments.bandIndexes.split(" ").map((t=>parseFloat(t)-1));2===t.length&&t.push(0);const e=this.isInputBandIdsSwizzled?[0,1,2]:t;let n,s;const r=new Float32Array(3),{method:o}=this.functionArguments;switch(o){case"gndvi":case"nbr":case"ndbi":case"ndvi":case"ndvi-re":case"ndsi":case"ndmi":case"mndwi":n=Zt([e[0],e[1],0]),s="ndxi";break;case"ndwi":n=Zt([e[1],e[0],0]),s="ndxi";break;case"sr":case"sr-re":case"iron-oxide":case"ferrous-minerals":case"clay-minerals":n=Zt([e[0],e[1],0]),s="sr";break;case"ci-g":case"ci-re":n=Zt([e[0],e[1],0]),s="ci";break;case"savi":n=Zt([e[0],e[1],0]),s="savi",r[0]=t[2]+1;break;case"tsavi":n=Zt([e[0],e[1],0]),s="tsavi",r[0]=t[2]+1,r[1]=t[3]+1,r[2]=t[4]+1;break;case"msavi":n=Zt([e[0],e[1],0]),s="msavi";break;case"gemi":n=Zt([e[0],e[1],0]),s="gemi";break;case"pvi":n=Zt([e[0],e[1],0]),s="tsavi",r[0]=t[2]+1,r[1]=t[3]+1;break;case"vari":n=Zt([e[0],e[1],e[2]]),s="vari";break;case"mtvi2":n=Zt([e[0],e[1],e[2]]),s="mtvi";break;case"rtvi-core":n=Zt([e[0],e[1],e[2]]),s="rtvicore";break;case"evi":n=Zt([e[0],e[1],e[2]]),s="evi";break;case"wndwi":n=Zt([e[0],e[1],0]),s="wndwi",r[0]=t[3]?t[3]+1:.5;break;case"bai":n=Zt([e[1],e[0],0]),s="bai";break;default:n=Zt([0,1,2]),s="custom"}return{bandIndexMat3:n,indexType:s,adjustments:r}}_getInputBandIds(t){if("custom"===this.functionArguments.method)return t;const e=this.functionArguments.bandIndexes.split(" ").map((t=>parseFloat(t)-1)),n=t.length,s=e.map((t=>t>=n?n-1:t)),r=se.has(this.functionArguments.method)?3:2,o=s.slice(0,r).map((e=>t[e]));return 2===o.length&&o.push(0),o}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],re.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:ne,json:{write:!0,name:"rasterFunctionArguments"}})],re.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],re.prototype,"rasterArgumentNames",void 0),re=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.BandArithmeticFunction")],re);const oe=re;var ie,ae=n(60708),ue=n(6704);const le=new Lt.O({1:"outside",2:"inside"},{useNumericKeys:!0});let ce=ie=class extends h{constructor(){super(...arguments),this.clippingType="outside"}clone(){return new ie({clippingGeometry:this.clippingGeometry.clone(),clippingType:this.clippingType})}};(0,i._)([(0,a.qq)({types:ae.Su,json:{read:ue.h4,write:!0}})],ce.prototype,"clippingGeometry",void 0),(0,i._)([(0,a.qq)({json:{read:le.read,write:le.write}})],ce.prototype,"clippingType",void 0),ce=ie=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.ClipFunctionArguments")],ce);const pe=ce;let he=class extends _{constructor(){super(...arguments),this.functionName="Clip",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isNoopProcess=!0}_bindSourceRasters(){const t=this.sourceRasterInfos[0].clone();return this.outputPixelType=this._getOutputPixelType(t.pixelType),t.pixelType=this.outputPixelType,this.rasterInfo=t,{success:!0,supportsGPU:!0}}_processPixels(t){return t.pixelBlocks?.[0]}_getWebGLParameters(){const{clippingGeometry:t,clippingType:e}=this.functionArguments;return{clippingGeometry:t.toJSON(),clippingType:e}}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],he.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:pe,json:{write:!0,name:"rasterFunctionArguments"}})],he.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],he.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.qq)()],he.prototype,"isNoopProcess",void 0),he=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.ClipFunction")],he);const fe=he;var me,de=n(33600),ge=n(44748),ye=n(55952);let xe=me=class extends h{castColormapName(t){if(!t)return null;const e=t.toLowerCase();return ge.W6.includes(e)?e:null}readColorRamp(t){return(0,ye.h)(t)}readColorRampName(t,e){if(!t)return null;const n=ge.i_.jsonValues.find((e=>e.toLowerCase()===t.toLowerCase()));return n?ge.i_.fromJSON(n):null}clone(){return new me({colormap:(0,o.ct)(this.colormap),colormapName:this.colormapName,colorRamp:this.colorRamp?.clone(),colorRampName:this.colorRampName})}};(0,i._)([(0,a.qq)({type:[[Number]],json:{write:!0}})],xe.prototype,"colormap",void 0),(0,i._)([(0,a.qq)({type:String,json:{write:!0}})],xe.prototype,"colormapName",void 0),(0,i._)([(0,g.W)("colormapName")],xe.prototype,"castColormapName",null),(0,i._)([(0,a.qq)({types:ye.i,json:{write:!0}})],xe.prototype,"colorRamp",void 0),(0,i._)([(0,de.E)("colorRamp")],xe.prototype,"readColorRamp",null),(0,i._)([(0,a.qq)({type:ge.i_.apiValues,json:{type:ge.i_.jsonValues,write:ge.i_.write}})],xe.prototype,"colorRampName",void 0),(0,i._)([(0,de.E)("colorRampName")],xe.prototype,"readColorRampName",null),xe=me=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.ColormapFunctionArguments")],xe);const we=xe,ve=[[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]],_e=[[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 be(t,e){const n=[],s=[];for(let e=0;e<t.length-1;e++)n.push({type:"algorithmic",algorithm:"esriHSVAlgorithm",fromColor:t[e].slice(1),toColor:t[e+1].slice(1)}),s.push(t[e+1][0]-t[e][0]);const r=t[t.length-1][0];return(0,ge.IL)({type:"multipart",colorRamps:n},{numColors:r,weights:e=e??s})}let Ae=class extends _{constructor(){super(...arguments),this.functionName="Colormap",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isNoopProcess=!0}_bindSourceRasters(){const t=this.sourceRasterInfos[0];if(t.bandCount>1)return{success:!1,supportsGPU:!1,error:"colormap-function: source data must be single band"};let{colormap:e,colormapName:n,colorRamp:s,colorRampName:r}=this.functionArguments;if(!e?.length)if(s)e=(0,ge.Ky)(s,{interpolateAlpha:!0});else if(r){const t=(0,ge.GK)(r);t&&(e=(0,ge.Ky)(t))}else n&&(e=function(t){let e;switch(t){case"elevation":e=be([[0,0,191,191],[51,0,0,255],[102,255,0,255],[153,255,0,127],[204,191,63,127],[256,20,20,20]]);break;case"gray":e=(0,ge.IL)({type:"algorithmic",algorithm:"esriHSVAlgorithm",fromColor:[0,0,0],toColor:[255,255,255]});break;case"hillshade":e=be([[0,38,41,54],[69,79,82,90],[131,156,156,156],[256,253,253,241]],[.268,.238,.495]);break;case"ndvi":e=ve;break;case"ndvi2":e=function(){const t=be([[0,255,255,255],[70,0,255,0],[80,205,173,193],[100,150,150,150],[110,120,51,100],[130,120,100,200],[140,28,3,144],[160,6,0,55],[180,10,25,30],[201,6,7,27]]);for(let e=t.length;e<256;e++)t.push([6,27,7]);return t}();break;case"ndvi3":e=_e;break;case"random":e=function(){const t=[];for(let e=0;e<256;e++){const e=[];for(let t=0;t<3;t++)e.push(Math.round(255*Math.random()));t.push(e)}return t}()}return e?(e=e.map(((t,e)=>[e,...t])),e):null}(n));if(!e?.length)return{success:!1,supportsGPU:!1,error:"colormap-function: missing colormap argument"};const o=this._getOutputPixelType(t.pixelType);this.outputPixelType=o.startsWith("f")?"s32":o;const i=t.clone();return i.pixelType=this.outputPixelType,i.colormap=e,i.bandCount=1,this.rasterInfo=i,{success:!0,supportsGPU:!0}}_processPixels(t){let e=t.pixelBlocks?.[0];return!e||(0,l.sZ)(e.pixelType)||(e=e.clone(),e.clamp(this.outputPixelType)),e}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],Ae.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:we,json:{write:!0,name:"rasterFunctionArguments"}})],Ae.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],Ae.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.qq)()],Ae.prototype,"isNoopProcess",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],Ae.prototype,"indexedColormap",void 0),Ae=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.ColormapFunction")],Ae);const qe=Ae;var Pe,Te=n(18996);let Ne=Pe=class extends h{constructor(){super(...arguments),this.rasters=[]}writeRasters(t,e){e.rasters=t.map((t=>"number"==typeof t||"string"==typeof t?t:t.toJSON()))}clone(){return new Pe({rasters:(0,o.ct)(this.rasters)})}};(0,i._)([(0,a.qq)({json:{write:!0}})],Ne.prototype,"rasters",void 0),(0,i._)([(0,Te.G)("rasters")],Ne.prototype,"writeRasters",null),Ne=Pe=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.CompositeBandFunctionArguments")],Ne);const Re=Ne;let Fe=class extends _{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 n=e.clone();if(n.attributeTable=null,n.colormap=null,n.pixelType=this.outputPixelType,n.bandCount=t.map((({bandCount:t})=>t)).reduce(((t,e)=>t+e)),t.every((({statistics:t})=>null!=t&&t.length))){const e=[];t.forEach((({statistics:t})=>null!=t&&e.push(...t))),n.statistics=e}if(t.every((({histograms:t})=>null!=t&&t.length))){const e=[];t.forEach((({histograms:t})=>null!=t&&e.push(...t))),n.histograms=e}n.bandCount>1&&(n.colormap=null,n.attributeTable=null);const s=t.every((t=>t.keyProperties.BandProperties?.length))?t.flatMap((t=>t.keyProperties.BandProperties)):void 0;return n.keyProperties={...n.keyProperties,BandProperties:s},this.rasterInfo=n,{success:!0,supportsGPU:n.bandCount<=3}}_processPixels(t){const{pixelBlocks:e}=t;if(!e)return null;const n=e?.[0];return null==n?null:(0,Jt.WS)(e)}_getWebGLParameters(){return{bandCount:this.rasterInfo.bandCount}}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],Fe.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:Re,json:{write:!0,name:"rasterFunctionArguments"}})],Fe.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],Fe.prototype,"rasterArgumentNames",void 0),Fe=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.CompositeBandFunction")],Fe);const Ie=Fe;var ke;let Ce=ke=class extends h{constructor(){super(...arguments),this.contrastOffset=0,this.brightnessOffset=0}clone(){return new ke({contrastOffset:this.contrastOffset,brightnessOffset:this.brightnessOffset,raster:this.raster})}};(0,i._)([(0,a.qq)({json:{write:!0}})],Ce.prototype,"contrastOffset",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],Ce.prototype,"brightnessOffset",void 0),Ce=ke=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.ContrastBrightnessFunctionArguments")],Ce);const Se=Ce;var Me=n(72116);let je=class extends _{constructor(){super(...arguments),this.functionName="ContrastBrightness",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.lookup=null}_bindSourceRasters(){const{sourceRasterInfos:t}=this,e=t[0];if("u8"!==e.pixelType)return{success:!1,supportsGPU:!1,error:"Only unsigned 8 bit raster is supported by ContrastBrightness function."};this.outputPixelType=this._getOutputPixelType("u8");const n=e.clone();this._removeStatsHistColormapVAT(n),this.rasterInfo=n;const{contrastOffset:s,brightnessOffset:r}=this.functionArguments;return this.lookup=(0,Me.Wc)(s,r),{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];return null==e?null:(0,Jt.sP)(e,{lut:e.pixels.map((()=>this.lookup)),offset:0,outputPixelType:"u8"})}_getWebGLParameters(){const{contrastOffset:t,brightnessOffset:e}=this.functionArguments;return{contrastOffset:t,brightnessOffset:e}}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],je.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:Se,json:{write:!0,name:"rasterFunctionArguments"}})],je.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],je.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],je.prototype,"lookup",void 0),je=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.ContrastBrightnessFunction")],je);const Be=je;function Ge(t,e,n,s,r){const o=Math.floor(s/2);for(let s=0;s<o;s++)for(let o=0;o<e;o++)t[s*e+o]=t[(r-1-s)*e+o],t[(n-1-s)*e+o]=t[(n-r+s)*e+o];const i=Math.floor(r/2);for(let s=0;s<n;s++){const n=s*e;for(let s=0;s<i;s++)t[n+s]=t[n+r-1-s],t[n+e-s-1]=t[n+e+s-r]}}const Oe=new Map;function Ee(t,e,n,s,r,o,i){const a=new Float32Array(e*n),u=o.length,l=i?0:s,c=i?s:0,p=i?1:e;for(let i=l;i<n-l;i++){const n=i*e;for(let i=c;i<e-c;i++){if(r&&!r[n+i])continue;let e=0;for(let r=0;r<u;r++)e+=t[n+i+(r-s)*p]*o[r];a[n+i]=e}}return a}function De(t,e,n,s,r,o,i){const a=new Float32Array(e*n),u=Math.floor(s/2),l=Math.floor(r/2);for(let c=u;c<n-u;c++){const n=c*e;for(let c=l;c<e-l;c++){if(o&&!o[n+c])continue;let p=0;for(let o=0;o<s;o++)for(let s=0;s<r;s++)p+=t[n+c+(o-u)*e+s-l]*i[o*r+s];a[n+c]=p}}return a}var ze;Oe.set(b.none,[0,0,0,0,1,0,0,0,0]),Oe.set(b.lineDetectionHorizontal,[-1,-1,-1,2,2,2,-1,-1,-1]),Oe.set(b.lineDetectionVertical,[-1,2,-1,-1,2,-1,-1,2,-1]),Oe.set(b.lineDetectionLeftDiagonal,[2,-1,-1,-1,2,-1,-1,-1,2]),Oe.set(b.lineDetectionRightDiagonal,[-1,-1,2,-1,2,-1,2,-1,-1]),Oe.set(b.gradientNorth,[-1,-2,-1,0,0,0,1,2,1]),Oe.set(b.gradientWest,[-1,0,1,-2,0,2,-1,0,1]),Oe.set(b.gradientEast,[1,0,-1,2,0,-2,1,0,-1]),Oe.set(b.gradientSouth,[1,2,1,0,0,0,-1,-2,-1]),Oe.set(b.gradientNorthEast,[0,-1,-2,1,0,-1,2,1,0]),Oe.set(b.gradientNorthWest,[-2,-1,0,-1,0,1,0,1,2]),Oe.set(b.smoothArithmeticMean,[.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111]),Oe.set(b.smoothing3x3,[.0625,.125,.0625,.125,.25,.125,.0625,.125,.0625]),Oe.set(b.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]),Oe.set(b.sharpening3x3,[-1,-1,-1,-1,9,-1,-1,-1,-1]),Oe.set(b.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]),Oe.set(b.laplacian3x3,[0,-1,0,-1,4,-1,0,-1,0]),Oe.set(b.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]),Oe.set(b.sobelHorizontal,[-1,-2,-1,0,0,0,1,2,1]),Oe.set(b.sobelVertical,[-1,0,1,-2,0,2,-1,0,1]),Oe.set(b.sharpen,[0,-.25,0,-.25,2,-.25,0,-.25,0]),Oe.set(b.sharpen2,[-.25,-.25,-.25,-.25,3,-.25,-.25,-.25,-.25]),Oe.set(b.pointSpread,[-.627,.352,-.627,.352,2.923,.352,-.627,.352,-.627]);let We=ze=class extends h{constructor(){super(...arguments),this.rows=3,this.cols=3,this.kernel=[0,0,0,0,1,0,0,0,0]}set convolutionType(t){this._set("convolutionType",t);const e=Oe.get(t);if(!e||t===b.userDefined||t===b.none)return;const n=Math.sqrt(e.length);this._set("kernel",e),this._set("cols",n),this._set("rows",n)}clone(){return new ze({cols:this.cols,rows:this.rows,kernel:[...this.kernel],convolutionType:this.convolutionType,raster:(0,o.ct)(this.raster)})}};(0,i._)([(0,a.qq)({json:{type:Number,write:!0}})],We.prototype,"rows",void 0),(0,i._)([(0,a.qq)({json:{type:Number,write:!0}})],We.prototype,"cols",void 0),(0,i._)([(0,a.qq)({json:{name:"type",type:Number,write:!0}})],We.prototype,"convolutionType",null),(0,i._)([(0,a.qq)({json:{type:[Number],write:!0}})],We.prototype,"kernel",void 0),We=ze=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.ConvolutionFunctionArguments")],We);const Le=We;let Ue=class extends _{constructor(){super(...arguments),this.functionName="Convolution",this.rasterArgumentNames=["raster"]}get _normalizedKernel(){const{kernel:t,convolutionType:e}=this.functionArguments,n=t.reduce(((t,e)=>t+e));return-1===e||0===n||1===n?t:t.map((t=>t/n))}_bindSourceRasters(){const{convolutionType:t,rows:e,cols:n,kernel:s}=this.functionArguments;if(!Object.values(b).includes(t))return{success:!1,supportsGPU:!1,error:`convolution-function: the specified kernel type is not supported ${t}`};if(t!==b.none&&e*n!==s.length)return{success:!1,supportsGPU:!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 o=r.clone();o.pixelType=this.outputPixelType;const i=[b.none,b.sharpen,b.sharpen2,b.sharpening3x3,b.sharpening5x5];return(-1===t||"u8"!==this.outputPixelType&&!i.includes(t))&&(o.statistics=null,o.histograms=null),o.colormap=null,o.attributeTable=null,this.rasterInfo=o,{success:!0,supportsGPU:s.length<=25}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e||this.functionArguments.convolutionType===b.none)return e;const{rows:n,cols:s}=this.functionArguments,{_normalizedKernel:r}=this;return function(t,e){const n=function(t){const e=Math.sqrt(t.length),n=t.slice(0,e),s=[1];for(let n=1;n<e;n++){let r=null;for(let s=0;s<e;s++){const o=t[s+n*e],i=t[s];if(null==r)if(0===i){if(o)return{separable:!1,row:null,col:null}}else r=o/i;else if(o/i!==r)return{separable:!1,row:null,col:null}}if(null==r)return{separable:!1,row:null,col:null};s.push(r)}return{separable:!0,row:n,col:s}}(e.kernel),s=!1!==e.mirrorEdges,r=n.separable?function(t,e,n,s=!0){const{pixels:r,width:o,height:i,pixelType:a,mask:u}=t,l=r.length,c=[],p=e.length,h=n.length,f=Math.floor(p/2),m=Math.floor(h/2);for(let t=0;t<l;t++){let a=Ee(r[t],o,i,f,u,e,!0);a=Ee(a,o,i,m,u,n,!1),s&&Ge(a,o,i,p,h),c.push(a)}return new y.c({width:o,height:i,pixelType:a,pixels:c,mask:u})}(t,n.row,n.col,s):function(t,e,n=!0){const{pixels:s,width:r,height:o,pixelType:i,mask:a}=t,u=s.length,l=[],{kernel:c,rows:p,cols:h}=e;for(let t=0;t<u;t++){const e=De(s[t],r,o,p,h,a,c);n&&Ge(e,r,o,p,h),l.push(e)}return new y.c({width:r,height:o,pixelType:i,pixels:l,mask:a})}(t,e,s),{outputPixelType:o}=e;return o&&r.clamp(o),r}(e,{kernel:r,rows:n,cols:s,outputPixelType:this.outputPixelType})}_getWebGLParameters(){const t=new Float32Array(25);return t.set(this._normalizedKernel),{kernelRows:this.functionArguments.rows,kernelCols:this.functionArguments.cols,kernel:t,clampRange:(0,l.mO)(this.outputPixelType)}}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],Ue.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:Le,json:{write:!0,name:"rasterFunctionArguments"}})],Ue.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],Ue.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.qq)()],Ue.prototype,"_normalizedKernel",null),Ue=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.ConvolutionFunction")],Ue);const Ve=Ue;var Ke;const He=new Lt.O({0:"standard",1:"platform",2:"profile"},{useNumericKeys:!0});let Xe=Ke=class extends h{constructor(){super(...arguments),this.curvatureType="standard",this.zFactor=1}readCurvatureType(t,e){return He.fromJSON(e.type??e.curvatureType??0)}clone(){return new Ke({curvatureType:this.curvatureType,zFactor:this.zFactor,raster:this.raster})}};(0,i._)([(0,a.qq)({json:{write:{target:"type"}}}),(0,Wt.G)(He)],Xe.prototype,"curvatureType",void 0),(0,i._)([(0,de.E)("curvatureType",["type","curvatureType"])],Xe.prototype,"readCurvatureType",null),(0,i._)([(0,a.qq)({type:Number,json:{write:!0}})],Xe.prototype,"zFactor",void 0),Xe=Ke=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.CurvatureFunctionArguments")],Xe);const Je=Xe;let $e=class extends _{constructor(){super(...arguments),this.functionName="Curvature",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.bandCount=1,this._removeStatsHistColormapVAT(t),this.rasterInfo=t,this.isGCS=t.spatialReference?.isGeographic??!1,{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{zFactor:n,curvatureType:s}=this.functionArguments,{extent:r,primaryPixelSizes:o}=t,i=o?.[0],a=i??(r?{x:r.width/e.width,y:r.height/e.height}:{x:1,y:1}),u=this.isGCS&&n>=1?n*Et.m_:n;return(0,Et.uI)(e,{zFactor:u,curvatureType:s,resolution:a})}_getWebGLParameters(){const{zFactor:t,curvatureType:e}=this.functionArguments;return{curvatureType:e,zFactor:this.isGCS&&t>=1?t*Et.m_:t}}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],$e.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:Je,json:{write:!0,name:"rasterFunctionArguments"}})],$e.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],$e.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],$e.prototype,"isGCS",void 0),$e=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.CurvatureFunction")],$e);const Ye=$e;var Ze;let Qe=Ze=class extends h{constructor(){super(...arguments),this.bandIds=[],this.bandNames=[],this.bandWavelengths=[],this.missingBandAction=Jt.yO.bestMatch}clone(){return new Ze({bandIds:this.bandIds?.slice(),bandNames:this.bandNames?.slice(),bandWavelengths:this.bandWavelengths?.slice(),missingBandAction:this.missingBandAction,method:this.method,wavelengthMatchTolerance:this.wavelengthMatchTolerance})}};(0,i._)([(0,a.qq)({json:{write:!0}})],Qe.prototype,"bandIds",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],Qe.prototype,"bandNames",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],Qe.prototype,"bandWavelengths",void 0),(0,i._)([(0,Wt.G)({0:"name",1:"wavelength",2:"id"})],Qe.prototype,"method",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],Qe.prototype,"missingBandAction",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],Qe.prototype,"wavelengthMatchTolerance",void 0),Qe=Ze=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.ExtractBandFunctionArguments")],Qe);const tn=Qe;let en=class extends _{constructor(){super(...arguments),this.functionName="ExtractBand",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const{functionArguments:t,sourceRasterInfos:e}=this,n=e[0],{method:s,bandNames:r,bandWavelengths:o,bandIds:i,missingBandAction:a}=t,u=r?.length&&("name"===s||"id"!==s&&!i?.length),l=o?.length&&("wavelength"===s||"id"!==s&&!i?.length),c=a===Jt.yO.fail,p=u?this._matchBandNames(n,r):l?this._matchBandWavelengths(n,o,c):this._matchBandIds(n,i,c);if(null==p)return{success:!1,supportsGPU:!1,error:`extract-band-function: Invalid ${u?"band names":l?"band wavelengths":"band ids"} for the imagery data source`};this.functionArguments.bandIds=p,this.functionArguments.method="id",this.outputPixelType=this._getOutputPixelType("f32");const h=n.clone();h.pixelType=this.outputPixelType,h.bandCount=p.length;const{statistics:f,histograms:m}=h;null!=f&&f.length&&(h.statistics=p.map((t=>f[t]||f[f.length-1]))),null!=m&&m.length&&(h.histograms=p.map((t=>m[t]||m[m.length-1])));let d=h.keyProperties?.BandProperties;return d?.length&&(d=p.map((t=>t>=d.length?d[d.length-1]:d[t])),h.keyProperties={...h.keyProperties,BandProperties:d}),this.rasterInfo=h,{success:!0,supportsGPU:h.bandCount<=3}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const n=e.pixels.length,s=this.functionArguments.bandIds.map((t=>t>=n?n-1:t));return e.extractBands(s)}_getWebGLParameters(){let t;if(this.isInputBandIdsSwizzled)t=this.swizzledBandSelection.length?this.swizzledBandSelection:[0,1,2];else{t=[...this.functionArguments.bandIds],0===t.length?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:Zt(t)}}_getInputBandIds(t){const e=t.length;return this.functionArguments.bandIds.map((t=>t>=e?e-1:t)).map((e=>t[e]))}_matchBandNames(t,e){const n=t.bandInfos.map((({name:t})=>t.toLowerCase())),s=[];for(let t=0;t<e.length;t++){const r=e[t].toLowerCase();let o=n.indexOf(r);if(-1===o&&"nearinfrared"===r&&(o=n.findIndex((t=>t.startsWith("nearinfrared_1"))),-1===o&&(o=n.findIndex((t=>t.startsWith("nearinfrared"))))),-1===o)return null;s.push(o)}return s}_matchBandIds(t,e,n){const{bandCount:s}=t;return!e?.length||n&&e.some((t=>t<0||t>=s))?null:e}_matchBandWavelengths(t,e,n){const{bandInfos:s}=t,r=[];for(let t=0;t<s.length;t++){const{minWavelength:e,maxWavelength:n}=s[t];if(!e||!n)return null;r.push({minWavelength:e,maxWavelength:n})}const{wavelengthMatchTolerance:o}=this.functionArguments,i=[];for(let t=0;t<e.length;t++){const s=e[t];let a=!1,u=-1,l=Number.MAX_VALUE;for(let t=0;t<r.length;t++){const e=r[t],n=s>=e.minWavelength&&s<=e.maxWavelength,o=Math.abs(s-(e.minWavelength+e.maxWavelength)/2);n?o<l&&(a=!0,u=t,l=o):!a&&o<l&&(u=t,l=o)}if(!a&&o&&l<o&&(a=!0),!a&&n)return null;i.push(u)}return i}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],en.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:tn,json:{write:!0,name:"rasterFunctionArguments"}})],en.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],en.prototype,"rasterArgumentNames",void 0),en=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.ExtractBandFunction")],en);const nn=en;var sn;let rn=sn=class extends h{clone(){return new sn({conversionParameters:[...this.conversionParameters],raster:this.raster})}};(0,i._)([(0,a.qq)({type:[Number],json:{write:!0}})],rn.prototype,"conversionParameters",void 0),rn=sn=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.GrayscaleFunctionArguments")],rn);const on=rn;let an=class extends _{constructor(){super(...arguments),this.functionName="Grayscale",this.functionArguments=null,this.rasterArgumentNames=["raster"]}get _normalizedWeights(){const{conversionParameters:t}=this.functionArguments,e=t.reduce(((t,e)=>t+e));return t.map((t=>t/e))}_bindSourceRasters(){const{conversionParameters:t}=this.functionArguments;if(!t?.length)return{success:!1,supportsGPU:!1,error:"missing valid conversion parameters."};const e=this.sourceRasterInfos[0].clone();this.outputPixelType=this._getOutputPixelType(e.pixelType),e.pixelType=this.outputPixelType;const n=3===t.length||3===e.bandCount&&t.length>3;return e.bandCount=1,this._removeStatsHistColormapVAT(e),this.rasterInfo=e,{success:!0,supportsGPU:n}}_processPixels(t){const e=t.pixelBlocks?.[0];return null==e?null:function(t,e,n){const{pixels:s,width:r,height:o,mask:i,bandMasks:a}=t,u=r*o,c=a?.length?y.c.combineBandMasks(a):i,p=Math.min(e.length,s.length),h=n.startsWith("f"),f=!h&&n!==t.pixelType,[m,d]=(0,l.mO)(n),g=y.c.createEmptyBand(n,u);for(let t=0;t<o;t++){let n=t*r;for(let t=0;t<r;t++,n++)if(!c||c[n]){let t=0;for(let r=0;r<p;r++)t+=e[r]*s[r][n];h||(t=Math.round(t),f&&(t=t>d?d:t<m?m:t)),g[n]=t}}const x=new y.c({width:r,height:o,pixels:[g],pixelType:n,mask:c});return x.updateStatistics(),x}(e,this._normalizedWeights,this.outputPixelType)}_getWebGLParameters(){return{weights:this._normalizedWeights}}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],an.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:on,json:{write:!0,name:"rasterFunctionArguments"}})],an.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],an.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.qq)()],an.prototype,"_normalizedWeights",null),an=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.GrayscaleFunction")],an);const un=an;var ln;let cn=ln=class extends h{constructor(){super(...arguments),this.rasters=[],this.processAsMultiband=!0}writeRasters(t,e){e.rasters=t.map((t=>"number"==typeof t||"string"==typeof t?t:t.toJSON()))}clone(){return new ln({operation:this.operation,processAsMultiband:this.processAsMultiband,rasters:(0,o.ct)(this.rasters)})}};(0,i._)([(0,a.qq)({json:{write:!0}})],cn.prototype,"operation",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],cn.prototype,"rasters",void 0),(0,i._)([(0,Te.G)("rasters")],cn.prototype,"writeRasters",null),(0,i._)([(0,a.qq)({json:{write:!0}})],cn.prototype,"processAsMultiband",void 0),cn=ln=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.LocalFunctionArguments")],cn);const pn=cn;let hn=class extends _{constructor(){super(...arguments),this.functionName="Local",this.functionArguments=null,this.rasterArgumentNames=["rasters"]}_bindSourceRasters(){const{sourceRasterInfos:t}=this,e=t[0],{bandCount:n}=e,{processAsMultiband:s}=this.functionArguments;if(t.some((t=>t.bandCount!==n)))return{success:!1,supportsGPU:!1,error:"local-function: input rasters do not have same band count"};const{operation:r,rasters:o}=this.functionArguments,i=F[r];if(!(999===i||o.length===i||o.length<=1&&1===i))return{success:!1,supportsGPU:!1,error:`local-function: the length of functionArguments.rasters does not match operation's requirement: ${i}`};const a=e.clone();return a.bandCount=999!==i||s?n:1,this._removeStatsHistColormapVAT(a),this._updateStatistics(a),this._updatePixelType(a),this.rasterInfo=a,{success:!0,supportsGPU:1===a.bandCount&&i<=3&&(r<11||r>16)}}_processPixels(t){const{pixelBlocks:e}=t;return null==e||e.some((t=>null==t))?null:St(e,this.functionArguments.operation,{processAsMultiband:this.functionArguments.processAsMultiband,outputPixelType:this.outputPixelType??void 0})}_getWebGLParameters(){const{operation:t}=this.functionArguments,e=F[t],n=Object.keys(T).find((e=>T[e]===t))?.toLowerCase()??"undefined",s=this.outputPixelType??"f32";let[r,o]=(0,l.mO)(s);const i=(0,l.sZ)(s);return i&&(r-=1e-4,o+=1e-4),{imageCount:e,operationName:n,domainRange:[r,o],isOutputRounded:i}}_updateStatistics(t){const e=this.sourceRasterInfos[0],{operation:n}=this.functionArguments,s=R(n)?.domain;if(s){t.statistics=[];for(let e=0;e<t.bandCount;e++)t.statistics[e]={min:s[0],max:s[1],avg:(s[0]+s[1])/2,stddev:(s[0]+s[1])/10}}else 45===n&&e.statistics?.length&&(t.statistics=e.statistics.map((t=>({min:-t.max,max:-t.min,avg:null!=t.avg?-t.avg:void 0,stddev:null!=t.stddev?-t.stddev:void 0}))))}_updatePixelType(t){const{statistics:e,pixelType:n}=this.sourceRasterInfos[0],{operation:s}=this.functionArguments,{domain:r,isInteger:o}=R(s)??{domain:null,isInteger:!1};let i="f32";if(r&&o)i=(0,l.E1)(r[0],r[1]);else if(30===s){const t=e?.[0];i=t?(0,l.E1)(t.min,t.max):(0,l.sZ)(n)?n:"s32"}else if(45===s&&(0,l.sZ)(n)){const t=e?.map((({max:t})=>-t)),s=e?.map((({min:t})=>-t)),r=t?.length?Math.min(...t):null,o=s?.length?Math.min(...s):null;i=null!=r&&null!=o?(0,l.E1)(r,o):n.startsWith("s")?n.replace("s","u"):"u1"===n||"u2"===n||"u4"===n?"s8":"u8"===n?"s16":"s32"}t.pixelType=this.outputPixelType=this._getOutputPixelType(i)}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],hn.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:pn,json:{write:!0,name:"rasterFunctionArguments"}})],hn.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],hn.prototype,"rasterArgumentNames",void 0),hn=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.LocalFunction")],hn);const fn=hn;var mn,dn=n(53648);let gn=mn=class extends h{constructor(){super(...arguments),this.includedRanges=null,this.noDataValues=null,this.noDataInterpretation=Jt.yv.matchAny}get normalizedNoDataValues(){const{noDataValues:t}=this;if(!t?.length)return null;let e=!1;const n=t.map((t=>{if("number"==typeof t)return e=!0,[t];if("string"==typeof t){const n=t.trim().split(" ").filter((t=>""!==t.trim())).map((t=>Number(t)));return e=e||n.length>0,0===n.length?null:n}return null}));return e?n:null}clone(){return new mn({includedRanges:this.includedRanges?.slice()??[],noDataValues:this.noDataValues?.slice()??[],noDataInterpretation:this.noDataInterpretation})}};(0,i._)([(0,a.qq)({json:{write:!0}})],gn.prototype,"includedRanges",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],gn.prototype,"noDataValues",void 0),(0,i._)([(0,a.qq)()],gn.prototype,"normalizedNoDataValues",null),(0,i._)([(0,a.qq)({json:{write:!0}})],gn.prototype,"noDataInterpretation",void 0),gn=mn=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.MaskFunctionArguments")],gn);const yn=gn;let xn=class extends _{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:n,normalizedNoDataValues:s}=this.functionArguments;if(!n?.length&&!s?.length)return{success:!1,supportsGPU:!1,error:"missing includedRanges or noDataValues argument"};let r=[];for(let o=0;o<t.bandCount;o++){const t=(0,Jt.K6)(e,n?.slice(2*o,2*o+2),s?.[o]);if(null==t){r=null;break}r.push(t)}this.lookups=r;const o=null!=s&&s.every((t=>t?.length===s[0]?.length));return{success:!0,supportsGPU:(!n||n.length<=2*Jt.WK)&&(!s||o&&s[0].length<=Jt.WK)}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{outputPixelType:n,lookups:s}=this,{includedRanges:r,noDataInterpretation:o,normalizedNoDataValues:i}=this.functionArguments,a=o===Jt.yv.matchAll;return(0,Jt.w7)(e,{includedRanges:r,noDataValues:i,outputPixelType:n,matchAll:a,lookups:s})}_getWebGLParameters(){const{includedRanges:t,normalizedNoDataValues:e}=this.functionArguments,n=new Float32Array(Jt.WK);n.fill(dn.SE),e?.[0]?.length&&n.set(e[0]);const s=new Float32Array(Jt.WK);for(let e=0;e<s.length;e+=2)s[e]=t?.[e]??-dn.SE,s[e+1]=t?.[e+1]??dn.SE;return t&&t.length&&s.set(t),{bandCount:this.sourceRasterInfos[0].bandCount,noDataValues:n,includedRanges:s}}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],xn.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:yn,json:{write:!0,name:"rasterFunctionArguments"}})],xn.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],xn.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],xn.prototype,"lookups",void 0),xn=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.MaskFunction")],xn);const wn=xn;var vn;let _n=vn=class extends h{constructor(){super(...arguments),this.visibleBandID=0,this.infraredBandID=1,this.scientificOutput=!1}clone(){const{visibleBandID:t,infraredBandID:e,scientificOutput:n}=this;return new vn({visibleBandID:t,infraredBandID:e,scientificOutput:n})}};(0,i._)([(0,a.qq)({json:{write:!0}})],_n.prototype,"visibleBandID",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],_n.prototype,"infraredBandID",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],_n.prototype,"scientificOutput",void 0),_n=vn=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.NDVIFunctionArguments")],_n);const bn=_n;let An=class extends _{constructor(){super(...arguments),this.functionName="NDVI",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const{scientificOutput:t,visibleBandID:e,infraredBandID:n}=this.functionArguments;this.outputPixelType=this._getOutputPixelType(t?"f32":"u8");const s=this.sourceRasterInfos[0],r=Math.max(e,n);if(s.bandCount<2||r>=s.bandCount)return{success:!1,supportsGPU:!1,error:"ndvi-function: source raster has insufficient amount of raster bands"};const o=s.clone();o.pixelType=this.outputPixelType,o.colormap=null,o.histograms=null,o.bandCount=1,o.keyProperties={...o.keyProperties,BandProperties:void 0};const[i,a,u,l]=t?[-1,1,0,.1]:[0,200,100,10];return o.statistics=[{min:i,max:a,avg:u,stddev:l}],this.rasterInfo=o,{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{visibleBandID:n,infraredBandID:s,scientificOutput:r}=this.functionArguments;return function(t,e,n,s){const{mask:r,pixels:o,width:i,height:a}=t,u=o[n],l=o[e],c=l.length,p=s?new Uint8Array(c):new Float32Array(c),h=s?100:1,f=s?100.5:0;for(let t=0;t<c;t++)if(null==r||r[t]){const e=u[t],n=l[t],s=e+n;s&&(p[t]=(e-n)/s*h+f)}const m=new y.c({width:i,height:a,mask:r,pixelType:s?"u8":"f32",pixels:[p]});return m.updateStatistics(),m}(e,n,s,!r)}_getWebGLParameters(){const{visibleBandID:t,infraredBandID:e,scientificOutput:n}=this.functionArguments;return{bandIndexMat3:Zt(this.isInputBandIdsSwizzled?[0,1,2]:[e,t,0]),scaled:!n}}_getInputBandIds(t){const{visibleBandID:e,infraredBandID:n}=this.functionArguments;return[n,e,0].map((e=>t[e]))}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],An.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:bn,json:{write:!0,name:"rasterFunctionArguments"}})],An.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],An.prototype,"rasterArgumentNames",void 0),An=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.NDVIFunction")],An);const qn=An;var Pn;let Tn=Pn=class extends h{constructor(){super(...arguments),this.inputRanges=null,this.outputValues=null,this.noDataRanges=null,this.allowUnmatched=!1,this.isLastInputRangeInclusive=!1}clone(){return new Pn({inputRanges:[...this.inputRanges],outputValues:[...this.outputValues],noDataRanges:[...this.noDataRanges],allowUnmatched:this.allowUnmatched,isLastInputRangeInclusive:this.isLastInputRangeInclusive})}};(0,i._)([(0,a.qq)({json:{write:!0}})],Tn.prototype,"inputRanges",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],Tn.prototype,"outputValues",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],Tn.prototype,"noDataRanges",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],Tn.prototype,"allowUnmatched",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],Tn.prototype,"isLastInputRangeInclusive",void 0),Tn=Pn=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.RemapFunctionArguments")],Tn);const Nn=Tn;let Rn=class extends _{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:n}=t,{allowUnmatched:s,outputValues:r,inputRanges:o,noDataRanges:i,isLastInputRangeInclusive:a}=this.functionArguments;if(null!=n&&n.length&&r?.length)if(s){const e=Math.min.apply(null,[...r,n[0].min]),s=Math.max.apply(null,[...r,n[0].max]);t.statistics=[{...n[0],min:e,max:s}]}else{let e=r[0],s=e;for(let t=0;t<r.length;t++)e=e>r[t]?r[t]:e,s=s>r[t]?s:r[t];t.statistics=[{...n[0],min:e,max:s}]}return this.rasterInfo=t,this.lookup=s?null:(0,Jt.Ap)({srcPixelType:e,inputRanges:o,outputValues:r,noDataRanges:i,allowUnmatched:s,isLastInputRangeInclusive:a,outputPixelType:this.outputPixelType}),{success:!0,supportsGPU:(!r||r.length<=Jt.WK)&&(!i||i.length<=Jt.WK)}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{lookup:n,outputPixelType:s}=this;if(n){const t=(0,Jt.sP)(e,{lut:[n.lut],offset:n.offset,outputPixelType:s});return null!=t&&n.mask&&(t.mask=(0,Jt.op)(e.pixels[0],e.mask,n.mask,n.offset,"u8")),t}const{inputRanges:r,outputValues:o,noDataRanges:i,allowUnmatched:a,isLastInputRangeInclusive:u}=this.functionArguments;return(0,Jt.U9)(e,{inputRanges:r,outputValues:o,noDataRanges:i,outputPixelType:s,allowUnmatched:a,isLastInputRangeInclusive:u})}_getWebGLParameters(){const{allowUnmatched:t,noDataRanges:e,isLastInputRangeInclusive:n}=this.functionArguments,s=new Float32Array(3*Jt.WK),r=1e-5,o=this.functionArguments.inputRanges??[],i=this.functionArguments.outputValues??[],a=i.length;for(let t=0;t<Jt.WK;t++)s[3*t]=o[2*t]??dn.SE-1,s[3*t+1]=o[2*t+1]??dn.SE,s[3*t+2]=i[t]??0,t<a&&(t>0&&(s[3*t]-=r),(t<a-1||!n)&&(s[3*t+1]-=r));const u=new Float32Array(2*Jt.WK);return u.fill(dn.SE),e?.length&&u.set(e),{allowUnmatched:t,rangeMaps:s,noDataRanges:u,clampRange:(0,l.mO)(this.outputPixelType)}}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],Rn.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:Nn,json:{write:!0,name:"rasterFunctionArguments"}})],Rn.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],Rn.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],Rn.prototype,"lookup",void 0),Rn=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.RemapFunction")],Rn);const Fn=Rn;var In;const kn=new Lt.O({1:"degree",2:"percent-rise",3:"adjusted"},{useNumericKeys:!0});let Cn=In=class extends h{constructor(){super(...arguments),this.slopeType="degree",this.zFactor=1,this.pixelSizePower=.664,this.pixelSizeFactor=.024,this.removeEdgeEffect=!1}clone(){return new In({slopeType:this.slopeType,zFactor:this.zFactor,pixelSizePower:this.pixelSizePower,pixelSizeFactor:this.pixelSizeFactor,removeEdgeEffect:this.removeEdgeEffect,raster:this.raster})}};(0,i._)([(0,Wt.G)(kn)],Cn.prototype,"slopeType",void 0),(0,i._)([(0,a.qq)({type:Number,json:{write:!0}})],Cn.prototype,"zFactor",void 0),(0,i._)([(0,a.qq)({type:Number,json:{name:"psPower",write:!0}})],Cn.prototype,"pixelSizePower",void 0),(0,i._)([(0,a.qq)({type:Number,json:{name:"psZFactor",write:!0}})],Cn.prototype,"pixelSizeFactor",void 0),(0,i._)([(0,a.qq)({type:Boolean,json:{write:!0}})],Cn.prototype,"removeEdgeEffect",void 0),Cn=In=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.SlopeFunctionArguments")],Cn);const Sn=Cn;let Mn=class extends _{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="percent-rise"!==this.functionArguments.slopeType?[{min:0,max:90,avg:1,stddev:1}]:null,t.histograms=null,t.colormap=null,t.attributeTable=null,t.bandCount=1,this.rasterInfo=t,this.isGCS=t.spatialReference?.isGeographic??!1,{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{zFactor:n,slopeType:s,pixelSizePower:r,pixelSizeFactor:o}=this.functionArguments,{isGCS:i}=this,{extent:a,primaryPixelSizes:u}=t,l=u?.[0],c=l??(a?{x:a.width/e.width,y:a.height/e.height}:{x:1,y:1});return(0,Et.uA)(e,{zFactor:n,slopeType:s,pixelSizePower:r,pixelSizeFactor:o,isGCS:i,resolution:c})}_getWebGLParameters(){const{zFactor:t,slopeType:e,pixelSizeFactor:n,pixelSizePower:s}=this.functionArguments;return{zFactor:this.isGCS&&t>=1?t*Et.m_:t,slopeType:e,pixelSizeFactor:n??0,pixelSizePower:s??0}}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],Mn.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:Sn,json:{write:!0,name:"rasterFunctionArguments"}})],Mn.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],Mn.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],Mn.prototype,"isGCS",void 0),Mn=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.SlopeFunction")],Mn);const jn=Mn,Bn=new Lt.O({1:"min",2:"max",3:"mean",4:"stddev",5:"median",6:"majority",7:"minority"},{useNumericKeys:!0});function Gn(t,e){const{fillNoDataOnly:n}=e,{band:s,width:r,height:o,mask:i,outBand:a}=t;if(n&&!i)return void a.set(s);const{statisticsType:u,kernelRows:l,kernelCols:c}=e,p="stddev"===u,h=r*o,f=new Float64Array(h),m=new Float64Array(h),d=new Uint32Array(h);for(let t=0;t<o;t++){const e=t*r;let n=0,o=0,a=0;for(let t=0;t<c;t++)i&&!i[e+t]||(n+=s[e+t],p&&(o+=s[e+t]**2),a++);f[e]=n,m[e]=o,d[e]=a;for(let t=1;t<=r-c;t++){const r=e+t-1,u=r+c;i?(i[r]&&(a--,n-=s[r],p&&(o-=s[r]**2)),i[u]&&(a++,n+=s[u],p&&(o+=s[u]**2))):(n-=s[r],n+=s[u],p&&(o-=s[r]**2,o+=s[u]**2)),f[e+t]=n,d[e+t]=a,p&&(m[e+t]=o)}}const g=new Float64Array(h),y=new Float64Array(h),x=new Uint32Array(h),w=l*r;for(let t=0;t<=r-c;t++){let e=0,n=0,s=0;for(let o=0;o<l;o++){const i=o*r+t;e+=f[i],s+=d[i],p&&(n+=m[i])}g[t]=e,y[t]=n,x[t]=s;for(let i=1;i<=o-l;i++){const o=(i-1)*r+t,a=o+w;e-=f[o],e+=f[a],s-=d[o],s+=d[a],p&&(n-=m[o],n+=m[a]),g[i*r+t]=e,y[i*r+t]=n,x[i*r+t]=s}}const v=Math.floor(l/2),_=Math.floor(c/2);for(let t=v;t<o-v;t++){const e=t*r;for(let s=_;s<r-_;s++){const o=(t-v)*r+s-_,u=x[o];if(0===u||n&&(!i||i[e+s]))continue;const l=g[o]/u,c=p?Math.sqrt((y[o]-g[o]*l)/u):l;a[e+s]=c,i&&(i[e+s]=255)}}}function On(t,e){const{fillNoDataOnly:n}=e,{band:s,width:r,height:o,mask:i,outBand:a}=t;if(n&&!i)return void a.set(s);const{kernelRows:u,kernelCols:l,statisticsType:c}=e,p=Math.floor(u/2),h=Math.floor(l/2),f="min"===c,m=a.slice(),d=new Uint32Array(r*o);for(let t=p;t<o-p;t++){const e=t*r;for(let t=h;t<r-h;t++){let n=f?Number.MAX_VALUE:-Number.MAX_VALUE,o=0;for(let a=0;a<u;a++)for(let u=0;u<l;u++){const l=e+t+(a-p)*r+u-h;i&&!i[l]||(n=f?Math.min(n,s[l]):Math.max(n,s[l]),o++)}i?(m[e+t]=0===o?0:n,d[e+t]=o):a[e+t]=0===o?0:n}}if(i)for(let t=p;t<o-p;t++){const e=t*r;for(let t=h;t<r-h;t++)if(d[e+t]){if(n&&i[e+t])continue;a[e+t]=m[e+t],i[e+t]=255}}}function En(t,e){const{fillNoDataOnly:n}=e,{band:s,width:r,height:o,mask:i,outBand:a}=t;if(n&&!i)return void a.set(s);const{kernelRows:u,kernelCols:l}=e,c=Math.floor(u/2),p=Math.floor(l/2),h=a.slice(),f=new Uint32Array(r*o);for(let t=c;t<o-c;t++){const e=t*r;for(let t=p;t<r-p;t++){if(n&&i&&i[e+t])continue;const o=[];for(let n=0;n<u;n++)for(let a=0;a<l;a++){const u=e+t+(n-c)*r+a-p;i&&!i[u]||o.push(s[u])}o.length&&(o.sort(((t,e)=>t-e)),i?(h[e+t]=o[Math.floor((o.length-1)/2)],f[e+t]=o.length):a[e+t]=o[Math.floor((o.length-1)/2)])}}if(i)for(let t=c;t<o-c;t++){const e=t*r;for(let t=p;t<r-p;t++)if(f[e+t]){if(n&&i[e+t])continue;a[e+t]=h[e+t],i[e+t]=255}}}function Dn(t,e){const{fillNoDataOnly:n}=e,{band:s,width:r,height:o,mask:i,outBand:a}=t;if(n&&!i)return void a.set(s);const{kernelRows:u,kernelCols:l}=e,c=Math.floor(u/2),p=Math.floor(l/2),h="majority"===e.statisticsType,f=u*l,m=a.slice(),d=new Uint32Array(r*o);for(let t=c;t<o-c;t++){const e=t*r;for(let t=p;t<r-p;t++){if(n&&i&&i[e+t])continue;const o=new Map;for(let n=0;n<u;n++)for(let a=0;a<l;a++){const u=e+t+(n-c)*r+a-p;if(i&&!i[u])continue;const l=s[u];o.set(l,o.has(l)?o.get(l)+1:1)}if(0===o.size)continue;let g=0,y=0,x=h?0:f+1;for(const t of o.keys())y=o.get(t),h===y>x&&(x=y,g=t);i?(m[e+t]=g,d[e+t]=o.size):a[e+t]=g}}if(i)for(let t=c;t<o-c;t++){const e=t*r;for(let t=p;t<r-p;t++)if(d[e+t]){if(n&&i[e+t])continue;a[e+t]=m[e+t],i[e+t]=255}}}var zn;let Wn=zn=class extends h{constructor(){super(...arguments),this.rows=3,this.cols=3,this.fillNoDataOnly=!1,this.statisticsType="min"}clone(){return new zn({rows:this.rows,cols:this.cols,fillNoDataOnly:this.fillNoDataOnly,statisticsType:this.statisticsType,raster:(0,o.ct)(this.raster)})}};(0,i._)([(0,a.qq)({json:{write:!0,read:{source:["kernelRows","rows"],reader:(t,e)=>Number(t??e?.kernelRows??3)}}})],Wn.prototype,"rows",void 0),(0,i._)([(0,a.qq)({json:{write:!0,read:{source:["kernelCols","cols"],reader:(t,e)=>Number(t??e?.kernelCols??3)}}})],Wn.prototype,"cols",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],Wn.prototype,"fillNoDataOnly",void 0),(0,i._)([(0,a.qq)({json:{read:{source:["statisticsType","type"],reader:(t,e)=>Bn.fromJSON(e?.statisticsType??e?.type)??"min"},write:{target:"type"}}}),(0,Wt.G)(Bn)],Wn.prototype,"statisticsType",void 0),Wn=zn=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.StatisticsFunctionArguments")],Wn);const Ln=Wn;let Un=class extends _{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 n=e.clone();n.pixelType=this.outputPixelType;const{statisticsType:s}=this.functionArguments;return"stddev"===s&&this._removeStatsHistColormapVAT(n),this.rasterInfo=n,{success:!0,supportsGPU:n.bandCount<=3&&t<5}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return e;const{statisticsType:n,rows:s,cols:r,fillNoDataOnly:o}=this.functionArguments;return function(t,e){const{mask:n}=t,{fillNoDataOnly:s}=e;if(s&&!n)return t;const{pixels:r,width:o,height:i,bandMasks:a,pixelType:u}=t,l=r.length,c=o*i,p=[],{kernelRows:h,kernelCols:f,statisticsType:m,mirrorEdges:d}=e;if(s&&!n)return t;const g=e.outputPixelType??u,x=[];for(let t=0;t<l;t++){const u=r[t],l=y.c.createEmptyBand(g,c);s&&l.set(u);const w=a?.[t]??n,v=w?.slice()??null,_={band:u,width:o,height:i,mask:v,outBand:l};switch(m){case"min":case"max":On(_,e);break;case"mean":case"stddev":Gn(_,e);break;case"median":En(_,e);break;case"majority":case"minority":Dn(_,e)}d&&!s&&Ge(l,o,i,h,f),p.push(l),v&&x.push(v)}let w=x[0]??n;x.length!==l&&(x.length=0),l>1&&a?.length&&(w=y.c.combineBandMasks(a));const v=new y.c({pixelType:g,width:o,height:i,pixels:p,bandMasks:a&&x.length?x:null,mask:w});return v.updateStatistics(),v}(e,{kernelRows:s,kernelCols:r,fillNoDataOnly:o,outputPixelType:this.outputPixelType,statisticsType:n,mirrorEdges:!0})}_getWebGLParameters(){const{rows:t,cols:e,statisticsType:n,fillNoDataOnly:s}=this.functionArguments;return{fillNoDataOnly:s,kernelRows:t,kernelCols:e,statisticsType:n,clampRange:(0,l.mO)(this.outputPixelType)}}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],Un.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:Ln,json:{write:!0,name:"rasterFunctionArguments"}})],Un.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],Un.prototype,"rasterArgumentNames",void 0),Un=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.StatisticsFunction")],Un);const Vn=Un;var Kn;let Hn=Kn=class extends h{constructor(){super(...arguments),this.statistics=null,this.histograms=null}readStatistics(t,e){if(!t?.length)return null;const n=[];return t.forEach((t=>{const e={min:t.min,max:t.max,avg:t.avg??t.mean,stddev:t.stddev??t.standardDeviation};n.push(e)})),n}writeStatistics(t,e,n){if(!t?.length)return;const s=[];t.forEach((t=>{const e={...t,mean:t.avg,standardDeviation:t.stddev};delete e.avg,delete e.stddev,s.push(e)})),e[n]=s}clone(){return new Kn({statistics:(0,o.ct)(this.statistics),histograms:(0,o.ct)(this.histograms)})}};(0,i._)([(0,a.qq)({json:{write:!0}})],Hn.prototype,"statistics",void 0),(0,i._)([(0,de.E)("statistics")],Hn.prototype,"readStatistics",null),(0,i._)([(0,Te.G)("statistics")],Hn.prototype,"writeStatistics",null),(0,i._)([(0,a.qq)({json:{write:!0}})],Hn.prototype,"histograms",void 0),Hn=Kn=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.StatisticsHistogramFunctionArguments")],Hn);const Xn=Hn;let Jn=class extends _{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:n,histograms:s}=this.functionArguments;return s&&(e.histograms=s),n&&(e.statistics=n),this.rasterInfo=e,{success:!0,supportsGPU:!0}}_processPixels(t){return t.pixelBlocks?.[0]}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],Jn.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:Xn,json:{write:!0,name:"rasterFunctionArguments"}})],Jn.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],Jn.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],Jn.prototype,"indexedColormap",void 0),(0,i._)([(0,a.qq)()],Jn.prototype,"isNoopProcess",void 0),Jn=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.StatisticsHistogramFunction")],Jn);const $n=Jn;var Yn;const Zn=new Lt.O({0:"none",3:"standard-deviation",4:"histogram-equalization",5:"min-max",6:"percent-clip",9:"sigmoid"},{useNumericKeys:!0});let Qn=Yn=class extends h{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,e,n){t?.length&&(Array.isArray(t[0])||(t=t.map((t=>[t.min,t.max,t.avg,t.stddev]))),e[n]=t)}clone(){return new Yn({stretchType:this.stretchType,outputMin:this.outputMin,outputMax:this.outputMax,useGamma:this.useGamma,computeGamma:this.computeGamma,statistics:(0,o.ct)(this.statistics),gamma:(0,o.ct)(this.gamma),sigmoidStrengthLevel:this.sigmoidStrengthLevel,numberOfStandardDeviations:this.numberOfStandardDeviations,minPercent:this.minPercent,maxPercent:this.maxPercent,histograms:(0,o.ct)(this.histograms),dynamicRangeAdjustment:this.dynamicRangeAdjustment,raster:this.raster})}};(0,i._)([(0,a.qq)({type:Boolean,json:{write:!0}})],Qn.prototype,"computeGamma",void 0),(0,i._)([(0,a.qq)({type:Boolean,json:{name:"dra",write:!0}})],Qn.prototype,"dynamicRangeAdjustment",void 0),(0,i._)([(0,a.qq)({type:[Number],json:{write:!0}})],Qn.prototype,"gamma",void 0),(0,i._)([(0,a.qq)()],Qn.prototype,"histograms",void 0),(0,i._)([(0,a.qq)({type:Number,json:{write:!0}})],Qn.prototype,"maxPercent",void 0),(0,i._)([(0,a.qq)({type:Number,json:{write:!0}})],Qn.prototype,"minPercent",void 0),(0,i._)([(0,a.qq)({type:Number,json:{write:!0}})],Qn.prototype,"numberOfStandardDeviations",void 0),(0,i._)([(0,a.qq)({type:Number,json:{name:"max",write:!0}})],Qn.prototype,"outputMax",void 0),(0,i._)([(0,a.qq)({type:Number,json:{name:"min",write:!0}})],Qn.prototype,"outputMin",void 0),(0,i._)([(0,a.qq)({type:Number,json:{write:!0}})],Qn.prototype,"sigmoidStrengthLevel",void 0),(0,i._)([(0,a.qq)({json:{type:[[Number]],write:!0}})],Qn.prototype,"statistics",void 0),(0,i._)([(0,Te.G)("statistics")],Qn.prototype,"writeStatistics",null),(0,i._)([(0,Wt.G)(Zn)],Qn.prototype,"stretchType",void 0),(0,i._)([(0,a.qq)({type:Boolean,json:{write:!0}})],Qn.prototype,"useGamma",void 0),Qn=Yn=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.StretchFunctionArguments")],Qn);const ts=Qn;let es=class extends _{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:n}=this,{dynamicRangeAdjustment:s,gamma:r,useGamma:o}=n;if(!s&&["u8","u16","s8","s16"].includes(e)){const s=(0,Me.A1)(n.toJSON(),{rasterInfo:t}),i=(0,l.sZ)(this.outputPixelType)?"round":"float";this.lookup=(0,Me.iY)({pixelType:e,...s,gamma:o?r:null,rounding:i}),this.cutOffs=s}else s||(this.cutOffs=(0,Me.A1)(n.toJSON(),{rasterInfo:t}));this.outputPixelType=this._getOutputPixelType(e);const i=t.clone();return i.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(i),"u8"===this.outputPixelType&&(i.keyProperties.DataType="processed"),this.rasterInfo=i,{success:!0,supportsGPU:!s}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return e;const{lookup:n}=this;if(n)return(0,Jt.sP)(e,{...n,outputPixelType:this.rasterInfo.pixelType});const{functionArguments:s}=this,r=this.cutOffs||(0,Me.A1)(s.toJSON(),{rasterInfo:this.sourceRasterInfos[0],pixelBlock:e}),o=s.useGamma?s.gamma:null;return(0,Me.MR)(e,{...r,gamma:o,outputPixelType:this.outputPixelType})}_getWebGLParameters(){const{outputMin:t=0,outputMax:e=255,gamma:n,useGamma:s}=this.functionArguments,r=this.rasterInfo.bandCount>=2?3:1,o=s&&n?.length?(0,Me.WO)(r,n):[1,1,1],{minCutOff:i,maxCutOff:a}=this.cutOffs??{minCutOff:[0,0,0],maxCutOff:[255,255,255]};1===i.length&&(i[1]=i[2]=i[0],a[1]=a[2]=a[0]);const u=new Float32Array(r);let c;for(c=0;c<r;c++)u[c]=(e-t)/(a[c]-i[c]);const p=(0,l.sZ)(this.outputPixelType);return{bandCount:r,outMin:t,outMax:e,minCutOff:i,maxCutOff:a,factor:u,useGamma:s,gamma:s&&n?n:[1,1,1],gammaCorrection:s&&o?o:[1,1,1],stretchType:this.functionArguments.stretchType,isOutputRounded:p,type:"stretch"}}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],es.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:ts,json:{write:!0,name:"rasterFunctionArguments"}})],es.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],es.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],es.prototype,"lookup",void 0),(0,i._)([(0,a.qq)({json:{write:!0}})],es.prototype,"cutOffs",void 0),es=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.StretchFunction")],es);const ns=es;var ss;let rs=ss=class extends h{constructor(){super(...arguments),this.attributeTableAsRecordSet=null}clone(){return new ss({attributeTableAsRecordSet:(0,o.ct)(this.attributeTableAsRecordSet)})}};(0,i._)([(0,a.qq)({json:{write:!0}})],rs.prototype,"attributeTableAsRecordSet",void 0),rs=ss=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.TableFunctionArguments")],rs);const os=rs;let is=class extends _{constructor(){super(...arguments),this.functionName="Table",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isNoopProcess=!0}_bindSourceRasters(){const t=this.sourceRasterInfos[0];if(t.bandCount>1||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 n=t.clone();return n.pixelType=this.outputPixelType,n.bandCount=1,"thematic"!==n.dataType&&(n.keyProperties=n.keyProperties?{...n.keyProperties,DataType:"thematic"}:{DataType:"thematic"}),this.rasterInfo=n,{success:!0,supportsGPU:!0}}_processPixels(t){return t.pixelBlocks?.[0]}};(0,i._)([(0,a.qq)({json:{write:!0,name:"rasterFunction"}})],is.prototype,"functionName",void 0),(0,i._)([(0,a.qq)({type:os,json:{write:!0,name:"rasterFunctionArguments"}})],is.prototype,"functionArguments",void 0),(0,i._)([(0,a.qq)()],is.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.qq)()],is.prototype,"isNoopProcess",void 0),is=(0,i._)([(0,u.c)("esri.layers.support.rasterFunctions.TableFunction")],is);const as=is,us=new Map;function ls(t,e){const{rasterFunctionArguments:n}=t;n&&(n.rasters||[n.raster]).forEach((t=>{t&&"number"!=typeof t&&("string"==typeof t?t.startsWith("http")&&(e.includes(t)||e.push(t)):"rasterFunctionArguments"in t&&ls(t,e))}))}function cs(t,e){if(e=e??{},"function"in(t=(0,o.ct)(t))&&"arguments"in t&&t.arguments){const n=ys(t,new Map,e);if(ws(n),!n.renderingRule)throw new r.c("raster-function-helper","Unsupported raster function json.");t=n.renderingRule}if("rasterFunction"in t)return fs(t=hs(t),e);throw new r.c("raster-function-helper","unsupported raster function json.")}function ps(t){return!!(t&&"object"==typeof t&&t.rasterFunction&&t.rasterFunctionArguments)}function hs(t){const{rasterFunction:e,rasterFunctionArguments:n}=t,s={};for(const t in n){let e=n[t];const r=t.toLowerCase();if("rasters"===r&&Array.isArray(e))s.rasters=e.map((t=>ps(t)?hs(t):t));else switch(ps(e)&&(e=hs(e)),r){case"dra":s.dra=e;break;case"pspower":s.psPower=e;break;case"pszfactor":s.psZFactor=e;break;case"bandids":s.bandIds=e;break;default:s[t[0].toLowerCase()+t.slice(1)]=e}}return"Local"!==e||s.rasters?.length||(s.rasters=["$$"]),{...t,rasterFunctionArguments:s}}function fs(t,e){const{rasterFunction:n,rasterFunctionArguments:s}=t,o=t.outputPixelType?.toLowerCase();if(null==n||!us.has(n))throw new r.c("raster-function-helper",`unsupported raster function: ${n}`);const i=us.get(n),a=("function"==typeof i.ctor?i.ctor:i.ctor.default).fromJSON({...t,outputPixelType:o}),{rasterArgumentNames:u}=a,l=[],c=function(t,e){return"rasters"===e[0]&&Array.isArray(t.rasters)?t.rasters:e.map((e=>t[e]))}(s,u),p="rasters"===u[0],h=[];for(let t=0;t<c.length;t++){const n=c[t];let s;null==n||"string"==typeof n&&n.startsWith("$")?l.push(e?.raster):"string"==typeof n?e[n]&&l.push(e[n]):"number"!=typeof n&&"rasterFunction"in n&&(s=fs(n,e),p||(a.functionArguments[u[t]]=s),l.push(s)),p&&h.push(s??n)}if(p&&(a.functionArguments.rasters=h),e){a.sourceRasters=l;const t=e.raster?.url;t&&(a.mainPrimaryRasterId=t)}return a}function ms(t,e){if(t&&e)for(const n in t){const s=t[n];s&&"object"==typeof s&&"type"in s&&("RasterFunctionTemplate"===s.type?ms(s.arguments,e):"RasterFunctionVariable"===s.type&&null!=e[s.name]&&(s.value=e[s.name]))}}function ds(t,e){if(!t||"object"!=typeof t)return t;const{value:n}=t;if(!n||"object"!=typeof n)return t.isDataset?"$$":n;if(Array.isArray(n))return 0===n.length?[]:n.map((t=>"object"==typeof t&&"RasterFunctionVariable"===t.type?ds(t,e):t));if("value"in n&&["number","string","boolean"].includes(typeof n.value))return n.value;if(t.isDataset&&"Scalar"!==n.type)return"$$";if(!("type"in n))return n;let s=n;switch(n.type){case"Scalar":s=n.value;break;case"AlgorithmicColorRamp":s=gs(n);break;case"MultiPartColorRamp":s={type:"multipart",colorRamps:n.ArrayOfColorRamp.map(gs)};break;case"ArgumentArray":if(n.elements?.length&&"RasterStatistics"!==n.elements[0].type){const t=[];for(let s=0;s<n.elements.length;s++){const o=n.elements[s],{type:i}=o;if(i)if("RasterFunctionTemplate"===i){const{renderingRule:n}=ys(o,e);t.push(n),null!=o._object_id&&e.set(o._object_id,n)}else{if("RasterFunctionVariable"!==i)throw new r.c("raster-function-helper","unsupported raster function json.");{const n=ds(o,e);t.push(n),null!=o._object_id&&e.set(o._object_id,n)}}else t.push(o)}s=t}else s=n.elements}return null!=n._object_id&&e.set(n._object_id,s),s}function gs(t){const e=t.algorithm??"esriHSVAlgorithm";let{FromColor:n,ToColor:r}=t;if(!Array.isArray(n)){const{r:t,g:e,b:r}=(0,s.AE)({h:n.Hue,s:n.Saturation,v:n.Value});n=[t,e,r,n.AlphaValue]}if(!Array.isArray(r)){const{r:t,g:e,b:n}=(0,s.AE)({h:r.Hue,s:r.Saturation,v:r.Value});r=[t,e,n,r.AlphaValue]}return{type:"algorithmic",algorithm:e,fromColor:n,toColor:r}}function ys(t,e,n){n&&ms(t,n);const s={renderingRule:{},templates:e};return xs(t,s),s}function xs(t,e){if(!t||!e.renderingRule)return;const{renderingRule:n,templates:s}=e,{function:r,arguments:o,_object_id:i}=t;if(!r||!o)return;null!=i&&s.set(i,n),n.rasterFunction=r.type.replace("Function",""),n.outputPixelType=r.pixelType;const a={};n.rasterFunctionArguments=a;for(const t in o){if("type"===t||"object_id"===t||"_object_ref_id"===t)continue;const e=o[t];e&&"object"==typeof e&&"type"in e&&("RasterFunctionTemplate"===e.type||"RasterFunctionVariable"===e.type)?("RasterFunctionVariable"===e.type?a[t]=ds(e,s):(n.rasterFunctionArguments[t]={},xs(e,{renderingRule:n.rasterFunctionArguments[t],templates:s})),null!=e._object_id&&s.set(e._object_id,a[t])):a[t]=e}switch(a.DEM&&!a.Raster&&(a.Raster=a.DEM,delete a.DEM),n.rasterFunction){case"Stretch":!function(t){t.Statistics?.length&&"object"==typeof t.Statistics&&(t.Statistics=t.Statistics.map((t=>[t.min,t.max,t.mean,t.standardDeviation]))),null!=t.NumberOfStandardDeviation&&(t.NumberOfStandardDeviations=t.NumberOfStandardDeviation,delete t.NumberOfStandardDeviation)}(a);break;case"Colormap":!function(t){"randomcolorramp"===t.ColorRamp?.type?.toLowerCase()&&(delete t.ColorRamp,t.ColormapName="Random"),0===t.ColorSchemeType&&delete t.ColorRamp}(a);break;case"Convolution":!function(t){null!=t.ConvolutionType&&(t.Type=t.ConvolutionType,delete t.ConvolutionType)}(a);break;case"Mask":!function(t){t.NoDataValues?.length&&"string"==typeof t.NoDataValues[0]&&(t.NoDataValues=t.NoDataValues.filter((t=>""!==t)).map((t=>Number(t))))}(a)}}function ws(t){const{renderingRule:e,templates:n}=t;if("object"!=typeof e||!e?.rasterFunctionArguments||!n.size)return;const{rasterFunctionArguments:s}=e;for(const t in s){const e=s[t],o="_object_ref_id"===t?e:e&&"object"==typeof e&&"_object_ref_id"in e?e._object_ref_id:null;if(null==o)e&&"object"==typeof e&&(e.rasterFunctionArguments&&ws({renderingRule:e,templates:n}),Array.isArray(e)&&e.forEach(((t,s)=>{if("object"==typeof t)if(null!=t._object_ref_id){if(!n.has(t._object_ref_id))throw new r.c("raster-function-helper",`unsupported raster function json. _object_ref_id: ${e} does not exist`);const i=n.get(o);i&&"object"==typeof i?Object.assign(t,i):e[s]=i}else ws({renderingRule:t,templates:n})})));else{if(!n.has(o))throw new r.c("raster-function-helper",`unsupported raster function json. _object_ref_id: ${o} does not exist`);const e=n.get(o);"_object_ref_id"!==t?s[t]=e:e&&"object"==typeof e&&Object.assign(s,e)}}}us.set("Arithmetic",{desc:"Arithmetic Function",ctor:jt,rasterArgumentNames:["rasters"]}),us.set("Aspect",{desc:"Aspect Function",ctor:zt,rasterArgumentNames:["raster"]}),us.set("BandArithmetic",{desc:"Band Arithmetic Function",ctor:oe,rasterArgumentNames:["raster"]}),us.set("Colormap",{desc:"Colormap Function",ctor:qe,rasterArgumentNames:["raster"]}),us.set("CompositeBand",{desc:"CompositeBand Function",ctor:Ie,rasterArgumentNames:["rasters"]}),us.set("Convolution",{desc:"Convolution Function",ctor:Ve,rasterArgumentNames:["raster"]}),us.set("ContrastBrightness",{desc:"Contrast Brightness Function",ctor:Be,rasterArgumentNames:["raster"]}),us.set("ExtractBand",{desc:"ExtractBand Function",ctor:nn,rasterArgumentNames:["raster"]}),us.set("Curvature",{desc:"Curvature Function",ctor:Ye,rasterArgumentNames:["raster"]}),us.set("Grayscale",{desc:"Grayscale Function",ctor:un,rasterArgumentNames:["raster"]}),us.set("Clip",{desc:"Clip Function",ctor:fe,rasterArgumentNames:["raster"]}),us.set("Local",{desc:"Local Function",ctor:fn,rasterArgumentNames:["rasters"]}),us.set("Mask",{desc:"Mask Function",ctor:wn,rasterArgumentNames:["raster"]}),us.set("NDVI",{desc:"NDVI Function",ctor:qn,rasterArgumentNames:["raster"]}),us.set("Remap",{desc:"Remap Function",ctor:Fn,rasterArgumentNames:["raster"]}),us.set("Slope",{desc:"Slope Function",ctor:jn,rasterArgumentNames:["raster"]}),us.set("Statistics",{desc:"Focal Statistics Function",ctor:Vn,rasterArgumentNames:["raster"]}),us.set("StatisticsHistogram",{desc:"Statistics Histogram Function",ctor:$n,rasterArgumentNames:["raster"]}),us.set("Stretch",{desc:"Stretch Function",ctor:ns,rasterArgumentNames:["raster"]}),us.set("Table",{desc:"Attribute Table Function",ctor:as,rasterArgumentNames:["raster"]})},25404:(t,e,n)=>{n.d(e,{AJ:()=>P,C_:()=>R,K_:()=>T,S0:()=>d,Sm:()=>W,_B:()=>z,aG:()=>B,eU:()=>O,eW:()=>H,eo:()=>K,iG:()=>L,yM:()=>j}),n(60708);var s,r,o=n(92400),i=n(20744),a=n(24296),u=n(40800),l=n(60074),c=n(60544),p=n(95247),h=n(67776),f=n(7488),m=n(56156);function d(t,e,n){return!(0,l.canProjectWithoutEngine)(t,e,n)}function g(t,e,n){const s=d(t,e,n);if(s&&!(0,l.isLoaded)())throw new i.c("rasterprojectionhelper-project","projection engine is not loaded");return s}(r=s||(s={}))[r.None=0]="None",r[r.North=1]="North",r[r.South=2]="South",r[r.Both=3]="Both";const y=(t,e,n,s=0)=>{if(1===n[0])return[0,0];let r=1,o=-1,i=1,a=-1;for(let e=0;e<t.length;e+=2)isNaN(t[e])||(r=r>t[e]?t[e]:r,o=o>t[e]?o:t[e],i=i>t[e+1]?t[e+1]:i,a=a>t[e+1]?a:t[e+1]);const{cols:u,rows:l}=e,c=(o-r)/u/n[0],p=(a-i)/l/n[1],h=2*s;let f=0,m=!1,d=[0,0];for(let e=0;e<u-3;e++){for(let n=0;n<l-3;n++){const s=e*l*2+2*n,r=(t[s]+t[s+4]+t[s+4*l]+t[s+4*l+4])/4,o=(t[s+1]+t[s+5]+t[s+4*l+1]+t[s+4*l+5])/4,i=Math.abs((r-t[s+2*l+2])/c),a=Math.abs((o-t[s+2*l+3])/p);if(i+a>f&&(f=i+a,d=[i,a]),h&&f>h){m=!0;break}}if(m)break}return d},x={3395:20037508.342789244,3410:17334193.943686873,3857:20037508.342788905,3975:17367530.445161372,4087:20037508.342789244,4088:20015108.787169147,6933:17367530.445161372,32662:20037508.342789244,53001:20015086.79602057,53002:10007543.39801029,53003:20015086.79602057,53004:20015086.79602057,53016:14152803.599503474,53017:17333573.624304302,53034:20015086.79602057,53079:20015114.352186374,53080:20015114.352186374,54001:20037508.342789244,54002:10018754.171394624,54003:20037508.342789244,54004:20037508.342789244,54016:14168658.027268292,54017:17367530.44516137,54034:20037508.342789244,54079:20037508.342789244,54080:20037508.342789244,54100:20037508.342789244,54101:20037508.342789244},w=32,v=4,_=v,b=new Map,A=new Map,q=500;async function P(){(0,l.isLoaded)()||await(0,l.load)()}function T(t,e,n,s=null){const r=t.spatialReference;if(r.equals(e))return t;g(r,e,s);const o=n.center,i=new p.c({xmin:o.x-t.x/2,xmax:o.x+t.x/2,ymin:o.y-t.y/2,ymax:o.y+t.y/2,spatialReference:r}),u=(0,l.project)(i,e,s),c=O(e);let h;if(null==u||null!=c&&u.width>=c){const n=(0,a.k8)(r)/(0,a.k8)(e);h={x:t.x*n,y:t.y*n}}else h={x:u.width,y:u.height};return h}function N(t,e=.01){return(0,a.k8)(t)?e/(0,a.k8)(t):0}function R(t,e,n=null,s=!0){const r=t.spatialReference;if(r.equals(e))return t;g(r,e,n);const o=(0,l.project)(t,e,n);return s&&o?(F([t],[o],r,e),o):o}function F(t,e,n,s){const r=E(n,!0),o=E(s,!0),i=N(n,q),a=N(s,q);if(i&&null!=r&&null!=o)for(let n=0;n<t.length;n++){const s=e[n];if(!s)continue;const{x:u}=t[n],{x:l}=s;l>=o[1]-a&&Math.abs(u-r[0])<i?s.x-=o[1]-o[0]:l<=o[0]+a&&Math.abs(u-r[1])<i&&(s.x+=o[1]-o[0])}}function I(t){const{inSR:e,outSR:n,datumTransformation:s,preferPE:r}=t;if(e.equals(n)){const{points:e}=M(t,null);return e}if(e.isWebMercator&&n.isWGS84||e.isWGS84&&n.isWebMercator)return function(t){const{cols:e,rows:n,xres:s,yres:r,usePixelCenter:o,inSR:i,outSR:a}=t;let{xmin:u,ymax:c}=t;o&&(u+=s/2,c-=r/2);const p=[],f=[],m=Math.max(e,n);for(let t=0;t<m;t++){const o=u+s*Math.min(e,t),m=c-r*Math.min(n,t),d=(0,l.project)(new h.c({x:o,y:m,spatialReference:i}),a);t<=e&&p.push(d.x),t<=n&&f.push(d.y)}const d=[];for(let t=0;t<e;t++)for(let e=0;e<n;e++)d.push([p[t],f[e]]);return d}(t);if(g(e,n,s)&&r){if(e.isGeographic)return k(t);if(null!=C(e))return k(t)}return function(t){const{points:e}=M(t,null),{inSR:n,outSR:s,datumTransformation:r}=t,o=e.map((t=>new h.c(t[0],t[1],n))),i=(0,l.project)(o,s,r);return r&&F(o,i,n,s),i.map((t=>t?[t.x,t.y]:[NaN,NaN]))}(t)}function k(t){const{inSR:e,outSR:n,datumTransformation:s}=t,r=C(e),{points:o,mask:i}=M(t,r);if(!e.isGeographic){const t=e.wkid?u.P.coordsys(e.wkid):u.P.fromString(e.isGeographic?u.a.PE_TYPE_GEOGCS:u.a.PE_TYPE_PROJCS,e.wkt2||e.wkt);u.g.projToGeog(t,o.length,o)}if(null!=s&&s.steps.length){let t;const e=179.9955;if(n.isGeographic&&(t=o.map((([t])=>t>e?1:t<-e?-1:0))),s.steps.forEach((t=>{const e=t.wkid?u.P.geogtran(t.wkid):u.P.fromString(u.a.PE_TYPE_GEOGTRAN,t.wkt);u.h.geogToGeog(e,o.length,o,null,t.isInverse?u.a.PE_TRANSFORM_2_TO_1:u.a.PE_TRANSFORM_1_TO_2)})),t)for(let n=0;n<o.length;n++){const s=t[n],r=o[n][0],i=r>e?1:r<-e?-1:0;s&&i&&s!==i&&(o[n][0]=s>0?r+360:r-360)}}if(!n.isGeographic){const t=C(n,!0),e=null!=t&&t.isEnvelope?[t.bbox[1],t.bbox[3]]:[-90,90];!function(t,e){const[n,s]=e;for(let e=0;e<t.length;e++){const r=t[e][1];(r<n||r>s)&&(t[e]=[NaN,NaN])}}(o,e);const s=n.wkid?u.P.coordsys(n.wkid):u.P.fromString(n.isGeographic?u.a.PE_TYPE_GEOGCS:u.a.PE_TYPE_PROJCS,n.wkt2||n.wkt);u.g.geogToProj(s,o.length,o)}let a=o;if(i&&o.length!==i.length){a=[];for(let t=0,e=0;t<i.length;t++)i[t]?a.push(o[e++]):a.push([NaN,NaN])}return a}function C(t,e=!1){let n=t.wkid||t.wkt2||t.wkt;if(!n||t.isGeographic)return null;if(n=String(n),b.has(n)){const t=b.get(n);return e?t?.gcs:t?.pcs}const s=t.wkid?u.P.coordsys(t.wkid):u.P.fromString(t.isGeographic?u.a.PE_TYPE_GEOGCS:u.a.PE_TYPE_PROJCS,t.wkt2||t.wkt),r=S(s,N(t,1e-4)),o=S(s,0,!0);return b.set(n,{pcs:r,gcs:o}),e?o:r}function S(t,e=0,n=!1){const s=u.j.generate(t),r=n?t.horizonGcsGenerate():t.horizonPcsGenerate();if(!s||!r?.length)return null;let o=!1,i=r.find((t=>1===t.getInclusive()&&1===t.getKind()));if(!i){if(i=r.find((t=>1===t.getInclusive()&&0===t.getKind())),!i)return null;o=!0}const a=n?0:(2===s.getNorthPoleLocation()?1:0)|(2===s.getSouthPoleLocation()?2:0),l=s.isPannableRectangle(),c=i.getCoord();if(o)return{isEnvelope:o,isPannable:l,vertices:c,coef:null,bbox:[c[0][0]-e,c[0][1]-e,c[1][0]+e,c[1][1]+e],poleLocation:a};let p=0;const h=[];let[f,m]=c[0],[d,g]=c[0];for(let t=0,e=c.length;t<e;t++){p++,p===e&&(p=0);const[n,s]=c[t],[r,o]=c[p];if(o===s)h.push([n,r,s,o,2]);else{const t=(r-n)/(o-s||1e-4),e=n-t*s;s<o?h.push([t,e,s,o,0]):h.push([t,e,o,s,1])}f=f<n?f:n,m=m<s?m:s,d=d>n?d:n,g=g>s?g:s}return{isEnvelope:!1,isPannable:l,vertices:c,coef:h,bbox:[f,m,d,g],poleLocation:a}}function M(t,e){const n=[],{cols:s,rows:r,xres:o,yres:i,usePixelCenter:a}=t;let{xmin:u,ymax:l}=t;if(a&&(u+=o/2,l-=i/2),null==e){for(let t=0;t<s;t++)for(let e=0;e<r;e++)n.push([u+o*t,l-i*e]);return{points:n}}const c=new Uint8Array(s*r);if(e.isEnvelope){const{bbox:[t,a,p,h]}=e;for(let f=0,m=0;f<s;f++){const s=u+o*f,d=e.isPannable||s>=t&&s<=p;for(let t=0;t<r;t++,m++){const e=l-i*t;d&&e>=a&&e<=h&&(n.push([s,e]),c[m]=1)}}return{points:n,mask:c}}const p=e.coef,h=[];for(let t=0;t<r;t++){const e=l-i*t,n=[],s=[];for(let t=0;t<p.length;t++){const[r,o,i,a,u]=p[t];if(e===i&&i===a)n.push(r),n.push(o),s.push(2),s.push(2);else if(e>=i&&e<=a){const t=r*e+o;n.push(t),s.push(u)}}let r=n;if(n.length>2){let t=2===s[0]?0:s[0],e=n[0];r=[];for(let o=1;o<s.length;o++)2===s[o]&&o!==s.length-1||(s[o]!==t&&(r.push(0===t?Math.min(e,n[o-1]):Math.max(e,n[o-1])),t=s[o],e=n[o]),o===s.length-1&&r.push(0===s[o]?Math.min(e,n[o]):Math.max(e,n[o])));r.sort(((t,e)=>t-e))}else n[0]>n[1]&&(r=[n[1],n[0]]);h.push(r)}for(let t=0,e=0;t<s;t++){const s=u+o*t;for(let t=0;t<r;t++,e++){const r=l-i*t,o=h[t];if(2===o.length)s>=o[0]&&s<=o[1]&&(n.push([s,r]),c[e]=1);else if(o.length>2){let t=!1;for(let e=0;e<o.length;e+=2)if(s>=o[e]&&s<=o[e+1]){t=!0;break}t&&(n.push([s,r]),c[e]=1)}}}return{points:n,mask:c}}function j(t,e,n=null,r=!0){const i=t.spatialReference;if(i.equals(e))return t;const a=z(t),u=O(i,!0),c=O(e);if(0===a||null==u||null==c){const o=G(t,e,n,r);if(null==u&&null!=c&&Math.abs(o.width-c)<N(e)&&(0,l.isLoaded)()){const n=C(i);if(null!=n&&n.poleLocation===s.None&&t.width<(n.bbox[2]-n.bbox[0])/2)return function(t,e){const n=O(e);if(null==n)return null;let{xmin:s,ymin:r,xmax:o,ymax:i}=t;const a=t.spatialReference,u=new f.c({spatialReference:a,rings:[[[s,r],[o,r],[o,i],[s,i],[s,r]]]}),c=(0,l.project)(u,e);if(2!==c.rings.length||!c.rings[0].length||!c.rings[1].length)return null;const{rings:h}=c,m=N(a),d=new p.c({spatialReference:e});for(let t=0;t<2;t++){s=o=h[t][0][0],r=i=h[t][0][1];for(let e=0;e<h[t].length;e++)s=s>h[t][e][0]?h[t][e][0]:s,o=o<h[t][e][0]?h[t][e][0]:o,r=r>h[t][e][1]?h[t][e][1]:r,i=i<h[t][e][1]?h[t][e][1]:i;if(0===t)d.ymin=r,d.ymax=i,d.xmin=s,d.xmax=o;else if(d.ymin=Math.min(d.ymin,r),d.ymax=Math.max(d.ymax,i),Math.abs(o-n/2)<m)d.xmin=s,d.xmax=d.xmax+n;else{if(!(Math.abs(s+n/2)<m))return null;d.xmax=o+n}}return d}(t,e)||o}return o}const h=t.clone().normalize();if(1===h.length&&t.xmax<u&&t.xmax-u/2>N(i)){const{xmin:e,xmax:n}=t;for(let s=0;s<=a;s++){const r=0===s?e:-u/2,o=s===a?n-u*s:u/2;h[s]=new p.c({xmin:r,xmax:o,ymin:t.ymin,ymax:t.ymax,spatialReference:i})}}return function(t,e){const n=O(t[0].spatialReference);if(t.length<2||null==n)return t[0];if(e=e??N(t[0].spatialReference),1===(t=t.filter((t=>t.width>e))).length)return t[0];let{xmin:s,xmax:r,ymin:o,ymax:i}=t[0];for(let e=1;e<t.length;e++){const s=t[e];r=s.xmax+n*e,o=Math.min(o,s.ymin),i=Math.max(i,s.ymax)}return new p.c({xmin:s,xmax:r,ymin:o,ymax:i,spatialReference:t[0].spatialReference})}(h.map((t=>G(t,e,n,r))).filter(o.G6))}function B(t,e,n){if("extent"===t.type){const{xmin:e,ymin:n,xmax:s,ymax:r,spatialReference:o}=t;t=new f.c({rings:[[[e,r],[s,r],[s,n],[e,n],[e,r]]],spatialReference:o})}return t.spatialReference.equals(e)?t:(g(t.spatialReference,e,n),(0,l.project)(t,e,n))}function G(t,e,n=null,s=!0,r=!0){const o=t.spatialReference;if(o.equals(e)||!e)return t;g(o,e,n);const i=(0,l.project)(t,e,n);if(r&&e.isWebMercator&&i&&(i.ymax=Math.min(20037508.342787,i.ymax),i.ymin=Math.max(-20037508.342787,i.ymin),i.ymin>=i.ymax))return null;if(!s||!i)return i;const a=E(o,!0),u=E(e,!0);if(null==a||null==u)return i;const c=N(o,.001),p=N(o,q),f=N(e,.001);if(Math.abs(i.xmin-u[0])<f&&Math.abs(i.xmax-u[1])<f){const s=Math.abs(t.xmin-a[0]),r=Math.abs(a[1]-t.xmax);if(s<c&&r>p){i.xmin=u[0];const s=[];s.push(new h.c(t.xmax,t.ymin,o)),s.push(new h.c(t.xmax,(t.ymin+t.ymax)/2,o)),s.push(new h.c(t.xmax,t.ymax,o));const r=s.map((t=>R(t,e,n))).filter((t=>!isNaN(t?.x))).map((t=>t.x));i.xmax=Math.max.apply(null,r)}if(r<c&&s>p){i.xmax=u[1];const s=[];s.push(new h.c(t.xmin,t.ymin,o)),s.push(new h.c(t.xmin,(t.ymin+t.ymax)/2,o)),s.push(new h.c(t.xmin,t.ymax,o));const r=s.map((t=>R(t,e,n))).filter((t=>!isNaN(t?.x))).map((t=>t.x));i.xmin=Math.min.apply(null,r)}}else{const t=N(e,.001);Math.abs(i.xmin-u[0])<t&&(i.xmin=u[0]),Math.abs(i.xmax-u[1])<t&&(i.xmax=u[1])}return i}function O(t,e=!1){if(!t)return null;const n=e?20037508.342787:20037508.342788905;return t.isWebMercator?2*n:t.wkid&&t.isGeographic?360:2*x[t.wkid]||null}function E(t,e=!1){if(t.isGeographic)return[-180,180];const n=O(t,e);return null!=n?[-n/2,n/2]:null}function D(t,e,n,s){let r=(t-e)/n;return r-Math.floor(r)!=0?r=Math.floor(r):s&&(r-=1),r}function z(t,e=!1){const n=O(t.spatialReference);if(null==n)return 0;const s=e?0:-n/2,r=N(t.spatialReference),o=!e&&Math.abs(t.xmax-n/2)<r?n/2:t.xmax,i=!e&&Math.abs(t.xmin+n/2)<r?-n/2:t.xmin;return D(o,s,n,!0)-D(i,s,n,!1)}function W(t){const e=t.storageInfo.origin.x,n=O(t.spatialReference,!0);if(null==n)return{originX:e,halfWorldWidth:null,pyramidsInfo:null};const s=n/2,{nativePixelSize:r,storageInfo:o,extent:i}=t,{maximumPyramidLevel:a,blockWidth:u,pyramidScalingFactor:l}=o;let c=r.x;const p=[],h=null!=t.transform&&"gcs-shift"===t.transform.type,f=e+(h?0:s),m=h?n-e:s-e;for(let t=0;t<=a;t++){const t=(i.xmax-e)/c/u,n=t-Math.floor(t)==0?t:Math.ceil(t),s=m/c/u,r=s-Math.floor(s)==0?s:Math.ceil(s),o=Math.floor(f/c/u),a=Math.round(f/c)%u,h=(u-Math.round(m/c)%u)%u;p.push({resolutionX:c,blockWidth:u,datasetColumnCount:n,worldColumnCountFromOrigin:r,leftMargin:a,rightPadding:h,originColumnOffset:o}),c*=l}return{originX:e,halfWorldWidth:s,pyramidsInfo:p,hasGCSSShiftTransform:h}}function L(t){const e=t.isAdaptive&&null==t.spacing;let n=t.spacing||[w,w],s=U(t),r={cols:s.size[0]+1,rows:s.size[1]+1};const o=s.outofBoundPointCount>0&&s.outofBoundPointCount<s.offsets.length/2;let i=s.outofBoundPointCount===s.offsets.length/2||e&&o?[0,0]:y(s.offsets,r,n,_);const a=(i[0]+i[1])/2,l=t.projectedExtent.spatialReference,c=t.srcBufferExtent.spatialReference;if(e&&(o||a>_)&&(d(l,c,t.datumTransformation)&&(l.isGeographic||C(l)),n=[v,v],s=U({...t,spacing:n}),r={cols:s.size[0]+1,rows:s.size[1]+1},i=y(s.offsets,r,n,_)),s.error=i,n[0]>1&&(s.coefficients=V(s.offsets,r,o)),t.includeGCSGrid&&!l.isGeographic&&!l.isWebMercator)if(c.isGeographic)s.gcsGrid={offsets:s.offsets,coefficients:s.coefficients,spacing:n};else{const e=C(l);if(null!=e&&!e.isEnvelope){const e=function(t){if(!t||t.isGeographic)return t;const e=String(t.wkid||t.wkt2||t.wkt);let n;return A.has(e)?n=A.get(e):(n=(t.wkid?u.P.coordsys(t.wkid):u.P.fromString(u.a.PE_TYPE_PROJCS,t.wkt2||t.wkt)).getGeogcs().getCode(),A.set(e,n)),new m.c({wkid:n})}(l),i=j(t.projectedExtent,e),{offsets:a}=U({...t,srcBufferExtent:i,spacing:n}),c=V(a,r,o);s.gcsGrid={offsets:a,coefficients:c,spacing:n}}}return s}function U(t){const{projectedExtent:e,srcBufferExtent:n,pixelSize:s,datumTransformation:r,rasterTransform:o}=t,i=e.spatialReference,a=n.spatialReference,u=g(i,a),{xmin:l,ymin:c,xmax:p,ymax:f}=e,m=O(a),d=null!=m&&(t.hasWrapAround||"gcs-shift"===o?.type),y=t.spacing||[w,w],x=y[0]*s.x,_=y[1]*s.y,b=1===y[0],A=Math.ceil((p-l)/x-.1/y[0])+(b?0:1),P=Math.ceil((f-c)/_-.1/y[1])+(b?0:1),T=I({cols:A,rows:P,xmin:l,ymax:f,xres:x,yres:_,inSR:i,outSR:a,datumTransformation:r,preferPE:y[0]<=v,usePixelCenter:b}),R=[];let F,k=0;const S=b?-1:NaN,{xmin:M,xmax:j,ymax:B,width:G,height:E}=n,D=N(a,q),z=null!=m&&M>0&&j>m/2;let W=!1;if(u){const t=C(i);W=null!=t&&t.poleLocation>0}for(let t=0;t<A;t++){const e=[];for(let n=0;n<P;n++){let s=T[t*P+n];if(d&&s[0]>j&&s[0]>m/2-D?s[0]-=m:d&&0===t&&s[0]<0&&z&&!o&&(s[0]+=m),!s||isNaN(s[0])||isNaN(s[1]))R.push(S),R.push(S),e.push(null),k++;else{if(o){const t=o.inverseTransform(new h.c({x:s[0],y:s[1],spatialReference:a}));s=[t.x,t.y]}e.push(s),t>0&&d&&F[n]&&s[0]<F[n][0]&&(s[0]+=m,W&&s[0]>j&&s[0]>m&&(s[0]-=m)),R.push((s[0]-M)/G),R.push((B-s[1])/E)}}F=e}return{offsets:R,error:null,coefficients:null,outofBoundPointCount:k,spacing:y,size:b?[A,P]:[A-1,P-1]}}function V(t,e,n){const{cols:s,rows:r}=e,o=new Float32Array((s-1)*(r-1)*2*6),i=new Float32Array([-0,-1,1,-1,1,-0,1,-0,-0]),a=new Float32Array([-1,1,0,0,-1,1,1,0,0]);for(let e=0;e<s-1;e++){for(let n=0;n<r-1;n++){let u=e*r*2+2*n;const l=t[u],c=t[u+1],p=t[u+2],h=t[u+3];u+=2*r;const f=t[u],m=t[u+1],d=t[u+2],g=t[u+3];let y=0,x=12*(n*(s-1)+e);for(let t=0;t<3;t++)o[x++]=i[y++]*l+i[y++]*p+i[y++]*d;y=0;for(let t=0;t<3;t++)o[x++]=i[y++]*c+i[y++]*h+i[y++]*g;y=0;for(let t=0;t<3;t++)o[x++]=a[y++]*l+a[y++]*f+a[y++]*d;y=0;for(let t=0;t<3;t++)o[x++]=a[y++]*c+a[y++]*m+a[y++]*g}if(n)for(let t=0;t<o.length;t++)isNaN(o[t])&&(o[t]=-1)}return o}function K(t){const{spatialReference:e}=t,n=(0,c.Nq)(e);if(!n)return t;const[s,r]=n.valid,o=r-s;let i=0;if(t.xmin<s){const e=s-t.xmin;i=Math.ceil(e/o)}else if(t.xmin>r){const e=t.xmin-r;i=-Math.ceil(e/o)}return new p.c({spatialReference:t.spatialReference,xmin:t.xmin+i*o,ymin:t.ymin,xmax:t.xmax+i*o,ymax:t.ymax})}function H(t,e,n){const{storageInfo:s,pixelSize:r}=e;let o=0,i=!1;const{pyramidResolutions:u}=s,l="mixed"===s.tileInfo.format?.toLowerCase()?Math.max(1,Math.min(3,s.tileInfo.dpi/96)):1,c=(t.x+t.y)/2/l;if(null!=u&&u.length){const t=u[u.length-1],s=(t.x+t.y)/2,l=(r.x+r.y)/2;if(c<=l)o=0;else if(c>=s)o=u.length,i=c/s>8;else{let t,e=l;for(let s=1;s<=u.length;s++){if(t=(u[s-1].x+u[s-1].y)/2,c<=t){c===t?o=s:"down"===n?(o=s-1,i=c/e>8):o="up"===n||c-e>t-c||c/e>2?s:s-1;break}e=t}}const p=0===o?r:u[o-1];return i&&Math.min(p.x,p.y)*(0,a.k8)(e.spatialReference)>19567&&(i=!1),{pyramidLevel:o,pyramidResolution:new h.c({x:p.x,y:p.y,spatialReference:e.spatialReference}),excessiveReading:i}}const p=Math.log(t.x/r.x)/Math.LN2,f=Math.log(t.y/r.y)/Math.LN2,m=e.storageInfo.maximumPyramidLevel||0;o="down"===n?Math.floor(Math.min(p,f)):"up"===n?Math.ceil(Math.max(p,f)):Math.round((p+f)/2),o<0?o=0:o>m&&(i=o>m+3,o=m);const d=2**o;return{pyramidLevel:o,pyramidResolution:new h.c({x:d*e.nativePixelSize.x,y:d*e.nativePixelSize.y,spatialReference:e.spatialReference}),excessiveReading:i}}},24428:(t,e,n)=>{n.d(e,{c:()=>u});var s=n(41948),r=n(40504),o=n(1580),i=(n(9456),n(66360),n(72052),n(12552));let a=class extends r.am{get affectsPixelSize(){return!1}forwardTransform(t){return t}inverseTransform(t){return t}};(0,s._)([(0,o.qq)()],a.prototype,"affectsPixelSize",null),(0,s._)([(0,o.qq)({json:{write:!0}})],a.prototype,"spatialReference",void 0),a=(0,s._)([(0,i.c)("esri.layers.support.rasterTransforms.BaseRasterTransform")],a);const u=a},91288:(t,e,n)=>{n.d(e,{c:()=>c});var s,r=n(41948),o=n(1580),i=(n(9456),n(66360),n(72052),n(9968)),a=n(12552),u=n(24428);let l=s=class extends u.c{constructor(){super(...arguments),this.type="gcs-shift",this.tolerance=1e-8}forwardTransform(t){return"point"===(t=t.clone()).type?(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"point"===(t=t.clone()).type?(t.x<-this.tolerance&&(t.x+=360),t):(t.xmin<-this.tolerance&&(t.xmin+=360,t.xmax+=360),t)}clone(){return new s({tolerance:this.tolerance})}};(0,r._)([(0,i.G)({GCSShiftXform:"gcs-shift"})],l.prototype,"type",void 0),(0,r._)([(0,o.qq)()],l.prototype,"tolerance",void 0),l=s=(0,r._)([(0,a.c)("esri.layers.support.rasterTransforms.GCSShiftTransform")],l);const c=l},79972:(t,e,n)=>{n.d(e,{c:()=>g});var s,r=n(41948),o=(n(60708),n(1580)),i=(n(9456),n(66360),n(72052),n(9968)),a=n(33600),u=n(12552),l=n(18996),c=n(24428),p=n(67776),h=n(95247);function f(t,e,n){const{x:s,y:r}=e;if(n<2)return{x:t[0]+s*t[2]+r*t[4],y:t[1]+s*t[3]+r*t[5]};if(2===n){const e=s*s,n=r*r,o=s*r;return{x:t[0]+s*t[2]+r*t[4]+e*t[6]+o*t[8]+n*t[10],y:t[1]+s*t[3]+r*t[5]+e*t[7]+o*t[9]+n*t[11]}}const o=s*s,i=r*r,a=s*r,u=o*s,l=o*r,c=s*i,p=r*i;return{x:t[0]+s*t[2]+r*t[4]+o*t[6]+a*t[8]+i*t[10]+u*t[12]+l*t[14]+c*t[16]+p*t[18],y:t[1]+s*t[3]+r*t[5]+o*t[7]+a*t[9]+i*t[11]+u*t[13]+l*t[15]+c*t[17]+p*t[19]}}function m(t,e,n){const{xmin:s,ymin:r,xmax:o,ymax:i,spatialReference:a}=e;let u=[];if(n<2)u.push({x:s,y:i}),u.push({x:o,y:i}),u.push({x:s,y:r}),u.push({x:o,y:r});else{let t=10;for(let e=0;e<t;e++)u.push({x:s,y:r+(i-r)*e/(t-1)}),u.push({x:o,y:r+(i-r)*e/(t-1)});t=8;for(let e=1;e<=t;e++)u.push({x:s+(o-s)*e/t,y:r}),u.push({x:s+(o-s)*e/t,y:i})}u=u.map((e=>f(t,e,n)));const l=u.map((t=>t.x)),c=u.map((t=>t.y));return new h.c({xmin:Math.min.apply(null,l),xmax:Math.max.apply(null,l),ymin:Math.min.apply(null,c),ymax:Math.max.apply(null,c),spatialReference:a})}let d=s=class extends c.c{constructor(){super(...arguments),this.polynomialOrder=1,this.type="polynomial"}readForwardCoefficients(t,e){const{coeffX:n,coeffY:s}=e;if(!n?.length||!s?.length||n.length!==s.length)return null;const r=[];for(let t=0;t<n.length;t++)r.push(n[t]),r.push(s[t]);return r}writeForwardCoefficients(t,e,n){const s=[],r=[];for(let e=0;e<t?.length;e++)e%2==0?s.push(t[e]):r.push(t[e]);e.coeffX=s,e.coeffY=r}get inverseCoefficients(){let t=this._get("inverseCoefficients");const e=this._get("forwardCoefficients");return!t&&e&&this.polynomialOrder<2&&(t=function(t){const[e,n,s,r,o,i]=t,a=s*i-o*r,u=o*r-s*i;return[(o*n-e*i)/a,(s*n-e*r)/u,i/a,r/u,-o/a,-s/u]}(e)),t}set inverseCoefficients(t){this._set("inverseCoefficients",t)}readInverseCoefficients(t,e){const{inverseCoeffX:n,inverseCoeffY:s}=e;if(!n?.length||!s?.length||n.length!==s.length)return null;const r=[];for(let t=0;t<n.length;t++)r.push(n[t]),r.push(s[t]);return r}writeInverseCoefficients(t,e,n){const s=[],r=[];for(let e=0;e<t?.length;e++)e%2==0?s.push(t[e]):r.push(t[e]);e.inverseCoeffX=s,e.inverseCoeffY=r}get affectsPixelSize(){return this.polynomialOrder>0}forwardTransform(t){if("point"===t.type){const e=f(this.forwardCoefficients,t,this.polynomialOrder);return new p.c({x:e.x,y:e.y,spatialReference:t.spatialReference})}return m(this.forwardCoefficients,t,this.polynomialOrder)}inverseTransform(t){if("point"===t.type){const e=f(this.inverseCoefficients,t,this.polynomialOrder);return new p.c({x:e.x,y:e.y,spatialReference:t.spatialReference})}return m(this.inverseCoefficients,t,this.polynomialOrder)}clone(){return new s({polynomialOrder:this.polynomialOrder,forwardCoefficients:this.forwardCoefficients?[...this.forwardCoefficients]:null,inverseCoefficients:this.inverseCoefficients?[...this.inverseCoefficients]:null})}};(0,r._)([(0,o.qq)({json:{write:!0}})],d.prototype,"polynomialOrder",void 0),(0,r._)([(0,o.qq)()],d.prototype,"forwardCoefficients",void 0),(0,r._)([(0,a.E)("forwardCoefficients",["coeffX","coeffY"])],d.prototype,"readForwardCoefficients",null),(0,r._)([(0,l.G)("forwardCoefficients")],d.prototype,"writeForwardCoefficients",null),(0,r._)([(0,o.qq)({json:{write:!0}})],d.prototype,"inverseCoefficients",null),(0,r._)([(0,a.E)("inverseCoefficients",["inverseCoeffX","inverseCoeffY"])],d.prototype,"readInverseCoefficients",null),(0,r._)([(0,l.G)("inverseCoefficients")],d.prototype,"writeInverseCoefficients",null),(0,r._)([(0,o.qq)()],d.prototype,"affectsPixelSize",null),(0,r._)([(0,i.G)({PolynomialXform:"polynomial"})],d.prototype,"type",void 0),d=s=(0,r._)([(0,u.c)("esri.layers.support.rasterTransforms.PolynomialTransform")],d);const g=d},95280:(t,e,n)=>{n.d(e,{_:()=>m,O:()=>d});var s,r=n(91288),o=n(41948),i=(n(66360),n(9456),n(72052),n(20744),n(9968)),a=n(12552),u=n(24428);let l=s=class extends u.c{constructor(){super(...arguments),this.type="identity"}clone(){return new s}};(0,o._)([(0,i.G)({IdentityXform:"identity"})],l.prototype,"type",void 0),l=s=(0,o._)([(0,a.c)("esri.layers.support.rasterTransforms.IdentityTransform")],l);const c=l;var p=n(79972);const h={GCSShiftXform:r.c,IdentityXform:c,PolynomialXform:p.c},f=Object.keys(h);function m(t){const e=t?.type;return!t||f.includes(e)}function d(t){const e=t?.type;if(!e)return null;const n=h[t?.type];if(n){const e=new n;return e.read(t),e}return null}}}]);