import '@das-fed/upf-ui/packages/components/preview/style.css';
import { withInstall as f } from "@das-fed/upf-utils/with-install/index";
import { getLang as m, t as d, setI18nRule as u } from "@das-fed/upf-web/packages/i18n/index";
import { defineComponent as w, openBlock as v, createElementBlock as g, unref as i, renderSlot as _, createVNode as h, withCtx as k, createTextVNode as x, toDisplayString as $ } from "vue";
import { DasButton as I } from "@das-fed/upf-ui/packages/components/button/index";
import { getPersonalInfo as P, getToken as C } from "@das-fed/upf-utils/common-info";
import { pureImageSrc as U } from "@das-fed/upf-utils/pure-image-src";
const b = (e) => {
  const r = P(), t = location.origin, o = e.host ?? t, s = "/web-apps/preview.html";
  return e.userid ?? r.id, e.username ?? r.name, { preview: () => {
    let n = e.fileUrl;
    const l = m().value, c = C();
    n.startsWith("http") || (n = `${t}${U(n)}`);
    const p = `${o}${s}?access_token=${c}&lang=${l}&fileUrl=${n}`;
    window.open(p);
  } };
}, y = /* @__PURE__ */ w({
  __name: "Index",
  props: {
    host: {},
    fileUrl: {},
    lang: { default: "zh-CN" },
    mode: { default: "view" },
    userid: {},
    username: {}
  },
  setup(e, { expose: r }) {
    const t = e, { preview: o } = b(t);
    return r({ preview: o }), (s, a) => (v(), g("div", {
      class: "das-preview-container",
      onClick: a[0] || (a[0] = //@ts-ignore
      (...n) => i(o) && i(o)(...n))
    }, [
      _(s.$slots, "default", {}, () => [
        h(i(I), {
          "btn-type": "primary-text",
          size: "large",
          block: ""
        }, {
          default: k(() => [
            x(
              $(i(d)("das-preview-text")),
              1
              /* TEXT */
            )
          ]),
          _: 1
          /* STABLE */
        })
      ], !0)
    ]));
  }
}), z = (e, r) => {
  const t = e.__vccOpts || e;
  for (const [o, s] of r)
    t[o] = s;
  return t;
}, N = /* @__PURE__ */ z(y, [["__scopeId", "data-v-b39d86f9"]]), B = { "das-preview-text": { "zh-CN": "预览", en: "Preview", "zh-MO": "預覽", _appCode: "framework" } }, E = f(N);
u(B);
export {
  E as DasPreview,
  E as default
};
