"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const reactBinding = require("@contember/react-binding");
const react = require("react");
const useDiscriminatedData = (source) => {
  const environment = reactBinding.useEnvironment();
  return react.useMemo(() => {
    const normalized = /* @__PURE__ */ new Map();
    for (const datum of source) {
      const value = reactBinding.VariableInputTransformer.transformValue(datum.discriminateBy, environment);
      normalized.set(value, {
        discriminateBy: value,
        datum
      });
    }
    return normalized;
  }, [environment, source]);
};
exports.useDiscriminatedData = useDiscriminatedData;
//# sourceMappingURL=useDiscriminatedData.cjs.map
