@neocompose/cli 0.76.2 → 0.76.3

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.
@@ -879,6 +879,351 @@ var require_ignore = __commonJS({
879
879
  // src/test-worker.ts
880
880
  import { parentPort } from "node:worker_threads";
881
881
 
882
+ // ../node_modules/uuid/dist-node/regex.js
883
+ var regex_default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
884
+
885
+ // ../node_modules/uuid/dist-node/validate.js
886
+ function validate(uuid) {
887
+ return typeof uuid === "string" && regex_default.test(uuid);
888
+ }
889
+ var validate_default = validate;
890
+
891
+ // ../node_modules/uuid/dist-node/parse.js
892
+ function parse(uuid) {
893
+ if (!validate_default(uuid)) {
894
+ throw TypeError("Invalid UUID");
895
+ }
896
+ let v;
897
+ return Uint8Array.of((v = parseInt(uuid.slice(0, 8), 16)) >>> 24, v >>> 16 & 255, v >>> 8 & 255, v & 255, (v = parseInt(uuid.slice(9, 13), 16)) >>> 8, v & 255, (v = parseInt(uuid.slice(14, 18), 16)) >>> 8, v & 255, (v = parseInt(uuid.slice(19, 23), 16)) >>> 8, v & 255, (v = parseInt(uuid.slice(24, 36), 16)) / 1099511627776 & 255, v / 4294967296 & 255, v >>> 24 & 255, v >>> 16 & 255, v >>> 8 & 255, v & 255);
898
+ }
899
+ var parse_default = parse;
900
+
901
+ // ../node_modules/uuid/dist-node/stringify.js
902
+ var byteToHex = [];
903
+ for (let i = 0; i < 256; ++i) {
904
+ byteToHex.push((i + 256).toString(16).slice(1));
905
+ }
906
+ function unsafeStringify(arr, offset = 0) {
907
+ return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
908
+ }
909
+
910
+ // ../node_modules/uuid/dist-node/rng.js
911
+ var rnds8 = new Uint8Array(16);
912
+ function rng() {
913
+ return crypto.getRandomValues(rnds8);
914
+ }
915
+
916
+ // ../node_modules/uuid/dist-node/v35.js
917
+ function stringToBytes(str) {
918
+ str = unescape(encodeURIComponent(str));
919
+ const bytes = new Uint8Array(str.length);
920
+ for (let i = 0; i < str.length; ++i) {
921
+ bytes[i] = str.charCodeAt(i);
922
+ }
923
+ return bytes;
924
+ }
925
+ var DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8";
926
+ var URL2 = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
927
+ function v35(version, hash, value, namespace, buf, offset) {
928
+ const valueBytes = typeof value === "string" ? stringToBytes(value) : value;
929
+ const namespaceBytes = typeof namespace === "string" ? parse_default(namespace) : namespace;
930
+ if (typeof namespace === "string") {
931
+ namespace = parse_default(namespace);
932
+ }
933
+ if (namespace?.length !== 16) {
934
+ throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
935
+ }
936
+ let bytes = new Uint8Array(16 + valueBytes.length);
937
+ bytes.set(namespaceBytes);
938
+ bytes.set(valueBytes, namespaceBytes.length);
939
+ bytes = hash(bytes);
940
+ bytes[6] = bytes[6] & 15 | version;
941
+ bytes[8] = bytes[8] & 63 | 128;
942
+ if (buf) {
943
+ offset ??= 0;
944
+ if (offset < 0 || offset + 16 > buf.length) {
945
+ throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
946
+ }
947
+ for (let i = 0; i < 16; ++i) {
948
+ buf[offset + i] = bytes[i];
949
+ }
950
+ return buf;
951
+ }
952
+ return unsafeStringify(bytes);
953
+ }
954
+
955
+ // ../node_modules/uuid/dist-node/v4.js
956
+ function v4(options, buf, offset) {
957
+ if (!buf && !options && crypto.randomUUID) {
958
+ return crypto.randomUUID();
959
+ }
960
+ return _v4(options, buf, offset);
961
+ }
962
+ function _v4(options, buf, offset) {
963
+ options = options || {};
964
+ const rnds = options.random ?? options.rng?.() ?? rng();
965
+ if (rnds.length < 16) {
966
+ throw new Error("Random bytes length must be >= 16");
967
+ }
968
+ rnds[6] = rnds[6] & 15 | 64;
969
+ rnds[8] = rnds[8] & 63 | 128;
970
+ if (buf) {
971
+ offset = offset || 0;
972
+ if (offset < 0 || offset + 16 > buf.length) {
973
+ throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
974
+ }
975
+ for (let i = 0; i < 16; ++i) {
976
+ buf[offset + i] = rnds[i];
977
+ }
978
+ return buf;
979
+ }
980
+ return unsafeStringify(rnds);
981
+ }
982
+ var v4_default = v4;
983
+
984
+ // ../node_modules/uuid/dist-node/sha1.js
985
+ import { createHash } from "node:crypto";
986
+ function sha1(bytes) {
987
+ if (Array.isArray(bytes)) {
988
+ bytes = Buffer.from(bytes);
989
+ } else if (typeof bytes === "string") {
990
+ bytes = Buffer.from(bytes, "utf8");
991
+ }
992
+ return createHash("sha1").update(bytes).digest();
993
+ }
994
+ var sha1_default = sha1;
995
+
996
+ // ../node_modules/uuid/dist-node/v5.js
997
+ function v5(value, namespace, buf, offset) {
998
+ return v35(80, sha1_default, value, namespace, buf, offset);
999
+ }
1000
+ v5.DNS = DNS;
1001
+ v5.URL = URL2;
1002
+ var v5_default = v5;
1003
+
1004
+ // ../packages/models/src/core/world-system-kinds.generated.ts
1005
+ var NeoWorldSystemClassKind = {
1006
+ CellPattern: "cellPattern",
1007
+ TileGrid: "tileGrid",
1008
+ SortingLayer: "sortingLayer",
1009
+ TileLayer: "tileLayer",
1010
+ ObjectLayer: "objectLayer",
1011
+ Tile: "tile",
1012
+ ObjectBase: "objectBase",
1013
+ ObjectCollider: "objectCollider",
1014
+ SortingGroup: "sortingGroup",
1015
+ LayerGroupBase: "layerGroupBase",
1016
+ SpriteObject: "spriteObject",
1017
+ PlacementTile: "placementTile",
1018
+ TileLayerLink: "tileLayerLink",
1019
+ ObjectLayerLink: "objectLayerLink",
1020
+ Object: "object",
1021
+ SmartTile: "smartTile",
1022
+ SmartTileRule: "smartTileRule",
1023
+ SmartTileNeighbor: "smartTileNeighbor",
1024
+ AnimationFrameBase: "animationFrameBase",
1025
+ AnimationClip: "animationClip",
1026
+ AnimationFrame: "animationFrame",
1027
+ AnimationSegmentFrame: "animationSegmentFrame",
1028
+ AnimationSegment: "animationSegment",
1029
+ SpriteAnimationSegment: "spriteAnimationSegment",
1030
+ AnimationChildOverride: "animationChildOverride",
1031
+ AnimationTrack: "animationTrack",
1032
+ AnimationChildTrack: "animationChildTrack",
1033
+ AnimationSegmentTrack: "animationSegmentTrack",
1034
+ SpriteAnimationSegmentTrack: "spriteAnimationSegmentTrack",
1035
+ Variant: "variant",
1036
+ VariantFolder: "variantFolder",
1037
+ LookupVariant: "lookupVariant",
1038
+ LookupVariantFolder: "lookupVariantFolder"
1039
+ };
1040
+ var NEO_WORLD_SYSTEM_CLASS_KIND_VALUES = new Set(
1041
+ Object.values(NeoWorldSystemClassKind)
1042
+ );
1043
+ function isNeoWorldSystemClassKind(value) {
1044
+ if (typeof value !== "string") return false;
1045
+ return NEO_WORLD_SYSTEM_CLASS_KIND_VALUES.has(value);
1046
+ }
1047
+
1048
+ // ../packages/models/src/core/core-types.ts
1049
+ var SystemDisallowedOperation = {
1050
+ /**
1051
+ * Blocks project-author edits to the record's schema/configuration.
1052
+ */
1053
+ EditRecord: "editRecord",
1054
+ /**
1055
+ * Blocks project-author deletion of the record.
1056
+ */
1057
+ DeleteRecord: "deleteRecord",
1058
+ /**
1059
+ * Removes the record from normal creation/selection affordances.
1060
+ */
1061
+ SelectRecord: "selectRecord",
1062
+ /**
1063
+ * Blocks replacing the value row attached to a member as a whole.
1064
+ */
1065
+ ReplaceValue: "replaceValue"
1066
+ };
1067
+ var SystemProtectionKind = {
1068
+ WorldAuthoring: "worldAuthoring",
1069
+ DialogueMemorySchema: "dialogueMemorySchema",
1070
+ DialogueMemoryContainer: "dialogueMemoryContainer",
1071
+ DialoguePriorityDefault: "dialoguePriorityDefault",
1072
+ PolicyImmutable: "policyImmutable",
1073
+ PolicyDeleteBlocked: "policyDeleteBlocked",
1074
+ ScriptRuntime: "scriptRuntime"
1075
+ };
1076
+ function isWithId(value) {
1077
+ return typeof value?.id === "string";
1078
+ }
1079
+ function isIWithTimestamps(value) {
1080
+ const v = value;
1081
+ if (v === null || v === void 0) {
1082
+ return false;
1083
+ }
1084
+ return isEpochMillis(v.createdAt) && isEpochMillis(v.updatedAt);
1085
+ }
1086
+ function isEpochMillis(value) {
1087
+ if (typeof value !== "number") return false;
1088
+ return Number.isFinite(value);
1089
+ }
1090
+ function isSystemProtectionKind(value) {
1091
+ return value === SystemProtectionKind.WorldAuthoring || value === SystemProtectionKind.DialogueMemorySchema || value === SystemProtectionKind.DialogueMemoryContainer || value === SystemProtectionKind.DialoguePriorityDefault || value === SystemProtectionKind.PolicyImmutable || value === SystemProtectionKind.PolicyDeleteBlocked || value === SystemProtectionKind.ScriptRuntime;
1092
+ }
1093
+ function isSystemMetadata(value) {
1094
+ const v = value;
1095
+ if (typeof v !== "object") return false;
1096
+ if (v === null) return false;
1097
+ if (!isSystemProtectionKind(v.kind)) return false;
1098
+ if (v.worldKind !== void 0 && v.worldKind !== null) {
1099
+ return isNeoWorldSystemClassKind(v.worldKind);
1100
+ }
1101
+ return true;
1102
+ }
1103
+ function isWithName(value) {
1104
+ return typeof value?.name === "string";
1105
+ }
1106
+
1107
+ // ../packages/models/src/core/auth-ownership-types.ts
1108
+ var ActorKind = {
1109
+ /**
1110
+ * `better-auth` user identities.
1111
+ */
1112
+ user: "user",
1113
+ /**
1114
+ * `better-auth` organization identities.
1115
+ */
1116
+ organization: "organization",
1117
+ /**
1118
+ * Used for denoting records created by a system.
1119
+ */
1120
+ system: "system"
1121
+ };
1122
+ function isActorIdentifier(value) {
1123
+ if (typeof value !== "object") return false;
1124
+ if (value === null) return false;
1125
+ const candidate = value;
1126
+ if (!isActorKind(candidate.kind)) return false;
1127
+ return typeof candidate.id === "string" && candidate.id.trim().length > 0;
1128
+ }
1129
+ function isActorKind(value) {
1130
+ return value === ActorKind.user || value === ActorKind.organization || value === ActorKind.system;
1131
+ }
1132
+
1133
+ // ../packages/models/src/core/structural-narrow.ts
1134
+ function isObject(value) {
1135
+ if (typeof value !== "object") return false;
1136
+ return value !== null;
1137
+ }
1138
+ function hasField(value, field) {
1139
+ if (!isObject(value)) return false;
1140
+ return field in value;
1141
+ }
1142
+ function getOptionalString(value, field) {
1143
+ if (!hasField(value, field)) return void 0;
1144
+ const v = value[field];
1145
+ if (typeof v !== "string") return void 0;
1146
+ return v;
1147
+ }
1148
+ function getField(value, field) {
1149
+ if (!hasField(value, field)) return void 0;
1150
+ return value[field];
1151
+ }
1152
+ function isOptionalNullableType(value, isType) {
1153
+ if (value === null || value === void 0) return true;
1154
+ return isType(value);
1155
+ }
1156
+ function isNullableType(value, isType) {
1157
+ if (value === null) return true;
1158
+ return isType(value);
1159
+ }
1160
+ function isRequiredType(value, isType) {
1161
+ if (value === null || value === void 0) return false;
1162
+ return isType(value);
1163
+ }
1164
+ function isString(value) {
1165
+ return typeof value === "string";
1166
+ }
1167
+ function isNumber(value) {
1168
+ return typeof value === "number";
1169
+ }
1170
+ function isFiniteNumberGreaterThanOrEqualToZero(value) {
1171
+ if (!isNumber(value)) return false;
1172
+ if (!Number.isFinite(value)) return false;
1173
+ return value >= 0;
1174
+ }
1175
+ function isBoolean(value) {
1176
+ return typeof value === "boolean";
1177
+ }
1178
+ function isOptionalNullableString(value) {
1179
+ return isOptionalNullableType(value, isString);
1180
+ }
1181
+ function isNullableFiniteNumberGreaterThanOrEqualToZero(value) {
1182
+ return isNullableType(value, isFiniteNumberGreaterThanOrEqualToZero);
1183
+ }
1184
+ function setOwnField(record4, key, value) {
1185
+ Object.defineProperty(record4, key, {
1186
+ value,
1187
+ enumerable: true,
1188
+ configurable: true,
1189
+ writable: true
1190
+ });
1191
+ }
1192
+
1193
+ // ../packages/models/src/common/collections.ts
1194
+ function indexById(records2) {
1195
+ const indexed = /* @__PURE__ */ new Map();
1196
+ for (const record4 of records2) indexed.set(record4.id, record4);
1197
+ return indexed;
1198
+ }
1199
+ function setsEqual(left, right) {
1200
+ if (left === right) return true;
1201
+ if (left.size !== right.size) return false;
1202
+ for (const value of left) {
1203
+ if (!right.has(value)) return false;
1204
+ }
1205
+ return true;
1206
+ }
1207
+ async function forEachConcurrently(items, limit, work) {
1208
+ const queue = items[Symbol.iterator]();
1209
+ await Promise.all(
1210
+ Array.from({ length: limit }, async () => {
1211
+ for (let next = queue.next(); next.done !== true; next = queue.next()) {
1212
+ await work(next.value);
1213
+ }
1214
+ })
1215
+ );
1216
+ }
1217
+
1218
+ // ../packages/models/src/docs-text.ts
1219
+ var DOCS_TEXT_MAX_UTF8_BYTES = 16384;
1220
+ var textEncoder = new TextEncoder();
1221
+ function isValidDocsText(value) {
1222
+ if (value === void 0) return true;
1223
+ if (typeof value !== "string") return false;
1224
+ return textEncoder.encode(value).byteLength <= DOCS_TEXT_MAX_UTF8_BYTES;
1225
+ }
1226
+
882
1227
  // ../packages/models/src/members/member-storage.ts
883
1228
  function isMemberStorageKind(value) {
884
1229
  return value === 0 /* Inherit */ || value === 1 /* Immutable */ || value === 2 /* Save */ || value === 3 /* Session */ || value === 4 /* Writable */ || value === 5 /* User */;
@@ -923,6 +1268,198 @@ function createWritableAncestorLookup(memberById) {
923
1268
  return lookup;
924
1269
  }
925
1270
 
1271
+ // ../packages/models/src/classes/classes.ts
1272
+ function isAbstractClass(value) {
1273
+ return value?.modifier === 1 /* Abstract */;
1274
+ }
1275
+ function isGenericParamConstraint(value) {
1276
+ const v = value;
1277
+ if (!v || typeof v !== "object") return false;
1278
+ if (v.kind === void 0 || v.kind === 0 /* Class */) {
1279
+ if (typeof v.classId !== "string") return false;
1280
+ if (v.classId.length === 0) return false;
1281
+ if (v.enumId !== void 0) return false;
1282
+ const argumentsValue = v.classArguments;
1283
+ return argumentsValue === void 0 || isGenericBindingsRecord(argumentsValue);
1284
+ }
1285
+ if (v.kind === 1 /* Enum */) {
1286
+ if (typeof v.enumId !== "string") return false;
1287
+ if (v.enumId.length === 0) return false;
1288
+ return v.classId === void 0;
1289
+ }
1290
+ return false;
1291
+ }
1292
+ function isClassGenericConstraint(value) {
1293
+ return value.kind === void 0 || value.kind === 0 /* Class */;
1294
+ }
1295
+ function isEnumGenericConstraint(value) {
1296
+ return value.kind === 1 /* Enum */;
1297
+ }
1298
+ function isGenericParamDeclaration(value) {
1299
+ const v = value;
1300
+ if (!v || typeof v !== "object") return false;
1301
+ if (typeof v.id !== "string") return false;
1302
+ if (v.id.length === 0) return false;
1303
+ if (typeof v.name !== "string") return false;
1304
+ if (v.name.length === 0) return false;
1305
+ if (v.constraint === void 0) return true;
1306
+ return isGenericParamConstraint(v.constraint);
1307
+ }
1308
+ function isGenericBinding(value) {
1309
+ const v = value;
1310
+ if (!v || typeof v !== "object") return false;
1311
+ if (Object.hasOwn(v, "defaultValue")) return false;
1312
+ if (v.kind === void 0 || v.kind === 0 /* Generic */) {
1313
+ if (typeof v.genericParamId !== "string") return false;
1314
+ if (v.genericParamId.length === 0) return false;
1315
+ return v.memberId === void 0;
1316
+ }
1317
+ if (v.kind === 1 /* Member */) {
1318
+ if (typeof v.memberId !== "string") return false;
1319
+ if (v.memberId.length === 0) return false;
1320
+ return v.genericParamId === void 0;
1321
+ }
1322
+ return false;
1323
+ }
1324
+ function isForwardedGenericBinding(value) {
1325
+ return value.kind === void 0 || value.kind === 0 /* Generic */;
1326
+ }
1327
+ function isMemberGenericBinding(value) {
1328
+ return value.kind === 1 /* Member */;
1329
+ }
1330
+ function isGenericBindingsRecord(value) {
1331
+ if (value === null) return false;
1332
+ if (typeof value !== "object") return false;
1333
+ if (Array.isArray(value)) return false;
1334
+ return Object.values(value).every(isGenericBinding);
1335
+ }
1336
+ var RETIRED_CONSTRUCTOR_PROJECTIONS_FIELD = "constructorProjections";
1337
+ function hasRetiredConstructorProjectionsTombstone(value) {
1338
+ return value !== null && typeof value === "object" && Object.hasOwn(value, RETIRED_CONSTRUCTOR_PROJECTIONS_FIELD);
1339
+ }
1340
+ function isNeoSchemaClassBase(value) {
1341
+ if (hasRetiredConstructorProjectionsTombstone(value)) {
1342
+ return false;
1343
+ }
1344
+ const v = value;
1345
+ return typeof v?.name === "string" && isValidDocsText(v.docsText) && isClassSchema(v?.schema) && isOptionalSchemaKeyOrder(v?.schemaKeyOrder) && (v.implementsInterfaceIds === void 0 || Array.isArray(v.implementsInterfaceIds) && v.implementsInterfaceIds.every(
1346
+ (interfaceId) => typeof interfaceId === "string" && interfaceId.length > 0
1347
+ )) && (v.uiVisibility === void 0 || v.uiVisibility === 0 /* Visible */ || v.uiVisibility === 1 /* Hidden */) && (v.modifier === void 0 || v.modifier === 0 /* Open */ || v.modifier === 1 /* Abstract */ || v.modifier === 2 /* Sealed */) && (v.allowedStorage === void 0 || isClassAllowedStorage(v.allowedStorage)) && (v.allowedStorageKeys === void 0 || Array.isArray(v.allowedStorageKeys) && v.allowedStorageKeys.every((key) => typeof key === "string")) && (v.genericParams === void 0 || Array.isArray(v.genericParams) && v.genericParams.every(isGenericParamDeclaration)) && (v.extendsGenericBindings === void 0 || isGenericBindingsRecord(v.extendsGenericBindings)) && (v.constructorIds === void 0 || Array.isArray(v.constructorIds) && v.constructorIds.every(
1348
+ (constructorId) => typeof constructorId === "string" && constructorId.length > 0
1349
+ ) && new Set(v.constructorIds).size === v.constructorIds.length) && (v.requiredConstructorId === void 0 || typeof v.requiredConstructorId === "string" && v.requiredConstructorId.length > 0 && (v.constructorIds ?? []).length === 0) && (v.targetMemberId === void 0 || typeof v.targetMemberId === "string" && v.targetMemberId.length > 0) && (v.system === void 0 || isSystemMetadata(v.system));
1350
+ }
1351
+ function resolveAllowedStorage(classId, classes, draft) {
1352
+ const visited = /* @__PURE__ */ new Set();
1353
+ const lookup = (id) => draft && draft.id === id ? draft : classes.find((candidate) => candidate.id === id);
1354
+ let current = lookup(classId);
1355
+ while (current) {
1356
+ if (visited.has(current.id)) return null;
1357
+ visited.add(current.id);
1358
+ if (current.allowedStorage != null) return current.allowedStorage;
1359
+ if (!current.extendsClassId) return null;
1360
+ current = lookup(current.extendsClassId);
1361
+ }
1362
+ return null;
1363
+ }
1364
+ function classInheritsWorldKind(classId, expectedKind, classesById) {
1365
+ let current = classesById.get(classId);
1366
+ for (let remaining = classesById.size; current !== void 0 && remaining > 0; remaining--) {
1367
+ if (current.system?.worldKind === expectedKind) return true;
1368
+ current = current.extendsClassId ? classesById.get(current.extendsClassId) : void 0;
1369
+ }
1370
+ return false;
1371
+ }
1372
+ function resolveWorldSystemClassKind(classId, classes, draft) {
1373
+ const visited = /* @__PURE__ */ new Set();
1374
+ const lookup = (id) => draft && draft.id === id ? draft : classes.find((candidate) => candidate.id === id);
1375
+ let current = lookup(classId);
1376
+ while (current) {
1377
+ if (visited.has(current.id)) return null;
1378
+ visited.add(current.id);
1379
+ if (current.system?.worldKind != null) return current.system.worldKind;
1380
+ if (!current.extendsClassId) return null;
1381
+ current = lookup(current.extendsClassId);
1382
+ }
1383
+ return null;
1384
+ }
1385
+ function indexWorldSystemClassKinds(classes, classesById = indexById(classes)) {
1386
+ const kinds = /* @__PURE__ */ new Map();
1387
+ for (const schemaClass2 of classes) {
1388
+ if (schemaClass2.system?.worldKind != null) {
1389
+ kinds.set(schemaClass2.id, schemaClass2.system.worldKind);
1390
+ } else if (schemaClass2.extendsClassId === void 0) {
1391
+ kinds.set(schemaClass2.id, null);
1392
+ }
1393
+ }
1394
+ const resolving = /* @__PURE__ */ new Set();
1395
+ for (const schemaClass2 of classes) {
1396
+ if (kinds.has(schemaClass2.id)) continue;
1397
+ const path = [];
1398
+ let current = schemaClass2;
1399
+ let resolved = null;
1400
+ while (current !== void 0) {
1401
+ if (kinds.has(current.id)) {
1402
+ resolved = kinds.get(current.id) ?? null;
1403
+ break;
1404
+ }
1405
+ if (resolving.has(current.id)) {
1406
+ resolved = null;
1407
+ break;
1408
+ }
1409
+ resolving.add(current.id);
1410
+ path.push(current);
1411
+ current = current.extendsClassId === void 0 ? void 0 : classesById.get(current.extendsClassId);
1412
+ }
1413
+ for (const candidate of path) {
1414
+ resolving.delete(candidate.id);
1415
+ kinds.set(candidate.id, resolved);
1416
+ }
1417
+ }
1418
+ return kinds;
1419
+ }
1420
+ function dedupeSchemaKeyOrder(order) {
1421
+ const seen = /* @__PURE__ */ new Set();
1422
+ const result = [];
1423
+ for (const schemaKey of order) {
1424
+ if (seen.has(schemaKey)) continue;
1425
+ seen.add(schemaKey);
1426
+ result.push(schemaKey);
1427
+ }
1428
+ return result;
1429
+ }
1430
+ function getClassSchemaKeyOrder(schemaClass2) {
1431
+ const schemaKeys = Object.keys(schemaClass2.schema);
1432
+ if (schemaClass2.schemaKeyOrder === void 0) return schemaKeys;
1433
+ const orderedKeys2 = dedupeSchemaKeyOrder(schemaClass2.schemaKeyOrder);
1434
+ const seen = new Set(orderedKeys2);
1435
+ for (const schemaKey of schemaKeys) {
1436
+ if (seen.has(schemaKey)) continue;
1437
+ seen.add(schemaKey);
1438
+ orderedKeys2.push(schemaKey);
1439
+ }
1440
+ return orderedKeys2;
1441
+ }
1442
+ function isClassSchema(value) {
1443
+ if (value === null) return false;
1444
+ if (typeof value !== "object") return false;
1445
+ if (Array.isArray(value)) return false;
1446
+ return Object.values(value).every(
1447
+ (schemaValue) => typeof schemaValue === "string"
1448
+ );
1449
+ }
1450
+ function isOptionalSchemaKeyOrder(value) {
1451
+ if (value === void 0) return true;
1452
+ if (!Array.isArray(value)) return false;
1453
+ return value.every((key) => typeof key === "string");
1454
+ }
1455
+ function isNeoSchemaClassProps(value) {
1456
+ const v = value;
1457
+ return isNeoSchemaClassBase(value) && typeof v?.id === "string" && isEpochMillis(v?.createdAt) && isEpochMillis(v?.updatedAt) && typeof v?.projectId === "string";
1458
+ }
1459
+ function isNeoSchemaClass(value) {
1460
+ return isNeoSchemaClassProps(value);
1461
+ }
1462
+
926
1463
  // ../packages/models/src/members/member-kind-enum.ts
927
1464
  var MemberKind = /* @__PURE__ */ ((MemberKind8) => {
928
1465
  MemberKind8[MemberKind8["Null"] = 0] = "Null";
@@ -1125,128 +1662,6 @@ function memberKindSupportsDistribution(kind) {
1125
1662
  return memberKindSupportsStorage(kind);
1126
1663
  }
1127
1664
 
1128
- // ../node_modules/uuid/dist-node/regex.js
1129
- var regex_default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
1130
-
1131
- // ../node_modules/uuid/dist-node/validate.js
1132
- function validate(uuid) {
1133
- return typeof uuid === "string" && regex_default.test(uuid);
1134
- }
1135
- var validate_default = validate;
1136
-
1137
- // ../node_modules/uuid/dist-node/parse.js
1138
- function parse(uuid) {
1139
- if (!validate_default(uuid)) {
1140
- throw TypeError("Invalid UUID");
1141
- }
1142
- let v;
1143
- return Uint8Array.of((v = parseInt(uuid.slice(0, 8), 16)) >>> 24, v >>> 16 & 255, v >>> 8 & 255, v & 255, (v = parseInt(uuid.slice(9, 13), 16)) >>> 8, v & 255, (v = parseInt(uuid.slice(14, 18), 16)) >>> 8, v & 255, (v = parseInt(uuid.slice(19, 23), 16)) >>> 8, v & 255, (v = parseInt(uuid.slice(24, 36), 16)) / 1099511627776 & 255, v / 4294967296 & 255, v >>> 24 & 255, v >>> 16 & 255, v >>> 8 & 255, v & 255);
1144
- }
1145
- var parse_default = parse;
1146
-
1147
- // ../node_modules/uuid/dist-node/stringify.js
1148
- var byteToHex = [];
1149
- for (let i = 0; i < 256; ++i) {
1150
- byteToHex.push((i + 256).toString(16).slice(1));
1151
- }
1152
- function unsafeStringify(arr, offset = 0) {
1153
- return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
1154
- }
1155
-
1156
- // ../node_modules/uuid/dist-node/rng.js
1157
- var rnds8 = new Uint8Array(16);
1158
- function rng() {
1159
- return crypto.getRandomValues(rnds8);
1160
- }
1161
-
1162
- // ../node_modules/uuid/dist-node/v35.js
1163
- function stringToBytes(str) {
1164
- str = unescape(encodeURIComponent(str));
1165
- const bytes = new Uint8Array(str.length);
1166
- for (let i = 0; i < str.length; ++i) {
1167
- bytes[i] = str.charCodeAt(i);
1168
- }
1169
- return bytes;
1170
- }
1171
- var DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8";
1172
- var URL2 = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
1173
- function v35(version, hash, value, namespace, buf, offset) {
1174
- const valueBytes = typeof value === "string" ? stringToBytes(value) : value;
1175
- const namespaceBytes = typeof namespace === "string" ? parse_default(namespace) : namespace;
1176
- if (typeof namespace === "string") {
1177
- namespace = parse_default(namespace);
1178
- }
1179
- if (namespace?.length !== 16) {
1180
- throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
1181
- }
1182
- let bytes = new Uint8Array(16 + valueBytes.length);
1183
- bytes.set(namespaceBytes);
1184
- bytes.set(valueBytes, namespaceBytes.length);
1185
- bytes = hash(bytes);
1186
- bytes[6] = bytes[6] & 15 | version;
1187
- bytes[8] = bytes[8] & 63 | 128;
1188
- if (buf) {
1189
- offset ??= 0;
1190
- if (offset < 0 || offset + 16 > buf.length) {
1191
- throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
1192
- }
1193
- for (let i = 0; i < 16; ++i) {
1194
- buf[offset + i] = bytes[i];
1195
- }
1196
- return buf;
1197
- }
1198
- return unsafeStringify(bytes);
1199
- }
1200
-
1201
- // ../node_modules/uuid/dist-node/v4.js
1202
- function v4(options, buf, offset) {
1203
- if (!buf && !options && crypto.randomUUID) {
1204
- return crypto.randomUUID();
1205
- }
1206
- return _v4(options, buf, offset);
1207
- }
1208
- function _v4(options, buf, offset) {
1209
- options = options || {};
1210
- const rnds = options.random ?? options.rng?.() ?? rng();
1211
- if (rnds.length < 16) {
1212
- throw new Error("Random bytes length must be >= 16");
1213
- }
1214
- rnds[6] = rnds[6] & 15 | 64;
1215
- rnds[8] = rnds[8] & 63 | 128;
1216
- if (buf) {
1217
- offset = offset || 0;
1218
- if (offset < 0 || offset + 16 > buf.length) {
1219
- throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
1220
- }
1221
- for (let i = 0; i < 16; ++i) {
1222
- buf[offset + i] = rnds[i];
1223
- }
1224
- return buf;
1225
- }
1226
- return unsafeStringify(rnds);
1227
- }
1228
- var v4_default = v4;
1229
-
1230
- // ../node_modules/uuid/dist-node/sha1.js
1231
- import { createHash } from "node:crypto";
1232
- function sha1(bytes) {
1233
- if (Array.isArray(bytes)) {
1234
- bytes = Buffer.from(bytes);
1235
- } else if (typeof bytes === "string") {
1236
- bytes = Buffer.from(bytes, "utf8");
1237
- }
1238
- return createHash("sha1").update(bytes).digest();
1239
- }
1240
- var sha1_default = sha1;
1241
-
1242
- // ../node_modules/uuid/dist-node/v5.js
1243
- function v5(value, namespace, buf, offset) {
1244
- return v35(80, sha1_default, value, namespace, buf, offset);
1245
- }
1246
- v5.DNS = DNS;
1247
- v5.URL = URL2;
1248
- var v5_default = v5;
1249
-
1250
1665
  // ../packages/models/src/project/project-root-members.ts
1251
1666
  var PROJECT_ROOTS = [
1252
1667
  {
@@ -1295,178 +1710,6 @@ function projectRootMembersInDisplayOrder(project) {
1295
1710
  }));
1296
1711
  }
1297
1712
 
1298
- // ../packages/models/src/core/structural-narrow.ts
1299
- function isObject(value) {
1300
- if (typeof value !== "object") return false;
1301
- return value !== null;
1302
- }
1303
- function hasField(value, field) {
1304
- if (!isObject(value)) return false;
1305
- return field in value;
1306
- }
1307
- function getOptionalString(value, field) {
1308
- if (!hasField(value, field)) return void 0;
1309
- const v = value[field];
1310
- if (typeof v !== "string") return void 0;
1311
- return v;
1312
- }
1313
- function getField(value, field) {
1314
- if (!hasField(value, field)) return void 0;
1315
- return value[field];
1316
- }
1317
- function isOptionalNullableType(value, isType) {
1318
- if (value === null || value === void 0) return true;
1319
- return isType(value);
1320
- }
1321
- function isNullableType(value, isType) {
1322
- if (value === null) return true;
1323
- return isType(value);
1324
- }
1325
- function isRequiredType(value, isType) {
1326
- if (value === null || value === void 0) return false;
1327
- return isType(value);
1328
- }
1329
- function isString(value) {
1330
- return typeof value === "string";
1331
- }
1332
- function isNumber(value) {
1333
- return typeof value === "number";
1334
- }
1335
- function isFiniteNumberGreaterThanOrEqualToZero(value) {
1336
- if (!isNumber(value)) return false;
1337
- if (!Number.isFinite(value)) return false;
1338
- return value >= 0;
1339
- }
1340
- function isBoolean(value) {
1341
- return typeof value === "boolean";
1342
- }
1343
- function isOptionalNullableString(value) {
1344
- return isOptionalNullableType(value, isString);
1345
- }
1346
- function isNullableFiniteNumberGreaterThanOrEqualToZero(value) {
1347
- return isNullableType(value, isFiniteNumberGreaterThanOrEqualToZero);
1348
- }
1349
- function setOwnField(record4, key, value) {
1350
- Object.defineProperty(record4, key, {
1351
- value,
1352
- enumerable: true,
1353
- configurable: true,
1354
- writable: true
1355
- });
1356
- }
1357
-
1358
- // ../packages/models/src/core/world-system-kinds.generated.ts
1359
- var NeoWorldSystemClassKind = {
1360
- CellPattern: "cellPattern",
1361
- TileGrid: "tileGrid",
1362
- SortingLayer: "sortingLayer",
1363
- TileLayer: "tileLayer",
1364
- ObjectLayer: "objectLayer",
1365
- Tile: "tile",
1366
- ObjectBase: "objectBase",
1367
- ObjectCollider: "objectCollider",
1368
- SortingGroup: "sortingGroup",
1369
- LayerGroupBase: "layerGroupBase",
1370
- SpriteObject: "spriteObject",
1371
- PlacementTile: "placementTile",
1372
- TileLayerLink: "tileLayerLink",
1373
- ObjectLayerLink: "objectLayerLink",
1374
- Object: "object",
1375
- SmartTile: "smartTile",
1376
- SmartTileRule: "smartTileRule",
1377
- SmartTileNeighbor: "smartTileNeighbor",
1378
- AnimationFrameBase: "animationFrameBase",
1379
- AnimationClip: "animationClip",
1380
- AnimationFrame: "animationFrame",
1381
- AnimationSegmentFrame: "animationSegmentFrame",
1382
- AnimationSegment: "animationSegment",
1383
- SpriteAnimationSegment: "spriteAnimationSegment",
1384
- AnimationChildOverride: "animationChildOverride",
1385
- AnimationTrack: "animationTrack",
1386
- AnimationChildTrack: "animationChildTrack",
1387
- AnimationSegmentTrack: "animationSegmentTrack",
1388
- SpriteAnimationSegmentTrack: "spriteAnimationSegmentTrack",
1389
- Variant: "variant",
1390
- VariantFolder: "variantFolder",
1391
- LookupVariant: "lookupVariant",
1392
- LookupVariantFolder: "lookupVariantFolder"
1393
- };
1394
- var NEO_WORLD_SYSTEM_CLASS_KIND_VALUES = new Set(
1395
- Object.values(NeoWorldSystemClassKind)
1396
- );
1397
- function isNeoWorldSystemClassKind(value) {
1398
- if (typeof value !== "string") return false;
1399
- return NEO_WORLD_SYSTEM_CLASS_KIND_VALUES.has(value);
1400
- }
1401
-
1402
- // ../packages/models/src/core/core-types.ts
1403
- var SystemDisallowedOperation = {
1404
- /**
1405
- * Blocks project-author edits to the record's schema/configuration.
1406
- */
1407
- EditRecord: "editRecord",
1408
- /**
1409
- * Blocks project-author deletion of the record.
1410
- */
1411
- DeleteRecord: "deleteRecord",
1412
- /**
1413
- * Removes the record from normal creation/selection affordances.
1414
- */
1415
- SelectRecord: "selectRecord",
1416
- /**
1417
- * Blocks replacing the value row attached to a member as a whole.
1418
- */
1419
- ReplaceValue: "replaceValue"
1420
- };
1421
- var SystemProtectionKind = {
1422
- WorldAuthoring: "worldAuthoring",
1423
- DialogueMemorySchema: "dialogueMemorySchema",
1424
- DialogueMemoryContainer: "dialogueMemoryContainer",
1425
- DialoguePriorityDefault: "dialoguePriorityDefault",
1426
- PolicyImmutable: "policyImmutable",
1427
- PolicyDeleteBlocked: "policyDeleteBlocked",
1428
- ScriptRuntime: "scriptRuntime"
1429
- };
1430
- function isWithId(value) {
1431
- return typeof value?.id === "string";
1432
- }
1433
- function isIWithTimestamps(value) {
1434
- const v = value;
1435
- if (v === null || v === void 0) {
1436
- return false;
1437
- }
1438
- return isEpochMillis(v.createdAt) && isEpochMillis(v.updatedAt);
1439
- }
1440
- function isEpochMillis(value) {
1441
- if (typeof value !== "number") return false;
1442
- return Number.isFinite(value);
1443
- }
1444
- function isSystemProtectionKind(value) {
1445
- return value === SystemProtectionKind.WorldAuthoring || value === SystemProtectionKind.DialogueMemorySchema || value === SystemProtectionKind.DialogueMemoryContainer || value === SystemProtectionKind.DialoguePriorityDefault || value === SystemProtectionKind.PolicyImmutable || value === SystemProtectionKind.PolicyDeleteBlocked || value === SystemProtectionKind.ScriptRuntime;
1446
- }
1447
- function isSystemMetadata(value) {
1448
- const v = value;
1449
- if (typeof v !== "object") return false;
1450
- if (v === null) return false;
1451
- if (!isSystemProtectionKind(v.kind)) return false;
1452
- if (v.worldKind !== void 0 && v.worldKind !== null) {
1453
- return isNeoWorldSystemClassKind(v.worldKind);
1454
- }
1455
- return true;
1456
- }
1457
- function isWithName(value) {
1458
- return typeof value?.name === "string";
1459
- }
1460
-
1461
- // ../packages/models/src/docs-text.ts
1462
- var DOCS_TEXT_MAX_UTF8_BYTES = 16384;
1463
- var textEncoder = new TextEncoder();
1464
- function isValidDocsText(value) {
1465
- if (value === void 0) return true;
1466
- if (typeof value !== "string") return false;
1467
- return textEncoder.encode(value).byteLength <= DOCS_TEXT_MAX_UTF8_BYTES;
1468
- }
1469
-
1470
1713
  // ../packages/models/src/members/float32.ts
1471
1714
  function isFloat32(value) {
1472
1715
  return typeof value === "number" && Number.isFinite(value) && Math.fround(value) === value;
@@ -3896,223 +4139,6 @@ function typeInfosInvariantlyEqual(left, right) {
3896
4139
  return true;
3897
4140
  }
3898
4141
 
3899
- // ../packages/models/src/common/collections.ts
3900
- function indexById(records2) {
3901
- const indexed = /* @__PURE__ */ new Map();
3902
- for (const record4 of records2) indexed.set(record4.id, record4);
3903
- return indexed;
3904
- }
3905
- function setsEqual(left, right) {
3906
- if (left === right) return true;
3907
- if (left.size !== right.size) return false;
3908
- for (const value of left) {
3909
- if (!right.has(value)) return false;
3910
- }
3911
- return true;
3912
- }
3913
- async function forEachConcurrently(items, limit, work) {
3914
- const queue = items[Symbol.iterator]();
3915
- await Promise.all(
3916
- Array.from({ length: limit }, async () => {
3917
- for (let next = queue.next(); next.done !== true; next = queue.next()) {
3918
- await work(next.value);
3919
- }
3920
- })
3921
- );
3922
- }
3923
-
3924
- // ../packages/models/src/classes/classes.ts
3925
- function isAbstractClass(value) {
3926
- return value?.modifier === 1 /* Abstract */;
3927
- }
3928
- function isGenericParamConstraint(value) {
3929
- const v = value;
3930
- if (!v || typeof v !== "object") return false;
3931
- if (v.kind === void 0 || v.kind === 0 /* Class */) {
3932
- if (typeof v.classId !== "string") return false;
3933
- if (v.classId.length === 0) return false;
3934
- if (v.enumId !== void 0) return false;
3935
- const argumentsValue = v.classArguments;
3936
- return argumentsValue === void 0 || isGenericBindingsRecord(argumentsValue);
3937
- }
3938
- if (v.kind === 1 /* Enum */) {
3939
- if (typeof v.enumId !== "string") return false;
3940
- if (v.enumId.length === 0) return false;
3941
- return v.classId === void 0;
3942
- }
3943
- return false;
3944
- }
3945
- function isClassGenericConstraint(value) {
3946
- return value.kind === void 0 || value.kind === 0 /* Class */;
3947
- }
3948
- function isEnumGenericConstraint(value) {
3949
- return value.kind === 1 /* Enum */;
3950
- }
3951
- function isGenericParamDeclaration(value) {
3952
- const v = value;
3953
- if (!v || typeof v !== "object") return false;
3954
- if (typeof v.id !== "string") return false;
3955
- if (v.id.length === 0) return false;
3956
- if (typeof v.name !== "string") return false;
3957
- if (v.name.length === 0) return false;
3958
- if (v.constraint === void 0) return true;
3959
- return isGenericParamConstraint(v.constraint);
3960
- }
3961
- function isGenericBinding(value) {
3962
- const v = value;
3963
- if (!v || typeof v !== "object") return false;
3964
- if (Object.hasOwn(v, "defaultValue")) return false;
3965
- if (v.kind === void 0 || v.kind === 0 /* Generic */) {
3966
- if (typeof v.genericParamId !== "string") return false;
3967
- if (v.genericParamId.length === 0) return false;
3968
- return v.memberId === void 0;
3969
- }
3970
- if (v.kind === 1 /* Member */) {
3971
- if (typeof v.memberId !== "string") return false;
3972
- if (v.memberId.length === 0) return false;
3973
- return v.genericParamId === void 0;
3974
- }
3975
- return false;
3976
- }
3977
- function isForwardedGenericBinding(value) {
3978
- return value.kind === void 0 || value.kind === 0 /* Generic */;
3979
- }
3980
- function isMemberGenericBinding(value) {
3981
- return value.kind === 1 /* Member */;
3982
- }
3983
- function isGenericBindingsRecord(value) {
3984
- if (value === null) return false;
3985
- if (typeof value !== "object") return false;
3986
- if (Array.isArray(value)) return false;
3987
- return Object.values(value).every(isGenericBinding);
3988
- }
3989
- var RETIRED_CONSTRUCTOR_PROJECTIONS_FIELD = "constructorProjections";
3990
- function hasRetiredConstructorProjectionsTombstone(value) {
3991
- return value !== null && typeof value === "object" && Object.hasOwn(value, RETIRED_CONSTRUCTOR_PROJECTIONS_FIELD);
3992
- }
3993
- function isNeoSchemaClassBase(value) {
3994
- if (hasRetiredConstructorProjectionsTombstone(value)) {
3995
- return false;
3996
- }
3997
- const v = value;
3998
- return typeof v?.name === "string" && isValidDocsText(v.docsText) && isClassSchema(v?.schema) && isOptionalSchemaKeyOrder(v?.schemaKeyOrder) && (v.implementsInterfaceIds === void 0 || Array.isArray(v.implementsInterfaceIds) && v.implementsInterfaceIds.every(
3999
- (interfaceId) => typeof interfaceId === "string" && interfaceId.length > 0
4000
- )) && (v.uiVisibility === void 0 || v.uiVisibility === 0 /* Visible */ || v.uiVisibility === 1 /* Hidden */) && (v.modifier === void 0 || v.modifier === 0 /* Open */ || v.modifier === 1 /* Abstract */ || v.modifier === 2 /* Sealed */) && (v.allowedStorage === void 0 || isClassAllowedStorage(v.allowedStorage)) && (v.allowedStorageKeys === void 0 || Array.isArray(v.allowedStorageKeys) && v.allowedStorageKeys.every((key) => typeof key === "string")) && (v.genericParams === void 0 || Array.isArray(v.genericParams) && v.genericParams.every(isGenericParamDeclaration)) && (v.extendsGenericBindings === void 0 || isGenericBindingsRecord(v.extendsGenericBindings)) && (v.constructorIds === void 0 || Array.isArray(v.constructorIds) && v.constructorIds.every(
4001
- (constructorId) => typeof constructorId === "string" && constructorId.length > 0
4002
- ) && new Set(v.constructorIds).size === v.constructorIds.length) && (v.requiredConstructorId === void 0 || typeof v.requiredConstructorId === "string" && v.requiredConstructorId.length > 0 && (v.constructorIds ?? []).length === 0) && (v.targetMemberId === void 0 || typeof v.targetMemberId === "string" && v.targetMemberId.length > 0) && (v.system === void 0 || isSystemMetadata(v.system));
4003
- }
4004
- function resolveAllowedStorage(classId, classes, draft) {
4005
- const visited = /* @__PURE__ */ new Set();
4006
- const lookup = (id) => draft && draft.id === id ? draft : classes.find((candidate) => candidate.id === id);
4007
- let current = lookup(classId);
4008
- while (current) {
4009
- if (visited.has(current.id)) return null;
4010
- visited.add(current.id);
4011
- if (current.allowedStorage != null) return current.allowedStorage;
4012
- if (!current.extendsClassId) return null;
4013
- current = lookup(current.extendsClassId);
4014
- }
4015
- return null;
4016
- }
4017
- function classInheritsWorldKind(classId, expectedKind, classesById) {
4018
- let current = classesById.get(classId);
4019
- for (let remaining = classesById.size; current !== void 0 && remaining > 0; remaining--) {
4020
- if (current.system?.worldKind === expectedKind) return true;
4021
- current = current.extendsClassId ? classesById.get(current.extendsClassId) : void 0;
4022
- }
4023
- return false;
4024
- }
4025
- function resolveWorldSystemClassKind(classId, classes, draft) {
4026
- const visited = /* @__PURE__ */ new Set();
4027
- const lookup = (id) => draft && draft.id === id ? draft : classes.find((candidate) => candidate.id === id);
4028
- let current = lookup(classId);
4029
- while (current) {
4030
- if (visited.has(current.id)) return null;
4031
- visited.add(current.id);
4032
- if (current.system?.worldKind != null) return current.system.worldKind;
4033
- if (!current.extendsClassId) return null;
4034
- current = lookup(current.extendsClassId);
4035
- }
4036
- return null;
4037
- }
4038
- function indexWorldSystemClassKinds(classes, classesById = indexById(classes)) {
4039
- const kinds = /* @__PURE__ */ new Map();
4040
- for (const schemaClass2 of classes) {
4041
- if (schemaClass2.system?.worldKind != null) {
4042
- kinds.set(schemaClass2.id, schemaClass2.system.worldKind);
4043
- } else if (schemaClass2.extendsClassId === void 0) {
4044
- kinds.set(schemaClass2.id, null);
4045
- }
4046
- }
4047
- const resolving = /* @__PURE__ */ new Set();
4048
- for (const schemaClass2 of classes) {
4049
- if (kinds.has(schemaClass2.id)) continue;
4050
- const path = [];
4051
- let current = schemaClass2;
4052
- let resolved = null;
4053
- while (current !== void 0) {
4054
- if (kinds.has(current.id)) {
4055
- resolved = kinds.get(current.id) ?? null;
4056
- break;
4057
- }
4058
- if (resolving.has(current.id)) {
4059
- resolved = null;
4060
- break;
4061
- }
4062
- resolving.add(current.id);
4063
- path.push(current);
4064
- current = current.extendsClassId === void 0 ? void 0 : classesById.get(current.extendsClassId);
4065
- }
4066
- for (const candidate of path) {
4067
- resolving.delete(candidate.id);
4068
- kinds.set(candidate.id, resolved);
4069
- }
4070
- }
4071
- return kinds;
4072
- }
4073
- function dedupeSchemaKeyOrder(order) {
4074
- const seen = /* @__PURE__ */ new Set();
4075
- const result = [];
4076
- for (const schemaKey of order) {
4077
- if (seen.has(schemaKey)) continue;
4078
- seen.add(schemaKey);
4079
- result.push(schemaKey);
4080
- }
4081
- return result;
4082
- }
4083
- function getClassSchemaKeyOrder(schemaClass2) {
4084
- const schemaKeys = Object.keys(schemaClass2.schema);
4085
- if (schemaClass2.schemaKeyOrder === void 0) return schemaKeys;
4086
- const orderedKeys2 = dedupeSchemaKeyOrder(schemaClass2.schemaKeyOrder);
4087
- const seen = new Set(orderedKeys2);
4088
- for (const schemaKey of schemaKeys) {
4089
- if (seen.has(schemaKey)) continue;
4090
- seen.add(schemaKey);
4091
- orderedKeys2.push(schemaKey);
4092
- }
4093
- return orderedKeys2;
4094
- }
4095
- function isClassSchema(value) {
4096
- if (value === null) return false;
4097
- if (typeof value !== "object") return false;
4098
- if (Array.isArray(value)) return false;
4099
- return Object.values(value).every(
4100
- (schemaValue) => typeof schemaValue === "string"
4101
- );
4102
- }
4103
- function isOptionalSchemaKeyOrder(value) {
4104
- if (value === void 0) return true;
4105
- if (!Array.isArray(value)) return false;
4106
- return value.every((key) => typeof key === "string");
4107
- }
4108
- function isNeoSchemaClassProps(value) {
4109
- const v = value;
4110
- return isNeoSchemaClassBase(value) && typeof v?.id === "string" && isEpochMillis(v?.createdAt) && isEpochMillis(v?.updatedAt) && typeof v?.projectId === "string";
4111
- }
4112
- function isNeoSchemaClass(value) {
4113
- return isNeoSchemaClassProps(value);
4114
- }
4115
-
4116
4142
  // ../packages/models/src/members/structured-leaf-fields.ts
4117
4143
  var STRUCTURED_LEAF_FIELDS = {
4118
4144
  [11 /* Sprite */]: [
@@ -6408,32 +6434,6 @@ function referencedValueIdCandidates(value) {
6408
6434
  return [];
6409
6435
  }
6410
6436
 
6411
- // ../packages/models/src/core/auth-ownership-types.ts
6412
- var ActorKind = {
6413
- /**
6414
- * `better-auth` user identities.
6415
- */
6416
- user: "user",
6417
- /**
6418
- * `better-auth` organization identities.
6419
- */
6420
- organization: "organization",
6421
- /**
6422
- * Used for denoting records created by a system.
6423
- */
6424
- system: "system"
6425
- };
6426
- function isActorIdentifier(value) {
6427
- if (typeof value !== "object") return false;
6428
- if (value === null) return false;
6429
- const candidate = value;
6430
- if (!isActorKind(candidate.kind)) return false;
6431
- return typeof candidate.id === "string" && candidate.id.trim().length > 0;
6432
- }
6433
- function isActorKind(value) {
6434
- return value === ActorKind.user || value === ActorKind.organization || value === ActorKind.system;
6435
- }
6436
-
6437
6437
  // ../packages/models/src/members/member-change-listeners.ts
6438
6438
  function editChangeListenerSet(explicit, inherited, edit, options = { inheritedComplete: true }) {
6439
6439
  if (edit.kind === "reset") {
@@ -8654,6 +8654,16 @@ function firstUnboundParamId(env) {
8654
8654
  }
8655
8655
  return null;
8656
8656
  }
8657
+ function findGenericParamDeclaration(genericParamId, classes) {
8658
+ for (const schemaClass2 of classes) {
8659
+ for (const param of schemaClass2.genericParams ?? []) {
8660
+ if (param.id === genericParamId) {
8661
+ return { param, declaringClass: schemaClass2 };
8662
+ }
8663
+ }
8664
+ }
8665
+ return null;
8666
+ }
8657
8667
  function referencedGenericParams(member, members, seen = /* @__PURE__ */ new Set()) {
8658
8668
  const result = /* @__PURE__ */ new Set();
8659
8669
  collectReferencedGenericParams(member, members, seen, result);
@@ -8885,6 +8895,88 @@ function substituteNestedTypeInfo(typeInfo, env, members) {
8885
8895
  );
8886
8896
  });
8887
8897
  }
8898
+ function substituteInheritedCallableTypeInfo(typeInfo, env, classes, members) {
8899
+ return mapGenericTypeInfo(typeInfo, (generic) => {
8900
+ const entry = env.get(generic.genericParamId);
8901
+ if (entry === void 0) return generic;
8902
+ if (entry.kind === "unbound") {
8903
+ const forwarded = forwardedParamTypeInfo(entry.paramId, classes);
8904
+ return forwarded === null ? generic : { ...forwarded, required: generic.required };
8905
+ }
8906
+ const bound = openBindingTypeInfo(
8907
+ callableBindingMember(entry.memberId, generic.genericParamId, members),
8908
+ env,
8909
+ classes,
8910
+ members
8911
+ );
8912
+ return { ...bound, required: bound.required && generic.required };
8913
+ });
8914
+ }
8915
+ function forwardedParamTypeInfo(genericParamId, classes) {
8916
+ const declaration = findGenericParamDeclaration(genericParamId, classes);
8917
+ if (declaration === null) return null;
8918
+ return {
8919
+ type: 21 /* Generic */,
8920
+ required: true,
8921
+ ownerClassId: declaration.declaringClass.id,
8922
+ genericParamId
8923
+ };
8924
+ }
8925
+ function openBindingTypeInfo(member, env, classes, members) {
8926
+ const resolved = resolveMember(member, members);
8927
+ const nested = (memberId) => openBindingTypeInfo(
8928
+ callableBindingMember(memberId, resolved.name, members),
8929
+ env,
8930
+ classes,
8931
+ members
8932
+ );
8933
+ const param = (genericParamId) => {
8934
+ const entry = env.get(genericParamId);
8935
+ if (entry?.kind === "member") return nested(entry.memberId);
8936
+ if (entry?.kind === "unbound") {
8937
+ return forwardedParamTypeInfo(entry.paramId, classes);
8938
+ }
8939
+ return null;
8940
+ };
8941
+ if (isMemberGenericBase(resolved)) {
8942
+ return param(resolved.genericParamId) ?? genericBindingTypeInfo(resolved, env, members);
8943
+ }
8944
+ const required = isRequiredMember(resolved);
8945
+ if (isMemberClassBase(resolved)) {
8946
+ const typeArguments = {};
8947
+ for (const [parameterId, argument2] of Object.entries(
8948
+ resolved.classArguments ?? {}
8949
+ )) {
8950
+ const argumentType = isForwardedGenericBinding(argument2) ? param(argument2.genericParamId) : nested(argument2.memberId);
8951
+ if (argumentType === null) {
8952
+ return genericBindingTypeInfo(resolved, env, members);
8953
+ }
8954
+ typeArguments[parameterId] = argumentType;
8955
+ }
8956
+ return {
8957
+ type: 7 /* Class */,
8958
+ required,
8959
+ classId: resolved.classId,
8960
+ ...Object.keys(typeArguments).length === 0 ? {} : { typeArguments }
8961
+ };
8962
+ }
8963
+ if (isMemberListBase(resolved)) {
8964
+ return {
8965
+ type: 6 /* List */,
8966
+ required,
8967
+ entryTypeInfo: nested(resolved.entryMemberId)
8968
+ };
8969
+ }
8970
+ if (isMemberDictionaryBase(resolved)) {
8971
+ return {
8972
+ type: 5 /* Dictionary */,
8973
+ required,
8974
+ entryTypeInfo: nested(resolved.entryMemberId),
8975
+ ...resolved.keyEnumId == null ? {} : { keyEnumId: resolved.keyEnumId }
8976
+ };
8977
+ }
8978
+ return genericBindingTypeInfo(resolved, env, members);
8979
+ }
8888
8980
  function callableBindingMember(memberId, slotName, members) {
8889
8981
  const binding = memberIndexFor(members).get(memberId);
8890
8982
  if (binding === void 0) {
@@ -9486,13 +9578,16 @@ function constructionMembers(classId, context) {
9486
9578
  }
9487
9579
  function createMemberDefaultConstructionChecker(document2) {
9488
9580
  const context = contextFor(document2);
9489
- return (member, genericEnv = /* @__PURE__ */ new Map()) => {
9581
+ return (member, genericEnv = /* @__PURE__ */ new Map(), readValueIds) => {
9490
9582
  const previousEnv = context.env;
9583
+ const previousReads = context.readValueIds;
9491
9584
  context.env = genericEnv;
9585
+ context.readValueIds = readValueIds;
9492
9586
  try {
9493
9587
  return defaultSettlesConstruction(member, context, /* @__PURE__ */ new Set());
9494
9588
  } finally {
9495
9589
  context.env = previousEnv;
9590
+ context.readValueIds = previousReads;
9496
9591
  }
9497
9592
  };
9498
9593
  }
@@ -9603,6 +9698,7 @@ function valueSettlesConstruction(member, body, context, path, storedRow = false
9603
9698
  }
9604
9699
  function suppliedValueSettlesConstruction(member, value, context, path) {
9605
9700
  if (typeof value === "string") {
9701
+ context.readValueIds?.add(value);
9606
9702
  let row;
9607
9703
  if (context.document.valueById !== void 0) {
9608
9704
  row = context.document.valueById(value);
@@ -10668,74 +10764,84 @@ function recordStorageKeyDeclaration(sink, valueId, member) {
10668
10764
  if (declaration === STORAGE_KEY_INHERIT) return;
10669
10765
  sink.set(valueId, declaration);
10670
10766
  }
10671
- function createDefaultValueResolutionCache() {
10767
+ function createDefaultSchemaResolutionCache() {
10672
10768
  return {
10673
10769
  memberByIdIndex: null,
10674
10770
  instanceEnvironmentByKey: /* @__PURE__ */ new Map(),
10675
- materializationPlanByClassAndEnvironment: /* @__PURE__ */ new Map(),
10676
10771
  resolvedMemberById: /* @__PURE__ */ new Map(),
10677
10772
  storedSchemaByClassId: /* @__PURE__ */ new Map(),
10678
- validatedInitializerContainers: /* @__PURE__ */ new WeakSet(),
10773
+ validatedInitializerContainers: /* @__PURE__ */ new WeakSet()
10774
+ };
10775
+ }
10776
+ function createDefaultValueResolutionCache(schema = createDefaultSchemaResolutionCache()) {
10777
+ return {
10778
+ schema,
10779
+ materializationPlanByClassAndEnvironment: /* @__PURE__ */ new Map(),
10679
10780
  memberDefaultConstructionChecker: null
10680
10781
  };
10681
10782
  }
10682
10783
  function withIndexedDefaultValueDocument(document2, options = {}) {
10683
10784
  const cache = options.cache ?? createDefaultValueResolutionCache();
10684
- if (cache.memberByIdIndex === null && options.memberById === void 0 && document2.memberById === void 0) {
10685
- cache.memberByIdIndex = new Map(
10785
+ const schemaCache = cache.schema;
10786
+ if (schemaCache.memberByIdIndex === null && options.memberById === void 0 && document2.memberById === void 0) {
10787
+ schemaCache.memberByIdIndex = new Map(
10686
10788
  document2.members.map((member) => [member.id, member])
10687
10789
  );
10688
10790
  }
10689
10791
  const indexed = {
10690
10792
  ...document2,
10691
- memberById: (id) => options.memberById?.(id) ?? document2.memberById?.(id) ?? cache.memberByIdIndex?.get(id) ?? null,
10793
+ memberById: (id) => options.memberById?.(id) ?? document2.memberById?.(id) ?? schemaCache.memberByIdIndex?.get(id) ?? null,
10692
10794
  resolvedMember: (member) => {
10693
10795
  const memberId = "id" in member ? member.id : void 0;
10694
10796
  if (typeof memberId !== "string") {
10695
10797
  return resolveMember(member, document2.members);
10696
10798
  }
10697
- const cached = cache.resolvedMemberById.get(memberId);
10799
+ const cached = schemaCache.resolvedMemberById.get(memberId);
10698
10800
  if (cached !== void 0) return cached;
10699
10801
  const resolved = resolveMember(member, document2.members);
10700
- cache.resolvedMemberById.set(memberId, resolved);
10802
+ schemaCache.resolvedMemberById.set(memberId, resolved);
10701
10803
  return resolved;
10702
10804
  },
10703
10805
  storedInstanceSchema: (classId) => {
10704
- const cached = cache.storedSchemaByClassId.get(classId);
10806
+ const cached = schemaCache.storedSchemaByClassId.get(classId);
10705
10807
  if (cached !== void 0) return cached;
10706
10808
  const schema = resolvedClassSchema(
10707
10809
  classId,
10708
10810
  document2.classes,
10709
10811
  document2.members
10710
10812
  ).surface;
10711
- cache.storedSchemaByClassId.set(classId, schema);
10813
+ schemaCache.storedSchemaByClassId.set(classId, schema);
10712
10814
  return schema;
10713
10815
  },
10714
10816
  instanceEnv: (classId, classArguments2) => {
10715
10817
  const key = `${classId}:${JSON.stringify(classArguments2 ?? null)}`;
10716
- const cached = cache.instanceEnvironmentByKey.get(key);
10818
+ const cached = schemaCache.instanceEnvironmentByKey.get(key);
10717
10819
  if (cached !== void 0) return cached;
10718
10820
  const environment = resolveInstanceEnv(
10719
10821
  classId,
10720
10822
  classArguments2,
10721
10823
  document2.classes
10722
10824
  );
10723
- cache.instanceEnvironmentByKey.set(key, environment);
10825
+ schemaCache.instanceEnvironmentByKey.set(key, environment);
10724
10826
  return environment;
10725
10827
  },
10726
10828
  isInitValueContent: (value) => {
10727
10829
  if (typeof value !== "object" || value === null) return false;
10728
- if (cache.validatedInitializerContainers.has(value)) return true;
10830
+ if (schemaCache.validatedInitializerContainers.has(value)) return true;
10729
10831
  if (!isInitValueContent(value)) return false;
10730
- cache.validatedInitializerContainers.add(value);
10832
+ schemaCache.validatedInitializerContainers.add(value);
10731
10833
  return true;
10732
10834
  },
10733
- memberDefaultSettlesConstruction: (member, environment) => {
10835
+ memberDefaultSettlesConstruction: (member, environment, readValueIds) => {
10734
10836
  cache.memberDefaultConstructionChecker ??= createMemberDefaultConstructionChecker({
10735
10837
  ...indexed,
10736
10838
  constructors: document2.constructors ?? []
10737
10839
  });
10738
- return cache.memberDefaultConstructionChecker(member, environment);
10840
+ return cache.memberDefaultConstructionChecker(
10841
+ member,
10842
+ environment,
10843
+ readValueIds
10844
+ );
10739
10845
  },
10740
10846
  createValueRow: options.createValueRow ?? document2.createValueRow
10741
10847
  };
@@ -10787,12 +10893,20 @@ function buildDefaultClassMaterializationPlan(document2, classId, instanceEnv) {
10787
10893
  ...document2,
10788
10894
  constructors: document2.constructors ?? []
10789
10895
  });
10790
- return storedSchemaOf(document2, classId).flatMap(
10896
+ const reads = {
10897
+ valueIds: /* @__PURE__ */ new Set(),
10898
+ containerIds: /* @__PURE__ */ new Set()
10899
+ };
10900
+ const entries = storedSchemaOf(document2, classId).flatMap(
10791
10901
  (entry) => {
10792
10902
  if (entry.memberId === null) return [];
10793
10903
  const childMember = findMemberInDocument(document2, entry.memberId);
10794
10904
  if (!memberKindOwnsStoredValue(childMember.kind)) return [];
10795
- if (instanceEnv.size === 0 && isConstantMember(document2, resolvedInDocument(document2, childMember)))
10905
+ if (instanceEnv.size === 0 && isConstantMember(
10906
+ document2,
10907
+ resolvedInDocument(document2, childMember),
10908
+ reads
10909
+ ))
10796
10910
  return [];
10797
10911
  const member = substituteMember(
10798
10912
  childMember,
@@ -10804,14 +10918,19 @@ function buildDefaultClassMaterializationPlan(document2, classId, instanceEnv) {
10804
10918
  {
10805
10919
  schemaKey: entry.schemaKey,
10806
10920
  member,
10807
- defaultSettlesConstruction: settlesConstruction(member, instanceEnv),
10921
+ defaultSettlesConstruction: settlesConstruction(
10922
+ member,
10923
+ instanceEnv,
10924
+ reads.valueIds
10925
+ ),
10808
10926
  directScalarBody: directScalarDefaultBody(document2, member)
10809
10927
  }
10810
10928
  ];
10811
10929
  }
10812
10930
  );
10931
+ return { entries, reads };
10813
10932
  }
10814
- function isConstantMember(document2, resolved) {
10933
+ function isConstantMember(document2, resolved, reads) {
10815
10934
  if (isStaticMember(resolved)) return false;
10816
10935
  const fixedness = fixednessOf(resolved, 0 /* Writable */);
10817
10936
  if (fixedness === 0 /* Writable */) return false;
@@ -10824,7 +10943,8 @@ function isConstantMember(document2, resolved) {
10824
10943
  document: document2,
10825
10944
  rows: /* @__PURE__ */ new Set(),
10826
10945
  declarations: /* @__PURE__ */ new Set(),
10827
- classes: /* @__PURE__ */ new Set()
10946
+ classes: /* @__PURE__ */ new Set(),
10947
+ reads
10828
10948
  },
10829
10949
  resolved,
10830
10950
  declared,
@@ -10898,6 +11018,8 @@ function declarationVaries(walk, member, body, rowId, scope) {
10898
11018
  return owned !== Object.keys(value).length;
10899
11019
  }
10900
11020
  if (isMemberListBase(member)) {
11021
+ if (rowId !== null && listKindOf(member) === 1 /* Unordered */)
11022
+ walk.reads?.containerIds.add(rowId);
10901
11023
  const entryIds = listKindOf(member) !== 1 /* Unordered */ ? value : rowId === null ? [] : document2.unorderedListEntryIds?.(rowId) ?? (walk.membership ??= buildUnorderedListMembershipIndex(
10902
11024
  document2.values
10903
11025
  )).get(rowId) ?? [];
@@ -10930,6 +11052,7 @@ function rowVaries(walk, member, valueId, scope) {
10930
11052
  const key = scopeKey(valueId, scope);
10931
11053
  if (walk.rows.has(key)) return false;
10932
11054
  walk.rows.add(key);
11055
+ walk.reads?.valueIds.add(valueId);
10933
11056
  const { document: document2 } = walk;
10934
11057
  const row = document2.valueById?.(valueId) ?? (walk.rowById ??= new Map(
10935
11058
  document2.values.map((value) => [value.id, value])
@@ -11233,6 +11356,7 @@ function buildDefaultMemberValueCore(args, resolvedMember) {
11233
11356
  effectiveClassId,
11234
11357
  childEnv
11235
11358
  );
11359
+ args.document.recordPlanReads?.(materializationPlan.reads);
11236
11360
  const record4 = member.payload === 1 /* Partial */ ? {} : cloneDefaultClassRecord({
11237
11361
  document: args.document,
11238
11362
  projectId: args.projectId,
@@ -11426,7 +11550,7 @@ function completeDefaultClassRecord(args) {
11426
11550
  member: resolvedChildMember,
11427
11551
  defaultSettlesConstruction: defaultSettlesConstruction2,
11428
11552
  directScalarBody
11429
- } of args.member.payload === 1 /* Partial */ ? [] : args.materializationPlan) {
11553
+ } of args.member.payload === 1 /* Partial */ ? [] : args.materializationPlan.entries) {
11430
11554
  if (storageKeyReferencesParentClass(
11431
11555
  normalizeStorageKeyDeclaration(resolvedChildMember.storageKey)
11432
11556
  )) {
@@ -11746,6 +11870,7 @@ function cloneDefaultValueForMemberCore(args, sourceValue) {
11746
11870
  effectiveClassId,
11747
11871
  childEnv
11748
11872
  );
11873
+ args.document.recordPlanReads?.(materializationPlan.reads);
11749
11874
  const anchorsParentClassPartition = sourceValue.constructorArgs == null && completeDefaultClassRecord({
11750
11875
  ...args,
11751
11876
  member,
@@ -12630,6 +12755,230 @@ var EffectiveStorageResolver = class {
12630
12755
  }
12631
12756
  };
12632
12757
 
12758
+ // ../packages/models/src/interfaces/interface-graph.ts
12759
+ var CircularInterfaceExtensionError = class extends Error {
12760
+ constructor(interfaceId, chain) {
12761
+ super(
12762
+ `Circular interface extension detected at "${interfaceId}"; chain: ${chain.join(" -> ")}`
12763
+ );
12764
+ this.interfaceId = interfaceId;
12765
+ this.chain = chain;
12766
+ this.name = "CircularInterfaceExtensionError";
12767
+ }
12768
+ interfaceId;
12769
+ chain;
12770
+ };
12771
+ function resolveInterfaceClosure(interfaceId, interfaces) {
12772
+ const byId = new Map(
12773
+ interfaces.map((neoInterface) => [neoInterface.id, neoInterface])
12774
+ );
12775
+ const result = [];
12776
+ const emitted = /* @__PURE__ */ new Set();
12777
+ const visiting = [];
12778
+ const visitingSet = /* @__PURE__ */ new Set();
12779
+ const visit = (id) => {
12780
+ if (visitingSet.has(id)) {
12781
+ throw new CircularInterfaceExtensionError(id, [...visiting, id]);
12782
+ }
12783
+ if (emitted.has(id)) return;
12784
+ const neoInterface = byId.get(id);
12785
+ if (!neoInterface) return;
12786
+ visiting.push(id);
12787
+ visitingSet.add(id);
12788
+ result.push(neoInterface);
12789
+ emitted.add(id);
12790
+ for (const parentId of neoInterface.extendsInterfaceIds ?? []) {
12791
+ visit(parentId);
12792
+ }
12793
+ visiting.pop();
12794
+ visitingSet.delete(id);
12795
+ };
12796
+ visit(interfaceId);
12797
+ return result;
12798
+ }
12799
+ function resolveImplementedInterfaces(classId, classes, interfaces) {
12800
+ const result = [];
12801
+ const seen = /* @__PURE__ */ new Set();
12802
+ for (const schemaClass2 of resolveInheritanceChain(classId, classes)) {
12803
+ for (const interfaceId of schemaClass2.implementsInterfaceIds ?? []) {
12804
+ for (const neoInterface of resolveInterfaceClosure(
12805
+ interfaceId,
12806
+ interfaces
12807
+ )) {
12808
+ if (seen.has(neoInterface.id)) continue;
12809
+ seen.add(neoInterface.id);
12810
+ result.push(neoInterface);
12811
+ }
12812
+ }
12813
+ }
12814
+ return result;
12815
+ }
12816
+ function classImplementsInterface(classId, interfaceId, classes, interfaces) {
12817
+ return resolveImplementedInterfaces(classId, classes, interfaces).some(
12818
+ (neoInterface) => neoInterface.id === interfaceId
12819
+ );
12820
+ }
12821
+
12822
+ // ../packages/manifest/src/value-comparison.ts
12823
+ function isObjectRecord(value) {
12824
+ return typeof value === "object" && value !== null && !Array.isArray(value);
12825
+ }
12826
+
12827
+ // ../packages/neoscript-runtime/src/values/canonical-json.ts
12828
+ function canonicalJsonStringify(value) {
12829
+ return JSON.stringify(toCanonicalJsonValue(value));
12830
+ }
12831
+ function toCanonicalJsonValue(value) {
12832
+ if (value === null) return null;
12833
+ if (value === void 0) return void 0;
12834
+ if (value instanceof Date) return value.toISOString();
12835
+ if (typeof value === "string") return value;
12836
+ if (typeof value === "boolean") return value;
12837
+ if (typeof value === "number") {
12838
+ if (!Number.isFinite(value)) {
12839
+ throw new Error("Cannot canonicalize a non-finite number.");
12840
+ }
12841
+ return value;
12842
+ }
12843
+ if (typeof value === "bigint") {
12844
+ throw new Error("Cannot canonicalize bigint values.");
12845
+ }
12846
+ if (typeof value === "symbol") {
12847
+ throw new Error("Cannot canonicalize symbol values.");
12848
+ }
12849
+ if (typeof value === "function") {
12850
+ throw new Error("Cannot canonicalize function values.");
12851
+ }
12852
+ if (Array.isArray(value)) {
12853
+ return value.map((item) => {
12854
+ const canonicalItem = toCanonicalJsonValue(item);
12855
+ if (canonicalItem === void 0) return null;
12856
+ return canonicalItem;
12857
+ });
12858
+ }
12859
+ const entries = Object.entries(value).sort(([a], [b]) => a.localeCompare(b));
12860
+ const canonicalObject = {};
12861
+ for (const [key, entryValue] of entries) {
12862
+ const canonicalValue = toCanonicalJsonValue(entryValue);
12863
+ if (canonicalValue === void 0) continue;
12864
+ canonicalObject[key] = canonicalValue;
12865
+ }
12866
+ return canonicalObject;
12867
+ }
12868
+
12869
+ // ../src/database/compiled-construction-types.ts
12870
+ function compiledConstructionTypeMembers(members, bodies, projectId) {
12871
+ const created = [];
12872
+ let existingIds;
12873
+ const byType = /* @__PURE__ */ new Map();
12874
+ const key = (type) => canonicalJsonStringify(type);
12875
+ const intern = (type) => {
12876
+ const signature = key(type);
12877
+ const existing = byType.get(signature);
12878
+ if (existing !== void 0) return existing;
12879
+ if (type.type === 21 /* Generic */ || type.type === NS_TYPE_UNKNOWN)
12880
+ return null;
12881
+ const id = v5_default(
12882
+ `neo:compiled-construction-type:${projectId}:${signature}`,
12883
+ v5_default.URL
12884
+ );
12885
+ existingIds ??= new Set(members.map((member) => member.id));
12886
+ if (existingIds.has(id)) {
12887
+ byType.set(signature, id);
12888
+ return id;
12889
+ }
12890
+ const common = {
12891
+ id,
12892
+ projectId,
12893
+ createdAt: 0,
12894
+ updatedAt: 0,
12895
+ name: "Type argument",
12896
+ kind: type.type,
12897
+ requirement: type.required ? 1 /* Required */ : 0 /* Optional */
12898
+ };
12899
+ const fields = (() => {
12900
+ if (type.type === 6 /* List */ || type.type === 5 /* Dictionary */) {
12901
+ const entryMemberId = intern(type.entryTypeInfo);
12902
+ if (entryMemberId === null) return null;
12903
+ return {
12904
+ entryMemberId,
12905
+ ...type.keyEnumId === void 0 ? {} : { keyKind: 1 /* Enum */, keyEnumId: type.keyEnumId }
12906
+ };
12907
+ } else if (type.type === 7 /* Class */) {
12908
+ const classArguments2 = {};
12909
+ for (const [parameter3, argument2] of Object.entries(
12910
+ type.typeArguments ?? {}
12911
+ )) {
12912
+ const memberId = intern(argument2);
12913
+ if (memberId === null) return null;
12914
+ classArguments2[parameter3] = {
12915
+ kind: 1 /* Member */,
12916
+ memberId
12917
+ };
12918
+ }
12919
+ return {
12920
+ classId: type.classId,
12921
+ ...Object.keys(classArguments2).length === 0 ? {} : { classArguments: classArguments2 }
12922
+ };
12923
+ } else if (type.type === 8 /* Enum */) {
12924
+ return { enumId: type.enumId };
12925
+ } else if (type.type === 25 /* NSDelegate */) {
12926
+ return {
12927
+ returnTypeInfo: type.returnTypeInfo,
12928
+ argumentTypes: type.argumentTypes
12929
+ };
12930
+ } else if (type.type === 26 /* NSAction */) {
12931
+ return { argumentTypes: type.argumentTypes };
12932
+ } else if (type.type === 22 /* Interface */ || type.type === 9 /* Lookup */ || type.type === 18 /* DialogueLookup */) {
12933
+ return null;
12934
+ } else {
12935
+ return {};
12936
+ }
12937
+ })();
12938
+ if (fields === null) return null;
12939
+ created.push({ ...common, ...fields });
12940
+ existingIds.add(id);
12941
+ byType.set(signature, id);
12942
+ return id;
12943
+ };
12944
+ const visited = /* @__PURE__ */ new Set();
12945
+ const visit = (value) => {
12946
+ if (value === null || typeof value !== "object" || visited.has(value))
12947
+ return;
12948
+ visited.add(value);
12949
+ const argumentsValue = getField(
12950
+ getField(value, "schemaClassInfo"),
12951
+ "typeArguments"
12952
+ );
12953
+ if (argumentsValue !== null && typeof argumentsValue === "object") {
12954
+ for (const type of Object.values(argumentsValue))
12955
+ if (isNSTypeInfo(type)) intern(type);
12956
+ }
12957
+ for (const child of Object.values(value)) visit(child);
12958
+ };
12959
+ for (const body of bodies) visit(body);
12960
+ return created;
12961
+ }
12962
+ function withCompiledConstructionTypes(document2, body) {
12963
+ const members = document2.members;
12964
+ const projectId = getField(document2.project, "id");
12965
+ if (!Array.isArray(members)) {
12966
+ throw new Error("Construction type descriptors require a member array.");
12967
+ }
12968
+ if (!members.every(
12969
+ (member) => typeof getField(member, "id") === "string"
12970
+ )) {
12971
+ throw new Error(
12972
+ "Construction type descriptors require an ID on every member record."
12973
+ );
12974
+ }
12975
+ if (typeof projectId !== "string") {
12976
+ throw new Error("Construction type descriptors require a project ID.");
12977
+ }
12978
+ const created = compiledConstructionTypeMembers(members, [body], projectId);
12979
+ return created.length === 0 ? document2 : { ...document2, members: [...members, ...created] };
12980
+ }
12981
+
12633
12982
  // ../packages/neoscript-runtime/src/neoscript/debug.ts
12634
12983
  function snapshotNeoScriptFrames(state) {
12635
12984
  const frames = state.frames.slice(-64).reverse().map((frame) => Object.freeze({ ...frame }));
@@ -13595,8 +13944,7 @@ var PendingInitializerDependency = class extends NSGetterRuntimeError {
13595
13944
  var OWNERSHIP_CHAIN_PREFIXES = [
13596
13945
  "generic-parent-resolution:",
13597
13946
  "member-owner-resolution:",
13598
- "owned-value-parents:",
13599
- "declaration-owner-resolution:"
13947
+ "owned-value-parents:"
13600
13948
  ];
13601
13949
  var CONTAINER_ENTRIES_PREFIX = "container-entries:";
13602
13950
  function ownershipChainRead(kind, rowId) {
@@ -13605,10 +13953,6 @@ function ownershipChainRead(kind, rowId) {
13605
13953
  function containerEntriesRead(containerId) {
13606
13954
  return `${CONTAINER_ENTRIES_PREFIX}${containerId}`;
13607
13955
  }
13608
- var OWNERSHIP_CHAIN_READ = ownershipChainRead(
13609
- "member-owner-resolution",
13610
- "*"
13611
- );
13612
13956
  function classifyUnattributableRead(reason) {
13613
13957
  for (const prefix of OWNERSHIP_CHAIN_PREFIXES) {
13614
13958
  if (reason.startsWith(prefix)) {
@@ -13639,12 +13983,13 @@ function valueIdsWithSourceChains(targetValueIds, valuesById) {
13639
13983
  }
13640
13984
  return result;
13641
13985
  }
13642
- function initializerOwnerContext(document2, valueId, rootOwners, valuesById) {
13986
+ function initializerOwnerContext(document2, valueId, rootOwners, valuesById, recordValueRead) {
13643
13987
  const visited = /* @__PURE__ */ new Set();
13644
13988
  let currentId = valueId;
13645
13989
  let lexicalRoot = rootOwners.get(valueId);
13646
13990
  while (currentId !== null && !visited.has(currentId)) {
13647
13991
  visited.add(currentId);
13992
+ recordValueRead?.(currentId);
13648
13993
  const sourceValueId = valuesById.get(currentId)?.sourceValueId;
13649
13994
  if (typeof sourceValueId !== "string") break;
13650
13995
  currentId = sourceValueId;
@@ -14840,9 +15185,8 @@ var InitializerReadSet = class {
14840
15185
  /**
14841
15186
  * The unattributable reads by scope, for a fork of the same document to
14842
15187
  * re-attribute; see {@link classifyUnattributableRead}. Ownership-chain
14843
- * reads collapse to one flag: their inputs are already in `valueIds`.
15188
+ * reads need no record: their inputs are already in `valueIds`.
14844
15189
  */
14845
- hasOwnershipChainRead = false;
14846
15190
  containerEntryReadIds = /* @__PURE__ */ new Set();
14847
15191
  corpusReadReasons = /* @__PURE__ */ new Set();
14848
15192
  recordUnattributableValueRead = (reason) => {
@@ -14850,7 +15194,6 @@ var InitializerReadSet = class {
14850
15194
  const read = classifyUnattributableRead(reason);
14851
15195
  switch (read.scope) {
14852
15196
  case "ownership-chain" /* OwnershipChain */:
14853
- this.hasOwnershipChainRead = true;
14854
15197
  return;
14855
15198
  case "container" /* Container */:
14856
15199
  this.containerEntryReadIds.add(read.containerId);
@@ -14895,17 +15238,61 @@ function getWorldGridQueryIndex(source) {
14895
15238
  building.delete(source.cacheKey);
14896
15239
  }
14897
15240
  }
15241
+ function readsAny(reads, ids) {
15242
+ for (const id of ids) if (reads.has(id)) return true;
15243
+ return false;
15244
+ }
14898
15245
  var WorldGridQueryIndex = class {
14899
- constructor(grids, placements, geometryReads, metrics) {
15246
+ constructor(grids, placements, geometryReads, kinds, placedRecordIds, metrics) {
14900
15247
  this.grids = grids;
14901
15248
  this.placements = placements;
14902
15249
  this.geometryReads = geometryReads;
15250
+ this.kinds = kinds;
15251
+ this.placedRecordIds = placedRecordIds;
14903
15252
  this.metrics = metrics;
14904
15253
  }
14905
15254
  grids;
14906
15255
  placements;
14907
15256
  geometryReads;
15257
+ kinds;
15258
+ placedRecordIds;
14908
15259
  metrics;
15260
+ /**
15261
+ * Whether edits to these rows can change the index. Ownership-chain reads
15262
+ * need no flag: every ancestor they visit is in `geometryReads.valueIds`.
15263
+ * Discovery checks every row's effective class without recording a read,
15264
+ * so a changed row it could now index as a grid counts as well. A record it
15265
+ * classed by placement keeps that placement through its own writes, so only
15266
+ * its stamp can change.
15267
+ */
15268
+ readsValues(valueIds, classIdOf, stampOf) {
15269
+ const reads = this.geometryReads;
15270
+ if (reads.corpusReadReasons.size > 0) return true;
15271
+ for (const id of valueIds) {
15272
+ if (reads.valueIds.has(id)) return true;
15273
+ const classId = this.placedRecordIds.has(id) ? stampOf(id) : classIdOf(id);
15274
+ if (classId !== null && this.kinds.get(classId) === NeoWorldSystemClassKind.TileGrid)
15275
+ return true;
15276
+ }
15277
+ return false;
15278
+ }
15279
+ /** Whether entry changes in these containers can change the index. */
15280
+ readsContainers(containerIds) {
15281
+ const reads = this.geometryReads;
15282
+ for (const id of containerIds) {
15283
+ if (reads.containerIds.has(id)) return true;
15284
+ if (reads.containerEntryReadIds.has(id)) return true;
15285
+ }
15286
+ return false;
15287
+ }
15288
+ /** Whether edits to these localized texts can change the index. */
15289
+ readsLocalizedTexts(textIds) {
15290
+ return readsAny(this.geometryReads.localizedTextIds, textIds);
15291
+ }
15292
+ /** Whether edits to these variants can change the index. */
15293
+ readsVariants(variantIds) {
15294
+ return readsAny(this.geometryReads.variantIds, variantIds);
15295
+ }
14909
15296
  placement(valueId, reads) {
14910
15297
  reads?.add({ kind: "placement", valueId });
14911
15298
  const matches = this.placements.get(valueId) ?? [];
@@ -15069,8 +15456,13 @@ function buildIndex(source) {
15069
15456
  occupiedCells += 1;
15070
15457
  };
15071
15458
  const discoveryReads = new InitializerReadSet();
15459
+ const placedRecordIds = /* @__PURE__ */ new Set();
15072
15460
  for (const root of source.rows) {
15073
- const grid = typeof root.classId !== "string" ? source.readRow(root.id, discoveryReads) : root;
15461
+ let grid = root;
15462
+ if (typeof root.classId !== "string") {
15463
+ if (record(root.value) !== null) placedRecordIds.add(root.id);
15464
+ grid = source.readRow(root.id, discoveryReads);
15465
+ }
15074
15466
  if (typeof grid?.classId !== "string" || kinds.get(grid.classId) !== NeoWorldSystemClassKind.TileGrid)
15075
15467
  continue;
15076
15468
  const effectiveGrid = readRow(root.id);
@@ -15163,11 +15555,18 @@ function buildIndex(source) {
15163
15555
  }
15164
15556
  }
15165
15557
  }
15166
- return new WorldGridQueryIndex(grids, placements, reads, {
15167
- rowsScanned: source.rows.length,
15168
- placementsIndexed,
15169
- occupiedCells
15170
- });
15558
+ return new WorldGridQueryIndex(
15559
+ grids,
15560
+ placements,
15561
+ reads,
15562
+ kinds,
15563
+ placedRecordIds,
15564
+ {
15565
+ rowsScanned: source.rows.length,
15566
+ placementsIndexed,
15567
+ occupiedCells
15568
+ }
15569
+ );
15171
15570
  }
15172
15571
  function record(value) {
15173
15572
  return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
@@ -15615,70 +16014,6 @@ function floatFromDecimalString(value) {
15615
16014
  return Number(value);
15616
16015
  }
15617
16016
 
15618
- // ../packages/models/src/interfaces/interface-graph.ts
15619
- var CircularInterfaceExtensionError = class extends Error {
15620
- constructor(interfaceId, chain) {
15621
- super(
15622
- `Circular interface extension detected at "${interfaceId}"; chain: ${chain.join(" -> ")}`
15623
- );
15624
- this.interfaceId = interfaceId;
15625
- this.chain = chain;
15626
- this.name = "CircularInterfaceExtensionError";
15627
- }
15628
- interfaceId;
15629
- chain;
15630
- };
15631
- function resolveInterfaceClosure(interfaceId, interfaces) {
15632
- const byId = new Map(
15633
- interfaces.map((neoInterface) => [neoInterface.id, neoInterface])
15634
- );
15635
- const result = [];
15636
- const emitted = /* @__PURE__ */ new Set();
15637
- const visiting = [];
15638
- const visitingSet = /* @__PURE__ */ new Set();
15639
- const visit = (id) => {
15640
- if (visitingSet.has(id)) {
15641
- throw new CircularInterfaceExtensionError(id, [...visiting, id]);
15642
- }
15643
- if (emitted.has(id)) return;
15644
- const neoInterface = byId.get(id);
15645
- if (!neoInterface) return;
15646
- visiting.push(id);
15647
- visitingSet.add(id);
15648
- result.push(neoInterface);
15649
- emitted.add(id);
15650
- for (const parentId of neoInterface.extendsInterfaceIds ?? []) {
15651
- visit(parentId);
15652
- }
15653
- visiting.pop();
15654
- visitingSet.delete(id);
15655
- };
15656
- visit(interfaceId);
15657
- return result;
15658
- }
15659
- function resolveImplementedInterfaces(classId, classes, interfaces) {
15660
- const result = [];
15661
- const seen = /* @__PURE__ */ new Set();
15662
- for (const schemaClass2 of resolveInheritanceChain(classId, classes)) {
15663
- for (const interfaceId of schemaClass2.implementsInterfaceIds ?? []) {
15664
- for (const neoInterface of resolveInterfaceClosure(
15665
- interfaceId,
15666
- interfaces
15667
- )) {
15668
- if (seen.has(neoInterface.id)) continue;
15669
- seen.add(neoInterface.id);
15670
- result.push(neoInterface);
15671
- }
15672
- }
15673
- }
15674
- return result;
15675
- }
15676
- function classImplementsInterface(classId, interfaceId, classes, interfaces) {
15677
- return resolveImplementedInterfaces(classId, classes, interfaces).some(
15678
- (neoInterface) => neoInterface.id === interfaceId
15679
- );
15680
- }
15681
-
15682
16017
  // ../packages/models/src/members/read-class-member.ts
15683
16018
  function readClassMember(args) {
15684
16019
  const { member, schemaKey } = args;
@@ -16697,8 +17032,8 @@ function evaluatorResolutionCache(ctx) {
16697
17032
  compiledFunctionByMemberId: /* @__PURE__ */ new Map(),
16698
17033
  compiledGetterByMemberId: /* @__PURE__ */ new Map(),
16699
17034
  compiledSetterByMemberId: /* @__PURE__ */ new Map(),
16700
- defaultValueResolutionCache: createDefaultValueResolutionCache(),
16701
- validatedConstructorDescriptorByInfo: /* @__PURE__ */ new WeakMap(),
17035
+ defaultSchema: createDefaultSchemaResolutionCache(),
17036
+ valueGenerations: /* @__PURE__ */ new WeakMap(),
16702
17037
  effectiveStorageResolver: void 0
16703
17038
  };
16704
17039
  resolutionCacheByMembers.set(members, {
@@ -16737,6 +17072,24 @@ function cachedInstanceEnv(classId, classArguments2, ctx) {
16737
17072
  function cachedIsInitValueContent(value, ctx) {
16738
17073
  return evaluatorDefaultValueDocument(ctx).isInitValueContent(value);
16739
17074
  }
17075
+ function evaluatorValueGeneration(ctx) {
17076
+ const { values, databaseVM } = ctx.vm;
17077
+ const valueGeneration = databaseVM?.valueGeneration;
17078
+ const resolution = evaluatorResolutionCache(ctx);
17079
+ const key = databaseVM ?? values;
17080
+ const entry = resolution.valueGenerations.get(key);
17081
+ if (entry !== void 0 && entry.values === values && entry.valueGeneration === valueGeneration) {
17082
+ return entry;
17083
+ }
17084
+ const generation = {
17085
+ values,
17086
+ valueGeneration,
17087
+ defaults: createDefaultValueResolutionCache(resolution.defaultSchema),
17088
+ constructorDescriptors: /* @__PURE__ */ new WeakMap()
17089
+ };
17090
+ resolution.valueGenerations.set(key, generation);
17091
+ return generation;
17092
+ }
16740
17093
  function evaluatorDefaultValueDocument(ctx) {
16741
17094
  if (ctx.__defaultValueDocument !== void 0) {
16742
17095
  return ctx.__defaultValueDocument;
@@ -16757,7 +17110,7 @@ function evaluatorDefaultValueDocument(ctx) {
16757
17110
  projectFiles: ctx.vm.projectFiles ?? [],
16758
17111
  textureTemplates: ctx.vm.textureTemplates ?? []
16759
17112
  },
16760
- { cache: evaluatorResolutionCache(ctx).defaultValueResolutionCache }
17113
+ { cache: evaluatorValueGeneration(ctx).defaults }
16761
17114
  );
16762
17115
  ctx.__defaultValueDocument = document2;
16763
17116
  return document2;
@@ -19208,8 +19561,12 @@ function bindOmittedConstantSlot(destination, member, value, ctx) {
19208
19561
  if (isMemberClassBase(member) || isMemberListBase(member) || isMemberDictionaryBase(member))
19209
19562
  return false;
19210
19563
  const resolved = resolveMember(member, ctx.vm.members);
19211
- if (!isConstantMember(constructorDefaultValueDocument(ctx, member), resolved))
19212
- return false;
19564
+ const decision = constantMemberDecision(
19565
+ constructorDefaultValueDocument(ctx, member),
19566
+ resolved
19567
+ );
19568
+ recordDeclarationReads(ctx, decision.reads);
19569
+ if (!decision.constant) return false;
19213
19570
  const { createdValues } = construction;
19214
19571
  const staged = createdValues.length;
19215
19572
  const row = materializeConstructorArgumentValue({
@@ -21592,6 +21949,17 @@ function ensureVirtualExpansionIndexed(rows, ctx, existingIndexes) {
21592
21949
  indexes3.indexedVirtualRowSets.add(rows);
21593
21950
  }
21594
21951
  var constantDeclarationRoots = /* @__PURE__ */ new WeakMap();
21952
+ function recordDeclarationReads(ctx, reads) {
21953
+ for (const id of reads.valueIds) ctx.valueDependencies?.add(id);
21954
+ for (const id of reads.containerIds) ctx.containerDependencies?.add(id);
21955
+ }
21956
+ function constantMemberDecision(document2, member) {
21957
+ const reads = {
21958
+ valueIds: /* @__PURE__ */ new Set(),
21959
+ containerIds: /* @__PURE__ */ new Set()
21960
+ };
21961
+ return { constant: isConstantMember(document2, member, reads), reads };
21962
+ }
21595
21963
  function readDeclarationDefault(member, ctx) {
21596
21964
  if (member?.defaultValue === void 0 || member.defaultValue === null) {
21597
21965
  return { matched: false };
@@ -21606,16 +21974,20 @@ function readDeclarationDefault(member, ctx) {
21606
21974
  constantDeclarationRoots.set(session, shared);
21607
21975
  }
21608
21976
  }
21609
- const known = shared?.get(member.id);
21610
- if (typeof known === "string" && session?.has(known) === true) {
21977
+ let known = shared?.get(member.id);
21978
+ if (known !== void 0) recordDeclarationReads(ctx, known.reads);
21979
+ if (known?.root !== void 0 && session?.has(known.root) === true) {
21611
21980
  return {
21612
21981
  matched: true,
21613
- value: resolveValueIfIdForMember(known, member, ctx)
21982
+ value: resolveValueIfIdForMember(known.root, member, ctx)
21614
21983
  };
21615
21984
  }
21616
21985
  const document2 = constructorDefaultValueDocument(ctx, member);
21617
- const constant = shared !== void 0 && known !== false && (known !== void 0 || isConstantMember(document2, member));
21618
- if (shared !== void 0 && !constant) shared.set(member.id, false);
21986
+ if (shared !== void 0 && known === void 0) {
21987
+ known = constantMemberDecision(document2, member);
21988
+ recordDeclarationReads(ctx, known.reads);
21989
+ shared.set(member.id, known);
21990
+ }
21619
21991
  const created = [];
21620
21992
  const closeFrame = pushConstructionFrame(ctx, `${member.name} declaration`);
21621
21993
  try {
@@ -21641,7 +22013,7 @@ function readDeclarationDefault(member, ctx) {
21641
22013
  )
21642
22014
  });
21643
22015
  stageConstructedRows([root, ...created], ctx);
21644
- if (constant) shared?.set(member.id, root.id);
22016
+ if (known?.constant === true) known.root = root.id;
21645
22017
  return {
21646
22018
  matched: true,
21647
22019
  value: resolveValueIfIdForMember(root.id, member, ctx)
@@ -21965,6 +22337,10 @@ function resolveMemberForValueRow(row, ctx, visited) {
21965
22337
  function worldGridQueryIndexForContext(context) {
21966
22338
  const ctx = withEvaluationRuntime(context, []);
21967
22339
  const vm = ctx.vm;
22340
+ const database = vm.databaseVM;
22341
+ const overlayRevision = ctx.__valueOverlay instanceof LazyValueOverlay ? ctx.__valueOverlay.worldRevision : 0;
22342
+ if (overlayRevision === 0 && database?.worldGridQueryIndex !== void 0)
22343
+ return database.worldGridQueryIndex();
21968
22344
  const readContexts = /* @__PURE__ */ new WeakMap();
21969
22345
  let geometryOverlay;
21970
22346
  const readContext = (reads) => {
@@ -21987,24 +22363,26 @@ function worldGridQueryIndexForContext(context) {
21987
22363
  readContexts.set(reads, next);
21988
22364
  return next;
21989
22365
  };
21990
- const overlayRevision = ctx.__valueOverlay instanceof LazyValueOverlay ? ctx.__valueOverlay.worldRevision : 0;
22366
+ const recording = (reads, read) => database?.recordVirtualInstanceReads === void 0 ? read() : database.recordVirtualInstanceReads(reads, read);
22367
+ const host = vm.worldQueryCache;
21991
22368
  return getWorldGridQueryIndex({
21992
- cacheKey: overlayRevision > 0 && ctx.__valueOverlay !== void 0 ? ctx.__valueOverlay : vm.worldQueryCache?.key ?? vm.databaseVM?.evaluatorIndexes ?? vm.values,
22369
+ cacheKey: overlayRevision > 0 && ctx.__valueOverlay !== void 0 ? ctx.__valueOverlay : host?.key ?? vm.databaseVM?.evaluatorIndexes ?? vm.values,
21993
22370
  revision: [
21994
- ...vm.worldQueryCache?.revision ?? vm.databaseVM?.worldQueryRevision ?? [],
21995
- vm.values,
21996
- vm.classes,
21997
- vm.members,
21998
- vm.internalRecordRelations,
21999
- vm.variants,
22000
- vm.variantFolders,
22001
- vm.schemaRevision,
22371
+ ...host?.revision ?? [
22372
+ vm.values,
22373
+ vm.classes,
22374
+ vm.members,
22375
+ vm.internalRecordRelations,
22376
+ vm.variants,
22377
+ vm.variantFolders,
22378
+ vm.schemaRevision
22379
+ ],
22002
22380
  ...overlayRevision === 0 ? [] : [ctx.__valueOverlay, overlayRevision]
22003
22381
  ],
22004
22382
  rows: vm.values,
22005
22383
  classes: vm.classes,
22006
22384
  relations: vm.internalRecordRelations ?? [],
22007
- readRow(id, reads) {
22385
+ readRow: (id, reads) => recording(reads, () => {
22008
22386
  const current = readContext(reads);
22009
22387
  const row = evalValueById(
22010
22388
  current,
@@ -22015,8 +22393,8 @@ function worldGridQueryIndexForContext(context) {
22015
22393
  if (row === null || typeof row.classId === "string") return row;
22016
22394
  const classId = classIdForValueRow(row, current);
22017
22395
  return classId === void 0 ? row : { ...row, classId };
22018
- },
22019
- readField(id, key, reads) {
22396
+ }),
22397
+ readField: (id, key, reads) => recording(reads, () => {
22020
22398
  const current = readContext(reads);
22021
22399
  const row = evalValueById(
22022
22400
  current,
@@ -22035,8 +22413,8 @@ function worldGridQueryIndexForContext(context) {
22035
22413
  thisValue: row.value,
22036
22414
  thisValueRowId: row.id
22037
22415
  });
22038
- },
22039
- valueId(value, reads) {
22416
+ }),
22417
+ valueId: (value, reads) => recording(reads, () => {
22040
22418
  const current = readContext(reads);
22041
22419
  if (typeof value === "string" && evalValueById(
22042
22420
  current,
@@ -22046,7 +22424,7 @@ function worldGridQueryIndexForContext(context) {
22046
22424
  ) !== null)
22047
22425
  return value;
22048
22426
  return trackedRowForValueReference(value, current)?.id ?? null;
22049
- }
22427
+ })
22050
22428
  });
22051
22429
  }
22052
22430
  function readSystemNativeField(value, key, ctx) {
@@ -23685,7 +24063,7 @@ function validateClassConstructorDescriptor(info, ctx, requireEveryRequiredField
23685
24063
  }
23686
24064
  const genericSlot = ctx.__constructionGenericSlots?.toReversed().find((slot) => slot.classId === classId) ?? ctx.__storedConstructionReplaySlot;
23687
24065
  const slotArguments = genericSlot?.classId === classId ? genericSlot.classArguments : void 0;
23688
- const descriptorCache = evaluatorResolutionCache(ctx).validatedConstructorDescriptorByInfo;
24066
+ const descriptorCache = evaluatorValueGeneration(ctx).constructorDescriptors;
23689
24067
  const descriptorCacheKey = `${requireEveryRequiredField}:${ctx.storedConstructionReplay === true}:${JSON.stringify(slotArguments ?? info.schemaClassInfo.typeArguments ?? null)}`;
23690
24068
  const cachedDescriptor = descriptorCache.get(info)?.get(descriptorCacheKey);
23691
24069
  if (cachedDescriptor !== void 0) return cachedDescriptor;
@@ -24303,6 +24681,8 @@ function constructClassValue(info, scope, ctx) {
24303
24681
  }
24304
24682
  }
24305
24683
  function constructorDefaultValueDocument(ctx, syntheticMember) {
24684
+ const database = ctx.vm.databaseVM;
24685
+ const entryIdsOf = database?.unorderedListEntryIds?.bind(database);
24306
24686
  return {
24307
24687
  listenerDefaultCapture: ctx.listenerDefaultCapture,
24308
24688
  beforeValueAllocation: ctx.beforeValueAllocation,
@@ -24315,11 +24695,24 @@ function constructorDefaultValueDocument(ctx, syntheticMember) {
24315
24695
  // immutable base plus its indexes avoids copying and linearly scanning
24316
24696
  // the entire project for every constructor replay.
24317
24697
  values: ctx.vm.values,
24318
- memberById: ctx.vm.databaseVM?.memberById,
24319
- valueById: ctx.vm.databaseVM?.defaultValueById ?? ctx.vm.databaseVM?.valueById,
24698
+ memberById: database?.memberById,
24699
+ // The declaration rows a default clones are reads of this evaluation.
24700
+ ...database === void 0 ? {} : {
24701
+ valueById: (id) => {
24702
+ ctx.valueDependencies?.add(id);
24703
+ return database.defaultValueById !== void 0 ? database.defaultValueById(id) : database.valueById(id);
24704
+ }
24705
+ },
24706
+ ...entryIdsOf === void 0 ? {} : {
24707
+ unorderedListEntryIds: (containerId) => {
24708
+ ctx.containerDependencies?.add(containerId);
24709
+ return entryIdsOf(containerId);
24710
+ }
24711
+ },
24320
24712
  resolvedMember: (member) => member === syntheticMember ? syntheticMember : cachedResolvedMember(member, ctx),
24321
24713
  storedInstanceSchema: (nestedClassId) => cachedStoredInstanceSchema(nestedClassId, ctx),
24322
24714
  storedInstanceMaterializationPlan: (nestedClassId, instanceEnv) => cachedStoredInstanceMaterializationPlan(nestedClassId, instanceEnv, ctx),
24715
+ recordPlanReads: (reads) => recordDeclarationReads(ctx, reads),
24323
24716
  instanceEnv: (nestedClassId, classArguments2) => cachedInstanceEnv(nestedClassId, classArguments2, ctx),
24324
24717
  isInitValueContent: (value) => cachedIsInitValueContent(value, ctx),
24325
24718
  createValueRow: (projectId, body) => buildNewValue(
@@ -27853,10 +28246,15 @@ function lookupDeclaredTypeInfo(member, collectionTypeInfo) {
27853
28246
  }
27854
28247
 
27855
28248
  // ../packages/neoscript-runtime/src/values/member-declared-type-info.ts
27856
- function resolveMemberDeclaredTypeInfo(member, members) {
27857
- return resolveMemberDeclaredTypeInfoInternal(member, members, /* @__PURE__ */ new Set());
28249
+ function resolveMemberDeclaredTypeInfo(member, members, ownerClass = null) {
28250
+ return resolveMemberDeclaredTypeInfoInternal(
28251
+ member,
28252
+ members,
28253
+ /* @__PURE__ */ new Set(),
28254
+ ownerClass
28255
+ );
27858
28256
  }
27859
- function resolveMemberDeclaredTypeInfoInternal(member, members, seen) {
28257
+ function resolveMemberDeclaredTypeInfoInternal(member, members, seen, ownerClass) {
27860
28258
  const resolved = resolveMember(member, members);
27861
28259
  const memberId = getField(resolved, "id");
27862
28260
  if (typeof memberId === "string" && seen.has(memberId)) return null;
@@ -27874,7 +28272,8 @@ function resolveMemberDeclaredTypeInfoInternal(member, members, seen) {
27874
28272
  const argumentType = resolveMemberDeclaredTypeInfoInternal(
27875
28273
  argumentMember,
27876
28274
  members,
27877
- nextSeen
28275
+ nextSeen,
28276
+ ownerClass
27878
28277
  );
27879
28278
  return argumentType === null ? [] : [[genericParamId, argumentType]];
27880
28279
  }
@@ -27940,7 +28339,8 @@ function resolveMemberDeclaredTypeInfoInternal(member, members, seen) {
27940
28339
  const entryTypeInfo = resolveMemberDeclaredTypeInfoInternal(
27941
28340
  entry,
27942
28341
  members,
27943
- nextSeen
28342
+ nextSeen,
28343
+ ownerClass
27944
28344
  );
27945
28345
  if (entryTypeInfo === null) return null;
27946
28346
  return {
@@ -27957,12 +28357,29 @@ function resolveMemberDeclaredTypeInfoInternal(member, members, seen) {
27957
28357
  if (collection === void 0) return null;
27958
28358
  return lookupDeclaredTypeInfo(
27959
28359
  resolved,
27960
- resolveMemberDeclaredTypeInfoInternal(collection, members, nextSeen)
28360
+ resolveMemberDeclaredTypeInfoInternal(
28361
+ collection,
28362
+ members,
28363
+ nextSeen,
28364
+ ownerClass
28365
+ )
27961
28366
  );
27962
28367
  }
27963
28368
  if (resolved.kind === 9 /* Lookup */) return null;
27964
28369
  if (!memberKindSupportsStorage(resolved.kind)) return null;
27965
- if (resolved.kind === 21 /* Generic */) return null;
28370
+ if (isMemberGenericBase(resolved)) {
28371
+ if (ownerClass === null) return null;
28372
+ const declaration = ownerClass.genericParams?.find(
28373
+ (parameter3) => parameter3.id === resolved.genericParamId
28374
+ );
28375
+ if (declaration === void 0) return null;
28376
+ return {
28377
+ type: 21 /* Generic */,
28378
+ required: isRequiredMember(resolved),
28379
+ ownerClassId: ownerClass.id,
28380
+ genericParamId: declaration.id
28381
+ };
28382
+ }
27966
28383
  return {
27967
28384
  type: resolved.kind,
27968
28385
  required: isRequiredMember(resolved)
@@ -30648,6 +31065,41 @@ function declarationInitializerContext(document2) {
30648
31065
  });
30649
31066
  return created;
30650
31067
  }
31068
+ var defaultValuePlansByDocument = /* @__PURE__ */ new WeakMap();
31069
+ function defaultValuePlans(document2) {
31070
+ const key = document2.databaseVM ?? initializerEvaluatorCacheKey(document2);
31071
+ const revision = initializerEvaluatorCacheRevision(document2);
31072
+ const valueGeneration = document2.databaseVM?.valueGeneration;
31073
+ const cached = defaultValuePlansByDocument.get(key);
31074
+ if (cached !== void 0 && (revision === void 0 ? cached.members === document2.members && cached.classes === document2.classes && cached.values === document2.values && cached.constructors === document2.constructors : cached.revision === revision && cached.valueGeneration === valueGeneration)) {
31075
+ return cached.plans;
31076
+ }
31077
+ const lookups = initializerEvaluatorLookups(document2);
31078
+ const plans = withIndexedDefaultValueDocument({
31079
+ project: document2.project,
31080
+ members: document2.members,
31081
+ classes: document2.classes,
31082
+ enums: document2.enums,
31083
+ values: document2.values,
31084
+ constructors: document2.constructors,
31085
+ projectFiles: document2.projectFiles,
31086
+ textureTemplates: document2.textureTemplates,
31087
+ memberById: lookups.memberById,
31088
+ valueById: lookups.defaultValueById ?? lookups.valueById,
31089
+ // A host database without list membership falls back to `values`.
31090
+ unorderedListEntryIds: document2.databaseVM?.unorderedListEntryIds === void 0 && document2.databaseVM !== void 0 ? void 0 : lookups.unorderedListEntryIds
31091
+ });
31092
+ defaultValuePlansByDocument.set(key, {
31093
+ members: document2.members,
31094
+ classes: document2.classes,
31095
+ values: document2.values,
31096
+ constructors: document2.constructors,
31097
+ revision,
31098
+ valueGeneration,
31099
+ plans
31100
+ });
31101
+ return plans;
31102
+ }
30651
31103
  function evaluateInitializerMaterialization(args) {
30652
31104
  const createdValues = [];
30653
31105
  const storageKeyDeclarations = /* @__PURE__ */ new Map();
@@ -30755,9 +31207,6 @@ function materializeInitializerValue(args) {
30755
31207
  function materializeMemberDefaultValue(args) {
30756
31208
  const createdValues = [];
30757
31209
  const storageKeyDeclarations = /* @__PURE__ */ new Map();
30758
- args.readTracking?.recordUnattributableValueRead(
30759
- ownershipChainRead("declaration-owner-resolution", args.envelope.id)
30760
- );
30761
31210
  const declarationArguments = (member, init, sourceValueId) => {
30762
31211
  const { valuesById, rootOwners } = declarationInitializerContext(
30763
31212
  args.document
@@ -30766,7 +31215,8 @@ function materializeMemberDefaultValue(args) {
30766
31215
  args.document,
30767
31216
  sourceValueId,
30768
31217
  rootOwners,
30769
- valuesById
31218
+ valuesById,
31219
+ (id) => args.readTracking?.valueIds.add(id)
30770
31220
  ).ownerClass : typeof Reflect.get(member, "id") === "string" ? findSchemaPlacement(
30771
31221
  String(Reflect.get(member, "id")),
30772
31222
  args.document.classes
@@ -30788,15 +31238,38 @@ function materializeMemberDefaultValue(args) {
30788
31238
  );
30789
31239
  };
30790
31240
  let lookups;
31241
+ const evaluatorLookups = () => lookups ??= initializerEvaluatorLookups(args.document, args.readTracking);
31242
+ const plans = args.readTracking !== void 0 && args.document.databaseVM === void 0 ? void 0 : defaultValuePlans(args.document);
30791
31243
  const built = buildDefaultMemberValue({
30792
31244
  document: {
30793
31245
  ...args.document,
31246
+ // The declaration rows a default clones are reads of this
31247
+ // materialization, like any row its initializers read.
30794
31248
  valueById: (id) => {
30795
- lookups ??= initializerEvaluatorLookups(
30796
- args.document,
30797
- args.readTracking
30798
- );
30799
- return (lookups.defaultValueById ?? lookups.valueById)(id);
31249
+ args.readTracking?.valueIds.add(id);
31250
+ const database = evaluatorLookups();
31251
+ return database.defaultValueById !== void 0 ? database.defaultValueById(id) : database.valueById(id);
31252
+ },
31253
+ unorderedListEntryIds: (containerId) => {
31254
+ args.readTracking?.containerIds.add(containerId);
31255
+ const entryIds = evaluatorLookups().unorderedListEntryIds?.(containerId);
31256
+ if (entryIds === void 0) {
31257
+ throw new Error(
31258
+ `Initializer lookups resolve no unordered-list membership for container "${containerId}".`
31259
+ );
31260
+ }
31261
+ return entryIds;
31262
+ },
31263
+ // Not `resolvedMember`: its id-keyed cache would answer for the
31264
+ // caller's rewritten copy of a member with the stored original.
31265
+ ...plans === void 0 ? {} : {
31266
+ instanceEnv: plans.instanceEnv,
31267
+ storedInstanceMaterializationPlan: plans.storedInstanceMaterializationPlan
31268
+ },
31269
+ recordPlanReads: (reads) => {
31270
+ for (const id of reads.valueIds) args.readTracking?.valueIds.add(id);
31271
+ for (const id of reads.containerIds)
31272
+ args.readTracking?.containerIds.add(id);
30800
31273
  }
30801
31274
  },
30802
31275
  projectId: args.envelope.projectId,
@@ -30875,10 +31348,6 @@ function buildVirtualInstanceMaterializedIndex(args) {
30875
31348
  })
30876
31349
  };
30877
31350
  }
30878
- var CORPUS_SCANNING_MEMBER_KINDS = /* @__PURE__ */ new Set([
30879
- 9 /* Lookup */,
30880
- 18 /* DialogueLookup */
30881
- ]);
30882
31351
  function derivesContentFromMemberDefault(args) {
30883
31352
  const member = args.member;
30884
31353
  if (!isMemberClassBase(member)) return false;
@@ -30942,43 +31411,50 @@ var VirtualExpansionUnsupportedError = class extends Error {
30942
31411
  this.name = "VirtualExpansionUnsupportedError";
30943
31412
  }
30944
31413
  };
30945
- function expandStoredInstance(args) {
30946
- const recorder = args.readRecorder ?? null;
30947
- const readTracking = recorder === null ? void 0 : new InitializerReadSet();
30948
- const trackMaterialization = readTracking === void 0 ? (materialize) => materialize() : (materialize) => {
31414
+ function materializationReadTracking(recorder) {
31415
+ if (recorder === void 0)
31416
+ return { readTracking: void 0, trackMaterialization: (m) => m() };
31417
+ const readTracking = new InitializerReadSet();
31418
+ const trackMaterialization = (materialize) => {
30949
31419
  try {
30950
31420
  return materialize();
30951
31421
  } finally {
30952
31422
  for (const valueId of readTracking.valueIds) {
30953
- recorder?.recordValueRead(valueId);
31423
+ recorder.recordValueRead(valueId);
30954
31424
  }
30955
31425
  for (const textId of readTracking.localizedTextIds) {
30956
- recorder?.recordLocalizedTextRead(textId);
31426
+ recorder.recordLocalizedTextRead(textId);
30957
31427
  }
30958
31428
  for (const variantId of readTracking.variantIds) {
30959
- recorder?.recordVariantRead(variantId);
31429
+ recorder.recordVariantRead(variantId);
30960
31430
  }
30961
31431
  for (const memberId of readTracking.staticMemberIds) {
30962
- recorder?.recordStaticMemberRead(memberId);
31432
+ recorder.recordStaticMemberRead(memberId);
30963
31433
  }
30964
31434
  for (const containerId of readTracking.containerIds) {
30965
- recorder?.recordContainerMembershipRead(containerId);
31435
+ recorder.recordContainerMembershipRead(containerId);
30966
31436
  }
30967
31437
  for (const read of readTracking.worldQueries) {
30968
- recorder?.recordWorldQueryRead?.(read);
31438
+ recorder.recordWorldQueryRead?.(read);
30969
31439
  }
30970
- if (readTracking.hasOwnershipChainRead) {
30971
- recorder?.recordGlobalRead(OWNERSHIP_CHAIN_READ);
31440
+ if (readTracking.hasValuePlacementRead) {
31441
+ recorder.recordValuePlacementRead();
30972
31442
  }
30973
31443
  for (const containerId of readTracking.containerEntryReadIds) {
30974
- recorder?.recordGlobalRead(containerEntriesRead(containerId));
31444
+ recorder.recordContainerMembershipRead(containerId);
30975
31445
  }
30976
31446
  for (const reason of readTracking.corpusReadReasons) {
30977
- recorder?.recordGlobalRead(reason);
31447
+ recorder.recordGlobalRead(reason);
30978
31448
  }
30979
31449
  }
30980
31450
  };
30981
- recorder?.recordValueRead(args.instanceRoot.id);
31451
+ return { readTracking, trackMaterialization };
31452
+ }
31453
+ function expandStoredInstance(args) {
31454
+ const { readTracking, trackMaterialization } = materializationReadTracking(
31455
+ args.readRecorder
31456
+ );
31457
+ args.readRecorder?.recordValueRead(args.instanceRoot.id);
30982
31458
  const rootMember = resolveMember(args.rootMember, args.document.members);
30983
31459
  if (!isMemberClassBase(rootMember)) {
30984
31460
  throw new Error(
@@ -31014,11 +31490,6 @@ function expandStoredInstance(args) {
31014
31490
  `Virtual expansion root "${args.instanceRoot.id}" is missing required constructor arguments.`
31015
31491
  );
31016
31492
  }
31017
- const constructorArguments = storedConstructorReplayArguments(
31018
- requiredConstructor,
31019
- storedArgs,
31020
- instanceRoot.id
31021
- );
31022
31493
  const {
31023
31494
  value: _value,
31024
31495
  classId: _classId,
@@ -31039,6 +31510,34 @@ function expandStoredInstance(args) {
31039
31510
  instanceRoot
31040
31511
  );
31041
31512
  const replayMember = closedRootMember === rootMember ? rootMember : { ...closedRootMember, classId };
31513
+ let environment;
31514
+ const constructorArguments = storedConstructorReplayArguments(
31515
+ requiredConstructor === null ? null : {
31516
+ ...requiredConstructor,
31517
+ argumentTypes: requiredConstructor.argumentTypes.map((argument2) => {
31518
+ if (argument2.type !== 21 /* Generic */) return argument2;
31519
+ environment ??= resolveInstanceEnv(
31520
+ classId,
31521
+ replayMember.classArguments,
31522
+ args.document.classes
31523
+ );
31524
+ const type = substituteInheritedCallableTypeInfo(
31525
+ argument2,
31526
+ environment,
31527
+ args.document.classes,
31528
+ args.document.members
31529
+ );
31530
+ if (type.type === NS_TYPE_VOID) {
31531
+ throw new Error(
31532
+ `Constructor parameter "${argument2.name}" on "${classId}" cannot have type void.`
31533
+ );
31534
+ }
31535
+ return { ...type, name: argument2.name };
31536
+ })
31537
+ },
31538
+ storedArgs,
31539
+ instanceRoot.id
31540
+ );
31042
31541
  const replay = (fields) => {
31043
31542
  const init = storedConstructorReplayInitializer({
31044
31543
  classId,
@@ -31103,11 +31602,7 @@ function expandStoredInstance(args) {
31103
31602
  function resolveVirtualInstanceGraph(args) {
31104
31603
  const expansion = args.expansionIndex ?? indexExpansion(args);
31105
31604
  const recorder = args.readRecorder ?? null;
31106
- if (recorder !== null) {
31107
- recorder.recordValueRead(args.instanceRoot.id);
31108
- const unattributable = firstUnattributableExpansionMember(expansion);
31109
- if (unattributable !== null) recorder.recordGlobalRead(unattributable);
31110
- }
31605
+ recorder?.recordValueRead(args.instanceRoot.id);
31111
31606
  const materializedById = args.materializedIndex?.rowsById ?? new Map(
31112
31607
  (args.materializedRows ?? args.document.values).map((row) => [
31113
31608
  row.id,
@@ -31662,15 +32157,6 @@ function mergeExpandedAndMaterializedRow(expanded, materialized) {
31662
32157
  if (merged.sourceValueId === materialized.id) delete merged.sourceValueId;
31663
32158
  return merged;
31664
32159
  }
31665
- function firstUnattributableExpansionMember(expansion) {
31666
- for (const node of expansion.nodesByPath.values()) {
31667
- const member = node.member;
31668
- if (CORPUS_SCANNING_MEMBER_KINDS.has(member.kind)) {
31669
- return `corpus-scanning-member-kind:${node.memberId}`;
31670
- }
31671
- }
31672
- return null;
31673
- }
31674
32160
  function prepareStoredClassValueResolution(args) {
31675
32161
  let listenerDefaults;
31676
32162
  let copiedListeners;
@@ -31682,9 +32168,10 @@ function prepareStoredClassValueResolution(args) {
31682
32168
  ...args.document,
31683
32169
  // Construction checks share the existing schema index across every nested default.
31684
32170
  memberById: args.document.memberById ?? ((id) => schema.member(id) ?? null),
31685
- evaluatorCache: {
31686
- key: initializerEvaluatorCacheKey(args.document),
31687
- revision: initializerEvaluatorCacheRevision(args.document)
32171
+ // The same rows under a fresh object: share its evaluator caches.
32172
+ evaluatorCache: args.document.evaluatorCache ?? {
32173
+ key: args.document,
32174
+ revision: void 0
31688
32175
  },
31689
32176
  listenerDefaultCapture: {
31690
32177
  begin: () => {
@@ -31760,27 +32247,32 @@ function expandStoredClassValue(args) {
31760
32247
  }
31761
32248
  const classId = root.classId ?? member.classId;
31762
32249
  args.readRecorder?.recordValueRead(root.id);
31763
- args.readRecorder?.recordGlobalRead("declaration-default");
31764
- const materialized = materializeMemberDefaultValue({
31765
- saveStaticBindings: args.saveStaticBindings,
31766
- sessionStaticBindings: args.sessionStaticBindings,
31767
- evaluateInitializer: args.evaluateInitializer,
31768
- document: args.document,
31769
- member: closeClassArgumentsFromRowStamp(
31770
- {
31771
- ...member,
31772
- classId,
31773
- defaultValue: derivesContentFromMemberDefault({
31774
- member,
31775
- instanceRoot: root,
31776
- effectiveClassId: classId
31777
- }) ? member.defaultValue : void 0
31778
- },
31779
- root
31780
- ),
31781
- envelope: root,
31782
- declarationRoot: true
31783
- });
32250
+ const { readTracking, trackMaterialization } = materializationReadTracking(
32251
+ args.readRecorder
32252
+ );
32253
+ const materialized = trackMaterialization(
32254
+ () => materializeMemberDefaultValue({
32255
+ ...readTracking === void 0 ? {} : { readTracking },
32256
+ saveStaticBindings: args.saveStaticBindings,
32257
+ sessionStaticBindings: args.sessionStaticBindings,
32258
+ evaluateInitializer: args.evaluateInitializer,
32259
+ document: args.document,
32260
+ member: closeClassArgumentsFromRowStamp(
32261
+ {
32262
+ ...member,
32263
+ classId,
32264
+ defaultValue: derivesContentFromMemberDefault({
32265
+ member,
32266
+ instanceRoot: root,
32267
+ effectiveClassId: classId
32268
+ }) ? member.defaultValue : void 0
32269
+ },
32270
+ root
32271
+ ),
32272
+ envelope: root,
32273
+ declarationRoot: true
32274
+ })
32275
+ );
31784
32276
  return {
31785
32277
  root: { ...root, classId, value: materialized.root.value },
31786
32278
  rows: materialized.createdValues,
@@ -32535,6 +33027,17 @@ function variantSwapDeclaredMember(document2, rootValueId) {
32535
33027
  if (placement === void 0) return void 0;
32536
33028
  return document2.members.find((member) => member.id === placement.memberId);
32537
33029
  }
33030
+ function emptyExpansionReads() {
33031
+ return {
33032
+ valueIds: /* @__PURE__ */ new Set(),
33033
+ containerIds: /* @__PURE__ */ new Set(),
33034
+ localizedTextIds: /* @__PURE__ */ new Set(),
33035
+ variantIds: /* @__PURE__ */ new Set(),
33036
+ staticMemberIds: /* @__PURE__ */ new Set(),
33037
+ global: false,
33038
+ merged: /* @__PURE__ */ new WeakSet()
33039
+ };
33040
+ }
32538
33041
  function createHeadlessVirtualInstanceResolver(args) {
32539
33042
  const { document: document2 } = args;
32540
33043
  const membersById = args.membersById ?? new Map(document2.members.map((member) => [member.id, member]));
@@ -32558,16 +33061,22 @@ function createHeadlessVirtualInstanceResolver(args) {
32558
33061
  const emptyRows = [];
32559
33062
  const graphByValueId = /* @__PURE__ */ new Map();
32560
33063
  const failedRootIds = /* @__PURE__ */ new Set();
33064
+ const expandingRootIds = /* @__PURE__ */ new Set();
32561
33065
  const expandedRowById = /* @__PURE__ */ new Map();
32562
33066
  const expandedRowByRecord = /* @__PURE__ */ new WeakMap();
32563
33067
  const readsByRootId = /* @__PURE__ */ new Map();
32564
33068
  const activeReads = [];
32565
33069
  const sharedByReceiverId = /* @__PURE__ */ new Map();
33070
+ const callerReads = /* @__PURE__ */ new WeakMap();
32566
33071
  const mergeReads = (reads) => {
32567
33072
  for (const active of activeReads) {
32568
- if (active === reads) continue;
33073
+ if (active === reads || active.merged.has(reads)) continue;
33074
+ active.merged.add(reads);
32569
33075
  for (const id of reads.valueIds) active.valueIds.add(id);
32570
33076
  for (const id of reads.containerIds) active.containerIds.add(id);
33077
+ for (const id of reads.localizedTextIds) active.localizedTextIds.add(id);
33078
+ for (const id of reads.variantIds) active.variantIds.add(id);
33079
+ for (const id of reads.staticMemberIds) active.staticMemberIds.add(id);
32571
33080
  if (reads.global) active.global = true;
32572
33081
  }
32573
33082
  };
@@ -32576,9 +33085,18 @@ function createHeadlessVirtualInstanceResolver(args) {
32576
33085
  for (const active of activeReads) active.valueIds.add(id);
32577
33086
  args.readRecorder?.recordValueRead(id);
32578
33087
  },
32579
- recordLocalizedTextRead: (id) => args.readRecorder?.recordLocalizedTextRead(id),
32580
- recordVariantRead: (id) => args.readRecorder?.recordVariantRead(id),
32581
- recordStaticMemberRead: (id) => args.readRecorder?.recordStaticMemberRead(id),
33088
+ recordLocalizedTextRead: (id) => {
33089
+ for (const active of activeReads) active.localizedTextIds.add(id);
33090
+ args.readRecorder?.recordLocalizedTextRead(id);
33091
+ },
33092
+ recordVariantRead: (id) => {
33093
+ for (const active of activeReads) active.variantIds.add(id);
33094
+ args.readRecorder?.recordVariantRead(id);
33095
+ },
33096
+ recordStaticMemberRead: (id) => {
33097
+ for (const active of activeReads) active.staticMemberIds.add(id);
33098
+ args.readRecorder?.recordStaticMemberRead(id);
33099
+ },
32582
33100
  recordContainerMembershipRead: (id) => {
32583
33101
  for (const active of activeReads) active.containerIds.add(id);
32584
33102
  args.readRecorder?.recordContainerMembershipRead(id);
@@ -32624,6 +33142,7 @@ function createHeadlessVirtualInstanceResolver(args) {
32624
33142
  if (reads2 !== void 0) mergeReads(reads2);
32625
33143
  return cached;
32626
33144
  }
33145
+ if (expandingRootIds.has(rootId)) return emptyRows;
32627
33146
  if (failedRootIds.has(rootId)) return emptyRows;
32628
33147
  const instanceRoot = rawById.get(rootId);
32629
33148
  if (instanceRoot === void 0 || declaredMember === void 0) {
@@ -32639,12 +33158,9 @@ function createHeadlessVirtualInstanceResolver(args) {
32639
33158
  failedRootIds.add(rootId);
32640
33159
  return emptyRows;
32641
33160
  }
32642
- const reads = {
32643
- valueIds: /* @__PURE__ */ new Set(),
32644
- containerIds: /* @__PURE__ */ new Set(),
32645
- global: false
32646
- };
33161
+ const reads = emptyExpansionReads();
32647
33162
  activeReads.push(reads);
33163
+ expandingRootIds.add(rootId);
32648
33164
  try {
32649
33165
  const resolverDocument = resolverDocumentOnce();
32650
33166
  materializedIndex ??= buildVirtualInstanceMaterializedIndex({
@@ -32668,6 +33184,7 @@ function createHeadlessVirtualInstanceResolver(args) {
32668
33184
  failedRootIds.add(rootId);
32669
33185
  return emptyRows;
32670
33186
  } finally {
33187
+ expandingRootIds.delete(rootId);
32671
33188
  activeReads.pop();
32672
33189
  mergeReads(reads);
32673
33190
  }
@@ -32686,9 +33203,15 @@ function createHeadlessVirtualInstanceResolver(args) {
32686
33203
  share.containerChanged
32687
33204
  );
32688
33205
  if (shared === null) return null;
33206
+ recorder.recordValuePlacementRead();
32689
33207
  for (const id of shared.reads.valueIds) recorder.recordValueRead(id);
32690
33208
  for (const id of shared.reads.containerIds)
32691
33209
  recorder.recordContainerMembershipRead(id);
33210
+ for (const id of shared.reads.localizedTextIds)
33211
+ recorder.recordLocalizedTextRead(id);
33212
+ for (const id of shared.reads.variantIds) recorder.recordVariantRead(id);
33213
+ for (const id of shared.reads.staticMemberIds)
33214
+ recorder.recordStaticMemberRead(id);
32692
33215
  if (graphRowsByRootId.get(shared.graph.instanceRootId) === void 0) {
32693
33216
  readsByRootId.set(shared.graph.instanceRootId, shared.reads);
32694
33217
  remember(shared.graph, shared.rows);
@@ -32732,7 +33255,16 @@ function createHeadlessVirtualInstanceResolver(args) {
32732
33255
  return graph?.instanceRootId === rootId ? graph : null;
32733
33256
  },
32734
33257
  virtualInstanceRowsForValue,
32735
- valueById: (id) => expandedRowById.get(id) ?? null,
33258
+ valueById: (id) => {
33259
+ const row = expandedRowById.get(id);
33260
+ if (row === void 0) return null;
33261
+ if (activeReads.length > 0) {
33262
+ const rootId = graphByValueId.get(id)?.instanceRootId;
33263
+ const reads = rootId === void 0 ? void 0 : readsByRootId.get(rootId);
33264
+ if (reads !== void 0) mergeReads(reads);
33265
+ }
33266
+ return row;
33267
+ },
32736
33268
  rowForValueReference: (value) => expandedRowByRecord.get(value) ?? null,
32737
33269
  virtualInstanceGraphForValue: (valueId) => {
32738
33270
  const known = graphByValueId.get(valueId);
@@ -32744,11 +33276,7 @@ function createHeadlessVirtualInstanceResolver(args) {
32744
33276
  return graphByValueId.get(valueId) ?? null;
32745
33277
  },
32746
33278
  shareExpansion: (receiverValueId, masked, containerChanged) => {
32747
- const reads = {
32748
- valueIds: /* @__PURE__ */ new Set(),
32749
- containerIds: /* @__PURE__ */ new Set(),
32750
- global: false
32751
- };
33279
+ const reads = emptyExpansionReads();
32752
33280
  activeReads.push(reads);
32753
33281
  let rows;
32754
33282
  try {
@@ -32769,6 +33297,29 @@ function createHeadlessVirtualInstanceResolver(args) {
32769
33297
  );
32770
33298
  }
32771
33299
  return { graph, rows, reads };
33300
+ },
33301
+ recordReads: (target, read) => {
33302
+ let reads = callerReads.get(target);
33303
+ if (reads === void 0) {
33304
+ reads = {
33305
+ valueIds: target.valueIds,
33306
+ containerIds: target.containerIds,
33307
+ localizedTextIds: target.localizedTextIds,
33308
+ variantIds: target.variantIds,
33309
+ staticMemberIds: target.staticMemberIds,
33310
+ global: false,
33311
+ merged: /* @__PURE__ */ new WeakSet()
33312
+ };
33313
+ callerReads.set(target, reads);
33314
+ }
33315
+ activeReads.push(reads);
33316
+ try {
33317
+ return read();
33318
+ } finally {
33319
+ activeReads.pop();
33320
+ if (reads.global)
33321
+ target.recordUnattributableValueRead("virtual-instance-expansion");
33322
+ }
32772
33323
  }
32773
33324
  };
32774
33325
  }
@@ -32818,6 +33369,10 @@ function initializerEvaluatorLookups(document2, readTracking) {
32818
33369
  ...databaseVM.changeListenerDefaultsForOwner === void 0 ? {} : {
32819
33370
  changeListenerDefaultsForOwner: (id) => databaseVM.changeListenerDefaultsForOwner(id)
32820
33371
  },
33372
+ // Read live: this wrapper outlives a scalar's nullness change.
33373
+ get valueGeneration() {
33374
+ return databaseVM.valueGeneration;
33375
+ },
32821
33376
  memberById: (id) => databaseVM.memberById(id),
32822
33377
  valueById: (id) => databaseVM.valueById(id),
32823
33378
  defaultValueById: (id) => databaseVM.defaultValueById?.(id) ?? databaseVM.valueById(id),
@@ -32844,6 +33399,7 @@ function initializerEvaluatorLookups(document2, readTracking) {
32844
33399
  return resolved;
32845
33400
  },
32846
33401
  virtualInstanceRowsForValue: (receiverValueId) => databaseVM.virtualInstanceRowsForValue(receiverValueId),
33402
+ ...databaseVM.worldGridQueryIndex === void 0 ? {} : { worldGridQueryIndex: () => databaseVM.worldGridQueryIndex() },
32847
33403
  rowForValueReference: (value) => databaseVM.rowForValueReference?.(value) ?? null,
32848
33404
  resolveVariantInstanceGraph: (args) => {
32849
33405
  const resolver = databaseVM.resolveVariantInstanceGraph;
@@ -32872,88 +33428,45 @@ function initializerEvaluatorLookups(document2, readTracking) {
32872
33428
  indexKey,
32873
33429
  revision
32874
33430
  );
32875
- const shareFrom = document2.databaseVM === void 0 && document2.evaluatorOverlay !== void 0 ? sharedHeadlessResolver(document2.evaluatorOverlay) : void 0;
33431
+ const shareFrom = document2.evaluatorOverlay === void 0 ? void 0 : sharedHeadlessResolver(document2.evaluatorOverlay);
32876
33432
  let hasListenerMetadata;
32877
- const headlessVirtualResolver = document2.databaseVM === void 0 ? createHeadlessVirtualInstanceResolver({
33433
+ const headlessVirtualResolver = createHeadlessVirtualInstanceResolver({
32878
33434
  evaluateInitializer: evaluateMemberInitializer,
32879
33435
  document: document2,
32880
33436
  resolverLookups: () => lookups,
32881
33437
  ...shareFrom === void 0 ? {} : { shareFrom },
32882
33438
  ...readTracking === void 0 ? {} : { readRecorder: virtualReadRecorder(readTracking) }
32883
- }) : null;
33439
+ });
32884
33440
  const lookups = {
32885
33441
  ...indexedLookups,
32886
- ...document2.databaseVM === void 0 && headlessVirtualResolver !== null ? {
32887
- changeListenerDefaultsForOwner: (id) => {
32888
- if (!(hasListenerMetadata ??= hasAuthoredChangeListenerMetadata(document2)))
32889
- return void 0;
32890
- const inherited = headlessVirtualResolver.virtualInstanceGraphForValue(id)?.listenerDefaultsByOwner?.get(id);
32891
- const authored = authoredChangeListenerOwners(document2.values).get(
32892
- id
32893
- );
32894
- return inherited === void 0 ? authored : { ...inherited, ...authored };
32895
- },
32896
- defaultValueById: (id) => declarationDefaultSource(
32897
- id,
32898
- indexedLookups.valueById(id),
32899
- headlessVirtualResolver.virtualInstanceGraphForValue
32900
- ),
32901
- valueById: (id) => indexedLookups.valueById(id) ?? headlessVirtualResolver.valueById(id),
32902
- rowForValueReference: (value) => indexedLookups.rowForValueReference?.(value) ?? headlessVirtualResolver.rowForValueReference(value),
32903
- virtualInstanceRowsForValue: (receiverValueId) => headlessVirtualResolver.virtualInstanceRowsForValue(
32904
- receiverValueId
32905
- ),
32906
- // Headless hosts still evaluate `ToVariant` during
32907
- // stored-construction replay — production's variant-constructed
32908
- // placements collapse through exactly this path. The shared core
32909
- // resolves against the plain document, with these lookups as the
32910
- // nested resolver.
32911
- resolveVariantInstanceGraph: (args) => resolveVariantInstanceGraphForDocument({
32912
- evaluateInitializer: evaluateMemberInitializer,
32913
- document: document2,
32914
- resolverLookups: lookups,
32915
- ...readTracking === void 0 ? {} : { readRecorder: virtualReadRecorder(readTracking) },
32916
- ...args
32917
- })
32918
- } : {
32919
- get worldQueryRevision() {
32920
- return document2.databaseVM?.worldQueryRevision;
32921
- },
32922
- memberById: (id) => document2.databaseVM?.memberById(id) ?? null,
32923
- valueById: (id) => document2.databaseVM?.valueById(id) ?? null,
32924
- variantById: (id) => document2.databaseVM?.variantById?.(id) ?? null,
32925
- // The VM's `valueById` answers EXPANDED-first: a collapse-stamped
32926
- // root resolves to a record the VM minted, an object the raw value
32927
- // index has never seen. Reference-identity dispatch (`.Id`, `is`,
32928
- // lookup selection) must reach the VM's reverse map for those
32929
- // records — dropping to the raw index alone made every lookup
32930
- // variant's initializer report "produced a value with no backing
32931
- // row" once P75 expansion started succeeding.
32932
- rowForValueReference: (value) => indexedLookups.rowForValueReference?.(value) ?? document2.databaseVM?.rowForValueReference?.(value) ?? null,
32933
- unorderedListEntryIds: (containerValueId) => {
32934
- const resolved = document2.databaseVM?.unorderedListEntryIds?.(containerValueId) ?? indexedLookups.unorderedListEntryIds?.(containerValueId);
32935
- if (resolved === void 0) {
32936
- throw new Error(
32937
- `Evaluator database resolves no unordered-list membership for container "${containerValueId}".`
32938
- );
32939
- }
32940
- return resolved;
32941
- },
32942
- virtualInstanceRowsForValue: (receiverValueId) => {
32943
- const databaseVM = document2.databaseVM;
32944
- if (databaseVM === void 0) return [];
32945
- return databaseVM.virtualInstanceRowsForValue(receiverValueId);
32946
- },
32947
- resolveVariantInstanceGraph: (args) => {
32948
- const resolver = document2.databaseVM?.resolveVariantInstanceGraph;
32949
- if (resolver === void 0) {
32950
- throw new Error(
32951
- "Evaluator database has no virtual variant resolver."
32952
- );
32953
- }
32954
- return resolver.call(document2.databaseVM, args);
32955
- }
32956
- }
33442
+ changeListenerDefaultsForOwner: (id) => {
33443
+ if (!(hasListenerMetadata ??= hasAuthoredChangeListenerMetadata(document2)))
33444
+ return void 0;
33445
+ const inherited = headlessVirtualResolver.virtualInstanceGraphForValue(id)?.listenerDefaultsByOwner?.get(id);
33446
+ const authored = authoredChangeListenerOwners(document2.values).get(id);
33447
+ return inherited === void 0 ? authored : { ...inherited, ...authored };
33448
+ },
33449
+ defaultValueById: (id) => declarationDefaultSource(
33450
+ id,
33451
+ indexedLookups.valueById(id),
33452
+ headlessVirtualResolver.virtualInstanceGraphForValue
33453
+ ),
33454
+ valueById: (id) => indexedLookups.valueById(id) ?? headlessVirtualResolver.valueById(id),
33455
+ rowForValueReference: (value) => indexedLookups.rowForValueReference?.(value) ?? headlessVirtualResolver.rowForValueReference(value),
33456
+ virtualInstanceRowsForValue: (receiverValueId) => headlessVirtualResolver.virtualInstanceRowsForValue(receiverValueId),
33457
+ recordVirtualInstanceReads: (reads, read) => headlessVirtualResolver.recordReads(reads, read),
33458
+ // Headless hosts still evaluate `ToVariant` during
33459
+ // stored-construction replay — production's variant-constructed
33460
+ // placements collapse through exactly this path. The shared core
33461
+ // resolves against the plain document, with these lookups as the
33462
+ // nested resolver.
33463
+ resolveVariantInstanceGraph: (args) => resolveVariantInstanceGraphForDocument({
33464
+ evaluateInitializer: evaluateMemberInitializer,
33465
+ document: document2,
33466
+ resolverLookups: lookups,
33467
+ ...readTracking === void 0 ? {} : { readRecorder: virtualReadRecorder(readTracking) },
33468
+ ...args
33469
+ })
32957
33470
  };
32958
33471
  if (!trackedHeadless) {
32959
33472
  evaluatorLookupsByDocument.set(lookupKey, {
@@ -32962,8 +33475,7 @@ function initializerEvaluatorLookups(document2, readTracking) {
32962
33475
  revision,
32963
33476
  lookups
32964
33477
  });
32965
- if (headlessVirtualResolver !== null)
32966
- headlessResolversByLookupKey.set(lookupKey, headlessVirtualResolver);
33478
+ headlessResolversByLookupKey.set(lookupKey, headlessVirtualResolver);
32967
33479
  }
32968
33480
  return lookups;
32969
33481
  }
@@ -33283,53 +33795,6 @@ function memoizeFrozenJsonGuard(isValid) {
33283
33795
  };
33284
33796
  }
33285
33797
 
33286
- // ../packages/manifest/src/value-comparison.ts
33287
- function isObjectRecord(value) {
33288
- return typeof value === "object" && value !== null && !Array.isArray(value);
33289
- }
33290
-
33291
- // ../packages/neoscript-runtime/src/values/canonical-json.ts
33292
- function canonicalJsonStringify(value) {
33293
- return JSON.stringify(toCanonicalJsonValue(value));
33294
- }
33295
- function toCanonicalJsonValue(value) {
33296
- if (value === null) return null;
33297
- if (value === void 0) return void 0;
33298
- if (value instanceof Date) return value.toISOString();
33299
- if (typeof value === "string") return value;
33300
- if (typeof value === "boolean") return value;
33301
- if (typeof value === "number") {
33302
- if (!Number.isFinite(value)) {
33303
- throw new Error("Cannot canonicalize a non-finite number.");
33304
- }
33305
- return value;
33306
- }
33307
- if (typeof value === "bigint") {
33308
- throw new Error("Cannot canonicalize bigint values.");
33309
- }
33310
- if (typeof value === "symbol") {
33311
- throw new Error("Cannot canonicalize symbol values.");
33312
- }
33313
- if (typeof value === "function") {
33314
- throw new Error("Cannot canonicalize function values.");
33315
- }
33316
- if (Array.isArray(value)) {
33317
- return value.map((item) => {
33318
- const canonicalItem = toCanonicalJsonValue(item);
33319
- if (canonicalItem === void 0) return null;
33320
- return canonicalItem;
33321
- });
33322
- }
33323
- const entries = Object.entries(value).sort(([a], [b]) => a.localeCompare(b));
33324
- const canonicalObject = {};
33325
- for (const [key, entryValue] of entries) {
33326
- const canonicalValue = toCanonicalJsonValue(entryValue);
33327
- if (canonicalValue === void 0) continue;
33328
- canonicalObject[key] = canonicalValue;
33329
- }
33330
- return canonicalObject;
33331
- }
33332
-
33333
33798
  // ../packages/neoscript-language/src/syntax-index.ts
33334
33799
  var OPEN_TO_CLOSE = /* @__PURE__ */ new Map([
33335
33800
  ["(", ")"],
@@ -40272,7 +40737,10 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
40272
40737
  const resolved = this.resolveIdentifier(callee.name, scope, callee.pos);
40273
40738
  return resolved.type.kind === "delegate" || resolved.type.kind === "action" ? resolved : null;
40274
40739
  }
40275
- if (callee.kind !== "member") return null;
40740
+ if (callee.kind !== "member") {
40741
+ const resolved = this.resolveExpression(callee, scope);
40742
+ return resolved.type.kind === "delegate" ? resolved : null;
40743
+ }
40276
40744
  try {
40277
40745
  const resolved = this.resolveMember(
40278
40746
  callee.receiver,
@@ -48910,6 +49378,8 @@ function compileDelegateClosureValue(code, signature) {
48910
49378
  variants: [...signature.variants ?? []],
48911
49379
  variantFolders: [...signature.variantFolders ?? []],
48912
49380
  thisClass: signature.thisClass,
49381
+ implicitMemberAccess: true,
49382
+ staticMember: signature.staticMember,
48913
49383
  returnTypeInfo: {
48914
49384
  type: 25 /* NSDelegate */,
48915
49385
  required: true,
@@ -48979,7 +49449,11 @@ function compileMemberInitializerBody(args) {
48979
49449
  );
48980
49450
  }
48981
49451
  const members = replaceMember(args.members, args.member);
48982
- const returnTypeInfo = resolveMemberDeclaredTypeInfo(args.member, members) ?? initializerGenericTypeInfo(args.member, args.thisClass);
49452
+ const returnTypeInfo = resolveMemberDeclaredTypeInfo(
49453
+ args.member,
49454
+ members,
49455
+ args.thisClass
49456
+ );
48983
49457
  if (returnTypeInfo === null) {
48984
49458
  throw new Error(
48985
49459
  `Member "${args.member.name}" has an initializer but no resolvable declared type.`
@@ -49013,19 +49487,6 @@ function compileMemberInitializerBody(args) {
49013
49487
  }
49014
49488
  Object.assign(defaultValue.init, { compiled });
49015
49489
  }
49016
- function initializerGenericTypeInfo(member, ownerClass) {
49017
- if (!isMemberGenericBase(member) || ownerClass === null) return null;
49018
- const declaration = ownerClass.genericParams?.find(
49019
- (parameter3) => parameter3.id === member.genericParamId
49020
- );
49021
- if (declaration === void 0) return null;
49022
- return {
49023
- type: 21 /* Generic */,
49024
- required: isRequiredMember(member),
49025
- ownerClassId: ownerClass.id,
49026
- genericParamId: declaration.id
49027
- };
49028
- }
49029
49490
  function compileValueRowInitializerBody(args) {
49030
49491
  const container = args.valueRow;
49031
49492
  if (!isInitValueContent(container)) return;
@@ -56408,7 +56869,7 @@ var INITIALIZER_KEY_PLACEHOLDER = new RegExp(
56408
56869
 
56409
56870
  // ../packages/manifest/schema-contract/registry.mjs
56410
56871
  var PROJECT_SCHEMA_CONTRACT = Object.freeze({
56411
- cliVersion: "0.76.2",
56872
+ cliVersion: "0.76.3",
56412
56873
  projectFileUploadBatchSize: 32,
56413
56874
  documentRecords: {
56414
56875
  member: {
@@ -58594,6 +59055,7 @@ function validateRegistrationAction(action, allowRegistration) {
58594
59055
  }
58595
59056
  }
58596
59057
  function registerSpec(spec, document2) {
59058
+ document2 = withCompiledConstructionTypes(document2, spec.action);
58597
59059
  validateRegistrationAction(spec.action, true);
58598
59060
  const root = {
58599
59061
  name: "",
@@ -58674,7 +59136,7 @@ function registerSpec(spec, document2) {
58674
59136
  makeEvaluatorContext(document2, interceptor),
58675
59137
  []
58676
59138
  );
58677
- return { spec, root, tests };
59139
+ return { spec, root, tests, document: document2 };
58678
59140
  }
58679
59141
  function mockResponse(environment, mock, selected, call) {
58680
59142
  if (selected === null) {
@@ -59097,13 +59559,13 @@ function prepareTestEvaluator(document2) {
59097
59559
  async function executeTestFile(spec, document2, selected, timeoutMs, interrupted2 = () => false) {
59098
59560
  return executeRegisteredSpec(
59099
59561
  registerSpec(spec, document2),
59100
- document2,
59101
59562
  selected,
59102
59563
  timeoutMs,
59103
59564
  interrupted2
59104
59565
  );
59105
59566
  }
59106
- async function executeRegisteredSpec(registered, document2, selected, timeoutMs, interrupted2) {
59567
+ async function executeRegisteredSpec(registered, selected, timeoutMs, interrupted2) {
59568
+ const document2 = registered.document;
59107
59569
  let restoredRuntimeSources = false;
59108
59570
  const reportFailure = (error, position, member = null) => {
59109
59571
  if (error instanceof NSGetterRuntimeError && error.node !== void 0 && (error.source === void 0 || error.callerNode !== void 0 && runtimeSource(error.callerNode) === void 0)) {