import { jsx as s } from "react/jsx-runtime";
import { useLocation as m } from "react-router-dom";
import { useMount as f, useDeepCompareEffect as d } from "ahooks";
import a from "react-ga4";
const v = (i) => {
  const n = window.blocklet?.GA_MEASUREMENT_ID || "", r = (o, e = document.title) => {
    !process.env.NODE_ENV || process.env.NODE_ENV === "development" || n && a.send({ hitType: "pageview", page: o, title: e });
  }, c = (o, e, t, p) => {
    n && a.event({ category: o, action: e, label: t, value: p, transport: "beacon" });
  };
  return n && a.initialize(n), window.trackPage = r, window.trackEvent = c, function(e) {
    const t = m();
    return f(() => {
      r(t.pathname);
    }), d(() => {
      r(t.pathname);
    }, [t.pathname]), /* @__PURE__ */ s(i, { ...e });
  };
};
export {
  v as default
};
