/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{RenderingInfo as n,RenderingInfoVisualVariableInfo as e}from"./RenderingInfo.js";import{getVisualVariableValues as t}from"../visualVariables/support/visualVariableUtils.js";function r(n,e){if(null!=n.symbol)return n.symbol;const t=e?.renderer;return null!=t&&"dot-density"!==t.type?t.getSymbol(n,e):null}function o(n,e){return l(n,r(n,e),e)}function l(r,o,l){if(!o)return null;const i=l?.renderer,a=new n(i,o);if(null==i||!("visualVariables"in i)||!i.visualVariables)return a;const u=t(i,r,l)??[],s=["proportional","proportional","proportional"],c=[null,null,null];for(const{type:n,variable:t,output:p,input:f}of u)switch(n){case"color":if(null==p)continue;a.color=new e(p.toRgba(),f);break;case"size":if("outline"===t.target){if(null==p)continue;a.outlineSize=new e(p??0,f)}else{const n=t.axis,e=t.useSymbolValue?"symbol-value":p??"proportional";switch(n){case"width":s[0]=e,c[0]=f;break;case"depth":s[1]=e,c[1]=f;break;case"height":s[2]=e,c[2]=f;break;case"width-and-depth":s[0]=s[1]=e,c[0]=c[1]=f;break;default:s[0]=s[1]=s[2]=e,c[0]=c[1]=c[2]=f}}break;case"opacity":if(null==p)continue;a.opacity=new e(p,f);break;case"rotation":if(null==p)continue;switch(t.axis){case"tilt":a.tilt=new e(p,f);break;case"roll":a.roll=new e(p,f);break;default:a.heading=new e(p,f)}}return"proportional"===s[0]&&"proportional"===s[1]&&"proportional"===s[2]||(a.size=new e(s,c)),a}async function i(n,e){return null!=n.symbol?n.symbol:e?.renderer?.getSymbolAsync(n,e)??null}async function a(n,e){return l(n,await i(n,e),e)}function u(n,e=0){const t=n[e];return"number"==typeof t&&isFinite(t)?t:null}function s(n){for(let e=0;e<3;e++){const t=n[e];if("number"==typeof t)return isFinite(t)?t:0}return 0}export{u as getDriverAxisSizeValue,s as getDriverAxisSizeValueAny,o as getRenderingInfo,a as getRenderingInfoAsync,i as getSymbolAsync};
