import '@das-fed/ui/packages/business-components/video-dialog/style.css';
import { getCurrentScope as ue, onScopeDispose as de, getCurrentInstance as ve, onMounted as te, nextTick as P, unref as l, ref as h, watch as F, defineComponent as D, useCssVars as pe, computed as T, createElementBlock as S, openBlock as p, normalizeClass as fe, renderSlot as oe, createCommentVNode as E, Fragment as H, renderList as me, createBlock as R, withCtx as y, withModifiers as _, createVNode as f, createElementVNode as m, toDisplayString as j, toRefs as Ce } from "vue";
import { withInstall as ge } from "@das-fed/utils/with-install/index";
import { t as k, setI18nRule as ye } from "@das-fed/web/packages/i18n/index";
import { DasDialog as ke } from "@das-fed/ui/packages/components/dialog/index";
import { DasTooltip as w } from "@das-fed/ui/packages/components/tooltip/index";
import { DasIconFullscreen2 as _e } from "@das-fed/ui/packages/icons/fullscreen-2/index";
import { DasAutoRegisterIcon as he, DasIcon as $ } from "@das-fed/ui/packages/components/icon/index";
import { DasLivePlayer as we } from "@das-fed/ui/packages/components/live-player/index";
import { DasSpin as be } from "@das-fed/ui/packages/components/spin/index";
import { DasHlsPlayer as Ie } from "@das-fed/ui/packages/components/hls-player/index";
import Ee from "dayjs";
import { createService as M } from "@das-fed/utils/api-services/src/create-service";
import { getProjectInfo as q, getToken as Re } from "@das-fed/utils/common-info";
var G;
const A = typeof window < "u", Ne = (t) => typeof t == "string", Fe = () => {
};
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 Se(t) {
  return t;
}
function le(t) {
  return ue() ? (de(t), !0) : !1;
}
function Le(t, n = !0) {
  ve() ? te(t) : n ? t() : P(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, ze = A ? window.document : void 0;
function De(...t) {
  let n, e, i, a;
  if (Ne(t[0]) || Array.isArray(t[0]) ? ([e, i, a] = t, n = Oe) : [n, e, i, a] = t, !n)
    return Fe;
  Array.isArray(e) || (e = [e]), Array.isArray(i) || (i = [i]);
  const o = [], s = () => {
    o.forEach((r) => r()), o.length = 0;
  }, C = (r, d, g, b) => (r.addEventListener(d, g, b), () => r.removeEventListener(d, g, b)), c = F(() => [ie(n), ne(a)], ([r, d]) => {
    s(), r && o.push(...e.flatMap((g) => i.map((b) => C(r, g, b, d))));
  }, { immediate: !0, flush: "post" }), u = () => {
    c(), s();
  };
  return le(u), u;
}
function Ue(t, n = !1) {
  const e = h(), 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 = ze, autoExit: i = !1 } = n, a = t || (e == null ? void 0 : e.querySelector("html")), o = h(!1);
  let s = Z[0];
  const C = Ue(() => {
    if (e) {
      for (const N of Z)
        if (N[1] in e)
          return s = N, !0;
    } else
      return !1;
    return !1;
  }), [c, u, r, , d] = s;
  async function g() {
    C.value && (e != null && e[r] && await e[u](), o.value = !1);
  }
  async function b() {
    if (!C.value)
      return;
    await g();
    const N = ie(a);
    N && (await N[c](), o.value = !0);
  }
  async function L() {
    o.value ? await g() : await b();
  }
  return e && De(e, d, () => {
    o.value = !!(e != null && e[r]);
  }, !1), i && le(g), {
    isSupported: C,
    isFullscreen: o,
    enter: b,
    exit: g,
    toggle: L
  };
}
var K;
(function(t) {
  t.UP = "UP", t.RIGHT = "RIGHT", t.DOWN = "DOWN", t.LEFT = "LEFT", t.NONE = "NONE";
})(K || (K = {}));
var $e = Object.defineProperty, X = Object.getOwnPropertySymbols, Pe = Object.prototype.hasOwnProperty, Te = Object.prototype.propertyIsEnumerable, J = (t, n, e) => n in t ? $e(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e, xe = (t, n) => {
  for (var e in n || (n = {}))
    Pe.call(n, e) && J(t, e, n[e]);
  if (X)
    for (var e of X(n))
      Te.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]
};
xe({
  linear: Se
}, He);
const Be = /* @__PURE__ */ D({
  __name: "GridItem",
  props: {
    active: { type: Boolean },
    gridNum: {}
  },
  emits: ["itemClick"],
  setup(t, { emit: n }) {
    pe((r) => ({
      "9b3a2c32": u.value
    }));
    const e = t, i = n, a = h(), { toggle: o, isFullscreen: s } = ae(a), C = () => {
      a.value != document.fullscreenElement && (s.value ? (s.value = !1, P(() => {
        o();
      })) : o());
    }, c = () => {
      i("itemClick");
    }, u = T(() => `calc(100% / ${Math.sqrt(e.gridNum)})`);
    return (r, d) => (p(), S(
      "div",
      {
        ref_key: "containerRef",
        ref: a,
        class: fe(["wrapper", { "is-active": e.active }]),
        onDblclick: d[0] || (d[0] = (g) => C()),
        onClick: d[1] || (d[1] = (g) => c())
      },
      [
        oe(r.$slots, "default", {}, void 0, !0)
      ],
      34
      /* CLASS, NEED_HYDRATION */
    ));
  }
}), B = (t, n) => {
  const e = t.__vccOpts || t;
  for (const [i, a] of n)
    e[i] = a;
  return e;
}, Ve = /* @__PURE__ */ B(Be, [["__scopeId", "data-v-100b67ca"]]), je = { class: "layout-wrapper" }, Me = /* @__PURE__ */ D({
  __name: "GridLayout",
  props: {
    gridNum: {},
    activeIndex: { default: 0 },
    showFn: {}
  },
  emits: ["update:activeIndex"],
  setup(t, { emit: n }) {
    const e = t, i = n, a = (o) => {
      i("update:activeIndex", o);
    };
    return (o, s) => (p(), S("div", je, [
      E(' :active="index === activeIndex" '),
      (p(!0), S(
        H,
        null,
        me(e.gridNum, (C, c) => (p(), R(Ve, {
          active: !1,
          "grid-num": e.gridNum,
          onItemClick: (u) => a(c)
        }, {
          default: y(() => [
            o.showFn(c) ? oe(o.$slots, "default", {
              key: 0,
              index: c
            }, void 0, !0) : E("v-if", !0)
          ]),
          _: 2
          /* DYNAMIC */
        }, 1032, ["grid-num", "onItemClick"]))),
        256
        /* UNKEYED_FRAGMENT */
      ))
    ]));
  }
}), Ae = /* @__PURE__ */ B(Me, [["__scopeId", "data-v-661e2289"]]), Qe = /* @__PURE__ */ D({
  __name: "DirectionControl",
  emits: ["change"],
  setup(t, { emit: n }) {
    const e = n, i = (a) => {
      e("change", a);
    };
    return (a, o) => (p(), S(
      "div",
      {
        class: "direction-control",
        onDblclick: o[9] || (o[9] = _((s) => s.stopPropagation(), ["stop"]))
      },
      [
        f(l(w), {
          content: l(k)("左上")
        }, {
          default: y(() => [
            m("div", {
              class: "icon icon-top-left",
              onClick: o[0] || (o[0] = _((s) => i("leftUp"), ["stop"]))
            })
          ]),
          _: 1
          /* STABLE */
        }, 8, ["content"]),
        f(l(w), {
          content: l(k)("上")
        }, {
          default: y(() => [
            m("div", {
              class: "icon icon-top",
              onClick: o[1] || (o[1] = _((s) => i("up"), ["stop"]))
            })
          ]),
          _: 1
          /* STABLE */
        }, 8, ["content"]),
        f(l(w), {
          content: l(k)("右上")
        }, {
          default: y(() => [
            m("div", {
              class: "icon icon-top-right",
              onClick: o[2] || (o[2] = _((s) => i("rightUp"), ["stop"]))
            })
          ]),
          _: 1
          /* STABLE */
        }, 8, ["content"]),
        f(l(w), {
          content: l(k)("左")
        }, {
          default: y(() => [
            m("div", {
              class: "icon icon-left",
              onClick: o[3] || (o[3] = _((s) => i("left"), ["stop"]))
            })
          ]),
          _: 1
          /* STABLE */
        }, 8, ["content"]),
        f(l(w), {
          content: l(k)("自动")
        }, {
          default: y(() => [
            m("div", {
              class: "icon icon-auto",
              onClick: o[4] || (o[4] = _((s) => i("auto"), ["stop"]))
            })
          ]),
          _: 1
          /* STABLE */
        }, 8, ["content"]),
        f(l(w), {
          content: l(k)("右")
        }, {
          default: y(() => [
            m("div", {
              class: "icon icon-right",
              onClick: o[5] || (o[5] = _((s) => i("right"), ["stop"]))
            })
          ]),
          _: 1
          /* STABLE */
        }, 8, ["content"]),
        f(l(w), {
          content: l(k)("左下")
        }, {
          default: y(() => [
            m("div", {
              class: "icon icon-bottom-left",
              onClick: o[6] || (o[6] = _((s) => i("leftDown"), ["stop"]))
            })
          ]),
          _: 1
          /* STABLE */
        }, 8, ["content"]),
        f(l(w), {
          content: l(k)("下")
        }, {
          default: y(() => [
            m("div", {
              class: "icon icon-bottom",
              onClick: o[7] || (o[7] = _((s) => i("down"), ["stop"]))
            })
          ]),
          _: 1
          /* STABLE */
        }, 8, ["content"]),
        f(l(w), {
          content: l(k)("右下")
        }, {
          default: y(() => [
            m("div", {
              class: "icon icon-bottom-right",
              onClick: o[8] || (o[8] = _((s) => i("rightDown"), ["stop"]))
            })
          ]),
          _: 1
          /* STABLE */
        }, 8, ["content"])
      ],
      32
      /* NEED_HYDRATION */
    ));
  }
}), qe = /* @__PURE__ */ B(Qe, [["__scopeId", "data-v-db2e8ec2"]]), Ge = { class: "video-wrapper" }, We = { class: "video-top" }, Ye = { class: "video-top_l" }, Ze = { class: "video-title-wrapper" }, Ke = { class: "video-title" }, Xe = { class: "video-top_r" }, Je = {
  key: 0,
  class: "play-status"
}, et = { class: "video-bottom" }, tt = { class: "video-bottom_r" }, ot = /* @__PURE__ */ D({
  __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;
    he({
      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 a = h(!0), o = h(), s = h(!1), C = h(), c = T(() => {
      var v;
      return (v = C.value) == null ? void 0 : v.video;
    }), u = h(!1), r = h(!0), d = (v) => {
      o.value = v, !e.isHls && o.value.on(window.mpegts.Events.ERROR, (I) => {
        console.log("player error", I);
      });
    }, g = () => {
      a.value = !a.value, i("handleClick", a.value ? "MUTE" : "UNMUTE"), o.value && (o.value.muted = a.value);
    }, b = () => {
      s.value = !s.value;
    }, L = h(""), N = () => {
      const v = document.createElement("canvas");
      if (i("handleClick", "SCREENSHOT"), c.value) {
        v.width = c.value.clientWidth, v.height = c.value.clientHeight;
        const I = v.getContext("2d");
        I == null || I.drawImage(c.value, 0, 0, v.width, v.height);
        const z = v.toDataURL("image/jpg"), ce = `【${e.title}】${Ee().format("YYYYMMDDHHmmss").toString()}.jpg`;
        if (L.value = z, "download" in document.createElement("a")) {
          const O = document.createElement("a");
          O.download = ce, O.style.display = "none", O.href = z, document.body.appendChild(O), document.body.appendChild(v), O.click(), URL.revokeObjectURL(O.href), document.body.removeChild(O), document.body.removeChild(v);
        }
      }
    }, V = (v) => {
      i("directionControl", v);
    }, x = (v) => {
      i("zoomControl", v);
    }, U = (v) => e.authType.includes(v);
    return F(
      () => c.value,
      () => {
        c.value && c.value.addEventListener("ended", () => {
          u.value = !0, e.type === "playback" && (r.value = !1);
        });
      }
    ), F(
      () => c.value,
      () => {
        c.value && P(() => {
          c.value.playbackRate = e.playbackRate || 1;
        });
      }
    ), F(
      () => o.value,
      () => {
        o.value && P(() => {
          o.value.muted = a.value;
        });
      }
    ), F(
      () => e.playbackRate,
      () => {
        c.value && (c.value.playbackRate = e.playbackRate || 1);
      },
      {
        immediate: !0
      }
    ), F(
      () => e.paused,
      () => {
        o.value && (e.paused ? o.value.pause() : o.value.play());
      }
    ), F(
      () => e.videoUrl,
      () => {
        r.value = !1, P(() => {
          r.value = !0;
        });
      }
    ), (v, I) => (p(), S("div", Ge, [
      f(l(be), {
        spinning: e.loading,
        type: "component",
        tip: l(k)("加载中...")
      }, {
        default: y(() => [
          m("div", We, [
            m("div", Ye, [
              m("div", Ze, [
                m(
                  "div",
                  Ke,
                  j(e.title.length > 20 ? e.title.slice(0, 19) + "..." : e.title),
                  1
                  /* TEXT */
                )
              ])
            ]),
            m("div", Xe, [
              ["live"].includes(v.type) ? (p(), S(
                "span",
                Je,
                j(l(k)("正在实时预览")),
                1
                /* TEXT */
              )) : E("v-if", !0),
              E(' <das-icon v-if="isFullscreen" class="icon close-icon" icon="close" @click.stop="handleClose"></das-icon> ')
            ])
          ]),
          v.isHls ? (p(), S(
            H,
            { key: 1 },
            [
              e.videoUrl && r.value ? (p(), R(l(Ie), {
                key: 0,
                ref_key: "dasLivePlayerRef",
                ref: C,
                muted: a.value,
                onLoaded: d,
                src: e.videoUrl
              }, null, 8, ["muted", "src"])) : E("v-if", !0)
            ],
            64
            /* STABLE_FRAGMENT */
          )) : (p(), S(
            H,
            { key: 0 },
            [
              e.videoUrl && r.value ? (p(), R(l(we), {
                key: 0,
                type: "flv",
                ref_key: "dasLivePlayerRef",
                ref: C,
                muted: a.value,
                onLoaded: d,
                src: e.videoUrl
              }, null, 8, ["muted", "src"])) : E("v-if", !0)
            ],
            64
            /* STABLE_FRAGMENT */
          )),
          m("div", et, [
            I[3] || (I[3] = m(
              "div",
              { class: "video-bottom_l" },
              null,
              -1
              /* CACHED */
            )),
            m("div", tt, [
              m(
                "div",
                {
                  class: "controls",
                  onDblclick: I[2] || (I[2] = _((z) => z.stopPropagation(), ["stop"]))
                },
                [
                  f(l(w), {
                    content: l(k)("声音")
                  }, {
                    default: y(() => [
                      f(l($), {
                        class: "icon icon-volume",
                        icon: a.value ? "muted" : "volume",
                        onClick: _(g, ["stop"])
                      }, null, 8, ["icon"])
                    ]),
                    _: 1
                    /* STABLE */
                  }, 8, ["content"]),
                  f(l(w), {
                    content: l(k)("截图")
                  }, {
                    default: y(() => [
                      f(l($), {
                        class: "icon icon-screenshot",
                        icon: "screenshot",
                        onClick: _(N, ["stop"])
                      })
                    ]),
                    _: 1
                    /* STABLE */
                  }, 8, ["content"]),
                  U("control") ? (p(), R(l(w), {
                    key: 0,
                    content: l(k)("聚焦-")
                  }, {
                    default: y(() => [
                      ["live", "polling"].includes(e.type) ? (p(), R(l($), {
                        key: 0,
                        class: "icon icon-shrink",
                        icon: "shrink",
                        onClick: I[0] || (I[0] = _((z) => x("zoomOut"), ["stop"]))
                      })) : E("v-if", !0)
                    ]),
                    _: 1
                    /* STABLE */
                  }, 8, ["content"])) : E("v-if", !0),
                  U("control") ? (p(), R(l(w), {
                    key: 1,
                    content: l(k)("聚焦+")
                  }, {
                    default: y(() => [
                      ["live", "polling"].includes(e.type) ? (p(), R(l($), {
                        key: 0,
                        class: "icon icon-enlarge",
                        icon: "enlarge",
                        onClick: I[1] || (I[1] = _((z) => x("zoomIn"), ["stop"]))
                      })) : E("v-if", !0)
                    ]),
                    _: 1
                    /* STABLE */
                  }, 8, ["content"])) : E("v-if", !0),
                  U("control") ? (p(), R(l(w), {
                    key: 2,
                    content: l(k)("方向控制")
                  }, {
                    default: y(() => [
                      ["live", "polling"].includes(e.type) ? (p(), R(l($), {
                        key: 0,
                        class: "icon icon-direction-control",
                        icon: "direction-control",
                        onClick: _(b, ["stop"])
                      })) : E("v-if", !0)
                    ]),
                    _: 1
                    /* STABLE */
                  }, 8, ["content"])) : E("v-if", !0)
                ],
                32
                /* NEED_HYDRATION */
              )
            ])
          ]),
          s.value ? (p(), R(qe, {
            key: 2,
            onChange: V
          })) : E("v-if", !0)
        ]),
        _: 1
        /* STABLE */
      }, 8, ["spinning", "tip"])
    ]));
  }
}), nt = /* @__PURE__ */ B(ot, [["__scopeId", "data-v-4db322a4"]]), lt = "/api/device-relation/deviceproject/v1/project/device/video", it = "v1", at = M(`/api/enterpriseright/permission/${it}`);
let Q = M(`${lt}`, se);
function se(t) {
  const n = q() ? q().id : 1;
  return t.params || (t.params = {}), t.params.project = n, t.params.projectId = n, t;
}
function re(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?${re(t)}`)().run();
}
function st(t) {
  return Q.post(`/url/preview?${re(t)}`)().run();
}
at.post("data/device-auth");
function rt(t) {
  return new Promise((n) => {
    Q = M(t, se), n("");
  });
}
const ct = (t) => {
  const n = Re();
  return `${t}?token=${n}`;
};
h([]);
const ut = /* @__PURE__ */ D({
  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: a,
      baseURL: o
    } = Ce(t), s = h(!1), C = h(""), c = async () => {
      var b;
      if (!((b = e.value) != null && b.deviceId)) return;
      s.value = !0;
      const [d, g] = await st({
        productId: e.value.productId,
        deviceId: e.value.deviceId,
        source: i.value
      });
      if (!d) {
        let L = a.value ? "httpHlsStreamURL" : "wsFlvStreamURL";
        C.value = ct(g == null ? void 0 : g[L]);
      }
      s.value = !1;
    }, u = (d) => {
      ee({
        productId: e.value.productId,
        deviceId: e.value.deviceId,
        direction: d,
        zoom: "",
        source: i.value || "web"
      });
    }, r = (d) => {
      ee({
        productId: e.value.productId,
        deviceId: e.value.deviceId,
        direction: "",
        zoom: d,
        source: i.value || "web"
      });
    };
    return te(async () => {
      o.value && await rt(o.value), c();
    }), F(() => e.value, () => {
      c();
    }, {
      deep: !0
    }), () => f(H, null, [n.default({
      videoUrl: C.value,
      loading: s.value,
      onDirectionControl: u,
      onZoomControl: r,
      isHls: a.value
    })]);
  }
});
function dt(t) {
  const n = h(0), e = h(), {
    toggle: i,
    isFullscreen: a,
    exit: o
  } = ae(e), s = (u, r) => {
    a.value && o();
  }, C = (u) => {
    var r;
    (r = t == null ? void 0 : t.handleClick) == null || r.call(t, u);
  };
  return {
    render: () => f(Ae, {
      ref: e,
      gridNum: t.gridNum,
      activeIndex: n.value,
      "onUpdate:activeIndex": (u) => n.value = u,
      showFn: (u) => !!t.deviceList[u]
    }, {
      default: ({
        index: u
      }) => {
        const r = t.deviceList[u], d = t.source, g = t.isHls, b = t.baseURL;
        return f(ut, {
          deviceInfo: r,
          baseURL: b,
          source: d,
          isHls: g
        }, {
          default: ({
            videoUrl: L,
            onDirectionControl: N,
            onZoomControl: V,
            loading: x,
            isHls: U
          }) => f(nt, {
            type: "live",
            loading: x,
            isFullscreen: a.value,
            videoUrl: L,
            title: r.deviceName,
            onClose: () => s(),
            onDirectionControl: N,
            onZoomControl: V,
            onHandleClick: C,
            authType: r.authType === 2 ? ["control"] : [],
            isHls: U
          }, null)
        });
      }
    }),
    toggleFullscreen: i
  };
}
const vt = /* @__PURE__ */ D({
  __name: "index",
  props: {
    visible: { type: Boolean, default: !1 },
    deviceList: { default: () => [] },
    gridNum: { default: 4 },
    source: {},
    isHls: { type: Boolean, default: !1 },
    dialogTitle: { default: "" },
    baseURL: { default: "/api/device-relation/deviceproject/v1/project/device/video" },
    handleClick: {}
  },
  emits: ["update:visible"],
  setup(t, { emit: n }) {
    const e = t, i = T(() => e.dialogTitle || k("视频监控")), a = n, o = T({
      get: () => e.visible,
      set: (u) => a("update:visible", u)
    }), { render: s, toggleFullscreen: C } = dt(e), c = T(() => {
      let u = {};
      switch (e.gridNum) {
        case 1:
          u = "one-video";
          break;
        case 4:
          u = "four-video";
          break;
        case 9:
          u = "nine-video";
          break;
      }
      return u;
    });
    return (u, r) => (p(), R(l(ke), {
      size: "mini",
      title: i.value,
      "custom-class": `das-linakge-video-dialog ${c.value}`,
      modelValue: o.value,
      "onUpdate:modelValue": r[0] || (r[0] = (d) => o.value = d),
      bodyStyle: { padding: 0 },
      "close-on-click-modal": !1,
      "close-on-press-escape": !1,
      modal: !1,
      "header-style": { display: "flex", justifyContent: "space-between", alignItems: "center" }
    }, {
      header: y(() => [
        m("div", null, [
          m(
            "span",
            null,
            j(i.value),
            1
            /* TEXT */
          )
        ]),
        f(l(w), {
          content: l(k)("页面全屏")
        }, {
          default: y(() => [
            f(l(_e), {
              class: "icon",
              color: "#999",
              onClick: l(C)
            }, null, 8, ["onClick"])
          ]),
          _: 1
          /* STABLE */
        }, 8, ["content"])
      ]),
      default: y(() => [
        o.value ? (p(), R(l(s), { key: 0 })) : E("v-if", !0)
      ]),
      _: 1
      /* STABLE */
    }, 8, ["title", "custom-class", "modelValue"]));
  }
}), pt = {
  加载中: { "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" }
};
ye(pt);
const Nt = ge(vt), Ft = () => h(null);
export {
  Nt as DasVideoDialog,
  Ft as DasVideoDialogRef,
  dt as useVideo
};
