// src/analytics/events.ts
function projectKindToTracking(kind) {
  switch (kind) {
    case "prototype":
      return "prototype";
    case "deck":
      return "slide_deck";
    case "template":
      return "template";
    case "other":
      return "live_artifact";
    case "image":
      return "image";
    case "video":
      return "video";
    case "audio":
      return "audio";
    default:
      return null;
  }
}
function createTabToTracking(tab) {
  switch (tab) {
    case "prototype":
      return "prototype";
    case "deck":
      return "slide_deck";
    case "template":
      return "from_template";
    case "live-artifact":
    case "other":
      return "live_artifact";
    case "image":
      return "image";
    case "video":
      return "video";
    case "audio":
      return "audio";
    default:
      return "prototype";
  }
}
function fidelityToTracking(fidelity) {
  if (fidelity === "wireframe") return "wireframe";
  if (fidelity === "high-fidelity") return "high_fidelity";
  return "not_applicable";
}
function topTabToTracking(tab) {
  switch (tab) {
    case "designs":
      return "designs";
    case "templates":
    case "examples":
      return "examples";
    case "design-systems":
      return "design_systems";
    case "image-templates":
      return "image_templates";
    case "video-templates":
      return "video_templates";
    default:
      return "designs";
  }
}
function settingsSectionToTracking(section) {
  switch (section) {
    case "execution":
      return "execution_model";
    case "media":
      return "media_providers";
    case "language":
      return "language";
    case "appearance":
      return "appearance";
    case "pet":
      return "pets";
    case "about":
      return "about";
    case "composio":
    case "integrations":
      return "integrations";
    case "mcpClient":
      return "mcp_client";
    case "orbit":
      return "orbit";
    case "routines":
      return "routines";
    case "skills":
      return "skills";
    case "designSystems":
      return "design_systems";
    case "memory":
      return "memory";
    case "privacy":
      return "privacy";
    case "notifications":
      return "notifications";
    default:
      return "execution_model";
  }
}
function executionModeToTracking(mode) {
  return mode === "daemon" ? "local_cli" : "byok";
}
function agentIdToTracking(agentId) {
  switch (agentId) {
    case "claude":
      return "claude_code";
    case "codex":
      return "codex_cli";
    case "devin":
      return "devin_terminal";
    case "gemini":
      return "gemini_cli";
    case "opencode":
      return "opencode";
    case "hermes":
      return "hermes";
    case "kimi":
      return "kimi_cli";
    case "cursor-agent":
      return "cursor_agent";
    case "qwen":
      return "qwen_code";
    case "copilot":
      return "github_copilot_cli";
    case "pi":
      return "pi";
    default:
      return "other";
  }
}
function artifactKindToTracking(args) {
  const { rendererId, fileKind } = args;
  if (rendererId === "html" || rendererId === "deck-html" || rendererId === "react-component") {
    return "html";
  }
  if (rendererId === "markdown") return "markdown";
  if (rendererId === "svg") return "image";
  if (fileKind === "image" || fileKind === "sketch") return "image";
  if (fileKind === "video") return "video";
  if (fileKind === "audio") return "audio";
  if (fileKind === "pdf" || fileKind === "document" || fileKind === "presentation" || fileKind === "spreadsheet") {
    return "doc";
  }
  return "unknown";
}

// src/analytics/public-params.ts
var EVENT_SCHEMA_VERSION = 1;
var ANALYTICS_HEADER_ANONYMOUS_ID = "x-od-analytics-anonymous-id";
var ANALYTICS_HEADER_SESSION_ID = "x-od-analytics-session-id";
var ANALYTICS_HEADER_CLIENT_TYPE = "x-od-analytics-client-type";
var ANALYTICS_HEADER_LOCALE = "x-od-analytics-locale";
var ANALYTICS_HEADER_REQUEST_ID = "x-od-analytics-request-id";

// src/analytics/artifact-id.ts
var FNV_OFFSET_BASIS = 0xcbf29ce484222325n;
var FNV_PRIME = 0x100000001b3n;
var MASK_64 = 0xffffffffffffffffn;
function anonymizeArtifactId(args) {
  const input = `${args.projectId}:${args.fileName}`;
  let hash = FNV_OFFSET_BASIS;
  for (let i = 0; i < input.length; i++) {
    hash ^= BigInt(input.charCodeAt(i));
    hash = hash * FNV_PRIME & MASK_64;
  }
  return hash.toString(16).padStart(16, "0");
}
export {
  ANALYTICS_HEADER_ANONYMOUS_ID,
  ANALYTICS_HEADER_CLIENT_TYPE,
  ANALYTICS_HEADER_LOCALE,
  ANALYTICS_HEADER_REQUEST_ID,
  ANALYTICS_HEADER_SESSION_ID,
  EVENT_SCHEMA_VERSION,
  agentIdToTracking,
  anonymizeArtifactId,
  artifactKindToTracking,
  createTabToTracking,
  executionModeToTracking,
  fidelityToTracking,
  projectKindToTracking,
  settingsSectionToTracking,
  topTabToTracking
};
