import { a4 as t, a3 as S, w as u, d0 as v, a9 as V, a5 as y, ez as h, aG as P, V as r, ce as m, d1 as p, U as E, H as a, ad as i, I as f, ae as n, af as l, am as g, ag as R, ah as x, aj as s, ai as T, eA as k, eB as D } from "./56c67d3b.js";
import { useContext as C, useRef as $, useState as j } from "react";
import { mediaCommonChildren as M, mediaMethods as B } from "./4afc263f.js";
import "react-dom";
const H = [{
  label: t("video.play"),
  value: "play",
  description: t("video.playDesc")
}, {
  label: t("video.pause"),
  value: "pause",
  description: t("video.pauseDesc")
}, {
  label: t("video.load"),
  value: "load",
  description: t("video.loadDesc")
}, {
  label: t("video.ended"),
  value: "ended",
  description: t("video.endedDesc")
}], I = S.div`
${(e) => e.$style};
rotate:${(e) => e.$style.rotation};
${(e) => e.$animationStyle};
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;

  div > video {
    object-fit: contain;
    pointer-events: auto;
    height: 100%;
    width: 100%;
    :focus-visible {
      outline: 0px;
    }
  }
`, U = (e) => {
  const o = $(null);
  let [b, w] = j(!1);
  return /* @__PURE__ */ a(I, {
    ref: e.containerRef,
    $style: e.style,
    $animationStyle: e.animationStyle,
    children: /* @__PURE__ */ a(k, {
      config: {
        file: {
          forceVideo: !0
        }
      },
      light: e.autoPlay ? "" : e.poster.value,
      ref: (c) => {
        e.viewRef(c), o.current = c;
      },
      url: e.src.value,
      onPlay: () => e.onEvent("play"),
      onReady: () => {
        o.current != null && e.duration.onChange(o.current.getDuration()), e.onEvent("load");
      },
      onPause: () => e.onEvent("pause"),
      onEnded: () => e.onEvent("ended"),
      loop: e.loop,
      controls: !e.controls,
      volume: e.volume,
      style: e.style,
      playbackRate: e.playbackRate,
      onClickPreview: () => {
        w(!0);
      },
      draggable: !1,
      playIcon: D(),
      playing: e.autoPlay || b,
      onProgress: () => {
        o.current != null && e.currentTimeStamp.onChange(o.current.getCurrentTime());
      }
    })
  });
}, N = {
  src: u(v, t("video.defaultSrcUrl")),
  poster: u(v, t("video.defaultPosterUrl")),
  onEvent: V(H),
  style: y(h, "style"),
  animationStyle: y(P, "animationStyle"),
  autoPlay: r,
  loop: r,
  controls: r,
  volume: m.closed(0, 1, 1),
  playbackRate: m.closed(1, 2, 1),
  currentTimeStamp: p("currentTimeStamp", 0),
  duration: p("duration"),
  ...M
};
let d = function() {
  return new E(N, (e) => /* @__PURE__ */ a(U, {
    ...e
  })).setPropertyViewFn((e) => /* @__PURE__ */ i(f, {
    children: [/* @__PURE__ */ a(n, {
      name: l.basic,
      children: e.src.propertyView({
        label: t("video.src"),
        tooltip: t("video.srcDesc")
      })
    }), (C(g).editorModeStatus === "logic" || C(g).editorModeStatus === "both") && /* @__PURE__ */ i(f, {
      children: [/* @__PURE__ */ i(n, {
        name: l.interaction,
        children: [e.onEvent.getPropertyView(), R(e)]
      }), /* @__PURE__ */ i(n, {
        name: l.advanced,
        children: [e.poster.propertyView({
          label: t("video.poster"),
          tooltip: t("video.posterTooltip")
        }), e.volume.propertyView({
          label: t("video.volume"),
          tooltip: t("video.volumeTooltip")
        }), e.playbackRate.propertyView({
          label: t("video.playbackRate"),
          tooltip: t("video.playbackRateTooltip")
        }), e.autoPlay.propertyView({
          label: t("video.autoPlay"),
          tooltip: t("video.autoPlayTooltip")
        }), e.loop.propertyView({
          label: t("video.loop")
        }), e.controls.propertyView({
          label: t("video.controls"),
          tooltip: t("video.controlsTooltip")
        })]
      }), /* @__PURE__ */ a(n, {
        name: l.style,
        children: e.style.getPropertyView()
      })]
    })]
  })).setExposeMethodConfigs(B()).build();
}();
d = class extends d {
  autoHeight() {
    return !1;
  }
};
const O = x(d, [new s("src", t("video.srcDesc")), new s("currentTimeStamp", t("video.currentTimeStamp")), new s("duration", t("video.duration")), T]);
export {
  O as VideoComp
};
