luigi12345 commited on
Commit
f2f7df4
1 Parent(s): df82a8c

797eac7ad7b83c07b3fa7b7d4e874e326eda68c915c93b978b0aaa66096fcfd3

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +2 -0
  2. workers1/auto3d/CursorLens/src/app/stats/page.tsx +457 -0
  3. workers1/auto3d/CursorLens/src/app/twitter-image.png +0 -0
  4. workers1/auto3d/CursorLens/src/components/LogDetails.tsx +427 -0
  5. workers1/auto3d/CursorLens/src/components/LogsList.tsx +202 -0
  6. workers1/auto3d/CursorLens/src/components/NavBar.tsx +43 -0
  7. workers1/auto3d/CursorLens/src/components/theme-provider.tsx +9 -0
  8. workers1/auto3d/CursorLens/src/components/theme-toggle.tsx +20 -0
  9. workers1/auto3d/CursorLens/src/components/ui/alert.tsx +59 -0
  10. workers1/auto3d/CursorLens/src/components/ui/badge.tsx +36 -0
  11. workers1/auto3d/CursorLens/src/components/ui/button.tsx +57 -0
  12. workers1/auto3d/CursorLens/src/components/ui/calendar.tsx +72 -0
  13. workers1/auto3d/CursorLens/src/components/ui/card.tsx +76 -0
  14. workers1/auto3d/CursorLens/src/components/ui/chart.tsx +370 -0
  15. workers1/auto3d/CursorLens/src/components/ui/checkbox.tsx +30 -0
  16. workers1/auto3d/CursorLens/src/components/ui/dialog.tsx +122 -0
  17. workers1/auto3d/CursorLens/src/components/ui/input.tsx +25 -0
  18. workers1/auto3d/CursorLens/src/components/ui/label.tsx +26 -0
  19. workers1/auto3d/CursorLens/src/components/ui/popover.tsx +33 -0
  20. workers1/auto3d/CursorLens/src/components/ui/progress.tsx +28 -0
  21. workers1/auto3d/CursorLens/src/components/ui/scroll-area.tsx +48 -0
  22. workers1/auto3d/CursorLens/src/components/ui/select.tsx +164 -0
  23. workers1/auto3d/CursorLens/src/components/ui/skeleton.tsx +15 -0
  24. workers1/auto3d/CursorLens/src/components/ui/sonner.tsx +31 -0
  25. workers1/auto3d/CursorLens/src/components/ui/switch.tsx +29 -0
  26. workers1/auto3d/CursorLens/src/components/ui/table.tsx +120 -0
  27. workers1/auto3d/CursorLens/src/env.ts +54 -0
  28. workers1/auto3d/CursorLens/src/lib/cost-calculator.ts +33 -0
  29. workers1/auto3d/CursorLens/src/lib/db.ts +30 -0
  30. workers1/auto3d/CursorLens/src/lib/model-config.ts +320 -0
  31. workers1/auto3d/CursorLens/src/lib/prisma.ts +25 -0
  32. workers1/auto3d/CursorLens/src/lib/utils.ts +6 -0
  33. workers1/auto3d/CursorLens/start.sh +10 -0
  34. workers1/auto3d/CursorLens/tailwind.config.ts +80 -0
  35. workers1/auto3d/CursorLens/tsconfig.json +26 -0
  36. workers1/auto3d/node_modules/.bin/acorn +4 -0
  37. workers1/auto3d/node_modules/.bin/esbuild +3 -0
  38. workers1/auto3d/node_modules/.bin/mime +46 -0
  39. workers1/auto3d/node_modules/.bin/miniflare +11 -0
  40. workers1/auto3d/node_modules/.bin/mustache +150 -0
  41. workers1/auto3d/node_modules/.bin/nanoid +55 -0
  42. workers1/auto3d/node_modules/.bin/resolve +50 -0
  43. workers1/auto3d/node_modules/.bin/workerd +3 -0
  44. workers1/auto3d/node_modules/.bin/wrangler +99 -0
  45. workers1/auto3d/node_modules/.bin/wrangler2 +99 -0
  46. workers1/auto3d/node_modules/.mf/cf.json +1 -0
  47. workers1/auto3d/node_modules/.package-lock.json +1005 -0
  48. workers1/auto3d/node_modules/@cloudflare/kv-asset-handler/README.md +346 -0
  49. workers1/auto3d/node_modules/@cloudflare/kv-asset-handler/dist/index.d.ts +37 -0
  50. workers1/auto3d/node_modules/@cloudflare/kv-asset-handler/dist/index.js +298 -0
.gitattributes CHANGED
@@ -2,3 +2,5 @@
2
  *.mp4 filter=lfs diff=lfs merge=lfs -text
3
  *.rar filter=lfs diff=lfs merge=lfs -text
4
  *.tar filter=lfs diff=lfs merge=lfs -text
 
 
 
2
  *.mp4 filter=lfs diff=lfs merge=lfs -text
3
  *.rar filter=lfs diff=lfs merge=lfs -text
4
  *.tar filter=lfs diff=lfs merge=lfs -text
