"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const Vue = require("vue");
const utils = require("./utils.js");
const create = require("../utils/create.js");
const constant = require("../utils/constant.js");
const [name] = create.createNamespace("picker-toolbar");
const pickerToolbarProps = {
  title: String,
  cancelButtonText: String,
  confirmButtonText: String
};
const pickerToolbarSlots = ["cancel", "confirm", "title", "toolbar"];
const pickerToolbarPropKeys = Object.keys(pickerToolbarProps);
var stdin_default = Vue.defineComponent({
  name,
  props: pickerToolbarProps,
  emits: ["confirm", "cancel"],
  setup(props, {
    emit,
    slots
  }) {
    const renderTitle = () => {
      if (slots.title) {
        return slots.title();
      }
      if (props.title) {
        return Vue.createVNode("div", {
          "class": [utils.bem("title"), "van-ellipsis"]
        }, [props.title]);
      }
    };
    const onCancel = () => emit("cancel");
    const onConfirm = () => emit("confirm");
    const renderCancel = () => {
      var _a;
      const text = (_a = props.cancelButtonText) != null ? _a : utils.t("cancel");
      if (!slots.cancel && !text) {
        return;
      }
      return Vue.createVNode("button", {
        "type": "button",
        "class": [utils.bem("cancel"), constant.HAPTICS_FEEDBACK],
        "onClick": onCancel
      }, [slots.cancel ? slots.cancel() : text]);
    };
    const renderConfirm = () => {
      var _a;
      const text = (_a = props.confirmButtonText) != null ? _a : utils.t("confirm");
      if (!slots.confirm && !text) {
        return;
      }
      return Vue.createVNode("button", {
        "type": "button",
        "class": [utils.bem("confirm"), constant.HAPTICS_FEEDBACK],
        "onClick": onConfirm
      }, [slots.confirm ? slots.confirm() : text]);
    };
    return () => Vue.createVNode("div", {
      "class": utils.bem("toolbar")
    }, [slots.toolbar ? slots.toolbar() : [renderCancel(), renderTitle(), renderConfirm()]]);
  }
});
exports.default = stdin_default;
exports.pickerToolbarPropKeys = pickerToolbarPropKeys;
exports.pickerToolbarProps = pickerToolbarProps;
exports.pickerToolbarSlots = pickerToolbarSlots;
