const DEPLOYMENT_URL_PLACEHOLDER=`{{DEPLOYMENT_URL}}`,HOME_PAGE_HTML_TEMPLATE=`<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="robots" content="noindex">
<meta name="referrer" content="no-referrer">
<title>eve</title>
<style>
  :root {
    color-scheme: light dark;
    --bg: #fff;
    --fg: #0a0a0a;
    --muted: #6b6b6b;
    --faint: #999;
    --border: rgba(0, 0, 0, 0.09);
    --surface: rgba(0, 0, 0, 0.025);
    --accent: #00c46a;
    --accent-glow: rgba(0, 196, 106, 0.18);
    --button-bg: #0a0a0a;
    --button-fg: #fff;
  }
  @media (prefers-color-scheme: dark) {
    :root {
      --bg: #000;
      --fg: #ededed;
      --muted: #8f8f8f;
      --faint: #666;
      --border: rgba(255, 255, 255, 0.1);
      --surface: rgba(255, 255, 255, 0.035);
      --accent: #46d4a4;
      --accent-glow: rgba(70, 212, 164, 0.22);
      --button-bg: #fff;
      --button-fg: #000;
    }
  }
  * { box-sizing: border-box; }
  html, body { height: 100%; margin: 0; }
  body {
    background: var(--bg);
    color: var(--fg);
    font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
      Roboto, "Helvetica Neue", Arial, sans-serif;
    font-feature-settings: "cv11", "ss01";
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    display: grid;
    place-items: center;
    padding: 2rem;
  }
  .mono {
    font-family: ui-monospace, "SF Mono", "Menlo", "JetBrains Mono",
      "Cascadia Code", Consolas, "Liberation Mono", monospace;
    font-feature-settings: "zero", "ss01";
  }
  main {
    width: 100%;
    max-width: 32rem;
    text-align: center;
  }
  .status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3125rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 9999px;
    font-size: 0.75rem;
    color: var(--muted);
    margin: 0 0 2rem;
  }
  .status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    flex-shrink: 0;
  }
  h1 {
    margin: 0 0 0.875rem;
    font-size: clamp(2.5rem, 9vw, 3.25rem);
    font-weight: 500;
    letter-spacing: -0.05em;
    line-height: 1;
  }
  .lede {
    margin: 0 0 1.5rem;
    color: var(--muted);
    font-size: 0.9375rem;
  }
  .lede a {
    color: var(--fg);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    text-decoration-color: var(--border);
    transition: text-decoration-color 0.15s ease;
    white-space: nowrap;
  }
  .lede a:hover { text-decoration-color: var(--fg); }
  .lede-arrow {
    display: inline-block;
    margin-left: 0.125rem;
    transition: transform 0.15s ease;
  }
  .lede a:hover .lede-arrow { transform: translateX(2px); }
  .terminal {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    max-width: 28rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    text-align: left;
    font-size: 0.8125rem;
    margin: 0 auto;
    overflow-x: auto;
    white-space: nowrap;
  }
  .terminal-prompt {
    color: var(--faint);
    user-select: none;
    flex-shrink: 0;
  }
  .terminal-cmd { color: var(--fg); }
</style>
</head>
<body>
<main>
  <span class="status mono">
    <span class="status-dot" aria-hidden="true"></span>
    running
  </span>
  <h1 class="mono">eve</h1>
  <p class="lede">The agent is up and accepting messages. <a href="https://beta.eve.dev/docs">Read the docs<span class="lede-arrow" aria-hidden="true">&nbsp;&rarr;</span></a></p>
  <div class="terminal mono" role="group" aria-label="Send a message from your terminal">
    <span class="terminal-prompt" aria-hidden="true">$</span>
    <span class="terminal-cmd">eve dev ${DEPLOYMENT_URL_PLACEHOLDER}</span>
  </div>
</main>
</body>
</html>
`;function escapeHtml(e){return e.replaceAll(`&`,`&amp;`).replaceAll(`<`,`&lt;`).replaceAll(`>`,`&gt;`).replaceAll(`"`,`&quot;`).replaceAll(`'`,`&#39;`)}function pickFirstForwardedValue(e){if(e===null)return;let t=e.split(`,`)[0]?.trim();if(!(t===void 0||t.length===0))return t}function resolveDeploymentUrl(e){let t=e.headers,n=new URL(e.url),r=pickFirstForwardedValue(t.get(`x-forwarded-host`)),i=pickFirstForwardedValue(t.get(`x-forwarded-proto`)),a=r??t.get(`host`)??n.host;return`${i??n.protocol.replace(/:$/,``)}://${a}`}function buildHomePageResponse(n){let r=resolveDeploymentUrl(n),i=HOME_PAGE_HTML_TEMPLATE.replace(DEPLOYMENT_URL_PLACEHOLDER,escapeHtml(r));return new Response(i,{headers:{"cache-control":`no-store`,"content-type":`text/html; charset=utf-8`}})}function handleHomePageRequest(e){return buildHomePageResponse(e.req)}export{buildHomePageResponse,handleHomePageRequest as default};