import { a0 as o, w as u, ct as v, bL as w, bB as P, cu as V, bv as i, bM as p, cA as m, U as S, V as l, P as a, bh as y, bi as n, bj as r, bg as b, bl as E, bn as R, bo as s, bG as h, eq as T, er as k, es as x } from "./684d2f28.js";
import { useContext as f, useRef as D, useState as M } from "react";
import { mediaCommonChildren as B, mediaMethods as I } from "./62fcc7e8.js";
import "react-dom";
const U = [{
  label: o("video.play"),
  value: "play",
  description: o("video.playDesc")
}, {
  label: o("video.pause"),
  value: "pause",
  description: o("video.pauseDesc")
}, {
  label: o("video.load"),
  value: "load",
  description: o("video.loadDesc")
}, {
  label: o("video.ended"),
  value: "ended",
  description: o("video.endedDesc")
}], j = (e) => {
  const t = D(null);
  let [C, g] = M(!1);
  return /* @__PURE__ */ l(T, {
    ref: e.containerRef,
    children: /* @__PURE__ */ l(k, {
      config: {
        file: {
          forceVideo: !0
        }
      },
      light: e.autoPlay ? "" : e.poster.value,
      ref: (c) => {
        e.viewRef(c), t.current = c;
      },
      url: e.src.value,
      onPlay: () => e.onEvent("play"),
      onReady: () => {
        t.current != null && e.duration.onChange(t.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: () => {
        g(!0);
      },
      draggable: !1,
      playIcon: x(),
      playing: e.autoPlay || C,
      onProgress: () => {
        t.current != null && e.currentTimeStamp.onChange(t.current.getCurrentTime());
      }
    })
  });
}, H = {
  src: u(v, o("video.defaultSrcUrl")),
  poster: u(v, o("video.defaultPosterUrl")),
  onEvent: w(U),
  style: P(V),
  autoPlay: i,
  loop: i,
  controls: i,
  volume: p.closed(0, 1, 1),
  playbackRate: p.closed(1, 2, 1),
  currentTimeStamp: m("currentTimeStamp", 0),
  duration: m("duration"),
  ...B
};
let d = function() {
  return new S(H, (e) => /* @__PURE__ */ l(j, {
    ...e
  })).setPropertyViewFn((e) => /* @__PURE__ */ a(y, {
    children: [/* @__PURE__ */ l(n, {
      name: r.basic,
      children: e.src.propertyView({
        label: o("video.src"),
        tooltip: o("video.srcDesc")
      })
    }), (f(b).editorModeStatus === "logic" || f(b).editorModeStatus === "both") && /* @__PURE__ */ a(y, {
      children: [/* @__PURE__ */ a(n, {
        name: r.interaction,
        children: [e.onEvent.getPropertyView(), E(e)]
      }), /* @__PURE__ */ a(n, {
        name: r.advanced,
        children: [e.poster.propertyView({
          label: o("video.poster"),
          tooltip: o("video.posterTooltip")
        }), e.volume.propertyView({
          label: o("video.volume"),
          tooltip: o("video.volumeTooltip")
        }), e.playbackRate.propertyView({
          label: o("video.playbackRate"),
          tooltip: o("video.playbackRateTooltip")
        }), e.autoPlay.propertyView({
          label: o("video.autoPlay"),
          tooltip: o("video.autoPlayTooltip")
        }), e.loop.propertyView({
          label: o("video.loop")
        }), e.controls.propertyView({
          label: o("video.controls"),
          tooltip: o("video.controlsTooltip")
        })]
      })]
    })]
  })).setExposeMethodConfigs(I()).build();
}();
d = class extends d {
  autoHeight() {
    return !1;
  }
};
const G = R(d, [new s("src", o("video.srcDesc")), new s("currentTimeStamp", o("video.currentTimeStamp")), new s("duration", o("video.duration")), h]);
export {
  G as VideoComp
};
