/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{createRasterFunction as e}from"./utils.js";function t(t){const{rasters:l,weights:s,outputPixelType:a}=t,r=t?.fields??l.map(()=>"Value");return e("WeightedSum",{rasters:l,fields:r,weights:s},a)}function l(t){const{rasters:l,weights:s,outputPixelType:a,minScale:r,maxScale:i,valueToScaleMaps:n,noDataValues:u,restrictedValues:o}=t,p=s.reduce((e,t)=>e+t),h=1===p?s:s.map(e=>e/p),m=t?.fields??l.map(()=>"Value"),f=l.map(()=>[]);if(n?.length)for(let e=0;e<f.length;e++)n[e]?.length&&f[e].push(...n[e].map(e=>e.join(" ")));if(u?.length)for(let e=0;e<f.length;e++)u[e]?.length&&f[e].push(...u[e].map(e=>`${e} NODATA`));if(o?.length)for(let e=0;e<f.length;e++)o[e]?.length&&f[e].push(...o[e].map(e=>`${e} Restricted`));const g=f.map(e=>e.join(","));return e("WeightedOverlay",{rasters:l,fields:m,influences:h,remaps:g,evalFrom:r,evalTo:i},a)}export{l as weightedOverlay,t as weightedSum};
