import { jsxDEV } from "react/jsx-dev-runtime";
import { Component, useEnvironment } from "@contember/react-binding";
import { BareUploadField } from "./BareUploadField.js";
import { useResolvedSingleKindFileSelection } from "./selection/useResolvedSingleKindFileSelection.js";
import { createEntityConnectorFactory } from "../fileHandler/utils/createEntityConnector.js";
import { useCallback } from "react";
import { useSingleKindFileHandler } from "../fileHandler/useSingleKindFileHandler.js";
import { SingleKindFileHandler, isEmptyByUrlField } from "../fileHandler/SingleKindFileHandler.js";
const SingleKindUploadField = Component(
  (props) => {
    const env = useEnvironment();
    const connectorFactoryFactory = useCallback(
      () => createEntityConnectorFactory(env, props.baseEntity),
      [env, props.baseEntity]
    );
    return /* @__PURE__ */ jsxDEV(
      BareUploadField,
      {
        ...props,
        fileSelection: useResolvedSingleKindFileSelection(props, connectorFactoryFactory),
        fileHandler: useSingleKindFileHandler(props, props.kindFactory)
      },
      void 0,
      false,
      {
        fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/upload/internalComponents/SingleKindUploadField.tsx",
        lineNumber: 29,
        columnNumber: 4
      },
      void 0
    );
  },
  (props) => /* @__PURE__ */ jsxDEV(
    BareUploadField,
    {
      ...props,
      fileHandler: new SingleKindFileHandler(
        props.kindFactory(props),
        isEmptyByUrlField(props.urlField)
      )
    },
    void 0,
    false,
    {
      fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/upload/internalComponents/SingleKindUploadField.tsx",
      lineNumber: 37,
      columnNumber: 3
    },
    void 0
  ),
  "SingleKindUploadField"
);
export {
  SingleKindUploadField
};
//# sourceMappingURL=SingleKindUploadField.js.map
