import {
  invoke
} from "./chunk-YQTFE5VL.js";
import "./chunk-BUSYA2B4.js";

// node_modules/@tauri-apps/plugin-dialog/dist-js/index.js
function buttonsToRust(buttons) {
  if (buttons === void 0) {
    return void 0;
  }
  if (typeof buttons === "string") {
    return buttons;
  } else if ("ok" in buttons && "cancel" in buttons) {
    return { OkCancelCustom: [buttons.ok, buttons.cancel] };
  } else if ("yes" in buttons && "no" in buttons && "cancel" in buttons) {
    return {
      YesNoCancelCustom: [buttons.yes, buttons.no, buttons.cancel]
    };
  } else if ("ok" in buttons) {
    return { OkCustom: buttons.ok };
  }
  return void 0;
}
async function open(options = {}) {
  if (typeof options === "object") {
    Object.freeze(options);
  }
  return await invoke("plugin:dialog|open", { options });
}
async function save(options = {}) {
  if (typeof options === "object") {
    Object.freeze(options);
  }
  return await invoke("plugin:dialog|save", { options });
}
async function message(message2, options) {
  var _a, _b;
  const opts = typeof options === "string" ? { title: options } : options;
  return invoke("plugin:dialog|message", {
    message: message2.toString(),
    title: (_a = opts == null ? void 0 : opts.title) == null ? void 0 : _a.toString(),
    kind: opts == null ? void 0 : opts.kind,
    okButtonLabel: (_b = opts == null ? void 0 : opts.okLabel) == null ? void 0 : _b.toString(),
    buttons: buttonsToRust(opts == null ? void 0 : opts.buttons)
  });
}
async function ask(message2, options) {
  var _a, _b, _c;
  const opts = typeof options === "string" ? { title: options } : options;
  return await invoke("plugin:dialog|ask", {
    message: message2.toString(),
    title: (_a = opts == null ? void 0 : opts.title) == null ? void 0 : _a.toString(),
    kind: opts == null ? void 0 : opts.kind,
    yesButtonLabel: (_b = opts == null ? void 0 : opts.okLabel) == null ? void 0 : _b.toString(),
    noButtonLabel: (_c = opts == null ? void 0 : opts.cancelLabel) == null ? void 0 : _c.toString()
  });
}
async function confirm(message2, options) {
  var _a, _b, _c;
  const opts = typeof options === "string" ? { title: options } : options;
  return await invoke("plugin:dialog|confirm", {
    message: message2.toString(),
    title: (_a = opts == null ? void 0 : opts.title) == null ? void 0 : _a.toString(),
    kind: opts == null ? void 0 : opts.kind,
    okButtonLabel: (_b = opts == null ? void 0 : opts.okLabel) == null ? void 0 : _b.toString(),
    cancelButtonLabel: (_c = opts == null ? void 0 : opts.cancelLabel) == null ? void 0 : _c.toString()
  });
}
export {
  ask,
  confirm,
  message,
  open,
  save
};
//# sourceMappingURL=@tauri-apps_plugin-dialog.js.map
