tempest.games 0.1.45 → 0.2.0

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.
@@ -1947,7 +1947,7 @@ function osUsername() {
1947
1947
  }
1948
1948
  }
1949
1949
 
1950
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/entity.js
1950
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/entity.js
1951
1951
  var entityKind = Symbol.for("drizzle:entityKind");
1952
1952
  var hasOwnEntityKind = Symbol.for("drizzle:hasOwnEntityKind");
1953
1953
  function is(value, type) {
@@ -1972,7 +1972,7 @@ function is(value, type) {
1972
1972
  return false;
1973
1973
  }
1974
1974
 
1975
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/logger.js
1975
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/logger.js
1976
1976
  class ConsoleLogWriter {
1977
1977
  static [entityKind] = "ConsoleLogWriter";
1978
1978
  write(message) {
@@ -2004,7 +2004,7 @@ class NoopLogger {
2004
2004
  logQuery() {}
2005
2005
  }
2006
2006
 
2007
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/query-promise.js
2007
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/query-promise.js
2008
2008
  class QueryPromise {
2009
2009
  static [entityKind] = "QueryPromise";
2010
2010
  [Symbol.toStringTag] = "QueryPromise";
@@ -2025,7 +2025,7 @@ class QueryPromise {
2025
2025
  }
2026
2026
  }
2027
2027
 
2028
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/column.js
2028
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/column.js
2029
2029
  class Column {
2030
2030
  constructor(table, config) {
2031
2031
  this.table = table;
@@ -2075,20 +2075,20 @@ class Column {
2075
2075
  }
2076
2076
  }
2077
2077
 
2078
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/table.utils.js
2078
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/table.utils.js
2079
2079
  var TableName = Symbol.for("drizzle:Name");
2080
2080
 
2081
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/tracing-utils.js
2081
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/tracing-utils.js
2082
2082
  function iife(fn, ...args) {
2083
2083
  return fn(...args);
2084
2084
  }
2085
2085
 
2086
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/pg-core/unique-constraint.js
2086
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/pg-core/unique-constraint.js
2087
2087
  function uniqueKeyName(table, columns) {
2088
2088
  return `${table[TableName]}_${columns.join("_")}_unique`;
2089
2089
  }
2090
2090
 
2091
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/pg-core/columns/common.js
2091
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/pg-core/columns/common.js
2092
2092
  class PgColumn extends Column {
2093
2093
  constructor(table, config) {
2094
2094
  if (!config.uniqueName) {
@@ -2137,7 +2137,19 @@ class ExtraConfigColumn extends PgColumn {
2137
2137
  }
2138
2138
  }
2139
2139
 
2140
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/pg-core/columns/enum.js
2140
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/pg-core/columns/enum.js
2141
+ class PgEnumObjectColumn extends PgColumn {
2142
+ static [entityKind] = "PgEnumObjectColumn";
2143
+ enum;
2144
+ enumValues = this.config.enum.enumValues;
2145
+ constructor(table, config) {
2146
+ super(table, config);
2147
+ this.enum = config.enum;
2148
+ }
2149
+ getSQLType() {
2150
+ return this.enum.enumName;
2151
+ }
2152
+ }
2141
2153
  var isPgEnumSym = Symbol.for("drizzle:isPgEnum");
2142
2154
  function isPgEnum(obj) {
2143
2155
  return !!obj && typeof obj === "function" && isPgEnumSym in obj && obj[isPgEnumSym] === true;
@@ -2155,7 +2167,7 @@ class PgEnumColumn extends PgColumn {
2155
2167
  }
2156
2168
  }
2157
2169
 
2158
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/subquery.js
2170
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/subquery.js
2159
2171
  class Subquery {
2160
2172
  static [entityKind] = "Subquery";
2161
2173
  constructor(sql, selection, alias, isWith = false) {
@@ -2173,10 +2185,10 @@ class WithSubquery extends Subquery {
2173
2185
  static [entityKind] = "WithSubquery";
2174
2186
  }
2175
2187
 
2176
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/version.js
2177
- var version = "0.41.0";
2188
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/version.js
2189
+ var version = "0.43.1";
2178
2190
 
2179
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/tracing.js
2191
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/tracing.js
2180
2192
  var otel;
2181
2193
  var rawTracer;
2182
2194
  var tracer = {
@@ -2203,10 +2215,10 @@ var tracer = {
2203
2215
  }
2204
2216
  };
2205
2217
 
2206
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/view-common.js
2218
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/view-common.js
2207
2219
  var ViewBaseConfig = Symbol.for("drizzle:ViewBaseConfig");
2208
2220
 
2209
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/table.js
2221
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/table.js
2210
2222
  var Schema = Symbol.for("drizzle:Schema");
2211
2223
  var Columns = Symbol.for("drizzle:Columns");
2212
2224
  var ExtraConfigColumns = Symbol.for("drizzle:ExtraConfigColumns");
@@ -2250,7 +2262,7 @@ function getTableUniqueName(table) {
2250
2262
  return `${table[Schema] ?? "public"}.${table[TableName]}`;
2251
2263
  }
2252
2264
 
2253
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/sql/sql.js
2265
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/sql/sql.js
2254
2266
  function isSQLWrapper(value) {
2255
2267
  return value !== null && value !== undefined && typeof value.getSQL === "function";
2256
2268
  }
@@ -2623,7 +2635,7 @@ Subquery.prototype.getSQL = function() {
2623
2635
  return new SQL([this]);
2624
2636
  };
2625
2637
 
2626
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/alias.js
2638
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/alias.js
2627
2639
  class ColumnAliasProxyHandler {
2628
2640
  constructor(table) {
2629
2641
  this.table = table;
@@ -2702,7 +2714,7 @@ function mapColumnsInSQLToAlias(query, alias) {
2702
2714
  }));
2703
2715
  }
2704
2716
 
2705
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/selection-proxy.js
2717
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/selection-proxy.js
2706
2718
  class SelectionProxyHandler {
2707
2719
  static [entityKind] = "SelectionProxyHandler";
2708
2720
  config;
@@ -2754,7 +2766,7 @@ class SelectionProxyHandler {
2754
2766
  }
2755
2767
  }
2756
2768
 
2757
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/utils.js
2769
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/utils.js
2758
2770
  function mapResultRow(columns, row, joinsNotNullableMap) {
2759
2771
  const nullifyMap = {};
2760
2772
  const result = columns.reduce((result2, { path, field }, columnIndex) => {
@@ -2899,7 +2911,7 @@ function isConfig(data) {
2899
2911
  return false;
2900
2912
  }
2901
2913
 
2902
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/pg-core/query-builders/delete.js
2914
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/pg-core/query-builders/delete.js
2903
2915
  class PgDeleteBase extends QueryPromise {
2904
2916
  constructor(table, session, dialect, withList) {
2905
2917
  super();
@@ -2955,7 +2967,7 @@ class PgDeleteBase extends QueryPromise {
2955
2967
  }
2956
2968
  }
2957
2969
 
2958
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/casing.js
2970
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/casing.js
2959
2971
  function toSnakeCase(input) {
2960
2972
  const words = input.replace(/['\u2019]/g, "").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g) ?? [];
2961
2973
  return words.map((word) => word.toLowerCase()).join("_");
@@ -3008,7 +3020,7 @@ class CasingCache {
3008
3020
  }
3009
3021
  }
3010
3022
 
3011
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/errors.js
3023
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/errors.js
3012
3024
  class DrizzleError extends Error {
3013
3025
  static [entityKind] = "DrizzleError";
3014
3026
  constructor({ message, cause }) {
@@ -3025,7 +3037,7 @@ class TransactionRollbackError extends DrizzleError {
3025
3037
  }
3026
3038
  }
3027
3039
 
3028
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/pg-core/columns/date.js
3040
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/pg-core/columns/date.js
3029
3041
  class PgDate extends PgColumn {
3030
3042
  static [entityKind] = "PgDate";
3031
3043
  getSQLType() {
@@ -3045,7 +3057,7 @@ class PgDateString extends PgColumn {
3045
3057
  }
3046
3058
  }
3047
3059
 
3048
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/pg-core/columns/json.js
3060
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/pg-core/columns/json.js
3049
3061
  class PgJson extends PgColumn {
3050
3062
  static [entityKind] = "PgJson";
3051
3063
  constructor(table, config) {
@@ -3069,7 +3081,7 @@ class PgJson extends PgColumn {
3069
3081
  }
3070
3082
  }
3071
3083
 
3072
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/pg-core/columns/jsonb.js
3084
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/pg-core/columns/jsonb.js
3073
3085
  class PgJsonb extends PgColumn {
3074
3086
  static [entityKind] = "PgJsonb";
3075
3087
  constructor(table, config) {
@@ -3093,7 +3105,7 @@ class PgJsonb extends PgColumn {
3093
3105
  }
3094
3106
  }
3095
3107
 
3096
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/pg-core/columns/numeric.js
3108
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/pg-core/columns/numeric.js
3097
3109
  class PgNumeric extends PgColumn {
3098
3110
  static [entityKind] = "PgNumeric";
3099
3111
  precision;
@@ -3119,7 +3131,7 @@ class PgNumeric extends PgColumn {
3119
3131
  }
3120
3132
  }
3121
3133
 
3122
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/pg-core/columns/time.js
3134
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/pg-core/columns/time.js
3123
3135
  class PgTime extends PgColumn {
3124
3136
  static [entityKind] = "PgTime";
3125
3137
  withTimezone;
@@ -3135,7 +3147,7 @@ class PgTime extends PgColumn {
3135
3147
  }
3136
3148
  }
3137
3149
 
3138
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/pg-core/columns/timestamp.js
3150
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/pg-core/columns/timestamp.js
3139
3151
  class PgTimestamp extends PgColumn {
3140
3152
  static [entityKind] = "PgTimestamp";
3141
3153
  withTimezone;
@@ -3171,7 +3183,7 @@ class PgTimestampString extends PgColumn {
3171
3183
  }
3172
3184
  }
3173
3185
 
3174
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/pg-core/columns/uuid.js
3186
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/pg-core/columns/uuid.js
3175
3187
  class PgUUID extends PgColumn {
3176
3188
  static [entityKind] = "PgUUID";
3177
3189
  getSQLType() {
@@ -3179,7 +3191,7 @@ class PgUUID extends PgColumn {
3179
3191
  }
3180
3192
  }
3181
3193
 
3182
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/pg-core/table.js
3194
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/pg-core/table.js
3183
3195
  var InlineForeignKeys = Symbol.for("drizzle:PgInlineForeignKeys");
3184
3196
  var EnableRLS = Symbol.for("drizzle:EnableRLS");
3185
3197
 
@@ -3195,7 +3207,7 @@ class PgTable extends Table {
3195
3207
  [Table.Symbol.ExtraConfigColumns] = {};
3196
3208
  }
3197
3209
 
3198
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/pg-core/primary-keys.js
3210
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/pg-core/primary-keys.js
3199
3211
  class PrimaryKeyBuilder {
3200
3212
  static [entityKind] = "PgPrimaryKeyBuilder";
3201
3213
  columns;
@@ -3223,7 +3235,7 @@ class PrimaryKey {
3223
3235
  }
3224
3236
  }
3225
3237
 
3226
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/sql/expressions/conditions.js
3238
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/sql/expressions/conditions.js
3227
3239
  function bindIfParam(value, column) {
3228
3240
  if (isDriverValueEncoder(column) && !isSQLWrapper(value) && !is(value, Param) && !is(value, Placeholder) && !is(value, Column) && !is(value, Table) && !is(value, View)) {
3229
3241
  return new Param(value, column);
@@ -3328,7 +3340,7 @@ function notIlike(column, value) {
3328
3340
  return sql`${column} not ilike ${value}`;
3329
3341
  }
3330
3342
 
3331
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/sql/expressions/select.js
3343
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/sql/expressions/select.js
3332
3344
  function asc(column) {
3333
3345
  return sql`${column} asc`;
3334
3346
  }
@@ -3336,7 +3348,7 @@ function desc(column) {
3336
3348
  return sql`${column} desc`;
3337
3349
  }
3338
3350
 
3339
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/relations.js
3351
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/relations.js
3340
3352
  class Relation {
3341
3353
  constructor(sourceTable, referencedTable, relationName) {
3342
3354
  this.sourceTable = sourceTable;
@@ -3556,12 +3568,12 @@ function mapRelationalRow(tablesConfig, tableConfig, row, buildQueryResultSelect
3556
3568
  return result;
3557
3569
  }
3558
3570
 
3559
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/pg-core/view-base.js
3571
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/pg-core/view-base.js
3560
3572
  class PgViewBase extends View {
3561
3573
  static [entityKind] = "PgViewBase";
3562
3574
  }
3563
3575
 
3564
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/pg-core/dialect.js
3576
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/pg-core/dialect.js
3565
3577
  class PgDialect {
3566
3578
  static [entityKind] = "PgDialect";
3567
3579
  casing;
@@ -3695,20 +3707,21 @@ class PgDialect {
3695
3707
  }
3696
3708
  const table = joinMeta.table;
3697
3709
  const lateralSql = joinMeta.lateral ? sql` lateral` : undefined;
3710
+ const onSql = joinMeta.on ? sql` on ${joinMeta.on}` : undefined;
3698
3711
  if (is(table, PgTable)) {
3699
3712
  const tableName = table[PgTable.Symbol.Name];
3700
3713
  const tableSchema = table[PgTable.Symbol.Schema];
3701
3714
  const origTableName = table[PgTable.Symbol.OriginalName];
3702
3715
  const alias = tableName === origTableName ? undefined : joinMeta.alias;
3703
- joinsArray.push(sql`${sql.raw(joinMeta.joinType)} join${lateralSql} ${tableSchema ? sql`${sql.identifier(tableSchema)}.` : undefined}${sql.identifier(origTableName)}${alias && sql` ${sql.identifier(alias)}`} on ${joinMeta.on}`);
3716
+ joinsArray.push(sql`${sql.raw(joinMeta.joinType)} join${lateralSql} ${tableSchema ? sql`${sql.identifier(tableSchema)}.` : undefined}${sql.identifier(origTableName)}${alias && sql` ${sql.identifier(alias)}`}${onSql}`);
3704
3717
  } else if (is(table, View)) {
3705
3718
  const viewName = table[ViewBaseConfig].name;
3706
3719
  const viewSchema = table[ViewBaseConfig].schema;
3707
3720
  const origViewName = table[ViewBaseConfig].originalName;
3708
3721
  const alias = viewName === origViewName ? undefined : joinMeta.alias;
3709
- joinsArray.push(sql`${sql.raw(joinMeta.joinType)} join${lateralSql} ${viewSchema ? sql`${sql.identifier(viewSchema)}.` : undefined}${sql.identifier(origViewName)}${alias && sql` ${sql.identifier(alias)}`} on ${joinMeta.on}`);
3722
+ joinsArray.push(sql`${sql.raw(joinMeta.joinType)} join${lateralSql} ${viewSchema ? sql`${sql.identifier(viewSchema)}.` : undefined}${sql.identifier(origViewName)}${alias && sql` ${sql.identifier(alias)}`}${onSql}`);
3710
3723
  } else {
3711
- joinsArray.push(sql`${sql.raw(joinMeta.joinType)} join${lateralSql} ${table} on ${joinMeta.on}`);
3724
+ joinsArray.push(sql`${sql.raw(joinMeta.joinType)} join${lateralSql} ${table}${onSql}`);
3712
3725
  }
3713
3726
  if (index < joins.length - 1) {
3714
3727
  joinsArray.push(sql` `);
@@ -3777,7 +3790,7 @@ class PgDialect {
3777
3790
  clauseSql.append(sql` of ${sql.join(Array.isArray(lockingClause.config.of) ? lockingClause.config.of : [lockingClause.config.of], sql`, `)}`);
3778
3791
  }
3779
3792
  if (lockingClause.config.noWait) {
3780
- clauseSql.append(sql` no wait`);
3793
+ clauseSql.append(sql` nowait`);
3781
3794
  } else if (lockingClause.config.skipLocked) {
3782
3795
  clauseSql.append(sql` skip locked`);
3783
3796
  }
@@ -4118,7 +4131,7 @@ class PgDialect {
4118
4131
  }
4119
4132
  }
4120
4133
 
4121
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/query-builders/query-builder.js
4134
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/query-builders/query-builder.js
4122
4135
  class TypedQueryBuilder {
4123
4136
  static [entityKind] = "TypedQueryBuilder";
4124
4137
  getSelectedFields() {
@@ -4126,7 +4139,7 @@ class TypedQueryBuilder {
4126
4139
  }
4127
4140
  }
4128
4141
 
4129
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/pg-core/query-builders/select.js
4142
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/pg-core/query-builders/select.js
4130
4143
  class PgSelectBuilder {
4131
4144
  static [entityKind] = "PgSelectBuilder";
4132
4145
  fields;
@@ -4202,7 +4215,7 @@ class PgSelectQueryBuilderBase extends TypedQueryBuilder {
4202
4215
  this.tableName = getTableLikeName(table);
4203
4216
  this.joinsNotNullableMap = typeof this.tableName === "string" ? { [this.tableName]: true } : {};
4204
4217
  }
4205
- createJoin(joinType) {
4218
+ createJoin(joinType, lateral) {
4206
4219
  return (table, on) => {
4207
4220
  const baseTableName = this.tableName;
4208
4221
  const tableName = getTableLikeName(table);
@@ -4226,7 +4239,7 @@ class PgSelectQueryBuilderBase extends TypedQueryBuilder {
4226
4239
  if (!this.config.joins) {
4227
4240
  this.config.joins = [];
4228
4241
  }
4229
- this.config.joins.push({ on, table, joinType, alias: tableName });
4242
+ this.config.joins.push({ on, table, joinType, alias: tableName, lateral });
4230
4243
  if (typeof tableName === "string") {
4231
4244
  switch (joinType) {
4232
4245
  case "left": {
@@ -4238,6 +4251,7 @@ class PgSelectQueryBuilderBase extends TypedQueryBuilder {
4238
4251
  this.joinsNotNullableMap[tableName] = true;
4239
4252
  break;
4240
4253
  }
4254
+ case "cross":
4241
4255
  case "inner": {
4242
4256
  this.joinsNotNullableMap[tableName] = true;
4243
4257
  break;
@@ -4252,10 +4266,14 @@ class PgSelectQueryBuilderBase extends TypedQueryBuilder {
4252
4266
  return this;
4253
4267
  };
4254
4268
  }
4255
- leftJoin = this.createJoin("left");
4256
- rightJoin = this.createJoin("right");
4257
- innerJoin = this.createJoin("inner");
4258
- fullJoin = this.createJoin("full");
4269
+ leftJoin = this.createJoin("left", false);
4270
+ leftJoinLateral = this.createJoin("left", true);
4271
+ rightJoin = this.createJoin("right", false);
4272
+ innerJoin = this.createJoin("inner", false);
4273
+ innerJoinLateral = this.createJoin("inner", true);
4274
+ fullJoin = this.createJoin("full", false);
4275
+ crossJoin = this.createJoin("cross", false);
4276
+ crossJoinLateral = this.createJoin("cross", true);
4259
4277
  createSetOperator(type, isAll) {
4260
4278
  return (rightSelection) => {
4261
4279
  const rightSelect = typeof rightSelection === "function" ? rightSelection(getPgSetOperators()) : rightSelection;
@@ -4415,7 +4433,7 @@ var intersectAll = createSetOperator("intersect", true);
4415
4433
  var except = createSetOperator("except", false);
4416
4434
  var exceptAll = createSetOperator("except", true);
4417
4435
 
4418
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/pg-core/query-builders/query-builder.js
4436
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/pg-core/query-builders/query-builder.js
4419
4437
  class QueryBuilder {
4420
4438
  static [entityKind] = "PgQueryBuilder";
4421
4439
  dialect;
@@ -4493,7 +4511,7 @@ class QueryBuilder {
4493
4511
  }
4494
4512
  }
4495
4513
 
4496
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/pg-core/query-builders/insert.js
4514
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/pg-core/query-builders/insert.js
4497
4515
  class PgInsertBuilder {
4498
4516
  constructor(table, session, dialect, withList, overridingSystemValue_) {
4499
4517
  this.table = table;
@@ -4612,7 +4630,7 @@ class PgInsertBase extends QueryPromise {
4612
4630
  }
4613
4631
  }
4614
4632
 
4615
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/pg-core/query-builders/refresh-materialized-view.js
4633
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/pg-core/query-builders/refresh-materialized-view.js
4616
4634
  class PgRefreshMaterializedView extends QueryPromise {
4617
4635
  constructor(view, session, dialect) {
4618
4636
  super();
@@ -4663,7 +4681,7 @@ class PgRefreshMaterializedView extends QueryPromise {
4663
4681
  };
4664
4682
  }
4665
4683
 
4666
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/pg-core/query-builders/update.js
4684
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/pg-core/query-builders/update.js
4667
4685
  class PgUpdateBuilder {
4668
4686
  constructor(table, session, dialect, withList) {
4669
4687
  this.table = table;
@@ -4813,7 +4831,7 @@ class PgUpdateBase extends QueryPromise {
4813
4831
  }
4814
4832
  }
4815
4833
 
4816
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/pg-core/query-builders/count.js
4834
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/pg-core/query-builders/count.js
4817
4835
  class PgCountBuilder extends SQL {
4818
4836
  constructor(params) {
4819
4837
  super(PgCountBuilder.buildEmbeddedCount(params.source, params.filters).queryChunks);
@@ -4854,7 +4872,7 @@ class PgCountBuilder extends SQL {
4854
4872
  }
4855
4873
  }
4856
4874
 
4857
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/pg-core/query-builders/query.js
4875
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/pg-core/query-builders/query.js
4858
4876
  class RelationalQueryBuilder {
4859
4877
  constructor(fullSchema, schema, tableNamesMap, table, tableConfig, dialect, session) {
4860
4878
  this.fullSchema = fullSchema;
@@ -4937,7 +4955,7 @@ class PgRelationalQuery extends QueryPromise {
4937
4955
  }
4938
4956
  }
4939
4957
 
4940
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/pg-core/query-builders/raw.js
4958
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/pg-core/query-builders/raw.js
4941
4959
  class PgRaw extends QueryPromise {
4942
4960
  constructor(execute, sql2, query, mapBatchResult) {
4943
4961
  super();
@@ -4964,7 +4982,7 @@ class PgRaw extends QueryPromise {
4964
4982
  }
4965
4983
  }
4966
4984
 
4967
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/pg-core/db.js
4985
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/pg-core/db.js
4968
4986
  class PgDatabase {
4969
4987
  constructor(dialect, session, schema) {
4970
4988
  this.dialect = dialect;
@@ -5088,7 +5106,7 @@ class PgDatabase {
5088
5106
  }
5089
5107
  }
5090
5108
 
5091
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/pg-core/session.js
5109
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/pg-core/session.js
5092
5110
  class PgPreparedQuery {
5093
5111
  constructor(query) {
5094
5112
  this.query = query;
@@ -5158,7 +5176,7 @@ class PgTransaction extends PgDatabase {
5158
5176
  }
5159
5177
  }
5160
5178
 
5161
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/postgres-js/session.js
5179
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/postgres-js/session.js
5162
5180
  class PostgresJsPreparedQuery extends PgPreparedQuery {
5163
5181
  constructor(client, queryString, params, logger, fields, _isResponseInArrayMode, customResultMapper) {
5164
5182
  super({ sql: queryString, params });
@@ -5266,7 +5284,7 @@ class PostgresJsTransaction extends PgTransaction {
5266
5284
  }
5267
5285
  }
5268
5286
 
5269
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/postgres-js/driver.js
5287
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/postgres-js/driver.js
5270
5288
  class PostgresJsDatabase extends PgDatabase {
5271
5289
  static [entityKind] = "PostgresJsDatabase";
5272
5290
  }
@@ -5330,7 +5348,7 @@ function drizzle(...params) {
5330
5348
  drizzle2.mock = mock;
5331
5349
  })(drizzle || (drizzle = {}));
5332
5350
 
5333
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/migrator.js
5351
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/migrator.js
5334
5352
  import crypto2 from "crypto";
5335
5353
  import fs2 from "fs";
5336
5354
  function readMigrationFiles(config) {
@@ -5362,23 +5380,24 @@ function readMigrationFiles(config) {
5362
5380
  return migrationQueries;
5363
5381
  }
5364
5382
 
5365
- // ../../node_modules/.pnpm/drizzle-orm@0.41.0_bun-types@1.2.9_gel@2.0.2_postgres@3.4.5/node_modules/drizzle-orm/postgres-js/migrator.js
5383
+ // ../../node_modules/.pnpm/drizzle-orm@0.43.1_bun-types@1.2.10_postgres@3.4.5/node_modules/drizzle-orm/postgres-js/migrator.js
5366
5384
  async function migrate(db, config) {
5367
5385
  const migrations = readMigrationFiles(config);
5368
5386
  await db.dialect.migrate(migrations, db.session, config);
5369
5387
  }
5370
5388
 
5371
- // ../../node_modules/.pnpm/@t3-oss+env-core@0.12.0_typescript@5.8.3_zod@3.24.2/node_modules/@t3-oss/env-core/dist/index.js
5389
+ // ../../node_modules/.pnpm/@t3-oss+env-core@0.13.0_arktype@2.1.20_typescript@5.8.3_valibot@1.0.0_typescript@5.8.3__zod@3.24.3/node_modules/@t3-oss/env-core/dist/index.js
5390
+ function ensureSynchronous(value, message) {
5391
+ if (value instanceof Promise) {
5392
+ throw new Error(message);
5393
+ }
5394
+ }
5372
5395
  function parseWithDictionary(dictionary, value) {
5373
5396
  const result = {};
5374
5397
  const issues = [];
5375
5398
  for (const key in dictionary) {
5376
- const schema = dictionary[key];
5377
- const prop = value[key];
5378
- const propResult = schema["~standard"].validate(prop);
5379
- if (propResult instanceof Promise) {
5380
- throw new Error(`Validation must be synchronous, but ${key} returned a Promise.`);
5381
- }
5399
+ const propResult = dictionary[key]["~standard"].validate(value[key]);
5400
+ ensureSynchronous(propResult, `Validation must be synchronous, but ${key} returned a Promise.`);
5382
5401
  if (propResult.issues) {
5383
5402
  issues.push(...propResult.issues.map((issue) => ({
5384
5403
  ...issue,
@@ -5417,7 +5436,7 @@ function createEnv(opts) {
5417
5436
  const _server = typeof opts.server === "object" ? opts.server : {};
5418
5437
  const _shared = typeof opts.shared === "object" ? opts.shared : {};
5419
5438
  const isServer = opts.isServer ?? (typeof window === "undefined" || ("Deno" in window));
5420
- const finalSchema = isServer ? {
5439
+ const finalSchemaShape = isServer ? {
5421
5440
  ..._server,
5422
5441
  ..._shared,
5423
5442
  ..._client
@@ -5425,7 +5444,8 @@ function createEnv(opts) {
5425
5444
  ..._client,
5426
5445
  ..._shared
5427
5446
  };
5428
- const parsed = parseWithDictionary(finalSchema, runtimeEnv);
5447
+ const parsed = opts.createFinalSchema?.(finalSchemaShape, isServer)["~standard"].validate(runtimeEnv) ?? parseWithDictionary(finalSchemaShape, runtimeEnv);
5448
+ ensureSynchronous(parsed, "Validation must be synchronous");
5429
5449
  const onValidationError = opts.onValidationError ?? ((issues) => {
5430
5450
  console.error("\u274C Invalid environment variables:", issues);
5431
5451
  throw new Error("Invalid environment variables");
@@ -5450,7 +5470,7 @@ function createEnv(opts) {
5450
5470
  const extendedObj = (opts.extends ?? []).reduce((acc, curr) => {
5451
5471
  return Object.assign(acc, curr);
5452
5472
  }, {});
5453
- const fullObj = Object.assign(parsed.value, extendedObj);
5473
+ const fullObj = Object.assign(extendedObj, parsed.value);
5454
5474
  const env = new Proxy(fullObj, {
5455
5475
  get(target, prop) {
5456
5476
  if (typeof prop !== "string")
@@ -5465,7 +5485,7 @@ function createEnv(opts) {
5465
5485
  return env;
5466
5486
  }
5467
5487
 
5468
- // ../../node_modules/.pnpm/@ark+util@0.45.9/node_modules/@ark/util/out/arrays.js
5488
+ // ../../node_modules/.pnpm/@ark+util@0.46.0/node_modules/@ark/util/out/arrays.js
5469
5489
  var liftArray = (data) => Array.isArray(data) ? data : [data];
5470
5490
  var spliterate = (arr, predicate) => {
5471
5491
  const result = [[], []];
@@ -5509,10 +5529,9 @@ var appendUnique = (to, value, opts) => {
5509
5529
  if (to === undefined)
5510
5530
  return Array.isArray(value) ? value : [value];
5511
5531
  const isEqual = opts?.isEqual ?? ((l, r) => l === r);
5512
- liftArray(value).forEach((v) => {
5532
+ for (const v of liftArray(value))
5513
5533
  if (!to.some((existing) => isEqual(existing, v)))
5514
5534
  to.push(v);
5515
- });
5516
5535
  return to;
5517
5536
  };
5518
5537
  var groupBy = (array, discriminant) => array.reduce((result, item) => {
@@ -5521,7 +5540,7 @@ var groupBy = (array, discriminant) => array.reduce((result, item) => {
5521
5540
  return result;
5522
5541
  }, {});
5523
5542
  var arrayEquals = (l, r, opts) => l.length === r.length && l.every(opts?.isEqual ? (lItem, i) => opts.isEqual(lItem, r[i]) : (lItem, i) => lItem === r[i]);
5524
- // ../../node_modules/.pnpm/@ark+util@0.45.9/node_modules/@ark/util/out/domain.js
5543
+ // ../../node_modules/.pnpm/@ark+util@0.46.0/node_modules/@ark/util/out/domain.js
5525
5544
  var hasDomain = (data, kind) => domainOf(data) === kind;
5526
5545
  var domainOf = (data) => {
5527
5546
  const builtinType = typeof data;
@@ -5542,7 +5561,7 @@ var jsTypeOfDescriptions = {
5542
5561
  function: "a function"
5543
5562
  };
5544
5563
 
5545
- // ../../node_modules/.pnpm/@ark+util@0.45.9/node_modules/@ark/util/out/errors.js
5564
+ // ../../node_modules/.pnpm/@ark+util@0.46.0/node_modules/@ark/util/out/errors.js
5546
5565
  class InternalArktypeError extends Error {
5547
5566
  }
5548
5567
  var throwInternalError = (message) => throwError(message, InternalArktypeError);
@@ -5556,26 +5575,26 @@ class ParseError extends Error {
5556
5575
  var throwParseError = (message) => throwError(message, ParseError);
5557
5576
  var noSuggest = (s) => ` ${s}`;
5558
5577
 
5559
- // ../../node_modules/.pnpm/@ark+util@0.45.9/node_modules/@ark/util/out/flatMorph.js
5578
+ // ../../node_modules/.pnpm/@ark+util@0.46.0/node_modules/@ark/util/out/flatMorph.js
5560
5579
  var flatMorph = (o, flatMapEntry) => {
5561
5580
  const result = {};
5562
5581
  const inputIsArray = Array.isArray(o);
5563
5582
  let outputShouldBeArray = false;
5564
- Object.entries(o).forEach((entry, i) => {
5583
+ for (const [i, entry] of Object.entries(o).entries()) {
5565
5584
  const mapped = inputIsArray ? flatMapEntry(i, entry[1]) : flatMapEntry(...entry, i);
5566
5585
  outputShouldBeArray ||= typeof mapped[0] === "number";
5567
5586
  const flattenedEntries = Array.isArray(mapped[0]) || mapped.length === 0 ? mapped : [mapped];
5568
- flattenedEntries.forEach(([k, v]) => {
5587
+ for (const [k, v] of flattenedEntries) {
5569
5588
  if (typeof k === "object")
5570
5589
  result[k.group] = append(result[k.group], v);
5571
5590
  else
5572
5591
  result[k] = v;
5573
- });
5574
- });
5592
+ }
5593
+ }
5575
5594
  return outputShouldBeArray ? Object.values(result) : result;
5576
5595
  };
5577
5596
 
5578
- // ../../node_modules/.pnpm/@ark+util@0.45.9/node_modules/@ark/util/out/records.js
5597
+ // ../../node_modules/.pnpm/@ark+util@0.46.0/node_modules/@ark/util/out/records.js
5579
5598
  var entriesOf = Object.entries;
5580
5599
  var isKeyOf = (k, o) => (k in o);
5581
5600
  var hasKey = (o, k) => (k in o);
@@ -5622,7 +5641,7 @@ var enumValues = (tsEnum) => Object.values(tsEnum).filter((v) => {
5622
5641
  return typeof tsEnum[v] !== "number";
5623
5642
  });
5624
5643
 
5625
- // ../../node_modules/.pnpm/@ark+util@0.45.9/node_modules/@ark/util/out/objectKinds.js
5644
+ // ../../node_modules/.pnpm/@ark+util@0.46.0/node_modules/@ark/util/out/objectKinds.js
5626
5645
  var ecmascriptConstructors = {
5627
5646
  Array,
5628
5647
  Boolean,
@@ -5738,7 +5757,7 @@ var constructorExtends = (ctor, base) => {
5738
5757
  return false;
5739
5758
  };
5740
5759
 
5741
- // ../../node_modules/.pnpm/@ark+util@0.45.9/node_modules/@ark/util/out/clone.js
5760
+ // ../../node_modules/.pnpm/@ark+util@0.46.0/node_modules/@ark/util/out/clone.js
5742
5761
  var deepClone = (input) => _clone(input, new Map);
5743
5762
  var _clone = (input, seen) => {
5744
5763
  if (typeof input !== "object" || input === null)
@@ -5764,7 +5783,7 @@ var _clone = (input, seen) => {
5764
5783
  Object.defineProperties(cloned, propertyDescriptors);
5765
5784
  return cloned;
5766
5785
  };
5767
- // ../../node_modules/.pnpm/@ark+util@0.45.9/node_modules/@ark/util/out/functions.js
5786
+ // ../../node_modules/.pnpm/@ark+util@0.46.0/node_modules/@ark/util/out/functions.js
5768
5787
  var cached = (thunk) => {
5769
5788
  let result = unset;
5770
5789
  return () => result === unset ? result = thunk() : result;
@@ -5798,16 +5817,16 @@ var envHasCsp = cached(() => {
5798
5817
  return true;
5799
5818
  }
5800
5819
  });
5801
- // ../../node_modules/.pnpm/@ark+util@0.45.9/node_modules/@ark/util/out/generics.js
5820
+ // ../../node_modules/.pnpm/@ark+util@0.46.0/node_modules/@ark/util/out/generics.js
5802
5821
  var brand = noSuggest("brand");
5803
5822
  var inferred = noSuggest("arkInferred");
5804
- // ../../node_modules/.pnpm/@ark+util@0.45.9/node_modules/@ark/util/out/hkt.js
5823
+ // ../../node_modules/.pnpm/@ark+util@0.46.0/node_modules/@ark/util/out/hkt.js
5805
5824
  var args = noSuggest("args");
5806
5825
 
5807
5826
  class Hkt {
5808
5827
  constructor() {}
5809
5828
  }
5810
- // ../../node_modules/.pnpm/@ark+util@0.45.9/node_modules/@ark/util/out/isomorphic.js
5829
+ // ../../node_modules/.pnpm/@ark+util@0.46.0/node_modules/@ark/util/out/isomorphic.js
5811
5830
  var fileName = () => {
5812
5831
  try {
5813
5832
  const error = new Error;
@@ -5824,7 +5843,7 @@ var isomorphic = {
5824
5843
  fileName,
5825
5844
  env
5826
5845
  };
5827
- // ../../node_modules/.pnpm/@ark+util@0.45.9/node_modules/@ark/util/out/strings.js
5846
+ // ../../node_modules/.pnpm/@ark+util@0.46.0/node_modules/@ark/util/out/strings.js
5828
5847
  var capitalize = (s) => s[0].toUpperCase() + s.slice(1);
5829
5848
  var anchoredRegex = (regex) => new RegExp(anchoredSource(regex), typeof regex === "string" ? "" : regex.flags);
5830
5849
  var anchoredSource = (regex) => {
@@ -5842,7 +5861,7 @@ var whitespaceChars = {
5842
5861
  "\t": 1
5843
5862
  };
5844
5863
 
5845
- // ../../node_modules/.pnpm/@ark+util@0.45.9/node_modules/@ark/util/out/numbers.js
5864
+ // ../../node_modules/.pnpm/@ark+util@0.46.0/node_modules/@ark/util/out/numbers.js
5846
5865
  var anchoredNegativeZeroPattern = /^-0\.?0*$/.source;
5847
5866
  var positiveIntegerPattern = /[1-9]\d*/.source;
5848
5867
  var looseDecimalPattern = /\.\d+/.source;
@@ -5904,15 +5923,15 @@ var tryParseWellFormedBigint = (def) => {
5904
5923
  return throwParseError(writeMalformedNumericLiteralMessage(def, "bigint"));
5905
5924
  }
5906
5925
  };
5907
- // ../../node_modules/.pnpm/@ark+util@0.45.9/node_modules/@ark/util/out/registry.js
5908
- var arkUtilVersion = "0.45.9";
5926
+ // ../../node_modules/.pnpm/@ark+util@0.46.0/node_modules/@ark/util/out/registry.js
5927
+ var arkUtilVersion = "0.46.0";
5909
5928
  var initialRegistryContents = {
5910
5929
  version: arkUtilVersion,
5911
5930
  filename: isomorphic.fileName(),
5912
5931
  FileConstructor
5913
5932
  };
5914
5933
  var registry = initialRegistryContents;
5915
- var namesByResolution = new WeakMap;
5934
+ var namesByResolution = new Map;
5916
5935
  var nameCounts = Object.create(null);
5917
5936
  var register = (value) => {
5918
5937
  const existingName = namesByResolution.get(value);
@@ -5927,7 +5946,7 @@ var register = (value) => {
5927
5946
  namesByResolution.set(value, name);
5928
5947
  return name;
5929
5948
  };
5930
- var isDotAccessible = (keyName) => /^[a-zA-Z_$][a-zA-Z_$0-9]*$/.test(keyName);
5949
+ var isDotAccessible = (keyName) => /^[$A-Z_a-z][\w$]*$/.test(keyName);
5931
5950
  var baseNameFor = (value) => {
5932
5951
  switch (typeof value) {
5933
5952
  case "object": {
@@ -5944,27 +5963,62 @@ var baseNameFor = (value) => {
5944
5963
  return throwInternalError(`Unexpected attempt to register serializable value of type ${domainOf(value)}`);
5945
5964
  };
5946
5965
 
5947
- // ../../node_modules/.pnpm/@ark+util@0.45.9/node_modules/@ark/util/out/primitive.js
5966
+ // ../../node_modules/.pnpm/@ark+util@0.46.0/node_modules/@ark/util/out/primitive.js
5948
5967
  var serializePrimitive = (value) => typeof value === "string" ? JSON.stringify(value) : typeof value === "bigint" ? `${value}n` : `${value}`;
5949
5968
 
5950
- // ../../node_modules/.pnpm/@ark+util@0.45.9/node_modules/@ark/util/out/serialize.js
5969
+ // ../../node_modules/.pnpm/@ark+util@0.46.0/node_modules/@ark/util/out/serialize.js
5951
5970
  var snapshot = (data, opts = {}) => _serialize(data, {
5952
5971
  onUndefined: `$ark.undefined`,
5953
5972
  onBigInt: (n) => `$ark.bigint-${n}`,
5954
5973
  ...opts
5955
5974
  }, []);
5956
- var printable = (data, indent) => {
5975
+ var printable = (data, opts) => {
5957
5976
  switch (domainOf(data)) {
5958
5977
  case "object":
5959
5978
  const o = data;
5960
5979
  const ctorName = o.constructor.name;
5961
- return ctorName === "Object" || ctorName === "Array" ? JSON.stringify(_serialize(o, printableOpts, []), null, indent) : o instanceof Date ? describeCollapsibleDate(o) : typeof o.expression === "string" ? o.expression : ctorName;
5980
+ return ctorName === "Object" || ctorName === "Array" ? opts?.quoteKeys === false ? stringifyUnquoted(o, opts?.indent ?? 0, "") : JSON.stringify(_serialize(o, printableOpts, []), null, opts?.indent) : stringifyUnquoted(o, opts?.indent ?? 0, "");
5962
5981
  case "symbol":
5963
5982
  return printableOpts.onSymbol(data);
5964
5983
  default:
5965
5984
  return serializePrimitive(data);
5966
5985
  }
5967
5986
  };
5987
+ var stringifyUnquoted = (value, indent, currentIndent) => {
5988
+ if (typeof value === "function")
5989
+ return printableOpts.onFunction(value);
5990
+ if (typeof value !== "object" || value === null)
5991
+ return serializePrimitive(value);
5992
+ const nextIndent = currentIndent + " ".repeat(indent);
5993
+ if (Array.isArray(value)) {
5994
+ if (value.length === 0)
5995
+ return "[]";
5996
+ const items = value.map((item) => stringifyUnquoted(item, indent, nextIndent)).join(`,
5997
+ ` + nextIndent);
5998
+ return indent ? `[
5999
+ ${nextIndent}${items}
6000
+ ${currentIndent}]` : `[${items}]`;
6001
+ }
6002
+ const ctorName = value.constructor.name;
6003
+ if (ctorName === "Object") {
6004
+ const keyValues = stringAndSymbolicEntriesOf(value).map(([key, val]) => {
6005
+ const stringifiedKey = typeof key === "symbol" ? printableOpts.onSymbol(key) : isDotAccessible(key) ? key : JSON.stringify(key);
6006
+ const stringifiedValue = stringifyUnquoted(val, indent, nextIndent);
6007
+ return `${nextIndent}${stringifiedKey}: ${stringifiedValue}`;
6008
+ });
6009
+ if (keyValues.length === 0)
6010
+ return "{}";
6011
+ return indent ? `{
6012
+ ${keyValues.join(`,
6013
+ `)}
6014
+ ${currentIndent}}` : `{${keyValues.join(", ")}}`;
6015
+ }
6016
+ if (value instanceof Date)
6017
+ return describeCollapsibleDate(value);
6018
+ if ("expression" in value && typeof value.expression === "string")
6019
+ return value.expression;
6020
+ return ctorName;
6021
+ };
5968
6022
  var printableOpts = {
5969
6023
  onCycle: () => "(cycle)",
5970
6024
  onSymbol: (v) => `Symbol(${register(v)})`,
@@ -6045,7 +6099,7 @@ var months = [
6045
6099
  var timeWithUnnecessarySeconds = /:\d\d:00$/;
6046
6100
  var pad = (value, length) => String(value).padStart(length, "0");
6047
6101
 
6048
- // ../../node_modules/.pnpm/@ark+util@0.45.9/node_modules/@ark/util/out/path.js
6102
+ // ../../node_modules/.pnpm/@ark+util@0.46.0/node_modules/@ark/util/out/path.js
6049
6103
  var appendStringifiedKey = (path, prop, ...[opts]) => {
6050
6104
  const stringifySymbol = opts?.stringifySymbol ?? printable;
6051
6105
  let propAccessChain = path;
@@ -6095,14 +6149,14 @@ class ReadonlyPath extends ReadonlyArray {
6095
6149
  return this.cache.stringifyAncestors;
6096
6150
  let propString = "";
6097
6151
  const result = [propString];
6098
- this.forEach((path) => {
6152
+ for (const path of this) {
6099
6153
  propString = appendStringifiedKey(propString, path);
6100
6154
  result.push(propString);
6101
- });
6155
+ }
6102
6156
  return this.cache.stringifyAncestors = result;
6103
6157
  }
6104
6158
  }
6105
- // ../../node_modules/.pnpm/@ark+util@0.45.9/node_modules/@ark/util/out/scanner.js
6159
+ // ../../node_modules/.pnpm/@ark+util@0.46.0/node_modules/@ark/util/out/scanner.js
6106
6160
  class Scanner {
6107
6161
  chars;
6108
6162
  i;
@@ -6168,9 +6222,9 @@ class Scanner {
6168
6222
  return this.lookahead in tokens;
6169
6223
  }
6170
6224
  }
6171
- // ../../node_modules/.pnpm/@ark+util@0.45.9/node_modules/@ark/util/out/traits.js
6225
+ // ../../node_modules/.pnpm/@ark+util@0.46.0/node_modules/@ark/util/out/traits.js
6172
6226
  var implementedTraits = noSuggest("implementedTraits");
6173
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/shared/registry.js
6227
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/shared/registry.js
6174
6228
  var _registryName = "$ark";
6175
6229
  var suffix = 2;
6176
6230
  while (_registryName in globalThis)
@@ -6181,7 +6235,7 @@ var $ark = registry;
6181
6235
  var reference = (name) => `${registryName}.${name}`;
6182
6236
  var registeredReference = (value) => reference(register(value));
6183
6237
 
6184
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/shared/compile.js
6238
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/shared/compile.js
6185
6239
  class CompiledFunction extends CastableBase {
6186
6240
  argNames;
6187
6241
  body = "";
@@ -6317,13 +6371,13 @@ class NodeCompiler extends CompiledFunction {
6317
6371
  }
6318
6372
  }
6319
6373
 
6320
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/shared/utils.js
6374
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/shared/utils.js
6321
6375
  var makeRootAndArrayPropertiesMutable = (o) => flatMorph(o, (k, v) => [k, isArray(v) ? [...v] : v]);
6322
6376
  var arkKind = noSuggest("arkKind");
6323
6377
  var hasArkKind = (value, kind) => value?.[arkKind] === kind;
6324
6378
  var isNode = (value) => hasArkKind(value, "root") || hasArkKind(value, "constraint");
6325
6379
 
6326
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/shared/implement.js
6380
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/shared/implement.js
6327
6381
  var basisKinds = ["unit", "proto", "domain"];
6328
6382
  var structuralKinds = [
6329
6383
  "required",
@@ -6411,33 +6465,102 @@ var implementNode = (_) => {
6411
6465
  return implementation;
6412
6466
  };
6413
6467
 
6414
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/config.js
6468
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/shared/toJsonSchema.js
6469
+ class ToJsonSchemaError extends Error {
6470
+ name = "ToJsonSchemaError";
6471
+ code;
6472
+ context;
6473
+ constructor(code, context) {
6474
+ super(printable(context, { quoteKeys: false, indent: 4 }));
6475
+ this.code = code;
6476
+ this.context = context;
6477
+ }
6478
+ hasCode(code) {
6479
+ return this.code === code;
6480
+ }
6481
+ }
6482
+ var defaultConfig = {
6483
+ dialect: "https://json-schema.org/draft/2020-12/schema",
6484
+ useRefs: false,
6485
+ fallback: {
6486
+ arrayObject: (ctx) => ToJsonSchema.throw("arrayObject", ctx),
6487
+ arrayPostfix: (ctx) => ToJsonSchema.throw("arrayPostfix", ctx),
6488
+ defaultValue: (ctx) => ToJsonSchema.throw("defaultValue", ctx),
6489
+ domain: (ctx) => ToJsonSchema.throw("domain", ctx),
6490
+ morph: (ctx) => ToJsonSchema.throw("morph", ctx),
6491
+ patternIntersection: (ctx) => ToJsonSchema.throw("patternIntersection", ctx),
6492
+ predicate: (ctx) => ToJsonSchema.throw("predicate", ctx),
6493
+ proto: (ctx) => ToJsonSchema.throw("proto", ctx),
6494
+ symbolKey: (ctx) => ToJsonSchema.throw("symbolKey", ctx),
6495
+ unit: (ctx) => ToJsonSchema.throw("unit", ctx),
6496
+ date: (ctx) => ToJsonSchema.throw("date", ctx)
6497
+ }
6498
+ };
6499
+ var ToJsonSchema = {
6500
+ Error: ToJsonSchemaError,
6501
+ throw: (...args2) => {
6502
+ throw new ToJsonSchema.Error(...args2);
6503
+ },
6504
+ throwInternalOperandError: (kind, schema) => throwInternalError(`Unexpected JSON Schema input for ${kind}: ${printable(schema)}`),
6505
+ defaultConfig
6506
+ };
6507
+
6508
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/config.js
6415
6509
  $ark.config ??= {};
6416
- var mergeConfigs = (base, extensions) => {
6417
- if (!extensions)
6510
+ var mergeConfigs = (base, merged) => {
6511
+ if (!merged)
6418
6512
  return base;
6419
6513
  const result = { ...base };
6420
6514
  let k;
6421
- for (k in extensions) {
6515
+ for (k in merged) {
6422
6516
  const keywords = { ...base.keywords };
6423
6517
  if (k === "keywords") {
6424
- for (const flatAlias in extensions[k]) {
6425
- const v = extensions.keywords[flatAlias];
6518
+ for (const flatAlias in merged[k]) {
6519
+ const v = merged.keywords[flatAlias];
6426
6520
  if (v === undefined)
6427
6521
  continue;
6428
6522
  keywords[flatAlias] = typeof v === "string" ? { description: v } : v;
6429
6523
  }
6430
6524
  result.keywords = keywords;
6431
- } else {
6432
- result[k] = isNodeKind(k) ? {
6525
+ } else if (k === "toJsonSchema") {
6526
+ result[k] = mergeToJsonSchemaConfigs(base.toJsonSchema, merged.toJsonSchema);
6527
+ } else if (isNodeKind(k)) {
6528
+ result[k] = {
6433
6529
  ...base[k],
6434
- ...extensions[k]
6435
- } : extensions[k];
6436
- }
6530
+ ...merged[k]
6531
+ };
6532
+ } else
6533
+ result[k] = merged[k];
6534
+ }
6535
+ return result;
6536
+ };
6537
+ var mergeToJsonSchemaConfigs = (baseConfig, mergedConfig) => {
6538
+ if (!baseConfig)
6539
+ return mergedConfig ?? {};
6540
+ if (!mergedConfig)
6541
+ return baseConfig;
6542
+ const result = { ...baseConfig };
6543
+ let k;
6544
+ for (k in mergedConfig) {
6545
+ if (k === "fallback") {
6546
+ result.fallback = mergeFallbacks(baseConfig.fallback, mergedConfig.fallback);
6547
+ } else
6548
+ result[k] = mergedConfig[k];
6549
+ }
6550
+ return result;
6551
+ };
6552
+ var mergeFallbacks = (base, merged) => {
6553
+ base = normalizeFallback(base);
6554
+ merged = normalizeFallback(merged);
6555
+ const result = {};
6556
+ let code;
6557
+ for (code in ToJsonSchema.defaultConfig.fallback) {
6558
+ result[code] = merged[code] ?? merged.default ?? base[code] ?? base.default ?? ToJsonSchema.defaultConfig.fallback[code];
6437
6559
  }
6438
6560
  return result;
6439
6561
  };
6440
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/shared/errors.js
6562
+ var normalizeFallback = (fallback) => typeof fallback === "function" ? { default: fallback } : fallback ?? {};
6563
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/shared/errors.js
6441
6564
  class ArkError extends CastableBase {
6442
6565
  [arkKind] = "error";
6443
6566
  path;
@@ -6560,15 +6683,16 @@ class ArkErrors extends ReadonlyArray {
6560
6683
  }
6561
6684
  transform(f) {
6562
6685
  const result = new ArkErrors(this.ctx);
6563
- this.forEach((e) => result.add(f(e)));
6686
+ for (const e of this)
6687
+ result.add(f(e));
6564
6688
  return result;
6565
6689
  }
6566
6690
  merge(errors2) {
6567
- errors2.forEach((e) => {
6691
+ for (const e of errors2) {
6568
6692
  if (this.includes(e))
6569
- return;
6693
+ continue;
6570
6694
  this._add(new ArkError({ ...e, path: [...this.ctx.path, ...e.path] }, this.ctx));
6571
- });
6695
+ }
6572
6696
  }
6573
6697
  affectsPath(path2) {
6574
6698
  if (this.length === 0)
@@ -6609,9 +6733,9 @@ class ArkErrors extends ReadonlyArray {
6609
6733
  this.count++;
6610
6734
  }
6611
6735
  addAncestorPaths(error) {
6612
- error.path.stringifyAncestors().forEach((propString) => {
6736
+ for (const propString of error.path.stringifyAncestors()) {
6613
6737
  this.byAncestorPath[propString] = append(this.byAncestorPath[propString], error);
6614
- });
6738
+ }
6615
6739
  }
6616
6740
  }
6617
6741
 
@@ -6634,7 +6758,7 @@ var indent = (error) => error.toString().split(`
6634
6758
  `).join(`
6635
6759
  `);
6636
6760
 
6637
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/shared/traversal.js
6761
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/shared/traversal.js
6638
6762
  class Traversal {
6639
6763
  path = [];
6640
6764
  errors = new ArkErrors(this);
@@ -6773,7 +6897,7 @@ var traverseKey = (key, fn, ctx) => {
6773
6897
  return result;
6774
6898
  };
6775
6899
 
6776
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/node.js
6900
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/node.js
6777
6901
  class BaseNode extends Callable {
6778
6902
  attachments;
6779
6903
  $;
@@ -7116,7 +7240,7 @@ var appendUniqueNodes = (existing, refs) => appendUnique(existing, refs, {
7116
7240
  isEqual: (l, r) => l.equals(r)
7117
7241
  });
7118
7242
 
7119
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/shared/disjoint.js
7243
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/shared/disjoint.js
7120
7244
  class Disjoint extends Array {
7121
7245
  static init(kind, l, r, ctx) {
7122
7246
  return new Disjoint({
@@ -7178,7 +7302,7 @@ var describeReasons = (l, r) => `${describeReason(l)} and ${describeReason(r)}`;
7178
7302
  var describeReason = (value) => isNode(value) ? value.expression : isArray(value) ? value.map(describeReason).join(" | ") || "never" : String(value);
7179
7303
  var writeUnsatisfiableExpressionError = (expression) => `${expression} results in an unsatisfiable type`;
7180
7304
 
7181
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/shared/intersections.js
7305
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/shared/intersections.js
7182
7306
  var intersectionCache = {};
7183
7307
  var intersectNodesRoot = (l, r, $) => intersectOrPipeNodes(l, r, {
7184
7308
  $,
@@ -7286,7 +7410,7 @@ var _pipeMorphed = (from, to, ctx) => {
7286
7410
  });
7287
7411
  };
7288
7412
 
7289
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/constraint.js
7413
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/constraint.js
7290
7414
  class BaseConstraint extends BaseNode {
7291
7415
  constructor(attachments, $) {
7292
7416
  super(attachments, $);
@@ -7370,8 +7494,11 @@ var intersectConstraints = (s) => {
7370
7494
  }
7371
7495
  if (!matched)
7372
7496
  s.l.push(head);
7373
- if (s.kind === "intersection")
7374
- head.impliedSiblings?.forEach((node) => appendUnique(s.r, node));
7497
+ if (s.kind === "intersection") {
7498
+ if (head.impliedSiblings)
7499
+ for (const node of head.impliedSiblings)
7500
+ appendUnique(s.r, node);
7501
+ }
7375
7502
  return intersectConstraints(s);
7376
7503
  };
7377
7504
  var flattenConstraints = (inner) => {
@@ -7397,7 +7524,7 @@ var writeInvalidOperandMessage = (kind, expected, actual) => {
7397
7524
  const actualDescription = actual.hasKind("morph") ? "a morph" : actual.isUnknown() ? "unknown" : actual.exclude(expected).defaultShortDescription;
7398
7525
  return `${capitalize(kind)} operand must be ${expected.description} (was ${actualDescription})`;
7399
7526
  };
7400
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/generic.js
7527
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/generic.js
7401
7528
  var parseGeneric = (paramDefs, bodyDef, $) => new GenericRoot(paramDefs, bodyDef, $, $, null);
7402
7529
 
7403
7530
  class LazyGenericBody extends Callable {
@@ -7468,28 +7595,7 @@ class GenericRoot extends Callable {
7468
7595
  }
7469
7596
  }
7470
7597
  var writeUnsatisfiedParameterConstraintMessage = (name, constraint, arg) => `${name} must be assignable to ${constraint} (was ${arg})`;
7471
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/shared/jsonSchema.js
7472
- var unjsonifiableExplanations = {
7473
- morph: "it represents a transformation, while JSON Schema only allows validation. Consider creating a Schema from one of its endpoints using `.in` or `.out`.",
7474
- cyclic: "cyclic types are not yet convertible to JSON Schema. If this feature is important to you, please add your feedback at https://github.com/arktypeio/arktype/issues/1087"
7475
- };
7476
- var writeUnjsonifiableMessage = (description, explanation) => {
7477
- let message = `${description} is not convertible to JSON Schema`;
7478
- if (explanation) {
7479
- const normalizedExplanation = isKeyOf(explanation, unjsonifiableExplanations) ? unjsonifiableExplanations[explanation] : explanation;
7480
- message += ` because ${normalizedExplanation}`;
7481
- }
7482
- return message;
7483
- };
7484
- var JsonSchema = {
7485
- writeUnjsonifiableMessage,
7486
- UnjsonifiableError: class UnjsonifiableError extends Error {
7487
- },
7488
- throwUnjsonifiableError: (...args2) => throwError(writeUnjsonifiableMessage(...args2)),
7489
- throwInternalOperandError: (kind, schema) => throwInternalError(`Unexpected JSON Schema input for ${kind}: ${printable(schema)}`)
7490
- };
7491
-
7492
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/predicate.js
7598
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/predicate.js
7493
7599
  var implementation = implementNode({
7494
7600
  kind: "predicate",
7495
7601
  hasAssociatedError: true,
@@ -7531,8 +7637,12 @@ class PredicateNode extends BaseConstraint {
7531
7637
  }
7532
7638
  js.if(`${this.compiledNegation} && !ctx.hasError()`, () => js.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`));
7533
7639
  }
7534
- reduceJsonSchema() {
7535
- return JsonSchema.throwUnjsonifiableError(`Predicate ${this.expression}`);
7640
+ reduceJsonSchema(base, ctx) {
7641
+ return ctx.fallback.predicate({
7642
+ code: "predicate",
7643
+ base,
7644
+ predicate: this.predicate
7645
+ });
7536
7646
  }
7537
7647
  }
7538
7648
  var Predicate = {
@@ -7540,7 +7650,7 @@ var Predicate = {
7540
7650
  Node: PredicateNode
7541
7651
  };
7542
7652
 
7543
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/refinements/divisor.js
7653
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/refinements/divisor.js
7544
7654
  var implementation2 = implementNode({
7545
7655
  kind: "divisor",
7546
7656
  collapsibleKey: "rule",
@@ -7593,7 +7703,7 @@ var greatestCommonDivisor = (l, r) => {
7593
7703
  return greatestCommonDivisor2;
7594
7704
  };
7595
7705
 
7596
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/refinements/range.js
7706
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/refinements/range.js
7597
7707
  class BaseRange extends InternalPrimitiveConstraint {
7598
7708
  boundOperandKind = operandKindsByBoundKind[this.kind];
7599
7709
  compiledActual = this.boundOperandKind === "value" ? `data` : this.boundOperandKind === "length" ? `data.length` : `data.valueOf()`;
@@ -7673,7 +7783,7 @@ var compileComparator = (kind, exclusive) => `${isKeyOf(kind, boundKindPairsByLo
7673
7783
  var dateLimitToString = (limit) => typeof limit === "string" ? limit : new Date(limit).toLocaleString();
7674
7784
  var writeUnboundableMessage = (root) => `Bounded expression ${root} must be exactly one of number, string, Array, or Date`;
7675
7785
 
7676
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/refinements/after.js
7786
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/refinements/after.js
7677
7787
  var implementation3 = implementNode({
7678
7788
  kind: "after",
7679
7789
  collapsibleKey: "rule",
@@ -7698,8 +7808,8 @@ class AfterNode extends BaseRange {
7698
7808
  impliedBasis = $ark.intrinsic.Date.internal;
7699
7809
  collapsibleLimitString = describeCollapsibleDate(this.rule);
7700
7810
  traverseAllows = (data) => data >= this.rule;
7701
- reduceJsonSchema() {
7702
- return JsonSchema.throwUnjsonifiableError("Date instance");
7811
+ reduceJsonSchema(base, ctx) {
7812
+ return ctx.fallback.date({ code: "date", base, after: this.rule });
7703
7813
  }
7704
7814
  }
7705
7815
  var After = {
@@ -7707,7 +7817,7 @@ var After = {
7707
7817
  Node: AfterNode
7708
7818
  };
7709
7819
 
7710
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/refinements/before.js
7820
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/refinements/before.js
7711
7821
  var implementation4 = implementNode({
7712
7822
  kind: "before",
7713
7823
  collapsibleKey: "rule",
@@ -7733,8 +7843,8 @@ class BeforeNode extends BaseRange {
7733
7843
  collapsibleLimitString = describeCollapsibleDate(this.rule);
7734
7844
  traverseAllows = (data) => data <= this.rule;
7735
7845
  impliedBasis = $ark.intrinsic.Date.internal;
7736
- reduceJsonSchema() {
7737
- return JsonSchema.throwUnjsonifiableError("Date instance");
7846
+ reduceJsonSchema(base, ctx) {
7847
+ return ctx.fallback.date({ code: "date", base, before: this.rule });
7738
7848
  }
7739
7849
  }
7740
7850
  var Before = {
@@ -7742,7 +7852,7 @@ var Before = {
7742
7852
  Node: BeforeNode
7743
7853
  };
7744
7854
 
7745
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/refinements/exactLength.js
7855
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/refinements/exactLength.js
7746
7856
  var implementation5 = implementNode({
7747
7857
  kind: "exactLength",
7748
7858
  collapsibleKey: "rule",
@@ -7781,7 +7891,7 @@ class ExactLengthNode extends InternalPrimitiveConstraint {
7781
7891
  schema.maxItems = this.rule;
7782
7892
  return schema;
7783
7893
  default:
7784
- return JsonSchema.throwInternalOperandError("exactLength", schema);
7894
+ return ToJsonSchema.throwInternalOperandError("exactLength", schema);
7785
7895
  }
7786
7896
  }
7787
7897
  }
@@ -7790,7 +7900,7 @@ var ExactLength = {
7790
7900
  Node: ExactLengthNode
7791
7901
  };
7792
7902
 
7793
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/refinements/max.js
7903
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/refinements/max.js
7794
7904
  var implementation6 = implementNode({
7795
7905
  kind: "max",
7796
7906
  collapsibleKey: "rule",
@@ -7830,7 +7940,7 @@ var Max = {
7830
7940
  Node: MaxNode
7831
7941
  };
7832
7942
 
7833
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/refinements/maxLength.js
7943
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/refinements/maxLength.js
7834
7944
  var implementation7 = implementNode({
7835
7945
  kind: "maxLength",
7836
7946
  collapsibleKey: "rule",
@@ -7864,7 +7974,7 @@ class MaxLengthNode extends BaseRange {
7864
7974
  schema.maxItems = this.rule;
7865
7975
  return schema;
7866
7976
  default:
7867
- return JsonSchema.throwInternalOperandError("maxLength", schema);
7977
+ return ToJsonSchema.throwInternalOperandError("maxLength", schema);
7868
7978
  }
7869
7979
  }
7870
7980
  }
@@ -7873,7 +7983,7 @@ var MaxLength = {
7873
7983
  Node: MaxLengthNode
7874
7984
  };
7875
7985
 
7876
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/refinements/min.js
7986
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/refinements/min.js
7877
7987
  var implementation8 = implementNode({
7878
7988
  kind: "min",
7879
7989
  collapsibleKey: "rule",
@@ -7912,7 +8022,7 @@ var Min = {
7912
8022
  Node: MinNode
7913
8023
  };
7914
8024
 
7915
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/refinements/minLength.js
8025
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/refinements/minLength.js
7916
8026
  var implementation9 = implementNode({
7917
8027
  kind: "minLength",
7918
8028
  collapsibleKey: "rule",
@@ -7945,7 +8055,7 @@ class MinLengthNode extends BaseRange {
7945
8055
  schema.minItems = this.rule;
7946
8056
  return schema;
7947
8057
  default:
7948
- return JsonSchema.throwInternalOperandError("minLength", schema);
8058
+ return ToJsonSchema.throwInternalOperandError("minLength", schema);
7949
8059
  }
7950
8060
  }
7951
8061
  }
@@ -7954,7 +8064,7 @@ var MinLength = {
7954
8064
  Node: MinLengthNode
7955
8065
  };
7956
8066
 
7957
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/refinements/kinds.js
8067
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/refinements/kinds.js
7958
8068
  var boundImplementationsByKind = {
7959
8069
  min: Min.implementation,
7960
8070
  max: Max.implementation,
@@ -7974,7 +8084,7 @@ var boundClassesByKind = {
7974
8084
  before: Before.Node
7975
8085
  };
7976
8086
 
7977
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/refinements/pattern.js
8087
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/refinements/pattern.js
7978
8088
  var implementation10 = implementNode({
7979
8089
  kind: "pattern",
7980
8090
  collapsibleKey: "rule",
@@ -8002,12 +8112,16 @@ class PatternNode extends InternalPrimitiveConstraint {
8002
8112
  compiledCondition = `${this.expression}.test(data)`;
8003
8113
  compiledNegation = `!${this.compiledCondition}`;
8004
8114
  impliedBasis = $ark.intrinsic.string.internal;
8005
- reduceJsonSchema(schema) {
8006
- if (schema.pattern) {
8007
- return JsonSchema.throwUnjsonifiableError(`Intersection of patterns ${schema.pattern} & ${this.rule}`);
8115
+ reduceJsonSchema(base, ctx) {
8116
+ if (base.pattern) {
8117
+ return ctx.fallback.patternIntersection({
8118
+ code: "patternIntersection",
8119
+ base,
8120
+ pattern: this.rule
8121
+ });
8008
8122
  }
8009
- schema.pattern = this.rule;
8010
- return schema;
8123
+ base.pattern = this.rule;
8124
+ return base;
8011
8125
  }
8012
8126
  }
8013
8127
  var Pattern = {
@@ -8015,7 +8129,7 @@ var Pattern = {
8015
8129
  Node: PatternNode
8016
8130
  };
8017
8131
 
8018
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/parse.js
8132
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/parse.js
8019
8133
  var schemaKindOf = (schema, allowedKinds) => {
8020
8134
  const kind = discriminateRootKind(schema);
8021
8135
  if (allowedKinds && !allowedKinds.includes(kind)) {
@@ -8104,7 +8218,7 @@ var createNode = ({ id, kind, inner, meta, $, ignoreCache }) => {
8104
8218
  const innerEntries = entriesOf(inner);
8105
8219
  const children = [];
8106
8220
  let innerJson = {};
8107
- innerEntries.forEach(([k, v]) => {
8221
+ for (const [k, v] of innerEntries) {
8108
8222
  const keyImpl = impl.keys[k];
8109
8223
  const serialize2 = keyImpl.serialize ?? (keyImpl.child ? serializeListableChild : defaultValueSerializer);
8110
8224
  innerJson[k] = serialize2(v);
@@ -8116,7 +8230,7 @@ var createNode = ({ id, kind, inner, meta, $, ignoreCache }) => {
8116
8230
  children.push(listableNode);
8117
8231
  } else if (typeof keyImpl.child === "function")
8118
8232
  children.push(...keyImpl.child(v));
8119
- });
8233
+ }
8120
8234
  if (impl.finalizeInnerJson)
8121
8235
  innerJson = impl.finalizeInnerJson(innerJson);
8122
8236
  let json = { ...innerJson };
@@ -8196,7 +8310,7 @@ var possiblyCollapse = (json, toKey, allowPrimitive) => {
8196
8310
  return json;
8197
8311
  };
8198
8312
 
8199
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/structure/prop.js
8313
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/structure/prop.js
8200
8314
  var intersectProps = (l, r, ctx) => {
8201
8315
  if (l.key !== r.key)
8202
8316
  return null;
@@ -8255,12 +8369,7 @@ class BaseProp extends BaseConstraint {
8255
8369
  compile(js) {
8256
8370
  js.if(`${this.serializedKey} in data`, () => js.traverseKey(this.serializedKey, `data${js.prop(this.key)}`, this.value));
8257
8371
  if (this.hasKind("required")) {
8258
- js.else(() => {
8259
- if (js.traversalKind === "Apply") {
8260
- return js.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`);
8261
- } else
8262
- return js.return(false);
8263
- });
8372
+ js.else(() => js.traversalKind === "Apply" ? js.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`) : js.return(false));
8264
8373
  }
8265
8374
  if (js.traversalKind === "Allows")
8266
8375
  js.return(true);
@@ -8268,7 +8377,7 @@ class BaseProp extends BaseConstraint {
8268
8377
  }
8269
8378
  var writeDefaultIntersectionMessage = (lValue, rValue) => `Invalid intersection of default values ${printable(lValue)} & ${printable(rValue)}`;
8270
8379
 
8271
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/structure/optional.js
8380
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/structure/optional.js
8272
8381
  var implementation11 = implementNode({
8273
8382
  kind: "optional",
8274
8383
  hasAssociatedError: false,
@@ -8364,7 +8473,7 @@ var writeNonPrimitiveNonFunctionDefaultValueMessage = (key) => {
8364
8473
  return `Non-primitive default ${keyDescription}must be specified as a function like () => ({my: 'object'})`;
8365
8474
  };
8366
8475
 
8367
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/roots/root.js
8476
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/roots/root.js
8368
8477
  class BaseRoot extends BaseNode {
8369
8478
  constructor(attachments, $) {
8370
8479
  super(attachments, $);
@@ -8405,18 +8514,26 @@ class BaseRoot extends BaseNode {
8405
8514
  return this.meta.description ?? this.defaultShortDescription;
8406
8515
  }
8407
8516
  toJsonSchema(opts = {}) {
8408
- const ctx = {
8409
- dialect: "https://json-schema.org/draft/2020-12/schema",
8410
- ...opts
8411
- };
8412
- const schema = this.toJsonSchemaRecurse(ctx);
8413
- if (typeof ctx.dialect === "string")
8414
- schema.$schema = ctx.dialect;
8517
+ const ctx = mergeToJsonSchemaConfigs(this.$.resolvedConfig.toJsonSchema, opts);
8518
+ ctx.useRefs ||= this.isCyclic;
8519
+ const schema = typeof ctx.dialect === "string" ? { $schema: ctx.dialect } : {};
8520
+ Object.assign(schema, this.toJsonSchemaRecurse(ctx));
8521
+ if (ctx.useRefs) {
8522
+ schema.$defs = flatMorph(this.references, (i, ref) => ref.isRoot() && !ref.alwaysExpandJsonSchema ? [ref.id, ref.toResolvedJsonSchema(ctx)] : []);
8523
+ }
8415
8524
  return schema;
8416
8525
  }
8417
8526
  toJsonSchemaRecurse(ctx) {
8418
- const schema = this.innerToJsonSchema(ctx);
8419
- return Object.assign(schema, this.metaJson);
8527
+ if (ctx.useRefs && !this.alwaysExpandJsonSchema)
8528
+ return { $ref: `#/$defs/${this.id}` };
8529
+ return this.toResolvedJsonSchema(ctx);
8530
+ }
8531
+ get alwaysExpandJsonSchema() {
8532
+ return this.isBasis() || this.kind === "alias" || this.hasKind("union") && this.isBoolean;
8533
+ }
8534
+ toResolvedJsonSchema(ctx) {
8535
+ const result = this.innerToJsonSchema(ctx);
8536
+ return Object.assign(result, this.metaJson);
8420
8537
  }
8421
8538
  intersect(r) {
8422
8539
  const rNode = this.$.parseDefinition(r);
@@ -8714,13 +8831,13 @@ var writeLiteralUnionEntriesMessage = (expression) => `Props cannot be extracted
8714
8831
  ${expression}`;
8715
8832
  var writeNonStructuralOperandMessage = (operation, operand) => `${operation} operand must be an object (was ${operand})`;
8716
8833
 
8717
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/roots/utils.js
8834
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/roots/utils.js
8718
8835
  var defineRightwardIntersections = (kind, implementation12) => flatMorph(schemaKindsRightOf(kind), (i, kind2) => [
8719
8836
  kind2,
8720
8837
  implementation12
8721
8838
  ]);
8722
8839
 
8723
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/roots/alias.js
8840
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/roots/alias.js
8724
8841
  var normalizeAliasSchema = (schema) => typeof schema === "string" ? { reference: schema } : schema;
8725
8842
  var neverIfDisjoint = (result) => result instanceof Disjoint ? $ark.intrinsic.never.internal : result;
8726
8843
  var implementation12 = implementNode({
@@ -8797,8 +8914,8 @@ Resolution: ${printable(resolution)}`);
8797
8914
  get defaultShortDescription() {
8798
8915
  return domainDescriptions.object;
8799
8916
  }
8800
- innerToJsonSchema(_ctx) {
8801
- return JsonSchema.throwUnjsonifiableError(this.expression, "cyclic");
8917
+ innerToJsonSchema(ctx) {
8918
+ return this.resolution.toJsonSchemaRecurse(ctx);
8802
8919
  }
8803
8920
  traverseAllows = (data, ctx) => {
8804
8921
  const seen = ctx.seen[this.reference];
@@ -8828,7 +8945,7 @@ var Alias = {
8828
8945
  Node: AliasNode
8829
8946
  };
8830
8947
 
8831
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/roots/basis.js
8948
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/roots/basis.js
8832
8949
  class InternalBasis extends BaseRoot {
8833
8950
  traverseApply = (data, ctx) => {
8834
8951
  if (!this.traverseAllows(data, ctx))
@@ -8854,7 +8971,7 @@ class InternalBasis extends BaseRoot {
8854
8971
  }
8855
8972
  }
8856
8973
 
8857
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/roots/domain.js
8974
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/roots/domain.js
8858
8975
  var implementation13 = implementNode({
8859
8976
  kind: "domain",
8860
8977
  hasAssociatedError: true,
@@ -8886,9 +9003,14 @@ class DomainNode extends InternalBasis {
8886
9003
  get defaultShortDescription() {
8887
9004
  return domainDescriptions[this.domain];
8888
9005
  }
8889
- innerToJsonSchema(_ctx) {
8890
- if (this.domain === "bigint" || this.domain === "symbol")
8891
- return JsonSchema.throwUnjsonifiableError(this.domain);
9006
+ innerToJsonSchema(ctx) {
9007
+ if (this.domain === "bigint" || this.domain === "symbol") {
9008
+ return ctx.fallback.domain({
9009
+ code: "domain",
9010
+ base: {},
9011
+ domain: this.domain
9012
+ });
9013
+ }
8892
9014
  return {
8893
9015
  type: this.domain
8894
9016
  };
@@ -8900,7 +9022,7 @@ var Domain = {
8900
9022
  writeBadAllowNanMessage: (actual) => `numberAllowsNaN may only be specified with domain "number" (was ${actual})`
8901
9023
  };
8902
9024
 
8903
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/roots/intersection.js
9025
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/roots/intersection.js
8904
9026
  var implementation14 = implementNode({
8905
9027
  kind: "intersection",
8906
9028
  hasAssociatedError: true,
@@ -9076,7 +9198,8 @@ class IntersectionNode extends BaseRoot {
9076
9198
  };
9077
9199
  compile(js) {
9078
9200
  if (js.traversalKind === "Allows") {
9079
- this.children.forEach((child) => js.check(child));
9201
+ for (const child of this.children)
9202
+ js.check(child);
9080
9203
  js.return(true);
9081
9204
  return;
9082
9205
  }
@@ -9138,7 +9261,7 @@ var intersectIntersections = (l, r, ctx) => {
9138
9261
  });
9139
9262
  };
9140
9263
 
9141
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/roots/morph.js
9264
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/roots/morph.js
9142
9265
  var implementation15 = implementNode({
9143
9266
  kind: "morph",
9144
9267
  hasAssociatedError: false,
@@ -9236,8 +9359,12 @@ class MorphNode extends BaseRoot {
9236
9359
  get defaultShortDescription() {
9237
9360
  return this.in.meta.description ?? this.in.defaultShortDescription;
9238
9361
  }
9239
- innerToJsonSchema(_ctx) {
9240
- return JsonSchema.throwUnjsonifiableError(this.expression, "morph");
9362
+ innerToJsonSchema(ctx) {
9363
+ return ctx.fallback.morph({
9364
+ code: "morph",
9365
+ base: this.in.toJsonSchemaRecurse(ctx),
9366
+ out: this.introspectableOut?.toJsonSchemaRecurse(ctx) ?? null
9367
+ });
9241
9368
  }
9242
9369
  compile(js) {
9243
9370
  if (js.traversalKind === "Allows") {
@@ -9270,7 +9397,7 @@ var writeMorphIntersectionMessage = (lDescription, rDescription) => `The interse
9270
9397
  Left: ${lDescription}
9271
9398
  Right: ${rDescription}`;
9272
9399
 
9273
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/roots/proto.js
9400
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/roots/proto.js
9274
9401
  var implementation16 = implementNode({
9275
9402
  kind: "proto",
9276
9403
  hasAssociatedError: true,
@@ -9311,14 +9438,20 @@ class ProtoNode extends InternalBasis {
9311
9438
  traverseAllows = this.requiresInvalidDateCheck ? (data) => data instanceof Date && data.toString() !== "Invalid Date" : (data) => data instanceof this.proto;
9312
9439
  compiledCondition = `data instanceof ${this.serializedConstructor}${this.requiresInvalidDateCheck ? ` && data.toString() !== "Invalid Date"` : ""}`;
9313
9440
  compiledNegation = `!(${this.compiledCondition})`;
9314
- innerToJsonSchema(_ctx) {
9441
+ innerToJsonSchema(ctx) {
9315
9442
  switch (this.builtinName) {
9316
9443
  case "Array":
9317
9444
  return {
9318
9445
  type: "array"
9319
9446
  };
9447
+ case "Date":
9448
+ return ctx.fallback.date?.({ code: "date", base: {} }) ?? ctx.fallback.proto({ code: "proto", base: {}, proto: this.proto });
9320
9449
  default:
9321
- return JsonSchema.throwUnjsonifiableError(this.description);
9450
+ return ctx.fallback.proto({
9451
+ code: "proto",
9452
+ base: {},
9453
+ proto: this.proto
9454
+ });
9322
9455
  }
9323
9456
  }
9324
9457
  expression = this.dateAllowsInvalid ? "Date | InvalidDate" : this.proto.name;
@@ -9337,7 +9470,7 @@ var Proto = {
9337
9470
  writeInvalidSchemaMessage: (actual) => `instanceOf operand must be a function (was ${domainOf(actual)})`
9338
9471
  };
9339
9472
 
9340
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/roots/union.js
9473
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/roots/union.js
9341
9474
  var implementation17 = implementNode({
9342
9475
  kind: "union",
9343
9476
  hasAssociatedError: true,
@@ -9348,9 +9481,9 @@ var implementation17 = implementNode({
9348
9481
  child: true,
9349
9482
  parse: (schema, ctx) => {
9350
9483
  const branches = [];
9351
- schema.forEach((branchSchema) => {
9484
+ for (const branchSchema of schema) {
9352
9485
  const branchNodes = hasArkKind(branchSchema, "root") ? branchSchema.branches : ctx.$.parseSchema(branchSchema).branches;
9353
- branchNodes.forEach((node) => {
9486
+ for (const node of branchNodes) {
9354
9487
  if (node.hasKind("morph")) {
9355
9488
  const matchingMorphIndex = branches.findIndex((matching) => matching.hasKind("morph") && matching.hasEqualMorphs(node));
9356
9489
  if (matchingMorphIndex === -1)
@@ -9364,8 +9497,8 @@ var implementation17 = implementNode({
9364
9497
  }
9365
9498
  } else
9366
9499
  branches.push(node);
9367
- });
9368
- });
9500
+ }
9501
+ }
9369
9502
  if (!ctx.def.ordered)
9370
9503
  branches.sort((l, r) => l.hash < r.hash ? -1 : 1);
9371
9504
  return branches;
@@ -9390,7 +9523,8 @@ var implementation17 = implementNode({
9390
9523
  const byPath = groupBy(ctx.errors, "propString");
9391
9524
  const pathDescriptions = Object.entries(byPath).map(([path2, errors2]) => {
9392
9525
  const branchesAtPath = [];
9393
- errors2.forEach((errorAtPath) => appendUnique(branchesAtPath, errorAtPath.expected));
9526
+ for (const errorAtPath of errors2)
9527
+ appendUnique(branchesAtPath, errorAtPath.expected);
9394
9528
  const expected = describeBranches(branchesAtPath);
9395
9529
  const actual = errors2.every((e) => e.actual === errors2[0].actual) ? errors2[0].actual : printable(errors2[0].data);
9396
9530
  return `${path2 && `${path2} `}must be ${expected}${actual && ` (was ${actual})`}`;
@@ -9438,17 +9572,17 @@ class UnionNode extends BaseRoot {
9438
9572
  get branchGroups() {
9439
9573
  const branchGroups = [];
9440
9574
  let firstBooleanIndex = -1;
9441
- this.branches.forEach((branch) => {
9575
+ for (const branch of this.branches) {
9442
9576
  if (branch.hasKind("unit") && branch.domain === "boolean") {
9443
9577
  if (firstBooleanIndex === -1) {
9444
9578
  firstBooleanIndex = branchGroups.length;
9445
9579
  branchGroups.push(branch);
9446
9580
  } else
9447
9581
  branchGroups[firstBooleanIndex] = $ark.intrinsic.boolean;
9448
- return;
9582
+ continue;
9449
9583
  }
9450
9584
  branchGroups.push(branch);
9451
- });
9585
+ }
9452
9586
  return branchGroups;
9453
9587
  }
9454
9588
  unitBranches = this.branches.filter((n) => n.in.hasKind("unit"));
@@ -9550,12 +9684,16 @@ class UnionNode extends BaseRoot {
9550
9684
  compileIndiscriminable(js) {
9551
9685
  if (js.traversalKind === "Apply") {
9552
9686
  js.const("errors", "[]");
9553
- this.branches.forEach((branch) => js.line("ctx.pushBranch()").line(js.invoke(branch)).if("!ctx.hasError()", () => js.return(branch.includesTransform ? "ctx.queuedMorphs.push(...ctx.popBranch().queuedMorphs)" : "ctx.popBranch()")).line("errors.push(ctx.popBranch().error)"));
9687
+ for (const branch of this.branches) {
9688
+ js.line("ctx.pushBranch()").line(js.invoke(branch)).if("!ctx.hasError()", () => js.return(branch.includesTransform ? "ctx.queuedMorphs.push(...ctx.popBranch().queuedMorphs)" : "ctx.popBranch()")).line("errors.push(ctx.popBranch().error)");
9689
+ }
9554
9690
  js.line(`ctx.errorFromNodeContext({ code: "union", errors, meta: ${this.compiledMeta} })`);
9555
9691
  } else {
9556
9692
  const { optimistic } = js;
9557
9693
  js.optimistic = false;
9558
- this.branches.forEach((branch) => js.if(`${js.invoke(branch)}`, () => js.return(optimistic ? branch.contextFreeMorph ? `${registeredReference(branch.contextFreeMorph)}(${js.data})` : js.data : true)));
9694
+ for (const branch of this.branches) {
9695
+ js.if(`${js.invoke(branch)}`, () => js.return(optimistic ? branch.contextFreeMorph ? `${registeredReference(branch.contextFreeMorph)}(${js.data})` : js.data : true));
9696
+ }
9559
9697
  js.return(optimistic ? `"${unset}"` : false);
9560
9698
  }
9561
9699
  }
@@ -9563,7 +9701,7 @@ class UnionNode extends BaseRoot {
9563
9701
  return this.isBoolean ? "boolean" : `(${this.expression})`;
9564
9702
  }
9565
9703
  discriminate() {
9566
- if (this.branches.length < 2)
9704
+ if (this.branches.length < 2 || this.isCyclic)
9567
9705
  return null;
9568
9706
  if (this.unitBranches.length === this.branches.length) {
9569
9707
  const cases2 = flatMorph(this.unitBranches, (i, n) => [
@@ -9884,7 +10022,7 @@ var writeOrderedIntersectionMessage = (lDescription, rDescription) => `The inter
9884
10022
  Left: ${lDescription}
9885
10023
  Right: ${rDescription}`;
9886
10024
 
9887
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/roots/unit.js
10025
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/roots/unit.js
9888
10026
  var implementation18 = implementNode({
9889
10027
  kind: "unit",
9890
10028
  hasAssociatedError: true,
@@ -9927,8 +10065,8 @@ class UnitNode extends InternalBasis {
9927
10065
  get defaultShortDescription() {
9928
10066
  return this.domain === "object" ? domainDescriptions.object : this.description;
9929
10067
  }
9930
- innerToJsonSchema(_ctx) {
9931
- return this.unit === null ? { type: "null" } : $ark.intrinsic.jsonPrimitive.allows(this.unit) ? { const: this.unit } : JsonSchema.throwUnjsonifiableError(this.defaultShortDescription);
10068
+ innerToJsonSchema(ctx) {
10069
+ return this.unit === null ? { type: "null" } : $ark.intrinsic.jsonPrimitive.allows(this.unit) ? { const: this.unit } : ctx.fallback.unit({ code: "unit", base: {}, unit: this.unit });
9932
10070
  }
9933
10071
  traverseAllows = this.unit instanceof Date ? (data) => data instanceof Date && data.toISOString() === this.compiledValue : Number.isNaN(this.unit) ? (data) => Number.isNaN(data) : (data) => data === this.unit;
9934
10072
  }
@@ -9946,7 +10084,7 @@ var compileEqualityCheck = (unit, serializedValue, negated) => {
9946
10084
  return `data ${negated ? "!" : "="}== ${serializedValue}`;
9947
10085
  };
9948
10086
 
9949
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/structure/index.js
10087
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/structure/index.js
9950
10088
  var implementation19 = implementNode({
9951
10089
  kind: "index",
9952
10090
  hasAssociatedError: false,
@@ -10001,11 +10139,13 @@ class IndexNode extends BaseConstraint {
10001
10139
  }
10002
10140
  return true;
10003
10141
  });
10004
- traverseApply = (data, ctx) => stringAndSymbolicEntriesOf(data).forEach((entry) => {
10005
- if (this.signature.traverseAllows(entry[0], ctx)) {
10006
- traverseKey(entry[0], () => this.value.traverseApply(entry[1], ctx), ctx);
10142
+ traverseApply = (data, ctx) => {
10143
+ for (const entry of stringAndSymbolicEntriesOf(data)) {
10144
+ if (this.signature.traverseAllows(entry[0], ctx)) {
10145
+ traverseKey(entry[0], () => this.value.traverseApply(entry[1], ctx), ctx);
10146
+ }
10007
10147
  }
10008
- });
10148
+ };
10009
10149
  _transform(mapper, ctx) {
10010
10150
  ctx.path.push(this.signature);
10011
10151
  const result = super._transform(mapper, ctx);
@@ -10021,7 +10161,7 @@ var Index = {
10021
10161
  var writeEnumerableIndexBranches = (keys2) => `Index keys ${keys2.join(", ")} should be specified as named props.`;
10022
10162
  var writeInvalidPropertyKeyMessage = (indexSchema) => `Indexed key definition '${indexSchema}' must be a string or symbol`;
10023
10163
 
10024
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/structure/required.js
10164
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/structure/required.js
10025
10165
  var implementation20 = implementNode({
10026
10166
  kind: "required",
10027
10167
  hasAssociatedError: true,
@@ -10060,7 +10200,7 @@ var Required = {
10060
10200
  Node: RequiredNode
10061
10201
  };
10062
10202
 
10063
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/structure/sequence.js
10203
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/structure/sequence.js
10064
10204
  var implementation21 = implementNode({
10065
10205
  kind: "sequence",
10066
10206
  hasAssociatedError: false,
@@ -10250,21 +10390,26 @@ class SequenceNode extends BaseConstraint {
10250
10390
  return this.cacheGetter("element", this.$.node("union", this.children));
10251
10391
  }
10252
10392
  compile(js) {
10253
- this.prefix?.forEach((node, i) => js.traverseKey(`${i}`, `data[${i}]`, node));
10254
- this.defaultablesAndOptionals.forEach((node, i) => {
10393
+ if (this.prefix) {
10394
+ for (const [i, node] of this.prefix.entries())
10395
+ js.traverseKey(`${i}`, `data[${i}]`, node);
10396
+ }
10397
+ for (const [i, node] of this.defaultablesAndOptionals.entries()) {
10255
10398
  const dataIndex = `${i + this.prefixLength}`;
10256
10399
  js.if(`${dataIndex} >= ${js.data}.length`, () => js.traversalKind === "Allows" ? js.return(true) : js.return());
10257
10400
  js.traverseKey(dataIndex, `data[${dataIndex}]`, node);
10258
- });
10401
+ }
10259
10402
  if (this.variadic) {
10260
10403
  if (this.postfix) {
10261
10404
  js.const("firstPostfixIndex", `${js.data}.length${this.postfix ? `- ${this.postfix.length}` : ""}`);
10262
10405
  }
10263
10406
  js.for(`i < ${this.postfix ? "firstPostfixIndex" : "data.length"}`, () => js.traverseKey("i", "data[i]", this.variadic), this.prevariadic.length);
10264
- this.postfix?.forEach((node, i) => {
10265
- const keyExpression = `firstPostfixIndex + ${i}`;
10266
- js.traverseKey(keyExpression, `data[${keyExpression}]`, node);
10267
- });
10407
+ if (this.postfix) {
10408
+ for (const [i, node] of this.postfix.entries()) {
10409
+ const keyExpression = `firstPostfixIndex + ${i}`;
10410
+ js.traverseKey(keyExpression, `data[${keyExpression}]`, node);
10411
+ }
10412
+ }
10268
10413
  }
10269
10414
  if (js.traversalKind === "Allows")
10270
10415
  js.return(true);
@@ -10281,8 +10426,12 @@ class SequenceNode extends BaseConstraint {
10281
10426
  schema.prefixItems = this.prevariadic.map((el) => {
10282
10427
  const valueSchema = el.node.toJsonSchemaRecurse(ctx);
10283
10428
  if (el.kind === "defaultables") {
10284
- const defaultValue = typeof el.default === "function" ? el.default() : el.default;
10285
- valueSchema.default = defaultValue;
10429
+ const value = typeof el.default === "function" ? el.default() : el.default;
10430
+ valueSchema.default = $ark.intrinsic.jsonData.allows(value) ? value : ctx.fallback.defaultValue({
10431
+ code: "defaultValue",
10432
+ base: valueSchema,
10433
+ value
10434
+ });
10286
10435
  }
10287
10436
  return valueSchema;
10288
10437
  });
@@ -10290,16 +10439,23 @@ class SequenceNode extends BaseConstraint {
10290
10439
  if (this.minLength)
10291
10440
  schema.minItems = this.minLength;
10292
10441
  if (this.variadic) {
10293
- schema.items = this.variadic?.toJsonSchemaRecurse(ctx);
10442
+ const variadicSchema = Object.assign(schema, {
10443
+ items: this.variadic.toJsonSchemaRecurse(ctx)
10444
+ });
10294
10445
  if (this.maxLength)
10295
- schema.maxItems = this.maxLength;
10446
+ variadicSchema.maxItems = this.maxLength;
10447
+ if (this.postfix) {
10448
+ const elements = this.postfix.map((el) => el.toJsonSchemaRecurse(ctx));
10449
+ schema = ctx.fallback.arrayPostfix({
10450
+ code: "arrayPostfix",
10451
+ base: variadicSchema,
10452
+ elements
10453
+ });
10454
+ }
10296
10455
  } else {
10297
10456
  schema.items = false;
10298
10457
  delete schema.maxItems;
10299
10458
  }
10300
- if (this.postfix) {
10301
- return JsonSchema.throwUnjsonifiableError(`Postfix tuple element${this.postfixLength > 1 ? "s" : ""} ${this.postfix.join(", ")}`);
10302
- }
10303
10459
  return schema;
10304
10460
  }
10305
10461
  }
@@ -10324,12 +10480,21 @@ var Sequence = {
10324
10480
  };
10325
10481
  var sequenceInnerToTuple = (inner) => {
10326
10482
  const tuple = [];
10327
- inner.prefix?.forEach((node) => tuple.push({ kind: "prefix", node }));
10328
- inner.defaultables?.forEach(([node, defaultValue]) => tuple.push({ kind: "defaultables", node, default: defaultValue }));
10329
- inner.optionals?.forEach((node) => tuple.push({ kind: "optionals", node }));
10483
+ if (inner.prefix)
10484
+ for (const node of inner.prefix)
10485
+ tuple.push({ kind: "prefix", node });
10486
+ if (inner.defaultables) {
10487
+ for (const [node, defaultValue] of inner.defaultables)
10488
+ tuple.push({ kind: "defaultables", node, default: defaultValue });
10489
+ }
10490
+ if (inner.optionals)
10491
+ for (const node of inner.optionals)
10492
+ tuple.push({ kind: "optionals", node });
10330
10493
  if (inner.variadic)
10331
10494
  tuple.push({ kind: "variadic", node: inner.variadic });
10332
- inner.postfix?.forEach((node) => tuple.push({ kind: "postfix", node }));
10495
+ if (inner.postfix)
10496
+ for (const node of inner.postfix)
10497
+ tuple.push({ kind: "postfix", node });
10333
10498
  return tuple;
10334
10499
  };
10335
10500
  var sequenceTupleToInner = (tuple) => tuple.reduce((result, element) => {
@@ -10408,11 +10573,12 @@ var _intersectSequences = (s) => {
10408
10573
  return _intersectSequences(s);
10409
10574
  };
10410
10575
 
10411
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/structure/structure.js
10576
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/structure/structure.js
10412
10577
  var createStructuralWriter = (childStringProp) => (node) => {
10413
10578
  if (node.props.length || node.index) {
10414
10579
  const parts = node.index?.map((index) => index[childStringProp]) ?? [];
10415
- node.props.forEach((prop) => parts.push(prop[childStringProp]));
10580
+ for (const prop of node.props)
10581
+ parts.push(prop[childStringProp]);
10416
10582
  if (node.undeclared)
10417
10583
  parts.push(`+ (undeclared): ${node.undeclared}`);
10418
10584
  const objectLiteralDescription = `{ ${parts.join(", ")} }`;
@@ -10428,13 +10594,10 @@ var intersectPropsAndIndex = (l, r, $) => {
10428
10594
  return null;
10429
10595
  const value = intersectNodesRoot(l.value, r.value, $);
10430
10596
  if (value instanceof Disjoint) {
10431
- if (kind === "optional") {
10432
- return $.node("optional", {
10433
- key: l.key,
10434
- value: $ark.intrinsic.never.internal
10435
- });
10436
- } else
10437
- return value.withPrefixKey(l.key, l.kind);
10597
+ return kind === "optional" ? $.node("optional", {
10598
+ key: l.key,
10599
+ value: $ark.intrinsic.never.internal
10600
+ }) : value.withPrefixKey(l.key, l.kind);
10438
10601
  }
10439
10602
  return null;
10440
10603
  };
@@ -10468,7 +10631,9 @@ var implementation22 = implementNode({
10468
10631
  inner.optional = nodes.map((node) => node.in);
10469
10632
  return;
10470
10633
  }
10471
- nodes.forEach((node) => inner[node.outProp.kind] = append(inner[node.outProp.kind], node.outProp.out));
10634
+ for (const node of nodes) {
10635
+ inner[node.outProp.kind] = append(inner[node.outProp.kind], node.outProp.out);
10636
+ }
10472
10637
  }
10473
10638
  },
10474
10639
  index: {
@@ -10501,13 +10666,13 @@ var implementation22 = implementNode({
10501
10666
  const disjointResult = new Disjoint;
10502
10667
  if (l.undeclared) {
10503
10668
  const lKey = l.keyof();
10504
- r.requiredKeys.forEach((k) => {
10669
+ for (const k of r.requiredKeys) {
10505
10670
  if (!lKey.allows(k)) {
10506
10671
  disjointResult.add("presence", $ark.intrinsic.never.internal, r.propsByKey[k].value, {
10507
10672
  path: [k]
10508
10673
  });
10509
10674
  }
10510
- });
10675
+ }
10511
10676
  if (rInner.optional)
10512
10677
  rInner.optional = rInner.optional.filter((n) => lKey.allows(n.key));
10513
10678
  if (rInner.index) {
@@ -10530,13 +10695,13 @@ var implementation22 = implementNode({
10530
10695
  }
10531
10696
  if (r.undeclared) {
10532
10697
  const rKey = r.keyof();
10533
- l.requiredKeys.forEach((k) => {
10698
+ for (const k of l.requiredKeys) {
10534
10699
  if (!rKey.allows(k)) {
10535
10700
  disjointResult.add("presence", l.propsByKey[k].value, $ark.intrinsic.never.internal, {
10536
10701
  path: [k]
10537
10702
  });
10538
10703
  }
10539
- });
10704
+ }
10540
10705
  if (lInner.optional)
10541
10706
  lInner.optional = lInner.optional.filter((n) => rKey.allows(n.key));
10542
10707
  if (lInner.index) {
@@ -10622,9 +10787,10 @@ class StructureNode extends BaseConstraint {
10622
10787
  if (this._keyof)
10623
10788
  return this._keyof;
10624
10789
  let branches = this.$.units(this.literalKeys).branches;
10625
- this.index?.forEach(({ signature }) => {
10626
- branches = branches.concat(signature.branches);
10627
- });
10790
+ if (this.index) {
10791
+ for (const { signature } of this.index)
10792
+ branches = branches.concat(signature.branches);
10793
+ }
10628
10794
  return this._keyof = this.$.node("union", branches);
10629
10795
  }
10630
10796
  map(flatMapProp) {
@@ -10657,10 +10823,12 @@ class StructureNode extends BaseConstraint {
10657
10823
  value = this.propsByKey[key].value;
10658
10824
  required = this.propsByKey[key].required;
10659
10825
  }
10660
- this.index?.forEach((n) => {
10661
- if (typeOrTermExtends(key, n.signature))
10662
- value = value?.and(n.value) ?? n.value;
10663
- });
10826
+ if (this.index) {
10827
+ for (const n of this.index) {
10828
+ if (typeOrTermExtends(key, n.signature))
10829
+ value = value?.and(n.value) ?? n.value;
10830
+ }
10831
+ }
10664
10832
  if (this.sequence && typeOrTermExtends(key, $ark.intrinsic.nonNegativeIntegerString)) {
10665
10833
  if (hasArkKind(key, "root")) {
10666
10834
  if (this.sequence.variadic)
@@ -10812,7 +10980,10 @@ class StructureNode extends BaseConstraint {
10812
10980
  const parts = [];
10813
10981
  if (this.props.length)
10814
10982
  parts.push(`k in ${this.propsByKeyReference}`);
10815
- this.index?.forEach((index) => parts.push(js.invoke(index.signature, { kind: "Allows", arg: "k" })));
10983
+ if (this.index) {
10984
+ for (const index of this.index)
10985
+ parts.push(js.invoke(index.signature, { kind: "Allows", arg: "k" }));
10986
+ }
10816
10987
  if (this.sequence)
10817
10988
  parts.push("$ark.intrinsic.nonNegativeIntegerString.allows(k)");
10818
10989
  return parts.join(" || ") || "false";
@@ -10824,11 +10995,11 @@ class StructureNode extends BaseConstraint {
10824
10995
  compile(js) {
10825
10996
  if (js.traversalKind === "Apply")
10826
10997
  js.initializeErrorCount();
10827
- this.props.forEach((prop) => {
10998
+ for (const prop of this.props) {
10828
10999
  js.check(prop);
10829
11000
  if (js.traversalKind === "Apply")
10830
11001
  js.returnIfFailFast();
10831
- });
11002
+ }
10832
11003
  if (this.sequence) {
10833
11004
  js.check(this.sequence);
10834
11005
  if (js.traversalKind === "Apply")
@@ -10851,9 +11022,11 @@ class StructureNode extends BaseConstraint {
10851
11022
  }
10852
11023
  compileExhaustiveEntry(js) {
10853
11024
  js.const("k", "keys[i]");
10854
- this.index?.forEach((node) => {
10855
- js.if(`${js.invoke(node.signature, { arg: "k", kind: "Allows" })}`, () => js.traverseKey("k", "data[k]", node.value));
10856
- });
11025
+ if (this.index) {
11026
+ for (const node of this.index) {
11027
+ js.if(`${js.invoke(node.signature, { arg: "k", kind: "Allows" })}`, () => js.traverseKey("k", "data[k]", node.value));
11028
+ }
11029
+ }
10857
11030
  if (this.undeclared === "reject") {
10858
11031
  js.if(`!(${this._compileDeclaresKey(js)})`, () => {
10859
11032
  if (js.traversalKind === "Allows")
@@ -10868,46 +11041,95 @@ class StructureNode extends BaseConstraint {
10868
11041
  case "object":
10869
11042
  return this.reduceObjectJsonSchema(schema, ctx);
10870
11043
  case "array":
11044
+ const arraySchema = this.sequence?.reduceJsonSchema(schema, ctx) ?? schema;
10871
11045
  if (this.props.length || this.index) {
10872
- return JsonSchema.throwUnjsonifiableError(`Additional properties on array ${this.expression}`);
11046
+ return ctx.fallback.arrayObject({
11047
+ code: "arrayObject",
11048
+ base: arraySchema,
11049
+ object: this.reduceObjectJsonSchema({ type: "object" }, ctx)
11050
+ });
10873
11051
  }
10874
- return this.sequence?.reduceJsonSchema(schema, ctx) ?? schema;
11052
+ return arraySchema;
10875
11053
  default:
10876
- return JsonSchema.throwInternalOperandError("structure", schema);
11054
+ return ToJsonSchema.throwInternalOperandError("structure", schema);
10877
11055
  }
10878
11056
  }
10879
11057
  reduceObjectJsonSchema(schema, ctx) {
10880
11058
  if (this.props.length) {
10881
11059
  schema.properties = {};
10882
- this.props.forEach((prop) => {
11060
+ for (const prop of this.props) {
11061
+ const valueSchema = prop.value.toJsonSchemaRecurse(ctx);
10883
11062
  if (typeof prop.key === "symbol") {
10884
- return JsonSchema.throwUnjsonifiableError(`Symbolic key ${prop.serializedKey}`);
11063
+ ctx.fallback.symbolKey({
11064
+ code: "symbolKey",
11065
+ base: schema,
11066
+ key: prop.key,
11067
+ value: valueSchema,
11068
+ optional: prop.optional
11069
+ });
11070
+ continue;
10885
11071
  }
10886
- const valueSchema = prop.value.toJsonSchemaRecurse(ctx);
10887
11072
  if (prop.hasDefault()) {
10888
- const defaultValue = typeof prop.default === "function" ? prop.default() : prop.default;
10889
- valueSchema.default = defaultValue;
11073
+ const value = typeof prop.default === "function" ? prop.default() : prop.default;
11074
+ valueSchema.default = $ark.intrinsic.jsonData.allows(value) ? value : ctx.fallback.defaultValue({
11075
+ code: "defaultValue",
11076
+ base: valueSchema,
11077
+ value
11078
+ });
10890
11079
  }
10891
11080
  schema.properties[prop.key] = valueSchema;
10892
- });
10893
- if (this.requiredKeys.length)
10894
- schema.required = this.requiredKeys;
10895
- }
10896
- this.index?.forEach((index) => {
10897
- if (index.signature.equals($ark.intrinsic.string)) {
10898
- return schema.additionalProperties = index.value.toJsonSchemaRecurse(ctx);
10899
11081
  }
10900
- if (!index.signature.extends($ark.intrinsic.string)) {
10901
- return JsonSchema.throwUnjsonifiableError(`Symbolic index signature ${index.signature.exclude($ark.intrinsic.string)}`);
11082
+ if (this.requiredKeys.length && schema.properties) {
11083
+ schema.required = this.requiredKeys.filter((k) => typeof k === "string" && (k in schema.properties));
10902
11084
  }
10903
- index.signature.branches.forEach((keyBranch) => {
10904
- if (!keyBranch.hasKind("intersection") || keyBranch.inner.pattern?.length !== 1) {
10905
- return JsonSchema.throwUnjsonifiableError(`Index signature ${keyBranch}`);
11085
+ }
11086
+ if (this.index) {
11087
+ for (const index of this.index) {
11088
+ const valueJsonSchema = index.value.toJsonSchemaRecurse(ctx);
11089
+ if (index.signature.equals($ark.intrinsic.string)) {
11090
+ schema.additionalProperties = valueJsonSchema;
11091
+ continue;
10906
11092
  }
10907
- schema.patternProperties ??= {};
10908
- schema.patternProperties[keyBranch.inner.pattern[0].rule] = index.value.toJsonSchemaRecurse(ctx);
10909
- });
10910
- });
11093
+ for (const keyBranch of index.signature.branches) {
11094
+ if (!keyBranch.extends($ark.intrinsic.string)) {
11095
+ schema = ctx.fallback.symbolKey({
11096
+ code: "symbolKey",
11097
+ base: schema,
11098
+ key: null,
11099
+ value: valueJsonSchema,
11100
+ optional: false
11101
+ });
11102
+ continue;
11103
+ }
11104
+ let keySchema = { type: "string" };
11105
+ if (keyBranch.hasKind("morph")) {
11106
+ keySchema = ctx.fallback.morph({
11107
+ code: "morph",
11108
+ base: keyBranch.in.toJsonSchemaRecurse(ctx),
11109
+ out: keyBranch.out.toJsonSchemaRecurse(ctx)
11110
+ });
11111
+ }
11112
+ if (!keyBranch.hasKind("intersection")) {
11113
+ return throwInternalError(`Unexpected index branch kind ${keyBranch.kind}.`);
11114
+ }
11115
+ const { pattern } = keyBranch.inner;
11116
+ if (pattern) {
11117
+ const keySchemaWithPattern = Object.assign(keySchema, {
11118
+ pattern: pattern[0].rule
11119
+ });
11120
+ for (let i = 1;i < pattern.length; i++) {
11121
+ keySchema = ctx.fallback.patternIntersection({
11122
+ code: "patternIntersection",
11123
+ base: keySchemaWithPattern,
11124
+ pattern: pattern[i].rule
11125
+ });
11126
+ }
11127
+ schema.patternProperties ??= {};
11128
+ schema.patternProperties[keySchemaWithPattern.pattern] = valueJsonSchema;
11129
+ }
11130
+ }
11131
+ }
11132
+ }
10911
11133
  if (this.undeclared && !schema.additionalProperties)
10912
11134
  schema.additionalProperties = false;
10913
11135
  return schema;
@@ -10922,14 +11144,21 @@ var constructStructuralMorphCacheKey = (node) => {
10922
11144
  cacheKey += node.sequence?.defaultValueMorphsReference;
10923
11145
  if (node.undeclared === "delete") {
10924
11146
  cacheKey += "delete !(";
10925
- node.required?.forEach((n) => cacheKey += n.compiledKey + " | ");
10926
- node.optional?.forEach((n) => cacheKey += n.compiledKey + " | ");
10927
- node.index?.forEach((index) => cacheKey += index.signature.id + " | ");
11147
+ if (node.required)
11148
+ for (const n of node.required)
11149
+ cacheKey += n.compiledKey + " | ";
11150
+ if (node.optional)
11151
+ for (const n of node.optional)
11152
+ cacheKey += n.compiledKey + " | ";
11153
+ if (node.index)
11154
+ for (const index of node.index)
11155
+ cacheKey += index.signature.id + " | ";
10928
11156
  if (node.sequence) {
10929
11157
  if (node.sequence.maxLength === null)
10930
11158
  cacheKey += intrinsic.nonNegativeIntegerString.id;
10931
11159
  else {
10932
- cacheKey += node.sequence.tuple.forEach((_, i) => cacheKey += i + " | ");
11160
+ for (let i = 0;i < node.sequence.tuple.length; i++)
11161
+ cacheKey += i + " | ";
10933
11162
  }
10934
11163
  }
10935
11164
  cacheKey += ")";
@@ -10994,10 +11223,10 @@ var normalizeIndex = (signature, value, $) => {
10994
11223
  if (!enumerableBranches.length)
10995
11224
  return { index: $.node("index", { signature, value }) };
10996
11225
  const normalized = {};
10997
- enumerableBranches.forEach((n) => {
11226
+ for (const n of enumerableBranches) {
10998
11227
  const prop = $.node("required", { key: n.unit, value });
10999
11228
  normalized[prop.kind] = append(normalized[prop.kind], prop);
11000
- });
11229
+ }
11001
11230
  if (nonEnumerableBranches.length) {
11002
11231
  normalized.index = $.node("index", {
11003
11232
  signature: nonEnumerableBranches,
@@ -11009,7 +11238,7 @@ var normalizeIndex = (signature, value, $) => {
11009
11238
  var typeKeyToString = (k) => hasArkKind(k, "root") ? k.expression : printable(k);
11010
11239
  var writeInvalidKeysMessage = (o, keys2) => `Key${keys2.length === 1 ? "" : "s"} ${keys2.map(typeKeyToString).join(", ")} ${keys2.length === 1 ? "does" : "do"} not exist on ${o}`;
11011
11240
 
11012
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/kinds.js
11241
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/kinds.js
11013
11242
  var nodeImplementationsByKind = {
11014
11243
  ...boundImplementationsByKind,
11015
11244
  alias: Alias.implementation,
@@ -11039,7 +11268,8 @@ $ark.defaultConfig = withAlphabetizedKeys(Object.assign(flatMorph(nodeImplementa
11039
11268
  numberAllowsNaN: false,
11040
11269
  dateAllowsInvalid: false,
11041
11270
  onFail: null,
11042
- keywords: {}
11271
+ keywords: {},
11272
+ toJsonSchema: ToJsonSchema.defaultConfig
11043
11273
  }));
11044
11274
  $ark.resolvedConfig = mergeConfigs($ark.defaultConfig, $ark.config);
11045
11275
  var nodeClassesByKind = {
@@ -11061,7 +11291,7 @@ var nodeClassesByKind = {
11061
11291
  structure: Structure.Node
11062
11292
  };
11063
11293
 
11064
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/module.js
11294
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/module.js
11065
11295
  class RootModule extends DynamicBase {
11066
11296
  get [arkKind]() {
11067
11297
  return "module";
@@ -11072,7 +11302,7 @@ var bindModule = (module, $) => new RootModule(flatMorph(module, (alias, value)
11072
11302
  hasArkKind(value, "module") ? bindModule(value, $) : $.bindReference(value)
11073
11303
  ]));
11074
11304
 
11075
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/scope.js
11305
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/scope.js
11076
11306
  var schemaBranchesOf = (schema) => isArray(schema) ? schema : ("branches" in schema) && isArray(schema.branches) ? schema.branches : undefined;
11077
11307
  var throwMismatchedNodeRootError = (expected, actual) => throwParseError(`Node of kind ${actual} is not valid as a ${expected} definition`);
11078
11308
  var writeDuplicateAliasError = (alias) => `#${alias} duplicates public alias ${alias}`;
@@ -11145,7 +11375,7 @@ class BaseScope {
11145
11375
  throwParseError(`A Scope already named ${this.name} already exists`);
11146
11376
  scopesByName[this.name] = this;
11147
11377
  const aliasEntries = Object.entries(def).map((entry) => this.preparseOwnAliasEntry(...entry));
11148
- aliasEntries.forEach(([k, v]) => {
11378
+ for (const [k, v] of aliasEntries) {
11149
11379
  let name = k;
11150
11380
  if (k[0] === "#") {
11151
11381
  name = k.slice(1);
@@ -11160,12 +11390,9 @@ class BaseScope {
11160
11390
  }
11161
11391
  if (!hasArkKind(v, "module") && !hasArkKind(v, "generic") && !isThunk(v)) {
11162
11392
  const preparsed = this.preparseOwnDefinitionFormat(v, { alias: name });
11163
- if (hasArkKind(preparsed, "root"))
11164
- this.resolutions[name] = this.bindReference(preparsed);
11165
- else
11166
- this.resolutions[name] = this.createParseContext(preparsed).id;
11393
+ this.resolutions[name] = hasArkKind(preparsed, "root") ? this.bindReference(preparsed) : this.createParseContext(preparsed).id;
11167
11394
  }
11168
- });
11395
+ }
11169
11396
  rawUnknownUnion ??= this.node("union", {
11170
11397
  branches: [
11171
11398
  "string",
@@ -11316,10 +11543,9 @@ class BaseScope {
11316
11543
  if (hasArkKind(def, "generic"))
11317
11544
  return this.resolutions[name] = this.bindReference(def);
11318
11545
  if (hasArkKind(def, "module")) {
11319
- if (def.root)
11320
- return this.resolutions[name] = this.bindReference(def.root);
11321
- else
11322
- return throwParseError(writeMissingSubmoduleAccessMessage(name));
11546
+ if (!def.root)
11547
+ throwParseError(writeMissingSubmoduleAccessMessage(name));
11548
+ return this.resolutions[name] = this.bindReference(def.root);
11323
11549
  }
11324
11550
  return this.resolutions[name] = this.parse(def, {
11325
11551
  alias: name
@@ -11353,7 +11579,8 @@ class BaseScope {
11353
11579
  const def = this.aliases[name];
11354
11580
  this._exports[name] = hasArkKind(def, "module") ? bindModule(def, this) : bootstrapAliasReferences(this.maybeResolve(name));
11355
11581
  }
11356
- this.lazyResolutions.forEach((node) => node.resolution);
11582
+ for (const node of this.lazyResolutions)
11583
+ node.resolution;
11357
11584
  this._exportedResolutions = resolutionsOfModule(this, this._exports);
11358
11585
  this._json = resolutionsToJson(this._exportedResolutions);
11359
11586
  Object.assign(this.resolutions, this._exportedResolutions);
@@ -11421,13 +11648,14 @@ class SchemaScope extends BaseScope {
11421
11648
  }
11422
11649
  }
11423
11650
  var bootstrapAliasReferences = (resolution) => {
11424
- resolution.references.filter((node) => node.hasKind("alias")).forEach((aliasNode) => {
11651
+ const aliases = resolution.references.filter((node) => node.hasKind("alias"));
11652
+ for (const aliasNode of aliases) {
11425
11653
  Object.assign(aliasNode.referencesById, aliasNode.resolution.referencesById);
11426
- resolution.references.forEach((ref) => {
11654
+ for (const ref of resolution.references) {
11427
11655
  if (aliasNode.id in ref.referencesById)
11428
11656
  Object.assign(ref.referencesById, aliasNode.referencesById);
11429
- });
11430
- });
11657
+ }
11658
+ }
11431
11659
  return resolution;
11432
11660
  };
11433
11661
  var resolutionsToJson = (resolutions) => flatMorph(resolutions, (k, v) => [
@@ -11481,12 +11709,12 @@ var node = rootSchemaScope.node;
11481
11709
  var defineSchema = rootSchemaScope.defineSchema;
11482
11710
  var genericNode = rootSchemaScope.generic;
11483
11711
 
11484
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/structure/shared.js
11712
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/structure/shared.js
11485
11713
  var arrayIndexSource = `^(?:0|[1-9]\\d*)$`;
11486
11714
  var arrayIndexMatcher = new RegExp(arrayIndexSource);
11487
11715
  var arrayIndexMatcherReference = registeredReference(arrayIndexMatcher);
11488
11716
 
11489
- // ../../node_modules/.pnpm/@ark+schema@0.45.9/node_modules/@ark/schema/out/intrinsic.js
11717
+ // ../../node_modules/.pnpm/@ark+schema@0.46.0/node_modules/@ark/schema/out/intrinsic.js
11490
11718
  var intrinsicBases = schemaScope({
11491
11719
  bigint: "bigint",
11492
11720
  boolean: [{ unit: false }, { unit: true }],
@@ -11538,7 +11766,7 @@ var intrinsic = {
11538
11766
  emptyStructure: node("structure", {}, { prereduced: true })
11539
11767
  };
11540
11768
  $ark.intrinsic = { ...intrinsic };
11541
- // ../../node_modules/.pnpm/arktype@2.1.19/node_modules/arktype/out/parser/shift/operand/date.js
11769
+ // ../../node_modules/.pnpm/arktype@2.1.20/node_modules/arktype/out/parser/shift/operand/date.js
11542
11770
  var isDateLiteral = (value) => typeof value === "string" && value[0] === "d" && (value[1] === "'" || value[1] === '"') && value.at(-1) === value[1];
11543
11771
  var isValidDate = (d) => d.toString() !== "Invalid Date";
11544
11772
  var extractDateLiteralSource = (literal) => literal.slice(2, -1);
@@ -11557,7 +11785,7 @@ var maybeParseDate = (source, errorOnFail) => {
11557
11785
  return errorOnFail ? throwParseError(errorOnFail === true ? writeInvalidDateMessage(source) : errorOnFail) : undefined;
11558
11786
  };
11559
11787
 
11560
- // ../../node_modules/.pnpm/arktype@2.1.19/node_modules/arktype/out/parser/shift/operand/enclosed.js
11788
+ // ../../node_modules/.pnpm/arktype@2.1.20/node_modules/arktype/out/parser/shift/operand/enclosed.js
11561
11789
  var parseEnclosed = (s, enclosing) => {
11562
11790
  const enclosed = s.scanner.shiftUntil(untilLookaheadIsClosing[enclosingTokens[enclosing]]);
11563
11791
  if (s.scanner.lookahead === "")
@@ -11608,12 +11836,12 @@ var enclosingCharDescriptions = {
11608
11836
  };
11609
11837
  var writeUnterminatedEnclosedMessage = (fragment2, enclosingStart) => `${enclosingStart}${fragment2} requires a closing ${enclosingCharDescriptions[enclosingTokens[enclosingStart]]}`;
11610
11838
 
11611
- // ../../node_modules/.pnpm/arktype@2.1.19/node_modules/arktype/out/parser/ast/validate.js
11839
+ // ../../node_modules/.pnpm/arktype@2.1.20/node_modules/arktype/out/parser/ast/validate.js
11612
11840
  var writePrefixedPrivateReferenceMessage = (name) => `Private type references should not include '#'. Use '${name}' instead.`;
11613
11841
  var shallowOptionalMessage = "Optional definitions like 'string?' are only valid as properties in an object or tuple";
11614
11842
  var shallowDefaultableMessage = "Defaultable definitions like 'number = 0' are only valid as properties in an object or tuple";
11615
11843
 
11616
- // ../../node_modules/.pnpm/arktype@2.1.19/node_modules/arktype/out/parser/reduce/shared.js
11844
+ // ../../node_modules/.pnpm/arktype@2.1.20/node_modules/arktype/out/parser/reduce/shared.js
11617
11845
  var minComparators = {
11618
11846
  ">": true,
11619
11847
  ">=": true
@@ -11635,7 +11863,7 @@ var writeOpenRangeMessage = (min2, comparator) => `Left bounds are only valid wh
11635
11863
  var writeUnpairableComparatorMessage = (comparator) => `Left-bounded expressions must specify their limits using < or <= (was ${comparator})`;
11636
11864
  var writeMultipleLeftBoundsMessage = (openLimit, openComparator, limit, comparator) => `An expression may have at most one left bound (parsed ${openLimit}${invertedComparators[openComparator]}, ${limit}${invertedComparators[comparator]})`;
11637
11865
 
11638
- // ../../node_modules/.pnpm/arktype@2.1.19/node_modules/arktype/out/parser/shift/operand/genericArgs.js
11866
+ // ../../node_modules/.pnpm/arktype@2.1.20/node_modules/arktype/out/parser/shift/operand/genericArgs.js
11639
11867
  var parseGenericArgs = (name, g, s) => _parseGenericArgs(name, g, s, []);
11640
11868
  var _parseGenericArgs = (name, g, s, argNodes) => {
11641
11869
  const argState = s.parseUntilFinalizer();
@@ -11652,7 +11880,7 @@ var _parseGenericArgs = (name, g, s, argNodes) => {
11652
11880
  };
11653
11881
  var writeInvalidGenericArgCountMessage = (name, params, argDefs) => `${name}<${params.join(", ")}> requires exactly ${params.length} args (got ${argDefs.length}${argDefs.length === 0 ? "" : `: ${argDefs.join(", ")}`})`;
11654
11882
 
11655
- // ../../node_modules/.pnpm/arktype@2.1.19/node_modules/arktype/out/parser/shift/operand/unenclosed.js
11883
+ // ../../node_modules/.pnpm/arktype@2.1.20/node_modules/arktype/out/parser/shift/operand/unenclosed.js
11656
11884
  var parseUnenclosed = (s) => {
11657
11885
  const token = s.scanner.shiftUntilNextTerminator();
11658
11886
  if (token === "keyof")
@@ -11700,10 +11928,10 @@ var writeMissingOperandMessage = (s) => {
11700
11928
  var writeMissingRightOperandMessage = (token, unscanned = "") => `Token '${token}' requires a right operand${unscanned ? ` before '${unscanned}'` : ""}`;
11701
11929
  var writeExpressionExpectedMessage = (unscanned) => `Expected an expression${unscanned ? ` before '${unscanned}'` : ""}`;
11702
11930
 
11703
- // ../../node_modules/.pnpm/arktype@2.1.19/node_modules/arktype/out/parser/shift/operand/operand.js
11931
+ // ../../node_modules/.pnpm/arktype@2.1.20/node_modules/arktype/out/parser/shift/operand/operand.js
11704
11932
  var parseOperand = (s) => s.scanner.lookahead === "" ? s.error(writeMissingOperandMessage(s)) : s.scanner.lookahead === "(" ? s.shiftedByOne().reduceGroupOpen() : s.scanner.lookaheadIsIn(enclosingChar) ? parseEnclosed(s, s.scanner.shift()) : s.scanner.lookaheadIsIn(whitespaceChars) ? parseOperand(s.shiftedByOne()) : s.scanner.lookahead === "d" ? s.scanner.nextLookahead in enclosingQuote ? parseEnclosed(s, `${s.scanner.shift()}${s.scanner.shift()}`) : parseUnenclosed(s) : parseUnenclosed(s);
11705
11933
 
11706
- // ../../node_modules/.pnpm/arktype@2.1.19/node_modules/arktype/out/parser/shift/scanner.js
11934
+ // ../../node_modules/.pnpm/arktype@2.1.20/node_modules/arktype/out/parser/shift/scanner.js
11707
11935
  class ArkTypeScanner extends Scanner {
11708
11936
  shiftUntilNextTerminator() {
11709
11937
  this.shiftUntilNonWhitespace();
@@ -11734,7 +11962,7 @@ class ArkTypeScanner extends Scanner {
11734
11962
  static lookaheadIsFinalizing = (lookahead, unscanned) => lookahead === ">" ? unscanned[0] === "=" ? unscanned[1] === "=" : unscanned.trimStart() === "" || isKeyOf(unscanned.trimStart()[0], ArkTypeScanner.terminatingChars) : lookahead === "=" ? unscanned[0] !== "=" : lookahead === "," || lookahead === "?";
11735
11963
  }
11736
11964
 
11737
- // ../../node_modules/.pnpm/arktype@2.1.19/node_modules/arktype/out/parser/shift/operator/bounds.js
11965
+ // ../../node_modules/.pnpm/arktype@2.1.20/node_modules/arktype/out/parser/shift/operator/bounds.js
11738
11966
  var parseBound = (s, start) => {
11739
11967
  const comparator = shiftComparator(s, start);
11740
11968
  if (s.root.hasKind("unit")) {
@@ -11805,14 +12033,14 @@ var parseRightBound = (s, comparator) => {
11805
12033
  };
11806
12034
  var writeInvalidLimitMessage = (comparator, limit, boundKind) => `Comparator ${boundKind === "left" ? invertedComparators[comparator] : comparator} must be ${boundKind === "left" ? "preceded" : "followed"} by a corresponding literal (was ${limit})`;
11807
12035
 
11808
- // ../../node_modules/.pnpm/arktype@2.1.19/node_modules/arktype/out/parser/shift/operator/brand.js
12036
+ // ../../node_modules/.pnpm/arktype@2.1.20/node_modules/arktype/out/parser/shift/operator/brand.js
11809
12037
  var parseBrand = (s) => {
11810
12038
  s.scanner.shiftUntilNonWhitespace();
11811
12039
  const brandName = s.scanner.shiftUntilNextTerminator();
11812
12040
  s.root = s.root.brand(brandName);
11813
12041
  };
11814
12042
 
11815
- // ../../node_modules/.pnpm/arktype@2.1.19/node_modules/arktype/out/parser/shift/operator/divisor.js
12043
+ // ../../node_modules/.pnpm/arktype@2.1.20/node_modules/arktype/out/parser/shift/operator/divisor.js
11816
12044
  var parseDivisor = (s) => {
11817
12045
  const divisorToken = s.scanner.shiftUntilNextTerminator();
11818
12046
  const divisor2 = tryParseInteger(divisorToken, {
@@ -11824,7 +12052,7 @@ var parseDivisor = (s) => {
11824
12052
  };
11825
12053
  var writeInvalidDivisorMessage = (divisor2) => `% operator must be followed by a non-zero integer literal (was ${divisor2})`;
11826
12054
 
11827
- // ../../node_modules/.pnpm/arktype@2.1.19/node_modules/arktype/out/parser/shift/operator/operator.js
12055
+ // ../../node_modules/.pnpm/arktype@2.1.20/node_modules/arktype/out/parser/shift/operator/operator.js
11828
12056
  var parseOperator = (s) => {
11829
12057
  const lookahead = s.scanner.shift();
11830
12058
  return lookahead === "" ? s.finalize("") : lookahead === "[" ? s.scanner.shift() === "]" ? s.setRoot(s.root.array()) : s.error(incompleteArrayTokenMessage) : lookahead === "|" ? s.scanner.lookahead === ">" ? s.shiftedByOne().pushRootToBranch("|>") : s.pushRootToBranch(lookahead) : lookahead === "&" ? s.pushRootToBranch(lookahead) : lookahead === ")" ? s.finalizeGroup() : ArkTypeScanner.lookaheadIsFinalizing(lookahead, s.scanner.unscanned) ? s.finalize(lookahead) : isKeyOf(lookahead, comparatorStartChars) ? parseBound(s, lookahead) : lookahead === "%" ? parseDivisor(s) : lookahead === "#" ? parseBrand(s) : (lookahead in whitespaceChars) ? parseOperator(s) : s.error(writeUnexpectedCharacterMessage(lookahead));
@@ -11832,7 +12060,7 @@ var parseOperator = (s) => {
11832
12060
  var writeUnexpectedCharacterMessage = (char, shouldBe = "") => `'${char}' is not allowed here${shouldBe && ` (should be ${shouldBe})`}`;
11833
12061
  var incompleteArrayTokenMessage = `Missing expected ']'`;
11834
12062
 
11835
- // ../../node_modules/.pnpm/arktype@2.1.19/node_modules/arktype/out/parser/shift/operator/default.js
12063
+ // ../../node_modules/.pnpm/arktype@2.1.20/node_modules/arktype/out/parser/shift/operator/default.js
11836
12064
  var parseDefault = (s) => {
11837
12065
  const baseNode = s.unsetRoot();
11838
12066
  s.parseOperand();
@@ -11844,7 +12072,7 @@ var parseDefault = (s) => {
11844
12072
  };
11845
12073
  var writeNonLiteralDefaultMessage = (defaultDef) => `Default value '${defaultDef}' must a literal value`;
11846
12074
 
11847
- // ../../node_modules/.pnpm/arktype@2.1.19/node_modules/arktype/out/parser/string.js
12075
+ // ../../node_modules/.pnpm/arktype@2.1.20/node_modules/arktype/out/parser/string.js
11848
12076
  var parseString = (def, ctx) => {
11849
12077
  const aliasResolution = ctx.$.maybeResolveRoot(def);
11850
12078
  if (aliasResolution)
@@ -11883,7 +12111,7 @@ var parseUntilFinalizer = (s) => {
11883
12111
  };
11884
12112
  var next = (s) => s.hasRoot() ? s.parseOperator() : s.parseOperand();
11885
12113
 
11886
- // ../../node_modules/.pnpm/arktype@2.1.19/node_modules/arktype/out/parser/reduce/dynamic.js
12114
+ // ../../node_modules/.pnpm/arktype@2.1.20/node_modules/arktype/out/parser/reduce/dynamic.js
11887
12115
  class DynamicState {
11888
12116
  root;
11889
12117
  branches = {
@@ -12019,7 +12247,7 @@ class DynamicState {
12019
12247
  }
12020
12248
  }
12021
12249
 
12022
- // ../../node_modules/.pnpm/arktype@2.1.19/node_modules/arktype/out/generic.js
12250
+ // ../../node_modules/.pnpm/arktype@2.1.20/node_modules/arktype/out/generic.js
12023
12251
  var emptyGenericParameterMessage = "An empty string is not a valid generic parameter name";
12024
12252
  var parseGenericParamName = (scanner2, result, ctx) => {
12025
12253
  scanner2.shiftUntilNonWhitespace();
@@ -12047,7 +12275,7 @@ var _parseOptionalConstraint = (scanner2, name, result, ctx) => {
12047
12275
  result.push([name, s.root]);
12048
12276
  return parseGenericParamName(scanner2, result, ctx);
12049
12277
  };
12050
- // ../../node_modules/.pnpm/arktype@2.1.19/node_modules/arktype/out/match.js
12278
+ // ../../node_modules/.pnpm/arktype@2.1.20/node_modules/arktype/out/match.js
12051
12279
  class InternalMatchParser extends Callable {
12052
12280
  $;
12053
12281
  constructor($) {
@@ -12141,7 +12369,7 @@ var throwOnDefault = (errors3) => errors3.throw();
12141
12369
  var chainedAtMessage = `A key matcher must be specified before the first case i.e. match.at('foo') or match.in<object>().at('bar')`;
12142
12370
  var doubleAtMessage = `At most one key matcher may be specified per expression`;
12143
12371
 
12144
- // ../../node_modules/.pnpm/arktype@2.1.19/node_modules/arktype/out/parser/property.js
12372
+ // ../../node_modules/.pnpm/arktype@2.1.20/node_modules/arktype/out/parser/property.js
12145
12373
  var parseProperty = (def, ctx) => {
12146
12374
  if (isArray(def)) {
12147
12375
  if (def[1] === "=")
@@ -12154,7 +12382,7 @@ var parseProperty = (def, ctx) => {
12154
12382
  var invalidOptionalKeyKindMessage = `Only required keys may make their values optional, e.g. { [mySymbol]: ['number', '?'] }`;
12155
12383
  var invalidDefaultableKeyKindMessage = `Only required keys may specify default values, e.g. { value: 'number = 0' }`;
12156
12384
 
12157
- // ../../node_modules/.pnpm/arktype@2.1.19/node_modules/arktype/out/parser/objectLiteral.js
12385
+ // ../../node_modules/.pnpm/arktype@2.1.20/node_modules/arktype/out/parser/objectLiteral.js
12158
12386
  var parseObjectLiteral = (def, ctx) => {
12159
12387
  let spread;
12160
12388
  const structure3 = {};
@@ -12239,7 +12467,7 @@ var preparseKey = (key) => typeof key === "symbol" ? { kind: "required", normali
12239
12467
  };
12240
12468
  var writeInvalidSpreadTypeMessage = (def) => `Spread operand must resolve to an object literal type (was ${def})`;
12241
12469
 
12242
- // ../../node_modules/.pnpm/arktype@2.1.19/node_modules/arktype/out/parser/tupleExpressions.js
12470
+ // ../../node_modules/.pnpm/arktype@2.1.20/node_modules/arktype/out/parser/tupleExpressions.js
12243
12471
  var maybeParseTupleExpression = (def, ctx) => isIndexZeroExpression(def) ? indexZeroParsers[def[0]](def, ctx) : isIndexOneExpression(def) ? indexOneParsers[def[1]](def, ctx) : null;
12244
12472
  var parseKeyOfTuple = (def, ctx) => ctx.$.parseOwnDefinitionFormat(def[1], ctx).keyof();
12245
12473
  var parseBranchTuple = (def, ctx) => {
@@ -12300,7 +12528,7 @@ var indexZeroParsers = defineIndexZeroParsers({
12300
12528
  var isIndexZeroExpression = (def) => indexZeroParsers[def[0]] !== undefined;
12301
12529
  var writeInvalidConstructorMessage = (actual) => `Expected a constructor following 'instanceof' operator (was ${actual})`;
12302
12530
 
12303
- // ../../node_modules/.pnpm/arktype@2.1.19/node_modules/arktype/out/parser/tupleLiteral.js
12531
+ // ../../node_modules/.pnpm/arktype@2.1.20/node_modules/arktype/out/parser/tupleLiteral.js
12304
12532
  var parseTupleLiteral = (def, ctx) => {
12305
12533
  let sequences = [{}];
12306
12534
  let i = 0;
@@ -12377,11 +12605,17 @@ var appendSpreadBranch = (base, branch) => {
12377
12605
  if (!spread) {
12378
12606
  return appendVariadicElement(base, $ark.intrinsic.unknown);
12379
12607
  }
12380
- spread.prefix?.forEach((node3) => appendRequiredElement(base, node3));
12381
- spread.optionals?.forEach((node3) => appendOptionalElement(base, node3));
12608
+ if (spread.prefix)
12609
+ for (const node3 of spread.prefix)
12610
+ appendRequiredElement(base, node3);
12611
+ if (spread.optionals)
12612
+ for (const node3 of spread.optionals)
12613
+ appendOptionalElement(base, node3);
12382
12614
  if (spread.variadic)
12383
12615
  appendVariadicElement(base, spread.variadic);
12384
- spread.postfix?.forEach((node3) => appendRequiredElement(base, node3));
12616
+ if (spread.postfix)
12617
+ for (const node3 of spread.postfix)
12618
+ appendRequiredElement(base, node3);
12385
12619
  return base;
12386
12620
  };
12387
12621
  var writeNonArraySpreadMessage = (operand) => `Spread element must be an array (was ${operand})`;
@@ -12390,7 +12624,7 @@ var requiredPostOptionalMessage = "A required element may not follow an optional
12390
12624
  var optionalOrDefaultableAfterVariadicMessage = "An optional element may not follow a variadic element";
12391
12625
  var defaultablePostOptionalMessage = "A defaultable element may not follow an optional element without a default";
12392
12626
 
12393
- // ../../node_modules/.pnpm/arktype@2.1.19/node_modules/arktype/out/parser/definition.js
12627
+ // ../../node_modules/.pnpm/arktype@2.1.20/node_modules/arktype/out/parser/definition.js
12394
12628
  var parseCache = {};
12395
12629
  var parseInnerDefinition = (def, ctx) => {
12396
12630
  if (typeof def === "string") {
@@ -12429,7 +12663,7 @@ var parseObject = (def, ctx) => {
12429
12663
  var parseTuple = (def, ctx) => maybeParseTupleExpression(def, ctx) ?? parseTupleLiteral(def, ctx);
12430
12664
  var writeBadDefinitionTypeMessage = (actual) => `Type definitions must be strings or objects (was ${actual})`;
12431
12665
 
12432
- // ../../node_modules/.pnpm/arktype@2.1.19/node_modules/arktype/out/type.js
12666
+ // ../../node_modules/.pnpm/arktype@2.1.20/node_modules/arktype/out/type.js
12433
12667
  class InternalTypeParser extends Callable {
12434
12668
  constructor($) {
12435
12669
  const attach = Object.assign({
@@ -12470,7 +12704,7 @@ class InternalTypeParser extends Callable {
12470
12704
  }
12471
12705
  }
12472
12706
 
12473
- // ../../node_modules/.pnpm/arktype@2.1.19/node_modules/arktype/out/scope.js
12707
+ // ../../node_modules/.pnpm/arktype@2.1.20/node_modules/arktype/out/scope.js
12474
12708
  var $arkTypeRegistry = $ark;
12475
12709
 
12476
12710
  class InternalScope extends BaseScope {
@@ -12563,7 +12797,7 @@ var scope2 = Object.assign(InternalScope.scope, {
12563
12797
  });
12564
12798
  var Scope = InternalScope;
12565
12799
 
12566
- // ../../node_modules/.pnpm/arktype@2.1.19/node_modules/arktype/out/keywords/builtins.js
12800
+ // ../../node_modules/.pnpm/arktype@2.1.20/node_modules/arktype/out/keywords/builtins.js
12567
12801
  class MergeHkt extends Hkt {
12568
12802
  description = 'merge an object\'s properties onto another like `Merge(User, { isAdmin: "true" })`';
12569
12803
  }
@@ -12573,7 +12807,7 @@ var arkBuiltins = Scope.module({
12573
12807
  Merge
12574
12808
  });
12575
12809
 
12576
- // ../../node_modules/.pnpm/arktype@2.1.19/node_modules/arktype/out/keywords/Array.js
12810
+ // ../../node_modules/.pnpm/arktype@2.1.20/node_modules/arktype/out/keywords/Array.js
12577
12811
  class liftFromHkt extends Hkt {
12578
12812
  }
12579
12813
  var liftFrom = genericNode("element")((args2) => {
@@ -12590,7 +12824,7 @@ var arkArray = Scope.module({
12590
12824
  name: "Array"
12591
12825
  });
12592
12826
 
12593
- // ../../node_modules/.pnpm/arktype@2.1.19/node_modules/arktype/out/keywords/FormData.js
12827
+ // ../../node_modules/.pnpm/arktype@2.1.20/node_modules/arktype/out/keywords/FormData.js
12594
12828
  var value = rootSchema(["string", registry.FileConstructor]);
12595
12829
  var parsedFormDataValue = value.rawOr(value.array());
12596
12830
  var parsed = rootSchema({
@@ -12627,7 +12861,7 @@ var arkFormData = Scope.module({
12627
12861
  name: "FormData"
12628
12862
  });
12629
12863
 
12630
- // ../../node_modules/.pnpm/arktype@2.1.19/node_modules/arktype/out/keywords/TypedArray.js
12864
+ // ../../node_modules/.pnpm/arktype@2.1.20/node_modules/arktype/out/keywords/TypedArray.js
12631
12865
  var TypedArray = Scope.module({
12632
12866
  Int8: ["instanceof", Int8Array],
12633
12867
  Uint8: ["instanceof", Uint8Array],
@@ -12644,7 +12878,7 @@ var TypedArray = Scope.module({
12644
12878
  name: "TypedArray"
12645
12879
  });
12646
12880
 
12647
- // ../../node_modules/.pnpm/arktype@2.1.19/node_modules/arktype/out/keywords/constructors.js
12881
+ // ../../node_modules/.pnpm/arktype@2.1.20/node_modules/arktype/out/keywords/constructors.js
12648
12882
  var omittedPrototypes = {
12649
12883
  Boolean: 1,
12650
12884
  Number: 1,
@@ -12657,7 +12891,7 @@ var arkPrototypes = Scope.module({
12657
12891
  FormData: arkFormData
12658
12892
  });
12659
12893
 
12660
- // ../../node_modules/.pnpm/arktype@2.1.19/node_modules/arktype/out/keywords/number.js
12894
+ // ../../node_modules/.pnpm/arktype@2.1.20/node_modules/arktype/out/keywords/number.js
12661
12895
  var epoch = rootSchema({
12662
12896
  domain: {
12663
12897
  domain: "number",
@@ -12700,15 +12934,20 @@ var number = Scope.module({
12700
12934
  name: "number"
12701
12935
  });
12702
12936
 
12703
- // ../../node_modules/.pnpm/arktype@2.1.19/node_modules/arktype/out/keywords/string.js
12704
- var regexStringNode = (regex, description) => node("intersection", {
12705
- domain: "string",
12706
- pattern: {
12707
- rule: regex.source,
12708
- flags: regex.flags,
12709
- meta: description
12710
- }
12711
- });
12937
+ // ../../node_modules/.pnpm/arktype@2.1.20/node_modules/arktype/out/keywords/string.js
12938
+ var regexStringNode = (regex, description, jsonSchemaFormat) => {
12939
+ const schema = {
12940
+ domain: "string",
12941
+ pattern: {
12942
+ rule: regex.source,
12943
+ flags: regex.flags,
12944
+ meta: description
12945
+ }
12946
+ };
12947
+ if (jsonSchemaFormat)
12948
+ schema.meta = { format: jsonSchemaFormat };
12949
+ return node("intersection", schema);
12950
+ };
12712
12951
  var stringIntegerRoot = regexStringNode(wellFormedIntegerMatcher, "a well-formed integer string");
12713
12952
  var stringInteger = Scope.module({
12714
12953
  root: stringIntegerRoot,
@@ -12723,10 +12962,10 @@ var stringInteger = Scope.module({
12723
12962
  }, {
12724
12963
  name: "string.integer"
12725
12964
  });
12726
- var hex = regexStringNode(/^[0-9a-fA-F]+$/, "hex characters only");
12965
+ var hex = regexStringNode(/^[\dA-Fa-f]+$/, "hex characters only");
12727
12966
  var base64 = Scope.module({
12728
- root: regexStringNode(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/, "base64-encoded"),
12729
- url: regexStringNode(/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2}(?:==|%3D%3D)?|[A-Za-z0-9_-]{3}(?:=|%3D)?)?$/, "base64url-encoded")
12967
+ root: regexStringNode(/^(?:[\d+/A-Za-z]{4})*(?:[\d+/A-Za-z]{2}==|[\d+/A-Za-z]{3}=)?$/, "base64-encoded"),
12968
+ url: regexStringNode(/^(?:[\w-]{4})*(?:[\w-]{2}(?:==|%3D%3D)?|[\w-]{3}(?:=|%3D)?)?$/, "base64url-encoded")
12730
12969
  }, {
12731
12970
  name: "string.base64"
12732
12971
  });
@@ -12742,7 +12981,7 @@ var capitalize2 = Scope.module({
12742
12981
  name: "string.capitalize"
12743
12982
  });
12744
12983
  var isLuhnValid = (creditCardInput) => {
12745
- const sanitized = creditCardInput.replace(/[- ]+/g, "");
12984
+ const sanitized = creditCardInput.replaceAll(/[ -]+/g, "");
12746
12985
  let sum = 0;
12747
12986
  let digit;
12748
12987
  let tmpNum;
@@ -12752,17 +12991,14 @@ var isLuhnValid = (creditCardInput) => {
12752
12991
  tmpNum = Number.parseInt(digit, 10);
12753
12992
  if (shouldDouble) {
12754
12993
  tmpNum *= 2;
12755
- if (tmpNum >= 10)
12756
- sum += tmpNum % 10 + 1;
12757
- else
12758
- sum += tmpNum;
12994
+ sum += tmpNum >= 10 ? tmpNum % 10 + 1 : tmpNum;
12759
12995
  } else
12760
12996
  sum += tmpNum;
12761
12997
  shouldDouble = !shouldDouble;
12762
12998
  }
12763
12999
  return !!(sum % 10 === 0 ? sanitized : false);
12764
13000
  };
12765
- var creditCardMatcher = /^(?:4[0-9]{12}(?:[0-9]{3,6})?|5[1-5][0-9]{14}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12,15}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11}|6[27][0-9]{14}|^(81[0-9]{14,17}))$/;
13001
+ var creditCardMatcher = /^(?:4\d{12}(?:\d{3,6})?|5[1-5]\d{14}|(222[1-9]|22[3-9]\d|2[3-6]\d{2}|27[01]\d|2720)\d{12}|6(?:011|5\d\d)\d{12,15}|3[47]\d{13}|3(?:0[0-5]|[68]\d)\d{11}|(?:2131|1800|35\d{3})\d{11}|6[27]\d{14}|^(81\d{14,17}))$/;
12766
13002
  var creditCard = rootSchema({
12767
13003
  domain: "string",
12768
13004
  pattern: {
@@ -12774,7 +13010,7 @@ var creditCard = rootSchema({
12774
13010
  predicate: isLuhnValid
12775
13011
  }
12776
13012
  });
12777
- var iso8601Matcher = /^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;
13013
+ var iso8601Matcher = /^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))(T((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([,.]\d+(?!:))?)?(\17[0-5]\d([,.]\d+)?)?([Zz]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;
12778
13014
  var isParsableDate = (s) => !Number.isNaN(new Date(s).valueOf());
12779
13015
  var parsableDate = rootSchema({
12780
13016
  domain: "string",
@@ -12833,7 +13069,7 @@ var stringDate = Scope.module({
12833
13069
  }, {
12834
13070
  name: "string.date"
12835
13071
  });
12836
- var email = regexStringNode(/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/, "an email address");
13072
+ var email = regexStringNode(/^[\w%+.-]+@[\d.A-Za-z-]+\.[A-Za-z]{2,}$/, "an email address", "email");
12837
13073
  var ipv4Segment = "(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])";
12838
13074
  var ipv4Address = `(${ipv4Segment}[.]){3}${ipv4Segment}`;
12839
13075
  var ipv4Matcher = new RegExp(`^${ipv4Address}$`);
@@ -12841,8 +13077,8 @@ var ipv6Segment = "(?:[0-9a-fA-F]{1,4})";
12841
13077
  var ipv6Matcher = new RegExp("^(" + `(?:${ipv6Segment}:){7}(?:${ipv6Segment}|:)|` + `(?:${ipv6Segment}:){6}(?:${ipv4Address}|:${ipv6Segment}|:)|` + `(?:${ipv6Segment}:){5}(?::${ipv4Address}|(:${ipv6Segment}){1,2}|:)|` + `(?:${ipv6Segment}:){4}(?:(:${ipv6Segment}){0,1}:${ipv4Address}|(:${ipv6Segment}){1,3}|:)|` + `(?:${ipv6Segment}:){3}(?:(:${ipv6Segment}){0,2}:${ipv4Address}|(:${ipv6Segment}){1,4}|:)|` + `(?:${ipv6Segment}:){2}(?:(:${ipv6Segment}){0,3}:${ipv4Address}|(:${ipv6Segment}){1,5}|:)|` + `(?:${ipv6Segment}:){1}(?:(:${ipv6Segment}){0,4}:${ipv4Address}|(:${ipv6Segment}){1,6}|:)|` + `(?::((?::${ipv6Segment}){0,5}:${ipv4Address}|(?::${ipv6Segment}){1,7}|:))` + ")(%[0-9a-zA-Z.]{1,})?$");
12842
13078
  var ip = Scope.module({
12843
13079
  root: ["v4 | v6", "@", "an IP address"],
12844
- v4: regexStringNode(ipv4Matcher, "an IPv4 address"),
12845
- v6: regexStringNode(ipv6Matcher, "an IPv6 address")
13080
+ v4: regexStringNode(ipv4Matcher, "an IPv4 address", "ipv4"),
13081
+ v6: regexStringNode(ipv6Matcher, "an IPv6 address", "ipv6")
12846
13082
  }, {
12847
13083
  name: "string.ip"
12848
13084
  });
@@ -12962,7 +13198,7 @@ var normalize = Scope.module({
12962
13198
  name: "string.normalize"
12963
13199
  });
12964
13200
  var numericRoot = regexStringNode(numericStringMatcher, "a well-formed numeric string");
12965
- var numeric = Scope.module({
13201
+ var stringNumeric = Scope.module({
12966
13202
  root: numericRoot,
12967
13203
  parse: rootSchema({
12968
13204
  in: numericRoot,
@@ -12972,7 +13208,27 @@ var numeric = Scope.module({
12972
13208
  }, {
12973
13209
  name: "string.numeric"
12974
13210
  });
12975
- var semverMatcher = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
13211
+ var regexPatternDescription = "a regex pattern";
13212
+ var regex = rootSchema({
13213
+ domain: "string",
13214
+ predicate: {
13215
+ meta: regexPatternDescription,
13216
+ predicate: (s, ctx) => {
13217
+ try {
13218
+ new RegExp(s);
13219
+ return true;
13220
+ } catch (e) {
13221
+ return ctx.reject({
13222
+ code: "predicate",
13223
+ expected: regexPatternDescription,
13224
+ problem: String(e)
13225
+ });
13226
+ }
13227
+ }
13228
+ },
13229
+ meta: { format: "regex" }
13230
+ });
13231
+ var semverMatcher = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*))*))?(?:\+([\dA-Za-z-]+(?:\.[\dA-Za-z-]+)*))?$/;
12976
13232
  var semver = regexStringNode(semverMatcher, "a semantic version (see https://semver.org/)");
12977
13233
  var preformattedTrim = regexStringNode(/^\S.*\S$|^\S?$/, "trimmed");
12978
13234
  var trim = Scope.module({
@@ -13011,7 +13267,8 @@ var urlRoot = rootSchema({
13011
13267
  predicate: {
13012
13268
  meta: "a URL string",
13013
13269
  predicate: isParsableUrl
13014
- }
13270
+ },
13271
+ meta: { format: "uri" }
13015
13272
  });
13016
13273
  var url = Scope.module({
13017
13274
  root: urlRoot,
@@ -13031,25 +13288,29 @@ var url = Scope.module({
13031
13288
  name: "string.url"
13032
13289
  });
13033
13290
  var uuid = Scope.module({
13034
- root: ["versioned | nil | max", "@", "a UUID"],
13291
+ root: [
13292
+ "versioned | nil | max",
13293
+ "@",
13294
+ { description: "a UUID", format: "uuid" }
13295
+ ],
13035
13296
  "#nil": "'00000000-0000-0000-0000-000000000000'",
13036
13297
  "#max": "'ffffffff-ffff-ffff-ffff-ffffffffffff'",
13037
- "#versioned": /[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/i,
13038
- v1: regexStringNode(/^[0-9a-f]{8}-[0-9a-f]{4}-1[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i, "a UUIDv1"),
13039
- v2: regexStringNode(/^[0-9a-f]{8}-[0-9a-f]{4}-2[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i, "a UUIDv2"),
13040
- v3: regexStringNode(/^[0-9a-f]{8}-[0-9a-f]{4}-3[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i, "a UUIDv3"),
13041
- v4: regexStringNode(/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i, "a UUIDv4"),
13042
- v5: regexStringNode(/^[0-9a-f]{8}-[0-9a-f]{4}-5[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i, "a UUIDv5"),
13043
- v6: regexStringNode(/^[0-9a-f]{8}-[0-9a-f]{4}-6[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i, "a UUIDv6"),
13044
- v7: regexStringNode(/^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i, "a UUIDv7"),
13045
- v8: regexStringNode(/^[0-9a-f]{8}-[0-9a-f]{4}-8[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i, "a UUIDv8")
13298
+ "#versioned": /[\da-f]{8}-[\da-f]{4}-[1-8][\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}/i,
13299
+ v1: regexStringNode(/^[\da-f]{8}-[\da-f]{4}-1[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i, "a UUIDv1"),
13300
+ v2: regexStringNode(/^[\da-f]{8}-[\da-f]{4}-2[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i, "a UUIDv2"),
13301
+ v3: regexStringNode(/^[\da-f]{8}-[\da-f]{4}-3[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i, "a UUIDv3"),
13302
+ v4: regexStringNode(/^[\da-f]{8}-[\da-f]{4}-4[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i, "a UUIDv4"),
13303
+ v5: regexStringNode(/^[\da-f]{8}-[\da-f]{4}-5[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i, "a UUIDv5"),
13304
+ v6: regexStringNode(/^[\da-f]{8}-[\da-f]{4}-6[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i, "a UUIDv6"),
13305
+ v7: regexStringNode(/^[\da-f]{8}-[\da-f]{4}-7[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i, "a UUIDv7"),
13306
+ v8: regexStringNode(/^[\da-f]{8}-[\da-f]{4}-8[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i, "a UUIDv8")
13046
13307
  }, {
13047
13308
  name: "string.uuid"
13048
13309
  });
13049
13310
  var string = Scope.module({
13050
13311
  root: intrinsic.string,
13051
13312
  alpha: regexStringNode(/^[A-Za-z]*$/, "only letters"),
13052
- alphanumeric: regexStringNode(/^[A-Za-z\d]*$/, "only letters and digits 0-9"),
13313
+ alphanumeric: regexStringNode(/^[\dA-Za-z]*$/, "only letters and digits 0-9"),
13053
13314
  hex,
13054
13315
  base64,
13055
13316
  capitalize: capitalize2,
@@ -13062,7 +13323,8 @@ var string = Scope.module({
13062
13323
  json,
13063
13324
  lower,
13064
13325
  normalize,
13065
- numeric,
13326
+ numeric: stringNumeric,
13327
+ regex,
13066
13328
  semver,
13067
13329
  trim,
13068
13330
  upper,
@@ -13072,7 +13334,7 @@ var string = Scope.module({
13072
13334
  name: "string"
13073
13335
  });
13074
13336
 
13075
- // ../../node_modules/.pnpm/arktype@2.1.19/node_modules/arktype/out/keywords/ts.js
13337
+ // ../../node_modules/.pnpm/arktype@2.1.20/node_modules/arktype/out/keywords/ts.js
13076
13338
  var arkTsKeywords = Scope.module({
13077
13339
  bigint: intrinsic.bigint,
13078
13340
  boolean: intrinsic.boolean,
@@ -13160,7 +13422,7 @@ var arkTsGenerics = Scope.module({
13160
13422
  Required: Required2
13161
13423
  });
13162
13424
 
13163
- // ../../node_modules/.pnpm/arktype@2.1.19/node_modules/arktype/out/keywords/keywords.js
13425
+ // ../../node_modules/.pnpm/arktype@2.1.20/node_modules/arktype/out/keywords/keywords.js
13164
13426
  var ark = scope2({
13165
13427
  ...arkTsKeywords,
13166
13428
  ...arkTsGenerics,
@@ -13217,12 +13479,14 @@ var env2 = createEnv({
13217
13479
  RUN_WORKERS_FROM_SOURCE: maybeBool.pipe((s) => s === `true`),
13218
13480
  FRONTEND_PORT: str.pipe((s) => Number.parseInt(s, 10)),
13219
13481
  FRONTEND_ORIGINS: str.pipe.try((s) => JSON.parse(s), type(`string[]`)),
13220
- OPENAI_API_KEY: type(`string | undefined`)
13482
+ API_KEY_OPENAI: type(`string | undefined`),
13483
+ API_KEY_RESEND: type(`string | undefined`)
13221
13484
  },
13222
13485
  clientPrefix: `VITE_`,
13223
13486
  client: {
13224
13487
  VITE_BACKEND_ORIGIN: str,
13225
- VITE_USE_SELF_SIGNED_CERTIFICATE: maybeBool.pipe((s) => s === `true`)
13488
+ VITE_DEV_FRONTEND_HOST: type(`string | undefined`),
13489
+ VITE_DEV_HTTPS: maybeBool.pipe((s) => s === `true`)
13226
13490
  },
13227
13491
  runtimeEnv: import.meta.env,
13228
13492
  emptyStringAsUndefined: true