{"version":3,"file":"earendil-announcement.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/earendil-announcement.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAuB,MAAM,wBAAwB,CAAC;AAyBxE,qBAAa,6BAA8B,SAAQ,SAAS;IAC3D,cAwBC;CACD","sourcesContent":["import * as fs from \"node:fs\";\nimport { Container, Image, Spacer, Text } from \"@earendil-works/pi-tui\";\nimport { getBundledInteractiveAssetPath } from \"../../../config.js\";\nimport { theme } from \"../theme/theme.js\";\nimport { DynamicBorder } from \"./dynamic-border.js\";\n\nconst BLOG_URL = \"https://mariozechner.at/posts/2026-04-08-ive-sold-out/\";\nconst IMAGE_FILENAME = \"clankolas.png\";\n\nlet cachedImageBase64: string | undefined;\nlet attemptedImageLoad = false;\n\nfunction loadImageBase64(): string | undefined {\n\tif (attemptedImageLoad) {\n\t\treturn cachedImageBase64;\n\t}\n\n\tattemptedImageLoad = true;\n\ttry {\n\t\tcachedImageBase64 = fs.readFileSync(getBundledInteractiveAssetPath(IMAGE_FILENAME)).toString(\"base64\");\n\t} catch {\n\t\tcachedImageBase64 = undefined;\n\t}\n\treturn cachedImageBase64;\n}\n\nexport class EarendilAnnouncementComponent extends Container {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.addChild(new DynamicBorder((text) => theme.fg(\"accent\", text)));\n\t\tthis.addChild(new Text(theme.bold(theme.fg(\"accent\", \"pi has joined Earendil\")), 1, 0));\n\t\tthis.addChild(new Spacer(1));\n\t\tthis.addChild(new Text(theme.fg(\"muted\", \"Read the blog post:\"), 1, 0));\n\t\tthis.addChild(new Text(theme.fg(\"mdLink\", BLOG_URL), 1, 0));\n\t\tthis.addChild(new Spacer(1));\n\n\t\tconst imageBase64 = loadImageBase64();\n\t\tif (imageBase64) {\n\t\t\tthis.addChild(\n\t\t\t\tnew Image(\n\t\t\t\t\timageBase64,\n\t\t\t\t\t\"image/png\",\n\t\t\t\t\t{ fallbackColor: (text) => theme.fg(\"muted\", text) },\n\t\t\t\t\t{ maxWidthCells: 56, filename: IMAGE_FILENAME },\n\t\t\t\t),\n\t\t\t);\n\t\t\tthis.addChild(new Spacer(1));\n\t\t}\n\n\t\tthis.addChild(new DynamicBorder((text) => theme.fg(\"accent\", text)));\n\t}\n}\n"]}