@valbuild/tanstack-build 0.0.1-alpha.0 → 0.136.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/CHANGELOG.md +97 -0
  2. package/constants/dist/valbuild-tanstack-build-constants.cjs.d.ts +2 -0
  3. package/constants/dist/valbuild-tanstack-build-constants.cjs.dev.js +15 -0
  4. package/constants/dist/valbuild-tanstack-build-constants.cjs.js +7 -0
  5. package/constants/dist/valbuild-tanstack-build-constants.cjs.prod.js +15 -0
  6. package/constants/dist/valbuild-tanstack-build-constants.esm.js +2 -0
  7. package/constants/package.json +4 -0
  8. package/dist/artifactKeys-3a40f3a0.esm.js +50 -0
  9. package/dist/artifactKeys-700b9044.cjs.prod.js +53 -0
  10. package/dist/artifactKeys-ad3e41fc.cjs.dev.js +53 -0
  11. package/dist/declarations/src/artifactKeys.d.ts +46 -0
  12. package/dist/declarations/src/artifacts.d.ts +72 -0
  13. package/dist/declarations/src/assets.d.ts +34 -0
  14. package/dist/declarations/src/build.d.ts +260 -0
  15. package/dist/declarations/src/buildTarget.d.ts +44 -0
  16. package/dist/declarations/src/constants/index.d.ts +19 -0
  17. package/dist/declarations/src/contract.d.ts +135 -0
  18. package/dist/declarations/src/gitTree.d.ts +20 -0
  19. package/dist/declarations/src/index.d.ts +34 -0
  20. package/dist/declarations/src/node/cssModules.d.ts +2 -0
  21. package/dist/declarations/src/node/index.d.ts +18 -0
  22. package/dist/declarations/src/node/nodeShims.d.ts +74 -0
  23. package/dist/declarations/src/node/routeSplitter.d.ts +14 -0
  24. package/dist/declarations/src/node/routes.d.ts +27 -0
  25. package/dist/declarations/src/node/vendorLayer.d.ts +175 -0
  26. package/dist/declarations/src/paths.d.ts +4 -0
  27. package/dist/declarations/src/projectPaths.d.ts +24 -0
  28. package/dist/declarations/src/routeSplit.d.ts +29 -0
  29. package/dist/declarations/src/tailwind.d.ts +59 -0
  30. package/dist/declarations/src/tsconfigPaths.d.ts +34 -0
  31. package/dist/declarations/src/wire.d.ts +113 -0
  32. package/dist/projectPaths-5e4defea.esm.js +30 -0
  33. package/dist/projectPaths-9cbecebf.cjs.prod.js +35 -0
  34. package/dist/projectPaths-f222255a.cjs.dev.js +35 -0
  35. package/dist/slicedToArray-12869836.cjs.dev.js +311 -0
  36. package/dist/slicedToArray-149a2518.cjs.prod.js +311 -0
  37. package/dist/slicedToArray-d71360f4.esm.js +303 -0
  38. package/dist/valbuild-tanstack-build.cjs.d.ts +2 -2
  39. package/dist/valbuild-tanstack-build.cjs.dev.js +3556 -0
  40. package/dist/valbuild-tanstack-build.cjs.js +6 -15
  41. package/dist/valbuild-tanstack-build.cjs.prod.js +3556 -0
  42. package/dist/valbuild-tanstack-build.esm.js +3525 -0
  43. package/node/dist/valbuild-tanstack-build-node.cjs.d.ts +2 -2
  44. package/node/dist/valbuild-tanstack-build-node.cjs.dev.js +2201 -0
  45. package/node/dist/valbuild-tanstack-build-node.cjs.js +6 -15
  46. package/node/dist/valbuild-tanstack-build-node.cjs.prod.js +2201 -0
  47. package/node/dist/valbuild-tanstack-build-node.esm.js +2162 -0
  48. package/package.json +12 -5
