/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../../../core/screenUtils","../../../../libs/maquette/projection","../../../../libs/maquette/projector","../../../../symbols/support/symbolUtils","../../../support/widgetUtils","../../../support/jsxFactory"],(function(e,t,i,o,l,n,r){"use strict";const s=o.createProjector(),a=10,c=20,p=10,f=20,u={univariateAboveAndBelowSymbol:"esri-univariate-above-and-below-ramp__symbol",colorRamp:"esri-legend__color-ramp"};function v(e="vertical"){const t="stroke:rgb(200, 200, 200);stroke-width:1";return"vertical"===e?r.tsx("svg",{height:"4",width:"10"},r.tsx("line",{x1:"0",y1:"2",x2:"10",y2:"2",style:t})):r.tsx("svg",{height:"10",width:"10"},r.tsx("line",{x1:"5",y1:"0",x2:"5",y2:"10",style:t}))}function m(e,t="vertical"){const i=document.createElement("div");return i.style.height=`${c}px`,i.className=u.univariateAboveAndBelowSymbol,null!=e&&(i.style.opacity=e.toString()),s.append(i,v.bind(null,t)),i}function h(e,i,o="vertical",l){e.infos.forEach(((e,n)=>{if(l&&2===n)e.preview=m(i,o);else{const i=t.pt2px(e.size)+("horizontal"===o?f:p),l="div"===e.preview.tagName.toLowerCase(),n=l?e.preview:document.createElement("div");n.className=u.univariateAboveAndBelowSymbol,"horizontal"===o?n.style.width=`${i}px`:n.style.height=`${i}px`,l||n.appendChild(e.preview),e.preview=n}}))}function d(e,i="classic"){const o=e.infos;return"classic"===i?(t.pt2px(o[0].size)+p)/2:(t.pt2px(o[0].size)-t.pt2px(o[o.length-1].size))/2}function g(e,t){if(!e)return null;const i=e.infos.map((e=>e.color)),o=l.renderColorRampPreviewHTML("full"===t.type?i:"above"===t.type?i.slice(0,3):i.slice(2,5),{width:t.width,height:t.height,align:t.rampAlignment,effectList:t.effectList});return o.className=u.colorRamp,null!=t.opacity&&(o.style.opacity=t.opacity.toString()),o}function y(e,i,o,l="vertical"){let n=0;const r=e.infos,s=Math.floor(r.length/2),u="full"===i||"above"===i?0:s,v="full"===i||"below"===i?r.length-1:s;for(let m=u;m<=v;m++)if(o&&m===s)n+="horizontal"===l?a:c;else{n+=t.pt2px(r[m].size)+("horizontal"===l?f:p)}return Math.round(n)}function b(e,i,o,l="vertical"){const n=y(e,i,o,l),r=e.infos,s=Math.floor(r.length/2),u="full"===i||"above"===i?0:s,v="full"===i||"below"===i?r.length-1:s,m="full"===i?r[u].size+r[v].size:"above"===i?r[u].size:r[v].size,h=o?"vertical"===l?c:a:0,d="vertical"===l?p*("full"===i?2:1):f*("full"===i?2:1);return Math.round(n-(t.pt2px(m)/2+h/2+d/2))}function z(e,t,i="vertical"){const o=e.infos;let l=o.find((({type:e})=>"size-ramp"===e)),n=o.find((({type:e})=>"color-ramp"===e));var r,s;(l&&(l={...l},l.infos=[...l.infos],h(l,t,i,!0)),n&&(n={...n},n.infos=[...n.infos]),"horizontal"===i)&&(null==(r=l)||r.infos.reverse(),null==(s=n)||s.infos.reverse());return{sizeRampElement:l,colorRampElement:n}}function w(e,t="vertical"){const i=e.infos;let o=i.find((({type:e})=>"size-ramp"===e)),l=i.find((({type:e})=>"color-ramp"===e));var n,r;(o&&(o={...o},o.infos=[...o.infos],h(o,null,t,!1)),l&&(l={...l},l.infos=[...l.infos]),"horizontal"===t)&&(null==(n=o)||n.infos.reverse(),null==(r=l)||r.infos.reverse());return{sizeRampElement:o,colorRampElement:l}}e.getUnivariateAboveAndBelowRampElements=z,e.getUnivariateColorRampMargin=d,e.getUnivariateColorRampPreview=g,e.getUnivariateColorRampSize=b,e.getUnivariateColorSizeRampElements=w,e.getUnivariateSizeRampSize=y,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
