import { Component, useField, SugaredField } from "@contember/binding";
import { FieldFallbackView } from "./FieldFallbackView.js";
import { jsxDEV, Fragment } from "react/jsx-dev-runtime";
var _jsxFileName = "/__w/interface/interface/packages/admin/src/components/bindingFacade/fieldViews/VideoFieldView.tsx";
const VideoFieldView = Component(({
  srcField,
  titleField,
  formatUrl,
  fallback,
  fallbackStyle,
  ...videoProps
}) => {
  const srcAccessor = useField(srcField);
  const titleAccessor = useField(titleField);
  if (srcAccessor.value === null) {
    return /* @__PURE__ */ jsxDEV(FieldFallbackView, {
      fallback,
      fallbackStyle
    }, void 0, false, {
      fileName: _jsxFileName,
      lineNumber: 26,
      columnNumber: 11
    }, void 0);
  }
  return /* @__PURE__ */ jsxDEV("video", {
    src: formatUrl ? formatUrl(srcAccessor.value) : srcAccessor.value,
    title: titleAccessor?.value || void 0,
    controls: true,
    ...videoProps
  }, void 0, false, {
    fileName: _jsxFileName,
    lineNumber: 30,
    columnNumber: 4
  }, void 0);
}, ({
  srcField,
  titleField,
  fallback,
  fallbackStyle
}) => /* @__PURE__ */ jsxDEV(Fragment, {
  children: [/* @__PURE__ */ jsxDEV(SugaredField, {
    field: srcField
  }, void 0, false, {
    fileName: _jsxFileName,
    lineNumber: 40,
    columnNumber: 4
  }, void 0), titleField && /* @__PURE__ */ jsxDEV(SugaredField, {
    field: titleField
  }, void 0, false, {
    fileName: _jsxFileName,
    lineNumber: 41,
    columnNumber: 19
  }, void 0), /* @__PURE__ */ jsxDEV(FieldFallbackView, {
    fallback,
    fallbackStyle
  }, void 0, false, {
    fileName: _jsxFileName,
    lineNumber: 42,
    columnNumber: 4
  }, void 0)]
}, void 0, true), "VideoFieldView");
export {
  VideoFieldView
};
//# sourceMappingURL=VideoFieldView.js.map
