@orieljs/framework 0.1.0-alpha.1 → 0.1.0-alpha.2

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.
package/dist/index.js CHANGED
@@ -22,7 +22,7 @@ import {
22
22
  renderToString,
23
23
  styleString,
24
24
  view
25
- } from "./chunk-WI7E7Q46.js";
25
+ } from "./chunk-TIE5OAMF.js";
26
26
  import {
27
27
  Application as Application2,
28
28
  ApplicationBuilder,
@@ -36,8 +36,14 @@ import {
36
36
  QueueFake,
37
37
  Repository,
38
38
  StorageFake,
39
- env
40
- } from "./chunk-BZPCRKFQ.js";
39
+ Vite,
40
+ ViteError,
41
+ ViteHtml,
42
+ currentVite,
43
+ env,
44
+ vite,
45
+ viteReactRefresh
46
+ } from "./chunk-UPZAML2Q.js";
41
47
  import {
42
48
  Arr,
43
49
  BindingResolutionError,
@@ -59,7 +65,7 @@ import {
59
65
  retry,
60
66
  tap,
61
67
  value
62
- } from "./chunk-AI2RFMBT.js";
68
+ } from "./chunk-IRHK7GH7.js";
63
69
  import {
64
70
  Application,
65
71
  AuthFactory,
@@ -83,6 +89,8 @@ import {
83
89
  Hasher,
84
90
  HttpKernel,
85
91
  HttpRequest,
92
+ InertiaFactory,
93
+ InertiaSsrGateway,
86
94
  LogManager,
87
95
  MailManager,
88
96
  MiddlewareCallbacks,
@@ -101,7 +109,7 @@ import {
101
109
  ValidationFactory,
102
110
  ViewFactory,
103
111
  token
104
- } from "./chunk-K6MAA3RM.js";
112
+ } from "./chunk-3ZRPBRAE.js";
105
113
 
106
114
  // ../Auth/dist/index.js
107
115
  import { timingSafeEqual } from "crypto";
@@ -2963,7 +2971,7 @@ var NodeConsoleInput = class {
2963
2971
  const line = this.lines.shift();
2964
2972
  if (line !== void 0) return line;
2965
2973
  if (this.ended) throw new Error("Aborted.");
2966
- return new Promise((resolve3, reject) => this.waiting.push({ resolve: resolve3, reject }));
2974
+ return new Promise((resolve4, reject) => this.waiting.push({ resolve: resolve4, reject }));
2967
2975
  }
2968
2976
  close() {
2969
2977
  const rl = this.rl;
@@ -4025,7 +4033,7 @@ var ScheduleWorkCommand = class extends Command {
4025
4033
  description = "Start the schedule worker";
4026
4034
  async handle() {
4027
4035
  const schedule = inject(Schedule);
4028
- const sleep5 = this.workOptions.sleep ?? ((ms) => new Promise((resolve3) => setTimeout(resolve3, ms)));
4036
+ const sleep5 = this.workOptions.sleep ?? ((ms) => new Promise((resolve4) => setTimeout(resolve4, ms)));
4029
4037
  const clock = this.workOptions.now ?? Date.now;
4030
4038
  this.info("Running scheduled tasks every minute.");
4031
4039
  let lastMinute;
@@ -4058,13 +4066,13 @@ var TestCommand = class extends Command {
4058
4066
  if (typeof filter === "string") args.push("--testNamePattern", filter);
4059
4067
  const extra = this.argument("args");
4060
4068
  if (Array.isArray(extra)) args.push(...extra);
4061
- return new Promise((resolve3) => {
4069
+ return new Promise((resolve4) => {
4062
4070
  const child = this.spawner("npx", args);
4063
4071
  child.on("error", (error) => {
4064
4072
  this.error(error.message);
4065
- resolve3(1);
4073
+ resolve4(1);
4066
4074
  });
4067
- child.on("exit", (code) => resolve3(code ?? 1));
4075
+ child.on("exit", (code) => resolve4(code ?? 1));
4068
4076
  });
4069
4077
  }
4070
4078
  };
@@ -4079,10 +4087,10 @@ var TinkerCommand = class extends Command {
4079
4087
  handle() {
4080
4088
  const app2 = inject(Application);
4081
4089
  const startRepl = this.tinkerOptions.start ?? ((options) => start(options));
4082
- return new Promise((resolve3) => {
4090
+ return new Promise((resolve4) => {
4083
4091
  const repl = startRepl({ prompt: "oriel> " });
4084
4092
  repl.context.app = app2;
4085
- repl.on("exit", () => resolve3(0));
4093
+ repl.on("exit", () => resolve4(0));
4086
4094
  });
4087
4095
  }
4088
4096
  };
@@ -6704,14 +6712,14 @@ var SchemaGrammar = class {
6704
6712
  compile(blueprint) {
6705
6713
  const statements = [];
6706
6714
  const commands = [...blueprint.commands, ...blueprint.fluentIndexCommands()];
6707
- const handled = /* @__PURE__ */ new Set();
6715
+ const handled2 = /* @__PURE__ */ new Set();
6708
6716
  if (blueprint.creating) {
6709
- statements.push(this.compileCreate(blueprint, commands, handled));
6717
+ statements.push(this.compileCreate(blueprint, commands, handled2));
6710
6718
  } else if (blueprint.columns.length) {
6711
- statements.push(...this.compileAdd(blueprint, commands, handled));
6719
+ statements.push(...this.compileAdd(blueprint, commands, handled2));
6712
6720
  }
6713
6721
  for (const command of commands) {
6714
- if (command.name === "create" || handled.has(command)) continue;
6722
+ if (command.name === "create" || handled2.has(command)) continue;
6715
6723
  statements.push(...this.compileCommand(blueprint, command));
6716
6724
  }
6717
6725
  if (blueprint.creating || blueprint.columns.length) statements.push(...this.compileComments(blueprint));
@@ -6826,21 +6834,21 @@ var present = (parts) => parts.filter((part) => part !== void 0);
6826
6834
  var SqliteSchemaGrammar = class extends SchemaGrammar {
6827
6835
  driver = "sqlite";
6828
6836
  /** SQLite can't add keys to an existing table, so primary and foreign keys go inside create table. */
6829
- compileCreate(blueprint, commands, handled) {
6837
+ compileCreate(blueprint, commands, handled2) {
6830
6838
  const parts = blueprint.columns.map((column) => this.columnDefinition(column));
6831
6839
  for (const command of commands) {
6832
6840
  if (command.name === "primary") {
6833
6841
  parts.push(sql4`primary key (${columnList(command.columns)})`);
6834
- handled.add(command);
6842
+ handled2.add(command);
6835
6843
  } else if (command.name === "foreign") {
6836
6844
  parts.push(this.foreignKeyClause(command.foreign));
6837
- handled.add(command);
6845
+ handled2.add(command);
6838
6846
  }
6839
6847
  }
6840
6848
  return sql4`create table ${sql4.id(blueprint.table)} (${join23(parts)})`;
6841
6849
  }
6842
6850
  /** New columns may carry an inline `references` clause (the only foreign key SQLite can add later). */
6843
- compileAdd(blueprint, commands, handled) {
6851
+ compileAdd(blueprint, commands, handled2) {
6844
6852
  return blueprint.columns.map((column) => {
6845
6853
  const foreign = commands.find(
6846
6854
  (command) => command.name === "foreign" && command.foreign.columns.length === 1 && command.foreign.columns[0] === column.name
@@ -6848,7 +6856,7 @@ var SqliteSchemaGrammar = class extends SchemaGrammar {
6848
6856
  let definition = this.columnDefinition(column);
6849
6857
  if (foreign) {
6850
6858
  definition = sql4`${definition} ${this.referencesClause(foreign.foreign)}`;
6851
- handled.add(foreign);
6859
+ handled2.add(foreign);
6852
6860
  }
6853
6861
  return sql4`alter table ${sql4.id(blueprint.table)} add column ${definition}`;
6854
6862
  });
@@ -7033,10 +7041,10 @@ var PostgresSchemaGrammar = class extends SchemaGrammar {
7033
7041
  };
7034
7042
  var MySqlSchemaGrammar = class extends SchemaGrammar {
7035
7043
  driver = "mysql";
7036
- compileCreate(blueprint, commands, handled) {
7044
+ compileCreate(blueprint, commands, handled2) {
7037
7045
  const charset = this.config.charset ?? "utf8mb4";
7038
7046
  const collation = this.config.collation ?? "utf8mb4_unicode_ci";
7039
- return sql4`${super.compileCreate(blueprint, commands, handled)} default character set ${sql4.raw(charset.replace(/[^\w]/g, ""))} collate ${sql4.lit(collation)}`;
7047
+ return sql4`${super.compileCreate(blueprint, commands, handled2)} default character set ${sql4.raw(charset.replace(/[^\w]/g, ""))} collate ${sql4.lit(collation)}`;
7040
7048
  }
7041
7049
  compileAdd(blueprint) {
7042
7050
  return blueprint.columns.map((column) => sql4`alter table ${sql4.id(blueprint.table)} add ${this.columnDefinition(column)}`);
@@ -12659,8 +12667,12 @@ import { basename as basename2 } from "path";
12659
12667
  import { Readable as Readable2 } from "stream";
12660
12668
  import { readFile as readFile4 } from "fs/promises";
12661
12669
  import { fileURLToPath } from "url";
12662
- import { createServer } from "http";
12670
+ import { createReadStream as createReadStream22 } from "fs";
12671
+ import { stat as stat22 } from "fs/promises";
12663
12672
  import { Readable as Readable22 } from "stream";
12673
+ import { relative as relative5, resolve as resolve3, sep as sep4 } from "path";
12674
+ import { createServer } from "http";
12675
+ import { Readable as Readable3 } from "stream";
12664
12676
  import { pipeline as pipeline2 } from "stream/promises";
12665
12677
  import { existsSync as existsSync7 } from "fs";
12666
12678
  import { mkdir as mkdir5, readFile as readFile22, writeFile as writeFile6 } from "fs/promises";
@@ -12855,13 +12867,16 @@ var TYPES = {
12855
12867
  ico: "image/vnd.microsoft.icon",
12856
12868
  jpg: "image/jpeg",
12857
12869
  js: "text/javascript",
12870
+ map: "application/json",
12858
12871
  json: "application/json",
12859
12872
  md: "text/markdown",
12860
12873
  mp3: "audio/mpeg",
12861
12874
  mp4: "video/mp4",
12875
+ otf: "font/otf",
12862
12876
  pdf: "application/pdf",
12863
12877
  png: "image/png",
12864
12878
  svg: "image/svg+xml",
12879
+ ttf: "font/ttf",
12865
12880
  txt: "text/plain",
12866
12881
  wasm: "application/wasm",
12867
12882
  webm: "video/webm",
@@ -13984,6 +13999,33 @@ function applyExceptionCallbacks(app2, handler3) {
13984
13999
  const configurator = new ExceptionsConfiguration(handler3);
13985
14000
  for (const callback of app2.make(ExceptionCallbacks)) callback(configurator);
13986
14001
  }
14002
+ var HIDDEN_SEGMENT = /^\.|\.(ts|tsx|mts|cts)$|[. ]$/i;
14003
+ async function servePublicFile(publicPath, request2) {
14004
+ if (request2.method !== "GET" && request2.method !== "HEAD") return void 0;
14005
+ let pathname;
14006
+ try {
14007
+ pathname = decodeURIComponent(new URL(request2.url).pathname);
14008
+ } catch {
14009
+ return void 0;
14010
+ }
14011
+ if (pathname === "/" || pathname.includes("\0")) return void 0;
14012
+ const root = resolve3(publicPath);
14013
+ const file = resolve3(root, `.${pathname}`);
14014
+ if (!file.startsWith(root + sep4)) return void 0;
14015
+ if (relative5(root, file).split(/[\\/]/).some((segment) => HIDDEN_SEGMENT.test(segment))) return void 0;
14016
+ const info = await stat22(file).catch(() => void 0);
14017
+ if (info === void 0 || !info.isFile()) return void 0;
14018
+ const type = mimeFromExtension2(file);
14019
+ const headers = new Headers({
14020
+ "content-type": type.startsWith("text/") || type === "application/json" ? `${type}; charset=utf-8` : type,
14021
+ "content-length": String(info.size),
14022
+ "last-modified": info.mtime.toUTCString()
14023
+ });
14024
+ if (pathname.startsWith("/build/assets/")) headers.set("cache-control", "public, max-age=31536000, immutable");
14025
+ if (request2.method === "HEAD") return new Response(null, { status: 200, headers });
14026
+ const body = Readable22.toWeb(createReadStream22(file));
14027
+ return new Response(body, { status: 200, headers });
14028
+ }
13987
14029
  async function terminateRequest(app2, request2, response2) {
13988
14030
  try {
13989
14031
  if (app2.bound(HttpKernel)) await app2.make(HttpKernel).terminate?.(request2, response2);
@@ -13991,8 +14033,12 @@ async function terminateRequest(app2, request2, response2) {
13991
14033
  console.error(error);
13992
14034
  }
13993
14035
  }
13994
- async function handleSafely(app2, request2) {
14036
+ async function handleSafely(app2, request2, publicPath) {
13995
14037
  try {
14038
+ if (publicPath !== void 0) {
14039
+ const file = await servePublicFile(publicPath, request2);
14040
+ if (file !== void 0) return file;
14041
+ }
13996
14042
  return await app2.handle(request2);
13997
14043
  } catch (error) {
13998
14044
  console.error(error);
@@ -14018,13 +14064,13 @@ async function serveBun(app2, options) {
14018
14064
  const bun = bunRuntime();
14019
14065
  if (bun === void 0) throw new HttpServerError("Bun.serve is not available: the process is not running on Bun.");
14020
14066
  let markClosed = () => void 0;
14021
- const closed = new Promise((resolve3) => markClosed = resolve3);
14067
+ const closed = new Promise((resolve22) => markClosed = resolve22);
14022
14068
  const server = bun.serve({
14023
14069
  port: options.port,
14024
14070
  hostname: options.hostname,
14025
14071
  async fetch(request2, current) {
14026
14072
  setClientAddress(request2, current.requestIP(request2)?.address);
14027
- const response2 = await handleSafely(app2, request2);
14073
+ const response2 = await handleSafely(app2, request2, options.publicPath);
14028
14074
  setTimeout(() => void terminateRequest(app2, request2, response2), 0);
14029
14075
  return response2;
14030
14076
  },
@@ -14036,8 +14082,8 @@ async function serveBun(app2, options) {
14036
14082
  let closing;
14037
14083
  const close = () => closing ??= (async () => {
14038
14084
  let timer;
14039
- const forced = new Promise((resolve3) => {
14040
- timer = setTimeout(() => void Promise.resolve(server.stop(true)).then(resolve3), options.shutdownTimeout);
14085
+ const forced = new Promise((resolve22) => {
14086
+ timer = setTimeout(() => void Promise.resolve(server.stop(true)).then(resolve22), options.shutdownTimeout);
14041
14087
  });
14042
14088
  await Promise.race([Promise.resolve(server.stop(false)), forced]);
14043
14089
  clearTimeout(timer);
@@ -14133,7 +14179,7 @@ async function writeResponse(res, response2) {
14133
14179
  res.end();
14134
14180
  return;
14135
14181
  }
14136
- await pipeline2(Readable22.fromWeb(response2.body), res);
14182
+ await pipeline2(Readable3.fromWeb(response2.body), res);
14137
14183
  }
14138
14184
  async function serveNode(app2, options) {
14139
14185
  const fallbackHost = `${displayHost(options.hostname)}:${options.port}`;
@@ -14148,7 +14194,7 @@ async function serveNode(app2, options) {
14148
14194
  return;
14149
14195
  }
14150
14196
  setClientAddress(request2, req.socket.remoteAddress);
14151
- const response2 = await handleSafely(app2, request2);
14197
+ const response2 = await handleSafely(app2, request2, options.publicPath);
14152
14198
  try {
14153
14199
  await writeResponse(res, response2);
14154
14200
  } catch {
@@ -14157,18 +14203,18 @@ async function serveNode(app2, options) {
14157
14203
  await terminateRequest(app2, request2, response2);
14158
14204
  })();
14159
14205
  });
14160
- await new Promise((resolve3, reject) => {
14206
+ await new Promise((resolve22, reject) => {
14161
14207
  server.once("error", reject);
14162
14208
  server.listen(options.port, options.hostname, () => {
14163
14209
  server.off("error", reject);
14164
- resolve3();
14210
+ resolve22();
14165
14211
  });
14166
14212
  });
14167
14213
  const address = server.address();
14168
- const closed = new Promise((resolve3) => server.once("close", () => resolve3()));
14214
+ const closed = new Promise((resolve22) => server.once("close", () => resolve22()));
14169
14215
  let closing;
14170
14216
  const close = () => closing ??= (async () => {
14171
- const done = new Promise((resolve3) => server.close(() => resolve3()));
14217
+ const done = new Promise((resolve22) => server.close(() => resolve22()));
14172
14218
  server.closeIdleConnections();
14173
14219
  const idle = setInterval(() => server.closeIdleConnections(), 50);
14174
14220
  const force = setTimeout(() => server.closeAllConnections(), options.shutdownTimeout);
@@ -14194,7 +14240,8 @@ async function serve(app2, options = {}) {
14194
14240
  port: options.port ?? Number(process.env.PORT ?? process.env.SERVER_PORT ?? 8e3),
14195
14241
  hostname: options.hostname ?? "127.0.0.1",
14196
14242
  signals: options.signals ?? true,
14197
- shutdownTimeout: options.shutdownTimeout ?? 1e4
14243
+ shutdownTimeout: options.shutdownTimeout ?? 1e4,
14244
+ ...options.publicPath !== false && { publicPath: options.publicPath ?? app2.publicPath() }
14198
14245
  };
14199
14246
  await app2.boot();
14200
14247
  const runtime = options.runtime ?? detectRuntime();
@@ -14234,12 +14281,12 @@ function routeListRows(routes) {
14234
14281
  return rows.sort((a, b) => a.uri < b.uri ? -1 : a.uri > b.uri ? 1 : 0);
14235
14282
  }
14236
14283
  function filterRouteList(rows, filters) {
14237
- const excluded = (filters.exceptPath ?? "").split(",").filter((path) => path !== "");
14284
+ const excluded2 = (filters.exceptPath ?? "").split(",").filter((path) => path !== "");
14238
14285
  return rows.filter((row) => {
14239
14286
  if (filters.name !== void 0 && !(row.name ?? "").includes(filters.name)) return false;
14240
14287
  if (filters.path !== void 0 && !row.uri.includes(filters.path)) return false;
14241
14288
  if (filters.method !== void 0 && !row.method.includes(filters.method.toUpperCase())) return false;
14242
- return !excluded.some((path) => row.uri.includes(path));
14289
+ return !excluded2.some((path) => row.uri.includes(path));
14243
14290
  });
14244
14291
  }
14245
14292
  function formatRouteList(rows, width) {
@@ -14386,10 +14433,1295 @@ var HttpServiceProvider = class extends ServiceProvider {
14386
14433
  }
14387
14434
  };
14388
14435
 
14436
+ // ../Inertia/dist/index.js
14437
+ import { existsSync as existsSync8 } from "fs";
14438
+ import { join as join10 } from "path";
14439
+ import { createHash as createHash5 } from "crypto";
14440
+ import { existsSync as existsSync23, readFileSync } from "fs";
14441
+ import { spawn as spawn2 } from "child_process";
14442
+ import { existsSync as existsSync33 } from "fs";
14443
+ import { mkdir as mkdir6, writeFile as writeFile7 } from "fs/promises";
14444
+ import { dirname as dirname6, isAbsolute as isAbsolute2, join as join24, relative as relative6 } from "path";
14445
+ import { existsSync as existsSync42, readFileSync as readFileSync2 } from "fs";
14446
+ var Header = {
14447
+ INERTIA: "X-Inertia",
14448
+ ERROR_BAG: "X-Inertia-Error-Bag",
14449
+ LOCATION: "X-Inertia-Location",
14450
+ REDIRECT: "X-Inertia-Redirect",
14451
+ VERSION: "X-Inertia-Version",
14452
+ PARTIAL_COMPONENT: "X-Inertia-Partial-Component",
14453
+ PARTIAL_ONLY: "X-Inertia-Partial-Data",
14454
+ PARTIAL_EXCEPT: "X-Inertia-Partial-Except",
14455
+ RESET: "X-Inertia-Reset",
14456
+ INFINITE_SCROLL_MERGE_INTENT: "X-Inertia-Infinite-Scroll-Merge-Intent",
14457
+ EXCEPT_ONCE_PROPS: "X-Inertia-Except-Once-Props"
14458
+ };
14459
+ function parseList(value2) {
14460
+ const items = (value2 ?? "").split(",").filter((item) => item !== "");
14461
+ return items.length === 0 ? void 0 : items;
14462
+ }
14463
+ var Prop = class {
14464
+ constructor(value2) {
14465
+ this.value = value2;
14466
+ }
14467
+ value;
14468
+ mergeState = { merge: false, deep: false, append: true, appendPaths: [], prependPaths: [], matchOn: [] };
14469
+ onceState = { once: false, fresh: false, key: void 0, ttlSeconds: void 0 };
14470
+ deferred = false;
14471
+ deferGroup;
14472
+ /** Calls the callback, if the value is one. */
14473
+ async resolve() {
14474
+ return typeof this.value === "function" ? await this.value() : this.value;
14475
+ }
14476
+ /** Never sent on the first load (OptionalProp, DeferProp). */
14477
+ ignoresFirstLoad() {
14478
+ return false;
14479
+ }
14480
+ /** Sent even when a partial reload didn't ask for it (AlwaysProp). */
14481
+ isAlways() {
14482
+ return false;
14483
+ }
14484
+ /** Errors are reported and the prop is left out, instead of failing the page (defer(..., { rescue: true })). */
14485
+ shouldRescue() {
14486
+ return false;
14487
+ }
14488
+ // Once (honoured by OptionalProp, DeferProp, MergeProp and OnceProp) ------------------------------------
14489
+ /** once(), once(false), once(true, { as: 'key', until: 3600 }). */
14490
+ once(value2 = true, options = {}) {
14491
+ this.onceState.once = value2;
14492
+ if (options.as !== void 0) this.onceState.key = options.as;
14493
+ if (options.until !== void 0) this.onceState.ttlSeconds = secondsUntil(options.until);
14494
+ return this;
14495
+ }
14496
+ /** A custom once key, so pages can share the prop under different names. */
14497
+ as(key) {
14498
+ this.onceState.key = key;
14499
+ return this;
14500
+ }
14501
+ /** Send the prop again even though the client already has it. */
14502
+ fresh(value2 = true) {
14503
+ this.onceState.fresh = value2;
14504
+ return this;
14505
+ }
14506
+ /** Expire after a number of seconds, or at a Date. */
14507
+ until(delay) {
14508
+ this.onceState.ttlSeconds = secondsUntil(delay);
14509
+ return this;
14510
+ }
14511
+ // Merging -------------------------------------------------------------------------------------------------
14512
+ isMergeable() {
14513
+ return false;
14514
+ }
14515
+ shouldMerge() {
14516
+ return this.isMergeable() && this.mergeState.merge;
14517
+ }
14518
+ shouldDeepMerge() {
14519
+ return this.mergeState.deep;
14520
+ }
14521
+ matchesOn() {
14522
+ return [...this.mergeState.matchOn];
14523
+ }
14524
+ appendsAtRoot() {
14525
+ return this.mergeState.append && this.mergesAtRoot();
14526
+ }
14527
+ prependsAtRoot() {
14528
+ return !this.mergeState.append && this.mergesAtRoot();
14529
+ }
14530
+ appendsAtPaths() {
14531
+ return [...this.mergeState.appendPaths];
14532
+ }
14533
+ prependsAtPaths() {
14534
+ return [...this.mergeState.prependPaths];
14535
+ }
14536
+ mergesAtRoot() {
14537
+ return this.mergeState.appendPaths.length === 0 && this.mergeState.prependPaths.length === 0;
14538
+ }
14539
+ // Deferring -----------------------------------------------------------------------------------------------
14540
+ isDeferrable() {
14541
+ return false;
14542
+ }
14543
+ shouldDefer() {
14544
+ return this.isDeferrable() && this.deferred;
14545
+ }
14546
+ group() {
14547
+ return this.deferGroup ?? "default";
14548
+ }
14549
+ // Once ----------------------------------------------------------------------------------------------------
14550
+ isOnceable() {
14551
+ return false;
14552
+ }
14553
+ shouldResolveOnce() {
14554
+ return this.isOnceable() && this.onceState.once;
14555
+ }
14556
+ shouldBeRefreshed() {
14557
+ return this.onceState.fresh;
14558
+ }
14559
+ getKey() {
14560
+ return this.onceState.key;
14561
+ }
14562
+ /** Epoch milliseconds, or null when the prop never expires. */
14563
+ expiresAt() {
14564
+ return this.onceState.ttlSeconds === void 0 ? null : (Math.floor(Date.now() / 1e3) + this.onceState.ttlSeconds) * 1e3;
14565
+ }
14566
+ };
14567
+ var MergeableProp = class extends Prop {
14568
+ isMergeable() {
14569
+ return true;
14570
+ }
14571
+ merge() {
14572
+ this.mergeState.merge = true;
14573
+ return this;
14574
+ }
14575
+ deepMerge() {
14576
+ this.mergeState.deep = true;
14577
+ return this.merge();
14578
+ }
14579
+ /** Match array items on these keys instead of appending duplicates: matchOn('id'). */
14580
+ matchOn(keys) {
14581
+ this.mergeState.matchOn = [keys].flat();
14582
+ return this;
14583
+ }
14584
+ /** append() at the root, append('data') at a path, append('data', 'id') with a match key, or a map of both. */
14585
+ append(path = true, matchOn) {
14586
+ return this.#place("append", path, matchOn);
14587
+ }
14588
+ prepend(path = true, matchOn) {
14589
+ return this.#place("prepend", path, matchOn);
14590
+ }
14591
+ #place(side, path, matchOn) {
14592
+ if (typeof path === "boolean") {
14593
+ this.mergeState.append = side === "append" ? path : !path;
14594
+ return this;
14595
+ }
14596
+ if (Array.isArray(path)) {
14597
+ for (const entry of path) this.#place(side, entry);
14598
+ return this;
14599
+ }
14600
+ if (typeof path === "object") {
14601
+ for (const [entry, key] of Object.entries(path)) this.#place(side, entry, key);
14602
+ return this;
14603
+ }
14604
+ ;
14605
+ (side === "append" ? this.mergeState.appendPaths : this.mergeState.prependPaths).push(path);
14606
+ if (matchOn !== void 0 && matchOn !== "") this.mergeState.matchOn = [...this.mergeState.matchOn, `${path}.${matchOn}`];
14607
+ return this;
14608
+ }
14609
+ };
14610
+ function secondsUntil(delay) {
14611
+ return delay instanceof Date ? Math.max(0, Math.round((delay.getTime() - Date.now()) / 1e3)) : delay;
14612
+ }
14613
+ var AlwaysProp = class extends Prop {
14614
+ kind = "always";
14615
+ isAlways() {
14616
+ return true;
14617
+ }
14618
+ };
14619
+ var OptionalProp = class extends Prop {
14620
+ kind = "optional";
14621
+ constructor(callback) {
14622
+ super(callback);
14623
+ }
14624
+ ignoresFirstLoad() {
14625
+ return true;
14626
+ }
14627
+ isOnceable() {
14628
+ return true;
14629
+ }
14630
+ };
14631
+ var DeferProp = class extends MergeableProp {
14632
+ kind = "defer";
14633
+ #rescue;
14634
+ constructor(callback, group, options = {}) {
14635
+ super(callback);
14636
+ this.deferred = true;
14637
+ this.deferGroup = group;
14638
+ this.#rescue = options.rescue ?? false;
14639
+ }
14640
+ ignoresFirstLoad() {
14641
+ return true;
14642
+ }
14643
+ isDeferrable() {
14644
+ return true;
14645
+ }
14646
+ isOnceable() {
14647
+ return true;
14648
+ }
14649
+ shouldRescue() {
14650
+ return this.#rescue;
14651
+ }
14652
+ };
14653
+ var MergeProp = class extends MergeableProp {
14654
+ kind = "merge";
14655
+ constructor(value2) {
14656
+ super(value2);
14657
+ this.mergeState.merge = true;
14658
+ }
14659
+ isOnceable() {
14660
+ return true;
14661
+ }
14662
+ };
14663
+ var OnceProp = class extends Prop {
14664
+ kind = "once";
14665
+ constructor(callback) {
14666
+ super(callback);
14667
+ this.onceState.once = true;
14668
+ }
14669
+ isOnceable() {
14670
+ return true;
14671
+ }
14672
+ };
14673
+ var isCursorPaginator = (value2) => typeof value2 === "object" && value2 !== null && typeof value2.getCursorName === "function";
14674
+ var isPagedPaginator = (value2) => typeof value2 === "object" && value2 !== null && typeof value2.getPageName === "function" && typeof value2.currentPage === "function" && typeof value2.hasMorePages === "function";
14675
+ function scrollMetadataFrom(value2) {
14676
+ if (isCursorPaginator(value2)) {
14677
+ const current = value2.cursor();
14678
+ return {
14679
+ pageName: value2.getCursorName(),
14680
+ previousPage: value2.previousCursor()?.encode() ?? null,
14681
+ nextPage: value2.nextCursor()?.encode() ?? null,
14682
+ currentPage: current === void 0 ? 1 : current.encode()
14683
+ };
14684
+ }
14685
+ if (isPagedPaginator(value2)) {
14686
+ const current = value2.currentPage();
14687
+ return {
14688
+ pageName: value2.getPageName(),
14689
+ previousPage: current > 1 ? current - 1 : null,
14690
+ nextPage: value2.hasMorePages() ? current + 1 : null,
14691
+ currentPage: current
14692
+ };
14693
+ }
14694
+ throw new TypeError("The given value is not a paginator. Pass a metadata callback to Inertia.scroll().");
14695
+ }
14696
+ var ScrollProp = class extends MergeableProp {
14697
+ constructor(value2, wrapper = "data", metadataResolver) {
14698
+ super(value2);
14699
+ this.wrapper = wrapper;
14700
+ this.metadataResolver = metadataResolver;
14701
+ this.mergeState.merge = true;
14702
+ }
14703
+ wrapper;
14704
+ metadataResolver;
14705
+ kind = "scroll";
14706
+ #resolved;
14707
+ isDeferrable() {
14708
+ return true;
14709
+ }
14710
+ /** Load the prop after the first render, like a deferred prop. */
14711
+ defer(group) {
14712
+ this.deferred = true;
14713
+ this.deferGroup = group;
14714
+ return this;
14715
+ }
14716
+ /** 'prepend' from the X-Inertia-Infinite-Scroll-Merge-Intent header prepends the wrapper; anything else appends. */
14717
+ configureMergeIntent(intent) {
14718
+ return intent === "prepend" ? this.prepend(this.wrapper) : this.append(this.wrapper);
14719
+ }
14720
+ /** Resolves once and caches, because both the value and its metadata need it. */
14721
+ async resolve() {
14722
+ this.#resolved ??= { value: await super.resolve() };
14723
+ return this.#resolved.value;
14724
+ }
14725
+ async metadata() {
14726
+ const value2 = await this.resolve();
14727
+ return this.metadataResolver === void 0 ? scrollMetadataFrom(value2) : this.metadataResolver(value2);
14728
+ }
14729
+ };
14730
+ var isProp = (value2) => value2 instanceof Prop;
14731
+ var isContainer = (value2) => {
14732
+ if (Array.isArray(value2)) return true;
14733
+ if (typeof value2 !== "object" || value2 === null) return false;
14734
+ const prototype = Object.getPrototypeOf(value2);
14735
+ return prototype === Object.prototype || prototype === null;
14736
+ };
14737
+ var entriesOf = (value2) => Array.isArray(value2) ? value2.map((item, index) => [String(index), item]) : Object.entries(value2);
14738
+ var PropsResolver = class {
14739
+ constructor(request2, component, options = {}) {
14740
+ this.options = options;
14741
+ this.#isPartial = request2.header(Header.PARTIAL_COMPONENT) === component;
14742
+ const inertia2 = request2.header(Header.INERTIA);
14743
+ this.#isInertia = inertia2 !== void 0 && inertia2 !== "" && inertia2 !== "false";
14744
+ this.#only = parseList(request2.header(Header.PARTIAL_ONLY));
14745
+ this.#except = parseList(request2.header(Header.PARTIAL_EXCEPT));
14746
+ this.#reset = parseList(request2.header(Header.RESET)) ?? [];
14747
+ this.#loadedOnce = parseList(request2.header(Header.EXCEPT_ONCE_PROPS)) ?? [];
14748
+ this.#mergeIntent = request2.header(Header.INFINITE_SCROLL_MERGE_INTENT);
14749
+ }
14750
+ options;
14751
+ #isPartial;
14752
+ #isInertia;
14753
+ #only;
14754
+ #except;
14755
+ #reset;
14756
+ #loadedOnce;
14757
+ #mergeIntent;
14758
+ #deferred = {};
14759
+ #rescued = [];
14760
+ #merge = [];
14761
+ #prepend = [];
14762
+ #deepMerge = [];
14763
+ #matchOn = [];
14764
+ #scroll = {};
14765
+ #once = {};
14766
+ #observed = /* @__PURE__ */ new WeakSet();
14767
+ #sharedKeys = [];
14768
+ async resolve(shared2, props) {
14769
+ if (this.options.exposeSharedPropKeys ?? true) {
14770
+ this.#sharedKeys = [...new Set(Object.keys(shared2).map((key) => key.split(".")[0]))];
14771
+ }
14772
+ this.#observePromises(shared2);
14773
+ this.#observePromises(props);
14774
+ const merged = await this.#unpackDotProps({ ...shared2, ...props });
14775
+ const resolved = await this.#resolveProps(merged, "", false);
14776
+ return { props: resolved, metadata: this.#metadata() };
14777
+ }
14778
+ #metadata() {
14779
+ const metadata = {};
14780
+ if (this.#sharedKeys.length > 0) metadata.sharedProps = this.#sharedKeys;
14781
+ if (this.#merge.length > 0) metadata.mergeProps = this.#merge;
14782
+ if (this.#prepend.length > 0) metadata.prependProps = this.#prepend;
14783
+ if (this.#deepMerge.length > 0) metadata.deepMergeProps = this.#deepMerge;
14784
+ if (this.#matchOn.length > 0) metadata.matchPropsOn = this.#matchOn;
14785
+ if (Object.keys(this.#deferred).length > 0) metadata.deferredProps = this.#deferred;
14786
+ if (this.#rescued.length > 0) metadata.rescuedProps = this.#rescued;
14787
+ if (Object.keys(this.#scroll).length > 0) metadata.scrollProps = this.#scroll;
14788
+ if (Object.keys(this.#once).length > 0) metadata.onceProps = this.#once;
14789
+ return metadata;
14790
+ }
14791
+ /**
14792
+ * Marks every raw Promise in a container tree as handled. A promise the walk never awaits (filtered out by a
14793
+ * partial reload, or after a prop that threw) would otherwise reject unobserved and could end the process.
14794
+ * Awaiting the original promise still throws its error where it is used.
14795
+ */
14796
+ #observePromises(value2) {
14797
+ if (value2 instanceof Promise) {
14798
+ value2.catch(() => void 0);
14799
+ return;
14800
+ }
14801
+ if (!isContainer(value2) || this.#observed.has(value2)) return;
14802
+ this.#observed.add(value2);
14803
+ for (const [, child] of entriesOf(value2)) this.#observePromises(child);
14804
+ }
14805
+ async #resolveProps(props, prefix, parentWasResolved) {
14806
+ this.#observePromises(props);
14807
+ const result = Array.isArray(props) ? [] : {};
14808
+ for (const [key, original] of entriesOf(props)) {
14809
+ const path = prefix === "" ? key : `${prefix}.${key}`;
14810
+ let prop = original;
14811
+ if (!this.#shouldIncludeInPartialResponse(prop, path, parentWasResolved)) continue;
14812
+ if (!this.#isPartial && this.#excludeFromInitialResponse(prop, path)) continue;
14813
+ let value2 = await this.#resolveValue(prop, path);
14814
+ if (this.#rescued.includes(path)) continue;
14815
+ if (value2 !== prop && isProp(value2)) {
14816
+ prop = value2;
14817
+ if (!this.#isPartial && this.#excludeFromInitialResponse(prop, path)) continue;
14818
+ value2 = await this.#resolveValue(prop, path);
14819
+ if (this.#rescued.includes(path)) continue;
14820
+ }
14821
+ await this.#collectMetadata(prop, path);
14822
+ const child = isContainer(value2) ? await this.#resolveProps(value2, path, parentWasResolved || !isContainer(prop)) : value2;
14823
+ if (Array.isArray(result)) result.push(child);
14824
+ else result[key] = child;
14825
+ }
14826
+ return result;
14827
+ }
14828
+ #shouldIncludeInPartialResponse(prop, path, parentWasResolved) {
14829
+ if (!this.#isPartial || parentWasResolved || isProp(prop) && prop.isAlways()) return true;
14830
+ if (this.#only !== void 0 && !this.#matchesOnly(path) && !this.#leadsToOnly(path)) return false;
14831
+ if (this.#except !== void 0 && this.#matchesExcept(path)) return false;
14832
+ return true;
14833
+ }
14834
+ #excludeFromInitialResponse(prop, path) {
14835
+ if (!isProp(prop)) return false;
14836
+ if (prop.ignoresFirstLoad()) {
14837
+ if (prop.shouldDefer() && !this.#wasAlreadyLoadedByClient(prop, path)) this.#collectDeferred(path, prop);
14838
+ if (prop.shouldMerge()) this.#collectMerge(path, prop);
14839
+ if (prop.shouldResolveOnce()) this.#collectOnce(path, prop);
14840
+ return true;
14841
+ }
14842
+ if (prop.shouldDefer()) {
14843
+ this.#collectDeferred(path, prop);
14844
+ if (prop.shouldMerge()) this.#collectMerge(path, prop);
14845
+ return true;
14846
+ }
14847
+ if (this.#isInertia && this.#wasAlreadyLoadedByClient(prop, path)) {
14848
+ this.#collectOnce(path, prop);
14849
+ return true;
14850
+ }
14851
+ return false;
14852
+ }
14853
+ #wasAlreadyLoadedByClient(prop, path) {
14854
+ return prop.shouldResolveOnce() && !prop.shouldBeRefreshed() && this.#loadedOnce.includes(prop.getKey() ?? path);
14855
+ }
14856
+ /** Callbacks and prop types run; objects with toJSON() (models, collections, paginators, dates) serialize. */
14857
+ async #resolveValue(value2, path) {
14858
+ if (value2 instanceof ScrollProp) value2.configureMergeIntent(this.#mergeIntent);
14859
+ const rescue = isProp(value2) && value2.shouldRescue();
14860
+ try {
14861
+ let resolved = value2;
14862
+ if (isProp(resolved)) resolved = await resolved.resolve();
14863
+ else if (typeof resolved === "function") resolved = await resolved();
14864
+ else if (resolved instanceof Promise) resolved = await resolved;
14865
+ if (!isProp(resolved) && typeof resolved === "object" && resolved !== null && !Array.isArray(resolved)) {
14866
+ const serializable = resolved;
14867
+ if (typeof serializable.toJSON === "function") resolved = serializable.toJSON();
14868
+ }
14869
+ return resolved;
14870
+ } catch (error) {
14871
+ if (!rescue) throw error;
14872
+ await this.options.report?.(error);
14873
+ this.#rescued.push(path);
14874
+ return null;
14875
+ }
14876
+ }
14877
+ async #collectMetadata(prop, path) {
14878
+ if (!isProp(prop)) return;
14879
+ if (prop.shouldMerge()) this.#collectMerge(path, prop);
14880
+ if (prop instanceof ScrollProp) this.#scroll[path] = { ...await prop.metadata(), reset: this.#reset.includes(path) };
14881
+ if (prop.shouldResolveOnce()) this.#collectOnce(path, prop);
14882
+ }
14883
+ #collectDeferred(path, prop) {
14884
+ ;
14885
+ (this.#deferred[prop.group()] ??= []).push(path);
14886
+ }
14887
+ #collectMerge(path, prop) {
14888
+ if (this.#reset.includes(path)) return;
14889
+ if (this.#isPartial && !this.#isIncludedInPartialMetadata(path)) return;
14890
+ if (prop.shouldDeepMerge()) this.#deepMerge.push(path);
14891
+ else if (prop.appendsAtRoot()) this.#merge.push(path);
14892
+ else if (prop.prependsAtRoot()) this.#prepend.push(path);
14893
+ else {
14894
+ for (const append of prop.appendsAtPaths()) this.#merge.push(`${path}.${append}`);
14895
+ for (const prepend of prop.prependsAtPaths()) this.#prepend.push(`${path}.${prepend}`);
14896
+ }
14897
+ for (const strategy of prop.matchesOn()) this.#matchOn.push(`${path}.${strategy}`);
14898
+ }
14899
+ #collectOnce(path, prop) {
14900
+ if (!prop.shouldResolveOnce()) return;
14901
+ if (this.#isPartial && !this.#isIncludedInPartialMetadata(path)) return;
14902
+ this.#once[prop.getKey() ?? path] = { prop: path, expiresAt: prop.expiresAt() };
14903
+ }
14904
+ #isIncludedInPartialMetadata(path) {
14905
+ if (this.#only !== void 0 && !this.#matchesOnly(path)) return false;
14906
+ if (this.#except !== void 0 && this.#matchesExcept(path)) return false;
14907
+ return true;
14908
+ }
14909
+ #matchesOnly(path) {
14910
+ return this.#only.some((only) => path === only || path.startsWith(`${only}.`));
14911
+ }
14912
+ #leadsToOnly(path) {
14913
+ return this.#only.some((only) => only.startsWith(`${path}.`));
14914
+ }
14915
+ #matchesExcept(path) {
14916
+ return this.#except.some((except) => path === except || path.startsWith(`${except}.`));
14917
+ }
14918
+ /** 'auth.user' => value becomes { auth: { user: value } }; callbacks along the path are resolved first. */
14919
+ async #unpackDotProps(props) {
14920
+ const result = { ...props };
14921
+ for (const [key, original] of Object.entries(props)) {
14922
+ if (!key.includes(".")) continue;
14923
+ let value2 = original;
14924
+ if (typeof value2 === "function") value2 = await value2();
14925
+ await this.#ensurePathIsTraversable(result, key);
14926
+ delete result[key];
14927
+ Arr.set(result, key, value2);
14928
+ }
14929
+ return result;
14930
+ }
14931
+ async #ensurePathIsTraversable(props, dotKey) {
14932
+ let current = props;
14933
+ for (const segment of dotKey.split(".").slice(0, -1)) {
14934
+ if (current[segment] === void 0 || current[segment] === null) return;
14935
+ if (typeof current[segment] === "function") current[segment] = await current[segment]();
14936
+ const value2 = current[segment];
14937
+ if (typeof value2 === "object" && value2 !== null && !isContainer(value2) && typeof value2.toJSON === "function") {
14938
+ current[segment] = value2.toJSON();
14939
+ }
14940
+ const walked = current[segment];
14941
+ if (typeof walked !== "object" || walked === null) return;
14942
+ current[segment] = Array.isArray(walked) ? [...walked] : Object.assign(Object.create(Object.getPrototypeOf(walked)), walked);
14943
+ current = current[segment];
14944
+ }
14945
+ }
14946
+ };
14947
+ function requestScope2() {
14948
+ const container = currentContainer();
14949
+ return container !== void 0 && container.bound(HttpRequest) ? container : void 0;
14950
+ }
14951
+ function currentRequest3() {
14952
+ return requestScope2()?.make(HttpRequest);
14953
+ }
14954
+ function optionalSession2() {
14955
+ const scope = requestScope2();
14956
+ return scope?.bound(Session) ? scope.make(Session) : void 0;
14957
+ }
14958
+ function isInertiaRequest(request2) {
14959
+ const value2 = request2.header("X-Inertia");
14960
+ return value2 !== void 0 && value2 !== "" && value2 !== "false";
14961
+ }
14962
+ function isPrefetch(request2) {
14963
+ return ["Purpose", "Sec-Purpose", "X-Moz"].some((name) => request2.header(name)?.toLowerCase() === "prefetch");
14964
+ }
14965
+ function rebuild(response2, changes) {
14966
+ const headers = new Headers(response2.headers);
14967
+ for (const [name, value2] of Object.entries(changes.headers ?? {})) headers.set(name, value2);
14968
+ const status = changes.status ?? response2.status;
14969
+ return new Response(response2.body, {
14970
+ status,
14971
+ statusText: status === response2.status ? response2.statusText : "",
14972
+ headers
14973
+ });
14974
+ }
14975
+ function isRedirect(response2) {
14976
+ return [201, 301, 302, 303, 307, 308].includes(response2.status) && response2.headers.has("Location");
14977
+ }
14978
+ var ComponentNotFoundError = class extends Error {
14979
+ constructor(component) {
14980
+ super(`Inertia page component [${component}] not found.`);
14981
+ this.component = component;
14982
+ this.name = "ComponentNotFoundError";
14983
+ }
14984
+ component;
14985
+ kind = "Server";
14986
+ status = 500;
14987
+ };
14988
+ var InertiaError = class extends Error {
14989
+ kind = "Server";
14990
+ status = 500;
14991
+ constructor(message) {
14992
+ super(message);
14993
+ this.name = "InertiaError";
14994
+ }
14995
+ };
14996
+ var SsrError = class extends Error {
14997
+ kind = "Server";
14998
+ status = 500;
14999
+ constructor(message, options) {
15000
+ super(message, options);
15001
+ this.name = "SsrError";
15002
+ }
15003
+ };
15004
+ var SessionKey = {
15005
+ CLEAR_HISTORY: "inertia.clear_history",
15006
+ PRESERVE_FRAGMENT: "inertia.preserve_fragment",
15007
+ FLASH_DATA: "inertia.flash_data"
15008
+ };
15009
+ function defaultUrl(request2) {
15010
+ const url2 = new URL(request2.raw.url);
15011
+ return `${url2.pathname}${url2.search}`;
15012
+ }
15013
+ var Response2 = class {
15014
+ constructor(component, props, settings) {
15015
+ this.component = component;
15016
+ this.settings = settings;
15017
+ this.#props = { ...props };
15018
+ this.#rootView = settings.rootView;
15019
+ }
15020
+ component;
15021
+ settings;
15022
+ #props;
15023
+ #viewData = {};
15024
+ #rootView;
15025
+ with(key, value2) {
15026
+ if (typeof key === "string") this.#props[key] = value2;
15027
+ else Object.assign(this.#props, key);
15028
+ return this;
15029
+ }
15030
+ withViewData(key, value2) {
15031
+ if (typeof key === "string") this.#viewData[key] = value2;
15032
+ else Object.assign(this.#viewData, key);
15033
+ return this;
15034
+ }
15035
+ rootView(view2) {
15036
+ this.#rootView = view2;
15037
+ return this;
15038
+ }
15039
+ flash(key, value2) {
15040
+ this.settings.flash(key, value2);
15041
+ return this;
15042
+ }
15043
+ /** The page object for this request. */
15044
+ async toPage(request2) {
15045
+ const scope = requestScope2();
15046
+ this.#ensurePageExists(scope);
15047
+ const resolver = new PropsResolver(request2, this.component, {
15048
+ exposeSharedPropKeys: this.#config(scope, "inertia.expose_shared_prop_keys", true),
15049
+ report: async (error) => {
15050
+ if (scope?.bound(ExceptionHandler)) await scope.make(ExceptionHandler).report(error);
15051
+ }
15052
+ });
15053
+ const { props, metadata } = await resolver.resolve(this.settings.shared, this.#props);
15054
+ const session2 = optionalSession2();
15055
+ const clearHistory = session2?.pull(SessionKey.CLEAR_HISTORY, false) === true;
15056
+ const preserveFragment = session2?.pull(SessionKey.PRESERVE_FRAGMENT, false) === true;
15057
+ const flash = session2?.pull(SessionKey.FLASH_DATA, void 0);
15058
+ const page = {
15059
+ component: this.component,
15060
+ props,
15061
+ url: (this.settings.urlResolver ?? defaultUrl)(request2),
15062
+ version: await this.settings.version(),
15063
+ ...metadata
15064
+ };
15065
+ if (clearHistory) page.clearHistory = true;
15066
+ if (this.settings.encryptHistory) page.encryptHistory = true;
15067
+ if (flash !== void 0 && flash !== null && Object.keys(flash).length > 0) page.flash = flash;
15068
+ if (preserveFragment) page.preserveFragment = true;
15069
+ return page;
15070
+ }
15071
+ async toResponse(request2) {
15072
+ const http = request2;
15073
+ if (typeof http?.header !== "function") throw new InertiaError("An Inertia response needs the HttpRequest.");
15074
+ const page = await this.toPage(http);
15075
+ if (isInertiaRequest(http)) {
15076
+ return new globalThis.Response(JSON.stringify(page), {
15077
+ status: 200,
15078
+ headers: { "content-type": "application/json", "X-Inertia": "true" }
15079
+ });
15080
+ }
15081
+ const scope = requestScope2();
15082
+ if (scope === void 0 || !scope.bound(ViewFactory)) {
15083
+ throw new InertiaError(`Cannot render the Inertia root view [${this.#rootView}]: no ViewFactory is bound.`);
15084
+ }
15085
+ const html2 = await scope.make(ViewFactory).make(this.#rootView, { ...this.#viewData, page }).render();
15086
+ return new globalThis.Response(html2, { status: 200, headers: { "content-type": "text/html; charset=utf-8" } });
15087
+ }
15088
+ /** inertia.pages.ensure_pages_exist: the component must exist under one of the page paths. */
15089
+ #ensurePageExists(scope) {
15090
+ if (!this.#config(scope, "inertia.pages.ensure_pages_exist", false)) return;
15091
+ const paths = this.#config(scope, "inertia.pages.paths", []);
15092
+ const extensions = this.#config(scope, "inertia.pages.extensions", []);
15093
+ if (!pageExists(this.component, paths, extensions)) throw new ComponentNotFoundError(this.component);
15094
+ }
15095
+ #config(scope, key, fallback) {
15096
+ return scope?.bound(ConfigRepository) ? scope.make(ConfigRepository).get(key, fallback) : fallback;
15097
+ }
15098
+ };
15099
+ function pageExists(component, paths, extensions) {
15100
+ return paths.some((path) => extensions.some((extension) => existsSync8(join10(path, `${component}.${extension}`))));
15101
+ }
15102
+ var ResponseFactory2 = class _ResponseFactory {
15103
+ constructor(app2, parent) {
15104
+ this.app = app2;
15105
+ this.parent = parent;
15106
+ }
15107
+ app;
15108
+ parent;
15109
+ #shared = {};
15110
+ #rootView;
15111
+ #version;
15112
+ #encryptHistory;
15113
+ #urlResolver;
15114
+ /** A per-request child of this (root) factory. */
15115
+ forRequest() {
15116
+ return new _ResponseFactory(this.app, this);
15117
+ }
15118
+ setRootView(view2) {
15119
+ this.#rootView = view2;
15120
+ }
15121
+ getRootView() {
15122
+ return this.#rootView ?? this.parent?.getRootView() ?? "app";
15123
+ }
15124
+ share(key, value2) {
15125
+ if (typeof key === "string") Arr.set(this.#shared, key, value2);
15126
+ else Object.assign(this.#shared, key);
15127
+ }
15128
+ shareOnce(key, callback) {
15129
+ const prop = new OnceProp(callback);
15130
+ this.share(key, prop);
15131
+ return prop;
15132
+ }
15133
+ getShared(key, defaultValue) {
15134
+ const shared2 = { ...this.parent?.getShared(), ...this.#shared };
15135
+ return key === void 0 ? shared2 : Arr.get(shared2, key, defaultValue);
15136
+ }
15137
+ flushShared() {
15138
+ this.#shared = {};
15139
+ }
15140
+ version(version) {
15141
+ this.#version = version;
15142
+ }
15143
+ /** The asset version as a string ('' when there is none), like Laravel's `(string) $version`. */
15144
+ async getVersion() {
15145
+ const version = this.#versionResolver();
15146
+ const resolved = typeof version === "function" ? await version() : version;
15147
+ return resolved === null || resolved === void 0 ? "" : String(resolved);
15148
+ }
15149
+ #versionResolver() {
15150
+ return this.#version ?? (this.parent === void 0 ? void 0 : this.parent.#versionResolver());
15151
+ }
15152
+ #encrypts() {
15153
+ return this.#encryptHistory ?? (this.parent === void 0 ? void 0 : this.parent.#encrypts());
15154
+ }
15155
+ #resolvesUrl() {
15156
+ return this.#urlResolver ?? (this.parent === void 0 ? void 0 : this.parent.#resolvesUrl());
15157
+ }
15158
+ resolveUrlUsing(resolver) {
15159
+ this.#urlResolver = resolver;
15160
+ }
15161
+ encryptHistory(encrypt2 = true) {
15162
+ this.#encryptHistory = encrypt2;
15163
+ }
15164
+ clearHistory() {
15165
+ optionalSession2()?.put(SessionKey.CLEAR_HISTORY, true);
15166
+ }
15167
+ preserveFragment() {
15168
+ optionalSession2()?.put(SessionKey.PRESERVE_FRAGMENT, true);
15169
+ }
15170
+ optional(callback) {
15171
+ return new OptionalProp(callback);
15172
+ }
15173
+ defer(callback, group = "default", options = {}) {
15174
+ return new DeferProp(callback, group, options);
15175
+ }
15176
+ always(value2) {
15177
+ return new AlwaysProp(value2);
15178
+ }
15179
+ merge(value2) {
15180
+ return new MergeProp(value2);
15181
+ }
15182
+ deepMerge(value2) {
15183
+ return new MergeProp(value2).deepMerge();
15184
+ }
15185
+ once(callback) {
15186
+ return new OnceProp(callback);
15187
+ }
15188
+ scroll(value2, wrapper = "data", metadata) {
15189
+ return new ScrollProp(value2, wrapper, metadata);
15190
+ }
15191
+ /** Flashes page.flash data for the next Inertia response (stored in the session immediately). */
15192
+ flash(key, value2) {
15193
+ const session2 = optionalSession2();
15194
+ if (session2 === void 0) return this;
15195
+ const flash = typeof key === "string" ? { [key]: value2 } : key;
15196
+ session2.flash(SessionKey.FLASH_DATA, { ...session2.get(SessionKey.FLASH_DATA, {}), ...flash });
15197
+ return this;
15198
+ }
15199
+ back(fallback, status = 302) {
15200
+ const scope = requestScope2() ?? this.app;
15201
+ return scope.make(Redirector).back(fallback, status);
15202
+ }
15203
+ /** 409 + X-Inertia-Location for Inertia requests (the client does a full visit), a plain 302 otherwise. */
15204
+ location(url2) {
15205
+ const request2 = currentRequest3();
15206
+ if (request2 !== void 0 && isInertiaRequest(request2)) {
15207
+ return new globalThis.Response(null, { status: 409, headers: { [Header.LOCATION]: url2 } });
15208
+ }
15209
+ return new globalThis.Response(null, { status: 302, headers: { Location: url2 } });
15210
+ }
15211
+ render(component, props = {}) {
15212
+ const config2 = this.app.bound(ConfigRepository) ? this.app.make(ConfigRepository) : void 0;
15213
+ return new Response2(component, props, {
15214
+ shared: this.getShared(),
15215
+ rootView: this.getRootView(),
15216
+ version: () => this.getVersion(),
15217
+ encryptHistory: this.#encrypts() ?? config2?.get("inertia.history.encrypt", false) ?? false,
15218
+ urlResolver: this.#resolvesUrl(),
15219
+ flash: (key, value2) => void this.flash(key, value2)
15220
+ });
15221
+ }
15222
+ };
15223
+ function inertiaFactory() {
15224
+ const container = currentContainer();
15225
+ if (container === void 0) throw new ContainerNotAvailableError("Inertia");
15226
+ if (container.bound(HttpRequest)) return container.make(InertiaFactory);
15227
+ return container.make(Application).make(ResponseFactory2);
15228
+ }
15229
+ function inertia(component, props = {}) {
15230
+ const factory = inertiaFactory();
15231
+ return component === void 0 ? factory : factory.render(component, props);
15232
+ }
15233
+ var Inertia = new Proxy({}, {
15234
+ get(_target, property) {
15235
+ if (typeof property === "symbol" || property === "then") return void 0;
15236
+ const factory = inertiaFactory();
15237
+ const value2 = Reflect.get(factory, property, factory);
15238
+ return typeof value2 === "function" ? value2.bind(factory) : value2;
15239
+ }
15240
+ });
15241
+ var InertiaHtml = class {
15242
+ constructor(html2) {
15243
+ this.html = html2;
15244
+ }
15245
+ html;
15246
+ toHtml() {
15247
+ return this.html;
15248
+ }
15249
+ toString() {
15250
+ return this.html;
15251
+ }
15252
+ };
15253
+ function pageJson(page) {
15254
+ return JSON.stringify(page).replace(/\//g, "\\/").replace(/</g, "\\u003c").replace(/>/g, "\\u003e");
15255
+ }
15256
+ function pageMarkup(page, id = "app") {
15257
+ const safeId = id.replace(/[^A-Za-z0-9_-]/g, "");
15258
+ return `<script data-page="${safeId}" type="application/json">${pageJson(page)}</script><div id="${safeId}"></div>`;
15259
+ }
15260
+ var dispatched = /* @__PURE__ */ new WeakMap();
15261
+ function ssr(page) {
15262
+ let pending = dispatched.get(page);
15263
+ if (pending === void 0) {
15264
+ const container = currentContainer();
15265
+ pending = container?.bound(InertiaSsrGateway) ? container.make(InertiaSsrGateway).dispatch(page) : Promise.resolve(void 0);
15266
+ dispatched.set(page, pending);
15267
+ }
15268
+ return pending;
15269
+ }
15270
+ function handled(promise) {
15271
+ promise.catch(() => void 0);
15272
+ return promise;
15273
+ }
15274
+ function inertiaHead(page) {
15275
+ return handled(ssr(page).then((rendered) => new InertiaHtml(rendered?.head ?? "")));
15276
+ }
15277
+ function inertiaBody(page, id = "app") {
15278
+ return handled(ssr(page).then((rendered) => new InertiaHtml(rendered?.body ?? pageMarkup(page, id))));
15279
+ }
15280
+ var excluded = /* @__PURE__ */ new WeakSet();
15281
+ function withoutSsr(request2, paths) {
15282
+ const matches = paths.some((pattern) => {
15283
+ const trimmed = pattern === "/" ? pattern : pattern.replace(/^\/+|\/+$/g, "");
15284
+ return Str.is(trimmed, request2.fullUrl()) || request2.is(trimmed);
15285
+ });
15286
+ if (matches) excluded.add(request2);
15287
+ }
15288
+ function isExcludedFromSsr(request2) {
15289
+ return excluded.has(request2);
15290
+ }
15291
+ var InertiaMiddleware = class {
15292
+ /** The root view rendered on the first visit: resources/views/app.tsx. */
15293
+ rootViewName = "app";
15294
+ /** Send every message per field instead of the first one. */
15295
+ withAllErrors = false;
15296
+ /** Paths (wildcards allowed) rendered without SSR. */
15297
+ withoutSsr = [];
15298
+ container = inject(Container);
15299
+ /** The asset version: a hash of app.asset_url, else of public/build/manifest.json, else none. */
15300
+ async version(_request) {
15301
+ const config2 = this.container.bound(ConfigRepository) ? this.container.make(ConfigRepository) : void 0;
15302
+ const assetUrl = config2?.get("app.asset_url", null);
15303
+ if (typeof assetUrl === "string" && assetUrl !== "") return md5(assetUrl);
15304
+ const app2 = this.container.make(Application);
15305
+ const manifest = app2.publicPath("build/manifest.json");
15306
+ return existsSync23(manifest) ? md5(readFileSync(manifest)) : null;
15307
+ }
15308
+ /** Props shared with every page. Override and spread `await super.share(request)` into your own. */
15309
+ async share(request2) {
15310
+ return { errors: new AlwaysProp(this.resolveValidationErrors(request2)) };
15311
+ }
15312
+ /** Shared once props: sent on the first visit, then kept by the client. */
15313
+ async shareOnce(_request) {
15314
+ return {};
15315
+ }
15316
+ rootView(_request) {
15317
+ return this.rootViewName;
15318
+ }
15319
+ /** How page.url is built; undefined keeps the default (path + query). */
15320
+ urlResolver() {
15321
+ return void 0;
15322
+ }
15323
+ async handle(request2, next) {
15324
+ const inertia2 = this.container.make(InertiaFactory);
15325
+ inertia2.version(() => this.version(request2));
15326
+ inertia2.share(await this.share(request2));
15327
+ for (const [key, value2] of Object.entries(await this.shareOnce(request2))) {
15328
+ if (value2 instanceof OnceProp) inertia2.share(key, value2);
15329
+ else inertia2.shareOnce(key, value2);
15330
+ }
15331
+ inertia2.setRootView(this.rootView(request2));
15332
+ const resolver = this.urlResolver();
15333
+ if (resolver !== void 0) inertia2.resolveUrlUsing(resolver);
15334
+ if (this.withoutSsr.length > 0) withoutSsr(request2, this.withoutSsr);
15335
+ let response2 = await next(request2);
15336
+ response2 = rebuild(response2, { headers: { Vary: "X-Inertia" } });
15337
+ const redirect2 = isRedirect(response2);
15338
+ const session2 = optionalSession2();
15339
+ if (redirect2 && session2 !== void 0) this.reflash(session2);
15340
+ if (!isInertiaRequest(request2)) return response2;
15341
+ if (session2 !== void 0 && this.shouldStoreCurrentUrl(request2, response2)) session2.setPreviousUrl(request2.fullUrl());
15342
+ if (request2.method() === "GET" && request2.header(Header.VERSION, "") !== await inertia2.getVersion()) {
15343
+ response2 = await this.onVersionChange(request2, response2);
15344
+ }
15345
+ if (isEmpty(response2)) response2 = await this.onEmptyResponse(request2, response2);
15346
+ if (response2.status === 302 && ["PUT", "PATCH", "DELETE"].includes(request2.method())) response2 = rebuild(response2, { status: 303 });
15347
+ if (redirect2 && (response2.headers.get("Location") ?? "").includes("#") && !isPrefetch(request2)) {
15348
+ response2 = await this.onRedirectWithFragment(request2, response2);
15349
+ }
15350
+ return response2;
15351
+ }
15352
+ /** The session's flashed errors ({ [bag]: { field: string[] } }), shaped for the client. */
15353
+ resolveValidationErrors(request2) {
15354
+ const flashed = optionalSession2()?.get("errors", void 0);
15355
+ if (flashed === void 0 || flashed === null || typeof flashed !== "object") return {};
15356
+ const bags = Object.fromEntries(
15357
+ Object.entries(flashed).map(([bag, fields]) => [
15358
+ bag,
15359
+ Object.fromEntries(
15360
+ Object.entries(fields ?? {}).map(([field, messages]) => {
15361
+ const list3 = Array.isArray(messages) ? messages.map(String) : [String(messages)];
15362
+ return [field, this.withAllErrors ? list3 : list3[0] ?? ""];
15363
+ })
15364
+ )
15365
+ ])
15366
+ );
15367
+ const errorBag = request2.header(Header.ERROR_BAG);
15368
+ if (bags.default !== void 0 && errorBag !== void 0 && errorBag !== "") return { [errorBag]: bags.default };
15369
+ if (bags.default !== void 0) return bags.default;
15370
+ return bags;
15371
+ }
15372
+ /** inertia.store_previous_url: Inertia GET visits (not prefetches or same-page partial reloads) become previous(). */
15373
+ shouldStoreCurrentUrl(request2, _response) {
15374
+ const config2 = this.container.bound(ConfigRepository) ? this.container.make(ConfigRepository) : void 0;
15375
+ if (config2?.get("inertia.store_previous_url", false) !== true) return false;
15376
+ if (request2.method() !== "GET" || !request2.ajax() || isPrefetch(request2)) return false;
15377
+ const partial = request2.header(Header.PARTIAL_COMPONENT);
15378
+ return partial === void 0 || partial === "";
15379
+ }
15380
+ async onEmptyResponse(request2, _response) {
15381
+ return this.container.make(Redirector).back().toResponse(request2);
15382
+ }
15383
+ async onRedirectWithFragment(_request, response2) {
15384
+ return new Response(null, { status: 409, headers: { [Header.REDIRECT]: response2.headers.get("Location") ?? "" } });
15385
+ }
15386
+ async onVersionChange(request2, _response) {
15387
+ optionalSession2()?.reflash();
15388
+ const inertia2 = this.container.make(InertiaFactory);
15389
+ const response2 = inertia2.location(request2.fullUrl());
15390
+ return rebuild(response2, { headers: { [Header.VERSION]: await inertia2.getVersion() } });
15391
+ }
15392
+ /** Keeps Inertia flash data for the page the redirect leads to. */
15393
+ reflash(session2) {
15394
+ const flashed = session2.get(SessionKey.FLASH_DATA, void 0);
15395
+ if (flashed !== void 0 && flashed !== null && Object.keys(flashed).length > 0) session2.flash(SessionKey.FLASH_DATA, flashed);
15396
+ }
15397
+ };
15398
+ function isEmpty(response2) {
15399
+ if (response2.status === 204) return true;
15400
+ return response2.status === 200 && (response2.body === null || response2.headers.get("content-length") === "0");
15401
+ }
15402
+ function md5(value2) {
15403
+ return createHash5("md5").update(value2).digest("hex");
15404
+ }
15405
+ var EncryptHistory = class {
15406
+ #container = inject(Container);
15407
+ async handle(request2, next) {
15408
+ this.#container.make(InertiaFactory).encryptHistory();
15409
+ return next(request2);
15410
+ }
15411
+ };
15412
+ var PARAMETER2 = /\{([A-Za-z_][A-Za-z0-9_]*)(?::([A-Za-z_][A-Za-z0-9_]*))?(\?)?\}/g;
15413
+ function routeParameters(uri) {
15414
+ return [...uri.matchAll(PARAMETER2)].map((match) => ({ name: match[1], optional: match[3] === "?", field: match[2] }));
15415
+ }
15416
+ function routeTable(routes, except = []) {
15417
+ const table = {};
15418
+ const named = routes.map((route2) => ({ route: route2, name: route2.getName() })).filter((entry) => entry.name !== void 0 && entry.name !== "").filter(({ name }) => !except.some((pattern) => Str.is(pattern, name))).sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
15419
+ for (const { route: route2, name } of named) table[name] = { uri: route2.uri, methods: [...route2.methods] };
15420
+ return table;
15421
+ }
15422
+ var ESCAPES = { "\\": "\\\\", "'": "\\'", "\n": "\\n", "\r": "\\r", "\u2028": "\\u2028", "\u2029": "\\u2029" };
15423
+ var quote = (value2) => `'${value2.replace(/[\\\u0027\n\r\u2028\u2029]/g, (char) => ESCAPES[char])}'`;
15424
+ function parameterType(uri) {
15425
+ const parameters = routeParameters(uri);
15426
+ if (parameters.length === 0) return "Record<never, never>";
15427
+ return `{ ${parameters.map(({ name, optional }) => `${name}${optional ? "?" : ""}: RouteParameter`).join("; ")} }`;
15428
+ }
15429
+ function renderRoutesModule(table, clientModule = "@orieljs/inertia-client") {
15430
+ const names = Object.keys(table);
15431
+ const entries = names.map((name) => {
15432
+ const { uri, methods } = table[name];
15433
+ return ` ${quote(name)}: { uri: ${quote(uri)}, methods: [${methods.map(quote).join(", ")}] },`;
15434
+ });
15435
+ const types = names.map((name) => ` ${quote(name)}: ${parameterType(table[name].uri)}`);
15436
+ return [
15437
+ "// Generated by `oriel route:types`. Do not edit: run `oriel route:types` again.",
15438
+ // Built by concatenation so tools that scan source for imports don't mistake this template for one.
15439
+ `import { defineRoutes, type RouteParameter } from ${quote(clientModule)}`,
15440
+ "",
15441
+ `export const routes = defineRoutes({${entries.length === 0 ? "" : `
15442
+ ${entries.join("\n")}
15443
+ `}})`,
15444
+ "",
15445
+ `declare module ${quote(clientModule)} {`,
15446
+ " interface RouteList {",
15447
+ ...types,
15448
+ " }",
15449
+ "}",
15450
+ ""
15451
+ ].join("\n");
15452
+ }
15453
+ function renderServerRouteTypes(table) {
15454
+ const members = Object.keys(table).map((name) => ` ${quote(name)}: ${parameterType(table[name].uri).replace(/RouteParameter/g, "unknown")}`);
15455
+ const block = (module) => [`declare module ${quote(module)} {`, " interface RouteList {", ...members, " }", "}"];
15456
+ return [
15457
+ "// Generated by `oriel route:types`. Do not edit: run `oriel route:types` again.",
15458
+ "",
15459
+ ...block("@orieljs/framework"),
15460
+ "",
15461
+ ...block("@orieljs/framework/contracts"),
15462
+ "",
15463
+ "export {}",
15464
+ ""
15465
+ ].join("\n");
15466
+ }
15467
+ var MIDDLEWARE_STUB2 = `import { InertiaMiddleware } from '@orieljs/framework'
15468
+ import type { HttpRequest } from '@orieljs/framework/contracts'
15469
+
15470
+ export class {{ class }} extends InertiaMiddleware {
15471
+ /** The root view loaded on the first page visit: resources/views/app.tsx. */
15472
+ protected override rootViewName = 'app'
15473
+
15474
+ /** Props shared with every page (typed for the pages by \`oriel inertia:types\`). */
15475
+ override async share(request: HttpRequest) {
15476
+ return {
15477
+ ...(await super.share(request)),
15478
+ }
15479
+ }
15480
+ }
15481
+ `;
15482
+ async function loadPageTypes() {
15483
+ const specifier = "@orieljs/vite/types";
15484
+ try {
15485
+ return await import(
15486
+ /* @vite-ignore */
15487
+ specifier
15488
+ );
15489
+ } catch {
15490
+ return void 0;
15491
+ }
15492
+ }
15493
+ function registerInertiaCommands(kernel, app2, gateway, options = {}) {
15494
+ const config2 = (key, fallback) => app2.bound(ConfigRepository) ? app2.make(ConfigRepository).get(key, fallback) : fallback;
15495
+ const absolute = (path) => isAbsolute2(path) ? path : app2.basePath(path);
15496
+ kernel.command(
15497
+ "route:types {--output= : Where to write the route module} {--server= : Where to write the server route name types}",
15498
+ async function() {
15499
+ if (!app2.bound(Router)) {
15500
+ this.error("The router is not available. Is the Routing service provider registered?");
15501
+ return 1;
15502
+ }
15503
+ const output = absolute(optionText(this.option("output")) ?? config2("inertia.types.routes", "resources/js/oriel/routes.ts"));
15504
+ const server = absolute(optionText(this.option("server")) ?? config2("inertia.types.server_routes", "types/routes.d.ts"));
15505
+ const table = routeTable(app2.make(Router).getRoutes(), config2("inertia.types.except_routes", []));
15506
+ await mkdir6(dirname6(output), { recursive: true });
15507
+ await writeFile7(output, renderRoutesModule(table));
15508
+ await mkdir6(dirname6(server), { recursive: true });
15509
+ await writeFile7(server, renderServerRouteTypes(routeTable(app2.make(Router).getRoutes())));
15510
+ this.info(`Route types for ${Object.keys(table).length} named routes written to ${relative6(app2.basePath(), output)}.`);
15511
+ return 0;
15512
+ }
15513
+ ).purpose("Generate the route table and route name types for the frontend");
15514
+ kernel.command("inertia:types {--output= : Where to write the page types}", async function() {
15515
+ const module = await (options.pageTypes ?? loadPageTypes)();
15516
+ if (module === void 0) {
15517
+ this.error("Generating page types needs @orieljs/vite: install it as a dev dependency.");
15518
+ return 1;
15519
+ }
15520
+ const output = absolute(optionText(this.option("output")) ?? config2("inertia.types.pages", "resources/js/oriel/pages.d.ts"));
15521
+ const result = await module.generatePageTypes({ root: app2.basePath(), output });
15522
+ for (const warning of result.warnings) this.warn(warning);
15523
+ this.info(`Page types for ${result.pages} pages written to ${relative6(app2.basePath(), result.output)}.`);
15524
+ return 0;
15525
+ }).purpose("Generate TypeScript types for the Inertia page props");
15526
+ kernel.command("inertia:middleware {name=HandleInertiaRequests : The middleware class name} {--force : Overwrite an existing file}", async function() {
15527
+ const name = String(this.argument("name") ?? "HandleInertiaRequests");
15528
+ if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)) {
15529
+ this.error(`Middleware name [${name}] is not a valid class name.`);
15530
+ return 1;
15531
+ }
15532
+ const file = app2.appPath(join24("Http", "Middleware", `${name}.ts`));
15533
+ if (existsSync33(file) && this.option("force") !== true) {
15534
+ this.error(`Middleware [${relative6(app2.basePath(), file)}] already exists.`);
15535
+ return 1;
15536
+ }
15537
+ await mkdir6(dirname6(file), { recursive: true });
15538
+ await writeFile7(file, MIDDLEWARE_STUB2.replace("{{ class }}", () => name));
15539
+ this.info(`Middleware [${relative6(app2.basePath(), file)}] created successfully.`);
15540
+ return 0;
15541
+ }).purpose("Create a new Inertia middleware");
15542
+ kernel.command("inertia:start-ssr {--runtime= : The runtime that runs the SSR bundle (node or bun)}", async function() {
15543
+ if (!config2("inertia.ssr.enabled", true)) {
15544
+ this.error("Inertia SSR is not enabled. Enable it via the `inertia.ssr.enabled` config option.");
15545
+ return 1;
15546
+ }
15547
+ const bundle = gateway.bundle();
15548
+ if (bundle === void 0) {
15549
+ this.error("Inertia SSR bundle not found. Build it with `vite build --ssr`, or set `inertia.ssr.bundle`.");
15550
+ return 1;
15551
+ }
15552
+ const runtime = optionText(this.option("runtime")) ?? config2("inertia.ssr.runtime", "node");
15553
+ const child = (options.spawn ?? spawn2)(runtime, [bundle], { stdio: "inherit" });
15554
+ return await new Promise((resolve4) => {
15555
+ child.on("exit", (code) => resolve4(code ?? 0));
15556
+ child.on("error", (error) => {
15557
+ this.error(`Could not start the SSR server: ${error.message}`);
15558
+ resolve4(1);
15559
+ });
15560
+ });
15561
+ }).purpose("Start the Inertia SSR server");
15562
+ kernel.command("inertia:stop-ssr", async function() {
15563
+ try {
15564
+ await fetch(`${gateway.productionUrl()}/shutdown`);
15565
+ } catch {
15566
+ }
15567
+ this.info("Inertia SSR server stopped.");
15568
+ return 0;
15569
+ }).purpose("Stop the Inertia SSR server");
15570
+ kernel.command("inertia:check-ssr", async function() {
15571
+ if (await gateway.isHealthy()) {
15572
+ this.info("Inertia SSR server is running.");
15573
+ return 0;
15574
+ }
15575
+ this.error("Inertia SSR server is not running.");
15576
+ return 1;
15577
+ }).purpose("Check the Inertia SSR server health status");
15578
+ }
15579
+ function optionText(value2) {
15580
+ return value2 === void 0 || value2 === null || value2 === false || value2 === "" ? void 0 : String(value2);
15581
+ }
15582
+ var SSR_RENDER_FAILED = "inertia.ssr.failed";
15583
+ var HttpGateway = class {
15584
+ constructor(app2) {
15585
+ this.app = app2;
15586
+ }
15587
+ app;
15588
+ #disabled;
15589
+ #except = [];
15590
+ disable(condition = true) {
15591
+ this.#disabled = condition;
15592
+ }
15593
+ /** Paths (wildcards allowed) never rendered on the server. */
15594
+ except(paths) {
15595
+ this.#except.push(...[paths].flat());
15596
+ }
15597
+ async dispatch(page) {
15598
+ if (!this.enabled(currentRequest3())) return void 0;
15599
+ const hot = this.hotUrl();
15600
+ if (hot === void 0 && this.#config("inertia.ssr.ensure_bundle_exists", true) && this.bundle() === void 0) return void 0;
15601
+ const url2 = hot === void 0 ? `${this.productionUrl()}/render` : `${hot}/__inertia_ssr`;
15602
+ try {
15603
+ const response2 = await fetch(url2, {
15604
+ method: "POST",
15605
+ headers: { "content-type": "application/json", accept: "application/json" },
15606
+ body: JSON.stringify(page),
15607
+ signal: this.#signal()
15608
+ });
15609
+ const data = await response2.json().catch(() => null);
15610
+ if (!response2.ok) {
15611
+ await this.#failed({ page, error: String(data?.error ?? `SSR server responded with ${response2.status}`), type: String(data?.type ?? "render"), ...details(data) });
15612
+ return void 0;
15613
+ }
15614
+ if (data === null) return void 0;
15615
+ return { head: (data.head ?? []).join("\n"), body: data.body ?? "" };
15616
+ } catch (error) {
15617
+ if (error instanceof SsrError) throw error;
15618
+ await this.#failed({ page, error: error instanceof Error ? error.message : String(error), type: "connection" });
15619
+ return void 0;
15620
+ }
15621
+ }
15622
+ /** GET {inertia.ssr.url}/health: any 2xx is healthy. */
15623
+ async isHealthy() {
15624
+ try {
15625
+ return (await fetch(`${this.productionUrl()}/health`, { signal: this.#signal() })).ok;
15626
+ } catch {
15627
+ return false;
15628
+ }
15629
+ }
15630
+ productionUrl() {
15631
+ return this.#config("inertia.ssr.url", "http://127.0.0.1:13714").replace(/\/+$/, "");
15632
+ }
15633
+ /** inertia.ssr.hot_url, else the Vite dev server URL in public/hot; undefined when Vite isn't running. */
15634
+ hotUrl() {
15635
+ const hotFile = this.app.publicPath("hot");
15636
+ if (!existsSync42(hotFile)) return void 0;
15637
+ const configured = this.#config("inertia.ssr.hot_url", null);
15638
+ const url2 = configured !== null && configured !== "" ? configured : readFileSync2(hotFile, "utf8");
15639
+ return url2.trim().replace(/\/+$/, "");
15640
+ }
15641
+ /** inertia.ssr.bundle, else bootstrap/ssr/{ssr,app}.{js,mjs}, else public/js/{ssr,app}.js (BundleDetector). */
15642
+ bundle() {
15643
+ const configured = this.#config("inertia.ssr.bundle", null);
15644
+ const candidates = [
15645
+ configured,
15646
+ this.app.basePath("bootstrap/ssr/ssr.js"),
15647
+ this.app.basePath("bootstrap/ssr/app.js"),
15648
+ this.app.basePath("bootstrap/ssr/ssr.mjs"),
15649
+ this.app.basePath("bootstrap/ssr/app.mjs"),
15650
+ this.app.publicPath("js/ssr.js"),
15651
+ this.app.publicPath("js/app.js")
15652
+ ];
15653
+ return candidates.find((path) => typeof path === "string" && path !== "" && existsSync42(path));
15654
+ }
15655
+ enabled(request2) {
15656
+ const disabled2 = this.#disabled;
15657
+ const enabled = disabled2 !== void 0 ? !(typeof disabled2 === "function" ? disabled2() : disabled2) : this.#config("inertia.ssr.enabled", true);
15658
+ if (!enabled) return false;
15659
+ if (request2 === void 0) return true;
15660
+ if (isExcludedFromSsr(request2)) return false;
15661
+ return !this.#except.some((pattern) => {
15662
+ const trimmed = pattern === "/" ? pattern : pattern.replace(/^\/+|\/+$/g, "");
15663
+ return Str.is(trimmed, request2.fullUrl()) || request2.is(trimmed);
15664
+ });
15665
+ }
15666
+ async #failed(failure) {
15667
+ const scope = requestScope2() ?? this.app;
15668
+ if (scope.bound(EventDispatcher)) await scope.make(EventDispatcher).dispatch(SSR_RENDER_FAILED, [failure]);
15669
+ if (this.#config("inertia.ssr.throw_on_error", false)) throw new SsrError(`SSR render failed: ${failure.error}`);
15670
+ }
15671
+ #signal() {
15672
+ const seconds = this.#config("inertia.ssr.timeout", null);
15673
+ return typeof seconds === "number" && seconds > 0 ? AbortSignal.timeout(seconds * 1e3) : void 0;
15674
+ }
15675
+ #config(key, fallback) {
15676
+ return this.app.bound(ConfigRepository) ? this.app.make(ConfigRepository).get(key, fallback) : fallback;
15677
+ }
15678
+ };
15679
+ function details(data) {
15680
+ const text3 = (key) => typeof data?.[key] === "string" ? data[key] : void 0;
15681
+ return { hint: text3("hint"), browserApi: text3("browserApi"), stack: text3("stack"), sourceLocation: text3("sourceLocation") };
15682
+ }
15683
+ var InertiaServiceProvider = class extends ServiceProvider {
15684
+ register() {
15685
+ this.mergeConfigFrom(
15686
+ {
15687
+ ssr: {
15688
+ enabled: true,
15689
+ runtime: "node",
15690
+ url: "http://127.0.0.1:13714",
15691
+ hot_url: null,
15692
+ timeout: null,
15693
+ ensure_bundle_exists: true,
15694
+ bundle: null,
15695
+ throw_on_error: false
15696
+ },
15697
+ pages: {
15698
+ ensure_pages_exist: false,
15699
+ paths: [this.app.resourcePath("js/pages")],
15700
+ extensions: ["js", "jsx", "svelte", "ts", "tsx", "vue", "component.ts"]
15701
+ },
15702
+ testing: { ensure_pages_exist: true },
15703
+ expose_shared_prop_keys: true,
15704
+ store_previous_url: false,
15705
+ history: { encrypt: false },
15706
+ types: { pages: "resources/js/oriel/pages.d.ts", routes: "resources/js/oriel/routes.ts", server_routes: "types/routes.d.ts", except_routes: [] }
15707
+ },
15708
+ "inertia"
15709
+ );
15710
+ this.app.singleton(ResponseFactory2, () => new ResponseFactory2(this.app));
15711
+ this.app.scoped(InertiaFactory, (container) => container.make(ResponseFactory2).forRequest());
15712
+ this.app.singleton(HttpGateway, () => new HttpGateway(this.app));
15713
+ this.app.singleton(InertiaSsrGateway, (container) => container.make(HttpGateway));
15714
+ }
15715
+ boot() {
15716
+ if (this.app.bound(Router)) this.app.make(Router).aliasMiddleware("inertia.encrypt", EncryptHistory);
15717
+ if (this.app.bound(ConsoleKernel)) registerInertiaCommands(this.app.make(ConsoleKernel), this.app, this.app.make(HttpGateway));
15718
+ }
15719
+ };
15720
+
14389
15721
  // ../Log/dist/index.js
14390
15722
  import pino2 from "pino";
14391
15723
  import { createWriteStream as createWriteStream2, mkdirSync as mkdirSync2, readdirSync as readdirSync5, rmSync } from "fs";
14392
- import { basename as basename3, dirname as dirname6, extname as extname3, join as join10 } from "path";
15724
+ import { basename as basename3, dirname as dirname7, extname as extname3, join as join11 } from "path";
14393
15725
  import { Writable } from "stream";
14394
15726
  import "pino";
14395
15727
  var rootKey = {};
@@ -14515,7 +15847,7 @@ var DailyRotatingStream = class extends Writable {
14515
15847
  super();
14516
15848
  this.days = days;
14517
15849
  this.now = now4;
14518
- this.dir = dirname6(basePath);
15850
+ this.dir = dirname7(basePath);
14519
15851
  this.stem = basename3(basePath, extname3(basePath) || void 0);
14520
15852
  mkdirSync2(this.dir, { recursive: true });
14521
15853
  }
@@ -14535,7 +15867,7 @@ var DailyRotatingStream = class extends Writable {
14535
15867
  */
14536
15868
  pending;
14537
15869
  pathFor(date) {
14538
- return join10(this.dir, `${this.stem}-${date}.log`);
15870
+ return join11(this.dir, `${this.stem}-${date}.log`);
14539
15871
  }
14540
15872
  today() {
14541
15873
  return localDay(this.now());
@@ -14588,7 +15920,7 @@ var DailyRotatingStream = class extends Writable {
14588
15920
  const match = DATE_PATTERN.exec(file.slice(prefix.length, -".log".length));
14589
15921
  if (!match) continue;
14590
15922
  const time = new Date(Number(match[1]), Number(match[2]) - 1, Number(match[3])).getTime();
14591
- if (time < cutoff) rmSync(join10(this.dir, file), { force: true });
15923
+ if (time < cutoff) rmSync(join11(this.dir, file), { force: true });
14592
15924
  }
14593
15925
  }
14594
15926
  _write(chunk, encoding, callback) {
@@ -15875,8 +17207,8 @@ import { randomUUID as randomUUID24 } from "crypto";
15875
17207
  import { Redis as Redis2 } from "ioredis";
15876
17208
  import { randomUUID as randomUUID32 } from "crypto";
15877
17209
  import { setTimeout as sleep4 } from "timers/promises";
15878
- import { existsSync as existsSync8, readdirSync as readdirSync6, statSync as statSync3 } from "fs";
15879
- import { join as join11 } from "path";
17210
+ import { existsSync as existsSync9, readdirSync as readdirSync6, statSync as statSync3 } from "fs";
17211
+ import { join as join12 } from "path";
15880
17212
  import { pathToFileURL as pathToFileURL6 } from "url";
15881
17213
  var QueueError = class extends Error {
15882
17214
  kind = "Server";
@@ -17469,7 +18801,7 @@ var EXTENSIONS3 = [".ts", ".js", ".mts", ".mjs"];
17469
18801
  function files2(directory) {
17470
18802
  const found = [];
17471
18803
  for (const entry of readdirSync6(directory).sort()) {
17472
- const path = join11(directory, entry);
18804
+ const path = join12(directory, entry);
17473
18805
  if (statSync3(path).isDirectory()) found.push(...files2(path));
17474
18806
  else if (EXTENSIONS3.some((extension) => entry.endsWith(extension)) && !entry.endsWith(".d.ts")) found.push(path);
17475
18807
  }
@@ -17479,7 +18811,7 @@ var WORKER_DISCOVERY_DIRECTORIES = ["Events", "Listeners", "Mail", "Notification
17479
18811
  var isClass2 = (value2) => typeof value2 === "function" && /^class[\s{]/.test(Function.prototype.toString.call(value2));
17480
18812
  var isJobClass = (value2) => typeof value2.prototype.handle === "function";
17481
18813
  async function discoverClasses(directory, registry2, filter = () => true) {
17482
- if (!existsSync8(directory)) return [];
18814
+ if (!existsSync9(directory)) return [];
17483
18815
  const names = [];
17484
18816
  for (const file of files2(directory)) {
17485
18817
  const module = await import(pathToFileURL6(file).href);
@@ -17799,11 +19131,11 @@ function expand(references, aliases2, groups, visiting, out) {
17799
19131
  out.push({ cls: aliases2[name], parameters });
17800
19132
  }
17801
19133
  }
17802
- function resolveMiddleware(references, excluded, aliases2, groups) {
19134
+ function resolveMiddleware(references, excluded2, aliases2, groups) {
17803
19135
  const all = [];
17804
19136
  expand(references, aliases2, groups, /* @__PURE__ */ new Set(), all);
17805
19137
  const skipped = [];
17806
- expand(excluded, aliases2, groups, /* @__PURE__ */ new Set(), skipped);
19138
+ expand(excluded2, aliases2, groups, /* @__PURE__ */ new Set(), skipped);
17807
19139
  const skippedClasses = new Set(skipped.map((entry) => entry.cls));
17808
19140
  const seen = /* @__PURE__ */ new Set();
17809
19141
  const classIds = /* @__PURE__ */ new Map();
@@ -17899,11 +19231,11 @@ async function substituteBindings(router, route2, values, container) {
17899
19231
  }
17900
19232
  return bound;
17901
19233
  }
17902
- var PARAMETER2 = /\{(\w+)(?::(\w+))?(\?)?\}/g;
19234
+ var PARAMETER3 = /\{(\w+)(?::(\w+))?(\?)?\}/g;
17903
19235
  var WHOLE_OPTIONAL = /^\{(\w+)(?::\w+)?\?\}$/;
17904
19236
  var escapeRegex = (value2) => value2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
17905
19237
  function parseParameters(uri) {
17906
- return [...uri.matchAll(PARAMETER2)].map((match) => ({ name: match[1], optional: match[3] === "?", field: match[2] }));
19238
+ return [...uri.matchAll(PARAMETER3)].map((match) => ({ name: match[1], optional: match[3] === "?", field: match[2] }));
17907
19239
  }
17908
19240
  function normalizeUri(uri) {
17909
19241
  const trimmed = uri.replace(/^\/+|\/+$/g, "");
@@ -17932,7 +19264,7 @@ function compileBody(uri, wheres) {
17932
19264
  }
17933
19265
  let piece = "";
17934
19266
  let last = 0;
17935
- for (const match of segment.matchAll(PARAMETER2)) {
19267
+ for (const match of segment.matchAll(PARAMETER3)) {
17936
19268
  piece += escapeRegex(segment.slice(last, match.index)) + group(match[1]) + (match[3] === "?" ? "?" : "");
17937
19269
  last = match.index + match[0].length;
17938
19270
  }
@@ -18295,6 +19627,23 @@ var BaseRouter = class {
18295
19627
  holder.route = this.addRoute(["GET", "HEAD"], uri, action);
18296
19628
  return holder.route;
18297
19629
  }
19630
+ /**
19631
+ * Route.inertia('/about', 'About', props): GET/HEAD; renders the page through the InertiaFactory (resolved when
19632
+ * the route runs, so Routing needs no Inertia import). Route parameters are merged into the props.
19633
+ */
19634
+ inertia(uri, component, props = {}) {
19635
+ const holder = {};
19636
+ const action = (...values) => {
19637
+ const parameters = Object.fromEntries(holder.route.parameters.map((parameter, index) => [parameter.name, values[index]]));
19638
+ const container = currentContainer() ?? this.container;
19639
+ if (container === void 0 || !container.bound(InertiaFactory)) {
19640
+ throw new RoutingError(`Cannot render Inertia page [${component}]: no InertiaFactory is bound.`);
19641
+ }
19642
+ return container.make(InertiaFactory).render(component, { ...props, ...parameters });
19643
+ };
19644
+ holder.route = this.addRoute(["GET", "HEAD"], uri, action);
19645
+ return holder.route;
19646
+ }
18298
19647
  resource(name, controller, options = {}) {
18299
19648
  this.#registerResource(name, controller, options, false);
18300
19649
  }
@@ -18503,7 +19852,7 @@ var BaseUrlGenerator = class {
18503
19852
  const whole = WHOLE_OPTIONAL.exec(segment);
18504
19853
  return whole === null || values.get(whole[1]) !== void 0;
18505
19854
  }).map(
18506
- (segment) => segment.replace(PARAMETER2, (_match, parameter) => {
19855
+ (segment) => segment.replace(PARAMETER3, (_match, parameter) => {
18507
19856
  const value2 = values.get(parameter);
18508
19857
  return value2 === void 0 ? "" : encodeURIComponent(value2);
18509
19858
  })
@@ -18601,8 +19950,8 @@ var RoutingServiceProvider = class extends ServiceProvider {
18601
19950
  };
18602
19951
 
18603
19952
  // ../Session/dist/index.js
18604
- import { mkdir as mkdir6, readdir as readdir3, readFile as readFile5, rename as rename3, rm as rm3, stat as stat4, writeFile as writeFile7 } from "fs/promises";
18605
- import { join as join12 } from "path";
19953
+ import { mkdir as mkdir7, readdir as readdir3, readFile as readFile5, rename as rename3, rm as rm3, stat as stat4, writeFile as writeFile8 } from "fs/promises";
19954
+ import { join as join13 } from "path";
18606
19955
  import { Redis as Redis3 } from "ioredis";
18607
19956
  import { randomInt } from "crypto";
18608
19957
  import { timingSafeEqual as timingSafeEqual4 } from "crypto";
@@ -18842,7 +20191,7 @@ var FileSessionHandler = class {
18842
20191
  clock;
18843
20192
  async read(id) {
18844
20193
  if (!VALID_ID.test(id)) return "";
18845
- const file = join12(this.path, id);
20194
+ const file = join13(this.path, id);
18846
20195
  try {
18847
20196
  const { mtimeMs } = await stat4(file);
18848
20197
  if (mtimeMs < this.clock() - this.minutes * 6e4) return "";
@@ -18853,21 +20202,21 @@ var FileSessionHandler = class {
18853
20202
  }
18854
20203
  async write(id, data) {
18855
20204
  if (!VALID_ID.test(id)) return;
18856
- await mkdir6(this.path, { recursive: true });
18857
- const temporary = join12(this.path, `.${id}.${Str.random(8)}.tmp`);
18858
- await writeFile7(temporary, data, "utf8");
18859
- await rename3(temporary, join12(this.path, id));
20205
+ await mkdir7(this.path, { recursive: true });
20206
+ const temporary = join13(this.path, `.${id}.${Str.random(8)}.tmp`);
20207
+ await writeFile8(temporary, data, "utf8");
20208
+ await rename3(temporary, join13(this.path, id));
18860
20209
  }
18861
20210
  async destroy(id) {
18862
- if (VALID_ID.test(id)) await rm3(join12(this.path, id), { force: true });
20211
+ if (VALID_ID.test(id)) await rm3(join13(this.path, id), { force: true });
18863
20212
  }
18864
20213
  async gc(maxLifetimeSeconds) {
18865
20214
  const expiration = this.clock() - maxLifetimeSeconds * 1e3;
18866
20215
  const files3 = await readdir3(this.path).catch(() => []);
18867
20216
  for (const file of files3) {
18868
20217
  if (!VALID_ID.test(file)) continue;
18869
- const { mtimeMs } = await stat4(join12(this.path, file)).catch(() => ({ mtimeMs: Number.POSITIVE_INFINITY }));
18870
- if (mtimeMs <= expiration) await rm3(join12(this.path, file), { force: true });
20218
+ const { mtimeMs } = await stat4(join13(this.path, file)).catch(() => ({ mtimeMs: Number.POSITIVE_INFINITY }));
20219
+ if (mtimeMs <= expiration) await rm3(join13(this.path, file), { force: true });
18871
20220
  }
18872
20221
  }
18873
20222
  };
@@ -19659,8 +21008,8 @@ function resolveDateParam(rule, param, data) {
19659
21008
  const parsed = parseDate(fieldValue);
19660
21009
  if (!Number.isNaN(parsed)) return parsed;
19661
21010
  }
19662
- const relative5 = relativeDate(param);
19663
- if (relative5 !== void 0) return relative5;
21011
+ const relative7 = relativeDate(param);
21012
+ if (relative7 !== void 0) return relative7;
19664
21013
  const literal = parseDate(param);
19665
21014
  if (!Number.isNaN(literal)) return literal;
19666
21015
  if (FIELD_REFERENCE_RE.test(param)) return Number.NaN;
@@ -20145,6 +21494,7 @@ function defaultProviders() {
20145
21494
  ValidationServiceProvider,
20146
21495
  AuthServiceProvider,
20147
21496
  ViewServiceProvider,
21497
+ InertiaServiceProvider,
20148
21498
  RoutingServiceProvider,
20149
21499
  HttpServiceProvider,
20150
21500
  ConsoleServiceProvider
@@ -20180,6 +21530,7 @@ export {
20180
21530
  AccessGate,
20181
21531
  AddQueuedCookiesToResponse,
20182
21532
  AllMailersFailedError,
21533
+ AlwaysProp,
20183
21534
  AnonymousNotifiable,
20184
21535
  Application3 as Application,
20185
21536
  ApplicationBuilder,
@@ -20234,6 +21585,7 @@ export {
20234
21585
  ColumnDefinition,
20235
21586
  Command,
20236
21587
  CommandNotFoundError,
21588
+ ComponentNotFoundError,
20237
21589
  Connection,
20238
21590
  Kernel as ConsoleKernelImpl,
20239
21591
  ConsoleServiceProvider,
@@ -20267,11 +21619,13 @@ export {
20267
21619
  DatabaseTokenRepository,
20268
21620
  DatabaseUnavailableError,
20269
21621
  DecryptError,
21622
+ DeferProp,
20270
21623
  Dispatchable,
20271
21624
  ELEMENT,
20272
21625
  EloquentUserProvider,
20273
21626
  EncryptCookies,
20274
21627
  EncryptError,
21628
+ EncryptHistory,
20275
21629
  Encrypter2 as Encrypter,
20276
21630
  EncryptionServiceProvider,
20277
21631
  EnsureEmailIsVerified,
@@ -20326,6 +21680,13 @@ export {
20326
21680
  HttpServiceProvider,
20327
21681
  Hub,
20328
21682
  IncomingRequest,
21683
+ Inertia,
21684
+ InertiaError,
21685
+ InertiaHtml,
21686
+ InertiaMiddleware,
21687
+ Response2 as InertiaPageResponse,
21688
+ ResponseFactory2 as InertiaResponseFactory,
21689
+ InertiaServiceProvider,
20329
21690
  InvalidCacheConfigError,
20330
21691
  InvalidCastError,
20331
21692
  InvalidListenerError,
@@ -20388,6 +21749,7 @@ export {
20388
21749
  MassAssignmentError,
20389
21750
  MaxAttemptsExceededError,
20390
21751
  MemoryStore,
21752
+ MergeProp,
20391
21753
  MessageBagImpl,
20392
21754
  MethodNotAllowedHttpError,
20393
21755
  MiddlewareConfiguration,
@@ -20423,6 +21785,8 @@ export {
20423
21785
  NullLogger,
20424
21786
  NullQueue,
20425
21787
  OPERATORS,
21788
+ OnceProp,
21789
+ OptionalProp,
20426
21790
  PERSONAL_ACCESS_TOKENS_MIGRATION,
20427
21791
  Paginator,
20428
21792
  Password,
@@ -20439,6 +21803,7 @@ export {
20439
21803
  PipelineServiceProvider,
20440
21804
  Pivot,
20441
21805
  PostgresSchemaGrammar,
21806
+ PropsResolver,
20442
21807
  ProviderBootError,
20443
21808
  ProviderRegisterError,
20444
21809
  QUEUE_JOB,
@@ -20476,6 +21841,7 @@ export {
20476
21841
  RoutingServiceProvider,
20477
21842
  Rule,
20478
21843
  S3Filesystem,
21844
+ SSR_RENDER_FAILED,
20479
21845
  STORAGE_LINK_SIGNATURE,
20480
21846
  Schedule4 as Schedule,
20481
21847
  ScheduleImpl,
@@ -20488,6 +21854,7 @@ export {
20488
21854
  SchemaBuilder,
20489
21855
  SchemaBuilderToken,
20490
21856
  SchemaGrammar,
21857
+ ScrollProp,
20491
21858
  Seeder,
20492
21859
  SendQueuedMailable,
20493
21860
  SendQueuedNotifications,
@@ -20501,6 +21868,8 @@ export {
20501
21868
  SmtpTransport,
20502
21869
  SoftDeletingScope,
20503
21870
  SqliteSchemaGrammar,
21871
+ SsrError,
21872
+ HttpGateway as SsrHttpGateway,
20504
21873
  StackLogger,
20505
21874
  StartSession,
20506
21875
  Storage2 as Storage,
@@ -20551,6 +21920,9 @@ export {
20551
21920
  ViewNotFoundError,
20552
21921
  ViewRenderError,
20553
21922
  ViewServiceProvider,
21923
+ Vite,
21924
+ ViteError,
21925
+ ViteHtml,
20554
21926
  WORKER_DISCOVERY_DIRECTORIES,
20555
21927
  WithoutOverlapping,
20556
21928
  Worker,
@@ -20592,6 +21964,7 @@ export {
20592
21964
  currentContainer,
20593
21965
  currentLogContext,
20594
21966
  currentRequest2 as currentRequest,
21967
+ currentVite,
20595
21968
  databaseConfigDefaults,
20596
21969
  debugPage,
20597
21970
  decodePayload,
@@ -20640,6 +22013,9 @@ export {
20640
22013
  guessTable,
20641
22014
  hashInfo,
20642
22015
  healthResponse,
22016
+ inertia,
22017
+ inertiaBody,
22018
+ inertiaHead,
20643
22019
  inject,
20644
22020
  ipMatches,
20645
22021
  isBlank,
@@ -20740,6 +22116,7 @@ export {
20740
22116
  serve,
20741
22117
  serveBun,
20742
22118
  serveNode,
22119
+ servePublicFile,
20743
22120
  session,
20744
22121
  setClientAddress,
20745
22122
  stackFrames,
@@ -20761,6 +22138,8 @@ export {
20761
22138
  validateRequiredArguments,
20762
22139
  value,
20763
22140
  view,
22141
+ vite,
22142
+ viteReactRefresh,
20764
22143
  withHeaders,
20765
22144
  workerOptionsFrom,
20766
22145
  writeResponse