{"version":3,"sources":["jsdelivr-header.js","/npm/nitropack-nightly@2.14.0-20260409-151037-0c5049e0/dist/core/index.mjs"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,OCNO,oBAAsB,cAAiB,iBACrC,YAAa,mBAAsB,kBACnC,WAAY,WAAc,gCAC1B,oDAAuD,gCACvD,YAAe,wBACf,gBAAiB,OAAQ,SAAU,UAAW,WAAY,YAAe,eACzE,eAAgB,cAAiB,kBACjC,YAAa,eAAkB,aAC/B,iCAAkC,WAAY,0BAA2B,4BAA+B,iBACxG,UAAa,oBACb,QAAS,OAAQ,iBAAkB,SAAU,SAAY,iBACzD,WAAY,aAAgB,iBAC9B,QAAU,SAAY,cACpB,iBAAkB,qBAAsB,kBAAmB,SAAU,SAAU,QAAS,gBAAmB,aAC3G,WAAc,uBACd,gBAAiB,qBAAsB,cAAiB,mBAC1D,aAAc,8BACZ,yBAA0B,oBAAqB,4BAA+B,cAC9E,iBAAkB,YAAa,UAAW,eAAkB,uBAC5D,sBAAyB,uBACzB,qBAAwB,mBACxB,eAAkB,cAClB,WAAc,gBAChB,KAAO,SAAU,gBAAiB,gBAAmB,0BACnD,WAAc,yBACL,YAAe,gCACP,gBAAiB,mBAAsB,mBACxD,kBAAqB,kBACvB,SAAU,cACR,eAAgB,iBAAoB,gBACpC,oBAAuB,0BACvB,UAAa,kBACb,aAAgB,6BACb,WAAY,gBACf,eAAkB,eAClB,kBAAqB,kBACrB,sBAAyB,iBACzB,iBAAoB,qBACpB,cAAe,kBAAqB,iBACpC,aAAgB,mBAClB,gBAAiB,2BACV,gBAAmB,iCACxB,gBAAmB,kBACrB,SAAU,mBACR,KAAM,UAAa,mBACnB,YAAa,cAAe,iBAAkB,kBAAmB,kBAAmB,mBAAoB,kBAAmB,KAAM,aAAc,aAAc,eAAgB,UAAW,uBAA0B,YAClN,WAAc,6BACd,sBAAyB,gBACzB,gBAAmB,oBACnB,UAAa,eACb,sBAAyB,oBAC3B,gBAAiB,sBAC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K,YAC1B,IAAK,EACH,MAAM,YAAY,CAChB,WAAY,IACZ,QAAS,yBAGb,OAAO,EAAO,cAAc,EAAK,EAAQ,EAC3C,CACA,EAAA,GACE,MAAM,EAAQ,KAAK,YAAc,KAAK,YACtC,GAAI,EAAO,CACT,IACE,EAAM,WAAY,EAClB,IAAI,EAAK,EAAM,IAAM,EAAM,KAC3B,GAAI,EAAI,CACN,MAAM,EAAQ,EAAM,SAAS,GACvB,EAAM,EAAM,UAAY,EAAM,KAAO,GAAO,UAAY,GAAO,IACjE,IACF,GAAM,IAAI,EAAI,QAAQ,EAAI,UAE5B,EAAM,OAAS,EAAM,OAAS,IAAI,QAChC,iBACA,UAAU,QAGd,CACF,CAAE,MACF,CACA,OAAO,YAAY,EACrB,CACA,OAAO,IAAI,SACT,KAAK,UACH,CACE,MAAO,6BACP,KAAM,kFAER,KACA,GAEF,CACE,OAAQ,IACR,WAAY,4BACZ,QAAS,CACP,eAAgB,mBAChB,gBAAiB,WACjB,QAAS,MAIjB,EAGF,eAAe,QAAQ,SACf,WAAW,EAAM,QAAQ,OAAO,KACjC,EAAM,QAAQ,mBACX,WAAW,EAAM,QAAQ,OAAO,WAEnC,EAAM,QAAQ,cACX,WAAW,EAAM,QAAQ,OAAO,UAE1C,CACA,eAAe,WAAW,SAClB,IAAI,GAAG,EAAK,CAAE,WAAW,EAAM,OAAO,UACtC,IAAI,MAAM,EAAK,CAAE,WAAW,GACpC,CAEA,SAAS,kBAAkB,GACzB,OAAO,CACT,QAES,kBAAmB,MAAO,iBAAkB,gBAAiB,YAAa,kBAAmB,UAAW,YAAa,QAAS,UAAW,QAAS,aAAc,eAAgB,YAAa,YAAa,iBAAkB,UAAW","file":"/npm/nitropack-nightly@2.14.0-20260409-151037-0c5049e0/dist/core/index.mjs","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/nitropack-nightly@2.14.0-20260409-151037-0c5049e0/dist/core/index.mjs\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","import consola, { consola as consola$1 } from 'consola';\nimport { createHooks, createDebugger } from 'hookable';\nimport { runtimeDir, pkgDir } from 'nitropack/runtime/meta';\nexport { runtimeDependencies as nitroRuntimeDependencies } from 'nitropack/runtime/meta';\nimport { version } from 'nitropack/meta';\nimport { resolve, join as join$1, relative, normalize, isAbsolute, dirname } from 'pathe';\nimport { createUnimport, toExports } from 'unimport';\nimport { watchConfig, loadConfig } from 'c12';\nimport { resolveCompatibilityDatesFromEnv, formatDate, resolveCompatibilityDates, formatCompatibilityDate } from 'compatx';\nimport { klona } from 'klona/full';\nimport { isDebug, isTest, nodeMajorVersion, provider, isCI } from 'std-env';\nimport { existsSync, promises } from 'node:fs';\nimport defu$1, { defu } from 'defu';\nimport { withLeadingSlash, withoutTrailingSlash, withTrailingSlash, withBase, parseURL, joinURL, withoutBase } from 'ufo';\nimport { colors } from 'consola/utils';\nimport { join, resolve as resolve$1, dirname as dirname$1 } from 'node:path';\nimport escapeRE from 'escape-string-regexp';\nimport { resolveModuleExportNames, parseNodeModulePath, lookupNodeModuleSubpath } from 'mlly';\nimport { resolveNitroPath, isDirectory, writeFile, prettyPath } from 'nitropack/kit';\nexport { defineNitroPreset } from 'nitropack/kit';\nimport { findWorkspaceDir } from 'pkg-types';\nimport { createJiti } from 'jiti';\nimport { globby } from 'globby';\nimport fsp, { readFile, rm, writeFile as writeFile$1 } from 'node:fs/promises';\nimport { ofetch } from 'ofetch';\nimport { klona as klona$1 } from 'klona';\nimport { createStorage as createStorage$1, builtinDrivers } from 'unstorage';\nimport { pathToFileURL } from 'node:url';\nimport mime from 'mime';\nimport { toRouteMatcher, createRouter } from 'radix3';\nimport { getRollupConfig } from 'nitropack/rollup';\nimport { watch } from 'chokidar';\nimport { debounce } from 'perfect-debounce';\nimport * as rollup from 'rollup';\nimport { upperFirst } from 'scule';\nimport { genTypeImport } from 'knitwork';\nimport { resolveModulePath } from 'exsolve';\nimport { resolveAlias } from 'pathe/utils';\nimport { generateTypes, resolveSchema } from 'untyped';\nimport { gzipSize } from 'gzip-size';\nimport prettyBytes from 'pretty-bytes';\nimport { r as runParallel } from '../_chunks/parallel.mjs';\nimport { getProperty } from 'dot-prop';\nimport zlib from 'node:zlib';\nimport { walk, parse } from 'ultrahtml';\nimport { createError, getRequestURL, getRequestHeader, getResponseHeader, getRequestHeaders, setResponseHeaders, setResponseStatus, send, eventHandler, getRequestIP, toNodeListener, createApp, fromNodeMiddleware } from 'h3';\nimport { Worker } from 'node:worker_threads';\nimport { createProxyServer } from 'httpxy';\nimport { ErrorParser } from 'youch-core';\nimport { Youch } from 'youch';\nimport { SourceMapConsumer } from 'source-map';\nimport serveStatic from 'serve-static';\nimport { listen } from 'listhen';\nimport { servePlaceholder } from 'serve-placeholder';\n\nconst NitroDefaults = {\n  // General\n  debug: isDebug,\n  timing: isDebug,\n  logLevel: isTest ? 1 : 3,\n  runtimeConfig: { app: {}, nitro: {} },\n  appConfig: {},\n  appConfigFiles: [],\n  // Dirs\n  scanDirs: [],\n  buildDir: \".nitro\",\n  output: {\n    dir: \"{{ rootDir }}/.output\",\n    serverDir: \"{{ output.dir }}/server\",\n    publicDir: \"{{ output.dir }}/public\"\n  },\n  // Features\n  experimental: {},\n  future: {},\n  storage: {},\n  devStorage: {},\n  bundledStorage: [],\n  publicAssets: [],\n  serverAssets: [],\n  plugins: [],\n  tasks: {},\n  scheduledTasks: {},\n  imports: {\n    exclude: [],\n    dirs: [],\n    presets: [],\n    virtualImports: [\"#imports\"]\n  },\n  virtual: {},\n  compressPublicAssets: false,\n  ignore: [],\n  // Dev\n  dev: false,\n  devServer: { watch: [] },\n  watchOptions: { ignoreInitial: true },\n  devProxy: {},\n  // Logging\n  logging: {\n    compressedSizes: true,\n    buildSuccess: true\n  },\n  // Routing\n  baseURL: process.env.NITRO_APP_BASE_URL || \"/\",\n  handlers: [],\n  devHandlers: [],\n  errorHandler: void 0,\n  routeRules: {},\n  prerender: {\n    autoSubfolderIndex: true,\n    concurrency: 1,\n    interval: 0,\n    retry: 3,\n    retryDelay: 500,\n    failOnError: false,\n    crawlLinks: false,\n    ignore: [],\n    routes: []\n  },\n  // Rollup\n  analyze: false,\n  moduleSideEffects: [\n    \"unenv/polyfill/\",\n    \"node-fetch-native/polyfill\",\n    \"node-fetch-native/dist/polyfill\",\n    resolve(runtimeDir, \"polyfill/\")\n  ],\n  replace: {},\n  node: true,\n  sourceMap: true,\n  esbuild: {\n    options: {\n      jsxFactory: \"h\",\n      jsxFragment: \"Fragment\"\n    }\n  },\n  // Advanced\n  typescript: {\n    strict: false,\n    generateTsConfig: true,\n    generateRuntimeConfigTypes: true,\n    tsconfigPath: \"types/tsconfig.json\",\n    internalPaths: false,\n    tsConfig: {}\n  },\n  nodeModulesDirs: [],\n  hooks: {},\n  commands: {},\n  // Framework\n  framework: {\n    name: \"nitro\",\n    version: \"\"\n  }\n};\n\nasync function resolveAssetsOptions(options) {\n  for (const publicAsset of options.publicAssets) {\n    publicAsset.dir = resolve(options.srcDir, publicAsset.dir);\n    publicAsset.baseURL = withLeadingSlash(\n      withoutTrailingSlash(publicAsset.baseURL || \"/\")\n    );\n  }\n  for (const dir of options.scanDirs) {\n    const publicDir = resolve(dir, \"public\");\n    if (!existsSync(publicDir)) {\n      continue;\n    }\n    if (options.publicAssets.some((asset) => asset.dir === publicDir)) {\n      continue;\n    }\n    options.publicAssets.push({ dir: publicDir });\n  }\n  for (const serverAsset of options.serverAssets) {\n    serverAsset.dir = resolve(options.srcDir, serverAsset.dir);\n  }\n  options.serverAssets.push({\n    baseName: \"server\",\n    dir: resolve(options.srcDir, \"assets\")\n  });\n  for (const asset of options.publicAssets) {\n    asset.baseURL = asset.baseURL || \"/\";\n    const isTopLevel = asset.baseURL === \"/\";\n    asset.fallthrough = asset.fallthrough ?? isTopLevel;\n    const routeRule = options.routeRules[asset.baseURL + \"/**\"];\n    asset.maxAge = routeRule?.cache?.maxAge ?? asset.maxAge ?? 0;\n    if (asset.maxAge && !asset.fallthrough) {\n      options.routeRules[asset.baseURL + \"/**\"] = defu(routeRule, {\n        headers: {\n          \"cache-control\": `public, max-age=${asset.maxAge}, immutable`\n        }\n      });\n    }\n  }\n}\n\nconst fallbackCompatibilityDate = \"2024-04-03\";\nlet _fallbackInfoShown = false;\nasync function resolveCompatibilityOptions(options) {\n  options.compatibilityDate = resolveCompatibilityDatesFromEnv(\n    options.compatibilityDate\n  );\n  if (!options.compatibilityDate.default) {\n    const consola$1 = consola.withTag(\"nitro\");\n    if (!_fallbackInfoShown && !isTest && options.preset !== \"nitro-prerender\") {\n      consola$1.warn(\n        [\n          /* WARN */\n          `Please add \\`compatibilityDate: '${formatDate(\"latest\")}'\\` to the config file. Using \\`${fallbackCompatibilityDate}\\` as fallback.`,\n          `       More info: ${colors.underline(\"https://nitro.build/deploy#compatibility-date\")}`\n        ].join(\"\\n\")\n      );\n      _fallbackInfoShown = true;\n    }\n  }\n}\n\nasync function resolveDatabaseOptions(options) {\n  if (options.experimental.database && options.imports) {\n    options.imports.presets.push({\n      from: \"nitropack/runtime/internal/database\",\n      imports: [\"useDatabase\"]\n    });\n    if (options.dev && !options.database && !options.devDatabase) {\n      options.devDatabase = {\n        default: {\n          connector: \"sqlite\",\n          options: {\n            cwd: options.rootDir\n          }\n        }\n      };\n    } else if (options.node && !options.database) {\n      options.database = {\n        default: {\n          connector: \"sqlite\",\n          options: {}\n        }\n      };\n    }\n  }\n}\n\nasync function resolveExportConditionsOptions(options) {\n  options.exportConditions = _resolveExportConditions(\n    options.exportConditions || [],\n    { dev: options.dev, node: options.node, wasm: options.experimental.wasm }\n  );\n}\nfunction _resolveExportConditions(conditions, opts) {\n  const resolvedConditions = [];\n  resolvedConditions.push(opts.dev ? \"development\" : \"production\");\n  resolvedConditions.push(...conditions);\n  if (opts.node) {\n    resolvedConditions.push(\"node\");\n  } else {\n    resolvedConditions.push(\n      \"wintercg\",\n      \"worker\",\n      \"web\",\n      \"browser\",\n      \"workerd\",\n      \"edge-light\",\n      \"netlify\",\n      \"edge-routine\",\n      \"deno\"\n    );\n  }\n  if (opts.wasm) {\n    resolvedConditions.push(\"wasm\", \"unwasm\");\n  }\n  resolvedConditions.push(\"import\", \"default\");\n  return resolvedConditions.filter(\n    (c, i) => resolvedConditions.indexOf(c) === i\n  );\n}\n\nasync function resolveFetchOptions(options) {\n  if (options.experimental.nodeFetchCompat === void 0) {\n    options.experimental.nodeFetchCompat = (nodeMajorVersion || 0) < 18;\n    if (options.experimental.nodeFetchCompat && provider !== \"stackblitz\") {\n      consola.warn(\n        \"Node fetch compatibility is enabled. Please consider upgrading to Node.js >= 18.\"\n      );\n    }\n  }\n  if (!options.experimental.nodeFetchCompat) {\n    options.alias = {\n      \"node-fetch-native/polyfill\": join(runtimeDir, \"internal/empty\"),\n      \"node-fetch-native/native\": \"node-fetch-native/native\",\n      \"node-fetch-native\": \"node-fetch-native/native\",\n      ...options.alias\n    };\n  }\n}\n\nasync function resolveImportsOptions(options) {\n  if (options.imports === false) {\n    return;\n  }\n  options.imports.presets ??= [];\n  options.imports.presets.push(...getNitroImportsPreset());\n  const h3Exports = await resolveModuleExportNames(\"h3\", {\n    url: import.meta.url\n  });\n  options.imports.presets ??= [];\n  options.imports.presets.push({\n    from: \"h3\",\n    imports: h3Exports.filter((n) => !/^[A-Z]/.test(n) && n !== \"use\")\n  });\n  options.imports.dirs ??= [];\n  options.imports.dirs.push(\n    ...options.scanDirs.map((dir) => join$1(dir, \"utils/**/*\"))\n  );\n  if (Array.isArray(options.imports.exclude) && options.imports.exclude.length === 0) {\n    options.imports.exclude.push(/[/\\\\]\\.git[/\\\\]/);\n    options.imports.exclude.push(options.buildDir);\n    const scanDirsInNodeModules = options.scanDirs.map((dir) => dir.match(/(?<=\\/)node_modules\\/(.+)$/)?.[1]).filter(Boolean);\n    options.imports.exclude.push(\n      scanDirsInNodeModules.length > 0 ? new RegExp(\n        `node_modules\\\\/(?!${scanDirsInNodeModules.map((dir) => escapeRE(dir)).join(\"|\")})`\n      ) : /[/\\\\]node_modules[/\\\\]/\n    );\n  }\n}\nfunction getNitroImportsPreset() {\n  return [\n    {\n      from: \"nitropack/runtime/internal/app\",\n      imports: [\"useNitroApp\"]\n    },\n    {\n      from: \"nitropack/runtime/internal/config\",\n      imports: [\"useRuntimeConfig\", \"useAppConfig\"]\n    },\n    {\n      from: \"nitropack/runtime/internal/plugin\",\n      imports: [\"defineNitroPlugin\", \"nitroPlugin\"]\n    },\n    {\n      from: \"nitropack/runtime/internal/cache\",\n      imports: [\n        \"defineCachedFunction\",\n        \"defineCachedEventHandler\",\n        \"cachedFunction\",\n        \"cachedEventHandler\"\n      ]\n    },\n    {\n      from: \"nitropack/runtime/internal/storage\",\n      imports: [\"useStorage\"]\n    },\n    {\n      from: \"nitropack/runtime/internal/renderer\",\n      imports: [\"defineRenderHandler\"]\n    },\n    {\n      from: \"nitropack/runtime/internal/meta\",\n      imports: [\"defineRouteMeta\"]\n    },\n    {\n      from: \"nitropack/runtime/internal/route-rules\",\n      imports: [\"getRouteRules\"]\n    },\n    {\n      from: \"nitropack/runtime/internal/context\",\n      imports: [\"useEvent\"]\n    },\n    {\n      from: \"nitropack/runtime/internal/task\",\n      imports: [\"defineTask\", \"runTask\"]\n    },\n    {\n      from: \"nitropack/runtime/internal/error/utils\",\n      imports: [\"defineNitroErrorHandler\"]\n    }\n  ];\n}\n\nasync function resolveOpenAPIOptions(options) {\n  if (!options.experimental.openAPI) {\n    return;\n  }\n  if (!options.dev && !options.openAPI?.production) {\n    return;\n  }\n  const shouldPrerender = !options.dev && options.openAPI?.production === \"prerender\";\n  const handlersEnv = shouldPrerender ? \"prerender\" : \"\";\n  const prerenderRoutes = [];\n  const jsonRoute = options.openAPI?.route || \"/_openapi.json\";\n  prerenderRoutes.push(jsonRoute);\n  options.handlers.push({\n    route: jsonRoute,\n    env: handlersEnv,\n    handler: join$1(runtimeDir, \"internal/routes/openapi\")\n  });\n  if (options.openAPI?.ui?.scalar !== false) {\n    const scalarRoute = options.openAPI?.ui?.scalar?.route || \"/_scalar\";\n    prerenderRoutes.push(scalarRoute);\n    options.handlers.push({\n      route: options.openAPI?.ui?.scalar?.route || \"/_scalar\",\n      env: handlersEnv,\n      handler: join$1(runtimeDir, \"internal/routes/scalar\")\n    });\n  }\n  if (options.openAPI?.ui?.swagger !== false) {\n    const swaggerRoute = options.openAPI?.ui?.swagger?.route || \"/_swagger\";\n    prerenderRoutes.push(swaggerRoute);\n    options.handlers.push({\n      route: swaggerRoute,\n      env: handlersEnv,\n      handler: join$1(runtimeDir, \"internal/routes/swagger\")\n    });\n  }\n  if (shouldPrerender) {\n    options.prerender ??= {};\n    options.prerender.routes ??= [];\n    options.prerender.routes.push(...prerenderRoutes);\n  }\n}\n\nasync function resolvePathOptions(options) {\n  options.rootDir = resolve(options.rootDir || \".\");\n  options.workspaceDir ||= await findWorkspaceDir(options.rootDir).catch(\n    () => options.rootDir\n  );\n  for (const key of [\"srcDir\", \"buildDir\"]) {\n    options[key] = resolve(options.rootDir, options[key] || \".\");\n  }\n  options.alias = {\n    ...options.alias,\n    \"~/\": join$1(options.srcDir, \"/\"),\n    \"@/\": join$1(options.srcDir, \"/\"),\n    \"~~/\": join$1(options.rootDir, \"/\"),\n    \"@@/\": join$1(options.rootDir, \"/\")\n  };\n  if (!options.static && !options.entry) {\n    throw new Error(\n      `Nitro entry is missing! Is \"${options.preset}\" preset correct?`\n    );\n  }\n  if (options.entry) {\n    options.entry = resolveNitroPath(options.entry, options);\n  }\n  options.output.dir = resolveNitroPath(\n    options.output.dir || NitroDefaults.output.dir,\n    options,\n    options.rootDir\n  );\n  options.output.publicDir = resolveNitroPath(\n    options.output.publicDir || NitroDefaults.output.publicDir,\n    options,\n    options.rootDir\n  );\n  options.output.serverDir = resolveNitroPath(\n    options.output.serverDir || NitroDefaults.output.serverDir,\n    options,\n    options.rootDir\n  );\n  options.nodeModulesDirs.push(resolve(options.workspaceDir, \"node_modules\"));\n  options.nodeModulesDirs.push(resolve(options.rootDir, \"node_modules\"));\n  options.nodeModulesDirs.push(resolve(pkgDir, \"node_modules\"));\n  options.nodeModulesDirs.push(resolve(pkgDir, \"..\"));\n  options.nodeModulesDirs = [\n    ...new Set(\n      // Adding trailing slash to optimize resolve performance (path is explicitly a dir)\n      options.nodeModulesDirs.map((dir) => resolve(options.rootDir, dir) + \"/\")\n    )\n  ];\n  options.plugins = options.plugins.map((p) => resolveNitroPath(p, options));\n  options.scanDirs.unshift(options.srcDir);\n  options.scanDirs = options.scanDirs.map(\n    (dir) => resolve(options.srcDir, dir)\n  );\n  options.scanDirs = [...new Set(options.scanDirs)];\n  options.appConfigFiles ??= [];\n  options.appConfigFiles = options.appConfigFiles.map((file) => _tryResolve(resolveNitroPath(file, options))).filter(Boolean);\n  for (const dir of options.scanDirs) {\n    const configFile = _tryResolve(\"app.config\", dir);\n    if (configFile && !options.appConfigFiles.includes(configFile)) {\n      options.appConfigFiles.push(configFile);\n    }\n  }\n}\nfunction _tryResolve(path, base = \".\", extensions = [\"\", \".js\", \".ts\", \".mjs\", \".cjs\", \".json\"]) {\n  path = resolve(base, path);\n  if (existsSync(path)) {\n    return path;\n  }\n  for (const ext of extensions) {\n    const p = path + ext;\n    if (existsSync(p)) {\n      return p;\n    }\n  }\n}\n\nasync function resolveRouteRulesOptions(options) {\n  options.routeRules = defu(options.routeRules, options.routes || {});\n  options.routeRules = normalizeRouteRules(options);\n}\nfunction normalizeRouteRules(config) {\n  const normalizedRules = {};\n  for (let path in config.routeRules) {\n    const routeConfig = config.routeRules[path];\n    path = withLeadingSlash(path);\n    const routeRules = {\n      ...routeConfig,\n      redirect: void 0,\n      proxy: void 0\n    };\n    if (routeConfig.redirect) {\n      routeRules.redirect = {\n        // @ts-ignore\n        to: \"/\",\n        statusCode: 307,\n        ...typeof routeConfig.redirect === \"string\" ? { to: routeConfig.redirect } : routeConfig.redirect\n      };\n      if (path.endsWith(\"/**\")) {\n        routeRules.redirect._redirectStripBase = path.slice(0, -3);\n      }\n    }\n    if (routeConfig.proxy) {\n      routeRules.proxy = typeof routeConfig.proxy === \"string\" ? { to: routeConfig.proxy } : routeConfig.proxy;\n      if (path.endsWith(\"/**\")) {\n        routeRules.proxy._proxyStripBase = path.slice(0, -3);\n      }\n    }\n    if (routeConfig.cors) {\n      routeRules.headers = {\n        \"access-control-allow-origin\": \"*\",\n        \"access-control-allow-methods\": \"*\",\n        \"access-control-allow-headers\": \"*\",\n        \"access-control-max-age\": \"0\",\n        ...routeRules.headers\n      };\n    }\n    if (routeConfig.swr) {\n      routeRules.cache = routeRules.cache || {};\n      routeRules.cache.swr = true;\n      if (typeof routeConfig.swr === \"number\") {\n        routeRules.cache.maxAge = routeConfig.swr;\n      }\n    }\n    if (routeConfig.cache === false) {\n      routeRules.cache = false;\n    }\n    normalizedRules[path] = routeRules;\n  }\n  return normalizedRules;\n}\n\nasync function resolveRuntimeConfigOptions(options) {\n  options.runtimeConfig = normalizeRuntimeConfig(options);\n}\nfunction normalizeRuntimeConfig(config) {\n  provideFallbackValues(config.runtimeConfig || {});\n  const runtimeConfig = defu$1(\n    config.runtimeConfig,\n    {\n      app: {\n        baseURL: config.baseURL\n      },\n      nitro: {\n        envExpansion: config.experimental?.envExpansion,\n        openAPI: config.openAPI\n      }\n    }\n  );\n  runtimeConfig.nitro.routeRules = config.routeRules;\n  checkSerializableRuntimeConfig(runtimeConfig);\n  return runtimeConfig;\n}\nfunction provideFallbackValues(obj) {\n  for (const key in obj) {\n    if (obj[key] === void 0 || obj[key] === null) {\n      obj[key] = \"\";\n    } else if (typeof obj[key] === \"object\") {\n      provideFallbackValues(obj[key]);\n    }\n  }\n}\nfunction checkSerializableRuntimeConfig(obj, path = []) {\n  if (isPrimitiveValue(obj)) {\n    return;\n  }\n  for (const key in obj) {\n    const value = obj[key];\n    if (value === null || value === void 0 || isPrimitiveValue(value)) {\n      continue;\n    }\n    if (Array.isArray(value)) {\n      for (const [index, item] of value.entries())\n        checkSerializableRuntimeConfig(item, [...path, `${key}[${index}]`]);\n    } else if (typeof value === \"object\" && value.constructor === Object && (!value.constructor?.name || value.constructor.name === \"Object\")) {\n      checkSerializableRuntimeConfig(value, [...path, key]);\n    } else {\n      console.warn(\n        `Runtime config option \\`${[...path, key].join(\".\")}\\` may not be able to be serialized.`\n      );\n    }\n  }\n}\nfunction isPrimitiveValue(value) {\n  return typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\";\n}\n\nasync function resolveStorageOptions(options) {\n  const fsMounts = {\n    root: resolve(options.rootDir),\n    src: resolve(options.srcDir),\n    build: resolve(options.buildDir),\n    cache: resolve(options.buildDir, \"cache\")\n  };\n  for (const p in fsMounts) {\n    options.devStorage[p] = options.devStorage[p] || {\n      driver: \"fs\",\n      readOnly: p === \"root\" || p === \"src\",\n      base: fsMounts[p]\n    };\n  }\n  if (options.dev && options.storage.data === void 0 && options.devStorage.data === void 0) {\n    options.devStorage.data = {\n      driver: \"fs\",\n      base: resolve(options.rootDir, \".data/kv\")\n    };\n  } else if (options.node && options.storage.data === void 0) {\n    options.storage.data = {\n      driver: \"fsLite\",\n      base: \"./.data/kv\"\n    };\n  }\n}\n\nasync function resolveURLOptions(options) {\n  options.baseURL = withLeadingSlash(withTrailingSlash(options.baseURL));\n}\n\nasync function resolveErrorOptions(options) {\n  if (!options.errorHandler) {\n    options.errorHandler = [];\n  } else if (!Array.isArray(options.errorHandler)) {\n    options.errorHandler = [options.errorHandler];\n  }\n  options.errorHandler.push(\n    join$1(runtimeDir, `internal/error/${options.dev ? \"dev\" : \"prod\"}`)\n  );\n}\n\nconst common = {\n  meta: {\n    name: \"nitro-common\",\n    url: import.meta.url\n  },\n  alias: {\n    \"node-mock-http/_polyfill/events\": \"node:events\",\n    \"node-mock-http/_polyfill/buffer\": \"node:buffer\",\n    \"buffer/\": \"node:buffer\",\n    \"buffer/index\": \"node:buffer\",\n    \"buffer/index.js\": \"node:buffer\",\n    \"string_decoder/\": \"node:string_decoder\",\n    \"process/\": \"node:process\"\n  }\n};\nconst nodeless = {\n  meta: {\n    name: \"nitro-nodeless\",\n    url: import.meta.url\n  },\n  inject: {\n    global: \"unenv/polyfill/globalthis\",\n    process: \"node:process\",\n    Buffer: [\"node:buffer\", \"Buffer\"],\n    clearImmediate: [\"node:timers\", \"clearImmediate\"],\n    setImmediate: [\"node:timers\", \"setImmediate\"],\n    performance: \"unenv/polyfill/performance\",\n    PerformanceObserver: [\"node:perf_hooks\", \"PerformanceObserver\"],\n    BroadcastChannel: [\"node:worker_threads\", \"BroadcastChannel\"]\n  },\n  polyfill: [\n    \"unenv/polyfill/globalthis-global\",\n    \"unenv/polyfill/process\",\n    \"unenv/polyfill/buffer\",\n    \"unenv/polyfill/timers\"\n  ]\n};\nasync function resolveUnenv(options) {\n  options.unenv ??= [];\n  if (!Array.isArray(options.unenv)) {\n    options.unenv = [options.unenv];\n  }\n  options.unenv = options.unenv.filter(Boolean);\n  if (!options.node) {\n    options.unenv.unshift(nodeless);\n  }\n  options.unenv.unshift(common);\n}\n\nconst configResolvers = [\n  resolveCompatibilityOptions,\n  resolvePathOptions,\n  resolveImportsOptions,\n  resolveRouteRulesOptions,\n  resolveDatabaseOptions,\n  resolveFetchOptions,\n  resolveExportConditionsOptions,\n  resolveRuntimeConfigOptions,\n  resolveOpenAPIOptions,\n  resolveURLOptions,\n  resolveAssetsOptions,\n  resolveStorageOptions,\n  resolveErrorOptions,\n  resolveUnenv\n];\nasync function loadOptions(configOverrides = {}, opts = {}) {\n  const options = await _loadUserConfig(configOverrides, opts);\n  for (const resolver of configResolvers) {\n    await resolver(options);\n  }\n  return options;\n}\nasync function _loadUserConfig(configOverrides = {}, opts = {}) {\n  configOverrides = klona(configOverrides);\n  globalThis.defineNitroConfig = globalThis.defineNitroConfig || ((c) => c);\n  let compatibilityDate = configOverrides.compatibilityDate || opts.compatibilityDate || (process.env.NITRO_COMPATIBILITY_DATE || process.env.SERVER_COMPATIBILITY_DATE || process.env.COMPATIBILITY_DATE);\n  const { resolvePreset } = await import('nitropack/presets');\n  let preset = configOverrides.preset || process.env.NITRO_PRESET || process.env.SERVER_PRESET;\n  const loadedConfig = await (opts.watch ? watchConfig : loadConfig)({\n    name: \"nitro\",\n    cwd: configOverrides.rootDir,\n    dotenv: opts.dotenv ?? configOverrides.dev,\n    extend: { extendKey: [\"extends\", \"preset\"] },\n    defaults: NitroDefaults,\n    jitiOptions: {\n      alias: {\n        nitropack: \"nitropack/config\",\n        \"nitropack/config\": \"nitropack/config\"\n      }\n    },\n    async overrides({ rawConfigs }) {\n      const getConf = (key) => configOverrides[key] ?? rawConfigs.main?.[key] ?? rawConfigs.rc?.[key] ?? rawConfigs.packageJson?.[key];\n      if (!compatibilityDate) {\n        compatibilityDate = getConf(\"compatibilityDate\");\n      }\n      const framework = getConf(\"framework\");\n      const isCustomFramework = framework?.name && framework.name !== \"nitro\";\n      if (!preset) {\n        preset = getConf(\"preset\");\n      }\n      if (configOverrides.dev) {\n        preset = preset && preset !== \"nitro-dev\" ? await resolvePreset(preset, {\n          static: getConf(\"static\"),\n          dev: true,\n          compatibilityDate: compatibilityDate || fallbackCompatibilityDate\n        }).then((p) => p?._meta?.name || \"nitro-dev\").catch(() => \"nitro-dev\") : \"nitro-dev\";\n      } else if (!preset) {\n        preset = await resolvePreset(\"\", {\n          static: getConf(\"static\"),\n          dev: false,\n          compatibilityDate: compatibilityDate || fallbackCompatibilityDate\n        }).then((p) => p?._meta?.name);\n      }\n      return {\n        ...configOverrides,\n        preset,\n        typescript: {\n          generateRuntimeConfigTypes: !isCustomFramework,\n          ...getConf(\"typescript\"),\n          ...configOverrides.typescript\n        }\n      };\n    },\n    async resolve(id) {\n      const preset2 = await resolvePreset(id, {\n        static: configOverrides.static,\n        compatibilityDate: compatibilityDate || fallbackCompatibilityDate,\n        dev: configOverrides.dev\n      });\n      if (preset2) {\n        return {\n          config: klona(preset2)\n        };\n      }\n    },\n    ...opts.c12\n  });\n  const options = klona(loadedConfig.config);\n  options._config = configOverrides;\n  options._c12 = loadedConfig;\n  const _presetName = (loadedConfig.layers || []).find((l) => l.config?._meta?.name)?.config?._meta?.name || preset;\n  options.preset = _presetName;\n  options.compatibilityDate = resolveCompatibilityDates(\n    compatibilityDate,\n    options.compatibilityDate\n  );\n  if (options.dev && options.preset !== \"nitro-dev\") {\n    consola.info(`Using \\`${options.preset}\\` emulation in development mode.`);\n  }\n  return options;\n}\n\nasync function updateNitroConfig(nitro, config) {\n  nitro.options.routeRules = normalizeRouteRules(\n    config.routeRules ? config : nitro.options\n  );\n  nitro.options.runtimeConfig = normalizeRuntimeConfig(\n    config.runtimeConfig ? config : nitro.options\n  );\n  await nitro.hooks.callHook(\"rollup:reload\");\n  consola.success(\"Nitro config hot reloaded!\");\n}\n\nasync function installModules(nitro) {\n  const _modules = [...nitro.options.modules || []];\n  const modules = await Promise.all(\n    _modules.map((mod) => _resolveNitroModule(mod, nitro.options))\n  );\n  const _installedURLs = /* @__PURE__ */ new Set();\n  for (const mod of modules) {\n    if (mod._url) {\n      if (_installedURLs.has(mod._url)) {\n        continue;\n      }\n      _installedURLs.add(mod._url);\n    }\n    await mod.setup(nitro);\n  }\n}\nasync function _resolveNitroModule(mod, nitroOptions) {\n  let _url;\n  if (typeof mod === \"string\") {\n    globalThis.defineNitroModule = // @ts-ignore\n    globalThis.defineNitroModule || ((mod2) => mod2);\n    const jiti = createJiti(nitroOptions.rootDir, {\n      alias: nitroOptions.alias\n    });\n    const _modPath = jiti.esmResolve(mod);\n    _url = _modPath;\n    mod = await jiti.import(_modPath, { default: true });\n  }\n  if (typeof mod === \"function\") {\n    mod = { setup: mod };\n  }\n  if (!mod.setup) {\n    mod.setup = () => {\n    };\n  }\n  return {\n    _url,\n    ...mod\n  };\n}\n\nconst GLOB_SCAN_PATTERN = \"**/*.{js,mjs,cjs,ts,mts,cts,tsx,jsx}\";\nconst suffixRegex = /(\\.(?<method>connect|delete|get|head|options|patch|post|put|trace))?(\\.(?<env>dev|prod|prerender))?$/;\nasync function scanAndSyncOptions(nitro) {\n  const scannedPlugins = await scanPlugins(nitro);\n  for (const plugin of scannedPlugins) {\n    if (!nitro.options.plugins.includes(plugin)) {\n      nitro.options.plugins.push(plugin);\n    }\n  }\n  if (nitro.options.experimental.tasks) {\n    const scannedTasks = await scanTasks(nitro);\n    for (const scannedTask of scannedTasks) {\n      if (scannedTask.name in nitro.options.tasks) {\n        if (!nitro.options.tasks[scannedTask.name].handler) {\n          nitro.options.tasks[scannedTask.name].handler = scannedTask.handler;\n        }\n      } else {\n        nitro.options.tasks[scannedTask.name] = {\n          handler: scannedTask.handler,\n          description: \"\"\n        };\n      }\n    }\n  }\n  const scannedModules = await scanModules(nitro);\n  nitro.options.modules = nitro.options.modules || [];\n  for (const modPath of scannedModules) {\n    if (!nitro.options.modules.includes(modPath)) {\n      nitro.options.modules.push(modPath);\n    }\n  }\n}\nasync function scanHandlers(nitro) {\n  const middleware = await scanMiddleware(nitro);\n  const handlers = await Promise.all([\n    scanServerRoutes(\n      nitro,\n      nitro.options.apiDir || \"api\",\n      nitro.options.apiBaseURL || \"/api\"\n    ),\n    scanServerRoutes(nitro, nitro.options.routesDir || \"routes\")\n  ]).then((r) => r.flat());\n  nitro.scannedHandlers = [\n    ...middleware,\n    ...handlers.filter((h, index, array) => {\n      return array.findIndex(\n        (h2) => h.route === h2.route && h.method === h2.method && h.env === h2.env\n      ) === index;\n    })\n  ];\n  return handlers;\n}\nasync function scanMiddleware(nitro) {\n  const files = await scanFiles(nitro, \"middleware\");\n  return files.map((file) => {\n    return {\n      middleware: true,\n      handler: file.fullPath\n    };\n  });\n}\nasync function scanServerRoutes(nitro, dir, prefix = \"/\") {\n  const files = await scanFiles(nitro, dir);\n  return files.map((file) => {\n    let route = file.path.replace(/\\.[A-Za-z]+$/, \"\").replace(/\\(([^(/\\\\]+)\\)[/\\\\]/g, \"\").replace(/\\[\\.{3}]/g, \"**\").replace(/\\[\\.{3}(\\w+)]/g, \"**:$1\").replace(/\\[([^/\\]]+)]/g, \":$1\");\n    route = withLeadingSlash(withoutTrailingSlash(withBase(route, prefix)));\n    const suffixMatch = route.match(suffixRegex);\n    let method;\n    let env;\n    if (suffixMatch?.index && suffixMatch?.index >= 0) {\n      route = route.slice(0, suffixMatch.index);\n      method = suffixMatch.groups?.method;\n      env = suffixMatch.groups?.env;\n    }\n    route = route.replace(/\\/index$/, \"\") || \"/\";\n    return {\n      handler: file.fullPath,\n      lazy: true,\n      middleware: false,\n      route,\n      method,\n      env\n    };\n  });\n}\nasync function scanPlugins(nitro) {\n  const files = await scanFiles(nitro, \"plugins\");\n  return files.map((f) => f.fullPath);\n}\nasync function scanTasks(nitro) {\n  const files = await scanFiles(nitro, \"tasks\");\n  return files.map((f) => {\n    const name = f.path.replace(/\\/index$/, \"\").replace(/\\.[A-Za-z]+$/, \"\").replace(/\\//g, \":\");\n    return { name, handler: f.fullPath };\n  });\n}\nasync function scanModules(nitro) {\n  const files = await scanFiles(nitro, \"modules\");\n  return files.map((f) => f.fullPath);\n}\nasync function scanFiles(nitro, name) {\n  const files = await Promise.all(\n    nitro.options.scanDirs.map((dir) => scanDir(nitro, dir, name))\n  ).then((r) => r.flat());\n  return files;\n}\nasync function scanDir(nitro, dir, name) {\n  const fileNames = await globby(join$1(name, GLOB_SCAN_PATTERN), {\n    cwd: dir,\n    dot: true,\n    ignore: nitro.options.ignore,\n    absolute: true\n  }).catch((error) => {\n    if (error?.code === \"ENOTDIR\") {\n      nitro.logger.warn(\n        `Ignoring \\`${join$1(dir, name)}\\`. It must be a directory.`\n      );\n      return [];\n    }\n    throw error;\n  });\n  return fileNames.map((fullPath) => {\n    return {\n      fullPath,\n      path: relative(join$1(dir, name), fullPath)\n    };\n  }).sort((a, b) => a.path.localeCompare(b.path));\n}\n\nasync function runTask(taskEvent, opts) {\n  const ctx = await _getTasksContext(opts);\n  const result = await ctx.devFetch(`/_nitro/tasks/${taskEvent.name}`, {\n    method: \"POST\",\n    body: taskEvent\n  });\n  return result;\n}\nasync function listTasks(opts) {\n  const ctx = await _getTasksContext(opts);\n  const res = await ctx.devFetch(\"/_nitro/tasks\");\n  return res.tasks;\n}\nfunction addNitroTasksVirtualFile(nitro) {\n  nitro.options.virtual[\"#nitro-internal-virtual/tasks\"] = () => {\n    const _scheduledTasks = Object.entries(nitro.options.scheduledTasks || {}).map(([cron, _tasks]) => {\n      const tasks = (Array.isArray(_tasks) ? _tasks : [_tasks]).filter(\n        (name) => {\n          if (!nitro.options.tasks[name]) {\n            nitro.logger.warn(`Scheduled task \\`${name}\\` is not defined!`);\n            return false;\n          }\n          return true;\n        }\n      );\n      return { cron, tasks };\n    }).filter((e) => e.tasks.length > 0);\n    const scheduledTasks = _scheduledTasks.length > 0 ? _scheduledTasks : false;\n    return (\n      /* js */\n      `\nexport const scheduledTasks = ${JSON.stringify(scheduledTasks)};\n\nexport const tasks = {\n  ${Object.entries(nitro.options.tasks).map(\n        ([name, task]) => `\"${name}\": {\n          meta: {\n            description: ${JSON.stringify(task.description)},\n          },\n          resolve: ${task.handler ? `() => import(\"${normalize(\n          task.handler\n        )}\").then(r => r.default || r)` : \"undefined\"},\n        }`\n      ).join(\",\\n\")}\n};`\n    );\n  };\n}\nconst _devHint = `(is dev server running?)`;\nasync function _getTasksContext(opts) {\n  const cwd = resolve(process.cwd(), opts?.cwd || \".\");\n  const outDir = resolve(cwd, opts?.buildDir || \".nitro\");\n  const buildInfoPath = resolve(outDir, \"nitro.json\");\n  if (!existsSync(buildInfoPath)) {\n    throw new Error(`Missing info file: \\`${buildInfoPath}\\` ${_devHint}`);\n  }\n  const buildInfo = JSON.parse(\n    await readFile(buildInfoPath, \"utf8\")\n  );\n  if (!buildInfo.dev?.pid || !buildInfo.dev?.workerAddress) {\n    throw new Error(\n      `Missing dev server info in: \\`${buildInfoPath}\\` ${_devHint}`\n    );\n  }\n  if (!_pidIsRunning(buildInfo.dev.pid)) {\n    throw new Error(`Dev server is not running (pid: ${buildInfo.dev.pid})`);\n  }\n  const devFetch = ofetch.create({\n    baseURL: `http://${buildInfo.dev.workerAddress.host || \"localhost\"}:${buildInfo.dev.workerAddress.port || \"3000\"}`,\n    // @ts-expect-error\n    socketPath: buildInfo.dev.workerAddress.socketPath\n  });\n  return {\n    buildInfo,\n    devFetch\n  };\n}\nfunction _pidIsRunning(pid) {\n  try {\n    process.kill(pid, 0);\n    return true;\n  } catch {\n    return false;\n  }\n}\n\nasync function createStorage(nitro) {\n  const storage = createStorage$1();\n  const mounts = klona$1({\n    ...nitro.options.storage,\n    ...nitro.options.devStorage\n  });\n  for (const [path, opts] of Object.entries(mounts)) {\n    if (opts.driver) {\n      const driver = await import(builtinDrivers[opts.driver] || opts.driver).then((r) => r.default || r);\n      storage.mount(path, driver(opts));\n    } else {\n      nitro.logger.warn(`No \\`driver\\` set for storage mount point \"${path}\".`);\n    }\n  }\n  return storage;\n}\nasync function snapshotStorage(nitro) {\n  const data = {};\n  const allKeys = [\n    ...new Set(\n      await Promise.all(\n        nitro.options.bundledStorage.map((base) => nitro.storage.getKeys(base))\n      ).then((r) => r.flat())\n    )\n  ];\n  await Promise.all(\n    allKeys.map(async (key) => {\n      data[key] = await nitro.storage.getItem(key);\n    })\n  );\n  return data;\n}\n\nasync function createNitro(config = {}, opts = {}) {\n  const options = await loadOptions(config, opts);\n  const nitro = {\n    meta: {\n      version: version,\n      majorVersion: 2\n    },\n    options,\n    hooks: createHooks(),\n    vfs: {},\n    logger: consola$1.withTag(\"nitro\"),\n    scannedHandlers: [],\n    close: () => nitro.hooks.callHook(\"close\"),\n    storage: void 0,\n    async updateConfig(config2) {\n      updateNitroConfig(nitro, config2);\n    }\n  };\n  await scanAndSyncOptions(nitro);\n  nitro.storage = await createStorage(nitro);\n  nitro.hooks.hook(\"close\", async () => {\n    await nitro.storage.dispose();\n  });\n  if (nitro.options.debug) {\n    createDebugger(nitro.hooks, { tag: \"nitro\" });\n    nitro.options.plugins.push(join$1(runtimeDir, \"internal/debug\"));\n  }\n  if (nitro.options.timing) {\n    nitro.options.plugins.push(join$1(runtimeDir, \"internal/timing\"));\n  }\n  if (nitro.options.logLevel !== void 0) {\n    nitro.logger.level = nitro.options.logLevel;\n  }\n  nitro.hooks.addHooks(nitro.options.hooks);\n  addNitroTasksVirtualFile(nitro);\n  await installModules(nitro);\n  if (nitro.options.imports) {\n    nitro.unimport = createUnimport(nitro.options.imports);\n    await nitro.unimport.init();\n    nitro.options.virtual[\"#imports\"] = () => nitro.unimport?.toExports() || \"\";\n    nitro.options.virtual[\"#nitro\"] = 'export * from \"#imports\"';\n  }\n  await scanHandlers(nitro);\n  return nitro;\n}\n\nfunction nitroServerName(nitro) {\n  return nitro.options.framework.name === \"nitro\" ? \"Nitro Server\" : `${upperFirst(nitro.options.framework.name)} Nitro server`;\n}\n\nfunction formatRollupError(_error) {\n  try {\n    const logs = [_error.toString()];\n    const errors = _error?.errors || [_error];\n    for (const error of errors) {\n      const id = error.path || error.id || _error.id;\n      let path = isAbsolute(id) ? relative(process.cwd(), id) : id;\n      const location = error.loc || error.location;\n      if (location) {\n        path += `:${location.line}:${location.column}`;\n      }\n      const text = error.text || error.frame;\n      logs.push(\n        `Rollup error while processing \\`${path}\\`` + text ? \"\\n\\n\" + text : \"\"\n      );\n    }\n    return logs.join(\"\\n\");\n  } catch {\n    return _error?.toString();\n  }\n}\n\nasync function writeTypes(nitro) {\n  const types = {\n    routes: {}\n  };\n  const typesDir = resolve(nitro.options.buildDir, \"types\");\n  const middleware = [...nitro.scannedHandlers, ...nitro.options.handlers];\n  for (const mw of middleware) {\n    if (typeof mw.handler !== \"string\" || !mw.route) {\n      continue;\n    }\n    const relativePath = relative(\n      typesDir,\n      resolveNitroPath(mw.handler, nitro.options)\n    ).replace(/\\.(js|mjs|cjs|ts|mts|cts|tsx|jsx)$/, \"\");\n    const method = mw.method || \"default\";\n    types.routes[mw.route] ??= {};\n    types.routes[mw.route][method] ??= [];\n    types.routes[mw.route][method].push(\n      `Simplify<Serialize<Awaited<ReturnType<typeof import('${relativePath}').default>>>>`\n    );\n  }\n  let autoImportedTypes = [];\n  let autoImportExports = \"\";\n  if (nitro.unimport) {\n    await nitro.unimport.init();\n    const allImports = await nitro.unimport.getImports();\n    autoImportExports = toExports(allImports).replace(\n      /#internal\\/nitro/g,\n      relative(typesDir, runtimeDir)\n    );\n    const resolvedImportPathMap = /* @__PURE__ */ new Map();\n    for (const i of allImports) {\n      const from = i.typeFrom || i.from;\n      if (resolvedImportPathMap.has(from)) {\n        continue;\n      }\n      let path = resolveAlias(from, nitro.options.alias);\n      if (!isAbsolute(path)) {\n        const resolvedPath = resolveModulePath(from, {\n          try: true,\n          from: nitro.options.nodeModulesDirs,\n          conditions: [\"type\", \"node\", \"import\"],\n          suffixes: [\"\", \"/index\"],\n          extensions: [\".mjs\", \".cjs\", \".js\", \".mts\", \".cts\", \".ts\"]\n        });\n        if (resolvedPath) {\n          const { dir, name } = parseNodeModulePath(resolvedPath);\n          if (!dir || !name) {\n            path = resolvedPath;\n          } else {\n            const subpath = await lookupNodeModuleSubpath(resolvedPath);\n            path = join$1(dir, name, subpath || \"\");\n          }\n        }\n      }\n      if (existsSync(path) && !await isDirectory(path)) {\n        path = path.replace(/\\.[a-z]+$/, \"\");\n      }\n      if (isAbsolute(path)) {\n        path = relative(typesDir, path);\n      }\n      resolvedImportPathMap.set(from, path);\n    }\n    autoImportedTypes = [\n      nitro.options.imports && nitro.options.imports.autoImport !== false ? (await nitro.unimport.generateTypeDeclarations({\n        exportHelper: false,\n        resolvePath: (i) => {\n          const from = i.typeFrom || i.from;\n          return resolvedImportPathMap.get(from) ?? from;\n        }\n      })).trim() : \"\"\n    ];\n  }\n  const generateRoutes = () => [\n    \"// Generated by nitro\",\n    'import type { Serialize, Simplify } from \"nitropack/types\";',\n    'declare module \"nitropack/types\" {',\n    \"  type Awaited<T> = T extends PromiseLike<infer U> ? Awaited<U> : T\",\n    \"  interface InternalApi {\",\n    ...Object.entries(types.routes).map(\n      ([path, methods]) => [\n        `    '${path}': {`,\n        ...Object.entries(methods).map(\n          ([method, types2]) => `      '${method}': ${types2.join(\" | \")}`\n        ),\n        \"    }\"\n      ].join(\"\\n\")\n    ),\n    \"  }\",\n    \"}\",\n    // Makes this a module for augmentation purposes\n    \"export {}\"\n  ];\n  const config = [\n    \"// Generated by nitro\",\n    `\n// App Config\nimport type { Defu } from 'defu'\n\n${nitro.options.appConfigFiles.map(\n      (file, index) => genTypeImport(relative(typesDir, file).replace(/\\.\\w+$/, \"\"), [\n        { name: \"default\", as: `appConfig${index}` }\n      ])\n    ).join(\"\\n\")}\n\ntype UserAppConfig = Defu<{}, [${nitro.options.appConfigFiles.map((_, index) => `typeof appConfig${index}`).join(\", \")}]>\n\ndeclare module \"nitropack/types\" {\n  interface AppConfig extends UserAppConfig {}`,\n    nitro.options.typescript.generateRuntimeConfigTypes ? generateTypes(\n      await resolveSchema(\n        Object.fromEntries(\n          Object.entries(nitro.options.runtimeConfig).filter(\n            ([key]) => ![\"app\", \"nitro\"].includes(key)\n          )\n        )\n      ),\n      {\n        interfaceName: \"NitroRuntimeConfig\",\n        addExport: false,\n        addDefaults: false,\n        allowExtraKeys: false,\n        indentation: 2\n      }\n    ) : \"\",\n    `}`,\n    // Makes this a module for augmentation purposes\n    \"export {}\"\n  ];\n  const declarations = [\n    // local nitropack augmentations\n    '/// <reference path=\"./nitro-routes.d.ts\" />',\n    '/// <reference path=\"./nitro-config.d.ts\" />',\n    // global server auto-imports\n    '/// <reference path=\"./nitro-imports.d.ts\" />'\n  ];\n  const buildFiles = [];\n  buildFiles.push({\n    path: join$1(typesDir, \"nitro-routes.d.ts\"),\n    contents: () => generateRoutes().join(\"\\n\")\n  });\n  buildFiles.push({\n    path: join$1(typesDir, \"nitro-config.d.ts\"),\n    contents: config.join(\"\\n\")\n  });\n  buildFiles.push({\n    path: join$1(typesDir, \"nitro-imports.d.ts\"),\n    contents: [...autoImportedTypes, autoImportExports || \"export {}\"].join(\n      \"\\n\"\n    )\n  });\n  buildFiles.push({\n    path: join$1(typesDir, \"nitro.d.ts\"),\n    contents: declarations.join(\"\\n\")\n  });\n  if (nitro.options.typescript.generateTsConfig) {\n    const tsConfigPath = resolve(\n      nitro.options.buildDir,\n      nitro.options.typescript.tsconfigPath\n    );\n    const tsconfigDir = dirname(tsConfigPath);\n    const tsConfig = defu(nitro.options.typescript.tsConfig, {\n      compilerOptions: {\n        forceConsistentCasingInFileNames: true,\n        strict: nitro.options.typescript.strict,\n        noEmit: true,\n        skipLibCheck: true,\n        target: \"ESNext\",\n        module: \"ESNext\",\n        moduleResolution: nitro.options.experimental.typescriptBundlerResolution === false ? \"Node\" : \"Bundler\",\n        allowJs: true,\n        resolveJsonModule: true,\n        jsx: \"preserve\",\n        allowSyntheticDefaultImports: true,\n        jsxFactory: \"h\",\n        jsxFragmentFactory: \"Fragment\",\n        paths: {\n          \"#imports\": [\n            relativeWithDot(tsconfigDir, join$1(typesDir, \"nitro-imports\"))\n          ],\n          \"~/*\": [\n            relativeWithDot(\n              tsconfigDir,\n              join$1(nitro.options.alias[\"~\"] || nitro.options.srcDir, \"*\")\n            )\n          ],\n          \"@/*\": [\n            relativeWithDot(\n              tsconfigDir,\n              join$1(nitro.options.alias[\"@\"] || nitro.options.srcDir, \"*\")\n            )\n          ],\n          \"~~/*\": [\n            relativeWithDot(\n              tsconfigDir,\n              join$1(nitro.options.alias[\"~~\"] || nitro.options.rootDir, \"*\")\n            )\n          ],\n          \"@@/*\": [\n            relativeWithDot(\n              tsconfigDir,\n              join$1(nitro.options.alias[\"@@\"] || nitro.options.rootDir, \"*\")\n            )\n          ],\n          ...nitro.options.typescript.internalPaths ? {\n            \"nitropack/runtime\": [\n              relativeWithDot(tsconfigDir, join$1(runtimeDir, \"index\"))\n            ],\n            \"#internal/nitro\": [\n              relativeWithDot(tsconfigDir, join$1(runtimeDir, \"index\"))\n            ],\n            \"nitropack/runtime/*\": [\n              relativeWithDot(tsconfigDir, join$1(runtimeDir, \"*\"))\n            ],\n            \"#internal/nitro/*\": [\n              relativeWithDot(tsconfigDir, join$1(runtimeDir, \"*\"))\n            ]\n          } : {}\n        }\n      },\n      include: [\n        relativeWithDot(tsconfigDir, join$1(typesDir, \"nitro.d.ts\")).replace(\n          /^(?=[^.])/,\n          \"./\"\n        ),\n        join$1(relativeWithDot(tsconfigDir, nitro.options.rootDir), \"**/*\"),\n        ...nitro.options.srcDir === nitro.options.rootDir ? [] : [join$1(relativeWithDot(tsconfigDir, nitro.options.srcDir), \"**/*\")]\n      ]\n    });\n    for (const alias in tsConfig.compilerOptions.paths) {\n      const paths = await Promise.all(\n        tsConfig.compilerOptions.paths[alias].map(async (path) => {\n          if (!isAbsolute(path)) {\n            return path;\n          }\n          const stats = await promises.stat(path).catch(\n            () => null\n            /* file does not exist */\n          );\n          return relativeWithDot(\n            tsconfigDir,\n            stats?.isFile() ? path.replace(/(?<=\\w)\\.\\w+$/g, \"\") : path\n          );\n        })\n      );\n      tsConfig.compilerOptions.paths[alias] = [...new Set(paths)];\n    }\n    tsConfig.include = [\n      ...new Set(\n        tsConfig.include.map(\n          (p) => isAbsolute(p) ? relativeWithDot(tsconfigDir, p) : p\n        )\n      )\n    ];\n    if (tsConfig.exclude) {\n      tsConfig.exclude = [\n        ...new Set(\n          tsConfig.exclude.map(\n            (p) => isAbsolute(p) ? relativeWithDot(tsconfigDir, p) : p\n          )\n        )\n      ];\n    }\n    types.tsConfig = tsConfig;\n    buildFiles.push({\n      path: tsConfigPath,\n      contents: () => JSON.stringify(tsConfig, null, 2)\n    });\n  }\n  await nitro.hooks.callHook(\"types:extend\", types);\n  await Promise.all(\n    buildFiles.map(async (file) => {\n      await writeFile(\n        resolve(nitro.options.buildDir, file.path),\n        typeof file.contents === \"string\" ? file.contents : file.contents()\n      );\n    })\n  );\n}\nconst RELATIVE_RE = /^\\.{1,2}\\//;\nfunction relativeWithDot(from, to) {\n  const rel = relative(from, to);\n  return RELATIVE_RE.test(rel) ? rel : \"./\" + rel;\n}\n\nasync function watchDev(nitro, rollupConfig) {\n  let rollupWatcher;\n  async function load() {\n    if (rollupWatcher) {\n      await rollupWatcher.close();\n    }\n    await scanHandlers(nitro);\n    rollupWatcher = startRollupWatcher(nitro, rollupConfig);\n    await writeTypes(nitro);\n  }\n  const reload = debounce(load);\n  const watchPatterns = nitro.options.scanDirs.flatMap((dir) => [\n    join$1(dir, nitro.options.apiDir || \"api\"),\n    join$1(dir, nitro.options.routesDir || \"routes\"),\n    join$1(dir, \"middleware\"),\n    join$1(dir, \"plugins\"),\n    join$1(dir, \"modules\")\n  ]);\n  const watchReloadEvents = /* @__PURE__ */ new Set([\"add\", \"addDir\", \"unlink\", \"unlinkDir\"]);\n  const reloadWatcher = watch(watchPatterns, { ignoreInitial: true }).on(\n    \"all\",\n    (event) => {\n      if (watchReloadEvents.has(event)) {\n        reload();\n      }\n    }\n  );\n  nitro.hooks.hook(\"close\", () => {\n    rollupWatcher.close();\n    reloadWatcher.close();\n  });\n  nitro.hooks.hook(\"rollup:reload\", () => reload());\n  await load();\n}\nfunction startRollupWatcher(nitro, rollupConfig) {\n  const watcher = rollup.watch(\n    defu$1(rollupConfig, {\n      watch: {\n        chokidar: nitro.options.watchOptions\n      }\n    })\n  );\n  let start;\n  watcher.on(\"event\", (event) => {\n    switch (event.code) {\n      case \"START\": {\n        start = Date.now();\n        nitro.hooks.callHook(\"dev:start\");\n        break;\n      }\n      case \"BUNDLE_END\": {\n        nitro.hooks.callHook(\"compiled\", nitro);\n        if (nitro.options.logging.buildSuccess) {\n          nitro.logger.success(\n            `${nitroServerName(nitro)} built`,\n            start ? `in ${Date.now() - start}ms` : \"\"\n          );\n        }\n        nitro.hooks.callHook(\"dev:reload\");\n        break;\n      }\n      case \"ERROR\": {\n        nitro.logger.error(formatRollupError(event.error));\n        nitro.hooks.callHook(\"dev:error\", event.error);\n      }\n    }\n  });\n  return watcher;\n}\n\nconst presetsWithConfig = [\"awsAmplify\", \"awsLambda\", \"azure\", \"cloudflare\", \"firebase\", \"netlify\", \"vercel\"];\n\nasync function generateFSTree(dir, options = {}) {\n  if (isTest) {\n    return;\n  }\n  const files = await globby(\"**/*.*\", { cwd: dir, ignore: [\"*.map\"] });\n  const items = [];\n  await runParallel(\n    new Set(files),\n    async (file) => {\n      const path = resolve(dir, file);\n      const src = await promises.readFile(path);\n      const size = src.byteLength;\n      const gzip = options.compressedSizes ? await gzipSize(src) : 0;\n      items.push({ file, path, size, gzip });\n    },\n    { concurrency: 10 }\n  );\n  items.sort((a, b) => a.path.localeCompare(b.path));\n  let totalSize = 0;\n  let totalGzip = 0;\n  let totalNodeModulesSize = 0;\n  let totalNodeModulesGzip = 0;\n  let treeText = \"\";\n  for (const [index, item] of items.entries()) {\n    dirname(item.file);\n    const rpath = relative(process.cwd(), item.path);\n    const treeChar = index === items.length - 1 ? \"\\u2514\\u2500\" : \"\\u251C\\u2500\";\n    const isNodeModules = item.file.includes(\"node_modules\");\n    if (isNodeModules) {\n      totalNodeModulesSize += item.size;\n      totalNodeModulesGzip += item.gzip;\n      continue;\n    }\n    treeText += colors.gray(\n      `  ${treeChar} ${rpath} (${prettyBytes(item.size)})`\n    );\n    if (options.compressedSizes) {\n      treeText += colors.gray(` (${prettyBytes(item.gzip)} gzip)`);\n    }\n    treeText += \"\\n\";\n    totalSize += item.size;\n    totalGzip += item.gzip;\n  }\n  treeText += `${colors.cyan(\"\\u03A3 Total size:\")} ${prettyBytes(\n    totalSize + totalNodeModulesSize\n  )}`;\n  if (options.compressedSizes) {\n    treeText += ` (${prettyBytes(totalGzip + totalNodeModulesGzip)} gzip)`;\n  }\n  treeText += \"\\n\";\n  return treeText;\n}\n\nasync function buildProduction(nitro, rollupConfig) {\n  await scanHandlers(nitro);\n  await writeTypes(nitro);\n  await _snapshot(nitro);\n  if (!nitro.options.static) {\n    nitro.logger.info(\n      `Building ${nitroServerName(nitro)} (preset: \\`${nitro.options.preset}\\`, compatibility date: \\`${formatCompatibilityDate(nitro.options.compatibilityDate)}\\`)`\n    );\n    const build = await rollup.rollup(rollupConfig).catch((error) => {\n      nitro.logger.error(formatRollupError(error));\n      throw error;\n    });\n    await build.write(rollupConfig.output);\n  }\n  const buildInfoPath = resolve(nitro.options.output.dir, \"nitro.json\");\n  const buildInfo = {\n    date: (/* @__PURE__ */ new Date()).toJSON(),\n    preset: nitro.options.preset,\n    framework: nitro.options.framework,\n    versions: {\n      nitro: version\n    },\n    commands: {\n      preview: resolveTmplPath(\n        nitro.options.commands.preview,\n        nitro,\n        nitro.options.output.dir\n      ),\n      deploy: resolveTmplPath(\n        nitro.options.commands.deploy,\n        nitro,\n        nitro.options.output.dir\n      )\n    },\n    config: {\n      ...Object.fromEntries(\n        presetsWithConfig.map((key) => [key, nitro.options[key]])\n      )\n    }\n  };\n  await writeFile(buildInfoPath, JSON.stringify(buildInfo, null, 2));\n  if (!nitro.options.static) {\n    if (nitro.options.logging.buildSuccess) {\n      nitro.logger.success(`${nitroServerName(nitro)} built`);\n    }\n    if (nitro.options.logLevel > 1) {\n      process.stdout.write(\n        await generateFSTree(nitro.options.output.serverDir, {\n          compressedSizes: nitro.options.logging.compressedSizes\n        }) || \"\"\n      );\n    }\n  }\n  await nitro.hooks.callHook(\"compiled\", nitro);\n  if (nitro.options.commands?.preview) {\n    nitro.logger.success(\n      `You can preview this build using \\`${resolveTmplPath(\n        nitro.options.commands.preview,\n        nitro,\n        process.cwd()\n      )}\\``\n    );\n  }\n  if (nitro.options.commands?.deploy) {\n    nitro.logger.success(\n      `You can deploy this build using \\`${resolveTmplPath(\n        nitro.options.commands.deploy,\n        nitro,\n        process.cwd()\n      )}\\``\n    );\n  }\n}\nasync function _snapshot(nitro) {\n  if (nitro.options.bundledStorage.length === 0 || nitro.options.preset === \"nitro-prerender\") {\n    return;\n  }\n  const storageDir = resolve(nitro.options.buildDir, \"snapshot\");\n  nitro.options.serverAssets.push({\n    baseName: \"nitro:bundled\",\n    dir: storageDir\n  });\n  const data = await snapshotStorage(nitro);\n  await Promise.all(\n    Object.entries(data).map(async ([path, contents]) => {\n      if (typeof contents !== \"string\") {\n        contents = JSON.stringify(contents);\n      }\n      const fsPath = join$1(storageDir, path.replace(/:/g, \"/\"));\n      await promises.mkdir(dirname(fsPath), { recursive: true });\n      await promises.writeFile(fsPath, contents, \"utf8\");\n    })\n  );\n}\nfunction resolveTmplPath(input, nitro, relativeTo) {\n  if (!input || !input.includes(\"{{\")) {\n    return input;\n  }\n  return input.replace(/{{ ?([\\w.]+) ?}}/g, (_, match) => {\n    let val = getProperty(\n      nitro.options,\n      match\n    );\n    if (val) {\n      val = relative(relativeTo, val) || \".\";\n    } else {\n      nitro.logger.warn(\n        `cannot resolve template param '${match}' in ${input.slice(0, 20)}`\n      );\n    }\n    return val || `${match}`;\n  });\n}\n\nasync function build(nitro) {\n  await nitro.hooks.callHook(\"build:before\", nitro);\n  const rollupConfig = getRollupConfig(nitro);\n  await nitro.hooks.callHook(\"rollup:before\", nitro, rollupConfig);\n  return nitro.options.dev ? watchDev(nitro, rollupConfig) : buildProduction(nitro, rollupConfig);\n}\n\nasync function compressPublicAssets(nitro) {\n  const publicFiles = await globby(\"**\", {\n    cwd: nitro.options.output.publicDir,\n    absolute: false,\n    dot: true,\n    ignore: [\"**/*.gz\", \"**/*.br\"]\n  });\n  await runParallel(\n    new Set(publicFiles),\n    async (fileName) => {\n      const filePath = resolve(nitro.options.output.publicDir, fileName);\n      if (existsSync(filePath + \".gz\") || existsSync(filePath + \".br\")) {\n        return;\n      }\n      const mimeType = mime.getType(fileName) || \"text/plain\";\n      const fileContents = await fsp.readFile(filePath);\n      if (fileContents.length < 1024 || fileName.endsWith(\".map\") || !isCompressibleMime(mimeType)) {\n        return;\n      }\n      const { gzip, brotli } = nitro.options.compressPublicAssets || {};\n      const encodings = [\n        gzip !== false && \"gzip\",\n        brotli !== false && \"br\"\n      ].filter(Boolean);\n      await Promise.all(\n        encodings.map(async (encoding) => {\n          const suffix = \".\" + (encoding === \"gzip\" ? \"gz\" : \"br\");\n          const compressedPath = filePath + suffix;\n          if (existsSync(compressedPath)) {\n            return;\n          }\n          const gzipOptions = { level: zlib.constants.Z_BEST_COMPRESSION };\n          const brotliOptions = {\n            [zlib.constants.BROTLI_PARAM_MODE]: isTextMime(mimeType) ? zlib.constants.BROTLI_MODE_TEXT : zlib.constants.BROTLI_MODE_GENERIC,\n            [zlib.constants.BROTLI_PARAM_QUALITY]: zlib.constants.BROTLI_MAX_QUALITY,\n            [zlib.constants.BROTLI_PARAM_SIZE_HINT]: fileContents.length\n          };\n          const compressedBuff = await new Promise(\n            (resolve2, reject) => {\n              const cb = (error, result) => error ? reject(error) : resolve2(result);\n              if (encoding === \"gzip\") {\n                zlib.gzip(fileContents, gzipOptions, cb);\n              } else {\n                zlib.brotliCompress(fileContents, brotliOptions, cb);\n              }\n            }\n          );\n          await fsp.writeFile(compressedPath, compressedBuff);\n        })\n      );\n    },\n    { concurrency: 10 }\n  );\n}\nfunction isTextMime(mimeType) {\n  return /text|javascript|json|xml/.test(mimeType);\n}\nconst COMPRESSIBLE_MIMES_RE = /* @__PURE__ */ new Set([\n  \"application/dash+xml\",\n  \"application/eot\",\n  \"application/font\",\n  \"application/font-sfnt\",\n  \"application/javascript\",\n  \"application/json\",\n  \"application/opentype\",\n  \"application/otf\",\n  \"application/pdf\",\n  \"application/pkcs7-mime\",\n  \"application/protobuf\",\n  \"application/rss+xml\",\n  \"application/truetype\",\n  \"application/ttf\",\n  \"application/vnd.apple.mpegurl\",\n  \"application/vnd.mapbox-vector-tile\",\n  \"application/vnd.ms-fontobject\",\n  \"application/wasm\",\n  \"application/xhtml+xml\",\n  \"application/xml\",\n  \"application/x-font-opentype\",\n  \"application/x-font-truetype\",\n  \"application/x-font-ttf\",\n  \"application/x-httpd-cgi\",\n  \"application/x-javascript\",\n  \"application/x-mpegurl\",\n  \"application/x-opentype\",\n  \"application/x-otf\",\n  \"application/x-perl\",\n  \"application/x-ttf\",\n  \"font/eot\",\n  \"font/opentype\",\n  \"font/otf\",\n  \"font/ttf\",\n  \"image/svg+xml\",\n  \"text/css\",\n  \"text/csv\",\n  \"text/html\",\n  \"text/javascript\",\n  \"text/js\",\n  \"text/plain\",\n  \"text/richtext\",\n  \"text/tab-separated-values\",\n  \"text/xml\",\n  \"text/x-component\",\n  \"text/x-java-source\",\n  \"text/x-script\",\n  \"vnd.apple.mpegurl\"\n]);\nfunction isCompressibleMime(mimeType) {\n  return COMPRESSIBLE_MIMES_RE.has(mimeType);\n}\n\nconst allowedExtensions = /* @__PURE__ */ new Set([\"\", \".json\"]);\nconst linkParents$1 = /* @__PURE__ */ new Map();\nconst HTML_ENTITIES = {\n  \"&lt;\": \"<\",\n  \"&gt;\": \">\",\n  \"&amp;\": \"&\",\n  \"&apos;\": \"'\",\n  \"&quot;\": '\"'\n};\nfunction escapeHtml(text) {\n  return text.replace(\n    /&(lt|gt|amp|apos|quot);/g,\n    (ch) => HTML_ENTITIES[ch] || ch\n  );\n}\nasync function extractLinks(html, from, res, crawlLinks) {\n  const links = [];\n  const _links = [];\n  if (crawlLinks) {\n    await walk(parse(html), (node) => {\n      if (!node.attributes?.href) {\n        return;\n      }\n      const link = escapeHtml(node.attributes.href);\n      if (!decodeURIComponent(link).startsWith(\"#\") && allowedExtensions.has(getExtension(link))) {\n        _links.push(link);\n      }\n    });\n  }\n  const header = res.headers.get(\"x-nitro-prerender\") || \"\";\n  _links.push(...header.split(\",\").map((i) => decodeURIComponent(i.trim())));\n  for (const link of _links.filter(Boolean)) {\n    const _link = parseURL(link);\n    if (_link.protocol || _link.host) {\n      continue;\n    }\n    if (!_link.pathname.startsWith(\"/\")) {\n      const fromURL = new URL(from, \"http://localhost\");\n      _link.pathname = new URL(_link.pathname, fromURL).pathname;\n    }\n    links.push(_link.pathname + _link.search);\n  }\n  for (const link of links) {\n    const _parents = linkParents$1.get(link);\n    if (_parents) {\n      _parents.add(from);\n    } else {\n      linkParents$1.set(link, /* @__PURE__ */ new Set([from]));\n    }\n  }\n  return links;\n}\nconst EXT_REGEX = /\\.[\\da-z]+$/;\nfunction getExtension(link) {\n  const pathname = parseURL(link).pathname;\n  return (pathname.match(EXT_REGEX) || [])[0] || \"\";\n}\nfunction formatPrerenderRoute(route) {\n  let str = `  \\u251C\\u2500 ${route.route} (${route.generateTimeMS}ms)`;\n  if (route.error) {\n    const parents = linkParents$1.get(route.route);\n    const errorColor = colors[route.error.statusCode === 404 ? \"yellow\" : \"red\"];\n    const errorLead = parents?.size ? \"\\u251C\\u2500\\u2500\" : \"\\u2514\\u2500\\u2500\";\n    str += `\n  \\u2502 ${errorLead} ${errorColor(route.error.message)}`;\n    if (parents?.size) {\n      str += `\n${[...parents.values()].map((link) => `  \\u2502 \\u2514\\u2500\\u2500 Linked from ${link}`).join(\"\\n\")}`;\n    }\n  }\n  if (route.skip) {\n    str += colors.gray(\" (skipped)\");\n  }\n  return colors.gray(str);\n}\nfunction matchesIgnorePattern(path, pattern) {\n  if (typeof pattern === \"string\") {\n    return path.startsWith(pattern);\n  }\n  if (typeof pattern === \"function\") {\n    return pattern(path) === true;\n  }\n  if (pattern instanceof RegExp) {\n    return pattern.test(path);\n  }\n  return false;\n}\n\nconst NEGATION_RE = /^(!?)(.*)$/;\nconst PARENT_DIR_GLOB_RE = /!?\\.\\.\\//;\nasync function scanUnprefixedPublicAssets(nitro) {\n  const scannedPaths = [];\n  for (const asset of nitro.options.publicAssets) {\n    if (asset.baseURL && asset.baseURL !== \"/\" && !asset.fallthrough) {\n      continue;\n    }\n    if (!await isDirectory(asset.dir)) {\n      continue;\n    }\n    const includePatterns = getIncludePatterns(nitro, asset.dir);\n    const publicAssets = await globby(includePatterns, {\n      cwd: asset.dir,\n      absolute: false,\n      dot: true\n    });\n    scannedPaths.push(\n      ...publicAssets.map((file) => join$1(asset.baseURL || \"/\", file))\n    );\n  }\n  return scannedPaths;\n}\nasync function copyPublicAssets(nitro) {\n  if (nitro.options.noPublicDir) {\n    return;\n  }\n  for (const asset of nitro.options.publicAssets) {\n    const srcDir = asset.dir;\n    const dstDir = join$1(nitro.options.output.publicDir, asset.baseURL);\n    if (await isDirectory(srcDir)) {\n      const includePatterns = getIncludePatterns(nitro, srcDir);\n      const publicAssets = await globby(includePatterns, {\n        cwd: srcDir,\n        absolute: false,\n        dot: true\n      });\n      await Promise.all(\n        publicAssets.map(async (file) => {\n          const src = join$1(srcDir, file);\n          const dst = join$1(dstDir, file);\n          if (!existsSync(dst)) {\n            await promises.cp(src, dst);\n          }\n        })\n      );\n    }\n  }\n  if (nitro.options.compressPublicAssets) {\n    await compressPublicAssets(nitro);\n  }\n  nitro.logger.success(\n    \"Generated public \" + prettyPath(nitro.options.output.publicDir)\n  );\n}\nfunction getIncludePatterns(nitro, srcDir) {\n  return [\n    \"**\",\n    ...nitro.options.ignore.map((p) => {\n      const [_, negation, pattern] = p.match(NEGATION_RE) || [];\n      return (\n        // Convert ignore to include patterns\n        (negation ? \"\" : \"!\") + // Make non-glob patterns relative to publicAssetDir\n        (pattern.startsWith(\"*\") ? pattern : relative(srcDir, resolve(nitro.options.srcDir, pattern)))\n      );\n    })\n  ].filter((p) => !PARENT_DIR_GLOB_RE.test(p));\n}\n\nconst JsonSigRx = /^\\s*[\"[{]|^\\s*-?\\d{1,16}(\\.\\d{1,17})?([Ee][+-]?\\d+)?\\s*$/;\nconst linkParents = /* @__PURE__ */ new Map();\nasync function prerender(nitro) {\n  if (nitro.options.noPublicDir) {\n    nitro.logger.warn(\n      \"Skipping prerender since `noPublicDir` option is enabled.\"\n    );\n    return;\n  }\n  const routes = new Set(nitro.options.prerender.routes);\n  const prerenderRulePaths = Object.entries(nitro.options.routeRules).filter(([path2, options]) => options.prerender && !path2.includes(\"*\")).map((e) => e[0]);\n  for (const route of prerenderRulePaths) {\n    routes.add(route);\n  }\n  await nitro.hooks.callHook(\"prerender:routes\", routes);\n  if (routes.size === 0) {\n    if (nitro.options.prerender.crawlLinks) {\n      routes.add(\"/\");\n    } else {\n      return;\n    }\n  }\n  nitro.logger.info(\"Initializing prerenderer\");\n  nitro._prerenderedRoutes = [];\n  nitro._prerenderMeta = nitro._prerenderMeta || {};\n  const prerendererConfig = {\n    ...nitro.options._config,\n    static: false,\n    rootDir: nitro.options.rootDir,\n    logLevel: 0,\n    preset: \"nitro-prerender\"\n  };\n  await nitro.hooks.callHook(\"prerender:config\", prerendererConfig);\n  const nitroRenderer = await createNitro(prerendererConfig);\n  const prerenderStartTime = Date.now();\n  await nitro.hooks.callHook(\"prerender:init\", nitroRenderer);\n  let path = relative(nitro.options.output.dir, nitro.options.output.publicDir);\n  if (!path.startsWith(\".\")) {\n    path = `./${path}`;\n  }\n  nitroRenderer.options.commands.preview = `npx serve ${path}`;\n  nitroRenderer.options.output.dir = nitro.options.output.dir;\n  await build(nitroRenderer);\n  const serverFilename = typeof nitroRenderer.options.rollupConfig?.output?.entryFileNames === \"string\" ? nitroRenderer.options.rollupConfig.output.entryFileNames : \"index.mjs\";\n  const serverEntrypoint = resolve(\n    nitroRenderer.options.output.serverDir,\n    serverFilename\n  );\n  const { closePrerenderer, localFetch } = await import(pathToFileURL(serverEntrypoint).href);\n  const _routeRulesMatcher = toRouteMatcher(\n    createRouter({ routes: nitro.options.routeRules })\n  );\n  const _getRouteRules = (path2) => defu({}, ..._routeRulesMatcher.matchAll(path2).reverse());\n  const generatedRoutes = /* @__PURE__ */ new Set();\n  const failedRoutes = /* @__PURE__ */ new Set();\n  const skippedRoutes = /* @__PURE__ */ new Set();\n  const displayedLengthWarns = /* @__PURE__ */ new Set();\n  const publicAssetBases = nitro.options.publicAssets.filter(\n    (a) => !!a.baseURL && a.baseURL !== \"/\" && !a.fallthrough\n  ).map((a) => withTrailingSlash(a.baseURL));\n  const scannedPublicAssets = nitro.options.prerender.ignoreUnprefixedPublicAssets ? new Set(await scanUnprefixedPublicAssets(nitro)) : /* @__PURE__ */ new Set();\n  const canPrerender = (route = \"/\") => {\n    if (generatedRoutes.has(route) || skippedRoutes.has(route)) {\n      return false;\n    }\n    for (const pattern of nitro.options.prerender.ignore) {\n      if (matchesIgnorePattern(route, pattern)) {\n        return false;\n      }\n    }\n    if (publicAssetBases.some((base) => route.startsWith(base))) {\n      return false;\n    }\n    if (scannedPublicAssets.has(route)) {\n      return false;\n    }\n    if (_getRouteRules(route).prerender === false) {\n      return false;\n    }\n    return true;\n  };\n  const canWriteToDisk = (route) => {\n    if (route.route.includes(\"?\") || route.route.includes(\"..\")) {\n      return false;\n    }\n    const FS_MAX_SEGMENT = 255;\n    const FS_MAX_PATH = 1024;\n    const FS_MAX_PATH_PUBLIC_HTML = FS_MAX_PATH - (nitro.options.output.publicDir.length + 10);\n    if ((route.route.length >= FS_MAX_PATH_PUBLIC_HTML || route.route.split(\"/\").some((s) => s.length > FS_MAX_SEGMENT)) && !displayedLengthWarns.has(route)) {\n      displayedLengthWarns.add(route);\n      const _route = route.route.slice(0, 60) + \"...\";\n      if (route.route.length >= FS_MAX_PATH_PUBLIC_HTML) {\n        nitro.logger.warn(\n          `Prerendering long route \"${_route}\" (${route.route.length}) can cause filesystem issues since it exceeds ${FS_MAX_PATH_PUBLIC_HTML}-character limit when writing to \\`${nitro.options.output.publicDir}\\`.`\n        );\n      } else {\n        nitro.logger.warn(\n          `Skipping prerender of the route \"${_route}\" since it exceeds the ${FS_MAX_SEGMENT}-character limit in one of the path segments and can cause filesystem issues.`\n        );\n        return false;\n      }\n    }\n    return true;\n  };\n  const generateRoute = async (route) => {\n    const start = Date.now();\n    route = decodeURI(route);\n    if (!canPrerender(route)) {\n      skippedRoutes.add(route);\n      return;\n    }\n    generatedRoutes.add(route);\n    const _route = { route };\n    const encodedRoute = encodeURI(route);\n    const res = await localFetch(\n      withBase(encodedRoute, nitro.options.baseURL),\n      {\n        headers: { \"x-nitro-prerender\": encodedRoute },\n        retry: nitro.options.prerender.retry,\n        retryDelay: nitro.options.prerender.retryDelay\n      }\n    );\n    let dataBuff = Buffer.from(await res.arrayBuffer());\n    Object.defineProperty(_route, \"contents\", {\n      get: () => {\n        return dataBuff ? dataBuff.toString(\"utf8\") : void 0;\n      },\n      set(value) {\n        if (dataBuff) {\n          dataBuff = Buffer.from(value);\n        }\n      }\n    });\n    Object.defineProperty(_route, \"data\", {\n      get: () => {\n        return dataBuff ? dataBuff.buffer : void 0;\n      },\n      set(value) {\n        if (dataBuff) {\n          dataBuff = Buffer.from(value);\n        }\n      }\n    });\n    const redirectCodes = [301, 302, 303, 304, 307, 308];\n    if (![200, ...redirectCodes].includes(res.status)) {\n      _route.error = new Error(`[${res.status}] ${res.statusText}`);\n      _route.error.statusCode = res.status;\n      _route.error.statusMessage = res.statusText;\n    }\n    _route.generateTimeMS = Date.now() - start;\n    const contentType = res.headers.get(\"content-type\") || \"\";\n    const isImplicitHTML = !route.endsWith(\".html\") && contentType.includes(\"html\") && !JsonSigRx.test(dataBuff.subarray(0, 32).toString(\"utf8\"));\n    const routeWithIndex = route.endsWith(\"/\") ? route + \"index\" : route;\n    const htmlPath = route.endsWith(\"/\") || nitro.options.prerender.autoSubfolderIndex ? joinURL(route, \"index.html\") : route + \".html\";\n    _route.fileName = withoutBase(\n      isImplicitHTML ? htmlPath : routeWithIndex,\n      nitro.options.baseURL\n    );\n    const inferredContentType = mime.getType(_route.fileName) || \"text/plain\";\n    _route.contentType = contentType || inferredContentType;\n    await nitro.hooks.callHook(\"prerender:generate\", _route, nitro);\n    if (_route.contentType !== inferredContentType) {\n      nitro._prerenderMeta[_route.fileName] ||= {};\n      nitro._prerenderMeta[_route.fileName].contentType = _route.contentType;\n    }\n    if (_route.error) {\n      failedRoutes.add(_route);\n    }\n    if (_route.skip || _route.error) {\n      await nitro.hooks.callHook(\"prerender:route\", _route);\n      nitro.logger.log(formatPrerenderRoute(_route));\n      dataBuff = void 0;\n      return _route;\n    }\n    const filePath = join$1(nitro.options.output.publicDir, _route.fileName);\n    if (canWriteToDisk(_route) && filePath.startsWith(nitro.options.output.publicDir)) {\n      await writeFile(filePath, dataBuff);\n      nitro._prerenderedRoutes.push(_route);\n    } else {\n      _route.skip = true;\n    }\n    if (!_route.error && (isImplicitHTML || route.endsWith(\".html\"))) {\n      const extractedLinks = await extractLinks(\n        dataBuff.toString(\"utf8\"),\n        route,\n        res,\n        nitro.options.prerender.crawlLinks\n      );\n      for (const _link of extractedLinks) {\n        if (canPrerender(_link)) {\n          routes.add(_link);\n        }\n      }\n    }\n    await nitro.hooks.callHook(\"prerender:route\", _route);\n    nitro.logger.log(formatPrerenderRoute(_route));\n    dataBuff = void 0;\n    return _route;\n  };\n  nitro.logger.info(\n    nitro.options.prerender.crawlLinks ? `Prerendering ${routes.size} initial routes with crawler` : `Prerendering ${routes.size} routes`\n  );\n  await runParallel(routes, generateRoute, {\n    concurrency: nitro.options.prerender.concurrency,\n    interval: nitro.options.prerender.interval\n  });\n  await closePrerenderer();\n  await nitro.hooks.callHook(\"prerender:done\", {\n    prerenderedRoutes: nitro._prerenderedRoutes,\n    failedRoutes: [...failedRoutes]\n  });\n  if (nitro.options.prerender.failOnError && failedRoutes.size > 0) {\n    nitro.logger.log(\"\\nErrors prerendering:\");\n    for (const route of failedRoutes) {\n      const parents = linkParents.get(route.route);\n      parents?.size ? `\n${[...parents.values()].map((link) => colors.gray(`  \\u2502 \\u2514\\u2500\\u2500 Linked from ${link}`)).join(\"\\n\")}` : \"\";\n      nitro.logger.log(formatPrerenderRoute(route));\n    }\n    nitro.logger.log(\"\");\n    throw new Error(\"Exiting due to prerender errors.\");\n  }\n  const prerenderTimeInMs = Date.now() - prerenderStartTime;\n  nitro.logger.info(\n    `Prerendered ${nitro._prerenderedRoutes.length} routes in ${prerenderTimeInMs / 1e3} seconds`\n  );\n  if (nitro.options.compressPublicAssets) {\n    await compressPublicAssets(nitro);\n  }\n}\n\nfunction createHTTPProxy(defaults = {}) {\n  const proxy = createProxyServer(defaults);\n  proxy.on(\"proxyReq\", (proxyReq, req) => {\n    if (!proxyReq.hasHeader(\"x-forwarded-for\")) {\n      const address = req.socket.remoteAddress;\n      if (address) {\n        proxyReq.appendHeader(\"x-forwarded-for\", address);\n      }\n    }\n    if (!proxyReq.hasHeader(\"x-forwarded-port\")) {\n      const localPort = req?.socket?.localPort;\n      if (localPort) {\n        proxyReq.setHeader(\"x-forwarded-port\", localPort);\n      }\n    }\n    if (!proxyReq.hasHeader(\"x-forwarded-Proto\")) {\n      const encrypted = req?.connection?.encrypted;\n      proxyReq.setHeader(\"x-forwarded-proto\", encrypted ? \"https\" : \"http\");\n    }\n  });\n  const handleEvent = async (event, opts = {}) => {\n    try {\n      event._handled = true;\n      await proxy.web(event.node.req, event.node.res, opts);\n    } catch (error) {\n      try {\n        event.node.res.setHeader(\"refresh\", \"3\");\n      } catch {\n      }\n      throw createError({\n        statusCode: 503,\n        message: \"Dev server is unavailable.\",\n        cause: error\n      });\n    }\n  };\n  return {\n    proxy,\n    handleEvent\n  };\n}\n\nclass NodeDevWorker {\n  closed = false;\n  #id;\n  #workerDir;\n  #hooks;\n  #address;\n  #proxy;\n  #worker;\n  constructor(id, workerDir, hooks = {}) {\n    this.#id = id;\n    this.#workerDir = workerDir;\n    this.#hooks = hooks;\n    this.#proxy = createHTTPProxy();\n    this.#initWorker();\n  }\n  get ready() {\n    return Boolean(\n      !this.closed && this.#address && this.#proxy && this.#worker\n    );\n  }\n  async handleEvent(event) {\n    if (!this.#address || !this.#proxy) {\n      throw createError({\n        status: 503,\n        statusText: \"Dev worker is unavailable\"\n      });\n    }\n    await this.#proxy.handleEvent(event, { target: this.#address });\n  }\n  handleUpgrade(req, socket, head) {\n    if (!this.ready) {\n      return;\n    }\n    return this.#proxy.proxy.ws(\n      req,\n      socket,\n      { target: this.#address, xfwd: true },\n      head\n    );\n  }\n  #initWorker() {\n    const workerEntryPath = join$1(this.#workerDir, \"index.mjs\");\n    if (!existsSync(workerEntryPath)) {\n      this.close(`worker entry not found in \"${workerEntryPath}\".`);\n      return;\n    }\n    const worker = new Worker(workerEntryPath, {\n      env: {\n        ...process.env,\n        NITRO_DEV_WORKER_ID: String(this.#id)\n      }\n    });\n    worker.once(\"exit\", (code) => {\n      worker._exitCode = code;\n      this.close(`worker exited with code ${code}`);\n    });\n    worker.once(\"error\", (error) => {\n      this.close(error);\n    });\n    worker.on(\"message\", (message) => {\n      if (message?.address) {\n        this.#address = message.address;\n        this.#hooks.onReady?.(this, this.#address);\n      }\n    });\n    this.#worker = worker;\n  }\n  async close(cause) {\n    if (this.closed) {\n      return;\n    }\n    this.closed = true;\n    this.#hooks.onClose?.(this, cause);\n    this.#hooks = {};\n    const onError = (error) => consola.error(error);\n    await this.#closeWorker().catch(onError);\n    await this.#closeProxy().catch(onError);\n    await this.#closeSocket().catch(onError);\n  }\n  async #closeProxy() {\n    this.#proxy?.proxy?.close(() => {\n    });\n    this.#proxy = void 0;\n  }\n  async #closeSocket() {\n    const socketPath = this.#address?.socketPath;\n    if (socketPath && socketPath[0] !== \"\\0\" && !socketPath.startsWith(String.raw`\\\\.\\pipe`)) {\n      await rm(socketPath).catch(() => {\n      });\n    }\n    this.#address = void 0;\n  }\n  async #closeWorker() {\n    if (!this.#worker) {\n      return;\n    }\n    this.#worker.postMessage({ event: \"shutdown\" });\n    if (!this.#worker._exitCode && !isTest && !isCI) {\n      await new Promise((resolve) => {\n        const gracefulShutdownTimeoutSec = Number.parseInt(process.env.NITRO_SHUTDOWN_TIMEOUT || \"\", 10) || 5;\n        const timeout = setTimeout(() => {\n          if (process.env.DEBUG) {\n            consola.warn(`force closing dev worker...`);\n          }\n        }, gracefulShutdownTimeoutSec * 1e3);\n        this.#worker?.on(\"message\", (message) => {\n          if (message.event === \"exit\") {\n            clearTimeout(timeout);\n            resolve();\n          }\n        });\n      });\n    }\n    this.#worker.removeAllListeners();\n    await this.#worker.terminate().catch((error) => {\n      consola.error(error);\n    });\n    this.#worker = void 0;\n  }\n  [Symbol.for(\"nodejs.util.inspect.custom\")]() {\n    const status = this.closed ? \"closed\" : this.ready ? \"ready\" : \"pending\";\n    return `NodeDevWorker#${this.#id}(${status})`;\n  }\n}\n\nfunction defineNitroErrorHandler(handler) {\n  return handler;\n}\n\nconst devErrorHandler = defineNitroErrorHandler(\n  async function defaultNitroErrorHandler(error, event) {\n    const res = await defaultHandler(error, event);\n    if (!event.node?.res.headersSent) {\n      setResponseHeaders(event, res.headers);\n    }\n    setResponseStatus(event, res.status, res.statusText);\n    return send(\n      event,\n      typeof res.body === \"string\" ? res.body : JSON.stringify(res.body, null, 2)\n    );\n  }\n);\nasync function defaultHandler(error, event, opts) {\n  const isSensitive = error.unhandled || error.fatal;\n  const statusCode = error.statusCode || 500;\n  const statusMessage = error.statusMessage || \"Server Error\";\n  const url = getRequestURL(event, { xForwardedHost: true, xForwardedProto: true });\n  if (statusCode === 404) {\n    const baseURL = import.meta.baseURL || \"/\";\n    if (/^\\/[^/]/.test(baseURL) && !url.pathname.startsWith(baseURL)) {\n      const redirectTo = `${baseURL}${url.pathname.slice(1)}${url.search}`;\n      return {\n        status: 302,\n        statusText: \"Found\",\n        headers: { location: redirectTo },\n        body: `Redirecting...`\n      };\n    }\n  }\n  await loadStackTrace(error).catch(consola.error);\n  const youch = new Youch();\n  if (isSensitive && !opts?.silent) {\n    const tags = [error.unhandled && \"[unhandled]\", error.fatal && \"[fatal]\"].filter(Boolean).join(\" \");\n    const ansiError = await (await youch.toANSI(error)).replaceAll(process.cwd(), \".\");\n    consola.error(\n      `[request error] ${tags} [${event.method}] ${url}\n\n`,\n      ansiError\n    );\n  }\n  const useJSON = opts?.json ?? !getRequestHeader(event, \"accept\")?.includes(\"text/html\");\n  const headers = {\n    \"content-type\": useJSON ? \"application/json\" : \"text/html\",\n    // Prevent browser from guessing the MIME types of resources.\n    \"x-content-type-options\": \"nosniff\",\n    // Prevent error page from being embedded in an iframe\n    \"x-frame-options\": \"DENY\",\n    // Prevent browsers from sending the Referer header\n    \"referrer-policy\": \"no-referrer\",\n    // Disable the execution of any js\n    \"content-security-policy\": \"script-src 'self' 'unsafe-inline'; object-src 'none'; base-uri 'self';\"\n  };\n  if (statusCode === 404 || !getResponseHeader(event, \"cache-control\")) {\n    headers[\"cache-control\"] = \"no-cache\";\n  }\n  const body = useJSON ? {\n    error: true,\n    url,\n    statusCode,\n    statusMessage,\n    message: error.message,\n    data: error.data,\n    stack: error.stack?.split(\"\\n\").map((line) => line.trim())\n  } : await youch.toHTML(error, {\n    request: {\n      url: url.href,\n      method: event.method,\n      headers: getRequestHeaders(event)\n    }\n  });\n  return {\n    status: statusCode,\n    statusText: statusMessage,\n    headers,\n    body\n  };\n}\nasync function loadStackTrace(error) {\n  if (!(error instanceof Error)) {\n    return;\n  }\n  const parsed = await new ErrorParser().defineSourceLoader(sourceLoader).parse(error);\n  const stack = error.message + \"\\n\" + parsed.frames.map((frame) => fmtFrame(frame)).join(\"\\n\");\n  Object.defineProperty(error, \"stack\", { value: stack });\n  if (error.cause) {\n    await loadStackTrace(error.cause).catch(consola.error);\n  }\n}\nasync function sourceLoader(frame) {\n  if (!frame.fileName || frame.fileType !== \"fs\" || frame.type === \"native\") {\n    return;\n  }\n  if (frame.type === \"app\") {\n    const rawSourceMap = await readFile(`${frame.fileName}.map`, \"utf8\").catch(() => {\n    });\n    if (rawSourceMap) {\n      const consumer = await new SourceMapConsumer(rawSourceMap);\n      const originalPosition = consumer.originalPositionFor({ line: frame.lineNumber, column: frame.columnNumber });\n      if (originalPosition.source && originalPosition.line) {\n        frame.fileName = resolve$1(dirname$1(frame.fileName), originalPosition.source);\n        frame.lineNumber = originalPosition.line;\n        frame.columnNumber = originalPosition.column || 0;\n      }\n    }\n  }\n  const contents = await readFile(frame.fileName, \"utf8\").catch(() => {\n  });\n  return contents ? { contents } : void 0;\n}\nfunction fmtFrame(frame) {\n  if (frame.type === \"native\") {\n    return frame.raw;\n  }\n  const src = `${frame.fileName || \"\"}:${frame.lineNumber}:${frame.columnNumber})`;\n  return frame.functionName ? `at ${frame.functionName} (${src}` : `at ${src}`;\n}\n\nfunction createVFSHandler(nitro) {\n  return eventHandler(async (event) => {\n    const { socket } = event.node.req;\n    const isUnixSocket = (\n      // No network addresses\n      !socket?.remoteAddress && !socket?.localAddress && // Empty address object\n      Object.keys(socket?.address?.() || {}).length === 0 && // Socket is readable/writable but has no port info\n      socket?.readable && socket?.writable && !socket?.remotePort\n    );\n    const ip = getRequestIP(event, { xForwardedFor: isUnixSocket });\n    const isLocalRequest = ip && /^::1$|^127\\.\\d+\\.\\d+\\.\\d+$/.test(ip);\n    if (!isLocalRequest) {\n      throw createError({\n        message: `Forbidden IP: \"${ip || \"?\"}\"`,\n        statusCode: 403\n      });\n    }\n    const vfsEntries = {\n      ...nitro.vfs,\n      ...nitro.options.virtual\n    };\n    const url = event.path || \"\";\n    const isJson = url.endsWith(\".json\") || getRequestHeader(event, \"accept\")?.includes(\"application/json\");\n    const id = decodeURIComponent(url.replace(/^(\\.json)?\\/?/, \"\") || \"\");\n    if (id && !(id in vfsEntries)) {\n      throw createError({ message: \"File not found\", statusCode: 404 });\n    }\n    let content = id ? vfsEntries[id] : void 0;\n    if (typeof content === \"function\") {\n      content = await content();\n    }\n    if (isJson) {\n      return {\n        rootDir: nitro.options.rootDir,\n        entries: Object.keys(vfsEntries).map((id2) => ({\n          id: id2,\n          path: \"/_vfs.json/\" + encodeURIComponent(id2)\n        })),\n        current: id ? {\n          id,\n          content\n        } : null\n      };\n    }\n    const directories = { [nitro.options.rootDir]: {} };\n    const fpaths = Object.keys(vfsEntries);\n    for (const item of fpaths) {\n      const segments = item.replace(nitro.options.rootDir, \"\").split(\"/\").filter(Boolean);\n      let currentDir = item.startsWith(nitro.options.rootDir) ? directories[nitro.options.rootDir] : directories;\n      for (const segment of segments) {\n        if (!currentDir[segment]) {\n          currentDir[segment] = {};\n        }\n        currentDir = currentDir[segment];\n      }\n    }\n    const generateHTML = (directory, path = []) => Object.entries(directory).map(([fname, value = {}]) => {\n      const subpath = [...path, fname];\n      const key = subpath.join(\"/\");\n      const encodedUrl = encodeURIComponent(key);\n      const linkClass = url === `/${encodedUrl}` ? \"bg-gray-700 text-white\" : \"hover:bg-gray-800 text-gray-200\";\n      return Object.keys(value).length === 0 ? `\n            <li class=\"flex flex-nowrap\">\n              <a href=\"/_vfs/${encodedUrl}\" class=\"w-full text-sm px-2 py-1 border-b border-gray-10 ${linkClass}\">\n                ${fname}\n              </a>\n            </li>\n            ` : `\n            <li>\n              <details ${url.startsWith(`/${encodedUrl}`) ? \"open\" : \"\"}>\n                <summary class=\"w-full text-sm px-2 py-1 border-b border-gray-10 hover:bg-gray-800 text-gray-200\">\n                  ${fname}\n                </summary>\n                <ul class=\"ml-4\">\n                  ${generateHTML(value, subpath)}\n                </ul>\n              </details>\n            </li>\n            `;\n    }).join(\"\");\n    const rootDirectory = directories[nitro.options.rootDir];\n    delete directories[nitro.options.rootDir];\n    const items = generateHTML(rootDirectory, [nitro.options.rootDir]) + generateHTML(directories);\n    const files = `\n      <div class=\"h-full overflow-auto border-r border-gray:10\">\n        <p class=\"text-white text-bold text-center py-1 opacity-50\">Virtual Files</p>\n        <ul class=\"flex flex-col\">${items}</ul>\n      </div>\n      `;\n    const file = id ? editorTemplate({\n      readOnly: true,\n      language: id.endsWith(\"html\") ? \"html\" : \"javascript\",\n      theme: \"vs-dark\",\n      value: content,\n      wordWrap: \"wordWrapColumn\",\n      wordWrapColumn: 80\n    }) : `\n        <div class=\"w-full h-full flex opacity-50\">\n          <h1 class=\"text-white m-auto\">Select a virtual file to inspect</h1>\n        </div>\n      `;\n    return (\n      /* html */\n      `\n<!doctype html>\n<html>\n<head>\n  <link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/@unocss/reset/tailwind.min.css\" />\n  <link rel=\"stylesheet\" data-name=\"vs/editor/editor.main\" href=\"${vsUrl}/editor/editor.main.min.css\">\n  <script src=\"https://cdn.jsdelivr.net/npm/@unocss/runtime\"><\\/script>\n  <style>\n    html {\n      background: #1E1E1E;\n      color: white;\n    }\n    [un-cloak] {\n      display: none;\n    }\n  </style>\n</head>\n<body class=\"bg-[#1E1E1E]\">\n  <div un-cloak class=\"h-screen grid grid-cols-[300px_1fr]\">\n    ${files}\n    ${file}\n  </div>\n</body>\n</html>`\n    );\n  });\n}\nconst monacoVersion = \"0.30.0\";\nconst monacoUrl = `https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/${monacoVersion}/min`;\nconst vsUrl = `${monacoUrl}/vs`;\nconst editorTemplate = (options) => `\n<div id=\"editor\" class=\"min-h-screen w-full h-full\"></div>\n<script src=\"${vsUrl}/loader.min.js\"><\\/script>\n<script>\n  require.config({ paths: { vs: '${vsUrl}' } })\n\n  const proxy = URL.createObjectURL(new Blob([\\`\n    self.MonacoEnvironment = { baseUrl: '${monacoUrl}' }\n    importScripts('${vsUrl}/base/worker/workerMain.min.js')\n  \\`], { type: 'text/javascript' }))\n  window.MonacoEnvironment = { getWorkerUrl: () => proxy }\n\n  setTimeout(() => {\n    require(['vs/editor/editor.main'], function () {\n      monaco.editor.create(document.getElementById('editor'), ${JSON.stringify(\n  options\n)})\n    })\n  }, 0);\n<\\/script>\n`;\n\nfunction createDevServer(nitro) {\n  const devServer = new DevServer(nitro);\n  return {\n    reload: () => devServer.reload(),\n    listen: (port, opts) => devServer.listen(port, opts),\n    close: () => devServer.close(),\n    upgrade: (req, socket, head) => devServer.handleUpgrade(req, socket, head),\n    get app() {\n      return devServer.app;\n    },\n    get watcher() {\n      return devServer.watcher;\n    }\n  };\n}\nlet workerIdCtr = 0;\nclass DevServer {\n  nitro;\n  workerDir;\n  app;\n  listeners = [];\n  reloadPromise;\n  watcher;\n  workers = [];\n  workerError;\n  building = true;\n  buildError;\n  constructor(nitro) {\n    this.nitro = nitro;\n    this.workerDir = resolve(\n      nitro.options.output.dir,\n      nitro.options.output.serverDir\n    );\n    this.app = this.createApp();\n    nitro.hooks.hook(\"close\", () => this.close());\n    nitro.hooks.hook(\"dev:start\", () => {\n      this.building = true;\n      this.buildError = void 0;\n    });\n    nitro.hooks.hook(\"dev:reload\", () => {\n      this.buildError = void 0;\n      this.building = false;\n      this.reload();\n    });\n    nitro.hooks.hook(\"dev:error\", (cause) => {\n      this.buildError = cause;\n      this.building = false;\n      for (const worker of this.workers) {\n        worker.close();\n      }\n    });\n    if (nitro.options.devServer.watch.length > 0) {\n      const debouncedReload = debounce(() => this.reload());\n      this.watcher = watch(\n        nitro.options.devServer.watch,\n        nitro.options.watchOptions\n      );\n      this.watcher.on(\"add\", debouncedReload).on(\"change\", debouncedReload);\n    }\n  }\n  async listen(port, opts) {\n    const listener = await listen(toNodeListener(this.app), { port, ...opts });\n    this.listeners.push(listener);\n    listener.server.on(\n      \"upgrade\",\n      (req, sock, head) => this.handleUpgrade(req, sock, head)\n    );\n    return listener;\n  }\n  async close() {\n    await Promise.all(\n      [\n        Promise.all(this.listeners.map((l) => l.close())).then(() => {\n          this.listeners = [];\n        }),\n        Promise.all(this.workers.map((w) => w.close())).then(() => {\n          this.workers = [];\n        }),\n        Promise.resolve(this.watcher?.close()).then(() => {\n          this.watcher = void 0;\n        })\n      ].map(\n        (p) => p.catch((error) => {\n          consola.error(error);\n        })\n      )\n    );\n  }\n  reload() {\n    for (const worker2 of this.workers) {\n      worker2.close();\n    }\n    const worker = new NodeDevWorker(++workerIdCtr, this.workerDir, {\n      onClose: (worker2, cause) => {\n        this.workerError = cause;\n        const index = this.workers.indexOf(worker2);\n        if (index !== -1) {\n          this.workers.splice(index, 1);\n        }\n      },\n      onReady: (worker2, addr) => {\n        this.writeBuildInfo(worker2, addr);\n      }\n    });\n    if (!worker.closed) {\n      this.workers.unshift(worker);\n    }\n  }\n  async getWorker() {\n    let retry = 0;\n    const maxRetries = isTest || isCI ? 100 : 10;\n    while (this.building || ++retry < maxRetries) {\n      if ((this.workers.length === 0 || this.buildError) && !this.building) {\n        return;\n      }\n      const activeWorker = this.workers.find((w) => w.ready);\n      if (activeWorker) {\n        return activeWorker;\n      }\n      await new Promise((resolve2) => setTimeout(resolve2, 600));\n    }\n  }\n  writeBuildInfo(_worker, addr) {\n    const buildInfoPath = resolve(this.nitro.options.buildDir, \"nitro.json\");\n    const buildInfo = {\n      date: (/* @__PURE__ */ new Date()).toJSON(),\n      preset: this.nitro.options.preset,\n      framework: this.nitro.options.framework,\n      versions: {\n        nitro: version\n      },\n      dev: {\n        pid: process.pid,\n        workerAddress: addr\n      }\n    };\n    writeFile$1(buildInfoPath, JSON.stringify(buildInfo, null, 2)).catch(\n      (error) => {\n        consola.error(error);\n      }\n    );\n  }\n  createApp() {\n    const app = createApp({\n      onError: async (error, event) => {\n        const errorHandler = this.nitro.options.devErrorHandler || devErrorHandler;\n        await loadStackTrace(error).catch(() => {\n        });\n        return errorHandler(error, event, {\n          defaultHandler: defaultHandler\n        });\n      }\n    });\n    for (const handler of this.nitro.options.devHandlers) {\n      app.use(handler.route || \"/\", handler.handler);\n    }\n    app.use(\"/_vfs\", createVFSHandler(this.nitro));\n    const routeRulesMatcher = toRouteMatcher(\n      createRouter({ routes: this.nitro.options.routeRules })\n    );\n    for (const asset of this.nitro.options.publicAssets) {\n      const url = joinURL(\n        this.nitro.options.runtimeConfig.app.baseURL,\n        asset.baseURL || \"/\"\n      );\n      app.use(\n        url,\n        fromNodeMiddleware(\n          serveStatic(asset.dir, {\n            dotfiles: \"allow\",\n            setHeaders(res, path) {\n              if (path.endsWith(\".gz\")) {\n                res.setHeader(\"Content-Encoding\", \"gzip\");\n              }\n              const pathname = res.req?._parsedOriginalUrl?.pathname;\n              if (pathname) {\n                const rules = defu$1(\n                  {},\n                  ...routeRulesMatcher.matchAll(pathname).reverse()\n                );\n                if (rules.headers) {\n                  for (const [k, v] of Object.entries(rules.headers)) {\n                    if (k === \"cache-control\") continue;\n                    res.appendHeader(k, v);\n                  }\n                }\n              }\n            }\n          })\n        )\n      );\n      if (!asset.fallthrough) {\n        app.use(url, fromNodeMiddleware(servePlaceholder()));\n      }\n    }\n    const routes = Object.keys(this.nitro.options.devProxy).sort().reverse();\n    for (const route of routes) {\n      let opts = this.nitro.options.devProxy[route];\n      if (typeof opts === \"string\") {\n        opts = { target: opts };\n      }\n      const proxy = createHTTPProxy(opts);\n      app.use(\n        route,\n        eventHandler((event) => proxy.handleEvent(event))\n      );\n    }\n    app.use(\n      eventHandler(async (event) => {\n        const worker = await this.getWorker();\n        if (!worker) {\n          return this.#generateError();\n        }\n        return worker.handleEvent(event);\n      })\n    );\n    return app;\n  }\n  async handleUpgrade(req, socket, head) {\n    const worker = await this.getWorker();\n    if (!worker) {\n      throw createError({\n        statusCode: 503,\n        message: \"No worker available.\"\n      });\n    }\n    return worker.handleUpgrade(req, socket, head);\n  }\n  #generateError() {\n    const error = this.buildError || this.workerError;\n    if (error) {\n      try {\n        error.unhandled = false;\n        let id = error.id || error.path;\n        if (id) {\n          const cause = error.errors?.[0];\n          const loc = error.location || error.loc || cause?.location || cause?.loc;\n          if (loc) {\n            id += `:${loc.line}:${loc.column}`;\n          }\n          error.stack = (error.stack || \"\").replace(\n            /(^\\s*at\\s+.+)/m,\n            `    at ${id}\n$1`\n          );\n        }\n      } catch {\n      }\n      return createError(error);\n    }\n    return new Response(\n      JSON.stringify(\n        {\n          error: \"Dev server is unavailable.\",\n          hint: \"Please reload the page and check the console for errors if the issue persists.\"\n        },\n        null,\n        2\n      ),\n      {\n        status: 503,\n        statusText: \"Dev server is unavailable\",\n        headers: {\n          \"Content-Type\": \"application/json\",\n          \"Cache-Control\": \"no-store\",\n          Refresh: \"3\"\n        }\n      }\n    );\n  }\n}\n\nasync function prepare(nitro) {\n  await prepareDir(nitro.options.output.dir);\n  if (!nitro.options.noPublicDir) {\n    await prepareDir(nitro.options.output.publicDir);\n  }\n  if (!nitro.options.static) {\n    await prepareDir(nitro.options.output.serverDir);\n  }\n}\nasync function prepareDir(dir) {\n  await fsp.rm(dir, { recursive: true, force: true });\n  await fsp.mkdir(dir, { recursive: true });\n}\n\nfunction defineNitroConfig(config) {\n  return config;\n}\n\nexport { GLOB_SCAN_PATTERN, build, copyPublicAssets, createDevServer, createNitro, defineNitroConfig, listTasks, loadOptions, prepare, prerender, runTask, scanHandlers, scanMiddleware, scanModules, scanPlugins, scanServerRoutes, scanTasks, writeTypes };\n"]}