"use client";
import { memo, 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 StockScreener() {
  const container = useRef(null);
  useEffect(() => {
    if (!container.current) return;
    if (container.current.dataset.initialized === "true") {
      return;
    }
    container.current.dataset.initialized = "true";
    const script = document.createElement("script");
    script.src = "https://s3.tradingview.com/external-embedding/embed-widget-screener.js";
    script.type = "text/javascript";
    script.async = true;
    script.innerHTML = JSON.stringify({
      market: "america",
      showToolbar: true,
      defaultColumn: "overview",
      defaultScreen: "most_capitalized",
      isTransparent: false,
      locale: "en",
      colorTheme: "dark",
      width: "100%",
      height: 550
    });
    container.current.appendChild(script);
    return () => {
      if (container.current) {
        delete container.current.dataset.initialized;
        const scripts = container.current.querySelectorAll("script");
        scripts.forEach((s) => s.remove());
      }
    };
  }, []);
  return /* @__PURE__ */ jsx("div", { className: "tradingview-widget-container w-full", ref: container, children: /* @__PURE__ */ jsx("div", { className: "tradingview-widget-container__widget" }) });
}
__name(StockScreener, "StockScreener");
var StockScreener_default = memo(StockScreener);

export { StockScreener_default as default };
