import { jsxDEV } from "react/jsx-dev-runtime";
import { SugaredField, QueryLanguage } from "@contember/react-binding";
const getFileUrlDataExtractor = ({ urlField }) => ({
  staticRender: () => /* @__PURE__ */ jsxDEV(SugaredField, { field: urlField }, void 0, false, {
    fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/upload/fileDataExtractors/getFileUrlDataExtractor.tsx",
    lineNumber: 13,
    columnNumber: 22
  }, void 0),
  populateFields: ({ entity, uploadResult }) => {
    if (!uploadResult.fileUrl || typeof uploadResult.fileUrl !== "string") {
      return;
    }
    entity.getField(urlField).updateValue(uploadResult.fileUrl);
  },
  getErrorsHolders: ({ entity, environment }) => {
    const desugaredUrlField = QueryLanguage.desugarRelativeSingleField(urlField, environment);
    const owningEntity = entity.getRelativeSingleEntity({
      hasOneRelationPath: desugaredUrlField.hasOneRelationPath
    });
    return [entity.getField(urlField), owningEntity];
  }
});
export {
  getFileUrlDataExtractor
};
//# sourceMappingURL=getFileUrlDataExtractor.js.map
