1export default async function(req: Request): Promise<Response> {
2 const query = new URL(req.url).searchParams;
3 const iata = query.get("iata") || query.get("q");
19// console.log(ret.url);
20
21export default function({ iframeSrc }) {
22 return async (req) => {
23 const { extractValInfo } = await import("https://esm.town/v/pomdtr/extractValInfo");
52
53if (typeof document !== "undefined") {
54 (window as any).makeValleDrawClient = async function({ iframeSrc, model }) {
55 const ret = { url: "https://esm.sh/~ae19cbe7d55c481140f1002355f248f335382639" };
56
81 } = tldraw;
82
83 function MakeRealButton() {
84 const editor = useEditor();
85 const { addToast } = useToasts();
91 const { maxX, midY } = editor.getSelectionPageBounds();
92
93 const text = `export default async function main(req: Request): Promise<Response> {
94 return new Response("Hello, World!", {
95 headers: { "Content-Type": "text/plain" },
154 }
155
156 function App() {
157 return (
158 <>
298 ];
299
300 function getRotatedBoxShadow(rotation: number) {
301 const cssStrings = ROTATING_BOX_SHADOWS.map((shadow) => {
302 const { offsetX, offsetY, blur, spread, color } = shadow;
7}
8
9export async function getGeminiModels(): Promise<GeminiModel[]> {
10 try {
11 const API_KEY = process.env.GEMINI_API_KEY;
1import sass from "npm:sass";
2
3export default async function(req: Request): Promise<Response> {
4 if (req.method !== "POST") {
5 return Response.json({ error: "This val responds to POST requests." }, {
1export function extractValInfo(url: string | URL) {
2 const { pathname, search } = new URL(url);
3 const [author, filename] = pathname.split("/").slice(-2);
1export default async function getValsContextWindow(model: any) {
2 const readmeVals: any = await (await fetch("https://janpaul123-readmevals.web.val.run/")).json();
3
183 import { render } from "npm:preact-render-to-string";
184
185 export default async function(req: Request) {
186 return new Response(
187 render(
212 const FLAT_TEMPLATES = sections.flatMap((section) => section.templates);
213
214 function tsResponse(code) {
215 return "```ts\n" + code + "\n```";
216 }
383 ### Utilities
384
385 Our Blob SDK also includes some utility functions to make working with blobs easier.
386
387 ##### Copy
507 role: "assistant",
508 content:
509 "\n```ts\nexport default async function (req: Request): Promise<Response> {\n return Response.json(\"Hello world\")\n}\n```",
510 },
511 {
516 role: "assistant",
517 content:
518 "\n```ts\nexport default async function(req: Request): Promise<Response> {\n const query = new URL(req.url).searchParams;\n\n // Read name from the querystring or body. Defaults to \"you\" if not present.\n const name = query.get(\"name\") || (await req.json().catch(() => ({}))).name || \"you\";\n\n // Returns the HTML response\n return new Response(`<h1>Hi ${name}!</h1>`, {\n headers: { \"Content-Type\": \"text/html\" },\n });\n}\n```",
519 },
520 {
533 role: "assistant",
534 content:
535 "```ts\nexport default async function(req: Request): Promise<Response> {\n const apiKey = Deno.env.get(\"METEO_KEY\");\n const apiUrl = `https://api.open-meteo.com/v1/forecast?latitude=40.6782&longitude=-73.9442&hourly=temperature_2m¤t_weather=true&apikey=${apiKey}`;\n\n const response = await fetch(apiUrl);\n const weatherData = await response.json();\n\n return new Response(JSON.stringify(weatherData), { headers: { \"Content-Type\": \"application/json\" } });\n}\n```",
536 },
537 {
6const ipDataName = "googleIpqsData";
7
8async function sendEmail(oldData, newData) {
9 const emailBody = `The IPQS score for the IP address "${ipAddress}" has changed.
10Old evaluation:
17}
18
19export async function checkIp() {
20 const result = await fetch(`https://ipqualityscore.com/api/json/ip/${ipqsApiKey}/${ipAddress}`);
21 const newData = await result.json();
17// DO NOT EDIT
18
19async function getSchedule() {
20 try {
21 let start = new Date();
53}
54
55function Demo({ data }) {
56 if (!data) return <p>Failed to fetch</p>;
57
58 function processData(data) {
59 /*console.log(JSON.stringify(data,null,2))*/
60 let processedData = [];
187// }
188
189export default async function(req: Request): Promise<Response> {
190 const scheduleData = await getSchedule();
191 const { renderToReadableStream } = await import("https://esm.sh/react-dom/server");
6import { blob } from "https://esm.town/v/std/blob?v=10";
7
8function App() {
9 const [data, setData] = useState();
10
11 useEffect(() => {
12 async function fetchSchedule() {
13 await fetch("/schedule")
14 .then(response => {
9 * @param val Define which val should open. Defaults to the root reference
10 */
11export function modifyHtmlString(
12 bodyText: string,
13 { val, style }: { val?: ValRef; style?: string } = {},
40 * @param val Define which val should open
41 */
42export function modifyFetchHandler(
43 handler: (req: Request) => Response | Promise<Response>,
44 { val, style }: { val?: ValRef; style?: string } = {},