import { useEffect } from "react";
import usePosthog from "../../hooks/use-posthog";
var posthog = usePosthog();
export default (function (udt) {
  var udtInterface = udt === null || udt === void 0 ? void 0 : udt.interface;
  useEffect(function () {
    if (!udtInterface) return;
    posthog.capture("interface_type", {
      interface_type: udtInterface.type
    });
    posthog.people.set({
      last_used_interface_type: udtInterface.type
    });
  }, [udtInterface]);
  var udtSamples = udt === null || udt === void 0 ? void 0 : udt.samples;
  var usedToyDataset = udt === null || udt === void 0 ? void 0 : udt.usedToyDataset;
  useEffect(function () {
    if (!udtSamples) return;
    var numCompleted = (udtSamples || []).filter(function (s) {
      return s.annotation;
    }).length;
    posthog.capture("samples_updated", {
      dataset_size: (udtSamples || []).length,
      samples_completed: numCompleted,
      percent_completed: numCompleted / (udtSamples || []).length,
      toy_dataset_used: Boolean(usedToyDataset)
    });
    posthog.people.set({
      recently_used_toy_dataset: Boolean(usedToyDataset)
    });
  }, [udtSamples, usedToyDataset]);
});