5
+ workers1/auto3d/node_modules/.bin/esbuild filter=lfs diff=lfs merge=lfs -text
6
+ workers1/auto3d/node_modules/.bin/workerd filter=lfs diff=lfs merge=lfs -text
workers1/auto3d/CursorLens/src/app/stats/page.tsx ADDED
@@ -0,0 +1,457 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use client";
2
+
3
+ import { useState, useEffect } from "react";
4
+ import { Card, CardHeader, CardTitle, CardContent } from "@/components/ui/card";
5
+ import { getStats, getConfigurations, getConfigurationCosts } from "../actions";
6
+ import type { AIConfiguration } from "@prisma/client";
7
+ import {
8
+ BarChart,
9
+ Bar,
10
+ XAxis,
11
+ YAxis,
12
+ CartesianGrid,
13
+ ResponsiveContainer,
14
+ LineChart,
15
+ Line,
16
+ PieChart,
17
+ Pie,
18
+ Cell,
19
+ } from "recharts";
20
+ import {
21
+ ChartContainer,
22
+ ChartTooltip,
23
+ ChartTooltipContent,
24
+ ChartLegend,
25
+ ChartLegendContent,
26
+ } from "@/components/ui/chart";
27
+ import {
28
+ Select,
29
+ SelectContent,
30
+ SelectItem,
31
+ SelectTrigger,
32
+ SelectValue,
33
+ } from "@/components/ui/select";
34
+ import { Skeleton } from "@/components/ui/skeleton";
35
+ import { Checkbox } from "@/components/ui/checkbox";
36
+
37
+ interface Stats {
38
+ totalLogs: number;
39
+ totalTokens: number;
40
+ totalPromptTokens: number;
41
+ totalCompletionTokens: number;
42
+ perModelProviderStats: {
43
+ [key: string]: {
44
+ logs: number;
45
+ tokens: number;
46
+ promptTokens: number;
47
+ completionTokens: number;
48
+ cost: number;
49
+ provider: string;
50
+ model: string;
51
+ };
52
+ };
53
+ tokenUsageOverTime: {
54
+ date: string;
55
+ tokens: number;
56
+ promptTokens: number;
57
+ completionTokens: number;
58
+ }[];
59
+ }
60
+
61
+ const chartConfig = {
62
+ logs: {
63
+ label: "Logs",
64
+ color: "hsl(var(--chart-1))",
65
+ },
66
+ tokens: {
67
+ label: "Total Tokens",
68
+ color: "hsl(var(--chart-2))",
69
+ },
70
+ promptTokens: {
71
+ label: "Input Tokens",
72
+ color: "hsl(var(--chart-3))",
73
+ },
74
+ completionTokens: {
75
+ label: "Output Tokens",
76
+ color: "hsl(var(--chart-4))",
77
+ },
78
+ cost: {
79
+ label: "Cost ($)",
80
+ color: "hsl(var(--chart-5))",
81
+ },
82
+ };
83
+
84
+ export default function StatsPage() {
85
+ const [stats, setStats] = useState<Stats | null>(null);
86
+ const [configurations, setConfigurations] = useState<AIConfiguration[]>([]);
87
+ const [loading, setLoading] = useState(true);
88
+ const [error, setError] = useState<string | null>(null);
89
+ const [timeFilter, setTimeFilter] = useState("all");
90
+ const [tokenUsageOverTime, setTokenUsageOverTime] = useState<
91
+ { date: string; tokens: number }[]
92
+ >([]);
93
+ const [selectedMetrics, setSelectedMetrics] = useState<string[]>([
94
+ "logs",
95
+ "tokens",
96
+ "cost",
97
+ ]);
98
+
99
+ useEffect(() => {
100
+ const fetchData = async () => {
101
+ try {
102
+ const [statsData, configData, costsData] = await Promise.all([
103
+ getStats(timeFilter),
104
+ getConfigurations(),
105
+ getConfigurationCosts(),
106
+ ]);
107
+
108
+ const perModelProviderStats: Stats["perModelProviderStats"] = {};
109
+ for (const config of configData) {
110
+ perModelProviderStats[`${config.provider}:${config.model}`] = {
111
+ logs: 0,
112
+ tokens: 0,
113
+ promptTokens: 0,
114
+ completionTokens: 0,
115
+ cost: 0,
116
+ provider: config.provider,
117
+ model: config.model,
118
+ };
119
+ }
120
+
121
+ for (const [key, modelStats] of Object.entries(
122
+ statsData.perModelProviderStats,
123
+ )) {
124
+ const [provider, model] = key.split(":");
125
+ const costData = costsData.find(
126
+ (c) => c.provider === provider && c.model === model,
127
+ );
128
+ const inputTokenCost = costData?.inputTokenCost || 0;
129
+ const outputTokenCost = costData?.outputTokenCost || 0;
130
+
131
+ perModelProviderStats[key] = {
132
+ ...modelStats,
133
+ cost:
134
+ modelStats.promptTokens * inputTokenCost +
135
+ modelStats.completionTokens * outputTokenCost,
136
+ };
137
+ }
138
+
139
+ setStats({
140
+ totalLogs: statsData.totalLogs,
141
+ totalTokens: statsData.totalTokens,
142
+ totalPromptTokens: statsData.totalPromptTokens,
143
+ totalCompletionTokens: statsData.totalCompletionTokens,
144
+ perModelProviderStats,
145
+ tokenUsageOverTime: statsData.tokenUsageOverTime,
146
+ });
147
+ setTokenUsageOverTime(statsData.tokenUsageOverTime);
148
+ setConfigurations(configData);
149
+ setLoading(false);
150
+ } catch (error) {
151
+ console.error("Error fetching data:", error);
152
+ setError("Error loading data. Please try again later.");
153
+ setLoading(false);
154
+ }
155
+ };
156
+ fetchData();
157
+ }, [timeFilter]);
158
+
159
+ const handleMetricToggle = (metric: string) => {
160
+ setSelectedMetrics((prev) =>
161
+ prev.includes(metric)
162
+ ? prev.filter((m) => m !== metric)
163
+ : [...prev, metric],
164
+ );
165
+ };
166
+
167
+ if (loading) {
168
+ return (
169
+ <div className="container mx-auto p-8">
170
+ <Skeleton className="mb-8 h-12 w-64" />
171
+ <div className="mb-8 grid grid-cols-1 gap-6 md:grid-cols-3">
172
+ {["card1", "card2", "card3"].map((key) => (
173
+ <Card key={key}>
174
+ <CardHeader>
175
+ <Skeleton className="h-6 w-32" />
176
+ </CardHeader>
177
+ <CardContent>
178
+ <Skeleton className="h-8 w-24" />
179
+ </CardContent>
180
+ </Card>
181
+ ))}
182
+ </div>
183
+ {["card1", "card2", "card3"].map((key) => (
184
+ <Card key={key} className="mb-8">
185
+ <CardHeader>
186
+ <Skeleton className="h-6 w-48" />
187
+ </CardHeader>
188
+ <CardContent>
189
+ <Skeleton className="h-[400px] w-full" />
190
+ </CardContent>
191
+ </Card>
192
+ ))}
193
+ </div>
194
+ );
195
+ }
196
+
197
+ if (error) {
198
+ return (
199
+ <div className="container mx-auto p-8">
200
+ <Card className="border-red-300 bg-red-100">
201
+ <CardHeader>
202
+ <CardTitle className="text-red-800">Error</CardTitle>
203
+ </CardHeader>
204
+ <CardContent>
205
+ <p className="text-red-700">{error}</p>
206
+ </CardContent>
207
+ </Card>
208
+ </div>
209
+ );
210
+ }
211
+
212
+ if (!stats) return null;
213
+
214
+ const chartData = Object.entries(stats.perModelProviderStats).map(
215
+ ([key, data]) => ({
216
+ provider: data.provider,
217
+ model: data.model,
218
+ logs: data.logs,
219
+ tokens: data.tokens,
220
+ promptTokens: data.promptTokens,
221
+ completionTokens: data.completionTokens,
222
+ cost: data.cost,
223
+ }),
224
+ );
225
+
226
+ const pieChartData = Object.entries(stats.perModelProviderStats).map(
227
+ ([key, data]) => ({
228
+ name: key,
229
+ value: data.logs,
230
+ }),
231
+ );
232
+
233
+ const COLORS = ["#0088FE", "#00C49F", "#FFBB28", "#FF8042", "#8884D8"];
234
+
235
+ return (
236
+ <div className="container mx-auto p-8">
237
+ <h1 className="mb-8 text-3xl font-bold">Analytics Dashboard</h1>
238
+
239
+ <div className="mb-8">
240
+ <Select
241
+ onValueChange={(value) => setTimeFilter(value)}
242
+ defaultValue={timeFilter}
243
+ >
244
+ <SelectTrigger className="w-[180px]">
245
+ <SelectValue placeholder="Select time range" />
246
+ </SelectTrigger>
247
+ <SelectContent>
248
+ <SelectItem value="all">All Time</SelectItem>
249
+ <SelectItem value="day">Last 24 Hours</SelectItem>
250
+ <SelectItem value="week">Last 7 Days</SelectItem>
251
+ <SelectItem value="month">Last 30 Days</SelectItem>
252
+ </SelectContent>
253
+ </Select>
254
+ </div>
255
+
256
+ <div className="mb-8 grid grid-cols-1 gap-6 md:grid-cols-3">
257
+ <Card>
258
+ <CardHeader>
259
+ <CardTitle>Total Logs</CardTitle>
260
+ </CardHeader>
261
+ <CardContent>
262
+ <p className="text-3xl font-semibold">
263
+ {stats.totalLogs.toLocaleString()}
264
+ </p>
265
+ </CardContent>
266
+ </Card>
267
+ <Card>
268
+ <CardHeader>
269
+ <CardTitle>Total Tokens</CardTitle>
270
+ </CardHeader>
271
+ <CardContent>
272
+ <p className="text-3xl font-semibold">
273
+ {stats.totalTokens.toLocaleString()}
274
+ </p>
275
+ </CardContent>
276
+ </Card>
277
+ <Card>
278
+ <CardHeader>
279
+ <CardTitle>Total Cost</CardTitle>
280
+ </CardHeader>
281
+ <CardContent>
282
+ <p className="text-3xl font-semibold">
283
+ $
284
+ {Object.values(stats.perModelProviderStats)
285
+ .reduce((sum, data) => sum + data.cost, 0)
286
+ .toFixed(2)}
287
+ </p>
288
+ </CardContent>
289
+ </Card>
290
+ </div>
291
+
292
+ <div className="mb-4 flex flex-wrap gap-4">
293
+ {Object.entries(chartConfig).map(([key, config]) => (
294
+ <div key={key} className="flex items-center space-x-2">
295
+ <Checkbox
296
+ id={key}
297
+ checked={selectedMetrics.includes(key)}
298
+ onCheckedChange={() => handleMetricToggle(key)}
299
+ />
300
+ <label
301
+ htmlFor={key}
302
+ className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
303
+ >
304
+ {config.label}
305
+ </label>
306
+ </div>
307
+ ))}
308
+ </div>
309
+
310
+ <Card className="mb-8">
311
+ <CardHeader>
312
+ <CardTitle>Per Model and Provider Statistics</CardTitle>
313
+ </CardHeader>
314
+ <CardContent>
315
+ <ChartContainer config={chartConfig} className="h-[400px] w-full">
316
+ <ResponsiveContainer width="100%" height="100%">
317
+ <BarChart data={chartData} accessibilityLayer>
318
+ <CartesianGrid vertical={false} strokeDasharray="3 3" />
319
+ <XAxis
320
+ dataKey="model"
321
+ tickLine={false}
322
+ tickMargin={10}
323
+ axisLine={false}
324
+ stroke="currentColor"
325
+ />
326
+ <YAxis yAxisId="left" stroke="currentColor" />
327
+ <YAxis
328
+ yAxisId="right"
329
+ orientation="right"
330
+ stroke="currentColor"
331
+ />
332
+ <ChartTooltip
333
+ content={({ active, payload }) => {
334
+ if (active && payload && payload.length) {
335
+ return (
336
+ <div className="rounded-lg bg-white p-2 shadow-md">
337
+ <p className="font-bold">{`${payload[0].payload.provider}: ${payload[0].payload.model}`}</p>
338
+ {payload.map((entry) => (
339
+ <p key={entry.name} style={{ color: entry.color }}>
340
+ {`${entry.name}: ${entry.value}`}
341
+ </p>
342
+ ))}
343
+ </div>
344
+ );
345
+ }
346
+ return null;
347
+ }}
348
+ />
349
+ <ChartLegend content={<ChartLegendContent />} />
350
+ {selectedMetrics.includes("logs") && (
351
+ <Bar
352
+ yAxisId="left"
353
+ dataKey="logs"
354
+ fill="var(--color-logs)"
355
+ radius={4}
356
+ />
357
+ )}
358
+ {selectedMetrics.includes("tokens") && (
359
+ <Bar
360
+ yAxisId="left"
361
+ dataKey="tokens"
362
+ fill="var(--color-tokens)"
363
+ radius={4}
364
+ />
365
+ )}
366
+ {selectedMetrics.includes("promptTokens") && (
367
+ <Bar
368
+ yAxisId="left"
369
+ dataKey="promptTokens"
370
+ fill="var(--color-promptTokens)"
371
+ radius={4}
372
+ />
373
+ )}
374
+ {selectedMetrics.includes("completionTokens") && (
375
+ <Bar
376
+ yAxisId="left"
377
+ dataKey="completionTokens"
378
+ fill="var(--color-completionTokens)"
379
+ radius={4}
380
+ />
381
+ )}
382
+ {selectedMetrics.includes("cost") && (
383
+ <Bar
384
+ yAxisId="right"
385
+ dataKey="cost"
386
+ fill="var(--color-cost)"
387
+ radius={4}
388
+ />
389
+ )}
390
+ </BarChart>
391
+ </ResponsiveContainer>
392
+ </ChartContainer>
393
+ </CardContent>
394
+ </Card>
395
+
396
+ <Card className="mb-8">
397
+ <CardHeader>
398
+ <CardTitle>Token Usage Over Time</CardTitle>
399
+ </CardHeader>
400
+ <CardContent>
401
+ <ChartContainer config={chartConfig} className="h-[400px] w-full">
402
+ <ResponsiveContainer width="100%" height="100%">
403
+ <LineChart data={tokenUsageOverTime} accessibilityLayer>
404
+ <CartesianGrid strokeDasharray="3 3" />
405
+ <XAxis dataKey="date" />
406
+ <YAxis />
407
+ <ChartTooltip content={<ChartTooltipContent />} />
408
+ <ChartLegend content={<ChartLegendContent />} />
409
+ <Line
410
+ type="monotone"
411
+ dataKey="tokens"
412
+ stroke="var(--color-tokens)"
413
+ name="Total Tokens"
414
+ />
415
+ </LineChart>
416
+ </ResponsiveContainer>
417
+ </ChartContainer>
418
+ </CardContent>
419
+ </Card>
420
+
421
+ <Card className="mb-8">
422
+ <CardHeader>
423
+ <CardTitle>Model and Provider Usage Distribution</CardTitle>
424
+ </CardHeader>
425
+ <CardContent>
426
+ <ChartContainer config={chartConfig} className="h-[400px] w-full">
427
+ <ResponsiveContainer width="100%" height="100%">
428
+ <PieChart>
429
+ <Pie
430
+ data={pieChartData}
431
+ cx="50%"
432
+ cy="50%"
433
+ labelLine={true}
434
+ outerRadius={150}
435
+ fill="#8884d8"
436
+ dataKey="value"
437
+ label={({ name, percent }) =>
438
+ `${name} ${(percent * 100).toFixed(0)}%`
439
+ }
440
+ >
441
+ {pieChartData.map((entry) => (
442
+ <Cell
443
+ key={entry.name}
444
+ fill={COLORS[pieChartData.indexOf(entry) % COLORS.length]}
445
+ />
446
+ ))}
447
+ </Pie>
448
+ <ChartTooltip content={<ChartTooltipContent />} />
449
+ <ChartLegend content={<ChartLegendContent />} />
450
+ </PieChart>
451
+ </ResponsiveContainer>
452
+ </ChartContainer>
453
+ </CardContent>
454
+ </Card>
455
+ </div>
456
+ );
457
+ }
workers1/auto3d/CursorLens/src/app/twitter-image.png ADDED
workers1/auto3d/CursorLens/src/components/LogDetails.tsx ADDED
@@ -0,0 +1,427 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use client";
2
+
3
+ import { useState, useEffect } from "react";
4
+ import { Card, CardHeader, CardTitle, CardContent } from "@/components/ui/card";
5
+ import { Skeleton } from "@/components/ui/skeleton";
6
+ import { Alert, AlertDescription } from "@/components/ui/alert";
7
+ import {
8
+ Prism as SyntaxHighlighter,
9
+ SyntaxHighlighterProps,
10
+ } from "react-syntax-highlighter";
11
+ import * as themes from "react-syntax-highlighter/dist/esm/styles/prism";
12
+ import { Button } from "@/components/ui/button";
13
+ import { Copy, ChevronDown, ChevronUp } from "lucide-react";
14
+ import ReactMarkdown from "react-markdown";
15
+ import { toast } from "sonner";
16
+ import { useSearchParams } from "next/navigation";
17
+ import {
18
+ Table,
19
+ TableBody,
20
+ TableCell,
21
+ TableHead,
22
+ TableHeader,
23
+ TableRow,
24
+ } from "@/components/ui/table";
25
+
26
+ interface Log {
27
+ id: number;
28
+ method: string;
29
+ url: string;
30
+ timestamp: string;
31
+ headers: string;
32
+ body: string;
33
+ response: string | null;
34
+ metadata: {
35
+ inputTokens: number;
36
+ outputTokens: number;
37
+ totalTokens: number;
38
+ inputCost: number;
39
+ outputCost: number;
40
+ totalCost: number;
41
+ };
42
+ }
43
+
44
+ interface LogDetailsProps {
45
+ logId: string;
46
+ }
47
+
48
+ export default function LogDetails({ logId }: LogDetailsProps) {
49
+ const [log, setLog] = useState<Log | null>(null);
50
+ const [error, setError] = useState<string | null>(null);
51
+ const [theme, setTheme] = useState<SyntaxHighlighterProps["style"] | null>(
52
+ null,
53
+ );
54
+ const searchParams = useSearchParams();
55
+ const [expandedSections, setExpandedSections] = useState({
56
+ response: true,
57
+ body: true,
58
+ headers: true,
59
+ });
60
+
61
+ useEffect(() => {
62
+ const fetchLog = async () => {
63
+ if (logId) {
64
+ try {
65
+ const response = await fetch(`/api/logs/${logId}`);
66
+ if (!response.ok) {
67
+ throw new Error("Failed to fetch log");
68
+ }
69
+ const logData: Log = await response.json();
70
+ setLog(logData);
71
+ } catch (err) {
72
+ setError("Error fetching log data");
73
+ console.error(err);
74
+ }
75
+ }
76
+ };
77
+
78
+ fetchLog();
79
+
80
+ const loadTheme = () => {
81
+ const themeName = "vscDarkPlus";
82
+ setTheme(
83
+ themes[
84
+ themeName as keyof typeof themes
85
+ ] as SyntaxHighlighterProps["style"],
86
+ );
87
+ };
88
+ loadTheme();
89
+ }, [logId, searchParams]);
90
+
91
+ const toggleSection = (section: "response" | "body" | "headers") => {
92
+ setExpandedSections((prev) => ({
93
+ ...prev,
94
+ [section]: !prev[section],
95
+ }));
96
+ };
97
+
98
+ if (error) {
99
+ return (
100
+ <Alert variant="destructive" className="w-2/3">
101
+ <AlertDescription>{error}</AlertDescription>
102
+ </Alert>
103
+ );
104
+ }
105
+
106
+ if (!log) {
107
+ return (
108
+ <Card className="">
109
+ <CardHeader>
110
+ <CardTitle>
111
+ <Skeleton className="h-4 w-[250px]" />
112
+ </CardTitle>
113
+ </CardHeader>
114
+ <CardContent>
115
+ <Skeleton className="mb-4 h-4 w-[300px]" />
116
+ <Skeleton className="mb-4 h-20 w-full" />
117
+ <Skeleton className="h-20 w-full" />
118
+ </CardContent>
119
+ </Card>
120
+ );
121
+ }
122
+
123
+ const parseJSON = (str: string | null) => {
124
+ if (!str) return null;
125
+ try {
126
+ return JSON.parse(str);
127
+ } catch {
128
+ return str;
129
+ }
130
+ };
131
+
132
+ const maskSensitiveInfo = (obj: any) => {
133
+ const sensitiveKeys = ["authorization", "api-key", "secret"];
134
+ if (typeof obj === "object" && obj !== null) {
135
+ Object.keys(obj).forEach((key) => {
136
+ if (
137
+ sensitiveKeys.some((sensitiveKey) =>
138
+ key.toLowerCase().includes(sensitiveKey),
139
+ )
140
+ ) {
141
+ obj[key] = "************************";
142
+ } else if (typeof obj[key] === "object") {
143
+ obj[key] = maskSensitiveInfo(obj[key]);
144
+ }
145
+ });
146
+ }
147
+ return obj;
148
+ };
149
+
150
+ const JsonHighlight = ({
151
+ content,
152
+ isExpandable = false,
153
+ }: {
154
+ content: string | null;
155
+ isExpandable?: boolean;
156
+ }) => {
157
+ const [isExpanded, setIsExpanded] = useState(!isExpandable);
158
+ const parsedContent = content;
159
+ const maskedContent = maskSensitiveInfo(parsedContent);
160
+ const jsonString =
161
+ JSON.stringify(maskedContent, null, 2) || "No data available";
162
+
163
+ const handleCopy = () => {
164
+ navigator.clipboard.writeText(jsonString);
165
+ toast.success("Copied to clipboard");
166
+ };
167
+
168
+ const toggleExpand = () => {
169
+ setIsExpanded(!isExpanded);
170
+ };
171
+
172
+ const renderAIResponse = (response: any) => {
173
+ return (
174
+ <div className="mb-4 rounded-lg bg-blue-100 p-4">
175
+ <p className="mb-2 font-bold">AI Response</p>
176
+ <ReactMarkdown
177
+ components={{
178
+ code({ node, inline, className, children, ...props }) {
179
+ const match = /language-(\w+)/.exec(className || "");
180
+ return !inline && match ? (
181
+ <SyntaxHighlighter
182
+ style={themes.tomorrow}
183
+ language={match[1]}
184
+ PreTag="div"
185
+ {...props}
186
+ >
187
+ {String(children).replace(/\n$/, "")}
188
+ </SyntaxHighlighter>
189
+ ) : (
190
+ <code className={className} {...props}>
191
+ {children}
192
+ </code>
193
+ );
194
+ },
195
+ }}
196
+ >
197
+ {response.text}
198
+ </ReactMarkdown>
199
+ </div>
200
+ );
201
+ };
202
+
203
+ const renderMessages = (messages: any[]) => {
204
+ return messages
205
+ .slice()
206
+ .reverse()
207
+ .map((message, index) => (
208
+ <div
209
+ key={index}
210
+ className={`mb-4 rounded-lg p-4 ${
211
+ message.role === "user"
212
+ ? "bg-gray-100"
213
+ : message.role === "system"
214
+ ? "bg-yellow-100"
215
+ : "bg-blue-100"
216
+ }`}
217
+ >
218
+ <p className="mb-2 font-bold">
219
+ {message.role === "user"
220
+ ? "You"
221
+ : message.role === "system"
222
+ ? "System"
223
+ : "Assistant"}
224
+ </p>
225
+ <ReactMarkdown
226
+ components={{
227
+ code({ node, inline, className, children, ...props }) {
228
+ const match = /language-(\w+)/.exec(className || "");
229
+ return !inline && match ? (
230
+ <SyntaxHighlighter
231
+ style={themes.tomorrow}
232
+ language={match[1]}
233
+ PreTag="div"
234
+ {...props}
235
+ >
236
+ {String(children).replace(/\n$/, "")}
237
+ </SyntaxHighlighter>
238
+ ) : (
239
+ <code className={className} {...props}>
240
+ {children}
241
+ </code>
242
+ );
243
+ },
244
+ }}
245
+ >
246
+ {message.content}
247
+ </ReactMarkdown>
248
+ </div>
249
+ ));
250
+ };
251
+
252
+ return (
253
+ <div className="relative">
254
+ <Button
255
+ variant="outline"
256
+ size="sm"
257
+ className="absolute right-2 top-2"
258
+ onClick={handleCopy}
259
+ >
260
+ <Copy className="h-4 w-4" />
261
+ </Button>
262
+ {isExpandable && (
263
+ <Button
264
+ variant="outline"
265
+ size="sm"
266
+ onClick={toggleExpand}
267
+ className="mb-2"
268
+ >
269
+ {isExpanded ? (
270
+ <>
271
+ <ChevronUp className="mr-2 h-4 w-4" /> Hide JSON
272
+ </>
273
+ ) : (
274
+ <>
275
+ <ChevronDown className="mr-2 h-4 w-4" /> Show JSON
276
+ </>
277
+ )}
278
+ </Button>
279
+ )}
280
+
281
+ {(isExpanded || !isExpandable) && (
282
+ <SyntaxHighlighter
283
+ language="json"
284
+ style={themes.tomorrow}
285
+ customStyle={{
286
+ margin: 0,
287
+ marginBottom: "1rem",
288
+ padding: "1rem",
289
+ borderRadius: "0.25rem",
290
+ fontSize: "0.875rem",
291
+ }}
292
+ >
293
+ {jsonString}
294
+ </SyntaxHighlighter>
295
+ )}
296
+
297
+ {parsedContent && parsedContent.text && (
298
+ <div className="mb-4">
299
+ <h4 className="mb-2 text-lg font-semibold">AI Response</h4>
300
+ {renderAIResponse(parsedContent)}
301
+ </div>
302
+ )}
303
+
304
+ {parsedContent && parsedContent.messages && (
305
+ <div className="mb-4">
306
+ <h4 className="mb-2 text-lg font-semibold">
307
+ Messages (Most recent on top)
308
+ </h4>
309
+ {renderMessages(parsedContent.messages)}
310
+ </div>
311
+ )}
312
+ </div>
313
+ );
314
+ };
315
+
316
+ const renderUsageTable = (log: Log) => {
317
+ return (
318
+ <Table className="mb-4">
319
+ <TableHeader>
320
+ <TableRow>
321
+ <TableHead>Input Tokens</TableHead>
322
+ <TableHead>Output Tokens</TableHead>
323
+ <TableHead>Total Tokens</TableHead>
324
+ <TableHead>Input Cost</TableHead>
325
+ <TableHead>Output Cost</TableHead>
326
+ <TableHead>Total Cost</TableHead>
327
+ </TableRow>
328
+ </TableHeader>
329
+ <TableBody>
330
+ <TableRow>
331
+ <TableCell>{log.metadata.inputTokens}</TableCell>
332
+ <TableCell>{log.metadata.outputTokens}</TableCell>
333
+ <TableCell>{log.metadata.totalTokens}</TableCell>
334
+ <TableCell>${log.metadata.inputCost.toFixed(4)}</TableCell>
335
+ <TableCell>${log.metadata.outputCost.toFixed(4)}</TableCell>
336
+ <TableCell>${log.metadata.totalCost.toFixed(4)}</TableCell>
337
+ </TableRow>
338
+ </TableBody>
339
+ </Table>
340
+ );
341
+ };
342
+
343
+ return (
344
+ <Card className="overflow-auto border-0 shadow-none">
345
+ <CardHeader className="">
346
+ <CardTitle>Request Details</CardTitle>
347
+ </CardHeader>
348
+ <CardContent>
349
+ <h3 className="mb-2 text-lg font-bold">
350
+ {log.method} {log.url}
351
+ </h3>
352
+ <p className="mb-4 text-sm text-gray-500">{log.timestamp}</p>
353
+
354
+ {renderUsageTable(log)}
355
+
356
+ <Card className="mt-4">
357
+ <CardHeader
358
+ className="flex cursor-pointer flex-row items-center justify-between"
359
+ onClick={() => toggleSection("response")}
360
+ >
361
+ <CardTitle className="text-base">Response</CardTitle>
362
+ <Button variant="ghost" size="sm">
363
+ {expandedSections.response ? (
364
+ <ChevronUp className="h-4 w-4" />
365
+ ) : (
366
+ <ChevronDown className="h-4 w-4" />
367
+ )}
368
+ </Button>
369
+ </CardHeader>
370
+ {expandedSections.response && (
371
+ <CardContent>
372
+ <JsonHighlight
373
+ content={parseJSON(log.response)}
374
+ isExpandable={true}
375
+ />
376
+ </CardContent>
377
+ )}
378
+ </Card>
379
+
380
+ <Card className="mt-4">
381
+ <CardHeader
382
+ className="flex cursor-pointer flex-row items-center justify-between"
383
+ onClick={() => toggleSection("body")}
384
+ >
385
+ <CardTitle className="text-base">Body</CardTitle>
386
+ <Button variant="ghost" size="sm">
387
+ {expandedSections.body ? (
388
+ <ChevronUp className="h-4 w-4" />
389
+ ) : (
390
+ <ChevronDown className="h-4 w-4" />
391
+ )}
392
+ </Button>
393
+ </CardHeader>
394
+ {expandedSections.body && (
395
+ <CardContent>
396
+ <JsonHighlight
397
+ content={parseJSON(log.body)}
398
+ isExpandable={true}
399
+ />
400
+ </CardContent>
401
+ )}
402
+ </Card>
403
+
404
+ <Card className="mt-4">
405
+ <CardHeader
406
+ className="flex cursor-pointer flex-row items-center justify-between"
407
+ onClick={() => toggleSection("headers")}
408
+ >
409
+ <CardTitle className="text-base">Headers</CardTitle>
410
+ <Button variant="ghost" size="sm">
411
+ {expandedSections.headers ? (
412
+ <ChevronUp className="h-4 w-4" />
413
+ ) : (
414
+ <ChevronDown className="h-4 w-4" />
415
+ )}
416
+ </Button>
417
+ </CardHeader>
418
+ {expandedSections.headers && (
419
+ <CardContent>
420
+ <JsonHighlight content={parseJSON(log.headers)} />
421
+ </CardContent>
422
+ )}
423
+ </Card>
424
+ </CardContent>
425
+ </Card>
426
+ );
427
+ }
workers1/auto3d/CursorLens/src/components/LogsList.tsx ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use client";
2
+
3
+ import { useEffect, useState } from "react";
4
+ import { useRouter } from "next/navigation";
5
+ import { Button } from "@/components/ui/button";
6
+ import { Card, CardHeader, CardTitle, CardContent } from "@/components/ui/card";
7
+ import { ScrollArea } from "@/components/ui/scroll-area";
8
+ import { Badge } from "@/components/ui/badge";
9
+ import { DollarSign, Clock, Hash, MessageSquare } from "lucide-react";
10
+ import { getConfigurationCosts } from "@/app/actions";
11
+
12
+ interface LogMetadata {
13
+ topP: number;
14
+ model: string;
15
+ configId: string;
16
+ provider: string;
17
+ maxTokens: number;
18
+ temperature: number;
19
+ presencePenalty: number;
20
+ frequencyPenalty: number;
21
+ totalTokens: number;
22
+ totalCost: number;
23
+ }
24
+
25
+ interface Usage {
26
+ promptTokens: number;
27
+ completionTokens: number;
28
+ totalTokens: number;
29
+ }
30
+
31
+ interface Message {
32
+ role: string;
33
+ content: string;
34
+ name?: string;
35
+ experimental_providerMetadata?: {
36
+ anthropic?: {
37
+ cacheControl?: {
38
+ type: string;
39
+ };
40
+ };
41
+ };
42
+ }
43
+
44
+ interface RequestBody {
45
+ messages: Message[];
46
+ temperature: number;
47
+ user: string;
48
+ stream: boolean;
49
+ }
50
+
51
+ interface ResponseData {
52
+ text: string;
53
+ toolCalls: any[];
54
+ toolResults: any[];
55
+ usage: Usage;
56
+ finishReason: string;
57
+ rawResponse: {
58
+ headers: Record<string, string>;
59
+ };
60
+ warnings: string[];
61
+ experimental_providerMetadata?: {
62
+ anthropic?: {
63
+ cacheCreationInputTokens?: number;
64
+ cacheReadInputTokens?: number;
65
+ };
66
+ };
67
+ }
68
+
69
+ interface Log {
70
+ id: string;
71
+ method: string;
72
+ url: string;
73
+ headers: string;
74
+ body: RequestBody; // This will be a JSON string containing RequestBody
75
+ response: ResponseData; // This will be a JSON string containing ResponseData
76
+ timestamp: string;
77
+ metadata: LogMetadata;
78
+ }
79
+
80
+ interface LogsListProps {
81
+ logs: Log[];
82
+ onLogSelect: (logId: string) => void;
83
+ selectedLogId?: string;
84
+ }
85
+
86
+ const LogsListComponent: React.FC<LogsListProps> = ({
87
+ logs,
88
+ onLogSelect,
89
+ selectedLogId,
90
+ }) => {
91
+ const getProviderColor = (provider: string) => {
92
+ const colors: Record<string, string> = {
93
+ anthropic: "bg-purple-100 text-purple-800 border-purple-300",
94
+ anthropicCached: "bg-indigo-100 text-indigo-800 border-indigo-300",
95
+ openai: "bg-green-100 text-green-800 border-green-300",
96
+ cohere: "bg-blue-100 text-blue-800 border-blue-300",
97
+ mistral: "bg-red-100 text-red-800 border-red-300",
98
+ groq: "bg-yellow-100 text-yellow-800 border-yellow-300",
99
+ ollama: "bg-orange-100 text-orange-800 border-orange-300",
100
+ other: "bg-gray-100 text-gray-800 border-gray-300",
101
+ };
102
+ return colors[provider] || "bg-gray-100 text-gray-800 border-gray-300";
103
+ };
104
+
105
+ if (!Array.isArray(logs) || logs.length === 0) {
106
+ return <p>No logs available.</p>;
107
+ }
108
+
109
+ return (
110
+ <div className="space-y-4">
111
+ {logs.map((log) => {
112
+ const totalTokens = log.metadata.totalTokens || 0;
113
+ const totalCost = log.metadata.totalCost || 0;
114
+ const firstUserMessage =
115
+ log.body.messages.find((m) => m.role === "user" && !("name" in m))
116
+ ?.content || "No message available";
117
+ const truncatedMessage =
118
+ firstUserMessage.slice(0, 100) +
119
+ (firstUserMessage.length > 100 ? "..." : "");
120
+ const isSelected = selectedLogId === log.id;
121
+ const providerColorClass = getProviderColor(log.metadata.provider);
122
+
123
+ return (
124
+ <Card
125
+ key={log.id}
126
+ className={`mx-1 overflow-hidden transition-all duration-200 ${
127
+ isSelected
128
+ ? `border-r-4 shadow-lg border-${providerColorClass}`
129
+ : "hover:cursor-pointer hover:shadow-md"
130
+ }`}
131
+ onClick={() => onLogSelect(log.id)}
132
+ >
133
+ <CardHeader className={` ${providerColorClass}`}>
134
+ <CardTitle className="line-clamp-2 text-base font-medium">
135
+ {truncatedMessage}
136
+ </CardTitle>
137
+ </CardHeader>
138
+ <CardContent className="p-4">
139
+ <div className="mb-2 flex items-center justify-between">
140
+ <div className="flex items-center space-x-2">
141
+ <Badge
142
+ variant="outline"
143
+ className={getProviderColor(log.metadata.provider)}
144
+ >
145
+ {log.metadata.provider}
146
+ </Badge>
147
+ <span className="text-sm font-medium">
148
+ {log.metadata.model}
149
+ </span>
150
+ </div>
151
+ </div>
152
+
153
+ <div className="mt-2 flex items-center justify-between">
154
+ <div className="flex w-full items-center justify-between space-x-4">
155
+ <div className="flex items-center text-sm text-muted-foreground">
156
+ <Clock className="mr-1 h-4 w-4" />
157
+ <span>{new Date(log.timestamp).toLocaleString()}</span>
158
+ </div>
159
+ <div className="flex items-center text-green-600">
160
+ <DollarSign className="mr-1 h-4 w-4" />
161
+ <span className="text-sm font-medium">
162
+ {totalCost.toFixed(4)}
163
+ </span>
164
+ </div>
165
+ <div className="flex items-center">
166
+ <Hash className="mr-1 h-4 w-4 text-muted-foreground" />
167
+ <span className="text-sm">{totalTokens} tokens</span>
168
+ </div>
169
+ </div>
170
+ </div>
171
+ </CardContent>
172
+ </Card>
173
+ );
174
+ })}
175
+ </div>
176
+ );
177
+ };
178
+
179
+ export default function LogsList({
180
+ logs,
181
+ onLogSelect,
182
+ selectedLogId,
183
+ }: LogsListProps) {
184
+ const router = useRouter();
185
+
186
+ return (
187
+ <Card className="h-[calc(100vh-140px)]">
188
+ <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
189
+ <CardTitle className="text-xl font-bold">Requests</CardTitle>
190
+ </CardHeader>
191
+ <CardContent>
192
+ <ScrollArea className="h-[calc(100vh-200px)]">
193
+ <LogsListComponent
194
+ logs={logs}
195
+ onLogSelect={onLogSelect}
196
+ selectedLogId={selectedLogId}
197
+ />
198
+ </ScrollArea>
199
+ </CardContent>
200
+ </Card>
201
+ );
202
+ }
workers1/auto3d/CursorLens/src/components/NavBar.tsx ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use client';
2
+
3
+ import Link from 'next/link';
4
+ import { usePathname } from 'next/navigation';
5
+ import { ThemeToggle } from './theme-toggle';
6
+
7
+ function NavLink({
8
+ href,
9
+ children,
10
+ }: {
11
+ href: string;
12
+ children: React.ReactNode;
13
+ }) {
14
+ const pathname = usePathname();
15
+ const active = pathname === href;
16
+
17
+ return (
18
+ <Link
19
+ href={href}
20
+ className={`px-4 py-2 rounded-full transition-colors duration-200 ${
21
+ active
22
+ ? 'bg-primary-foreground text-primary font-semibold'
23
+ : 'text-primary-foreground hover:bg-primary-foreground/10'
24
+ }`}
25
+ >
26
+ {children}
27
+ </Link>
28
+ );
29
+ }
30
+
31
+ export default function NavBar() {
32
+ return (
33
+ <nav className='flex items-center justify-center'>
34
+ <div className='flex items-center space-x-6'>
35
+ <NavLink href='/'>Home</NavLink>
36
+ <NavLink href='/logs'>Logs</NavLink>
37
+ <NavLink href='/configurations'>Configurations</NavLink>
38
+ <NavLink href='/stats'>Stats</NavLink>
39
+ <ThemeToggle />
40
+ </div>
41
+ </nav>
42
+ );
43
+ }
workers1/auto3d/CursorLens/src/components/theme-provider.tsx ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import { ThemeProvider as NextThemesProvider } from 'next-themes';
5
+ import { type ThemeProviderProps } from 'next-themes/dist/types';
6
+
7
+ export function ThemeProvider({ children, ...props }: ThemeProviderProps) {
8
+ return <NextThemesProvider {...props}>{children}</NextThemesProvider>;
9
+ }
workers1/auto3d/CursorLens/src/components/theme-toggle.tsx ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import { Moon, Sun } from 'lucide-react';
5
+ import { useTheme } from 'next-themes';
6
+
7
+ export function ThemeToggle() {
8
+ const { setTheme, theme } = useTheme();
9
+
10
+ return (
11
+ <button
12
+ onClick={() => setTheme(theme === 'light' ? 'dark' : 'light')}
13
+ className='p-2 rounded-full hover:bg-primary-foreground/10 relative'
14
+ >
15
+ <Sun className='h-5 w-5 transition-all dark:absolute dark:opacity-0' />
16
+ <Moon className='h-5 w-5 absolute transition-all opacity-0 dark:opacity-100 dark:static' />
17
+ <span className='sr-only'>Toggle theme</span>
18
+ </button>
19
+ );
20
+ }
workers1/auto3d/CursorLens/src/components/ui/alert.tsx ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as React from "react"
2
+ import { cva, type VariantProps } from "class-variance-authority"
3
+
4
+ import { cn } from "@/lib/utils"
5
+
6
+ const alertVariants = cva(
7
+ "relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",
8
+ {
9
+ variants: {
10
+ variant: {
11
+ default: "bg-background text-foreground",
12
+ destructive:
13
+ "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",
14
+ },
15
+ },
16
+ defaultVariants: {
17
+ variant: "default",
18
+ },
19
+ }
20
+ )
21
+
22
+ const Alert = React.forwardRef<
23
+ HTMLDivElement,
24
+ React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>
25
+ >(({ className, variant, ...props }, ref) => (
26
+ <div
27
+ ref={ref}
28
+ role="alert"
29
+ className={cn(alertVariants({ variant }), className)}
30
+ {...props}
31
+ />
32
+ ))
33
+ Alert.displayName = "Alert"
34
+
35
+ const AlertTitle = React.forwardRef<
36
+ HTMLParagraphElement,
37
+ React.HTMLAttributes<HTMLHeadingElement>
38
+ >(({ className, ...props }, ref) => (
39
+ <h5
40
+ ref={ref}
41
+ className={cn("mb-1 font-medium leading-none tracking-tight", className)}
42
+ {...props}
43
+ />
44
+ ))
45
+ AlertTitle.displayName = "AlertTitle"
46
+
47
+ const AlertDescription = React.forwardRef<
48
+ HTMLParagraphElement,
49
+ React.HTMLAttributes<HTMLParagraphElement>
50
+ >(({ className, ...props }, ref) => (
51
+ <div
52
+ ref={ref}
53
+ className={cn("text-sm [&_p]:leading-relaxed", className)}
54
+ {...props}
55
+ />
56
+ ))
57
+ AlertDescription.displayName = "AlertDescription"
58
+
59
+ export { Alert, AlertTitle, AlertDescription }
workers1/auto3d/CursorLens/src/components/ui/badge.tsx ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as React from "react"
2
+ import { cva, type VariantProps } from "class-variance-authority"
3
+
4
+ import { cn } from "@/lib/utils"
5
+
6
+ const badgeVariants = cva(
7
+ "inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
8
+ {
9
+ variants: {
10
+ variant: {
11
+ default:
12
+ "border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",
13
+ secondary:
14
+ "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
15
+ destructive:
16
+ "border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",
17
+ outline: "text-foreground",
18
+ },
19
+ },
20
+ defaultVariants: {
21
+ variant: "default",
22
+ },
23
+ }
24
+ )
25
+
26
+ export interface BadgeProps
27
+ extends React.HTMLAttributes<HTMLDivElement>,
28
+ VariantProps<typeof badgeVariants> {}
29
+
30
+ function Badge({ className, variant, ...props }: BadgeProps) {
31
+ return (
32
+ <div className={cn(badgeVariants({ variant }), className)} {...props} />
33
+ )
34
+ }
35
+
36
+ export { Badge, badgeVariants }
workers1/auto3d/CursorLens/src/components/ui/button.tsx ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as React from "react"
2
+ import { Slot } from "@radix-ui/react-slot"
3
+ import { cva, type VariantProps } from "class-variance-authority"
4
+
5
+ import { cn } from "@/lib/utils"
6
+
7
+ const buttonVariants = cva(
8
+ "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
9
+ {
10
+ variants: {
11
+ variant: {
12
+ default:
13
+ "bg-primary text-primary-foreground shadow hover:bg-primary/90",
14
+ destructive:
15
+ "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
16
+ outline:
17
+ "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
18
+ secondary:
19
+ "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
20
+ ghost: "hover:bg-accent hover:text-accent-foreground",
21
+ link: "text-primary underline-offset-4 hover:underline",
22
+ },
23
+ size: {
24
+ default: "h-9 px-4 py-2",
25
+ sm: "h-8 rounded-md px-3 text-xs",
26
+ lg: "h-10 rounded-md px-8",
27
+ icon: "h-9 w-9",
28
+ },
29
+ },
30
+ defaultVariants: {
31
+ variant: "default",
32
+ size: "default",
33
+ },
34
+ }
35
+ )
36
+
37
+ export interface ButtonProps
38
+ extends React.ButtonHTMLAttributes<HTMLButtonElement>,
39
+ VariantProps<typeof buttonVariants> {
40
+ asChild?: boolean
41
+ }
42
+
43
+ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
44
+ ({ className, variant, size, asChild = false, ...props }, ref) => {
45
+ const Comp = asChild ? Slot : "button"
46
+ return (
47
+ <Comp
48
+ className={cn(buttonVariants({ variant, size, className }))}
49
+ ref={ref}
50
+ {...props}
51
+ />
52
+ )
53
+ }
54
+ )
55
+ Button.displayName = "Button"
56
+
57
+ export { Button, buttonVariants }
workers1/auto3d/CursorLens/src/components/ui/calendar.tsx ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { ChevronLeftIcon, ChevronRightIcon } from "@radix-ui/react-icons"
5
+ import { DayPicker } from "react-day-picker"
6
+
7
+ import { cn } from "@/lib/utils"
8
+ import { buttonVariants } from "@/components/ui/button"
9
+
10
+ export type CalendarProps = React.ComponentProps<typeof DayPicker>
11
+
12
+ function Calendar({
13
+ className,
14
+ classNames,
15
+ showOutsideDays = true,
16
+ ...props
17
+ }: CalendarProps) {
18
+ return (
19
+ <DayPicker
20
+ showOutsideDays={showOutsideDays}
21
+ className={cn("p-3", className)}
22
+ classNames={{
23
+ months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",
24
+ month: "space-y-4",
25
+ caption: "flex justify-center pt-1 relative items-center",
26
+ caption_label: "text-sm font-medium",
27
+ nav: "space-x-1 flex items-center",
28
+ nav_button: cn(
29
+ buttonVariants({ variant: "outline" }),
30
+ "h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
31
+ ),
32
+ nav_button_previous: "absolute left-1",
33
+ nav_button_next: "absolute right-1",
34
+ table: "w-full border-collapse space-y-1",
35
+ head_row: "flex",
36
+ head_cell:
37
+ "text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",
38
+ row: "flex w-full mt-2",
39
+ cell: cn(
40
+ "relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected].day-range-end)]:rounded-r-md",
41
+ props.mode === "range"
42
+ ? "[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md"
43
+ : "[&:has([aria-selected])]:rounded-md"
44
+ ),
45
+ day: cn(
46
+ buttonVariants({ variant: "ghost" }),
47
+ "h-8 w-8 p-0 font-normal aria-selected:opacity-100"
48
+ ),
49
+ day_range_start: "day-range-start",
50
+ day_range_end: "day-range-end",
51
+ day_selected:
52
+ "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",
53
+ day_today: "bg-accent text-accent-foreground",
54
+ day_outside:
55
+ "day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",
56
+ day_disabled: "text-muted-foreground opacity-50",
57
+ day_range_middle:
58
+ "aria-selected:bg-accent aria-selected:text-accent-foreground",
59
+ day_hidden: "invisible",
60
+ ...classNames,
61
+ }}
62
+ components={{
63
+ IconLeft: ({ ...props }) => <ChevronLeftIcon className="h-4 w-4" />,
64
+ IconRight: ({ ...props }) => <ChevronRightIcon className="h-4 w-4" />,
65
+ }}
66
+ {...props}
67
+ />
68
+ )
69
+ }
70
+ Calendar.displayName = "Calendar"
71
+
72
+ export { Calendar }
workers1/auto3d/CursorLens/src/components/ui/card.tsx ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as React from "react"
2
+
3
+ import { cn } from "@/lib/utils"
4
+
5
+ const Card = React.forwardRef<
6
+ HTMLDivElement,
7
+ React.HTMLAttributes<HTMLDivElement>
8
+ >(({ className, ...props }, ref) => (
9
+ <div
10
+ ref={ref}
11
+ className={cn(
12
+ "rounded-xl border bg-card text-card-foreground shadow",
13
+ className
14
+ )}
15
+ {...props}
16
+ />
17
+ ))
18
+ Card.displayName = "Card"
19
+
20
+ const CardHeader = React.forwardRef<
21
+ HTMLDivElement,
22
+ React.HTMLAttributes<HTMLDivElement>
23
+ >(({ className, ...props }, ref) => (
24
+ <div
25
+ ref={ref}
26
+ className={cn("flex flex-col space-y-1.5 p-6", className)}
27
+ {...props}
28
+ />
29
+ ))
30
+ CardHeader.displayName = "CardHeader"
31
+
32
+ const CardTitle = React.forwardRef<
33
+ HTMLParagraphElement,
34
+ React.HTMLAttributes<HTMLHeadingElement>
35
+ >(({ className, ...props }, ref) => (
36
+ <h3
37
+ ref={ref}
38
+ className={cn("font-semibold leading-none tracking-tight", className)}
39
+ {...props}
40
+ />
41
+ ))
42
+ CardTitle.displayName = "CardTitle"
43
+
44
+ const CardDescription = React.forwardRef<
45
+ HTMLParagraphElement,
46
+ React.HTMLAttributes<HTMLParagraphElement>
47
+ >(({ className, ...props }, ref) => (
48
+ <p
49
+ ref={ref}
50
+ className={cn("text-sm text-muted-foreground", className)}
51
+ {...props}
52
+ />
53
+ ))
54
+ CardDescription.displayName = "CardDescription"
55
+
56
+ const CardContent = React.forwardRef<
57
+ HTMLDivElement,
58
+ React.HTMLAttributes<HTMLDivElement>
59
+ >(({ className, ...props }, ref) => (
60
+ <div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
61
+ ))
62
+ CardContent.displayName = "CardContent"
63
+
64
+ const CardFooter = React.forwardRef<
65
+ HTMLDivElement,
66
+ React.HTMLAttributes<HTMLDivElement>
67
+ >(({ className, ...props }, ref) => (
68
+ <div
69
+ ref={ref}
70
+ className={cn("flex items-center p-6 pt-0", className)}
71
+ {...props}
72
+ />
73
+ ))
74
+ CardFooter.displayName = "CardFooter"
75
+
76
+ export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }
workers1/auto3d/CursorLens/src/components/ui/chart.tsx ADDED
@@ -0,0 +1,370 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import * as RechartsPrimitive from 'recharts';
5
+ import {
6
+ NameType,
7
+ Payload,
8
+ ValueType,
9
+ } from 'recharts/types/component/DefaultTooltipContent';
10
+
11
+ import { cn } from '@/lib/utils';
12
+
13
+ // Format: { THEME_NAME: CSS_SELECTOR }
14
+ const THEMES = { light: '', dark: '.dark' } as const;
15
+
16
+ export type ChartConfig = {
17
+ [k in string]: {
18
+ label?: React.ReactNode;
19
+ icon?: React.ComponentType;
20
+ } & (
21
+ | { color?: string; theme?: never }
22
+ | { color?: never; theme: Record<keyof typeof THEMES, string> }
23
+ );
24
+ };
25
+
26
+ type ChartContextProps = {
27
+ config: ChartConfig;
28
+ };
29
+
30
+ const ChartContext = React.createContext<ChartContextProps | null>(null);
31
+
32
+ function useChart() {
33
+ const context = React.useContext(ChartContext);
34
+
35
+ if (!context) {
36
+ throw new Error('useChart must be used within a <ChartContainer />');
37
+ }
38
+
39
+ return context;
40
+ }
41
+
42
+ const ChartContainer = React.forwardRef<
43
+ HTMLDivElement,
44
+ React.ComponentProps<'div'> & {
45
+ config: ChartConfig;
46
+ children: React.ComponentProps<
47
+ typeof RechartsPrimitive.ResponsiveContainer
48
+ >['children'];
49
+ }
50
+ >(({ id, className, children, config, ...props }, ref) => {
51
+ const uniqueId = React.useId();
52
+ const chartId = `chart-${id || uniqueId.replace(/:/g, '')}`;
53
+
54
+ return (
55
+ <ChartContext.Provider value={{ config }}>
56
+ <div
57
+ data-chart={chartId}
58
+ ref={ref}
59
+ className={cn(
60
+ "flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",
61
+ className
62
+ )}
63
+ {...props}
64
+ >
65
+ <ChartStyle id={chartId} config={config} />
66
+ <RechartsPrimitive.ResponsiveContainer>
67
+ {children}
68
+ </RechartsPrimitive.ResponsiveContainer>
69
+ </div>
70
+ </ChartContext.Provider>
71
+ );
72
+ });
73
+ ChartContainer.displayName = 'Chart';
74
+
75
+ const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
76
+ const colorConfig = Object.entries(config).filter(
77
+ ([_, config]) => config.theme || config.color
78
+ );
79
+
80
+ if (!colorConfig.length) {
81
+ return null;
82
+ }
83
+
84
+ return (
85
+ <style
86
+ dangerouslySetInnerHTML={{
87
+ __html: Object.entries(THEMES)
88
+ .map(
89
+ ([theme, prefix]) => `
90
+ ${prefix} [data-chart=${id}] {
91
+ ${colorConfig
92
+ .map(([key, itemConfig]) => {
93
+ const color =
94
+ itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ||
95
+ itemConfig.color;
96
+ return color ? ` --color-${key}: ${color};` : null;
97
+ })
98
+ .join('\n')}
99
+ }
100
+ `
101
+ )
102
+ .join('\n'),
103
+ }}
104
+ />
105
+ );
106
+ };
107
+
108
+ const ChartTooltip = RechartsPrimitive.Tooltip;
109
+
110
+ const ChartTooltipContent = React.forwardRef<
111
+ HTMLDivElement,
112
+ React.ComponentProps<typeof RechartsPrimitive.Tooltip> &
113
+ React.ComponentProps<'div'> & {
114
+ hideLabel?: boolean;
115
+ hideIndicator?: boolean;
116
+ indicator?: 'line' | 'dot' | 'dashed';
117
+ nameKey?: string;
118
+ labelKey?: string;
119
+ }
120
+ >(
121
+ (
122
+ {
123
+ active,
124
+ payload,
125
+ className,
126
+ indicator = 'dot',
127
+ hideLabel = false,
128
+ hideIndicator = false,
129
+ label,
130
+ labelFormatter,
131
+ labelClassName,
132
+ formatter,
133
+ color,
134
+ nameKey,
135
+ labelKey,
136
+ },
137
+ ref
138
+ ) => {
139
+ const { config } = useChart();
140
+
141
+ const tooltipLabel = React.useMemo(() => {
142
+ if (hideLabel || !payload?.length) {
143
+ return null;
144
+ }
145
+
146
+ const [item] = payload;
147
+ const key = `${labelKey || item.dataKey || item.name || 'value'}`;
148
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
149
+ const value =
150
+ !labelKey && typeof label === 'string'
151
+ ? config[label as keyof typeof config]?.label || label
152
+ : itemConfig?.label;
153
+
154
+ if (labelFormatter) {
155
+ return (
156
+ <div className={cn('font-medium', labelClassName)}>
157
+ {labelFormatter(value, payload)}
158
+ </div>
159
+ );
160
+ }
161
+
162
+ if (!value) {
163
+ return null;
164
+ }
165
+
166
+ return <div className={cn('font-medium', labelClassName)}>{value}</div>;
167
+ }, [
168
+ label,
169
+ labelFormatter,
170
+ payload,
171
+ hideLabel,
172
+ labelClassName,
173
+ config,
174
+ labelKey,
175
+ ]);
176
+
177
+ if (!active || !payload?.length) {
178
+ return null;
179
+ }
180
+
181
+ const nestLabel = payload.length === 1 && indicator !== 'dot';
182
+
183
+ return (
184
+ <div
185
+ ref={ref}
186
+ className={cn(
187
+ 'grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl',
188
+ className
189
+ )}
190
+ >
191
+ {!nestLabel ? tooltipLabel : null}
192
+ <div className='grid gap-1.5'>
193
+ {payload.map((item, index) => {
194
+ const key = `${nameKey || item.name || item.dataKey || 'value'}`;
195
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
196
+ const indicatorColor = color || item.payload.fill || item.color;
197
+
198
+ return (
199
+ <div
200
+ key={item.dataKey}
201
+ className={cn(
202
+ 'flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground',
203
+ indicator === 'dot' && 'items-center'
204
+ )}
205
+ >
206
+ {formatter && item?.value !== undefined && item.name ? (
207
+ formatter(item.value, item.name, item, index, item.payload)
208
+ ) : (
209
+ <>
210
+ {itemConfig?.icon ? (
211
+ <itemConfig.icon />
212
+ ) : (
213
+ !hideIndicator && (
214
+ <div
215
+ className={cn(
216
+ 'shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]',
217
+ {
218
+ 'h-2.5 w-2.5': indicator === 'dot',
219
+ 'w-1': indicator === 'line',
220
+ 'w-0 border-[1.5px] border-dashed bg-transparent':
221
+ indicator === 'dashed',
222
+ 'my-0.5': nestLabel && indicator === 'dashed',
223
+ }
224
+ )}
225
+ style={
226
+ {
227
+ '--color-bg': indicatorColor,
228
+ '--color-border': indicatorColor,
229
+ } as React.CSSProperties
230
+ }
231
+ />
232
+ )
233
+ )}
234
+ <div
235
+ className={cn(
236
+ 'flex flex-1 justify-between leading-none',
237
+ nestLabel ? 'items-end' : 'items-center'
238
+ )}
239
+ >
240
+ <div className='grid gap-1.5'>
241
+ {nestLabel ? tooltipLabel : null}
242
+ <span className='text-muted-foreground'>
243
+ {itemConfig?.label || item.name}
244
+ </span>
245
+ </div>
246
+ {item.value && (
247
+ <span className='font-mono font-medium tabular-nums text-foreground'>
248
+ {item.value.toLocaleString()}
249
+ </span>
250
+ )}
251
+ </div>
252
+ </>
253
+ )}
254
+ </div>
255
+ );
256
+ })}
257
+ </div>
258
+ </div>
259
+ );
260
+ }
261
+ );
262
+ ChartTooltipContent.displayName = 'ChartTooltip';
263
+
264
+ const ChartLegend = RechartsPrimitive.Legend;
265
+
266
+ const ChartLegendContent = React.forwardRef<
267
+ HTMLDivElement,
268
+ React.ComponentProps<'div'> &
269
+ Pick<RechartsPrimitive.LegendProps, 'payload' | 'verticalAlign'> & {
270
+ hideIcon?: boolean;
271
+ nameKey?: string;
272
+ }
273
+ >(
274
+ (
275
+ { className, hideIcon = false, payload, verticalAlign = 'bottom', nameKey },
276
+ ref
277
+ ) => {
278
+ const { config } = useChart();
279
+
280
+ if (!payload?.length) {
281
+ return null;
282
+ }
283
+
284
+ return (
285
+ <div
286
+ ref={ref}
287
+ className={cn(
288
+ 'flex items-center justify-center gap-4',
289
+ verticalAlign === 'top' ? 'pb-3' : 'pt-3',
290
+ className
291
+ )}
292
+ >
293
+ {payload.map((item) => {
294
+ const key = `${nameKey || item.dataKey || 'value'}`;
295
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
296
+
297
+ return (
298
+ <div
299
+ key={item.value}
300
+ className={cn(
301
+ 'flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground'
302
+ )}
303
+ >
304
+ {itemConfig?.icon && !hideIcon ? (
305
+ <itemConfig.icon />
306
+ ) : (
307
+ <div
308
+ className='h-2 w-2 shrink-0 rounded-[2px]'
309
+ style={{
310
+ backgroundColor: item.color,
311
+ }}
312
+ />
313
+ )}
314
+ {itemConfig?.label}
315
+ </div>
316
+ );
317
+ })}
318
+ </div>
319
+ );
320
+ }
321
+ );
322
+ ChartLegendContent.displayName = 'ChartLegend';
323
+
324
+ // Helper to extract item config from a payload.
325
+ function getPayloadConfigFromPayload(
326
+ config: ChartConfig,
327
+ payload: unknown,
328
+ key: string
329
+ ) {
330
+ if (typeof payload !== 'object' || payload === null) {
331
+ return undefined;
332
+ }
333
+
334
+ const payloadPayload =
335
+ 'payload' in payload &&
336
+ typeof payload.payload === 'object' &&
337
+ payload.payload !== null
338
+ ? payload.payload
339
+ : undefined;
340
+
341
+ let configLabelKey: string = key;
342
+
343
+ if (
344
+ key in payload &&
345
+ typeof payload[key as keyof typeof payload] === 'string'
346
+ ) {
347
+ configLabelKey = payload[key as keyof typeof payload] as string;
348
+ } else if (
349
+ payloadPayload &&
350
+ key in payloadPayload &&
351
+ typeof payloadPayload[key as keyof typeof payloadPayload] === 'string'
352
+ ) {
353
+ configLabelKey = payloadPayload[
354
+ key as keyof typeof payloadPayload
355
+ ] as string;
356
+ }
357
+
358
+ return configLabelKey in config
359
+ ? config[configLabelKey]
360
+ : config[key as keyof typeof config];
361
+ }
362
+
363
+ export {
364
+ ChartContainer,
365
+ ChartTooltip,
366
+ ChartTooltipContent,
367
+ ChartLegend,
368
+ ChartLegendContent,
369
+ ChartStyle,
370
+ };
workers1/auto3d/CursorLens/src/components/ui/checkbox.tsx ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as CheckboxPrimitive from "@radix-ui/react-checkbox"
5
+ import { CheckIcon } from "@radix-ui/react-icons"
6
+
7
+ import { cn } from "@/lib/utils"
8
+
9
+ const Checkbox = React.forwardRef<
10
+ React.ElementRef<typeof CheckboxPrimitive.Root>,
11
+ React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
12
+ >(({ className, ...props }, ref) => (
13
+ <CheckboxPrimitive.Root
14
+ ref={ref}
15
+ className={cn(
16
+ "peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
17
+ className
18
+ )}
19
+ {...props}
20
+ >
21
+ <CheckboxPrimitive.Indicator
22
+ className={cn("flex items-center justify-center text-current")}
23
+ >
24
+ <CheckIcon className="h-4 w-4" />
25
+ </CheckboxPrimitive.Indicator>
26
+ </CheckboxPrimitive.Root>
27
+ ))
28
+ Checkbox.displayName = CheckboxPrimitive.Root.displayName
29
+
30
+ export { Checkbox }
workers1/auto3d/CursorLens/src/components/ui/dialog.tsx ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as DialogPrimitive from "@radix-ui/react-dialog"
5
+ import { Cross2Icon } from "@radix-ui/react-icons"
6
+
7
+ import { cn } from "@/lib/utils"
8
+
9
+ const Dialog = DialogPrimitive.Root
10
+
11
+ const DialogTrigger = DialogPrimitive.Trigger
12
+
13
+ const DialogPortal = DialogPrimitive.Portal
14
+
15
+ const DialogClose = DialogPrimitive.Close
16
+
17
+ const DialogOverlay = React.forwardRef<
18
+ React.ElementRef<typeof DialogPrimitive.Overlay>,
19
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
20
+ >(({ className, ...props }, ref) => (
21
+ <DialogPrimitive.Overlay
22
+ ref={ref}
23
+ className={cn(
24
+ "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
25
+ className
26
+ )}
27
+ {...props}
28
+ />
29
+ ))
30
+ DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
31
+
32
+ const DialogContent = React.forwardRef<
33
+ React.ElementRef<typeof DialogPrimitive.Content>,
34
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
35
+ >(({ className, children, ...props }, ref) => (
36
+ <DialogPortal>
37
+ <DialogOverlay />
38
+ <DialogPrimitive.Content
39
+ ref={ref}
40
+ className={cn(
41
+ "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
42
+ className
43
+ )}
44
+ {...props}
45
+ >
46
+ {children}
47
+ <DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
48
+ <Cross2Icon className="h-4 w-4" />
49
+ <span className="sr-only">Close</span>
50
+ </DialogPrimitive.Close>
51
+ </DialogPrimitive.Content>
52
+ </DialogPortal>
53
+ ))
54
+ DialogContent.displayName = DialogPrimitive.Content.displayName
55
+
56
+ const DialogHeader = ({
57
+ className,
58
+ ...props
59
+ }: React.HTMLAttributes<HTMLDivElement>) => (
60
+ <div
61
+ className={cn(
62
+ "flex flex-col space-y-1.5 text-center sm:text-left",
63
+ className
64
+ )}
65
+ {...props}
66
+ />
67
+ )
68
+ DialogHeader.displayName = "DialogHeader"
69
+
70
+ const DialogFooter = ({
71
+ className,
72
+ ...props
73
+ }: React.HTMLAttributes<HTMLDivElement>) => (
74
+ <div
75
+ className={cn(
76
+ "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
77
+ className
78
+ )}
79
+ {...props}
80
+ />
81
+ )
82
+ DialogFooter.displayName = "DialogFooter"
83
+
84
+ const DialogTitle = React.forwardRef<
85
+ React.ElementRef<typeof DialogPrimitive.Title>,
86
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
87
+ >(({ className, ...props }, ref) => (
88
+ <DialogPrimitive.Title
89
+ ref={ref}
90
+ className={cn(
91
+ "text-lg font-semibold leading-none tracking-tight",
92
+ className
93
+ )}
94
+ {...props}
95
+ />
96
+ ))
97
+ DialogTitle.displayName = DialogPrimitive.Title.displayName
98
+
99
+ const DialogDescription = React.forwardRef<
100
+ React.ElementRef<typeof DialogPrimitive.Description>,
101
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
102
+ >(({ className, ...props }, ref) => (
103
+ <DialogPrimitive.Description
104
+ ref={ref}
105
+ className={cn("text-sm text-muted-foreground", className)}
106
+ {...props}
107
+ />
108
+ ))
109
+ DialogDescription.displayName = DialogPrimitive.Description.displayName
110
+
111
+ export {
112
+ Dialog,
113
+ DialogPortal,
114
+ DialogOverlay,
115
+ DialogTrigger,
116
+ DialogClose,
117
+ DialogContent,
118
+ DialogHeader,
119
+ DialogFooter,
120
+ DialogTitle,
121
+ DialogDescription,
122
+ }
workers1/auto3d/CursorLens/src/components/ui/input.tsx ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as React from "react"
2
+
3
+ import { cn } from "@/lib/utils"
4
+
5
+ export interface InputProps
6
+ extends React.InputHTMLAttributes<HTMLInputElement> {}
7
+
8
+ const Input = React.forwardRef<HTMLInputElement, InputProps>(
9
+ ({ className, type, ...props }, ref) => {
10
+ return (
11
+ <input
12
+ type={type}
13
+ className={cn(
14
+ "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
15
+ className
16
+ )}
17
+ ref={ref}
18
+ {...props}
19
+ />
20
+ )
21
+ }
22
+ )
23
+ Input.displayName = "Input"
24
+
25
+ export { Input }
workers1/auto3d/CursorLens/src/components/ui/label.tsx ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as LabelPrimitive from "@radix-ui/react-label"
5
+ import { cva, type VariantProps } from "class-variance-authority"
6
+
7
+ import { cn } from "@/lib/utils"
8
+
9
+ const labelVariants = cva(
10
+ "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
11
+ )
12
+
13
+ const Label = React.forwardRef<
14
+ React.ElementRef<typeof LabelPrimitive.Root>,
15
+ React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &
16
+ VariantProps<typeof labelVariants>
17
+ >(({ className, ...props }, ref) => (
18
+ <LabelPrimitive.Root
19
+ ref={ref}
20
+ className={cn(labelVariants(), className)}
21
+ {...props}
22
+ />
23
+ ))
24
+ Label.displayName = LabelPrimitive.Root.displayName
25
+
26
+ export { Label }
workers1/auto3d/CursorLens/src/components/ui/popover.tsx ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as PopoverPrimitive from "@radix-ui/react-popover"
5
+
6
+ import { cn } from "@/lib/utils"
7
+
8
+ const Popover = PopoverPrimitive.Root
9
+
10
+ const PopoverTrigger = PopoverPrimitive.Trigger
11
+
12
+ const PopoverAnchor = PopoverPrimitive.Anchor
13
+
14
+ const PopoverContent = React.forwardRef<
15
+ React.ElementRef<typeof PopoverPrimitive.Content>,
16
+ React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>
17
+ >(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
18
+ <PopoverPrimitive.Portal>
19
+ <PopoverPrimitive.Content
20
+ ref={ref}
21
+ align={align}
22
+ sideOffset={sideOffset}
23
+ className={cn(
24
+ "z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
25
+ className
26
+ )}
27
+ {...props}
28
+ />
29
+ </PopoverPrimitive.Portal>
30
+ ))
31
+ PopoverContent.displayName = PopoverPrimitive.Content.displayName
32
+
33
+ export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor }
workers1/auto3d/CursorLens/src/components/ui/progress.tsx ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as ProgressPrimitive from "@radix-ui/react-progress"
5
+
6
+ import { cn } from "@/lib/utils"
7
+
8
+ const Progress = React.forwardRef<
9
+ React.ElementRef<typeof ProgressPrimitive.Root>,
10
+ React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>
11
+ >(({ className, value, ...props }, ref) => (
12
+ <ProgressPrimitive.Root
13
+ ref={ref}
14
+ className={cn(
15
+ "relative h-2 w-full overflow-hidden rounded-full bg-primary/20",
16
+ className
17
+ )}
18
+ {...props}
19
+ >
20
+ <ProgressPrimitive.Indicator
21
+ className="h-full w-full flex-1 bg-primary transition-all"
22
+ style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
23
+ />
24
+ </ProgressPrimitive.Root>
25
+ ))
26
+ Progress.displayName = ProgressPrimitive.Root.displayName
27
+
28
+ export { Progress }
workers1/auto3d/CursorLens/src/components/ui/scroll-area.tsx ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area"
5
+
6
+ import { cn } from "@/lib/utils"
7
+
8
+ const ScrollArea = React.forwardRef<
9
+ React.ElementRef<typeof ScrollAreaPrimitive.Root>,
10
+ React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>
11
+ >(({ className, children, ...props }, ref) => (
12
+ <ScrollAreaPrimitive.Root
13
+ ref={ref}
14
+ className={cn("relative overflow-hidden", className)}
15
+ {...props}
16
+ >
17
+ <ScrollAreaPrimitive.Viewport className="h-full w-full rounded-[inherit]">
18
+ {children}
19
+ </ScrollAreaPrimitive.Viewport>
20
+ <ScrollBar />
21
+ <ScrollAreaPrimitive.Corner />
22
+ </ScrollAreaPrimitive.Root>
23
+ ))
24
+ ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName
25
+
26
+ const ScrollBar = React.forwardRef<
27
+ React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,
28
+ React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>
29
+ >(({ className, orientation = "vertical", ...props }, ref) => (
30
+ <ScrollAreaPrimitive.ScrollAreaScrollbar
31
+ ref={ref}
32
+ orientation={orientation}
33
+ className={cn(
34
+ "flex touch-none select-none transition-colors",
35
+ orientation === "vertical" &&
36
+ "h-full w-2.5 border-l border-l-transparent p-[1px]",
37
+ orientation === "horizontal" &&
38
+ "h-2.5 flex-col border-t border-t-transparent p-[1px]",
39
+ className
40
+ )}
41
+ {...props}
42
+ >
43
+ <ScrollAreaPrimitive.ScrollAreaThumb className="relative flex-1 rounded-full bg-border" />
44
+ </ScrollAreaPrimitive.ScrollAreaScrollbar>
45
+ ))
46
+ ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName
47
+
48
+ export { ScrollArea, ScrollBar }
workers1/auto3d/CursorLens/src/components/ui/select.tsx ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import {
5
+ CaretSortIcon,
6
+ CheckIcon,
7
+ ChevronDownIcon,
8
+ ChevronUpIcon,
9
+ } from "@radix-ui/react-icons"
10
+ import * as SelectPrimitive from "@radix-ui/react-select"
11
+
12
+ import { cn } from "@/lib/utils"
13
+
14
+ const Select = SelectPrimitive.Root
15
+
16
+ const SelectGroup = SelectPrimitive.Group
17
+
18
+ const SelectValue = SelectPrimitive.Value
19
+
20
+ const SelectTrigger = React.forwardRef<
21
+ React.ElementRef<typeof SelectPrimitive.Trigger>,
22
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
23
+ >(({ className, children, ...props }, ref) => (
24
+ <SelectPrimitive.Trigger
25
+ ref={ref}
26
+ className={cn(
27
+ "flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
28
+ className
29
+ )}
30
+ {...props}
31
+ >
32
+ {children}
33
+ <SelectPrimitive.Icon asChild>
34
+ <CaretSortIcon className="h-4 w-4 opacity-50" />
35
+ </SelectPrimitive.Icon>
36
+ </SelectPrimitive.Trigger>
37
+ ))
38
+ SelectTrigger.displayName = SelectPrimitive.Trigger.displayName
39
+
40
+ const SelectScrollUpButton = React.forwardRef<
41
+ React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
42
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
43
+ >(({ className, ...props }, ref) => (
44
+ <SelectPrimitive.ScrollUpButton
45
+ ref={ref}
46
+ className={cn(
47
+ "flex cursor-default items-center justify-center py-1",
48
+ className
49
+ )}
50
+ {...props}
51
+ >
52
+ <ChevronUpIcon />
53
+ </SelectPrimitive.ScrollUpButton>
54
+ ))
55
+ SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName
56
+
57
+ const SelectScrollDownButton = React.forwardRef<
58
+ React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
59
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
60
+ >(({ className, ...props }, ref) => (
61
+ <SelectPrimitive.ScrollDownButton
62
+ ref={ref}
63
+ className={cn(
64
+ "flex cursor-default items-center justify-center py-1",
65
+ className
66
+ )}
67
+ {...props}
68
+ >
69
+ <ChevronDownIcon />
70
+ </SelectPrimitive.ScrollDownButton>
71
+ ))
72
+ SelectScrollDownButton.displayName =
73
+ SelectPrimitive.ScrollDownButton.displayName
74
+
75
+ const SelectContent = React.forwardRef<
76
+ React.ElementRef<typeof SelectPrimitive.Content>,
77
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
78
+ >(({ className, children, position = "popper", ...props }, ref) => (
79
+ <SelectPrimitive.Portal>
80
+ <SelectPrimitive.Content
81
+ ref={ref}
82
+ className={cn(
83
+ "relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
84
+ position === "popper" &&
85
+ "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
86
+ className
87
+ )}
88
+ position={position}
89
+ {...props}
90
+ >
91
+ <SelectScrollUpButton />
92
+ <SelectPrimitive.Viewport
93
+ className={cn(
94
+ "p-1",
95
+ position === "popper" &&
96
+ "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
97
+ )}
98
+ >
99
+ {children}
100
+ </SelectPrimitive.Viewport>
101
+ <SelectScrollDownButton />
102
+ </SelectPrimitive.Content>
103
+ </SelectPrimitive.Portal>
104
+ ))
105
+ SelectContent.displayName = SelectPrimitive.Content.displayName
106
+
107
+ const SelectLabel = React.forwardRef<
108
+ React.ElementRef<typeof SelectPrimitive.Label>,
109
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
110
+ >(({ className, ...props }, ref) => (
111
+ <SelectPrimitive.Label
112
+ ref={ref}
113
+ className={cn("px-2 py-1.5 text-sm font-semibold", className)}
114
+ {...props}
115
+ />
116
+ ))
117
+ SelectLabel.displayName = SelectPrimitive.Label.displayName
118
+
119
+ const SelectItem = React.forwardRef<
120
+ React.ElementRef<typeof SelectPrimitive.Item>,
121
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
122
+ >(({ className, children, ...props }, ref) => (
123
+ <SelectPrimitive.Item
124
+ ref={ref}
125
+ className={cn(
126
+ "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
127
+ className
128
+ )}
129
+ {...props}
130
+ >
131
+ <span className="absolute right-2 flex h-3.5 w-3.5 items-center justify-center">
132
+ <SelectPrimitive.ItemIndicator>
133
+ <CheckIcon className="h-4 w-4" />
134
+ </SelectPrimitive.ItemIndicator>
135
+ </span>
136
+ <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
137
+ </SelectPrimitive.Item>
138
+ ))
139
+ SelectItem.displayName = SelectPrimitive.Item.displayName
140
+
141
+ const SelectSeparator = React.forwardRef<
142
+ React.ElementRef<typeof SelectPrimitive.Separator>,
143
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
144
+ >(({ className, ...props }, ref) => (
145
+ <SelectPrimitive.Separator
146
+ ref={ref}
147
+ className={cn("-mx-1 my-1 h-px bg-muted", className)}
148
+ {...props}
149
+ />
150
+ ))
151
+ SelectSeparator.displayName = SelectPrimitive.Separator.displayName
152
+
153
+ export {
154
+ Select,
155
+ SelectGroup,
156
+ SelectValue,
157
+ SelectTrigger,
158
+ SelectContent,
159
+ SelectLabel,
160
+ SelectItem,
161
+ SelectSeparator,
162
+ SelectScrollUpButton,
163
+ SelectScrollDownButton,
164
+ }
workers1/auto3d/CursorLens/src/components/ui/skeleton.tsx ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { cn } from "@/lib/utils"
2
+
3
+ function Skeleton({
4
+ className,
5
+ ...props
6
+ }: React.HTMLAttributes<HTMLDivElement>) {
7
+ return (
8
+ <div
9
+ className={cn("animate-pulse rounded-md bg-primary/10", className)}
10
+ {...props}
11
+ />
12
+ )
13
+ }
14
+
15
+ export { Skeleton }
workers1/auto3d/CursorLens/src/components/ui/sonner.tsx ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use client"
2
+
3
+ import { useTheme } from "next-themes"
4
+ import { Toaster as Sonner } from "sonner"
5
+
6
+ type ToasterProps = React.ComponentProps<typeof Sonner>
7
+
8
+ const Toaster = ({ ...props }: ToasterProps) => {
9
+ const { theme = "system" } = useTheme()
10
+
11
+ return (
12
+ <Sonner
13
+ theme={theme as ToasterProps["theme"]}
14
+ className="toaster group"
15
+ toastOptions={{
16
+ classNames: {
17
+ toast:
18
+ "group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",
19
+ description: "group-[.toast]:text-muted-foreground",
20
+ actionButton:
21
+ "group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",
22
+ cancelButton:
23
+ "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",
24
+ },
25
+ }}
26
+ {...props}
27
+ />
28
+ )
29
+ }
30
+
31
+ export { Toaster }
workers1/auto3d/CursorLens/src/components/ui/switch.tsx ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as SwitchPrimitives from "@radix-ui/react-switch"
5
+
6
+ import { cn } from "@/lib/utils"
7
+
8
+ const Switch = React.forwardRef<
9
+ React.ElementRef<typeof SwitchPrimitives.Root>,
10
+ React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>
11
+ >(({ className, ...props }, ref) => (
12
+ <SwitchPrimitives.Root
13
+ className={cn(
14
+ "peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
15
+ className
16
+ )}
17
+ {...props}
18
+ ref={ref}
19
+ >
20
+ <SwitchPrimitives.Thumb
21
+ className={cn(
22
+ "pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0"
23
+ )}
24
+ />
25
+ </SwitchPrimitives.Root>
26
+ ))
27
+ Switch.displayName = SwitchPrimitives.Root.displayName
28
+
29
+ export { Switch }
workers1/auto3d/CursorLens/src/components/ui/table.tsx ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as React from "react"
2
+
3
+ import { cn } from "@/lib/utils"
4
+
5
+ const Table = React.forwardRef<
6
+ HTMLTableElement,
7
+ React.HTMLAttributes<HTMLTableElement>
8
+ >(({ className, ...props }, ref) => (
9
+ <div className="relative w-full overflow-auto">
10
+ <table
11
+ ref={ref}
12
+ className={cn("w-full caption-bottom text-sm", className)}
13
+ {...props}
14
+ />
15
+ </div>
16
+ ))
17
+ Table.displayName = "Table"
18
+
19
+ const TableHeader = React.forwardRef<
20
+ HTMLTableSectionElement,
21
+ React.HTMLAttributes<HTMLTableSectionElement>
22
+ >(({ className, ...props }, ref) => (
23
+ <thead ref={ref} className={cn("[&_tr]:border-b", className)} {...props} />
24
+ ))
25
+ TableHeader.displayName = "TableHeader"
26
+
27
+ const TableBody = React.forwardRef<
28
+ HTMLTableSectionElement,
29
+ React.HTMLAttributes<HTMLTableSectionElement>
30
+ >(({ className, ...props }, ref) => (
31
+ <tbody
32
+ ref={ref}
33
+ className={cn("[&_tr:last-child]:border-0", className)}
34
+ {...props}
35
+ />
36
+ ))
37
+ TableBody.displayName = "TableBody"
38
+
39
+ const TableFooter = React.forwardRef<
40
+ HTMLTableSectionElement,
41
+ React.HTMLAttributes<HTMLTableSectionElement>
42
+ >(({ className, ...props }, ref) => (
43
+ <tfoot
44
+ ref={ref}
45
+ className={cn(
46
+ "border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
47
+ className
48
+ )}
49
+ {...props}
50
+ />
51
+ ))
52
+ TableFooter.displayName = "TableFooter"
53
+
54
+ const TableRow = React.forwardRef<
55
+ HTMLTableRowElement,
56
+ React.HTMLAttributes<HTMLTableRowElement>
57
+ >(({ className, ...props }, ref) => (
58
+ <tr
59
+ ref={ref}
60
+ className={cn(
61
+ "border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
62
+ className
63
+ )}
64
+ {...props}
65
+ />
66
+ ))
67
+ TableRow.displayName = "TableRow"
68
+
69
+ const TableHead = React.forwardRef<
70
+ HTMLTableCellElement,
71
+ React.ThHTMLAttributes<HTMLTableCellElement>
72
+ >(({ className, ...props }, ref) => (
73
+ <th
74
+ ref={ref}
75
+ className={cn(
76
+ "h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
77
+ className
78
+ )}
79
+ {...props}
80
+ />
81
+ ))
82
+ TableHead.displayName = "TableHead"
83
+
84
+ const TableCell = React.forwardRef<
85
+ HTMLTableCellElement,
86
+ React.TdHTMLAttributes<HTMLTableCellElement>
87
+ >(({ className, ...props }, ref) => (
88
+ <td
89
+ ref={ref}
90
+ className={cn(
91
+ "p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
92
+ className
93
+ )}
94
+ {...props}
95
+ />
96
+ ))
97
+ TableCell.displayName = "TableCell"
98
+
99
+ const TableCaption = React.forwardRef<
100
+ HTMLTableCaptionElement,
101
+ React.HTMLAttributes<HTMLTableCaptionElement>
102
+ >(({ className, ...props }, ref) => (
103
+ <caption
104
+ ref={ref}
105
+ className={cn("mt-4 text-sm text-muted-foreground", className)}
106
+ {...props}
107
+ />
108
+ ))
109
+ TableCaption.displayName = "TableCaption"
110
+
111
+ export {
112
+ Table,
113
+ TableHeader,
114
+ TableBody,
115
+ TableFooter,
116
+ TableHead,
117
+ TableRow,
118
+ TableCell,
119
+ TableCaption,
120
+ }
workers1/auto3d/CursorLens/src/env.ts ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { createEnv } from "@t3-oss/env-nextjs";
2
+ import { z } from "zod";
3
+
4
+ export const env = createEnv({
5
+ /**
6
+ * Specify your server-side environment variables schema here. This way you can ensure the app
7
+ * isn't built with invalid env vars.
8
+ */
9
+ server: {
10
+ DATABASE_URL: z.string().url(),
11
+ NODE_ENV: z
12
+ .enum(["development", "test", "production"])
13
+ .default("development"),
14
+ OPENAI_API_KEY: z.string().optional(),
15
+ ANTHROPIC_API_KEY: z.string().optional(),
16
+ COHERE_API_KEY: z.string().optional(),
17
+ MISTRAL_API_KEY: z.string().optional(),
18
+ GROQ_API_KEY: z.string().optional(),
19
+ },
20
+
21
+ /**
22
+ * Specify your client-side environment variables schema here. This way you can ensure the app
23
+ * isn't built with invalid env vars. To expose them to the client, prefix them with
24
+ * `NEXT_PUBLIC_`.
25
+ */
26
+ client: {
27
+ // NEXT_PUBLIC_CLIENTVAR: z.string(),
28
+ },
29
+
30
+ /**
31
+ * You can't destruct `process.env` as a regular object in the Next.js edge runtimes (e.g.
32
+ * middlewares) or client-side so we need to destruct manually.
33
+ */
34
+ runtimeEnv: {
35
+ DATABASE_URL: process.env.DATABASE_URL,
36
+ NODE_ENV: process.env.NODE_ENV,
37
+ OPENAI_API_KEY: process.env.OPENAI_API_KEY,
38
+ ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY,
39
+ COHERE_API_KEY: process.env.COHERE_API_KEY,
40
+ MISTRAL_API_KEY: process.env.MISTRAL_API_KEY,
41
+ GROQ_API_KEY: process.env.GROQ_API_KEY,
42
+ // NEXT_PUBLIC_CLIENTVAR: process.env.NEXT_PUBLIC_CLIENTVAR,
43
+ },
44
+ /**
45
+ * Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially
46
+ * useful for Docker builds.
47
+ */
48
+ skipValidation: !!process.env.SKIP_ENV_VALIDATION,
49
+ /**
50
+ * Makes it so that empty strings are treated as undefined. `SOME_VAR: z.string()` and
51
+ * `SOME_VAR=''` will throw an error.
52
+ */
53
+ emptyStringAsUndefined: true,
54
+ });
workers1/auto3d/CursorLens/src/lib/cost-calculator.ts ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { PrismaClient } from "@prisma/client";
2
+
3
+ const prisma = new PrismaClient();
4
+
5
+ export async function getModelCost(provider: string, model: string) {
6
+ const currentDate = new Date();
7
+ const modelCost = await prisma.modelCost.findFirst({
8
+ where: {
9
+ provider,
10
+ model,
11
+ OR: [{ validFrom: null }, { validFrom: { lte: currentDate } }],
12
+ OR: [{ validTo: null }, { validTo: { gte: currentDate } }],
13
+ },
14
+ orderBy: { validFrom: "desc" },
15
+ });
16
+
17
+ if (!modelCost) {
18
+ throw new Error(`No cost data found for ${provider} ${model}`);
19
+ }
20
+
21
+ return modelCost;
22
+ }
23
+
24
+ export function calculateCost(
25
+ inputTokens: number,
26
+ outputTokens: number,
27
+ modelCost: { inputTokenCost: number; outputTokenCost: number },
28
+ ) {
29
+ return (
30
+ (inputTokens / 1000000) * modelCost.inputTokenCost +
31
+ (outputTokens / 1000000) * modelCost.outputTokenCost
32
+ );
33
+ }
workers1/auto3d/CursorLens/src/lib/db.ts ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // lib/db.ts
2
+ import prisma from './prisma';
3
+
4
+ export async function insertLog(logEntry: any) {
5
+ return prisma.log.create({
6
+ data: logEntry,
7
+ });
8
+ }
9
+
10
+ export async function getLogs(filterHomepage: boolean) {
11
+ return prisma.log.findMany({
12
+ where: filterHomepage
13
+ ? {
14
+ NOT: {
15
+ url: '/',
16
+ },
17
+ }
18
+ : {},
19
+ orderBy: {
20
+ timestamp: 'desc',
21
+ },
22
+ });
23
+ }
24
+
25
+ export async function getDefaultConfiguration() {
26
+ const config = await prisma.aIConfiguration.findFirst({
27
+ where: { isDefault: true },
28
+ });
29
+ return config;
30
+ }
workers1/auto3d/CursorLens/src/lib/model-config.ts ADDED
@@ -0,0 +1,320 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ type ModelConfig = {
2
+ name?: string;
3
+ temperature?: number;
4
+ maxTokens?: number;
5
+ topP?: number;
6
+ frequencyPenalty?: number;
7
+ presencePenalty?: number;
8
+ inputTokenCost: number;
9
+ outputTokenCost: number;
10
+ isTemplate: boolean;
11
+ };
12
+
13
+ type ProviderConfigs = {
14
+ [key: string]: ModelConfig | null;
15
+ };
16
+
17
+ export type ModelConfigurations = {
18
+ [key: string]: ProviderConfigs;
19
+ };
20
+
21
+ export const getModelConfigurations = (): ModelConfigurations => ({
22
+ openai: {
23
+ "gpt-4o": {
24
+ name: "OpenAI GPT-4 Optimized",
25
+ temperature: 0.7,
26
+ maxTokens: 8192,
27
+ topP: 1,
28
+ frequencyPenalty: 0,
29
+ presencePenalty: 0,
30
+ inputTokenCost: 0.000005,
31
+ outputTokenCost: 0.000015,
32
+ isTemplate: true,
33
+ },
34
+ "gpt-4o-mini": {
35
+ name: "OpenAI GPT-4 Mini",
36
+ temperature: 0.7,
37
+ maxTokens: 4096,
38
+ topP: 1,
39
+ frequencyPenalty: 0,
40
+ presencePenalty: 0,
41
+ inputTokenCost: 0.00000015,
42
+ outputTokenCost: 0.0000006,
43
+ isTemplate: true,
44
+ },
45
+ "gpt-4-turbo": {
46
+ name: "OpenAI GPT-4",
47
+ temperature: 0.7,
48
+ maxTokens: 8192,
49
+ topP: 1,
50
+ frequencyPenalty: 0,
51
+ presencePenalty: 0,
52
+ inputTokenCost: 0.00001,
53
+ outputTokenCost: 0.00003,
54
+ isTemplate: true,
55
+ },
56
+ "gpt-4o-2024-08-06": {
57
+ name: "GPT-4 Optimized (2024-08-06)",
58
+ inputTokenCost: 0.0000025,
59
+ outputTokenCost: 0.00001,
60
+ isTemplate: false,
61
+ },
62
+ "gpt-3.5-turbo-0125": {
63
+ inputTokenCost: 0.0000005,
64
+ outputTokenCost: 0.0000015,
65
+ isTemplate: false,
66
+ },
67
+ "chatgpt-4o-latest": {
68
+ inputTokenCost: 0.000005,
69
+ outputTokenCost: 0.000015,
70
+ isTemplate: false,
71
+ },
72
+ "gpt-4-turbo-2024-04-09": {
73
+ inputTokenCost: 0.00001,
74
+ outputTokenCost: 0.00003,
75
+ isTemplate: false,
76
+ },
77
+ "gpt-4": {
78
+ inputTokenCost: 0.00003,
79
+ outputTokenCost: 0.00006,
80
+ isTemplate: false,
81
+ },
82
+ "gpt-4-32k": {
83
+ inputTokenCost: 0.00006,
84
+ outputTokenCost: 0.00012,
85
+ isTemplate: false,
86
+ },
87
+ "gpt-4-0125-preview": {
88
+ inputTokenCost: 0.00001,
89
+ outputTokenCost: 0.00003,
90
+ isTemplate: false,
91
+ },
92
+ "gpt-4-1106-preview": {
93
+ inputTokenCost: 0.00001,
94
+ outputTokenCost: 0.00003,
95
+ isTemplate: false,
96
+ },
97
+ "gpt-4-vision-preview": {
98
+ inputTokenCost: 0.00001,
99
+ outputTokenCost: 0.00003,
100
+ isTemplate: false,
101
+ },
102
+ "gpt-3.5-turbo-instruct": {
103
+ inputTokenCost: 0.0000015,
104
+ outputTokenCost: 0.000002,
105
+ isTemplate: false,
106
+ },
107
+ "gpt-3.5-turbo-1106": {
108
+ inputTokenCost: 0.000001,
109
+ outputTokenCost: 0.000002,
110
+ isTemplate: false,
111
+ },
112
+ "gpt-3.5-turbo-0613": {
113
+ inputTokenCost: 0.0000015,
114
+ outputTokenCost: 0.000002,
115
+ isTemplate: false,
116
+ },
117
+ "gpt-3.5-turbo-16k-0613": {
118
+ inputTokenCost: 0.000003,
119
+ outputTokenCost: 0.000004,
120
+ isTemplate: false,
121
+ },
122
+ "gpt-3.5-turbo-0301": {
123
+ inputTokenCost: 0.0000015,
124
+ outputTokenCost: 0.000002,
125
+ isTemplate: false,
126
+ },
127
+ "davinci-002": {
128
+ inputTokenCost: 0.000002,
129
+ outputTokenCost: 0.000002,
130
+ isTemplate: false,
131
+ },
132
+ "babbage-002": {
133
+ inputTokenCost: 0.0000004,
134
+ outputTokenCost: 0.0000004,
135
+ isTemplate: false,
136
+ },
137
+ },
138
+ anthropicCached: {
139
+ "claude-3-5-sonnet-20240620": {
140
+ name: "Anthropic Claude 3.5 Sonnet (Cached)",
141
+ temperature: 0.7,
142
+ maxTokens: 200000,
143
+ topP: 1,
144
+ frequencyPenalty: 0,
145
+ presencePenalty: 0,
146
+ inputTokenCost: 0.000003,
147
+ outputTokenCost: 0.000015,
148
+ isTemplate: true,
149
+ },
150
+ },
151
+ anthropic: {
152
+ "claude-3-5-sonnet-20240620": {
153
+ name: "Anthropic Claude 3.5 Sonnet",
154
+ temperature: 0.7,
155
+ maxTokens: 200000,
156
+ topP: 1,
157
+ frequencyPenalty: 0,
158
+ presencePenalty: 0,
159
+ inputTokenCost: 0.000003,
160
+ outputTokenCost: 0.000015,
161
+ isTemplate: true,
162
+ },
163
+ "claude-3-opus-20240229": null,
164
+ "claude-3-sonnet-20240229": null,
165
+ "claude-3-haiku-20240307": null,
166
+ "claude-3-5-sonnet": {
167
+ inputTokenCost: 0.000003,
168
+ outputTokenCost: 0.000015,
169
+ isTemplate: false,
170
+ },
171
+ "claude-3-opus": {
172
+ inputTokenCost: 0.000015,
173
+ outputTokenCost: 0.000075,
174
+ isTemplate: false,
175
+ },
176
+ "claude-3-haiku": {
177
+ inputTokenCost: 0.00000025,
178
+ outputTokenCost: 0.00000125,
179
+ isTemplate: false,
180
+ },
181
+ "claude-2-1": {
182
+ inputTokenCost: 0.000008,
183
+ outputTokenCost: 0.000024,
184
+ isTemplate: false,
185
+ },
186
+ "claude-2-0": {
187
+ inputTokenCost: 0.000008,
188
+ outputTokenCost: 0.000024,
189
+ isTemplate: false,
190
+ },
191
+ "claude-instant": {
192
+ inputTokenCost: 0.0000008,
193
+ outputTokenCost: 0.0000024,
194
+ isTemplate: false,
195
+ },
196
+ },
197
+ cohere: {
198
+ "command-r": null,
199
+ "command-r-plus": null,
200
+ },
201
+ mistral: {
202
+ "mistral-large-latest": {
203
+ name: "Mistral Large",
204
+ temperature: 0.7,
205
+ maxTokens: 32768,
206
+ topP: 1,
207
+ frequencyPenalty: 0,
208
+ presencePenalty: 0,
209
+ inputTokenCost: 0,
210
+ outputTokenCost: 0,
211
+ isTemplate: true,
212
+ },
213
+ "mistral-medium-latest": null,
214
+ "mistral-small-latest": null,
215
+ "open-mistral-nemo": null,
216
+ "open-mixtral-8x22b": null,
217
+ "open-mixtral-8x7b": null,
218
+ "open-mistral-7b": null,
219
+ },
220
+ groq: {
221
+ "llama-3.1-70b-versatile": {
222
+ name: "Groq LLaMA 3.1",
223
+ temperature: 0.7,
224
+ maxTokens: 32768,
225
+ topP: 1,
226
+ frequencyPenalty: 0,
227
+ presencePenalty: 0,
228
+ inputTokenCost: 0,
229
+ outputTokenCost: 0,
230
+ isTemplate: true,
231
+ },
232
+ "llama-3.1-405b-reasoning": null,
233
+ "llama-3.1-8b-instant": null,
234
+ "mixtral-8x7b-32768": null,
235
+ "gemma2-9b-it": null,
236
+ },
237
+ ollama: {
238
+ codegemma: null,
239
+ "codegemma:2b": null,
240
+ "codegemma:7b": null,
241
+ codellama: null,
242
+ "codellama:7b": null,
243
+ "codellama:13b": null,
244
+ "codellama:34b": null,
245
+ "codellama:70b": null,
246
+ "codellama:code": null,
247
+ "codellama:python": null,
248
+ "command-r": null,
249
+ "command-r:35b": null,
250
+ "command-r-plus": null,
251
+ "command-r-plus:104b": null,
252
+ "deepseek-coder-v2": null,
253
+ "deepseek-coder-v2:16b": null,
254
+ "deepseek-coder-v2:236b": null,
255
+ falcon2: null,
256
+ "falcon2:11b": null,
257
+ gemma: null,
258
+ "gemma:2b": null,
259
+ "gemma:7b": null,
260
+ gemma2: null,
261
+ "gemma2:2b": null,
262
+ "gemma2:9b": null,
263
+ "gemma2:27b": null,
264
+ llama2: null,
265
+ "llama2:7b": null,
266
+ "llama2:13b": null,
267
+ "llama2:70b": null,
268
+ llama3: null,
269
+ "llama3:8b": null,
270
+ "llama3:70b": null,
271
+ "llama3-chatqa": null,
272
+ "llama3-chatqa:8b": null,
273
+ "llama3-chatqa:70b": null,
274
+ "llama3-gradient": null,
275
+ "llama3-gradient:8b": null,
276
+ "llama3-gradient:70b": null,
277
+ "llama3.1": null,
278
+ "llama3.1:8b": null,
279
+ "llama3.1:70b": null,
280
+ "llama3.1:405b": null,
281
+ llava: null,
282
+ "llava:7b": null,
283
+ "llava:13b": null,
284
+ "llava:34b": null,
285
+ "llava-llama3": null,
286
+ "llava-llama3:8b": null,
287
+ "llava-phi3": null,
288
+ "llava-phi3:3.8b": null,
289
+ mistral: null,
290
+ "mistral:7b": null,
291
+ "mistral-large": null,
292
+ "mistral-large:123b": null,
293
+ "mistral-nemo": null,
294
+ "mistral-nemo:12b": null,
295
+ mixtral: null,
296
+ "mixtral:8x7b": null,
297
+ "mixtral:8x22b": null,
298
+ moondream: null,
299
+ "moondream:1.8b": null,
300
+ openhermes: null,
301
+ "openhermes:v2.5": null,
302
+ qwen: null,
303
+ "qwen:7b": null,
304
+ "qwen:14b": null,
305
+ "qwen:32b": null,
306
+ "qwen:72b": null,
307
+ "qwen:110b": null,
308
+ qwen2: null,
309
+ "qwen2:0.5b": null,
310
+ "qwen2:1.5b": null,
311
+ "qwen2:7b": null,
312
+ "qwen2:72b": null,
313
+ phi3: null,
314
+ "phi3:3.8b": null,
315
+ "phi3:14b": null,
316
+ },
317
+ other: {
318
+ other: null,
319
+ },
320
+ });
workers1/auto3d/CursorLens/src/lib/prisma.ts ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { env } from "@/env";
2
+ import { PrismaClient } from "@prisma/client";
3
+
4
+ // PrismaClient is attached to the `global` object in development to prevent
5
+ // exhausting your database connection limit.
6
+ //
7
+ // Learn more:
8
+ // https://pris.ly/d/help/next-js-best-practices
9
+ // https://github.com/prisma/prisma/discussions/20321#discussioncomment-6646920
10
+ const globalForPrisma = global as unknown as {
11
+ prisma: PrismaClient | undefined;
12
+ };
13
+
14
+ let prisma: PrismaClient;
15
+
16
+ if (env.NODE_ENV === "production") {
17
+ prisma = new PrismaClient();
18
+ } else {
19
+ if (!globalForPrisma.prisma) {
20
+ globalForPrisma.prisma = new PrismaClient();
21
+ }
22
+ prisma = globalForPrisma.prisma;
23
+ }
24
+
25
+ export default prisma;
workers1/auto3d/CursorLens/src/lib/utils.ts ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ import { type ClassValue, clsx } from "clsx"
2
+ import { twMerge } from "tailwind-merge"
3
+
4
+ export function cn(...inputs: ClassValue[]) {
5
+ return twMerge(clsx(inputs))
6
+ }
workers1/auto3d/CursorLens/start.sh ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+
3
+ # Run migrations
4
+ pnpm prisma migrate deploy
5
+
6
+ # Seed the database
7
+ pnpm prisma db seed
8
+
9
+ # Start the application
10
+ pnpm start
workers1/auto3d/CursorLens/tailwind.config.ts ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import type { Config } from "tailwindcss"
2
+
3
+ const config = {
4
+ darkMode: ["class"],
5
+ content: [
6
+ './pages/**/*.{ts,tsx}',
7
+ './components/**/*.{ts,tsx}',
8
+ './app/**/*.{ts,tsx}',
9
+ './src/**/*.{ts,tsx}',
10
+ ],
11
+ prefix: "",
12
+ theme: {
13
+ container: {
14
+ center: true,
15
+ padding: "2rem",
16
+ screens: {
17
+ "2xl": "1400px",
18
+ },
19
+ },
20
+ extend: {
21
+ colors: {
22
+ border: "hsl(var(--border))",
23
+ input: "hsl(var(--input))",
24
+ ring: "hsl(var(--ring))",
25
+ background: "hsl(var(--background))",
26
+ foreground: "hsl(var(--foreground))",
27
+ primary: {
28
+ DEFAULT: "hsl(var(--primary))",
29
+ foreground: "hsl(var(--primary-foreground))",
30
+ },
31
+ secondary: {
32
+ DEFAULT: "hsl(var(--secondary))",
33
+ foreground: "hsl(var(--secondary-foreground))",
34
+ },
35
+ destructive: {
36
+ DEFAULT: "hsl(var(--destructive))",
37
+ foreground: "hsl(var(--destructive-foreground))",
38
+ },
39
+ muted: {
40
+ DEFAULT: "hsl(var(--muted))",
41
+ foreground: "hsl(var(--muted-foreground))",
42
+ },
43
+ accent: {
44
+ DEFAULT: "hsl(var(--accent))",
45
+ foreground: "hsl(var(--accent-foreground))",
46
+ },
47
+ popover: {
48
+ DEFAULT: "hsl(var(--popover))",
49
+ foreground: "hsl(var(--popover-foreground))",
50
+ },
51
+ card: {
52
+ DEFAULT: "hsl(var(--card))",
53
+ foreground: "hsl(var(--card-foreground))",
54
+ },
55
+ },
56
+ borderRadius: {
57
+ lg: "var(--radius)",
58
+ md: "calc(var(--radius) - 2px)",
59
+ sm: "calc(var(--radius) - 4px)",
60
+ },
61
+ keyframes: {
62
+ "accordion-down": {
63
+ from: { height: "0" },
64
+ to: { height: "var(--radix-accordion-content-height)" },
65
+ },
66
+ "accordion-up": {
67
+ from: { height: "var(--radix-accordion-content-height)" },
68
+ to: { height: "0" },
69
+ },
70
+ },
71
+ animation: {
72
+ "accordion-down": "accordion-down 0.2s ease-out",
73
+ "accordion-up": "accordion-up 0.2s ease-out",
74
+ },
75
+ },
76
+ },
77
+ plugins: [require("tailwindcss-animate")],
78
+ } satisfies Config
79
+
80
+ export default config
workers1/auto3d/CursorLens/tsconfig.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "compilerOptions": {
3
+ "lib": ["dom", "dom.iterable", "esnext"],
4
+ "allowJs": true,
5
+ "skipLibCheck": true,
6
+ "strict": true,
7
+ "noEmit": true,
8
+ "esModuleInterop": true,
9
+ "module": "esnext",
10
+ "moduleResolution": "bundler",
11
+ "resolveJsonModule": true,
12
+ "isolatedModules": true,
13
+ "jsx": "preserve",
14
+ "incremental": true,
15
+ "plugins": [
16
+ {
17
+ "name": "next"
18
+ }
19
+ ],
20
+ "paths": {
21
+ "@/*": ["./src/*"]
22
+ }
23
+ },
24
+ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
25
+ "exclude": ["node_modules"]
26
+ }
workers1/auto3d/node_modules/.bin/acorn ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ "use strict"
3
+
4
+ require("../dist/bin.js")
workers1/auto3d/node_modules/.bin/esbuild ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:db15adc0987bfd62b2a5fa461a118c340bc6788a5c3e793f52ea6d0ca95127ec
3
+ size 9265810
workers1/auto3d/node_modules/.bin/mime ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+
3
+ 'use strict';
4
+
5
+ process.title = 'mime';
6
+ let mime = require('.');
7
+ let pkg = require('./package.json');
8
+ let args = process.argv.splice(2);
9
+
10
+ if (args.includes('--version') || args.includes('-v') || args.includes('--v')) {
11
+ console.log(pkg.version);
12
+ process.exit(0);
13
+ } else if (args.includes('--name') || args.includes('-n') || args.includes('--n')) {
14
+ console.log(pkg.name);
15
+ process.exit(0);
16
+ } else if (args.includes('--help') || args.includes('-h') || args.includes('--h')) {
17
+ console.log(pkg.name + ' - ' + pkg.description + '\n');
18
+ console.log(`Usage:
19
+
20
+ mime [flags] [path_or_extension]
21
+
22
+ Flags:
23
+ --help, -h Show this message
24
+ --version, -v Display the version
25
+ --name, -n Print the name of the program
26
+
27
+ Note: the command will exit after it executes if a command is specified
28
+ The path_or_extension is the path to the file or the extension of the file.
29
+
30
+ Examples:
31
+ mime --help
32
+ mime --version
33
+ mime --name
34
+ mime -v
35
+ mime src/log.js
36
+ mime new.py
37
+ mime foo.sh
38
+ `);
39
+ process.exit(0);
40
+ }
41
+
42
+ let file = args[0];
43
+ let type = mime.getType(file);
44
+
45
+ process.stdout.write(type + '\n');
46
+
workers1/auto3d/node_modules/.bin/miniflare ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ const { Log } = require(".");
3
+
4
+ const log = new Log();
5
+ log.error(
6
+ [
7
+ "`miniflare@3` no longer includes a CLI. Please use `npx wrangler dev` instead.",
8
+ "As of `wrangler@3`, this will use Miniflare by default.",
9
+ "See https://miniflare.dev/get-started/migrating for more details.",
10
+ ].join("\n")
11
+ );
workers1/auto3d/node_modules/.bin/mustache ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+
3
+ var fs = require('fs'),
4
+ path = require('path');
5
+
6
+ var Mustache = require('..');
7
+ var pkg = require('../package');
8
+ var partials = {};
9
+
10
+ var partialsPaths = [];
11
+ var partialArgIndex = -1;
12
+
13
+ while ((partialArgIndex = process.argv.indexOf('-p')) > -1) {
14
+ partialsPaths.push(process.argv.splice(partialArgIndex, 2)[1]);
15
+ }
16
+
17
+ var viewArg = process.argv[2];
18
+ var templateArg = process.argv[3];
19
+ var outputArg = process.argv[4];
20
+
21
+ if (hasVersionArg()) {
22
+ return console.log(pkg.version);
23
+ }
24
+
25
+ if (!templateArg || !viewArg) {
26
+ console.error('Syntax: mustache <view> <template> [output]');
27
+ process.exit(1);
28
+ }
29
+
30
+ run(readPartials, readView, readTemplate, render, toStdout);
31
+
32
+ /**
33
+ * Runs a list of functions as a waterfall.
34
+ * Functions are runned one after the other in order, providing each
35
+ * function the returned values of all the previously invoked functions.
36
+ * Each function is expected to exit the process if an error occurs.
37
+ */
38
+ function run (/*args*/) {
39
+ var values = [];
40
+ var fns = Array.prototype.slice.call(arguments);
41
+
42
+ function invokeNextFn (val) {
43
+ values.unshift(val);
44
+ if (fns.length === 0) return;
45
+ invoke(fns.shift());
46
+ }
47
+
48
+ function invoke (fn) {
49
+ fn.apply(null, [invokeNextFn].concat(values));
50
+ }
51
+
52
+ invoke(fns.shift());
53
+ }
54
+
55
+ function readView (cb) {
56
+ var view;
57
+ if (isJsFile(viewArg)) {
58
+ view = require(path.join(process.cwd(),viewArg));
59
+ cb(view);
60
+ } else {
61
+ if (isStdin(viewArg)) {
62
+ view = process.openStdin();
63
+ } else {
64
+ view = fs.createReadStream(viewArg);
65
+ }
66
+ streamToStr(view, function onDone (str) {
67
+ cb(parseView(str));
68
+ });
69
+ }
70
+ }
71
+
72
+ function parseView (str) {
73
+ try {
74
+ return JSON.parse(str);
75
+ } catch (ex) {
76
+ console.error(
77
+ 'Shooot, could not parse view as JSON.\n' +
78
+ 'Tips: functions are not valid JSON and keys / values must be surround with double quotes.\n\n' +
79
+ ex.stack);
80
+
81
+ process.exit(1);
82
+ }
83
+ }
84
+
85
+ function readPartials (cb) {
86
+ if (!partialsPaths.length) return cb();
87
+ var partialPath = partialsPaths.pop();
88
+ var partial = fs.createReadStream(partialPath);
89
+ streamToStr(partial, function onDone (str) {
90
+ partials[getPartialName(partialPath)] = str;
91
+ readPartials(cb);
92
+ });
93
+ }
94
+
95
+ function readTemplate (cb) {
96
+ var template = fs.createReadStream(templateArg);
97
+ streamToStr(template, cb);
98
+ }
99
+
100
+ function render (cb, templateStr, jsonView) {
101
+ cb(Mustache.render(templateStr, jsonView, partials));
102
+ }
103
+
104
+ function toStdout (cb, str) {
105
+ if (outputArg) {
106
+ cb(fs.writeFileSync(outputArg, str));
107
+ } else {
108
+ cb(process.stdout.write(str));
109
+ }
110
+ }
111
+
112
+ function streamToStr (stream, cb) {
113
+ var data = '';
114
+
115
+ stream.on('data', function onData (chunk) {
116
+ data += chunk;
117
+ }).once('end', function onEnd () {
118
+ cb(data.toString());
119
+ }).on('error', function onError (err) {
120
+ if (wasNotFound(err)) {
121
+ console.error('Could not find file:', err.path);
122
+ } else {
123
+ console.error('Error while reading file:', err.message);
124
+ }
125
+ process.exit(1);
126
+ });
127
+ }
128
+
129
+ function isStdin (view) {
130
+ return view === '-';
131
+ }
132
+
133
+ function isJsFile (view) {
134
+ var extension = path.extname(view);
135
+ return extension === '.js' || extension === '.cjs';
136
+ }
137
+
138
+ function wasNotFound (err) {
139
+ return err.code && err.code === 'ENOENT';
140
+ }
141
+
142
+ function hasVersionArg () {
143
+ return ['--version', '-v'].some(function matchInArgs (opt) {
144
+ return process.argv.indexOf(opt) > -1;
145
+ });
146
+ }
147
+
148
+ function getPartialName (filename) {
149
+ return path.basename(filename, '.mustache');
150
+ }
workers1/auto3d/node_modules/.bin/nanoid ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+
3
+ let { nanoid, customAlphabet } = require('..')
4
+
5
+ function print(msg) {
6
+ process.stdout.write(msg + '\n')
7
+ }
8
+
9
+ function error(msg) {
10
+ process.stderr.write(msg + '\n')
11
+ process.exit(1)
12
+ }
13
+
14
+ if (process.argv.includes('--help') || process.argv.includes('-h')) {
15
+ print(`
16
+ Usage
17
+ $ nanoid [options]
18
+
19
+ Options
20
+ -s, --size Generated ID size
21
+ -a, --alphabet Alphabet to use
22
+ -h, --help Show this help
23
+
24
+ Examples
25
+ $ nanoid --s 15
26
+ S9sBF77U6sDB8Yg
27
+
28
+ $ nanoid --size 10 --alphabet abc
29
+ bcabababca`)
30
+ process.exit()
31
+ }
32
+
33
+ let alphabet, size
34
+ for (let i = 2; i < process.argv.length; i++) {
35
+ let arg = process.argv[i]
36
+ if (arg === '--size' || arg === '-s') {
37
+ size = Number(process.argv[i + 1])
38
+ i += 1
39
+ if (Number.isNaN(size) || size <= 0) {
40
+ error('Size must be positive integer')
41
+ }
42
+ } else if (arg === '--alphabet' || arg === '-a') {
43
+ alphabet = process.argv[i + 1]
44
+ i += 1
45
+ } else {
46
+ error('Unknown argument ' + arg)
47
+ }
48
+ }
49
+
50
+ if (alphabet) {
51
+ let customNanoid = customAlphabet(alphabet, size)
52
+ print(customNanoid())
53
+ } else {
54
+ print(nanoid(size))
55
+ }
workers1/auto3d/node_modules/.bin/resolve ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+
3
+ 'use strict';
4
+
5
+ var path = require('path');
6
+ var fs = require('fs');
7
+
8
+ if (
9
+ String(process.env.npm_lifecycle_script).slice(0, 8) !== 'resolve '
10
+ && (
11
+ !process.argv
12
+ || process.argv.length < 2
13
+ || (process.argv[1] !== __filename && fs.statSync(process.argv[1]).ino !== fs.statSync(__filename).ino)
14
+ || (process.env.npm_lifecycle_event !== 'npx' && process.env._ && fs.realpathSync(path.resolve(process.env._)) !== __filename)
15
+ )
16
+ ) {
17
+ console.error('Error: `resolve` must be run directly as an executable');
18
+ process.exit(1);
19
+ }
20
+
21
+ var supportsPreserveSymlinkFlag = require('supports-preserve-symlinks-flag');
22
+
23
+ var preserveSymlinks = false;
24
+ for (var i = 2; i < process.argv.length; i += 1) {
25
+ if (process.argv[i].slice(0, 2) === '--') {
26
+ if (supportsPreserveSymlinkFlag && process.argv[i] === '--preserve-symlinks') {
27
+ preserveSymlinks = true;
28
+ } else if (process.argv[i].length > 2) {
29
+ console.error('Unknown argument ' + process.argv[i].replace(/[=].*$/, ''));
30
+ process.exit(2);
31
+ }
32
+ process.argv.splice(i, 1);
33
+ i -= 1;
34
+ if (process.argv[i] === '--') { break; } // eslint-disable-line no-restricted-syntax
35
+ }
36
+ }
37
+
38
+ if (process.argv.length < 3) {
39
+ console.error('Error: `resolve` expects a specifier');
40
+ process.exit(2);
41
+ }
42
+
43
+ var resolve = require('../');
44
+
45
+ var result = resolve.sync(process.argv[2], {
46
+ basedir: process.cwd(),
47
+ preserveSymlinks: preserveSymlinks
48
+ });
49
+
50
+ console.log(result);
workers1/auto3d/node_modules/.bin/workerd ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cde2db24a8b1105d9d4b7452a799dec7e01b978434ca3e62de4ce3375bb60990
3
+ size 111103064
workers1/auto3d/node_modules/.bin/wrangler ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ const { spawn } = require("child_process");
3
+ const path = require("path");
4
+ const fs = require("fs");
5
+ const os = require("os");
6
+
7
+ const MIN_NODE_VERSION = "16.13.0";
8
+ const debug =
9
+ process.env["WRANGLER_LOG"] === "debug"
10
+ ? (...args) => console.log(...args)
11
+ : () => {};
12
+
13
+ let wranglerProcess;
14
+
15
+ /**
16
+ * Executes ../wrangler-dist/cli.js
17
+ */
18
+ function runWrangler() {
19
+ if (semiver(process.versions.node, MIN_NODE_VERSION) < 0) {
20
+ // Note Volta and nvm are also recommended in the official docs:
21
+ // https://developers.cloudflare.com/workers/get-started/guide#2-install-the-workers-cli
22
+ console.error(
23
+ `Wrangler requires at least Node.js v${MIN_NODE_VERSION}. You are using v${process.versions.node}. Please update your version of Node.js.
24
+
25
+ Consider using a Node.js version manager such as https://volta.sh/ or https://github.com/nvm-sh/nvm.`
26
+ );
27
+ process.exitCode = 1;
28
+ return;
29
+ }
30
+
31
+ return spawn(
32
+ process.execPath,
33
+ [
34
+ "--no-warnings",
35
+ "--experimental-vm-modules",
36
+ ...process.execArgv,
37
+ path.join(__dirname, "../wrangler-dist/cli.js"),
38
+ ...process.argv.slice(2),
39
+ ],
40
+ {
41
+ stdio: ["inherit", "inherit", "inherit", "ipc"],
42
+ }
43
+ )
44
+ .on("exit", (code) =>
45
+ process.exit(code === undefined || code === null ? 0 : code)
46
+ )
47
+ .on("message", (message) => {
48
+ if (process.send) {
49
+ process.send(message);
50
+ }
51
+ })
52
+ .on("disconnect", () => {
53
+ if (process.disconnect) {
54
+ process.disconnect();
55
+ }
56
+ });
57
+ }
58
+
59
+ // semiver implementation via https://github.com/lukeed/semiver/blob/ae7eebe6053c96be63032b14fb0b68e2553fcac4/src/index.js
60
+
61
+ /**
62
+ MIT License
63
+
64
+ Copyright (c) Luke Edwards <[email protected]> (lukeed.com)
65
+
66
+ 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:
67
+
68
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
69
+
70
+ 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.
71
+
72
+ */
73
+
74
+ var fn = new Intl.Collator(0, { numeric: 1 }).compare;
75
+
76
+ function semiver(a, b, bool) {
77
+ a = a.split(".");
78
+ b = b.split(".");
79
+
80
+ return (
81
+ fn(a[0], b[0]) ||
82
+ fn(a[1], b[1]) ||
83
+ ((b[2] = b.slice(2).join(".")),
84
+ (bool = /[.-]/.test((a[2] = a.slice(2).join(".")))),
85
+ bool == /[.-]/.test(b[2]) ? fn(a[2], b[2]) : bool ? -1 : 1)
86
+ );
87
+ }
88
+
89
+ // end semiver implementation
90
+
91
+ if (module === require.main) {
92
+ wranglerProcess = runWrangler();
93
+ process.on("SIGINT", () => {
94
+ wranglerProcess && wranglerProcess.kill();
95
+ });
96
+ process.on("SIGTERM", () => {
97
+ wranglerProcess && wranglerProcess.kill();
98
+ });
99
+ }
workers1/auto3d/node_modules/.bin/wrangler2 ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ const { spawn } = require("child_process");
3
+ const path = require("path");
4
+ const fs = require("fs");
5
+ const os = require("os");
6
+
7
+ const MIN_NODE_VERSION = "16.13.0";
8
+ const debug =
9
+ process.env["WRANGLER_LOG"] === "debug"
10
+ ? (...args) => console.log(...args)
11
+ : () => {};
12
+
13
+ let wranglerProcess;
14
+
15
+ /**
16
+ * Executes ../wrangler-dist/cli.js
17
+ */
18
+ function runWrangler() {
19
+ if (semiver(process.versions.node, MIN_NODE_VERSION) < 0) {
20
+ // Note Volta and nvm are also recommended in the official docs:
21
+ // https://developers.cloudflare.com/workers/get-started/guide#2-install-the-workers-cli
22
+ console.error(
23
+ `Wrangler requires at least Node.js v${MIN_NODE_VERSION}. You are using v${process.versions.node}. Please update your version of Node.js.
24
+
25
+ Consider using a Node.js version manager such as https://volta.sh/ or https://github.com/nvm-sh/nvm.`
26
+ );
27
+ process.exitCode = 1;
28
+ return;
29
+ }
30
+
31
+ return spawn(
32
+ process.execPath,
33
+ [
34
+ "--no-warnings",
35
+ "--experimental-vm-modules",
36
+ ...process.execArgv,
37
+ path.join(__dirname, "../wrangler-dist/cli.js"),
38
+ ...process.argv.slice(2),
39
+ ],
40
+ {
41
+ stdio: ["inherit", "inherit", "inherit", "ipc"],
42
+ }
43
+ )
44
+ .on("exit", (code) =>
45
+ process.exit(code === undefined || code === null ? 0 : code)
46
+ )
47
+ .on("message", (message) => {
48
+ if (process.send) {
49
+ process.send(message);
50
+ }
51
+ })
52
+ .on("disconnect", () => {
53
+ if (process.disconnect) {
54
+ process.disconnect();
55
+ }
56
+ });
57
+ }
58
+
59
+ // semiver implementation via https://github.com/lukeed/semiver/blob/ae7eebe6053c96be63032b14fb0b68e2553fcac4/src/index.js
60
+
61
+ /**
62
+ MIT License
63
+
64
+ Copyright (c) Luke Edwards <[email protected]> (lukeed.com)
65
+
66
+ 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:
67
+
68
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
69
+
70
+ 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.
71
+
72
+ */
73
+
74
+ var fn = new Intl.Collator(0, { numeric: 1 }).compare;
75
+
76
+ function semiver(a, b, bool) {
77
+ a = a.split(".");
78
+ b = b.split(".");
79
+
80
+ return (
81
+ fn(a[0], b[0]) ||
82
+ fn(a[1], b[1]) ||
83
+ ((b[2] = b.slice(2).join(".")),
84
+ (bool = /[.-]/.test((a[2] = a.slice(2).join(".")))),
85
+ bool == /[.-]/.test(b[2]) ? fn(a[2], b[2]) : bool ? -1 : 1)
86
+ );
87
+ }
88
+
89
+ // end semiver implementation
90
+
91
+ if (module === require.main) {
92
+ wranglerProcess = runWrangler();
93
+ process.on("SIGINT", () => {
94
+ wranglerProcess && wranglerProcess.kill();
95
+ });
96
+ process.on("SIGTERM", () => {
97
+ wranglerProcess && wranglerProcess.kill();
98
+ });
99
+ }
workers1/auto3d/node_modules/.mf/cf.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"clientTcpRtt":6,"longitude":"-3.69970","httpProtocol":"HTTP/1.1","tlsCipher":"AEAD-AES256-GCM-SHA384","continent":"EU","asn":3352,"clientAcceptEncoding":"br, gzip, deflate","tlsClientExtensionsSha1":"Y7DIC8A6G0/aXviZ8ie/xDbJb7g=","isEUCountry":"1","verifiedBotCategory":"","tlsClientAuth":{"certIssuerDNLegacy":"","certIssuerSKI":"","certSubjectDNRFC2253":"","certSubjectDNLegacy":"","certFingerprintSHA256":"","certNotBefore":"","certSKI":"","certSerial":"","certIssuerDN":"","certVerified":"NONE","certNotAfter":"","certSubjectDN":"","certPresented":"0","certRevoked":"0","certIssuerSerial":"","certIssuerDNRFC2253":"","certFingerprintSHA1":""},"tlsExportedAuthenticator":{"clientFinished":"15dc21af5ec37802d8101c22eef89c261d2740ccd6b989ec6b31c60d799ff0376914d56a31d11b9de005e48dfcfb57a1","clientHandshake":"e04e4f0ba35572fbb249f2042e73a78837e3370952dad3b6ee9e772091d3dd2d75763f9cd59705ee5d74c3d0247be4a9","serverHandshake":"0c0268a149a9593109a55f06660f749f379a4ef028fba3b121a12114973363c0041b50c0f5275e7dfc13d7d09704862b","serverFinished":"d9135386a81b229940cab0f63b729ba21b43e72ae4fce2471f112c44414ee2b6e5ffea18fffce2aa32caa17d37ef8b41"},"tlsVersion":"TLSv1.3","city":"Madrid","timezone":"Europe/Madrid","tlsClientHelloLength":"380","requestPriority":"","edgeRequestKeepAliveStatus":1,"tlsClientRandom":"le7m5TY+d1rTG9E1fbznVJEHPpH4d8yauLtpYl2tjJ0=","region":"Madrid","latitude":"40.39070","postalCode":"28026","regionCode":"MD","asOrganization":"Telefonica de Espana","colo":"MAD","country":"ES","botManagement":{"corporateProxy":false,"verifiedBot":false,"jsDetection":{"passed":false},"staticResource":false,"detectionIds":{},"score":99}}
workers1/auto3d/node_modules/.package-lock.json ADDED
@@ -0,0 +1,1005 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "auto3d",
3
+ "version": "0.0.0",
4
+ "lockfileVersion": 3,
5
+ "requires": true,
6
+ "packages": {
7
+ "node_modules/@cloudflare/kv-asset-handler": {
8
+ "version": "0.3.4",
9
+ "resolved": "https://registry.npmjs.org/@cloudflare/kv-asset-handler/-/kv-asset-handler-0.3.4.tgz",
10
+ "integrity": "sha512-YLPHc8yASwjNkmcDMQMY35yiWjoKAKnhUbPRszBRS0YgH+IXtsMp61j+yTcnCE3oO2DgP0U3iejLC8FTtKDC8Q==",
11
+ "dev": true,
12
+ "license": "MIT OR Apache-2.0",
13
+ "dependencies": {
14
+ "mime": "^3.0.0"
15
+ },
16
+ "engines": {
17
+ "node": ">=16.13"
18
+ }
19
+ },
20
+ "node_modules/@cloudflare/workerd-darwin-arm64": {
21
+ "version": "1.20240821.1",
22
+ "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20240821.1.tgz",
23
+ "integrity": "sha512-Q+9RedvNbPcEt/dKni1oN94OxbvuNAeJkgHmrLFTGF8zu21wzOhVkQeRNxcYxrMa9mfStc457NAg13OVCj2kHQ==",
24
+ "cpu": [
25
+ "arm64"
26
+ ],
27
+ "dev": true,
28
+ "license": "Apache-2.0",
29
+ "optional": true,
30
+ "os": [
31
+ "darwin"
32
+ ],
33
+ "engines": {
34
+ "node": ">=16"
35
+ }
36
+ },
37
+ "node_modules/@cloudflare/workers-shared": {
38
+ "version": "0.4.1",
39
+ "resolved": "https://registry.npmjs.org/@cloudflare/workers-shared/-/workers-shared-0.4.1.tgz",
40
+ "integrity": "sha512-nYh4r8JwOOjYIdH2zub++CmIKlkYFlpxI1nBHimoiHcytJXD/b7ldJ21TtfzUZMCgI78mxVlymMHA/ReaOxKlA==",
41
+ "dev": true,
42
+ "license": "MIT OR Apache-2.0",
43
+ "engines": {
44
+ "node": ">=16.7.0"
45
+ }
46
+ },
47
+ "node_modules/@cspotcode/source-map-support": {
48
+ "version": "0.8.1",
49
+ "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
50
+ "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",
51
+ "dev": true,
52
+ "license": "MIT",
53
+ "dependencies": {
54
+ "@jridgewell/trace-mapping": "0.3.9"
55
+ },
56
+ "engines": {
57
+ "node": ">=12"
58
+ }
59
+ },
60
+ "node_modules/@esbuild-plugins/node-globals-polyfill": {
61
+ "version": "0.2.3",
62
+ "resolved": "https://registry.npmjs.org/@esbuild-plugins/node-globals-polyfill/-/node-globals-polyfill-0.2.3.tgz",
63
+ "integrity": "sha512-r3MIryXDeXDOZh7ih1l/yE9ZLORCd5e8vWg02azWRGj5SPTuoh69A2AIyn0Z31V/kHBfZ4HgWJ+OK3GTTwLmnw==",
64
+ "dev": true,
65
+ "license": "ISC",
66
+ "peerDependencies": {
67
+ "esbuild": "*"
68
+ }
69
+ },
70
+ "node_modules/@esbuild-plugins/node-modules-polyfill": {
71
+ "version": "0.2.2",
72
+ "resolved": "https://registry.npmjs.org/@esbuild-plugins/node-modules-polyfill/-/node-modules-polyfill-0.2.2.tgz",
73
+ "integrity": "sha512-LXV7QsWJxRuMYvKbiznh+U1ilIop3g2TeKRzUxOG5X3YITc8JyyTa90BmLwqqv0YnX4v32CSlG+vsziZp9dMvA==",
74
+ "dev": true,
75
+ "license": "ISC",
76
+ "dependencies": {
77
+ "escape-string-regexp": "^4.0.0",
78
+ "rollup-plugin-node-polyfills": "^0.2.1"
79
+ },
80
+ "peerDependencies": {
81
+ "esbuild": "*"
82
+ }
83
+ },
84
+ "node_modules/@esbuild/darwin-arm64": {
85
+ "version": "0.17.19",
86
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.19.tgz",
87
+ "integrity": "sha512-80wEoCfF/hFKM6WE1FyBHc9SfUblloAWx6FJkFWTWiCoht9Mc0ARGEM47e67W9rI09YoUxJL68WHfDRYEAvOhg==",
88
+ "cpu": [
89
+ "arm64"
90
+ ],
91
+ "dev": true,
92
+ "license": "MIT",
93
+ "optional": true,
94
+ "os": [
95
+ "darwin"
96
+ ],
97
+ "engines": {
98
+ "node": ">=12"
99
+ }
100
+ },
101
+ "node_modules/@fastify/busboy": {
102
+ "version": "2.1.1",
103
+ "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz",
104
+ "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==",
105
+ "dev": true,
106
+ "license": "MIT",
107
+ "engines": {
108
+ "node": ">=14"
109
+ }
110
+ },
111
+ "node_modules/@jridgewell/resolve-uri": {
112
+ "version": "3.1.2",
113
+ "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
114
+ "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
115
+ "dev": true,
116
+ "license": "MIT",
117
+ "engines": {
118
+ "node": ">=6.0.0"
119
+ }
120
+ },
121
+ "node_modules/@jridgewell/sourcemap-codec": {
122
+ "version": "1.5.0",
123
+ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz",
124
+ "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==",
125
+ "dev": true,
126
+ "license": "MIT"
127
+ },
128
+ "node_modules/@jridgewell/trace-mapping": {
129
+ "version": "0.3.9",
130
+ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz",
131
+ "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",
132
+ "dev": true,
133
+ "license": "MIT",
134
+ "dependencies": {
135
+ "@jridgewell/resolve-uri": "^3.0.3",
136
+ "@jridgewell/sourcemap-codec": "^1.4.10"
137
+ }
138
+ },
139
+ "node_modules/@types/node": {
140
+ "version": "22.5.4",
141
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.4.tgz",
142
+ "integrity": "sha512-FDuKUJQm/ju9fT/SeX/6+gBzoPzlVCzfzmGkwKvRHQVxi4BntVbyIwf6a4Xn62mrvndLiml6z/UBXIdEVjQLXg==",
143
+ "dev": true,
144
+ "license": "MIT",
145
+ "dependencies": {
146
+ "undici-types": "~6.19.2"
147
+ }
148
+ },
149
+ "node_modules/@types/node-forge": {
150
+ "version": "1.3.11",
151
+ "resolved": "https://registry.npmjs.org/@types/node-forge/-/node-forge-1.3.11.tgz",
152
+ "integrity": "sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ==",
153
+ "dev": true,
154
+ "license": "MIT",
155
+ "dependencies": {
156
+ "@types/node": "*"
157
+ }
158
+ },
159
+ "node_modules/acorn": {
160
+ "version": "8.12.1",
161
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz",
162
+ "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==",
163
+ "dev": true,
164
+ "license": "MIT",
165
+ "bin": {
166
+ "acorn": "bin/acorn"
167
+ },
168
+ "engines": {
169
+ "node": ">=0.4.0"
170
+ }
171
+ },
172
+ "node_modules/acorn-walk": {
173
+ "version": "8.3.4",
174
+ "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz",
175
+ "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==",
176
+ "dev": true,
177
+ "license": "MIT",
178
+ "dependencies": {
179
+ "acorn": "^8.11.0"
180
+ },
181
+ "engines": {
182
+ "node": ">=0.4.0"
183
+ }
184
+ },
185
+ "node_modules/anymatch": {
186
+ "version": "3.1.3",
187
+ "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
188
+ "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",
189
+ "dev": true,
190
+ "license": "ISC",
191
+ "dependencies": {
192
+ "normalize-path": "^3.0.0",
193
+ "picomatch": "^2.0.4"
194
+ },
195
+ "engines": {
196
+ "node": ">= 8"
197
+ }
198
+ },
199
+ "node_modules/as-table": {
200
+ "version": "1.0.55",
201
+ "resolved": "https://registry.npmjs.org/as-table/-/as-table-1.0.55.tgz",
202
+ "integrity": "sha512-xvsWESUJn0JN421Xb9MQw6AsMHRCUknCe0Wjlxvjud80mU4E6hQf1A6NzQKcYNmYw62MfzEtXc+badstZP3JpQ==",
203
+ "dev": true,
204
+ "license": "MIT",
205
+ "dependencies": {
206
+ "printable-characters": "^1.0.42"
207
+ }
208
+ },
209
+ "node_modules/binary-extensions": {
210
+ "version": "2.3.0",
211
+ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz",
212
+ "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==",
213
+ "dev": true,
214
+ "license": "MIT",
215
+ "engines": {
216
+ "node": ">=8"
217
+ },
218
+ "funding": {
219
+ "url": "https://github.com/sponsors/sindresorhus"
220
+ }
221
+ },
222
+ "node_modules/blake3-wasm": {
223
+ "version": "2.1.5",
224
+ "resolved": "https://registry.npmjs.org/blake3-wasm/-/blake3-wasm-2.1.5.tgz",
225
+ "integrity": "sha512-F1+K8EbfOZE49dtoPtmxUQrpXaBIl3ICvasLh+nJta0xkz+9kF/7uet9fLnwKqhDrmj6g+6K3Tw9yQPUg2ka5g==",
226
+ "dev": true,
227
+ "license": "MIT"
228
+ },
229
+ "node_modules/braces": {
230
+ "version": "3.0.3",
231
+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
232
+ "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
233
+ "dev": true,
234
+ "license": "MIT",
235
+ "dependencies": {
236
+ "fill-range": "^7.1.1"
237
+ },
238
+ "engines": {
239
+ "node": ">=8"
240
+ }
241
+ },
242
+ "node_modules/capnp-ts": {
243
+ "version": "0.7.0",
244
+ "resolved": "https://registry.npmjs.org/capnp-ts/-/capnp-ts-0.7.0.tgz",
245
+ "integrity": "sha512-XKxXAC3HVPv7r674zP0VC3RTXz+/JKhfyw94ljvF80yynK6VkTnqE3jMuN8b3dUVmmc43TjyxjW4KTsmB3c86g==",
246
+ "dev": true,
247
+ "license": "MIT",
248
+ "dependencies": {
249
+ "debug": "^4.3.1",
250
+ "tslib": "^2.2.0"
251
+ }
252
+ },
253
+ "node_modules/chokidar": {
254
+ "version": "3.6.0",
255
+ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
256
+ "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",
257
+ "dev": true,
258
+ "license": "MIT",
259
+ "dependencies": {
260
+ "anymatch": "~3.1.2",
261
+ "braces": "~3.0.2",
262
+ "glob-parent": "~5.1.2",
263
+ "is-binary-path": "~2.1.0",
264
+ "is-glob": "~4.0.1",
265
+ "normalize-path": "~3.0.0",
266
+ "readdirp": "~3.6.0"
267
+ },
268
+ "engines": {
269
+ "node": ">= 8.10.0"
270
+ },
271
+ "funding": {
272
+ "url": "https://paulmillr.com/funding/"
273
+ },
274
+ "optionalDependencies": {
275
+ "fsevents": "~2.3.2"
276
+ }
277
+ },
278
+ "node_modules/cookie": {
279
+ "version": "0.5.0",
280
+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz",
281
+ "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==",
282
+ "dev": true,
283
+ "license": "MIT",
284
+ "engines": {
285
+ "node": ">= 0.6"
286
+ }
287
+ },
288
+ "node_modules/data-uri-to-buffer": {
289
+ "version": "2.0.2",
290
+ "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-2.0.2.tgz",
291
+ "integrity": "sha512-ND9qDTLc6diwj+Xe5cdAgVTbLVdXbtxTJRXRhli8Mowuaan+0EJOtdqJ0QCHNSSPyoXGx9HX2/VMnKeC34AChA==",
292
+ "dev": true,
293
+ "license": "MIT"
294
+ },
295
+ "node_modules/date-fns": {
296
+ "version": "3.6.0",
297
+ "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-3.6.0.tgz",
298
+ "integrity": "sha512-fRHTG8g/Gif+kSh50gaGEdToemgfj74aRX3swtiouboip5JDLAyDE9F11nHMIcvOaXeOC6D7SpNhi7uFyB7Uww==",
299
+ "dev": true,
300
+ "license": "MIT",
301
+ "funding": {
302
+ "type": "github",
303
+ "url": "https://github.com/sponsors/kossnocorp"
304
+ }
305
+ },
306
+ "node_modules/debug": {
307
+ "version": "4.3.7",
308
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz",
309
+ "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==",
310
+ "dev": true,
311
+ "license": "MIT",
312
+ "dependencies": {
313
+ "ms": "^2.1.3"
314
+ },
315
+ "engines": {
316
+ "node": ">=6.0"
317
+ },
318
+ "peerDependenciesMeta": {
319
+ "supports-color": {
320
+ "optional": true
321
+ }
322
+ }
323
+ },
324
+ "node_modules/defu": {
325
+ "version": "6.1.4",
326
+ "resolved": "https://registry.npmjs.org/defu/-/defu-6.1.4.tgz",
327
+ "integrity": "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==",
328
+ "dev": true,
329
+ "license": "MIT"
330
+ },
331
+ "node_modules/esbuild": {
332
+ "version": "0.17.19",
333
+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.19.tgz",
334
+ "integrity": "sha512-XQ0jAPFkK/u3LcVRcvVHQcTIqD6E2H1fvZMA5dQPSOWb3suUbWbfbRf94pjc0bNzRYLfIrDRQXr7X+LHIm5oHw==",
335
+ "dev": true,
336
+ "hasInstallScript": true,
337
+ "license": "MIT",
338
+ "bin": {
339
+ "esbuild": "bin/esbuild"
340
+ },
341
+ "engines": {
342
+ "node": ">=12"
343
+ },
344
+ "optionalDependencies": {
345
+ "@esbuild/android-arm": "0.17.19",
346
+ "@esbuild/android-arm64": "0.17.19",
347
+ "@esbuild/android-x64": "0.17.19",
348
+ "@esbuild/darwin-arm64": "0.17.19",
349
+ "@esbuild/darwin-x64": "0.17.19",
350
+ "@esbuild/freebsd-arm64": "0.17.19",
351
+ "@esbuild/freebsd-x64": "0.17.19",
352
+ "@esbuild/linux-arm": "0.17.19",
353
+ "@esbuild/linux-arm64": "0.17.19",
354
+ "@esbuild/linux-ia32": "0.17.19",
355
+ "@esbuild/linux-loong64": "0.17.19",
356
+ "@esbuild/linux-mips64el": "0.17.19",
357
+ "@esbuild/linux-ppc64": "0.17.19",
358
+ "@esbuild/linux-riscv64": "0.17.19",
359
+ "@esbuild/linux-s390x": "0.17.19",
360
+ "@esbuild/linux-x64": "0.17.19",
361
+ "@esbuild/netbsd-x64": "0.17.19",
362
+ "@esbuild/openbsd-x64": "0.17.19",
363
+ "@esbuild/sunos-x64": "0.17.19",
364
+ "@esbuild/win32-arm64": "0.17.19",
365
+ "@esbuild/win32-ia32": "0.17.19",
366
+ "@esbuild/win32-x64": "0.17.19"
367
+ }
368
+ },
369
+ "node_modules/escape-string-regexp": {
370
+ "version": "4.0.0",
371
+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
372
+ "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
373
+ "dev": true,
374
+ "license": "MIT",
375
+ "engines": {
376
+ "node": ">=10"
377
+ },
378
+ "funding": {
379
+ "url": "https://github.com/sponsors/sindresorhus"
380
+ }
381
+ },
382
+ "node_modules/estree-walker": {
383
+ "version": "0.6.1",
384
+ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz",
385
+ "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==",
386
+ "dev": true,
387
+ "license": "MIT"
388
+ },
389
+ "node_modules/exit-hook": {
390
+ "version": "2.2.1",
391
+ "resolved": "https://registry.npmjs.org/exit-hook/-/exit-hook-2.2.1.tgz",
392
+ "integrity": "sha512-eNTPlAD67BmP31LDINZ3U7HSF8l57TxOY2PmBJ1shpCvpnxBF93mWCE8YHBnXs8qiUZJc9WDcWIeC3a2HIAMfw==",
393
+ "dev": true,
394
+ "license": "MIT",
395
+ "engines": {
396
+ "node": ">=6"
397
+ },
398
+ "funding": {
399
+ "url": "https://github.com/sponsors/sindresorhus"
400
+ }
401
+ },
402
+ "node_modules/fill-range": {
403
+ "version": "7.1.1",
404
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
405
+ "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
406
+ "dev": true,
407
+ "license": "MIT",
408
+ "dependencies": {
409
+ "to-regex-range": "^5.0.1"
410
+ },
411
+ "engines": {
412
+ "node": ">=8"
413
+ }
414
+ },
415
+ "node_modules/function-bind": {
416
+ "version": "1.1.2",
417
+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
418
+ "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
419
+ "dev": true,
420
+ "license": "MIT",
421
+ "funding": {
422
+ "url": "https://github.com/sponsors/ljharb"
423
+ }
424
+ },
425
+ "node_modules/get-source": {
426
+ "version": "2.0.12",
427
+ "resolved": "https://registry.npmjs.org/get-source/-/get-source-2.0.12.tgz",
428
+ "integrity": "sha512-X5+4+iD+HoSeEED+uwrQ07BOQr0kEDFMVqqpBuI+RaZBpBpHCuXxo70bjar6f0b0u/DQJsJ7ssurpP0V60Az+w==",
429
+ "dev": true,
430
+ "license": "Unlicense",
431
+ "dependencies": {
432
+ "data-uri-to-buffer": "^2.0.0",
433
+ "source-map": "^0.6.1"
434
+ }
435
+ },
436
+ "node_modules/glob-parent": {
437
+ "version": "5.1.2",
438
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
439
+ "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
440
+ "dev": true,
441
+ "license": "ISC",
442
+ "dependencies": {
443
+ "is-glob": "^4.0.1"
444
+ },
445
+ "engines": {
446
+ "node": ">= 6"
447
+ }
448
+ },
449
+ "node_modules/glob-to-regexp": {
450
+ "version": "0.4.1",
451
+ "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz",
452
+ "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==",
453
+ "dev": true,
454
+ "license": "BSD-2-Clause"
455
+ },
456
+ "node_modules/hasown": {
457
+ "version": "2.0.2",
458
+ "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
459
+ "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
460
+ "dev": true,
461
+ "license": "MIT",
462
+ "dependencies": {
463
+ "function-bind": "^1.1.2"
464
+ },
465
+ "engines": {
466
+ "node": ">= 0.4"
467
+ }
468
+ },
469
+ "node_modules/is-binary-path": {
470
+ "version": "2.1.0",
471
+ "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
472
+ "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
473
+ "dev": true,
474
+ "license": "MIT",
475
+ "dependencies": {
476
+ "binary-extensions": "^2.0.0"
477
+ },
478
+ "engines": {
479
+ "node": ">=8"
480
+ }
481
+ },
482
+ "node_modules/is-core-module": {
483
+ "version": "2.15.1",
484
+ "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.1.tgz",
485
+ "integrity": "sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ==",
486
+ "dev": true,
487
+ "license": "MIT",
488
+ "dependencies": {
489
+ "hasown": "^2.0.2"
490
+ },
491
+ "engines": {
492
+ "node": ">= 0.4"
493
+ },
494
+ "funding": {
495
+ "url": "https://github.com/sponsors/ljharb"
496
+ }
497
+ },
498
+ "node_modules/is-extglob": {
499
+ "version": "2.1.1",
500
+ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
501
+ "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
502
+ "dev": true,
503
+ "license": "MIT",
504
+ "engines": {
505
+ "node": ">=0.10.0"
506
+ }
507
+ },
508
+ "node_modules/is-glob": {
509
+ "version": "4.0.3",
510
+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
511
+ "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
512
+ "dev": true,
513
+ "license": "MIT",
514
+ "dependencies": {
515
+ "is-extglob": "^2.1.1"
516
+ },
517
+ "engines": {
518
+ "node": ">=0.10.0"
519
+ }
520
+ },
521
+ "node_modules/is-number": {
522
+ "version": "7.0.0",
523
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
524
+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
525
+ "dev": true,
526
+ "license": "MIT",
527
+ "engines": {
528
+ "node": ">=0.12.0"
529
+ }
530
+ },
531
+ "node_modules/magic-string": {
532
+ "version": "0.25.9",
533
+ "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz",
534
+ "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==",
535
+ "dev": true,
536
+ "license": "MIT",
537
+ "dependencies": {
538
+ "sourcemap-codec": "^1.4.8"
539
+ }
540
+ },
541
+ "node_modules/mime": {
542
+ "version": "3.0.0",
543
+ "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz",
544
+ "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==",
545
+ "dev": true,
546
+ "license": "MIT",
547
+ "bin": {
548
+ "mime": "cli.js"
549
+ },
550
+ "engines": {
551
+ "node": ">=10.0.0"
552
+ }
553
+ },
554
+ "node_modules/miniflare": {
555
+ "version": "3.20240821.1",
556
+ "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20240821.1.tgz",
557
+ "integrity": "sha512-81qdiryDG7VXzZuoa0EwhkaIYYrn7+StRIrd/2i7SPqPUNICUBjbhFFKqTnvE1+fqIPPB6l8ShKFaFvmnZOASg==",
558
+ "dev": true,
559
+ "license": "MIT",
560
+ "dependencies": {
561
+ "@cspotcode/source-map-support": "0.8.1",
562
+ "acorn": "^8.8.0",
563
+ "acorn-walk": "^8.2.0",
564
+ "capnp-ts": "^0.7.0",
565
+ "exit-hook": "^2.2.1",
566
+ "glob-to-regexp": "^0.4.1",
567
+ "stoppable": "^1.1.0",
568
+ "undici": "^5.28.4",
569
+ "workerd": "1.20240821.1",
570
+ "ws": "^8.17.1",
571
+ "youch": "^3.2.2",
572
+ "zod": "^3.22.3"
573
+ },
574
+ "bin": {
575
+ "miniflare": "bootstrap.js"
576
+ },
577
+ "engines": {
578
+ "node": ">=16.13"
579
+ }
580
+ },
581
+ "node_modules/ms": {
582
+ "version": "2.1.3",
583
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
584
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
585
+ "dev": true,
586
+ "license": "MIT"
587
+ },
588
+ "node_modules/mustache": {
589
+ "version": "4.2.0",
590
+ "resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz",
591
+ "integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==",
592
+ "dev": true,
593
+ "license": "MIT",
594
+ "bin": {
595
+ "mustache": "bin/mustache"
596
+ }
597
+ },
598
+ "node_modules/nanoid": {
599
+ "version": "3.3.7",
600
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz",
601
+ "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==",
602
+ "dev": true,
603
+ "funding": [
604
+ {
605
+ "type": "github",
606
+ "url": "https://github.com/sponsors/ai"
607
+ }
608
+ ],
609
+ "license": "MIT",
610
+ "bin": {
611
+ "nanoid": "bin/nanoid.cjs"
612
+ },
613
+ "engines": {
614
+ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
615
+ }
616
+ },
617
+ "node_modules/node-forge": {
618
+ "version": "1.3.1",
619
+ "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz",
620
+ "integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==",
621
+ "dev": true,
622
+ "license": "(BSD-3-Clause OR GPL-2.0)",
623
+ "engines": {
624
+ "node": ">= 6.13.0"
625
+ }
626
+ },
627
+ "node_modules/normalize-path": {
628
+ "version": "3.0.0",
629
+ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
630
+ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
631
+ "dev": true,
632
+ "license": "MIT",
633
+ "engines": {
634
+ "node": ">=0.10.0"
635
+ }
636
+ },
637
+ "node_modules/ohash": {
638
+ "version": "1.1.3",
639
+ "resolved": "https://registry.npmjs.org/ohash/-/ohash-1.1.3.tgz",
640
+ "integrity": "sha512-zuHHiGTYTA1sYJ/wZN+t5HKZaH23i4yI1HMwbuXm24Nid7Dv0KcuRlKoNKS9UNfAVSBlnGLcuQrnOKWOZoEGaw==",
641
+ "dev": true,
642
+ "license": "MIT"
643
+ },
644
+ "node_modules/path-parse": {
645
+ "version": "1.0.7",
646
+ "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
647
+ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
648
+ "dev": true,
649
+ "license": "MIT"
650
+ },
651
+ "node_modules/path-to-regexp": {
652
+ "version": "6.2.2",
653
+ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.2.tgz",
654
+ "integrity": "sha512-GQX3SSMokngb36+whdpRXE+3f9V8UzyAorlYvOGx87ufGHehNTn5lCxrKtLyZ4Yl/wEKnNnr98ZzOwwDZV5ogw==",
655
+ "dev": true,
656
+ "license": "MIT"
657
+ },
658
+ "node_modules/pathe": {
659
+ "version": "1.1.2",
660
+ "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz",
661
+ "integrity": "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==",
662
+ "dev": true,
663
+ "license": "MIT"
664
+ },
665
+ "node_modules/picomatch": {
666
+ "version": "2.3.1",
667
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
668
+ "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
669
+ "dev": true,
670
+ "license": "MIT",
671
+ "engines": {
672
+ "node": ">=8.6"
673
+ },
674
+ "funding": {
675
+ "url": "https://github.com/sponsors/jonschlinkert"
676
+ }
677
+ },
678
+ "node_modules/printable-characters": {
679
+ "version": "1.0.42",
680
+ "resolved": "https://registry.npmjs.org/printable-characters/-/printable-characters-1.0.42.tgz",
681
+ "integrity": "sha512-dKp+C4iXWK4vVYZmYSd0KBH5F/h1HoZRsbJ82AVKRO3PEo8L4lBS/vLwhVtpwwuYcoIsVY+1JYKR268yn480uQ==",
682
+ "dev": true,
683
+ "license": "Unlicense"
684
+ },
685
+ "node_modules/readdirp": {
686
+ "version": "3.6.0",
687
+ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
688
+ "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
689
+ "dev": true,
690
+ "license": "MIT",
691
+ "dependencies": {
692
+ "picomatch": "^2.2.1"
693
+ },
694
+ "engines": {
695
+ "node": ">=8.10.0"
696
+ }
697
+ },
698
+ "node_modules/resolve": {
699
+ "version": "1.22.8",
700
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz",
701
+ "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==",
702
+ "dev": true,
703
+ "license": "MIT",
704
+ "dependencies": {
705
+ "is-core-module": "^2.13.0",
706
+ "path-parse": "^1.0.7",
707
+ "supports-preserve-symlinks-flag": "^1.0.0"
708
+ },
709
+ "bin": {
710
+ "resolve": "bin/resolve"
711
+ },
712
+ "funding": {
713
+ "url": "https://github.com/sponsors/ljharb"
714
+ }
715
+ },
716
+ "node_modules/resolve.exports": {
717
+ "version": "2.0.2",
718
+ "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz",
719
+ "integrity": "sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==",
720
+ "dev": true,
721
+ "license": "MIT",
722
+ "engines": {
723
+ "node": ">=10"
724
+ }
725
+ },
726
+ "node_modules/rollup-plugin-inject": {
727
+ "version": "3.0.2",
728
+ "resolved": "https://registry.npmjs.org/rollup-plugin-inject/-/rollup-plugin-inject-3.0.2.tgz",
729
+ "integrity": "sha512-ptg9PQwzs3orn4jkgXJ74bfs5vYz1NCZlSQMBUA0wKcGp5i5pA1AO3fOUEte8enhGUC+iapTCzEWw2jEFFUO/w==",
730
+ "deprecated": "This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.",
731
+ "dev": true,
732
+ "license": "MIT",
733
+ "dependencies": {
734
+ "estree-walker": "^0.6.1",
735
+ "magic-string": "^0.25.3",
736
+ "rollup-pluginutils": "^2.8.1"
737
+ }
738
+ },
739
+ "node_modules/rollup-plugin-node-polyfills": {
740
+ "version": "0.2.1",
741
+ "resolved": "https://registry.npmjs.org/rollup-plugin-node-polyfills/-/rollup-plugin-node-polyfills-0.2.1.tgz",
742
+ "integrity": "sha512-4kCrKPTJ6sK4/gLL/U5QzVT8cxJcofO0OU74tnB19F40cmuAKSzH5/siithxlofFEjwvw1YAhPmbvGNA6jEroA==",
743
+ "dev": true,
744
+ "license": "MIT",
745
+ "dependencies": {
746
+ "rollup-plugin-inject": "^3.0.0"
747
+ }
748
+ },
749
+ "node_modules/rollup-pluginutils": {
750
+ "version": "2.8.2",
751
+ "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz",
752
+ "integrity": "sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==",
753
+ "dev": true,
754
+ "license": "MIT",
755
+ "dependencies": {
756
+ "estree-walker": "^0.6.1"
757
+ }
758
+ },
759
+ "node_modules/selfsigned": {
760
+ "version": "2.4.1",
761
+ "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-2.4.1.tgz",
762
+ "integrity": "sha512-th5B4L2U+eGLq1TVh7zNRGBapioSORUeymIydxgFpwww9d2qyKvtuPU2jJuHvYAwwqi2Y596QBL3eEqcPEYL8Q==",
763
+ "dev": true,
764
+ "license": "MIT",
765
+ "dependencies": {
766
+ "@types/node-forge": "^1.3.0",
767
+ "node-forge": "^1"
768
+ },
769
+ "engines": {
770
+ "node": ">=10"
771
+ }
772
+ },
773
+ "node_modules/source-map": {
774
+ "version": "0.6.1",
775
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
776
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
777
+ "dev": true,
778
+ "license": "BSD-3-Clause",
779
+ "engines": {
780
+ "node": ">=0.10.0"
781
+ }
782
+ },
783
+ "node_modules/sourcemap-codec": {
784
+ "version": "1.4.8",
785
+ "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz",
786
+ "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==",
787
+ "deprecated": "Please use @jridgewell/sourcemap-codec instead",
788
+ "dev": true,
789
+ "license": "MIT"
790
+ },
791
+ "node_modules/stacktracey": {
792
+ "version": "2.1.8",
793
+ "resolved": "https://registry.npmjs.org/stacktracey/-/stacktracey-2.1.8.tgz",
794
+ "integrity": "sha512-Kpij9riA+UNg7TnphqjH7/CzctQ/owJGNbFkfEeve4Z4uxT5+JapVLFXcsurIfN34gnTWZNJ/f7NMG0E8JDzTw==",
795
+ "dev": true,
796
+ "license": "Unlicense",
797
+ "dependencies": {
798
+ "as-table": "^1.0.36",
799
+ "get-source": "^2.0.12"
800
+ }
801
+ },
802
+ "node_modules/stoppable": {
803
+ "version": "1.1.0",
804
+ "resolved": "https://registry.npmjs.org/stoppable/-/stoppable-1.1.0.tgz",
805
+ "integrity": "sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw==",
806
+ "dev": true,
807
+ "license": "MIT",
808
+ "engines": {
809
+ "node": ">=4",
810
+ "npm": ">=6"
811
+ }
812
+ },
813
+ "node_modules/supports-preserve-symlinks-flag": {
814
+ "version": "1.0.0",
815
+ "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
816
+ "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
817
+ "dev": true,
818
+ "license": "MIT",
819
+ "engines": {
820
+ "node": ">= 0.4"
821
+ },
822
+ "funding": {
823
+ "url": "https://github.com/sponsors/ljharb"
824
+ }
825
+ },
826
+ "node_modules/to-regex-range": {
827
+ "version": "5.0.1",
828
+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
829
+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
830
+ "dev": true,
831
+ "license": "MIT",
832
+ "dependencies": {
833
+ "is-number": "^7.0.0"
834
+ },
835
+ "engines": {
836
+ "node": ">=8.0"
837
+ }
838
+ },
839
+ "node_modules/tslib": {
840
+ "version": "2.7.0",
841
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz",
842
+ "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==",
843
+ "dev": true,
844
+ "license": "0BSD"
845
+ },
846
+ "node_modules/ufo": {
847
+ "version": "1.5.4",
848
+ "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.5.4.tgz",
849
+ "integrity": "sha512-UsUk3byDzKd04EyoZ7U4DOlxQaD14JUKQl6/P7wiX4FNvUfm3XL246n9W5AmqwW5RSFJ27NAuM0iLscAOYUiGQ==",
850
+ "dev": true,
851
+ "license": "MIT"
852
+ },
853
+ "node_modules/undici": {
854
+ "version": "5.28.4",
855
+ "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz",
856
+ "integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==",
857
+ "dev": true,
858
+ "license": "MIT",
859
+ "dependencies": {
860
+ "@fastify/busboy": "^2.0.0"
861
+ },
862
+ "engines": {
863
+ "node": ">=14.0"
864
+ }
865
+ },
866
+ "node_modules/undici-types": {
867
+ "version": "6.19.8",
868
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz",
869
+ "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==",
870
+ "dev": true,
871
+ "license": "MIT"
872
+ },
873
+ "node_modules/unenv": {
874
+ "name": "unenv-nightly",
875
+ "version": "2.0.0-1724863496.70db6f1",
876
+ "resolved": "https://registry.npmjs.org/unenv-nightly/-/unenv-nightly-2.0.0-1724863496.70db6f1.tgz",
877
+ "integrity": "sha512-r+VIl1gnsI4WQxluruSQhy8alpAf1AsLRLm4sEKp3otCyTIVD6I6wHEYzeQnwsyWgaD4+3BD4A/eqrgOpdTzhw==",
878
+ "dev": true,
879
+ "license": "MIT",
880
+ "dependencies": {
881
+ "defu": "^6.1.4",
882
+ "ohash": "^1.1.3",
883
+ "pathe": "^1.1.2",
884
+ "ufo": "^1.5.4"
885
+ }
886
+ },
887
+ "node_modules/workerd": {
888
+ "version": "1.20240821.1",
889
+ "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20240821.1.tgz",
890
+ "integrity": "sha512-y4phjCnEG96u8ZkgkkHB+gSw0i6uMNo23rBmixylWpjxDklB+LWD8dztasvsu7xGaZbLoTxQESdEw956F7VJDA==",
891
+ "dev": true,
892
+ "hasInstallScript": true,
893
+ "license": "Apache-2.0",
894
+ "bin": {
895
+ "workerd": "bin/workerd"
896
+ },
897
+ "engines": {
898
+ "node": ">=16"
899
+ },
900
+ "optionalDependencies": {
901
+ "@cloudflare/workerd-darwin-64": "1.20240821.1",
902
+ "@cloudflare/workerd-darwin-arm64": "1.20240821.1",
903
+ "@cloudflare/workerd-linux-64": "1.20240821.1",
904
+ "@cloudflare/workerd-linux-arm64": "1.20240821.1",
905
+ "@cloudflare/workerd-windows-64": "1.20240821.1"
906
+ }
907
+ },
908
+ "node_modules/wrangler": {
909
+ "version": "3.75.0",
910
+ "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-3.75.0.tgz",
911
+ "integrity": "sha512-CitNuNj0O1z6qbonUXmpUbxeWpU3nx28Kc4ZT33tMdeooQssb063Ie7+ZCdfS3kPhRHSwGdtOV22xFYytHON8w==",
912
+ "dev": true,
913
+ "license": "MIT OR Apache-2.0",
914
+ "dependencies": {
915
+ "@cloudflare/kv-asset-handler": "0.3.4",
916
+ "@cloudflare/workers-shared": "0.4.1",
917
+ "@esbuild-plugins/node-globals-polyfill": "^0.2.3",
918
+ "@esbuild-plugins/node-modules-polyfill": "^0.2.2",
919
+ "blake3-wasm": "^2.1.5",
920
+ "chokidar": "^3.5.3",
921
+ "date-fns": "^3.6.0",
922
+ "esbuild": "0.17.19",
923
+ "miniflare": "3.20240821.1",
924
+ "nanoid": "^3.3.3",
925
+ "path-to-regexp": "^6.2.0",
926
+ "resolve": "^1.22.8",
927
+ "resolve.exports": "^2.0.2",
928
+ "selfsigned": "^2.0.1",
929
+ "source-map": "^0.6.1",
930
+ "unenv": "npm:[email protected]",
931
+ "workerd": "1.20240821.1",
932
+ "xxhash-wasm": "^1.0.1"
933
+ },
934
+ "bin": {
935
+ "wrangler": "bin/wrangler.js",
936
+ "wrangler2": "bin/wrangler.js"
937
+ },
938
+ "engines": {
939
+ "node": ">=16.17.0"
940
+ },
941
+ "optionalDependencies": {
942
+ "fsevents": "~2.3.2"
943
+ },
944
+ "peerDependencies": {
945
+ "@cloudflare/workers-types": "^4.20240821.1"
946
+ },
947
+ "peerDependenciesMeta": {
948
+ "@cloudflare/workers-types": {
949
+ "optional": true
950
+ }
951
+ }
952
+ },
953
+ "node_modules/ws": {
954
+ "version": "8.18.0",
955
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz",
956
+ "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==",
957
+ "dev": true,
958
+ "license": "MIT",
959
+ "engines": {
960
+ "node": ">=10.0.0"
961
+ },
962
+ "peerDependencies": {
963
+ "bufferutil": "^4.0.1",
964
+ "utf-8-validate": ">=5.0.2"
965
+ },
966
+ "peerDependenciesMeta": {
967
+ "bufferutil": {
968
+ "optional": true
969
+ },
970
+ "utf-8-validate": {
971
+ "optional": true
972
+ }
973
+ }
974
+ },
975
+ "node_modules/xxhash-wasm": {
976
+ "version": "1.0.2",
977
+ "resolved": "https://registry.npmjs.org/xxhash-wasm/-/xxhash-wasm-1.0.2.tgz",
978
+ "integrity": "sha512-ibF0Or+FivM9lNrg+HGJfVX8WJqgo+kCLDc4vx6xMeTce7Aj+DLttKbxxRR/gNLSAelRc1omAPlJ77N/Jem07A==",
979
+ "dev": true,
980
+ "license": "MIT"
981
+ },
982
+ "node_modules/youch": {
983
+ "version": "3.3.3",
984
+ "resolved": "https://registry.npmjs.org/youch/-/youch-3.3.3.tgz",
985
+ "integrity": "sha512-qSFXUk3UZBLfggAW3dJKg0BMblG5biqSF8M34E06o5CSsZtH92u9Hqmj2RzGiHDi64fhe83+4tENFP2DB6t6ZA==",
986
+ "dev": true,
987
+ "license": "MIT",
988
+ "dependencies": {
989
+ "cookie": "^0.5.0",
990
+ "mustache": "^4.2.0",
991
+ "stacktracey": "^2.1.8"
992
+ }
993
+ },
994
+ "node_modules/zod": {
995
+ "version": "3.23.8",
996
+ "resolved": "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz",
997
+ "integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==",
998
+ "dev": true,
999
+ "license": "MIT",
1000
+ "funding": {
1001
+ "url": "https://github.com/sponsors/colinhacks"
1002
+ }
1003
+ }
1004
+ }
1005
+ }
workers1/auto3d/node_modules/@cloudflare/kv-asset-handler/README.md ADDED
@@ -0,0 +1,346 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # @cloudflare/kv-asset-handler
2
+
3
+ [![npm](https://img.shields.io/npm/v/@cloudflare/kv-asset-handler.svg)](https://www.npmjs.com/package/@cloudflare/kv-asset-handler) &nbsp;
4
+ [![Run npm tests](https://github.com/cloudflare/kv-asset-handler/actions/workflows/test.yml/badge.svg)](https://github.com/cloudflare/kv-asset-handler/actions/workflows/test.yml) &nbsp;
5
+ [![Lint Markdown](https://github.com/cloudflare/kv-asset-handler/actions/workflows/lint.yml/badge.svg)](https://github.com/cloudflare/kv-asset-handler/actions/workflows/lint.yml) &nbsp;
6
+
7
+ `kv-asset-handler` is an open-source library for managing the retrieval of static assets from [Workers KV](https://developers.cloudflare.com/workers/runtime-apis/kv) inside of a [Cloudflare Workers](https://workers.dev) function. `kv-asset-handler` is designed for use with [Workers Sites](https://developers.cloudflare.com/workers/platform/sites), a feature included in [Wrangler](https://github.com/cloudflare/wrangler), our command-line tool for deploying Workers projects.
8
+
9
+ `kv-asset-handler` runs as part of a Cloudflare Workers function, so it allows you to customize _how_ and _when_ your static assets are loaded, as well as customize how those assets behave before they're sent to the client.
10
+
11
+ Most users and sites will not need these customizations, and just want to serve their statically built applications. For that simple use-case, you can check out [Cloudflare Pages](https://pages.cloudflare.com), our batteries-included approach to deploying static sites on Cloudflare's edge network. Workers Sites was designed as a precursor to Cloudflare Pages, so check out Pages if you just want to deploy your static site without any special customizations!
12
+
13
+ For users who _do_ want to customize their assets, and want to build complex experiences on top of their static assets, `kv-asset-handler` (and the default [Workers Sites template](https://github.com/cloudflare/worker-sites-template), which is provided for use with Wrangler + Workers Sites) allows you to customize caching behavior, headers, and anything else about how your Workers function loads the static assets for your site stored in Workers KV.
14
+
15
+ The Cloudflare Workers Discord server is an active place where Workers users get help, share feedback, and collaborate on making our platform better. The `#workers` channel in particular is a great place to chat about `kv-asset-handler`, and building cool experiences for your users using these tools! If you have questions, want to share what you're working on, or give feedback, [join us in Discord and say hello](https://discord.cloudflare.com)!
16
+
17
+ - [Installation](#installation)
18
+ - [Usage](#usage)
19
+ - [`getAssetFromKV`](#getassetfromkv)
20
+ - [Example](#example)
21
+ * [Return](#return)
22
+ * [Optional Arguments](#optional-arguments)
23
+ - [`mapRequestToAsset`](#maprequesttoasset)
24
+ - [Example](#example-1)
25
+ - [`cacheControl`](#cachecontrol)
26
+ - [`browserTTL`](#browserttl)
27
+ - [`edgeTTL`](#edgettl)
28
+ - [`bypassCache`](#bypasscache)
29
+ - [`ASSET_NAMESPACE` (required for ES Modules)](#asset_namespace-required-for-es-modules)
30
+ - [`ASSET_MANIFEST` (required for ES Modules)](#asset_manifest-required-for-es-modules)
31
+ - [`defaultETag`](#defaultetag-optional)
32
+
33
+ * [Helper functions](#helper-functions)
34
+ - [`mapRequestToAsset`](#maprequesttoasset-1)
35
+ - [`serveSinglePageApp`](#servesinglepageapp)
36
+ * [Cache revalidation and etags](#cache-revalidation-and-etags)
37
+
38
+ ## Installation
39
+
40
+ Add this package to your `package.json` by running this in the root of your
41
+ project's directory:
42
+
43
+ ```
44
+ npm i @cloudflare/kv-asset-handler
45
+ ```
46
+
47
+ ## Usage
48
+
49
+ This package was designed to work with [Worker Sites](https://workers.cloudflare.com/sites).
50
+
51
+ ## `getAssetFromKV`
52
+
53
+ getAssetFromKV(Evt) => Promise<Response>
54
+
55
+ `getAssetFromKV` is an async function that takes an `Evt` object (containing a `Request` and a [`waitUntil`](https://developers.cloudflare.com/workers/runtime-apis/fetch-event#waituntil)) and returns a `Response` object if the request matches an asset in KV, otherwise it will throw a `KVError`.
56
+
57
+ #### Example
58
+
59
+ This example checks for the existence of a value in KV, and returns it if it's there, and returns a 404 if it is not. It also serves index.html from `/`.
60
+
61
+ ### Return
62
+
63
+ `getAssetFromKV` returns a `Promise<Response>` with `Response` being the body of the asset requested.
64
+
65
+ Known errors to be thrown are:
66
+
67
+ - MethodNotAllowedError
68
+ - NotFoundError
69
+ - InternalError
70
+
71
+ #### ES Modules
72
+
73
+ ```js
74
+ import manifestJSON from "__STATIC_CONTENT_MANIFEST";
75
+ import {
76
+ getAssetFromKV,
77
+ MethodNotAllowedError,
78
+ NotFoundError,
79
+ } from "@cloudflare/kv-asset-handler";
80
+
81
+ const assetManifest = JSON.parse(manifestJSON);
82
+
83
+ export default {
84
+ async fetch(request, env, ctx) {
85
+ if (request.url.includes("/docs")) {
86
+ try {
87
+ return await getAssetFromKV(
88
+ {
89
+ request,
90
+ waitUntil(promise) {
91
+ return ctx.waitUntil(promise);
92
+ },
93
+ },
94
+ {
95
+ ASSET_NAMESPACE: env.__STATIC_CONTENT,
96
+ ASSET_MANIFEST: assetManifest,
97
+ }
98
+ );
99
+ } catch (e) {
100
+ if (e instanceof NotFoundError) {
101
+ // ...
102
+ } else if (e instanceof MethodNotAllowedError) {
103
+ // ...
104
+ } else {
105
+ return new Response("An unexpected error occurred", { status: 500 });
106
+ }
107
+ }
108
+ } else return fetch(request);
109
+ },
110
+ };
111
+ ```
112
+
113
+ #### Service Worker
114
+
115
+ ```js
116
+ import {
117
+ getAssetFromKV,
118
+ MethodNotAllowedError,
119
+ NotFoundError,
120
+ } from "@cloudflare/kv-asset-handler";
121
+
122
+ addEventListener("fetch", (event) => {
123
+ event.respondWith(handleEvent(event));
124
+ });
125
+
126
+ async function handleEvent(event) {
127
+ if (event.request.url.includes("/docs")) {
128
+ try {
129
+ return await getAssetFromKV(event);
130
+ } catch (e) {
131
+ if (e instanceof NotFoundError) {
132
+ // ...
133
+ } else if (e instanceof MethodNotAllowedError) {
134
+ // ...
135
+ } else {
136
+ return new Response("An unexpected error occurred", { status: 500 });
137
+ }
138
+ }
139
+ } else return fetch(event.request);
140
+ }
141
+ ```
142
+
143
+ ### Optional Arguments
144
+
145
+ You can customize the behavior of `getAssetFromKV` by passing the following properties as an object into the second argument.
146
+
147
+ ```
148
+ getAssetFromKV(event, { mapRequestToAsset: ... })
149
+ ```
150
+
151
+ #### `mapRequestToAsset`
152
+
153
+ mapRequestToAsset(Request) => Request
154
+
155
+ Maps the incoming request to the value that will be looked up in Cloudflare's KV
156
+
157
+ By default, mapRequestToAsset is set to the exported function [`mapRequestToAsset`](#maprequesttoasset-1). This works for most static site generators, but you can customize this behavior by passing your own function as `mapRequestToAsset`. The function should take a `Request` object as its only argument, and return a new `Request` object with an updated path to be looked up in the asset manifest/KV.
158
+
159
+ For SPA mapping pass in the [`serveSinglePageApp`](#servesinglepageapp) function
160
+
161
+ #### Example
162
+
163
+ Strip `/docs` from any incoming request before looking up an asset in Cloudflare's KV.
164
+
165
+ ```js
166
+ import { getAssetFromKV, mapRequestToAsset } from '@cloudflare/kv-asset-handler'
167
+ ...
168
+ const customKeyModifier = request => {
169
+ let url = request.url
170
+ //custom key mapping optional
171
+ url = url.replace('/docs', '').replace(/^\/+/, '')
172
+ return mapRequestToAsset(new Request(url, request))
173
+ }
174
+ let asset = await getAssetFromKV(event, { mapRequestToAsset: customKeyModifier })
175
+ ```
176
+
177
+ #### `cacheControl`
178
+
179
+ type: object
180
+
181
+ `cacheControl` allows you to configure options for both the Cloudflare Cache accessed by your Worker, and the browser cache headers sent along with your Workers' responses. The default values are as follows:
182
+
183
+ ```javascript
184
+ let cacheControl = {
185
+ browserTTL: null, // do not set cache control ttl on responses
186
+ edgeTTL: 2 * 60 * 60 * 24, // 2 days
187
+ bypassCache: false, // do not bypass Cloudflare's cache
188
+ };
189
+ ```
190
+
191
+ ##### `browserTTL`
192
+
193
+ type: number | null
194
+ nullable: true
195
+
196
+ Sets the `Cache-Control: max-age` header on the response returned from the Worker. By default set to `null` which will not add the header at all.
197
+
198
+ ##### `edgeTTL`
199
+
200
+ type: number | null
201
+ nullable: true
202
+
203
+ Sets the `Cache-Control: max-age` header on the response used as the edge cache key. By default set to 2 days (`2 * 60 * 60 * 24`). When null will not cache on the edge at all.
204
+
205
+ ##### `bypassCache`
206
+
207
+ type: boolean
208
+
209
+ Determines whether to cache requests on Cloudflare's edge cache. By default set to `false` (recommended for production builds). Useful for development when you need to eliminate the cache's effect on testing.
210
+
211
+ #### `ASSET_NAMESPACE` (required for ES Modules)
212
+
213
+ type: KV Namespace Binding
214
+
215
+ The binding name to the KV Namespace populated with key/value entries of files for the Worker to serve. By default, Workers Sites uses a [binding to a Workers KV Namespace](https://developers.cloudflare.com/workers/reference/storage/api/#namespaces) named `__STATIC_CONTENT`.
216
+
217
+ It is further assumed that this namespace consists of static assets such as HTML, CSS, JavaScript, or image files, keyed off of a relative path that roughly matches the assumed URL pathname of the incoming request.
218
+
219
+ In ES Modules format, this argument is required, and can be gotten from `env`.
220
+
221
+ ##### ES Module
222
+
223
+ ```js
224
+ return getAssetFromKV(
225
+ {
226
+ request,
227
+ waitUntil(promise) {
228
+ return ctx.waitUntil(promise)
229
+ },
230
+ },
231
+ {
232
+ ASSET_NAMESPACE: env.__STATIC_CONTENT,
233
+ },
234
+ )
235
+ ```
236
+
237
+ ##### Service Worker
238
+
239
+ ```
240
+ return getAssetFromKV(event, { ASSET_NAMESPACE: MY_NAMESPACE })
241
+ ```
242
+
243
+ #### `ASSET_MANIFEST` (required for ES Modules)
244
+
245
+ type: text blob (JSON formatted) or object
246
+
247
+ The mapping of requested file path to the key stored on Cloudflare.
248
+
249
+ Workers Sites with Wrangler bundles up a text blob that maps request paths to content-hashed keys that are generated by Wrangler as a cache-busting measure. If this option/binding is not present, the function will fallback to using the raw pathname to look up your asset in KV. If, for whatever reason, you have rolled your own implementation of this, you can include your own by passing a stringified JSON object where the keys are expected paths, and the values are the expected keys in your KV namespace.
250
+
251
+ In ES Modules format, this argument is required, and can be imported.
252
+
253
+ ##### ES Module
254
+
255
+ ```js
256
+ import manifestJSON from '__STATIC_CONTENT_MANIFEST'
257
+ let manifest = JSON.parse(manifestJSON)
258
+ manifest['index.html'] = 'index.special.html'
259
+
260
+ return getAssetFromKV(
261
+ {
262
+ request,
263
+ waitUntil(promise) {
264
+ return ctx.waitUntil(promise)
265
+ },
266
+ },
267
+ {
268
+ ASSET_MANIFEST: manifest,
269
+ // ...
270
+ },
271
+ )
272
+ ```
273
+
274
+ ##### Service Worker
275
+
276
+ ```
277
+ let assetManifest = { "index.html": "index.special.html" }
278
+ return getAssetFromKV(event, { ASSET_MANIFEST: assetManifest })
279
+ ```
280
+
281
+ #### `defaultMimeType` (optional)
282
+
283
+ type: string
284
+
285
+ This is the mime type that will be used for files with unrecognized or missing extensions. The default value is `'text/plain'`.
286
+
287
+ If you are serving a static site and would like to use extensionless HTML files instead of index.html files, set this to `'text/html'`.
288
+
289
+ #### `defaultDocument` (optional)
290
+
291
+ type: string
292
+
293
+ This is the default document that will be concatenated for requests ends in `'/'` or without a valid mime type like `'/about'` or `'/about.me'`. The default value is `'index.html'`.
294
+
295
+ #### `defaultETag` (optional)
296
+
297
+ type: `'strong' | 'weak'`
298
+
299
+ This determines the format of the response [ETag header](https://developer.mozilla.org/docs/Web/HTTP/Headers/ETag). If the resource is in the cache, the ETag will always be weakened before being returned.
300
+ The default value is `'strong'`.
301
+
302
+ # Helper functions
303
+
304
+ ## `mapRequestToAsset`
305
+
306
+ mapRequestToAsset(Request) => Request
307
+
308
+ The default function for mapping incoming requests to keys in Cloudflare's KV.
309
+
310
+ Takes any path that ends in `/` or evaluates to an HTML file and appends `index.html` or `/index.html` for lookup in your Workers KV namespace.
311
+
312
+ ## `serveSinglePageApp`
313
+
314
+ serveSinglePageApp(Request) => Request
315
+
316
+ A custom handler for mapping requests to a single root: `index.html`. The most common use case is single-page applications - frameworks with in-app routing - such as React Router, VueJS, etc. It takes zero arguments.
317
+
318
+ ```js
319
+ import { getAssetFromKV, serveSinglePageApp } from '@cloudflare/kv-asset-handler'
320
+ ...
321
+ let asset = await getAssetFromKV(event, { mapRequestToAsset: serveSinglePageApp })
322
+ ```
323
+
324
+ # Cache revalidation and etags
325
+
326
+ All responses served from cache (including those with `cf-cache-status: MISS`) include an `etag` response header that identifies the version of the resource. The `etag` value is identical to the path key used in the `ASSET_MANIFEST`. It is updated each time an asset changes and looks like this: `etag: <filename>.<hash of file contents>.<extension>` (ex. `etag: index.54321.html`).
327
+
328
+ Resources served with an `etag` allow browsers to use the `if-none-match` request header to make conditional requests for that resource in the future. This has two major benefits:
329
+
330
+ - When a request's `if-none-match` value matches the `etag` of the resource in Cloudflare cache, Cloudflare will send a `304 Not Modified` response without a body, saving bandwidth.
331
+ - Changes to a file on the server are immediately reflected in the browser - even when the cache control directive `max-age` is unexpired.
332
+
333
+ #### Disable the `etag`
334
+
335
+ To turn `etags` **off**, you must bypass cache:
336
+
337
+ ```js
338
+ /* Turn etags off */
339
+ let cacheControl = {
340
+ bypassCache: true,
341
+ };
342
+ ```
343
+
344
+ #### Syntax and comparison context
345
+
346
+ `kv-asset-handler` sets and evaluates etags as [strong validators](https://developer.mozilla.org/en-US/docs/Web/HTTP/Conditional_requests#Strong_validation). To preserve `etag` integrity, the format of the value deviates from the [RFC2616 recommendation to enclose the `etag` with quotation marks](https://tools.ietf.org/html/rfc2616#section-3.11). This is intentional. Cloudflare cache applies the `W/` prefix to all `etags` that use quoted-strings -- a process that converts the `etag` to a "weak validator" when served to a client.
workers1/auto3d/node_modules/@cloudflare/kv-asset-handler/dist/index.d.ts ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// <reference types="@cloudflare/workers-types" />
2
+ import { CacheControl, InternalError, MethodNotAllowedError, NotFoundError, Options } from "./types";
3
+ declare global {
4
+ const __STATIC_CONTENT: KVNamespace | undefined, __STATIC_CONTENT_MANIFEST: string;
5
+ }
6
+ /**
7
+ * maps the path of incoming request to the request pathKey to look up
8
+ * in bucket and in cache
9
+ * e.g. for a path '/' returns '/index.html' which serves
10
+ * the content of bucket/index.html
11
+ * @param {Request} request incoming request
12
+ */
13
+ declare const mapRequestToAsset: (request: Request, options?: Partial<Options>) => Request;
14
+ /**
15
+ * maps the path of incoming request to /index.html if it evaluates to
16
+ * any HTML file.
17
+ * @param {Request} request incoming request
18
+ */
19
+ declare function serveSinglePageApp(request: Request, options?: Partial<Options>): Request;
20
+ /**
21
+ * takes the path of the incoming request, gathers the appropriate content from KV, and returns
22
+ * the response
23
+ *
24
+ * @param {FetchEvent} event the fetch event of the triggered request
25
+ * @param {{mapRequestToAsset: (string: Request) => Request, cacheControl: {bypassCache:boolean, edgeTTL: number, browserTTL:number}, ASSET_NAMESPACE: any, ASSET_MANIFEST:any}} [options] configurable options
26
+ * @param {CacheControl} [options.cacheControl] determine how to cache on Cloudflare and the browser
27
+ * @param {typeof(options.mapRequestToAsset)} [options.mapRequestToAsset] maps the path of incoming request to the request pathKey to look up
28
+ * @param {Object | string} [options.ASSET_NAMESPACE] the binding to the namespace that script references
29
+ * @param {any} [options.ASSET_MANIFEST] the map of the key to cache and store in KV
30
+ * */
31
+ type Evt = {
32
+ request: Request;
33
+ waitUntil: (promise: Promise<unknown>) => void;
34
+ };
35
+ declare const getAssetFromKV: (event: Evt, options?: Partial<Options>) => Promise<Response>;
36
+ export { getAssetFromKV, mapRequestToAsset, serveSinglePageApp };
37
+ export { Options, CacheControl, MethodNotAllowedError, NotFoundError, InternalError, };
workers1/auto3d/node_modules/@cloudflare/kv-asset-handler/dist/index.js ADDED
@@ -0,0 +1,298 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.InternalError = exports.NotFoundError = exports.MethodNotAllowedError = exports.serveSinglePageApp = exports.mapRequestToAsset = exports.getAssetFromKV = void 0;
27
+ const mime = __importStar(require("mime"));
28
+ const types_1 = require("./types");
29
+ Object.defineProperty(exports, "InternalError", { enumerable: true, get: function () { return types_1.InternalError; } });
30
+ Object.defineProperty(exports, "MethodNotAllowedError", { enumerable: true, get: function () { return types_1.MethodNotAllowedError; } });
31
+ Object.defineProperty(exports, "NotFoundError", { enumerable: true, get: function () { return types_1.NotFoundError; } });
32
+ const defaultCacheControl = {
33
+ browserTTL: null,
34
+ edgeTTL: 2 * 60 * 60 * 24, // 2 days
35
+ bypassCache: false, // do not bypass Cloudflare's cache
36
+ };
37
+ const parseStringAsObject = (maybeString) => typeof maybeString === "string"
38
+ ? JSON.parse(maybeString)
39
+ : maybeString;
40
+ const getAssetFromKVDefaultOptions = {
41
+ ASSET_NAMESPACE: typeof __STATIC_CONTENT !== "undefined" ? __STATIC_CONTENT : undefined,
42
+ ASSET_MANIFEST: typeof __STATIC_CONTENT_MANIFEST !== "undefined"
43
+ ? parseStringAsObject(__STATIC_CONTENT_MANIFEST)
44
+ : {},
45
+ cacheControl: defaultCacheControl,
46
+ defaultMimeType: "text/plain",
47
+ defaultDocument: "index.html",
48
+ pathIsEncoded: false,
49
+ defaultETag: "strong",
50
+ };
51
+ function assignOptions(options) {
52
+ // Assign any missing options passed in to the default
53
+ // options.mapRequestToAsset is handled manually later
54
+ return Object.assign({}, getAssetFromKVDefaultOptions, options);
55
+ }
56
+ /**
57
+ * maps the path of incoming request to the request pathKey to look up
58
+ * in bucket and in cache
59
+ * e.g. for a path '/' returns '/index.html' which serves
60
+ * the content of bucket/index.html
61
+ * @param {Request} request incoming request
62
+ */
63
+ const mapRequestToAsset = (request, options) => {
64
+ options = assignOptions(options);
65
+ const parsedUrl = new URL(request.url);
66
+ let pathname = parsedUrl.pathname;
67
+ if (pathname.endsWith("/")) {
68
+ // If path looks like a directory append options.defaultDocument
69
+ // e.g. If path is /about/ -> /about/index.html
70
+ pathname = pathname.concat(options.defaultDocument);
71
+ }
72
+ else if (!mime.getType(pathname)) {
73
+ // If path doesn't look like valid content
74
+ // e.g. /about.me -> /about.me/index.html
75
+ pathname = pathname.concat("/" + options.defaultDocument);
76
+ }
77
+ parsedUrl.pathname = pathname;
78
+ return new Request(parsedUrl.toString(), request);
79
+ };
80
+ exports.mapRequestToAsset = mapRequestToAsset;
81
+ /**
82
+ * maps the path of incoming request to /index.html if it evaluates to
83
+ * any HTML file.
84
+ * @param {Request} request incoming request
85
+ */
86
+ function serveSinglePageApp(request, options) {
87
+ options = assignOptions(options);
88
+ // First apply the default handler, which already has logic to detect
89
+ // paths that should map to HTML files.
90
+ request = mapRequestToAsset(request, options);
91
+ const parsedUrl = new URL(request.url);
92
+ // Detect if the default handler decided to map to
93
+ // a HTML file in some specific directory.
94
+ if (parsedUrl.pathname.endsWith(".html")) {
95
+ // If expected HTML file was missing, just return the root index.html (or options.defaultDocument)
96
+ return new Request(`${parsedUrl.origin}/${options.defaultDocument}`, request);
97
+ }
98
+ else {
99
+ // The default handler decided this is not an HTML page. It's probably
100
+ // an image, CSS, or JS file. Leave it as-is.
101
+ return request;
102
+ }
103
+ }
104
+ exports.serveSinglePageApp = serveSinglePageApp;
105
+ const getAssetFromKV = async (event, options) => {
106
+ options = assignOptions(options);
107
+ const request = event.request;
108
+ const ASSET_NAMESPACE = options.ASSET_NAMESPACE;
109
+ const ASSET_MANIFEST = parseStringAsObject(options.ASSET_MANIFEST);
110
+ if (typeof ASSET_NAMESPACE === "undefined") {
111
+ throw new types_1.InternalError(`there is no KV namespace bound to the script`);
112
+ }
113
+ const rawPathKey = new URL(request.url).pathname.replace(/^\/+/, ""); // strip any preceding /'s
114
+ let pathIsEncoded = options.pathIsEncoded;
115
+ let requestKey;
116
+ // if options.mapRequestToAsset is explicitly passed in, always use it and assume user has own intentions
117
+ // otherwise handle request as normal, with default mapRequestToAsset below
118
+ if (options.mapRequestToAsset) {
119
+ requestKey = options.mapRequestToAsset(request);
120
+ }
121
+ else if (ASSET_MANIFEST[rawPathKey]) {
122
+ requestKey = request;
123
+ }
124
+ else if (ASSET_MANIFEST[decodeURIComponent(rawPathKey)]) {
125
+ pathIsEncoded = true;
126
+ requestKey = request;
127
+ }
128
+ else {
129
+ const mappedRequest = mapRequestToAsset(request);
130
+ const mappedRawPathKey = new URL(mappedRequest.url).pathname.replace(/^\/+/, "");
131
+ if (ASSET_MANIFEST[decodeURIComponent(mappedRawPathKey)]) {
132
+ pathIsEncoded = true;
133
+ requestKey = mappedRequest;
134
+ }
135
+ else {
136
+ // use default mapRequestToAsset
137
+ requestKey = mapRequestToAsset(request, options);
138
+ }
139
+ }
140
+ const SUPPORTED_METHODS = ["GET", "HEAD"];
141
+ if (!SUPPORTED_METHODS.includes(requestKey.method)) {
142
+ throw new types_1.MethodNotAllowedError(`${requestKey.method} is not a valid request method`);
143
+ }
144
+ const parsedUrl = new URL(requestKey.url);
145
+ const pathname = pathIsEncoded
146
+ ? decodeURIComponent(parsedUrl.pathname)
147
+ : parsedUrl.pathname; // decode percentage encoded path only when necessary
148
+ // pathKey is the file path to look up in the manifest
149
+ let pathKey = pathname.replace(/^\/+/, ""); // remove prepended /
150
+ // @ts-expect-error we should pick cf types here
151
+ const cache = caches.default;
152
+ let mimeType = mime.getType(pathKey) || options.defaultMimeType;
153
+ if (mimeType.startsWith("text") || mimeType === "application/javascript") {
154
+ mimeType += "; charset=utf-8";
155
+ }
156
+ let shouldEdgeCache = false; // false if storing in KV by raw file path i.e. no hash
157
+ // check manifest for map from file path to hash
158
+ if (typeof ASSET_MANIFEST !== "undefined") {
159
+ if (ASSET_MANIFEST[pathKey]) {
160
+ pathKey = ASSET_MANIFEST[pathKey];
161
+ // if path key is in asset manifest, we can assume it contains a content hash and can be cached
162
+ shouldEdgeCache = true;
163
+ }
164
+ }
165
+ // TODO this excludes search params from cache, investigate ideal behavior
166
+ const cacheKey = new Request(`${parsedUrl.origin}/${pathKey}`, request);
167
+ // if argument passed in for cacheControl is a function then
168
+ // evaluate that function. otherwise return the Object passed in
169
+ // or default Object
170
+ const evalCacheOpts = (() => {
171
+ switch (typeof options.cacheControl) {
172
+ case "function":
173
+ return options.cacheControl(request);
174
+ case "object":
175
+ return options.cacheControl;
176
+ default:
177
+ return defaultCacheControl;
178
+ }
179
+ })();
180
+ // formats the etag depending on the response context. if the entityId
181
+ // is invalid, returns an empty string (instead of null) to prevent the
182
+ // the potentially disastrous scenario where the value of the Etag resp
183
+ // header is "null". Could be modified in future to base64 encode etc
184
+ const formatETag = (entityId = pathKey, validatorType = options.defaultETag) => {
185
+ if (!entityId) {
186
+ return "";
187
+ }
188
+ switch (validatorType) {
189
+ case "weak":
190
+ if (!entityId.startsWith("W/")) {
191
+ if (entityId.startsWith(`"`) && entityId.endsWith(`"`)) {
192
+ return `W/${entityId}`;
193
+ }
194
+ return `W/"${entityId}"`;
195
+ }
196
+ return entityId;
197
+ case "strong":
198
+ if (entityId.startsWith(`W/"`)) {
199
+ entityId = entityId.replace("W/", "");
200
+ }
201
+ if (!entityId.endsWith(`"`)) {
202
+ entityId = `"${entityId}"`;
203
+ }
204
+ return entityId;
205
+ default:
206
+ return "";
207
+ }
208
+ };
209
+ options.cacheControl = Object.assign({}, defaultCacheControl, evalCacheOpts);
210
+ // override shouldEdgeCache if options say to bypassCache
211
+ if (options.cacheControl.bypassCache ||
212
+ options.cacheControl.edgeTTL === null ||
213
+ request.method == "HEAD") {
214
+ shouldEdgeCache = false;
215
+ }
216
+ // only set max-age if explicitly passed in a number as an arg
217
+ const shouldSetBrowserCache = typeof options.cacheControl.browserTTL === "number";
218
+ let response = null;
219
+ if (shouldEdgeCache) {
220
+ response = await cache.match(cacheKey);
221
+ }
222
+ if (response) {
223
+ if (response.status > 300 && response.status < 400) {
224
+ if (response.body && "cancel" in Object.getPrototypeOf(response.body)) {
225
+ // Body exists and environment supports readable streams
226
+ response.body.cancel();
227
+ }
228
+ else {
229
+ // Environment doesnt support readable streams, or null repsonse body. Nothing to do
230
+ }
231
+ response = new Response(null, response);
232
+ }
233
+ else {
234
+ // fixes #165
235
+ const opts = {
236
+ headers: new Headers(response.headers),
237
+ status: 0,
238
+ statusText: "",
239
+ };
240
+ opts.headers.set("cf-cache-status", "HIT");
241
+ if (response.status) {
242
+ opts.status = response.status;
243
+ opts.statusText = response.statusText;
244
+ }
245
+ else if (opts.headers.has("Content-Range")) {
246
+ opts.status = 206;
247
+ opts.statusText = "Partial Content";
248
+ }
249
+ else {
250
+ opts.status = 200;
251
+ opts.statusText = "OK";
252
+ }
253
+ response = new Response(response.body, opts);
254
+ }
255
+ }
256
+ else {
257
+ const body = await ASSET_NAMESPACE.get(pathKey, "arrayBuffer");
258
+ if (body === null) {
259
+ throw new types_1.NotFoundError(`could not find ${pathKey} in your content namespace`);
260
+ }
261
+ response = new Response(body);
262
+ if (shouldEdgeCache) {
263
+ response.headers.set("Accept-Ranges", "bytes");
264
+ response.headers.set("Content-Length", String(body.byteLength));
265
+ // set etag before cache insertion
266
+ if (!response.headers.has("etag")) {
267
+ response.headers.set("etag", formatETag(pathKey));
268
+ }
269
+ // determine Cloudflare cache behavior
270
+ response.headers.set("Cache-Control", `max-age=${options.cacheControl.edgeTTL}`);
271
+ event.waitUntil(cache.put(cacheKey, response.clone()));
272
+ response.headers.set("CF-Cache-Status", "MISS");
273
+ }
274
+ }
275
+ response.headers.set("Content-Type", mimeType);
276
+ if (response.status === 304) {
277
+ const etag = formatETag(response.headers.get("etag"));
278
+ const ifNoneMatch = cacheKey.headers.get("if-none-match");
279
+ const proxyCacheStatus = response.headers.get("CF-Cache-Status");
280
+ if (etag) {
281
+ if (ifNoneMatch && ifNoneMatch === etag && proxyCacheStatus === "MISS") {
282
+ response.headers.set("CF-Cache-Status", "EXPIRED");
283
+ }
284
+ else {
285
+ response.headers.set("CF-Cache-Status", "REVALIDATED");
286
+ }
287
+ response.headers.set("etag", formatETag(etag, "weak"));
288
+ }
289
+ }
290
+ if (shouldSetBrowserCache) {
291
+ response.headers.set("Cache-Control", `max-age=${options.cacheControl.browserTTL}`);
292
+ }
293
+ else {
294
+ response.headers.delete("Cache-Control");
295
+ }
296
+ return response;
297
+ };
298
+ exports.getAssetFromKV = getAssetFromKV;