@@ -0,0 +1,3556 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var slicedToArray = require('./slicedToArray-149a2518.cjs.prod.js');
6
+ var browser = require('@rolldown/browser');
7
+ var projectPaths = require('./projectPaths-9cbecebf.cjs.prod.js');
8
+ var parseAst = require('@rolldown/browser/parseAst');
9
+ var tailwindcss = require('tailwindcss');
10
+ var artifactKeys = require('./artifactKeys-700b9044.cjs.prod.js');
11
+
12
+ // A minimal posix path resolver. The builder runs in the browser, so node:path
13
+ // is unavailable, and pulling a polyfill in for two functions is not worth it.
14
+
15
+ function dirname(path) {
16
+ var i = path.lastIndexOf("/");
17
+ return i <= 0 ? "" : path.slice(0, i);
18
+ }
19
+ function resolve(from, to) {
20
+ var segments = to.startsWith("/") ? [] : from.split("/").filter(Boolean);
21
+ var _iterator = slicedToArray._createForOfIteratorHelper(to.split("/")),
22
+ _step;
23
+ try {
24
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
25
+ var segment = _step.value;
26
+ if (segment === "" || segment === ".") continue;
27
+ if (segment === "..") segments.pop();else segments.push(segment);
28
+ }
29
+ } catch (err) {
30
+ _iterator.e(err);
31
+ } finally {
32
+ _iterator.f();
33
+ }
34
+ return segments.join("/");
35
+ }
36
+ var EXTENSIONS = ["", ".tsx", ".ts", ".jsx", ".js", "/index.tsx", "/index.ts"];
37
+
38
+ /** Resolve a relative import against the in-memory file set. */
39
+ function resolveInFiles(base, files) {
40
+ var _iterator2 = slicedToArray._createForOfIteratorHelper(EXTENSIONS),
41
+ _step2;
42
+ try {
43
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
44
+ var extension = _step2.value;
45
+ var candidate = base + extension;
46
+ if (candidate in files) return candidate;
47
+ }
48
+ } catch (err) {
49
+ _iterator2.e(err);
50
+ } finally {
51
+ _iterator2.f();
52
+ }
53
+ return null;
54
+ }
55
+
56
+ var langOf = function langOf(path) {
57
+ return path.endsWith(".tsx") || path.endsWith(".jsx") ? "tsx" : "ts";
58
+ };
59
+ function parse(_x, _x2) {
60
+ return _parse.apply(this, arguments);
61
+ }
62
+
63
+ /** Depth-first walk carrying a parent stack, nearest parent last. */
64
+ function _parse() {
65
+ _parse = slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function _callee(path, code) {
66
+ return slicedToArray._regenerator().w(function (_context) {
67
+ while (1) switch (_context.n) {
68
+ case 0:
69
+ _context.n = 1;
70
+ return parseAst.parseAstAsync(code, {
71
+ lang: langOf(path)
72
+ }, path);
73
+ case 1:
74
+ return _context.a(2, _context.v);
75
+ }
76
+ }, _callee);
77
+ }));
78
+ return _parse.apply(this, arguments);
79
+ }
80
+ function walk(node, visit) {
81
+ var stack = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
82
+ if (!node || typeof node.type !== "string") return;
83
+ visit(node, stack);
84
+ stack.push(node);
85
+ for (var _i = 0, _Object$keys = Object.keys(node); _i < _Object$keys.length; _i++) {
86
+ var _key = _Object$keys[_i];
87
+ if (_key === "type" || _key === "start" || _key === "end") continue;
88
+ var value = node[_key];
89
+ if (Array.isArray(value)) {
90
+ var _iterator = slicedToArray._createForOfIteratorHelper(value),
91
+ _step;
92
+ try {
93
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
94
+ var item = _step.value;
95
+ if (item && typeof item.type === "string") walk(item, visit, stack);
96
+ }
97
+ } catch (err) {
98
+ _iterator.e(err);
99
+ } finally {
100
+ _iterator.f();
101
+ }
102
+ } else if (value && typeof value.type === "string") {
103
+ walk(value, visit, stack);
104
+ }
105
+ }
106
+ stack.pop();
107
+ }
108
+
109
+ /** Applies edits end-first, so earlier offsets stay valid. */
110
+ function applyEdits(code, edits) {
111
+ var ordered = slicedToArray._toConsumableArray(edits).sort(function (a, b) {
112
+ return b.start - a.start || b.end - a.end;
113
+ });
114
+ var out = code;
115
+ var _iterator2 = slicedToArray._createForOfIteratorHelper(ordered),
116
+ _step2;
117
+ try {
118
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
119
+ var edit = _step2.value;
120
+ out = out.slice(0, edit.start) + edit.text + out.slice(edit.end);
121
+ }
122
+ } catch (err) {
123
+ _iterator2.e(err);
124
+ } finally {
125
+ _iterator2.f();
126
+ }
127
+ return out;
128
+ }
129
+
130
+ /**
131
+ * Local names imported from a TanStack package.
132
+ *
133
+ * The transforms key on names like `createIsomorphicFn`, and keying on the name
134
+ * alone would rewrite an unrelated local function that happens to share it.
135
+ * Start's compiler tracks imports for the same reason.
136
+ */
137
+ function tanstackImports(ast) {
138
+ var names = new Set();
139
+ for (var _i2 = 0, _arr = ast.body; _i2 < _arr.length; _i2++) {
140
+ var _value, _statement$source;
141
+ var statement = _arr[_i2];
142
+ if (statement.type !== "ImportDeclaration") continue;
143
+ var source = String((_value = (_statement$source = statement.source) === null || _statement$source === void 0 ? void 0 : _statement$source.value) !== null && _value !== void 0 ? _value : "");
144
+ if (!source.startsWith("@tanstack/")) continue;
145
+ for (var _i3 = 0, _arr2 = (_statement$specifiers = statement.specifiers) !== null && _statement$specifiers !== void 0 ? _statement$specifiers : []; _i3 < _arr2.length; _i3++) {
146
+ var _statement$specifiers, _specifier$local;
147
+ var specifier = _arr2[_i3];
148
+ var local = (_specifier$local = specifier.local) === null || _specifier$local === void 0 ? void 0 : _specifier$local.name;
149
+ if (local) names.add(String(local));
150
+ }
151
+ }
152
+ return names;
153
+ }
154
+
155
+ /** Virtual module holding the per-build server-function registry. */
156
+ var REGISTRY_ID = "\0platform:server-fns";
157
+
158
+ /**
159
+ * Populated as each defining module evaluates, read at request time.
160
+ *
161
+ * A mutable module-scoped object rather than something assembled in the entry,
162
+ * because a server function can be declared in any file. Ordering is not a
163
+ * concern: the whole user app is a single chunk (asserted in buildUserApp), so
164
+ * every module has evaluated long before a request arrives.
165
+ */
166
+ var REGISTRY_SOURCE = "\nexport const __serverFns = {}\nexport function __register(id, fn) { __serverFns[id] = fn }\n";
167
+
168
+ /** Re-exported from the entry so the shell can reach it across the boundary. */
169
+ /** Cheap pre-filter for "does this module define a server function". */
170
+ var hasServerFn = function hasServerFn(code) {
171
+ return code.includes("createServerFn");
172
+ };
173
+
174
+ /**
175
+ * The entry for the RSC build.
176
+ *
177
+ * NOT the app. Under Start's RSC mode the `rsc` environment is the
178
+ * *server-function provider* -- `createStartHandler` forwards every server
179
+ * function call to it -- and that is the only job the bundle has here, because
180
+ * `renderServerComponent` is not supported yet.
181
+ *
182
+ * Building the app entry instead compiles the whole route tree under the
183
+ * `react-server` condition, where React has no hooks and no `createContext`.
184
+ * That works for a fixture with two components and fails for anything with a
185
+ * router in it: the first symptom is `createContext is not a function`, thrown
186
+ * from inside a vendor chunk, on the first server-function call.
187
+ *
188
+ * So the entry imports only the modules that register server functions. Each
189
+ * one registers itself as a side effect (see the transform below), and whatever
190
+ * they pull in comes with them -- including client components, which are
191
+ * replaced by reference stubs before this build sees them.
192
+ */
193
+ function rscEntrySource(files) {
194
+ var modules = Object.keys(files).filter(function (path) {
195
+ return /\.(tsx?|jsx?)$/.test(path) && hasServerFn(files[path]);
196
+ }).sort();
197
+ return modules.map(function (path) {
198
+ return "import ".concat(JSON.stringify("./".concat(path)), "\n");
199
+ }).join("") + REGISTRY_REEXPORT;
200
+ }
201
+ var REGISTRY_REEXPORT = "\nexport { __serverFns } from ".concat(JSON.stringify(REGISTRY_ID), "\n");
202
+ var SERVER_RPC = "@tanstack/react-start/server-rpc";
203
+ var CLIENT_RPC = "@tanstack/react-start/client-rpc";
204
+ /**
205
+ * Ids must be identical across the two passes, since one produces the registry
206
+ * key and the other the URL that looks it up. Derived from the module id and
207
+ * the variable name, both of which are pass-independent.
208
+ *
209
+ * Readable rather than hashed, which is a deliberate spike choice: it makes a
210
+ * failed lookup self-explanatory. It also puts source paths in a public URL,
211
+ * so a real implementation should hash this -- the only property the rest of
212
+ * the system depends on is determinism.
213
+ */
214
+ function makeId(moduleId, variableName, seen) {
215
+ var base = "".concat(moduleId, "--").concat(variableName).replace(/[^A-Za-z0-9_$]+/g, "_").replace(/^_+/, "");
216
+ var id = base;
217
+ var n = 1;
218
+ while (seen.has(id)) id = "".concat(base, "_").concat(++n);
219
+ seen.add(id);
220
+ return id;
221
+ }
222
+
223
+ /**
224
+ * True for `createServerFn(...)` and any chain built on it --
225
+ * `.validator(...)`, `.middleware([...])` and so on.
226
+ */
227
+ function isCreateServerFnChain(node) {
228
+ var current = node;
229
+ while (current && current.type === "CallExpression") {
230
+ var callee = current.callee;
231
+ if ((callee === null || callee === void 0 ? void 0 : callee.type) === "Identifier" && callee.name === "createServerFn") return true;
232
+ if ((callee === null || callee === void 0 ? void 0 : callee.type) === "MemberExpression") {
233
+ current = callee.object;
234
+ continue;
235
+ }
236
+ return false;
237
+ }
238
+ return false;
239
+ }
240
+ function findSites(ast, moduleId, code, seen) {
241
+ var sites = [];
242
+ var names = new Set();
243
+ walk(ast, function (node, stack) {
244
+ var _callee$property, _node$arguments, _declarator$id;
245
+ if (node.type !== "CallExpression") return;
246
+ var callee = node.callee;
247
+ if ((callee === null || callee === void 0 ? void 0 : callee.type) !== "MemberExpression") return;
248
+ if (((_callee$property = callee.property) === null || _callee$property === void 0 ? void 0 : _callee$property.name) !== "handler") return;
249
+ if (!isCreateServerFnChain(callee.object)) return;
250
+ var arg = (_node$arguments = node.arguments) === null || _node$arguments === void 0 ? void 0 : _node$arguments[0];
251
+ if (!arg) {
252
+ throw new Error("".concat(moduleId, ": createServerFn().handler() must be called with a function."));
253
+ }
254
+
255
+ // The extracted function has to reference the variable to reach
256
+ // __executeServer, so an unassigned call has nothing to hang off. Start
257
+ // enforces the same rule, with the same reasoning.
258
+ var declarator = slicedToArray._toConsumableArray(stack).reverse().find(function (parent) {
259
+ return parent.type === "VariableDeclarator";
260
+ });
261
+ var declarationIndex = stack.map(function (parent) {
262
+ return parent.type;
263
+ }).lastIndexOf("VariableDeclaration");
264
+ if (!declarator || declarationIndex === -1 || ((_declarator$id = declarator.id) === null || _declarator$id === void 0 ? void 0 : _declarator$id.type) !== "Identifier") {
265
+ throw new Error("".concat(moduleId, ": createServerFn() must be assigned to a plain `const` variable ") + "(found ".concat(declarator ? "a destructuring pattern" : "an unassigned call", ")."));
266
+ }
267
+
268
+ // `export const greet = ...` is an ExportNamedDeclaration *wrapping* the
269
+ // VariableDeclaration, so the declaration's own start is after the `export`
270
+ // keyword. Inserting there would put the extracted const between `export`
271
+ // and `const` -- which parses fine, exports the wrong binding, and shows up
272
+ // as "greet is not exported by src/api.ts" two modules away.
273
+ var parent = stack[declarationIndex - 1];
274
+ var statement = (parent === null || parent === void 0 ? void 0 : parent.type) === "ExportNamedDeclaration" ? parent : stack[declarationIndex];
275
+ var variableName = declarator.id.name;
276
+ var handlerName = "".concat(variableName, "_createServerFn_handler");
277
+ while (names.has(handlerName)) handlerName += "_";
278
+ names.add(handlerName);
279
+ sites.push({
280
+ id: makeId(moduleId, variableName, seen),
281
+ variableName: variableName,
282
+ handlerName: handlerName,
283
+ argStart: arg.start,
284
+ argEnd: arg.end,
285
+ declStart: statement.start,
286
+ declEnd: statement.end
287
+ });
288
+ });
289
+ return sites;
290
+ }
291
+ /**
292
+ * Rewrites one module for one target. Returns `null` when the module declares
293
+ * no server functions, so the caller can leave it untouched.
294
+ */
295
+ function transformServerFns(_x, _x2, _x3, _x4) {
296
+ return _transformServerFns.apply(this, arguments);
297
+ }
298
+ function _transformServerFns() {
299
+ _transformServerFns = slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function _callee(moduleId, code, target, seen) {
300
+ var ast, sites, edits, _iterator, _step, site, meta, out, prelude;
301
+ return slicedToArray._regenerator().w(function (_context) {
302
+ while (1) switch (_context.n) {
303
+ case 0:
304
+ if (code.includes("createServerFn")) {
305
+ _context.n = 1;
306
+ break;
307
+ }
308
+ return _context.a(2, null);
309
+ case 1:
310
+ _context.n = 2;
311
+ return parse(moduleId, code);
312
+ case 2:
313
+ ast = _context.v;
314
+ sites = findSites(ast, moduleId, code, seen);
315
+ if (!(sites.length === 0)) {
316
+ _context.n = 3;
317
+ break;
318
+ }
319
+ return _context.a(2, null);
320
+ case 3:
321
+ edits = [];
322
+ _iterator = slicedToArray._createForOfIteratorHelper(sites);
323
+ try {
324
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
325
+ site = _step.value;
326
+ if (target === "server") {
327
+ meta = JSON.stringify({
328
+ id: site.id,
329
+ name: site.variableName,
330
+ filename: moduleId
331
+ });
332
+ edits.push({
333
+ start: site.declStart,
334
+ end: site.declStart,
335
+ text: "const ".concat(site.handlerName, " = __platformServerRpc(").concat(meta, ", ") + "(opts) => ".concat(site.variableName, ".__executeServer(opts));\n")
336
+ });
337
+ // Keep the implementation, and pass the extracted fn alongside it.
338
+ edits.push({
339
+ start: site.argStart,
340
+ end: site.argStart,
341
+ text: "".concat(site.handlerName, ", ")
342
+ });
343
+ edits.push({
344
+ start: site.declEnd,
345
+ end: site.declEnd,
346
+ text: "\n__platformRegister(".concat(JSON.stringify(site.id), ", ").concat(site.handlerName, ");")
347
+ });
348
+ } else {
349
+ // Drop the implementation entirely. Whatever it referenced and nothing
350
+ // else does goes with it when rolldown shakes the graph.
351
+ edits.push({
352
+ start: site.argStart,
353
+ end: site.argEnd,
354
+ text: "__platformClientRpc(".concat(JSON.stringify(site.id), ")")
355
+ });
356
+ }
357
+ }
358
+ } catch (err) {
359
+ _iterator.e(err);
360
+ } finally {
361
+ _iterator.f();
362
+ }
363
+ out = applyEdits(code, edits);
364
+ prelude = target === "server" ? "import { createServerRpc as __platformServerRpc } from ".concat(JSON.stringify(SERVER_RPC), ";\n") + "import { __register as __platformRegister } from ".concat(JSON.stringify(REGISTRY_ID), ";\n") : "import { createClientRpc as __platformClientRpc } from ".concat(JSON.stringify(CLIENT_RPC), ";\n");
365
+ return _context.a(2, {
366
+ code: prelude + out,
367
+ ids: sites.map(function (site) {
368
+ return site.id;
369
+ })
370
+ });
371
+ }
372
+ }, _callee);
373
+ }));
374
+ return _transformServerFns.apply(this, arguments);
375
+ }
376
+
377
+ // One sha256, used by the build hash and by asset content-addressing.
378
+ //
379
+ // `crypto.subtle` rather than node:crypto: the builder runs in a browser tab as
380
+ // well as in Node, and this is the only digest available in both.
381
+ function sha256Hex(_x) {
382
+ return _sha256Hex.apply(this, arguments);
383
+ }
384
+ function _sha256Hex() {
385
+ _sha256Hex = slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function _callee(text) {
386
+ var digest;
387
+ return slicedToArray._regenerator().w(function (_context) {
388
+ while (1) switch (_context.n) {
389
+ case 0:
390
+ _context.n = 1;
391
+ return crypto.subtle.digest("SHA-256", new TextEncoder().encode(text));
392
+ case 1:
393
+ digest = _context.v;
394
+ return _context.a(2, slicedToArray._toConsumableArray(new Uint8Array(digest)).map(function (_byte) {
395
+ return _byte.toString(16).padStart(2, "0");
396
+ }).join(""));
397
+ }
398
+ }, _callee);
399
+ }));
400
+ return _sha256Hex.apply(this, arguments);
401
+ }
402
+
403
+ var isCssModule = function isCssModule(path) {
404
+ return /\.module\.css$/.test(path.split("?")[0]);
405
+ };
406
+
407
+ /**
408
+ * Class selectors in a stylesheet.
409
+ *
410
+ * `.foo`, `.foo:hover`, `.a .b`, `.foo.bar` -- but not `.5rem` (a number), and
411
+ * not a class inside an at-rule prelude like `@media`.
412
+ */
413
+ var CLASS_SELECTOR = /\.(-?[A-Za-z_][\w-]*)/g;
414
+
415
+ /** Directives this cannot honour, so they are reported instead of mis-scoped. */
416
+ var UNSUPPORTED$1 = [[/:global\b/, ":global() is not supported; the class would be scoped anyway"], [/^\s*composes\s*:/m, "composes: is not supported; the composed class is not merged"]];
417
+ /**
418
+ * Strips comments before scanning.
419
+ *
420
+ * A commented-out rule must not contribute a name to the mapping, and a comment
421
+ * is the one place a `.thing` reliably appears without being a selector.
422
+ */
423
+ var withoutComments = function withoutComments(css) {
424
+ return css.replace(/\/\*[\s\S]*?\*\//g, "");
425
+ };
426
+
427
+ /**
428
+ * Rewrites one CSS module.
429
+ *
430
+ * The suffix comes from the file's path rather than its contents: the same
431
+ * module imported from two places must produce one set of names, and a
432
+ * content hash would also change every emitted class name on every edit.
433
+ */
434
+ function transformCssModule(_x, _x2) {
435
+ return _transformCssModule.apply(this, arguments);
436
+ }
437
+
438
+ /** The JS module a CSS-module import becomes. */
439
+ function _transformCssModule() {
440
+ _transformCssModule = slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function _callee(path, css) {
441
+ var suffix, warnings, _iterator, _step, _step$value, pattern, message, names, scoped;
442
+ return slicedToArray._regenerator().w(function (_context) {
443
+ while (1) switch (_context.n) {
444
+ case 0:
445
+ _context.n = 1;
446
+ return sha256Hex(path);
447
+ case 1:
448
+ suffix = _context.v.slice(0, 8);
449
+ warnings = [];
450
+ _iterator = slicedToArray._createForOfIteratorHelper(UNSUPPORTED$1);
451
+ try {
452
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
453
+ _step$value = slicedToArray._slicedToArray(_step.value, 2), pattern = _step$value[0], message = _step$value[1];
454
+ if (pattern.test(css)) warnings.push("".concat(path, ": ").concat(message, "."));
455
+ }
456
+ } catch (err) {
457
+ _iterator.e(err);
458
+ } finally {
459
+ _iterator.f();
460
+ }
461
+ names = {};
462
+ scoped = withoutComments(css).replace(CLASS_SELECTOR, function (match, name) {
463
+ // A decimal like `.5rem` never reaches here -- the pattern requires a
464
+ // letter or underscore first -- but a property value like `1.5em` would
465
+ // match `.5em` without that guard, which is why it is there.
466
+ names[name] = "".concat(name, "_").concat(suffix);
467
+ return ".".concat(names[name]);
468
+ });
469
+ return _context.a(2, {
470
+ css: scoped,
471
+ names: names,
472
+ warnings: warnings
473
+ });
474
+ }
475
+ }, _callee);
476
+ }));
477
+ return _transformCssModule.apply(this, arguments);
478
+ }
479
+ var cssModuleExports = function cssModuleExports(names) {
480
+ return "export default ".concat(JSON.stringify(names, null, 2), "\n");
481
+ };
482
+
483
+ var CSS_EXTENSIONS = [".css"];
484
+
485
+ /**
486
+ * Vite query suffixes. `./styles.css?url` asks for the URL rather than the
487
+ * contents, but it still means "this stylesheet belongs to the page" -- so the
488
+ * CSS pass has to see through the query, or a project that links its own
489
+ * stylesheet gets an empty one.
490
+ */
491
+ var withoutQuery = function withoutQuery(path) {
492
+ return path.split("?")[0];
493
+ };
494
+ var isCss = function isCss(path) {
495
+ return CSS_EXTENSIONS.some(function (ext) {
496
+ return withoutQuery(path).endsWith(ext);
497
+ });
498
+ };
499
+ /** Import sources of one module, in the order they appear in the source. */
500
+ function importsOf(_x, _x2) {
501
+ return _importsOf.apply(this, arguments);
502
+ }
503
+ function _importsOf() {
504
+ _importsOf = slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function _callee(path, code) {
505
+ var lang, ast, sources, _iterator, _step, statement, source;
506
+ return slicedToArray._regenerator().w(function (_context) {
507
+ while (1) switch (_context.n) {
508
+ case 0:
509
+ lang = path.endsWith(".tsx") || path.endsWith(".jsx") ? "tsx" : "ts";
510
+ _context.n = 1;
511
+ return parseAst.parseAstAsync(code, {
512
+ lang: lang
513
+ }, path);
514
+ case 1:
515
+ ast = _context.v;
516
+ sources = [];
517
+ _iterator = slicedToArray._createForOfIteratorHelper(ast.body);
518
+ try {
519
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
520
+ statement = _step.value;
521
+ // Static imports and re-exports both pull a module into the graph, and
522
+ // both can be the thing that drags a stylesheet in.
523
+ if (statement.type === "ImportDeclaration" || statement.type === "ExportNamedDeclaration" || statement.type === "ExportAllDeclaration") {
524
+ source = statement.source; // A type-only import contributes nothing at runtime, so it contributes
525
+ // no stylesheet either.
526
+ if (source !== null && source !== void 0 && source.value && statement.importKind !== "type" && statement.exportKind !== "type") {
527
+ sources.push(String(source.value));
528
+ }
529
+ }
530
+ }
531
+ } catch (err) {
532
+ _iterator.e(err);
533
+ } finally {
534
+ _iterator.f();
535
+ }
536
+ return _context.a(2, sources);
537
+ }
538
+ }, _callee);
539
+ }));
540
+ return _importsOf.apply(this, arguments);
541
+ }
542
+ /**
543
+ * Walks the module graph from the entry and concatenates every stylesheet it
544
+ * reaches, dependencies first.
545
+ *
546
+ * Only the user's own files are traversed: a bare specifier is a vendor
547
+ * external, and vendor chunks carry no CSS (the vendor build has no CSS
548
+ * pipeline either). A project that depends on a package shipping its own
549
+ * stylesheet is therefore not covered -- see the README.
550
+ */
551
+ function collectCss(_x3, _x4) {
552
+ return _collectCss.apply(this, arguments);
553
+ }
554
+ function _collectCss() {
555
+ _collectCss = slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function _callee3(files, entry) {
556
+ var dependencyCss,
557
+ aliases,
558
+ visited,
559
+ sheets,
560
+ contributing,
561
+ modules,
562
+ warnings,
563
+ walk,
564
+ _walk,
565
+ _args3 = arguments;
566
+ return slicedToArray._regenerator().w(function (_context3) {
567
+ while (1) switch (_context3.n) {
568
+ case 0:
569
+ _walk = function _walk3() {
570
+ _walk = slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function _callee2(path) {
571
+ var _files$bare, bare, text, scoped, code, _iterator2, _step2, source, _aliases$candidates, _bare, aliased, _iterator3, _step3, candidate, hit, resolved, _t, _t2, _t3;
572
+ return slicedToArray._regenerator().w(function (_context2) {
573
+ while (1) switch (_context2.p = _context2.n) {
574
+ case 0:
575
+ if (!visited.has(path)) {
576
+ _context2.n = 1;
577
+ break;
578
+ }
579
+ return _context2.a(2);
580
+ case 1:
581
+ visited.add(path);
582
+ if (!isCss(path)) {
583
+ _context2.n = 5;
584
+ break;
585
+ }
586
+ bare = withoutQuery(path);
587
+ text = (_files$bare = files[bare]) !== null && _files$bare !== void 0 ? _files$bare : "";
588
+ if (!isCssModule(bare)) {
589
+ _context2.n = 3;
590
+ break;
591
+ }
592
+ _context2.n = 2;
593
+ return transformCssModule(bare, text);
594
+ case 2:
595
+ scoped = _context2.v;
596
+ modules[bare] = scoped.names;
597
+ warnings.push.apply(warnings, slicedToArray._toConsumableArray(scoped.warnings));
598
+ sheets.push(scoped.css);
599
+ _context2.n = 4;
600
+ break;
601
+ case 3:
602
+ sheets.push(text);
603
+ case 4:
604
+ contributing.push(bare);
605
+ return _context2.a(2);
606
+ case 5:
607
+ code = files[path];
608
+ if (!(code == null)) {
609
+ _context2.n = 6;
610
+ break;
611
+ }
612
+ return _context2.a(2);
613
+ case 6:
614
+ if (!(!code.includes("import") && !code.includes("export"))) {
615
+ _context2.n = 7;
616
+ break;
617
+ }
618
+ return _context2.a(2);
619
+ case 7:
620
+ _t = slicedToArray._createForOfIteratorHelper;
621
+ _context2.n = 8;
622
+ return importsOf(path, code);
623
+ case 8:
624
+ _iterator2 = _t(_context2.v);
625
+ _context2.p = 9;
626
+ _iterator2.s();
627
+ case 10:
628
+ if ((_step2 = _iterator2.n()).done) {
629
+ _context2.n = 22;
630
+ break;
631
+ }
632
+ source = _step2.value;
633
+ if (source.startsWith(".")) {
634
+ _context2.n = 20;
635
+ break;
636
+ }
637
+ // A bare specifier is a vendor external -- unless it names a
638
+ // stylesheet the layer carried across, in which case it contributes
639
+ // here just like one of the project's own.
640
+ _bare = withoutQuery(source);
641
+ if (!(isCss(_bare) && _bare in dependencyCss && !visited.has(_bare))) {
642
+ _context2.n = 11;
643
+ break;
644
+ }
645
+ visited.add(_bare);
646
+ sheets.push(dependencyCss[_bare]);
647
+ contributing.push(_bare);
648
+ return _context2.a(3, 21);
649
+ case 11:
650
+ // ...or a tsconfig alias, which is a bare specifier that names one of
651
+ // the project's own files.
652
+ aliased = [].concat(slicedToArray._toConsumableArray((_aliases$candidates = aliases === null || aliases === void 0 ? void 0 : aliases.candidates(_bare)) !== null && _aliases$candidates !== void 0 ? _aliases$candidates : []), slicedToArray._toConsumableArray(aliases !== null && aliases !== void 0 && aliases.baseUrlCandidate(_bare) ? [aliases.baseUrlCandidate(_bare)] : []));
653
+ _iterator3 = slicedToArray._createForOfIteratorHelper(aliased);
654
+ _context2.p = 12;
655
+ _iterator3.s();
656
+ case 13:
657
+ if ((_step3 = _iterator3.n()).done) {
658
+ _context2.n = 16;
659
+ break;
660
+ }
661
+ candidate = _step3.value;
662
+ hit = resolveInFiles(candidate, files);
663
+ if (!hit) {
664
+ _context2.n = 15;
665
+ break;
666
+ }
667
+ _context2.n = 14;
668
+ return walk(hit);
669
+ case 14:
670
+ return _context2.a(3, 16);
671
+ case 15:
672
+ _context2.n = 13;
673
+ break;
674
+ case 16:
675
+ _context2.n = 18;
676
+ break;
677
+ case 17:
678
+ _context2.p = 17;
679
+ _t2 = _context2.v;
680
+ _iterator3.e(_t2);
681
+ case 18:
682
+ _context2.p = 18;
683
+ _iterator3.f();
684
+ return _context2.f(18);
685
+ case 19:
686
+ return _context2.a(3, 21);
687
+ case 20:
688
+ // A `?url` import of a stylesheet still contributes it; see withoutQuery.
689
+ resolved = resolveInFiles(resolve(dirname(path), withoutQuery(source)), files);
690
+ if (!resolved) {
691
+ _context2.n = 21;
692
+ break;
693
+ }
694
+ _context2.n = 21;
695
+ return walk(resolved);
696
+ case 21:
697
+ _context2.n = 10;
698
+ break;
699
+ case 22:
700
+ _context2.n = 24;
701
+ break;
702
+ case 23:
703
+ _context2.p = 23;
704
+ _t3 = _context2.v;
705
+ _iterator2.e(_t3);
706
+ case 24:
707
+ _context2.p = 24;
708
+ _iterator2.f();
709
+ return _context2.f(24);
710
+ case 25:
711
+ return _context2.a(2);
712
+ }
713
+ }, _callee2, null, [[12, 17, 18, 19], [9, 23, 24, 25]]);
714
+ }));
715
+ return _walk.apply(this, arguments);
716
+ };
717
+ walk = function _walk2(_x5) {
718
+ return _walk.apply(this, arguments);
719
+ };
720
+ dependencyCss = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : {};
721
+ aliases = _args3.length > 3 && _args3[3] !== undefined ? _args3[3] : null;
722
+ visited = new Set();
723
+ sheets = [];
724
+ contributing = [];
725
+ modules = {};
726
+ warnings = [];
727
+ _context3.n = 1;
728
+ return walk(entry);
729
+ case 1:
730
+ return _context3.a(2, {
731
+ // A trailing newline per sheet so concatenated files cannot run together
732
+ // when the last rule has no terminator.
733
+ code: sheets.map(function (sheet) {
734
+ return sheet.trim();
735
+ }).filter(Boolean).join("\n"),
736
+ files: contributing,
737
+ modules: modules,
738
+ warnings: warnings
739
+ });
740
+ }
741
+ }, _callee3);
742
+ }));
743
+ return _collectCss.apply(this, arguments);
744
+ }
745
+
746
+ // GENERATED by packages/tanstack-build/scripts/tailwindSources.ts -- do not edit.
747
+ var TAILWIND_SOURCES = {
748
+ index: '@layer theme, base, components, utilities;\n\n@layer theme {\n @theme default {\n --font-sans:\n -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",\n "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",\n "Segoe UI Symbol", "Noto Color Emoji";\n --font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;\n --font-mono:\n ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",\n "Courier New", monospace;\n\n --color-red-50: oklch(97.1% 0.013 17.38);\n --color-red-100: oklch(93.6% 0.032 17.717);\n --color-red-200: oklch(88.5% 0.062 18.334);\n --color-red-300: oklch(80.8% 0.114 19.571);\n --color-red-400: oklch(70.4% 0.191 22.216);\n --color-red-500: oklch(63.7% 0.237 25.331);\n --color-red-600: oklch(57.7% 0.245 27.325);\n --color-red-700: oklch(50.5% 0.213 27.518);\n --color-red-800: oklch(44.4% 0.177 26.899);\n --color-red-900: oklch(39.6% 0.141 25.723);\n --color-red-950: oklch(25.8% 0.092 26.042);\n\n --color-orange-50: oklch(98% 0.016 73.684);\n --color-orange-100: oklch(95.4% 0.038 75.164);\n --color-orange-200: oklch(90.1% 0.076 70.697);\n --color-orange-300: oklch(83.7% 0.128 66.29);\n --color-orange-400: oklch(75% 0.183 55.934);\n --color-orange-500: oklch(70.5% 0.213 47.604);\n --color-orange-600: oklch(64.6% 0.222 41.116);\n --color-orange-700: oklch(55.3% 0.195 38.402);\n --color-orange-800: oklch(47% 0.157 37.304);\n --color-orange-900: oklch(40.8% 0.123 38.172);\n --color-orange-950: oklch(26.6% 0.079 36.259);\n\n --color-amber-50: oklch(98.7% 0.022 95.277);\n --color-amber-100: oklch(96.2% 0.059 95.617);\n --color-amber-200: oklch(92.4% 0.12 95.746);\n --color-amber-300: oklch(87.9% 0.169 91.605);\n --color-amber-400: oklch(82.8% 0.189 84.429);\n --color-amber-500: oklch(76.9% 0.188 70.08);\n --color-amber-600: oklch(66.6% 0.179 58.318);\n --color-amber-700: oklch(55.5% 0.163 48.998);\n --color-amber-800: oklch(47.3% 0.137 46.201);\n --color-amber-900: oklch(41.4% 0.112 45.904);\n --color-amber-950: oklch(27.9% 0.077 45.635);\n\n --color-yellow-50: oklch(98.7% 0.026 102.212);\n --color-yellow-100: oklch(97.3% 0.071 103.193);\n --color-yellow-200: oklch(94.5% 0.129 101.54);\n --color-yellow-300: oklch(90.5% 0.182 98.111);\n --color-yellow-400: oklch(85.2% 0.199 91.936);\n --color-yellow-500: oklch(79.5% 0.184 86.047);\n --color-yellow-600: oklch(68.1% 0.162 75.834);\n --color-yellow-700: oklch(55.4% 0.135 66.442);\n --color-yellow-800: oklch(47.6% 0.114 61.907);\n --color-yellow-900: oklch(42.1% 0.095 57.708);\n --color-yellow-950: oklch(28.6% 0.066 53.813);\n\n --color-lime-50: oklch(98.6% 0.031 120.757);\n --color-lime-100: oklch(96.7% 0.067 122.328);\n --color-lime-200: oklch(93.8% 0.127 124.321);\n --color-lime-300: oklch(89.7% 0.196 126.665);\n --color-lime-400: oklch(84.1% 0.238 128.85);\n --color-lime-500: oklch(76.8% 0.233 130.85);\n --color-lime-600: oklch(64.8% 0.2 131.684);\n --color-lime-700: oklch(53.2% 0.157 131.589);\n --color-lime-800: oklch(45.3% 0.124 130.933);\n --color-lime-900: oklch(40.5% 0.101 131.063);\n --color-lime-950: oklch(27.4% 0.072 132.109);\n\n --color-green-50: oklch(98.2% 0.018 155.826);\n --color-green-100: oklch(96.2% 0.044 156.743);\n --color-green-200: oklch(92.5% 0.084 155.995);\n --color-green-300: oklch(87.1% 0.15 154.449);\n --color-green-400: oklch(79.2% 0.209 151.711);\n --color-green-500: oklch(72.3% 0.219 149.579);\n --color-green-600: oklch(62.7% 0.194 149.214);\n --color-green-700: oklch(52.7% 0.154 150.069);\n --color-green-800: oklch(44.8% 0.119 151.328);\n --color-green-900: oklch(39.3% 0.095 152.535);\n --color-green-950: oklch(26.6% 0.065 152.934);\n\n --color-emerald-50: oklch(97.9% 0.021 166.113);\n --color-emerald-100: oklch(95% 0.052 163.051);\n --color-emerald-200: oklch(90.5% 0.093 164.15);\n --color-emerald-300: oklch(84.5% 0.143 164.978);\n --color-emerald-400: oklch(76.5% 0.177 163.223);\n --color-emerald-500: oklch(69.6% 0.17 162.48);\n --color-emerald-600: oklch(59.6% 0.145 163.225);\n --color-emerald-700: oklch(50.8% 0.118 165.612);\n --color-emerald-800: oklch(43.2% 0.095 166.913);\n --color-emerald-900: oklch(37.8% 0.077 168.94);\n --color-emerald-950: oklch(26.2% 0.051 172.552);\n\n --color-teal-50: oklch(98.4% 0.014 180.72);\n --color-teal-100: oklch(95.3% 0.051 180.801);\n --color-teal-200: oklch(91% 0.096 180.426);\n --color-teal-300: oklch(85.5% 0.138 181.071);\n --color-teal-400: oklch(77.7% 0.152 181.912);\n --color-teal-500: oklch(70.4% 0.14 182.503);\n --color-teal-600: oklch(60% 0.118 184.704);\n --color-teal-700: oklch(51.1% 0.096 186.391);\n --color-teal-800: oklch(43.7% 0.078 188.216);\n --color-teal-900: oklch(38.6% 0.063 188.416);\n --color-teal-950: oklch(27.7% 0.046 192.524);\n\n --color-cyan-50: oklch(98.4% 0.019 200.873);\n --color-cyan-100: oklch(95.6% 0.045 203.388);\n --color-cyan-200: oklch(91.7% 0.08 205.041);\n --color-cyan-300: oklch(86.5% 0.127 207.078);\n --color-cyan-400: oklch(78.9% 0.154 211.53);\n --color-cyan-500: oklch(71.5% 0.143 215.221);\n --color-cyan-600: oklch(60.9% 0.126 221.723);\n --color-cyan-700: oklch(52% 0.105 223.128);\n --color-cyan-800: oklch(45% 0.085 224.283);\n --color-cyan-900: oklch(39.8% 0.07 227.392);\n --color-cyan-950: oklch(30.2% 0.056 229.695);\n\n --color-sky-50: oklch(97.7% 0.013 236.62);\n --color-sky-100: oklch(95.1% 0.026 236.824);\n --color-sky-200: oklch(90.1% 0.058 230.902);\n --color-sky-300: oklch(82.8% 0.111 230.318);\n --color-sky-400: oklch(74.6% 0.16 232.661);\n --color-sky-500: oklch(68.5% 0.169 237.323);\n --color-sky-600: oklch(58.8% 0.158 241.966);\n --color-sky-700: oklch(50% 0.134 242.749);\n --color-sky-800: oklch(44.3% 0.11 240.79);\n --color-sky-900: oklch(39.1% 0.09 240.876);\n --color-sky-950: oklch(29.3% 0.066 243.157);\n\n --color-blue-50: oklch(97% 0.014 254.604);\n --color-blue-100: oklch(93.2% 0.032 255.585);\n --color-blue-200: oklch(88.2% 0.059 254.128);\n --color-blue-300: oklch(80.9% 0.105 251.813);\n --color-blue-400: oklch(70.7% 0.165 254.624);\n --color-blue-500: oklch(62.3% 0.214 259.815);\n --color-blue-600: oklch(54.6% 0.245 262.881);\n --color-blue-700: oklch(48.8% 0.243 264.376);\n --color-blue-800: oklch(42.4% 0.199 265.638);\n --color-blue-900: oklch(37.9% 0.146 265.522);\n --color-blue-950: oklch(28.2% 0.091 267.935);\n\n --color-indigo-50: oklch(96.2% 0.018 272.314);\n --color-indigo-100: oklch(93% 0.034 272.788);\n --color-indigo-200: oklch(87% 0.065 274.039);\n --color-indigo-300: oklch(78.5% 0.115 274.713);\n --color-indigo-400: oklch(67.3% 0.182 276.935);\n --color-indigo-500: oklch(58.5% 0.233 277.117);\n --color-indigo-600: oklch(51.1% 0.262 276.966);\n --color-indigo-700: oklch(45.7% 0.24 277.023);\n --color-indigo-800: oklch(39.8% 0.195 277.366);\n --color-indigo-900: oklch(35.9% 0.144 278.697);\n --color-indigo-950: oklch(25.7% 0.09 281.288);\n\n --color-violet-50: oklch(96.9% 0.016 293.756);\n --color-violet-100: oklch(94.3% 0.029 294.588);\n --color-violet-200: oklch(89.4% 0.057 293.283);\n --color-violet-300: oklch(81.1% 0.111 293.571);\n --color-violet-400: oklch(70.2% 0.183 293.541);\n --color-violet-500: oklch(60.6% 0.25 292.717);\n --color-violet-600: oklch(54.1% 0.281 293.009);\n --color-violet-700: oklch(49.1% 0.27 292.581);\n --color-violet-800: oklch(43.2% 0.232 292.759);\n --color-violet-900: oklch(38% 0.189 293.745);\n --color-violet-950: oklch(28.3% 0.141 291.089);\n\n --color-purple-50: oklch(97.7% 0.014 308.299);\n --color-purple-100: oklch(94.6% 0.033 307.174);\n --color-purple-200: oklch(90.2% 0.063 306.703);\n --color-purple-300: oklch(82.7% 0.119 306.383);\n --color-purple-400: oklch(71.4% 0.203 305.504);\n --color-purple-500: oklch(62.7% 0.265 303.9);\n --color-purple-600: oklch(55.8% 0.288 302.321);\n --color-purple-700: oklch(49.6% 0.265 301.924);\n --color-purple-800: oklch(43.8% 0.218 303.724);\n --color-purple-900: oklch(38.1% 0.176 304.987);\n --color-purple-950: oklch(29.1% 0.149 302.717);\n\n --color-fuchsia-50: oklch(97.7% 0.017 320.058);\n --color-fuchsia-100: oklch(95.2% 0.037 318.852);\n --color-fuchsia-200: oklch(90.3% 0.076 319.62);\n --color-fuchsia-300: oklch(83.3% 0.145 321.434);\n --color-fuchsia-400: oklch(74% 0.238 322.16);\n --color-fuchsia-500: oklch(66.7% 0.295 322.15);\n --color-fuchsia-600: oklch(59.1% 0.293 322.896);\n --color-fuchsia-700: oklch(51.8% 0.253 323.949);\n --color-fuchsia-800: oklch(45.2% 0.211 324.591);\n --color-fuchsia-900: oklch(40.1% 0.17 325.612);\n --color-fuchsia-950: oklch(29.3% 0.136 325.661);\n\n --color-pink-50: oklch(97.1% 0.014 343.198);\n --color-pink-100: oklch(94.8% 0.028 342.258);\n --color-pink-200: oklch(89.9% 0.061 343.231);\n --color-pink-300: oklch(82.3% 0.12 346.018);\n --color-pink-400: oklch(71.8% 0.202 349.761);\n --color-pink-500: oklch(65.6% 0.241 354.308);\n --color-pink-600: oklch(59.2% 0.249 0.584);\n --color-pink-700: oklch(52.5% 0.223 3.958);\n --color-pink-800: oklch(45.9% 0.187 3.815);\n --color-pink-900: oklch(40.8% 0.153 2.432);\n --color-pink-950: oklch(28.4% 0.109 3.907);\n\n --color-rose-50: oklch(96.9% 0.015 12.422);\n --color-rose-100: oklch(94.1% 0.03 12.58);\n --color-rose-200: oklch(89.2% 0.058 10.001);\n --color-rose-300: oklch(81% 0.117 11.638);\n --color-rose-400: oklch(71.2% 0.194 13.428);\n --color-rose-500: oklch(64.5% 0.246 16.439);\n --color-rose-600: oklch(58.6% 0.253 17.585);\n --color-rose-700: oklch(51.4% 0.222 16.935);\n --color-rose-800: oklch(45.5% 0.188 13.697);\n --color-rose-900: oklch(41% 0.159 10.272);\n --color-rose-950: oklch(27.1% 0.105 12.094);\n\n --color-slate-50: oklch(98.4% 0.003 247.858);\n --color-slate-100: oklch(96.8% 0.007 247.896);\n --color-slate-200: oklch(92.9% 0.013 255.508);\n --color-slate-300: oklch(86.9% 0.022 252.894);\n --color-slate-400: oklch(70.4% 0.04 256.788);\n --color-slate-500: oklch(55.4% 0.046 257.417);\n --color-slate-600: oklch(44.6% 0.043 257.281);\n --color-slate-700: oklch(37.2% 0.044 257.287);\n --color-slate-800: oklch(27.9% 0.041 260.031);\n --color-slate-900: oklch(20.8% 0.042 265.755);\n --color-slate-950: oklch(12.9% 0.042 264.695);\n\n --color-gray-50: oklch(98.5% 0.002 247.839);\n --color-gray-100: oklch(96.7% 0.003 264.542);\n --color-gray-200: oklch(92.8% 0.006 264.531);\n --color-gray-300: oklch(87.2% 0.01 258.338);\n --color-gray-400: oklch(70.7% 0.022 261.325);\n --color-gray-500: oklch(55.1% 0.027 264.364);\n --color-gray-600: oklch(44.6% 0.03 256.802);\n --color-gray-700: oklch(37.3% 0.034 259.733);\n --color-gray-800: oklch(27.8% 0.033 256.848);\n --color-gray-900: oklch(21% 0.034 264.665);\n --color-gray-950: oklch(13% 0.028 261.692);\n\n --color-zinc-50: oklch(98.5% 0 none);\n --color-zinc-100: oklch(96.7% 0.001 286.375);\n --color-zinc-200: oklch(92% 0.004 286.32);\n --color-zinc-300: oklch(87.1% 0.006 286.286);\n --color-zinc-400: oklch(70.5% 0.015 286.067);\n --color-zinc-500: oklch(55.2% 0.016 285.938);\n --color-zinc-600: oklch(44.2% 0.017 285.786);\n --color-zinc-700: oklch(37% 0.013 285.805);\n --color-zinc-800: oklch(27.4% 0.006 286.033);\n --color-zinc-900: oklch(21% 0.006 285.885);\n --color-zinc-950: oklch(14.1% 0.005 285.823);\n\n --color-neutral-50: oklch(98.5% 0 none);\n --color-neutral-100: oklch(97% 0 none);\n --color-neutral-200: oklch(92.2% 0 none);\n --color-neutral-300: oklch(87% 0 none);\n --color-neutral-400: oklch(70.8% 0 none);\n --color-neutral-500: oklch(55.6% 0 none);\n --color-neutral-600: oklch(43.9% 0 none);\n --color-neutral-700: oklch(37.1% 0 none);\n --color-neutral-800: oklch(26.9% 0 none);\n --color-neutral-900: oklch(20.5% 0 none);\n --color-neutral-950: oklch(14.5% 0 none);\n\n --color-stone-50: oklch(98.5% 0.001 106.423);\n --color-stone-100: oklch(97% 0.001 106.424);\n --color-stone-200: oklch(92.3% 0.003 48.717);\n --color-stone-300: oklch(86.9% 0.005 56.366);\n --color-stone-400: oklch(70.9% 0.01 56.259);\n --color-stone-500: oklch(55.3% 0.013 58.071);\n --color-stone-600: oklch(44.4% 0.011 73.639);\n --color-stone-700: oklch(37.4% 0.01 67.558);\n --color-stone-800: oklch(26.8% 0.007 34.298);\n --color-stone-900: oklch(21.6% 0.006 56.043);\n --color-stone-950: oklch(14.7% 0.004 49.25);\n\n --color-mauve-50: oklch(98.5% 0 none);\n --color-mauve-100: oklch(96% 0.003 325.6);\n --color-mauve-200: oklch(92.2% 0.005 325.62);\n --color-mauve-300: oklch(86.5% 0.012 325.68);\n --color-mauve-400: oklch(71.1% 0.019 323.02);\n --color-mauve-500: oklch(54.2% 0.034 322.5);\n --color-mauve-600: oklch(43.5% 0.029 321.78);\n --color-mauve-700: oklch(36.4% 0.029 323.89);\n --color-mauve-800: oklch(26.3% 0.024 320.12);\n --color-mauve-900: oklch(21.2% 0.019 322.12);\n --color-mauve-950: oklch(14.5% 0.008 326);\n\n --color-olive-50: oklch(98.8% 0.003 106.5);\n --color-olive-100: oklch(96.6% 0.005 106.5);\n --color-olive-200: oklch(93% 0.007 106.5);\n --color-olive-300: oklch(88% 0.011 106.6);\n --color-olive-400: oklch(73.7% 0.021 106.9);\n --color-olive-500: oklch(58% 0.031 107.3);\n --color-olive-600: oklch(46.6% 0.025 107.3);\n --color-olive-700: oklch(39.4% 0.023 107.4);\n --color-olive-800: oklch(28.6% 0.016 107.4);\n --color-olive-900: oklch(22.8% 0.013 107.4);\n --color-olive-950: oklch(15.3% 0.006 107.1);\n\n --color-mist-50: oklch(98.7% 0.002 197.1);\n --color-mist-100: oklch(96.3% 0.002 197.1);\n --color-mist-200: oklch(92.5% 0.005 214.3);\n --color-mist-300: oklch(87.2% 0.007 219.6);\n --color-mist-400: oklch(72.3% 0.014 214.4);\n --color-mist-500: oklch(56% 0.021 213.5);\n --color-mist-600: oklch(45% 0.017 213.2);\n --color-mist-700: oklch(37.8% 0.015 216);\n --color-mist-800: oklch(27.5% 0.011 216.9);\n --color-mist-900: oklch(21.8% 0.008 223.9);\n --color-mist-950: oklch(14.8% 0.004 228.8);\n\n --color-taupe-50: oklch(98.6% 0.002 67.8);\n --color-taupe-100: oklch(96% 0.002 17.2);\n --color-taupe-200: oklch(92.2% 0.005 34.3);\n --color-taupe-300: oklch(86.8% 0.007 39.5);\n --color-taupe-400: oklch(71.4% 0.014 41.2);\n --color-taupe-500: oklch(54.7% 0.021 43.1);\n --color-taupe-600: oklch(43.8% 0.017 39.3);\n --color-taupe-700: oklch(36.7% 0.016 35.7);\n --color-taupe-800: oklch(26.8% 0.011 36.5);\n --color-taupe-900: oklch(21.4% 0.009 43.1);\n --color-taupe-950: oklch(14.7% 0.004 49.3);\n\n --color-black: #000;\n --color-white: #fff;\n\n --spacing: 0.25rem;\n\n --breakpoint-sm: 40rem;\n --breakpoint-md: 48rem;\n --breakpoint-lg: 64rem;\n --breakpoint-xl: 80rem;\n --breakpoint-2xl: 96rem;\n\n --container-3xs: 16rem;\n --container-2xs: 18rem;\n --container-xs: 20rem;\n --container-sm: 24rem;\n --container-md: 28rem;\n --container-lg: 32rem;\n --container-xl: 36rem;\n --container-2xl: 42rem;\n --container-3xl: 48rem;\n --container-4xl: 56rem;\n --container-5xl: 64rem;\n --container-6xl: 72rem;\n --container-7xl: 80rem;\n\n --text-xs: 0.75rem;\n --text-xs--line-height: calc(1 / 0.75);\n --text-sm: 0.875rem;\n --text-sm--line-height: calc(1.25 / 0.875);\n --text-base: 1rem;\n --text-base--line-height: calc(1.5 / 1);\n --text-lg: 1.125rem;\n --text-lg--line-height: calc(1.75 / 1.125);\n --text-xl: 1.25rem;\n --text-xl--line-height: calc(1.75 / 1.25);\n --text-2xl: 1.5rem;\n --text-2xl--line-height: calc(2 / 1.5);\n --text-3xl: 1.875rem;\n --text-3xl--line-height: calc(2.25 / 1.875);\n --text-4xl: 2.25rem;\n --text-4xl--line-height: calc(2.5 / 2.25);\n --text-5xl: 3rem;\n --text-5xl--line-height: 1;\n --text-6xl: 3.75rem;\n --text-6xl--line-height: 1;\n --text-7xl: 4.5rem;\n --text-7xl--line-height: 1;\n --text-8xl: 6rem;\n --text-8xl--line-height: 1;\n --text-9xl: 8rem;\n --text-9xl--line-height: 1;\n\n --font-weight-thin: 100;\n --font-weight-extralight: 200;\n --font-weight-light: 300;\n --font-weight-normal: 400;\n --font-weight-medium: 500;\n --font-weight-semibold: 600;\n --font-weight-bold: 700;\n --font-weight-extrabold: 800;\n --font-weight-black: 900;\n\n --tracking-tighter: -0.05em;\n --tracking-tight: -0.025em;\n --tracking-normal: 0em;\n --tracking-wide: 0.025em;\n --tracking-wider: 0.05em;\n --tracking-widest: 0.1em;\n\n --leading-tight: 1.25;\n --leading-snug: 1.375;\n --leading-normal: 1.5;\n --leading-relaxed: 1.625;\n --leading-loose: 2;\n\n --radius-xs: 0.125rem;\n --radius-sm: 0.25rem;\n --radius-md: 0.375rem;\n --radius-lg: 0.5rem;\n --radius-xl: 0.75rem;\n --radius-2xl: 1rem;\n --radius-3xl: 1.5rem;\n --radius-4xl: 2rem;\n\n --shadow-2xs: 0 1px rgb(0 0 0 / 0.05);\n --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);\n --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);\n --shadow-md:\n 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);\n --shadow-lg:\n 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);\n --shadow-xl:\n 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);\n --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);\n\n --inset-shadow-2xs: inset 0 1px rgb(0 0 0 / 0.05);\n --inset-shadow-xs: inset 0 1px 1px rgb(0 0 0 / 0.05);\n --inset-shadow-sm: inset 0 2px 4px rgb(0 0 0 / 0.05);\n\n --drop-shadow-xs: 0 1px 1px rgb(0 0 0 / 0.05);\n --drop-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.15);\n --drop-shadow-md: 0 3px 3px rgb(0 0 0 / 0.12);\n --drop-shadow-lg: 0 4px 4px rgb(0 0 0 / 0.15);\n --drop-shadow-xl: 0 9px 7px rgb(0 0 0 / 0.1);\n --drop-shadow-2xl: 0 25px 25px rgb(0 0 0 / 0.15);\n\n --text-shadow-2xs: 0px 1px 0px rgb(0 0 0 / 0.15);\n --text-shadow-xs: 0px 1px 1px rgb(0 0 0 / 0.2);\n --text-shadow-sm:\n 0px 1px 0px rgb(0 0 0 / 0.075), 0px 1px 1px rgb(0 0 0 / 0.075),\n 0px 2px 2px rgb(0 0 0 / 0.075);\n --text-shadow-md:\n 0px 1px 1px rgb(0 0 0 / 0.1), 0px 1px 2px rgb(0 0 0 / 0.1),\n 0px 2px 4px rgb(0 0 0 / 0.1);\n --text-shadow-lg:\n 0px 1px 2px rgb(0 0 0 / 0.1), 0px 3px 2px rgb(0 0 0 / 0.1),\n 0px 4px 8px rgb(0 0 0 / 0.1);\n\n --ease-in: cubic-bezier(0.4, 0, 1, 1);\n --ease-out: cubic-bezier(0, 0, 0.2, 1);\n --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);\n\n --animate-spin: spin 1s linear infinite;\n --animate-ping: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;\n --animate-pulse: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;\n --animate-bounce: bounce 1s infinite;\n\n @keyframes spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n @keyframes ping {\n 75%,\n 100% {\n transform: scale(2);\n opacity: 0;\n }\n }\n\n @keyframes pulse {\n 50% {\n opacity: 0.5;\n }\n }\n\n @keyframes bounce {\n 0%,\n 100% {\n transform: translateY(-25%);\n animation-timing-function: cubic-bezier(0.8, 0, 1, 1);\n }\n\n 50% {\n transform: none;\n animation-timing-function: cubic-bezier(0, 0, 0.2, 1);\n }\n }\n\n --blur-xs: 4px;\n --blur-sm: 8px;\n --blur-md: 12px;\n --blur-lg: 16px;\n --blur-xl: 24px;\n --blur-2xl: 40px;\n --blur-3xl: 64px;\n\n --perspective-dramatic: 100px;\n --perspective-near: 300px;\n --perspective-normal: 500px;\n --perspective-midrange: 800px;\n --perspective-distant: 1200px;\n\n --aspect-video: 16 / 9;\n\n --default-transition-duration: 150ms;\n --default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n --default-font-family: --theme(--font-sans, initial);\n --default-font-feature-settings: --theme(\n --font-sans--font-feature-settings,\n initial\n );\n --default-font-variation-settings: --theme(\n --font-sans--font-variation-settings,\n initial\n );\n --default-mono-font-family: --theme(--font-mono, initial);\n --default-mono-font-feature-settings: --theme(\n --font-mono--font-feature-settings,\n initial\n );\n --default-mono-font-variation-settings: --theme(\n --font-mono--font-variation-settings,\n initial\n );\n }\n\n /* Deprecated */\n @theme default inline reference {\n --blur: 8px;\n --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);\n --shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);\n --drop-shadow: 0 1px 2px rgb(0 0 0 / 0.1), 0 1px 1px rgb(0 0 0 / 0.06);\n --radius: 0.25rem;\n --max-width-prose: 65ch;\n }\n}\n\n@layer base {\n /*\n 1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)\n 2. Remove default margins and padding\n 3. Reset all borders.\n*/\n\n *,\n ::after,\n ::before,\n ::backdrop,\n ::file-selector-button {\n box-sizing: border-box; /* 1 */\n margin: 0; /* 2 */\n padding: 0; /* 2 */\n border: 0 solid; /* 3 */\n }\n\n /*\n 1. Use a consistent sensible line-height in all browsers.\n 2. Prevent adjustments of font size after orientation changes in iOS.\n 3. Use a more readable tab size.\n 4. Use the user\'s configured `sans` font-family by default.\n 5. Use the user\'s configured `sans` font-feature-settings by default.\n 6. Use the user\'s configured `sans` font-variation-settings by default.\n 7. Disable tap highlights on iOS.\n*/\n\n html,\n :host {\n line-height: 1.5; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n tab-size: 4; /* 3 */\n font-family: --theme(\n --default-font-family,\n -apple-system,\n BlinkMacSystemFont,\n "Segoe UI",\n Roboto,\n "Helvetica Neue",\n "Noto Sans",\n Arial,\n sans-serif,\n "Apple Color Emoji",\n "Segoe UI Emoji",\n "Segoe UI Symbol",\n "Noto Color Emoji"\n ); /* 4 */\n font-feature-settings: --theme(\n --default-font-feature-settings,\n normal\n ); /* 5 */\n font-variation-settings: --theme(\n --default-font-variation-settings,\n normal\n ); /* 6 */\n -webkit-tap-highlight-color: transparent; /* 7 */\n }\n\n /*\n 1. Add the correct height in Firefox.\n 2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)\n 3. Reset the default border style to a 1px solid border.\n*/\n\n hr {\n height: 0; /* 1 */\n color: inherit; /* 2 */\n border-top-width: 1px; /* 3 */\n }\n\n /*\n Add the correct text decoration in Chrome, Edge, and Safari.\n*/\n\n abbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n }\n\n /*\n Remove the default font size and weight for headings.\n*/\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n font-size: inherit;\n font-weight: inherit;\n }\n\n /*\n Reset links to optimize for opt-in styling instead of opt-out.\n*/\n\n a {\n color: inherit;\n -webkit-text-decoration: inherit;\n text-decoration: inherit;\n }\n\n /*\n Add the correct font weight in Edge and Safari.\n*/\n\n b,\n strong {\n font-weight: bolder;\n }\n\n /*\n 1. Use the user\'s configured `mono` font-family by default.\n 2. Use the user\'s configured `mono` font-feature-settings by default.\n 3. Use the user\'s configured `mono` font-variation-settings by default.\n 4. Correct the odd `em` font sizing in all browsers.\n*/\n\n code,\n kbd,\n samp,\n pre {\n font-family: --theme(\n --default-mono-font-family,\n ui-monospace,\n SFMono-Regular,\n Menlo,\n Monaco,\n Consolas,\n "Liberation Mono",\n "Courier New",\n monospace\n ); /* 1 */\n font-feature-settings: --theme(\n --default-mono-font-feature-settings,\n normal\n ); /* 2 */\n font-variation-settings: --theme(\n --default-mono-font-variation-settings,\n normal\n ); /* 3 */\n font-size: 1em; /* 4 */\n }\n\n /*\n Add the correct font size in all browsers.\n*/\n\n small {\n font-size: 80%;\n }\n\n /*\n Prevent `sub` and `sup` elements from affecting the line height in all browsers.\n*/\n\n sub,\n sup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n }\n\n sub {\n bottom: -0.25em;\n }\n\n sup {\n top: -0.5em;\n }\n\n /*\n 1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)\n 2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)\n 3. Remove gaps between table borders by default.\n*/\n\n table {\n text-indent: 0; /* 1 */\n border-color: inherit; /* 2 */\n border-collapse: collapse; /* 3 */\n }\n\n /*\n Use the modern Firefox focus style for all focusable elements.\n*/\n\n :-moz-focusring:where(:not(iframe)) {\n outline: auto;\n }\n\n /*\n Add the correct vertical alignment in Chrome and Firefox.\n*/\n\n progress {\n vertical-align: baseline;\n }\n\n /*\n Add the correct display in Chrome and Safari.\n*/\n\n summary {\n display: list-item;\n }\n\n /*\n Make lists unstyled by default.\n*/\n\n ol,\n ul,\n menu {\n list-style: none;\n }\n\n /*\n 1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)\n 2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)\n This can trigger a poorly considered lint error in some tools but is included by design.\n*/\n\n img,\n svg,\n video,\n canvas,\n audio,\n iframe,\n embed,\n object {\n display: block; /* 1 */\n vertical-align: middle; /* 2 */\n }\n\n /*\n Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)\n*/\n\n img,\n video {\n max-width: 100%;\n height: auto;\n }\n\n /*\n 1. Inherit font styles in all browsers.\n 2. Remove border radius in all browsers.\n 3. Remove background color in all browsers.\n 4. Ensure consistent opacity for disabled states in all browsers.\n*/\n\n button,\n input,\n select,\n optgroup,\n textarea,\n ::file-selector-button {\n font: inherit; /* 1 */\n font-feature-settings: inherit; /* 1 */\n font-variation-settings: inherit; /* 1 */\n letter-spacing: inherit; /* 1 */\n color: inherit; /* 1 */\n border-radius: 0; /* 2 */\n background-color: transparent; /* 3 */\n opacity: 1; /* 4 */\n }\n\n /*\n Restore default font weight.\n*/\n\n :where(select:is([multiple], [size])) optgroup {\n font-weight: bolder;\n }\n\n /*\n Restore indentation.\n*/\n\n :where(select:is([multiple], [size])) optgroup option {\n padding-inline-start: 20px;\n }\n\n /*\n Restore space after button.\n*/\n\n ::file-selector-button {\n margin-inline-end: 4px;\n }\n\n /*\n Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)\n*/\n\n ::placeholder {\n opacity: 1;\n }\n\n /*\n Set the default placeholder color to a semi-transparent version of the current text color in browsers that do not\n crash when using `color-mix(…)` with `currentcolor`. (https://github.com/tailwindlabs/tailwindcss/issues/17194)\n*/\n\n @supports (not (-webkit-appearance: -apple-pay-button)) /* Not Safari */ or\n (contain-intrinsic-size: 1px) /* Safari 17+ */ {\n ::placeholder {\n color: color-mix(in oklab, currentcolor 50%, transparent);\n }\n }\n\n /*\n Prevent resizing textareas horizontally by default.\n*/\n\n textarea {\n resize: vertical;\n }\n\n /*\n Remove the inner padding in Chrome and Safari on macOS.\n*/\n\n ::-webkit-search-decoration {\n -webkit-appearance: none;\n }\n\n /*\n 1. Ensure date/time inputs have the same height when empty in iOS Safari.\n 2. Ensure text alignment can be changed on date/time inputs in iOS Safari.\n*/\n\n ::-webkit-date-and-time-value {\n min-height: 1lh; /* 1 */\n text-align: inherit; /* 2 */\n }\n\n /*\n Prevent height from changing on date/time inputs in macOS Safari when the input is set to `display: block`.\n*/\n\n ::-webkit-datetime-edit {\n display: inline-flex;\n }\n\n /*\n Remove excess padding from pseudo-elements in date/time inputs to ensure consistent height across browsers.\n*/\n\n ::-webkit-datetime-edit-fields-wrapper {\n padding: 0;\n }\n\n ::-webkit-datetime-edit,\n ::-webkit-datetime-edit-year-field,\n ::-webkit-datetime-edit-month-field,\n ::-webkit-datetime-edit-day-field,\n ::-webkit-datetime-edit-hour-field,\n ::-webkit-datetime-edit-minute-field,\n ::-webkit-datetime-edit-second-field,\n ::-webkit-datetime-edit-millisecond-field,\n ::-webkit-datetime-edit-meridiem-field {\n padding-block: 0;\n }\n\n /*\n Center dropdown marker shown on inputs with paired `<datalist>`s in Chrome. (https://github.com/tailwindlabs/tailwindcss/issues/18499)\n*/\n\n ::-webkit-calendar-picker-indicator {\n line-height: 1;\n }\n\n /*\n Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)\n*/\n\n :-moz-ui-invalid {\n box-shadow: none;\n }\n\n /*\n Correct the inability to style the border radius in iOS Safari.\n*/\n\n button,\n input:where([type="button"], [type="reset"], [type="submit"]),\n ::file-selector-button {\n appearance: button;\n }\n\n /*\n Correct the cursor style of increment and decrement buttons in Safari.\n*/\n\n ::-webkit-inner-spin-button,\n ::-webkit-outer-spin-button {\n height: auto;\n }\n\n /*\n Make elements with the HTML hidden attribute stay hidden by default.\n*/\n\n [hidden]:where(:not([hidden="until-found"])) {\n display: none !important;\n }\n}\n\n@layer utilities {\n @tailwind utilities;\n}\n',
749
+ preflight: "/*\n 1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)\n 2. Remove default margins and padding\n 3. Reset all borders.\n*/\n\n*,\n::after,\n::before,\n::backdrop,\n::file-selector-button {\n box-sizing: border-box; /* 1 */\n margin: 0; /* 2 */\n padding: 0; /* 2 */\n border: 0 solid; /* 3 */\n}\n\n/*\n 1. Use a consistent sensible line-height in all browsers.\n 2. Prevent adjustments of font size after orientation changes in iOS.\n 3. Use a more readable tab size.\n 4. Use the user's configured `sans` font-family by default.\n 5. Use the user's configured `sans` font-feature-settings by default.\n 6. Use the user's configured `sans` font-variation-settings by default.\n 7. Disable tap highlights on iOS.\n*/\n\nhtml,\n:host {\n line-height: 1.5; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n tab-size: 4; /* 3 */\n font-family: --theme(\n --default-font-family,\n -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n Roboto,\n 'Helvetica Neue',\n 'Noto Sans',\n Arial,\n sans-serif,\n 'Apple Color Emoji',\n 'Segoe UI Emoji',\n 'Segoe UI Symbol',\n 'Noto Color Emoji'\n ); /* 4 */\n font-feature-settings: --theme(--default-font-feature-settings, normal); /* 5 */\n font-variation-settings: --theme(--default-font-variation-settings, normal); /* 6 */\n -webkit-tap-highlight-color: transparent; /* 7 */\n}\n\n/*\n 1. Add the correct height in Firefox.\n 2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)\n 3. Reset the default border style to a 1px solid border.\n*/\n\nhr {\n height: 0; /* 1 */\n color: inherit; /* 2 */\n border-top-width: 1px; /* 3 */\n}\n\n/*\n Add the correct text decoration in Chrome, Edge, and Safari.\n*/\n\nabbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n}\n\n/*\n Remove the default font size and weight for headings.\n*/\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n font-size: inherit;\n font-weight: inherit;\n}\n\n/*\n Reset links to optimize for opt-in styling instead of opt-out.\n*/\n\na {\n color: inherit;\n -webkit-text-decoration: inherit;\n text-decoration: inherit;\n}\n\n/*\n Add the correct font weight in Edge and Safari.\n*/\n\nb,\nstrong {\n font-weight: bolder;\n}\n\n/*\n 1. Use the user's configured `mono` font-family by default.\n 2. Use the user's configured `mono` font-feature-settings by default.\n 3. Use the user's configured `mono` font-variation-settings by default.\n 4. Correct the odd `em` font sizing in all browsers.\n*/\n\ncode,\nkbd,\nsamp,\npre {\n font-family: --theme(\n --default-mono-font-family,\n ui-monospace,\n SFMono-Regular,\n Menlo,\n Monaco,\n Consolas,\n 'Liberation Mono',\n 'Courier New',\n monospace\n ); /* 1 */\n font-feature-settings: --theme(--default-mono-font-feature-settings, normal); /* 2 */\n font-variation-settings: --theme(--default-mono-font-variation-settings, normal); /* 3 */\n font-size: 1em; /* 4 */\n}\n\n/*\n Add the correct font size in all browsers.\n*/\n\nsmall {\n font-size: 80%;\n}\n\n/*\n Prevent `sub` and `sup` elements from affecting the line height in all browsers.\n*/\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/*\n 1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)\n 2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)\n 3. Remove gaps between table borders by default.\n*/\n\ntable {\n text-indent: 0; /* 1 */\n border-color: inherit; /* 2 */\n border-collapse: collapse; /* 3 */\n}\n\n/*\n Use the modern Firefox focus style for all focusable elements.\n*/\n\n:-moz-focusring:where(:not(iframe)) {\n outline: auto;\n}\n\n/*\n Add the correct vertical alignment in Chrome and Firefox.\n*/\n\nprogress {\n vertical-align: baseline;\n}\n\n/*\n Add the correct display in Chrome and Safari.\n*/\n\nsummary {\n display: list-item;\n}\n\n/*\n Make lists unstyled by default.\n*/\n\nol,\nul,\nmenu {\n list-style: none;\n}\n\n/*\n 1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)\n 2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)\n This can trigger a poorly considered lint error in some tools but is included by design.\n*/\n\nimg,\nsvg,\nvideo,\ncanvas,\naudio,\niframe,\nembed,\nobject {\n display: block; /* 1 */\n vertical-align: middle; /* 2 */\n}\n\n/*\n Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)\n*/\n\nimg,\nvideo {\n max-width: 100%;\n height: auto;\n}\n\n/*\n 1. Inherit font styles in all browsers.\n 2. Remove border radius in all browsers.\n 3. Remove background color in all browsers.\n 4. Ensure consistent opacity for disabled states in all browsers.\n*/\n\nbutton,\ninput,\nselect,\noptgroup,\ntextarea,\n::file-selector-button {\n font: inherit; /* 1 */\n font-feature-settings: inherit; /* 1 */\n font-variation-settings: inherit; /* 1 */\n letter-spacing: inherit; /* 1 */\n color: inherit; /* 1 */\n border-radius: 0; /* 2 */\n background-color: transparent; /* 3 */\n opacity: 1; /* 4 */\n}\n\n/*\n Restore default font weight.\n*/\n\n:where(select:is([multiple], [size])) optgroup {\n font-weight: bolder;\n}\n\n/*\n Restore indentation.\n*/\n\n:where(select:is([multiple], [size])) optgroup option {\n padding-inline-start: 20px;\n}\n\n/*\n Restore space after button.\n*/\n\n::file-selector-button {\n margin-inline-end: 4px;\n}\n\n/*\n Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)\n*/\n\n::placeholder {\n opacity: 1;\n}\n\n/*\n Set the default placeholder color to a semi-transparent version of the current text color in browsers that do not\n crash when using `color-mix(…)` with `currentcolor`. (https://github.com/tailwindlabs/tailwindcss/issues/17194)\n*/\n\n@supports (not (-webkit-appearance: -apple-pay-button)) /* Not Safari */ or\n (contain-intrinsic-size: 1px) /* Safari 17+ */ {\n ::placeholder {\n color: color-mix(in oklab, currentcolor 50%, transparent);\n }\n}\n\n/*\n Prevent resizing textareas horizontally by default.\n*/\n\ntextarea {\n resize: vertical;\n}\n\n/*\n Remove the inner padding in Chrome and Safari on macOS.\n*/\n\n::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/*\n 1. Ensure date/time inputs have the same height when empty in iOS Safari.\n 2. Ensure text alignment can be changed on date/time inputs in iOS Safari.\n*/\n\n::-webkit-date-and-time-value {\n min-height: 1lh; /* 1 */\n text-align: inherit; /* 2 */\n}\n\n/*\n Prevent height from changing on date/time inputs in macOS Safari when the input is set to `display: block`.\n*/\n\n::-webkit-datetime-edit {\n display: inline-flex;\n}\n\n/*\n Remove excess padding from pseudo-elements in date/time inputs to ensure consistent height across browsers.\n*/\n\n::-webkit-datetime-edit-fields-wrapper {\n padding: 0;\n}\n\n::-webkit-datetime-edit,\n::-webkit-datetime-edit-year-field,\n::-webkit-datetime-edit-month-field,\n::-webkit-datetime-edit-day-field,\n::-webkit-datetime-edit-hour-field,\n::-webkit-datetime-edit-minute-field,\n::-webkit-datetime-edit-second-field,\n::-webkit-datetime-edit-millisecond-field,\n::-webkit-datetime-edit-meridiem-field {\n padding-block: 0;\n}\n\n/*\n Center dropdown marker shown on inputs with paired `<datalist>`s in Chrome. (https://github.com/tailwindlabs/tailwindcss/issues/18499)\n*/\n\n::-webkit-calendar-picker-indicator {\n line-height: 1;\n}\n\n/*\n Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)\n*/\n\n:-moz-ui-invalid {\n box-shadow: none;\n}\n\n/*\n Correct the inability to style the border radius in iOS Safari.\n*/\n\nbutton,\ninput:where([type='button'], [type='reset'], [type='submit']),\n::file-selector-button {\n appearance: button;\n}\n\n/*\n Correct the cursor style of increment and decrement buttons in Safari.\n*/\n\n::-webkit-inner-spin-button,\n::-webkit-outer-spin-button {\n height: auto;\n}\n\n/*\n Make elements with the HTML hidden attribute stay hidden by default.\n*/\n\n[hidden]:where(:not([hidden='until-found'])) {\n display: none !important;\n}\n",
750
+ theme: "@theme default {\n --font-sans:\n -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', 'Noto Sans', Arial,\n sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';\n --font-serif: ui-serif, Georgia, Cambria, 'Times New Roman', Times, serif;\n --font-mono:\n ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New',\n monospace;\n\n --color-red-50: oklch(97.1% 0.013 17.38);\n --color-red-100: oklch(93.6% 0.032 17.717);\n --color-red-200: oklch(88.5% 0.062 18.334);\n --color-red-300: oklch(80.8% 0.114 19.571);\n --color-red-400: oklch(70.4% 0.191 22.216);\n --color-red-500: oklch(63.7% 0.237 25.331);\n --color-red-600: oklch(57.7% 0.245 27.325);\n --color-red-700: oklch(50.5% 0.213 27.518);\n --color-red-800: oklch(44.4% 0.177 26.899);\n --color-red-900: oklch(39.6% 0.141 25.723);\n --color-red-950: oklch(25.8% 0.092 26.042);\n\n --color-orange-50: oklch(98% 0.016 73.684);\n --color-orange-100: oklch(95.4% 0.038 75.164);\n --color-orange-200: oklch(90.1% 0.076 70.697);\n --color-orange-300: oklch(83.7% 0.128 66.29);\n --color-orange-400: oklch(75% 0.183 55.934);\n --color-orange-500: oklch(70.5% 0.213 47.604);\n --color-orange-600: oklch(64.6% 0.222 41.116);\n --color-orange-700: oklch(55.3% 0.195 38.402);\n --color-orange-800: oklch(47% 0.157 37.304);\n --color-orange-900: oklch(40.8% 0.123 38.172);\n --color-orange-950: oklch(26.6% 0.079 36.259);\n\n --color-amber-50: oklch(98.7% 0.022 95.277);\n --color-amber-100: oklch(96.2% 0.059 95.617);\n --color-amber-200: oklch(92.4% 0.12 95.746);\n --color-amber-300: oklch(87.9% 0.169 91.605);\n --color-amber-400: oklch(82.8% 0.189 84.429);\n --color-amber-500: oklch(76.9% 0.188 70.08);\n --color-amber-600: oklch(66.6% 0.179 58.318);\n --color-amber-700: oklch(55.5% 0.163 48.998);\n --color-amber-800: oklch(47.3% 0.137 46.201);\n --color-amber-900: oklch(41.4% 0.112 45.904);\n --color-amber-950: oklch(27.9% 0.077 45.635);\n\n --color-yellow-50: oklch(98.7% 0.026 102.212);\n --color-yellow-100: oklch(97.3% 0.071 103.193);\n --color-yellow-200: oklch(94.5% 0.129 101.54);\n --color-yellow-300: oklch(90.5% 0.182 98.111);\n --color-yellow-400: oklch(85.2% 0.199 91.936);\n --color-yellow-500: oklch(79.5% 0.184 86.047);\n --color-yellow-600: oklch(68.1% 0.162 75.834);\n --color-yellow-700: oklch(55.4% 0.135 66.442);\n --color-yellow-800: oklch(47.6% 0.114 61.907);\n --color-yellow-900: oklch(42.1% 0.095 57.708);\n --color-yellow-950: oklch(28.6% 0.066 53.813);\n\n --color-lime-50: oklch(98.6% 0.031 120.757);\n --color-lime-100: oklch(96.7% 0.067 122.328);\n --color-lime-200: oklch(93.8% 0.127 124.321);\n --color-lime-300: oklch(89.7% 0.196 126.665);\n --color-lime-400: oklch(84.1% 0.238 128.85);\n --color-lime-500: oklch(76.8% 0.233 130.85);\n --color-lime-600: oklch(64.8% 0.2 131.684);\n --color-lime-700: oklch(53.2% 0.157 131.589);\n --color-lime-800: oklch(45.3% 0.124 130.933);\n --color-lime-900: oklch(40.5% 0.101 131.063);\n --color-lime-950: oklch(27.4% 0.072 132.109);\n\n --color-green-50: oklch(98.2% 0.018 155.826);\n --color-green-100: oklch(96.2% 0.044 156.743);\n --color-green-200: oklch(92.5% 0.084 155.995);\n --color-green-300: oklch(87.1% 0.15 154.449);\n --color-green-400: oklch(79.2% 0.209 151.711);\n --color-green-500: oklch(72.3% 0.219 149.579);\n --color-green-600: oklch(62.7% 0.194 149.214);\n --color-green-700: oklch(52.7% 0.154 150.069);\n --color-green-800: oklch(44.8% 0.119 151.328);\n --color-green-900: oklch(39.3% 0.095 152.535);\n --color-green-950: oklch(26.6% 0.065 152.934);\n\n --color-emerald-50: oklch(97.9% 0.021 166.113);\n --color-emerald-100: oklch(95% 0.052 163.051);\n --color-emerald-200: oklch(90.5% 0.093 164.15);\n --color-emerald-300: oklch(84.5% 0.143 164.978);\n --color-emerald-400: oklch(76.5% 0.177 163.223);\n --color-emerald-500: oklch(69.6% 0.17 162.48);\n --color-emerald-600: oklch(59.6% 0.145 163.225);\n --color-emerald-700: oklch(50.8% 0.118 165.612);\n --color-emerald-800: oklch(43.2% 0.095 166.913);\n --color-emerald-900: oklch(37.8% 0.077 168.94);\n --color-emerald-950: oklch(26.2% 0.051 172.552);\n\n --color-teal-50: oklch(98.4% 0.014 180.72);\n --color-teal-100: oklch(95.3% 0.051 180.801);\n --color-teal-200: oklch(91% 0.096 180.426);\n --color-teal-300: oklch(85.5% 0.138 181.071);\n --color-teal-400: oklch(77.7% 0.152 181.912);\n --color-teal-500: oklch(70.4% 0.14 182.503);\n --color-teal-600: oklch(60% 0.118 184.704);\n --color-teal-700: oklch(51.1% 0.096 186.391);\n --color-teal-800: oklch(43.7% 0.078 188.216);\n --color-teal-900: oklch(38.6% 0.063 188.416);\n --color-teal-950: oklch(27.7% 0.046 192.524);\n\n --color-cyan-50: oklch(98.4% 0.019 200.873);\n --color-cyan-100: oklch(95.6% 0.045 203.388);\n --color-cyan-200: oklch(91.7% 0.08 205.041);\n --color-cyan-300: oklch(86.5% 0.127 207.078);\n --color-cyan-400: oklch(78.9% 0.154 211.53);\n --color-cyan-500: oklch(71.5% 0.143 215.221);\n --color-cyan-600: oklch(60.9% 0.126 221.723);\n --color-cyan-700: oklch(52% 0.105 223.128);\n --color-cyan-800: oklch(45% 0.085 224.283);\n --color-cyan-900: oklch(39.8% 0.07 227.392);\n --color-cyan-950: oklch(30.2% 0.056 229.695);\n\n --color-sky-50: oklch(97.7% 0.013 236.62);\n --color-sky-100: oklch(95.1% 0.026 236.824);\n --color-sky-200: oklch(90.1% 0.058 230.902);\n --color-sky-300: oklch(82.8% 0.111 230.318);\n --color-sky-400: oklch(74.6% 0.16 232.661);\n --color-sky-500: oklch(68.5% 0.169 237.323);\n --color-sky-600: oklch(58.8% 0.158 241.966);\n --color-sky-700: oklch(50% 0.134 242.749);\n --color-sky-800: oklch(44.3% 0.11 240.79);\n --color-sky-900: oklch(39.1% 0.09 240.876);\n --color-sky-950: oklch(29.3% 0.066 243.157);\n\n --color-blue-50: oklch(97% 0.014 254.604);\n --color-blue-100: oklch(93.2% 0.032 255.585);\n --color-blue-200: oklch(88.2% 0.059 254.128);\n --color-blue-300: oklch(80.9% 0.105 251.813);\n --color-blue-400: oklch(70.7% 0.165 254.624);\n --color-blue-500: oklch(62.3% 0.214 259.815);\n --color-blue-600: oklch(54.6% 0.245 262.881);\n --color-blue-700: oklch(48.8% 0.243 264.376);\n --color-blue-800: oklch(42.4% 0.199 265.638);\n --color-blue-900: oklch(37.9% 0.146 265.522);\n --color-blue-950: oklch(28.2% 0.091 267.935);\n\n --color-indigo-50: oklch(96.2% 0.018 272.314);\n --color-indigo-100: oklch(93% 0.034 272.788);\n --color-indigo-200: oklch(87% 0.065 274.039);\n --color-indigo-300: oklch(78.5% 0.115 274.713);\n --color-indigo-400: oklch(67.3% 0.182 276.935);\n --color-indigo-500: oklch(58.5% 0.233 277.117);\n --color-indigo-600: oklch(51.1% 0.262 276.966);\n --color-indigo-700: oklch(45.7% 0.24 277.023);\n --color-indigo-800: oklch(39.8% 0.195 277.366);\n --color-indigo-900: oklch(35.9% 0.144 278.697);\n --color-indigo-950: oklch(25.7% 0.09 281.288);\n\n --color-violet-50: oklch(96.9% 0.016 293.756);\n --color-violet-100: oklch(94.3% 0.029 294.588);\n --color-violet-200: oklch(89.4% 0.057 293.283);\n --color-violet-300: oklch(81.1% 0.111 293.571);\n --color-violet-400: oklch(70.2% 0.183 293.541);\n --color-violet-500: oklch(60.6% 0.25 292.717);\n --color-violet-600: oklch(54.1% 0.281 293.009);\n --color-violet-700: oklch(49.1% 0.27 292.581);\n --color-violet-800: oklch(43.2% 0.232 292.759);\n --color-violet-900: oklch(38% 0.189 293.745);\n --color-violet-950: oklch(28.3% 0.141 291.089);\n\n --color-purple-50: oklch(97.7% 0.014 308.299);\n --color-purple-100: oklch(94.6% 0.033 307.174);\n --color-purple-200: oklch(90.2% 0.063 306.703);\n --color-purple-300: oklch(82.7% 0.119 306.383);\n --color-purple-400: oklch(71.4% 0.203 305.504);\n --color-purple-500: oklch(62.7% 0.265 303.9);\n --color-purple-600: oklch(55.8% 0.288 302.321);\n --color-purple-700: oklch(49.6% 0.265 301.924);\n --color-purple-800: oklch(43.8% 0.218 303.724);\n --color-purple-900: oklch(38.1% 0.176 304.987);\n --color-purple-950: oklch(29.1% 0.149 302.717);\n\n --color-fuchsia-50: oklch(97.7% 0.017 320.058);\n --color-fuchsia-100: oklch(95.2% 0.037 318.852);\n --color-fuchsia-200: oklch(90.3% 0.076 319.62);\n --color-fuchsia-300: oklch(83.3% 0.145 321.434);\n --color-fuchsia-400: oklch(74% 0.238 322.16);\n --color-fuchsia-500: oklch(66.7% 0.295 322.15);\n --color-fuchsia-600: oklch(59.1% 0.293 322.896);\n --color-fuchsia-700: oklch(51.8% 0.253 323.949);\n --color-fuchsia-800: oklch(45.2% 0.211 324.591);\n --color-fuchsia-900: oklch(40.1% 0.17 325.612);\n --color-fuchsia-950: oklch(29.3% 0.136 325.661);\n\n --color-pink-50: oklch(97.1% 0.014 343.198);\n --color-pink-100: oklch(94.8% 0.028 342.258);\n --color-pink-200: oklch(89.9% 0.061 343.231);\n --color-pink-300: oklch(82.3% 0.12 346.018);\n --color-pink-400: oklch(71.8% 0.202 349.761);\n --color-pink-500: oklch(65.6% 0.241 354.308);\n --color-pink-600: oklch(59.2% 0.249 0.584);\n --color-pink-700: oklch(52.5% 0.223 3.958);\n --color-pink-800: oklch(45.9% 0.187 3.815);\n --color-pink-900: oklch(40.8% 0.153 2.432);\n --color-pink-950: oklch(28.4% 0.109 3.907);\n\n --color-rose-50: oklch(96.9% 0.015 12.422);\n --color-rose-100: oklch(94.1% 0.03 12.58);\n --color-rose-200: oklch(89.2% 0.058 10.001);\n --color-rose-300: oklch(81% 0.117 11.638);\n --color-rose-400: oklch(71.2% 0.194 13.428);\n --color-rose-500: oklch(64.5% 0.246 16.439);\n --color-rose-600: oklch(58.6% 0.253 17.585);\n --color-rose-700: oklch(51.4% 0.222 16.935);\n --color-rose-800: oklch(45.5% 0.188 13.697);\n --color-rose-900: oklch(41% 0.159 10.272);\n --color-rose-950: oklch(27.1% 0.105 12.094);\n\n --color-slate-50: oklch(98.4% 0.003 247.858);\n --color-slate-100: oklch(96.8% 0.007 247.896);\n --color-slate-200: oklch(92.9% 0.013 255.508);\n --color-slate-300: oklch(86.9% 0.022 252.894);\n --color-slate-400: oklch(70.4% 0.04 256.788);\n --color-slate-500: oklch(55.4% 0.046 257.417);\n --color-slate-600: oklch(44.6% 0.043 257.281);\n --color-slate-700: oklch(37.2% 0.044 257.287);\n --color-slate-800: oklch(27.9% 0.041 260.031);\n --color-slate-900: oklch(20.8% 0.042 265.755);\n --color-slate-950: oklch(12.9% 0.042 264.695);\n\n --color-gray-50: oklch(98.5% 0.002 247.839);\n --color-gray-100: oklch(96.7% 0.003 264.542);\n --color-gray-200: oklch(92.8% 0.006 264.531);\n --color-gray-300: oklch(87.2% 0.01 258.338);\n --color-gray-400: oklch(70.7% 0.022 261.325);\n --color-gray-500: oklch(55.1% 0.027 264.364);\n --color-gray-600: oklch(44.6% 0.03 256.802);\n --color-gray-700: oklch(37.3% 0.034 259.733);\n --color-gray-800: oklch(27.8% 0.033 256.848);\n --color-gray-900: oklch(21% 0.034 264.665);\n --color-gray-950: oklch(13% 0.028 261.692);\n\n --color-zinc-50: oklch(98.5% 0 none);\n --color-zinc-100: oklch(96.7% 0.001 286.375);\n --color-zinc-200: oklch(92% 0.004 286.32);\n --color-zinc-300: oklch(87.1% 0.006 286.286);\n --color-zinc-400: oklch(70.5% 0.015 286.067);\n --color-zinc-500: oklch(55.2% 0.016 285.938);\n --color-zinc-600: oklch(44.2% 0.017 285.786);\n --color-zinc-700: oklch(37% 0.013 285.805);\n --color-zinc-800: oklch(27.4% 0.006 286.033);\n --color-zinc-900: oklch(21% 0.006 285.885);\n --color-zinc-950: oklch(14.1% 0.005 285.823);\n\n --color-neutral-50: oklch(98.5% 0 none);\n --color-neutral-100: oklch(97% 0 none);\n --color-neutral-200: oklch(92.2% 0 none);\n --color-neutral-300: oklch(87% 0 none);\n --color-neutral-400: oklch(70.8% 0 none);\n --color-neutral-500: oklch(55.6% 0 none);\n --color-neutral-600: oklch(43.9% 0 none);\n --color-neutral-700: oklch(37.1% 0 none);\n --color-neutral-800: oklch(26.9% 0 none);\n --color-neutral-900: oklch(20.5% 0 none);\n --color-neutral-950: oklch(14.5% 0 none);\n\n --color-stone-50: oklch(98.5% 0.001 106.423);\n --color-stone-100: oklch(97% 0.001 106.424);\n --color-stone-200: oklch(92.3% 0.003 48.717);\n --color-stone-300: oklch(86.9% 0.005 56.366);\n --color-stone-400: oklch(70.9% 0.01 56.259);\n --color-stone-500: oklch(55.3% 0.013 58.071);\n --color-stone-600: oklch(44.4% 0.011 73.639);\n --color-stone-700: oklch(37.4% 0.01 67.558);\n --color-stone-800: oklch(26.8% 0.007 34.298);\n --color-stone-900: oklch(21.6% 0.006 56.043);\n --color-stone-950: oklch(14.7% 0.004 49.25);\n\n --color-mauve-50: oklch(98.5% 0 none);\n --color-mauve-100: oklch(96% 0.003 325.6);\n --color-mauve-200: oklch(92.2% 0.005 325.62);\n --color-mauve-300: oklch(86.5% 0.012 325.68);\n --color-mauve-400: oklch(71.1% 0.019 323.02);\n --color-mauve-500: oklch(54.2% 0.034 322.5);\n --color-mauve-600: oklch(43.5% 0.029 321.78);\n --color-mauve-700: oklch(36.4% 0.029 323.89);\n --color-mauve-800: oklch(26.3% 0.024 320.12);\n --color-mauve-900: oklch(21.2% 0.019 322.12);\n --color-mauve-950: oklch(14.5% 0.008 326);\n\n --color-olive-50: oklch(98.8% 0.003 106.5);\n --color-olive-100: oklch(96.6% 0.005 106.5);\n --color-olive-200: oklch(93% 0.007 106.5);\n --color-olive-300: oklch(88% 0.011 106.6);\n --color-olive-400: oklch(73.7% 0.021 106.9);\n --color-olive-500: oklch(58% 0.031 107.3);\n --color-olive-600: oklch(46.6% 0.025 107.3);\n --color-olive-700: oklch(39.4% 0.023 107.4);\n --color-olive-800: oklch(28.6% 0.016 107.4);\n --color-olive-900: oklch(22.8% 0.013 107.4);\n --color-olive-950: oklch(15.3% 0.006 107.1);\n\n --color-mist-50: oklch(98.7% 0.002 197.1);\n --color-mist-100: oklch(96.3% 0.002 197.1);\n --color-mist-200: oklch(92.5% 0.005 214.3);\n --color-mist-300: oklch(87.2% 0.007 219.6);\n --color-mist-400: oklch(72.3% 0.014 214.4);\n --color-mist-500: oklch(56% 0.021 213.5);\n --color-mist-600: oklch(45% 0.017 213.2);\n --color-mist-700: oklch(37.8% 0.015 216);\n --color-mist-800: oklch(27.5% 0.011 216.9);\n --color-mist-900: oklch(21.8% 0.008 223.9);\n --color-mist-950: oklch(14.8% 0.004 228.8);\n\n --color-taupe-50: oklch(98.6% 0.002 67.8);\n --color-taupe-100: oklch(96% 0.002 17.2);\n --color-taupe-200: oklch(92.2% 0.005 34.3);\n --color-taupe-300: oklch(86.8% 0.007 39.5);\n --color-taupe-400: oklch(71.4% 0.014 41.2);\n --color-taupe-500: oklch(54.7% 0.021 43.1);\n --color-taupe-600: oklch(43.8% 0.017 39.3);\n --color-taupe-700: oklch(36.7% 0.016 35.7);\n --color-taupe-800: oklch(26.8% 0.011 36.5);\n --color-taupe-900: oklch(21.4% 0.009 43.1);\n --color-taupe-950: oklch(14.7% 0.004 49.3);\n\n --color-black: #000;\n --color-white: #fff;\n\n --spacing: 0.25rem;\n\n --breakpoint-sm: 40rem;\n --breakpoint-md: 48rem;\n --breakpoint-lg: 64rem;\n --breakpoint-xl: 80rem;\n --breakpoint-2xl: 96rem;\n\n --container-3xs: 16rem;\n --container-2xs: 18rem;\n --container-xs: 20rem;\n --container-sm: 24rem;\n --container-md: 28rem;\n --container-lg: 32rem;\n --container-xl: 36rem;\n --container-2xl: 42rem;\n --container-3xl: 48rem;\n --container-4xl: 56rem;\n --container-5xl: 64rem;\n --container-6xl: 72rem;\n --container-7xl: 80rem;\n\n --text-xs: 0.75rem;\n --text-xs--line-height: calc(1 / 0.75);\n --text-sm: 0.875rem;\n --text-sm--line-height: calc(1.25 / 0.875);\n --text-base: 1rem;\n --text-base--line-height: calc(1.5 / 1);\n --text-lg: 1.125rem;\n --text-lg--line-height: calc(1.75 / 1.125);\n --text-xl: 1.25rem;\n --text-xl--line-height: calc(1.75 / 1.25);\n --text-2xl: 1.5rem;\n --text-2xl--line-height: calc(2 / 1.5);\n --text-3xl: 1.875rem;\n --text-3xl--line-height: calc(2.25 / 1.875);\n --text-4xl: 2.25rem;\n --text-4xl--line-height: calc(2.5 / 2.25);\n --text-5xl: 3rem;\n --text-5xl--line-height: 1;\n --text-6xl: 3.75rem;\n --text-6xl--line-height: 1;\n --text-7xl: 4.5rem;\n --text-7xl--line-height: 1;\n --text-8xl: 6rem;\n --text-8xl--line-height: 1;\n --text-9xl: 8rem;\n --text-9xl--line-height: 1;\n\n --font-weight-thin: 100;\n --font-weight-extralight: 200;\n --font-weight-light: 300;\n --font-weight-normal: 400;\n --font-weight-medium: 500;\n --font-weight-semibold: 600;\n --font-weight-bold: 700;\n --font-weight-extrabold: 800;\n --font-weight-black: 900;\n\n --tracking-tighter: -0.05em;\n --tracking-tight: -0.025em;\n --tracking-normal: 0em;\n --tracking-wide: 0.025em;\n --tracking-wider: 0.05em;\n --tracking-widest: 0.1em;\n\n --leading-tight: 1.25;\n --leading-snug: 1.375;\n --leading-normal: 1.5;\n --leading-relaxed: 1.625;\n --leading-loose: 2;\n\n --radius-xs: 0.125rem;\n --radius-sm: 0.25rem;\n --radius-md: 0.375rem;\n --radius-lg: 0.5rem;\n --radius-xl: 0.75rem;\n --radius-2xl: 1rem;\n --radius-3xl: 1.5rem;\n --radius-4xl: 2rem;\n\n --shadow-2xs: 0 1px rgb(0 0 0 / 0.05);\n --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);\n --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);\n --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);\n --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);\n --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);\n --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);\n\n --inset-shadow-2xs: inset 0 1px rgb(0 0 0 / 0.05);\n --inset-shadow-xs: inset 0 1px 1px rgb(0 0 0 / 0.05);\n --inset-shadow-sm: inset 0 2px 4px rgb(0 0 0 / 0.05);\n\n --drop-shadow-xs: 0 1px 1px rgb(0 0 0 / 0.05);\n --drop-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.15);\n --drop-shadow-md: 0 3px 3px rgb(0 0 0 / 0.12);\n --drop-shadow-lg: 0 4px 4px rgb(0 0 0 / 0.15);\n --drop-shadow-xl: 0 9px 7px rgb(0 0 0 / 0.1);\n --drop-shadow-2xl: 0 25px 25px rgb(0 0 0 / 0.15);\n\n --text-shadow-2xs: 0px 1px 0px rgb(0 0 0 / 0.15);\n --text-shadow-xs: 0px 1px 1px rgb(0 0 0 / 0.2);\n --text-shadow-sm:\n 0px 1px 0px rgb(0 0 0 / 0.075), 0px 1px 1px rgb(0 0 0 / 0.075), 0px 2px 2px rgb(0 0 0 / 0.075);\n --text-shadow-md:\n 0px 1px 1px rgb(0 0 0 / 0.1), 0px 1px 2px rgb(0 0 0 / 0.1), 0px 2px 4px rgb(0 0 0 / 0.1);\n --text-shadow-lg:\n 0px 1px 2px rgb(0 0 0 / 0.1), 0px 3px 2px rgb(0 0 0 / 0.1), 0px 4px 8px rgb(0 0 0 / 0.1);\n\n --ease-in: cubic-bezier(0.4, 0, 1, 1);\n --ease-out: cubic-bezier(0, 0, 0.2, 1);\n --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);\n\n --animate-spin: spin 1s linear infinite;\n --animate-ping: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;\n --animate-pulse: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;\n --animate-bounce: bounce 1s infinite;\n\n @keyframes spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n @keyframes ping {\n 75%,\n 100% {\n transform: scale(2);\n opacity: 0;\n }\n }\n\n @keyframes pulse {\n 50% {\n opacity: 0.5;\n }\n }\n\n @keyframes bounce {\n 0%,\n 100% {\n transform: translateY(-25%);\n animation-timing-function: cubic-bezier(0.8, 0, 1, 1);\n }\n\n 50% {\n transform: none;\n animation-timing-function: cubic-bezier(0, 0, 0.2, 1);\n }\n }\n\n --blur-xs: 4px;\n --blur-sm: 8px;\n --blur-md: 12px;\n --blur-lg: 16px;\n --blur-xl: 24px;\n --blur-2xl: 40px;\n --blur-3xl: 64px;\n\n --perspective-dramatic: 100px;\n --perspective-near: 300px;\n --perspective-normal: 500px;\n --perspective-midrange: 800px;\n --perspective-distant: 1200px;\n\n --aspect-video: 16 / 9;\n\n --default-transition-duration: 150ms;\n --default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n --default-font-family: --theme(--font-sans, initial);\n --default-font-feature-settings: --theme(--font-sans--font-feature-settings, initial);\n --default-font-variation-settings: --theme(--font-sans--font-variation-settings, initial);\n --default-mono-font-family: --theme(--font-mono, initial);\n --default-mono-font-feature-settings: --theme(--font-mono--font-feature-settings, initial);\n --default-mono-font-variation-settings: --theme(--font-mono--font-variation-settings, initial);\n}\n\n/* Deprecated */\n@theme default inline reference {\n --blur: 8px;\n --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);\n --shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);\n --drop-shadow: 0 1px 2px rgb(0 0 0 / 0.1), 0 1px 1px rgb(0 0 0 / 0.06);\n --radius: 0.25rem;\n --max-width-prose: 65ch;\n}\n",
751
+ utilities: "@tailwind utilities;\n"
752
+ };
753
+
754
+ /** Does this stylesheet ask for Tailwind at all? */
755
+ var usesTailwind = function usesTailwind(css) {
756
+ return /@import\s+["']tailwindcss/.test(css) || /@tailwind\s+\w/.test(css);
757
+ };
758
+
759
+ /**
760
+ * Directives that need something this build does not have.
761
+ *
762
+ * `@plugin` and `@config` both go through Tailwind's `loadModule`, which means
763
+ * resolving and *executing* a JS module at CSS-compile time. That is a real
764
+ * feature gap rather than a shortcut -- and a solvable one, since a plugin is a
765
+ * dependency the project declares and the vendor layer already builds those --
766
+ * but it is not built, so it fails loudly.
767
+ *
768
+ * `@source` is different: it points the scanner at paths, and candidates here
769
+ * come from the project's files rather than from a glob. Harmless to ignore,
770
+ * worth saying so.
771
+ */
772
+ var UNSUPPORTED = [["@source", "points the scanner at paths; candidates come from the project files here"]];
773
+
774
+ /**
775
+ * Loads a JS module for `@plugin` / `@config`.
776
+ *
777
+ * Tailwind resolves and *executes* these while compiling CSS, which is the one
778
+ * thing this build cannot do on its own: there is no module resolution here,
779
+ * only a fixed set of externals. So it is a capability the caller supplies --
780
+ * `packages/publish` has a real filesystem and node_modules and passes one; a
781
+ * browser build has neither and does not.
782
+ *
783
+ * Absent, this throws rather than returning an empty plugin. A plugin that
784
+ * silently does nothing leaves a page subtly unstyled, which is much harder to
785
+ * diagnose than a build that stops and names the directive -- and it would make
786
+ * the same project build differently depending on where it was published.
787
+ */
788
+
789
+ /**
790
+ * Derived from Tailwind's own option rather than restated.
791
+ *
792
+ * It used to be restated -- `(id, base, hint: string) => Promise<{ module:
793
+ * unknown; base: string }>` -- and the restatement was WRONG: Tailwind also
794
+ * wants a `path`, and the loader in the CLI never sent one. Nothing caught it
795
+ * because the package this came from ran under `--experimental-strip-types`,
796
+ * which strips types without checking them, so the mismatch was invisible on
797
+ * both sides of the call.
798
+ *
799
+ * Derived, a Tailwind upgrade that changes the shape is a compile error here
800
+ * -- which is where it can be read -- rather than an `undefined` handed to
801
+ * someone else's code.
802
+ */
803
+
804
+ /** What a `@plugin` / `@config` module has to be, once it is loaded. */
805
+
806
+ var refuseModule = function refuseModule() {
807
+ return function (id, _base, hint) {
808
+ throw new Error("Tailwind's '@".concat(hint, "' is not supported here: '").concat(id, "' would have to be resolved and ") + "executed while compiling CSS, and this build has no module loader for that. " + "Publishing through the CLI does support it; a browser build does not. " + "Otherwise, remove the directive or express it with @theme/@utility/@custom-variant.");
809
+ };
810
+ };
811
+
812
+ /**
813
+ * Characters that can appear in a Tailwind candidate.
814
+ *
815
+ * Tailwind's real extractor is a Rust state machine over arbitrary text; this
816
+ * is the same idea with a blunter instrument. It over-supplies heavily -- every
817
+ * identifier in the source becomes a candidate -- and that is the safe
818
+ * direction, because `build()` silently drops anything it does not recognise
819
+ * while a missed candidate is a missing style with no error anywhere.
820
+ *
821
+ * Includes `:` for variants (`hover:`, `md:`), `[` `]` and `(` `)` for
822
+ * arbitrary values (`w-[32px]`, `bg-(--brand)`), `/` for opacity (`bg-red-500/50`),
823
+ * `!` and `-` for modifiers.
824
+ */
825
+ var CANDIDATE = /[A-Za-z0-9_@!.:/%[\]()#&$*+,<>=^~|-]+/g;
826
+
827
+ /** Source extensions worth scanning. Stylesheets are the input, not a source. */
828
+ var SCANNABLE = /\.(tsx?|jsx?|mdx?|html|svelte|vue)$/;
829
+
830
+ /**
831
+ * Candidates for `build()`, extracted from the project's own source.
832
+ *
833
+ * Every string in every module, not just JSX class attributes: a class name can
834
+ * be built anywhere -- a `cn()` helper, a lookup table, a constant in another
835
+ * file -- and Tailwind's own scanner makes the same choice for the same reason.
836
+ */
837
+ function scanCandidates(files) {
838
+ var found = new Set();
839
+ for (var _i = 0, _Object$entries = Object.entries(files); _i < _Object$entries.length; _i++) {
840
+ var _Object$entries$_i = slicedToArray._slicedToArray(_Object$entries[_i], 2),
841
+ path = _Object$entries$_i[0],
842
+ code = _Object$entries$_i[1];
843
+ if (!SCANNABLE.test(path)) continue;
844
+ var _iterator = slicedToArray._createForOfIteratorHelper(code.matchAll(CANDIDATE)),
845
+ _step;
846
+ try {
847
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
848
+ var match = _step.value;
849
+ found.add(match[0]);
850
+ }
851
+ } catch (err) {
852
+ _iterator.e(err);
853
+ } finally {
854
+ _iterator.f();
855
+ }
856
+ }
857
+ return slicedToArray._toConsumableArray(found);
858
+ }
859
+ /**
860
+ * Resolves `@import "tailwindcss"` and friends from the inlined stylesheets.
861
+ *
862
+ * Tailwind asks for these by package-relative id (`tailwindcss`,
863
+ * `tailwindcss/theme.css`). Anything else is a project stylesheet, which the
864
+ * CSS pass has already inlined by the time this runs -- so an unresolved id
865
+ * here is a genuine error rather than something to paper over.
866
+ */
867
+ function loadStylesheet(_x) {
868
+ return _loadStylesheet.apply(this, arguments);
869
+ }
870
+ /**
871
+ * Runs the project's stylesheet through Tailwind.
872
+ *
873
+ * The input is the *already concatenated* project CSS, so a project's own rules
874
+ * and its `@import "tailwindcss"` are compiled together and the cascade order
875
+ * the CSS pass worked out is preserved.
876
+ */
877
+ function _loadStylesheet() {
878
+ _loadStylesheet = slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function _callee(id) {
879
+ var name, content;
880
+ return slicedToArray._regenerator().w(function (_context) {
881
+ while (1) switch (_context.n) {
882
+ case 0:
883
+ name = id.replace(/^tailwindcss\/?/, "").replace(/\.css$/, "") || "index";
884
+ content = TAILWIND_SOURCES[name];
885
+ if (!(content === undefined)) {
886
+ _context.n = 1;
887
+ break;
888
+ }
889
+ throw new Error("Tailwind asked for '".concat(id, "', which this build does not carry. ") + "Available: ".concat(Object.keys(TAILWIND_SOURCES).join(", "), "."));
890
+ case 1:
891
+ return _context.a(2, {
892
+ path: "tailwindcss/".concat(name, ".css"),
893
+ base: "/",
894
+ content: content
895
+ });
896
+ }
897
+ }, _callee);
898
+ }));
899
+ return _loadStylesheet.apply(this, arguments);
900
+ }
901
+ function compileTailwind(_x2, _x3, _x4) {
902
+ return _compileTailwind.apply(this, arguments);
903
+ }
904
+ function _compileTailwind() {
905
+ _compileTailwind = slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function _callee2(css, files, loadModule) {
906
+ var started, warnings, _iterator2, _step2, _step2$value, directive, why, compiler, candidates;
907
+ return slicedToArray._regenerator().w(function (_context2) {
908
+ while (1) switch (_context2.n) {
909
+ case 0:
910
+ started = performance.now();
911
+ warnings = [];
912
+ _iterator2 = slicedToArray._createForOfIteratorHelper(UNSUPPORTED);
913
+ try {
914
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
915
+ _step2$value = slicedToArray._slicedToArray(_step2.value, 2), directive = _step2$value[0], why = _step2$value[1];
916
+ if (new RegExp("^\\s*".concat(directive, "\\b"), "m").test(css)) {
917
+ warnings.push("'".concat(directive, "' is not supported: it ").concat(why, "."));
918
+ }
919
+ }
920
+ } catch (err) {
921
+ _iterator2.e(err);
922
+ } finally {
923
+ _iterator2.f();
924
+ }
925
+ _context2.n = 1;
926
+ return tailwindcss.compile(css, {
927
+ base: "/",
928
+ loadStylesheet: loadStylesheet,
929
+ loadModule: loadModule !== null && loadModule !== void 0 ? loadModule : refuseModule()
930
+ });
931
+ case 1:
932
+ compiler = _context2.v;
933
+ candidates = scanCandidates(files);
934
+ return _context2.a(2, {
935
+ css: compiler.build(candidates),
936
+ warnings: warnings,
937
+ candidates: candidates.length,
938
+ ms: performance.now() - started
939
+ });
940
+ }
941
+ }, _callee2);
942
+ }));
943
+ return _compileTailwind.apply(this, arguments);
944
+ }
945
+
946
+ /**
947
+ * Extensions treated as assets.
948
+ *
949
+ * Deliberately a list rather than "anything not JS or CSS": an unknown
950
+ * extension should fail as an unresolved import naming the file, not silently
951
+ * become a URL to something the browser cannot use.
952
+ */
953
+ var ASSET_TYPES = {
954
+ ".png": "image/png",
955
+ ".jpg": "image/jpeg",
956
+ ".jpeg": "image/jpeg",
957
+ ".gif": "image/gif",
958
+ ".webp": "image/webp",
959
+ ".avif": "image/avif",
960
+ ".svg": "image/svg+xml",
961
+ ".ico": "image/x-icon",
962
+ ".woff": "font/woff",
963
+ ".woff2": "font/woff2",
964
+ ".ttf": "font/ttf",
965
+ ".otf": "font/otf",
966
+ ".mp4": "video/mp4",
967
+ ".webm": "video/webm",
968
+ ".mp3": "audio/mpeg",
969
+ ".wav": "audio/wav",
970
+ ".pdf": "application/pdf",
971
+ ".txt": "text/plain"
972
+ };
973
+ var extensionOf = function extensionOf(path) {
974
+ var at = path.lastIndexOf(".");
975
+ return at === -1 ? "" : path.slice(at).toLowerCase();
976
+ };
977
+ var isAsset = function isAsset(path) {
978
+ return extensionOf(path) in ASSET_TYPES;
979
+ };
980
+ var mimeOf = function mimeOf(path) {
981
+ var _ASSET_TYPES$extensio;
982
+ return (_ASSET_TYPES$extensio = ASSET_TYPES[extensionOf(path)]) !== null && _ASSET_TYPES$extensio !== void 0 ? _ASSET_TYPES$extensio : "application/octet-stream";
983
+ };
984
+
985
+ /**
986
+ * Below this many decoded bytes, an asset is inlined as a data URI.
987
+ *
988
+ * 4 kB, matching Vite's `assetsInlineLimit` default. The trade is the same one
989
+ * Vite is making: an extra request costs more than 4 kB of base64 does, and
990
+ * above that it stops being true.
991
+ */
992
+ var INLINE_LIMIT = 4096;
993
+
994
+ /** Decoded byte length of base64, without decoding it. */
995
+ function base64Bytes(base64) {
996
+ var clean = base64.replace(/=+$/, "");
997
+ return Math.floor(clean.length * 3 / 4);
998
+ }
999
+ /**
1000
+ * Where an asset import resolves to, for one target.
1001
+ *
1002
+ * Server and client get the *same* URL. An asset is a URL in both, and SSR has
1003
+ * to emit the same `src` the browser will hydrate against -- a server bundle
1004
+ * with a different URL would be a hydration mismatch on every image.
1005
+ */
1006
+ function resolveAsset(_x, _x2) {
1007
+ return _resolveAsset.apply(this, arguments);
1008
+ }
1009
+
1010
+ /** Where published assets are served from. Matched by the loader. */
1011
+ function _resolveAsset() {
1012
+ _resolveAsset = slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function _callee(path, base64) {
1013
+ var hash, name;
1014
+ return slicedToArray._regenerator().w(function (_context) {
1015
+ while (1) switch (_context.n) {
1016
+ case 0:
1017
+ if (!(base64Bytes(base64) <= INLINE_LIMIT)) {
1018
+ _context.n = 1;
1019
+ break;
1020
+ }
1021
+ return _context.a(2, {
1022
+ url: "data:".concat(mimeOf(path), ";base64,").concat(base64)
1023
+ });
1024
+ case 1:
1025
+ _context.n = 2;
1026
+ return sha256Hex(base64);
1027
+ case 2:
1028
+ hash = _context.v.slice(0, 16);
1029
+ name = "".concat(hash).concat(extensionOf(path));
1030
+ return _context.a(2, {
1031
+ url: "".concat(ASSET_BASE).concat(name),
1032
+ file: {
1033
+ name: name,
1034
+ base64: base64
1035
+ }
1036
+ });
1037
+ }
1038
+ }, _callee);
1039
+ }));
1040
+ return _resolveAsset.apply(this, arguments);
1041
+ }
1042
+ var ASSET_BASE = "/_app/a/";
1043
+
1044
+ /** The module a resolved asset import becomes. */
1045
+ var assetModule = function assetModule(url) {
1046
+ return "export default ".concat(JSON.stringify(url), "\n");
1047
+ };
1048
+
1049
+ /** Cheap pre-filter: skip the parse unless one of these appears in the source. */
1050
+ var MARKERS = ["createIsomorphicFn", "createServerOnlyFn", "createClientOnlyFn", "createMiddleware", "ClientOnly"];
1051
+
1052
+ /** Walks a `foo().bar().baz()` chain down to its root callee identifier. */
1053
+ function chainRoot(node) {
1054
+ var current = node;
1055
+ while (current) {
1056
+ if (current.type === "CallExpression") {
1057
+ var callee = current.callee;
1058
+ if ((callee === null || callee === void 0 ? void 0 : callee.type) === "Identifier") return String(callee.name);
1059
+ if ((callee === null || callee === void 0 ? void 0 : callee.type) === "MemberExpression") {
1060
+ current = callee.object;
1061
+ continue;
1062
+ }
1063
+ return null;
1064
+ }
1065
+ return null;
1066
+ }
1067
+ return null;
1068
+ }
1069
+
1070
+ /**
1071
+ * True when this call is the whole chain rather than a link in a longer one.
1072
+ *
1073
+ * Without this, `createIsomorphicFn().client(a).server(b)` matches three times
1074
+ * and the inner replacements land inside text the outer one is about to
1075
+ * replace.
1076
+ */
1077
+ function isOutermost(node, stack) {
1078
+ var parent = stack[stack.length - 1];
1079
+ var grandparent = stack[stack.length - 2];
1080
+ return !((parent === null || parent === void 0 ? void 0 : parent.type) === "MemberExpression" && parent.object === node && (grandparent === null || grandparent === void 0 ? void 0 : grandparent.type) === "CallExpression");
1081
+ }
1082
+
1083
+ /** Collects `.method(arg)` calls along a chain, nearest-root first. */
1084
+ function methodsOf(node) {
1085
+ var found = new Map();
1086
+ var current = node;
1087
+ while (((_current = current) === null || _current === void 0 ? void 0 : _current.type) === "CallExpression") {
1088
+ var _current, _name, _callee$property, _current$arguments;
1089
+ var callee = current.callee;
1090
+ if ((callee === null || callee === void 0 ? void 0 : callee.type) !== "MemberExpression") break;
1091
+ var name = String((_name = (_callee$property = callee.property) === null || _callee$property === void 0 ? void 0 : _callee$property.name) !== null && _name !== void 0 ? _name : "");
1092
+ // Nearest-to-root wins, so a later duplicate does not shadow the first.
1093
+ found.set(name, {
1094
+ call: current,
1095
+ arg: (_current$arguments = current.arguments) === null || _current$arguments === void 0 ? void 0 : _current$arguments[0],
1096
+ objectEnd: callee.object.end
1097
+ });
1098
+ current = callee.object;
1099
+ }
1100
+ return found;
1101
+ }
1102
+ /**
1103
+ * Rewrites the environment markers in one module for one target.
1104
+ *
1105
+ * Returns `null` when the module contains none, so the caller leaves it alone
1106
+ * and pays no parse.
1107
+ */
1108
+ function transformEnvMarkers(_x, _x2, _x3) {
1109
+ return _transformEnvMarkers.apply(this, arguments);
1110
+ }
1111
+ function _transformEnvMarkers() {
1112
+ _transformEnvMarkers = slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function _callee(moduleId, code, target) {
1113
+ var ast, imported, edits, applied, text;
1114
+ return slicedToArray._regenerator().w(function (_context) {
1115
+ while (1) switch (_context.n) {
1116
+ case 0:
1117
+ if (MARKERS.some(function (marker) {
1118
+ return code.includes(marker);
1119
+ })) {
1120
+ _context.n = 1;
1121
+ break;
1122
+ }
1123
+ return _context.a(2, null);
1124
+ case 1:
1125
+ _context.n = 2;
1126
+ return parse(moduleId, code);
1127
+ case 2:
1128
+ ast = _context.v;
1129
+ imported = tanstackImports(ast);
1130
+ if (!(imported.size === 0)) {
1131
+ _context.n = 3;
1132
+ break;
1133
+ }
1134
+ return _context.a(2, null);
1135
+ case 3:
1136
+ edits = [];
1137
+ applied = [];
1138
+ text = function text(node) {
1139
+ return code.slice(node.start, node.end);
1140
+ };
1141
+ walk(ast, function (node, stack) {
1142
+ // --- handleClientOnlyJSX ---------------------------------------------
1143
+ // On the server the children of <ClientOnly> are dropped and the element
1144
+ // becomes self-closing, so only the fallback renders.
1145
+ if (node.type === "JSXElement" && target === "server") {
1146
+ var _opening$name;
1147
+ var opening = node.openingElement;
1148
+ var name = opening === null || opening === void 0 || (_opening$name = opening.name) === null || _opening$name === void 0 ? void 0 : _opening$name.name;
1149
+ if (name === "ClientOnly" && imported.has("ClientOnly") && !opening.selfClosing) {
1150
+ // From the `>` of the opening tag through the closing tag becomes `/>`.
1151
+ edits.push({
1152
+ start: opening.end - 1,
1153
+ end: node.end,
1154
+ text: " />"
1155
+ });
1156
+ applied.push("ClientOnly");
1157
+ }
1158
+ return;
1159
+ }
1160
+ if (node.type !== "CallExpression") return;
1161
+
1162
+ // --- handleEnvOnly ----------------------------------------------------
1163
+ // createServerOnlyFn(fn) is `fn` on the server and a throwing stub on the
1164
+ // client; createClientOnlyFn the mirror image. A stub rather than a no-op,
1165
+ // because silently doing nothing is how a server-only call in a tab turns
1166
+ // into a confusing downstream failure instead of a clear one.
1167
+ var callee = node.callee;
1168
+ if ((callee === null || callee === void 0 ? void 0 : callee.type) === "Identifier") {
1169
+ var _name2 = String(callee.name);
1170
+ var envOnly = _name2 === "createServerOnlyFn" ? "server" : _name2 === "createClientOnlyFn" ? "client" : null;
1171
+ if (envOnly && imported.has(_name2)) {
1172
+ var _node$arguments;
1173
+ var inner = (_node$arguments = node.arguments) === null || _node$arguments === void 0 ? void 0 : _node$arguments[0];
1174
+ if (!inner) {
1175
+ throw new Error("".concat(moduleId, ": ").concat(_name2, "() must be called with a function."));
1176
+ }
1177
+ edits.push({
1178
+ start: node.start,
1179
+ end: node.end,
1180
+ text: target === envOnly ? text(inner) : "(() => { throw new Error(".concat(JSON.stringify("".concat(_name2, "() functions can only be called on the ").concat(envOnly, "!")), ") })")
1181
+ });
1182
+ applied.push(_name2);
1183
+ }
1184
+ return;
1185
+ }
1186
+ if ((callee === null || callee === void 0 ? void 0 : callee.type) !== "MemberExpression" || !isOutermost(node, stack)) return;
1187
+ var root = chainRoot(node);
1188
+ if (!root || !imported.has(root)) return;
1189
+
1190
+ // --- handleCreateIsomorphicFn ----------------------------------------
1191
+ // The whole chain collapses to this environment's implementation. With no
1192
+ // implementation for this environment, a no-op -- which is what Start does,
1193
+ // and what makes a `.server()`-only isomorphic fn safe to reference in a
1194
+ // browser.
1195
+ if (root === "createIsomorphicFn") {
1196
+ var methods = methodsOf(node);
1197
+ var chosen = methods.get(target);
1198
+ if (chosen && !chosen.arg) {
1199
+ throw new Error("".concat(moduleId, ": createIsomorphicFn().").concat(target, "() must be called with a function."));
1200
+ }
1201
+ edits.push({
1202
+ start: node.start,
1203
+ end: node.end,
1204
+ text: chosen !== null && chosen !== void 0 && chosen.arg ? text(chosen.arg) : "(() => {})"
1205
+ });
1206
+ applied.push("createIsomorphicFn");
1207
+ return;
1208
+ }
1209
+
1210
+ // --- handleCreateMiddleware -------------------------------------------
1211
+ // Client only, and it strips rather than replaces: the middleware object
1212
+ // survives, but its `.server()` body and validators do not reach the
1213
+ // browser. Upstream this pass throws if run on the server, which is the
1214
+ // clearest statement that the server keeps everything.
1215
+ if (root === "createMiddleware" && target === "client") {
1216
+ for (var _i = 0, _arr = ["server", "validator", "inputValidator"]; _i < _arr.length; _i++) {
1217
+ var _name3 = _arr[_i];
1218
+ var method = methodsOf(node).get(_name3);
1219
+ if (!method) continue;
1220
+ if (_name3 !== "server" && !method.arg) {
1221
+ throw new Error("".concat(moduleId, ": createMiddleware().").concat(_name3, "() must be called with a validator."));
1222
+ }
1223
+ // Drop `.name(...)`, leaving the object it was called on.
1224
+ edits.push({
1225
+ start: method.objectEnd,
1226
+ end: method.call.end,
1227
+ text: ""
1228
+ });
1229
+ applied.push("createMiddleware.".concat(_name3));
1230
+ }
1231
+ }
1232
+ });
1233
+ if (!(edits.length === 0)) {
1234
+ _context.n = 4;
1235
+ break;
1236
+ }
1237
+ return _context.a(2, null);
1238
+ case 4:
1239
+ return _context.a(2, {
1240
+ code: applyEdits(code, edits),
1241
+ applied: applied
1242
+ });
1243
+ }
1244
+ }, _callee);
1245
+ }));
1246
+ return _transformEnvMarkers.apply(this, arguments);
1247
+ }
1248
+
1249
+ /**
1250
+ * The names Start deletes from the client build.
1251
+ *
1252
+ * `ssr` and `headers` are server-rendering decisions with no client meaning;
1253
+ * `server` is the route's HTTP handlers. Kept as a literal set rather than
1254
+ * derived, so it can be diffed against Start's when versions move.
1255
+ */
1256
+ var SERVER_ONLY_OPTIONS = new Set(["ssr", "server", "headers"]);
1257
+
1258
+ /**
1259
+ * The route constructors whose options object this applies to.
1260
+ *
1261
+ * Matches Start's `allCreateRouteFns`. `createLazyFileRoute` is deliberately
1262
+ * absent: a lazy route file carries only the client half, so there is nothing
1263
+ * server-only in it to delete.
1264
+ */
1265
+ var ROUTE_FNS = new Set(["createFileRoute", "createRootRoute", "createRootRouteWithContext"]);
1266
+
1267
+ /** Cheap pre-filter, so a module with no route call is never parsed. */
1268
+ var shouldRun = function shouldRun(code) {
1269
+ return slicedToArray._toConsumableArray(ROUTE_FNS).some(function (name) {
1270
+ return code.includes(name);
1271
+ }) && slicedToArray._toConsumableArray(SERVER_ONLY_OPTIONS).some(function (name) {
1272
+ return code.includes(name);
1273
+ });
1274
+ };
1275
+ /**
1276
+ * The options object of a route call, in either of its two shapes.
1277
+ *
1278
+ * createRootRoute({ ... }) the argument
1279
+ * createFileRoute('/x')({ ... }) the argument of the *returned* call
1280
+ */
1281
+ function routeOptionsOf(node, stack) {
1282
+ var _node$arguments;
1283
+ var parent = stack[stack.length - 1];
1284
+ var direct = (_node$arguments = node.arguments) === null || _node$arguments === void 0 ? void 0 : _node$arguments[0];
1285
+ if ((parent === null || parent === void 0 ? void 0 : parent.type) === "CallExpression" && parent.callee === node) {
1286
+ var _parent$arguments;
1287
+ var curried = (_parent$arguments = parent.arguments) === null || _parent$arguments === void 0 ? void 0 : _parent$arguments[0];
1288
+ return (curried === null || curried === void 0 ? void 0 : curried.type) === "ObjectExpression" ? curried : null;
1289
+ }
1290
+ return (direct === null || direct === void 0 ? void 0 : direct.type) === "ObjectExpression" ? direct : null;
1291
+ }
1292
+
1293
+ /** A property's own name, for the plain `key: value` form only. */
1294
+ function propertyName(property) {
1295
+ // Matching Start, which filters on `isObjectProperty`: a shorthand method
1296
+ // (`server() {}`) and a spread are both left alone. A method would be a
1297
+ // strange way to write these options, and a spread cannot be read statically.
1298
+ if (property.type !== "Property" || property.method) return null;
1299
+ var key = property.key;
1300
+ if (!key) return null;
1301
+ if (property.computed) return null;
1302
+ if (key.type === "Identifier") return String(key.name);
1303
+ if (key.type === "Literal") return String(key.value);
1304
+ return null;
1305
+ }
1306
+
1307
+ /**
1308
+ * Edits that delete the flagged properties of one object literal.
1309
+ *
1310
+ * Deleting each property on its own does not work. A property's own range
1311
+ * leaves the comma behind (`{ a: 1, , c: 3 }`, which does not parse), and
1312
+ * extending each one over its neighbouring comma makes *adjacent* deletions
1313
+ * overlap -- two edits claiming the same comma, which corrupts the source
1314
+ * rather than failing.
1315
+ *
1316
+ * So deletions are grouped into runs of consecutive properties, and each run
1317
+ * takes exactly one comma: the one before it when it has a surviving property
1318
+ * to its left, the one after it otherwise.
1319
+ */
1320
+ function deleteProperties(code, properties, doomed) {
1321
+ var edits = [];
1322
+ for (var i = 0; i < properties.length; i++) {
1323
+ if (!doomed.has(properties[i])) continue;
1324
+ var j = i;
1325
+ while (j + 1 < properties.length && doomed.has(properties[j + 1])) j++;
1326
+ if (i > 0) {
1327
+ // From the end of the property before the run, which takes the comma
1328
+ // separating them.
1329
+ edits.push({
1330
+ start: properties[i - 1].end,
1331
+ end: properties[j].end,
1332
+ text: ""
1333
+ });
1334
+ } else if (j + 1 < properties.length) {
1335
+ // Run starts the object: take the comma that follows it instead.
1336
+ edits.push({
1337
+ start: properties[0].start,
1338
+ end: properties[j + 1].start,
1339
+ text: ""
1340
+ });
1341
+ } else {
1342
+ // The whole object goes. There is no separating comma, but there may be
1343
+ // a trailing one, and `{ , }` does not parse any better than `{ ,`.
1344
+ var end = properties[j].end;
1345
+ var cursor = end;
1346
+ while (cursor < code.length && /\s/.test(code[cursor])) cursor++;
1347
+ if (code[cursor] === ",") end = cursor + 1;
1348
+ edits.push({
1349
+ start: properties[0].start,
1350
+ end: end,
1351
+ text: ""
1352
+ });
1353
+ }
1354
+ i = j;
1355
+ }
1356
+ return edits;
1357
+ }
1358
+
1359
+ /**
1360
+ * Removes server-only route options from one module.
1361
+ *
1362
+ * Returns `null` when there is nothing to do, so the caller pays no parse.
1363
+ * Server and rsc targets always get `null`: they are the ones that need these.
1364
+ */
1365
+ function transformRouteNodes(_x, _x2, _x3) {
1366
+ return _transformRouteNodes.apply(this, arguments);
1367
+ }
1368
+ function _transformRouteNodes() {
1369
+ _transformRouteNodes = slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function _callee(moduleId, code, target) {
1370
+ var ast, imported, edits, removed;
1371
+ return slicedToArray._regenerator().w(function (_context) {
1372
+ while (1) switch (_context.n) {
1373
+ case 0:
1374
+ if (!(target !== "client")) {
1375
+ _context.n = 1;
1376
+ break;
1377
+ }
1378
+ return _context.a(2, null);
1379
+ case 1:
1380
+ if (shouldRun(code)) {
1381
+ _context.n = 2;
1382
+ break;
1383
+ }
1384
+ return _context.a(2, null);
1385
+ case 2:
1386
+ _context.n = 3;
1387
+ return parse(moduleId, code);
1388
+ case 3:
1389
+ ast = _context.v;
1390
+ imported = tanstackImports(ast);
1391
+ if (!(imported.size === 0)) {
1392
+ _context.n = 4;
1393
+ break;
1394
+ }
1395
+ return _context.a(2, null);
1396
+ case 4:
1397
+ edits = [];
1398
+ removed = [];
1399
+ walk(ast, function (node, stack) {
1400
+ var _options$properties;
1401
+ if (node.type !== "CallExpression") return;
1402
+ var callee = node.callee;
1403
+ if ((callee === null || callee === void 0 ? void 0 : callee.type) !== "Identifier") return;
1404
+ var name = String(callee.name);
1405
+ if (!ROUTE_FNS.has(name) || !imported.has(name)) return;
1406
+ var options = routeOptionsOf(node, stack);
1407
+ if (!options) return;
1408
+ var properties = (_options$properties = options.properties) !== null && _options$properties !== void 0 ? _options$properties : [];
1409
+ var doomed = new Set();
1410
+ var _iterator = slicedToArray._createForOfIteratorHelper(properties),
1411
+ _step;
1412
+ try {
1413
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
1414
+ var property = _step.value;
1415
+ var key = propertyName(property);
1416
+ if (!key || !SERVER_ONLY_OPTIONS.has(key)) continue;
1417
+ doomed.add(property);
1418
+ removed.push(key);
1419
+ }
1420
+ } catch (err) {
1421
+ _iterator.e(err);
1422
+ } finally {
1423
+ _iterator.f();
1424
+ }
1425
+ if (doomed.size) edits.push.apply(edits, slicedToArray._toConsumableArray(deleteProperties(code, properties, doomed)));
1426
+ });
1427
+ if (!(edits.length === 0)) {
1428
+ _context.n = 5;
1429
+ break;
1430
+ }
1431
+ return _context.a(2, null);
1432
+ case 5:
1433
+ return _context.a(2, {
1434
+ code: applyEdits(code, edits),
1435
+ removed: removed
1436
+ });
1437
+ }
1438
+ }, _callee);
1439
+ }));
1440
+ return _transformRouteNodes.apply(this, arguments);
1441
+ }
1442
+
1443
+ /**
1444
+ * JSON with comments and trailing commas, which is what tsconfig.json is.
1445
+ *
1446
+ * Written as a scanner rather than a regex on purpose: `"url": "https://x"`
1447
+ * contains `//`, and a regex that strips comments without tracking string state
1448
+ * truncates the file there and throws a parse error pointing at the wrong line.
1449
+ */
1450
+ function parseJsonc(text) {
1451
+ var out = "";
1452
+ var i = 0;
1453
+ while (i < text.length) {
1454
+ var ch = text[i];
1455
+ if (ch === '"') {
1456
+ // Copy the whole string literal, escapes included, untouched.
1457
+ out += ch;
1458
+ i++;
1459
+ while (i < text.length) {
1460
+ var c = text[i];
1461
+ out += c;
1462
+ i++;
1463
+ if (c === "\\") {
1464
+ if (i < text.length) out += text[i++];
1465
+ continue;
1466
+ }
1467
+ if (c === '"') break;
1468
+ }
1469
+ continue;
1470
+ }
1471
+ if (ch === "/" && text[i + 1] === "/") {
1472
+ while (i < text.length && text[i] !== "\n") i++;
1473
+ continue;
1474
+ }
1475
+ if (ch === "/" && text[i + 1] === "*") {
1476
+ i += 2;
1477
+ while (i < text.length && !(text[i] === "*" && text[i + 1] === "/")) i++;
1478
+ i += 2;
1479
+ continue;
1480
+ }
1481
+ out += ch;
1482
+ i++;
1483
+ }
1484
+ // Trailing commas, now that every remaining comma is structural.
1485
+ return JSON.parse(out.replace(/,(\s*[}\]])/g, "$1"));
1486
+ }
1487
+
1488
+ /** One `paths` entry, pre-split on its wildcard. */
1489
+
1490
+ /**
1491
+ * Reads tsconfig.json out of the file record and builds the matcher.
1492
+ *
1493
+ * Returns null when the project configures no aliases, which is the common
1494
+ * case and costs nothing.
1495
+ */
1496
+ function aliasMap(files, warn) {
1497
+ var _config$compilerOptio, _config$compilerOptio2;
1498
+ var entry = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "tsconfig.json";
1499
+ var config = readConfig(files, entry, warn, new Set());
1500
+ var paths = config === null || config === void 0 || (_config$compilerOptio = config.compilerOptions) === null || _config$compilerOptio === void 0 ? void 0 : _config$compilerOptio.paths;
1501
+ var baseUrl = config === null || config === void 0 || (_config$compilerOptio2 = config.compilerOptions) === null || _config$compilerOptio2 === void 0 ? void 0 : _config$compilerOptio2.baseUrl;
1502
+ // A project can configure either one without the other, and baseUrl alone is
1503
+ // enough to change how a bare specifier resolves.
1504
+ if ((!paths || Object.keys(paths).length === 0) && baseUrl === undefined) return null;
1505
+
1506
+ // `baseUrl` is relative to the tsconfig that declared it. Since TS 4.1 paths
1507
+ // work without one, resolved against the tsconfig's own directory -- so the
1508
+ // fallback here is the directory, not the project root.
1509
+ var base = resolve(dirname(entry), baseUrl !== null && baseUrl !== void 0 ? baseUrl : ".");
1510
+ var patterns = [];
1511
+ for (var _i = 0, _Object$entries = Object.entries(paths !== null && paths !== void 0 ? paths : {}); _i < _Object$entries.length; _i++) {
1512
+ var _Object$entries$_i = slicedToArray._slicedToArray(_Object$entries[_i], 2),
1513
+ pattern = _Object$entries$_i[0],
1514
+ targets = _Object$entries$_i[1];
1515
+ var star = pattern.indexOf("*");
1516
+ if (star !== pattern.lastIndexOf("*")) {
1517
+ warn("tsconfig paths pattern '".concat(pattern, "' has more than one '*' and is ignored."));
1518
+ continue;
1519
+ }
1520
+ patterns.push({
1521
+ prefix: star === -1 ? pattern : pattern.slice(0, star),
1522
+ suffix: star === -1 ? "" : pattern.slice(star + 1),
1523
+ wildcard: star !== -1,
1524
+ targets: targets.map(function (target) {
1525
+ return resolve(base, target);
1526
+ })
1527
+ });
1528
+ }
1529
+
1530
+ // TypeScript picks the pattern with the longest literal prefix, so `@/ui/*`
1531
+ // beats `@/*` for `@/ui/card` regardless of declaration order.
1532
+ patterns.sort(function (a, b) {
1533
+ return b.prefix.length - a.prefix.length;
1534
+ });
1535
+ return {
1536
+ patterns: Object.keys(paths !== null && paths !== void 0 ? paths : {}),
1537
+ baseUrlCandidate: function baseUrlCandidate(specifier) {
1538
+ return baseUrl === undefined ? null : resolve(base, specifier);
1539
+ },
1540
+ candidates: function candidates(specifier) {
1541
+ var _loop = function _loop() {
1542
+ var pattern = _patterns[_i2];
1543
+ if (!pattern.wildcard) {
1544
+ if (specifier === pattern.prefix) return {
1545
+ v: slicedToArray._toConsumableArray(pattern.targets)
1546
+ };
1547
+ return 0; // continue
1548
+ }
1549
+ if (!specifier.startsWith(pattern.prefix) || !specifier.endsWith(pattern.suffix) || specifier.length < pattern.prefix.length + pattern.suffix.length) {
1550
+ return 0; // continue
1551
+ }
1552
+ var matched = specifier.slice(pattern.prefix.length, specifier.length - pattern.suffix.length);
1553
+ return {
1554
+ v: pattern.targets.map(function (target) {
1555
+ return target.replace("*", matched);
1556
+ })
1557
+ };
1558
+ },
1559
+ _ret;
1560
+ for (var _i2 = 0, _patterns = patterns; _i2 < _patterns.length; _i2++) {
1561
+ _ret = _loop();
1562
+ if (_ret === 0) continue;
1563
+ if (_ret) return _ret.v;
1564
+ }
1565
+ return [];
1566
+ }
1567
+ };
1568
+ }
1569
+
1570
+ /** Follows `extends` through the file record. Package extends cannot be read. */
1571
+ function readConfig(files, path, warn, seen) {
1572
+ var _config, _config$compilerOptio4, _config$compilerOptio5, _parent$compilerOptio;
1573
+ if (seen.has(path)) return null; // a cycle; whatever we have is enough
1574
+ seen.add(path);
1575
+ var text = files[path];
1576
+ if (text === undefined) return null;
1577
+ var config;
1578
+ try {
1579
+ config = parseJsonc(text);
1580
+ } catch (error) {
1581
+ var _message;
1582
+ warn("Could not parse ".concat(path, ": ").concat(String((_message = error === null || error === void 0 ? void 0 : error.message) !== null && _message !== void 0 ? _message : error)));
1583
+ return null;
1584
+ }
1585
+ if (!((_config = config) !== null && _config !== void 0 && _config["extends"])) return config;
1586
+
1587
+ // Only a relative extends can be followed: a package one ("extends":
1588
+ // "@tsconfig/node20/tsconfig.json") lives in node_modules, which a browser
1589
+ // build does not have. Worth saying out loud rather than silently resolving
1590
+ // half the aliases, because the base config is where a monorepo usually puts
1591
+ // them.
1592
+ if (!config["extends"].startsWith(".")) {
1593
+ var _config$compilerOptio3;
1594
+ if (!((_config$compilerOptio3 = config.compilerOptions) !== null && _config$compilerOptio3 !== void 0 && _config$compilerOptio3.paths)) {
1595
+ warn("".concat(path, " extends '").concat(config["extends"], "', which is a package and cannot be read here. ") + "Any 'paths' it declares will not apply -- declare them in ".concat(path, " instead."));
1596
+ }
1597
+ return config;
1598
+ }
1599
+ var parentPath = resolveConfigPath(files, resolve(dirname(path), config["extends"]));
1600
+ var parent = parentPath ? readConfig(files, parentPath, warn, seen) : null;
1601
+ if (!parent) return config;
1602
+
1603
+ // The child wins, and `paths` replaces rather than merges -- which is what
1604
+ // TypeScript does.
1605
+ return {
1606
+ compilerOptions: slicedToArray._objectSpread2(slicedToArray._objectSpread2(slicedToArray._objectSpread2({}, parent.compilerOptions), config.compilerOptions), {}, {
1607
+ // baseUrl in the parent was relative to the *parent*, and readConfig
1608
+ // returns it unresolved, so a parent baseUrl with a child that sets none
1609
+ // is the one case this gets wrong. Rare enough to name rather than model.
1610
+ paths: (_config$compilerOptio4 = (_config$compilerOptio5 = config.compilerOptions) === null || _config$compilerOptio5 === void 0 ? void 0 : _config$compilerOptio5.paths) !== null && _config$compilerOptio4 !== void 0 ? _config$compilerOptio4 : (_parent$compilerOptio = parent.compilerOptions) === null || _parent$compilerOptio === void 0 ? void 0 : _parent$compilerOptio.paths
1611
+ })
1612
+ };
1613
+ }
1614
+
1615
+ /** `extends: './base'` may omit the .json. */
1616
+ function resolveConfigPath(files, path) {
1617
+ for (var _i3 = 0, _arr = [path, "".concat(path, ".json")]; _i3 < _arr.length; _i3++) {
1618
+ var candidate = _arr[_i3];
1619
+ if (candidate in files) return candidate;
1620
+ }
1621
+ return null;
1622
+ }
1623
+
1624
+ // autoCodeSplitting.
1625
+ //
1626
+ // Start splits a route file in two: the *reference* keeps the loader and the
1627
+ // route's critical options and replaces the component with
1628
+ // `lazyRouteComponent(() => import('...?tsr-split=component'))`, and the
1629
+ // *virtual* module holds the component itself. The builder already handles the
1630
+ // resulting dynamic import; what it cannot do is produce the split.
1631
+ //
1632
+ // That split is `@tanstack/router-plugin`'s, built on @babel/core, and it does
1633
+ // not run in a browser. Bundled for the browser target it comes to 1.14 MB and
1634
+ // evaluates as far as `require('@babel/traverse')` -- Babel requires its own
1635
+ // packages by name at module scope, which is the reason @babel/standalone
1636
+ // exists at all. Verified, not assumed: the probe got as far as a real Chromium.
1637
+ //
1638
+ // So this is a capability the caller supplies, like Tailwind's module loader.
1639
+ // `packages/publish` has Node and passes one. A browser build does not split,
1640
+ // and unlike a missing Tailwind plugin that costs *bytes rather than
1641
+ // correctness* -- an unsplit route component renders exactly the same, it just
1642
+ // ships in the entry. That is why this is allowed to differ by environment
1643
+ // where `@plugin` is not.
1644
+
1645
+ /** Query Start's splitter emits, e.g. `?tsr-split=component---errorComponent`. */
1646
+ var SPLIT_QUERY = "tsr-split";
1647
+
1648
+ /** Is this a route file, i.e. one the splitter should look at? */
1649
+ var isRouteFile = function isRouteFile(path) {
1650
+ var routesDir = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "src/routes/";
1651
+ return path.startsWith(routesDir) && /\.(tsx?|jsx?)$/.test(path);
1652
+ };
1653
+ /**
1654
+ * Reads `./posts.tsx?tsr-split=component---errorComponent`.
1655
+ *
1656
+ * Returns null for anything else, including a `?raw` or `?url` query, so the
1657
+ * caller can fall through to its other handling.
1658
+ */
1659
+ function parseSplitRequest(source) {
1660
+ var _source$split = source.split("?"),
1661
+ _source$split2 = slicedToArray._slicedToArray(_source$split, 2),
1662
+ path = _source$split2[0],
1663
+ query = _source$split2[1];
1664
+ if (!path || !query) return null;
1665
+ var match = new RegExp("(?:^|&)".concat(SPLIT_QUERY, "=([^&]*)")).exec(query);
1666
+ if (!match) return null;
1667
+ return {
1668
+ path: path,
1669
+ targets: match[1].split("---").filter(Boolean)
1670
+ };
1671
+ }
1672
+
1673
+ var DIRECTIVE = /^\s*(['"])use client\1/;
1674
+
1675
+ /** Cheap check before paying for a parse. */
1676
+ var hasUseClient = function hasUseClient(code) {
1677
+ return DIRECTIVE.test(code);
1678
+ };
1679
+ /** Export names of one module, in source order. */
1680
+ function exportsOf(ast) {
1681
+ var names = [];
1682
+ for (var _i = 0, _arr = ast.body; _i < _arr.length; _i++) {
1683
+ var _declaration$id;
1684
+ var statement = _arr[_i];
1685
+ if (statement.type === "ExportDefaultDeclaration") {
1686
+ names.push("default");
1687
+ continue;
1688
+ }
1689
+ if (statement.type !== "ExportNamedDeclaration") continue;
1690
+
1691
+ // `export { a, b as c }`
1692
+ for (var _i2 = 0, _arr2 = (_statement$specifiers = statement.specifiers) !== null && _statement$specifiers !== void 0 ? _statement$specifiers : []; _i2 < _arr2.length; _i2++) {
1693
+ var _statement$specifiers, _specifier$exported;
1694
+ var specifier = _arr2[_i2];
1695
+ var exported = (_specifier$exported = specifier.exported) === null || _specifier$exported === void 0 ? void 0 : _specifier$exported.name;
1696
+ if (exported) names.push(String(exported));
1697
+ }
1698
+
1699
+ // `export const a = ...`, `export function b() {}`
1700
+ var declaration = statement.declaration;
1701
+ if (!declaration) continue;
1702
+ if (declaration.type === "VariableDeclaration") {
1703
+ for (var _i3 = 0, _arr3 = (_declaration$declarat = declaration.declarations) !== null && _declaration$declarat !== void 0 ? _declaration$declarat : []; _i3 < _arr3.length; _i3++) {
1704
+ var _declaration$declarat;
1705
+ var declarator = _arr3[_i3];
1706
+ // A destructured export has no single name to reference; the flight
1707
+ // protocol needs one, so it is not supported rather than silently
1708
+ // producing a reference that cannot resolve.
1709
+ var id = declarator.id;
1710
+ if ((id === null || id === void 0 ? void 0 : id.type) === "Identifier") names.push(String(id.name));
1711
+ }
1712
+ } else if ((_declaration$id = declaration.id) !== null && _declaration$id !== void 0 && _declaration$id.name) {
1713
+ names.push(String(declaration.id.name));
1714
+ }
1715
+ }
1716
+ return slicedToArray._toConsumableArray(new Set(names));
1717
+ }
1718
+
1719
+ /**
1720
+ * Finds every `"use client"` module in the project.
1721
+ *
1722
+ * Ids are assigned by sorted path rather than by discovery order, so the same
1723
+ * project always produces the same ids -- the rsc build writes them into the
1724
+ * flight payload and the ssr build writes them into the lookup map, and those
1725
+ * are separate passes that must agree.
1726
+ */
1727
+ function collectClientModules(_x) {
1728
+ return _collectClientModules.apply(this, arguments);
1729
+ }
1730
+
1731
+ /**
1732
+ * The rsc-target replacement for a client module.
1733
+ *
1734
+ * `registerClientReference` comes from the flight server, which the rsc vendor
1735
+ * layer already carries. The first argument is the value a server component
1736
+ * would see if it tried to *call* the component -- React replaces it with a
1737
+ * throwing proxy, so the mistake surfaces as "cannot be rendered on the server"
1738
+ * rather than as a confusing render.
1739
+ */
1740
+ function _collectClientModules() {
1741
+ _collectClientModules = slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function _callee(files) {
1742
+ var paths, modules, _iterator2, _step2, _step2$value, index, path, ast, exported, _t;
1743
+ return slicedToArray._regenerator().w(function (_context) {
1744
+ while (1) switch (_context.p = _context.n) {
1745
+ case 0:
1746
+ paths = Object.keys(files).filter(function (path) {
1747
+ return /\.(tsx?|jsx?)$/.test(path) && hasUseClient(files[path]);
1748
+ }).sort();
1749
+ modules = [];
1750
+ _iterator2 = slicedToArray._createForOfIteratorHelper(paths.entries());
1751
+ _context.p = 1;
1752
+ _iterator2.s();
1753
+ case 2:
1754
+ if ((_step2 = _iterator2.n()).done) {
1755
+ _context.n = 6;
1756
+ break;
1757
+ }
1758
+ _step2$value = slicedToArray._slicedToArray(_step2.value, 2), index = _step2$value[0], path = _step2$value[1];
1759
+ _context.n = 3;
1760
+ return parse(path, files[path]);
1761
+ case 3:
1762
+ ast = _context.v;
1763
+ exported = exportsOf(ast);
1764
+ if (!(exported.length === 0)) {
1765
+ _context.n = 4;
1766
+ break;
1767
+ }
1768
+ throw new Error("".concat(path, ": a \"use client\" module must export something. ") + "Its exports are what a server component can reference.");
1769
+ case 4:
1770
+ modules.push({
1771
+ path: path,
1772
+ id: "c".concat(index),
1773
+ exports: exported
1774
+ });
1775
+ case 5:
1776
+ _context.n = 2;
1777
+ break;
1778
+ case 6:
1779
+ _context.n = 8;
1780
+ break;
1781
+ case 7:
1782
+ _context.p = 7;
1783
+ _t = _context.v;
1784
+ _iterator2.e(_t);
1785
+ case 8:
1786
+ _context.p = 8;
1787
+ _iterator2.f();
1788
+ return _context.f(8);
1789
+ case 9:
1790
+ return _context.a(2, modules);
1791
+ }
1792
+ }, _callee, null, [[1, 7, 8, 9]]);
1793
+ }));
1794
+ return _collectClientModules.apply(this, arguments);
1795
+ }
1796
+ function clientReferenceStub(module,
1797
+ /**
1798
+ * Where `registerClientReference` comes from, from the build target.
1799
+ *
1800
+ * A parameter rather than an import for the reason the whole `build-target`
1801
+ * chunk exists: reading it from `@valbuild/vendor/externals` at compile time
1802
+ * is what made this package buildable only inside the platform's own
1803
+ * repository.
1804
+ */
1805
+ flightServer) {
1806
+ var lines = ["import { registerClientReference as __ref } from ".concat(JSON.stringify(flightServer))];
1807
+ var _iterator = slicedToArray._createForOfIteratorHelper(module.exports),
1808
+ _step;
1809
+ try {
1810
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
1811
+ var name = _step.value;
1812
+ var value = "__ref({}, ".concat(JSON.stringify(module.id), ", ").concat(JSON.stringify(name), ")");
1813
+ lines.push(name === "default" ? "export default ".concat(value) : "export const ".concat(name, " = ").concat(value));
1814
+ }
1815
+ } catch (err) {
1816
+ _iterator.e(err);
1817
+ } finally {
1818
+ _iterator.f();
1819
+ }
1820
+ return lines.join("\n") + "\n";
1821
+ }
1822
+
1823
+ /**
1824
+ * What the ssr and client entries append so the reference map can be built.
1825
+ *
1826
+ * Namespaces rather than lazy importers: the whole app is one chunk, so there
1827
+ * is nothing to defer -- the module is already in memory by the time any
1828
+ * reference is resolved.
1829
+ */
1830
+ function clientModuleRegistry(modules) {
1831
+ if (modules.length === 0) return "\nexport const __clientModules = {}\n";
1832
+ var imports = modules.map(function (module, index) {
1833
+ return "import * as __c".concat(index, " from ").concat(JSON.stringify(module.path));
1834
+ }).join("\n");
1835
+ var entries = modules.map(function (module, index) {
1836
+ return " ".concat(JSON.stringify(module.id), ": __c").concat(index, ",");
1837
+ }).join("\n");
1838
+ return "\n".concat(imports, "\nexport const __clientModules = {\n").concat(entries, "\n}\n");
1839
+ }
1840
+
1841
+ /**
1842
+ * What a build is targeting, fetched from the platform.
1843
+ *
1844
+ * One implementation, because there used to be two calls and everybody made
1845
+ * them by hand: `/__api/artifacts` for the base revision and `/__api/vendor`
1846
+ * for the project's layer, assembled at eighteen call sites. Two calls to
1847
+ * build one answer is also two chances to assemble a mismatched one -- a base
1848
+ * from after a deploy with a project layer built against the one before it.
1849
+ *
1850
+ * In THIS package, beside the `BuildInput.target` it produces, because the
1851
+ * callers that have to ask are the ones that carry the builder: a CLI on npm
1852
+ * and a Studio in a tab, neither of which can be given the answer at compile
1853
+ * time. `@valbuild/contract` would be the other candidate and is deliberately
1854
+ * types-only -- a user app must not need a runtime import from the platform.
1855
+ *
1856
+ * The route is no longer public. It says what a project depends on, which was
1857
+ * readable by anyone; it now takes the project's own `VAL_API_KEY`, or the
1858
+ * operator token, or nothing at all when the loader is running with
1859
+ * `CONTROL_PLANE_AUTH: open` -- which is how `wrangler dev` runs and why the
1860
+ * suites need no credential.
1861
+ *
1862
+ * NOT a project token, which the loader refuses on every route but
1863
+ * `/__api/publish`. A publisher that holds one asks content's
1864
+ * `GET /v1/build-target` instead, which resolves the project from the token
1865
+ * and asks the loader with the project's api key.
1866
+ */
1867
+
1868
+ var headersFor = function headersFor(request) {
1869
+ return slicedToArray._objectSpread2({
1870
+ "x-platform-project": request.project
1871
+ }, request.token ? {
1872
+ authorization: "Bearer ".concat(request.token)
1873
+ } : {});
1874
+ };
1875
+ var endpoint = function endpoint(request) {
1876
+ var query = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
1877
+ return "".concat(request.loader.replace(/\/+$/, ""), "/__api/build-target").concat(query);
1878
+ };
1879
+ function fetchBuildTarget(_x) {
1880
+ return _fetchBuildTarget.apply(this, arguments);
1881
+ }
1882
+
1883
+ /**
1884
+ * Just this project's layer revision.
1885
+ *
1886
+ * The one question a publisher asks before it has built anything -- must I
1887
+ * send my dependency layer at all -- and the full answer reads the whole layer
1888
+ * out of storage for its specifier map, which is several megabytes to
1889
+ * establish a string comparison.
1890
+ */
1891
+ function _fetchBuildTarget() {
1892
+ _fetchBuildTarget = slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function _callee(request) {
1893
+ var res, _t, _t2, _t3, _t4, _t5;
1894
+ return slicedToArray._regenerator().w(function (_context) {
1895
+ while (1) switch (_context.n) {
1896
+ case 0:
1897
+ _context.n = 1;
1898
+ return fetch(endpoint(request), {
1899
+ headers: headersFor(request)
1900
+ });
1901
+ case 1:
1902
+ res = _context.v;
1903
+ if (res.ok) {
1904
+ _context.n = 3;
1905
+ break;
1906
+ }
1907
+ _t = Error;
1908
+ _t2 = "the platform would not say what to build against: ".concat(res.status, " ");
1909
+ _t3 = "";
1910
+ _context.n = 2;
1911
+ return res.text();
1912
+ case 2:
1913
+ _t4 = _t3.concat.call(_t3, _context.v.slice(0, 200));
1914
+ _t5 = _t2 + _t4;
1915
+ throw new _t(_t5);
1916
+ case 3:
1917
+ _context.n = 4;
1918
+ return res.json();
1919
+ case 4:
1920
+ return _context.a(2, _context.v);
1921
+ }
1922
+ }, _callee);
1923
+ }));
1924
+ return _fetchBuildTarget.apply(this, arguments);
1925
+ }
1926
+ function fetchBuildTargetRev(_x2) {
1927
+ return _fetchBuildTargetRev.apply(this, arguments);
1928
+ }
1929
+ function _fetchBuildTargetRev() {
1930
+ _fetchBuildTargetRev = slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function _callee2(request) {
1931
+ var res;
1932
+ return slicedToArray._regenerator().w(function (_context2) {
1933
+ while (1) switch (_context2.n) {
1934
+ case 0:
1935
+ _context2.n = 1;
1936
+ return fetch(endpoint(request, "?only=rev"), {
1937
+ headers: headersFor(request)
1938
+ });
1939
+ case 1:
1940
+ res = _context2.v;
1941
+ if (res.ok) {
1942
+ _context2.n = 2;
1943
+ break;
1944
+ }
1945
+ return _context2.a(2, null);
1946
+ case 2:
1947
+ _context2.n = 3;
1948
+ return res.json();
1949
+ case 3:
1950
+ return _context2.a(2, _context2.v.project.rev);
1951
+ }
1952
+ }, _callee2);
1953
+ }));
1954
+ return _fetchBuildTargetRev.apply(this, arguments);
1955
+ }
1956
+
1957
+ /**
1958
+ * Filename of the entry chunk, in every target.
1959
+ *
1960
+ * Fixed rather than hashed because it is addressed by name from outside the
1961
+ * build: `app.js` in the isolate's module map, `/_app/app.js` from the shell's
1962
+ * client half. Everything the build splits off is content-addressed instead.
1963
+ */
1964
+ var ENTRY_CHUNK = "app.js";
1965
+
1966
+ /**
1967
+ * The RSC build's entry, which is not the app's.
1968
+ *
1969
+ * See `rscEntrySource`: the rsc environment exists to host server functions,
1970
+ * and compiling the route tree under `react-server` breaks on the first
1971
+ * component that uses a hook or a context.
1972
+ */
1973
+ var RSC_ENTRY_ID = "\0platform:rsc-entry";
1974
+
1975
+ /** The shared vendor layer, as seen from `rsc/app.js` one directory down. */
1976
+ /**
1977
+ * The platform's externalisation rules, as DATA rather than as an import.
1978
+ *
1979
+ * This module used to read `@valbuild/vendor/externals` at compile time, which
1980
+ * meant a builder could only ever be built in the same repository as the
1981
+ * vendor package it read. It now gets the same facts from the `BuildTarget`
1982
+ * the caller hands it -- `GET /__api/build-target` on the loader, or
1983
+ * `GET /v1/build-target` on content -- which is what makes the builder
1984
+ * movable, and is the whole point of the `build-target` chunk.
1985
+ *
1986
+ * The resolvers are one line each, deliberately: the RULE stays with the side
1987
+ * that owns the chunks (`resolveVendor` in externals.js says the same thing),
1988
+ * and what crosses the wire is the map it reads. A function cannot cross a
1989
+ * wire; a `Record<string, string>` can.
1990
+ */
1991
+ function vendorRules(target) {
1992
+ var _target$base = target.base,
1993
+ modules = _target$base.modules,
1994
+ rscModules = _target$base.rscModules,
1995
+ paths = _target$base.paths;
1996
+ var chunk = function chunk(map, specifier, base) {
1997
+ return map[specifier] ? "".concat(base).concat(map[specifier], ".js") : null;
1998
+ };
1999
+ return {
2000
+ paths: paths,
2001
+ isBase: function isBase(specifier) {
2002
+ return specifier in modules;
2003
+ },
2004
+ isRsc: function isRsc(specifier) {
2005
+ return specifier in rscModules;
2006
+ },
2007
+ base: function base(specifier, from) {
2008
+ return chunk(modules, specifier, from);
2009
+ },
2010
+ rsc: function rsc(specifier, from) {
2011
+ return chunk(rscModules, specifier, from);
2012
+ },
2013
+ /** Everything externalised, which the build lists as `external`. */
2014
+ specifiers: Object.keys(modules),
2015
+ rscSpecifiers: Object.keys(rscModules)
2016
+ };
2017
+ }
2018
+ var BASE_FROM_RSC = "../vendor/";
2019
+
2020
+ /**
2021
+ * The RSC runtime, as the ssr and client builds see it.
2022
+ *
2023
+ * A module defining a server function that renders a server component imports
2024
+ * the runtime at module scope, and that module is also in the other two graphs
2025
+ * -- the route that calls the server function imports it. Only the rsc build
2026
+ * can supply the real thing, so the others get stubs.
2027
+ *
2028
+ * Throwing rather than no-op: under RSC these are never reached, because Start
2029
+ * routes every server function call to the rsc environment. If one *is*
2030
+ * reached, it means the build was published without `rsc`, and a clear error
2031
+ * beats a silent undefined.
2032
+ */
2033
+ var RSC_RUNTIME_STUB_ID = "\0platform:rsc-runtime-stub";
2034
+ var RSC_RUNTIME_STUB = "\nconst outsideRsc = (name) => () => {\n throw new Error(\n name + '() needs the React Server Components build. This project was built ' +\n 'without it, so there is no rsc bundle for the server function to run in.',\n )\n}\nexport const renderServerComponent = outsideRsc('renderServerComponent')\nexport const createCompositeComponent = outsideRsc('createCompositeComponent')\nexport const CompositeComponent = outsideRsc('CompositeComponent')\n";
2035
+
2036
+ /**
2037
+ * A stylesheet imported from a dependency, as the *JS* graph sees it.
2038
+ *
2039
+ * It contributes to the page's CSS and nothing to its JavaScript, so the module
2040
+ * is empty -- the same treatment a relative `.css` import gets from
2041
+ * `moduleTypes`, which matches on extension and so does not cover a bare
2042
+ * specifier. Returning an id that still ends in `.css` would make rolldown try
2043
+ * to parse the empty module as CSS.
2044
+ */
2045
+ var DEPENDENCY_CSS_ID = "\0platform:dependency-css";
2046
+
2047
+ /**
2048
+ * Marks a resolved id as a CSS module's name mapping.
2049
+ *
2050
+ * The id deliberately does NOT end in `.css`. `moduleTypes` picks a module's
2051
+ * type by extension, so `\0platform:css-module:card.module.css` is treated as CSS
2052
+ * and emptied -- the import then yields `undefined` and the component crashes
2053
+ * on `styles.card` at render time, not at build time. An index keeps the
2054
+ * extension out of the id entirely.
2055
+ */
2056
+ /**
2057
+ * Marks a resolved id as the deferred half of a split route.
2058
+ *
2059
+ * Targets first and the path last, so the id never ends in `.tsx`:
2060
+ * `moduleTypes` picks a module's type by extension and would otherwise decide
2061
+ * what this module is. That trap has cost three bugs in this codebase already.
2062
+ */
2063
+ var SPLIT_PREFIX = "\0platform:tsr-split:";
2064
+
2065
+ /**
2066
+ * The route and the halves a split id names, or null if it is not one.
2067
+ *
2068
+ * One parse, because two hooks read these ids: `load` builds the deferred half
2069
+ * from the route's source, and `transform` runs the env markers over what
2070
+ * `load` produced. They disagreeing about where the path starts would not fail
2071
+ * — it would quietly hand the markers pass a truncated filename, which only
2072
+ * decides whether it parses as TSX.
2073
+ */
2074
+ function splitIdOf(id) {
2075
+ if (!id.startsWith(SPLIT_PREFIX)) return null;
2076
+ var rest = id.slice(SPLIT_PREFIX.length);
2077
+ var at = rest.indexOf(":");
2078
+ return {
2079
+ targets: rest.slice(0, at).split("---").filter(Boolean),
2080
+ path: rest.slice(at + 1)
2081
+ };
2082
+ }
2083
+
2084
+ /**
2085
+ * The project file a module id came from.
2086
+ *
2087
+ * A split module's id is virtual, but its *contents* came out of a route file
2088
+ * and its relative imports are written relative to that file. Resolving them
2089
+ * against the virtual id instead gives a path that is not in the project, and
2090
+ * the build fails on every import the deferred half carried with it.
2091
+ */
2092
+ var sourcePathOf = function sourcePathOf(id) {
2093
+ if (!id) return "";
2094
+ if (!id.startsWith(SPLIT_PREFIX)) return id;
2095
+ var rest = id.slice(SPLIT_PREFIX.length);
2096
+ return rest.slice(rest.indexOf(":") + 1);
2097
+ };
2098
+ var CSS_MODULE_PREFIX = "\0platform:css-module:";
2099
+
2100
+ /** `./a.module.css?inline` -> `./a.module.css`. */
2101
+ var withoutCssQuery = function withoutCssQuery(path) {
2102
+ return path.split("?")[0];
2103
+ };
2104
+
2105
+ /** Marks a resolved id as an asset rather than a source file. */
2106
+ var ASSET_PREFIX = "\0platform:asset:";
2107
+
2108
+ /**
2109
+ * Where `import css from './styles.css?url'` resolves to.
2110
+ *
2111
+ * One URL for the whole project, because the CSS pass concatenates every
2112
+ * stylesheet into one -- so whichever sheet is asked for by URL, the answer is
2113
+ * the same file. The loader serves it, and skips its own <head> injection when
2114
+ * the project links it (see `linksOwnCss` on the build).
2115
+ */
2116
+ var CSS_URL = "/_app/app.css";
2117
+ var CSS_URL_ID = "\0platform:css-url";
2118
+
2119
+ /**
2120
+ * Env vars whose names start with this are inlined into the *client* bundle as
2121
+ * well as the server one, and are therefore public: anyone can read them from
2122
+ * the served JavaScript. Everything else is inlined only server-side.
2123
+ *
2124
+ * An explicit prefix rather than a separate list, so the exposure of a variable
2125
+ * is visible at every use site in the user's code.
2126
+ */
2127
+ /**
2128
+ * The project's own source, importable by the app that is made from it.
2129
+ *
2130
+ * `import { FILES } from 'platform:project-source'` -- how a host hands a CMS its
2131
+ * content when there is no filesystem to read it from. Val's in-memory store is
2132
+ * the case this exists for.
2133
+ *
2134
+ * Emitted by the BUILD, from the same record the build is made of, and that is
2135
+ * the whole point. It used to be a chunk of the project's VENDOR LAYER, which
2136
+ * made it dependency-shaped: the layer changes when `package.json` does, so a
2137
+ * publisher reusing a layer by reference -- which is every publish from the
2138
+ * studio tab, because a tab cannot build one -- shipped new code beside a
2139
+ * frozen copy of the source. The symptom was precise and awful: the edit WAS in
2140
+ * the client bundle, so the page hydrated with the new content, while anything
2141
+ * read on the SERVER (`head` metadata, a redirect) still saw the source as it
2142
+ * was at the last CLI publish.
2143
+ *
2144
+ * Server-side only. A client bundle carrying every source file of the project
2145
+ * would be both a leak and, for a real app, enormous.
2146
+ */
2147
+ var PROJECT_SOURCE = "platform:project-source";
2148
+ var PROJECT_SOURCE_ID = "\0platform:project-source";
2149
+ var PUBLIC_PREFIX = "PUBLIC_";
2150
+ var VALID_KEY = /^[A-Za-z_][A-Za-z0-9_]*$/;
2151
+ /**
2152
+ * Resolves the user's file tree and hard-externalises everything else.
2153
+ *
2154
+ * There is deliberately no node_modules resolution here. Every dependency is a
2155
+ * vendor external, so the build graph is exactly the user's own files, which is
2156
+ * what keeps this fast enough to run on every publish and why the browser build
2157
+ * needs no virtual filesystem at all.
2158
+ */
2159
+ function projectPlugin(files, projectSource, splitter, cssModules, aliases, assets, assetUrls, vendorBase, projectVendorBase, projectVendor, vendor, warnings, target, seenIds, clientModules, isRsc) {
2160
+ return {
2161
+ name: "platform:project",
2162
+ resolveId: function resolveId(source, importer) {
2163
+ var _projectVendor$module;
2164
+ if (source === REGISTRY_ID) return REGISTRY_ID;
2165
+ if (source === RSC_ENTRY_ID) return RSC_ENTRY_ID;
2166
+ if (source === PROJECT_SOURCE) {
2167
+ // Refused for the browser rather than emitted and hoped about: this is
2168
+ // every source file of the project, and the mistake it prevents -- a
2169
+ // component importing it "just to read a title" -- is a leak nothing
2170
+ // else would notice.
2171
+ if (target === "client") {
2172
+ warnings.push("'".concat(PROJECT_SOURCE, "' is server-only: it carries the project's entire source. ") + "Import it from a server route handler or a createServerFn handler, not from " + "a component or a loader.");
2173
+ return null;
2174
+ }
2175
+ return PROJECT_SOURCE_ID;
2176
+ }
2177
+ // Before the vendor sets: this is a bare specifier, but it names a
2178
+ // stylesheet rather than a module.
2179
+ if (isCss(source) && projectVendor !== null && projectVendor !== void 0 && projectVendor.css && source in projectVendor.css) {
2180
+ return DEPENDENCY_CSS_ID;
2181
+ }
2182
+ if (source === RSC_RUNTIME_STUB_ID) return RSC_RUNTIME_STUB_ID;
2183
+
2184
+ // The rsc pass has its own vendor set, and the difference is not just
2185
+ // which React: it is narrower on purpose. `react-dom/client` is absent
2186
+ // because the react-server condition refuses it outright, so importing it
2187
+ // from a server component fails here, naming the package, rather than in
2188
+ // a cold isolate that will not boot.
2189
+ if (isRsc) {
2190
+ // The RSC runtime lives in the shell, not in a vendor chunk; see
2191
+ // RSC_RUNTIME_PATH. `rsc/app.js` reaches `rsc/runtime.js` as a sibling.
2192
+ if (source === vendor.paths.rscRuntimeSpecifier) {
2193
+ return {
2194
+ id: vendor.paths.rscRuntimePath,
2195
+ external: true
2196
+ };
2197
+ }
2198
+ // The react-server layer next: whatever a server component renders
2199
+ // with has to come from there, or it gets a React with no hooks.
2200
+ if (vendor.isRsc(source)) {
2201
+ return {
2202
+ id: vendor.rsc(source, vendorBase),
2203
+ external: true
2204
+ };
2205
+ }
2206
+ // Everything else from the *normal* layer. The rsc bundle's other
2207
+ // dependencies -- `createServerFn`, the rpc helpers -- are not
2208
+ // rendering code, and their react-server builds pull React rendering
2209
+ // machinery that fails at module scope. Pointing at the same chunk the
2210
+ // shell uses also keeps it to one instance.
2211
+ var shared = vendor.base(source, BASE_FROM_RSC);
2212
+ if (shared) return {
2213
+ id: shared,
2214
+ external: true
2215
+ };
2216
+ } else {
2217
+ // The ssr and client graphs reach the runtime through the module that
2218
+ // defines the server function; see RSC_RUNTIME_STUB.
2219
+ if (source === vendor.paths.rscRuntimeSpecifier) return RSC_RUNTIME_STUB_ID;
2220
+ if (vendor.isBase(source)) {
2221
+ return {
2222
+ id: vendor.base(source, vendorBase),
2223
+ external: true
2224
+ };
2225
+ }
2226
+ }
2227
+
2228
+ // The project's own layer, resolved exactly like the base one -- an
2229
+ // external pointing at a chunk someone else built. The user's module
2230
+ // graph is still only their own files.
2231
+ var projectChunk = projectVendor === null || projectVendor === void 0 ? void 0 : projectVendor.modules[source];
2232
+ if (projectChunk) {
2233
+ var _projectVendor$worker;
2234
+ // Server-only: the layer has a worker chunk for this and no browser
2235
+ // one. Saying so here, naming the specifier, beats a 404 for a chunk
2236
+ // URL that was never built -- which is what a client bundle importing
2237
+ // it would otherwise produce, at runtime, in a tab.
2238
+ if (target === "client" && projectVendor !== null && projectVendor !== void 0 && (_projectVendor$worker = projectVendor.workerOnly) !== null && _projectVendor$worker !== void 0 && _projectVendor$worker.includes(source)) {
2239
+ warnings.push("'".concat(source, "' is server-only in this project's vendor layer: it could not be built ") + "for the browser. Import it from a server route handler or a createServerFn " + "handler, not from a component or a loader.");
2240
+ return null;
2241
+ }
2242
+ return {
2243
+ id: "".concat(projectVendorBase).concat(projectChunk, ".js"),
2244
+ external: true
2245
+ };
2246
+ }
2247
+
2248
+ // A deferred half of a route file, from the splitter's own rewrite.
2249
+ var split = splitter ? parseSplitRequest(source) : null;
2250
+ if (split) {
2251
+ var path = split.path.startsWith(".") ? resolveInFiles(resolve(dirname(sourcePathOf(importer)), split.path), files) : split.path;
2252
+ if (path && path in files) {
2253
+ return "".concat(SPLIT_PREFIX).concat(split.targets.join("---"), ":").concat(path);
2254
+ }
2255
+ }
2256
+
2257
+ // Everything a project-relative path can turn into, shared by the
2258
+ // relative branch below and the tsconfig-alias one after it -- an alias
2259
+ // can point at a stylesheet or an image just as easily as a module, and
2260
+ // resolving it to a bare file id would skip the asset and CSS-module
2261
+ // passes entirely.
2262
+ var resolveProjectPath = function resolveProjectPath(base) {
2263
+ // Assets are resolved against their own map: they are not text, so they
2264
+ // never entered `files`. Checked first because an asset path would not
2265
+ // resolve there anyway, and the error would name the wrong thing.
2266
+ if (isAsset(base) && base in assets) return ASSET_PREFIX + base;
2267
+ // A CSS module's *import* is its name mapping. The stylesheet half was
2268
+ // produced by the CSS pass; this is the object the module returns.
2269
+ var bareCss = withoutCssQuery(base);
2270
+ if (isCssModule(bareCss) && bareCss in cssModules) {
2271
+ var paths = Object.keys(cssModules);
2272
+ return "".concat(CSS_MODULE_PREFIX).concat(paths.indexOf(bareCss));
2273
+ }
2274
+ return resolveInFiles(base, files);
2275
+ };
2276
+
2277
+ // Vite's `?url` suffix: "give me the URL, not the contents". On a
2278
+ // stylesheet that is how a Start route puts CSS in <head> itself,
2279
+ // rather than relying on a bundler to inject a link -- which is what
2280
+ // the stock __root.tsx does.
2281
+ var _source$split = source.split("?"),
2282
+ _source$split2 = slicedToArray._slicedToArray(_source$split, 2),
2283
+ bare = _source$split2[0],
2284
+ query = _source$split2[1];
2285
+ if (source.startsWith(".")) {
2286
+ if (query === "url" && isCss(bare)) return CSS_URL_ID;
2287
+ var hit = resolveProjectPath(resolve(dirname(sourcePathOf(importer)), source));
2288
+ if (hit) return hit;
2289
+ return null; // let rolldown report the unresolved import with a code frame
2290
+ }
2291
+ if (source in files) return source;
2292
+
2293
+ // tsconfig `paths`. Deliberately *after* the vendor sets: an alias can
2294
+ // never shadow the pinned React, router or start packages, because two
2295
+ // React instances is a broken page rather than a resolution preference.
2296
+ // A pattern that tries is reported rather than silently dropped.
2297
+ if (aliases) {
2298
+ var candidates = aliases.candidates(bare);
2299
+ var _iterator = slicedToArray._createForOfIteratorHelper(candidates),
2300
+ _step;
2301
+ try {
2302
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
2303
+ var candidate = _step.value;
2304
+ if (query === "url" && isCss(candidate)) return CSS_URL_ID;
2305
+ var _hit2 = resolveProjectPath(candidate);
2306
+ if (_hit2) return _hit2;
2307
+ }
2308
+ // A specifier that matched a pattern but resolved to nothing is a typo
2309
+ // or a moved file, not a missing package. Falling through to the
2310
+ // dependency error below would print a list of npm packages and tell
2311
+ // you to install `@/components/Card`, which does not exist and never
2312
+ // will -- so say what was actually tried instead.
2313
+ } catch (err) {
2314
+ _iterator.e(err);
2315
+ } finally {
2316
+ _iterator.f();
2317
+ }
2318
+ if (candidates.length) {
2319
+ warnings.push("'".concat(source, "' matched a tsconfig 'paths' alias but no file was found. ") + "Tried: ".concat(candidates.join(", "), "."));
2320
+ return null;
2321
+ }
2322
+
2323
+ // No pattern matched, so try `baseUrl` on its own. A miss here is not
2324
+ // reported as a broken alias: with a baseUrl set, every unknown npm
2325
+ // package reaches this line, and they are dependency errors.
2326
+ var fromBaseUrl = aliases.baseUrlCandidate(bare);
2327
+ if (fromBaseUrl) {
2328
+ var _hit = resolveProjectPath(fromBaseUrl);
2329
+ if (_hit) return _hit;
2330
+ }
2331
+ }
2332
+
2333
+ // A bare specifier outside the vendor set. Failing here rather than at
2334
+ // runtime is the point: the user gets a build error naming the package
2335
+ // instead of a blank page from a missing module in the isolate.
2336
+ var available = [].concat(slicedToArray._toConsumableArray(isRsc ? [vendor.paths.rscRuntimeSpecifier].concat(slicedToArray._toConsumableArray(vendor.rscSpecifiers), slicedToArray._toConsumableArray(vendor.specifiers)) : vendor.specifiers), slicedToArray._toConsumableArray(Object.keys((_projectVendor$module = projectVendor === null || projectVendor === void 0 ? void 0 : projectVendor.modules) !== null && _projectVendor$module !== void 0 ? _projectVendor$module : {})));
2337
+ warnings.push("'".concat(source, "' is not an available dependency. Available: ").concat(available.join(", "), "."));
2338
+ return null;
2339
+ },
2340
+ load: function load(id) {
2341
+ if (id === REGISTRY_ID) return REGISTRY_SOURCE;
2342
+ if (id === PROJECT_SOURCE_ID) return "export const FILES = ".concat(JSON.stringify(projectSource), "\n");
2343
+ if (id === RSC_ENTRY_ID) return rscEntrySource(files);
2344
+ if (id === RSC_RUNTIME_STUB_ID) return RSC_RUNTIME_STUB;
2345
+ if (id === DEPENDENCY_CSS_ID) return "export {}\n";
2346
+ var split = splitIdOf(id);
2347
+ if (split) {
2348
+ return splitter.virtual(split.path, files[split.path], split.targets).code;
2349
+ }
2350
+ if (id.startsWith(CSS_MODULE_PREFIX)) {
2351
+ var path = Object.keys(cssModules)[Number(id.slice(CSS_MODULE_PREFIX.length))];
2352
+ return cssModuleExports(cssModules[path]);
2353
+ }
2354
+ // Resolved ahead of the build, because `load` cannot be async here and
2355
+ // because the URL has to be identical across targets -- see resolveAsset.
2356
+ if (id === CSS_URL_ID) return assetModule(CSS_URL);
2357
+ if (id.startsWith(ASSET_PREFIX)) {
2358
+ return assetModule(assetUrls.get(id.slice(ASSET_PREFIX.length)));
2359
+ }
2360
+ if (!(id in files)) return null;
2361
+
2362
+ // A "use client" module is a boundary, and which side of it this build is
2363
+ // on decides what the module even is.
2364
+ var clientModule = clientModules.find(function (module) {
2365
+ return module.path === id;
2366
+ });
2367
+ if (clientModule && isRsc) return clientReferenceStub(clientModule, vendor.paths.flightServer);
2368
+ if (id !== projectPaths.ENTRY) return files[id];
2369
+ // The entry carries the registry across the module boundary: the shell
2370
+ // reads `__serverFns` off the user app, not off a module it cannot name.
2371
+ // The rsc build has no use for the registry: it holds references, not
2372
+ // modules.
2373
+ return files[id] + REGISTRY_REEXPORT + (isRsc ? "" : clientModuleRegistry(clientModules));
2374
+ },
2375
+ /**
2376
+ * Runs before rolldown's own oxc pass, so this sees the original TS/JSX.
2377
+ * Modules without a `createServerFn` are returned untouched and never
2378
+ * parsed.
2379
+ */
2380
+ transform: function transform(code, id) {
2381
+ return slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function _callee() {
2382
+ var half, _envMarkers, out, reference, serverFns, envMarkers, routeNodes;
2383
+ return slicedToArray._regenerator().w(function (_context) {
2384
+ while (1) switch (_context.n) {
2385
+ case 0:
2386
+ /*
2387
+ * A split route's DEFERRED half, which would otherwise be skipped whole.
2388
+ *
2389
+ * `load` builds it from `files[path]` -- the original source, before any
2390
+ * of the passes below -- and gives it an id of its own, which is not in
2391
+ * `files`, so the guard after this one returned `null` for it. The
2392
+ * markers live in the component, and the component is exactly what the
2393
+ * splitter moves here: a route using `<ClientOnly>` or
2394
+ * `createIsomorphicFn()` therefore kept TanStack's shipped fallback when
2395
+ * a splitter was supplied and was rewritten when one was not. Splitting
2396
+ * is allowed to cost bytes and is NOT allowed to change behaviour, which
2397
+ * is the whole reason a browser build may skip it.
2398
+ *
2399
+ * The env markers ALONE, and the other two passes are deliberately not
2400
+ * run here: the reference half keeps the route options
2401
+ * (`transformRouteNodes`) and any `createServerFn` (`transformServerFns`),
2402
+ * and re-running the latter would mint a second id for a function that
2403
+ * already has one.
2404
+ */
2405
+ half = splitIdOf(id);
2406
+ if (!half) {
2407
+ _context.n = 2;
2408
+ break;
2409
+ }
2410
+ _context.n = 1;
2411
+ return transformEnvMarkers(half.path, code, target);
2412
+ case 1:
2413
+ _envMarkers = _context.v;
2414
+ return _context.a(2, _envMarkers ? {
2415
+ code: _envMarkers.code,
2416
+ map: null
2417
+ } : null);
2418
+ case 2:
2419
+ if (!(!(id in files) || isCss(id))) {
2420
+ _context.n = 3;
2421
+ break;
2422
+ }
2423
+ return _context.a(2, null);
2424
+ case 3:
2425
+ // Two passes rather than one shared parse: each bails out on a substring
2426
+ // check before parsing, so a module that uses neither -- which is most of
2427
+ // them -- is never parsed at all.
2428
+ out = code; // First, because it decides what stays in this module at all: the other
2429
+ // passes should see the reference half, not code about to move out of it.
2430
+ if (splitter && isRouteFile(id)) {
2431
+ reference = splitter.reference(id, out);
2432
+ if (reference) out = reference.code;
2433
+ }
2434
+ _context.n = 4;
2435
+ return transformServerFns(id, out, target, seenIds);
2436
+ case 4:
2437
+ serverFns = _context.v;
2438
+ if (serverFns) out = serverFns.code;
2439
+ _context.n = 5;
2440
+ return transformEnvMarkers(id, out, target);
2441
+ case 5:
2442
+ envMarkers = _context.v;
2443
+ if (envMarkers) out = envMarkers.code;
2444
+ // Client only, and last: it deletes whole route options, so running it
2445
+ // before the others would leave them rewriting code about to be removed.
2446
+ _context.n = 6;
2447
+ return transformRouteNodes(id, out, target);
2448
+ case 6:
2449
+ routeNodes = _context.v;
2450
+ if (routeNodes) out = routeNodes.code;
2451
+ return _context.a(2, out === code ? null : {
2452
+ code: out,
2453
+ map: null
2454
+ });
2455
+ }
2456
+ }, _callee);
2457
+ }))();
2458
+ }
2459
+ };
2460
+ }
2461
+
2462
+ /**
2463
+ * Build-time env substitution.
2464
+ *
2465
+ * Values are inlined as literals rather than read at runtime, which is why they
2466
+ * cost nothing to use and why changing one produces a new build hash: the
2467
+ * output genuinely differs.
2468
+ *
2469
+ * Non-public keys resolve to `undefined` in the client bundle rather than being
2470
+ * left alone. An untouched `import.meta.env.SECRET` would throw in the browser,
2471
+ * and a silent `undefined` is both safer and easier to reason about.
2472
+ */
2473
+ function defineFor(env, target, warnings) {
2474
+ var define = {};
2475
+ var visible = {};
2476
+ for (var _i = 0, _Object$entries = Object.entries(env); _i < _Object$entries.length; _i++) {
2477
+ var _Object$entries$_i = slicedToArray._slicedToArray(_Object$entries[_i], 2),
2478
+ key = _Object$entries$_i[0],
2479
+ value = _Object$entries$_i[1];
2480
+ if (!VALID_KEY.test(key)) {
2481
+ warnings.push("env var '".concat(key, "' is not a valid identifier and was ignored."));
2482
+ continue;
2483
+ }
2484
+ var exposed = target === "server" || key.startsWith(PUBLIC_PREFIX);
2485
+ var literal = exposed ? JSON.stringify(value) : "undefined";
2486
+ define["import.meta.env.".concat(key)] = literal;
2487
+ define["process.env.".concat(key)] = literal;
2488
+ if (exposed) visible[key] = value;
2489
+ }
2490
+
2491
+ // Always defined, even when empty: it makes `import.meta.env` destructuring
2492
+ // work and stops a bare reference from throwing. Specific keys above take
2493
+ // precedence over this object.
2494
+ define["import.meta.env"] = JSON.stringify(visible);
2495
+ return define;
2496
+ }
2497
+ function buildOnce(_x, _x2, _x3, _x4, _x5) {
2498
+ return _buildOnce.apply(this, arguments);
2499
+ }
2500
+ function _buildOnce() {
2501
+ _buildOnce = slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function _callee2(input, vendorBase, projectVendorBase, target, warnings) {
2502
+ var _input$projectSource, _input$assets, _input$env;
2503
+ var clientModules,
2504
+ isRsc,
2505
+ assetUrls,
2506
+ cssModules,
2507
+ aliases,
2508
+ vendor,
2509
+ projectVendor,
2510
+ result,
2511
+ chunks,
2512
+ entry,
2513
+ split,
2514
+ _iterator2,
2515
+ _step2,
2516
+ chunk,
2517
+ _args2 = arguments;
2518
+ return slicedToArray._regenerator().w(function (_context2) {
2519
+ while (1) switch (_context2.n) {
2520
+ case 0:
2521
+ clientModules = _args2.length > 5 && _args2[5] !== undefined ? _args2[5] : [];
2522
+ isRsc = _args2.length > 6 && _args2[6] !== undefined ? _args2[6] : false;
2523
+ assetUrls = _args2.length > 7 && _args2[7] !== undefined ? _args2[7] : new Map();
2524
+ cssModules = _args2.length > 8 && _args2[8] !== undefined ? _args2[8] : {};
2525
+ aliases = _args2.length > 9 && _args2[9] !== undefined ? _args2[9] : null;
2526
+ vendor = vendorRules(input.target);
2527
+ /*
2528
+ * The project's own layer, in the shape the plugin already reads.
2529
+ *
2530
+ * `BuildTarget.project` is the wire shape and always present; this is the
2531
+ * "does it have one at all" question the resolver asks, and `null` keeps
2532
+ * that a single check rather than one per field.
2533
+ */
2534
+ projectVendor = input.target.project.rev === null ? undefined : {
2535
+ rev: input.target.project.rev,
2536
+ modules: input.target.project.modules,
2537
+ css: input.target.project.css,
2538
+ workerOnly: input.target.project.workerOnly
2539
+ }; // The RSC pass is a server build in every respect the transforms care about:
2540
+ // it runs on the server, so server-only code stays and client-only code goes.
2541
+ // Only the vendor layer differs.
2542
+ _context2.n = 1;
2543
+ return browser.build({
2544
+ input: isRsc ? RSC_ENTRY_ID : projectPaths.ENTRY,
2545
+ // Required in the browser. rolldown computes `cwd: inputOptions.cwd ??
2546
+ // process.cwd()` unguarded, so omitting this throws "process is not
2547
+ // defined" from inside the wasm loader -- which surfaces only as a build
2548
+ // error with no stack pointing here. The value is inert for us because the
2549
+ // project plugin resolves every id itself.
2550
+ cwd: "/",
2551
+ // rolldown removed CSS bundling (rolldown/rolldown#4271), so a `.css`
2552
+ // import is a hard build error unless its module type is declared. 'empty'
2553
+ // drops it from the JS graph; the stylesheet itself comes from collectCss.
2554
+ moduleTypes: {
2555
+ ".css": "empty"
2556
+ },
2557
+ plugins: [projectPlugin(input.files, (_input$projectSource = input.projectSource) !== null && _input$projectSource !== void 0 ? _input$projectSource : input.files, input.routeSplitter, cssModules, aliases, (_input$assets = input.assets) !== null && _input$assets !== void 0 ? _input$assets : {}, assetUrls, vendorBase, projectVendorBase, projectVendor, vendor, warnings, target, new Set(), clientModules, isRsc)],
2558
+ // oxc handles TS and JSX natively, so there is no separate transform pass
2559
+ // and no type-checking on the publish path. Types are the editor's job.
2560
+ transform: {
2561
+ jsx: {
2562
+ runtime: "automatic",
2563
+ importSource: "react"
2564
+ },
2565
+ define: defineFor((_input$env = input.env) !== null && _input$env !== void 0 ? _input$env : {}, target, warnings)
2566
+ },
2567
+ output: {
2568
+ format: "esm",
2569
+ minify: false,
2570
+ // The entry's name is fixed because both consumers address it by name:
2571
+ // the isolate's module map has an `app.js` key, and the shell's client
2572
+ // half imports `/_app/app.js`. Split chunks are content-addressed, which
2573
+ // is what lets them be served immutable.
2574
+ entryFileNames: ENTRY_CHUNK,
2575
+ chunkFileNames: "c-[hash].js"
2576
+ },
2577
+ write: false
2578
+ });
2579
+ case 1:
2580
+ result = _context2.v;
2581
+ // A type predicate rather than `(chunk: any)`, which is how this read until
2582
+ // the package moved into a repository that type-checks it: an `any`
2583
+ // parameter makes the filter non-narrowing, so every `.code` below was
2584
+ // reaching for a property that an OutputAsset does not have. Nothing was
2585
+ // wrong at runtime -- `type === 'chunk'` was already the check -- but
2586
+ // nothing said so either.
2587
+ chunks = result.output.filter(function (output) {
2588
+ return output.type === "chunk";
2589
+ });
2590
+ entry = chunks.find(function (chunk) {
2591
+ return chunk.fileName === ENTRY_CHUNK;
2592
+ });
2593
+ if (entry) {
2594
+ _context2.n = 2;
2595
+ break;
2596
+ }
2597
+ throw new Error("The build produced no ".concat(ENTRY_CHUNK, ". Chunks: ").concat(chunks.map(function (c) {
2598
+ return c.fileName;
2599
+ }).join(", "), "."));
2600
+ case 2:
2601
+ // Chunk-to-chunk imports come out relative (`./c-abc.js`), which is exactly
2602
+ // what both sides need and why neither gets a base path here: relative to
2603
+ // `app.js` in the module map, relative to `/_app/app.js` as a URL.
2604
+ split = {};
2605
+ _iterator2 = slicedToArray._createForOfIteratorHelper(chunks);
2606
+ try {
2607
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
2608
+ chunk = _step2.value;
2609
+ if (chunk.fileName !== ENTRY_CHUNK) split[chunk.fileName] = chunk.code;
2610
+ }
2611
+ } catch (err) {
2612
+ _iterator2.e(err);
2613
+ } finally {
2614
+ _iterator2.f();
2615
+ }
2616
+ return _context2.a(2, {
2617
+ code: entry.code,
2618
+ chunks: split
2619
+ });
2620
+ }
2621
+ }, _callee2);
2622
+ }));
2623
+ return _buildOnce.apply(this, arguments);
2624
+ }
2625
+ function buildUserApp(_x6) {
2626
+ return _buildUserApp.apply(this, arguments);
2627
+ }
2628
+
2629
+ /**
2630
+ * Exactly what `POST /__api/publish` expects, from a build.
2631
+ *
2632
+ * A function rather than "spread the whole build", because BuildOutput also
2633
+ * carries things the loader has no use for -- timings, warnings, the client
2634
+ * module list -- and rather than a hand-written literal at every call site,
2635
+ * because split chunks were the third output to be added and the third time
2636
+ * every publisher had to be found and edited.
2637
+ */
2638
+ function _buildUserApp() {
2639
+ _buildUserApp = slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function _callee3(input) {
2640
+ var _input$target$project;
2641
+ var warnings, started, rev, clientModules, assetUrls, assetFiles, _i2, _Object$entries2, _input$assets2, _Object$entries2$_i, path, base64, resolved, aliases, css, styles, tailwindMs, compiled, serverStarted, serverBuild, server, clientStarted, clientBuild, client, rscBuild, publicFiles, _i3, _Object$entries3, _input$publicFiles, _Object$entries3$_i, _path, _base, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9, _t0, _t1, _t10, _t11, _t12, _t13, _t14, _t15;
2642
+ return slicedToArray._regenerator().w(function (_context3) {
2643
+ while (1) switch (_context3.n) {
2644
+ case 0:
2645
+ warnings = [];
2646
+ started = performance.now(); // Server and client differ in two ways: how vendor imports are addressed
2647
+ // (module-map keys vs asset URLs), and which env vars are visible.
2648
+ // The project layer is addressed differently per target for the same reason
2649
+ // the base layer is: module-map keys inside the isolate, asset URLs in the
2650
+ // browser. The client path carries the layer's revision so it can be cached
2651
+ // immutably.
2652
+ rev = (_input$target$project = input.target.project.rev) !== null && _input$target$project !== void 0 ? _input$target$project : ""; // Found once and used by all three passes, because the ids have to agree:
2653
+ // the rsc build writes them into the flight payload and the others write them
2654
+ // into the lookup map.
2655
+ if (!input.rsc) {
2656
+ _context3.n = 2;
2657
+ break;
2658
+ }
2659
+ _context3.n = 1;
2660
+ return collectClientModules(input.files);
2661
+ case 1:
2662
+ _t = _context3.v;
2663
+ _context3.n = 3;
2664
+ break;
2665
+ case 2:
2666
+ _t = [];
2667
+ case 3:
2668
+ clientModules = _t;
2669
+ // Resolved once, before any target builds, for two reasons: `load` cannot be
2670
+ // async, and every target has to emit the *same* URL -- a server bundle that
2671
+ // disagreed with the client one would be a hydration mismatch on every image.
2672
+ assetUrls = new Map();
2673
+ assetFiles = {};
2674
+ _i2 = 0, _Object$entries2 = Object.entries((_input$assets2 = input.assets) !== null && _input$assets2 !== void 0 ? _input$assets2 : {});
2675
+ case 4:
2676
+ if (!(_i2 < _Object$entries2.length)) {
2677
+ _context3.n = 7;
2678
+ break;
2679
+ }
2680
+ _Object$entries2$_i = slicedToArray._slicedToArray(_Object$entries2[_i2], 2), path = _Object$entries2$_i[0], base64 = _Object$entries2$_i[1];
2681
+ _context3.n = 5;
2682
+ return resolveAsset(path, base64);
2683
+ case 5:
2684
+ resolved = _context3.v;
2685
+ assetUrls.set(path, resolved.url);
2686
+ if (resolved.file) assetFiles[resolved.file.name] = resolved.file.base64;
2687
+ case 6:
2688
+ _i2++;
2689
+ _context3.n = 4;
2690
+ break;
2691
+ case 7:
2692
+ // Collected once rather than per target: the stylesheet is the same either
2693
+ // way, and only the client ever uses it. Whether a build produced one is
2694
+ // recorded in the head pointer at publish time, because the loader -- not the
2695
+ // shell -- injects the link.
2696
+ // Parsed once for the whole build rather than per target or per import:
2697
+ // reading tsconfig.json on every resolveId call would be the hot path in a
2698
+ // build whose whole point is that it takes a second. Both the CSS walk and
2699
+ // the resolver get the same map -- two resolvers disagreeing about what
2700
+ // `@/components/Card` means is how the alias support broke on its first real
2701
+ // use, so they are given it from one place.
2702
+ aliases = aliasMap(input.files, function (message) {
2703
+ return warnings.push(message);
2704
+ });
2705
+ _context3.n = 8;
2706
+ return collectCss(input.files, projectPaths.ENTRY, input.target.project.css, aliases);
2707
+ case 8:
2708
+ css = _context3.v;
2709
+ // Tailwind runs over the *concatenated* stylesheet, so the project's own
2710
+ // rules and its `@import "tailwindcss"` compile together and the cascade
2711
+ // order the CSS pass derived is preserved. Skipped entirely when the project
2712
+ // does not ask for it, which keeps the cost off every other build.
2713
+ styles = css.code;
2714
+ tailwindMs = 0;
2715
+ warnings.push.apply(warnings, slicedToArray._toConsumableArray(css.warnings));
2716
+ if (!usesTailwind(styles)) {
2717
+ _context3.n = 10;
2718
+ break;
2719
+ }
2720
+ _context3.n = 9;
2721
+ return compileTailwind(styles, input.files, input.loadCssModule);
2722
+ case 9:
2723
+ compiled = _context3.v;
2724
+ styles = compiled.css;
2725
+ tailwindMs = compiled.ms;
2726
+ warnings.push.apply(warnings, slicedToArray._toConsumableArray(compiled.warnings));
2727
+ case 10:
2728
+ serverStarted = performance.now();
2729
+ _context3.n = 11;
2730
+ return buildOnce(input, "./vendor/", "./pvendor/", "server", warnings, clientModules, false, assetUrls, css.modules, aliases);
2731
+ case 11:
2732
+ serverBuild = _context3.v;
2733
+ server = performance.now() - serverStarted;
2734
+ clientStarted = performance.now();
2735
+ _context3.n = 12;
2736
+ return buildOnce(input, "/_vendor/", "/_pvendor/".concat(rev, "/"), "client", warnings, clientModules, false, assetUrls, css.modules, aliases);
2737
+ case 12:
2738
+ clientBuild = _context3.v;
2739
+ client = performance.now() - clientStarted; // Paths are relative to `rsc/app.js`, one directory down, so both layers are
2740
+ // addressed with a leading `../`. Getting this wrong does not fail the build;
2741
+ // the cold isolate simply refuses to boot.
2742
+ if (!input.rsc) {
2743
+ _context3.n = 14;
2744
+ break;
2745
+ }
2746
+ _context3.n = 13;
2747
+ return buildOnce(
2748
+ // `../pvendor/`, with no revision segment: the revision belongs in the
2749
+ // browser URL, where it buys immutable caching. Inside the module map
2750
+ // there is exactly one layer and the key is `pvendor/<name>.js`, so a
2751
+ // revision here is a path segment that does not exist -- and the cold
2752
+ // isolate is where you would find that out.
2753
+ input, "../vendor-rsc/", "../pvendor/", "server", warnings, clientModules, true, assetUrls, css.modules, aliases);
2754
+ case 13:
2755
+ _t2 = _context3.v;
2756
+ _context3.n = 15;
2757
+ break;
2758
+ case 14:
2759
+ _t2 = undefined;
2760
+ case 15:
2761
+ rscBuild = _t2;
2762
+ // Stripped of the `public/` prefix here rather than at every consumer: the
2763
+ // prefix is a convention of the project layout, and what the loader needs is
2764
+ // the URL path.
2765
+ publicFiles = {};
2766
+ for (_i3 = 0, _Object$entries3 = Object.entries((_input$publicFiles = input.publicFiles) !== null && _input$publicFiles !== void 0 ? _input$publicFiles : {}); _i3 < _Object$entries3.length; _i3++) {
2767
+ _Object$entries3$_i = slicedToArray._slicedToArray(_Object$entries3[_i3], 2), _path = _Object$entries3$_i[0], _base = _Object$entries3$_i[1];
2768
+ publicFiles[_path.replace(/^public\//, "")] = _base;
2769
+ }
2770
+ _t3 = serverBuild.code;
2771
+ _t4 = clientBuild.code;
2772
+ _t5 = serverBuild.chunks;
2773
+ _t6 = clientBuild.chunks;
2774
+ _t7 = assetFiles;
2775
+ _t8 = publicFiles;
2776
+ _t9 = styles;
2777
+ _t0 = Object.values(input.files).some(function (code) {
2778
+ return /\.css\?url/.test(code);
2779
+ });
2780
+ _t1 = rscBuild === null || rscBuild === void 0 ? void 0 : rscBuild.code;
2781
+ _t10 = rscBuild === null || rscBuild === void 0 ? void 0 : rscBuild.chunks;
2782
+ _t11 = input.rsc ? clientModules : undefined;
2783
+ _t12 = input.target.base.rev;
2784
+ _context3.n = 16;
2785
+ return sha256Hex([input.target.base.rev, rev, styles].concat(slicedToArray._toConsumableArray(Object.entries(assetFiles).flat()), slicedToArray._toConsumableArray(Object.entries(publicFiles).flat()), slicedToArray._toConsumableArray([serverBuild, clientBuild, rscBuild].flatMap(function (built) {
2786
+ return built ? [built.code].concat(slicedToArray._toConsumableArray(Object.entries(built.chunks).flat())) : [];
2787
+ }))).join("\0"));
2788
+ case 16:
2789
+ _t13 = _context3.v.slice(0, 32);
2790
+ _t14 = {
2791
+ server: server,
2792
+ client: client,
2793
+ tailwind: tailwindMs,
2794
+ total: performance.now() - started
2795
+ };
2796
+ _t15 = slicedToArray._toConsumableArray(new Set(warnings));
2797
+ return _context3.a(2, {
2798
+ serverCode: _t3,
2799
+ clientCode: _t4,
2800
+ serverChunks: _t5,
2801
+ clientChunks: _t6,
2802
+ assetFiles: _t7,
2803
+ publicFiles: _t8,
2804
+ cssCode: _t9,
2805
+ linksOwnCss: _t0,
2806
+ rscCode: _t1,
2807
+ rscChunks: _t10,
2808
+ clientModules: _t11,
2809
+ vendorRev: _t12,
2810
+ hash: _t13,
2811
+ timings: _t14,
2812
+ warnings: _t15
2813
+ });
2814
+ }
2815
+ }, _callee3);
2816
+ }));
2817
+ return _buildUserApp.apply(this, arguments);
2818
+ }
2819
+ function publishPayload(build, extra) {
2820
+ return slicedToArray._objectSpread2({
2821
+ serverCode: build.serverCode,
2822
+ clientCode: build.clientCode,
2823
+ serverChunks: build.serverChunks,
2824
+ clientChunks: build.clientChunks,
2825
+ cssCode: build.cssCode,
2826
+ linksOwnCss: build.linksOwnCss,
2827
+ rscCode: build.rscCode,
2828
+ rscChunks: build.rscChunks,
2829
+ assetFiles: build.assetFiles,
2830
+ publicFiles: build.publicFiles,
2831
+ hash: build.hash,
2832
+ vendorRev: build.vendorRev
2833
+ }, extra);
2834
+ }
2835
+
2836
+ /** One artifact, ready to declare and to upload. */
2837
+
2838
+ /**
2839
+ * Every artifact a build publishes, by key.
2840
+ *
2841
+ * Async because the hashes are, and the hashes are because `crypto.subtle` is
2842
+ * the one digest available both in a tab and in Node -- see `hash.ts`.
2843
+ *
2844
+ * An empty stylesheet is omitted rather than uploaded as an empty artifact: a
2845
+ * project with no CSS has no `css` key, which is what `loaderPayload.ts` reads
2846
+ * `text("css") !== undefined` to decide.
2847
+ */
2848
+ function publishArtifacts(_x) {
2849
+ return _publishArtifacts.apply(this, arguments);
2850
+ }
2851
+ function _publishArtifacts() {
2852
+ _publishArtifacts = slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function _callee2(build) {
2853
+ var options,
2854
+ encoder,
2855
+ out,
2856
+ single,
2857
+ group,
2858
+ _args2 = arguments;
2859
+ return slicedToArray._regenerator().w(function (_context2) {
2860
+ while (1) switch (_context2.n) {
2861
+ case 0:
2862
+ options = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {};
2863
+ encoder = new TextEncoder();
2864
+ out = [];
2865
+ single = function single(key, body) {
2866
+ if (body === undefined || body === "") return;
2867
+ out.push({
2868
+ key: key,
2869
+ body: body
2870
+ });
2871
+ };
2872
+ single(artifactKeys.ARTIFACT_KEYS.server, build.serverCode);
2873
+ single(artifactKeys.ARTIFACT_KEYS.client, build.clientCode);
2874
+ single(artifactKeys.ARTIFACT_KEYS.css, build.cssCode);
2875
+ single(artifactKeys.ARTIFACT_KEYS.rsc, build.rscCode);
2876
+ if (options.projectSource !== undefined) {
2877
+ single(artifactKeys.ARTIFACT_KEYS.source, JSON.stringify(options.projectSource));
2878
+ }
2879
+ group = function group(prefix, record) {
2880
+ for (var _i = 0, _Object$entries = Object.entries(record !== null && record !== void 0 ? record : {}); _i < _Object$entries.length; _i++) {
2881
+ var _Object$entries$_i = slicedToArray._slicedToArray(_Object$entries[_i], 2),
2882
+ name = _Object$entries$_i[0],
2883
+ body = _Object$entries$_i[1];
2884
+ /*
2885
+ * The name is appended and nothing else touches it. An asset is addressed
2886
+ * by the path the built code imports it at, so normalising it here --
2887
+ * stripping, lowercasing, re-joining -- produces a bundle whose imports
2888
+ * resolve to nothing, at runtime, in the isolate. `loaderPayload.ts` says
2889
+ * the same thing on the way back.
2890
+ */
2891
+ out.push({
2892
+ key: "".concat(prefix).concat(name),
2893
+ body: body
2894
+ });
2895
+ }
2896
+ };
2897
+ group(artifactKeys.ARTIFACT_PREFIXES.serverChunks, build.serverChunks);
2898
+ group(artifactKeys.ARTIFACT_PREFIXES.clientChunks, build.clientChunks);
2899
+ group(artifactKeys.ARTIFACT_PREFIXES.rscChunks, build.rscChunks);
2900
+ group(artifactKeys.ARTIFACT_PREFIXES.assetFiles, build.assetFiles);
2901
+ group(artifactKeys.ARTIFACT_PREFIXES.publicFiles, build.publicFiles);
2902
+ return _context2.a(2, Promise.all(out.map(/*#__PURE__*/function () {
2903
+ var _ref2 = slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function _callee(_ref) {
2904
+ var key, body, _t, _t2, _t3, _t4;
2905
+ return slicedToArray._regenerator().w(function (_context) {
2906
+ while (1) switch (_context.n) {
2907
+ case 0:
2908
+ key = _ref.key, body = _ref.body;
2909
+ _t = key;
2910
+ _t2 = body;
2911
+ _context.n = 1;
2912
+ return sha256Hex(body);
2913
+ case 1:
2914
+ _t3 = _context.v;
2915
+ _t4 = encoder.encode(body).length;
2916
+ return _context.a(2, {
2917
+ key: _t,
2918
+ body: _t2,
2919
+ sha256: _t3,
2920
+ bytes: _t4
2921
+ });
2922
+ }
2923
+ }, _callee);
2924
+ }));
2925
+ return function (_x2) {
2926
+ return _ref2.apply(this, arguments);
2927
+ };
2928
+ }())));
2929
+ }
2930
+ }, _callee2);
2931
+ }));
2932
+ return _publishArtifacts.apply(this, arguments);
2933
+ }
2934
+
2935
+ /*
2936
+ * The git tree hash of a file record, computed the way git computes it.
2937
+ *
2938
+ * ## Why not any other hash
2939
+ *
2940
+ * The platform compares what a publisher built against what the commit it names
2941
+ * actually holds. That comparison is only useful if two honest publishers of one
2942
+ * commit agree -- and "a hash over the file record" does not give that. CI
2943
+ * hashes a checkout, a browser tab hashes its in-memory record, and they differ
2944
+ * over anything at all: a generated file, a binary the tab skipped,
2945
+ * `val.server.ts` wired at a different moment, line endings. Every instant
2946
+ * publish would then look like a divergence and be replaced by the CI build, and
2947
+ * the pointer would churn after every save.
2948
+ *
2949
+ * The tree hash removes the question rather than tightening the tolerance. It is
2950
+ * what git already stores for the commit, so CI has it for nothing and the
2951
+ * region reads it from the git host along with HEAD. Two honest builds of one
2952
+ * commit then agree BY DEFINITION, because they are both naming the same object.
2953
+ *
2954
+ * ## The format, which is small and unforgiving
2955
+ *
2956
+ * A blob is `blob <byteLength>\0<bytes>`, SHA-1'd. A tree is the concatenation
2957
+ * of `<mode> <name>\0<20 raw sha bytes>` over its entries, SHA-1'd, built
2958
+ * bottom-up. Modes are `100644`, `100755` and `40000` -- a tree's mode has no
2959
+ * leading zero inside an entry, which is the detail that silently produces a
2960
+ * hash git disagrees with.
2961
+ *
2962
+ * Entry order is where a reimplementation usually goes wrong: git sorts by name,
2963
+ * but compares a directory as though its name ended in `/`. So `foo.txt` sorts
2964
+ * BEFORE `foo/` even though `.` is below `/` in ASCII. Get that wrong and the
2965
+ * hash is stable, plausible, and not git's.
2966
+ */
2967
+ /** SHA-1 over bytes, as the 20 raw bytes git concatenates into a tree. */
2968
+ function sha1(_x) {
2969
+ return _sha.apply(this, arguments);
2970
+ }
2971
+ function _sha() {
2972
+ _sha = slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function _callee(bytes) {
2973
+ var digest;
2974
+ return slicedToArray._regenerator().w(function (_context) {
2975
+ while (1) switch (_context.n) {
2976
+ case 0:
2977
+ _context.n = 1;
2978
+ return crypto.subtle.digest("SHA-1", bytes);
2979
+ case 1:
2980
+ digest = _context.v;
2981
+ return _context.a(2, new Uint8Array(digest));
2982
+ }
2983
+ }, _callee);
2984
+ }));
2985
+ return _sha.apply(this, arguments);
2986
+ }
2987
+ var hex = function hex(bytes) {
2988
+ return Array.from(bytes, function (b) {
2989
+ return b.toString(16).padStart(2, "0");
2990
+ }).join("");
2991
+ };
2992
+ function concat(parts) {
2993
+ var total = parts.reduce(function (n, p) {
2994
+ return n + p.length;
2995
+ }, 0);
2996
+ var out = new Uint8Array(total);
2997
+ var at = 0;
2998
+ var _iterator = slicedToArray._createForOfIteratorHelper(parts),
2999
+ _step;
3000
+ try {
3001
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
3002
+ var part = _step.value;
3003
+ out.set(part, at);
3004
+ at += part.length;
3005
+ }
3006
+ } catch (err) {
3007
+ _iterator.e(err);
3008
+ } finally {
3009
+ _iterator.f();
3010
+ }
3011
+ return out;
3012
+ }
3013
+ var utf8 = function utf8(text) {
3014
+ return new TextEncoder().encode(text);
3015
+ };
3016
+
3017
+ /** `blob <length>\0<content>`, hashed. The same value as `git hash-object`. */
3018
+ function blobSha(_x2) {
3019
+ return _blobSha.apply(this, arguments);
3020
+ }
3021
+ function _blobSha() {
3022
+ _blobSha = slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function _callee2(content) {
3023
+ var _t;
3024
+ return slicedToArray._regenerator().w(function (_context2) {
3025
+ while (1) switch (_context2.n) {
3026
+ case 0:
3027
+ _t = hex;
3028
+ _context2.n = 1;
3029
+ return sha1(concat([utf8("blob ".concat(content.length, "\0")), content]));
3030
+ case 1:
3031
+ return _context2.a(2, _t(_context2.v));
3032
+ }
3033
+ }, _callee2);
3034
+ }));
3035
+ return _blobSha.apply(this, arguments);
3036
+ }
3037
+ /**
3038
+ * The sort git uses, which is not the sort a reader expects.
3039
+ *
3040
+ * A tree entry compares as though its name had a trailing `/`. `/` is 0x2F and
3041
+ * `.` is 0x2E, so `foo.txt` comes before `foo/` -- the opposite of what plain
3042
+ * name ordering gives, and a difference that changes the hash without changing
3043
+ * anything a human would notice.
3044
+ */
3045
+ function gitOrder(a, b) {
3046
+ var an = a.mode === "40000" ? "".concat(a.name, "/") : a.name;
3047
+ var bn = b.mode === "40000" ? "".concat(b.name, "/") : b.name;
3048
+ return an < bn ? -1 : an > bn ? 1 : 0;
3049
+ }
3050
+ function hashTree(_x3) {
3051
+ return _hashTree.apply(this, arguments);
3052
+ }
3053
+ /** A file, as this record holds it: its bytes and whether git marks it executable. */
3054
+ function _hashTree() {
3055
+ _hashTree = slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function _callee3(entries) {
3056
+ var sorted, body;
3057
+ return slicedToArray._regenerator().w(function (_context3) {
3058
+ while (1) switch (_context3.n) {
3059
+ case 0:
3060
+ sorted = slicedToArray._toConsumableArray(entries).sort(gitOrder);
3061
+ body = concat(sorted.flatMap(function (e) {
3062
+ return [utf8("".concat(e.mode, " ").concat(e.name, "\0")), e.sha];
3063
+ }));
3064
+ return _context3.a(2, sha1(concat([utf8("tree ".concat(body.length, "\0")), body])));
3065
+ }
3066
+ }, _callee3);
3067
+ }));
3068
+ return _hashTree.apply(this, arguments);
3069
+ }
3070
+ /**
3071
+ * The tree hash of a whole file record.
3072
+ *
3073
+ * Paths are `/`-separated and may or may not start with one -- a leading slash
3074
+ * is stripped, because a record keyed `/src/a.ts` and one keyed `src/a.ts` are
3075
+ * the same tree and must not hash differently.
3076
+ *
3077
+ * An empty record hashes to git's empty tree, which is a real object with a
3078
+ * well-known id rather than a special case.
3079
+ */
3080
+ function treeSha(_x4) {
3081
+ return _treeSha.apply(this, arguments);
3082
+ }
3083
+
3084
+ /** The common case: a record of text files, none executable. */
3085
+ function _treeSha() {
3086
+ _treeSha = slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function _callee5(files) {
3087
+ var root, _i, _Object$entries, _Object$entries$_i, rawPath, file, parts, name, at, _iterator2, _step2, dir, next, _build, _t1;
3088
+ return slicedToArray._regenerator().w(function (_context5) {
3089
+ while (1) switch (_context5.n) {
3090
+ case 0:
3091
+ root = {
3092
+ files: new Map(),
3093
+ dirs: new Map()
3094
+ };
3095
+ _i = 0, _Object$entries = Object.entries(files);
3096
+ case 1:
3097
+ if (!(_i < _Object$entries.length)) {
3098
+ _context5.n = 4;
3099
+ break;
3100
+ }
3101
+ _Object$entries$_i = slicedToArray._slicedToArray(_Object$entries[_i], 2), rawPath = _Object$entries$_i[0], file = _Object$entries$_i[1];
3102
+ parts = rawPath.replace(/^\/+/, "").split("/").filter(Boolean);
3103
+ if (!(parts.length === 0)) {
3104
+ _context5.n = 2;
3105
+ break;
3106
+ }
3107
+ return _context5.a(3, 3);
3108
+ case 2:
3109
+ name = parts.pop();
3110
+ at = root;
3111
+ _iterator2 = slicedToArray._createForOfIteratorHelper(parts);
3112
+ try {
3113
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
3114
+ dir = _step2.value;
3115
+ next = at.dirs.get(dir);
3116
+ if (!next) {
3117
+ next = {
3118
+ files: new Map(),
3119
+ dirs: new Map()
3120
+ };
3121
+ at.dirs.set(dir, next);
3122
+ }
3123
+ at = next;
3124
+ }
3125
+ } catch (err) {
3126
+ _iterator2.e(err);
3127
+ } finally {
3128
+ _iterator2.f();
3129
+ }
3130
+ at.files.set(name, file);
3131
+ case 3:
3132
+ _i++;
3133
+ _context5.n = 1;
3134
+ break;
3135
+ case 4:
3136
+ _build = /*#__PURE__*/function () {
3137
+ var _ref3 = slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function _callee4(node) {
3138
+ var entries, _iterator3, _step3, _step3$value, _name, _file, _iterator4, _step4, _step4$value, _name2, _dir, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9, _t0;
3139
+ return slicedToArray._regenerator().w(function (_context4) {
3140
+ while (1) switch (_context4.p = _context4.n) {
3141
+ case 0:
3142
+ entries = [];
3143
+ _iterator3 = slicedToArray._createForOfIteratorHelper(node.files);
3144
+ _context4.p = 1;
3145
+ _iterator3.s();
3146
+ case 2:
3147
+ if ((_step3 = _iterator3.n()).done) {
3148
+ _context4.n = 5;
3149
+ break;
3150
+ }
3151
+ _step3$value = slicedToArray._slicedToArray(_step3.value, 2), _name = _step3$value[0], _file = _step3$value[1];
3152
+ _t2 = entries;
3153
+ _t3 = _file.executable ? "100755" : "100644";
3154
+ _t4 = _name;
3155
+ _context4.n = 3;
3156
+ return sha1(concat([utf8("blob ".concat(_file.content.length, "\0")), _file.content]));
3157
+ case 3:
3158
+ _t5 = _context4.v;
3159
+ _t2.push.call(_t2, {
3160
+ mode: _t3,
3161
+ name: _t4,
3162
+ sha: _t5
3163
+ });
3164
+ case 4:
3165
+ _context4.n = 2;
3166
+ break;
3167
+ case 5:
3168
+ _context4.n = 7;
3169
+ break;
3170
+ case 6:
3171
+ _context4.p = 6;
3172
+ _t6 = _context4.v;
3173
+ _iterator3.e(_t6);
3174
+ case 7:
3175
+ _context4.p = 7;
3176
+ _iterator3.f();
3177
+ return _context4.f(7);
3178
+ case 8:
3179
+ _iterator4 = slicedToArray._createForOfIteratorHelper(node.dirs);
3180
+ _context4.p = 9;
3181
+ _iterator4.s();
3182
+ case 10:
3183
+ if ((_step4 = _iterator4.n()).done) {
3184
+ _context4.n = 13;
3185
+ break;
3186
+ }
3187
+ _step4$value = slicedToArray._slicedToArray(_step4.value, 2), _name2 = _step4$value[0], _dir = _step4$value[1];
3188
+ _t7 = entries;
3189
+ _t8 = _name2;
3190
+ _context4.n = 11;
3191
+ return _build(_dir);
3192
+ case 11:
3193
+ _t9 = _context4.v;
3194
+ _t7.push.call(_t7, {
3195
+ mode: "40000",
3196
+ name: _t8,
3197
+ sha: _t9
3198
+ });
3199
+ case 12:
3200
+ _context4.n = 10;
3201
+ break;
3202
+ case 13:
3203
+ _context4.n = 15;
3204
+ break;
3205
+ case 14:
3206
+ _context4.p = 14;
3207
+ _t0 = _context4.v;
3208
+ _iterator4.e(_t0);
3209
+ case 15:
3210
+ _context4.p = 15;
3211
+ _iterator4.f();
3212
+ return _context4.f(15);
3213
+ case 16:
3214
+ return _context4.a(2, hashTree(entries));
3215
+ }
3216
+ }, _callee4, null, [[9, 14, 15, 16], [1, 6, 7, 8]]);
3217
+ }));
3218
+ return function build(_x5) {
3219
+ return _ref3.apply(this, arguments);
3220
+ };
3221
+ }();
3222
+ _t1 = hex;
3223
+ _context5.n = 5;
3224
+ return _build(root);
3225
+ case 5:
3226
+ return _context5.a(2, _t1(_context5.v));
3227
+ }
3228
+ }, _callee5);
3229
+ }));
3230
+ return _treeSha.apply(this, arguments);
3231
+ }
3232
+ function treeShaOfText(files) {
3233
+ var encoder = new TextEncoder();
3234
+ return treeSha(Object.fromEntries(Object.entries(files).map(function (_ref) {
3235
+ var _ref2 = slicedToArray._slicedToArray(_ref, 2),
3236
+ path = _ref2[0],
3237
+ text = _ref2[1];
3238
+ return [path, {
3239
+ content: encoder.encode(text)
3240
+ }];
3241
+ })));
3242
+ }
3243
+
3244
+ function _typeof(o) {
3245
+ "@babel/helpers - typeof";
3246
+
3247
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
3248
+ return typeof o;
3249
+ } : function (o) {
3250
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
3251
+ }, _typeof(o);
3252
+ }
3253
+
3254
+ /**
3255
+ * Where a Val project keeps the module this replaces.
3256
+ *
3257
+ * Exported because a caller has to be able to rewrite JUST this file. The
3258
+ * commit is baked into it (see `BUILT_FROM` in the template), and the files a save
3259
+ * writes are the `.val.ts` ones it patched -- this is never among them, so a tab
3260
+ * that laid a save over the project and rebuilt would compile the NEW content
3261
+ * against the OLD commit and read the wrong version of it back. `rebakeGit` is
3262
+ * what the Studio calls.
3263
+ */
3264
+ var VAL_SERVER_PATH = "src/val/val.server.ts";
3265
+ var VAL_SERVER = VAL_SERVER_PATH;
3266
+ var PROJECT_SOURCE_TYPES = "src/val/project-source.d.ts";
3267
+
3268
+ /**
3269
+ * The first line of every `val.server.ts` this file generates, and how
3270
+ * {@link isWired} recognises one.
3271
+ *
3272
+ * A comment rather than anything the file DOES, because a wired file no longer
3273
+ * does anything no other Val host does: it used to post the files a save
3274
+ * committed to `platform.internal`, for a builder tab to pick up, and that
3275
+ * sentinel host was the marker. A managed project's Studio builds in its own
3276
+ * tab now, the loader refuses that door, and the post went with it.
3277
+ */
3278
+ var WIRED_MARKER = "// Wired for the Val platform by @valbuild/tanstack-build. Regenerated on publish.";
3279
+
3280
+ /**
3281
+ * The sentinel host a file wired BEFORE {@link WIRED_MARKER} existed posted to.
3282
+ * Still recognised by {@link isWired}, so a project published by an older
3283
+ * publisher is not wired twice.
3284
+ */
3285
+ var LEGACY_CONTROL_HOST = "platform.internal";
3286
+
3287
+ /**
3288
+ * The editing backend, as this platform needs it.
3289
+ *
3290
+ * **This is http mode, and almost nothing here deviates from it.** A published
3291
+ * app reads its content from Val's content service at a commit, relays patches
3292
+ * there, and hands the browser a presigned URL to upload an image to -- exactly
3293
+ * as a Val app deployed anywhere else does. Worth stating because this file used
3294
+ * to do none of it: it put Val in `memory` mode, which sets `patchesAreLocal`,
3295
+ * and that one flag moved pending patches into a store of the platform's own and
3296
+ * buffered every draft image through the isolate. Two behaviours nobody chose,
3297
+ * out of one word.
3298
+ *
3299
+ * One thing differs, and it is load bearing:
3300
+ *
3301
+ * - **no formatter.** A repository passes prettier here so a patch written to
3302
+ * disk comes out formatted like the rest of the code. Prettier's bundle
3303
+ * TDZ-crashes in a Worker isolate ("Cannot access 'y' before
3304
+ * initialization"), and nothing is being written to disk anyway.
3305
+ *
3306
+ * WHAT IT COSTS, said here because the code cannot show it: a project with no
3307
+ * `VAL_API_KEY` and `VAL_SECRET` cannot serve its content at all, where a
3308
+ * memory-mode build could -- its sources were compiled into the bundle, and
3309
+ * these are fetched. Credentials stop being what EDITING needs and become what
3310
+ * running needs.
3311
+ */
3312
+ var valServerSource = function valServerSource(_ref) {
3313
+ var git = _ref.git;
3314
+ return "".concat(WIRED_MARKER, "\nimport {\n initValContent,\n initValServer,\n} from \"@valbuild/tanstack/server\";\nimport { config } from \"../../val.config\";\nimport valModules from \"../../val.modules\";\n\n/**\n * A secret, as the platform hands it over at RUNTIME.\n *\n * Preferred over `process.env`, which the builder inlines as a literal into\n * this bundle: that puts the value in storage inside the code, copies it into\n * every isolate that loads it, and makes rotating it a republish.\n *\n * Falls back to the build-time value, so an app published before secrets\n * existed keeps working.\n */\nfunction secret(name: string): string | undefined {\n return (globalThis.__PLATFORM_SECRETS ?? {})[name] ?? process.env[name];\n}\n\n/**\n * The commit this build was made from, and the branch it commits to.\n *\n * Baked in rather than handed over at runtime, unlike a secret, because it is\n * not configuration -- it is a property OF THIS BUILD. Every read of a\n * `.val.ts` in http mode fetches that path from the content service at this\n * sha, so a build served with somebody else's commit renders and edits a\n * version of its files it was not compiled from. A secret can be rotated under\n * a running build; this cannot, and publishing again is how it changes.\n *\n * WHAT THIS IS NOT. It is not every read: a committed render reads the source\n * bundled into this build and asks the content service nothing. It is the\n * PUBLISH path -- turning pending patches into new `.val.ts` text means\n * fetching the current text to patch, and that is the read that happens at\n * this sha. The docblock used to say \"every read\", which sent readers looking\n * for a content call on the serving path that is not there.\n *\n * `null` when the source came from no commit -- a record assembled in a tab,\n * a fixture, or ANY build this platform makes, which is the common case rather\n * than the exception. Such a build has no repository to mirror commits into,\n * and does not need one: the content service is the store of record for\n * content and mints its own commit shas. Val is in http mode on credentials\n * alone.\n */\nconst BUILT_FROM = ").concat(git ? JSON.stringify(git) : "null", ";\n\n/**\n * What puts Val in http mode: its content service owns the content.\n *\n * The same three things any deployed Val app is configured with. Note what is\n * NOT here: no `sourceFiles`, so patches are relayed to the content service\n * instead of being kept by this platform, and the browser uploads an image\n * straight there on a presigned URL instead of streaming it through here.\n *\n * `undefined` when a credential or the commit is missing, and deliberately not\n * a throw at module scope: that would take the isolate down with it, page\n * renders included. Val is left to refuse the request and name what it wanted\n * -- `VAL_ENV=app` is set on this build precisely so that a missing credential\n * is an error instead of a fall-through to `fs` mode, looking for a working\n * tree that is not in here.\n */\nconst apiKey = secret(\"VAL_API_KEY\");\nconst valSecret = secret(\"VAL_SECRET\");\n/*\n * Which content service, for a project that is not pointed at the real one.\n *\n * A secret rather than a baked literal, because unlike the commit this IS\n * configuration: the same build should be servable against a stand-in and\n * against production. It is what makes the editing path testable at all --\n * Val's own `e2e/mock-content-host` implements this wire protocol with no git\n * repository behind it -- and without it a build could only ever talk to\n * content.val.build.\n *\n * It does NOT redirect everything, and the gap is in Val rather than here:\n * `getSettings`, which remote FILES use, reads `process.env.VAL_CONTENT_URL`\n * at module scope inside @valbuild/server. This platform bundles its\n * dependencies separately from the app, so nothing it sets reaches that read --\n * the same reason `apiKey` has to be passed in rather than found. So patches,\n * commits and source reads go where this says, and remote file uploads still\n * address the real host.\n */\nconst valContentUrl = secret(\"VAL_CONTENT_URL\");\n/*\n * WHICH project's content this is, at the content service.\n *\n * Val's own name for the project (`org/name`), which is not the platform's\n * project id and cannot be derived from it. A repository that is deployed\n * anywhere else puts it in `val.config.ts`; one imported here need not have,\n * so it is configuration the platform can supply -- and it goes through\n * `secret` rather than `--env` for a second reason: a build-time literal\n * would have to be baked into the shared dependency layer, where\n * @valbuild/server reads `process.env.VAL_PROJECT`, and that layer is reused\n * by every project with the same dependencies.\n *\n * What the app configured wins over nothing at all, so a repository that does\n * name its project keeps working with no secret set.\n */\nconst valProject = secret(\"VAL_PROJECT\");\nconst valConfig = {\n ...config,\n ...(valProject !== undefined ? { project: valProject } : {}),\n};\n/*\n * CREDENTIALS ALONE. A commit is not part of what puts Val in http mode.\n *\n * It used to be: `GIT !== null` was in this condition, and a build with no\n * commit fell through to `undefined` -- which meant every site this platform\n * seeded was silently unable to edit, because a shared build cannot know a\n * commit. The binding that worked around it (`VAL_GIT_COMMIT` /\n * `VAL_GIT_BRANCH` out of the project's secrets) is gone with it: it named a\n * commit in the TEMPLATE's repository, which was true only for as long as\n * seeding and repository creation shared a template, and it was one more thing\n * in KV that could go stale.\n *\n * The commit is optional NOW, and it is still sent where there is one -- see\n * the note at the spread below. What is gone is the binding that supplied one\n * from KV, so there is one source per environment and no precedence rule\n * between a baked value and a bound one.\n */\nconst http =\n apiKey !== undefined && valSecret !== undefined\n ? {\n apiKey,\n valSecret,\n /*\n * BOTH SPELLINGS OF THE COMMIT, because the APP decides which one is\n * read and this file cannot know which app it is being written into.\n *\n * `ValHttpMode` has been renamed in both directions. Up to 0.132 it\n * took `gitCommit`/`gitBranch`; 0.133.0 replaced that pair with a\n * nested `git`; the version this package ships beside flattens it\n * back again. The generated file is compiled against whatever\n * `@valbuild/tanstack` the PROJECT installed -- the starter pins\n * 0.133.0 -- and a platform writing this file has no say in that. So\n * this is not one rename behind or ahead: it is on both sides of one at\n * once, and will be until every app it publishes has moved.\n *\n * Sending only the wrong one is SILENT, which is why this is belt and\n * braces rather than a version check. An unknown key on the options\n * object is ignored, so the commit is simply dropped and a build wired\n * FROM A COMMIT runs as though it had none -- which means a publish\n * produces no mirrored `.val.ts`, so a save commits and hands over\n * nothing, and the site keeps serving its old content with the patches\n * already consumed. Nothing reports it. valbuild/home's loop is the one\n * thing that sees it, and it was bisected there: 25/25 with the key the\n * installed version reads, 21/23 without, failing at exactly \"the save\n * left the file it rewrote pending\".\n *\n * Whichever version is installed reads its own key and ignores the\n * other two. Drop this to one spelling when every app this platform\n * publishes is past the rename -- not before, and not on the say-so of\n * a compiler in the Val repository, which is looking at a different\n * version of `@valbuild/tanstack` than the app is.\n */\n ...(BUILT_FROM !== null\n ? {\n git: BUILT_FROM,\n gitCommit: BUILT_FROM.commit,\n gitBranch: BUILT_FROM.branch,\n }\n : {}),\n ...(valContentUrl !== undefined ? { valContentUrl } : {}),\n }\n : undefined;\n\nconst { valApiHandler, draftMode } = initValServer(\n valModules,\n valConfig,\n {\n ...(http ? { http } : {}),\n },\n);\n\nconst {\n fetchValStega: fetchVal,\n fetchValKeyStega: fetchValKey,\n fetchValRouteStega: fetchValRoute,\n fetchValRouteUrl,\n} = initValContent(valConfig, valModules, {\n draftMode,\n /*\n * The SAME object the API got.\n *\n * These readers resolve content through a Val server of their own rather than\n * by calling the API over HTTP, so the mode question is put to them\n * separately -- configuring only `initValServer` left them inferring `fs`\n * mode, looking for a working tree that is not in here. `gitCommit` is the\n * field that would be silently wrong rather than loudly missing: two\n * different shas means the API edits one version of a file while the page\n * renders another.\n */\n ...(http ? { http } : {}),\n});\n\n/**\n * A build that is MEANT to edit and cannot, refusing instead of pretending to.\n *\n * `BUILT_FROM` being non-null says this build came from a commit, so it was\n * made to edit against a content service. If the credentials for that service are not\n * here, the configuration is broken -- and the failure that was reaching people\n * was not an error at all. Val picks its storage mode by inference, so an\n * isolate with no api key lands in a mode that ACCEPTS the write and keeps it\n * in the isolate. Cloudflare starts an isolate per concurrent request, so the\n * save answers 200 and the next request, served by a different isolate, has\n * never heard of it. The edit is simply gone, and nothing anywhere said so.\n *\n * That is the worst available outcome: a person is told their work is saved\n * when it is not. Refusing is strictly better, and naming the missing secret\n * turns an evening of reading logs into one line in a response body.\n *\n * WHY HERE rather than relying on `VAL_ENV=app`: that is a build-time\n * substitution into the shared dependency layer, so whether a build fails\n * loudly depends on which layer it happens to be pinned to. This file is\n * written on every build, by the platform, and cannot be missing from one.\n *\n * Only the editing API. Page renders do not come through here, and a site whose\n * content cannot be edited should still serve the content it has.\n */\nconst editingApiHandler =\n http === undefined\n ? async () => {\n const missing = [\n apiKey === undefined ? \"VAL_API_KEY\" : null,\n valSecret === undefined ? \"VAL_SECRET\" : null,\n /*\n * A build from no commit is listed the same way, because from the\n * outside the two are one state. It is not a secret somebody can set\n * -- a commit is a property OF THE BUILD, and the only cure is\n * publishing this project's own repository over whatever is serving\n * it. Named anyway, because \"it was built from no commit\" is the\n * sentence that ends the search.\n */\n BUILT_FROM === null ? \"a commit (this build was made from none)\" : null,\n ].filter(Boolean);\n return Response.json(\n {\n error:\n \"This site cannot be edited. Its content lives in a content service, and \" +\n missing.join(\", \") +\n \" \" +\n (missing.length > 1 ? \"are\" : \"is\") +\n \" missing, so there is nothing to edit against. Editing is refused rather \" +\n \"than kept in this isolate's memory, where it would be lost without being \" +\n \"reported.\" +\n (BUILT_FROM === null\n ? \" A build made from no commit is usually one SEEDED from a template: \" +\n \"publish this project's own repository to replace it.\"\n : \" This build was made from commit \" + BUILT_FROM.commit.slice(0, 8) + \".\"),\n missing,\n },\n { status: 503 },\n );\n }\n : valApiHandler;\n\nexport {\n editingApiHandler as valApiHandler,\n draftMode,\n fetchVal,\n fetchValKey,\n fetchValRoute,\n fetchValRouteUrl,\n};\n");
3315
+ };
3316
+
3317
+ /**
3318
+ * Types for what the PLATFORM supplies, which is in no package.
3319
+ *
3320
+ * Declared rather than suppressed: an editor open on this project should know
3321
+ * what `FILES` is, and the alternative is a file full of red squiggles that a
3322
+ * developer learns to ignore.
3323
+ */
3324
+ var PROJECT_SOURCE_DECLARATIONS = "// Generated by the Val studio when this project was wired up to the platform.\n// The build resolves this specifier to the project's own source, shipped into\n// the isolate as a module.\ndeclare module 'platform:project-source' {\n /** Every source file of this project, keyed by its path from the root. */\n export const FILES: Record<string, string>\n}\n\ndeclare global {\n /**\n * The project this isolate is serving, set per request by the platform from\n * the id the loader resolved off the hostname.\n *\n * Absent when server-rendering outside the platform, and in the browser.\n */\n // eslint-disable-next-line no-var\n var __PLATFORM_PROJECT_ID: string | undefined\n /**\n * This project's secrets, handed over per request rather than built in.\n *\n * SERVER ONLY -- set by the platform's Worker entry, which never runs in a\n * browser. Absent outside the platform.\n */\n // eslint-disable-next-line no-var\n var __PLATFORM_SECRETS: Record<string, string> | undefined\n}\nexport {}\n";
3325
+
3326
+ /**
3327
+ * The wired `val.server.ts`, on its own.
3328
+ *
3329
+ * {@link wireUp} does this and eight other things, which is right when a
3330
+ * repository arrives and wrong every time a build is about to run: re-deriving
3331
+ * a package.json and a route entry to change one baked-in sha would be a lot of
3332
+ * machinery to get a one-line difference, and any of it not being idempotent
3333
+ * would be a bug that only shows up on the second publish.
3334
+ */
3335
+ function wiredValServer(options) {
3336
+ return valServerSource(options);
3337
+ }
3338
+
3339
+ /**
3340
+ * The commit a wired record was last built at, read back out of the file.
3341
+ *
3342
+ * The inverse of `BUILT_FROM` in the template, and it lives here so that one place
3343
+ * knows the format -- a reader elsewhere would go stale the first time the
3344
+ * template's shape changed, and silently, since a failed parse and a build
3345
+ * with no commit look identical.
3346
+ *
3347
+ * There is nowhere else this could come from. A record adopted from the live
3348
+ * build IS the published source, and the commit it was published at is a
3349
+ * literal inside its own `val.server.ts`.
3350
+ */
3351
+ /**
3352
+ * The one line that carries the commit.
3353
+ *
3354
+ * Shared by the reader below and the rewriter under it, so the two cannot
3355
+ * disagree about the format -- which they would silently, since a failed parse
3356
+ * and a build made from no commit are the same answer.
3357
+ */
3358
+ var BUILT_FROM_LINE = /^const BUILT_FROM = (.+);$/m;
3359
+ function bakedGit(files) {
3360
+ var source = files[VAL_SERVER];
3361
+ if (source === undefined) return undefined;
3362
+ /*
3363
+ * `BUILT_FROM`, which is the literal, and now the only place a commit can
3364
+ * come from at all.
3365
+ *
3366
+ * There used to be a `GIT` expression beside it that fell back to a runtime
3367
+ * binding for a SHARED build, which a reader of files alone could not
3368
+ * evaluate. That has gone: the content service owns the commit chain, so a
3369
+ * platform build bakes nothing and binds nothing, and this returns
3370
+ * `undefined` for one -- which is the truth about it.
3371
+ */
3372
+ var match = BUILT_FROM_LINE.exec(source);
3373
+ if (!(match !== null && match !== void 0 && match[1]) || match[1] === "null") return undefined;
3374
+ try {
3375
+ var parsed = JSON.parse(match[1]);
3376
+ if (_typeof(parsed) !== "object" || parsed === null) return undefined;
3377
+ var _ref2 = parsed,
3378
+ commit = _ref2.commit,
3379
+ branch = _ref2.branch;
3380
+ if (typeof commit !== "string" || typeof branch !== "string") return undefined;
3381
+ if (commit === "" || branch === "") return undefined;
3382
+ return {
3383
+ commit: commit,
3384
+ branch: branch
3385
+ };
3386
+ } catch (_unused) {
3387
+ return undefined;
3388
+ }
3389
+ }
3390
+
3391
+ /**
3392
+ * The same record, wired at a different commit.
3393
+ *
3394
+ * The inverse of {@link bakedGit}, and the whole of what a rebuild has to
3395
+ * change: `BUILT_FROM` is the only place the commit appears, and every other
3396
+ * use in the generated file reads it.
3397
+ *
3398
+ * REWRITES one line rather than regenerating the file, and that is the point.
3399
+ * `wiredValServer` needs the project id and the platform's address, which the
3400
+ * publisher that has them is the tab; a Studio publishing from inside the
3401
+ * deployment has neither, and reconstructing the file from what it could guess
3402
+ * would throw away wiring it cannot see. Replacing the literal cannot.
3403
+ *
3404
+ * Returns the record unchanged when there is nothing to rewrite -- no
3405
+ * `val.server.ts`, or one this does not recognise. Unchanged rather than
3406
+ * thrown, because the caller's next step is a build, and a build of a record
3407
+ * with no wired server is a project that was never wired: a real thing, which
3408
+ * fails with its own message rather than this one.
3409
+ *
3410
+ * Non-destructive, like {@link wireUp}: the caller's record is what gets
3411
+ * published back as source.
3412
+ */
3413
+ function rebakeGit(files, git) {
3414
+ var source = files[VAL_SERVER];
3415
+ if (source === undefined) return files;
3416
+ if (!BUILT_FROM_LINE.test(source)) return files;
3417
+ return slicedToArray._objectSpread2(slicedToArray._objectSpread2({}, files), {}, slicedToArray._defineProperty({}, VAL_SERVER, source.replace(BUILT_FROM_LINE, "const BUILT_FROM = ".concat(git === null ? "null" : JSON.stringify(git), ";"))));
3418
+ }
3419
+
3420
+ /** Is this a Val project at all? */
3421
+ function isValProject(files) {
3422
+ return "val.config.ts" in files && "val.modules.ts" in files;
3423
+ }
3424
+
3425
+ /**
3426
+ * Has this record already been wired up?
3427
+ *
3428
+ * {@link WIRED_MARKER} is the marker, or -- for a file generated before it
3429
+ * existed -- the sentinel host that file posted its saves to. It used to be
3430
+ * `platform:project-source` before that, which the generated file imported
3431
+ * while Val was in memory mode.
3432
+ */
3433
+ function isWired(files) {
3434
+ var source = files[VAL_SERVER];
3435
+ if (source === undefined) return false;
3436
+ return source.startsWith(WIRED_MARKER) || source.includes(LEGACY_CONTROL_HOST);
3437
+ }
3438
+
3439
+ /**
3440
+ * Returns the record with the platform's wiring applied, and what it changed.
3441
+ *
3442
+ * Non-destructive, and that matters more than it looks: the caller's record is
3443
+ * what an edit is applied to, and the source that gets published back.
3444
+ */
3445
+ function wireUp(files, options) {
3446
+ var out = slicedToArray._objectSpread2({}, files);
3447
+ var changes = [];
3448
+ var warnings = [];
3449
+ if (!isValProject(files)) {
3450
+ warnings.push("No val.config.ts or val.modules.ts: this does not look like a Val project, so nothing " + "was wired up. It may still build and serve.");
3451
+ return {
3452
+ files: out,
3453
+ changes: changes,
3454
+ warnings: warnings
3455
+ };
3456
+ }
3457
+
3458
+ // --- the editing backend ----------------------------------------------------
3459
+
3460
+ out[VAL_SERVER] = valServerSource(options);
3461
+ changes.push({
3462
+ what: "".concat(VAL_SERVER, " rewritten for the platform"),
3463
+ why: "Val reads its content over HTTP at this commit, as in any deployment, and a publish " + "also hands the files it committed to the platform so the tab can build them -- nothing " + "else turns a commit into a running site, because there is no bundler in the isolate"
3464
+ });
3465
+ out[PROJECT_SOURCE_TYPES] = PROJECT_SOURCE_DECLARATIONS;
3466
+ changes.push({
3467
+ what: "".concat(PROJECT_SOURCE_TYPES, " added"),
3468
+ why: "the platform sets globals for the project id and its secrets, and the build can " + "supply `platform:project-source`; no package declares either"
3469
+ });
3470
+
3471
+ // --- the Studio's own bundle ------------------------------------------------
3472
+
3473
+ /*
3474
+ * `@valbuild/ui` carries the Studio's UI -- 7.15 MB, base64-embedded into the
3475
+ * package, served by `/api/val/static/...`. A template usually has it only as
3476
+ * a TRANSITIVE dependency, and the vendor layer is built from what a project
3477
+ * DECLARES intersected with what it imports. Undeclared, the Studio loads its
3478
+ * shell and then 404s on its own bundle.
3479
+ */
3480
+ var manifestRaw = files["package.json"];
3481
+ if (manifestRaw) {
3482
+ try {
3483
+ var _manifest$dependencie;
3484
+ var manifest = JSON.parse(manifestRaw);
3485
+ var deps = (_manifest$dependencie = manifest.dependencies) !== null && _manifest$dependencie !== void 0 ? _manifest$dependencie : {};
3486
+ if (deps["@valbuild/core"] && !deps["@valbuild/ui"]) {
3487
+ deps["@valbuild/ui"] = deps["@valbuild/core"];
3488
+ manifest.dependencies = deps;
3489
+ out["package.json"] = "".concat(JSON.stringify(manifest, null, 2), "\n");
3490
+ changes.push({
3491
+ what: "@valbuild/ui declared as a dependency",
3492
+ why: "it carries the Studio bundle and was only a transitive dependency; the vendor " + "layer is built from what the project declares"
3493
+ });
3494
+ }
3495
+ } catch (_unused2) {
3496
+ warnings.push("package.json could not be parsed, so @valbuild/ui was not declared.");
3497
+ }
3498
+ }
3499
+
3500
+ // --- generated output the repository happens to track -----------------------
3501
+
3502
+ /*
3503
+ * `routeTree.gen.ts` is derived, and this platform generates it per build.
3504
+ * Most projects gitignore it; `valbuild/template-tanstack-starter` tracks it,
3505
+ * so an import carries a stale copy -- which the build would overwrite and
3506
+ * then publish BACK as project source, so the record would slowly fill with
3507
+ * generated files that are never read.
3508
+ */
3509
+ if (projectPaths.TREE in out) {
3510
+ delete out[projectPaths.TREE];
3511
+ changes.push({
3512
+ what: "".concat(projectPaths.TREE, " dropped"),
3513
+ why: "it is generated per build; a tracked copy would be published back as project source"
3514
+ });
3515
+ }
3516
+
3517
+ // --- what wiring cannot fix -------------------------------------------------
3518
+
3519
+ warnings.push("This wires the SOURCE up. The project still needs a dependency layer built for it, which " + "is a pass over node_modules and cannot happen in a browser.");
3520
+ return {
3521
+ files: out,
3522
+ changes: changes,
3523
+ warnings: warnings
3524
+ };
3525
+ }
3526
+
3527
+ exports.ENTRY = projectPaths.ENTRY;
3528
+ exports.ROUTES_DIR = projectPaths.ROUTES_DIR;
3529
+ exports.TREE = projectPaths.TREE;
3530
+ exports.ARTIFACT_KEYS = artifactKeys.ARTIFACT_KEYS;
3531
+ exports.ARTIFACT_PREFIXES = artifactKeys.ARTIFACT_PREFIXES;
3532
+ exports.ENTRY_CHUNK = ENTRY_CHUNK;
3533
+ exports.INLINE_LIMIT = INLINE_LIMIT;
3534
+ exports.PROJECT_SOURCE = PROJECT_SOURCE;
3535
+ exports.PUBLIC_PREFIX = PUBLIC_PREFIX;
3536
+ exports.VAL_SERVER_PATH = VAL_SERVER_PATH;
3537
+ exports.aliasMap = aliasMap;
3538
+ exports.bakedGit = bakedGit;
3539
+ exports.base64Bytes = base64Bytes;
3540
+ exports.blobSha = blobSha;
3541
+ exports.buildUserApp = buildUserApp;
3542
+ exports.fetchBuildTarget = fetchBuildTarget;
3543
+ exports.fetchBuildTargetRev = fetchBuildTargetRev;
3544
+ exports.isAsset = isAsset;
3545
+ exports.isValProject = isValProject;
3546
+ exports.isWired = isWired;
3547
+ exports.publishArtifacts = publishArtifacts;
3548
+ exports.publishPayload = publishPayload;
3549
+ exports.rebakeGit = rebakeGit;
3550
+ exports.resolveInFiles = resolveInFiles;
3551
+ exports.scanCandidates = scanCandidates;
3552
+ exports.treeSha = treeSha;
3553
+ exports.treeShaOfText = treeShaOfText;
3554
+ exports.usesTailwind = usesTailwind;
3555
+ exports.wireUp = wireUp;
3556
+ exports.wiredValServer = wiredValServer;