import { computed as g, ref as n, watch as Se, onMounted as qe, onBeforeUnmount as Je, nextTick as V, openBlock as s, createElementBlock as u, normalizeClass as Ne, normalizeStyle as ee, unref as v, createBlock as _, createCommentVNode as y, createSlots as Ke, withCtx as m, renderSlot as f, normalizeProps as T, guardReactiveProps as F, createVNode as Ae, createElementVNode as r, Fragment as I, renderList as L, toDisplayString as P, createTextVNode as Qe } from "vue";
import { u as Ze, c as et, t as tt, C as Te, o as lt, e as z, D as ot, v as U, X as at, w as j, E as st, s as ut, x as it, y as nt, q as rt, r as dt, F as Fe } from "./index-CxkSLqkR.js";
import { t as vt, u as yt } from "./useResponsive-CoxXLe23.js";
import { _ as ct } from "./Title-DlWf9Ddn.js";
import { u as ht, U as pt } from "./usePrinter-C6iBjau1.js";
import { _ as ft } from "./Tooltip-CvkadVaG.js";
import { D as gt } from "./DataTable-BE81z-1L.js";
import mt from "./vue-ui-skeleton-BNcyfNtG.js";
import { S as bt } from "./Slicer-DjwvlG8M.js";
import xt from "./vue-ui-accordion-ElsMWD7y.js";
import { u as Ie } from "./useNestedProp-Cl0RLl8U.js";
import { _ as kt } from "./PackageVersion-CZWTAkjP.js";
import { P as wt } from "./PenAndPaper-B-Xy37LR.js";
import { u as $t } from "./useUserOptionState-BIvW1Kz7.js";
import { _ as Ct } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const _t = ["id"], zt = ["xmlns", "viewBox"], St = ["x", "y", "width", "height"], Nt = { key: 1 }, At = ["id"], Tt = ["stop-color"], Ft = ["stop-color"], It = ["stop-color"], Lt = ["id"], Rt = ["stop-color"], Ot = ["stop-color"], Vt = ["stop-color"], Pt = { key: 0 }, Ut = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Bt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Et = { key: 1 }, Mt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Dt = ["x", "y", "font-size", "fill", "font-weight"], Wt = { key: 2 }, Gt = ["transform", "text-anchor", "font-size", "fill", "font-weight"], Ht = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], jt = { key: 0 }, Xt = ["cx", "cy", "r", "fill"], Yt = ["cx", "cy", "r", "fill"], qt = { key: 1 }, Jt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Kt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Qt = ["x", "y", "height", "width", "fill", "rx"], Zt = ["x", "y", "height", "width", "fill", "rx", "stroke", "stroke-width"], el = ["x", "y", "height", "width", "fill", "onMouseover"], tl = {
  key: 5,
  class: "vue-data-ui-watermark"
}, ll = ["innerHTML"], ol = {
  __name: "vue-ui-candlestick",
  props: {
    config: {
      type: Object,
      default() {
        return {};
      }
    },
    dataset: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  setup($, { expose: Le }) {
    const h = $, { vue_ui_candlestick: Re } = Ze(), R = g(() => !!h.dataset && h.dataset.length), k = n(et()), Oe = n(null), X = n(!1), Y = n(""), q = n(void 0), te = n(0), S = n(null), le = n(null), oe = n(null), ae = n(null), se = n(null), ue = n(null), B = n(0), ie = n(0), ne = n(0), e = g({
      get: () => ve(),
      set: (t) => t
    }), { userOptionsVisible: J, setUserOptionsVisibility: re, keepUserOptionState: de } = $t({ config: e.value });
    function ve() {
      const t = Ie({
        userConfig: h.config,
        defaultConfig: Re
      });
      let o = {};
      return t.theme ? o = {
        ...Ie({
          userConfig: tt.vue_ui_candlestick[t.theme] || h.config,
          defaultConfig: t
        })
      } : o = t, h.config && Te(h.config, "style.zoom.startIndex") ? o.style.zoom.startIndex = h.config.style.zoom.startIndex : o.style.zoom.startIndex = null, h.config && Te(h.config, "style.zoom.endIndex") ? o.style.zoom.endIndex = h.config.style.zoom.endIndex : o.style.zoom.endIndex = null, o;
    }
    Se(() => h.config, (t) => {
      e.value = ve(), J.value = !e.value.userOptions.showOnChartHover, ye(), B.value += 1, ne.value += 1, ie.value += 1, w.value.showTable = e.value.table.show, w.value.showTooltip = e.value.style.tooltip.show;
    }, { deep: !0 }), Se(() => h.dataset, (t) => {
      p.value.start = 0, p.value.end = t.length, B.value += 1;
    }, { deep: !0 });
    const c = n({
      height: e.value.style.height,
      width: e.value.style.width,
      xAxisFontSize: e.value.style.layout.grid.xAxis.dataLabels.fontSize,
      yAxisFontSize: e.value.style.layout.grid.yAxis.dataLabels.fontSize
    }), E = n(null);
    qe(() => {
      ye();
    });
    function ye() {
      if (lt(h.dataset) && z({
        componentName: "VueUiCandlestick",
        type: "dataset"
      }), e.value.responsive) {
        const t = vt(() => {
          const { width: o, height: l } = yt({
            chart: S.value,
            title: e.value.style.title.text ? le.value : null,
            slicer: ae.value,
            legend: oe.value,
            source: se.value,
            noTitle: ue.value
          });
          requestAnimationFrame(() => {
            c.value.width = o, c.value.height = l, c.value.xAxisFontSize = Fe({
              relator: Math.min(o, l),
              adjuster: e.value.style.width,
              source: e.value.style.layout.grid.xAxis.dataLabels.fontSize,
              threshold: 6,
              fallback: 6
            }), c.value.yAxisFontSize = Fe({
              relator: Math.min(o, l),
              adjuster: e.value.style.width,
              source: e.value.style.layout.grid.yAxis.dataLabels.fontSize,
              threshold: 6,
              fallback: 6
            });
          });
        });
        E.value = new ResizeObserver(t), E.value.observe(S.value.parentNode);
      }
      be();
    }
    Je(() => {
      E.value && E.value.disconnect();
    });
    const { isPrinting: ce, isImaging: he, generatePdf: pe, generateImage: fe } = ht({
      elementId: `vue-ui-candlestick_${k.value}`,
      fileName: e.value.style.title.text || "vue-ui-candlestick"
    }), Ve = g(() => e.value.userOptions.show && !e.value.style.title.text), w = n({
      showTable: e.value.table.show,
      showTooltip: e.value.style.tooltip.show
    }), i = g(() => {
      const { top: t, right: o, bottom: l, left: a } = e.value.style.layout.padding;
      return {
        top: t,
        right: c.value.width - o,
        left: a,
        bottom: c.value.height - l,
        width: c.value.width - a - o,
        height: c.value.height - t - l
      };
    }), O = g(() => h.dataset.length), p = n({
      start: 0,
      end: O.value
    }), ge = g(() => h.dataset.slice(p.value.start, p.value.end)), K = g(() => (h.dataset.forEach((t, o) => {
      [null, void 0].includes(t[0]) && z({
        componentName: "VueUiCandlestick",
        type: "datasetAttribute",
        property: "period (index 0)",
        index: o
      }), [null, void 0].includes(t[1]) && z({
        componentName: "VueUiCandlestick",
        type: "datasetAttribute",
        property: "open (index 1)",
        index: o
      }), [null, void 0].includes(t[2]) && z({
        componentName: "VueUiCandlestick",
        type: "datasetAttribute",
        property: "high (index 2)",
        index: o
      }), [null, void 0].includes(t[3]) && z({
        componentName: "VueUiCandlestick",
        type: "datasetAttribute",
        property: "low (index 3)",
        index: o
      }), [null, void 0].includes(t[4]) && z({
        componentName: "VueUiCandlestick",
        type: "datasetAttribute",
        property: "last (index 4)",
        index: o
      }), [null, void 0].includes(t[5]) && z({
        componentName: "VueUiCandlestick",
        type: "datasetAttribute",
        property: "volume (index 5)",
        index: o
      });
    }), ge.value.map((t) => ({
      period: t[0],
      open: t[1],
      high: t[2],
      low: t[3],
      last: t[4],
      volume: t[5]
    })))), d = g(() => i.value.width / ge.value.length), me = g(() => ({
      max: Math.max(...K.value.map((t) => t.high)),
      min: 0
    })), C = g(() => ot(me.value.min, me.value.max, e.value.style.layout.grid.yAxis.dataLabels.steps));
    function M(t, o) {
      return {
        ...t,
        x: U(i.value.left + o * d.value + d.value / 2),
        y: U(i.value.top + (1 - t / C.value.max) * i.value.height),
        value: U(t)
      };
    }
    const b = g(() => K.value.map((t, o) => {
      const l = M(t.open, o), a = M(t.high, o), x = M(t.low, o), G = M(t.last, o), H = t.last > t.open;
      return {
        period: t.period,
        open: l,
        high: a,
        low: x,
        last: G,
        volume: t.volume,
        isBullish: H
      };
    }));
    function Pe(t) {
      return U(t / C.value.max);
    }
    const Ue = g(() => C.value.ticks.map((t) => ({
      y: i.value.bottom - i.value.height * Pe(t),
      value: U(t)
    }))), Be = g(() => K.value.map((t) => t.period)), Q = n(null);
    function Ee(t, o) {
      q.value = t, Q.value = {
        datapoint: o,
        seriesIndex: t,
        series: b.value,
        config: e.value
      };
      const l = e.value.style.tooltip.customFormat;
      if (it(l) && nt(() => l({
        seriesIndex: t,
        datapoint: o,
        series: b.value,
        config: e.value
      })))
        Y.value = l({
          seriesIndex: t,
          datapoint: o,
          series: b.value,
          config: e.value
        });
      else if (e.value.style.tooltip.show) {
        let a = "";
        const { period: x, open: G, high: H, low: $e, last: Ce, volume: _e, isBullish: ze } = b.value[t], { period: al, open: Ge, high: He, low: je, last: Xe, volume: Ye } = e.value.translations;
        a += `<div><svg style="margin-right:6px" viewBox="0 0 12 12" height="12" width="12"><rect x="0" y="0" height="12" width="12" rx="${e.value.style.layout.candle.borderRadius * 3}" stroke="${e.value.style.layout.candle.stroke}" stroke-width="${e.value.style.layout.candle.strokeWidth}" 
                fill="${e.value.style.layout.candle.gradient.show ? ze ? `url(#bullish_gradient_${k.value})` : `url(#bearish_gradient_${k.value})` : ze ? e.value.style.layout.candle.colors.bullish : e.value.style.layout.candle.colors.bearish}"/></svg>${x}</div>`, a += `${Ye} : <b>${isNaN(_e) ? "-" : Number(_e.toFixed(e.value.style.tooltip.roundingValue)).toLocaleString()}</b>`, a += `<div style="margin-top:6px;padding-top:6px;border-top:1px solid ${e.value.style.tooltip.borderColor}">`, a += `<div>${Ge}: <b>${e.value.style.tooltip.prefix} ${isNaN(G.value) ? "-" : Number(G.value.toFixed(e.value.style.tooltip.roundingValue)).toLocaleString()} ${e.value.style.tooltip.suffix}</b></div>`, a += `<div>${He}: <b>${e.value.style.tooltip.prefix} ${isNaN(H.value) ? "-" : Number(H.value.toFixed(e.value.style.tooltip.roundingValue)).toLocaleString()} ${e.value.style.tooltip.suffix}</b></div>`, a += `<div>${je}: <b>${e.value.style.tooltip.prefix} ${isNaN($e.value) ? "-" : Number($e.value.toFixed(e.value.style.tooltip.roundingValue)).toLocaleString()} ${e.value.style.tooltip.suffix}</b></div>`, a += `<div>${Xe}: <b>${e.value.style.tooltip.prefix} ${isNaN(Ce.value) ? "-" : Number(Ce.value.toFixed(e.value.style.tooltip.roundingValue)).toLocaleString()} ${e.value.style.tooltip.suffix}</b></div>`, a += "</div>", Y.value = `<div style="text-align:right">${a}</div>`;
      }
      X.value = !0;
    }
    function Me() {
      be();
    }
    const N = n(null);
    async function be() {
      (e.value.style.zoom.startIndex !== null || e.value.style.zoom.endIndex !== null) && N.value ? (e.value.style.zoom.startIndex !== null && (await V(), await V(), N.value && N.value.setStartValue(e.value.style.zoom.startIndex)), e.value.style.zoom.endIndex !== null && (await V(), await V(), N.value && N.value.setEndValue(De(e.value.style.zoom.endIndex + 1)))) : (p.value = {
        start: 0,
        end: O.value
      }, B.value += 1);
    }
    function De(t) {
      const o = O.value;
      return t > o ? o : t < 0 || e.value.style.zoom.startIndex !== null && t < e.value.style.zoom.startIndex ? e.value.style.zoom.startIndex !== null ? e.value.style.zoom.startIndex + 1 : 1 : t;
    }
    function xe() {
      V(() => {
        const t = [e.value.translations.period, e.value.translations.open, e.value.translations.high, e.value.translations.low, e.value.translations.last, e.value.translations.volume], o = b.value.map((x) => [
          x.period,
          x.open.value,
          x.high.value,
          x.low.value,
          x.last.value,
          x.volume
        ]), l = [[e.value.style.title.text], [e.value.style.title.subtitle.text], [[""], [""], [""]]].concat([t]).concat(o), a = rt(l);
        dt({ csvContent: a, title: e.value.style.title.text || "vue-ui-candlestick" });
      });
    }
    const D = g(() => {
      const t = b.value.map((a) => [
        `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" height="12" width="12" style="margin-right: 6px"><rect x="0" y="0" height="12" width="12" :rx="${e.value.style.layout.candle.borderRadius * 3}" fill="${e.value.style.layout.candle.gradient.show ? a.isBullish ? `url(#bullish_gradient_${k.value}` : `url(#bearish_gradient_${k.value})` : a.isBullish ? e.value.style.layout.candle.colors.bullish : e.value.style.layout.candle.colors.bearish}"/></svg> ${a.period}`,
        `${e.value.table.td.prefix} ${isNaN(a.open.value) ? "-" : Number(a.open.value.toFixed(e.value.table.td.roundingValue)).toLocaleString()} ${e.value.table.td.suffix}`,
        `${e.value.table.td.prefix} ${isNaN(a.high.value) ? "-" : Number(a.high.value.toFixed(e.value.table.td.roundingValue)).toLocaleString()} ${e.value.table.td.suffix}`,
        `${e.value.table.td.prefix} ${isNaN(a.low.value) ? "-" : Number(a.low.value.toFixed(e.value.table.td.roundingValue)).toLocaleString()} ${e.value.table.td.suffix}`,
        `${e.value.table.td.prefix} ${isNaN(a.last.value) ? "-" : Number(a.last.value.toFixed(e.value.table.td.roundingValue)).toLocaleString()} ${e.value.table.td.suffix}`,
        `${isNaN(a.volume) ? "-" : a.volume.toLocaleString()}`
      ]), o = {
        th: {
          backgroundColor: e.value.table.th.backgroundColor,
          color: e.value.table.th.color,
          outline: e.value.table.th.outline
        },
        td: {
          backgroundColor: e.value.table.td.backgroundColor,
          color: e.value.table.td.color,
          outline: e.value.table.td.outline
        },
        breakpoint: e.value.table.responsiveBreakpoint
      }, l = [
        e.value.translations.period,
        e.value.translations.open,
        e.value.translations.high,
        e.value.translations.low,
        e.value.translations.last,
        e.value.translations.volume
      ];
      return { head: l, body: t, config: o, colNames: l };
    }), A = n(!1);
    function We(t) {
      A.value = t, te.value += 1;
    }
    function ke() {
      w.value.showTable = !w.value.showTable;
    }
    function we() {
      w.value.showTooltip = !w.value.showTooltip;
    }
    const W = n(!1);
    function Z() {
      W.value = !W.value;
    }
    return Le({
      generatePdf: pe,
      generateCsv: xe,
      generateImage: fe,
      toggleTable: ke,
      toggleTooltip: we,
      toggleAnnotator: Z
    }), (t, o) => (s(), u("div", {
      ref_key: "candlestickChart",
      ref: S,
      class: Ne(`vue-ui-candlestick ${A.value ? "vue-data-ui-wrapper-fullscreen" : ""} ${e.value.useCssAnimation ? "" : "vue-ui-dna"}`),
      style: ee(`position:relative;font-family:${e.value.style.fontFamily}; text-align:center;background:${e.value.style.backgroundColor}; ${e.value.responsive ? "height: 100%" : ""}`),
      id: `vue-ui-candlestick_${k.value}`,
      onMouseenter: o[4] || (o[4] = () => v(re)(!0)),
      onMouseleave: o[5] || (o[5] = () => v(re)(!1))
    }, [
      e.value.userOptions.buttons.annotator ? (s(), _(wt, {
        key: 0,
        parent: S.value,
        backgroundColor: e.value.style.backgroundColor,
        color: e.value.style.color,
        active: W.value,
        onClose: Z
      }, null, 8, ["parent", "backgroundColor", "color", "active"])) : y("", !0),
      Ve.value ? (s(), u("div", {
        key: 1,
        ref_key: "noTitle",
        ref: ue,
        class: "vue-data-ui-no-title-space",
        style: "height:36px; width: 100%;background:transparent"
      }, null, 512)) : y("", !0),
      e.value.style.title.text ? (s(), u("div", {
        key: 2,
        ref_key: "chartTitle",
        ref: le,
        style: "width:100%;background:transparent"
      }, [
        (s(), _(ct, {
          key: `title_${ne.value}`,
          config: {
            title: {
              cy: "candlestick-div-title",
              ...e.value.style.title
            },
            subtitle: {
              cy: "candlestick-div-subtitle",
              ...e.value.style.title.subtitle
            }
          }
        }, null, 8, ["config"]))
      ], 512)) : y("", !0),
      e.value.userOptions.show && R.value && (v(de) || v(J)) ? (s(), _(pt, {
        ref_key: "details",
        ref: Oe,
        key: `user_options_${te.value}`,
        backgroundColor: e.value.style.backgroundColor,
        color: e.value.style.color,
        isImaging: v(he),
        isPrinting: v(ce),
        uid: k.value,
        hasTooltip: e.value.userOptions.buttons.tooltip && e.value.style.tooltip.show,
        hasPdf: e.value.userOptions.buttons.pdf,
        hasImg: e.value.userOptions.buttons.img,
        hasXls: e.value.userOptions.buttons.csv,
        hasTable: e.value.userOptions.buttons.table,
        hasFullscreen: e.value.userOptions.buttons.fullscreen,
        isFullscreen: A.value,
        isTooltip: w.value.showTooltip,
        titles: { ...e.value.userOptions.buttonTitles },
        chartElement: S.value,
        position: e.value.userOptions.position,
        hasAnnotator: e.value.userOptions.buttons.annotator,
        isAnnotation: W.value,
        onToggleFullscreen: We,
        onGeneratePdf: v(pe),
        onGenerateCsv: xe,
        onGenerateImage: v(fe),
        onToggleTable: ke,
        onToggleTooltip: we,
        onToggleAnnotator: Z,
        style: ee({
          visibility: v(de) ? v(J) ? "visible" : "hidden" : "visible"
        })
      }, Ke({ _: 2 }, [
        t.$slots.optionTooltip ? {
          name: "optionTooltip",
          fn: m(() => [
            f(t.$slots, "optionTooltip", {}, void 0, !0)
          ]),
          key: "0"
        } : void 0,
        t.$slots.optionPdf ? {
          name: "optionPdf",
          fn: m(() => [
            f(t.$slots, "optionPdf", {}, void 0, !0)
          ]),
          key: "1"
        } : void 0,
        t.$slots.optionCsv ? {
          name: "optionCsv",
          fn: m(() => [
            f(t.$slots, "optionCsv", {}, void 0, !0)
          ]),
          key: "2"
        } : void 0,
        t.$slots.optionImg ? {
          name: "optionImg",
          fn: m(() => [
            f(t.$slots, "optionImg", {}, void 0, !0)
          ]),
          key: "3"
        } : void 0,
        t.$slots.optionTable ? {
          name: "optionTable",
          fn: m(() => [
            f(t.$slots, "optionTable", {}, void 0, !0)
          ]),
          key: "4"
        } : void 0,
        t.$slots.optionFullscreen ? {
          name: "optionFullscreen",
          fn: m(({ toggleFullscreen: l, isFullscreen: a }) => [
            f(t.$slots, "optionFullscreen", T(F({ toggleFullscreen: l, isFullscreen: a })), void 0, !0)
          ]),
          key: "5"
        } : void 0,
        t.$slots.optionAnnotator ? {
          name: "optionAnnotator",
          fn: m(({ toggleAnnotator: l, isAnnotator: a }) => [
            f(t.$slots, "optionAnnotator", T(F({ toggleAnnotator: l, isAnnotator: a })), void 0, !0)
          ]),
          key: "6"
        } : void 0
      ]), 1032, ["backgroundColor", "color", "isImaging", "isPrinting", "uid", "hasTooltip", "hasPdf", "hasImg", "hasXls", "hasTable", "hasFullscreen", "isFullscreen", "isTooltip", "titles", "chartElement", "position", "hasAnnotator", "isAnnotation", "onGeneratePdf", "onGenerateImage", "style"])) : y("", !0),
      R.value ? (s(), u("svg", {
        key: 4,
        xmlns: v(at),
        class: Ne({ "vue-data-ui-fullscreen--on": A.value, "vue-data-ui-fulscreen--off": !A.value }),
        viewBox: `0 0 ${c.value.width <= 0 ? 10 : c.value.width} ${c.value.height <= 0 ? 10 : c.value.height}`,
        style: ee(`max-width:100%;overflow:visible;background:transparent;color:${e.value.style.color}`)
      }, [
        Ae(kt),
        t.$slots["chart-background"] ? (s(), u("foreignObject", {
          key: 0,
          x: i.value.left,
          y: i.value.top,
          width: i.value.width,
          height: i.value.height,
          style: {
            pointerEvents: "none"
          }
        }, [
          f(t.$slots, "chart-background", {}, void 0, !0)
        ], 8, St)) : y("", !0),
        b.value.length > 0 ? (s(), u("g", Nt, [
          r("defs", null, [
            r("linearGradient", {
              id: `bearish_gradient_${k.value}`,
              x2: "0%",
              y2: "100%"
            }, [
              r("stop", {
                offset: "0%",
                "stop-color": e.value.style.layout.candle.colors.bearish
              }, null, 8, Tt),
              r("stop", {
                offset: "50%",
                "stop-color": `${v(j)(e.value.style.layout.candle.colors.bearish, 0.02)}DE`
              }, null, 8, Ft),
              r("stop", {
                offset: "100%",
                "stop-color": `${v(j)(e.value.style.layout.candle.colors.bearish, 0.05)}66`
              }, null, 8, It)
            ], 8, At),
            r("linearGradient", {
              id: `bullish_gradient_${k.value}`,
              x2: "0%",
              y2: "100%"
            }, [
              r("stop", {
                offset: "0%",
                "stop-color": e.value.style.layout.candle.colors.bullish
              }, null, 8, Rt),
              r("stop", {
                offset: "50%",
                "stop-color": `${v(j)(e.value.style.layout.candle.colors.bullish, 0.02)}DE`
              }, null, 8, Ot),
              r("stop", {
                offset: "100%",
                "stop-color": `${v(j)(e.value.style.layout.candle.colors.bullish, 0.05)}66`
              }, null, 8, Vt)
            ], 8, Lt)
          ]),
          e.value.style.layout.grid.show ? (s(), u("g", Pt, [
            r("line", {
              x1: i.value.left,
              x2: i.value.left,
              y1: i.value.top,
              y2: i.value.bottom,
              stroke: e.value.style.layout.grid.stroke,
              "stroke-width": e.value.style.layout.grid.strokeWidth,
              "stroke-linecap": "round"
            }, null, 8, Ut),
            r("line", {
              x1: i.value.left,
              x2: i.value.right,
              y1: i.value.bottom,
              y2: i.value.bottom,
              stroke: e.value.style.layout.grid.stroke,
              "stroke-width": e.value.style.layout.grid.strokeWidth,
              "stroke-linecap": "round"
            }, null, 8, Bt)
          ])) : y("", !0),
          e.value.style.layout.grid.yAxis.dataLabels.show ? (s(), u("g", Et, [
            (s(!0), u(I, null, L(Ue.value, (l, a) => (s(), u("g", null, [
              l.value >= C.value.min && l.value <= C.value.max ? (s(), u("line", {
                key: 0,
                x1: i.value.left,
                x2: i.value.left - 5,
                y1: l.y,
                y2: l.y,
                stroke: e.value.style.layout.grid.stroke,
                "stroke-width": e.value.style.layout.grid.strokeWidth,
                "stroke-linecap": "round"
              }, null, 8, Mt)) : y("", !0),
              l.value >= C.value.min && l.value <= C.value.max ? (s(), u("text", {
                key: 1,
                x: i.value.left - 8 + e.value.style.layout.grid.yAxis.dataLabels.offsetX,
                y: l.y + c.value.yAxisFontSize / 3,
                "font-size": c.value.yAxisFontSize,
                "text-anchor": "end",
                fill: e.value.style.layout.grid.yAxis.dataLabels.color,
                "font-weight": e.value.style.layout.grid.yAxis.dataLabels.bold ? "bold" : "normal"
              }, P(e.value.style.layout.grid.yAxis.dataLabels.prefix) + " " + P(v(st)(l.value) ? l.value.toFixed(e.value.style.layout.grid.yAxis.dataLabels.roundingValue) : "") + " " + P(e.value.style.layout.grid.yAxis.dataLabels.suffix), 9, Dt)) : y("", !0)
            ]))), 256))
          ])) : y("", !0),
          e.value.style.layout.grid.xAxis.dataLabels.show ? (s(), u("g", Wt, [
            (s(!0), u(I, null, L(Be.value, (l, a) => (s(), u("g", null, [
              r("text", {
                transform: `translate(${i.value.left + d.value * a + d.value / 2}, ${i.value.bottom + c.value.xAxisFontSize * 2 + e.value.style.layout.grid.xAxis.dataLabels.offsetY}), rotate(${e.value.style.layout.grid.xAxis.dataLabels.rotation})`,
                "text-anchor": e.value.style.layout.grid.xAxis.dataLabels.rotation > 0 ? "start" : e.value.style.layout.grid.xAxis.dataLabels.rotation < 0 ? "end" : "middle",
                "font-size": c.value.xAxisFontSize,
                fill: e.value.style.layout.grid.xAxis.dataLabels.color,
                "font-weight": e.value.style.layout.grid.xAxis.dataLabels.bold ? "bold" : "normal"
              }, P(l), 9, Gt)
            ]))), 256))
          ])) : y("", !0),
          r("g", null, [
            (s(!0), u(I, null, L(b.value, (l, a) => (s(), u("g", null, [
              r("line", {
                x1: l.open.x,
                x2: l.open.x,
                y1: l.high.y,
                y2: l.low.y,
                stroke: e.value.style.layout.wick.stroke,
                "stroke-width": e.value.style.layout.wick.strokeWidth,
                "stroke-linecap": "round"
              }, null, 8, Ht),
              e.value.style.layout.wick.extremity.shape === "circle" ? (s(), u("g", jt, [
                r("circle", {
                  cx: l.high.x,
                  cy: l.high.y,
                  r: e.value.style.layout.wick.extremity.size === "auto" ? d.value / 20 : e.value.style.layout.wick.extremity.size,
                  fill: e.value.style.layout.wick.extremity.color
                }, null, 8, Xt),
                r("circle", {
                  cx: l.low.x,
                  cy: l.low.y,
                  r: e.value.style.layout.wick.extremity.size === "auto" ? d.value / 20 : e.value.style.layout.wick.extremity.size,
                  fill: e.value.style.layout.wick.extremity.color
                }, null, 8, Yt)
              ])) : y("", !0),
              e.value.style.layout.wick.extremity.shape === "line" ? (s(), u("g", qt, [
                r("line", {
                  x1: l.high.x - (e.value.style.layout.wick.extremity.size === "auto" ? d.value * e.value.style.layout.candle.widthRatio : e.value.style.layout.wick.extremity.size) / 2,
                  x2: l.high.x + (e.value.style.layout.wick.extremity.size === "auto" ? d.value * e.value.style.layout.candle.widthRatio : e.value.style.layout.wick.extremity.size) / 2,
                  y1: l.high.y,
                  y2: l.high.y,
                  stroke: e.value.style.layout.wick.extremity.color,
                  "stroke-width": e.value.style.layout.wick.strokeWidth,
                  "stroke-linecap": "round"
                }, null, 8, Jt),
                r("line", {
                  x1: l.low.x - (e.value.style.layout.wick.extremity.size === "auto" ? d.value * e.value.style.layout.candle.widthRatio : e.value.style.layout.wick.extremity.size) / 2,
                  x2: l.low.x + (e.value.style.layout.wick.extremity.size === "auto" ? d.value * e.value.style.layout.candle.widthRatio : e.value.style.layout.wick.extremity.size) / 2,
                  y1: l.low.y,
                  y2: l.low.y,
                  stroke: e.value.style.layout.wick.extremity.color,
                  "stroke-width": e.value.style.layout.wick.strokeWidth,
                  "stroke-linecap": "round"
                }, null, 8, Kt)
              ])) : y("", !0)
            ]))), 256))
          ]),
          r("g", null, [
            (s(!0), u(I, null, L(b.value, (l, a) => (s(), u("rect", {
              x: l.open.x - d.value / 2 + d.value * (1 - e.value.style.layout.candle.widthRatio) / 2,
              y: l.isBullish ? l.last.y : l.open.y,
              height: Math.abs(l.last.y - l.open.y) <= 0 ? 1e-4 : Math.abs(l.last.y - l.open.y),
              width: d.value * e.value.style.layout.candle.widthRatio <= 0 ? 1e-4 : d.value * e.value.style.layout.candle.widthRatio,
              fill: e.value.style.layout.candle.gradient.underlayer,
              rx: e.value.style.layout.candle.borderRadius,
              stroke: "none"
            }, null, 8, Qt))), 256)),
            (s(!0), u(I, null, L(b.value, (l, a) => (s(), u("rect", {
              x: l.open.x - d.value / 2 + d.value * (1 - e.value.style.layout.candle.widthRatio) / 2,
              y: l.isBullish ? l.last.y : l.open.y,
              height: Math.abs(l.last.y - l.open.y) <= 0 ? 1e-4 : Math.abs(l.last.y - l.open.y),
              width: d.value * e.value.style.layout.candle.widthRatio <= 0 ? 1e-4 : d.value * e.value.style.layout.candle.widthRatio,
              fill: l.isBullish ? e.value.style.layout.candle.gradient.show ? `url(#bullish_gradient_${k.value})` : e.value.style.layout.candle.colors.bullish : e.value.style.layout.candle.gradient.show ? `url(#bearish_gradient_${k.value})` : e.value.style.layout.candle.colors.bearish,
              rx: e.value.style.layout.candle.borderRadius,
              stroke: e.value.style.layout.candle.stroke,
              "stroke-width": e.value.style.layout.candle.strokeWidth,
              "stroke-linecap": "round",
              "stroke-linejoin": "round"
            }, null, 8, Zt))), 256))
          ]),
          r("g", null, [
            (s(!0), u(I, null, L(b.value, (l, a) => (s(), u("rect", {
              x: i.value.left + a * d.value,
              y: i.value.top,
              height: i.value.height <= 0 ? 1e-4 : i.value.height,
              width: d.value <= 0 ? 1e-4 : d.value,
              fill: q.value === a ? v(ut)(e.value.style.layout.selector.color, e.value.style.layout.selector.opacity) : "transparent",
              onMouseover: (x) => Ee(a, l),
              onMouseleave: o[0] || (o[0] = (x) => {
                q.value = void 0, X.value = !1;
              })
            }, null, 40, el))), 256))
          ])
        ])) : y("", !0),
        f(t.$slots, "svg", { svg: c.value }, void 0, !0)
      ], 14, zt)) : y("", !0),
      t.$slots.watermark ? (s(), u("div", tl, [
        f(t.$slots, "watermark", T(F({ isPrinting: v(ce) || v(he) })), void 0, !0)
      ])) : y("", !0),
      R.value ? y("", !0) : (s(), _(mt, {
        key: 6,
        config: {
          type: "candlesticks",
          style: {
            backgroundColor: e.value.style.backgroundColor,
            candlesticks: {
              axis: {
                color: "#CCCCCC"
              },
              candle: {
                color: "#CCCCCC"
              }
            }
          }
        }
      }, null, 8, ["config"])),
      e.value.style.zoom.show && R.value ? (s(), u("div", {
        key: 7,
        ref_key: "chartSlicer",
        ref: ae
      }, [
        (s(), _(bt, {
          ref_key: "slicerComponent",
          ref: N,
          key: `slicer_${B.value}`,
          background: e.value.style.zoom.color,
          borderColor: e.value.style.backgroundColor,
          fontSize: e.value.style.zoom.fontSize,
          useResetSlot: e.value.style.zoom.useResetSlot,
          labelLeft: $.dataset[p.value.start] ? $.dataset[p.value.start][0] : $.dataset[0][0],
          labelRight: $.dataset[p.value.end - 1] ? $.dataset[p.value.end - 1][0] : $.dataset.at(-1)[0],
          textColor: e.value.style.color,
          inputColor: e.value.style.zoom.color,
          selectColor: e.value.style.zoom.highlightColor,
          max: O.value,
          min: 0,
          valueStart: p.value.start,
          valueEnd: p.value.end,
          start: p.value.start,
          "onUpdate:start": o[1] || (o[1] = (l) => p.value.start = l),
          end: p.value.end,
          "onUpdate:end": o[2] || (o[2] = (l) => p.value.end = l),
          refreshStartPoint: e.value.style.zoom.startIndex !== null ? e.value.style.zoom.startIndex : 0,
          refreshEndPoint: e.value.style.zoom.endIndex !== null ? e.value.style.zoom.endIndex + 1 : O.value,
          enableRangeHandles: e.value.style.zoom.enableRangeHandles,
          enableSelectionDrag: e.value.style.zoom.enableSelectionDrag,
          onReset: Me
        }, {
          "reset-action": m(({ reset: l }) => [
            f(t.$slots, "reset-action", T(F({ reset: l })), void 0, !0)
          ]),
          _: 3
        }, 8, ["background", "borderColor", "fontSize", "useResetSlot", "labelLeft", "labelRight", "textColor", "inputColor", "selectColor", "max", "valueStart", "valueEnd", "start", "end", "refreshStartPoint", "refreshEndPoint", "enableRangeHandles", "enableSelectionDrag"]))
      ], 512)) : y("", !0),
      r("div", {
        ref_key: "chartLegend",
        ref: oe
      }, [
        f(t.$slots, "legend", { legend: b.value }, void 0, !0)
      ], 512),
      t.$slots.source ? (s(), u("div", {
        key: 8,
        ref_key: "source",
        ref: se,
        dir: "auto"
      }, [
        f(t.$slots, "source", {}, void 0, !0)
      ], 512)) : y("", !0),
      Ae(ft, {
        show: w.value.showTooltip && X.value,
        backgroundColor: e.value.style.tooltip.backgroundColor,
        color: e.value.style.tooltip.color,
        borderRadius: e.value.style.tooltip.borderRadius,
        borderColor: e.value.style.tooltip.borderColor,
        borderWidth: e.value.style.tooltip.borderWidth,
        fontSize: e.value.style.tooltip.fontSize,
        backgroundOpacity: e.value.style.tooltip.backgroundOpacity,
        position: e.value.style.tooltip.position,
        offsetY: e.value.style.tooltip.offsetY,
        parent: S.value,
        content: Y.value,
        isFullscreen: A.value,
        isCustom: e.value.style.tooltip.customFormat && typeof e.value.style.tooltip.customFormat == "function"
      }, {
        "tooltip-before": m(() => [
          f(t.$slots, "tooltip-before", T(F({ ...Q.value })), void 0, !0)
        ]),
        "tooltip-after": m(() => [
          f(t.$slots, "tooltip-after", T(F({ ...Q.value })), void 0, !0)
        ]),
        _: 3
      }, 8, ["show", "backgroundColor", "color", "borderRadius", "borderColor", "borderWidth", "fontSize", "backgroundOpacity", "position", "offsetY", "parent", "content", "isFullscreen", "isCustom"]),
      R.value ? (s(), _(xt, {
        key: 9,
        hideDetails: "",
        config: {
          open: w.value.showTable,
          maxHeight: 1e4,
          body: {
            backgroundColor: e.value.style.backgroundColor,
            color: e.value.style.color
          },
          head: {
            backgroundColor: e.value.style.backgroundColor,
            color: e.value.style.color
          }
        }
      }, {
        content: m(() => [
          (s(), _(gt, {
            key: `table_${ie.value}`,
            colNames: D.value.colNames,
            head: D.value.head,
            body: D.value.body,
            config: D.value.config,
            title: `${e.value.style.title.text}${e.value.style.title.subtitle.text ? ` : ${e.value.style.title.subtitle.text}` : ""}`,
            onClose: o[3] || (o[3] = (l) => w.value.showTable = !1)
          }, {
            th: m(({ th: l }) => [
              Qe(P(l), 1)
            ]),
            td: m(({ td: l }) => [
              r("div", { innerHTML: l }, null, 8, ll)
            ]),
            _: 1
          }, 8, ["colNames", "head", "body", "config", "title"]))
        ]),
        _: 1
      }, 8, ["config"])) : y("", !0)
    ], 46, _t));
  }
}, xl = /* @__PURE__ */ Ct(ol, [["__scopeId", "data-v-4c6b7dd8"]]);
export {
  xl as default
};
