"use client";
import { useRef, useEffect } from 'react';
import { jsx } from 'react/jsx-runtime';

var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
function SymbolInfo({
  symbol = "NASDAQ:AAPL",
  width = "100%",
  locale = "en",
  colorTheme = "dark",
  isTransparent = false
}) {
  const containerRef = useRef(null);
  useEffect(() => {
    if (!containerRef.current) return;
    if (containerRef.current.dataset.initialized === "true") {
      return;
    }
    containerRef.current.dataset.initialized = "true";
    const script = document.createElement("script");
    script.src = "https://s3.tradingview.com/external-embedding/embed-widget-symbol-info.js";
    script.async = true;
    script.innerHTML = JSON.stringify({
      symbol,
      width,
      locale,
      colorTheme,
      isTransparent
    });
    containerRef.current.appendChild(script);
    return () => {
      if (containerRef.current) {
        delete containerRef.current.dataset.initialized;
        const scripts = containerRef.current.querySelectorAll("script");
        scripts.forEach((s) => s.remove());
      }
    };
  }, [symbol, width, locale, colorTheme, isTransparent]);
  return /* @__PURE__ */ jsx("div", { className: "tradingview-widget-container", ref: containerRef, children: /* @__PURE__ */ jsx("div", { className: "tradingview-widget-container__widget" }) });
}
__name(SymbolInfo, "SymbolInfo");

export { SymbolInfo as default };
