diff --git a/.astro/settings.json b/.astro/settings.json new file mode 100644 index 0000000..632bb96 --- /dev/null +++ b/.astro/settings.json @@ -0,0 +1,5 @@ +{ + "_variables": { + "lastUpdateCheck": 1721590671562 + } +} \ No newline at end of file diff --git a/.vercel/output/config.json b/.vercel/output/config.json new file mode 100644 index 0000000..bc52f6b --- /dev/null +++ b/.vercel/output/config.json @@ -0,0 +1,19 @@ +{ + "version": 3, + "routes": [ + { + "src": "^/_astro/(.*)$", + "headers": { + "cache-control": "public, max-age=31536000, immutable" + }, + "continue": true + }, + { + "handle": "filesystem" + }, + { + "src": "^\\/_image$", + "dest": "_render" + } + ] +} \ No newline at end of file diff --git a/.vercel/output/functions/_render.func/.vc-config.json b/.vercel/output/functions/_render.func/.vc-config.json new file mode 100644 index 0000000..56c08d9 --- /dev/null +++ b/.vercel/output/functions/_render.func/.vc-config.json @@ -0,0 +1,6 @@ +{ + "runtime": "nodejs18.x", + "handler": "home/vic/src/web/portfolio/.vercel/output/_functions/entry.mjs", + "launcherType": "Nodejs", + "supportsResponseStreaming": true +} \ No newline at end of file diff --git a/.vercel/output/functions/_render.func/home/vic/src/web/portfolio/.vercel/output/_functions/_noop-middleware.mjs b/.vercel/output/functions/_render.func/home/vic/src/web/portfolio/.vercel/output/_functions/_noop-middleware.mjs new file mode 100644 index 0000000..84424b0 --- /dev/null +++ b/.vercel/output/functions/_render.func/home/vic/src/web/portfolio/.vercel/output/_functions/_noop-middleware.mjs @@ -0,0 +1,3 @@ +const onRequest = (_, next) => next(); + +export { onRequest }; diff --git a/.vercel/output/functions/_render.func/home/vic/src/web/portfolio/.vercel/output/_functions/chunks/_@astrojs-manifest_BchT3v_p.mjs b/.vercel/output/functions/_render.func/home/vic/src/web/portfolio/.vercel/output/_functions/chunks/_@astrojs-manifest_BchT3v_p.mjs new file mode 100644 index 0000000..cb018e0 --- /dev/null +++ b/.vercel/output/functions/_render.func/home/vic/src/web/portfolio/.vercel/output/_functions/chunks/_@astrojs-manifest_BchT3v_p.mjs @@ -0,0 +1,352 @@ +import 'cookie'; +import { bold, red, yellow, dim, blue } from 'kleur/colors'; +import { D as DEFAULT_404_COMPONENT } from './astro/server_mfaSpNA7.mjs'; +import 'clsx'; +import { escape } from 'html-escaper'; +import { compile } from 'path-to-regexp'; + +const dateTimeFormat = new Intl.DateTimeFormat([], { + hour: "2-digit", + minute: "2-digit", + second: "2-digit", + hour12: false +}); +const levels = { + debug: 20, + info: 30, + warn: 40, + error: 50, + silent: 90 +}; +function log(opts, level, label, message, newLine = true) { + const logLevel = opts.level; + const dest = opts.dest; + const event = { + label, + level, + message, + newLine + }; + if (!isLogLevelEnabled(logLevel, level)) { + return; + } + dest.write(event); +} +function isLogLevelEnabled(configuredLogLevel, level) { + return levels[configuredLogLevel] <= levels[level]; +} +function info(opts, label, message, newLine = true) { + return log(opts, "info", label, message, newLine); +} +function warn(opts, label, message, newLine = true) { + return log(opts, "warn", label, message, newLine); +} +function error(opts, label, message, newLine = true) { + return log(opts, "error", label, message, newLine); +} +function debug(...args) { + if ("_astroGlobalDebug" in globalThis) { + globalThis._astroGlobalDebug(...args); + } +} +function getEventPrefix({ level, label }) { + const timestamp = `${dateTimeFormat.format(/* @__PURE__ */ new Date())}`; + const prefix = []; + if (level === "error" || level === "warn") { + prefix.push(bold(timestamp)); + prefix.push(`[${level.toUpperCase()}]`); + } else { + prefix.push(timestamp); + } + if (label) { + prefix.push(`[${label}]`); + } + if (level === "error") { + return red(prefix.join(" ")); + } + if (level === "warn") { + return yellow(prefix.join(" ")); + } + if (prefix.length === 1) { + return dim(prefix[0]); + } + return dim(prefix[0]) + " " + blue(prefix.splice(1).join(" ")); +} +if (typeof process !== "undefined") { + let proc = process; + if ("argv" in proc && Array.isArray(proc.argv)) { + if (proc.argv.includes("--verbose")) ; else if (proc.argv.includes("--silent")) ; else ; + } +} +class Logger { + options; + constructor(options) { + this.options = options; + } + info(label, message, newLine = true) { + info(this.options, label, message, newLine); + } + warn(label, message, newLine = true) { + warn(this.options, label, message, newLine); + } + error(label, message, newLine = true) { + error(this.options, label, message, newLine); + } + debug(label, ...messages) { + debug(label, ...messages); + } + level() { + return this.options.level; + } + forkIntegrationLogger(label) { + return new AstroIntegrationLogger(this.options, label); + } +} +class AstroIntegrationLogger { + options; + label; + constructor(logging, label) { + this.options = logging; + this.label = label; + } + /** + * Creates a new logger instance with a new label, but the same log options. + */ + fork(label) { + return new AstroIntegrationLogger(this.options, label); + } + info(message) { + info(this.options, this.label, message); + } + warn(message) { + warn(this.options, this.label, message); + } + error(message) { + error(this.options, this.label, message); + } + debug(message) { + debug(this.label, message); + } +} + +function template({ + title, + pathname, + statusCode = 404, + tabTitle, + body +}) { + return ` + + + + ${tabTitle} + + + +
+ +

${statusCode ? `${statusCode}: ` : ""}${title}

+ ${body || ` +
Path: ${escape(pathname)}
+ `} +
+ +`; +} + +const DEFAULT_404_ROUTE = { + component: DEFAULT_404_COMPONENT, + generate: () => "", + params: [], + pattern: /\/404/, + prerender: false, + pathname: "/404", + segments: [[{ content: "404", dynamic: false, spread: false }]], + type: "page", + route: "/404", + fallbackRoutes: [], + isIndex: false +}; +function ensure404Route(manifest) { + if (!manifest.routes.some((route) => route.route === "/404")) { + manifest.routes.push(DEFAULT_404_ROUTE); + } + return manifest; +} +async function default404Page({ pathname }) { + return new Response( + template({ + statusCode: 404, + title: "Not found", + tabTitle: "404: Not Found", + pathname + }), + { status: 404, headers: { "Content-Type": "text/html; charset=utf-8" } } + ); +} +default404Page.isAstroComponentFactory = true; +const default404Instance = { + default: default404Page +}; + +function sanitizeParams(params) { + return Object.fromEntries( + Object.entries(params).map(([key, value]) => { + if (typeof value === "string") { + return [key, value.normalize().replace(/#/g, "%23").replace(/\?/g, "%3F")]; + } + return [key, value]; + }) + ); +} +function getRouteGenerator(segments, addTrailingSlash) { + const template = segments.map((segment) => { + return "/" + segment.map((part) => { + if (part.spread) { + return `:${part.content.slice(3)}(.*)?`; + } else if (part.dynamic) { + return `:${part.content}`; + } else { + return part.content.normalize().replace(/\?/g, "%3F").replace(/#/g, "%23").replace(/%5B/g, "[").replace(/%5D/g, "]").replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); + } + }).join(""); + }).join(""); + let trailing = ""; + if (addTrailingSlash === "always" && segments.length) { + trailing = "/"; + } + const toPath = compile(template + trailing); + return (params) => { + const sanitizedParams = sanitizeParams(params); + const path = toPath(sanitizedParams); + return path || "/"; + }; +} + +function deserializeRouteData(rawRouteData) { + return { + route: rawRouteData.route, + type: rawRouteData.type, + pattern: new RegExp(rawRouteData.pattern), + params: rawRouteData.params, + component: rawRouteData.component, + generate: getRouteGenerator(rawRouteData.segments, rawRouteData._meta.trailingSlash), + pathname: rawRouteData.pathname || void 0, + segments: rawRouteData.segments, + prerender: rawRouteData.prerender, + redirect: rawRouteData.redirect, + redirectRoute: rawRouteData.redirectRoute ? deserializeRouteData(rawRouteData.redirectRoute) : void 0, + fallbackRoutes: rawRouteData.fallbackRoutes.map((fallback) => { + return deserializeRouteData(fallback); + }), + isIndex: rawRouteData.isIndex + }; +} + +function deserializeManifest(serializedManifest) { + const routes = []; + for (const serializedRoute of serializedManifest.routes) { + routes.push({ + ...serializedRoute, + routeData: deserializeRouteData(serializedRoute.routeData) + }); + const route = serializedRoute; + route.routeData = deserializeRouteData(serializedRoute.routeData); + } + const assets = new Set(serializedManifest.assets); + const componentMetadata = new Map(serializedManifest.componentMetadata); + const inlinedScripts = new Map(serializedManifest.inlinedScripts); + const clientDirectives = new Map(serializedManifest.clientDirectives); + const serverIslandNameMap = new Map(serializedManifest.serverIslandNameMap); + return { + // in case user middleware exists, this no-op middleware will be reassigned (see plugin-ssr.ts) + middleware(_, next) { + return next(); + }, + ...serializedManifest, + assets, + componentMetadata, + inlinedScripts, + clientDirectives, + routes, + serverIslandNameMap + }; +} + +const manifest = deserializeManifest({"hrefRoot":"file:///home/vic/src/web/portfolio/","adapterName":"@astrojs/vercel/serverless","routes":[{"file":"robots.txt","links":[],"scripts":[],"styles":[],"routeData":{"route":"/robots.txt","isIndex":false,"type":"endpoint","pattern":"^\\/robots\\.txt\\/?$","segments":[[{"content":"robots.txt","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/robots.txt.ts","pathname":"/robots.txt","prerender":true,"fallbackRoutes":[],"_meta":{"trailingSlash":"ignore"}}},{"file":"index.html","links":[],"scripts":[],"styles":[],"routeData":{"route":"/","isIndex":true,"type":"page","pattern":"^\\/$","segments":[],"params":[],"component":"src/pages/index.astro","pathname":"/","prerender":true,"fallbackRoutes":[],"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"styles":[],"routeData":{"type":"endpoint","isIndex":false,"route":"/_image","pattern":"^\\/_image$","segments":[[{"content":"_image","dynamic":false,"spread":false}]],"params":[],"component":"node_modules/astro/dist/assets/endpoint/generic.js","pathname":"/_image","prerender":false,"fallbackRoutes":[],"_meta":{"trailingSlash":"ignore"}}}],"site":"https://wilyJ80.github.io/portfolio","base":"/","trailingSlash":"ignore","compressHTML":true,"componentMetadata":[["/home/vic/src/web/portfolio/src/pages/index.astro",{"propagation":"none","containsHead":true}]],"renderers":[],"clientDirectives":[["idle","(()=>{var i=t=>{let e=async()=>{await(await t())()};\"requestIdleCallback\"in window?window.requestIdleCallback(e):setTimeout(e,200)};(self.Astro||(self.Astro={})).idle=i;window.dispatchEvent(new Event(\"astro:idle\"));})();"],["load","(()=>{var e=async t=>{await(await t())()};(self.Astro||(self.Astro={})).load=e;window.dispatchEvent(new Event(\"astro:load\"));})();"],["media","(()=>{var s=(i,t)=>{let a=async()=>{await(await i())()};if(t.value){let e=matchMedia(t.value);e.matches?a():e.addEventListener(\"change\",a,{once:!0})}};(self.Astro||(self.Astro={})).media=s;window.dispatchEvent(new Event(\"astro:media\"));})();"],["only","(()=>{var e=async t=>{await(await t())()};(self.Astro||(self.Astro={})).only=e;window.dispatchEvent(new Event(\"astro:only\"));})();"],["visible","(()=>{var l=(s,i,o)=>{let r=async()=>{await(await s())()},t=typeof i.value==\"object\"?i.value:void 0,c={rootMargin:t==null?void 0:t.rootMargin},n=new IntersectionObserver(e=>{for(let a of e)if(a.isIntersecting){n.disconnect(),r();break}},c);for(let e of o.children)n.observe(e)};(self.Astro||(self.Astro={})).visible=l;window.dispatchEvent(new Event(\"astro:visible\"));})();"]],"entryModules":{"\u0000@astro-page:node_modules/astro/dist/assets/endpoint/generic@_@js":"pages/_image.astro.mjs","\u0000@astro-page:src/pages/robots.txt@_@ts":"pages/robots.txt.astro.mjs","\u0000@astro-page:src/pages/index@_@astro":"pages/index.astro.mjs","\u0000@astrojs-ssr-virtual-entry":"entry.mjs","\u0000noop-middleware":"_noop-middleware.mjs","\u0000@astro-renderers":"renderers.mjs","/home/vic/src/web/portfolio/node_modules/astro/dist/env/setup.js":"chunks/astro/env-setup_Cr6XTFvb.mjs","\u0000@astrojs-manifest":"manifest_BbZOqa2I.mjs","astro:scripts/before-hydration.js":""},"inlinedScripts":[],"assets":["/_astro/index.BuTT48KC.css","/favicon.svg","/robots.txt","/assets/img/ai-generated-portrait.webp","/assets/img/vitaoportrait.webp","/assets/svg/backgrounds/horizon-animated.svg","/assets/svg/backgrounds/horizon.svg","/assets/svg/icons/email.svg","/assets/svg/icons/github.svg","/assets/svg/icons/instagram.svg","/assets/svg/icons/linkedin.svg","/assets/svg/icons/tiktok.svg","/assets/svg/icons/x.svg","/robots.txt","/index.html"],"buildFormat":"directory","checkOrigin":false,"rewritingEnabled":false,"serverIslandNameMap":[],"experimentalEnvGetSecretEnabled":false}); + +export { AstroIntegrationLogger as A, DEFAULT_404_ROUTE as D, Logger as L, default404Instance as d, ensure404Route as e, getEventPrefix as g, levels as l, manifest as m }; diff --git a/.vercel/output/functions/_render.func/home/vic/src/web/portfolio/.vercel/output/_functions/chunks/_astro_assets_BUmYIlZq.mjs b/.vercel/output/functions/_render.func/home/vic/src/web/portfolio/.vercel/output/_functions/chunks/_astro_assets_BUmYIlZq.mjs new file mode 100644 index 0000000..0c732fc --- /dev/null +++ b/.vercel/output/functions/_render.func/home/vic/src/web/portfolio/.vercel/output/_functions/chunks/_astro_assets_BUmYIlZq.mjs @@ -0,0 +1,1015 @@ +import { A as AstroError, g as NoImageMetadata, F as FailedToFetchRemoteImageDimensions, h as ExpectedImageOptions, j as ExpectedImage, k as ExpectedNotESMImage, r as resolveSrc, l as isRemoteImage, m as isESMImportedImage, n as isLocalService, D as DEFAULT_HASH_PROPS, o as InvalidImageService, p as ImageMissingAlt } from './astro/assets-service_DK7A0Y1H.mjs'; +import { d as createAstro, c as createComponent, r as renderTemplate, m as maybeRenderHead, b as addAttribute, s as spreadAttributes } from './astro/server_mfaSpNA7.mjs'; +import * as mime from 'mrmime'; +import 'clsx'; + +function isImageMetadata(src) { + return src.fsPath && !("fsPath" in src); +} + +const decoder = new TextDecoder(); +const toUTF8String = (input, start = 0, end = input.length) => decoder.decode(input.slice(start, end)); +const toHexString = (input, start = 0, end = input.length) => input.slice(start, end).reduce((memo, i) => memo + ("0" + i.toString(16)).slice(-2), ""); +const readInt16LE = (input, offset = 0) => { + const val = input[offset] + input[offset + 1] * 2 ** 8; + return val | (val & 2 ** 15) * 131070; +}; +const readUInt16BE = (input, offset = 0) => input[offset] * 2 ** 8 + input[offset + 1]; +const readUInt16LE = (input, offset = 0) => input[offset] + input[offset + 1] * 2 ** 8; +const readUInt24LE = (input, offset = 0) => input[offset] + input[offset + 1] * 2 ** 8 + input[offset + 2] * 2 ** 16; +const readInt32LE = (input, offset = 0) => input[offset] + input[offset + 1] * 2 ** 8 + input[offset + 2] * 2 ** 16 + (input[offset + 3] << 24); +const readUInt32BE = (input, offset = 0) => input[offset] * 2 ** 24 + input[offset + 1] * 2 ** 16 + input[offset + 2] * 2 ** 8 + input[offset + 3]; +const readUInt32LE = (input, offset = 0) => input[offset] + input[offset + 1] * 2 ** 8 + input[offset + 2] * 2 ** 16 + input[offset + 3] * 2 ** 24; +const methods = { + readUInt16BE, + readUInt16LE, + readUInt32BE, + readUInt32LE +}; +function readUInt(input, bits, offset, isBigEndian) { + offset = offset || 0; + const endian = isBigEndian ? "BE" : "LE"; + const methodName = "readUInt" + bits + endian; + return methods[methodName](input, offset); +} +function readBox(buffer, offset) { + if (buffer.length - offset < 4) return; + const boxSize = readUInt32BE(buffer, offset); + if (buffer.length - offset < boxSize) return; + return { + name: toUTF8String(buffer, 4 + offset, 8 + offset), + offset, + size: boxSize + }; +} +function findBox(buffer, boxName, offset) { + while (offset < buffer.length) { + const box = readBox(buffer, offset); + if (!box) break; + if (box.name === boxName) return box; + offset += box.size; + } +} + +const BMP = { + validate: (input) => toUTF8String(input, 0, 2) === "BM", + calculate: (input) => ({ + height: Math.abs(readInt32LE(input, 22)), + width: readUInt32LE(input, 18) + }) +}; + +const TYPE_ICON = 1; +const SIZE_HEADER$1 = 2 + 2 + 2; +const SIZE_IMAGE_ENTRY = 1 + 1 + 1 + 1 + 2 + 2 + 4 + 4; +function getSizeFromOffset(input, offset) { + const value = input[offset]; + return value === 0 ? 256 : value; +} +function getImageSize$1(input, imageIndex) { + const offset = SIZE_HEADER$1 + imageIndex * SIZE_IMAGE_ENTRY; + return { + height: getSizeFromOffset(input, offset + 1), + width: getSizeFromOffset(input, offset) + }; +} +const ICO = { + validate(input) { + const reserved = readUInt16LE(input, 0); + const imageCount = readUInt16LE(input, 4); + if (reserved !== 0 || imageCount === 0) return false; + const imageType = readUInt16LE(input, 2); + return imageType === TYPE_ICON; + }, + calculate(input) { + const nbImages = readUInt16LE(input, 4); + const imageSize = getImageSize$1(input, 0); + if (nbImages === 1) return imageSize; + const imgs = [imageSize]; + for (let imageIndex = 1; imageIndex < nbImages; imageIndex += 1) { + imgs.push(getImageSize$1(input, imageIndex)); + } + return { + height: imageSize.height, + images: imgs, + width: imageSize.width + }; + } +}; + +const TYPE_CURSOR = 2; +const CUR = { + validate(input) { + const reserved = readUInt16LE(input, 0); + const imageCount = readUInt16LE(input, 4); + if (reserved !== 0 || imageCount === 0) return false; + const imageType = readUInt16LE(input, 2); + return imageType === TYPE_CURSOR; + }, + calculate: (input) => ICO.calculate(input) +}; + +const DDS = { + validate: (input) => readUInt32LE(input, 0) === 542327876, + calculate: (input) => ({ + height: readUInt32LE(input, 12), + width: readUInt32LE(input, 16) + }) +}; + +const gifRegexp = /^GIF8[79]a/; +const GIF = { + validate: (input) => gifRegexp.test(toUTF8String(input, 0, 6)), + calculate: (input) => ({ + height: readUInt16LE(input, 8), + width: readUInt16LE(input, 6) + }) +}; + +const brandMap = { + avif: "avif", + mif1: "heif", + msf1: "heif", + // hief-sequence + heic: "heic", + heix: "heic", + hevc: "heic", + // heic-sequence + hevx: "heic" + // heic-sequence +}; +function detectBrands(buffer, start, end) { + let brandsDetected = {}; + for (let i = start; i <= end; i += 4) { + const brand = toUTF8String(buffer, i, i + 4); + if (brand in brandMap) { + brandsDetected[brand] = 1; + } + } + if ("avif" in brandsDetected) { + return "avif"; + } else if ("heic" in brandsDetected || "heix" in brandsDetected || "hevc" in brandsDetected || "hevx" in brandsDetected) { + return "heic"; + } else if ("mif1" in brandsDetected || "msf1" in brandsDetected) { + return "heif"; + } +} +const HEIF = { + validate(buffer) { + const ftype = toUTF8String(buffer, 4, 8); + const brand = toUTF8String(buffer, 8, 12); + return "ftyp" === ftype && brand in brandMap; + }, + calculate(buffer) { + const metaBox = findBox(buffer, "meta", 0); + const iprpBox = metaBox && findBox(buffer, "iprp", metaBox.offset + 12); + const ipcoBox = iprpBox && findBox(buffer, "ipco", iprpBox.offset + 8); + const ispeBox = ipcoBox && findBox(buffer, "ispe", ipcoBox.offset + 8); + if (ispeBox) { + return { + height: readUInt32BE(buffer, ispeBox.offset + 16), + width: readUInt32BE(buffer, ispeBox.offset + 12), + type: detectBrands(buffer, 8, metaBox.offset) + }; + } + throw new TypeError("Invalid HEIF, no size found"); + } +}; + +const SIZE_HEADER = 4 + 4; +const FILE_LENGTH_OFFSET = 4; +const ENTRY_LENGTH_OFFSET = 4; +const ICON_TYPE_SIZE = { + ICON: 32, + "ICN#": 32, + // m => 16 x 16 + "icm#": 16, + icm4: 16, + icm8: 16, + // s => 16 x 16 + "ics#": 16, + ics4: 16, + ics8: 16, + is32: 16, + s8mk: 16, + icp4: 16, + // l => 32 x 32 + icl4: 32, + icl8: 32, + il32: 32, + l8mk: 32, + icp5: 32, + ic11: 32, + // h => 48 x 48 + ich4: 48, + ich8: 48, + ih32: 48, + h8mk: 48, + // . => 64 x 64 + icp6: 64, + ic12: 32, + // t => 128 x 128 + it32: 128, + t8mk: 128, + ic07: 128, + // . => 256 x 256 + ic08: 256, + ic13: 256, + // . => 512 x 512 + ic09: 512, + ic14: 512, + // . => 1024 x 1024 + ic10: 1024 +}; +function readImageHeader(input, imageOffset) { + const imageLengthOffset = imageOffset + ENTRY_LENGTH_OFFSET; + return [ + toUTF8String(input, imageOffset, imageLengthOffset), + readUInt32BE(input, imageLengthOffset) + ]; +} +function getImageSize(type) { + const size = ICON_TYPE_SIZE[type]; + return { width: size, height: size, type }; +} +const ICNS = { + validate: (input) => toUTF8String(input, 0, 4) === "icns", + calculate(input) { + const inputLength = input.length; + const fileLength = readUInt32BE(input, FILE_LENGTH_OFFSET); + let imageOffset = SIZE_HEADER; + let imageHeader = readImageHeader(input, imageOffset); + let imageSize = getImageSize(imageHeader[0]); + imageOffset += imageHeader[1]; + if (imageOffset === fileLength) return imageSize; + const result = { + height: imageSize.height, + images: [imageSize], + width: imageSize.width + }; + while (imageOffset < fileLength && imageOffset < inputLength) { + imageHeader = readImageHeader(input, imageOffset); + imageSize = getImageSize(imageHeader[0]); + imageOffset += imageHeader[1]; + result.images.push(imageSize); + } + return result; + } +}; + +const J2C = { + // TODO: this doesn't seem right. SIZ marker doesn't have to be right after the SOC + validate: (input) => toHexString(input, 0, 4) === "ff4fff51", + calculate: (input) => ({ + height: readUInt32BE(input, 12), + width: readUInt32BE(input, 8) + }) +}; + +const JP2 = { + validate(input) { + if (readUInt32BE(input, 4) !== 1783636e3 || readUInt32BE(input, 0) < 1) return false; + const ftypBox = findBox(input, "ftyp", 0); + if (!ftypBox) return false; + return readUInt32BE(input, ftypBox.offset + 4) === 1718909296; + }, + calculate(input) { + const jp2hBox = findBox(input, "jp2h", 0); + const ihdrBox = jp2hBox && findBox(input, "ihdr", jp2hBox.offset + 8); + if (ihdrBox) { + return { + height: readUInt32BE(input, ihdrBox.offset + 8), + width: readUInt32BE(input, ihdrBox.offset + 12) + }; + } + throw new TypeError("Unsupported JPEG 2000 format"); + } +}; + +const EXIF_MARKER = "45786966"; +const APP1_DATA_SIZE_BYTES = 2; +const EXIF_HEADER_BYTES = 6; +const TIFF_BYTE_ALIGN_BYTES = 2; +const BIG_ENDIAN_BYTE_ALIGN = "4d4d"; +const LITTLE_ENDIAN_BYTE_ALIGN = "4949"; +const IDF_ENTRY_BYTES = 12; +const NUM_DIRECTORY_ENTRIES_BYTES = 2; +function isEXIF(input) { + return toHexString(input, 2, 6) === EXIF_MARKER; +} +function extractSize(input, index) { + return { + height: readUInt16BE(input, index), + width: readUInt16BE(input, index + 2) + }; +} +function extractOrientation(exifBlock, isBigEndian) { + const idfOffset = 8; + const offset = EXIF_HEADER_BYTES + idfOffset; + const idfDirectoryEntries = readUInt(exifBlock, 16, offset, isBigEndian); + for (let directoryEntryNumber = 0; directoryEntryNumber < idfDirectoryEntries; directoryEntryNumber++) { + const start = offset + NUM_DIRECTORY_ENTRIES_BYTES + directoryEntryNumber * IDF_ENTRY_BYTES; + const end = start + IDF_ENTRY_BYTES; + if (start > exifBlock.length) { + return; + } + const block = exifBlock.slice(start, end); + const tagNumber = readUInt(block, 16, 0, isBigEndian); + if (tagNumber === 274) { + const dataFormat = readUInt(block, 16, 2, isBigEndian); + if (dataFormat !== 3) { + return; + } + const numberOfComponents = readUInt(block, 32, 4, isBigEndian); + if (numberOfComponents !== 1) { + return; + } + return readUInt(block, 16, 8, isBigEndian); + } + } +} +function validateExifBlock(input, index) { + const exifBlock = input.slice(APP1_DATA_SIZE_BYTES, index); + const byteAlign = toHexString( + exifBlock, + EXIF_HEADER_BYTES, + EXIF_HEADER_BYTES + TIFF_BYTE_ALIGN_BYTES + ); + const isBigEndian = byteAlign === BIG_ENDIAN_BYTE_ALIGN; + const isLittleEndian = byteAlign === LITTLE_ENDIAN_BYTE_ALIGN; + if (isBigEndian || isLittleEndian) { + return extractOrientation(exifBlock, isBigEndian); + } +} +function validateInput(input, index) { + if (index > input.length) { + throw new TypeError("Corrupt JPG, exceeded buffer limits"); + } +} +const JPG = { + validate: (input) => toHexString(input, 0, 2) === "ffd8", + calculate(input) { + input = input.slice(4); + let orientation; + let next; + while (input.length) { + const i = readUInt16BE(input, 0); + if (input[i] !== 255) { + input = input.slice(1); + continue; + } + if (isEXIF(input)) { + orientation = validateExifBlock(input, i); + } + validateInput(input, i); + next = input[i + 1]; + if (next === 192 || next === 193 || next === 194) { + const size = extractSize(input, i + 5); + if (!orientation) { + return size; + } + return { + height: size.height, + orientation, + width: size.width + }; + } + input = input.slice(i + 2); + } + throw new TypeError("Invalid JPG, no size found"); + } +}; + +const KTX = { + validate: (input) => { + const signature = toUTF8String(input, 1, 7); + return ["KTX 11", "KTX 20"].includes(signature); + }, + calculate: (input) => { + const type = input[5] === 49 ? "ktx" : "ktx2"; + const offset = type === "ktx" ? 36 : 20; + return { + height: readUInt32LE(input, offset + 4), + width: readUInt32LE(input, offset), + type + }; + } +}; + +const pngSignature = "PNG\r\n\n"; +const pngImageHeaderChunkName = "IHDR"; +const pngFriedChunkName = "CgBI"; +const PNG = { + validate(input) { + if (pngSignature === toUTF8String(input, 1, 8)) { + let chunkName = toUTF8String(input, 12, 16); + if (chunkName === pngFriedChunkName) { + chunkName = toUTF8String(input, 28, 32); + } + if (chunkName !== pngImageHeaderChunkName) { + throw new TypeError("Invalid PNG"); + } + return true; + } + return false; + }, + calculate(input) { + if (toUTF8String(input, 12, 16) === pngFriedChunkName) { + return { + height: readUInt32BE(input, 36), + width: readUInt32BE(input, 32) + }; + } + return { + height: readUInt32BE(input, 20), + width: readUInt32BE(input, 16) + }; + } +}; + +const PNMTypes = { + P1: "pbm/ascii", + P2: "pgm/ascii", + P3: "ppm/ascii", + P4: "pbm", + P5: "pgm", + P6: "ppm", + P7: "pam", + PF: "pfm" +}; +const handlers = { + default: (lines) => { + let dimensions = []; + while (lines.length > 0) { + const line = lines.shift(); + if (line[0] === "#") { + continue; + } + dimensions = line.split(" "); + break; + } + if (dimensions.length === 2) { + return { + height: parseInt(dimensions[1], 10), + width: parseInt(dimensions[0], 10) + }; + } else { + throw new TypeError("Invalid PNM"); + } + }, + pam: (lines) => { + const size = {}; + while (lines.length > 0) { + const line = lines.shift(); + if (line.length > 16 || line.charCodeAt(0) > 128) { + continue; + } + const [key, value] = line.split(" "); + if (key && value) { + size[key.toLowerCase()] = parseInt(value, 10); + } + if (size.height && size.width) { + break; + } + } + if (size.height && size.width) { + return { + height: size.height, + width: size.width + }; + } else { + throw new TypeError("Invalid PAM"); + } + } +}; +const PNM = { + validate: (input) => toUTF8String(input, 0, 2) in PNMTypes, + calculate(input) { + const signature = toUTF8String(input, 0, 2); + const type = PNMTypes[signature]; + const lines = toUTF8String(input, 3).split(/[\r\n]+/); + const handler = handlers[type] || handlers.default; + return handler(lines); + } +}; + +const PSD = { + validate: (input) => toUTF8String(input, 0, 4) === "8BPS", + calculate: (input) => ({ + height: readUInt32BE(input, 14), + width: readUInt32BE(input, 18) + }) +}; + +const svgReg = /"']|"[^"]*"|'[^']*')*>/; +const extractorRegExps = { + height: /\sheight=(['"])([^%]+?)\1/, + root: svgReg, + viewbox: /\sviewBox=(['"])(.+?)\1/i, + width: /\swidth=(['"])([^%]+?)\1/ +}; +const INCH_CM = 2.54; +const units = { + in: 96, + cm: 96 / INCH_CM, + em: 16, + ex: 8, + m: 96 / INCH_CM * 100, + mm: 96 / INCH_CM / 10, + pc: 96 / 72 / 12, + pt: 96 / 72, + px: 1 +}; +const unitsReg = new RegExp( + `^([0-9.]+(?:e\\d+)?)(${Object.keys(units).join("|")})?$` +); +function parseLength(len) { + const m = unitsReg.exec(len); + if (!m) { + return void 0; + } + return Math.round(Number(m[1]) * (units[m[2]] || 1)); +} +function parseViewbox(viewbox) { + const bounds = viewbox.split(" "); + return { + height: parseLength(bounds[3]), + width: parseLength(bounds[2]) + }; +} +function parseAttributes(root) { + const width = root.match(extractorRegExps.width); + const height = root.match(extractorRegExps.height); + const viewbox = root.match(extractorRegExps.viewbox); + return { + height: height && parseLength(height[2]), + viewbox: viewbox && parseViewbox(viewbox[2]), + width: width && parseLength(width[2]) + }; +} +function calculateByDimensions(attrs) { + return { + height: attrs.height, + width: attrs.width + }; +} +function calculateByViewbox(attrs, viewbox) { + const ratio = viewbox.width / viewbox.height; + if (attrs.width) { + return { + height: Math.floor(attrs.width / ratio), + width: attrs.width + }; + } + if (attrs.height) { + return { + height: attrs.height, + width: Math.floor(attrs.height * ratio) + }; + } + return { + height: viewbox.height, + width: viewbox.width + }; +} +const SVG = { + // Scan only the first kilo-byte to speed up the check on larger files + validate: (input) => svgReg.test(toUTF8String(input, 0, 1e3)), + calculate(input) { + const root = toUTF8String(input).match(extractorRegExps.root); + if (root) { + const attrs = parseAttributes(root[0]); + if (attrs.width && attrs.height) { + return calculateByDimensions(attrs); + } + if (attrs.viewbox) { + return calculateByViewbox(attrs, attrs.viewbox); + } + } + throw new TypeError("Invalid SVG"); + } +}; + +const TGA = { + validate(input) { + return readUInt16LE(input, 0) === 0 && readUInt16LE(input, 4) === 0; + }, + calculate(input) { + return { + height: readUInt16LE(input, 14), + width: readUInt16LE(input, 12) + }; + } +}; + +function readIFD(input, isBigEndian) { + const ifdOffset = readUInt(input, 32, 4, isBigEndian); + return input.slice(ifdOffset + 2); +} +function readValue(input, isBigEndian) { + const low = readUInt(input, 16, 8, isBigEndian); + const high = readUInt(input, 16, 10, isBigEndian); + return (high << 16) + low; +} +function nextTag(input) { + if (input.length > 24) { + return input.slice(12); + } +} +function extractTags(input, isBigEndian) { + const tags = {}; + let temp = input; + while (temp && temp.length) { + const code = readUInt(temp, 16, 0, isBigEndian); + const type = readUInt(temp, 16, 2, isBigEndian); + const length = readUInt(temp, 32, 4, isBigEndian); + if (code === 0) { + break; + } else { + if (length === 1 && (type === 3 || type === 4)) { + tags[code] = readValue(temp, isBigEndian); + } + temp = nextTag(temp); + } + } + return tags; +} +function determineEndianness(input) { + const signature = toUTF8String(input, 0, 2); + if ("II" === signature) { + return "LE"; + } else if ("MM" === signature) { + return "BE"; + } +} +const signatures = [ + // '492049', // currently not supported + "49492a00", + // Little endian + "4d4d002a" + // Big Endian + // '4d4d002a', // BigTIFF > 4GB. currently not supported +]; +const TIFF = { + validate: (input) => signatures.includes(toHexString(input, 0, 4)), + calculate(input) { + const isBigEndian = determineEndianness(input) === "BE"; + const ifdBuffer = readIFD(input, isBigEndian); + const tags = extractTags(ifdBuffer, isBigEndian); + const width = tags[256]; + const height = tags[257]; + if (!width || !height) { + throw new TypeError("Invalid Tiff. Missing tags"); + } + return { height, width }; + } +}; + +function calculateExtended(input) { + return { + height: 1 + readUInt24LE(input, 7), + width: 1 + readUInt24LE(input, 4) + }; +} +function calculateLossless(input) { + return { + height: 1 + ((input[4] & 15) << 10 | input[3] << 2 | (input[2] & 192) >> 6), + width: 1 + ((input[2] & 63) << 8 | input[1]) + }; +} +function calculateLossy(input) { + return { + height: readInt16LE(input, 8) & 16383, + width: readInt16LE(input, 6) & 16383 + }; +} +const WEBP = { + validate(input) { + const riffHeader = "RIFF" === toUTF8String(input, 0, 4); + const webpHeader = "WEBP" === toUTF8String(input, 8, 12); + const vp8Header = "VP8" === toUTF8String(input, 12, 15); + return riffHeader && webpHeader && vp8Header; + }, + calculate(input) { + const chunkHeader = toUTF8String(input, 12, 16); + input = input.slice(20, 30); + if (chunkHeader === "VP8X") { + const extendedHeader = input[0]; + const validStart = (extendedHeader & 192) === 0; + const validEnd = (extendedHeader & 1) === 0; + if (validStart && validEnd) { + return calculateExtended(input); + } else { + throw new TypeError("Invalid WebP"); + } + } + if (chunkHeader === "VP8 " && input[0] !== 47) { + return calculateLossy(input); + } + const signature = toHexString(input, 3, 6); + if (chunkHeader === "VP8L" && signature !== "9d012a") { + return calculateLossless(input); + } + throw new TypeError("Invalid WebP"); + } +}; + +const typeHandlers = /* @__PURE__ */ new Map([ + ["bmp", BMP], + ["cur", CUR], + ["dds", DDS], + ["gif", GIF], + ["heif", HEIF], + ["icns", ICNS], + ["ico", ICO], + ["j2c", J2C], + ["jp2", JP2], + ["jpg", JPG], + ["ktx", KTX], + ["png", PNG], + ["pnm", PNM], + ["psd", PSD], + ["svg", SVG], + ["tga", TGA], + ["tiff", TIFF], + ["webp", WEBP] +]); +const types = Array.from(typeHandlers.keys()); + +const firstBytes = /* @__PURE__ */ new Map([ + [56, "psd"], + [66, "bmp"], + [68, "dds"], + [71, "gif"], + [73, "tiff"], + [77, "tiff"], + [82, "webp"], + [105, "icns"], + [137, "png"], + [255, "jpg"] +]); +function detector(input) { + const byte = input[0]; + const type = firstBytes.get(byte); + if (type && typeHandlers.get(type).validate(input)) { + return type; + } + return types.find((fileType) => typeHandlers.get(fileType).validate(input)); +} + +const globalOptions = { + disabledTypes: [] +}; +function lookup(input) { + const type = detector(input); + if (typeof type !== "undefined") { + if (globalOptions.disabledTypes.indexOf(type) > -1) { + throw new TypeError("disabled file type: " + type); + } + const size = typeHandlers.get(type).calculate(input); + if (size !== void 0) { + size.type = size.type ?? type; + return size; + } + } + throw new TypeError("unsupported file type: " + type); +} + +async function imageMetadata(data, src) { + try { + const result = lookup(data); + if (!result.height || !result.width || !result.type) { + throw new AstroError({ + ...NoImageMetadata, + message: NoImageMetadata.message(src) + }); + } + const { width, height, type, orientation } = result; + const isPortrait = (orientation || 0) >= 5; + return { + width: isPortrait ? height : width, + height: isPortrait ? width : height, + format: type, + orientation + }; + } catch (e) { + throw new AstroError({ + ...NoImageMetadata, + message: NoImageMetadata.message(src) + }); + } +} + +async function inferRemoteSize(url) { + const response = await fetch(url); + if (!response.body || !response.ok) { + throw new AstroError({ + ...FailedToFetchRemoteImageDimensions, + message: FailedToFetchRemoteImageDimensions.message(url) + }); + } + const reader = response.body.getReader(); + let done, value; + let accumulatedChunks = new Uint8Array(); + while (!done) { + const readResult = await reader.read(); + done = readResult.done; + if (done) break; + if (readResult.value) { + value = readResult.value; + let tmp = new Uint8Array(accumulatedChunks.length + value.length); + tmp.set(accumulatedChunks, 0); + tmp.set(value, accumulatedChunks.length); + accumulatedChunks = tmp; + try { + const dimensions = await imageMetadata(accumulatedChunks, url); + if (dimensions) { + await reader.cancel(); + return dimensions; + } + } catch (error) { + } + } + } + throw new AstroError({ + ...NoImageMetadata, + message: NoImageMetadata.message(url) + }); +} + +async function getConfiguredImageService() { + if (!globalThis?.astroAsset?.imageService) { + const { default: service } = await import( + // @ts-expect-error + './astro/assets-service_DK7A0Y1H.mjs' + ).then(n => n.Z).catch((e) => { + const error = new AstroError(InvalidImageService); + error.cause = e; + throw error; + }); + if (!globalThis.astroAsset) globalThis.astroAsset = {}; + globalThis.astroAsset.imageService = service; + return service; + } + return globalThis.astroAsset.imageService; +} +async function getImage$1(options, imageConfig) { + if (!options || typeof options !== "object") { + throw new AstroError({ + ...ExpectedImageOptions, + message: ExpectedImageOptions.message(JSON.stringify(options)) + }); + } + if (typeof options.src === "undefined") { + throw new AstroError({ + ...ExpectedImage, + message: ExpectedImage.message( + options.src, + "undefined", + JSON.stringify(options) + ) + }); + } + if (isImageMetadata(options)) { + throw new AstroError(ExpectedNotESMImage); + } + const service = await getConfiguredImageService(); + const resolvedOptions = { + ...options, + src: await resolveSrc(options.src) + }; + if (options.inferSize && isRemoteImage(resolvedOptions.src)) { + const result = await inferRemoteSize(resolvedOptions.src); + resolvedOptions.width ??= result.width; + resolvedOptions.height ??= result.height; + delete resolvedOptions.inferSize; + } + const originalFilePath = isESMImportedImage(resolvedOptions.src) ? resolvedOptions.src.fsPath : void 0; + const clonedSrc = isESMImportedImage(resolvedOptions.src) ? ( + // @ts-expect-error - clone is a private, hidden prop + resolvedOptions.src.clone ?? resolvedOptions.src + ) : resolvedOptions.src; + resolvedOptions.src = clonedSrc; + const validatedOptions = service.validateOptions ? await service.validateOptions(resolvedOptions, imageConfig) : resolvedOptions; + const srcSetTransforms = service.getSrcSet ? await service.getSrcSet(validatedOptions, imageConfig) : []; + let imageURL = await service.getURL(validatedOptions, imageConfig); + let srcSets = await Promise.all( + srcSetTransforms.map(async (srcSet) => ({ + transform: srcSet.transform, + url: await service.getURL(srcSet.transform, imageConfig), + descriptor: srcSet.descriptor, + attributes: srcSet.attributes + })) + ); + if (isLocalService(service) && globalThis.astroAsset.addStaticImage && !(isRemoteImage(validatedOptions.src) && imageURL === validatedOptions.src)) { + const propsToHash = service.propertiesToHash ?? DEFAULT_HASH_PROPS; + imageURL = globalThis.astroAsset.addStaticImage( + validatedOptions, + propsToHash, + originalFilePath + ); + srcSets = srcSetTransforms.map((srcSet) => ({ + transform: srcSet.transform, + url: globalThis.astroAsset.addStaticImage(srcSet.transform, propsToHash, originalFilePath), + descriptor: srcSet.descriptor, + attributes: srcSet.attributes + })); + } + return { + rawOptions: resolvedOptions, + options: validatedOptions, + src: imageURL, + srcSet: { + values: srcSets, + attribute: srcSets.map((srcSet) => `${srcSet.url} ${srcSet.descriptor}`).join(", ") + }, + attributes: service.getHTMLAttributes !== void 0 ? await service.getHTMLAttributes(validatedOptions, imageConfig) : {} + }; +} + +const $$Astro$1 = createAstro("https://wilyJ80.github.io/portfolio"); +const $$Image = createComponent(async ($$result, $$props, $$slots) => { + const Astro2 = $$result.createAstro($$Astro$1, $$props, $$slots); + Astro2.self = $$Image; + const props = Astro2.props; + if (props.alt === void 0 || props.alt === null) { + throw new AstroError(ImageMissingAlt); + } + if (typeof props.width === "string") { + props.width = parseInt(props.width); + } + if (typeof props.height === "string") { + props.height = parseInt(props.height); + } + const image = await getImage(props); + const additionalAttributes = {}; + if (image.srcSet.values.length > 0) { + additionalAttributes.srcset = image.srcSet.attribute; + } + return renderTemplate`${maybeRenderHead()}`; +}, "/home/vic/src/web/portfolio/node_modules/astro/components/Image.astro", void 0); + +const $$Astro = createAstro("https://wilyJ80.github.io/portfolio"); +const $$Picture = createComponent(async ($$result, $$props, $$slots) => { + const Astro2 = $$result.createAstro($$Astro, $$props, $$slots); + Astro2.self = $$Picture; + const defaultFormats = ["webp"]; + const defaultFallbackFormat = "png"; + const specialFormatsFallback = ["gif", "svg", "jpg", "jpeg"]; + const { formats = defaultFormats, pictureAttributes = {}, fallbackFormat, ...props } = Astro2.props; + if (props.alt === void 0 || props.alt === null) { + throw new AstroError(ImageMissingAlt); + } + const scopedStyleClass = props.class?.match(/\bastro-\w{8}\b/)?.[0]; + if (scopedStyleClass) { + if (pictureAttributes.class) { + pictureAttributes.class = `${pictureAttributes.class} ${scopedStyleClass}`; + } else { + pictureAttributes.class = scopedStyleClass; + } + } + for (const key in props) { + if (key.startsWith("data-astro-cid")) { + pictureAttributes[key] = props[key]; + } + } + const originalSrc = await resolveSrc(props.src); + const optimizedImages = await Promise.all( + formats.map( + async (format) => await getImage({ + ...props, + src: originalSrc, + format, + widths: props.widths, + densities: props.densities + }) + ) + ); + let resultFallbackFormat = fallbackFormat ?? defaultFallbackFormat; + if (!fallbackFormat && isESMImportedImage(originalSrc) && specialFormatsFallback.includes(originalSrc.format)) { + resultFallbackFormat = originalSrc.format; + } + const fallbackImage = await getImage({ + ...props, + format: resultFallbackFormat, + widths: props.widths, + densities: props.densities + }); + const imgAdditionalAttributes = {}; + const sourceAdditionalAttributes = {}; + if (props.sizes) { + sourceAdditionalAttributes.sizes = props.sizes; + } + if (fallbackImage.srcSet.values.length > 0) { + imgAdditionalAttributes.srcset = fallbackImage.srcSet.attribute; + } + return renderTemplate`${maybeRenderHead()} ${Object.entries(optimizedImages).map(([_, image]) => { + const srcsetAttribute = props.densities || !props.densities && !props.widths ? `${image.src}${image.srcSet.values.length > 0 ? ", " + image.srcSet.attribute : ""}` : image.srcSet.attribute; + return renderTemplate``; + })} `; +}, "/home/vic/src/web/portfolio/node_modules/astro/components/Picture.astro", void 0); + +const imageConfig = {"service":{"entrypoint":"astro/assets/services/sharp","config":{}},"domains":[],"remotePatterns":[]}; + const getImage = async (options) => await getImage$1(options, imageConfig); + +export { $$Image as $, getConfiguredImageService as g, imageConfig as i }; diff --git a/.vercel/output/functions/_render.func/home/vic/src/web/portfolio/.vercel/output/_functions/chunks/astro/assets-service_DK7A0Y1H.mjs b/.vercel/output/functions/_render.func/home/vic/src/web/portfolio/.vercel/output/_functions/chunks/astro/assets-service_DK7A0Y1H.mjs new file mode 100644 index 0000000..1719f44 --- /dev/null +++ b/.vercel/output/functions/_render.func/home/vic/src/web/portfolio/.vercel/output/_functions/chunks/astro/assets-service_DK7A0Y1H.mjs @@ -0,0 +1,700 @@ +function appendForwardSlash(path) { + return path.endsWith("/") ? path : path + "/"; +} +function prependForwardSlash(path) { + return path[0] === "/" ? path : "/" + path; +} +function removeTrailingForwardSlash(path) { + return path.endsWith("/") ? path.slice(0, path.length - 1) : path; +} +function removeLeadingForwardSlash(path) { + return path.startsWith("/") ? path.substring(1) : path; +} +function trimSlashes(path) { + return path.replace(/^\/|\/$/g, ""); +} +function isString(path) { + return typeof path === "string" || path instanceof String; +} +function joinPaths(...paths) { + return paths.filter(isString).map((path, i) => { + if (i === 0) { + return removeTrailingForwardSlash(path); + } else if (i === paths.length - 1) { + return removeLeadingForwardSlash(path); + } else { + return trimSlashes(path); + } + }).join("/"); +} +function isRemotePath(src) { + return /^(?:http|ftp|https|ws):?\/\//.test(src) || src.startsWith("data:"); +} +function slash(path) { + return path.replace(/\\/g, "/"); +} +function fileExtension(path) { + const ext = path.split(".").pop(); + return ext !== path ? `.${ext}` : ""; +} + +const ClientAddressNotAvailable = { + name: "ClientAddressNotAvailable", + title: "`Astro.clientAddress` is not available in current adapter.", + message: (adapterName) => `\`Astro.clientAddress\` is not available in the \`${adapterName}\` adapter. File an issue with the adapter to add support.` +}; +const PrerenderClientAddressNotAvailable = { + name: "PrerenderClientAddressNotAvailable", + title: "`Astro.clientAddress` cannot be used inside prerendered routes.", + message: `\`Astro.clientAddress\` cannot be used inside prerendered routes` +}; +const StaticClientAddressNotAvailable = { + name: "StaticClientAddressNotAvailable", + title: "`Astro.clientAddress` is not available in static mode.", + message: "`Astro.clientAddress` is only available when using `output: 'server'` or `output: 'hybrid'`. Update your Astro config if you need SSR features.", + hint: "See https://docs.astro.build/en/guides/server-side-rendering/ for more information on how to enable SSR." +}; +const NoMatchingStaticPathFound = { + name: "NoMatchingStaticPathFound", + title: "No static path found for requested path.", + message: (pathName) => `A \`getStaticPaths()\` route pattern was matched, but no matching static path was found for requested path \`${pathName}\`.`, + hint: (possibleRoutes) => `Possible dynamic routes being matched: ${possibleRoutes.join(", ")}.` +}; +const OnlyResponseCanBeReturned = { + name: "OnlyResponseCanBeReturned", + title: "Invalid type returned by Astro page.", + message: (route, returnedValue) => `Route \`${route ? route : ""}\` returned a \`${returnedValue}\`. Only a [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) can be returned from Astro files.`, + hint: "See https://docs.astro.build/en/guides/server-side-rendering/#response for more information." +}; +const MissingMediaQueryDirective = { + name: "MissingMediaQueryDirective", + title: "Missing value for `client:media` directive.", + message: 'Media query not provided for `client:media` directive. A media query similar to `client:media="(max-width: 600px)"` must be provided' +}; +const NoMatchingRenderer = { + name: "NoMatchingRenderer", + title: "No matching renderer found.", + message: (componentName, componentExtension, plural, validRenderersCount) => `Unable to render \`${componentName}\`. + +${validRenderersCount > 0 ? `There ${plural ? "are" : "is"} ${validRenderersCount} renderer${plural ? "s" : ""} configured in your \`astro.config.mjs\` file, +but ${plural ? "none were" : "it was not"} able to server-side render \`${componentName}\`.` : `No valid renderer was found ${componentExtension ? `for the \`.${componentExtension}\` file extension.` : `for this file extension.`}`}`, + hint: (probableRenderers) => `Did you mean to enable the ${probableRenderers} integration? + +See https://docs.astro.build/en/guides/framework-components/ for more information on how to install and configure integrations.` +}; +const NoClientEntrypoint = { + name: "NoClientEntrypoint", + title: "No client entrypoint specified in renderer.", + message: (componentName, clientDirective, rendererName) => `\`${componentName}\` component has a \`client:${clientDirective}\` directive, but no client entrypoint was provided by \`${rendererName}\`.`, + hint: "See https://docs.astro.build/en/reference/integrations-reference/#addrenderer-option for more information on how to configure your renderer." +}; +const NoClientOnlyHint = { + name: "NoClientOnlyHint", + title: "Missing hint on client:only directive.", + message: (componentName) => `Unable to render \`${componentName}\`. When using the \`client:only\` hydration strategy, Astro needs a hint to use the correct renderer.`, + hint: (probableRenderers) => `Did you mean to pass \`client:only="${probableRenderers}"\`? See https://docs.astro.build/en/reference/directives-reference/#clientonly for more information on client:only` +}; +const InvalidGetStaticPathsEntry = { + name: "InvalidGetStaticPathsEntry", + title: "Invalid entry inside getStaticPath's return value", + message: (entryType) => `Invalid entry returned by getStaticPaths. Expected an object, got \`${entryType}\``, + hint: "If you're using a `.map` call, you might be looking for `.flatMap()` instead. See https://docs.astro.build/en/reference/api-reference/#getstaticpaths for more information on getStaticPaths." +}; +const InvalidGetStaticPathsReturn = { + name: "InvalidGetStaticPathsReturn", + title: "Invalid value returned by getStaticPaths.", + message: (returnType) => `Invalid type returned by \`getStaticPaths\`. Expected an \`array\`, got \`${returnType}\``, + hint: "See https://docs.astro.build/en/reference/api-reference/#getstaticpaths for more information on getStaticPaths." +}; +const GetStaticPathsExpectedParams = { + name: "GetStaticPathsExpectedParams", + title: "Missing params property on `getStaticPaths` route.", + message: "Missing or empty required `params` property on `getStaticPaths` route.", + hint: "See https://docs.astro.build/en/reference/api-reference/#getstaticpaths for more information on getStaticPaths." +}; +const GetStaticPathsInvalidRouteParam = { + name: "GetStaticPathsInvalidRouteParam", + title: "Invalid value for `getStaticPaths` route parameter.", + message: (key, value, valueType) => `Invalid getStaticPaths route parameter for \`${key}\`. Expected undefined, a string or a number, received \`${valueType}\` (\`${value}\`)`, + hint: "See https://docs.astro.build/en/reference/api-reference/#getstaticpaths for more information on getStaticPaths." +}; +const GetStaticPathsRequired = { + name: "GetStaticPathsRequired", + title: "`getStaticPaths()` function required for dynamic routes.", + message: "`getStaticPaths()` function is required for dynamic routes. Make sure that you `export` a `getStaticPaths` function from your dynamic route.", + hint: `See https://docs.astro.build/en/guides/routing/#dynamic-routes for more information on dynamic routes. + +Alternatively, set \`output: "server"\` or \`output: "hybrid"\` in your Astro config file to switch to a non-static server build. This error can also occur if using \`export const prerender = true;\`. +See https://docs.astro.build/en/guides/server-side-rendering/ for more information on non-static rendering.` +}; +const ReservedSlotName = { + name: "ReservedSlotName", + title: "Invalid slot name.", + message: (slotName) => `Unable to create a slot named \`${slotName}\`. \`${slotName}\` is a reserved slot name. Please update the name of this slot.` +}; +const NoMatchingImport = { + name: "NoMatchingImport", + title: "No import found for component.", + message: (componentName) => `Could not render \`${componentName}\`. No matching import has been found for \`${componentName}\`.`, + hint: "Please make sure the component is properly imported." +}; +const InvalidComponentArgs = { + name: "InvalidComponentArgs", + title: "Invalid component arguments.", + message: (name) => `Invalid arguments passed to${name ? ` <${name}>` : ""} component.`, + hint: "Astro components cannot be rendered directly via function call, such as `Component()` or `{items.map(Component)}`." +}; +const PageNumberParamNotFound = { + name: "PageNumberParamNotFound", + title: "Page number param not found.", + message: (paramName) => `[paginate()] page number param \`${paramName}\` not found in your filepath.`, + hint: "Rename your file to `[page].astro` or `[...page].astro`." +}; +const ImageMissingAlt = { + name: "ImageMissingAlt", + title: 'Image missing required "alt" property.', + message: 'Image missing "alt" property. "alt" text is required to describe important images on the page.', + hint: 'Use an empty string ("") for decorative images.' +}; +const InvalidImageService = { + name: "InvalidImageService", + title: "Error while loading image service.", + message: "There was an error loading the configured image service. Please see the stack trace for more information." +}; +const MissingImageDimension = { + name: "MissingImageDimension", + title: "Missing image dimensions", + message: (missingDimension, imageURL) => `Missing ${missingDimension === "both" ? "width and height attributes" : `${missingDimension} attribute`} for ${imageURL}. When using remote images, both dimensions are required unless in order to avoid CLS.`, + hint: "If your image is inside your `src` folder, you probably meant to import it instead. See [the Imports guide for more information](https://docs.astro.build/en/guides/imports/#other-assets). You can also use `inferSize={true}` for remote images to get the original dimensions." +}; +const FailedToFetchRemoteImageDimensions = { + name: "FailedToFetchRemoteImageDimensions", + title: "Failed to retrieve remote image dimensions", + message: (imageURL) => `Failed to get the dimensions for ${imageURL}.`, + hint: "Verify your remote image URL is accurate, and that you are not using `inferSize` with a file located in your `public/` folder." +}; +const UnsupportedImageFormat = { + name: "UnsupportedImageFormat", + title: "Unsupported image format", + message: (format, imagePath, supportedFormats) => `Received unsupported format \`${format}\` from \`${imagePath}\`. Currently only ${supportedFormats.join( + ", " + )} are supported by our image services.`, + hint: "Using an `img` tag directly instead of the `Image` component might be what you're looking for." +}; +const UnsupportedImageConversion = { + name: "UnsupportedImageConversion", + title: "Unsupported image conversion", + message: "Converting between vector (such as SVGs) and raster (such as PNGs and JPEGs) images is not currently supported." +}; +const PrerenderDynamicEndpointPathCollide = { + name: "PrerenderDynamicEndpointPathCollide", + title: "Prerendered dynamic endpoint has path collision.", + message: (pathname) => `Could not render \`${pathname}\` with an \`undefined\` param as the generated path will collide during prerendering. Prevent passing \`undefined\` as \`params\` for the endpoint's \`getStaticPaths()\` function, or add an additional extension to the endpoint's filename.`, + hint: (filename) => `Rename \`${filename}\` to \`${filename.replace(/\.(?:js|ts)/, (m) => `.json` + m)}\`` +}; +const ExpectedImage = { + name: "ExpectedImage", + title: "Expected src to be an image.", + message: (src, typeofOptions, fullOptions) => `Expected \`src\` property for \`getImage\` or \`\` to be either an ESM imported image or a string with the path of a remote image. Received \`${src}\` (type: \`${typeofOptions}\`). + +Full serialized options received: \`${fullOptions}\`.`, + hint: "This error can often happen because of a wrong path. Make sure the path to your image is correct. If you're passing an async function, make sure to call and await it." +}; +const ExpectedImageOptions = { + name: "ExpectedImageOptions", + title: "Expected image options.", + message: (options) => `Expected getImage() parameter to be an object. Received \`${options}\`.` +}; +const ExpectedNotESMImage = { + name: "ExpectedNotESMImage", + title: "Expected image options, not an ESM-imported image.", + message: "An ESM-imported image cannot be passed directly to `getImage()`. Instead, pass an object with the image in the `src` property.", + hint: "Try changing `getImage(myImage)` to `getImage({ src: myImage })`" +}; +const IncompatibleDescriptorOptions = { + name: "IncompatibleDescriptorOptions", + title: "Cannot set both `densities` and `widths`", + message: "Only one of `densities` or `widths` can be specified. In most cases, you'll probably want to use only `widths` if you require specific widths.", + hint: "Those attributes are used to construct a `srcset` attribute, which cannot have both `x` and `w` descriptors." +}; +const NoImageMetadata = { + name: "NoImageMetadata", + title: "Could not process image metadata.", + message: (imagePath) => `Could not process image metadata${imagePath ? ` for \`${imagePath}\`` : ""}.`, + hint: "This is often caused by a corrupted or malformed image. Re-exporting the image from your image editor may fix this issue." +}; +const ResponseSentError = { + name: "ResponseSentError", + title: "Unable to set response.", + message: "The response has already been sent to the browser and cannot be altered." +}; +const MiddlewareNoDataOrNextCalled = { + name: "MiddlewareNoDataOrNextCalled", + title: "The middleware didn't return a `Response`.", + message: "Make sure your middleware returns a `Response` object, either directly or by returning the `Response` from calling the `next` function." +}; +const MiddlewareNotAResponse = { + name: "MiddlewareNotAResponse", + title: "The middleware returned something that is not a `Response` object.", + message: "Any data returned from middleware must be a valid `Response` object." +}; +const EndpointDidNotReturnAResponse = { + name: "EndpointDidNotReturnAResponse", + title: "The endpoint did not return a `Response`.", + message: "An endpoint must return either a `Response`, or a `Promise` that resolves with a `Response`." +}; +const LocalsNotAnObject = { + name: "LocalsNotAnObject", + title: "Value assigned to `locals` is not accepted.", + message: "`locals` can only be assigned to an object. Other values like numbers, strings, etc. are not accepted.", + hint: "If you tried to remove some information from the `locals` object, try to use `delete` or set the property to `undefined`." +}; +const AstroResponseHeadersReassigned = { + name: "AstroResponseHeadersReassigned", + title: "`Astro.response.headers` must not be reassigned.", + message: "Individual headers can be added to and removed from `Astro.response.headers`, but it must not be replaced with another instance of `Headers` altogether.", + hint: "Consider using `Astro.response.headers.add()`, and `Astro.response.headers.delete()`." +}; +const LocalImageUsedWrongly = { + name: "LocalImageUsedWrongly", + title: "Local images must be imported.", + message: (imageFilePath) => `\`Image\`'s and \`getImage\`'s \`src\` parameter must be an imported image or an URL, it cannot be a string filepath. Received \`${imageFilePath}\`.`, + hint: "If you want to use an image from your `src` folder, you need to either import it or if the image is coming from a content collection, use the [image() schema helper](https://docs.astro.build/en/guides/images/#images-in-content-collections). See https://docs.astro.build/en/guides/images/#src-required for more information on the `src` property." +}; +const AstroGlobUsedOutside = { + name: "AstroGlobUsedOutside", + title: "Astro.glob() used outside of an Astro file.", + message: (globStr) => `\`Astro.glob(${globStr})\` can only be used in \`.astro\` files. \`import.meta.glob(${globStr})\` can be used instead to achieve a similar result.`, + hint: "See Vite's documentation on `import.meta.glob` for more information: https://vitejs.dev/guide/features.html#glob-import" +}; +const AstroGlobNoMatch = { + name: "AstroGlobNoMatch", + title: "Astro.glob() did not match any files.", + message: (globStr) => `\`Astro.glob(${globStr})\` did not return any matching files.`, + hint: "Check the pattern for typos." +}; +const MissingSharp = { + name: "MissingSharp", + title: "Could not find Sharp.", + message: "Could not find Sharp. Please install Sharp (`sharp`) manually into your project or migrate to another image service.", + hint: "See Sharp's installation instructions for more information: https://sharp.pixelplumbing.com/install. If you are not relying on `astro:assets` to optimize, transform, or process any images, you can configure a passthrough image service instead of installing Sharp. See https://docs.astro.build/en/reference/errors/missing-sharp for more information.\n\nSee https://docs.astro.build/en/guides/images/#default-image-service for more information on how to migrate to another image service." +}; +const i18nNoLocaleFoundInPath = { + name: "i18nNoLocaleFoundInPath", + title: "The path doesn't contain any locale", + message: "You tried to use an i18n utility on a path that doesn't contain any locale. You can use `pathHasLocale` first to determine if the path has a locale." +}; +const RewriteWithBodyUsed = { + name: "RewriteWithBodyUsed", + title: "Cannot use Astro.rewrite after the request body has been read", + message: "Astro.rewrite() cannot be used if the request body has already been read. If you need to read the body, first clone the request." +}; + +function normalizeLF(code) { + return code.replace(/\r\n|\r(?!\n)|\n/g, "\n"); +} + +function codeFrame(src, loc) { + if (!loc || loc.line === void 0 || loc.column === void 0) { + return ""; + } + const lines = normalizeLF(src).split("\n").map((ln) => ln.replace(/\t/g, " ")); + const visibleLines = []; + for (let n = -2; n <= 2; n++) { + if (lines[loc.line + n]) visibleLines.push(loc.line + n); + } + let gutterWidth = 0; + for (const lineNo of visibleLines) { + let w = `> ${lineNo}`; + if (w.length > gutterWidth) gutterWidth = w.length; + } + let output = ""; + for (const lineNo of visibleLines) { + const isFocusedLine = lineNo === loc.line - 1; + output += isFocusedLine ? "> " : " "; + output += `${lineNo + 1} | ${lines[lineNo]} +`; + if (isFocusedLine) + output += `${Array.from({ length: gutterWidth }).join(" ")} | ${Array.from({ + length: loc.column + }).join(" ")}^ +`; + } + return output; +} + +class AstroError extends Error { + loc; + title; + hint; + frame; + type = "AstroError"; + constructor(props, options) { + const { name, title, message, stack, location, hint, frame } = props; + super(message, options); + this.title = title; + this.name = name; + if (message) this.message = message; + this.stack = stack ? stack : this.stack; + this.loc = location; + this.hint = hint; + this.frame = frame; + } + setLocation(location) { + this.loc = location; + } + setName(name) { + this.name = name; + } + setMessage(message) { + this.message = message; + } + setHint(hint) { + this.hint = hint; + } + setFrame(source, location) { + this.frame = codeFrame(source, location); + } + static is(err) { + return err.type === "AstroError"; + } +} + +const VALID_SUPPORTED_FORMATS = [ + "jpeg", + "jpg", + "png", + "tiff", + "webp", + "gif", + "svg", + "avif" +]; +const DEFAULT_OUTPUT_FORMAT = "webp"; +const DEFAULT_HASH_PROPS = ["src", "width", "height", "format", "quality"]; + +function isESMImportedImage(src) { + return typeof src === "object"; +} +function isRemoteImage(src) { + return typeof src === "string"; +} +async function resolveSrc(src) { + return typeof src === "object" && "then" in src ? (await src).default ?? await src : src; +} + +function matchPattern(url, remotePattern) { + return matchProtocol(url, remotePattern.protocol) && matchHostname(url, remotePattern.hostname, true) && matchPort(url, remotePattern.port) && matchPathname(url, remotePattern.pathname); +} +function matchPort(url, port) { + return !port || port === url.port; +} +function matchProtocol(url, protocol) { + return !protocol || protocol === url.protocol.slice(0, -1); +} +function matchHostname(url, hostname, allowWildcard) { + if (!hostname) { + return true; + } else if (!allowWildcard || !hostname.startsWith("*")) { + return hostname === url.hostname; + } else if (hostname.startsWith("**.")) { + const slicedHostname = hostname.slice(2); + return slicedHostname !== url.hostname && url.hostname.endsWith(slicedHostname); + } else if (hostname.startsWith("*.")) { + const slicedHostname = hostname.slice(1); + const additionalSubdomains = url.hostname.replace(slicedHostname, "").split(".").filter(Boolean); + return additionalSubdomains.length === 1; + } + return false; +} +function matchPathname(url, pathname, allowWildcard) { + if (!pathname) { + return true; + } else if (!pathname.endsWith("*")) { + return pathname === url.pathname; + } else if (pathname.endsWith("/**")) { + const slicedPathname = pathname.slice(0, -2); + return slicedPathname !== url.pathname && url.pathname.startsWith(slicedPathname); + } else if (pathname.endsWith("/*")) { + const slicedPathname = pathname.slice(0, -1); + const additionalPathChunks = url.pathname.replace(slicedPathname, "").split("/").filter(Boolean); + return additionalPathChunks.length === 1; + } + return false; +} +function isRemoteAllowed(src, { + domains = [], + remotePatterns = [] +}) { + if (!isRemotePath(src)) return false; + const url = new URL(src); + return domains.some((domain) => matchHostname(url, domain)) || remotePatterns.some((remotePattern) => matchPattern(url, remotePattern)); +} + +function isLocalService(service) { + if (!service) { + return false; + } + return "transform" in service; +} +function parseQuality(quality) { + let result = parseInt(quality); + if (Number.isNaN(result)) { + return quality; + } + return result; +} +const baseService = { + propertiesToHash: DEFAULT_HASH_PROPS, + validateOptions(options) { + if (!options.src || typeof options.src !== "string" && typeof options.src !== "object") { + throw new AstroError({ + ...ExpectedImage, + message: ExpectedImage.message( + JSON.stringify(options.src), + typeof options.src, + JSON.stringify(options, (_, v) => v === void 0 ? null : v) + ) + }); + } + if (!isESMImportedImage(options.src)) { + if (options.src.startsWith("/@fs/") || !isRemotePath(options.src) && !options.src.startsWith("/")) { + throw new AstroError({ + ...LocalImageUsedWrongly, + message: LocalImageUsedWrongly.message(options.src) + }); + } + let missingDimension; + if (!options.width && !options.height) { + missingDimension = "both"; + } else if (!options.width && options.height) { + missingDimension = "width"; + } else if (options.width && !options.height) { + missingDimension = "height"; + } + if (missingDimension) { + throw new AstroError({ + ...MissingImageDimension, + message: MissingImageDimension.message(missingDimension, options.src) + }); + } + } else { + if (!VALID_SUPPORTED_FORMATS.includes(options.src.format)) { + throw new AstroError({ + ...UnsupportedImageFormat, + message: UnsupportedImageFormat.message( + options.src.format, + options.src.src, + VALID_SUPPORTED_FORMATS + ) + }); + } + if (options.widths && options.densities) { + throw new AstroError(IncompatibleDescriptorOptions); + } + if (options.src.format === "svg") { + options.format = "svg"; + } + if (options.src.format === "svg" && options.format !== "svg" || options.src.format !== "svg" && options.format === "svg") { + throw new AstroError(UnsupportedImageConversion); + } + } + if (!options.format) { + options.format = DEFAULT_OUTPUT_FORMAT; + } + if (options.width) options.width = Math.round(options.width); + if (options.height) options.height = Math.round(options.height); + return options; + }, + getHTMLAttributes(options) { + const { targetWidth, targetHeight } = getTargetDimensions(options); + const { src, width, height, format, quality, densities, widths, formats, ...attributes } = options; + return { + ...attributes, + width: targetWidth, + height: targetHeight, + loading: attributes.loading ?? "lazy", + decoding: attributes.decoding ?? "async" + }; + }, + getSrcSet(options) { + const srcSet = []; + const { targetWidth } = getTargetDimensions(options); + const { widths, densities } = options; + const targetFormat = options.format ?? DEFAULT_OUTPUT_FORMAT; + let imageWidth = options.width; + let maxWidth = Infinity; + if (isESMImportedImage(options.src)) { + imageWidth = options.src.width; + maxWidth = imageWidth; + } + const { + width: transformWidth, + height: transformHeight, + ...transformWithoutDimensions + } = options; + const allWidths = []; + if (densities) { + const densityValues = densities.map((density) => { + if (typeof density === "number") { + return density; + } else { + return parseFloat(density); + } + }); + const densityWidths = densityValues.sort().map((density) => Math.round(targetWidth * density)); + allWidths.push( + ...densityWidths.map((width, index) => ({ + maxTargetWidth: Math.min(width, maxWidth), + descriptor: `${densityValues[index]}x` + })) + ); + } else if (widths) { + allWidths.push( + ...widths.map((width) => ({ + maxTargetWidth: Math.min(width, maxWidth), + descriptor: `${width}w` + })) + ); + } + for (const { maxTargetWidth, descriptor } of allWidths) { + const srcSetTransform = { ...transformWithoutDimensions }; + if (maxTargetWidth !== imageWidth) { + srcSetTransform.width = maxTargetWidth; + } else { + if (options.width && options.height) { + srcSetTransform.width = options.width; + srcSetTransform.height = options.height; + } + } + srcSet.push({ + transform: srcSetTransform, + descriptor, + attributes: { + type: `image/${targetFormat}` + } + }); + } + return srcSet; + }, + getURL(options, imageConfig) { + const searchParams = new URLSearchParams(); + if (isESMImportedImage(options.src)) { + searchParams.append("href", options.src.src); + } else if (isRemoteAllowed(options.src, imageConfig)) { + searchParams.append("href", options.src); + } else { + return options.src; + } + const params = { + w: "width", + h: "height", + q: "quality", + f: "format" + }; + Object.entries(params).forEach(([param, key]) => { + options[key] && searchParams.append(param, options[key].toString()); + }); + const imageEndpoint = joinPaths("/", "/_image"); + return `${imageEndpoint}?${searchParams}`; + }, + parseURL(url) { + const params = url.searchParams; + if (!params.has("href")) { + return void 0; + } + const transform = { + src: params.get("href"), + width: params.has("w") ? parseInt(params.get("w")) : void 0, + height: params.has("h") ? parseInt(params.get("h")) : void 0, + format: params.get("f"), + quality: params.get("q") + }; + return transform; + } +}; +function getTargetDimensions(options) { + let targetWidth = options.width; + let targetHeight = options.height; + if (isESMImportedImage(options.src)) { + const aspectRatio = options.src.width / options.src.height; + if (targetHeight && !targetWidth) { + targetWidth = Math.round(targetHeight * aspectRatio); + } else if (targetWidth && !targetHeight) { + targetHeight = Math.round(targetWidth / aspectRatio); + } else if (!targetWidth && !targetHeight) { + targetWidth = options.src.width; + targetHeight = options.src.height; + } + } + return { + targetWidth, + targetHeight + }; +} + +let sharp; +const qualityTable = { + low: 25, + mid: 50, + high: 80, + max: 100 +}; +async function loadSharp() { + let sharpImport; + try { + sharpImport = (await import('sharp')).default; + } catch (e) { + throw new AstroError(MissingSharp); + } + sharpImport.cache(false); + return sharpImport; +} +const sharpService = { + validateOptions: baseService.validateOptions, + getURL: baseService.getURL, + parseURL: baseService.parseURL, + getHTMLAttributes: baseService.getHTMLAttributes, + getSrcSet: baseService.getSrcSet, + async transform(inputBuffer, transformOptions, config) { + if (!sharp) sharp = await loadSharp(); + const transform = transformOptions; + if (transform.format === "svg") return { data: inputBuffer, format: "svg" }; + const result = sharp(inputBuffer, { + failOnError: false, + pages: -1, + limitInputPixels: config.service.config.limitInputPixels + }); + result.rotate(); + if (transform.height && !transform.width) { + result.resize({ height: Math.round(transform.height) }); + } else if (transform.width) { + result.resize({ width: Math.round(transform.width) }); + } + if (transform.format) { + let quality = void 0; + if (transform.quality) { + const parsedQuality = parseQuality(transform.quality); + if (typeof parsedQuality === "number") { + quality = parsedQuality; + } else { + quality = transform.quality in qualityTable ? qualityTable[transform.quality] : void 0; + } + } + result.toFormat(transform.format, { quality }); + } + const { data, info } = await result.toBuffer({ resolveWithObject: true }); + return { + data, + format: info.format + }; + } +}; +var sharp_default = sharpService; + +const sharp$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ + __proto__: null, + default: sharp_default +}, Symbol.toStringTag, { value: 'Module' })); + +export { AstroError as A, trimSlashes as B, NoMatchingStaticPathFound as C, DEFAULT_HASH_PROPS as D, EndpointDidNotReturnAResponse as E, FailedToFetchRemoteImageDimensions as F, GetStaticPathsRequired as G, PrerenderDynamicEndpointPathCollide as H, InvalidComponentArgs as I, ReservedSlotName as J, PrerenderClientAddressNotAvailable as K, LocalsNotAnObject as L, MissingMediaQueryDirective as M, NoMatchingImport as N, OnlyResponseCanBeReturned as O, PageNumberParamNotFound as P, ClientAddressNotAvailable as Q, ResponseSentError as R, StaticClientAddressNotAvailable as S, RewriteWithBodyUsed as T, AstroResponseHeadersReassigned as U, fileExtension as V, slash as W, prependForwardSlash as X, removeTrailingForwardSlash as Y, sharp$1 as Z, AstroGlobUsedOutside as a, AstroGlobNoMatch as b, NoMatchingRenderer as c, NoClientOnlyHint as d, NoClientEntrypoint as e, isRemoteAllowed as f, NoImageMetadata as g, ExpectedImageOptions as h, isRemotePath as i, ExpectedImage as j, ExpectedNotESMImage as k, isRemoteImage as l, isESMImportedImage as m, isLocalService as n, InvalidImageService as o, ImageMissingAlt as p, i18nNoLocaleFoundInPath as q, resolveSrc as r, appendForwardSlash as s, joinPaths as t, MiddlewareNoDataOrNextCalled as u, MiddlewareNotAResponse as v, InvalidGetStaticPathsReturn as w, InvalidGetStaticPathsEntry as x, GetStaticPathsExpectedParams as y, GetStaticPathsInvalidRouteParam as z }; diff --git a/.vercel/output/functions/_render.func/home/vic/src/web/portfolio/.vercel/output/_functions/chunks/astro/env-setup_Cr6XTFvb.mjs b/.vercel/output/functions/_render.func/home/vic/src/web/portfolio/.vercel/output/_functions/chunks/astro/env-setup_Cr6XTFvb.mjs new file mode 100644 index 0000000..a7a04d0 --- /dev/null +++ b/.vercel/output/functions/_render.func/home/vic/src/web/portfolio/.vercel/output/_functions/chunks/astro/env-setup_Cr6XTFvb.mjs @@ -0,0 +1,4 @@ +function setGetEnv(fn, reset = false) { +} + +export { setGetEnv }; diff --git a/.vercel/output/functions/_render.func/home/vic/src/web/portfolio/.vercel/output/_functions/chunks/astro/server_mfaSpNA7.mjs b/.vercel/output/functions/_render.func/home/vic/src/web/portfolio/.vercel/output/_functions/chunks/astro/server_mfaSpNA7.mjs new file mode 100644 index 0000000..b4eead4 --- /dev/null +++ b/.vercel/output/functions/_render.func/home/vic/src/web/portfolio/.vercel/output/_functions/chunks/astro/server_mfaSpNA7.mjs @@ -0,0 +1,1995 @@ +import { bold } from 'kleur/colors'; +import { A as AstroError, E as EndpointDidNotReturnAResponse, I as InvalidComponentArgs, a as AstroGlobUsedOutside, b as AstroGlobNoMatch, M as MissingMediaQueryDirective, N as NoMatchingImport, O as OnlyResponseCanBeReturned, R as ResponseSentError, c as NoMatchingRenderer, d as NoClientOnlyHint, e as NoClientEntrypoint } from './assets-service_DK7A0Y1H.mjs'; +import { clsx } from 'clsx'; +import { escape } from 'html-escaper'; +import 'cssesc'; + +const ASTRO_VERSION = "4.12.2"; +const REROUTE_DIRECTIVE_HEADER = "X-Astro-Reroute"; +const REWRITE_DIRECTIVE_HEADER_KEY = "X-Astro-Rewrite"; +const REWRITE_DIRECTIVE_HEADER_VALUE = "yes"; +const ROUTE_TYPE_HEADER = "X-Astro-Route-Type"; +const DEFAULT_404_COMPONENT = "astro-default-404.astro"; +const REROUTABLE_STATUS_CODES = [404, 500]; +const clientAddressSymbol = Symbol.for("astro.clientAddress"); +const clientLocalsSymbol = Symbol.for("astro.locals"); +const responseSentSymbol = Symbol.for("astro.responseSent"); + +async function renderEndpoint(mod, context, ssr, logger) { + const { request, url } = context; + const method = request.method.toUpperCase(); + const handler = mod[method] ?? mod["ALL"]; + if (!ssr && ssr === false && method !== "GET") { + logger.warn( + "router", + `${url.pathname} ${bold( + method + )} requests are not available for a static site. Update your config to \`output: 'server'\` or \`output: 'hybrid'\` to enable.` + ); + } + if (handler === void 0) { + logger.warn( + "router", + `No API Route handler exists for the method "${method}" for the route "${url.pathname}". +Found handlers: ${Object.keys(mod).map((exp) => JSON.stringify(exp)).join(", ")} +` + ("all" in mod ? `One of the exported handlers is "all" (lowercase), did you mean to export 'ALL'? +` : "") + ); + return new Response(null, { status: 404 }); + } + if (typeof handler !== "function") { + logger.error( + "router", + `The route "${url.pathname}" exports a value for the method "${method}", but it is of the type ${typeof handler} instead of a function.` + ); + return new Response(null, { status: 500 }); + } + const response = await handler.call(mod, context); + if (!response || response instanceof Response === false) { + throw new AstroError(EndpointDidNotReturnAResponse); + } + if (REROUTABLE_STATUS_CODES.includes(response.status)) { + response.headers.set(REROUTE_DIRECTIVE_HEADER, "no"); + } + return response; +} + +function validateArgs(args) { + if (args.length !== 3) return false; + if (!args[0] || typeof args[0] !== "object") return false; + return true; +} +function baseCreateComponent(cb, moduleId, propagation) { + const name = moduleId?.split("/").pop()?.replace(".astro", "") ?? ""; + const fn = (...args) => { + if (!validateArgs(args)) { + throw new AstroError({ + ...InvalidComponentArgs, + message: InvalidComponentArgs.message(name) + }); + } + return cb(...args); + }; + Object.defineProperty(fn, "name", { value: name, writable: false }); + fn.isAstroComponentFactory = true; + fn.moduleId = moduleId; + fn.propagation = propagation; + return fn; +} +function createComponentWithOptions(opts) { + const cb = baseCreateComponent(opts.factory, opts.moduleId, opts.propagation); + return cb; +} +function createComponent(arg1, moduleId, propagation) { + if (typeof arg1 === "function") { + return baseCreateComponent(arg1, moduleId, propagation); + } else { + return createComponentWithOptions(arg1); + } +} + +function createAstroGlobFn() { + const globHandler = (importMetaGlobResult) => { + if (typeof importMetaGlobResult === "string") { + throw new AstroError({ + ...AstroGlobUsedOutside, + message: AstroGlobUsedOutside.message(JSON.stringify(importMetaGlobResult)) + }); + } + let allEntries = [...Object.values(importMetaGlobResult)]; + if (allEntries.length === 0) { + throw new AstroError({ + ...AstroGlobNoMatch, + message: AstroGlobNoMatch.message(JSON.stringify(importMetaGlobResult)) + }); + } + return Promise.all(allEntries.map((fn) => fn())); + }; + return globHandler; +} +function createAstro(site) { + return { + // TODO: this is no longer necessary for `Astro.site` + // but it somehow allows working around caching issues in content collections for some tests + site: new URL(site) , + generator: `Astro v${ASTRO_VERSION}`, + glob: createAstroGlobFn() + }; +} + +function isPromise(value) { + return !!value && typeof value === "object" && "then" in value && typeof value.then === "function"; +} +async function* streamAsyncIterator(stream) { + const reader = stream.getReader(); + try { + while (true) { + const { done, value } = await reader.read(); + if (done) return; + yield value; + } + } finally { + reader.releaseLock(); + } +} + +const escapeHTML = escape; +class HTMLBytes extends Uint8Array { +} +Object.defineProperty(HTMLBytes.prototype, Symbol.toStringTag, { + get() { + return "HTMLBytes"; + } +}); +class HTMLString extends String { + get [Symbol.toStringTag]() { + return "HTMLString"; + } +} +const markHTMLString = (value) => { + if (value instanceof HTMLString) { + return value; + } + if (typeof value === "string") { + return new HTMLString(value); + } + return value; +}; +function isHTMLString(value) { + return Object.prototype.toString.call(value) === "[object HTMLString]"; +} +function markHTMLBytes(bytes) { + return new HTMLBytes(bytes); +} +function hasGetReader(obj) { + return typeof obj.getReader === "function"; +} +async function* unescapeChunksAsync(iterable) { + if (hasGetReader(iterable)) { + for await (const chunk of streamAsyncIterator(iterable)) { + yield unescapeHTML(chunk); + } + } else { + for await (const chunk of iterable) { + yield unescapeHTML(chunk); + } + } +} +function* unescapeChunks(iterable) { + for (const chunk of iterable) { + yield unescapeHTML(chunk); + } +} +function unescapeHTML(str) { + if (!!str && typeof str === "object") { + if (str instanceof Uint8Array) { + return markHTMLBytes(str); + } else if (str instanceof Response && str.body) { + const body = str.body; + return unescapeChunksAsync(body); + } else if (typeof str.then === "function") { + return Promise.resolve(str).then((value) => { + return unescapeHTML(value); + }); + } else if (str[Symbol.for("astro:slot-string")]) { + return str; + } else if (Symbol.iterator in str) { + return unescapeChunks(str); + } else if (Symbol.asyncIterator in str || hasGetReader(str)) { + return unescapeChunksAsync(str); + } + } + return markHTMLString(str); +} + +const AstroJSX = "astro:jsx"; +function isVNode(vnode) { + return vnode && typeof vnode === "object" && vnode[AstroJSX]; +} + +const RenderInstructionSymbol = Symbol.for("astro:render"); +function createRenderInstruction(instruction) { + return Object.defineProperty(instruction, RenderInstructionSymbol, { + value: true + }); +} +function isRenderInstruction(chunk) { + return chunk && typeof chunk === "object" && chunk[RenderInstructionSymbol]; +} + +const PROP_TYPE = { + Value: 0, + JSON: 1, + // Actually means Array + RegExp: 2, + Date: 3, + Map: 4, + Set: 5, + BigInt: 6, + URL: 7, + Uint8Array: 8, + Uint16Array: 9, + Uint32Array: 10 +}; +function serializeArray(value, metadata = {}, parents = /* @__PURE__ */ new WeakSet()) { + if (parents.has(value)) { + throw new Error(`Cyclic reference detected while serializing props for <${metadata.displayName} client:${metadata.hydrate}>! + +Cyclic references cannot be safely serialized for client-side usage. Please remove the cyclic reference.`); + } + parents.add(value); + const serialized = value.map((v) => { + return convertToSerializedForm(v, metadata, parents); + }); + parents.delete(value); + return serialized; +} +function serializeObject(value, metadata = {}, parents = /* @__PURE__ */ new WeakSet()) { + if (parents.has(value)) { + throw new Error(`Cyclic reference detected while serializing props for <${metadata.displayName} client:${metadata.hydrate}>! + +Cyclic references cannot be safely serialized for client-side usage. Please remove the cyclic reference.`); + } + parents.add(value); + const serialized = Object.fromEntries( + Object.entries(value).map(([k, v]) => { + return [k, convertToSerializedForm(v, metadata, parents)]; + }) + ); + parents.delete(value); + return serialized; +} +function convertToSerializedForm(value, metadata = {}, parents = /* @__PURE__ */ new WeakSet()) { + const tag = Object.prototype.toString.call(value); + switch (tag) { + case "[object Date]": { + return [PROP_TYPE.Date, value.toISOString()]; + } + case "[object RegExp]": { + return [PROP_TYPE.RegExp, value.source]; + } + case "[object Map]": { + return [PROP_TYPE.Map, serializeArray(Array.from(value), metadata, parents)]; + } + case "[object Set]": { + return [PROP_TYPE.Set, serializeArray(Array.from(value), metadata, parents)]; + } + case "[object BigInt]": { + return [PROP_TYPE.BigInt, value.toString()]; + } + case "[object URL]": { + return [PROP_TYPE.URL, value.toString()]; + } + case "[object Array]": { + return [PROP_TYPE.JSON, serializeArray(value, metadata, parents)]; + } + case "[object Uint8Array]": { + return [PROP_TYPE.Uint8Array, Array.from(value)]; + } + case "[object Uint16Array]": { + return [PROP_TYPE.Uint16Array, Array.from(value)]; + } + case "[object Uint32Array]": { + return [PROP_TYPE.Uint32Array, Array.from(value)]; + } + default: { + if (value !== null && typeof value === "object") { + return [PROP_TYPE.Value, serializeObject(value, metadata, parents)]; + } else if (value === void 0) { + return [PROP_TYPE.Value]; + } else { + return [PROP_TYPE.Value, value]; + } + } + } +} +function serializeProps(props, metadata) { + const serialized = JSON.stringify(serializeObject(props, metadata)); + return serialized; +} + +const transitionDirectivesToCopyOnIsland = Object.freeze([ + "data-astro-transition-scope", + "data-astro-transition-persist", + "data-astro-transition-persist-props" +]); +function extractDirectives(inputProps, clientDirectives) { + let extracted = { + isPage: false, + hydration: null, + props: {}, + propsWithoutTransitionAttributes: {} + }; + for (const [key, value] of Object.entries(inputProps)) { + if (key.startsWith("server:")) { + if (key === "server:root") { + extracted.isPage = true; + } + } + if (key.startsWith("client:")) { + if (!extracted.hydration) { + extracted.hydration = { + directive: "", + value: "", + componentUrl: "", + componentExport: { value: "" } + }; + } + switch (key) { + case "client:component-path": { + extracted.hydration.componentUrl = value; + break; + } + case "client:component-export": { + extracted.hydration.componentExport.value = value; + break; + } + case "client:component-hydration": { + break; + } + case "client:display-name": { + break; + } + default: { + extracted.hydration.directive = key.split(":")[1]; + extracted.hydration.value = value; + if (!clientDirectives.has(extracted.hydration.directive)) { + const hydrationMethods = Array.from(clientDirectives.keys()).map((d) => `client:${d}`).join(", "); + throw new Error( + `Error: invalid hydration directive "${key}". Supported hydration methods: ${hydrationMethods}` + ); + } + if (extracted.hydration.directive === "media" && typeof extracted.hydration.value !== "string") { + throw new AstroError(MissingMediaQueryDirective); + } + break; + } + } + } else { + extracted.props[key] = value; + if (!transitionDirectivesToCopyOnIsland.includes(key)) { + extracted.propsWithoutTransitionAttributes[key] = value; + } + } + } + for (const sym of Object.getOwnPropertySymbols(inputProps)) { + extracted.props[sym] = inputProps[sym]; + extracted.propsWithoutTransitionAttributes[sym] = inputProps[sym]; + } + return extracted; +} +async function generateHydrateScript(scriptOptions, metadata) { + const { renderer, result, astroId, props, attrs } = scriptOptions; + const { hydrate, componentUrl, componentExport } = metadata; + if (!componentExport.value) { + throw new AstroError({ + ...NoMatchingImport, + message: NoMatchingImport.message(metadata.displayName) + }); + } + const island = { + children: "", + props: { + // This is for HMR, probably can avoid it in prod + uid: astroId + } + }; + if (attrs) { + for (const [key, value] of Object.entries(attrs)) { + island.props[key] = escapeHTML(value); + } + } + island.props["component-url"] = await result.resolve(decodeURI(componentUrl)); + if (renderer.clientEntrypoint) { + island.props["component-export"] = componentExport.value; + island.props["renderer-url"] = await result.resolve(decodeURI(renderer.clientEntrypoint)); + island.props["props"] = escapeHTML(serializeProps(props, metadata)); + } + island.props["ssr"] = ""; + island.props["client"] = hydrate; + let beforeHydrationUrl = await result.resolve("astro:scripts/before-hydration.js"); + if (beforeHydrationUrl.length) { + island.props["before-hydration-url"] = beforeHydrationUrl; + } + island.props["opts"] = escapeHTML( + JSON.stringify({ + name: metadata.displayName, + value: metadata.hydrateArgs || "" + }) + ); + transitionDirectivesToCopyOnIsland.forEach((name) => { + if (typeof props[name] !== "undefined") { + island.props[name] = props[name]; + } + }); + return island; +} + +/** + * shortdash - https://github.com/bibig/node-shorthash + * + * @license + * + * (The MIT License) + * + * Copyright (c) 2013 Bibig + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ +const dictionary = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXY"; +const binary = dictionary.length; +function bitwise(str) { + let hash = 0; + if (str.length === 0) return hash; + for (let i = 0; i < str.length; i++) { + const ch = str.charCodeAt(i); + hash = (hash << 5) - hash + ch; + hash = hash & hash; + } + return hash; +} +function shorthash(text) { + let num; + let result = ""; + let integer = bitwise(text); + const sign = integer < 0 ? "Z" : ""; + integer = Math.abs(integer); + while (integer >= binary) { + num = integer % binary; + integer = Math.floor(integer / binary); + result = dictionary[num] + result; + } + if (integer > 0) { + result = dictionary[integer] + result; + } + return sign + result; +} + +function isAstroComponentFactory(obj) { + return obj == null ? false : obj.isAstroComponentFactory === true; +} +function isAPropagatingComponent(result, factory) { + let hint = factory.propagation || "none"; + if (factory.moduleId && result.componentMetadata.has(factory.moduleId) && hint === "none") { + hint = result.componentMetadata.get(factory.moduleId).propagation; + } + return hint === "in-tree" || hint === "self"; +} + +const headAndContentSym = Symbol.for("astro.headAndContent"); +function isHeadAndContent(obj) { + return typeof obj === "object" && !!obj[headAndContentSym]; +} + +var astro_island_prebuilt_dev_default = `(()=>{var A=Object.defineProperty;var g=(i,o,a)=>o in i?A(i,o,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[o]=a;var l=(i,o,a)=>g(i,typeof o!="symbol"?o+"":o,a);{let i={0:t=>y(t),1:t=>a(t),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(a(t)),5:t=>new Set(a(t)),6:t=>BigInt(t),7:t=>new URL(t),8:t=>new Uint8Array(t),9:t=>new Uint16Array(t),10:t=>new Uint32Array(t)},o=t=>{let[h,e]=t;return h in i?i[h](e):void 0},a=t=>t.map(o),y=t=>typeof t!="object"||t===null?t:Object.fromEntries(Object.entries(t).map(([h,e])=>[h,o(e)]));class f extends HTMLElement{constructor(){super(...arguments);l(this,"Component");l(this,"hydrator");l(this,"hydrate",async()=>{var b;if(!this.hydrator||!this.isConnected)return;let e=(b=this.parentElement)==null?void 0:b.closest("astro-island[ssr]");if(e){e.addEventListener("astro:hydrate",this.hydrate,{once:!0});return}let c=this.querySelectorAll("astro-slot"),n={},p=this.querySelectorAll("template[data-astro-template]");for(let r of p){let s=r.closest(this.tagName);s!=null&&s.isSameNode(this)&&(n[r.getAttribute("data-astro-template")||"default"]=r.innerHTML,r.remove())}for(let r of c){let s=r.closest(this.tagName);s!=null&&s.isSameNode(this)&&(n[r.getAttribute("name")||"default"]=r.innerHTML)}let u;try{u=this.hasAttribute("props")?y(JSON.parse(this.getAttribute("props"))):{}}catch(r){let s=this.getAttribute("component-url")||"",v=this.getAttribute("component-export");throw v&&(s+=\` (export \${v})\`),console.error(\`[hydrate] Error parsing props for component \${s}\`,this.getAttribute("props"),r),r}let d,m=this.hydrator(this);d=performance.now(),await m(this.Component,u,n,{client:this.getAttribute("client")}),d&&this.setAttribute("client-render-time",(performance.now()-d).toString()),this.removeAttribute("ssr"),this.dispatchEvent(new CustomEvent("astro:hydrate"))});l(this,"unmount",()=>{this.isConnected||this.dispatchEvent(new CustomEvent("astro:unmount"))})}disconnectedCallback(){document.removeEventListener("astro:after-swap",this.unmount),document.addEventListener("astro:after-swap",this.unmount,{once:!0})}connectedCallback(){if(!this.hasAttribute("await-children")||document.readyState==="interactive"||document.readyState==="complete")this.childrenConnectedCallback();else{let e=()=>{document.removeEventListener("DOMContentLoaded",e),c.disconnect(),this.childrenConnectedCallback()},c=new MutationObserver(()=>{var n;((n=this.lastChild)==null?void 0:n.nodeType)===Node.COMMENT_NODE&&this.lastChild.nodeValue==="astro:end"&&(this.lastChild.remove(),e())});c.observe(this,{childList:!0}),document.addEventListener("DOMContentLoaded",e)}}async childrenConnectedCallback(){let e=this.getAttribute("before-hydration-url");e&&await import(e),this.start()}async start(){let e=JSON.parse(this.getAttribute("opts")),c=this.getAttribute("client");if(Astro[c]===void 0){window.addEventListener(\`astro:\${c}\`,()=>this.start(),{once:!0});return}try{await Astro[c](async()=>{let n=this.getAttribute("renderer-url"),[p,{default:u}]=await Promise.all([import(this.getAttribute("component-url")),n?import(n):()=>()=>{}]),d=this.getAttribute("component-export")||"default";if(!d.includes("."))this.Component=p[d];else{this.Component=p;for(let m of d.split("."))this.Component=this.Component[m]}return this.hydrator=u,this.hydrate},e,this)}catch(n){console.error(\`[astro-island] Error hydrating \${this.getAttribute("component-url")}\`,n)}}attributeChangedCallback(){this.hydrate()}}l(f,"observedAttributes",["props"]),customElements.get("astro-island")||customElements.define("astro-island",f)}})();`; + +var astro_island_prebuilt_default = `(()=>{var A=Object.defineProperty;var g=(i,o,a)=>o in i?A(i,o,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[o]=a;var d=(i,o,a)=>g(i,typeof o!="symbol"?o+"":o,a);{let i={0:t=>m(t),1:t=>a(t),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(a(t)),5:t=>new Set(a(t)),6:t=>BigInt(t),7:t=>new URL(t),8:t=>new Uint8Array(t),9:t=>new Uint16Array(t),10:t=>new Uint32Array(t)},o=t=>{let[l,e]=t;return l in i?i[l](e):void 0},a=t=>t.map(o),m=t=>typeof t!="object"||t===null?t:Object.fromEntries(Object.entries(t).map(([l,e])=>[l,o(e)]));class y extends HTMLElement{constructor(){super(...arguments);d(this,"Component");d(this,"hydrator");d(this,"hydrate",async()=>{var b;if(!this.hydrator||!this.isConnected)return;let e=(b=this.parentElement)==null?void 0:b.closest("astro-island[ssr]");if(e){e.addEventListener("astro:hydrate",this.hydrate,{once:!0});return}let c=this.querySelectorAll("astro-slot"),n={},h=this.querySelectorAll("template[data-astro-template]");for(let r of h){let s=r.closest(this.tagName);s!=null&&s.isSameNode(this)&&(n[r.getAttribute("data-astro-template")||"default"]=r.innerHTML,r.remove())}for(let r of c){let s=r.closest(this.tagName);s!=null&&s.isSameNode(this)&&(n[r.getAttribute("name")||"default"]=r.innerHTML)}let p;try{p=this.hasAttribute("props")?m(JSON.parse(this.getAttribute("props"))):{}}catch(r){let s=this.getAttribute("component-url")||"",v=this.getAttribute("component-export");throw v&&(s+=\` (export \${v})\`),console.error(\`[hydrate] Error parsing props for component \${s}\`,this.getAttribute("props"),r),r}let u;await this.hydrator(this)(this.Component,p,n,{client:this.getAttribute("client")}),this.removeAttribute("ssr"),this.dispatchEvent(new CustomEvent("astro:hydrate"))});d(this,"unmount",()=>{this.isConnected||this.dispatchEvent(new CustomEvent("astro:unmount"))})}disconnectedCallback(){document.removeEventListener("astro:after-swap",this.unmount),document.addEventListener("astro:after-swap",this.unmount,{once:!0})}connectedCallback(){if(!this.hasAttribute("await-children")||document.readyState==="interactive"||document.readyState==="complete")this.childrenConnectedCallback();else{let e=()=>{document.removeEventListener("DOMContentLoaded",e),c.disconnect(),this.childrenConnectedCallback()},c=new MutationObserver(()=>{var n;((n=this.lastChild)==null?void 0:n.nodeType)===Node.COMMENT_NODE&&this.lastChild.nodeValue==="astro:end"&&(this.lastChild.remove(),e())});c.observe(this,{childList:!0}),document.addEventListener("DOMContentLoaded",e)}}async childrenConnectedCallback(){let e=this.getAttribute("before-hydration-url");e&&await import(e),this.start()}async start(){let e=JSON.parse(this.getAttribute("opts")),c=this.getAttribute("client");if(Astro[c]===void 0){window.addEventListener(\`astro:\${c}\`,()=>this.start(),{once:!0});return}try{await Astro[c](async()=>{let n=this.getAttribute("renderer-url"),[h,{default:p}]=await Promise.all([import(this.getAttribute("component-url")),n?import(n):()=>()=>{}]),u=this.getAttribute("component-export")||"default";if(!u.includes("."))this.Component=h[u];else{this.Component=h;for(let f of u.split("."))this.Component=this.Component[f]}return this.hydrator=p,this.hydrate},e,this)}catch(n){console.error(\`[astro-island] Error hydrating \${this.getAttribute("component-url")}\`,n)}}attributeChangedCallback(){this.hydrate()}}d(y,"observedAttributes",["props"]),customElements.get("astro-island")||customElements.define("astro-island",y)}})();`; + +const ISLAND_STYLES = ``; +function determineIfNeedsHydrationScript(result) { + if (result._metadata.hasHydrationScript) { + return false; + } + return result._metadata.hasHydrationScript = true; +} +function determinesIfNeedsDirectiveScript(result, directive) { + if (result._metadata.hasDirectives.has(directive)) { + return false; + } + result._metadata.hasDirectives.add(directive); + return true; +} +function getDirectiveScriptText(result, directive) { + const clientDirectives = result.clientDirectives; + const clientDirective = clientDirectives.get(directive); + if (!clientDirective) { + throw new Error(`Unknown directive: ${directive}`); + } + return clientDirective; +} +function getPrescripts(result, type, directive) { + switch (type) { + case "both": + return `${ISLAND_STYLES}`; + case "directive": + return ``; + } + return ""; +} + +const voidElementNames = /^(area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)$/i; +const htmlBooleanAttributes = /^(?:allowfullscreen|async|autofocus|autoplay|controls|default|defer|disabled|disablepictureinpicture|disableremoteplayback|formnovalidate|hidden|loop|nomodule|novalidate|open|playsinline|readonly|required|reversed|scoped|seamless|itemscope)$/i; +const htmlEnumAttributes = /^(?:contenteditable|draggable|spellcheck|value)$/i; +const svgEnumAttributes = /^(?:autoReverse|externalResourcesRequired|focusable|preserveAlpha)$/i; +const AMPERSAND_REGEX = /&/g; +const DOUBLE_QUOTE_REGEX = /"/g; +const STATIC_DIRECTIVES = /* @__PURE__ */ new Set(["set:html", "set:text"]); +const toIdent = (k) => k.trim().replace(/(?!^)\b\w|\s+|\W+/g, (match, index) => { + if (/\W/.test(match)) return ""; + return index === 0 ? match : match.toUpperCase(); +}); +const toAttributeString = (value, shouldEscape = true) => shouldEscape ? String(value).replace(AMPERSAND_REGEX, "&").replace(DOUBLE_QUOTE_REGEX, """) : value; +const kebab = (k) => k.toLowerCase() === k ? k : k.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`); +const toStyleString = (obj) => Object.entries(obj).filter(([_, v]) => typeof v === "string" && v.trim() || typeof v === "number").map(([k, v]) => { + if (k[0] !== "-" && k[1] !== "-") return `${kebab(k)}:${v}`; + return `${k}:${v}`; +}).join(";"); +function defineScriptVars(vars) { + let output = ""; + for (const [key, value] of Object.entries(vars)) { + output += `const ${toIdent(key)} = ${JSON.stringify(value)?.replace( + /<\/script>/g, + "\\x3C/script>" + )}; +`; + } + return markHTMLString(output); +} +function formatList(values) { + if (values.length === 1) { + return values[0]; + } + return `${values.slice(0, -1).join(", ")} or ${values[values.length - 1]}`; +} +function addAttribute(value, key, shouldEscape = true) { + if (value == null) { + return ""; + } + if (value === false) { + if (htmlEnumAttributes.test(key) || svgEnumAttributes.test(key)) { + return markHTMLString(` ${key}="false"`); + } + return ""; + } + if (STATIC_DIRECTIVES.has(key)) { + console.warn(`[astro] The "${key}" directive cannot be applied dynamically at runtime. It will not be rendered as an attribute. + +Make sure to use the static attribute syntax (\`${key}={value}\`) instead of the dynamic spread syntax (\`{...{ "${key}": value }}\`).`); + return ""; + } + if (key === "class:list") { + const listValue = toAttributeString(clsx(value), shouldEscape); + if (listValue === "") { + return ""; + } + return markHTMLString(` ${key.slice(0, -5)}="${listValue}"`); + } + if (key === "style" && !(value instanceof HTMLString)) { + if (Array.isArray(value) && value.length === 2) { + return markHTMLString( + ` ${key}="${toAttributeString(`${toStyleString(value[0])};${value[1]}`, shouldEscape)}"` + ); + } + if (typeof value === "object") { + return markHTMLString(` ${key}="${toAttributeString(toStyleString(value), shouldEscape)}"`); + } + } + if (key === "className") { + return markHTMLString(` class="${toAttributeString(value, shouldEscape)}"`); + } + if (typeof value === "string" && value.includes("&") && isHttpUrl(value)) { + return markHTMLString(` ${key}="${toAttributeString(value, false)}"`); + } + if (value === true && (key.startsWith("data-") || htmlBooleanAttributes.test(key))) { + return markHTMLString(` ${key}`); + } else { + return markHTMLString(` ${key}="${toAttributeString(value, shouldEscape)}"`); + } +} +function internalSpreadAttributes(values, shouldEscape = true) { + let output = ""; + for (const [key, value] of Object.entries(values)) { + output += addAttribute(value, key, shouldEscape); + } + return markHTMLString(output); +} +function renderElement$1(name, { props: _props, children = "" }, shouldEscape = true) { + const { lang: _, "data-astro-id": astroId, "define:vars": defineVars, ...props } = _props; + if (defineVars) { + if (name === "style") { + delete props["is:global"]; + delete props["is:scoped"]; + } + if (name === "script") { + delete props.hoist; + children = defineScriptVars(defineVars) + "\n" + children; + } + } + if ((children == null || children == "") && voidElementNames.test(name)) { + return `<${name}${internalSpreadAttributes(props, shouldEscape)}>`; + } + return `<${name}${internalSpreadAttributes(props, shouldEscape)}>${children}`; +} +const noop = () => { +}; +class BufferedRenderer { + chunks = []; + renderPromise; + destination; + constructor(bufferRenderFunction) { + this.renderPromise = bufferRenderFunction(this); + Promise.resolve(this.renderPromise).catch(noop); + } + write(chunk) { + if (this.destination) { + this.destination.write(chunk); + } else { + this.chunks.push(chunk); + } + } + async renderToFinalDestination(destination) { + for (const chunk of this.chunks) { + destination.write(chunk); + } + this.destination = destination; + await this.renderPromise; + } +} +function renderToBufferDestination(bufferRenderFunction) { + const renderer = new BufferedRenderer(bufferRenderFunction); + return renderer; +} +const isNode = typeof process !== "undefined" && Object.prototype.toString.call(process) === "[object process]"; +const isDeno = typeof Deno !== "undefined"; +function promiseWithResolvers() { + let resolve, reject; + const promise = new Promise((_resolve, _reject) => { + resolve = _resolve; + reject = _reject; + }); + return { + promise, + resolve, + reject + }; +} +const VALID_PROTOCOLS = ["http:", "https:"]; +function isHttpUrl(url) { + try { + const parsedUrl = new URL(url); + return VALID_PROTOCOLS.includes(parsedUrl.protocol); + } catch { + return false; + } +} + +const uniqueElements = (item, index, all) => { + const props = JSON.stringify(item.props); + const children = item.children; + return index === all.findIndex((i) => JSON.stringify(i.props) === props && i.children == children); +}; +function renderAllHeadContent(result) { + result._metadata.hasRenderedHead = true; + const styles = Array.from(result.styles).filter(uniqueElements).map( + (style) => style.props.rel === "stylesheet" ? renderElement$1("link", style) : renderElement$1("style", style) + ); + result.styles.clear(); + const scripts = Array.from(result.scripts).filter(uniqueElements).map((script) => { + return renderElement$1("script", script, false); + }); + const links = Array.from(result.links).filter(uniqueElements).map((link) => renderElement$1("link", link, false)); + let content = styles.join("\n") + links.join("\n") + scripts.join("\n"); + if (result._metadata.extraHead.length > 0) { + for (const part of result._metadata.extraHead) { + content += part; + } + } + return markHTMLString(content); +} +function renderHead() { + return createRenderInstruction({ type: "head" }); +} +function maybeRenderHead() { + return createRenderInstruction({ type: "maybe-head" }); +} + +const renderTemplateResultSym = Symbol.for("astro.renderTemplateResult"); +class RenderTemplateResult { + [renderTemplateResultSym] = true; + htmlParts; + expressions; + error; + constructor(htmlParts, expressions) { + this.htmlParts = htmlParts; + this.error = void 0; + this.expressions = expressions.map((expression) => { + if (isPromise(expression)) { + return Promise.resolve(expression).catch((err) => { + if (!this.error) { + this.error = err; + throw err; + } + }); + } + return expression; + }); + } + async render(destination) { + const expRenders = this.expressions.map((exp) => { + return renderToBufferDestination((bufferDestination) => { + if (exp || exp === 0) { + return renderChild(bufferDestination, exp); + } + }); + }); + for (let i = 0; i < this.htmlParts.length; i++) { + const html = this.htmlParts[i]; + const expRender = expRenders[i]; + destination.write(markHTMLString(html)); + if (expRender) { + await expRender.renderToFinalDestination(destination); + } + } + } +} +function isRenderTemplateResult(obj) { + return typeof obj === "object" && !!obj[renderTemplateResultSym]; +} +function renderTemplate(htmlParts, ...expressions) { + return new RenderTemplateResult(htmlParts, expressions); +} + +const slotString = Symbol.for("astro:slot-string"); +class SlotString extends HTMLString { + instructions; + [slotString]; + constructor(content, instructions) { + super(content); + this.instructions = instructions; + this[slotString] = true; + } +} +function isSlotString(str) { + return !!str[slotString]; +} +function renderSlot(result, slotted, fallback) { + if (!slotted && fallback) { + return renderSlot(result, fallback); + } + return { + async render(destination) { + await renderChild(destination, typeof slotted === "function" ? slotted(result) : slotted); + } + }; +} +async function renderSlotToString(result, slotted, fallback) { + let content = ""; + let instructions = null; + const temporaryDestination = { + write(chunk) { + if (chunk instanceof SlotString) { + content += chunk; + if (chunk.instructions) { + instructions ??= []; + instructions.push(...chunk.instructions); + } + } else if (chunk instanceof Response) return; + else if (typeof chunk === "object" && "type" in chunk && typeof chunk.type === "string") { + if (instructions === null) { + instructions = []; + } + instructions.push(chunk); + } else { + content += chunkToString(result, chunk); + } + } + }; + const renderInstance = renderSlot(result, slotted, fallback); + await renderInstance.render(temporaryDestination); + return markHTMLString(new SlotString(content, instructions)); +} +async function renderSlots(result, slots = {}) { + let slotInstructions = null; + let children = {}; + if (slots) { + await Promise.all( + Object.entries(slots).map( + ([key, value]) => renderSlotToString(result, value).then((output) => { + if (output.instructions) { + if (slotInstructions === null) { + slotInstructions = []; + } + slotInstructions.push(...output.instructions); + } + children[key] = output; + }) + ) + ); + } + return { slotInstructions, children }; +} +function createSlotValueFromString(content) { + return function() { + return renderTemplate`${unescapeHTML(content)}`; + }; +} + +const Fragment = Symbol.for("astro:fragment"); +const Renderer = Symbol.for("astro:renderer"); +const encoder = new TextEncoder(); +const decoder = new TextDecoder(); +function stringifyChunk(result, chunk) { + if (isRenderInstruction(chunk)) { + const instruction = chunk; + switch (instruction.type) { + case "directive": { + const { hydration } = instruction; + let needsHydrationScript = hydration && determineIfNeedsHydrationScript(result); + let needsDirectiveScript = hydration && determinesIfNeedsDirectiveScript(result, hydration.directive); + let prescriptType = needsHydrationScript ? "both" : needsDirectiveScript ? "directive" : null; + if (prescriptType) { + let prescripts = getPrescripts(result, prescriptType, hydration.directive); + return markHTMLString(prescripts); + } else { + return ""; + } + } + case "head": { + if (result._metadata.hasRenderedHead || result.partial) { + return ""; + } + return renderAllHeadContent(result); + } + case "maybe-head": { + if (result._metadata.hasRenderedHead || result._metadata.headInTree || result.partial) { + return ""; + } + return renderAllHeadContent(result); + } + case "renderer-hydration-script": { + const { rendererSpecificHydrationScripts } = result._metadata; + const { rendererName } = instruction; + if (!rendererSpecificHydrationScripts.has(rendererName)) { + rendererSpecificHydrationScripts.add(rendererName); + return instruction.render(); + } + return ""; + } + default: { + throw new Error(`Unknown chunk type: ${chunk.type}`); + } + } + } else if (chunk instanceof Response) { + return ""; + } else if (isSlotString(chunk)) { + let out = ""; + const c = chunk; + if (c.instructions) { + for (const instr of c.instructions) { + out += stringifyChunk(result, instr); + } + } + out += chunk.toString(); + return out; + } + return chunk.toString(); +} +function chunkToString(result, chunk) { + if (ArrayBuffer.isView(chunk)) { + return decoder.decode(chunk); + } else { + return stringifyChunk(result, chunk); + } +} +function chunkToByteArray(result, chunk) { + if (ArrayBuffer.isView(chunk)) { + return chunk; + } else { + const stringified = stringifyChunk(result, chunk); + return encoder.encode(stringified.toString()); + } +} +function isRenderInstance(obj) { + return !!obj && typeof obj === "object" && "render" in obj && typeof obj.render === "function"; +} + +async function renderChild(destination, child) { + if (isPromise(child)) { + child = await child; + } + if (child instanceof SlotString) { + destination.write(child); + } else if (isHTMLString(child)) { + destination.write(child); + } else if (Array.isArray(child)) { + const childRenders = child.map((c) => { + return renderToBufferDestination((bufferDestination) => { + return renderChild(bufferDestination, c); + }); + }); + for (const childRender of childRenders) { + if (!childRender) continue; + await childRender.renderToFinalDestination(destination); + } + } else if (typeof child === "function") { + await renderChild(destination, child()); + } else if (typeof child === "string") { + destination.write(markHTMLString(escapeHTML(child))); + } else if (!child && child !== 0) ; else if (isRenderInstance(child)) { + await child.render(destination); + } else if (isRenderTemplateResult(child)) { + await child.render(destination); + } else if (isAstroComponentInstance(child)) { + await child.render(destination); + } else if (ArrayBuffer.isView(child)) { + destination.write(child); + } else if (typeof child === "object" && (Symbol.asyncIterator in child || Symbol.iterator in child)) { + for await (const value of child) { + await renderChild(destination, value); + } + } else { + destination.write(child); + } +} + +const astroComponentInstanceSym = Symbol.for("astro.componentInstance"); +class AstroComponentInstance { + [astroComponentInstanceSym] = true; + result; + props; + slotValues; + factory; + returnValue; + constructor(result, props, slots, factory) { + this.result = result; + this.props = props; + this.factory = factory; + this.slotValues = {}; + for (const name in slots) { + let didRender = false; + let value = slots[name](result); + this.slotValues[name] = () => { + if (!didRender) { + didRender = true; + return value; + } + return slots[name](result); + }; + } + } + async init(result) { + if (this.returnValue !== void 0) return this.returnValue; + this.returnValue = this.factory(result, this.props, this.slotValues); + if (isPromise(this.returnValue)) { + this.returnValue.then((resolved) => { + this.returnValue = resolved; + }).catch(() => { + }); + } + return this.returnValue; + } + async render(destination) { + const returnValue = await this.init(this.result); + if (isHeadAndContent(returnValue)) { + await returnValue.content.render(destination); + } else { + await renderChild(destination, returnValue); + } + } +} +function validateComponentProps(props, displayName) { + if (props != null) { + for (const prop of Object.keys(props)) { + if (prop.startsWith("client:")) { + console.warn( + `You are attempting to render <${displayName} ${prop} />, but ${displayName} is an Astro component. Astro components do not render in the client and should not have a hydration directive. Please use a framework component for client rendering.` + ); + } + } + } +} +function createAstroComponentInstance(result, displayName, factory, props, slots = {}) { + validateComponentProps(props, displayName); + const instance = new AstroComponentInstance(result, props, slots, factory); + if (isAPropagatingComponent(result, factory)) { + result._metadata.propagators.add(instance); + } + return instance; +} +function isAstroComponentInstance(obj) { + return typeof obj === "object" && !!obj[astroComponentInstanceSym]; +} + +const DOCTYPE_EXP = /" : "\n"; + str += doctype; + } + } + if (chunk instanceof Response) return; + str += chunkToString(result, chunk); + } + }; + await templateResult.render(destination); + return str; +} +async function renderToReadableStream(result, componentFactory, props, children, isPage = false, route) { + const templateResult = await callComponentAsTemplateResultOrResponse( + result, + componentFactory, + props, + children, + route + ); + if (templateResult instanceof Response) return templateResult; + let renderedFirstPageChunk = false; + if (isPage) { + await bufferHeadContent(result); + } + return new ReadableStream({ + start(controller) { + const destination = { + write(chunk) { + if (isPage && !renderedFirstPageChunk) { + renderedFirstPageChunk = true; + if (!result.partial && !DOCTYPE_EXP.test(String(chunk))) { + const doctype = result.compressHTML ? "" : "\n"; + controller.enqueue(encoder.encode(doctype)); + } + } + if (chunk instanceof Response) { + throw new AstroError({ + ...ResponseSentError + }); + } + const bytes = chunkToByteArray(result, chunk); + controller.enqueue(bytes); + } + }; + (async () => { + try { + await templateResult.render(destination); + controller.close(); + } catch (e) { + if (AstroError.is(e) && !e.loc) { + e.setLocation({ + file: route?.component + }); + } + setTimeout(() => controller.error(e), 0); + } + })(); + }, + cancel() { + result.cancelled = true; + } + }); +} +async function callComponentAsTemplateResultOrResponse(result, componentFactory, props, children, route) { + const factoryResult = await componentFactory(result, props, children); + if (factoryResult instanceof Response) { + return factoryResult; + } else if (isHeadAndContent(factoryResult)) { + if (!isRenderTemplateResult(factoryResult.content)) { + throw new AstroError({ + ...OnlyResponseCanBeReturned, + message: OnlyResponseCanBeReturned.message( + route?.route, + typeof factoryResult + ), + location: { + file: route?.component + } + }); + } + return factoryResult.content; + } else if (!isRenderTemplateResult(factoryResult)) { + throw new AstroError({ + ...OnlyResponseCanBeReturned, + message: OnlyResponseCanBeReturned.message(route?.route, typeof factoryResult), + location: { + file: route?.component + } + }); + } + return factoryResult; +} +async function bufferHeadContent(result) { + const iterator = result._metadata.propagators.values(); + while (true) { + const { value, done } = iterator.next(); + if (done) { + break; + } + const returnValue = await value.init(result); + if (isHeadAndContent(returnValue)) { + result._metadata.extraHead.push(returnValue.head); + } + } +} +async function renderToAsyncIterable(result, componentFactory, props, children, isPage = false, route) { + const templateResult = await callComponentAsTemplateResultOrResponse( + result, + componentFactory, + props, + children, + route + ); + if (templateResult instanceof Response) return templateResult; + let renderedFirstPageChunk = false; + if (isPage) { + await bufferHeadContent(result); + } + let error = null; + let next = null; + const buffer = []; + let renderingComplete = false; + const iterator = { + async next() { + if (result.cancelled) return { done: true, value: void 0 }; + if (next !== null) { + await next.promise; + } else if (!renderingComplete && !buffer.length) { + next = promiseWithResolvers(); + await next.promise; + } + if (!renderingComplete) { + next = promiseWithResolvers(); + } + if (error) { + throw error; + } + let length = 0; + for (let i = 0, len = buffer.length; i < len; i++) { + length += buffer[i].length; + } + let mergedArray = new Uint8Array(length); + let offset = 0; + for (let i = 0, len = buffer.length; i < len; i++) { + const item = buffer[i]; + mergedArray.set(item, offset); + offset += item.length; + } + buffer.length = 0; + const returnValue = { + // The iterator is done when rendering has finished + // and there are no more chunks to return. + done: length === 0 && renderingComplete, + value: mergedArray + }; + return returnValue; + }, + async return() { + result.cancelled = true; + return { done: true, value: void 0 }; + } + }; + const destination = { + write(chunk) { + if (isPage && !renderedFirstPageChunk) { + renderedFirstPageChunk = true; + if (!result.partial && !DOCTYPE_EXP.test(String(chunk))) { + const doctype = result.compressHTML ? "" : "\n"; + buffer.push(encoder.encode(doctype)); + } + } + if (chunk instanceof Response) { + throw new AstroError(ResponseSentError); + } + const bytes = chunkToByteArray(result, chunk); + if (bytes.length > 0) { + buffer.push(bytes); + next?.resolve(); + } else if (buffer.length > 0) { + next?.resolve(); + } + } + }; + const renderPromise = templateResult.render(destination); + renderPromise.then(() => { + renderingComplete = true; + next?.resolve(); + }).catch((err) => { + error = err; + renderingComplete = true; + next?.resolve(); + }); + return { + [Symbol.asyncIterator]() { + return iterator; + } + }; +} + +function componentIsHTMLElement(Component) { + return typeof HTMLElement !== "undefined" && HTMLElement.isPrototypeOf(Component); +} +async function renderHTMLElement(result, constructor, props, slots) { + const name = getHTMLElementName(constructor); + let attrHTML = ""; + for (const attr in props) { + attrHTML += ` ${attr}="${toAttributeString(await props[attr])}"`; + } + return markHTMLString( + `<${name}${attrHTML}>${await renderSlotToString(result, slots?.default)}` + ); +} +function getHTMLElementName(constructor) { + const definedName = customElements.getName(constructor); + if (definedName) return definedName; + const assignedName = constructor.name.replace(/^HTML|Element$/g, "").replace(/[A-Z]/g, "-$&").toLowerCase().replace(/^-/, "html-"); + return assignedName; +} + +const internalProps = /* @__PURE__ */ new Set([ + "server:component-path", + "server:component-export", + "server:component-directive", + "server:defer" +]); +function containsServerDirective(props) { + return "server:component-directive" in props; +} +function safeJsonStringify(obj) { + return JSON.stringify(obj).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029").replace(//g, "\\u003e").replace(/\//g, "\\u002f"); +} +function renderServerIsland(result, _displayName, props, slots) { + return { + async render(destination) { + const componentPath = props["server:component-path"]; + const componentExport = props["server:component-export"]; + const componentId = result.serverIslandNameMap.get(componentPath); + if (!componentId) { + throw new Error(`Could not find server component name`); + } + for (const key of Object.keys(props)) { + if (internalProps.has(key)) { + delete props[key]; + } + } + destination.write(""); + const renderedSlots = {}; + for (const name in slots) { + if (name !== "fallback") { + const content = await renderSlotToString(result, slots[name]); + renderedSlots[name] = content.toString(); + } else { + await renderChild(destination, slots.fallback(result)); + } + } + const hostId = crypto.randomUUID(); + destination.write(``); + } + }; +} + +const needsHeadRenderingSymbol = Symbol.for("astro.needsHeadRendering"); +const rendererAliases = /* @__PURE__ */ new Map([["solid", "solid-js"]]); +const clientOnlyValues = /* @__PURE__ */ new Set(["solid-js", "react", "preact", "vue", "svelte", "lit"]); +function guessRenderers(componentUrl) { + const extname = componentUrl?.split(".").pop(); + switch (extname) { + case "svelte": + return ["@astrojs/svelte"]; + case "vue": + return ["@astrojs/vue"]; + case "jsx": + case "tsx": + return ["@astrojs/react", "@astrojs/preact", "@astrojs/solid-js", "@astrojs/vue (jsx)"]; + default: + return [ + "@astrojs/react", + "@astrojs/preact", + "@astrojs/solid-js", + "@astrojs/vue", + "@astrojs/svelte", + "@astrojs/lit" + ]; + } +} +function isFragmentComponent(Component) { + return Component === Fragment; +} +function isHTMLComponent(Component) { + return Component && Component["astro:html"] === true; +} +const ASTRO_SLOT_EXP = /<\/?astro-slot\b[^>]*>/g; +const ASTRO_STATIC_SLOT_EXP = /<\/?astro-static-slot\b[^>]*>/g; +function removeStaticAstroSlot(html, supportsAstroStaticSlot = true) { + const exp = supportsAstroStaticSlot ? ASTRO_STATIC_SLOT_EXP : ASTRO_SLOT_EXP; + return html.replace(exp, ""); +} +async function renderFrameworkComponent(result, displayName, Component, _props, slots = {}) { + if (!Component && "client:only" in _props === false) { + throw new Error( + `Unable to render ${displayName} because it is ${Component}! +Did you forget to import the component or is it possible there is a typo?` + ); + } + const { renderers, clientDirectives } = result; + const metadata = { + astroStaticSlot: true, + displayName + }; + const { hydration, isPage, props, propsWithoutTransitionAttributes } = extractDirectives( + _props, + clientDirectives + ); + let html = ""; + let attrs = void 0; + if (hydration) { + metadata.hydrate = hydration.directive; + metadata.hydrateArgs = hydration.value; + metadata.componentExport = hydration.componentExport; + metadata.componentUrl = hydration.componentUrl; + } + const probableRendererNames = guessRenderers(metadata.componentUrl); + const validRenderers = renderers.filter((r) => r.name !== "astro:jsx"); + const { children, slotInstructions } = await renderSlots(result, slots); + let renderer; + if (metadata.hydrate !== "only") { + let isTagged = false; + try { + isTagged = Component && Component[Renderer]; + } catch { + } + if (isTagged) { + const rendererName = Component[Renderer]; + renderer = renderers.find(({ name }) => name === rendererName); + } + if (!renderer) { + let error; + for (const r of renderers) { + try { + if (await r.ssr.check.call({ result }, Component, props, children)) { + renderer = r; + break; + } + } catch (e) { + error ??= e; + } + } + if (!renderer && error) { + throw error; + } + } + if (!renderer && typeof HTMLElement === "function" && componentIsHTMLElement(Component)) { + const output = await renderHTMLElement( + result, + Component, + _props, + slots + ); + return { + render(destination) { + destination.write(output); + } + }; + } + } else { + if (metadata.hydrateArgs) { + const rendererName = rendererAliases.has(metadata.hydrateArgs) ? rendererAliases.get(metadata.hydrateArgs) : metadata.hydrateArgs; + if (clientOnlyValues.has(rendererName)) { + renderer = renderers.find( + ({ name }) => name === `@astrojs/${rendererName}` || name === rendererName + ); + } + } + if (!renderer && validRenderers.length === 1) { + renderer = validRenderers[0]; + } + if (!renderer) { + const extname = metadata.componentUrl?.split(".").pop(); + renderer = renderers.filter( + ({ name }) => name === `@astrojs/${extname}` || name === extname + )[0]; + } + } + let componentServerRenderEndTime; + if (!renderer) { + if (metadata.hydrate === "only") { + const rendererName = rendererAliases.has(metadata.hydrateArgs) ? rendererAliases.get(metadata.hydrateArgs) : metadata.hydrateArgs; + if (clientOnlyValues.has(rendererName)) { + const plural = validRenderers.length > 1; + throw new AstroError({ + ...NoMatchingRenderer, + message: NoMatchingRenderer.message( + metadata.displayName, + metadata?.componentUrl?.split(".").pop(), + plural, + validRenderers.length + ), + hint: NoMatchingRenderer.hint( + formatList(probableRendererNames.map((r) => "`" + r + "`")) + ) + }); + } else { + throw new AstroError({ + ...NoClientOnlyHint, + message: NoClientOnlyHint.message(metadata.displayName), + hint: NoClientOnlyHint.hint( + probableRendererNames.map((r) => r.replace("@astrojs/", "")).join("|") + ) + }); + } + } else if (typeof Component !== "string") { + const matchingRenderers = validRenderers.filter( + (r) => probableRendererNames.includes(r.name) + ); + const plural = validRenderers.length > 1; + if (matchingRenderers.length === 0) { + throw new AstroError({ + ...NoMatchingRenderer, + message: NoMatchingRenderer.message( + metadata.displayName, + metadata?.componentUrl?.split(".").pop(), + plural, + validRenderers.length + ), + hint: NoMatchingRenderer.hint( + formatList(probableRendererNames.map((r) => "`" + r + "`")) + ) + }); + } else if (matchingRenderers.length === 1) { + renderer = matchingRenderers[0]; + ({ html, attrs } = await renderer.ssr.renderToStaticMarkup.call( + { result }, + Component, + propsWithoutTransitionAttributes, + children, + metadata + )); + } else { + throw new Error(`Unable to render ${metadata.displayName}! + +This component likely uses ${formatList(probableRendererNames)}, +but Astro encountered an error during server-side rendering. + +Please ensure that ${metadata.displayName}: +1. Does not unconditionally access browser-specific globals like \`window\` or \`document\`. + If this is unavoidable, use the \`client:only\` hydration directive. +2. Does not conditionally return \`null\` or \`undefined\` when rendered on the server. + +If you're still stuck, please open an issue on GitHub or join us at https://astro.build/chat.`); + } + } + } else { + if (metadata.hydrate === "only") { + const rendererName = rendererAliases.has(metadata.hydrateArgs) ? rendererAliases.get(metadata.hydrateArgs) : metadata.hydrateArgs; + if (!clientOnlyValues.has(rendererName)) { + console.warn( + `The client:only directive for ${metadata.displayName} is not recognized. The renderer ${renderer.name} will be used. If you intended to use a different renderer, please provide a valid client:only directive.` + ); + } + html = await renderSlotToString(result, slots?.fallback); + } else { + const componentRenderStartTime = performance.now(); + ({ html, attrs } = await renderer.ssr.renderToStaticMarkup.call( + { result }, + Component, + propsWithoutTransitionAttributes, + children, + metadata + )); + if (process.env.NODE_ENV === "development") + componentServerRenderEndTime = performance.now() - componentRenderStartTime; + } + } + if (renderer && !renderer.clientEntrypoint && renderer.name !== "@astrojs/lit" && metadata.hydrate) { + throw new AstroError({ + ...NoClientEntrypoint, + message: NoClientEntrypoint.message( + displayName, + metadata.hydrate, + renderer.name + ) + }); + } + if (!html && typeof Component === "string") { + const Tag = sanitizeElementName(Component); + const childSlots = Object.values(children).join(""); + const renderTemplateResult = renderTemplate`<${Tag}${internalSpreadAttributes( + props + )}${markHTMLString( + childSlots === "" && voidElementNames.test(Tag) ? `/>` : `>${childSlots}` + )}`; + html = ""; + const destination = { + write(chunk) { + if (chunk instanceof Response) return; + html += chunkToString(result, chunk); + } + }; + await renderTemplateResult.render(destination); + } + if (!hydration) { + return { + render(destination) { + if (slotInstructions) { + for (const instruction of slotInstructions) { + destination.write(instruction); + } + } + if (isPage || renderer?.name === "astro:jsx") { + destination.write(html); + } else if (html && html.length > 0) { + destination.write( + markHTMLString(removeStaticAstroSlot(html, renderer?.ssr?.supportsAstroStaticSlot)) + ); + } + } + }; + } + const astroId = shorthash( + ` +${html} +${serializeProps( + props, + metadata + )}` + ); + const island = await generateHydrateScript( + { renderer, result, astroId, props, attrs }, + metadata + ); + if (componentServerRenderEndTime && process.env.NODE_ENV === "development") + island.props["server-render-time"] = componentServerRenderEndTime; + let unrenderedSlots = []; + if (html) { + if (Object.keys(children).length > 0) { + for (const key of Object.keys(children)) { + let tagName = renderer?.ssr?.supportsAstroStaticSlot ? !!metadata.hydrate ? "astro-slot" : "astro-static-slot" : "astro-slot"; + let expectedHTML = key === "default" ? `<${tagName}>` : `<${tagName} name="${key}">`; + if (!html.includes(expectedHTML)) { + unrenderedSlots.push(key); + } + } + } + } else { + unrenderedSlots = Object.keys(children); + } + const template = unrenderedSlots.length > 0 ? unrenderedSlots.map( + (key) => `` + ).join("") : ""; + island.children = `${html ?? ""}${template}`; + if (island.children) { + island.props["await-children"] = ""; + island.children += ``; + } + return { + render(destination) { + if (slotInstructions) { + for (const instruction of slotInstructions) { + destination.write(instruction); + } + } + destination.write(createRenderInstruction({ type: "directive", hydration })); + if (hydration.directive !== "only" && renderer?.ssr.renderHydrationScript) { + destination.write( + createRenderInstruction({ + type: "renderer-hydration-script", + rendererName: renderer.name, + render: renderer.ssr.renderHydrationScript + }) + ); + } + const renderedElement = renderElement$1("astro-island", island, false); + destination.write(markHTMLString(renderedElement)); + } + }; +} +function sanitizeElementName(tag) { + const unsafe = /[&<>'"\s]+/; + if (!unsafe.test(tag)) return tag; + return tag.trim().split(unsafe)[0].trim(); +} +async function renderFragmentComponent(result, slots = {}) { + const children = await renderSlotToString(result, slots?.default); + return { + render(destination) { + if (children == null) return; + destination.write(children); + } + }; +} +async function renderHTMLComponent(result, Component, _props, slots = {}) { + const { slotInstructions, children } = await renderSlots(result, slots); + const html = Component({ slots: children }); + const hydrationHtml = slotInstructions ? slotInstructions.map((instr) => chunkToString(result, instr)).join("") : ""; + return { + render(destination) { + destination.write(markHTMLString(hydrationHtml + html)); + } + }; +} +function renderAstroComponent(result, displayName, Component, props, slots = {}) { + if (containsServerDirective(props)) { + return renderServerIsland(result, displayName, props, slots); + } + const instance = createAstroComponentInstance(result, displayName, Component, props, slots); + return { + async render(destination) { + await instance.render(destination); + } + }; +} +async function renderComponent(result, displayName, Component, props, slots = {}) { + if (isPromise(Component)) { + Component = await Component.catch(handleCancellation); + } + if (isFragmentComponent(Component)) { + return await renderFragmentComponent(result, slots).catch(handleCancellation); + } + props = normalizeProps(props); + if (isHTMLComponent(Component)) { + return await renderHTMLComponent(result, Component, props, slots).catch(handleCancellation); + } + if (isAstroComponentFactory(Component)) { + return renderAstroComponent(result, displayName, Component, props, slots); + } + return await renderFrameworkComponent(result, displayName, Component, props, slots).catch( + handleCancellation + ); + function handleCancellation(e) { + if (result.cancelled) + return { + render() { + } + }; + throw e; + } +} +function normalizeProps(props) { + if (props["class:list"] !== void 0) { + const value = props["class:list"]; + delete props["class:list"]; + props["class"] = clsx(props["class"], value); + if (props["class"] === "") { + delete props["class"]; + } + } + return props; +} +async function renderComponentToString(result, displayName, Component, props, slots = {}, isPage = false, route) { + let str = ""; + let renderedFirstPageChunk = false; + let head = ""; + if (isPage && !result.partial && nonAstroPageNeedsHeadInjection(Component)) { + head += chunkToString(result, maybeRenderHead()); + } + try { + const destination = { + write(chunk) { + if (isPage && !result.partial && !renderedFirstPageChunk) { + renderedFirstPageChunk = true; + if (!/" : "\n"; + str += doctype + head; + } + } + if (chunk instanceof Response) return; + str += chunkToString(result, chunk); + } + }; + const renderInstance = await renderComponent(result, displayName, Component, props, slots); + await renderInstance.render(destination); + } catch (e) { + if (AstroError.is(e) && !e.loc) { + e.setLocation({ + file: route?.component + }); + } + throw e; + } + return str; +} +function nonAstroPageNeedsHeadInjection(pageComponent) { + return !!pageComponent?.[needsHeadRenderingSymbol]; +} + +const ClientOnlyPlaceholder = "astro-client-only"; +const hasTriedRenderComponentSymbol = Symbol("hasTriedRenderComponent"); +async function renderJSX(result, vnode) { + switch (true) { + case vnode instanceof HTMLString: + if (vnode.toString().trim() === "") { + return ""; + } + return vnode; + case typeof vnode === "string": + return markHTMLString(escapeHTML(vnode)); + case typeof vnode === "function": + return vnode; + case (!vnode && vnode !== 0): + return ""; + case Array.isArray(vnode): + return markHTMLString( + (await Promise.all(vnode.map((v) => renderJSX(result, v)))).join("") + ); + } + return renderJSXVNode(result, vnode); +} +async function renderJSXVNode(result, vnode) { + if (isVNode(vnode)) { + switch (true) { + case !vnode.type: { + throw new Error(`Unable to render ${result.pathname} because it contains an undefined Component! +Did you forget to import the component or is it possible there is a typo?`); + } + case vnode.type === Symbol.for("astro:fragment"): + return renderJSX(result, vnode.props.children); + case vnode.type.isAstroComponentFactory: { + let props = {}; + let slots = {}; + for (const [key, value] of Object.entries(vnode.props ?? {})) { + if (key === "children" || value && typeof value === "object" && value["$$slot"]) { + slots[key === "children" ? "default" : key] = () => renderJSX(result, value); + } else { + props[key] = value; + } + } + const str = await renderToString(result, vnode.type, props, slots); + if (str instanceof Response) { + throw str; + } + const html = markHTMLString(str); + return html; + } + case (!vnode.type && vnode.type !== 0): + return ""; + case (typeof vnode.type === "string" && vnode.type !== ClientOnlyPlaceholder): + return markHTMLString(await renderElement(result, vnode.type, vnode.props ?? {})); + } + if (vnode.type) { + let extractSlots2 = function(child) { + if (Array.isArray(child)) { + return child.map((c) => extractSlots2(c)); + } + if (!isVNode(child)) { + _slots.default.push(child); + return; + } + if ("slot" in child.props) { + _slots[child.props.slot] = [..._slots[child.props.slot] ?? [], child]; + delete child.props.slot; + return; + } + _slots.default.push(child); + }; + if (typeof vnode.type === "function" && vnode.props["server:root"]) { + const output2 = await vnode.type(vnode.props ?? {}); + return await renderJSX(result, output2); + } + if (typeof vnode.type === "function") { + if (vnode.props[hasTriedRenderComponentSymbol]) { + delete vnode.props[hasTriedRenderComponentSymbol]; + const output2 = await vnode.type(vnode.props ?? {}); + if (output2?.[AstroJSX] || !output2) { + return await renderJSXVNode(result, output2); + } else { + return; + } + } else { + vnode.props[hasTriedRenderComponentSymbol] = true; + } + } + const { children = null, ...props } = vnode.props ?? {}; + const _slots = { + default: [] + }; + extractSlots2(children); + for (const [key, value] of Object.entries(props)) { + if (value?.["$$slot"]) { + _slots[key] = value; + delete props[key]; + } + } + const slotPromises = []; + const slots = {}; + for (const [key, value] of Object.entries(_slots)) { + slotPromises.push( + renderJSX(result, value).then((output2) => { + if (output2.toString().trim().length === 0) return; + slots[key] = () => output2; + }) + ); + } + await Promise.all(slotPromises); + let output; + if (vnode.type === ClientOnlyPlaceholder && vnode.props["client:only"]) { + output = await renderComponentToString( + result, + vnode.props["client:display-name"] ?? "", + null, + props, + slots + ); + } else { + output = await renderComponentToString( + result, + typeof vnode.type === "function" ? vnode.type.name : vnode.type, + vnode.type, + props, + slots + ); + } + return markHTMLString(output); + } + } + return markHTMLString(`${vnode}`); +} +async function renderElement(result, tag, { children, ...props }) { + return markHTMLString( + `<${tag}${spreadAttributes(props)}${markHTMLString( + (children == null || children == "") && voidElementNames.test(tag) ? `/>` : `>${children == null ? "" : await renderJSX(result, prerenderElementChildren(tag, children))}` + )}` + ); +} +function prerenderElementChildren(tag, children) { + if (typeof children === "string" && (tag === "style" || tag === "script")) { + return markHTMLString(children); + } else { + return children; + } +} + +async function renderPage(result, componentFactory, props, children, streaming, route) { + if (!isAstroComponentFactory(componentFactory)) { + result._metadata.headInTree = result.componentMetadata.get(componentFactory.moduleId)?.containsHead ?? false; + const pageProps = { ...props ?? {}, "server:root": true }; + const str = await renderComponentToString( + result, + componentFactory.name, + componentFactory, + pageProps, + {}, + true, + route + ); + const bytes = encoder.encode(str); + return new Response(bytes, { + headers: new Headers([ + ["Content-Type", "text/html; charset=utf-8"], + ["Content-Length", bytes.byteLength.toString()] + ]) + }); + } + result._metadata.headInTree = result.componentMetadata.get(componentFactory.moduleId)?.containsHead ?? false; + let body; + if (streaming) { + if (isNode && !isDeno) { + const nodeBody = await renderToAsyncIterable( + result, + componentFactory, + props, + children, + true, + route + ); + body = nodeBody; + } else { + body = await renderToReadableStream(result, componentFactory, props, children, true, route); + } + } else { + body = await renderToString(result, componentFactory, props, children, true, route); + } + if (body instanceof Response) return body; + const init = result.response; + const headers = new Headers(init.headers); + if (!streaming && typeof body === "string") { + body = encoder.encode(body); + headers.set("Content-Length", body.byteLength.toString()); + } + if (route?.component.endsWith(".md")) { + headers.set("Content-Type", "text/html; charset=utf-8"); + } + let status = init.status; + if (route?.route === "/404") { + status = 404; + } else if (route?.route === "/500") { + status = 500; + } + if (status) { + return new Response(body, { ...init, headers, status }); + } else { + return new Response(body, { ...init, headers }); + } +} + +"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_".split("").reduce((v, c) => (v[c.charCodeAt(0)] = c, v), []); +"-0123456789_".split("").reduce((v, c) => (v[c.charCodeAt(0)] = c, v), []); + +function spreadAttributes(values = {}, _name, { class: scopedClassName } = {}) { + let output = ""; + if (scopedClassName) { + if (typeof values.class !== "undefined") { + values.class += ` ${scopedClassName}`; + } else if (typeof values["class:list"] !== "undefined") { + values["class:list"] = [values["class:list"], scopedClassName]; + } else { + values.class = scopedClassName; + } + } + for (const [key, value] of Object.entries(values)) { + output += addAttribute(value, key, true); + } + return markHTMLString(output); +} + +export { ASTRO_VERSION as A, DEFAULT_404_COMPONENT as D, ROUTE_TYPE_HEADER as R, renderComponent as a, addAttribute as b, createComponent as c, createAstro as d, renderHead as e, renderSlot as f, REROUTE_DIRECTIVE_HEADER as g, createSlotValueFromString as h, renderSlotToString as i, renderJSX as j, chunkToString as k, isRenderInstruction as l, maybeRenderHead as m, clientLocalsSymbol as n, clientAddressSymbol as o, renderPage as p, REWRITE_DIRECTIVE_HEADER_KEY as q, renderTemplate as r, spreadAttributes as s, REWRITE_DIRECTIVE_HEADER_VALUE as t, unescapeHTML as u, renderEndpoint as v, responseSentSymbol as w, REROUTABLE_STATUS_CODES as x }; diff --git a/.vercel/output/functions/_render.func/home/vic/src/web/portfolio/.vercel/output/_functions/entry.mjs b/.vercel/output/functions/_render.func/home/vic/src/web/portfolio/.vercel/output/_functions/entry.mjs new file mode 100644 index 0000000..f1f5af4 --- /dev/null +++ b/.vercel/output/functions/_render.func/home/vic/src/web/portfolio/.vercel/output/_functions/entry.mjs @@ -0,0 +1,2560 @@ +import { renderers } from './renderers.mjs'; +import { l as levels, g as getEventPrefix, e as ensure404Route, d as default404Instance, D as DEFAULT_404_ROUTE, L as Logger, A as AstroIntegrationLogger, m as manifest } from './chunks/_@astrojs-manifest_BchT3v_p.mjs'; +import { A as AstroError, q as i18nNoLocaleFoundInPath, s as appendForwardSlash, t as joinPaths, R as ResponseSentError, u as MiddlewareNoDataOrNextCalled, v as MiddlewareNotAResponse, G as GetStaticPathsRequired, w as InvalidGetStaticPathsReturn, x as InvalidGetStaticPathsEntry, y as GetStaticPathsExpectedParams, z as GetStaticPathsInvalidRouteParam, B as trimSlashes, P as PageNumberParamNotFound, C as NoMatchingStaticPathFound, H as PrerenderDynamicEndpointPathCollide, J as ReservedSlotName, L as LocalsNotAnObject, K as PrerenderClientAddressNotAvailable, Q as ClientAddressNotAvailable, S as StaticClientAddressNotAvailable, T as RewriteWithBodyUsed, U as AstroResponseHeadersReassigned, V as fileExtension, W as slash, X as prependForwardSlash, Y as removeTrailingForwardSlash } from './chunks/astro/assets-service_DK7A0Y1H.mjs'; +import { R as ROUTE_TYPE_HEADER, g as REROUTE_DIRECTIVE_HEADER, h as createSlotValueFromString, r as renderTemplate, a as renderComponent, D as DEFAULT_404_COMPONENT, i as renderSlotToString, j as renderJSX, k as chunkToString, l as isRenderInstruction, n as clientLocalsSymbol, o as clientAddressSymbol$1, p as renderPage, q as REWRITE_DIRECTIVE_HEADER_KEY, t as REWRITE_DIRECTIVE_HEADER_VALUE, v as renderEndpoint, A as ASTRO_VERSION, w as responseSentSymbol$1, x as REROUTABLE_STATUS_CODES } from './chunks/astro/server_mfaSpNA7.mjs'; +import { serialize, parse } from 'cookie'; +import 'clsx'; +import 'kleur/colors'; +import 'fast-glob'; +import nodePath from 'node:path'; +import buffer from 'node:buffer'; +import crypto$1 from 'node:crypto'; +import { onRequest } from './_noop-middleware.mjs'; + +function shouldAppendForwardSlash(trailingSlash, buildFormat) { + switch (trailingSlash) { + case "always": + return true; + case "never": + return false; + case "ignore": { + switch (buildFormat) { + case "directory": + return true; + case "preserve": + case "file": + return false; + } + } + } +} + +function createI18nMiddleware(i18n, base, trailingSlash, format) { + if (!i18n) return (_, next) => next(); + const payload = { + ...i18n, + trailingSlash, + base, + format, + domains: {} + }; + const _redirectToDefaultLocale = redirectToDefaultLocale(payload); + const _noFoundForNonLocaleRoute = notFound(payload); + const _requestHasLocale = requestHasLocale(payload.locales); + const _redirectToFallback = redirectToFallback(payload); + const prefixAlways = (context) => { + const url = context.url; + if (url.pathname === base + "/" || url.pathname === base) { + return _redirectToDefaultLocale(context); + } else if (!_requestHasLocale(context)) { + return _noFoundForNonLocaleRoute(context); + } + return void 0; + }; + const prefixOtherLocales = (context, response) => { + let pathnameContainsDefaultLocale = false; + const url = context.url; + for (const segment of url.pathname.split("/")) { + if (normalizeTheLocale(segment) === normalizeTheLocale(i18n.defaultLocale)) { + pathnameContainsDefaultLocale = true; + break; + } + } + if (pathnameContainsDefaultLocale) { + const newLocation = url.pathname.replace(`/${i18n.defaultLocale}`, ""); + response.headers.set("Location", newLocation); + return _noFoundForNonLocaleRoute(context); + } + return void 0; + }; + return async (context, next) => { + const response = await next(); + const type = response.headers.get(ROUTE_TYPE_HEADER); + if (type !== "page" && type !== "fallback") { + return response; + } + if (requestIs404Or500(context.request, base)) { + return response; + } + const { currentLocale } = context; + switch (i18n.strategy) { + case "manual": { + return response; + } + case "domains-prefix-other-locales": { + if (localeHasntDomain(i18n, currentLocale)) { + const result = prefixOtherLocales(context, response); + if (result) { + return result; + } + } + break; + } + case "pathname-prefix-other-locales": { + const result = prefixOtherLocales(context, response); + if (result) { + return result; + } + break; + } + case "domains-prefix-always-no-redirect": { + if (localeHasntDomain(i18n, currentLocale)) { + const result = _noFoundForNonLocaleRoute(context, response); + if (result) { + return result; + } + } + break; + } + case "pathname-prefix-always-no-redirect": { + const result = _noFoundForNonLocaleRoute(context, response); + if (result) { + return result; + } + break; + } + case "pathname-prefix-always": { + const result = prefixAlways(context); + if (result) { + return result; + } + break; + } + case "domains-prefix-always": { + if (localeHasntDomain(i18n, currentLocale)) { + const result = prefixAlways(context); + if (result) { + return result; + } + } + break; + } + } + return _redirectToFallback(context, response); + }; +} +function localeHasntDomain(i18n, currentLocale) { + for (const domainLocale of Object.values(i18n.domainLookupTable)) { + if (domainLocale === currentLocale) { + return false; + } + } + return true; +} + +function requestHasLocale(locales) { + return function(context) { + return pathHasLocale(context.url.pathname, locales); + }; +} +function requestIs404Or500(request, base = "") { + const url = new URL(request.url); + return url.pathname.startsWith(`${base}/404`) || url.pathname.startsWith(`${base}/500`); +} +function pathHasLocale(path, locales) { + const segments = path.split("/"); + for (const segment of segments) { + for (const locale of locales) { + if (typeof locale === "string") { + if (normalizeTheLocale(segment) === normalizeTheLocale(locale)) { + return true; + } + } else if (segment === locale.path) { + return true; + } + } + } + return false; +} +function getPathByLocale(locale, locales) { + for (const loopLocale of locales) { + if (typeof loopLocale === "string") { + if (loopLocale === locale) { + return loopLocale; + } + } else { + for (const code of loopLocale.codes) { + if (code === locale) { + return loopLocale.path; + } + } + } + } + throw new AstroError(i18nNoLocaleFoundInPath); +} +function normalizeTheLocale(locale) { + return locale.replaceAll("_", "-").toLowerCase(); +} +function toCodes(locales) { + return locales.map((loopLocale) => { + if (typeof loopLocale === "string") { + return loopLocale; + } else { + return loopLocale.codes[0]; + } + }); +} +function redirectToDefaultLocale({ + trailingSlash, + format, + base, + defaultLocale +}) { + return function(context, statusCode) { + if (shouldAppendForwardSlash(trailingSlash, format)) { + return context.redirect(`${appendForwardSlash(joinPaths(base, defaultLocale))}`, statusCode); + } else { + return context.redirect(`${joinPaths(base, defaultLocale)}`, statusCode); + } + }; +} +function notFound({ base, locales }) { + return function(context, response) { + if (response?.headers.get(REROUTE_DIRECTIVE_HEADER) === "no") return response; + const url = context.url; + const isRoot = url.pathname === base + "/" || url.pathname === base; + if (!(isRoot || pathHasLocale(url.pathname, locales))) { + if (response) { + response.headers.set(REROUTE_DIRECTIVE_HEADER, "no"); + return new Response(response.body, { + status: 404, + headers: response.headers + }); + } else { + return new Response(null, { + status: 404, + headers: { + [REROUTE_DIRECTIVE_HEADER]: "no" + } + }); + } + } + return void 0; + }; +} +function redirectToFallback({ + fallback, + locales, + defaultLocale, + strategy, + base +}) { + return function(context, response) { + if (response.status >= 300 && fallback) { + const fallbackKeys = fallback ? Object.keys(fallback) : []; + const segments = context.url.pathname.split("/"); + const urlLocale = segments.find((segment) => { + for (const locale of locales) { + if (typeof locale === "string") { + if (locale === segment) { + return true; + } + } else if (locale.path === segment) { + return true; + } + } + return false; + }); + if (urlLocale && fallbackKeys.includes(urlLocale)) { + const fallbackLocale = fallback[urlLocale]; + const pathFallbackLocale = getPathByLocale(fallbackLocale, locales); + let newPathname; + if (pathFallbackLocale === defaultLocale && strategy === "pathname-prefix-other-locales") { + if (context.url.pathname.includes(`${base}`)) { + newPathname = context.url.pathname.replace(`/${urlLocale}`, ``); + } else { + newPathname = context.url.pathname.replace(`/${urlLocale}`, `/`); + } + } else { + newPathname = context.url.pathname.replace(`/${urlLocale}`, `/${pathFallbackLocale}`); + } + return context.redirect(newPathname); + } + } + return response; + }; +} + +const DELETED_EXPIRATION = /* @__PURE__ */ new Date(0); +const DELETED_VALUE = "deleted"; +const responseSentSymbol = Symbol.for("astro.responseSent"); +class AstroCookie { + constructor(value) { + this.value = value; + } + json() { + if (this.value === void 0) { + throw new Error(`Cannot convert undefined to an object.`); + } + return JSON.parse(this.value); + } + number() { + return Number(this.value); + } + boolean() { + if (this.value === "false") return false; + if (this.value === "0") return false; + return Boolean(this.value); + } +} +class AstroCookies { + #request; + #requestValues; + #outgoing; + #consumed; + constructor(request) { + this.#request = request; + this.#requestValues = null; + this.#outgoing = null; + this.#consumed = false; + } + /** + * Astro.cookies.delete(key) is used to delete a cookie. Using this method will result + * in a Set-Cookie header added to the response. + * @param key The cookie to delete + * @param options Options related to this deletion, such as the path of the cookie. + */ + delete(key, options) { + const { + // @ts-expect-error + maxAge: _ignoredMaxAge, + // @ts-expect-error + expires: _ignoredExpires, + ...sanitizedOptions + } = options || {}; + const serializeOptions = { + expires: DELETED_EXPIRATION, + ...sanitizedOptions + }; + this.#ensureOutgoingMap().set(key, [ + DELETED_VALUE, + serialize(key, DELETED_VALUE, serializeOptions), + false + ]); + } + /** + * Astro.cookies.get(key) is used to get a cookie value. The cookie value is read from the + * request. If you have set a cookie via Astro.cookies.set(key, value), the value will be taken + * from that set call, overriding any values already part of the request. + * @param key The cookie to get. + * @returns An object containing the cookie value as well as convenience methods for converting its value. + */ + get(key, options = void 0) { + if (this.#outgoing?.has(key)) { + let [serializedValue, , isSetValue] = this.#outgoing.get(key); + if (isSetValue) { + return new AstroCookie(serializedValue); + } else { + return void 0; + } + } + const values = this.#ensureParsed(options); + if (key in values) { + const value = values[key]; + return new AstroCookie(value); + } + } + /** + * Astro.cookies.has(key) returns a boolean indicating whether this cookie is either + * part of the initial request or set via Astro.cookies.set(key) + * @param key The cookie to check for. + * @returns + */ + has(key, options = void 0) { + if (this.#outgoing?.has(key)) { + let [, , isSetValue] = this.#outgoing.get(key); + return isSetValue; + } + const values = this.#ensureParsed(options); + return !!values[key]; + } + /** + * Astro.cookies.set(key, value) is used to set a cookie's value. If provided + * an object it will be stringified via JSON.stringify(value). Additionally you + * can provide options customizing how this cookie will be set, such as setting httpOnly + * in order to prevent the cookie from being read in client-side JavaScript. + * @param key The name of the cookie to set. + * @param value A value, either a string or other primitive or an object. + * @param options Options for the cookie, such as the path and security settings. + */ + set(key, value, options) { + if (this.#consumed) { + const warning = new Error( + "Astro.cookies.set() was called after the cookies had already been sent to the browser.\nThis may have happened if this method was called in an imported component.\nPlease make sure that Astro.cookies.set() is only called in the frontmatter of the main page." + ); + warning.name = "Warning"; + console.warn(warning); + } + let serializedValue; + if (typeof value === "string") { + serializedValue = value; + } else { + let toStringValue = value.toString(); + if (toStringValue === Object.prototype.toString.call(value)) { + serializedValue = JSON.stringify(value); + } else { + serializedValue = toStringValue; + } + } + const serializeOptions = {}; + if (options) { + Object.assign(serializeOptions, options); + } + this.#ensureOutgoingMap().set(key, [ + serializedValue, + serialize(key, serializedValue, serializeOptions), + true + ]); + if (this.#request[responseSentSymbol]) { + throw new AstroError({ + ...ResponseSentError + }); + } + } + /** + * Merges a new AstroCookies instance into the current instance. Any new cookies + * will be added to the current instance, overwriting any existing cookies with the same name. + */ + merge(cookies) { + const outgoing = cookies.#outgoing; + if (outgoing) { + for (const [key, value] of outgoing) { + this.#ensureOutgoingMap().set(key, value); + } + } + } + /** + * Astro.cookies.header() returns an iterator for the cookies that have previously + * been set by either Astro.cookies.set() or Astro.cookies.delete(). + * This method is primarily used by adapters to set the header on outgoing responses. + * @returns + */ + *headers() { + if (this.#outgoing == null) return; + for (const [, value] of this.#outgoing) { + yield value[1]; + } + } + /** + * Behaves the same as AstroCookies.prototype.headers(), + * but allows a warning when cookies are set after the instance is consumed. + */ + static consume(cookies) { + cookies.#consumed = true; + return cookies.headers(); + } + #ensureParsed(options = void 0) { + if (!this.#requestValues) { + this.#parse(options); + } + if (!this.#requestValues) { + this.#requestValues = {}; + } + return this.#requestValues; + } + #ensureOutgoingMap() { + if (!this.#outgoing) { + this.#outgoing = /* @__PURE__ */ new Map(); + } + return this.#outgoing; + } + #parse(options = void 0) { + const raw = this.#request.headers.get("cookie"); + if (!raw) { + return; + } + this.#requestValues = parse(raw, options); + } +} + +const astroCookiesSymbol = Symbol.for("astro.cookies"); +function attachCookiesToResponse(response, cookies) { + Reflect.set(response, astroCookiesSymbol, cookies); +} +function getCookiesFromResponse(response) { + let cookies = Reflect.get(response, astroCookiesSymbol); + if (cookies != null) { + return cookies; + } else { + return void 0; + } +} +function* getSetCookiesFromResponse(response) { + const cookies = getCookiesFromResponse(response); + if (!cookies) { + return []; + } + for (const headerValue of AstroCookies.consume(cookies)) { + yield headerValue; + } + return []; +} + +const consoleLogDestination = { + write(event) { + let dest = console.error; + if (levels[event.level] < levels["error"]) { + dest = console.log; + } + if (event.label === "SKIP_FORMAT") { + dest(event.message); + } else { + dest(getEventPrefix(event) + " " + event.message); + } + return true; + } +}; + +function hasActionsInternal(locals) { + return "_actionsInternal" in locals; +} +function createGetActionResult(locals) { + return (actionFn) => { + if (!hasActionsInternal(locals)) + throw new AstroError({ + name: "AstroActionError", + message: "Experimental actions are not enabled in your project.", + hint: "See https://docs.astro.build/en/reference/configuration-reference/#experimental-flags" + }); + return locals._actionsInternal.getActionResult(actionFn); + }; +} + +function parseLocale(header) { + if (header === "*") { + return [{ locale: header, qualityValue: void 0 }]; + } + const result = []; + const localeValues = header.split(",").map((str) => str.trim()); + for (const localeValue of localeValues) { + const split = localeValue.split(";").map((str) => str.trim()); + const localeName = split[0]; + const qualityValue = split[1]; + if (!split) { + continue; + } + if (qualityValue && qualityValue.startsWith("q=")) { + const qualityValueAsFloat = Number.parseFloat(qualityValue.slice("q=".length)); + if (Number.isNaN(qualityValueAsFloat) || qualityValueAsFloat > 1) { + result.push({ + locale: localeName, + qualityValue: void 0 + }); + } else { + result.push({ + locale: localeName, + qualityValue: qualityValueAsFloat + }); + } + } else { + result.push({ + locale: localeName, + qualityValue: void 0 + }); + } + } + return result; +} +function sortAndFilterLocales(browserLocaleList, locales) { + const normalizedLocales = toCodes(locales).map(normalizeTheLocale); + return browserLocaleList.filter((browserLocale) => { + if (browserLocale.locale !== "*") { + return normalizedLocales.includes(normalizeTheLocale(browserLocale.locale)); + } + return true; + }).sort((a, b) => { + if (a.qualityValue && b.qualityValue) { + return Math.sign(b.qualityValue - a.qualityValue); + } + return 0; + }); +} +function computePreferredLocale(request, locales) { + const acceptHeader = request.headers.get("Accept-Language"); + let result = void 0; + if (acceptHeader) { + const browserLocaleList = sortAndFilterLocales(parseLocale(acceptHeader), locales); + const firstResult = browserLocaleList.at(0); + if (firstResult && firstResult.locale !== "*") { + for (const currentLocale of locales) { + if (typeof currentLocale === "string") { + if (normalizeTheLocale(currentLocale) === normalizeTheLocale(firstResult.locale)) { + result = currentLocale; + } + } else { + for (const currentCode of currentLocale.codes) { + if (normalizeTheLocale(currentCode) === normalizeTheLocale(firstResult.locale)) { + result = currentLocale.path; + } + } + } + } + } + } + return result; +} +function computePreferredLocaleList(request, locales) { + const acceptHeader = request.headers.get("Accept-Language"); + let result = []; + if (acceptHeader) { + const browserLocaleList = sortAndFilterLocales(parseLocale(acceptHeader), locales); + if (browserLocaleList.length === 1 && browserLocaleList.at(0).locale === "*") { + return locales.map((locale) => { + if (typeof locale === "string") { + return locale; + } else { + return locale.codes.at(0); + } + }); + } else if (browserLocaleList.length > 0) { + for (const browserLocale of browserLocaleList) { + for (const loopLocale of locales) { + if (typeof loopLocale === "string") { + if (normalizeTheLocale(loopLocale) === normalizeTheLocale(browserLocale.locale)) { + result.push(loopLocale); + } + } else { + for (const code of loopLocale.codes) { + if (code === browserLocale.locale) { + result.push(loopLocale.path); + } + } + } + } + } + } + } + return result; +} +function computeCurrentLocale(pathname, locales) { + for (const segment of pathname.split("/")) { + for (const locale of locales) { + if (typeof locale === "string") { + if (!segment.includes(locale)) continue; + if (normalizeTheLocale(locale) === normalizeTheLocale(segment)) { + return locale; + } + } else { + if (locale.path === segment) { + return locale.codes.at(0); + } else { + for (const code of locale.codes) { + if (normalizeTheLocale(code) === normalizeTheLocale(segment)) { + return code; + } + } + } + } + } + } +} + +function sequence(...handlers) { + const filtered = handlers.filter((h) => !!h); + const length = filtered.length; + if (!length) { + return defineMiddleware((_context, next) => { + return next(); + }); + } + return defineMiddleware((context, next) => { + let carriedPayload = void 0; + return applyHandle(0, context); + function applyHandle(i, handleContext) { + const handle = filtered[i]; + const result = handle(handleContext, async (payload) => { + if (i < length - 1) { + if (payload) { + let newRequest; + if (payload instanceof Request) { + newRequest = payload; + } else if (payload instanceof URL) { + newRequest = new Request(payload, handleContext.request); + } else { + newRequest = new Request( + new URL(payload, handleContext.url.origin), + handleContext.request + ); + } + carriedPayload = payload; + handleContext.request = newRequest; + handleContext.url = new URL(newRequest.url); + handleContext.cookies = new AstroCookies(newRequest); + } + return applyHandle(i + 1, handleContext); + } else { + return next(payload ?? carriedPayload); + } + }); + return result; + } + }); +} + +function defineMiddleware(fn) { + return fn; +} + +async function callMiddleware(onRequest, apiContext, responseFunction, enableRerouting, logger) { + let nextCalled = false; + let responseFunctionPromise = void 0; + const next = async (payload) => { + nextCalled = true; + if (enableRerouting) { + responseFunctionPromise = responseFunction(apiContext, payload); + } else { + if (payload) { + logger.warn( + "router", + "The rewrite API is experimental. To use this feature, add the `rewriting` flag to the `experimental` object in your Astro config." + ); + } + responseFunctionPromise = responseFunction(apiContext); + } + return responseFunctionPromise; + }; + let middlewarePromise = onRequest(apiContext, next); + return await Promise.resolve(middlewarePromise).then(async (value) => { + if (nextCalled) { + if (typeof value !== "undefined") { + if (value instanceof Response === false) { + throw new AstroError(MiddlewareNotAResponse); + } + return value; + } else { + if (responseFunctionPromise) { + return responseFunctionPromise; + } else { + throw new AstroError(MiddlewareNotAResponse); + } + } + } else if (typeof value === "undefined") { + throw new AstroError(MiddlewareNoDataOrNextCalled); + } else if (value instanceof Response === false) { + throw new AstroError(MiddlewareNotAResponse); + } else { + return value; + } + }); +} + +async function renderRedirect(renderContext) { + const { + request: { method }, + routeData + } = renderContext; + const { redirect, redirectRoute } = routeData; + const status = redirectRoute && typeof redirect === "object" ? redirect.status : method === "GET" ? 301 : 308; + const headers = { location: encodeURI(redirectRouteGenerate(renderContext)) }; + return new Response(null, { status, headers }); +} +function redirectRouteGenerate(renderContext) { + const { + params, + routeData: { redirect, redirectRoute } + } = renderContext; + if (typeof redirectRoute !== "undefined") { + return redirectRoute?.generate(params) || redirectRoute?.pathname || "/"; + } else if (typeof redirect === "string") { + let target = redirect; + for (const param of Object.keys(params)) { + const paramValue = params[param]; + target = target.replace(`[${param}]`, paramValue).replace(`[...${param}]`, paramValue); + } + return target; + } else if (typeof redirect === "undefined") { + return "/"; + } + return redirect.destination; +} + +const VALID_PARAM_TYPES = ["string", "number", "undefined"]; +function validateGetStaticPathsParameter([key, value], route) { + if (!VALID_PARAM_TYPES.includes(typeof value)) { + throw new AstroError({ + ...GetStaticPathsInvalidRouteParam, + message: GetStaticPathsInvalidRouteParam.message(key, value, typeof value), + location: { + file: route + } + }); + } +} +function validateDynamicRouteModule(mod, { + ssr, + route +}) { + if ((!ssr || route.prerender) && !mod.getStaticPaths) { + throw new AstroError({ + ...GetStaticPathsRequired, + location: { file: route.component } + }); + } +} +function validateGetStaticPathsResult(result, logger, route) { + if (!Array.isArray(result)) { + throw new AstroError({ + ...InvalidGetStaticPathsReturn, + message: InvalidGetStaticPathsReturn.message(typeof result), + location: { + file: route.component + } + }); + } + result.forEach((pathObject) => { + if (typeof pathObject === "object" && Array.isArray(pathObject) || pathObject === null) { + throw new AstroError({ + ...InvalidGetStaticPathsEntry, + message: InvalidGetStaticPathsEntry.message( + Array.isArray(pathObject) ? "array" : typeof pathObject + ) + }); + } + if (pathObject.params === void 0 || pathObject.params === null || pathObject.params && Object.keys(pathObject.params).length === 0) { + throw new AstroError({ + ...GetStaticPathsExpectedParams, + location: { + file: route.component + } + }); + } + for (const [key, val] of Object.entries(pathObject.params)) { + if (!(typeof val === "undefined" || typeof val === "string" || typeof val === "number")) { + logger.warn( + "router", + `getStaticPaths() returned an invalid path param: "${key}". A string, number or undefined value was expected, but got \`${JSON.stringify( + val + )}\`.` + ); + } + if (typeof val === "string" && val === "") { + logger.warn( + "router", + `getStaticPaths() returned an invalid path param: "${key}". \`undefined\` expected for an optional param, but got empty string.` + ); + } + } + }); +} + +function stringifyParams(params, route) { + const validatedParams = Object.entries(params).reduce((acc, next) => { + validateGetStaticPathsParameter(next, route.component); + const [key, value] = next; + if (value !== void 0) { + acc[key] = typeof value === "string" ? trimSlashes(value) : value.toString(); + } + return acc; + }, {}); + return route.generate(validatedParams); +} + +function generatePaginateFunction(routeMatch) { + return function paginateUtility(data, args = {}) { + let { pageSize: _pageSize, params: _params, props: _props } = args; + const pageSize = _pageSize || 10; + const paramName = "page"; + const additionalParams = _params || {}; + const additionalProps = _props || {}; + let includesFirstPageNumber; + if (routeMatch.params.includes(`...${paramName}`)) { + includesFirstPageNumber = false; + } else if (routeMatch.params.includes(`${paramName}`)) { + includesFirstPageNumber = true; + } else { + throw new AstroError({ + ...PageNumberParamNotFound, + message: PageNumberParamNotFound.message(paramName) + }); + } + const lastPage = Math.max(1, Math.ceil(data.length / pageSize)); + const result = [...Array(lastPage).keys()].map((num) => { + const pageNum = num + 1; + const start = pageSize === Infinity ? 0 : (pageNum - 1) * pageSize; + const end = Math.min(start + pageSize, data.length); + const params = { + ...additionalParams, + [paramName]: includesFirstPageNumber || pageNum > 1 ? String(pageNum) : void 0 + }; + const current = correctIndexRoute(routeMatch.generate({ ...params })); + const next = pageNum === lastPage ? void 0 : correctIndexRoute(routeMatch.generate({ ...params, page: String(pageNum + 1) })); + const prev = pageNum === 1 ? void 0 : correctIndexRoute( + routeMatch.generate({ + ...params, + page: !includesFirstPageNumber && pageNum - 1 === 1 ? void 0 : String(pageNum - 1) + }) + ); + const first = pageNum === 1 ? void 0 : correctIndexRoute( + routeMatch.generate({ + ...params, + page: includesFirstPageNumber ? "1" : void 0 + }) + ); + const last = pageNum === lastPage ? void 0 : correctIndexRoute(routeMatch.generate({ ...params, page: String(lastPage) })); + return { + params, + props: { + ...additionalProps, + page: { + data: data.slice(start, end), + start, + end: end - 1, + size: pageSize, + total: data.length, + currentPage: pageNum, + lastPage, + url: { current, next, prev, first, last } + } + } + }; + }); + return result; + }; +} +function correctIndexRoute(route) { + if (route === "") { + return "/"; + } + return route; +} + +async function callGetStaticPaths({ + mod, + route, + routeCache, + logger, + ssr +}) { + const cached = routeCache.get(route); + if (!mod) { + throw new Error("This is an error caused by Astro and not your code. Please file an issue."); + } + if (cached?.staticPaths) { + return cached.staticPaths; + } + validateDynamicRouteModule(mod, { ssr, route }); + if (ssr && !route.prerender) { + const entry = Object.assign([], { keyed: /* @__PURE__ */ new Map() }); + routeCache.set(route, { ...cached, staticPaths: entry }); + return entry; + } + let staticPaths = []; + if (!mod.getStaticPaths) { + throw new Error("Unexpected Error."); + } + staticPaths = await mod.getStaticPaths({ + // Q: Why the cast? + // A: So users downstream can have nicer typings, we have to make some sacrifice in our internal typings, which necessitate a cast here + paginate: generatePaginateFunction(route) + }); + validateGetStaticPathsResult(staticPaths, logger, route); + const keyedStaticPaths = staticPaths; + keyedStaticPaths.keyed = /* @__PURE__ */ new Map(); + for (const sp of keyedStaticPaths) { + const paramsKey = stringifyParams(sp.params, route); + keyedStaticPaths.keyed.set(paramsKey, sp); + } + routeCache.set(route, { ...cached, staticPaths: keyedStaticPaths }); + return keyedStaticPaths; +} +class RouteCache { + logger; + cache = {}; + mode; + constructor(logger, mode = "production") { + this.logger = logger; + this.mode = mode; + } + /** Clear the cache. */ + clearAll() { + this.cache = {}; + } + set(route, entry) { + const key = this.key(route); + if (this.mode === "production" && this.cache[key]?.staticPaths) { + this.logger.warn(null, `Internal Warning: route cache overwritten. (${key})`); + } + this.cache[key] = entry; + } + get(route) { + return this.cache[this.key(route)]; + } + key(route) { + return `${route.route}_${route.component}`; + } +} +function findPathItemByKey(staticPaths, params, route, logger) { + const paramsKey = stringifyParams(params, route); + const matchedStaticPath = staticPaths.keyed.get(paramsKey); + if (matchedStaticPath) { + return matchedStaticPath; + } + logger.debug("router", `findPathItemByKey() - Unexpected cache miss looking for ${paramsKey}`); +} + +function getPattern(segments, base, addTrailingSlash) { + const pathname = segments.map((segment) => { + if (segment.length === 1 && segment[0].spread) { + return "(?:\\/(.*?))?"; + } else { + return "\\/" + segment.map((part) => { + if (part.spread) { + return "(.*?)"; + } else if (part.dynamic) { + return "([^/]+?)"; + } else { + return part.content.normalize().replace(/\?/g, "%3F").replace(/#/g, "%23").replace(/%5B/g, "[").replace(/%5D/g, "]").replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); + } + }).join(""); + } + }).join(""); + const trailing = addTrailingSlash && segments.length ? getTrailingSlashPattern(addTrailingSlash) : "$"; + let initial = "\\/"; + if (addTrailingSlash === "never" && base !== "/") { + initial = ""; + } + return new RegExp(`^${pathname || initial}${trailing}`); +} +function getTrailingSlashPattern(addTrailingSlash) { + if (addTrailingSlash === "always") { + return "\\/$"; + } + if (addTrailingSlash === "never") { + return "$"; + } + return "\\/?$"; +} + +const SERVER_ISLAND_ROUTE = "/_server-islands/[name]"; +const SERVER_ISLAND_COMPONENT = "_server-islands.astro"; +function getServerIslandRouteData(config) { + const segments = [ + [{ content: "_server-islands", dynamic: false, spread: false }], + [{ content: "name", dynamic: true, spread: false }] + ]; + const route = { + type: "page", + component: SERVER_ISLAND_COMPONENT, + generate: () => "", + params: ["name"], + segments, + pattern: getPattern(segments, config.base, config.trailingSlash), + prerender: false, + isIndex: false, + fallbackRoutes: [], + route: SERVER_ISLAND_ROUTE + }; + return route; +} +function ensureServerIslandRoute(config, routeManifest) { + if (routeManifest.routes.some((route) => route.route === "/_server-islands/[name]")) { + return; + } + routeManifest.routes.push(getServerIslandRouteData(config)); +} +function createEndpoint(manifest) { + const page = async (result) => { + const params = result.params; + const request = result.request; + const raw = await request.text(); + const data = JSON.parse(raw); + if (!params.name) { + return new Response(null, { + status: 400, + statusText: "Bad request" + }); + } + const componentId = params.name; + const imp = manifest.serverIslandMap?.get(componentId); + if (!imp) { + return new Response(null, { + status: 404, + statusText: "Not found" + }); + } + const props = data.props; + const componentModule = await imp(); + const Component = componentModule[data.componentExport]; + const slots = {}; + for (const prop in data.slots) { + slots[prop] = createSlotValueFromString(data.slots[prop]); + } + return renderTemplate`${renderComponent(result, "Component", Component, props, slots)}`; + }; + page.isAstroComponentFactory = true; + const instance = { + default: page, + partial: true + }; + return instance; +} + +function injectDefaultRoutes(ssrManifest, routeManifest) { + ensure404Route(routeManifest); + ensureServerIslandRoute(ssrManifest, routeManifest); + return routeManifest; +} +function createDefaultRoutes(manifest) { + const root = new URL(manifest.hrefRoot); + return [ + { + instance: default404Instance, + matchesComponent: (filePath) => filePath.href === new URL(DEFAULT_404_COMPONENT, root).href, + route: DEFAULT_404_ROUTE.route, + component: DEFAULT_404_COMPONENT + }, + { + instance: createEndpoint(manifest), + matchesComponent: (filePath) => filePath.href === new URL(SERVER_ISLAND_COMPONENT, root).href, + route: SERVER_ISLAND_ROUTE, + component: SERVER_ISLAND_COMPONENT + } + ]; +} + +class Pipeline { + constructor(logger, manifest, mode, renderers, resolve, serverLike, streaming, adapterName = manifest.adapterName, clientDirectives = manifest.clientDirectives, inlinedScripts = manifest.inlinedScripts, compressHTML = manifest.compressHTML, i18n = manifest.i18n, middleware = manifest.middleware, routeCache = new RouteCache(logger, mode), site = manifest.site ? new URL(manifest.site) : void 0, callSetGetEnv = true, defaultRoutes = createDefaultRoutes(manifest)) { + this.logger = logger; + this.manifest = manifest; + this.mode = mode; + this.renderers = renderers; + this.resolve = resolve; + this.serverLike = serverLike; + this.streaming = streaming; + this.adapterName = adapterName; + this.clientDirectives = clientDirectives; + this.inlinedScripts = inlinedScripts; + this.compressHTML = compressHTML; + this.i18n = i18n; + this.middleware = middleware; + this.routeCache = routeCache; + this.site = site; + this.callSetGetEnv = callSetGetEnv; + this.defaultRoutes = defaultRoutes; + this.internalMiddleware = []; + if (i18n?.strategy !== "manual") { + this.internalMiddleware.push( + createI18nMiddleware(i18n, manifest.base, manifest.trailingSlash, manifest.buildFormat) + ); + } + if (callSetGetEnv && manifest.experimentalEnvGetSecretEnabled) ; + } + internalMiddleware; +} + +function routeIsRedirect(route) { + return route?.type === "redirect"; +} +function routeIsFallback(route) { + return route?.type === "fallback"; +} + +const RedirectComponentInstance = { + default() { + return new Response(null, { + status: 301 + }); + } +}; +const RedirectSinglePageBuiltModule = { + page: () => Promise.resolve(RedirectComponentInstance), + onRequest: (_, next) => next(), + renderers: [] +}; + +async function getProps(opts) { + const { logger, mod, routeData: route, routeCache, pathname, serverLike } = opts; + if (!route || route.pathname) { + return {}; + } + if (routeIsRedirect(route) || routeIsFallback(route) || route.component === DEFAULT_404_COMPONENT) { + return {}; + } + const params = getParams(route, pathname); + if (mod) { + validatePrerenderEndpointCollision(route, mod, params); + } + const staticPaths = await callGetStaticPaths({ + mod, + route, + routeCache, + logger, + ssr: serverLike + }); + const matchedStaticPath = findPathItemByKey(staticPaths, params, route, logger); + if (!matchedStaticPath && (serverLike ? route.prerender : true)) { + throw new AstroError({ + ...NoMatchingStaticPathFound, + message: NoMatchingStaticPathFound.message(pathname), + hint: NoMatchingStaticPathFound.hint([route.component]) + }); + } + const props = matchedStaticPath?.props ? { ...matchedStaticPath.props } : {}; + return props; +} +function getParams(route, pathname) { + if (!route.params.length) return {}; + const paramsMatch = route.pattern.exec(decodeURIComponent(pathname)); + if (!paramsMatch) return {}; + const params = {}; + route.params.forEach((key, i) => { + if (key.startsWith("...")) { + params[key.slice(3)] = paramsMatch[i + 1] ? paramsMatch[i + 1] : void 0; + } else { + params[key] = paramsMatch[i + 1]; + } + }); + return params; +} +function validatePrerenderEndpointCollision(route, mod, params) { + if (route.type === "endpoint" && mod.getStaticPaths) { + const lastSegment = route.segments[route.segments.length - 1]; + const paramValues = Object.values(params); + const lastParam = paramValues[paramValues.length - 1]; + if (lastSegment.length === 1 && lastSegment[0].dynamic && lastParam === void 0) { + throw new AstroError({ + ...PrerenderDynamicEndpointPathCollide, + message: PrerenderDynamicEndpointPathCollide.message(route.route), + hint: PrerenderDynamicEndpointPathCollide.hint(route.component), + location: { + file: route.component + } + }); + } + } +} + +function getFunctionExpression(slot) { + if (!slot) return; + const expressions = slot?.expressions?.filter((e) => isRenderInstruction(e) === false); + if (expressions?.length !== 1) return; + return expressions[0]; +} +class Slots { + #result; + #slots; + #logger; + constructor(result, slots, logger) { + this.#result = result; + this.#slots = slots; + this.#logger = logger; + if (slots) { + for (const key of Object.keys(slots)) { + if (this[key] !== void 0) { + throw new AstroError({ + ...ReservedSlotName, + message: ReservedSlotName.message(key) + }); + } + Object.defineProperty(this, key, { + get() { + return true; + }, + enumerable: true + }); + } + } + } + has(name) { + if (!this.#slots) return false; + return Boolean(this.#slots[name]); + } + async render(name, args = []) { + if (!this.#slots || !this.has(name)) return; + const result = this.#result; + if (!Array.isArray(args)) { + this.#logger.warn( + null, + `Expected second parameter to be an array, received a ${typeof args}. If you're trying to pass an array as a single argument and getting unexpected results, make sure you're passing your array as a item of an array. Ex: Astro.slots.render('default', [["Hello", "World"]])` + ); + } else if (args.length > 0) { + const slotValue = this.#slots[name]; + const component = typeof slotValue === "function" ? await slotValue(result) : await slotValue; + const expression = getFunctionExpression(component); + if (expression) { + const slot = async () => typeof expression === "function" ? expression(...args) : expression; + return await renderSlotToString(result, slot).then((res) => { + return res; + }); + } + if (typeof component === "function") { + return await renderJSX(result, component(...args)).then( + (res) => res != null ? String(res) : res + ); + } + } + const content = await renderSlotToString(result, this.#slots[name]); + const outHTML = chunkToString(result, content); + return outHTML; + } +} + +class RenderContext { + constructor(pipeline, locals, middleware, pathname, request, routeData, status, cookies = new AstroCookies(request), params = getParams(routeData, pathname), url = new URL(request.url), props = {}) { + this.pipeline = pipeline; + this.locals = locals; + this.middleware = middleware; + this.pathname = pathname; + this.request = request; + this.routeData = routeData; + this.status = status; + this.cookies = cookies; + this.params = params; + this.url = url; + this.props = props; + this.originalRoute = routeData; + } + // The first route that this instance of the context attempts to render + originalRoute; + /** + * A flag that tells the render content if the rewriting was triggered + */ + isRewriting = false; + /** + * A safety net in case of loops + */ + counter = 0; + static create({ + locals = {}, + middleware, + pathname, + pipeline, + request, + routeData, + status = 200, + props + }) { + return new RenderContext( + pipeline, + locals, + sequence(...pipeline.internalMiddleware, middleware ?? pipeline.middleware), + pathname, + request, + routeData, + status, + void 0, + void 0, + void 0, + props + ); + } + /** + * The main function of the RenderContext. + * + * Use this function to render any route known to Astro. + * It attempts to render a route. A route can be a: + * + * - page + * - redirect + * - endpoint + * - fallback + */ + async render(componentInstance, slots = {}) { + const { cookies, middleware, pipeline } = this; + const { logger, serverLike, streaming } = pipeline; + const props = Object.keys(this.props).length > 0 ? this.props : await getProps({ + mod: componentInstance, + routeData: this.routeData, + routeCache: this.pipeline.routeCache, + pathname: this.pathname, + logger, + serverLike + }); + const apiContext = this.createAPIContext(props); + this.counter++; + if (this.counter === 4) { + return new Response("Loop Detected", { + // https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/508 + status: 508, + statusText: "Astro detected a loop where you tried to call the rewriting logic more than four times." + }); + } + const lastNext = async (ctx, payload) => { + if (payload) { + if (this.pipeline.manifest.rewritingEnabled) { + pipeline.logger.debug("router", "Called rewriting to:", payload); + const [routeData, component] = await pipeline.tryRewrite( + payload, + this.request, + this.originalRoute + ); + this.routeData = routeData; + componentInstance = component; + this.isRewriting = true; + this.status = 200; + } else { + this.pipeline.logger.error( + "router", + "The rewrite API is experimental. To use this feature, add the `rewriting` flag to the `experimental` object in your Astro config." + ); + } + } + let response2; + switch (this.routeData.type) { + case "endpoint": { + response2 = await renderEndpoint(componentInstance, ctx, serverLike, logger); + break; + } + case "redirect": + return renderRedirect(this); + case "page": { + const result = await this.createResult(componentInstance); + try { + response2 = await renderPage( + result, + componentInstance?.default, + props, + slots, + streaming, + this.routeData + ); + } catch (e) { + result.cancelled = true; + throw e; + } + response2.headers.set(ROUTE_TYPE_HEADER, "page"); + if (this.routeData.route === "/404" || this.routeData.route === "/500") { + response2.headers.set(REROUTE_DIRECTIVE_HEADER, "no"); + } + if (this.isRewriting) { + response2.headers.set(REWRITE_DIRECTIVE_HEADER_KEY, REWRITE_DIRECTIVE_HEADER_VALUE); + } + break; + } + case "fallback": { + return new Response(null, { status: 500, headers: { [ROUTE_TYPE_HEADER]: "fallback" } }); + } + } + const responseCookies = getCookiesFromResponse(response2); + if (responseCookies) { + cookies.merge(responseCookies); + } + return response2; + }; + const response = await callMiddleware( + middleware, + apiContext, + lastNext, + this.pipeline.manifest.rewritingEnabled, + this.pipeline.logger + ); + if (response.headers.get(ROUTE_TYPE_HEADER)) { + response.headers.delete(ROUTE_TYPE_HEADER); + } + attachCookiesToResponse(response, cookies); + return response; + } + createAPIContext(props) { + const context = this.createActionAPIContext(); + return Object.assign(context, { + props, + getActionResult: createGetActionResult(context.locals) + }); + } + async #executeRewrite(reroutePayload) { + this.pipeline.logger.debug("router", "Calling rewrite: ", reroutePayload); + if (!this.pipeline.manifest.rewritingEnabled) { + this.pipeline.logger.error( + "router", + "The rewrite API is experimental. To use this feature, add the `rewriting` flag to the `experimental` object in your Astro config." + ); + return new Response( + "The rewrite API is experimental. To use this feature, add the `rewriting` flag to the `experimental` object in your Astro config.", + { + status: 500, + statusText: "The rewrite API is experimental. To use this feature, add the `rewriting` flag to the `experimental` object in your Astro config." + } + ); + } + const [routeData, component, newURL] = await this.pipeline.tryRewrite( + reroutePayload, + this.request, + this.originalRoute + ); + this.routeData = routeData; + if (reroutePayload instanceof Request) { + this.request = reroutePayload; + } else { + this.request = this.#copyRequest(newURL, this.request); + } + this.url = new URL(this.request.url); + this.cookies = new AstroCookies(this.request); + this.params = getParams(routeData, this.url.pathname); + this.pathname = this.url.pathname; + this.isRewriting = true; + this.status = 200; + return await this.render(component); + } + createActionAPIContext() { + const renderContext = this; + const { cookies, params, pipeline, url } = this; + const generator = `Astro v${ASTRO_VERSION}`; + const redirect = (path, status = 302) => new Response(null, { status, headers: { Location: path } }); + const rewrite = async (reroutePayload) => { + return await this.#executeRewrite(reroutePayload); + }; + return { + cookies, + get clientAddress() { + return renderContext.clientAddress(); + }, + get currentLocale() { + return renderContext.computeCurrentLocale(); + }, + generator, + get locals() { + return renderContext.locals; + }, + // TODO(breaking): disallow replacing the locals object + set locals(val) { + if (typeof val !== "object") { + throw new AstroError(LocalsNotAnObject); + } else { + renderContext.locals = val; + Reflect.set(this.request, clientLocalsSymbol, val); + } + }, + params, + get preferredLocale() { + return renderContext.computePreferredLocale(); + }, + get preferredLocaleList() { + return renderContext.computePreferredLocaleList(); + }, + redirect, + rewrite, + request: this.request, + site: pipeline.site, + url + }; + } + async createResult(mod) { + const { cookies, pathname, pipeline, routeData, status } = this; + const { clientDirectives, inlinedScripts, compressHTML, manifest, renderers, resolve } = pipeline; + const { links, scripts, styles } = await pipeline.headElements(routeData); + const componentMetadata = await pipeline.componentMetadata(routeData) ?? manifest.componentMetadata; + const headers = new Headers({ "Content-Type": "text/html" }); + const partial = Boolean(mod.partial); + const response = { + status, + statusText: "OK", + get headers() { + return headers; + }, + // Disallow `Astro.response.headers = new Headers` + set headers(_) { + throw new AstroError(AstroResponseHeadersReassigned); + } + }; + const actionResult = hasActionsInternal(this.locals) ? this.locals._actionsInternal?.actionResult : void 0; + const result = { + cancelled: false, + clientDirectives, + inlinedScripts, + componentMetadata, + compressHTML, + cookies, + /** This function returns the `Astro` faux-global */ + createAstro: (astroGlobal, props, slots) => this.createAstro(result, astroGlobal, props, slots), + links, + params: this.params, + partial, + pathname, + renderers, + resolve, + response, + request: this.request, + scripts, + styles, + actionResult, + serverIslandNameMap: manifest.serverIslandNameMap ?? /* @__PURE__ */ new Map(), + _metadata: { + hasHydrationScript: false, + rendererSpecificHydrationScripts: /* @__PURE__ */ new Set(), + hasRenderedHead: false, + renderedScripts: /* @__PURE__ */ new Set(), + hasDirectives: /* @__PURE__ */ new Set(), + headInTree: false, + extraHead: [], + propagators: /* @__PURE__ */ new Set() + } + }; + return result; + } + #astroPagePartial; + /** + * The Astro global is sourced in 3 different phases: + * - **Static**: `.generator` and `.glob` is printed by the compiler, instantiated once per process per astro file + * - **Page-level**: `.request`, `.cookies`, `.locals` etc. These remain the same for the duration of the request. + * - **Component-level**: `.props`, `.slots`, and `.self` are unique to each _use_ of each component. + * + * The page level partial is used as the prototype of the user-visible `Astro` global object, which is instantiated once per use of a component. + */ + createAstro(result, astroStaticPartial, props, slotValues) { + let astroPagePartial; + if (this.isRewriting) { + astroPagePartial = this.#astroPagePartial = this.createAstroPagePartial( + result, + astroStaticPartial + ); + } else { + astroPagePartial = this.#astroPagePartial ??= this.createAstroPagePartial( + result, + astroStaticPartial + ); + } + const astroComponentPartial = { props, self: null }; + const Astro = Object.assign( + Object.create(astroPagePartial), + astroComponentPartial + ); + let _slots; + Object.defineProperty(Astro, "slots", { + get: () => { + if (!_slots) { + _slots = new Slots( + result, + slotValues, + this.pipeline.logger + ); + } + return _slots; + } + }); + return Astro; + } + createAstroPagePartial(result, astroStaticPartial) { + const renderContext = this; + const { cookies, locals, params, pipeline, url } = this; + const { response } = result; + const redirect = (path, status = 302) => { + if (this.request[responseSentSymbol$1]) { + throw new AstroError({ + ...ResponseSentError + }); + } + return new Response(null, { status, headers: { Location: path } }); + }; + const rewrite = async (reroutePayload) => { + return await this.#executeRewrite(reroutePayload); + }; + return { + generator: astroStaticPartial.generator, + glob: astroStaticPartial.glob, + cookies, + get clientAddress() { + return renderContext.clientAddress(); + }, + get currentLocale() { + return renderContext.computeCurrentLocale(); + }, + params, + get preferredLocale() { + return renderContext.computePreferredLocale(); + }, + get preferredLocaleList() { + return renderContext.computePreferredLocaleList(); + }, + locals, + redirect, + rewrite, + request: this.request, + getActionResult: createGetActionResult(locals), + response, + site: pipeline.site, + url + }; + } + clientAddress() { + const { pipeline, request } = this; + if (clientAddressSymbol$1 in request) { + return Reflect.get(request, clientAddressSymbol$1); + } + if (pipeline.serverLike) { + if (request.body === null) { + throw new AstroError(PrerenderClientAddressNotAvailable); + } + if (pipeline.adapterName) { + throw new AstroError({ + ...ClientAddressNotAvailable, + message: ClientAddressNotAvailable.message(pipeline.adapterName) + }); + } + } + throw new AstroError(StaticClientAddressNotAvailable); + } + /** + * API Context may be created multiple times per request, i18n data needs to be computed only once. + * So, it is computed and saved here on creation of the first APIContext and reused for later ones. + */ + #currentLocale; + computeCurrentLocale() { + const { + url, + pipeline: { i18n }, + routeData + } = this; + if (!i18n) return; + const { defaultLocale, locales, strategy } = i18n; + const fallbackTo = strategy === "pathname-prefix-other-locales" || strategy === "domains-prefix-other-locales" ? defaultLocale : void 0; + return this.#currentLocale ??= computeCurrentLocale(routeData.route, locales) ?? computeCurrentLocale(url.pathname, locales) ?? fallbackTo; + } + #preferredLocale; + computePreferredLocale() { + const { + pipeline: { i18n }, + request + } = this; + if (!i18n) return; + return this.#preferredLocale ??= computePreferredLocale(request, i18n.locales); + } + #preferredLocaleList; + computePreferredLocaleList() { + const { + pipeline: { i18n }, + request + } = this; + if (!i18n) return; + return this.#preferredLocaleList ??= computePreferredLocaleList(request, i18n.locales); + } + /** + * Utility function that creates a new `Request` with a new URL from an old `Request`. + * + * @param newUrl The new `URL` + * @param oldRequest The old `Request` + */ + #copyRequest(newUrl, oldRequest) { + if (oldRequest.bodyUsed) { + throw new AstroError(RewriteWithBodyUsed); + } + return new Request(newUrl, { + method: oldRequest.method, + headers: oldRequest.headers, + body: oldRequest.body, + referrer: oldRequest.referrer, + referrerPolicy: oldRequest.referrerPolicy, + mode: oldRequest.mode, + credentials: oldRequest.credentials, + cache: oldRequest.cache, + redirect: oldRequest.redirect, + integrity: oldRequest.integrity, + signal: oldRequest.signal, + keepalive: oldRequest.keepalive, + // https://fetch.spec.whatwg.org/#dom-request-duplex + // @ts-expect-error It isn't part of the types, but undici accepts it and it allows to carry over the body to a new request + duplex: "half" + }); + } +} + +function getAssetsPrefix(fileExtension, assetsPrefix) { + if (!assetsPrefix) return ""; + if (typeof assetsPrefix === "string") return assetsPrefix; + const dotLessFileExtension = fileExtension.slice(1); + if (assetsPrefix[dotLessFileExtension]) { + return assetsPrefix[dotLessFileExtension]; + } + return assetsPrefix.fallback; +} + +function createAssetLink(href, base, assetsPrefix) { + if (assetsPrefix) { + const pf = getAssetsPrefix(fileExtension(href), assetsPrefix); + return joinPaths(pf, slash(href)); + } else if (base) { + return prependForwardSlash(joinPaths(base, slash(href))); + } else { + return href; + } +} +function createStylesheetElement(stylesheet, base, assetsPrefix) { + if (stylesheet.type === "inline") { + return { + props: {}, + children: stylesheet.content + }; + } else { + return { + props: { + rel: "stylesheet", + href: createAssetLink(stylesheet.src, base, assetsPrefix) + }, + children: "" + }; + } +} +function createStylesheetElementSet(stylesheets, base, assetsPrefix) { + return new Set(stylesheets.map((s) => createStylesheetElement(s, base, assetsPrefix))); +} +function createModuleScriptElement(script, base, assetsPrefix) { + if (script.type === "external") { + return createModuleScriptElementWithSrc(script.value, base, assetsPrefix); + } else { + return { + props: { + type: "module" + }, + children: script.value + }; + } +} +function createModuleScriptElementWithSrc(src, base, assetsPrefix) { + return { + props: { + type: "module", + src: createAssetLink(src, base, assetsPrefix) + }, + children: "" + }; +} + +function matchRoute(pathname, manifest) { + const decodedPathname = decodeURI(pathname); + return manifest.routes.find((route) => { + return route.pattern.test(decodedPathname) || route.fallbackRoutes.some((fallbackRoute) => fallbackRoute.pattern.test(decodedPathname)); + }); +} + +const FORM_CONTENT_TYPES = [ + "application/x-www-form-urlencoded", + "multipart/form-data", + "text/plain" +]; +function createOriginCheckMiddleware() { + return defineMiddleware((context, next) => { + const { request, url } = context; + const contentType = request.headers.get("content-type"); + if (contentType) { + if (FORM_CONTENT_TYPES.includes(contentType.toLowerCase())) { + const forbidden = (request.method === "POST" || request.method === "PUT" || request.method === "PATCH" || request.method === "DELETE") && request.headers.get("origin") !== url.origin; + if (forbidden) { + return new Response(`Cross-site ${request.method} form submissions are forbidden`, { + status: 403 + }); + } + } + } + return next(); + }); +} + +function findRouteToRewrite({ + payload, + routes, + request, + trailingSlash, + buildFormat, + base +}) { + let finalUrl = void 0; + if (payload instanceof URL) { + finalUrl = payload; + } else if (payload instanceof Request) { + finalUrl = new URL(payload.url); + } else { + finalUrl = new URL(payload, new URL(request.url).origin); + } + let foundRoute; + for (const route of routes) { + const pathname = shouldAppendForwardSlash(trailingSlash, buildFormat) ? appendForwardSlash(finalUrl.pathname) : base !== "/" ? removeTrailingForwardSlash(finalUrl.pathname) : finalUrl.pathname; + if (route.pattern.test(decodeURI(pathname))) { + foundRoute = route; + break; + } + } + if (foundRoute) { + return [foundRoute, finalUrl]; + } else { + const custom404 = routes.find((route) => route.route === "/404"); + if (custom404) { + return [custom404, finalUrl]; + } else { + return [DEFAULT_404_ROUTE, finalUrl]; + } + } +} + +class AppPipeline extends Pipeline { + #manifestData; + static create(manifestData, { + logger, + manifest, + mode, + renderers, + resolve, + serverLike, + streaming, + defaultRoutes + }) { + const pipeline = new AppPipeline( + logger, + manifest, + mode, + renderers, + resolve, + serverLike, + streaming, + void 0, + void 0, + void 0, + void 0, + void 0, + void 0, + void 0, + void 0, + false, + defaultRoutes + ); + pipeline.#manifestData = manifestData; + return pipeline; + } + headElements(routeData) { + const routeInfo = this.manifest.routes.find((route) => route.routeData === routeData); + const links = /* @__PURE__ */ new Set(); + const scripts = /* @__PURE__ */ new Set(); + const styles = createStylesheetElementSet(routeInfo?.styles ?? []); + for (const script of routeInfo?.scripts ?? []) { + if ("stage" in script) { + if (script.stage === "head-inline") { + scripts.add({ + props: {}, + children: script.children + }); + } + } else { + scripts.add(createModuleScriptElement(script)); + } + } + return { links, styles, scripts }; + } + componentMetadata() { + } + async getComponentByRoute(routeData) { + const module = await this.getModuleForRoute(routeData); + return module.page(); + } + async tryRewrite(payload, request, _sourceRoute) { + const [foundRoute, finalUrl] = findRouteToRewrite({ + payload, + request, + routes: this.manifest?.routes.map((r) => r.routeData), + trailingSlash: this.manifest.trailingSlash, + buildFormat: this.manifest.buildFormat, + base: this.manifest.base + }); + const componentInstance = await this.getComponentByRoute(foundRoute); + return [foundRoute, componentInstance, finalUrl]; + } + async getModuleForRoute(route) { + for (const defaultRoute of this.defaultRoutes) { + if (route.component === defaultRoute.component) { + return { + page: () => Promise.resolve(defaultRoute.instance), + renderers: [] + }; + } + } + if (route.type === "redirect") { + return RedirectSinglePageBuiltModule; + } else { + if (this.manifest.pageMap) { + const importComponentInstance = this.manifest.pageMap.get(route.component); + if (!importComponentInstance) { + throw new Error( + `Unexpectedly unable to find a component instance for route ${route.route}` + ); + } + return await importComponentInstance(); + } else if (this.manifest.pageModule) { + return this.manifest.pageModule; + } + throw new Error( + "Astro couldn't find the correct page to render, probably because it wasn't correctly mapped for SSR usage. This is an internal error, please file an issue." + ); + } + } +} + +class App { + #manifest; + #manifestData; + #logger = new Logger({ + dest: consoleLogDestination, + level: "info" + }); + #baseWithoutTrailingSlash; + #pipeline; + #adapterLogger; + #renderOptionsDeprecationWarningShown = false; + constructor(manifest, streaming = true) { + this.#manifest = manifest; + this.#manifestData = injectDefaultRoutes(manifest, { + routes: manifest.routes.map((route) => route.routeData) + }); + this.#baseWithoutTrailingSlash = removeTrailingForwardSlash(this.#manifest.base); + this.#pipeline = this.#createPipeline(this.#manifestData, streaming); + this.#adapterLogger = new AstroIntegrationLogger( + this.#logger.options, + this.#manifest.adapterName + ); + } + getAdapterLogger() { + return this.#adapterLogger; + } + /** + * Creates a pipeline by reading the stored manifest + * + * @param manifestData + * @param streaming + * @private + */ + #createPipeline(manifestData, streaming = false) { + if (this.#manifest.checkOrigin) { + this.#manifest.middleware = sequence( + createOriginCheckMiddleware(), + this.#manifest.middleware + ); + } + return AppPipeline.create(manifestData, { + logger: this.#logger, + manifest: this.#manifest, + mode: "production", + renderers: this.#manifest.renderers, + defaultRoutes: createDefaultRoutes(this.#manifest), + resolve: async (specifier) => { + if (!(specifier in this.#manifest.entryModules)) { + throw new Error(`Unable to resolve [${specifier}]`); + } + const bundlePath = this.#manifest.entryModules[specifier]; + switch (true) { + case bundlePath.startsWith("data:"): + case bundlePath.length === 0: { + return bundlePath; + } + default: { + return createAssetLink(bundlePath, this.#manifest.base, this.#manifest.assetsPrefix); + } + } + }, + serverLike: true, + streaming + }); + } + set setManifestData(newManifestData) { + this.#manifestData = newManifestData; + } + removeBase(pathname) { + if (pathname.startsWith(this.#manifest.base)) { + return pathname.slice(this.#baseWithoutTrailingSlash.length + 1); + } + return pathname; + } + #getPathnameFromRequest(request) { + const url = new URL(request.url); + const pathname = prependForwardSlash(this.removeBase(url.pathname)); + return pathname; + } + match(request) { + const url = new URL(request.url); + if (this.#manifest.assets.has(url.pathname)) return void 0; + let pathname = this.#computePathnameFromDomain(request); + if (!pathname) { + pathname = prependForwardSlash(this.removeBase(url.pathname)); + } + let routeData = matchRoute(pathname, this.#manifestData); + if (!routeData || routeData.prerender) return void 0; + return routeData; + } + #computePathnameFromDomain(request) { + let pathname = void 0; + const url = new URL(request.url); + if (this.#manifest.i18n && (this.#manifest.i18n.strategy === "domains-prefix-always" || this.#manifest.i18n.strategy === "domains-prefix-other-locales" || this.#manifest.i18n.strategy === "domains-prefix-always-no-redirect")) { + let host = request.headers.get("X-Forwarded-Host"); + let protocol = request.headers.get("X-Forwarded-Proto"); + if (protocol) { + protocol = protocol + ":"; + } else { + protocol = url.protocol; + } + if (!host) { + host = request.headers.get("Host"); + } + if (host && protocol) { + host = host.split(":")[0]; + try { + let locale; + const hostAsUrl = new URL(`${protocol}//${host}`); + for (const [domainKey, localeValue] of Object.entries( + this.#manifest.i18n.domainLookupTable + )) { + const domainKeyAsUrl = new URL(domainKey); + if (hostAsUrl.host === domainKeyAsUrl.host && hostAsUrl.protocol === domainKeyAsUrl.protocol) { + locale = localeValue; + break; + } + } + if (locale) { + pathname = prependForwardSlash( + joinPaths(normalizeTheLocale(locale), this.removeBase(url.pathname)) + ); + if (url.pathname.endsWith("/")) { + pathname = appendForwardSlash(pathname); + } + } + } catch (e) { + this.#logger.error( + "router", + `Astro tried to parse ${protocol}//${host} as an URL, but it threw a parsing error. Check the X-Forwarded-Host and X-Forwarded-Proto headers.` + ); + this.#logger.error("router", `Error: ${e}`); + } + } + } + return pathname; + } + async render(request, routeDataOrOptions, maybeLocals) { + let routeData; + let locals; + let clientAddress; + let addCookieHeader; + if (routeDataOrOptions && ("addCookieHeader" in routeDataOrOptions || "clientAddress" in routeDataOrOptions || "locals" in routeDataOrOptions || "routeData" in routeDataOrOptions)) { + if ("addCookieHeader" in routeDataOrOptions) { + addCookieHeader = routeDataOrOptions.addCookieHeader; + } + if ("clientAddress" in routeDataOrOptions) { + clientAddress = routeDataOrOptions.clientAddress; + } + if ("routeData" in routeDataOrOptions) { + routeData = routeDataOrOptions.routeData; + } + if ("locals" in routeDataOrOptions) { + locals = routeDataOrOptions.locals; + } + } else { + routeData = routeDataOrOptions; + locals = maybeLocals; + if (routeDataOrOptions || locals) { + this.#logRenderOptionsDeprecationWarning(); + } + } + if (routeData) { + this.#logger.debug( + "router", + "The adapter " + this.#manifest.adapterName + " provided a custom RouteData for ", + request.url + ); + this.#logger.debug("router", "RouteData:\n" + routeData); + } + if (locals) { + if (typeof locals !== "object") { + const error = new AstroError(LocalsNotAnObject); + this.#logger.error(null, error.stack); + return this.#renderError(request, { status: 500, error }); + } + Reflect.set(request, clientLocalsSymbol, locals); + } + if (clientAddress) { + Reflect.set(request, clientAddressSymbol$1, clientAddress); + } + if (!routeData) { + routeData = this.match(request); + this.#logger.debug("router", "Astro matched the following route for " + request.url); + this.#logger.debug("router", "RouteData:\n" + routeData); + } + if (!routeData) { + this.#logger.debug("router", "Astro hasn't found routes that match " + request.url); + this.#logger.debug("router", "Here's the available routes:\n", this.#manifestData); + return this.#renderError(request, { locals, status: 404 }); + } + const pathname = this.#getPathnameFromRequest(request); + const defaultStatus = this.#getDefaultStatusCode(routeData, pathname); + let response; + try { + const mod = await this.#pipeline.getModuleForRoute(routeData); + const renderContext = RenderContext.create({ + pipeline: this.#pipeline, + locals, + pathname, + request, + routeData, + status: defaultStatus + }); + response = await renderContext.render(await mod.page()); + } catch (err) { + this.#logger.error(null, err.stack || err.message || String(err)); + return this.#renderError(request, { locals, status: 500, error: err }); + } + if (REROUTABLE_STATUS_CODES.includes(response.status) && response.headers.get(REROUTE_DIRECTIVE_HEADER) !== "no") { + return this.#renderError(request, { + locals, + response, + status: response.status, + // We don't have an error to report here. Passing null means we pass nothing intentionally + // while undefined means there's no error + error: response.status === 500 ? null : void 0 + }); + } + if (response.headers.has(REROUTE_DIRECTIVE_HEADER)) { + response.headers.delete(REROUTE_DIRECTIVE_HEADER); + } + if (addCookieHeader) { + for (const setCookieHeaderValue of App.getSetCookieFromResponse(response)) { + response.headers.append("set-cookie", setCookieHeaderValue); + } + } + Reflect.set(response, responseSentSymbol$1, true); + return response; + } + #logRenderOptionsDeprecationWarning() { + if (this.#renderOptionsDeprecationWarningShown) return; + this.#logger.warn( + "deprecated", + `The adapter ${this.#manifest.adapterName} is using a deprecated signature of the 'app.render()' method. From Astro 4.0, locals and routeData are provided as properties on an optional object to this method. Using the old signature will cause an error in Astro 5.0. See https://github.com/withastro/astro/pull/9199 for more information.` + ); + this.#renderOptionsDeprecationWarningShown = true; + } + setCookieHeaders(response) { + return getSetCookiesFromResponse(response); + } + /** + * Reads all the cookies written by `Astro.cookie.set()` onto the passed response. + * For example, + * ```ts + * for (const cookie_ of App.getSetCookieFromResponse(response)) { + * const cookie: string = cookie_ + * } + * ``` + * @param response The response to read cookies from. + * @returns An iterator that yields key-value pairs as equal-sign-separated strings. + */ + static getSetCookieFromResponse = getSetCookiesFromResponse; + /** + * If it is a known error code, try sending the according page (e.g. 404.astro / 500.astro). + * This also handles pre-rendered /404 or /500 routes + */ + async #renderError(request, { + locals, + status, + response: originalResponse, + skipMiddleware = false, + error + }) { + const errorRoutePath = `/${status}${this.#manifest.trailingSlash === "always" ? "/" : ""}`; + const errorRouteData = matchRoute(errorRoutePath, this.#manifestData); + const url = new URL(request.url); + if (errorRouteData) { + if (errorRouteData.prerender) { + const maybeDotHtml = errorRouteData.route.endsWith(`/${status}`) ? ".html" : ""; + const statusURL = new URL( + `${this.#baseWithoutTrailingSlash}/${status}${maybeDotHtml}`, + url + ); + const response2 = await fetch(statusURL.toString()); + const override = { status }; + return this.#mergeResponses(response2, originalResponse, override); + } + const mod = await this.#pipeline.getModuleForRoute(errorRouteData); + try { + const renderContext = RenderContext.create({ + locals, + pipeline: this.#pipeline, + middleware: skipMiddleware ? (_, next) => next() : void 0, + pathname: this.#getPathnameFromRequest(request), + request, + routeData: errorRouteData, + status, + props: { error } + }); + const response2 = await renderContext.render(await mod.page()); + return this.#mergeResponses(response2, originalResponse); + } catch { + if (skipMiddleware === false) { + return this.#renderError(request, { + locals, + status, + response: originalResponse, + skipMiddleware: true + }); + } + } + } + const response = this.#mergeResponses(new Response(null, { status }), originalResponse); + Reflect.set(response, responseSentSymbol$1, true); + return response; + } + #mergeResponses(newResponse, originalResponse, override) { + if (!originalResponse) { + if (override !== void 0) { + return new Response(newResponse.body, { + status: override.status, + statusText: newResponse.statusText, + headers: newResponse.headers + }); + } + return newResponse; + } + const status = override?.status ? override.status : originalResponse.status === 200 ? newResponse.status : originalResponse.status; + try { + originalResponse.headers.delete("Content-type"); + } catch { + } + return new Response(newResponse.body, { + status, + statusText: status === 200 ? newResponse.statusText : originalResponse.statusText, + // If you're looking at here for possible bugs, it means that it's not a bug. + // With the middleware, users can meddle with headers, and we should pass to the 404/500. + // If users see something weird, it's because they are setting some headers they should not. + // + // Although, we don't want it to replace the content-type, because the error page must return `text/html` + headers: new Headers([ + ...Array.from(newResponse.headers), + ...Array.from(originalResponse.headers) + ]) + }); + } + #getDefaultStatusCode(routeData, pathname) { + if (!routeData.pattern.exec(pathname)) { + for (const fallbackRoute of routeData.fallbackRoutes) { + if (fallbackRoute.pattern.test(pathname)) { + return 302; + } + } + } + const route = removeTrailingForwardSlash(routeData.route); + if (route.endsWith("/404")) return 404; + if (route.endsWith("/500")) return 500; + return 200; + } +} + +const createOutgoingHttpHeaders = (headers) => { + if (!headers) { + return void 0; + } + const nodeHeaders = Object.fromEntries(headers.entries()); + if (Object.keys(nodeHeaders).length === 0) { + return void 0; + } + if (headers.has("set-cookie")) { + const cookieHeaders = headers.getSetCookie(); + if (cookieHeaders.length > 1) { + nodeHeaders["set-cookie"] = cookieHeaders; + } + } + return nodeHeaders; +}; + +function apply() { + if (!globalThis.crypto) { + Object.defineProperty(globalThis, "crypto", { + value: crypto$1.webcrypto + }); + } + if (!globalThis.File) { + Object.defineProperty(globalThis, "File", { + value: buffer.File + }); + } +} + +const clientAddressSymbol = Symbol.for("astro.clientAddress"); +class NodeApp extends App { + match(req) { + if (!(req instanceof Request)) { + req = NodeApp.createRequest(req, { + skipBody: true + }); + } + return super.match(req); + } + render(req, routeDataOrOptions, maybeLocals) { + if (!(req instanceof Request)) { + req = NodeApp.createRequest(req); + } + return super.render(req, routeDataOrOptions, maybeLocals); + } + /** + * Converts a NodeJS IncomingMessage into a web standard Request. + * ```js + * import { NodeApp } from 'astro/app/node'; + * import { createServer } from 'node:http'; + * + * const server = createServer(async (req, res) => { + * const request = NodeApp.createRequest(req); + * const response = await app.render(request); + * await NodeApp.writeResponse(response, res); + * }) + * ``` + */ + static createRequest(req, { skipBody = false } = {}) { + const protocol = req.headers["x-forwarded-proto"] ?? ("encrypted" in req.socket && req.socket.encrypted ? "https" : "http"); + const hostname = req.headers["x-forwarded-host"] ?? req.headers.host ?? req.headers[":authority"]; + const port = req.headers["x-forwarded-port"]; + const portInHostname = typeof hostname === "string" && typeof port === "string" && hostname.endsWith(port); + const hostnamePort = portInHostname ? hostname : hostname + (port ? `:${port}` : ""); + const url = `${protocol}://${hostnamePort}${req.url}`; + const options = { + method: req.method || "GET", + headers: makeRequestHeaders(req) + }; + const bodyAllowed = options.method !== "HEAD" && options.method !== "GET" && skipBody === false; + if (bodyAllowed) { + Object.assign(options, makeRequestBody(req)); + } + const request = new Request(url, options); + const clientIp = req.headers["x-forwarded-for"]; + if (clientIp) { + Reflect.set(request, clientAddressSymbol, clientIp); + } else if (req.socket?.remoteAddress) { + Reflect.set(request, clientAddressSymbol, req.socket.remoteAddress); + } + return request; + } + /** + * Streams a web-standard Response into a NodeJS Server Response. + * ```js + * import { NodeApp } from 'astro/app/node'; + * import { createServer } from 'node:http'; + * + * const server = createServer(async (req, res) => { + * const request = NodeApp.createRequest(req); + * const response = await app.render(request); + * await NodeApp.writeResponse(response, res); + * }) + * ``` + * @param source WhatWG Response + * @param destination NodeJS ServerResponse + */ + static async writeResponse(source, destination) { + const { status, headers, body } = source; + destination.writeHead(status, createOutgoingHttpHeaders(headers)); + if (!body) return destination.end(); + try { + const reader = body.getReader(); + destination.on("close", () => { + reader.cancel().catch((err) => { + console.error( + `There was an uncaught error in the middle of the stream while rendering ${destination.req.url}.`, + err + ); + }); + }); + let result = await reader.read(); + while (!result.done) { + destination.write(result.value); + result = await reader.read(); + } + destination.end(); + } catch { + destination.end("Internal server error"); + } + } +} +function makeRequestHeaders(req) { + const headers = new Headers(); + for (const [name, value] of Object.entries(req.headers)) { + if (value === void 0) { + continue; + } + if (Array.isArray(value)) { + for (const item of value) { + headers.append(name, item); + } + } else { + headers.append(name, value); + } + } + return headers; +} +function makeRequestBody(req) { + if (req.body !== void 0) { + if (typeof req.body === "string" && req.body.length > 0) { + return { body: Buffer.from(req.body) }; + } + if (typeof req.body === "object" && req.body !== null && Object.keys(req.body).length > 0) { + return { body: Buffer.from(JSON.stringify(req.body)) }; + } + if (typeof req.body === "object" && req.body !== null && typeof req.body[Symbol.asyncIterator] !== "undefined") { + return asyncIterableToBodyProps(req.body); + } + } + return asyncIterableToBodyProps(req); +} +function asyncIterableToBodyProps(iterable) { + return { + // Node uses undici for the Request implementation. Undici accepts + // a non-standard async iterable for the body. + // @ts-expect-error + body: iterable, + // The duplex property is required when using a ReadableStream or async + // iterable for the body. The type definitions do not include the duplex + // property because they are not up-to-date. + duplex: "half" + }; +} + +nodePath.posix.join; + +const ASTRO_PATH_HEADER = "x-astro-path"; +const ASTRO_PATH_PARAM = "x_astro_path"; +const ASTRO_LOCALS_HEADER = "x-astro-locals"; +const ASTRO_MIDDLEWARE_SECRET_HEADER = "x-astro-middleware-secret"; + +await import('./chunks/astro/env-setup_Cr6XTFvb.mjs').then((mod) => mod.setGetEnv((key) => process.env[key])).catch(() => { +}); +apply(); +const createExports = (manifest, { middlewareSecret, skewProtection }) => { + const app = new NodeApp(manifest); + const handler = async (req, res) => { + const url = new URL(`https://example.com${req.url}`); + const clientAddress = req.headers["x-forwarded-for"]; + const localsHeader = req.headers[ASTRO_LOCALS_HEADER]; + const middlewareSecretHeader = req.headers[ASTRO_MIDDLEWARE_SECRET_HEADER]; + const realPath = req.headers[ASTRO_PATH_HEADER] ?? url.searchParams.get(ASTRO_PATH_PARAM); + if (typeof realPath === "string") { + req.url = realPath; + } + let locals = {}; + if (localsHeader) { + if (middlewareSecretHeader !== middlewareSecret) { + res.statusCode = 403; + res.end("Forbidden"); + return; + } + locals = typeof localsHeader === "string" ? JSON.parse(localsHeader) : JSON.parse(localsHeader[0]); + } + delete req.headers[ASTRO_MIDDLEWARE_SECRET_HEADER]; + if (skewProtection && process.env.VERCEL_SKEW_PROTECTION_ENABLED === "1") { + req.headers["x-deployment-id"] = process.env.VERCEL_DEPLOYMENT_ID; + } + const webResponse = await app.render(req, { addCookieHeader: true, clientAddress, locals }); + await NodeApp.writeResponse(webResponse, res); + }; + return { default: handler }; +}; + +const _page0 = () => import('./pages/_image.astro.mjs'); +const _page1 = () => import('./pages/robots.txt.astro.mjs'); +const _page2 = () => import('./pages/index.astro.mjs'); + +const pageMap = new Map([ + ["node_modules/astro/dist/assets/endpoint/generic.js", _page0], + ["src/pages/robots.txt.ts", _page1], + ["src/pages/index.astro", _page2] +]); +const serverIslandMap = new Map(); + +const _manifest = Object.assign(manifest, { + pageMap, + serverIslandMap, + renderers, + middleware: onRequest +}); +const _args = { + "middlewareSecret": "48e885c5-9567-4c2e-9c2b-6fbaef0a6ab0", + "skewProtection": false +}; +const _exports = createExports(_manifest, _args); +const __astrojsSsrVirtualEntry = _exports.default; + +export { __astrojsSsrVirtualEntry as default, pageMap }; diff --git a/.vercel/output/functions/_render.func/home/vic/src/web/portfolio/.vercel/output/_functions/pages/_image.astro.mjs b/.vercel/output/functions/_render.func/home/vic/src/web/portfolio/.vercel/output/_functions/pages/_image.astro.mjs new file mode 100644 index 0000000..9ed1962 --- /dev/null +++ b/.vercel/output/functions/_render.func/home/vic/src/web/portfolio/.vercel/output/_functions/pages/_image.astro.mjs @@ -0,0 +1,93 @@ +import { g as getConfiguredImageService, i as imageConfig } from '../chunks/_astro_assets_BUmYIlZq.mjs'; +import { i as isRemotePath, f as isRemoteAllowed } from '../chunks/astro/assets-service_DK7A0Y1H.mjs'; +import * as mime from 'mrmime'; +export { renderers } from '../renderers.mjs'; + +const fnv1a52 = (str) => { + const len = str.length; + let i = 0, t0 = 0, v0 = 8997, t1 = 0, v1 = 33826, t2 = 0, v2 = 40164, t3 = 0, v3 = 52210; + while (i < len) { + v0 ^= str.charCodeAt(i++); + t0 = v0 * 435; + t1 = v1 * 435; + t2 = v2 * 435; + t3 = v3 * 435; + t2 += v0 << 8; + t3 += v1 << 8; + t1 += t0 >>> 16; + v0 = t0 & 65535; + t2 += t1 >>> 16; + v1 = t1 & 65535; + v3 = t3 + (t2 >>> 16) & 65535; + v2 = t2 & 65535; + } + return (v3 & 15) * 281474976710656 + v2 * 4294967296 + v1 * 65536 + (v0 ^ v3 >> 4); +}; +const etag = (payload, weak = false) => { + const prefix = weak ? 'W/"' : '"'; + return prefix + fnv1a52(payload).toString(36) + payload.length.toString(36) + '"'; +}; + +async function loadRemoteImage(src, headers) { + try { + const res = await fetch(src, { + // Forward all headers from the original request + headers + }); + if (!res.ok) { + return void 0; + } + return await res.arrayBuffer(); + } catch (err) { + return void 0; + } +} +const GET = async ({ request }) => { + try { + const imageService = await getConfiguredImageService(); + if (!("transform" in imageService)) { + throw new Error("Configured image service is not a local service"); + } + const url = new URL(request.url); + const transform = await imageService.parseURL(url, imageConfig); + if (!transform?.src) { + throw new Error("Incorrect transform returned by `parseURL`"); + } + let inputBuffer = void 0; + const isRemoteImage = isRemotePath(transform.src); + const sourceUrl = isRemoteImage ? new URL(transform.src) : new URL(transform.src, url.origin); + if (isRemoteImage && isRemoteAllowed(transform.src, imageConfig) === false) { + return new Response("Forbidden", { status: 403 }); + } + inputBuffer = await loadRemoteImage(sourceUrl, isRemoteImage ? new Headers() : request.headers); + if (!inputBuffer) { + return new Response("Not Found", { status: 404 }); + } + const { data, format } = await imageService.transform( + new Uint8Array(inputBuffer), + transform, + imageConfig + ); + return new Response(data, { + status: 200, + headers: { + "Content-Type": mime.lookup(format) ?? `image/${format}`, + "Cache-Control": "public, max-age=31536000", + ETag: etag(data.toString()), + Date: (/* @__PURE__ */ new Date()).toUTCString() + } + }); + } catch (err) { + console.error("Could not process image request:", err); + return new Response(`Server Error: ${err}`, { status: 500 }); + } +}; + +const _page = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ + __proto__: null, + GET +}, Symbol.toStringTag, { value: 'Module' })); + +const page = () => _page; + +export { page }; diff --git a/.vercel/output/functions/_render.func/home/vic/src/web/portfolio/.vercel/output/_functions/pages/index.astro.mjs b/.vercel/output/functions/_render.func/home/vic/src/web/portfolio/.vercel/output/_functions/pages/index.astro.mjs new file mode 100644 index 0000000..e8ff7a4 --- /dev/null +++ b/.vercel/output/functions/_render.func/home/vic/src/web/portfolio/.vercel/output/_functions/pages/index.astro.mjs @@ -0,0 +1 @@ +// Contents removed by Astro as it's used for prerendering only \ No newline at end of file diff --git a/.vercel/output/functions/_render.func/home/vic/src/web/portfolio/.vercel/output/_functions/pages/robots.txt.astro.mjs b/.vercel/output/functions/_render.func/home/vic/src/web/portfolio/.vercel/output/_functions/pages/robots.txt.astro.mjs new file mode 100644 index 0000000..e8ff7a4 --- /dev/null +++ b/.vercel/output/functions/_render.func/home/vic/src/web/portfolio/.vercel/output/_functions/pages/robots.txt.astro.mjs @@ -0,0 +1 @@ +// Contents removed by Astro as it's used for prerendering only \ No newline at end of file diff --git a/.vercel/output/functions/_render.func/home/vic/src/web/portfolio/.vercel/output/_functions/renderers.mjs b/.vercel/output/functions/_render.func/home/vic/src/web/portfolio/.vercel/output/_functions/renderers.mjs new file mode 100644 index 0000000..a97849f --- /dev/null +++ b/.vercel/output/functions/_render.func/home/vic/src/web/portfolio/.vercel/output/_functions/renderers.mjs @@ -0,0 +1,3 @@ +const renderers = []; + +export { renderers }; diff --git a/.vercel/output/functions/_render.func/package.json b/.vercel/output/functions/_render.func/package.json new file mode 100644 index 0000000..47dc78d --- /dev/null +++ b/.vercel/output/functions/_render.func/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} \ No newline at end of file diff --git a/.vercel/output/functions/_render.func/usr/bin/ldd b/.vercel/output/functions/_render.func/usr/bin/ldd new file mode 100755 index 0000000..d9f3e4f --- /dev/null +++ b/.vercel/output/functions/_render.func/usr/bin/ldd @@ -0,0 +1,191 @@ +#!/bin/bash +# Copyright (C) 1996-2024 Free Software Foundation, Inc. +# This file is part of the GNU C Library. + +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, see +# . + + +# This is the `ldd' command, which lists what shared libraries are +# used by given dynamically-linked executables. It works by invoking the +# run-time dynamic linker as a command and setting the environment +# variable LD_TRACE_LOADED_OBJECTS to a non-empty value. + +# We should be able to find the translation right at the beginning. +TEXTDOMAIN=libc +TEXTDOMAINDIR=/usr/share/locale + +RTLDLIST="/usr/lib/ld-linux.so.2 /usr/lib64/ld-linux-x86-64.so.2 /usr/libx32/ld-linux-x32.so.2" +warn= +bind_now= +verbose= + +while test $# -gt 0; do + case "$1" in + --vers | --versi | --versio | --version) + echo 'ldd (GNU libc) 2.39' + printf $"Copyright (C) %s Free Software Foundation, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +" "2024" + printf $"Written by %s and %s. +" "Roland McGrath" "Ulrich Drepper" + exit 0 + ;; + --h | --he | --hel | --help) + echo $"Usage: ldd [OPTION]... FILE... + --help print this help and exit + --version print version information and exit + -d, --data-relocs process data relocations + -r, --function-relocs process data and function relocations + -u, --unused print unused direct dependencies + -v, --verbose print all information +" + printf $"For bug reporting instructions, please see:\\n%s.\\n" \ + "" + exit 0 + ;; + -d | --d | --da | --dat | --data | --data- | --data-r | --data-re | \ + --data-rel | --data-relo | --data-reloc | --data-relocs) + warn=yes + shift + ;; + -r | --f | --fu | --fun | --func | --funct | --functi | --functio | \ + --function | --function- | --function-r | --function-re | --function-rel | \ + --function-relo | --function-reloc | --function-relocs) + warn=yes + bind_now=yes + shift + ;; + -v | --verb | --verbo | --verbos | --verbose) + verbose=yes + shift + ;; + -u | --u | --un | --unu | --unus | --unuse | --unused) + unused=yes + shift + ;; + --v | --ve | --ver) + echo >&2 $"ldd: option \`$1' is ambiguous" + exit 1 + ;; + --) # Stop option processing. + shift; break + ;; + -*) + echo >&2 'ldd:' $"unrecognized option" "\`$1'" + echo >&2 $"Try \`ldd --help' for more information." + exit 1 + ;; + *) + break + ;; + esac +done + +nonelf () +{ + # Maybe extra code for non-ELF binaries. + return 1; +} + +add_env="LD_TRACE_LOADED_OBJECTS=1 LD_WARN=$warn LD_BIND_NOW=$bind_now" +add_env="$add_env LD_VERBOSE=$verbose" +if test "$unused" = yes; then + add_env="$add_env LD_DEBUG=\"$LD_DEBUG${LD_DEBUG:+,}unused\"" +fi + +# The following command substitution is needed to make ldd work in SELinux +# environments where the RTLD might not have permission to write to the +# terminal. The extra "x" character prevents the shell from trimming trailing +# newlines from command substitution results. This function is defined as a +# subshell compound list (using "(...)") to prevent parameter assignments from +# affecting the calling shell execution environment. +try_trace() ( + output=$(eval $add_env '"$@"' 2>&1; rc=$?; printf 'x'; exit $rc) + rc=$? + printf '%s' "${output%x}" + return $rc +) + +case $# in +0) + echo >&2 'ldd:' $"missing file arguments" + echo >&2 $"Try \`ldd --help' for more information." + exit 1 + ;; +1) + single_file=t + ;; +*) + single_file=f + ;; +esac + +result=0 +for file do + # We don't list the file name when there is only one. + test $single_file = t || echo "${file}:" + case $file in + */*) : + ;; + *) file=./$file + ;; + esac + if test ! -e "$file"; then + echo "ldd: ${file}:" $"No such file or directory" >&2 + result=1 + elif test ! -f "$file"; then + echo "ldd: ${file}:" $"not regular file" >&2 + result=1 + elif test -r "$file"; then + test -x "$file" || echo 'ldd:' $"\ +warning: you do not have execution permission for" "\`$file'" >&2 + RTLD= + ret=1 + for rtld in ${RTLDLIST}; do + if test -x $rtld; then + verify_out=`${rtld} --verify "$file"` + ret=$? + case $ret in + [02]) RTLD=${rtld}; break;; + esac + fi + done + case $ret in + 1) + # This can be a non-ELF binary or no binary at all. + nonelf "$file" || { + echo $" not a dynamic executable" >&2 + result=1 + } + ;; + 0|2) + try_trace "$RTLD" "$file" || result=1 + ;; + *) + echo 'ldd:' ${RTLD} $"exited with unknown exit code" "($ret)" >&2 + exit 1 + ;; + esac + else + echo 'ldd:' $"error: you do not have read permission for" "\`$file'" >&2 + result=1 + fi +done + +exit $result +# Local Variables: +# mode:ksh +# End: diff --git a/.vercel/output/static/_astro/index.BuTT48KC.css b/.vercel/output/static/_astro/index.BuTT48KC.css new file mode 100644 index 0000000..6c2c2d9 --- /dev/null +++ b/.vercel/output/static/_astro/index.BuTT48KC.css @@ -0,0 +1 @@ +*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.flex{display:flex}.grid{display:grid}.size-14{width:3.5rem;height:3.5rem}.size-36{width:9rem;height:9rem}.min-h-dvh{min-height:100dvh}.scale-100{--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.animate-fade-in{animation:fade-in .7s ease .3s}@keyframes fade-up{0%{opacity:0;transform:translateY(1.5rem)}to{opacity:1;transform:none}}.animate-fade-up{animation:fade-up .7s ease .3s}@keyframes zoom-in{0%{opacity:0;transform:scale(.75)}to{opacity:1;transform:scale(1)}}.animate-zoom-in{animation:zoom-in .5s ease .3s}@keyframes zoom-in-out{0%{transform:scale(1.1)}to{transform:scale(1)}}.animate-zoom-in-out{animation:zoom-in-out .7s ease}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.place-content-center{place-content:center}.place-items-center{place-items:center}.items-center{align-items:center}.justify-center{justify-content:center}.gap-3{gap:.75rem}.gap-5{gap:1.25rem}.rounded-full{border-radius:9999px}.border-2{border-width:2px}.border-4{border-width:4px}.border-gray-950{--tw-border-opacity: 1;border-color:rgb(3 7 18 / var(--tw-border-opacity))}.bg-cyan-500{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity))}.bg-lime-400{--tw-bg-opacity: 1;background-color:rgb(163 230 53 / var(--tw-bg-opacity))}.bg-sky-700{--tw-bg-opacity: 1;background-color:rgb(3 105 161 / var(--tw-bg-opacity))}.bg-zinc-100{--tw-bg-opacity: 1;background-color:rgb(244 244 245 / var(--tw-bg-opacity))}.bg-horizonAnimated{background-image:url(/assets/svg/backgrounds/horizon-animated.svg)}.bg-cover{background-size:cover}.bg-scroll{background-attachment:scroll}.bg-center{background-position:center}.bg-no-repeat{background-repeat:no-repeat}.p-0\.5{padding:.125rem}.p-3{padding:.75rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-light{font-weight:300}.font-normal{font-weight:400}.tracking-wide{letter-spacing:.025em}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.hover\:scale-110:hover{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@media (min-width: 768px){.md\:size-16{width:4rem;height:4rem}.md\:size-40{width:10rem;height:10rem}.md\:grid-flow-col{grid-auto-flow:column}.md\:gap-2{gap:.5rem}.md\:text-5xl{font-size:3rem;line-height:1}.md\:text-base{font-size:1rem;line-height:1.5rem}.md\:text-sm{font-size:.875rem;line-height:1.25rem}} diff --git a/.vercel/output/static/assets/img/ai-generated-portrait.webp b/.vercel/output/static/assets/img/ai-generated-portrait.webp new file mode 100644 index 0000000..d31207f Binary files /dev/null and b/.vercel/output/static/assets/img/ai-generated-portrait.webp differ diff --git a/.vercel/output/static/assets/img/vitaoportrait.webp b/.vercel/output/static/assets/img/vitaoportrait.webp new file mode 100644 index 0000000..2f6da47 Binary files /dev/null and b/.vercel/output/static/assets/img/vitaoportrait.webp differ diff --git a/.vercel/output/static/assets/svg/backgrounds/horizon-animated.svg b/.vercel/output/static/assets/svg/backgrounds/horizon-animated.svg new file mode 100644 index 0000000..dc0f76d --- /dev/null +++ b/.vercel/output/static/assets/svg/backgrounds/horizon-animated.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/.vercel/output/static/assets/svg/backgrounds/horizon.svg b/.vercel/output/static/assets/svg/backgrounds/horizon.svg new file mode 100644 index 0000000..ec9e3eb --- /dev/null +++ b/.vercel/output/static/assets/svg/backgrounds/horizon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/.vercel/output/static/assets/svg/icons/email.svg b/.vercel/output/static/assets/svg/icons/email.svg new file mode 100644 index 0000000..8070c2c --- /dev/null +++ b/.vercel/output/static/assets/svg/icons/email.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/.vercel/output/static/assets/svg/icons/github.svg b/.vercel/output/static/assets/svg/icons/github.svg new file mode 100644 index 0000000..3fa191e --- /dev/null +++ b/.vercel/output/static/assets/svg/icons/github.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/.vercel/output/static/assets/svg/icons/instagram.svg b/.vercel/output/static/assets/svg/icons/instagram.svg new file mode 100644 index 0000000..2382cdf --- /dev/null +++ b/.vercel/output/static/assets/svg/icons/instagram.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/.vercel/output/static/assets/svg/icons/linkedin.svg b/.vercel/output/static/assets/svg/icons/linkedin.svg new file mode 100644 index 0000000..02633b0 --- /dev/null +++ b/.vercel/output/static/assets/svg/icons/linkedin.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/.vercel/output/static/assets/svg/icons/tiktok.svg b/.vercel/output/static/assets/svg/icons/tiktok.svg new file mode 100644 index 0000000..6402b05 --- /dev/null +++ b/.vercel/output/static/assets/svg/icons/tiktok.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/.vercel/output/static/assets/svg/icons/x.svg b/.vercel/output/static/assets/svg/icons/x.svg new file mode 100644 index 0000000..4641414 --- /dev/null +++ b/.vercel/output/static/assets/svg/icons/x.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/.vercel/output/static/favicon.svg b/.vercel/output/static/favicon.svg new file mode 100644 index 0000000..f157bd1 --- /dev/null +++ b/.vercel/output/static/favicon.svg @@ -0,0 +1,9 @@ + + + + diff --git a/.vercel/output/static/index.html b/.vercel/output/static/index.html new file mode 100644 index 0000000..32a4ec1 --- /dev/null +++ b/.vercel/output/static/index.html @@ -0,0 +1 @@ + Victor's Portfolio
Selfie of me

Hi, I'm Victor

Full Stack App Developer

Your business solution, one code line at a time. 🚀💻

\ No newline at end of file diff --git a/.vercel/output/static/robots.txt b/.vercel/output/static/robots.txt new file mode 100644 index 0000000..91da89a --- /dev/null +++ b/.vercel/output/static/robots.txt @@ -0,0 +1,4 @@ +User-agent: * +Allow: / + +Sitemap: https://wilyj80.github.io/sitemap-index.xml \ No newline at end of file diff --git a/.vercel/output/static/sitemap-0.xml b/.vercel/output/static/sitemap-0.xml new file mode 100644 index 0000000..c56585c --- /dev/null +++ b/.vercel/output/static/sitemap-0.xml @@ -0,0 +1 @@ +https://wilyj80.github.io/ \ No newline at end of file diff --git a/.vercel/output/static/sitemap-index.xml b/.vercel/output/static/sitemap-index.xml new file mode 100644 index 0000000..689c2c1 --- /dev/null +++ b/.vercel/output/static/sitemap-index.xml @@ -0,0 +1 @@ +https://wilyj80.github.io/sitemap-0.xml \ No newline at end of file diff --git a/index.html b/index.html index 8f65c8c..26648b5 100644 --- a/index.html +++ b/index.html @@ -1 +1 @@ - Victor's Portfolio
Selfie of me

Hi, I'm Victor

Full Stack App Developer

Your business solution, one code line at a time. 🚀💻

\ No newline at end of file + Victor's Portfolio
Selfie of me

Hi, I'm Victor

Full Stack App Developer

Your business solution, one code line at a time. 🚀💻

\ No newline at end of file diff --git a/robots.txt b/robots.txt index 532d03d..91da89a 100644 --- a/robots.txt +++ b/robots.txt @@ -1,4 +1,4 @@ User-agent: * Allow: / -Sitemap: https://astro-simple-portfolio.vercel.app/sitemap-index.xml \ No newline at end of file +Sitemap: https://wilyj80.github.io/sitemap-index.xml \ No newline at end of file diff --git a/sitemap-0.xml b/sitemap-0.xml index 27050a8..c56585c 100644 --- a/sitemap-0.xml +++ b/sitemap-0.xml @@ -1 +1 @@ -https://astro-simple-portfolio.vercel.app/ \ No newline at end of file +https://wilyj80.github.io/ \ No newline at end of file diff --git a/sitemap-index.xml b/sitemap-index.xml index 4820e97..689c2c1 100644 --- a/sitemap-index.xml +++ b/sitemap-index.xml @@ -1 +1 @@ -https://astro-simple-portfolio.vercel.app/sitemap-0.xml \ No newline at end of file +https://wilyj80.github.io/sitemap-0.xml \ No newline at end of file