import { Y as t, X as S, w as u, cI as v, a2 as V, Z as y, eq as h, az as P, O as r, c1 as m, cJ as p, U as E, F as a, a6 as i, G as f, a7 as n, a8 as l, af as g, a9 as R, aa as x, ac as s, ab as T, er as k, es as D } from "./603b75d9.js";
import { useContext as b, useRef as $, useState as M } from "react";
import { mediaCommonChildren as j, mediaMethods as I } from "./f1dd0ef6.js";
import "react-dom";
const U = [{
  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")
}], B = 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;
    }
  }
`, F = (e) => {
  const o = $(null);
  let [C, w] = M(!1);
  return /* @__PURE__ */ a(B, {
    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 || C,
      onProgress: () => {
        o.current != null && e.currentTimeStamp.onChange(o.current.getCurrentTime());
      }
    })
  });
}, H = {
  src: u(v, t("video.defaultSrcUrl")),
  poster: u(v, t("video.defaultPosterUrl")),
  onEvent: V(U),
  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"),
  ...j
};
let d = function() {
  return new E(H, (e) => /* @__PURE__ */ a(F, {
    ...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")
      })
    }), (b(g).editorModeStatus === "logic" || b(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(I()).build();
}();
d = class extends d {
  autoHeight() {
    return !1;
  }
};
const A = x(d, [new s("src", t("video.srcDesc")), new s("currentTimeStamp", t("video.currentTimeStamp")), new s("duration", t("video.duration")), T]);
export {
  A as VideoComp
};
