/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import e from"../../../core/Error.js";import r from"../../../core/Logger.js";import{unquantizeMultipoint as t,unquantizePolyline as o,unquantizePolygon as n,unquantizePoint as a}from"../../../geometry/support/quantizationUtils.js";function s(e,t,o,n,a,s){if(null==e)return null;const u=e.references("geometry")&&s?i(t,n,s):t,c=e.repurposeFeature(u,a);try{return e.evaluate(c,o)}catch(m){return r.getLogger("esri.views.2d.support.arcadeOnDemand").warn("Feature arcade evaluation failed:",m),null}}const u=new Map;function i(e,r,t){const{transform:o,hasZ:n,hasM:a}=t;u.has(r)||u.set(r,c(r));const s=u.get(r)(e.geometry,o,n,a);return{...e,geometry:s}}function c(s){const u={};switch(s){case"esriGeometryPoint":return(e,r,t,o)=>a(r,u,e,t,o);case"esriGeometryPolygon":return(e,r,t,o)=>n(r,u,e,t,o);case"esriGeometryPolyline":return(e,r,t,n)=>o(r,u,e,t,n);case"esriGeometryMultipoint":return(e,r,o,n)=>t(r,u,e,o,n);default:return r.getLogger("esri.views.2d.support.arcadeOnDemand").error(new e("mapview-arcade",`Unable to handle geometryType: ${s}`)),e=>e}}export{s as default};
