import { useEnvironment, VariableInputTransformer } from "@contember/react-binding";
import { useMemo } from "react";
const useDiscriminatedData = (source) => {
  const environment = useEnvironment();
  return useMemo(() => {
    const normalized = /* @__PURE__ */ new Map();
    for (const datum of source) {
      const value = VariableInputTransformer.transformValue(datum.discriminateBy, environment);
      normalized.set(value, {
        discriminateBy: value,
        datum
      });
    }
    return normalized;
  }, [environment, source]);
};
export {
  useDiscriminatedData
};
//# sourceMappingURL=useDiscriminatedData.js.map
