/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import { C as b } from "./chart-model.js";
import { r as e, k as h, s as x, l as m, m as A, n as C, o as L, p as V, a as v } from "./utils.js";
import { cloneDeep as T } from "lodash-es";
import "@arcgis/toolkit/intl";
import "luxon";
import "d3-array";
import "@arcgis/toolkit/type";
import { o as y } from "./series-types.js";
import { aL as g } from "./index.js";
import "@arcgis/core/Graphic.js";
import "@arcgis/core/renderers/support/jsonUtils.js";
import "@arcgis/core/symbols/support/symbolUtils.js";
import "@esri/arcgis-html-sanitizer";
import "@arcgis/core/intl.js";
import "@arcgis/core/layers/support/FeatureFilter.js";
import "@arcgis/core/smartMapping/statistics/histogram.js";
import "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
import "simple-statistics";
import "@arcgis/core/request.js";
import "@arcgis/core/core/sql.js";
import "@arcgis/core/AttributeBinsGraphic.js";
import "@arcgis/core/geometry/support/jsonUtils.js";
import "@arcgis/core/rest/support/AttributeBinsQuery.js";
import "@arcgis/core/rest/support/StatisticDefinition.js";
import "@arcgis/core/time/TimeExtent.js";
import "@arcgis/core/core/promiseUtils.js";
import "./runtime.js";
import "@arcgis/toolkit/dom";
import { m as r } from "./model-setter.js";
import { g as S, b as B, e as M, f as O, c as D, d as G, a as I, s as z } from "./utils2.js";
import { M as _, a as H, d as Y } from "./model-with-guides.js";
import { G as p } from "./common.js";
const P = (t) => {
  for (const i of t.axes ?? [])
    if (i?.grid !== void 0)
      return i.grid;
}, k = (t, i, s) => {
  const o = i.axes;
  s.forEach((c) => {
    o?.[c] !== void 0 && (o[c].grid = T(t));
  });
}, F = (t, i) => i.axes?.[t]?.visible ?? !0, W = (t, i, s) => {
  const o = s.axes?.[i];
  o !== void 0 && (o.visible = t);
}, Z = (t, i) => t.axes?.[i]?.displayZeroLine ?? !1, w = (t, i, s) => {
  t.axes?.[s] !== void 0 && (t.axes[s].displayZeroLine = i);
}, N = (t, i) => t.axes?.[i]?.displayCursorTooltip ?? !1, j = (t) => {
  const { config: i, displayCursorTooltip: s, axisIndex: o } = t;
  i.axes?.[o] !== void 0 && (i.axes[o].displayCursorTooltip = s);
}, $ = (t, i) => t.axes?.[i]?.buffer ?? !1, U = (t) => {
  const { config: i, buffer: s, axisIndex: o } = t, c = i.axes?.[o];
  c !== void 0 && (c.buffer = s);
}, E = (t, i) => t.axes?.[i]?.tickSpacing, R = (t) => {
  const { config: i, tickSpacing: s, axisIndex: o } = t;
  i.axes?.[o] !== void 0 && (i.axes[o].tickSpacing = s);
}, X = (t, i) => t.axes?.[i]?.integerOnlyValues ?? !1, q = (t) => {
  const { config: i, integerOnlyValues: s, axisIndex: o } = t;
  i.axes?.[o] !== void 0 && (i.axes[o].integerOnlyValues = s);
}, J = (t) => t.horizontalAxisLabelsBehavior ?? y.Rotate, K = (t, i) => {
  i.horizontalAxisLabelsBehavior = t;
}, Q = (t) => t.verticalAxisLabelsBehavior ?? y.Wrap, ii = (t, i) => {
  i.verticalAxisLabelsBehavior = t;
}, si = (t) => t.cursorCrosshair?.horizontalLineVisible ?? !1, ti = (t, i) => {
  i.cursorCrosshair === void 0 && (i.cursorCrosshair = g()), i.cursorCrosshair.horizontalLineVisible = t;
}, oi = (t) => t.cursorCrosshair?.verticalLineVisible ?? !1, ei = (t, i) => {
  i.cursorCrosshair === void 0 && (i.cursorCrosshair = g()), i.cursorCrosshair.verticalLineVisible = t;
}, ri = (t) => t.cursorCrosshair?.style, ni = (t, i) => {
  i.cursorCrosshair === void 0 && (i.cursorCrosshair = g()), i.cursorCrosshair.style = t;
}, ai = (t) => t.cursorCrosshair, ci = (t, i) => {
  i.cursorCrosshair = t;
};
var fi = Object.defineProperty, li = Object.getOwnPropertyDescriptor, n = (t, i, s, o) => {
  for (var c = li(i, s), f = t.length - 1, l; f >= 0; f--)
    (l = t[f]) && (c = l(i, s, c) || c);
  return c && fi(i, s, c), c;
};
class a extends b {
  /**
   * Gets the title text of the specified axis.
   *
   * @param axisIndex - The index of the axis (0 for X-axis, 1 for Y-axis, 2 for second Y-axis).
   */
  getAxisTitleText(i) {
    return e({
      config: this._config,
      axisIndex: i,
      func: (s) => S(s, this._config)
    }) ?? "";
  }
  setAxisTitleText(i, s) {
    e({
      config: this._config,
      axisIndex: s,
      func: (o) => {
        B(i, o, this._config);
      }
    });
  }
  /**
   * Gets the visibility of the specified axis.
   * @param {number} axisIndex The index of the axis (0 for X-axis, 1 for Y-axis, 2 for second Y-axis).
   * @returns {boolean}
   */
  getAxisVisibility(i) {
    return e({
      config: this._config,
      axisIndex: i,
      func: (s) => F(s, this._config)
    }) ?? !0;
  }
  /**
   * Sets the visibility of the specified axis.
   * **Note:** The visibility for the second Y-axis (axisIndex 2) will only be applied if there is a second Y-axis in the chart. To enable the second Y-axis, use the `setAssignToSecondValueAxis(true, 1)` method to assign a series to the second Y-axis.
   * @param {boolean} isVisible The visibility state for the axis.
   * @param {number} axisIndex The index of the axis (0 for X-axis, 1 for Y-axis, 2 for second Y-axis).
   */
  setAxisVisibility(i, s) {
    this.guardSetterFromAsyncOverwrite(() => {
      e({
        config: this._config,
        axisIndex: s,
        func: (o) => {
          W(i, o, this._config), this.emitConfigUpdate("setAxisVisibility");
        }
      });
    });
  }
  /**
   * Gets the visibility of the specified axis labels.
   * @param {number} axisIndex The index of the axis (0 for X-axis, 1 for Y-axis, 2 for second Y-axis).
   * @returns {boolean}
   */
  getAxisLabelsVisibility(i) {
    return e({
      config: this._config,
      axisIndex: i,
      func: (s) => M(s, this._config)
    }) ?? !0;
  }
  /**
   * Sets the visibility of the specified axis labels.
   * **Note:** The labels visibility for the second Y-axis (axisIndex 2) will only be applied if there is a second Y-axis in the chart. To enable the second Y-axis, use the `setAssignToSecondValueAxis(true, 1)` method to assign a series to the second Y-axis.
   * @param {boolean} isVisible The visibility state for the axis labels.
   * @param {number} axisIndex The index of the axis (0 for X-axis, 1 for Y-axis, 2 for second Y-axis).
   */
  setAxisLabelsVisibility(i, s) {
    this.guardSetterFromAsyncOverwrite(() => {
      e({
        config: this._config,
        axisIndex: s,
        func: (o) => {
          O(i, o, this._config), this.emitConfigUpdate("setAxisLabelsVisibility");
        }
      });
    });
  }
  /**
   * Gets the visibility of the specified axis title.
   *
   * @param axisIndex - The index of the axis (0 for X-axis, 1 for Y-axis, 2 for second Y-axis).
   */
  getAxisTitleVisibility(i) {
    return e({
      config: this._config,
      axisIndex: i,
      func: (s) => D(s, this._config)
    }) ?? !1;
  }
  setAxisTitleVisibility(i, s) {
    e({
      config: this._config,
      axisIndex: s,
      func: (o) => {
        G(i, o, this._config);
      }
    });
  }
  /**
   * Gets the maximum bound for the specified axis.
   *
   * @param axisIndex - The index of the axis (0 for X-axis, 1 for Y-axis, 2 for second Y-axis).
   */
  getMaxBound(i) {
    return e({
      config: this._config,
      axisIndex: i,
      func: (s) => h({ config: this._config, axisIndex: s, isMax: !0 })
    }) ?? Number.NaN;
  }
  setMaxBound(i, s) {
    e({
      config: this._config,
      axisIndex: s,
      func: (o) => {
        x({ config: this._config, value: i, axisIndex: o, isMax: !0 });
      }
    });
  }
  /**
   * Gets the minimum bound for the specified axis.
   *
   * @param axisIndex - The index of the axis (0 for X-axis, 1 for Y-axis, 2 for second Y-axis).
   */
  getMinBound(i) {
    return e({
      config: this._config,
      axisIndex: i,
      func: (s) => h({ config: this._config, axisIndex: s, isMax: !1 })
    }) ?? Number.NaN;
  }
  setMinBound(i, s) {
    e({
      config: this._config,
      axisIndex: s,
      func: (o) => {
        x({ config: this._config, value: i, axisIndex: o, isMax: !1 });
      }
    });
  }
  /**
   * Gets the value format for the specified axis.
   *
   * @param axisIndex - The index of the axis (0 for X-axis, 1 for Y-axis, 2 for second Y-axis).
   */
  getAxisValueFormat(i) {
    return e({
      config: this._config,
      axisIndex: i,
      func: (s) => m(s, this._config)
    });
  }
  setAxisValueFormat(i, s) {
    e({
      config: this._config,
      axisIndex: i,
      func: (o) => {
        A({
          config: this._config,
          valueFormat: s,
          axisIndex: o,
          commonStrings: this.commonStrings
        });
      }
    });
  }
  /**
   * Gets whether logarithmic scale is enabled for the specified axis.
   * - `true`: Logarithmic scale is enabled for the specified axis.
   * - `false`: Logarithmic scale is disabled for the specified axis.
   *
   * @param axisIndex - The index of the axis (0 for X-axis, 1 for Y-axis, 2 for second Y-axis).
   */
  getLogarithmic(i) {
    return e({
      config: this._config,
      axisIndex: i,
      func: (s) => C(this._config, s)
    }) ?? !1;
  }
  setLogarithmic(i, s) {
    e({
      config: this._config,
      axisIndex: s,
      func: (o) => {
        L({
          config: this._config,
          isLogarithmic: i,
          axisIndex: o
        });
      }
    });
  }
  /**
   * Gets the scrollbar configuration for the specified axis.
   *
   * @param axisIndex - The index of the axis (0 for X-axis, 1 for Y-axis, 2 for second Y-axis).
   */
  getAxisScrollbar(i) {
    return e({
      config: this._config,
      axisIndex: i,
      func: (s) => this._config.axes?.[s]?.scrollbar
    });
  }
  setAxisScrollbar(i, s) {
    e({
      config: this._config,
      axisIndex: s,
      func: (o) => {
        V({
          config: this._config,
          scrollbar: i,
          axisIndex: o
        });
      }
    });
  }
  /**
   * Gets the specified title text symbol. Contains styling information such as font, color, and symbol style.
   *
   * @param axisIndex - The index of the axis to get the title symbol for
   */
  getAxisTitleSymbol(i) {
    return e({
      config: this._config,
      axisIndex: i,
      func: (s) => I(this._config, s)
    });
  }
  setAxisTitleSymbol(i, s) {
    e({
      config: this._config,
      axisIndex: s,
      func: (o) => {
        z({ symbol: i, config: this._config, axisIndex: o });
      }
    });
  }
  /**
   * Gets the horizontal axis labels behavior for the chart.
   */
  getHorizontalAxisLabelsBehavior() {
    return J(this._config);
  }
  setHorizontalAxisLabelsBehavior(i) {
    K(i, this._config);
  }
  /**
   * Gets the vertical axis labels behavior for the chart.
   */
  getVerticalAxisLabelsBehavior() {
    return Q(this._config);
  }
  setVerticalAxisLabelsBehavior(i) {
    ii(i, this._config);
  }
  /**
   * Gets the grid lines symbol. Contains styling information such as line width, line style, and line color.
   */
  getGridLinesSymbol() {
    return P(this._config);
  }
  setGridLinesSymbol(i, s) {
    Array.isArray(s) && k(i, this._config, s);
  }
  /**
   * Get the default x-axis title text.
   */
  getDefaultXAxisTitleText() {
    return this.commonStrings.utilsStrings.statistics.count;
  }
  /**
   * Gets the display zero line setting for the specified axis.
   * - This setting is only applicable to the axis of type ValueAxis.
   * - To get the setting for the x-axis, the axisIndex should be `0`. For the y-axis, the axisIndex should be `1`.
   * - If the displayZeroLine is not set on the axis, the default value of `false` will be returned.
   *
   * @param axisIndex - The index of the axis to get the display zero line for.
   */
  getDisplayZeroLine(i) {
    return e({
      config: this._config,
      axisIndex: i,
      func: (s) => Z(this._config, s)
    }) ?? !1;
  }
  setDisplayZeroLine(i, s) {
    e({
      config: this._config,
      axisIndex: s,
      func: (o) => {
        w(this._config, i, o);
      }
    });
  }
  /**
   * Gets the display cursor tooltip setting for the specified axis.
   * - To get the setting for the x-axis, the axisIndex should be `0`. For the y-axis, the axisIndex should be `1`.
   * - If the displayCursorTooltip is not set on the axis, the default value of `false` will be returned.
   *
   * @param axisIndex - The index of the axis to get the display cursor tooltip for.
   */
  getDisplayCursorTooltip(i) {
    return e({
      config: this._config,
      axisIndex: i,
      func: (s) => N(this._config, s)
    }) ?? !1;
  }
  setDisplayCursorTooltip(i, s) {
    e({
      config: this._config,
      axisIndex: s,
      func: (o) => {
        j({
          config: this._config,
          displayCursorTooltip: i,
          axisIndex: o
        });
      }
    });
  }
  /**
   * Gets the buffer setting for the specified axis.
   * - This setting is only applicable to the axis of type ValueAxis.
   * - To get the setting for the x-axis, the axisIndex should be `0`. For the y-axis, the axisIndex should be `1`.
   * - If the `buffer` is not set on the axis, the default value of `false` will be returned.
   *
   * @param axisIndex - The index of the axis
   */
  getBuffer(i) {
    return e({
      config: this._config,
      axisIndex: i,
      func: (s) => $(this._config, s)
    }) ?? !1;
  }
  setBuffer(i, s) {
    e({
      config: this._config,
      axisIndex: s,
      func: (o) => {
        U({
          config: this._config,
          buffer: i,
          axisIndex: o
        });
      }
    });
  }
  /**
   * Gets the tick spacing setting for the specified axis.
   * - To get the setting for the x-axis, the axisIndex should be `0`. For the y-axis, the axisIndex should be `1`.
   *
   * @param axisIndex - The index of the axis
   */
  getTickSpacing(i) {
    return E(this._config, i);
  }
  setTickSpacing(i, s) {
    e({
      config: this._config,
      axisIndex: s,
      func: (o) => {
        R({
          config: this._config,
          tickSpacing: i,
          axisIndex: o
        });
      }
    });
  }
  /**
   * Gets the integer only values setting for the specified axis.
   * - This setting is only applicable to the axis of type ValueAxis.
   * - To get the setting for the x-axis, the axisIndex should be `0`. For the y-axis, the axisIndex should be `1`.
   * - If the `integerOnlyValues` is not set on the axis, the default value of `false` will be returned.
   *
   * @param axisIndex - The index of the axis
   */
  getIntegerOnlyValues(i) {
    return e({
      config: this._config,
      axisIndex: i,
      func: (s) => X(this._config, s)
    }) ?? !1;
  }
  setIntegerOnlyValues(i, s) {
    e({
      config: this._config,
      axisIndex: s,
      func: (o) => {
        q({
          config: this._config,
          integerOnlyValues: i,
          axisIndex: o
        });
      }
    });
  }
  /**
   * Visibility of the horizontal line of the cursor's crosshair.
   * - If the cursor crosshair or its horizontal line visibility is not set, the default value of `false` will be returned.
   *
   * **Note:** To set the cursor crosshair horizontal line visibility for the second Y-axis (axisIndex 2), ensure there is a second Y-axis in the chart by using the `setAssignToSecondValueAxis(true, 1)` method to assign a series to the second Y-axis.
   */
  get cursorCrosshairHorizontalLineVisibility() {
    return si(this._config);
  }
  set cursorCrosshairHorizontalLineVisibility(i) {
    ti(i, this._config);
  }
  /**
   * Visibility of the vertical line of the cursor's crosshair.
   * - If the cursor crosshair or its vertical line visibility is not set, the default value of `false` will be returned.
   *
   * **Note:** To set the cursor crosshair vertical line visibility for the second Y-axis (axisIndex 2), ensure there is a second Y-axis in the chart by using the `setAssignToSecondValueAxis(true, 1)` method to assign a series to the second Y-axis.
   */
  get cursorCrosshairVerticalLineVisibility() {
    return oi(this._config);
  }
  set cursorCrosshairVerticalLineVisibility(i) {
    ei(i, this._config);
  }
  /**
   * Style of the cursor's crosshair from the chart config.
   *
   * **Note:** To set the cursor crosshair style for the second Y-axis (axisIndex 2), ensure there is a second Y-axis in the chart by using the `setAssignToSecondValueAxis(true, 1)` method to assign a series to the second Y-axis.
   */
  get cursorCrosshairStyle() {
    return ri(this._config);
  }
  set cursorCrosshairStyle(i) {
    i && ni(i, this._config);
  }
  /**
   * Cursor crosshair from the chart config.
   *
   * **Note:** To set the cursor crosshair for the second Y-axis (axisIndex 2), ensure there is a second Y-axis in the chart by using the `setAssignToSecondValueAxis(true, 1)` method to assign a series to the second Y-axis.
   */
  get cursorCrosshair() {
    return ai(this._config);
  }
  set cursorCrosshair(i) {
    i && ci(i, this._config);
  }
}
n([
  r
], a.prototype, "setAxisTitleText");
n([
  r
], a.prototype, "setAxisTitleVisibility");
n([
  r
], a.prototype, "setMaxBound");
n([
  r
], a.prototype, "setMinBound");
n([
  r
], a.prototype, "setAxisValueFormat");
n([
  r
], a.prototype, "setLogarithmic");
n([
  r
], a.prototype, "setAxisScrollbar");
n([
  r
], a.prototype, "setAxisTitleSymbol");
n([
  r
], a.prototype, "setHorizontalAxisLabelsBehavior");
n([
  r
], a.prototype, "setVerticalAxisLabelsBehavior");
n([
  r
], a.prototype, "setGridLinesSymbol");
n([
  r
], a.prototype, "setDisplayZeroLine");
n([
  r
], a.prototype, "setDisplayCursorTooltip");
n([
  r
], a.prototype, "setBuffer");
n([
  r
], a.prototype, "setTickSpacing");
n([
  r
], a.prototype, "setIntegerOnlyValues");
n([
  r
], a.prototype, "cursorCrosshairHorizontalLineVisibility");
n([
  r
], a.prototype, "cursorCrosshairVerticalLineVisibility");
n([
  r
], a.prototype, "cursorCrosshairStyle");
n([
  r
], a.prototype, "cursorCrosshair");
var gi = Object.defineProperty, ui = Object.getOwnPropertyDescriptor, d = (t, i, s, o) => {
  for (var c = ui(i, s), f = t.length - 1, l; f >= 0; f--)
    (l = t[f]) && (c = l(i, s, c) || c);
  return c && gi(i, s, c), c;
};
class u extends _ {
  /**
   * Gets the number guides in the Y-axis guides list.
   *
   * @returns The number of Y-axis guides.
   */
  getYGuidesLength() {
    return this._config.axes?.[1]?.guides?.length;
  }
  addYAxisGuide(i, s) {
    H({
      config: this._config,
      name: i,
      index: s,
      orientation: p.Y
    });
  }
  deleteYAxisGuide(i) {
    Y({
      config: this._config,
      index: i,
      orientation: p.Y
    });
  }
}
d([
  r
], u.prototype, "addYAxisGuide");
d([
  r
], u.prototype, "deleteYAxisGuide");
const hi = [_];
v(u, hi);
export {
  a as M,
  u as a
};
