import { defineComponent as _, inject as C, computed as w, resolveComponent as u, openBlock as c, createBlock as r, withCtx as t, createVNode as a, createTextVNode as n, toDisplayString as g, unref as k, createCommentVNode as y } from "vue";
import { j as b } from "./index-a857af7d.mjs";
const N = /* @__PURE__ */ _({
  __name: "buttonSys",
  setup(x) {
    const e = C("context");
    function d() {
      i(!1), e.mitt.emit("action", { type: "return" });
    }
    function m() {
      i(!0);
    }
    b(() => {
      i(!1);
    }, 120 * 1e3);
    function i(l) {
      (l || e.codeManager.dirty.value) && (e.mitt.emit("action", { type: "save", code: e.codeManager.getCode() }), e.codeManager.dirty.value = !1);
    }
    const f = w(() => e.mode.value == "edit" ? "Peview" : "Edit");
    function s() {
      e.mode.value == "edit" ? e.mode.value = "view" : e.mode.value = "edit";
    }
    function v() {
      e.mode.value = "view", e.mitt.emit("previewFullSCreen");
    }
    return (l, S) => {
      const o = u("el-button"), p = u("el-button-group");
      return c(), r(p, null, {
        default: t(() => [
          a(o, { onClick: d }, {
            default: t(() => [
              n("Return to list")
            ]),
            _: 1
          }),
          a(o, { onClick: m }, {
            default: t(() => [
              n("Save")
            ]),
            _: 1
          }),
          a(o, { onClick: s }, {
            default: t(() => [
              n(g(f.value), 1)
            ]),
            _: 1
          }),
          k(e).mode.value == "edit" ? (c(), r(o, {
            key: 0,
            onClick: v
          }, {
            default: t(() => [
              n("Preview in full screen")
            ]),
            _: 1
          })) : y("", !0)
        ]),
        _: 1
      });
    };
  }
});
export {
  N as default
};
