/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
import { c as k } from "../../chunks/runtime.js";
import { css as B, html as l } from "lit";
import { LitElement as F, safeClassMap as b, safeStyleMap as e } from "@arcgis/lumina";
import { g as P, b as g, c as f, d as U, u as j, f as h, h as o } from "../../chunks/univariateUtils.js";
const H = B`.layer-body{margin-left:var(--calcite-spacing-sm);display:table}:dir(rtl) .layer-body{margin-right:var(--calcite-spacing-sm);margin-left:0;overflow:auto}.layer-row{display:table-row}.layer-cell{display:table-cell;padding:var(--calcite-spacing-xxs) 0;min-width:100px;vertical-align:middle;word-break:break-word}.layer-cell-info{padding-right:var(--calcite-spacing-sm);padding-left:var(--calcite-spacing-sm);max-width:250px;word-break:normal;word-wrap:normal;font-size:var(--calcite-font-size-sm)}.symbol{display:flex;justify-content:center}.ramps{margin-left:var(--calcite-spacing-md)}:dir(rtl) .ramps{margin-right:var(--calcite-spacing-md);margin-left:auto}.ramp-labels{display:flex;flex-flow:column nowrap;justify-content:space-between}.ramp-label{position:relative;padding:0 var(--calcite-spacing-sm);line-height:1em;white-space:nowrap;font-size:var(--calcite-font-size-sm)}.ramp-label:before{display:block;position:absolute;top:.25em;right:100%;border-width:3px 4px 3px 0;border-style:solid;border-color:transparent var(--calcite-color-text-1) transparent transparent;width:0;height:0;content:""}.ramp-label:first-child{margin-top:calc(var(--calcite-font-size-sm) / 3 * -1)}.ramp-label:last-child{bottom:calc(var(--calcite-font-size-sm) * .25 * -1)}:dir(rtl) .ramp-label:before{right:auto;left:100%;border-width:3px 0 3px 4px;border-color:transparent transparent transparent var(--calcite-color-text-1)}.univariate-above-below-label{position:relative;margin-left:7px;line-height:1em;white-space:nowrap;font-size:var(--calcite-font-size-sm)}.univariate-above-below-label:before{display:block;position:absolute;top:.45em;left:-19px;border-width:1px 0 0;border-style:solid;width:14px;height:0;content:""}.univariate-above-below-label:first-child{top:calc(var(--calcite-font-size-sm) / 2.2 * -1)}.univariate-above-below-label:last-child{bottom:calc(var(--calcite-font-size-sm) / 2.2 * -1)}:dir(rtl) .univariate-above-below-label{margin-right:var(--calcite-spacing-sm);margin-left:auto}:dir(rtl) .univariate-above-below-label:before{right:-19px;left:auto}.univariate-above-below-symbol{display:flex;align-items:center;justify-content:center}`;
class I extends F {
  constructor() {
    super(...arguments), this.legendElement = null, this.opacity = 1;
  }
  static {
    this.properties = { cssEffectFilter: 1, legendElement: 0, opacity: 9, messages: 0 };
  }
  static {
    this.styles = H;
  }
  render() {
    const { legendElement: y, opacity: n } = this, { sizeRampElement: i, colorRampElement: c } = P(y, this.messages, n);
    if (!i)
      return null;
    const p = this.messages.previewColorRampAriaLabel, d = g(i, "above", !0), m = g(i, "below", !0), v = 12, r = f(c, {
      width: v,
      height: d,
      rampAlignment: "vertical",
      opacity: n,
      type: "above",
      cssEffectFilter: this.cssEffectFilter,
      ariaLabel: p
    }), w = f(c, {
      width: v,
      height: m,
      rampAlignment: "vertical",
      opacity: n,
      type: "below",
      cssEffectFilter: this.cssEffectFilter,
      ariaLabel: p
    }), u = U(i), s = i.infos.map((a) => a.label), x = s.map((a, t) => t === 0 ? l`<div class=${b(a ? r ? "univariate-above-below-label" : "ramp-label" : void 0)}>${a}</div>` : t === 2 ? l`<div></div>` : null), $ = s.length - 1, R = Math.floor(s.length / 2), L = s.map((a, t) => t === R || t === $ ? l`<div class=${b(a ? r ? "univariate-above-below-label" : "ramp-label" : void 0)}>${a}</div>` : null), E = { display: "table-cell", verticalAlign: "middle" }, z = { marginTop: `${u}px` }, A = { height: `${d}px` }, S = { height: `${m}px` };
    return l`<div style=${e(j)}><div class="layer-body">${i.infos.map((a, t) => l`<div class="layer-row"><div class="symbol" style=${e(E)}>${a.preview}</div>${!r && t % 2 === 0 ? l`<div class="layer-cell layer-cell-info">${s[t]}</div>` : null}</div>`)}</div>${r ? l`<div style=${e(z)}><div style=${e(h)}><div style=${e(o)}><div class="ramps">${r}</div></div><div style=${e(o)}><div class="ramp-labels" style=${e(A)}>${x}</div></div></div><div style=${e(h)}><div style=${e(o)}><div class="ramps">${w}</div></div><div style=${e(o)}><div class="ramp-labels" style=${e(S)}>${L}</div></div></div></div>` : null}</div>`;
  }
}
k("arcgis-legend-classic-univariate-above-and-below-ramp", I);
export {
  I as ArcgisLegendClassicUnivariateAboveAndBelowRamp
};
