import '@das-fed/ui/packages/business-components/video-dialog/style.css';
import { getCurrentScope as ue, onScopeDispose as de, getCurrentInstance as pe, onMounted as te, nextTick as x, unref as l, ref as w, watch as S, defineComponent as U, useCssVars as ve, computed as P, createElementBlock as z, openBlock as v, normalizeClass as fe, renderSlot as oe, createCommentVNode as I, Fragment as B, renderList as me, createBlock as R, withCtx as C, withModifiers as h, createVNode as f, createElementVNode as m, toDisplayString as j, toRefs as ge, mergeProps as Ce } from "vue";
import { withInstall as ye } from "@das-fed/utils/with-install/index";
import { t as y, setI18nRule as ke } from "@das-fed/web/packages/i18n/index";
import { DasDialog as he } from "@das-fed/ui/packages/components/dialog/index";
import { DasTooltip as _ } from "@das-fed/ui/packages/components/tooltip/index";
import { DasIconFullscreen2 as we } from "@das-fed/ui/packages/icons/fullscreen-2/index";
import { DasAutoRegisterIcon as _e, DasIcon as $ } from "@das-fed/ui/packages/components/icon/index";
import { DasLivePlayer as be } from "@das-fed/ui/packages/components/live-player/index";
import { DasSpin as Ie } from "@das-fed/ui/packages/components/spin/index";
import { DasHlsPlayer as Ee } from "@das-fed/ui/packages/components/hls-player/index";
import Re from "dayjs";
import { createService as M } from "@das-fed/utils/api-services/src/create-service";
import { getProjectInfo as q, getToken as Ne } from "@das-fed/utils/common-info";
var G;
const A = typeof window < "u", Se = (t) => typeof t == "string", ze = () => {
};
A && ((G = window == null ? void 0 : window.navigator) != null && G.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
function ne(t) {
  return typeof t == "function" ? t() : l(t);
}
function Fe(t) {
  return t;
}
function le(t) {
  return ue() ? (de(t), !0) : !1;
}
function Le(t, n = !0) {
  pe() ? te(t) : n ? t() : x(t);
}
function ie(t) {
  var n;
  const e = ne(t);
  return (n = e == null ? void 0 : e.$el) != null ? n : e;
}
const Oe = A ? window : void 0, Ue = A ? window.document : void 0;
function De(...t) {
  let n, e, i, r;
  if (Se(t[0]) || Array.isArray(t[0]) ? ([e, i, r] = t, n = Oe) : [n, e, i, r] = t, !n)
    return ze;
  Array.isArray(e) || (e = [e]), Array.isArray(i) || (i = [i]);
  const o = [], c = () => {
    o.forEach((a) => a()), o.length = 0;
  }, g = (a, p, k, b) => (a.addEventListener(p, k, b), () => a.removeEventListener(p, k, b)), u = S(() => [ie(n), ne(r)], ([a, p]) => {
    c(), a && o.push(...e.flatMap((k) => i.map((b) => g(a, k, b, p))));
  }, { immediate: !0, flush: "post" }), s = () => {
    u(), c();
  };
  return le(s), s;
}
function $e(t, n = !1) {
  const e = w(), i = () => e.value = !!t();
  return i(), Le(i, n), e;
}
const W = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Y = "__vueuse_ssr_handlers__";
W[Y] = W[Y] || {};
const Z = [
  [
    "requestFullscreen",
    "exitFullscreen",
    "fullscreenElement",
    "fullscreenEnabled",
    "fullscreenchange",
    "fullscreenerror"
  ],
  [
    "webkitRequestFullscreen",
    "webkitExitFullscreen",
    "webkitFullscreenElement",
    "webkitFullscreenEnabled",
    "webkitfullscreenchange",
    "webkitfullscreenerror"
  ],
  [
    "webkitRequestFullScreen",
    "webkitCancelFullScreen",
    "webkitCurrentFullScreenElement",
    "webkitCancelFullScreen",
    "webkitfullscreenchange",
    "webkitfullscreenerror"
  ],
  [
    "mozRequestFullScreen",
    "mozCancelFullScreen",
    "mozFullScreenElement",
    "mozFullScreenEnabled",
    "mozfullscreenchange",
    "mozfullscreenerror"
  ],
  [
    "msRequestFullscreen",
    "msExitFullscreen",
    "msFullscreenElement",
    "msFullscreenEnabled",
    "MSFullscreenChange",
    "MSFullscreenError"
  ]
];
function ae(t, n = {}) {
  const { document: e = Ue, autoExit: i = !1 } = n, r = t || (e == null ? void 0 : e.querySelector("html")), o = w(!1);
  let c = Z[0];
  const g = $e(() => {
    if (e) {
      for (const N of Z)
        if (N[1] in e)
          return c = N, !0;
    } else
      return !1;
    return !1;
  }), [u, s, a, , p] = c;
  async function k() {
    g.value && (e != null && e[a] && await e[s](), o.value = !1);
  }
  async function b() {
    if (!g.value)
      return;
    await k();
    const N = ie(r);
    N && (await N[u](), o.value = !0);
  }
  async function F() {
    o.value ? await k() : await b();
  }
  return e && De(e, p, () => {
    o.value = !!(e != null && e[a]);
  }, !1), i && le(k), {
    isSupported: g,
    isFullscreen: o,
    enter: b,
    exit: k,
    toggle: F
  };
}
var K;
(function(t) {
  t.UP = "UP", t.RIGHT = "RIGHT", t.DOWN = "DOWN", t.LEFT = "LEFT", t.NONE = "NONE";
})(K || (K = {}));
var Pe = Object.defineProperty, X = Object.getOwnPropertySymbols, Te = Object.prototype.hasOwnProperty, xe = Object.prototype.propertyIsEnumerable, J = (t, n, e) => n in t ? Pe(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e, Be = (t, n) => {
  for (var e in n || (n = {}))
    Te.call(n, e) && J(t, e, n[e]);
  if (X)
    for (var e of X(n))
      xe.call(n, e) && J(t, e, n[e]);
  return t;
};
const He = {
  easeInSine: [0.12, 0, 0.39, 0],
  easeOutSine: [0.61, 1, 0.88, 1],
  easeInOutSine: [0.37, 0, 0.63, 1],
  easeInQuad: [0.11, 0, 0.5, 0],
  easeOutQuad: [0.5, 1, 0.89, 1],
  easeInOutQuad: [0.45, 0, 0.55, 1],
  easeInCubic: [0.32, 0, 0.67, 0],
  easeOutCubic: [0.33, 1, 0.68, 1],
  easeInOutCubic: [0.65, 0, 0.35, 1],
  easeInQuart: [0.5, 0, 0.75, 0],
  easeOutQuart: [0.25, 1, 0.5, 1],
  easeInOutQuart: [0.76, 0, 0.24, 1],
  easeInQuint: [0.64, 0, 0.78, 0],
  easeOutQuint: [0.22, 1, 0.36, 1],
  easeInOutQuint: [0.83, 0, 0.17, 1],
  easeInExpo: [0.7, 0, 0.84, 0],
  easeOutExpo: [0.16, 1, 0.3, 1],
  easeInOutExpo: [0.87, 0, 0.13, 1],
  easeInCirc: [0.55, 0, 1, 0.45],
  easeOutCirc: [0, 0.55, 0.45, 1],
  easeInOutCirc: [0.85, 0, 0.15, 1],
  easeInBack: [0.36, 0, 0.66, -0.56],
  easeOutBack: [0.34, 1.56, 0.64, 1],
  easeInOutBack: [0.68, -0.6, 0.32, 1.6]
};
Be({
  linear: Fe
}, He);
const Ve = /* @__PURE__ */ U({
  __name: "GridItem",
  props: {
    active: { type: Boolean },
    gridNum: {}
  },
  emits: ["itemClick"],
  setup(t, { emit: n }) {
    ve((s) => ({
      a769b0be: u.value
    }));
    const e = t, i = n, r = w(), { toggle: o } = ae(r), c = () => {
      o();
    }, g = () => {
      i("itemClick");
    }, u = P(() => `calc(100% / ${Math.sqrt(e.gridNum)})`);
    return (s, a) => (v(), z(
      "div",
      {
        ref_key: "containerRef",
        ref: r,
        class: fe(["wrapper", { "is-active": e.active }]),
        onDblclick: a[0] || (a[0] = (p) => c()),
        onClick: a[1] || (a[1] = (p) => g())
      },
      [
        oe(s.$slots, "default", {}, void 0, !0)
      ],
      34
      /* CLASS, NEED_HYDRATION */
    ));
  }
}), H = (t, n) => {
  const e = t.__vccOpts || t;
  for (const [i, r] of n)
    e[i] = r;
  return e;
}, je = /* @__PURE__ */ H(Ve, [["__scopeId", "data-v-97d987a9"]]), Me = { class: "layout-wrapper" }, Ae = /* @__PURE__ */ U({
  __name: "GridLayout",
  props: {
    gridNum: {},
    activeIndex: { default: 0 },
    showFn: {}
  },
  emits: ["update:activeIndex"],
  setup(t, { emit: n }) {
    const e = t, i = n, r = (o) => {
      i("update:activeIndex", o);
    };
    return (o, c) => (v(), z("div", Me, [
      I(' :active="index === activeIndex" '),
      (v(!0), z(
        B,
        null,
        me(e.gridNum, (g, u) => (v(), R(je, {
          active: !1,
          "grid-num": e.gridNum,
          onItemClick: (s) => r(u)
        }, {
          default: C(() => [
            o.showFn(u) ? oe(o.$slots, "default", {
              key: 0,
              index: u
            }, void 0, !0) : I("v-if", !0)
          ]),
          _: 2
          /* DYNAMIC */
        }, 1032, ["grid-num", "onItemClick"]))),
        256
        /* UNKEYED_FRAGMENT */
      ))
    ]));
  }
}), Qe = /* @__PURE__ */ H(Ae, [["__scopeId", "data-v-661e2289"]]), qe = /* @__PURE__ */ U({
  __name: "DirectionControl",
  emits: ["change"],
  setup(t, { emit: n }) {
    const e = n, i = (r) => {
      e("change", r);
    };
    return (r, o) => (v(), z(
      "div",
      {
        class: "direction-control",
        onDblclick: o[9] || (o[9] = h((c) => c.stopPropagation(), ["stop"]))
      },
      [
        f(l(_), {
          content: l(y)("左上")
        }, {
          default: C(() => [
            m("div", {
              class: "icon icon-top-left",
              onClick: o[0] || (o[0] = h((c) => i("leftUp"), ["stop"]))
            })
          ]),
          _: 1
          /* STABLE */
        }, 8, ["content"]),
        f(l(_), {
          content: l(y)("上")
        }, {
          default: C(() => [
            m("div", {
              class: "icon icon-top",
              onClick: o[1] || (o[1] = h((c) => i("up"), ["stop"]))
            })
          ]),
          _: 1
          /* STABLE */
        }, 8, ["content"]),
        f(l(_), {
          content: l(y)("右上")
        }, {
          default: C(() => [
            m("div", {
              class: "icon icon-top-right",
              onClick: o[2] || (o[2] = h((c) => i("rightUp"), ["stop"]))
            })
          ]),
          _: 1
          /* STABLE */
        }, 8, ["content"]),
        f(l(_), {
          content: l(y)("左")
        }, {
          default: C(() => [
            m("div", {
              class: "icon icon-left",
              onClick: o[3] || (o[3] = h((c) => i("left"), ["stop"]))
            })
          ]),
          _: 1
          /* STABLE */
        }, 8, ["content"]),
        f(l(_), {
          content: l(y)("自动")
        }, {
          default: C(() => [
            m("div", {
              class: "icon icon-auto",
              onClick: o[4] || (o[4] = h((c) => i("auto"), ["stop"]))
            })
          ]),
          _: 1
          /* STABLE */
        }, 8, ["content"]),
        f(l(_), {
          content: l(y)("右")
        }, {
          default: C(() => [
            m("div", {
              class: "icon icon-right",
              onClick: o[5] || (o[5] = h((c) => i("right"), ["stop"]))
            })
          ]),
          _: 1
          /* STABLE */
        }, 8, ["content"]),
        f(l(_), {
          content: l(y)("左下")
        }, {
          default: C(() => [
            m("div", {
              class: "icon icon-bottom-left",
              onClick: o[6] || (o[6] = h((c) => i("leftDown"), ["stop"]))
            })
          ]),
          _: 1
          /* STABLE */
        }, 8, ["content"]),
        f(l(_), {
          content: l(y)("下")
        }, {
          default: C(() => [
            m("div", {
              class: "icon icon-bottom",
              onClick: o[7] || (o[7] = h((c) => i("down"), ["stop"]))
            })
          ]),
          _: 1
          /* STABLE */
        }, 8, ["content"]),
        f(l(_), {
          content: l(y)("右下")
        }, {
          default: C(() => [
            m("div", {
              class: "icon icon-bottom-right",
              onClick: o[8] || (o[8] = h((c) => i("rightDown"), ["stop"]))
            })
          ]),
          _: 1
          /* STABLE */
        }, 8, ["content"])
      ],
      32
      /* NEED_HYDRATION */
    ));
  }
}), Ge = /* @__PURE__ */ H(qe, [["__scopeId", "data-v-db2e8ec2"]]), We = { class: "video-wrapper" }, Ye = { class: "video-top" }, Ze = { class: "video-top_l" }, Ke = { class: "video-title-wrapper" }, Xe = { class: "video-title" }, Je = { class: "video-top_r" }, et = {
  key: 0,
  class: "play-status"
}, tt = { class: "video-bottom" }, ot = { class: "video-bottom_r" }, nt = /* @__PURE__ */ U({
  __name: "index",
  props: {
    videoUrl: {},
    title: {},
    type: {},
    loading: { type: Boolean },
    isFullscreen: { type: Boolean },
    playbackRate: { default: 1 },
    paused: { type: Boolean, default: !1 },
    authType: { default: () => [] },
    isHls: { type: Boolean, default: !1 },
    onReplay: {}
  },
  emits: ["close", "directionControl", "zoomControl", "handleClick"],
  setup(t, { emit: n }) {
    const e = t, i = n;
    _e({
      muted: import("@das-fed/ui/packages/icons/muted"),
      volume: import("@das-fed/ui/packages/icons/volume"),
      shrink: import("@das-fed/ui/packages/icons/shrink"),
      enlarge: import("@das-fed/ui/packages/icons/enlarge"),
      "direction-control": import("@das-fed/ui/packages/icons/direction-control"),
      screenshot: import("@das-fed/ui/packages/icons/screenshot")
    });
    const r = w(!0), o = w(), c = w(!1), g = w(), u = P(() => {
      var d;
      return (d = g.value) == null ? void 0 : d.video;
    }), s = w(!1), a = w(!0), p = (d) => {
      o.value = d, !e.isHls && o.value.on(window.mpegts.Events.ERROR, (E) => {
      });
    }, k = () => {
      r.value = !r.value, i("handleClick", r.value ? "MUTE" : "UNMUTE"), o.value && (o.value.muted = r.value);
    }, b = () => {
      c.value = !c.value;
    }, F = w(""), N = () => {
      const d = document.createElement("canvas");
      if (i("handleClick", "SCREENSHOT"), u.value) {
        d.width = u.value.clientWidth, d.height = u.value.clientHeight;
        const E = d.getContext("2d");
        E == null || E.drawImage(u.value, 0, 0, d.width, d.height);
        const O = d.toDataURL("image/jpg"), ce = `【${e.title}】${Re().format("YYYYMMDDHHmmss").toString()}.jpg`;
        if (F.value = O, "download" in document.createElement("a")) {
          const L = document.createElement("a");
          L.download = ce, L.style.display = "none", L.href = O, document.body.appendChild(L), document.body.appendChild(d), L.click(), URL.revokeObjectURL(L.href), document.body.removeChild(L), document.body.removeChild(d);
        }
      }
    }, V = (d) => {
      i("directionControl", d);
    }, T = (d) => {
      i("zoomControl", d);
    }, D = (d) => e.authType.includes(d);
    return S(
      () => u.value,
      () => {
        u.value && u.value.addEventListener("ended", () => {
          s.value = !0, e.type === "playback" && (a.value = !1);
        });
      }
    ), S(
      () => u.value,
      () => {
        u.value && x(() => {
          u.value.playbackRate = e.playbackRate || 1;
        });
      }
    ), S(
      () => o.value,
      () => {
        o.value && x(() => {
          o.value.muted = r.value;
        });
      }
    ), S(
      () => e.playbackRate,
      () => {
        u.value && (u.value.playbackRate = e.playbackRate || 1);
      },
      {
        immediate: !0
      }
    ), S(
      () => e.paused,
      () => {
        o.value && (e.paused ? o.value.pause() : o.value.play());
      }
    ), S(
      () => e.videoUrl,
      () => {
        a.value = !1, x(() => {
          a.value = !0;
        });
      }
    ), (d, E) => (v(), z("div", We, [
      f(l(Ie), {
        spinning: e.loading,
        type: "component",
        tip: l(y)("加载中...")
      }, {
        default: C(() => [
          m("div", Ye, [
            m("div", Ze, [
              m("div", Ke, [
                m(
                  "div",
                  Xe,
                  j(e.title.length > 20 ? e.title.slice(0, 19) + "..." : e.title),
                  1
                  /* TEXT */
                )
              ])
            ]),
            m("div", Je, [
              ["live"].includes(d.type) ? (v(), z(
                "span",
                et,
                j(l(y)("正在实时预览")),
                1
                /* TEXT */
              )) : I("v-if", !0),
              I(' <das-icon v-if="isFullscreen" class="icon close-icon" icon="close" @click.stop="handleClose"></das-icon> ')
            ])
          ]),
          d.isHls ? (v(), z(
            B,
            { key: 1 },
            [
              e.videoUrl && a.value ? (v(), R(l(Ee), {
                key: 0,
                ref_key: "dasLivePlayerRef",
                ref: g,
                muted: r.value,
                onLoaded: p,
                src: e.videoUrl
              }, null, 8, ["muted", "src"])) : I("v-if", !0)
            ],
            64
            /* STABLE_FRAGMENT */
          )) : (v(), z(
            B,
            { key: 0 },
            [
              e.videoUrl && a.value ? (v(), R(l(be), {
                key: 0,
                type: "flv",
                ref_key: "dasLivePlayerRef",
                ref: g,
                muted: r.value,
                onLoaded: p,
                src: e.videoUrl
              }, null, 8, ["muted", "src"])) : I("v-if", !0)
            ],
            64
            /* STABLE_FRAGMENT */
          )),
          m("div", tt, [
            E[3] || (E[3] = m(
              "div",
              { class: "video-bottom_l" },
              null,
              -1
              /* CACHED */
            )),
            m("div", ot, [
              m(
                "div",
                {
                  class: "controls",
                  onDblclick: E[2] || (E[2] = h((O) => O.stopPropagation(), ["stop"]))
                },
                [
                  f(l(_), {
                    content: l(y)("声音")
                  }, {
                    default: C(() => [
                      f(l($), {
                        class: "icon icon-volume",
                        icon: r.value ? "muted" : "volume",
                        onClick: h(k, ["stop"])
                      }, null, 8, ["icon"])
                    ]),
                    _: 1
                    /* STABLE */
                  }, 8, ["content"]),
                  f(l(_), {
                    content: l(y)("截图")
                  }, {
                    default: C(() => [
                      f(l($), {
                        class: "icon icon-screenshot",
                        icon: "screenshot",
                        onClick: h(N, ["stop"])
                      })
                    ]),
                    _: 1
                    /* STABLE */
                  }, 8, ["content"]),
                  D("control") ? (v(), R(l(_), {
                    key: 0,
                    content: l(y)("聚焦-")
                  }, {
                    default: C(() => [
                      ["live", "polling"].includes(e.type) ? (v(), R(l($), {
                        key: 0,
                        class: "icon icon-shrink",
                        icon: "shrink",
                        onClick: E[0] || (E[0] = h((O) => T("zoomOut"), ["stop"]))
                      })) : I("v-if", !0)
                    ]),
                    _: 1
                    /* STABLE */
                  }, 8, ["content"])) : I("v-if", !0),
                  D("control") ? (v(), R(l(_), {
                    key: 1,
                    content: l(y)("聚焦+")
                  }, {
                    default: C(() => [
                      ["live", "polling"].includes(e.type) ? (v(), R(l($), {
                        key: 0,
                        class: "icon icon-enlarge",
                        icon: "enlarge",
                        onClick: E[1] || (E[1] = h((O) => T("zoomIn"), ["stop"]))
                      })) : I("v-if", !0)
                    ]),
                    _: 1
                    /* STABLE */
                  }, 8, ["content"])) : I("v-if", !0),
                  D("control") ? (v(), R(l(_), {
                    key: 2,
                    content: l(y)("方向控制")
                  }, {
                    default: C(() => [
                      ["live", "polling"].includes(e.type) ? (v(), R(l($), {
                        key: 0,
                        class: "icon icon-direction-control",
                        icon: "direction-control",
                        onClick: h(b, ["stop"])
                      })) : I("v-if", !0)
                    ]),
                    _: 1
                    /* STABLE */
                  }, 8, ["content"])) : I("v-if", !0)
                ],
                32
                /* NEED_HYDRATION */
              )
            ])
          ]),
          c.value ? (v(), R(Ge, {
            key: 2,
            onChange: V
          })) : I("v-if", !0)
        ]),
        _: 1
        /* STABLE */
      }, 8, ["spinning", "tip"])
    ]));
  }
}), lt = /* @__PURE__ */ H(nt, [["__scopeId", "data-v-4db322a4"]]), it = "/api/device-relation/deviceproject/v1/project/device/video", at = "v1", rt = M(`/api/enterpriseright/permission/${at}`);
let Q = M(`${it}`, re);
function re(t) {
  const n = q() ? q().id : 1;
  return t.params || (t.params = {}), t.params.project = n, t.params.projectId = n, t;
}
function se(t) {
  const n = new URLSearchParams("");
  for (let [e, i] of Object.entries(t))
    n.append(e, i);
  return n.toString();
}
function ee(t) {
  return Q.post(`/ptz?${se(t)}`)().run();
}
function st(t) {
  return Q.post(`/url/preview?${se(t)}`)().run();
}
rt.post("data/device-auth");
function ct(t) {
  return new Promise((n) => {
    Q = M(t, re), n("");
  });
}
const ut = (t) => {
  const n = Ne();
  return `${t}?token=${n}`;
};
w([]);
const dt = /* @__PURE__ */ U({
  props: {
    deviceInfo: {
      type: Object,
      required: !0
    },
    source: {
      type: String
    },
    isHls: {
      type: Boolean,
      default: !1
    },
    baseURL: {
      type: String
    }
  },
  setup(t, {
    slots: n
  }) {
    const {
      deviceInfo: e,
      source: i,
      isHls: r,
      baseURL: o
    } = ge(t), c = w(!1), g = w(""), u = async () => {
      var b;
      if (!((b = e.value) != null && b.deviceId)) return;
      c.value = !0;
      const [p, k] = await st({
        productId: e.value.productId,
        deviceId: e.value.deviceId,
        source: i.value
      });
      if (!p) {
        let F = r.value ? "httpHlsStreamURL" : "wsFlvStreamURL";
        g.value = ut(k == null ? void 0 : k[F]);
      }
      c.value = !1;
    }, s = (p) => {
      ee({
        productId: e.value.productId,
        deviceId: e.value.deviceId,
        direction: p,
        zoom: "",
        source: i.value || "web"
      });
    }, a = (p) => {
      ee({
        productId: e.value.productId,
        deviceId: e.value.deviceId,
        direction: "",
        zoom: p,
        source: i.value || "web"
      });
    };
    return te(async () => {
      o.value && await ct(o.value), u();
    }), S(() => e.value, () => {
      u();
    }, {
      deep: !0
    }), () => f(B, null, [n.default({
      videoUrl: g.value,
      loading: c.value,
      onDirectionControl: s,
      onZoomControl: a,
      isHls: r.value
    })]);
  }
});
function pt(t) {
  const n = w(0), e = w(), {
    toggle: i,
    isFullscreen: r,
    exit: o
  } = ae(e), c = (s, a) => {
    r.value && o();
  }, g = (s) => {
    var a;
    (a = t == null ? void 0 : t.handleClick) == null || a.call(t, s);
  };
  return {
    render: () => f(Qe, {
      ref: e,
      gridNum: t.gridNum,
      activeIndex: n.value,
      "onUpdate:activeIndex": (s) => n.value = s,
      showFn: (s) => !!t.deviceList[s]
    }, {
      default: ({
        index: s
      }) => {
        const a = t.deviceList[s], p = t.source, k = t.isHls, b = t.baseURL;
        return f(dt, {
          deviceInfo: a,
          baseURL: b,
          source: p,
          isHls: k
        }, {
          default: ({
            videoUrl: F,
            onDirectionControl: N,
            onZoomControl: V,
            loading: T,
            isHls: D
          }) => f(lt, {
            type: "live",
            loading: T,
            isFullscreen: r.value,
            videoUrl: F,
            title: a.deviceName,
            onClose: () => c(),
            onDirectionControl: N,
            onZoomControl: V,
            onHandleClick: g,
            authType: a.authType === 2 ? ["control"] : [],
            isHls: D
          }, null)
        });
      }
    }),
    toggleFullscreen: i
  };
}
const vt = /* @__PURE__ */ U({
  __name: "index",
  props: {
    visible: { type: Boolean, default: !1 },
    deviceList: { default: () => [] },
    gridNum: { default: 4 },
    source: {},
    isHls: { type: Boolean, default: !1 },
    draggable: { type: Boolean, default: !0 },
    resizable: { type: Boolean, default: !0 },
    dialogTitle: { default: "" },
    baseURL: { default: "/api/device-relation/deviceproject/v1/project/device/video" },
    handleClick: {}
  },
  emits: ["update:visible"],
  setup(t, { emit: n }) {
    const e = t, i = P(() => e.dialogTitle || y("视频监控")), r = n, o = P({
      get: () => e.visible,
      set: (s) => r("update:visible", s)
    }), { render: c, toggleFullscreen: g } = pt(e), u = P(() => {
      let s = {};
      switch (e.gridNum) {
        case 1:
          s = { width: "933px", height: "595px" };
          break;
        case 4:
          s = { width: "933px", height: "595px" };
          break;
        case 9:
          s = { width: "1370px", height: "840px" };
          break;
      }
      return s;
    });
    return (s, a) => (v(), R(l(he), Ce({
      size: "mini",
      title: i.value,
      "custom-class": "das-linakge-video-dialog",
      modelValue: o.value,
      "onUpdate:modelValue": a[0] || (a[0] = (p) => o.value = p),
      bodyStyle: { padding: 0 },
      "close-on-click-modal": !1,
      "close-on-press-escape": !1,
      modal: !1,
      "header-style": { display: "flex", justifyContent: "space-between", alignItems: "center" },
      draggable: s.draggable,
      resizable: s.resizable,
      width: u.value.width,
      height: u.value.height
    }, s.$attrs), {
      header: C(() => [
        m("div", null, [
          m(
            "span",
            null,
            j(i.value),
            1
            /* TEXT */
          )
        ]),
        f(l(_), {
          content: l(y)("页面全屏")
        }, {
          default: C(() => [
            f(l(we), {
              class: "icon",
              color: "#999",
              onClick: l(g)
            }, null, 8, ["onClick"])
          ]),
          _: 1
          /* STABLE */
        }, 8, ["content"])
      ]),
      default: C(() => [
        o.value ? (v(), R(l(c), { key: 0 })) : I("v-if", !0)
      ]),
      _: 1
      /* STABLE */
    }, 16, ["title", "modelValue", "draggable", "resizable", "width", "height"]));
  }
}), ft = {
  加载中: { "zh-CN": "加载中", en: "Loading", _appCode: "framework" },
  正在实时预览: { "zh-CN": "正在实时预览", en: "Real-time Video", _appCode: "framework" },
  声音: { "zh-CN": "声音", en: "Sound", _appCode: "framework" },
  截图: { "zh-CN": "截图", en: "Screenshot", _appCode: "framework" },
  聚焦: { "zh-CN": "聚焦", en: "Focus", _appCode: "framework" },
  方向控制: { "zh-CN": "方向控制", en: "Direction Control", _appCode: "framework" },
  左上: { "zh-CN": "左上", en: "Top Left", _appCode: "framework" },
  上: { "zh-CN": "上", en: "Up", _appCode: "framework" },
  右上: { "zh-CN": "右上", en: "Top Right", _appCode: "framework" },
  左: { "zh-CN": "左", en: "Left", _appCode: "framework" },
  自动: { "zh-CN": "自动", en: "Auto", _appCode: "framework" },
  右: { "zh-CN": "右", en: "Right", _appCode: "framework" },
  左下: { "zh-CN": "左下", en: "Bottom Left", _appCode: "framework" },
  下: { "zh-CN": "下", en: "Down", _appCode: "framework" },
  右下: { "zh-CN": "右下", en: "Bottom Right", _appCode: "framework" },
  视频监控: { "zh-CN": "视频监控", en: "Video Surveillance", _appCode: "framework" },
  页面全屏: { "zh-CN": "页面全屏", en: "Full Screen", _appCode: "framework" },
  "加载中...": { "zh-CN": "加载中...", en: "Loading...", _appCode: "framework" },
  "聚焦-": { "zh-CN": "聚焦-", en: "Focus-", _appCode: "framework" },
  "聚焦+": { "zh-CN": "聚焦+", en: "Focus+", _appCode: "framework" }
};
ke(ft);
const St = ye(vt), zt = () => w(null);
export {
  St as DasVideoDialog,
  zt as DasVideoDialogRef,
  pt as useVideo
};
