"use strict";
const common_vendor = require("../../../../common/vendor.js");
require("../../../adapter-vue.js");
const TUIKit_utils_env = require("../../../utils/env.js");
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "index",
  props: {
    show: {
      type: Boolean,
      default: false
    },
    isHeaderShow: {
      type: Boolean,
      default: true
    },
    isFooterShow: {
      type: Boolean,
      default: true
    },
    background: {
      type: Boolean,
      default: true
    },
    title: {
      type: String,
      default: ""
    },
    center: {
      type: Boolean,
      default: false
    }
  },
  emits: ["update:show", "submit"],
  setup(__props, { emit: __emit }) {
    const clickType = {
      OUTSIDE: "outside",
      INSIDE: "inside"
    };
    const props = __props;
    const showDialog = common_vendor.ref(false);
    const isHeaderShowDialog = common_vendor.ref(true);
    const isFooterShowDialog = common_vendor.ref(true);
    const backgroundDialog = common_vendor.ref(true);
    const showTitle = common_vendor.ref("");
    common_vendor.watchEffect(() => {
      showDialog.value = props.show;
      showTitle.value = props.title;
      isHeaderShowDialog.value = props.isHeaderShow;
      isFooterShowDialog.value = props.isFooterShow;
      backgroundDialog.value = props.background;
    });
    const emit = __emit;
    const toggleView = (type) => {
      if (type === clickType.OUTSIDE) {
        close();
      }
    };
    const close = () => {
      showDialog.value = !showDialog.value;
      emit("update:show", showDialog.value);
    };
    const submit = () => {
      emit("submit");
      close();
    };
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.unref(showDialog)
      }, common_vendor.unref(showDialog) ? common_vendor.e({
        b: common_vendor.unref(isHeaderShowDialog)
      }, common_vendor.unref(isHeaderShowDialog) ? {
        c: common_vendor.t(common_vendor.unref(showTitle)),
        d: common_vendor.o$1(close)
      } : {}, {
        e: common_vendor.n(common_vendor.unref(TUIKit_utils_env.isUniFrameWork) && common_vendor.unref(TUIKit_utils_env.isH5) ? "dialog-main-content-uniapp" : ""),
        f: common_vendor.unref(isFooterShowDialog)
      }, common_vendor.unref(isFooterShowDialog) ? {
        g: common_vendor.t(common_vendor.unref(common_vendor.Wt).t("component.取消")),
        h: common_vendor.o$1(close),
        i: common_vendor.t(common_vendor.unref(common_vendor.Wt).t("component.确定")),
        j: common_vendor.o$1(submit)
      } : {}, {
        k: common_vendor.n(!common_vendor.unref(backgroundDialog) ? "dialog-main-back" : ""),
        l: common_vendor.o$1(($event) => toggleView(clickType.INSIDE)),
        m: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) ? "dialog-h5" : ""),
        n: common_vendor.n(__props.center ? "center" : ""),
        o: common_vendor.o$1(($event) => toggleView(clickType.OUTSIDE))
      }) : {});
    };
  }
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-2c2f9c5b"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/TUIKit/components/common/Dialog/index.js.map
