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