var Be = Object.defineProperty;
var Ie = (t, e, a) => e in t ? Be(t, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[e] = a;
var T = (t, e, a) => Ie(t, typeof e != "symbol" ? e + "" : e, a);
import { d as I, u as H, i as N, W as le, j as ie, k as se, l as ve, m as Re, o as b, c as E, n as ee, a as A, b as l, p as be, g as F, r as B, q as De, h as f, s as Le, I as ye, x as Y, v as Fe, T as Oe, e as D, z as Ne, _ as G, w as Ce, B as X, t as ne, aX as Qe, X as Ae, Y as de, a0 as He, E as Ve, F as k, a3 as j, C as z, G as Te, y as ze, H as ke, J as xe, K as we, L as Xe, M as Ge, N as Ue, P as We, O as Ye, R as K, Q as je, a1 as qe, a2 as Ze, a4 as Ke, a5 as Me, A as oe, D as Je, U as _e, V as $e, f as et, a6 as tt, a7 as at, a8 as nt, a9 as ot, aa as rt, ab as lt, ac as it, ad as st, ae as At, af as dt, ag as ut, ah as ct, ai as mt, aj as gt, ak as pt, al as ft, am as ht, an as vt, ao as bt, ap as yt, aq as Ct, ar as wt, as as St, at as Et, au as Pt, av as Bt, aw as It, ax as Rt, ay as Dt, az as Lt, aA as Ft, aB as Ot, aC as Nt, aD as Qt, aE as Ht, aF as Vt, aG as Tt, aH as zt, aI as kt, aJ as xt, aK as Xt, aL as ue, aM as Gt, aN as Ut, aO as Wt, aP as Yt, aQ as jt, aR as qt, aT as Zt, aU as M } from "./ApiBase.js";
import { a as Kt, O as ce, c as me, d as ge } from "./UI.runtime.js";
const R = {
  Init: "init",
  // 文档初始化时
  SelectionChange: "selectionChange",
  // selection改变时
  UndoRedoChange: "UndoRedoChange",
  // undo redo 操作列表发生改变时
  ExportReady: "ExportReady",
  // 文档准备好导出时
  ZoomChange: "ZoomChange"
  // zoom 改变
}, o = {
  //styles
  Bold: "bold",
  Underline: "underline",
  Strikeout: "strikeout",
  Italic: "italic",
  FontSize: "fontSize",
  FontColor: "fontColor",
  FontName: "fontName",
  Color: "color",
  AlignHorizontal: "alignHorizontal",
  AlignVertical: "alignVertical",
  // editor
  Undo: "undo",
  Redo: "redo",
  Copy: "copy",
  Paste: "paste",
  NewSlide: "newSlide",
  Zoom: "zoom",
  AutoZoom: "autoZoom",
  Export: "export",
  ExportPDF: "exportPDF",
  Open: "open",
  Play: "play",
  GoToPage: "goToPage",
  GetLayoutList: "getLayoutList",
  // dropdown
  SlideOptions: "slideOptions"
}, re = /* @__PURE__ */ new Set([
  o.Open,
  o.Export,
  o.ExportPDF,
  o.Copy,
  o.Play,
  o.GoToPage,
  o.GetLayoutList,
  o.Zoom,
  o.AutoZoom
]);
function Mt(t, e, a = window) {
  let n = null;
  const r = () => {
    n && (clearInterval(n), n = null);
  }, i = (v) => {
    t.dispatch("file/onError", v);
  };
  a.addEventListener("FileError", i);
  const s = (v) => {
    t.dispatch("file/onReady", v), t.dispatch("file/onLoadPageEnd", v), t.commit("command/setLoadEnd", !0), e.refresh(R.Init);
  };
  a.addEventListener("DocumentReady", s);
  const d = (v) => {
    e.refresh(R.ZoomChange);
  };
  a.addEventListener("ZoomChange", d);
  const c = (v) => {
    t.dispatch("file/onExportReady", v), e.refresh(R.ExportReady);
  };
  a.addEventListener("ExportReady", c);
  const u = (v) => {
    e.refresh(R.UndoRedoChange);
  };
  a.addEventListener("UndoRedoChange", u);
  const g = (v) => {
    const { currentPage: O } = (v == null ? void 0 : v.detail) || {};
    t.commit("file/setCurrentPage", O);
  };
  a.addEventListener("CurrentPage", g);
  const h = (v) => {
    const { totalPages: O } = (v == null ? void 0 : v.detail) || {};
    t.commit("file/setPageCount", O);
  };
  a.addEventListener("PageCount", h);
  const P = (v) => {
    Jt(t, v.detail), e.refresh(R.SelectionChange);
  };
  a.addEventListener("SelectionChange", P);
  const p = (v) => {
    t.dispatch("file/onReady", v), r();
    function O(W, te) {
      return Math.floor(Math.random() * (te - W + 1)) + W;
    }
    let U = 0, x = 50;
    const q = () => {
      const W = O(U, x);
      t.commit("file/setLoadingStepTime", W), U = x, x = Math.min(x + O(20, 50), 100), U >= 100 && (U = 0, x = 50);
    };
    n = window.setInterval(() => {
      if ((t == null ? void 0 : t.getters["file/loadingRatio"]) === 100) {
        r(), t.commit("file/setLoadingStepTime", 1e3);
        return;
      }
      q();
    }, 3e3), q();
  };
  a.addEventListener("FirstPageLoaded", p);
  const C = () => {
    e.enableEditor();
  };
  a.addEventListener("EditorEnable", C);
  const L = () => {
    e.disableEditor();
  };
  a.addEventListener("EditorDisable", L);
  const y = (v) => {
    var O;
    e.notifySecurityError(((O = v.detail) == null ? void 0 : O.action) || "");
  };
  return a.addEventListener("SecurityError", y), () => {
    a.removeEventListener("FileError", i), a.removeEventListener("DocumentReady", s), a.removeEventListener("ZOOM_CHANGED", d), a.removeEventListener("ExportReady", c), a.removeEventListener("UndoRedoChange", u), a.removeEventListener("CurrentPage", g), a.removeEventListener("PageCount", h), a.removeEventListener("FirstPageLoaded", p), a.removeEventListener("EditorEnable", C), a.removeEventListener("EditorDisable", L), a.removeEventListener("SecurityError", y), r();
  };
}
function Jt(t, e) {
  if (!e) return;
  const a = [
    { cmd: o.Bold, key: "bold" },
    { cmd: o.FontColor, key: "fontColor" },
    { cmd: o.FontName, key: "fontName" },
    {
      cmd: o.FontSize,
      key: "fontSize",
      getVal: (r) => {
        const i = r ? String(r) : "";
        return i != "0" ? i : "";
      }
    },
    { cmd: o.Italic, key: "italic" },
    { cmd: o.Underline, key: "underline" },
    { cmd: o.Strikeout, key: "strikeout" },
    { cmd: o.AlignHorizontal, key: "alignHorizontal" },
    { cmd: o.AlignVertical, key: "alignVertical" }
  ], n = [o.Paste];
  t.commit("command/setEnabled", {
    cmd: o.Copy,
    enabled: e.canCopy === !0
  }), Number(e.selectType) === 6 || Number(e.selectType) === 4 ? (a.forEach(({ cmd: r, key: i, getVal: s }) => {
    t.commit("command/setEnabled", {
      cmd: r,
      enabled: !0
    });
    let d;
    s ? d = s(e[i]) : d = e[i], t.commit("command/setState", {
      cmd: r,
      ui: {
        value: d
      }
    });
  }), n.forEach((r) => {
    t.commit("command/setEnabled", {
      cmd: r,
      enabled: !0
    });
  })) : (a.forEach(({ cmd: r }) => {
    t.commit("command/setEnabled", {
      cmd: r,
      enabled: !1
    }), t.commit("command/clearState", {
      cmd: r
    });
  }), n.forEach((r) => {
    t.commit("command/setEnabled", {
      cmd: r,
      enabled: !1
    }), t.commit("command/clearState", {
      cmd: r
    });
  }));
}
const V = Symbol("CommandService");
class _t {
  constructor(e) {
    T(this, "store");
    T(this, "api");
    T(this, "pptReady");
    T(this, "eventTarget");
    T(this, "removeListeners");
    T(this, "handlers");
    T(this, "refreshers");
    T(this, "securityErrorHandler");
    T(this, "modeController");
    T(this, "removeModeListener");
    this.store = e.store, this.api = e.api, this.pptReady = !1, this.eventTarget = e.eventTarget ?? window, this.removeListeners = () => {
    }, this.handlers = {}, this.refreshers = {}, this.securityErrorHandler = () => {
    }, this.modeController = null, this.removeModeListener = () => {
    };
  }
  initApi(e) {
    var a, n;
    this.pptReady = !1, this.store.commit("command/resetCommandState"), (a = this.removeListeners) == null || a.call(this), (n = this.removeModeListener) == null || n.call(this), this.api.initApi(e), this.bindDocumentMode(e), this.syncReadOnlyState(), this.removeListeners = Mt(this.store, this, this.eventTarget);
  }
  initApp(e) {
    this.initApi(e);
  }
  destroy() {
    var e, a;
    (e = this.removeListeners) == null || e.call(this), (a = this.removeModeListener) == null || a.call(this), this.modeController = null, this.removeListeners = () => {
    }, this.removeModeListener = () => {
    };
  }
  dispose() {
    this.destroy();
  }
  setSecurityErrorHandler(e) {
    this.securityErrorHandler = e || (() => {
    });
  }
  notifySecurityError(e) {
    this.securityErrorHandler(e);
  }
  enableEditor() {
    this.pptReady = !0, this.refresh(R.Init);
  }
  disableEditor() {
    this.pptReady = !1, this.refresh(R.Init);
  }
  canRefreshCommand(e) {
    return this.pptReady ? !0 : this.isReadOnly() && this.store.getters["command/loadEnd"] === !0 && re.has(e);
  }
  //refresheres
  registerHandler(e, a) {
    this.handlers[e], this.handlers[e] = a;
  }
  registerRefresher(e, a) {
    this.refreshers[e] = a;
  }
  refreshAll() {
    this.syncReadOnlyState(), this.refreshSome(Object.values(o));
  }
  refresh(e) {
    var n, r, i;
    this.syncReadOnlyState();
    const a = Object.values(o);
    for (const s of a) {
      const d = this.handlers[s];
      d && ((n = d.refresh) != null && n.has(e)) && ((i = (r = this.refreshers)[s]) == null || i.call(r, this));
    }
  }
  refreshSome(e) {
    var a, n;
    this.syncReadOnlyState();
    for (const r of e)
      (n = (a = this.refreshers)[r]) == null || n.call(a, this);
  }
  bindDocumentMode(e) {
    var a;
    this.modeController = Kt(e), this.removeModeListener = ((a = this.modeController) == null ? void 0 : a.onChange((n) => {
      this.store.commit("command/setReadOnly", n), n && this.disableEditor();
    })) ?? (() => {
    });
  }
  isReadOnly() {
    var e;
    return ((e = this.modeController) == null ? void 0 : e.isReadOnly()) ?? !1;
  }
  syncReadOnlyState() {
    this.store.commit("command/setReadOnly", this.isReadOnly());
  }
  canRunInReadOnly(e) {
    return re.has(e);
  }
  /** 执行命令：统一入口 */
  async run(e, a) {
    this.syncReadOnlyState();
    const n = this.handlers[e];
    if (!n) {
      console.error(`[CommandService] no handler registered for "${e}"`);
      return;
    }
    this.isReadOnly() && !this.canRunInReadOnly(e) || await this.store.dispatch("command/run", {
      cmd: e,
      param: a,
      fn: async (r) => {
        await n.run(this.api, r);
      }
    });
  }
}
const pe = ".pptx", $t = /* @__PURE__ */ I({
  __name: "edit",
  setup(t) {
    const e = H(), a = N(V), n = N(le, null), r = B(null), { t: i } = ie(), s = se(), d = [
      { label: i("dropDown.slide.new"), key: "newSlide" },
      { label: i("dropDown.slide.delete"), key: "deleteSlide" }
    ], c = [
      { label: i("dropDown.slide.new"), key: "newSlide" }
    ], u = B(!1), g = B(0), h = B(0), P = f(() => {
      var m;
      return ((m = e.state.command) == null ? void 0 : m.readOnly) === !0;
    }), p = f(() => {
      var m;
      return ((m = e.state.command) == null ? void 0 : m.loadEnd) === !0;
    });
    function C() {
      var m, S;
      try {
        (S = (m = a.api.docApp) == null ? void 0 : m.destroy) == null || S.call(m);
      } catch {
      }
    }
    let L = [];
    function y(m, S) {
      return m.map((Q) => Q.type === "divider" ? Q : {
        ...Q,
        disabled: S
      });
    }
    function v(m) {
      u.value = !1;
      const S = {
        value: {
          action: m
        }
      };
      switch (m) {
        case "newSlide":
        case "deleteSlide":
          a.run(o.SlideOptions, S);
          break;
      }
    }
    function O(m) {
      if (p.value === !0) {
        switch (m.preventDefault(), u.value = !1, a.api.getCursorTargetType()) {
          case "Thumbnail":
            L = y(d, P.value);
            break;
          case "ThumbnailGapLine":
            L = y(c, P.value);
            break;
          default:
            L = [];
            break;
        }
        L && L.length > 0 && De(() => {
          u.value = !0, g.value = m.clientX, h.value = m.clientY;
        });
      }
    }
    function U() {
      u.value = !1;
    }
    function x(m) {
      const S = {
        copy: "C",
        paste: "V",
        cut: "X"
      };
      return `${/Mac|iPhone|iPad|iPod/i.test(navigator.platform) ? "Command" : "Ctrl"}+${S[m] || "C/V/X"}`;
    }
    function q(m) {
      if (m === "https") {
        s.warning(i("common.httpsOnly"));
        return;
      }
      (m === "copy" || m === "paste" || m === "cut") && s.warning(
        i("common.clipboardShortcutTip", {
          shortcut: x(m)
        })
      );
    }
    function W() {
      return new Promise((m) => {
        const S = document.createElement("input");
        S.type = "file", S.accept = pe, S.style.display = "none", S.addEventListener(
          "change",
          () => {
            var $;
            const Q = (($ = S.files) == null ? void 0 : $[0]) || null;
            if (S.remove(), Q && !Le(Q, pe)) {
              s.warning("不支持打开该文件类型"), m(null);
              return;
            }
            if (Q && Q.size <= 0) {
              s.warning(i("common.emptyFileUnsupported")), m(null);
              return;
            }
            m(Q);
          },
          { once: !0 }
        ), S.addEventListener(
          "cancel",
          () => {
            S.remove(), m(null);
          },
          { once: !0 }
        ), document.body.appendChild(S), S.click();
      });
    }
    async function te() {
      var S;
      const m = await W();
      if (!(!m || !r.value))
        try {
          e.dispatch("file/onOpening"), C(), (S = a.destroy) == null || S.call(a), r.value.innerHTML = "";
          const Q = await ce({
            docId: `local-${Date.now()}`,
            mode: n == null ? void 0 : n.mode,
            file: m,
            fileName: m.name,
            user: n == null ? void 0 : n.user,
            widgetMode: n == null ? void 0 : n.widgetMode,
            mainDom: r.value,
            eventTarget: n == null ? void 0 : n.eventTarget,
            [me]: {
              beforeRender: ($) => {
                a.initApi($);
              }
            }
          });
          e.dispatch("file/onConnected", {
            title: document.title,
            docId: Q.docId
          });
        } catch (Q) {
          console.error("OpenDocument failed:", Q), e.commit("file/setReady"), ge(
            "OpenDocumentFailed",
            void 0,
            n == null ? void 0 : n.eventTarget
          );
        }
    }
    return ve(() => {
      a.setSecurityErrorHandler(q), a.api.setOpenFileHandler(te), n != null && n.mainDom && (n.mainDom.value = r.value), ce({
        docId: n == null ? void 0 : n.docId,
        mode: n == null ? void 0 : n.mode,
        file: n == null ? void 0 : n.file,
        fileUrl: n == null ? void 0 : n.fileUrl,
        fileName: n == null ? void 0 : n.fileName,
        user: n == null ? void 0 : n.user,
        widgetMode: n == null ? void 0 : n.widgetMode,
        mainDom: r.value,
        eventTarget: n == null ? void 0 : n.eventTarget,
        [me]: {
          beforeRender: (m) => {
            a.initApi(m);
          }
        }
      }).then(({ docId: m }) => {
        e.dispatch("file/onConnected", {
          title: document.title,
          docId: m
        });
      }).catch((m) => {
        console.error("OpenDocument failed:", m), e.dispatch("file/onError", m), ge(
          "OpenDocumentFailed",
          void 0,
          n == null ? void 0 : n.eventTarget
        );
      });
    }), Re(() => {
      a.setSecurityErrorHandler(null);
    }), (m, S) => (b(), E("div", {
      class: "main-container",
      onContextmenu: ee(O, ["prevent"])
    }, [
      A(l(be), {
        trigger: "manual",
        show: u.value,
        x: g.value,
        y: h.value,
        options: l(L),
        onSelect: v,
        onClickoutside: U
      }, null, 8, ["show", "x", "y", "options"]),
      F("div", {
        ref_key: "mainRef",
        ref: r,
        class: "main"
      }, null, 512)
    ], 32));
  }
}), Se = Symbol("LayoutRefs");
function ea() {
  const t = N(Se);
  if (!t) throw new Error("LayoutRefs not provided");
  return t;
}
const ta = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAAAq9JREFUeAHFV01oE0EUfrOGkKZNmygi25M2YA/tQd3cVGhBb41HkVzqRXIUwfZok5uUCj0aT3rpQW+NtxYq6DEVLxUqNC2IyaHYTU1/Qii7vrdhwzY7s38t3Q82WWZ35vvem/czywCxPaM815lWwNskXAx2GLD3N+a/F9n27J05HfQChADkfSHhz1MICeiFOQn/r0N4SEoQMiK9AwNKFiKpYeGEVrWC1zr4RWwkA7G0Ao2VkrOAE7UGVx8XhQtpxzn4/XoKtFYT3ECGxMcmoB8vEtCub7oLIOtaWxVUm+EuKvUlYPB+zraQSRgbUSA6PGqQ9nrycOOLfQ6PRF0tgcwRQFbvf12Cf9+WumNkWUKZgvj4JEixBIhAnuWK5r1MXmhWypDIZE+N7X58hQvVDaLUwzwM3ss5klrJ66Vn3GcR0aS9zwvQPz5hEJBHTPVDSJpEci/EhH30Fs0VxYxQgHbccTepP1gvG4TXpt8YLveCdm0T/pYXXDMm4vSwsdqxmoJJzr9zTE+bAIx4CkbaqpO9Gux+KoBvAUHJCQPKI7w692q1JHzPtRIGIbdCFP2eBKQe5M9EThBFv6sAIqZoPwsoeyhtAwk4D3In15vgBiFZn1CyEBSUftZq6VsA1fMgoJxXV9766pZcAfGxSQhK7LVCOgroS7t7gIKrWVnung+s/UHFvQ+8BVH5ptAKIjrcWIMjvMzo5jUmSt8DbGaezgy2gcun897agq0L0smJuiWvNzidGWzv9g5E5dHuPVn8Z/GJ0RN6raFa79SYhu7mMJtk8C3ArHyUx1TFRIWkXftltFrhwuiFK9mX4AbbFhz9XMP2u+wplcgzl1yinrzgVA1Zdfa2DiEi9O8CEtCA8LAj6ZpehJCg6/oHRjdbM7cKjLFpuLjvxAZ+FBfT8z8W/wMSbCotUS3t0QAAAABJRU5ErkJggg==", aa = "data:image/png;base64, ", w = {
  width: 705,
  image: aa
}, Z = /* @__PURE__ */ I({
  __name: "CommandBigIconTextButton",
  props: {
    cmd: {},
    label: {},
    showArrow: { type: Boolean },
    x: {},
    y: {},
    resourceImage: {},
    imageWidth: {}
  },
  setup(t) {
    const e = H(), a = t, n = f(() => e == null ? void 0 : e.getters["command/can"](a.cmd)), r = N(V);
    function i() {
      r.run(a.cmd, void 0);
    }
    return (s, d) => (b(), E("div", {
      onClick: ee(i, ["stop"])
    }, [
      A(l(ye), {
        label: t.label,
        "resource-image": t.resourceImage ?? l(w).image,
        disabled: !n.value,
        showArrow: t.showArrow,
        x: t.x,
        y: t.y,
        "image-width": t.imageWidth ?? l(w).width
      }, null, 8, ["label", "resource-image", "disabled", "showArrow", "x", "y", "image-width"])
    ]));
  }
}), na = { style: { display: "flex", gap: "8px" } }, oa = /* @__PURE__ */ I({
  __name: "FileButtonGroup",
  setup(t) {
    se();
    const { t: e } = ie();
    return (a, n) => (b(), E("div", na, [
      A(Z, {
        cmd: l(o).Open,
        label: a.$t("toolbar.file.open"),
        x: 0,
        y: -30
      }, null, 8, ["cmd", "label"]),
      A(l(Y), {
        vertical: !0,
        height: 65,
        margin: "0px"
      }),
      A(Z, {
        cmd: l(o).Export,
        label: a.$t("toolbar.file.exportDocument"),
        x: -24,
        y: -30
      }, null, 8, ["cmd", "label"])
    ]));
  }
}), ra = { style: { display: "flex", gap: "8px" } }, la = /* @__PURE__ */ I({
  __name: "UndoRedoGroup",
  setup(t) {
    return (e, a) => (b(), E("div", ra, [
      A(Z, {
        cmd: l(o).Undo,
        label: e.$t("toolbar.start.undo"),
        x: -120,
        y: -30
      }, null, 8, ["cmd", "label"]),
      A(Z, {
        cmd: l(o).Redo,
        label: e.$t("toolbar.start.redo"),
        x: -96,
        y: -30
      }, null, 8, ["cmd", "label"])
    ]));
  }
}), ia = { style: { display: "flex", gap: "8px" } }, sa = /* @__PURE__ */ I({
  __name: "ClipboardGroup",
  setup(t) {
    const e = se(), { t: a } = ie(), n = {
      width: 737,
      image: Fe
    };
    function r(i) {
      location.protocol === "https:" || location.hostname === "localhost" || location.hostname === "127.0.0.1" || (i.preventDefault(), i.stopPropagation(), i.stopImmediatePropagation(), e.warning(a("common.httpsOnly")));
    }
    return (i, s) => (b(), E("div", ia, [
      A(Z, {
        cmd: l(o).Copy,
        label: i.$t("toolbar.start.copy"),
        "resource-image": n.image,
        "image-width": n.width,
        x: -96,
        y: -30
      }, null, 8, ["cmd", "label", "resource-image", "image-width"]),
      A(Z, {
        cmd: l(o).Paste,
        label: i.$t("toolbar.start.paste"),
        "resource-image": n.image,
        "image-width": n.width,
        x: -72,
        y: -30,
        onClickCapture: r
      }, null, 8, ["cmd", "label", "resource-image", "image-width"])
    ]));
  }
}), Aa = { class: "trigger-wrapper" }, da = /* @__PURE__ */ I({
  __name: "CommandBigIconPopoverButton",
  props: {
    show: { type: Boolean },
    cmd: {},
    label: {},
    x: {},
    y: {},
    placement: { default: "bottom" }
  },
  emits: ["update:show"],
  setup(t, { emit: e }) {
    const a = H(), n = t, r = f(() => a == null ? void 0 : a.getters["command/can"](n.cmd)), i = f(() => a == null ? void 0 : a.getters["command/active"](n.cmd)), s = N(V), d = e;
    function c(g) {
      const h = { value: g };
      s.run(n.cmd, h);
    }
    function u(g) {
      d("update:show", g);
    }
    return (g, h) => (b(), E("div", null, [
      A(l(Oe), {
        show: t.show,
        trigger: "click",
        placement: t.placement,
        "onUpdate:show": u
      }, {
        trigger: D(() => [
          F("div", Aa, [
            A(l(ye), {
              label: t.label,
              "resource-image": l(w).image,
              disabled: !r.value,
              active: i.value,
              showArrow: !0,
              x: t.x,
              y: t.y,
              "image-width": l(w).width
            }, null, 8, ["label", "resource-image", "disabled", "active", "x", "y", "image-width"])
          ])
        ]),
        default: D(() => [
          Ne(g.$slots, "popover", { runCommand: c }, void 0, !0)
        ]),
        _: 3
      }, 8, ["show", "placement"])
    ]));
  }
}), ua = /* @__PURE__ */ G(da, [["__scopeId", "data-v-7c8b9bb8"]]), ca = { class: "global-basic-display-text panel-title" }, ma = ["onClick"], ga = ["src"], pa = /* @__PURE__ */ I({
  __name: "CommandBigIconNewSlidePopover",
  setup(t) {
    const e = H(), a = N(V), n = B(!1), r = f(() => e == null ? void 0 : e.getters["file/slideLayoutList"]), i = f(() => ({
      gridTemplateColumns: "repeat(4, 1fr)"
      // 每行4模板
    }));
    function s(c, u) {
      n.value = !1;
      let g = {};
      g.masterIndex = u, g.layoutIndex = c.layoutIndex, a.run(o.NewSlide, { value: g });
    }
    function d(c, u) {
      return u < 1 ? !1 : c < u - 1;
    }
    return Ce(n, (c) => {
      c && a.run(o.GetLayoutList, void 0);
    }), (c, u) => {
      const g = X("n-ellipsis");
      return b(), E("div", null, [
        A(ua, {
          cmd: l(o).NewSlide,
          label: c.$t("toolbar.start.new"),
          x: -72,
          y: -32,
          placement: "bottom-start",
          show: n.value,
          "onUpdate:show": u[0] || (u[0] = (h) => n.value = h)
        }, {
          popover: D(() => [
            F("div", null, [
              F("div", ca, ne(c.$t("toolbar.start.newFromLayout")), 1),
              A(l(Qe), { "max-height": 400 }, {
                default: D(() => [
                  (b(!0), E(Ae, null, de(r.value, (h, P) => (b(), E("div", { key: P }, [
                    F("div", {
                      class: "grid",
                      style: He(i.value)
                    }, [
                      (b(!0), E(Ae, null, de(h, (p) => (b(), E("div", {
                        key: p.id,
                        class: "layout",
                        onClick: (C) => s(p, P)
                      }, [
                        F("img", {
                          src: p.img,
                          class: "layout-img"
                        }, null, 8, ga),
                        A(g, {
                          class: "global-basic-display-text",
                          style: {
                            color: "var(--primary-text)",
                            lineHeight: "normal",
                            maxWidth: "70px"
                          }
                        }, {
                          default: D(() => [
                            Ve(ne(p.name || ""), 1)
                          ]),
                          _: 2
                        }, 1024)
                      ], 8, ma))), 128))
                    ], 4),
                    d(Number(P), r.value.length) ? (b(), k(l(Y), {
                      key: 0,
                      margin: "15px 0px"
                    })) : j("", !0)
                  ]))), 128))
                ]),
                _: 1
              })
            ])
          ]),
          _: 1
        }, 8, ["cmd", "label", "show"])
      ]);
    };
  }
}), fa = /* @__PURE__ */ G(pa, [["__scopeId", "data-v-364883dd"]]), ha = { style: { display: "flex", gap: "8px" } }, va = /* @__PURE__ */ I({
  __name: "SlidesGroup",
  setup(t) {
    return (e, a) => (b(), E("div", ha, [
      A(fa)
    ]));
  }
}), ba = /* @__PURE__ */ I({
  __name: "CommandAlignHorizontalGroup",
  props: {
    cmd: {}
  },
  setup(t) {
    const e = H(), a = t, n = f(() => e == null ? void 0 : e.getters["command/can"](a.cmd)), r = f(() => e == null ? void 0 : e.getters["command/getVal"](a.cmd)), i = N(V), s = {
      Right: 0,
      // 右对齐
      Left: 1,
      // 左对齐
      Center: 2,
      // 居中
      Justify: 3,
      // 两端对齐
      Distribute: 4
      // 分散对齐
    };
    function d(c) {
      const u = { value: c };
      i.run(a.cmd, u);
    }
    return (c, u) => {
      const g = X("n-space");
      return b(), k(g, null, {
        default: D(() => [
          A(l(z), {
            active: r.value === "left",
            disabled: !n.value,
            onClick: u[0] || (u[0] = (h) => d(s.Left)),
            "resource-image": l(w).image,
            x: -192,
            y: -56,
            "image-width": l(w).width,
            tooltip: c.$t("toolbar.start.horizontalAlignLeft"),
            class: "global-small-icon-button"
          }, null, 8, ["active", "disabled", "resource-image", "image-width", "tooltip"]),
          A(l(z), {
            active: r.value === "center",
            disabled: !n.value,
            onClick: u[1] || (u[1] = (h) => d(s.Center)),
            "resource-image": l(w).image,
            x: -208,
            y: -56,
            "image-width": l(w).width,
            tooltip: c.$t("toolbar.start.horizontalAlignCenter"),
            class: "global-small-icon-button"
          }, null, 8, ["active", "disabled", "resource-image", "image-width", "tooltip"]),
          A(l(z), {
            active: r.value === "right",
            disabled: !n.value,
            onClick: u[2] || (u[2] = (h) => d(s.Right)),
            "resource-image": l(w).image,
            x: -224,
            y: -56,
            "image-width": l(w).width,
            tooltip: c.$t("toolbar.start.horizontalAlignRight"),
            class: "global-small-icon-button"
          }, null, 8, ["active", "disabled", "resource-image", "image-width", "tooltip"]),
          A(l(z), {
            active: r.value === "justify",
            disabled: !n.value,
            onClick: u[3] || (u[3] = (h) => d(s.Justify)),
            "resource-image": l(w).image,
            x: -240,
            y: -56,
            "image-width": l(w).width,
            tooltip: c.$t("toolbar.start.horizontalAlignJustify"),
            class: "global-small-icon-button"
          }, null, 8, ["active", "disabled", "resource-image", "image-width", "tooltip"]),
          A(l(z), {
            active: r.value === "distribute",
            disabled: !n.value,
            onClick: u[4] || (u[4] = (h) => d(s.Distribute)),
            "resource-image": l(w).image,
            x: -336,
            y: -56,
            "image-width": l(w).width,
            tooltip: c.$t("toolbar.start.horizontalAlignDistribute"),
            class: "global-small-icon-button"
          }, null, 8, ["active", "disabled", "resource-image", "image-width", "tooltip"])
        ]),
        _: 1
      });
    };
  }
}), ya = /* @__PURE__ */ I({
  __name: "CommandAlignVerticalGroup",
  props: {
    cmd: {}
  },
  setup(t) {
    const e = H(), a = t, n = f(() => e == null ? void 0 : e.getters["command/can"](a.cmd)), r = f(() => e == null ? void 0 : e.getters["command/getVal"](a.cmd)), i = N(V), s = {
      Top: 0,
      //0
      Center: 1,
      //1
      Bottom: 2,
      //2
      Justified: 3,
      //3
      Distributed: 4
      //4
    };
    function d(c) {
      const u = { value: c };
      i.run(a.cmd, u);
    }
    return (c, u) => {
      const g = X("n-space");
      return b(), k(g, null, {
        default: D(() => [
          A(l(z), {
            active: r.value === "top",
            disabled: !n.value,
            onClick: u[0] || (u[0] = (h) => d(s.Top)),
            "resource-image": l(w).image,
            x: -144,
            y: -56,
            "image-width": l(w).width,
            tooltip: c.$t("toolbar.start.verticalAlignTop"),
            class: "global-small-icon-button"
          }, null, 8, ["active", "disabled", "resource-image", "image-width", "tooltip"]),
          A(l(z), {
            active: r.value === "center",
            disabled: !n.value,
            onClick: u[1] || (u[1] = (h) => d(s.Center)),
            "resource-image": l(w).image,
            x: -160,
            y: -56,
            "image-width": l(w).width,
            tooltip: c.$t("toolbar.start.verticalAlignCenter"),
            class: "global-small-icon-button"
          }, null, 8, ["active", "disabled", "resource-image", "image-width", "tooltip"]),
          A(l(z), {
            active: r.value === "bottom",
            disabled: !n.value,
            onClick: u[2] || (u[2] = (h) => d(s.Bottom)),
            "resource-image": l(w).image,
            x: -176,
            y: -56,
            "image-width": l(w).width,
            tooltip: c.$t("toolbar.start.verticalAlignBottom"),
            class: "global-small-icon-button"
          }, null, 8, ["active", "disabled", "resource-image", "image-width", "tooltip"])
        ]),
        _: 1
      });
    };
  }
}), Ca = { class: "toolbar-group" }, wa = /* @__PURE__ */ I({
  __name: "ParaStyleGroup",
  setup(t) {
    return (e, a) => {
      const n = X("n-space");
      return b(), E("div", Ca, [
        A(n, { vertical: "" }, {
          default: D(() => [
            A(ya, {
              cmd: l(o).AlignVertical
            }, null, 8, ["cmd"]),
            A(ba, {
              cmd: l(o).AlignHorizontal
            }, null, 8, ["cmd"])
          ]),
          _: 1
        })
      ]);
    };
  }
}), Sa = /* @__PURE__ */ G(wa, [["__scopeId", "data-v-fb9d4736"]]), J = /* @__PURE__ */ I({
  __name: "CommandSmallButton",
  props: {
    cmd: {},
    x: {},
    y: {},
    tooltip: {}
  },
  setup(t) {
    const e = H(), a = t, n = f(() => e == null ? void 0 : e.getters["command/can"](a.cmd)), r = f(() => e == null ? void 0 : e.getters["command/active"](a.cmd)), i = N(V);
    function s() {
      const c = { value: !r.value };
      i.run(a.cmd, c);
    }
    return (d, c) => (b(), k(l(z), {
      onClick: s,
      "resource-image": l(w).image,
      disabled: !n.value,
      x: t.x,
      y: t.y,
      "image-width": l(w).width,
      tooltip: t.tooltip,
      active: r.value
    }, null, 8, ["resource-image", "disabled", "x", "y", "image-width", "tooltip", "active"]));
  }
}), fe = /* @__PURE__ */ I({
  __name: "CommandEditableSelect",
  props: {
    cmd: {},
    options: {},
    width: {},
    type: {},
    validateInput: { type: Function }
  },
  setup(t) {
    const e = H(), a = t, n = f(() => e == null ? void 0 : e.getters["command/can"](a.cmd)), r = f(() => e == null ? void 0 : e.getters["command/getVal"](a.cmd)), i = N(V);
    function s(d) {
      const c = { value: d };
      i.run(a.cmd, c), e.commit("command/setState", {
        cmd: a.cmd,
        ui: { value: d }
      });
    }
    return (d, c) => (b(), k(l(Te), {
      "model-value": r.value,
      "onUpdate:modelValue": s,
      options: t.options,
      disabled: !n.value,
      width: t.width,
      "validate-input": t.validateInput,
      type: t.type
    }, null, 8, ["model-value", "options", "disabled", "width", "validate-input", "type"]));
  }
}), Ea = /* @__PURE__ */ I({
  __name: "CommandColorPaletteSmallButton",
  props: {
    cmd: {},
    tooltip: {},
    x: {},
    y: {},
    showFill: { type: Boolean }
  },
  setup(t) {
    const e = H(), a = N(V);
    let n = B([]), r = B([]);
    const i = B(!1), s = t, d = f(() => e == null ? void 0 : e.getters["command/can"](s.cmd)), c = f(() => e == null ? void 0 : e.getters["command/getVal"](s.cmd)), u = f(() => e == null ? void 0 : e.getters["file/recentColors"]);
    function g(P) {
      const p = { value: P };
      a.run(s.cmd, p), e.commit("file/addRecentColors", P);
    }
    function h(P) {
      var p;
      if (i.value = P, P) {
        let C = e == null ? void 0 : e.getters["file/colorPalette"];
        if (!C) {
          const L = (p = a.api) == null ? void 0 : p.getPalette();
          L && (C = xe(L), e.commit("file/setColorPalette", C));
        }
        n.value = C == null ? void 0 : C.standardColors, r.value = C == null ? void 0 : C.themeColors;
      }
    }
    return (P, p) => (b(), k(l(ke), {
      val: c.value,
      "standard-colors": l(n),
      "theme-colors": l(r),
      "recent-colors": u.value,
      showFill: t.showFill,
      onSelect: g,
      onShow: h
    }, {
      default: D(() => [
        A(l(ze), {
          "resource-image": l(w).image,
          disabled: !d.value,
          x: t.x,
          y: t.y,
          "image-width": l(w).width,
          tooltip: t.tooltip,
          "sub-showing": i.value,
          "show-color-cube": !0,
          color: t.showFill ? c.value || "" : c.value || "rgb(0, 0, 0)",
          onClick: p[0] || (p[0] = ee(() => {
          }, ["stop"]))
        }, null, 8, ["resource-image", "disabled", "x", "y", "image-width", "tooltip", "sub-showing", "color"])
      ]),
      _: 1
    }, 8, ["val", "standard-colors", "theme-colors", "recent-colors", "showFill"]));
  }
}), Pa = {
  common: {
    httpsOnly: "Please use this feature in an HTTPS environment",
    clipboardShortcutTip: "Browser security restrictions blocked this button action. Please use the {shortcut} keyboard shortcut.",
    emptyFileUnsupported: "Opening 0KB empty files is not supported."
  },
  toolbar: {
    file: {
      title: "FILE",
      export: "Export",
      exportDocument: "Export",
      exportPDF: "Export PDF",
      open: "Open"
    },
    start: {
      title: "START",
      undo: "Undo",
      redo: "Redo",
      copy: "Copy",
      paste: "Paste",
      new: "New",
      newFromLayout: "New from Layout",
      bold: "Bold",
      italic: "Italic",
      underline: "Underline",
      strikeout: "Strikeout",
      fontClolor: "Font Clolor",
      verticalAlignTop: "Align Top",
      verticalAlignCenter: "Align Center",
      verticalAlignBottom: "Align Bottom",
      horizontalAlignLeft: "Align Left",
      horizontalAlignCenter: "Align Center",
      horizontalAlignRight: "Align Right",
      horizontalAlignJustify: "Align Justify",
      horizontalAlignDistribute: "Align Distribute"
    }
  },
  statusBar: {
    fullscreen: "Full Screen",
    play: "Play",
    playFromStart: "Play From Start",
    playFromCurrent: "Play From Current",
    autoZoom: "Auto Zoom",
    slides: "Slides"
  },
  dropDown: {
    slide: {
      new: "New Slide",
      delete: "Delete Slide"
    }
  },
  dialogs: {
    pageSelector: {
      title: "Jump To",
      jumpTo: "Jump to the specified page",
      pageCountError: "Page number is incorrect, please re-enter it."
    }
  }
}, Ba = we(Xe, Pa), Ee = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: Ba
}, Symbol.toStringTag, { value: "Module" })), Ia = {
  common: {
    httpsOnly: "请在https环境下使用该功能",
    clipboardShortcutTip: "受浏览器安全限制，无法通过按钮完成该操作，请使用快捷键 {shortcut}。",
    emptyFileUnsupported: "不支持打开 0KB 的空文件"
  },
  toolbar: {
    file: {
      title: "文件",
      export: "导出",
      exportDocument: "导出",
      exportPDF: "导出PDF",
      open: "打开"
    },
    start: {
      title: "开始",
      undo: "撤销",
      redo: "重做",
      copy: "复制",
      paste: "粘贴",
      new: "新建",
      newFromLayout: "从版式新建",
      bold: "粗体",
      italic: "斜体",
      underline: "下划线",
      strikeout: "删除线",
      fontClolor: "字体颜色",
      verticalAlignTop: "顶端对齐",
      verticalAlignCenter: "垂直居中",
      verticalAlignBottom: "底部对齐",
      horizontalAlignLeft: "左对齐",
      horizontalAlignCenter: "居中对齐",
      horizontalAlignRight: "右对齐",
      horizontalAlignJustify: "两端对齐",
      horizontalAlignDistribute: "分散对齐"
    }
  },
  statusBar: {
    fullscreen: "全屏",
    play: "播放",
    playFromStart: "从首页开始",
    playFromCurrent: "从当前页开始",
    autoZoom: "最佳显示比例",
    slides: "幻灯片"
  },
  dropDown: {
    slide: {
      new: "新建幻灯片",
      delete: "删除幻灯片"
    }
  },
  dialogs: {
    pageSelector: {
      title: "跳转",
      jumpTo: "跳转到指定页码",
      pageCountError: "当前页码有误，请重新输入"
    }
  }
}, Ra = we(Ge, Ia), Pe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: Ra
}, Symbol.toStringTag, { value: "Module" })), Da = /* @__PURE__ */ Object.assign({ "./en-US.ts": Ee, "./zh-CN.ts": Pe }), La = /* @__PURE__ */ Object.assign({ "./en-US.ts": Ee, "./zh-CN.ts": Pe });
function Fa() {
  let t = {};
  return he(Da, t), he(La, t), t;
}
function he(t, e) {
  for (let a in t)
    if (t[a].default) {
      let n = a.substr(a.lastIndexOf("/") + 1, 5);
      e[n] ? e[n] = {
        ...t[n],
        ...t[a].default
      } : e[n] = t[a].default;
    }
}
let _ = "zh-CN";
function Oa(t) {
  return _ = t || _, Ue({
    legacy: !1,
    locale: _,
    messages: Fa(),
    globalInjection: !0
  });
}
const Na = { class: "toolbar-group" }, Qa = /* @__PURE__ */ I({
  __name: "TextStyleGroup",
  setup(t) {
    const e = B([]), a = We("pptx", _);
    async function n() {
      (K == null || K.length == 0) && await je(), K && K.length !== e.value.length && (e.value = K.map(({ fullName: r }) => ({
        label: r,
        value: r
      })));
    }
    return (r, i) => {
      const s = X("n-space");
      return b(), E("div", Na, [
        A(s, { vertical: "" }, {
          default: D(() => [
            A(s, null, {
              default: D(() => [
                F("span", { onClick: n }, [
                  A(fe, {
                    cmd: l(o).FontName,
                    options: e.value,
                    width: 140,
                    type: "font"
                  }, null, 8, ["cmd", "options"])
                ]),
                A(fe, {
                  cmd: l(o).FontSize,
                  options: l(a),
                  width: 70,
                  "validate-input": l(Ye)
                }, null, 8, ["cmd", "options", "validate-input"])
              ]),
              _: 1
            }),
            A(s, null, {
              default: D(() => [
                A(J, {
                  cmd: l(o).Bold,
                  x: -256,
                  y: -56,
                  tooltip: r.$t("toolbar.start.bold"),
                  class: "global-small-icon-button"
                }, null, 8, ["cmd", "tooltip"]),
                A(J, {
                  cmd: l(o).Italic,
                  x: -272,
                  y: -56,
                  tooltip: r.$t("toolbar.start.italic"),
                  class: "global-small-icon-button"
                }, null, 8, ["cmd", "tooltip"]),
                A(J, {
                  cmd: l(o).Underline,
                  x: -289,
                  y: -56,
                  tooltip: r.$t("toolbar.start.underline"),
                  class: "global-small-icon-button"
                }, null, 8, ["cmd", "tooltip"]),
                A(J, {
                  cmd: l(o).Strikeout,
                  x: -304,
                  y: -56,
                  tooltip: r.$t("toolbar.start.strikeout"),
                  class: "global-small-icon-button"
                }, null, 8, ["cmd", "tooltip"]),
                A(Ea, {
                  cmd: l(o).FontColor,
                  x: -320.5,
                  y: -56,
                  tooltip: r.$t("toolbar.start.fontClolor"),
                  class: "global-small-icon-dropdown-button"
                }, null, 8, ["cmd", "tooltip"])
              ]),
              _: 1
            })
          ]),
          _: 1
        })
      ]);
    };
  }
}), Ha = /* @__PURE__ */ G(Qa, [["__scopeId", "data-v-902bee45"]]), Va = { class: "toolbar-container" }, Ta = {
  key: 0,
  class: "ribbon-content"
}, za = {
  key: 1,
  class: "ribbon-content"
}, ka = /* @__PURE__ */ I({
  __name: "PptRibbon",
  setup(t) {
    const e = H(), a = f(() => e == null ? void 0 : e.getters["file/title"]), n = B("start");
    return (r, i) => (b(), E("div", null, [
      F("div", Va, [
        A(l(qe), {
          documentTitle: a.value,
          logoSrc: l(ta),
          class: "toolbar-prefix"
        }, null, 8, ["documentTitle", "logoSrc"]),
        A(l(Ze), {
          modelValue: n.value,
          "onUpdate:modelValue": i[0] || (i[0] = (s) => n.value = s),
          tabs: [
            { name: "file", label: r.$t("toolbar.file.title") },
            { name: "start", label: r.$t("toolbar.start.title") }
          ]
        }, null, 8, ["modelValue", "tabs"]),
        i[1] || (i[1] = F("div", { class: "toolbar-suffix" }, null, -1))
      ]),
      F("div", null, [
        n.value == "file" ? (b(), E("div", Ta, [
          A(l(oa))
        ])) : j("", !0),
        n.value == "start" ? (b(), E("div", za, [
          A(l(la)),
          A(l(Y), {
            vertical: !0,
            height: 65,
            margin: "0px 8px"
          }),
          A(l(sa)),
          A(l(Y), {
            vertical: !0,
            height: 65,
            margin: "0px 8px"
          }),
          A(l(va)),
          A(l(Y), {
            vertical: !0,
            height: 65,
            margin: "0px 8px"
          }),
          A(l(Ha)),
          A(l(Y), {
            vertical: !0,
            height: 65,
            margin: "0px 8px"
          }),
          A(l(Sa))
        ])) : j("", !0)
      ])
    ]));
  }
}), xa = /* @__PURE__ */ G(ka, [["__scopeId", "data-v-7da90f12"]]), Xa = { class: "zoom-wrapper" }, Ga = /* @__PURE__ */ I({
  __name: "CommandZoom",
  props: {
    cmd: {},
    modelValue: {},
    min: { default: 10 },
    max: { default: 400 },
    step: {},
    disabled: { type: Boolean },
    width: { default: 200 }
  },
  setup(t) {
    const e = H(), a = t, n = f(() => e == null ? void 0 : e.getters["command/can"](a.cmd)), r = f(() => e == null ? void 0 : e.getters["command/getVal"](a.cmd)), i = N(V);
    function s(d) {
      const c = { value: d };
      i.run(a.cmd, c), e.commit("command/setState", {
        cmd: o.Zoom,
        ui: {
          value: d
        }
      });
    }
    return (d, c) => (b(), E("div", Xa, [
      A(l(Ke), {
        modelValue: r.value,
        "onUpdate:modelValue": c[0] || (c[0] = (u) => r.value = u),
        onChange: s,
        min: t.min,
        max: t.max,
        width: t.width,
        disabled: !n.value
      }, null, 8, ["modelValue", "min", "max", "width", "disabled"]),
      A(l(Me), {
        modelValue: r.value,
        "onUpdate:modelValue": [
          c[1] || (c[1] = (u) => r.value = u),
          s
        ],
        disabled: !n.value,
        min: t.min,
        max: t.max
      }, null, 8, ["modelValue", "disabled", "min", "max"])
    ]));
  }
}), Ua = /* @__PURE__ */ G(Ga, [["__scopeId", "data-v-0fb1af3f"]]), Wa = /* @__PURE__ */ I({
  __name: "CommandPageSelectorButton",
  props: {
    disabled: { type: Boolean },
    cmd: {}
  },
  emits: ["open"],
  setup(t, { emit: e }) {
    const a = H(), n = t, r = f(() => a == null ? void 0 : a.getters["file/currentPage"]), i = f(() => a == null ? void 0 : a.getters["file/pageCount"]), s = f(() => a == null ? void 0 : a.getters["command/can"](n.cmd)), d = N(V), c = e;
    function u(h) {
      const P = { value: h };
      d.run(n.cmd, P);
    }
    function g() {
      c("open", {
        callback: u,
        info: { currentPage: r.value, maxPage: i.value }
      });
    }
    return (h, P) => (b(), E("div", null, [
      A(l(oe), {
        type: "quaternary",
        disabled: !s.value,
        onClickButton: g,
        class: "page-info-label",
        label: h.$t("statusBar.slides") + " : " + r.value + "/" + i.value
      }, null, 8, ["disabled", "label"])
    ]));
  }
}), Ya = /* @__PURE__ */ G(Wa, [["__scopeId", "data-v-100268b2"]]), ja = /* @__PURE__ */ I({
  __name: "CommandSmallIconDropDownButton",
  props: {
    cmd: {},
    tooltip: {},
    placement: {},
    x: {},
    y: {},
    dropdownOptions: {}
  },
  setup(t) {
    const e = H(), a = t, n = f(() => e == null ? void 0 : e.getters["command/can"](a.cmd)), r = N(V);
    function i(d) {
      s(d);
    }
    function s(d) {
      const c = { value: d };
      r.run(a.cmd, c);
    }
    return (d, c) => (b(), E("div", null, [
      A(l(be), {
        trigger: "click",
        placement: t.placement,
        options: t.dropdownOptions,
        onSelect: i
      }, {
        default: D(() => [
          F("span", null, [
            A(l(z), {
              tooltip: t.tooltip,
              "resource-image": l(w).image,
              disabled: !n.value,
              showArrow: !0,
              x: t.x,
              y: t.y,
              "image-width": l(w).width
            }, null, 8, ["tooltip", "resource-image", "disabled", "x", "y", "image-width"])
          ])
        ]),
        _: 1
      }, 8, ["placement", "options"])
    ]));
  }
}), qa = { class: "custom-panel" }, Za = { class: "global-basic-display-text text" }, Ka = /* @__PURE__ */ I({
  __name: "PageSelectorDialog",
  setup(t, { expose: e }) {
    const a = B(!1), n = B(!1), r = B(""), i = B(0), s = B(0), d = B(0);
    let c = null;
    function u(p) {
      const C = Number(p);
      if (p === "") {
        n.value = !1, r.value = "";
        return;
      }
      !isNaN(C) && C > 0 && C <= s.value ? (n.value = !1, r.value = "") : (n.value = !0, r.value = "error");
    }
    function g(p, C) {
      p && (i.value = p.currentPage, s.value = p.maxPage, d.value = p.currentPage), n.value = !1, r.value = "", c = C, a.value = !0;
    }
    function h() {
      d.value && (c && c({
        jumpePage: d.value
      }), a.value = !1);
    }
    function P() {
      a.value = !1;
    }
    return e({
      openPopover: g
    }), (p, C) => (b(), E("div", null, [
      A(l(Je), {
        show: a.value,
        "onUpdate:show": C[1] || (C[1] = (L) => a.value = L),
        title: p.$t("dialogs.pageSelector.title"),
        width: 240
      }, {
        action: D(() => [
          A(l(oe), {
            label: p.$t("common.cancel"),
            onClickButton: P,
            type: "standard"
          }, null, 8, ["label"]),
          A(l(oe), {
            label: p.$t("common.confirm"),
            onClickButton: h
          }, null, 8, ["label"])
        ]),
        default: D(() => [
          F("div", qa, [
            F("div", Za, ne(p.$t("dialogs.pageSelector.jumpTo")), 1),
            A(l(_e), {
              "validation-status": r.value,
              feedback: n.value ? p.$t("dialogs.pageSelector.pageCountError") : ""
            }, {
              default: D(() => [
                A(l($e), {
                  value: d.value,
                  "onUpdate:value": C[0] || (C[0] = (L) => d.value = L),
                  class: "custom-input-num",
                  precision: 0,
                  max: s.value,
                  onInput: u,
                  onKeydown: et(ee(h, ["prevent"]), ["enter"])
                }, null, 8, ["value", "max", "onKeydown"])
              ]),
              _: 1
            }, 8, ["validation-status", "feedback"])
          ])
        ]),
        _: 1
      }, 8, ["show", "title"])
    ]));
  }
}), Ma = /* @__PURE__ */ G(Ka, [["__scopeId", "data-v-16bf1abf"]]), Ja = { class: "status-bar" }, _a = { class: "left" }, $a = { class: "spacer" }, en = { class: "right" }, tn = /* @__PURE__ */ I({
  __name: "StatusBar",
  setup(t) {
    const e = H(), a = f(() => e == null ? void 0 : e.getters["file/loadingRatio"]), n = f(() => e == null ? void 0 : e.getters["file/loadingStepTime"]), r = f(
      () => e == null ? void 0 : e.getters["file/showLoadingProgressBar"]
    ), i = B(null), s = f(() => e == null ? void 0 : e.getters["command/loadEnd"]);
    function d(u) {
      var g;
      (g = i == null ? void 0 : i.value) == null || g.openPopover(
        {
          currentPage: u.info.currentPage,
          maxPage: u.info.maxPage
        },
        (h) => {
          u.callback(h.jumpePage);
        }
      );
    }
    function c() {
      at(document.getElementById("main"));
    }
    return (u, g) => (b(), E("div", Ja, [
      F("div", _a, [
        A(Ya, {
          cmd: l(o).GoToPage,
          onOpen: d
        }, null, 8, ["cmd"])
      ]),
      F("div", $a, [
        r.value ? (b(), k(l(tt), {
          key: 0,
          percentage: a.value,
          loadingStepTime: n.value,
          class: "progress-bar"
        }, null, 8, ["percentage", "loadingStepTime"])) : j("", !0)
      ]),
      F("div", en, [
        A(J, {
          cmd: l(o).AutoZoom,
          tooltip: u.$t("statusBar.autoZoom"),
          x: -96.5,
          y: -56,
          class: "global-medium-icon-button"
        }, null, 8, ["cmd", "tooltip"]),
        A(ja, {
          cmd: l(o).Play,
          tooltip: u.$t("statusBar.play"),
          x: -80.5,
          y: -56,
          placement: "top",
          class: "global-medium-icon-button",
          "dropdown-options": [
            {
              key: "playFromStart",
              label: u.$t("statusBar.playFromStart")
            },
            {
              key: "playFromCurrent",
              label: u.$t("statusBar.playFromCurrent")
            }
          ]
        }, null, 8, ["cmd", "tooltip", "dropdown-options"]),
        A(l(Y), {
          vertical: !0,
          height: 12,
          margin: "0px"
        }),
        A(Ua, {
          cmd: l(o).Zoom,
          step: 1
        }, null, 8, ["cmd"]),
        A(l(z), {
          onClick: c,
          "resource-image": l(w).image,
          x: -32,
          y: -56,
          "button-size": 24,
          "image-width": l(w).width,
          tooltip: u.$t("statusBar.fullscreen"),
          class: "global-medium-icon-button",
          disabled: !s.value
        }, null, 8, ["resource-image", "image-width", "tooltip", "disabled"])
      ]),
      A(Ma, {
        ref_key: "PageSelectorDialogRef",
        ref: i
      }, null, 512)
    ]));
  }
}), an = /* @__PURE__ */ G(tn, [["__scopeId", "data-v-d189a861"]]), nn = nt({
  components: [
    ot,
    rt,
    lt,
    it,
    st,
    At,
    dt,
    ut,
    ct,
    mt,
    gt,
    pt,
    ft,
    ht,
    vt,
    bt,
    yt,
    Ct,
    wt,
    St,
    Et,
    Pt,
    Bt,
    It,
    Rt,
    Dt,
    Lt,
    Ft,
    Ot,
    Nt,
    Qt,
    Ht,
    Vt,
    Tt,
    zt,
    kt,
    xt
  ]
});
function on(t) {
  t.use(nn);
}
function rn() {
  switch (_) {
    case "zh-CN":
      return ue;
    case "en-US":
      return Xt;
  }
  return ue;
}
function ln() {
  return {
    common: {
      primaryColor: "#D1560D",
      // 主色
      primaryColorHover: "#D1560D",
      // hover 主色
      primaryColorPressed: "#D1560D",
      // 按下色
      primaryColorSuppl: "#D1560D"
      // 补充主色
    }
  };
}
function sn(t) {
  t.registerHandler(o.Export, {
    run: async (e, a) => {
      await e.doExport("exportDocument");
    },
    refresh: /* @__PURE__ */ new Set([R.Init, R.ExportReady])
  }), t.registerHandler(o.ExportPDF, {
    run: async (e, a) => {
      await e.doExport("exportPDF");
    },
    refresh: /* @__PURE__ */ new Set([R.ExportReady])
  }), t.registerRefresher(o.Export, (e) => {
    e.canRefreshCommand(o.Export) && e.store.commit("command/setEnabled", {
      cmd: o.Export,
      enabled: !0
    });
  }), t.registerRefresher(o.ExportPDF, (e) => {
    e.canRefreshCommand(o.ExportPDF) && e.store.commit("command/setEnabled", {
      cmd: o.ExportPDF,
      enabled: !1
    });
  });
}
function An(t) {
  t.registerHandler(o.Open, {
    run: (e, a) => e.openFile(),
    refresh: /* @__PURE__ */ new Set([R.Init])
  }), t.registerRefresher(o.Open, (e) => {
    e.canRefreshCommand(o.Open) && e.store.commit("command/setEnabled", {
      cmd: o.Open,
      enabled: !0
    });
  });
}
function dn(t) {
  t.registerHandler(o.Zoom, {
    run: (e, a) => e.setZoom(a.value),
    refresh: /* @__PURE__ */ new Set([R.Init, R.ZoomChange])
  }), t.registerRefresher(o.Zoom, (e) => {
    e.canRefreshCommand(o.Zoom) && (e.store.commit("command/setState", {
      cmd: o.Zoom,
      ui: {
        value: e.api.getZoom()
      }
    }), e.store.commit("command/setEnabled", {
      cmd: o.Zoom,
      enabled: !0
    }));
  });
}
function un(t) {
  t.registerHandler(o.AutoZoom, {
    run: (e, a) => e.autoZoom(),
    refresh: /* @__PURE__ */ new Set([R.Init])
  }), t.registerRefresher(o.AutoZoom, (e) => {
    e.canRefreshCommand(o.AutoZoom) && e.store.commit("command/setEnabled", {
      cmd: o.AutoZoom,
      enabled: !0
    });
  });
}
function cn(t) {
  t.registerHandler(o.Play, {
    run: (e, a) => e.doPlay(a.value),
    refresh: /* @__PURE__ */ new Set([R.Init])
  }), t.registerRefresher(o.Play, (e) => {
    e.canRefreshCommand(o.Play) && e.store.commit("command/setEnabled", {
      cmd: o.Play,
      enabled: !0
    });
  });
}
function mn(t) {
  t.registerHandler(o.GoToPage, {
    run: (e, a) => e.goToPage(a.value),
    refresh: /* @__PURE__ */ new Set([R.Init])
  }), t.registerRefresher(o.GoToPage, (e) => {
    e.canRefreshCommand(o.GoToPage) && e.store.commit("command/setEnabled", {
      cmd: o.GoToPage,
      enabled: !0
    });
  });
}
function gn(t) {
  t.registerHandler(o.NewSlide, {
    run: (e, a) => e.newSlide(a.value),
    refresh: /* @__PURE__ */ new Set([R.Init])
  }), t.registerRefresher(o.NewSlide, (e) => {
    e.pptReady && e.store.commit("command/setEnabled", {
      cmd: o.NewSlide,
      enabled: !0
    });
  });
}
function pn(t) {
  t.registerHandler(o.Bold, {
    run: (e, a) => e.setBold(a.value),
    refresh: /* @__PURE__ */ new Set([])
  });
}
function fn(t) {
  t.registerHandler(o.Underline, {
    run: (e, a) => e.setUnderline(a.value),
    refresh: /* @__PURE__ */ new Set([])
  });
}
function hn(t) {
  t.registerHandler(o.Strikeout, {
    run: (e, a) => e.setStrikeout(a.value),
    refresh: /* @__PURE__ */ new Set([])
  });
}
function vn(t) {
  t.registerHandler(o.Italic, {
    run: (e, a) => e.setItalic(a.value),
    refresh: /* @__PURE__ */ new Set([])
  });
}
function bn(t) {
  t.registerHandler(o.FontSize, {
    run: (e, a) => e.setFontSize(a.value),
    refresh: /* @__PURE__ */ new Set([])
  });
}
function yn(t) {
  t.registerHandler(o.FontColor, {
    run: (e, a) => e.setFontColor(a.value),
    refresh: /* @__PURE__ */ new Set([])
  });
}
function Cn(t) {
  t.registerHandler(o.AlignHorizontal, {
    run: (e, a) => e.setAlignHorizontalUI(a.value),
    refresh: /* @__PURE__ */ new Set([])
  });
}
function wn(t) {
  t.registerHandler(o.AlignVertical, {
    run: (e, a) => e.setAlignVerticalUI(a.value),
    refresh: /* @__PURE__ */ new Set([])
  });
}
function Sn(t) {
  t.registerHandler(o.FontName, {
    run: (e, a) => e.setFontName(a.value),
    refresh: /* @__PURE__ */ new Set([])
  });
}
function En(t) {
  t.registerHandler(o.Undo, {
    run: (e) => e.undo(),
    refresh: /* @__PURE__ */ new Set([R.UndoRedoChange])
  }), t.registerRefresher(o.Undo, (e) => {
    e.pptReady && e.store.commit("command/setEnabled", {
      cmd: o.Undo,
      enabled: e.api.canUndo()
    });
  });
}
function Pn(t) {
  t.registerHandler(o.Redo, {
    run: (e) => e.redo(),
    refresh: /* @__PURE__ */ new Set([R.UndoRedoChange])
  }), t.registerRefresher(o.Redo, (e) => {
    e.pptReady && e.store.commit("command/setEnabled", {
      cmd: o.Redo,
      enabled: e.api.canRedo()
    });
  });
}
function Bn(t) {
  t.registerHandler(o.GetLayoutList, {
    run: (e, a) => {
      In(t);
    },
    refresh: /* @__PURE__ */ new Set([R.Init])
  }), t.registerRefresher(o.GetLayoutList, (e) => {
    e.canRefreshCommand(o.GetLayoutList) && e.store.commit("command/setEnabled", {
      cmd: o.GetLayoutList,
      enabled: !0
    });
  });
}
function In(t) {
  const e = t.api.getLayoutList();
  t.store.commit("file/setSlideLayoutList", e);
}
function Rn(t) {
  t.registerHandler(o.SlideOptions, {
    run: (e, a) => e.doSlideOperations(a.value),
    refresh: /* @__PURE__ */ new Set([R.Init])
  }), t.registerRefresher(o.SlideOptions, (e) => {
    e.pptReady && e.store.commit("command/setEnabled", {
      cmd: o.SlideOptions,
      enabled: !0
    });
  });
}
function Dn(t) {
  t.registerHandler(o.Copy, {
    run: (e) => e.copy()
  }), t.registerHandler(o.Paste, {
    run: (e) => e.paste()
  });
}
function Ln() {
  const t = N(V);
  An(t), sn(t), dn(t), un(t), cn(t), mn(t), gn(t), En(t), Pn(t), Dn(t), pn(t), fn(t), hn(t), vn(t), bn(t), yn(t), Cn(t), wn(t), Sn(t), Bn(t), Rn(t);
}
const Fn = { class: "app-shell" }, On = { class: "app-stage" }, Nn = { id: "appContainer" }, Qn = /* @__PURE__ */ I({
  __name: "App",
  setup(t) {
    const e = H(), a = B(null), n = B(null), r = B(!0), i = B(null), s = B(null), d = N(le, null), c = f(
      () => {
        var y;
        return ((y = d == null ? void 0 : d.uiOptions) == null ? void 0 : y.showTopBar) !== !1;
      }
    ), u = f(
      () => {
        var y;
        return ((y = d == null ? void 0 : d.uiOptions) == null ? void 0 : y.showBottomBar) !== !1;
      }
    ), g = f(() => e.state.file.isReady);
    Ce(g, (y) => {
      r.value = !y;
    });
    const h = f(() => e == null ? void 0 : e.state.file.hasError), P = f(
      () => (e == null ? void 0 : e.getters["command/isRunning"](o.Export)) || (e == null ? void 0 : e.getters["command/isRunning"](o.ExportPDF))
    ), p = (y) => {
      var O;
      const { callback: v } = (y == null ? void 0 : y.detail) || {};
      v && ((O = i == null ? void 0 : i.value) != null && O.openPopover) && i.value.openPopover(v);
    }, C = (y) => {
      var v;
      (v = i == null ? void 0 : i.value) == null || v.closePopover();
    }, L = () => {
      var y;
      (y = s == null ? void 0 : s.value) == null || y.openPopover();
    };
    return Gt(() => {
      const y = (d == null ? void 0 : d.eventTarget) ?? window;
      Ln(), y.addEventListener("FilePassWordError", p), y.addEventListener("FilePassWordOK", C), y.addEventListener("OpenDocumentFailed", L);
    }), Ut(() => {
      const y = (d == null ? void 0 : d.eventTarget) ?? window;
      e.commit("file/clearError"), y.removeEventListener(
        "FilePassWordError",
        p
      ), y.removeEventListener("FilePassWordOK", C), y.removeEventListener(
        "OpenDocumentFailed",
        L
      );
    }), ve(() => {
      const { toolBarElm: y, editorElm: v } = ea();
      y.value = a.value, v.value = n.value;
    }), (y, v) => {
      const O = X("n-spin"), U = X("n-message-provider"), x = X("n-modal-provider"), q = X("n-config-provider");
      return b(), E("div", Fn, [
        A(q, {
          class: "app-provider",
          locale: l(rn)(),
          "theme-overrides": l(ln)()
        }, {
          default: D(() => [
            A(x, null, {
              default: D(() => [
                A(U, null, {
                  default: D(() => [
                    A(l(Wt), {
                      ref_key: "dialogOpenFailedRef",
                      ref: s
                    }, null, 512),
                    A(l(Yt), {
                      ref_key: "dialogCypherRef",
                      ref: i
                    }, null, 512),
                    F("div", On, [
                      A(O, {
                        class: "app-spin",
                        show: r.value || P.value,
                        fullscreen: "",
                        style: {
                          backgroundColor: "rgba(255, 255, 255, 0.5)"
                        }
                      }, {
                        default: D(() => [
                          F("div", Nn, [
                            c.value ? (b(), k(xa, {
                              key: 0,
                              ref_key: "toolbarRef",
                              ref: a
                            }, null, 512)) : j("", !0),
                            h.value ? j("", !0) : (b(), k($t, {
                              key: 1,
                              ref_key: "editorRef",
                              ref: n,
                              class: "editor"
                            }, null, 512)),
                            u.value ? (b(), k(l(an), {
                              key: 2,
                              class: "status-bar"
                            })) : j("", !0)
                          ])
                        ]),
                        _: 1
                      }, 8, ["show"])
                    ])
                  ]),
                  _: 1
                })
              ]),
              _: 1
            })
          ]),
          _: 1
        }, 8, ["locale", "theme-overrides"])
      ]);
    };
  }
});
function Hn(t) {
  let e = Oa(t);
  const a = jt(Qn);
  return a.use(e), { app: a };
}
const Vn = {
  namespaced: !0,
  state: () => ({
    hasError: !1,
    isReady: !1,
    connected: !1,
    message: null,
    rawEvent: null,
    fileInfo: { title: "", docId: "" },
    currentPage: 0,
    pageCount: 0,
    colorPalette: null,
    recentColors: [],
    slideLayoutList: [],
    loadingRatio: 0,
    loadingStepTime: 1e3,
    showLoadingProgressBar: !0
  }),
  getters: {
    title: (t) => t.fileInfo.title,
    currentPage: (t) => t.currentPage,
    pageCount: (t) => t.pageCount,
    colorPalette: (t) => t.colorPalette,
    recentColors: (t) => t.recentColors,
    slideLayoutList: (t) => t.slideLayoutList,
    loadingRatio: (t) => t.loadingRatio,
    loadingStepTime: (t) => t.loadingStepTime,
    showLoadingProgressBar: (t) => t.showLoadingProgressBar
  },
  mutations: {
    setError(t, e) {
      t.hasError = !0, t.message = e.message, t.rawEvent = e.event ?? null;
    },
    clearError(t) {
      t.hasError = !1, t.message = null, t.rawEvent = null;
    },
    setReady(t, e = !0) {
      t.isReady = e;
    },
    setConnected(t, e) {
      t.connected = e;
    },
    setFileInfo(t, e) {
      t.fileInfo.title = e.title, t.fileInfo.docId = e.docId;
    },
    setCurrentPage(t, e) {
      t.currentPage = e;
    },
    setPageCount(t, e) {
      t.pageCount = e;
    },
    setColorPalette(t, e) {
      t.colorPalette = e;
    },
    addRecentColors(t, e) {
      function a(i) {
        return typeof i == "string" ? i : i == null ? void 0 : i.hex;
      }
      const n = a(e), r = t.recentColors.findIndex(
        (i) => a(i) === n
      );
      r !== -1 && t.recentColors.splice(r, 1), t.recentColors.unshift(e), t.recentColors.length > 10 && (t.recentColors.length = 10);
    },
    setSlideLayoutList(t, e) {
      t.slideLayoutList = e;
    },
    setLoadingRatio(t, e) {
      t.loadingRatio = e;
    },
    setLoadingStepTime(t, e) {
      t.loadingStepTime = e;
    },
    setShowLoadingProgressBar(t, e) {
      t.showLoadingProgressBar = e;
    }
  },
  actions: {
    onError({ commit: t }, e) {
      t("setError", {
        message: "文件处理失败",
        event: e
      });
    },
    onOpening({ commit: t }) {
      t("clearError"), t("setReady", !1), t("setConnected", !1), t("setLoadingRatio", 0), t("setShowLoadingProgressBar", !0);
    },
    onReady({ commit: t }, e) {
      t("setReady");
    },
    onConnected({ commit: t }, e) {
      t("setConnected", !0), t("setFileInfo", e);
    },
    onLoadPageEnd({ commit: t }, e) {
      t("setLoadingRatio", 100), setTimeout(() => {
        t("setShowLoadingProgressBar", !1);
      }, 1e3);
    },
    onExportReady({ commit: t }, e) {
    },
    onFilePassWord({ commit: t }, e) {
    }
  }
};
function ae() {
  return {
    [o.Undo]: { enabled: !1, running: !1 },
    [o.Redo]: { enabled: !1, running: !1 },
    [o.Copy]: { enabled: !1, running: !1 },
    [o.Paste]: { enabled: !1, running: !1 },
    [o.Bold]: {
      enabled: !1,
      running: !1,
      ui: {
        value: !1
      }
    },
    [o.Underline]: {
      enabled: !1,
      running: !1,
      ui: {
        value: !1
      }
    },
    [o.Strikeout]: {
      enabled: !1,
      running: !1,
      ui: {
        value: !1
      }
    },
    [o.Italic]: {
      enabled: !1,
      running: !1,
      ui: {
        value: !1
      }
    },
    [o.FontSize]: {
      enabled: !1,
      running: !1,
      ui: {
        value: ""
      }
    },
    [o.FontColor]: {
      enabled: !1,
      running: !1,
      ui: {
        value: ""
      }
    },
    [o.FontName]: {
      enabled: !1,
      running: !1,
      ui: {
        value: ""
      }
    },
    [o.AlignHorizontal]: {
      enabled: !1,
      running: !1,
      ui: {
        value: ""
      }
    },
    [o.AlignVertical]: {
      enabled: !1,
      running: !1,
      ui: {
        value: ""
      }
    },
    [o.Color]: {
      enabled: !1,
      running: !1,
      ui: {
        value: "0xFFFFFF"
      }
    },
    [o.Zoom]: {
      enabled: !1,
      running: !1,
      ui: {
        value: 100
      }
    },
    [o.AutoZoom]: {
      enabled: !1,
      running: !1
    },
    [o.Export]: {
      enabled: !1,
      running: !1
    },
    [o.ExportPDF]: {
      enabled: !1,
      running: !1
    },
    [o.Open]: {
      enabled: !1,
      running: !1
    },
    [o.Play]: {
      enabled: !1,
      running: !1
    },
    [o.NewSlide]: {
      enabled: !1,
      running: !1
    },
    [o.GoToPage]: {
      enabled: !1,
      running: !1
    },
    [o.GetLayoutList]: {
      running: !1,
      enabled: !1
    },
    [o.SlideOptions]: {
      running: !1,
      enabled: !1
    }
  };
}
const Tn = {
  namespaced: !0,
  state: () => ({
    map: ae(),
    readOnly: !1,
    loadEnd: !1
  }),
  getters: {
    can: (t) => (e) => {
      var a;
      return ((a = t.map[e]) == null ? void 0 : a.enabled) !== !0 ? !1 : t.readOnly ? t.loadEnd && re.has(e) : !0;
    },
    isRunning: (t) => (e) => {
      var a;
      return ((a = t.map[e]) == null ? void 0 : a.running) === !0;
    },
    active: (t) => (e) => {
      var n;
      const a = (n = t.map[e]) == null ? void 0 : n.ui;
      return !!a && a.value === !0;
    },
    getVal: (t) => (e) => {
      var n;
      const a = (n = t.map[e]) == null ? void 0 : n.ui;
      return !!a && a.value;
    },
    loadEnd: (t) => t.loadEnd
  },
  mutations: {
    resetCommandState(t) {
      t.map = ae(), t.readOnly = !1, t.loadEnd = !1;
    },
    setLoadEnd(t, e) {
      t.loadEnd = e;
    },
    setReadOnly(t, e) {
      t.readOnly = e;
    },
    setEnabled(t, e) {
      t.loadEnd == !1 && (e.enabled = !1), t.map[e.cmd].enabled = e.enabled;
    },
    setRunning(t, e) {
      t.map[e.cmd].running = e.running;
    },
    setState(t, e) {
      const a = t.map[e.cmd];
      if (!a) return;
      const n = e.ui;
      if (n === void 0) {
        a.ui = void 0;
        return;
      }
      a.ui = { ...a.ui ?? {}, ...n };
    },
    clearState(t, e) {
      const a = ae()[e.cmd];
      a && (t.map[e.cmd] = JSON.parse(JSON.stringify(a)));
    }
  },
  actions: {
    async run({ commit: t, getters: e }, a) {
      const { cmd: n, fn: r, param: i } = a;
      if (e.can(n)) {
        t("setRunning", { cmd: n, running: !0 });
        try {
          await r(i);
        } finally {
          t("setRunning", { cmd: n, running: !1 });
        }
      }
    }
  }
};
class zn extends qt {
  get Document() {
    return this.getAPIComponent("Document");
  }
  get Player() {
    return this.getAPIComponent("Player");
  }
  get UndoRedo() {
    return this.getAPIComponent("UndoRedo");
  }
  get Selection() {
    return this.getAPIComponent("Selection");
  }
  get Paragraph() {
    return this.getAPIComponent("Paragraph");
  }
  get TextBox() {
    return this.getAPIComponent("TextBox");
  }
  get Cursor() {
    return this.getAPIComponent("Cursor");
  }
  get Viewer() {
    return this.getAPIComponent("Viewer");
  }
}
class kn extends zn {
}
class xn extends kn {
  constructor() {
    super();
    T(this, "openFileHandler");
  }
  setOpenFileHandler(a) {
    this.openFileHandler = a;
  }
  openFile() {
    var a;
    return (a = this.openFileHandler) == null ? void 0 : a.call(this);
  }
  newSlide(a) {
    this.Document.callFun("addSlide", a);
  }
  getLayoutList() {
    return this.Document.callFun("getSlideLayouts");
  }
  async doExport(a) {
    switch (a) {
      case "exportDocument":
        await this.Document.callFun("exportDocument");
        break;
      case "exportPDF":
        console.error("missing api");
        break;
    }
  }
  doExportPDF() {
    return this.Document.callFun("exportPdf");
  }
  doPlay(a) {
    a == "playFromStart" ? this.Player.callFun("play", 1) : a == "playFromCurrent" && this.Player.callFun("play", 2);
  }
  setZoom(a) {
    this.Document.callFun("setZoom", a);
  }
  getZoom() {
    return Math.round(this.Document.callFun("getZoom") || 100);
  }
  autoZoom() {
    this.Document.callFun("autoZoom");
  }
  goToPage(a) {
    return this.Document.callFun("goToSlide", a || 1);
  }
  undo() {
    return this.UndoRedo.callFun("undo");
  }
  redo() {
    return this.UndoRedo.callFun("redo");
  }
  copy() {
    return this.Document.callFun("copy");
  }
  paste() {
    return this.Document.callFun("paste");
  }
  canUndo() {
    return this.UndoRedo.callFun("canUndo");
  }
  canRedo() {
    return this.UndoRedo.callFun("canRedo");
  }
  setUnderline(a = !0) {
    return this.Paragraph.callFun("setUnderline", a);
  }
  setStrikeout(a = !0) {
    return this.Paragraph.callFun("setStrikeThrough", a);
  }
  setBold(a = !0) {
    return this.Paragraph.callFun("setBold", a);
  }
  setItalic(a = !0) {
    return this.Paragraph.callFun("setItalic", a);
  }
  setFontSize(a) {
    return this.Paragraph.callFun("setFontSize", a);
  }
  setAlignHorizontalUI(a) {
    this.Paragraph.callFun("setAlignment", a);
  }
  setAlignVerticalUI(a) {
    this.TextBox.callFun("setVerticalAlignment", a);
  }
  setFontColor(a) {
    return this.Paragraph.callFun("setFontColor", a);
  }
  setFontName(a) {
    return this.Paragraph.callFun("setFontName", a);
  }
  getPalette() {
    return this.Document.callFun("getColorPalette");
  }
  doSlideOperations(a) {
    const { action: n } = a;
    switch (n) {
      case "newSlide":
        this.Document.callFun("addSlide");
        break;
      case "deleteSlide":
        this.Document.callFun("deleteSlides");
        break;
    }
  }
  getCursorTargetType() {
    return this.Viewer.callFun("getActiveZoom");
  }
}
function Xn(t) {
  return t ?? window.lang ?? window.navigator.language;
}
function Gn(t) {
  return new Promise((e, a) => {
    var i;
    const n = (i = t.state) == null ? void 0 : i.file;
    if (n != null && n.isReady) {
      e();
      return;
    }
    if (n != null && n.hasError) {
      a(new Error(n.message ?? "document load failed"));
      return;
    }
    const r = t.watch(
      (s) => {
        var d, c, u;
        return {
          isReady: !!((d = s.file) != null && d.isReady),
          hasError: !!((c = s.file) != null && c.hasError),
          message: ((u = s.file) == null ? void 0 : u.message) ?? null
        };
      },
      (s) => {
        if (s.isReady) {
          r(), e();
          return;
        }
        s.hasError && (r(), a(new Error(s.message ?? "document load failed")));
      }
    );
  });
}
function Un(t, e, a) {
  const n = Zt({
    modules: {
      file: Vn,
      command: Tn
    }
  }), { app: r } = Hn(Xn(e));
  on(r), r.use(n);
  const i = new xn(), s = new _t({
    store: n,
    api: i,
    eventTarget: a == null ? void 0 : a.eventTarget
  }), d = Gn(n);
  r.provide(V, s), r.provide(Se, {
    toolBarElm: M(null),
    navigateBarElm: M(null),
    editorElm: M(null),
    bottomBarElm: M(null)
  }), r.provide(le, {
    docId: (a == null ? void 0 : a.docId) ?? "",
    mode: a == null ? void 0 : a.mode,
    file: a == null ? void 0 : a.file,
    fileUrl: a == null ? void 0 : a.fileUrl,
    fileName: a == null ? void 0 : a.fileName,
    user: a == null ? void 0 : a.user,
    uiOptions: a == null ? void 0 : a.uiOptions,
    widgetMode: a == null ? void 0 : a.widgetMode,
    mainDom: M(null),
    eventTarget: (a == null ? void 0 : a.eventTarget) ?? window
  }), r.mount(t);
  async function c() {
    var u, g;
    await ((g = (u = i.docApp) == null ? void 0 : u.destroy) == null ? void 0 : g.call(u)), s.destroy(), r.unmount();
  }
  return {
    app: r,
    api: i,
    commandService: s,
    store: n,
    ready: d,
    destroy: c,
    close: c,
    unmount: c
  };
}
const qn = Un;
export {
  Un as default,
  qn as mount,
  Un as mountPptxApp
};
