"use client";
import {
  __esm
} from "./chunk-GGWZFCYS.js";

// src/utils/cn.ts
import { clsx } from "clsx";
import { extendTailwindMerge } from "tailwind-merge";
function cn(...inputs) {
  return twMerge(clsx(inputs));
}
function getPlatformProductionUrl(platform) {
  switch (platform) {
    // *-hub platforms — env var convention: NEXT_PUBLIC_<NAME>_HUB_URL
    case "marketing-hub":
      return process.env.NEXT_PUBLIC_MARKETING_HUB_URL || "https://marketing-hub.flamingo.so";
    case "company-hub":
      return process.env.NEXT_PUBLIC_COMPANY_HUB_URL || "https://company-hub.flamingo.so";
    case "product-hub":
      return process.env.NEXT_PUBLIC_PRODUCT_HUB_URL || "https://product-hub.flamingo.so";
    case "revenue-hub":
      return process.env.NEXT_PUBLIC_REVENUE_HUB_URL || "https://revenue-hub.flamingo.so";
    case "people-hub":
      return process.env.NEXT_PUBLIC_PEOPLE_HUB_URL || "https://people-hub.flamingo.so";
    // Standalone platforms — env var convention: NEXT_PUBLIC_<NAME>_URL
    case "openmsp":
      return process.env.NEXT_PUBLIC_OPENMSP_URL || "https://www.openmsp.ai";
    case "flamingo":
      return process.env.NEXT_PUBLIC_FLAMINGO_URL || "https://www.flamingo.run";
    case "tmcg":
      return process.env.NEXT_PUBLIC_TMCG_URL || "https://www.tmcg.miami";
    case "flamingo-teaser":
      return process.env.NEXT_PUBLIC_FLAMINGO_URL || "https://www.flamingo.run";
    case "openframe":
      return process.env.NEXT_PUBLIC_OPENFRAME_URL || "https://openframe.ai";
    case "universal":
      return process.env.NEXT_PUBLIC_FLAMINGO_URL || "https://www.flamingo.run";
    default:
      return process.env.NEXT_PUBLIC_FLAMINGO_URL || "https://www.flamingo.run";
  }
}
function getAllPlatformBaseDomains() {
  if (typeof window === "undefined") return [];
  const hostname = window.location.hostname;
  if (hostname === "localhost" || hostname === "127.0.0.1" || hostname.startsWith("127.")) {
    return [];
  }
  const isVercelPreview = process.env.VERCEL_ENV === "preview" || process.env.NEXT_PUBLIC_VERCEL_ENV === "preview" || hostname.includes(".vercel.app");
  if (isVercelPreview) {
    return [".vercel.app", "vercel.app"];
  }
  const platformIdentifiers = [
    "marketing-hub",
    "company-hub",
    "product-hub",
    "revenue-hub",
    "people-hub",
    "openmsp",
    "flamingo",
    "tmcg",
    "flamingo-teaser",
    "openframe",
    "universal"
  ];
  const baseDomains = /* @__PURE__ */ new Set();
  platformIdentifiers.forEach((platform) => {
    try {
      const url = getPlatformProductionUrl(platform);
      const urlHostname = new URL(url).hostname;
      const parts = urlHostname.split(".");
      if (parts.length >= 2) {
        const baseDomain = parts.slice(-2).join(".");
        baseDomains.add(`.${baseDomain}`);
        baseDomains.add(baseDomain);
      }
    } catch (error) {
      console.warn("[Platform Domains] Failed to parse URL for platform:", platform, error);
    }
  });
  return Array.from(baseDomains);
}
function getBaseUrl(platform) {
  if (process.env.NODE_ENV !== "production") {
    return process.env.NEXT_PUBLIC_DEV_URL || "http://localhost:3000";
  }
  if (platform) {
    return getPlatformProductionUrl(platform);
  }
  if (process.env.VERCEL_PROJECT_PRODUCTION_URL) {
    return `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`;
  }
  return "https://www.openmsp.ai";
}
var twMerge;
var init_cn = __esm({
  "src/utils/cn.ts"() {
    "use strict";
    twMerge = extendTailwindMerge({
      extend: {
        classGroups: {
          "ods-typography": ["text-h1", "text-h2", "text-h3", "text-h4", "text-h5", "text-h6"]
        }
      }
    });
  }
});

export {
  cn,
  getPlatformProductionUrl,
  getAllPlatformBaseDomains,
  getBaseUrl,
  init_cn
};
//# sourceMappingURL=chunk-KSOOKNBG.js.map