var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/components/pisellEmail/utils/emailHelper.ts
var emailHelper_exports = {};
__export(emailHelper_exports, {
  extractEmailDomain: () => extractEmailDomain,
  extractEmailLocal: () => extractEmailLocal,
  handleEmailClick: () => handleEmailClick,
  hideEmailDomain: () => hideEmailDomain,
  maskEmailDomain: () => maskEmailDomain,
  normalizeEmail: () => normalizeEmail
});
module.exports = __toCommonJS(emailHelper_exports);
function extractEmailDomain(email) {
  const parts = email.split("@");
  return parts.length === 2 ? parts[1] : "";
}
function extractEmailLocal(email) {
  const parts = email.split("@");
  return parts.length >= 1 ? parts[0] : "";
}
function normalizeEmail(email) {
  return email.trim().toLowerCase();
}
function hideEmailDomain(email) {
  if (!email || !email.includes("@")) {
    return email;
  }
  const [localPart, domainPart] = email.split("@");
  if (!localPart || !domainPart) {
    return email;
  }
  const visibleChars = Math.min(1, localPart.length);
  const maskedLocal = localPart.substring(0, visibleChars) + "***";
  return `${maskedLocal}@${domainPart}`;
}
function maskEmailDomain(email) {
  if (!email || !email.includes("@")) {
    return email;
  }
  const [localPart] = email.split("@");
  return `${localPart}@***`;
}
function handleEmailClick(email, options) {
  if (!email) return;
  let mailtoUrl = `mailto:${email}`;
  const params = [];
  if (options == null ? void 0 : options.subject) {
    params.push(`subject=${encodeURIComponent(options.subject)}`);
  }
  if (options == null ? void 0 : options.body) {
    params.push(`body=${encodeURIComponent(options.body)}`);
  }
  if (options == null ? void 0 : options.cc) {
    params.push(`cc=${encodeURIComponent(options.cc)}`);
  }
  if (options == null ? void 0 : options.bcc) {
    params.push(`bcc=${encodeURIComponent(options.bcc)}`);
  }
  if (params.length > 0) {
    mailtoUrl += "?" + params.join("&");
  }
  window.location.href = mailtoUrl;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  extractEmailDomain,
  extractEmailLocal,
  handleEmailClick,
  hideEmailDomain,
  maskEmailDomain,
  normalizeEmail
});
