@neocompose/cli 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/neo.mjs +820 -164
  3. package/package.json +1 -1
package/dist/neo.mjs CHANGED
@@ -511,20 +511,20 @@ var init_source_diagnostics = __esm({
511
511
 
512
512
  // src/project-sync/names.ts
513
513
  function sanitizeCsIdentifier(value) {
514
- let identifier = "";
514
+ let identifier2 = "";
515
515
  let upperNext = false;
516
516
  for (const char of value) {
517
517
  if (/[A-Za-z0-9_]/.test(char)) {
518
- identifier += upperNext ? char.toUpperCase() : char;
518
+ identifier2 += upperNext ? char.toUpperCase() : char;
519
519
  upperNext = false;
520
520
  } else {
521
- upperNext = identifier.length > 0;
521
+ upperNext = identifier2.length > 0;
522
522
  }
523
523
  }
524
- if (identifier.length === 0) identifier = "_";
525
- if (/^[0-9]/.test(identifier)) identifier = `_${identifier}`;
526
- if (CSHARP_KEYWORDS.has(identifier)) identifier = `${identifier}_`;
527
- return identifier;
524
+ if (identifier2.length === 0) identifier2 = "_";
525
+ if (/^[0-9]/.test(identifier2)) identifier2 = `_${identifier2}`;
526
+ if (CSHARP_KEYWORDS.has(identifier2)) identifier2 = `${identifier2}_`;
527
+ return identifier2;
528
528
  }
529
529
  var CSHARP_KEYWORDS, IdentifierTable;
530
530
  var init_names = __esm({
@@ -2208,9 +2208,9 @@ function jsonValue(value, record3, path) {
2208
2208
  (entry, index) => jsonValue(entry, record3, `${path}[${index}]`)
2209
2209
  );
2210
2210
  }
2211
- const object = requireRecordValue(value, record3, path);
2211
+ const object2 = requireRecordValue(value, record3, path);
2212
2212
  const result = {};
2213
- for (const [key, entry] of Object.entries(object)) {
2213
+ for (const [key, entry] of Object.entries(object2)) {
2214
2214
  if (entry === void 0) continue;
2215
2215
  result[key] = jsonValue(entry, record3, `${path}.${key}`);
2216
2216
  }
@@ -6874,7 +6874,7 @@ function lexInterpolatedParts(raw, startPos) {
6874
6874
  i += consumed.length;
6875
6875
  for (const character of consumed) recordChar(character);
6876
6876
  } else {
6877
- buf += unescape(next);
6877
+ buf += unescape2(next);
6878
6878
  i += 2;
6879
6879
  recordChar(c);
6880
6880
  recordChar(next);
@@ -6897,7 +6897,7 @@ function isIdentCont(c) {
6897
6897
  function isDigit2(c) {
6898
6898
  return c >= "0" && c <= "9";
6899
6899
  }
6900
- function unescape(c) {
6900
+ function unescape2(c) {
6901
6901
  switch (c) {
6902
6902
  case "n":
6903
6903
  return "\n";
@@ -6961,7 +6961,7 @@ function readStringBody(advance, peek, here, startPos) {
6961
6961
  }
6962
6962
  cooked += String.fromCharCode(Number.parseInt(digits, 16));
6963
6963
  } else {
6964
- cooked += unescape(esc);
6964
+ cooked += unescape2(esc);
6965
6965
  }
6966
6966
  continue;
6967
6967
  }
@@ -19853,11 +19853,11 @@ function assertDiagnostic(value, path) {
19853
19853
  string(diagnostic.severity, `${path}.severity`);
19854
19854
  string(diagnostic.message, `${path}.message`);
19855
19855
  }
19856
- function assertArrayEnvelope(value, path, field, validate) {
19856
+ function assertArrayEnvelope(value, path, field, validate2) {
19857
19857
  const envelope = record(value, path);
19858
19858
  exactKeys(envelope, path, [field]);
19859
19859
  array(envelope[field], `${path}.${field}`).forEach(
19860
- (entry, index) => validate?.(entry, `${path}.${field}[${index}]`)
19860
+ (entry, index) => validate2?.(entry, `${path}.${field}[${index}]`)
19861
19861
  );
19862
19862
  }
19863
19863
  function assertIdentity(value, path) {
@@ -28457,14 +28457,14 @@ ${namedArguments(
28457
28457
  ];
28458
28458
  `;
28459
28459
  }
28460
- function emitLocalizationStatus(status, identifier, names) {
28460
+ function emitLocalizationStatus(status, identifier2, names) {
28461
28461
  const annotations = [
28462
28462
  id(status.id).trimEnd(),
28463
28463
  ...status.system ? [systemAnnotation(status.system)] : []
28464
28464
  ];
28465
28465
  const statusReference = (value) => value === null ? "null" : names.get(value) ?? `Reference<LocalizationStatus>(id: ${quote(value)})`;
28466
28466
  return `${annotations.join("\n")}
28467
- LocalizationStatus ${identifier} = new(
28467
+ LocalizationStatus ${identifier2} = new(
28468
28468
  ${namedArguments(
28469
28469
  [
28470
28470
  ["slug", status.slug],
@@ -30003,10 +30003,10 @@ function normalizeProjectBinaryPath(path, kind) {
30003
30003
  }
30004
30004
  function pascalIdentifier(value) {
30005
30005
  const words = value.normalize("NFKD").replace(/[^A-Za-z0-9]+/g, " ").trim().split(/\s+/).filter(Boolean);
30006
- let identifier = words.map((word) => `${word[0].toUpperCase()}${word.slice(1)}`).join("");
30007
- if (identifier.length === 0) identifier = "File";
30008
- if (/^[0-9]/.test(identifier)) identifier = `File${identifier}`;
30009
- return identifier;
30006
+ let identifier2 = words.map((word) => `${word[0].toUpperCase()}${word.slice(1)}`).join("");
30007
+ if (identifier2.length === 0) identifier2 = "File";
30008
+ if (/^[0-9]/.test(identifier2)) identifier2 = `File${identifier2}`;
30009
+ return identifier2;
30010
30010
  }
30011
30011
  function safeFileName(value) {
30012
30012
  const fileName2 = basename(value).replace(/[\\/]/g, "-");
@@ -30040,6 +30040,409 @@ var init_project_files = __esm({
30040
30040
  }
30041
30041
  });
30042
30042
 
30043
+ // ../node_modules/uuid/dist-node/regex.js
30044
+ var regex_default;
30045
+ var init_regex = __esm({
30046
+ "../node_modules/uuid/dist-node/regex.js"() {
30047
+ 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;
30048
+ }
30049
+ });
30050
+
30051
+ // ../node_modules/uuid/dist-node/validate.js
30052
+ function validate(uuid) {
30053
+ return typeof uuid === "string" && regex_default.test(uuid);
30054
+ }
30055
+ var validate_default;
30056
+ var init_validate2 = __esm({
30057
+ "../node_modules/uuid/dist-node/validate.js"() {
30058
+ init_regex();
30059
+ validate_default = validate;
30060
+ }
30061
+ });
30062
+
30063
+ // ../node_modules/uuid/dist-node/parse.js
30064
+ function parse(uuid) {
30065
+ if (!validate_default(uuid)) {
30066
+ throw TypeError("Invalid UUID");
30067
+ }
30068
+ let v;
30069
+ 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);
30070
+ }
30071
+ var parse_default;
30072
+ var init_parse = __esm({
30073
+ "../node_modules/uuid/dist-node/parse.js"() {
30074
+ init_validate2();
30075
+ parse_default = parse;
30076
+ }
30077
+ });
30078
+
30079
+ // ../node_modules/uuid/dist-node/stringify.js
30080
+ function unsafeStringify(arr, offset = 0) {
30081
+ 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();
30082
+ }
30083
+ var byteToHex;
30084
+ var init_stringify = __esm({
30085
+ "../node_modules/uuid/dist-node/stringify.js"() {
30086
+ byteToHex = [];
30087
+ for (let i = 0; i < 256; ++i) {
30088
+ byteToHex.push((i + 256).toString(16).slice(1));
30089
+ }
30090
+ }
30091
+ });
30092
+
30093
+ // ../node_modules/uuid/dist-node/rng.js
30094
+ function rng() {
30095
+ return crypto.getRandomValues(rnds8);
30096
+ }
30097
+ var rnds8;
30098
+ var init_rng = __esm({
30099
+ "../node_modules/uuid/dist-node/rng.js"() {
30100
+ rnds8 = new Uint8Array(16);
30101
+ }
30102
+ });
30103
+
30104
+ // ../node_modules/uuid/dist-node/v35.js
30105
+ function stringToBytes(str) {
30106
+ str = unescape(encodeURIComponent(str));
30107
+ const bytes = new Uint8Array(str.length);
30108
+ for (let i = 0; i < str.length; ++i) {
30109
+ bytes[i] = str.charCodeAt(i);
30110
+ }
30111
+ return bytes;
30112
+ }
30113
+ function v35(version, hash, value, namespace, buf, offset) {
30114
+ const valueBytes = typeof value === "string" ? stringToBytes(value) : value;
30115
+ const namespaceBytes = typeof namespace === "string" ? parse_default(namespace) : namespace;
30116
+ if (typeof namespace === "string") {
30117
+ namespace = parse_default(namespace);
30118
+ }
30119
+ if (namespace?.length !== 16) {
30120
+ throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
30121
+ }
30122
+ let bytes = new Uint8Array(16 + valueBytes.length);
30123
+ bytes.set(namespaceBytes);
30124
+ bytes.set(valueBytes, namespaceBytes.length);
30125
+ bytes = hash(bytes);
30126
+ bytes[6] = bytes[6] & 15 | version;
30127
+ bytes[8] = bytes[8] & 63 | 128;
30128
+ if (buf) {
30129
+ offset ??= 0;
30130
+ if (offset < 0 || offset + 16 > buf.length) {
30131
+ throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
30132
+ }
30133
+ for (let i = 0; i < 16; ++i) {
30134
+ buf[offset + i] = bytes[i];
30135
+ }
30136
+ return buf;
30137
+ }
30138
+ return unsafeStringify(bytes);
30139
+ }
30140
+ var DNS, URL2;
30141
+ var init_v35 = __esm({
30142
+ "../node_modules/uuid/dist-node/v35.js"() {
30143
+ init_parse();
30144
+ init_stringify();
30145
+ DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8";
30146
+ URL2 = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
30147
+ }
30148
+ });
30149
+
30150
+ // ../node_modules/uuid/dist-node/v4.js
30151
+ function v4(options, buf, offset) {
30152
+ if (!buf && !options && crypto.randomUUID) {
30153
+ return crypto.randomUUID();
30154
+ }
30155
+ return _v4(options, buf, offset);
30156
+ }
30157
+ function _v4(options, buf, offset) {
30158
+ options = options || {};
30159
+ const rnds = options.random ?? options.rng?.() ?? rng();
30160
+ if (rnds.length < 16) {
30161
+ throw new Error("Random bytes length must be >= 16");
30162
+ }
30163
+ rnds[6] = rnds[6] & 15 | 64;
30164
+ rnds[8] = rnds[8] & 63 | 128;
30165
+ if (buf) {
30166
+ offset = offset || 0;
30167
+ if (offset < 0 || offset + 16 > buf.length) {
30168
+ throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
30169
+ }
30170
+ for (let i = 0; i < 16; ++i) {
30171
+ buf[offset + i] = rnds[i];
30172
+ }
30173
+ return buf;
30174
+ }
30175
+ return unsafeStringify(rnds);
30176
+ }
30177
+ var v4_default;
30178
+ var init_v4 = __esm({
30179
+ "../node_modules/uuid/dist-node/v4.js"() {
30180
+ init_rng();
30181
+ init_stringify();
30182
+ v4_default = v4;
30183
+ }
30184
+ });
30185
+
30186
+ // ../node_modules/uuid/dist-node/sha1.js
30187
+ import { createHash as createHash2 } from "node:crypto";
30188
+ function sha1(bytes) {
30189
+ if (Array.isArray(bytes)) {
30190
+ bytes = Buffer.from(bytes);
30191
+ } else if (typeof bytes === "string") {
30192
+ bytes = Buffer.from(bytes, "utf8");
30193
+ }
30194
+ return createHash2("sha1").update(bytes).digest();
30195
+ }
30196
+ var sha1_default;
30197
+ var init_sha1 = __esm({
30198
+ "../node_modules/uuid/dist-node/sha1.js"() {
30199
+ sha1_default = sha1;
30200
+ }
30201
+ });
30202
+
30203
+ // ../node_modules/uuid/dist-node/v5.js
30204
+ function v5(value, namespace, buf, offset) {
30205
+ return v35(80, sha1_default, value, namespace, buf, offset);
30206
+ }
30207
+ var v5_default;
30208
+ var init_v5 = __esm({
30209
+ "../node_modules/uuid/dist-node/v5.js"() {
30210
+ init_sha1();
30211
+ init_v35();
30212
+ v5.DNS = DNS;
30213
+ v5.URL = URL2;
30214
+ v5_default = v5;
30215
+ }
30216
+ });
30217
+
30218
+ // ../node_modules/uuid/dist-node/index.js
30219
+ var init_dist_node = __esm({
30220
+ "../node_modules/uuid/dist-node/index.js"() {
30221
+ init_v4();
30222
+ init_v5();
30223
+ }
30224
+ });
30225
+
30226
+ // src/project-source/ui-action-source.ts
30227
+ function uiLogicFunctionSourceId(storedFunctionId, useId) {
30228
+ return storedFunctionId.startsWith("legacy-function:") ? v5_default(`dialogue-ui-condition:${useId}`, UI_LOGIC_SOURCE_NAMESPACE) : storedFunctionId;
30229
+ }
30230
+ function isCompleteUIAction(rawAction) {
30231
+ const action = object(rawAction);
30232
+ if (!action || !Array.isArray(action.instructions)) return false;
30233
+ if (action.instructions.length !== 1) return false;
30234
+ const instruction = object(action.instructions[0]);
30235
+ return instruction?.type === "functionCall" || instruction?.type === "assign" || instruction?.type === "collectionCall";
30236
+ }
30237
+ function uiActionSource(rawAction, resolver) {
30238
+ const action = object(rawAction);
30239
+ if (!action || !Array.isArray(action.instructions)) return null;
30240
+ if (!isCompleteUIAction(action)) return null;
30241
+ const instruction = object(action.instructions[0]);
30242
+ if (!instruction || typeof instruction.type !== "string") return null;
30243
+ if (instruction.type === "functionCall") {
30244
+ const call = pointerSource(instruction.call, resolver);
30245
+ return call === null ? null : `${call};`;
30246
+ }
30247
+ if (instruction.type === "assign") {
30248
+ const target = object(instruction.target);
30249
+ const targetSource = pointerSource(target?.pointer, resolver);
30250
+ if (targetSource === null || typeof instruction.operator !== "string") {
30251
+ return null;
30252
+ }
30253
+ if (instruction.operator === "++" || instruction.operator === "--") {
30254
+ return `${targetSource}${instruction.operator};`;
30255
+ }
30256
+ const value = pointerSource(instruction.pointer, resolver);
30257
+ return value === null ? null : `${targetSource} ${instruction.operator} ${value};`;
30258
+ }
30259
+ if (instruction.type === "collectionCall") {
30260
+ const target = object(instruction.target);
30261
+ const targetSource = pointerSource(target?.pointer, resolver);
30262
+ if (targetSource === null || typeof instruction.mutation !== "string" || !Array.isArray(instruction.args)) {
30263
+ return null;
30264
+ }
30265
+ const args = instruction.args.map((arg) => pointerSource(arg, resolver));
30266
+ if (args.some((arg) => arg === null)) return null;
30267
+ return `${targetSource}.${instruction.mutation}(${args.join(", ")});`;
30268
+ }
30269
+ return null;
30270
+ }
30271
+ function uiConditionSource(rawGetter, resolver) {
30272
+ const getter = object(rawGetter);
30273
+ if (!getter || !Array.isArray(getter.instructions)) return null;
30274
+ if (getter.instructions.length !== 1) return null;
30275
+ const instruction = object(getter.instructions[0]);
30276
+ if (instruction?.type !== "return") return null;
30277
+ const expression = pointerSource(instruction.pointer, resolver);
30278
+ return expression === null ? null : `return ${expression};`;
30279
+ }
30280
+ function pointerSource(rawPointer, resolver) {
30281
+ const pointer = object(rawPointer);
30282
+ if (!pointer || typeof pointer.type !== "string") return null;
30283
+ if (pointer.type === "variable") {
30284
+ if (pointer.variableId === "__this__") return resolver.primaryAlias;
30285
+ if (pointer.variableId === "__root__") return "root";
30286
+ if (pointer.variableId === "__context__") return "context";
30287
+ return typeof pointer.variableId === "string" ? pointer.variableId : null;
30288
+ }
30289
+ if (pointer.type === "reference") {
30290
+ return typeof pointer.valueId === "string" ? resolver.bindingNameByValueId.get(pointer.valueId) ?? null : null;
30291
+ }
30292
+ if (pointer.type === "staticMember") {
30293
+ return typeof pointer.memberId === "string" ? resolver.staticMemberExpressionById.get(pointer.memberId) ?? null : null;
30294
+ }
30295
+ if (pointer.type === "value") {
30296
+ return literalSource(pointer.value, resolver);
30297
+ }
30298
+ if (pointer.type === "keyOf") {
30299
+ const keyOf = object(pointer.keyOf);
30300
+ const receiver = pointerSource(keyOf?.pointer, resolver);
30301
+ const key = literalKey(keyOf?.key);
30302
+ if (receiver === null || key === null) return null;
30303
+ return identifier(key) ? `${receiver}.${key}` : `${receiver}[${quoteNeoString(key)}]`;
30304
+ }
30305
+ if (pointer.type === "callGetter") {
30306
+ if (typeof pointer.memberId !== "string") return null;
30307
+ const member = resolver.memberNameById.get(pointer.memberId);
30308
+ if (member === void 0) return null;
30309
+ const receiver = object(pointer.receiver);
30310
+ if (receiver?.kind === "static") {
30311
+ return resolver.staticMemberExpressionById.get(pointer.memberId) ?? null;
30312
+ }
30313
+ const receiverSource = pointerSource(receiver?.pointer, resolver);
30314
+ return receiverSource === null ? null : `${receiverSource}.${member}`;
30315
+ }
30316
+ if (pointer.type === "callFunction") {
30317
+ const receiver = object(pointer.receiver);
30318
+ let functionSource = null;
30319
+ if (receiver?.kind === "static") {
30320
+ const memberId = typeof pointer.memberId === "string" ? pointer.memberId : typeof receiver.memberId === "string" ? receiver.memberId : null;
30321
+ functionSource = memberId === null ? null : resolver.staticMemberExpressionById.get(memberId) ?? null;
30322
+ } else {
30323
+ const receiverSource = pointerSource(receiver?.pointer, resolver);
30324
+ const member = typeof pointer.memberId === "string" ? resolver.memberNameById.get(pointer.memberId) : typeof pointer.memberKey === "string" ? pointer.memberKey : void 0;
30325
+ functionSource = receiverSource === null || member === void 0 ? null : `${receiverSource}.${member}`;
30326
+ }
30327
+ if (functionSource === null || !Array.isArray(pointer.args)) return null;
30328
+ const args = pointer.args.map((arg) => pointerSource(arg, resolver));
30329
+ return args.some((arg) => arg === null) ? null : `${functionSource}(${args.join(", ")})`;
30330
+ }
30331
+ if (pointer.type === "stringify" || pointer.type === "toBool") {
30332
+ return pointerSource(pointer.pointer, resolver);
30333
+ }
30334
+ if (pointer.type === "forceUnwrap") {
30335
+ const inner = pointerSource(pointer.pointer, resolver);
30336
+ return inner === null ? null : `${inner}!`;
30337
+ }
30338
+ if (pointer.type === "coalesce") {
30339
+ const left = pointerSource(pointer.left, resolver);
30340
+ const right = pointerSource(pointer.right, resolver);
30341
+ return left === null || right === null ? null : `${left} ?? ${right}`;
30342
+ }
30343
+ if (pointer.type === "operation") {
30344
+ return operationSource(pointer.operation, resolver);
30345
+ }
30346
+ if (pointer.type === "function") {
30347
+ return intrinsicFunctionSource(pointer.function, resolver);
30348
+ }
30349
+ return null;
30350
+ }
30351
+ function operationSource(rawOperation, resolver) {
30352
+ const operation = object(rawOperation);
30353
+ if (operation?.type === "boolean") {
30354
+ return booleanExpressionSource(operation.expression, resolver);
30355
+ }
30356
+ if (operation?.type === "arithmetic") {
30357
+ const arithmetic = object(operation.arithmetic);
30358
+ if (typeof arithmetic?.type !== "string" || !Array.isArray(arithmetic.pointers)) {
30359
+ return null;
30360
+ }
30361
+ const pointers = arithmetic.pointers.map(
30362
+ (value) => pointerSource(value, resolver)
30363
+ );
30364
+ return pointers.some((value) => value === null) ? null : pointers.join(` ${arithmetic.type} `);
30365
+ }
30366
+ return null;
30367
+ }
30368
+ function booleanExpressionSource(rawExpression, resolver) {
30369
+ const expression = object(rawExpression);
30370
+ const condition = object(expression?.condition);
30371
+ const operator = typeof condition?.type === "string" ? conditionOperator[condition.type] : void 0;
30372
+ if (operator === void 0) return null;
30373
+ const left = pointerSource(condition?.operand1, resolver);
30374
+ const right = pointerSource(condition?.operand2, resolver);
30375
+ if (left === null || right === null) return null;
30376
+ let source = `${left} ${operator} ${right}`;
30377
+ const connective = object(expression?.connective);
30378
+ if (connective) {
30379
+ if (connective.type !== "&&" && connective.type !== "||") return null;
30380
+ const next = booleanExpressionSource(connective.to, resolver);
30381
+ if (next === null) return null;
30382
+ source += ` ${connective.type} ${next}`;
30383
+ }
30384
+ return source;
30385
+ }
30386
+ function intrinsicFunctionSource(rawFunction, resolver) {
30387
+ const fn = object(rawFunction);
30388
+ const info = object(fn?.info);
30389
+ if (!fn || !info) return null;
30390
+ const collection = pointerSource(info.collectionPointer, resolver);
30391
+ if (collection === null) return null;
30392
+ if (fn.type === "count") return `${collection}.Count()`;
30393
+ if (fn.type === "contains") {
30394
+ const value = pointerSource(info.valuePointer, resolver);
30395
+ return value === null ? null : `${collection}.Contains(${value})`;
30396
+ }
30397
+ return null;
30398
+ }
30399
+ function literalSource(rawValue2, resolver) {
30400
+ const value = object(rawValue2);
30401
+ if (!value || !object(value.typeInfo)) return null;
30402
+ if (value.value === null) return "null";
30403
+ if (typeof value.value === "boolean") return String(value.value);
30404
+ if (typeof value.value === "number") return String(value.value);
30405
+ if (typeof value.value === "string") {
30406
+ const kind = object(value.typeInfo)?.type;
30407
+ if (kind === 3) return quoteNeoString(value.value);
30408
+ if (kind === 4) return value.value;
30409
+ return quoteNeoString(value.value);
30410
+ }
30411
+ if (Array.isArray(value.value) && value.value.length === 1 && typeof value.value[0] === "string") {
30412
+ const optionName = resolver.enumOptionNameById.get(value.value[0]);
30413
+ return optionName === void 0 ? null : `.${optionName}`;
30414
+ }
30415
+ return null;
30416
+ }
30417
+ function literalKey(rawPointer) {
30418
+ const pointer = object(rawPointer);
30419
+ const value = pointer?.type === "value" ? object(pointer.value) : null;
30420
+ return typeof value?.value === "string" ? value.value : null;
30421
+ }
30422
+ function object(value) {
30423
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
30424
+ }
30425
+ function identifier(value) {
30426
+ return /^[A-Za-z_][A-Za-z0-9_]*$/u.test(value);
30427
+ }
30428
+ var UI_LOGIC_SOURCE_NAMESPACE, conditionOperator;
30429
+ var init_ui_action_source = __esm({
30430
+ "src/project-source/ui-action-source.ts"() {
30431
+ "use strict";
30432
+ init_source_format();
30433
+ init_dist_node();
30434
+ UI_LOGIC_SOURCE_NAMESPACE = "0b03137f-573a-5dc2-b7b5-8105c3a734a0";
30435
+ conditionOperator = {
30436
+ greaterThan: ">",
30437
+ greaterThanOrEqualTo: ">=",
30438
+ lessThan: "<",
30439
+ lessThanOrEqualTo: "<=",
30440
+ equalTo: "==",
30441
+ doesNotEqual: "!="
30442
+ };
30443
+ }
30444
+ });
30445
+
30043
30446
  // src/project-source/supplemental-records.ts
30044
30447
  function emitSupplementalProjectSourcesV4(records2) {
30045
30448
  const live = [...records2.values()].filter((record3) => !record3.deleted);
@@ -30047,6 +30450,7 @@ function emitSupplementalProjectSourcesV4(records2) {
30047
30450
  const audioNames = namesById(live, "unity-audio-clip-template");
30048
30451
  const priorityNames = namesById(live, "priority-group");
30049
30452
  const dialogueNames = namesById(live, "dialogue-group");
30453
+ const uiLogicResolver = supplementalUILogicResolver(live);
30050
30454
  const files = [];
30051
30455
  files.push(...emitProjectFileRegistrySourcesV4(records2));
30052
30456
  const project = live.find((record3) => record3.recordKind === "project");
@@ -30081,7 +30485,8 @@ function emitSupplementalProjectSourcesV4(records2) {
30081
30485
  record3.recordId,
30082
30486
  name,
30083
30487
  priorityNames,
30084
- dialogueNames
30488
+ dialogueNames,
30489
+ uiLogicResolver
30085
30490
  ),
30086
30491
  recordKeys: [`dialogue-group:${record3.recordId}`]
30087
30492
  });
@@ -30139,6 +30544,7 @@ function lowerSupplementalProjectSourcesV4(root, state, analysis, options = {})
30139
30544
  (global) => global.type.name === "DialogueGroup"
30140
30545
  );
30141
30546
  const dialogueIds = globalIds(dialogueGlobals, "dialogue-group");
30547
+ const uiLogicResolver = analysisUILogicResolver(analysis);
30142
30548
  for (const global of dialogueGlobals) {
30143
30549
  const recordId = globalId(global, "dialogue-group");
30144
30550
  result.push(
@@ -30149,7 +30555,8 @@ function lowerSupplementalProjectSourcesV4(root, state, analysis, options = {})
30149
30555
  baseData(state, "dialogue-group", recordId),
30150
30556
  global,
30151
30557
  priorityIds,
30152
- dialogueIds
30558
+ dialogueIds,
30559
+ uiLogicResolver
30153
30560
  ),
30154
30561
  global
30155
30562
  )
@@ -30200,7 +30607,7 @@ ${body.join("\n\n")}
30200
30607
  }
30201
30608
  `;
30202
30609
  }
30203
- function emitDialogueGroup(data, recordId, name, priorityNames, dialogueNames) {
30610
+ function emitDialogueGroup(data, recordId, name, priorityNames, dialogueNames, uiLogicResolver) {
30204
30611
  assertIdentifier2(name, "dialogue group");
30205
30612
  const kind = data.type === 1 ? "Lookup" : data.type === 2 ? "Folder" : "Standard";
30206
30613
  const args = [["kind", `.${kind}`]];
@@ -30228,7 +30635,7 @@ function emitDialogueGroup(data, recordId, name, priorityNames, dialogueNames) {
30228
30635
  `Reference(id: ${quote2(data.collectionValueId)})`
30229
30636
  ]);
30230
30637
  }
30231
- const source = collectDialogueGroupFunctions(data, recordId);
30638
+ const source = collectDialogueGroupFunctions(data, recordId, uiLogicResolver);
30232
30639
  const body = [
30233
30640
  ...source.functions.map(emitDialogueGroupFunction),
30234
30641
  ...source.uses.length > 0 ? [`when: ${emitDialogueGroupUseList(source.uses)};`] : []
@@ -30242,7 +30649,7 @@ ${body.map((entry) => indentNeoSource(entry, 2)).join("\n\n")}
30242
30649
  }` : ";"}
30243
30650
  `;
30244
30651
  }
30245
- function collectDialogueGroupFunctions(data, groupId) {
30652
+ function collectDialogueGroupFunctions(data, groupId, resolver) {
30246
30653
  const conditions = Array.isArray(data.conditions) ? data.conditions : [];
30247
30654
  const functions = /* @__PURE__ */ new Map();
30248
30655
  const functionNameById = /* @__PURE__ */ new Map();
@@ -30259,18 +30666,19 @@ function collectDialogueGroupFunctions(data, groupId) {
30259
30666
  "id",
30260
30667
  `Dialogue group ${groupId} condition ${index}`
30261
30668
  );
30262
- const functionId = requiredStringField(
30669
+ const storedFunctionId = requiredStringField(
30263
30670
  value,
30264
30671
  "sourceFunctionId",
30265
30672
  `Dialogue group ${groupId} condition ${useId}`
30266
30673
  );
30674
+ const functionId = value.type === 0 ? uiLogicFunctionSourceId(storedFunctionId, useId) : storedFunctionId;
30267
30675
  const requestedName = requiredStringField(
30268
30676
  value,
30269
30677
  "sourceFunctionName",
30270
30678
  `Dialogue group ${groupId} condition ${useId}`
30271
30679
  );
30272
30680
  let functionName = functionNameById.get(functionId);
30273
- const code = typeof value.code === "string" ? value.code.trim() : null;
30681
+ const code = typeof value.code === "string" ? value.code.trim() : value.type === 0 ? uiConditionSource(value.getter, resolver) : null;
30274
30682
  if (functionName === void 0) {
30275
30683
  assertIdentifier2(requestedName, "dialogue group function");
30276
30684
  functionName = uniqueIdentifier(requestedName, names);
@@ -30409,7 +30817,7 @@ function lowerPriorityGroup(baseValue, global) {
30409
30817
  }
30410
30818
  return result;
30411
30819
  }
30412
- function lowerDialogueGroup(baseValue, global, priorityIds, dialogueIds) {
30820
+ function lowerDialogueGroup(baseValue, global, priorityIds, dialogueIds, uiLogicResolver) {
30413
30821
  const base = optionalBase(baseValue);
30414
30822
  const baseWithoutLookup = { ...base };
30415
30823
  Reflect.deleteProperty(baseWithoutLookup, "collectionMemberId");
@@ -30446,7 +30854,12 @@ function lowerDialogueGroup(baseValue, global, priorityIds, dialogueIds) {
30446
30854
  args.get("priorityGroup"),
30447
30855
  priorityIds
30448
30856
  ),
30449
- conditions: lowerDialogueGroupConditions(base, global, authored),
30857
+ conditions: lowerDialogueGroupConditions(
30858
+ base,
30859
+ global,
30860
+ authored,
30861
+ uiLogicResolver
30862
+ ),
30450
30863
  ...type === 1 ? {
30451
30864
  collectionMemberId: collectionMemberId ?? (() => {
30452
30865
  throw new Error(
@@ -30457,7 +30870,7 @@ function lowerDialogueGroup(baseValue, global, priorityIds, dialogueIds) {
30457
30870
  } : {}
30458
30871
  };
30459
30872
  }
30460
- function lowerDialogueGroupConditions(base, global, authored) {
30873
+ function lowerDialogueGroupConditions(base, global, authored, uiLogicResolver) {
30461
30874
  const priorById = /* @__PURE__ */ new Map();
30462
30875
  if (Array.isArray(base.conditions)) {
30463
30876
  for (const value of base.conditions) {
@@ -30511,6 +30924,13 @@ function lowerDialogueGroupConditions(base, global, authored) {
30511
30924
  `Native/incomplete dialogue-group condition ${fn.name} has no pulled UI logic to preserve.`
30512
30925
  );
30513
30926
  }
30927
+ const projectedUICondition = prior?.type === 0 ? uiConditionSource(prior.getter, uiLogicResolver) : null;
30928
+ if (projectedUICondition !== null && normalizeSource(fn.code) === normalizeSource(projectedUICondition)) {
30929
+ return {
30930
+ ...prior,
30931
+ sourceFunctionName: fn.name
30932
+ };
30933
+ }
30514
30934
  return {
30515
30935
  ...prior ?? {},
30516
30936
  id: id2,
@@ -30833,6 +31253,89 @@ function namesById(records2, kind) {
30833
31253
  ])
30834
31254
  );
30835
31255
  }
31256
+ function supplementalUILogicResolver(records2) {
31257
+ const memberNameById = /* @__PURE__ */ new Map();
31258
+ const memberDataById = /* @__PURE__ */ new Map();
31259
+ for (const record3 of records2) {
31260
+ if (record3.recordKind !== "member") continue;
31261
+ const data = recordData(record3);
31262
+ memberDataById.set(record3.recordId, data);
31263
+ if (typeof data.name === "string" && isIdentifier(data.name)) {
31264
+ memberNameById.set(record3.recordId, data.name);
31265
+ }
31266
+ }
31267
+ const staticMemberExpressionById = /* @__PURE__ */ new Map();
31268
+ for (const record3 of records2) {
31269
+ if (record3.recordKind !== "class") continue;
31270
+ const data = recordData(record3);
31271
+ if (typeof data.name !== "string" || !isObjectRecord2(data.schema)) continue;
31272
+ for (const memberId of Object.values(data.schema)) {
31273
+ if (typeof memberId !== "string") continue;
31274
+ const member = memberDataById.get(memberId);
31275
+ if (member?.isStatic === true && typeof member.name === "string") {
31276
+ staticMemberExpressionById.set(memberId, `${data.name}.${member.name}`);
31277
+ }
31278
+ }
31279
+ }
31280
+ const enumOptionNameById = /* @__PURE__ */ new Map();
31281
+ for (const record3 of records2) {
31282
+ if (record3.recordKind !== "enum") continue;
31283
+ const options = recordData(record3).options;
31284
+ if (!isObjectRecord2(options)) continue;
31285
+ for (const [optionId, rawOption] of Object.entries(options)) {
31286
+ if (isObjectRecord2(rawOption) && typeof rawOption.name === "string") {
31287
+ enumOptionNameById.set(optionId, rawOption.name);
31288
+ }
31289
+ }
31290
+ }
31291
+ return {
31292
+ primaryAlias: "this",
31293
+ bindingNameByValueId: /* @__PURE__ */ new Map(),
31294
+ memberNameById,
31295
+ staticMemberExpressionById,
31296
+ enumOptionNameById
31297
+ };
31298
+ }
31299
+ function analysisUILogicResolver(analysis) {
31300
+ const memberNameById = /* @__PURE__ */ new Map();
31301
+ const staticMemberExpressionById = /* @__PURE__ */ new Map();
31302
+ for (const schemaClass2 of analysis.schema.classes) {
31303
+ for (const member of schemaClass2.members) {
31304
+ if (member.id === null) continue;
31305
+ memberNameById.set(member.id, member.name);
31306
+ if (member.modifiers.includes("static")) {
31307
+ staticMemberExpressionById.set(
31308
+ member.id,
31309
+ `${schemaClass2.name}.${member.name}`
31310
+ );
31311
+ }
31312
+ }
31313
+ }
31314
+ for (const schemaInterface of analysis.schema.interfaces) {
31315
+ for (const member of schemaInterface.members) {
31316
+ if (member.id !== null) memberNameById.set(member.id, member.name);
31317
+ }
31318
+ }
31319
+ const enumOptionNameById = /* @__PURE__ */ new Map();
31320
+ for (const schemaEnum of analysis.schema.enums) {
31321
+ for (const option of schemaEnum.options) {
31322
+ if (option.id !== null) enumOptionNameById.set(option.id, option.name);
31323
+ }
31324
+ }
31325
+ return {
31326
+ primaryAlias: "this",
31327
+ bindingNameByValueId: /* @__PURE__ */ new Map(),
31328
+ memberNameById,
31329
+ staticMemberExpressionById,
31330
+ enumOptionNameById
31331
+ };
31332
+ }
31333
+ function normalizeSource(value) {
31334
+ return value.replace(/\s+/gu, " ").trim();
31335
+ }
31336
+ function isIdentifier(value) {
31337
+ return /^[A-Za-z_][A-Za-z0-9_]*$/u.test(value);
31338
+ }
30836
31339
  function reference(value, names, type) {
30837
31340
  if (value === void 0 || value === null) return null;
30838
31341
  if (typeof value !== "string")
@@ -30923,6 +31426,7 @@ var init_supplemental_records = __esm({
30923
31426
  init_projection();
30924
31427
  init_project_files();
30925
31428
  init_source_format();
31429
+ init_ui_action_source();
30926
31430
  PRIORITY_OPTION_PATTERN = /^(?:@id\(\s*"((?:[^"\\]|\\.)+)"\s*\)\s*)?PriorityOption\s+([A-Za-z_][A-Za-z0-9_]*)\s*=\s*new\s*\(\s*\)\s*;/;
30927
31431
  }
30928
31432
  });
@@ -33072,74 +33576,6 @@ var init_storage_partitions = __esm({
33072
33576
  }
33073
33577
  });
33074
33578
 
33075
- // ../node_modules/uuid/dist-node/stringify.js
33076
- function unsafeStringify(arr, offset = 0) {
33077
- 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();
33078
- }
33079
- var byteToHex;
33080
- var init_stringify = __esm({
33081
- "../node_modules/uuid/dist-node/stringify.js"() {
33082
- byteToHex = [];
33083
- for (let i = 0; i < 256; ++i) {
33084
- byteToHex.push((i + 256).toString(16).slice(1));
33085
- }
33086
- }
33087
- });
33088
-
33089
- // ../node_modules/uuid/dist-node/rng.js
33090
- function rng() {
33091
- return crypto.getRandomValues(rnds8);
33092
- }
33093
- var rnds8;
33094
- var init_rng = __esm({
33095
- "../node_modules/uuid/dist-node/rng.js"() {
33096
- rnds8 = new Uint8Array(16);
33097
- }
33098
- });
33099
-
33100
- // ../node_modules/uuid/dist-node/v4.js
33101
- function v4(options, buf, offset) {
33102
- if (!buf && !options && crypto.randomUUID) {
33103
- return crypto.randomUUID();
33104
- }
33105
- return _v4(options, buf, offset);
33106
- }
33107
- function _v4(options, buf, offset) {
33108
- options = options || {};
33109
- const rnds = options.random ?? options.rng?.() ?? rng();
33110
- if (rnds.length < 16) {
33111
- throw new Error("Random bytes length must be >= 16");
33112
- }
33113
- rnds[6] = rnds[6] & 15 | 64;
33114
- rnds[8] = rnds[8] & 63 | 128;
33115
- if (buf) {
33116
- offset = offset || 0;
33117
- if (offset < 0 || offset + 16 > buf.length) {
33118
- throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
33119
- }
33120
- for (let i = 0; i < 16; ++i) {
33121
- buf[offset + i] = rnds[i];
33122
- }
33123
- return buf;
33124
- }
33125
- return unsafeStringify(rnds);
33126
- }
33127
- var v4_default;
33128
- var init_v4 = __esm({
33129
- "../node_modules/uuid/dist-node/v4.js"() {
33130
- init_rng();
33131
- init_stringify();
33132
- v4_default = v4;
33133
- }
33134
- });
33135
-
33136
- // ../node_modules/uuid/dist-node/index.js
33137
- var init_dist_node = __esm({
33138
- "../node_modules/uuid/dist-node/index.js"() {
33139
- init_v4();
33140
- }
33141
- });
33142
-
33143
33579
  // ../src/models/classes/generics.ts
33144
33580
  function resolveGenericEnv(classId, classes, draft) {
33145
33581
  const chain = resolveInheritanceChain(classId, classes, draft);
@@ -37129,7 +37565,9 @@ function emitDialogueProjectSourcesV4(records2) {
37129
37565
  const mainLocale = localization ? optionalString2(recordData2(localization).mainLocale) ?? "en-US" : "en-US";
37130
37566
  const values = new ValuePlacementIndex(live);
37131
37567
  const dialogueGroupNames = namesById2(live, "dialogue-group");
37132
- const memberNames = namesById2(live, "member");
37568
+ const memberNames = validNamesById(live, "member");
37569
+ const staticMemberExpressions = staticMemberExpressionsById(live);
37570
+ const enumOptionNames2 = enumOptionNamesById(live);
37133
37571
  const priorityOptionNames = /* @__PURE__ */ new Map();
37134
37572
  for (const record3 of live.filter(
37135
37573
  (candidate) => candidate.recordKind === "priority-group"
@@ -37161,7 +37599,9 @@ function emitDialogueProjectSourcesV4(records2) {
37161
37599
  mainLocale,
37162
37600
  dialogueGroupNames,
37163
37601
  priorityOptionNames,
37164
- memberNames
37602
+ memberNames,
37603
+ staticMemberExpressions,
37604
+ enumOptionNames: enumOptionNames2
37165
37605
  });
37166
37606
  files.push({
37167
37607
  path: `Dialogues/${className}.neoflow`,
@@ -37214,6 +37654,8 @@ function emitDialogueProjectSourcesV4(records2) {
37214
37654
  dialogueGroupNames,
37215
37655
  priorityOptionNames,
37216
37656
  memberNames,
37657
+ staticMemberExpressions,
37658
+ enumOptionNames: enumOptionNames2,
37217
37659
  recoveryReason: `Orphan dialogue-node records reference missing dialogue ${orphanDialogueId}`
37218
37660
  });
37219
37661
  files.push({
@@ -37233,7 +37675,15 @@ function emitDialogue(args) {
37233
37675
  const bindings = allocateBindings(args.dialogue.linkedValues, args.values);
37234
37676
  const primaryId = optionalString2(args.dialogue.primaryLinkedValueId);
37235
37677
  const primaryAlias = primaryId ? bindings.get(primaryId)?.name ?? null : null;
37236
- const functionResult = collectFunctions(args.nodes, primaryAlias);
37678
+ const functionResult = collectFunctions({
37679
+ nodes: args.nodes,
37680
+ primaryAlias,
37681
+ bindings,
37682
+ values: args.values,
37683
+ memberNames: args.memberNames,
37684
+ staticMemberExpressions: args.staticMemberExpressions,
37685
+ enumOptionNames: args.enumOptionNames
37686
+ });
37237
37687
  const context = {
37238
37688
  dialogue: args.dialogue,
37239
37689
  nodes: args.nodes,
@@ -37247,7 +37697,9 @@ function emitDialogue(args) {
37247
37697
  mainLocale: args.mainLocale,
37248
37698
  dialogueGroupNames: args.dialogueGroupNames,
37249
37699
  priorityOptionNames: args.priorityOptionNames,
37250
- memberNames: args.memberNames
37700
+ memberNames: args.memberNames,
37701
+ staticMemberExpressions: args.staticMemberExpressions,
37702
+ enumOptionNames: args.enumOptionNames
37251
37703
  };
37252
37704
  const localizedTextIds = /* @__PURE__ */ new Set();
37253
37705
  const settings = [];
@@ -37467,7 +37919,15 @@ function emitActionsNode(context, node) {
37467
37919
  if (name) args.push(["name", quote3(name)]);
37468
37920
  const actions = Array.isArray(node.actions) ? node.actions : [];
37469
37921
  const lines = [];
37470
- lines.push(...emitNodeBindings(context, node));
37922
+ const nodeBindings = allocateBindings(node.linkedValues, context.values);
37923
+ assertNoBindingShadow(context.bindings, nodeBindings);
37924
+ const nodePrimaryId = optionalString2(node.primaryLinkedValueId);
37925
+ const primaryAlias = (nodePrimaryId ? nodeBindings.get(nodePrimaryId)?.name : null) ?? context.primaryAlias;
37926
+ lines.push(
37927
+ ...[...nodeBindings.values()].map(
37928
+ (binding) => emitBinding(binding, binding.valueId === nodePrimaryId)
37929
+ )
37930
+ );
37471
37931
  for (const action of actions) {
37472
37932
  if (!isObjectRecord2(action)) continue;
37473
37933
  const actionId = stringField(action, "id");
@@ -37481,6 +37941,28 @@ Pause(
37481
37941
  );
37482
37942
  continue;
37483
37943
  }
37944
+ if (isObjectRecord2(action.logic) && action.logic.type === 0 && isCompleteUIAction(action.logic.action)) {
37945
+ const bindingNames = new Map(
37946
+ [...context.bindings.values(), ...nodeBindings.values()].map(
37947
+ (binding) => [binding.valueId, binding.name]
37948
+ )
37949
+ );
37950
+ const source = uiActionSource(action.logic.action, {
37951
+ primaryAlias,
37952
+ bindingNameByValueId: bindingNames,
37953
+ memberNameById: context.memberNames,
37954
+ staticMemberExpressionById: context.staticMemberExpressions,
37955
+ enumOptionNameById: context.enumOptionNames
37956
+ });
37957
+ if (source === null) {
37958
+ throw new Error(
37959
+ `UI action ${actionId} cannot be represented as inline NeoScript.`
37960
+ );
37961
+ }
37962
+ lines.push(`@id(${quote3(actionId)})
37963
+ ${source}`);
37964
+ continue;
37965
+ }
37484
37966
  if (isObjectRecord2(action.logic) && action.logic.sourceInline === true) {
37485
37967
  const code = optionalString2(action.logic.code);
37486
37968
  if (code === null)
@@ -37653,7 +38135,7 @@ function isLegacyInlineLocalizedText(records2, value) {
37653
38135
  function isLegacyInlineText(value) {
37654
38136
  return /[\s.,!?;:'"\u2026]/u.test(value);
37655
38137
  }
37656
- function collectFunctions(nodes, primaryAlias) {
38138
+ function collectFunctions(args) {
37657
38139
  const functions = /* @__PURE__ */ new Map();
37658
38140
  const byUse = /* @__PURE__ */ new Map();
37659
38141
  const names = new UniqueNames();
@@ -37661,7 +38143,7 @@ function collectFunctions(nodes, primaryAlias) {
37661
38143
  const functionId = stringField(logic, "sourceFunctionId");
37662
38144
  const requestedName = sourceIdentifier(logic, "sourceFunctionName");
37663
38145
  const existing = functions.get(functionId);
37664
- const code = typeof logic.code === "string" ? rewriteThis(logic.code, primaryAlias) : null;
38146
+ const code = typeof logic.code === "string" ? rewriteThis(logic.code, args.primaryAlias) : null;
37665
38147
  if (existing) {
37666
38148
  if (existing.returnType !== returnType || existing.code !== code) {
37667
38149
  throw new Error(
@@ -37675,12 +38157,24 @@ function collectFunctions(nodes, primaryAlias) {
37675
38157
  functions.set(functionId, { id: functionId, name, returnType, code });
37676
38158
  byUse.set(useKey, name);
37677
38159
  };
37678
- const addConditions = (raw) => {
38160
+ const addConditions = (raw, resolver) => {
37679
38161
  if (!Array.isArray(raw)) return;
37680
38162
  raw.forEach((condition) => {
37681
38163
  if (!isObjectRecord2(condition)) return;
37682
38164
  const useId = stringField(condition, "id");
37683
- add(condition, `condition:${useId}`, "bool");
38165
+ const projected = condition.type === 0 ? uiConditionSource(condition.getter, resolver) : null;
38166
+ add(
38167
+ projected === null ? condition : {
38168
+ ...condition,
38169
+ sourceFunctionId: uiLogicFunctionSourceId(
38170
+ stringField(condition, "sourceFunctionId"),
38171
+ useId
38172
+ ),
38173
+ code: projected
38174
+ },
38175
+ `condition:${useId}`,
38176
+ "bool"
38177
+ );
37684
38178
  });
37685
38179
  };
37686
38180
  const addTextVariables = (raw, owner) => {
@@ -37689,6 +38183,9 @@ function collectFunctions(nodes, primaryAlias) {
37689
38183
  if (!isObjectRecord2(candidate) || candidate.sourceInline === true) {
37690
38184
  continue;
37691
38185
  }
38186
+ if (typeof candidate.code !== "string" && typeof candidate.sourcePath === "string") {
38187
+ continue;
38188
+ }
37692
38189
  const sourceFunctionId = optionalString2(candidate.sourceFunctionId);
37693
38190
  const sourceFunctionName = optionalString2(candidate.sourceFunctionName);
37694
38191
  if (sourceFunctionId === null && sourceFunctionName === null) continue;
@@ -37709,15 +38206,31 @@ function collectFunctions(nodes, primaryAlias) {
37709
38206
  );
37710
38207
  }
37711
38208
  };
37712
- for (const node of nodes) {
38209
+ for (const node of args.nodes) {
37713
38210
  const nodeId = optionalString2(node.id) ?? "node";
37714
- addConditions(node.conditions);
38211
+ const nodeBindings = allocateBindings(node.linkedValues, args.values);
38212
+ const nodePrimaryId = optionalString2(node.primaryLinkedValueId);
38213
+ const nodePrimaryAlias = (nodePrimaryId ? nodeBindings.get(nodePrimaryId)?.name : null) ?? args.primaryAlias;
38214
+ const bindingNames = new Map(
38215
+ [...args.bindings.values(), ...nodeBindings.values()].map(
38216
+ (binding) => [binding.valueId, binding.name]
38217
+ )
38218
+ );
38219
+ const resolver = {
38220
+ primaryAlias: nodePrimaryAlias,
38221
+ bindingNameByValueId: bindingNames,
38222
+ memberNameById: args.memberNames,
38223
+ staticMemberExpressionById: args.staticMemberExpressions,
38224
+ enumOptionNameById: args.enumOptionNames
38225
+ };
38226
+ addConditions(node.conditions, resolver);
37715
38227
  addTextVariables(node.variables, `node:${nodeId}`);
37716
38228
  if (Array.isArray(node.actions)) {
37717
38229
  for (const action of node.actions) {
37718
38230
  if (!isObjectRecord2(action) || action.type !== 0 || !isObjectRecord2(action.logic))
37719
38231
  continue;
37720
- if (action.logic.sourceInline === true) continue;
38232
+ if (action.logic.sourceInline === true || action.logic.type === 0 && isCompleteUIAction(action.logic.action))
38233
+ continue;
37721
38234
  const useId = stringField(action, "id");
37722
38235
  add(action.logic, `action:${useId}`, "void");
37723
38236
  }
@@ -37725,7 +38238,7 @@ function collectFunctions(nodes, primaryAlias) {
37725
38238
  if (Array.isArray(node.outcomes)) {
37726
38239
  for (const outcome of node.outcomes) {
37727
38240
  if (!isObjectRecord2(outcome)) continue;
37728
- addConditions(outcome.conditions);
38241
+ addConditions(outcome.conditions, resolver);
37729
38242
  }
37730
38243
  }
37731
38244
  const optionSettings = isObjectRecord2(node.optionSettings) ? node.optionSettings : null;
@@ -37735,8 +38248,8 @@ function collectFunctions(nodes, primaryAlias) {
37735
38248
  const optionId = optionalString2(option.id) ?? "option";
37736
38249
  addTextVariables(option.variables, `option:${optionId}`);
37737
38250
  if (!isObjectRecord2(option.settings)) continue;
37738
- addConditions(option.settings.conditions);
37739
- addConditions(option.settings.selectableConditions);
38251
+ addConditions(option.settings.conditions, resolver);
38252
+ addConditions(option.settings.selectableConditions, resolver);
37740
38253
  }
37741
38254
  }
37742
38255
  return { functions, functionNameByUse: byUse };
@@ -37846,6 +38359,50 @@ function namesById2(records2, kind) {
37846
38359
  ])
37847
38360
  );
37848
38361
  }
38362
+ function validNamesById(records2, kind) {
38363
+ return new Map(
38364
+ records2.flatMap((record3) => {
38365
+ if (record3.recordKind !== kind) return [];
38366
+ const name = optionalString2(recordData2(record3).name);
38367
+ return name !== null && isDialogueSourceIdentifier(name) ? [[record3.recordId, name]] : [];
38368
+ })
38369
+ );
38370
+ }
38371
+ function staticMemberExpressionsById(records2) {
38372
+ const members = new Map(
38373
+ records2.filter((record3) => record3.recordKind === "member").map((record3) => [record3.recordId, recordData2(record3)])
38374
+ );
38375
+ const result = /* @__PURE__ */ new Map();
38376
+ for (const record3 of records2) {
38377
+ if (record3.recordKind !== "class") continue;
38378
+ const schemaClass2 = recordData2(record3);
38379
+ const className = optionalString2(schemaClass2.name);
38380
+ if (className === null || !isObjectRecord2(schemaClass2.schema)) continue;
38381
+ for (const memberId of Object.values(schemaClass2.schema)) {
38382
+ if (typeof memberId !== "string") continue;
38383
+ const member = members.get(memberId);
38384
+ const memberName = optionalString2(member?.name);
38385
+ if (member?.isStatic === true && memberName !== null) {
38386
+ result.set(memberId, `${className}.${memberName}`);
38387
+ }
38388
+ }
38389
+ }
38390
+ return result;
38391
+ }
38392
+ function enumOptionNamesById(records2) {
38393
+ const result = /* @__PURE__ */ new Map();
38394
+ for (const record3 of records2) {
38395
+ if (record3.recordKind !== "enum") continue;
38396
+ const options = recordData2(record3).options;
38397
+ if (!isObjectRecord2(options)) continue;
38398
+ for (const [optionId, rawOption] of Object.entries(options)) {
38399
+ if (!isObjectRecord2(rawOption)) continue;
38400
+ const name = optionalString2(rawOption.name);
38401
+ if (name !== null) result.set(optionId, name);
38402
+ }
38403
+ }
38404
+ return result;
38405
+ }
37849
38406
  function ownerClassId(member) {
37850
38407
  const owner = isObjectRecord2(member.owner) ? member.owner : null;
37851
38408
  if (owner && (owner.kind === "classMember" || owner.kind === "sharedClassMember")) {
@@ -37940,6 +38497,7 @@ var init_dialogue_sources = __esm({
37940
38497
  init_projection();
37941
38498
  init_neoscript_source_rewrite();
37942
38499
  init_source_format();
38500
+ init_ui_action_source();
37943
38501
  DIALOGUE_SYSTEM_TYPE_NAMES = [
37944
38502
  "Dialogue",
37945
38503
  "Trigger",
@@ -40207,7 +40765,13 @@ function lowerGraphMember(context, member, index) {
40207
40765
  {
40208
40766
  ...common,
40209
40767
  type: 2,
40210
- actions: lowerActions(context, member.content, id2),
40768
+ actions: lowerActions(
40769
+ context,
40770
+ member.content,
40771
+ id2,
40772
+ effectiveLinkedValues,
40773
+ common.primaryLinkedValueId
40774
+ ),
40211
40775
  ...destination === null ? { toNodeId: void 0 } : { toNodeId: destination }
40212
40776
  },
40213
40777
  member
@@ -40340,8 +40904,20 @@ function lowerTextNode(context, member, id2, base, common, destination) {
40340
40904
  ...textRecords
40341
40905
  ];
40342
40906
  }
40343
- function lowerActions(context, content, nodeId) {
40907
+ function lowerActions(context, content, nodeId, linkedValues, primaryValueId2) {
40344
40908
  if (!content) return [];
40909
+ const allLinks = [...context.dialogueLinks, ...linkedValues];
40910
+ const bindingNames = /* @__PURE__ */ new Map();
40911
+ for (const link of allLinks) {
40912
+ if (typeof link.valueId === "string" && typeof link.sourceName === "string") {
40913
+ bindingNames.set(link.valueId, link.sourceName);
40914
+ }
40915
+ }
40916
+ const primaryAlias = allLinks.find((link) => link.valueId === primaryValueId2)?.sourceName ?? context.sourcePrimaryAlias;
40917
+ const uiResolver = context.sourceSchema.uiActionResolver(
40918
+ typeof primaryAlias === "string" ? primaryAlias : null,
40919
+ bindingNames
40920
+ );
40345
40921
  return content.statements.map((statement, index) => {
40346
40922
  const id2 = sourceId2(statement, "dialogue-action", `${nodeId}:${index}`);
40347
40923
  if (statement.kind === "pause") {
@@ -40355,26 +40931,31 @@ function lowerActions(context, content, nodeId) {
40355
40931
  }
40356
40932
  const prior = context.existingLogic.actionsByUseId.get(id2);
40357
40933
  if (statement.kind === "call") {
40358
- const functionName = callName(statement.text);
40359
- const fn = context.functionsByName.get(functionName);
40360
- if (!fn) throw new Error(`Unknown action function ${functionName}.`);
40361
- if (fn.type.name !== "void" || fn.parameters.length !== 0) {
40362
- throw new Error(
40363
- `Action function ${functionName} must be a zero-argument void function.`
40364
- );
40934
+ const functionName = callExpressionName(
40935
+ stripTrailingSemicolon(statement.text)
40936
+ );
40937
+ if (functionName !== null) {
40938
+ const fn = context.functionsByName.get(functionName);
40939
+ if (!fn) throw new Error(`Unknown action function ${functionName}.`);
40940
+ if (fn.type.name !== "void" || fn.parameters.length !== 0) {
40941
+ throw new Error(
40942
+ `Action function ${functionName} must be a zero-argument void function.`
40943
+ );
40944
+ }
40945
+ return {
40946
+ id: id2,
40947
+ type: 0,
40948
+ logic: lowerActionLogic(
40949
+ context,
40950
+ prior,
40951
+ fn,
40952
+ stripTrailingSemicolon(statement.text),
40953
+ false,
40954
+ id2,
40955
+ uiResolver
40956
+ )
40957
+ };
40365
40958
  }
40366
- return {
40367
- id: id2,
40368
- type: 0,
40369
- logic: lowerActionLogic(
40370
- context,
40371
- prior,
40372
- fn,
40373
- stripTrailingSemicolon(statement.text),
40374
- false,
40375
- id2
40376
- )
40377
- };
40378
40959
  }
40379
40960
  const sourceName = `Inline${index + 1}`;
40380
40961
  const inlineFunction = {
@@ -40397,7 +40978,8 @@ function lowerActions(context, content, nodeId) {
40397
40978
  inlineFunction,
40398
40979
  stripTrailingSemicolon(statement.text),
40399
40980
  true,
40400
- id2
40981
+ id2,
40982
+ uiResolver
40401
40983
  )
40402
40984
  };
40403
40985
  });
@@ -40466,6 +41048,12 @@ function lowerConditionUses(context, expression, owner) {
40466
41048
  `Native/incomplete condition ${use.name} has no pulled UI logic to preserve.`
40467
41049
  );
40468
41050
  }
41051
+ if (prior?.type === 0 && conditionProjectionMatches(context, prior, body)) {
41052
+ return {
41053
+ ...prior,
41054
+ sourceFunctionName: fn.name
41055
+ };
41056
+ }
40469
41057
  if (prior && isCanonicalProjectedCode(body, prior.code, context)) {
40470
41058
  return {
40471
41059
  ...prior,
@@ -40484,8 +41072,48 @@ function lowerConditionUses(context, expression, owner) {
40484
41072
  };
40485
41073
  });
40486
41074
  }
40487
- function lowerActionLogic(context, prior, fn, fallbackCode, inline, useId) {
41075
+ function conditionProjectionMatches(context, prior, body) {
41076
+ const linkScopes = [
41077
+ context.dialogueLinks,
41078
+ ...context.nodesById.values().map(
41079
+ (node) => Array.isArray(node.linkedValues) ? node.linkedValues.filter(isObjectRecord2) : []
41080
+ )
41081
+ ];
41082
+ for (const links of linkScopes) {
41083
+ const allLinks = [...context.dialogueLinks, ...links];
41084
+ const bindingNames = /* @__PURE__ */ new Map();
41085
+ for (const link of allLinks) {
41086
+ if (typeof link.valueId === "string" && typeof link.sourceName === "string") {
41087
+ bindingNames.set(link.valueId, link.sourceName);
41088
+ }
41089
+ }
41090
+ const aliases = /* @__PURE__ */ new Set([
41091
+ context.sourcePrimaryAlias,
41092
+ "this"
41093
+ ]);
41094
+ for (const link of allLinks) {
41095
+ if (typeof link.sourceName === "string") aliases.add(link.sourceName);
41096
+ }
41097
+ for (const alias of aliases) {
41098
+ const projected = uiConditionSource(
41099
+ prior.getter,
41100
+ context.sourceSchema.uiActionResolver(alias, bindingNames)
41101
+ );
41102
+ if (projected !== null && normalizeSourceCode(body) === normalizeSourceCode(projected)) {
41103
+ return true;
41104
+ }
41105
+ }
41106
+ }
41107
+ return false;
41108
+ }
41109
+ function lowerActionLogic(context, prior, fn, fallbackCode, inline, useId, uiResolver) {
40488
41110
  const code = functionCode(fn) ?? fallbackCode;
41111
+ if (prior?.type === 0) {
41112
+ const projected = uiActionSource(prior.action, uiResolver);
41113
+ if (projected !== null && normalizeSourceCode(code) === normalizeSourceCode(projected)) {
41114
+ return prior;
41115
+ }
41116
+ }
40489
41117
  const sourceFunctionIdentity = {
40490
41118
  sourceFunctionId: inline ? useId : sourceId2(fn, "dialogue-function", fn.name),
40491
41119
  sourceFunctionName: fn.name
@@ -41389,12 +42017,6 @@ function callArguments(text, expectedName) {
41389
42017
  }
41390
42018
  return result;
41391
42019
  }
41392
- function callName(text) {
41393
- const match = text.trim().match(/^([A-Za-z_][A-Za-z0-9_]*)\s*\(\s*\)\s*;?$/);
41394
- if (!match)
41395
- throw new Error(`Action calls must be zero-argument function calls.`);
41396
- return match[1];
41397
- }
41398
42020
  function callExpressionName(text) {
41399
42021
  return text.match(/^([A-Za-z_][A-Za-z0-9_]*)\s*\(\s*\)$/)?.[1] ?? null;
41400
42022
  }
@@ -41734,6 +42356,7 @@ var init_dialogue_lower = __esm({
41734
42356
  init_neoscript();
41735
42357
  init_projection();
41736
42358
  init_neoscript_source_rewrite();
42359
+ init_ui_action_source();
41737
42360
  init_source_format();
41738
42361
  SourceSchemaIndex = class {
41739
42362
  classesByName;
@@ -41742,6 +42365,8 @@ var init_dialogue_lower = __esm({
41742
42365
  interfacesById;
41743
42366
  enumsByName;
41744
42367
  memberNamesById;
42368
+ staticMemberExpressionsById;
42369
+ enumOptionNamesById;
41745
42370
  constructor(analysis) {
41746
42371
  this.classesByName = new Map(
41747
42372
  analysis.schema.classes.map((entry) => [entry.name, entry])
@@ -41773,6 +42398,37 @@ var init_dialogue_lower = __esm({
41773
42398
  member.name
41774
42399
  ])
41775
42400
  );
42401
+ this.staticMemberExpressionsById = new Map(
42402
+ analysis.schema.classes.flatMap(
42403
+ (schemaClass2) => schemaClass2.members.flatMap(
42404
+ (member) => member.modifiers.includes("static") ? [
42405
+ [
42406
+ schemaIdentityId(member, "member", member.name),
42407
+ `${schemaClass2.name}.${member.name}`
42408
+ ]
42409
+ ] : []
42410
+ )
42411
+ )
42412
+ );
42413
+ this.enumOptionNamesById = new Map(
42414
+ analysis.schema.enums.flatMap(
42415
+ (schemaEnum) => schemaEnum.options.map(
42416
+ (option) => [
42417
+ schemaIdentityId(option, "enum-option", option.name),
42418
+ option.name
42419
+ ]
42420
+ )
42421
+ )
42422
+ );
42423
+ }
42424
+ uiActionResolver(primaryAlias, bindingNameByValueId) {
42425
+ return {
42426
+ primaryAlias,
42427
+ bindingNameByValueId,
42428
+ memberNameById: this.memberNamesById,
42429
+ staticMemberExpressionById: this.staticMemberExpressionsById,
42430
+ enumOptionNameById: this.enumOptionNamesById
42431
+ };
41776
42432
  }
41777
42433
  typeInfoForName(name) {
41778
42434
  return this.typeInfoForManifestType({
@@ -48499,12 +49155,12 @@ function virtualSourceUri(context, directory, fileName2) {
48499
49155
  const prefix = directory === null ? "" : `${directory}/`;
48500
49156
  return `neo-csharp://${encodeURIComponent(context.vm.project.id)}/${prefix}${encodeURIComponent(fileName2)}.cs`;
48501
49157
  }
48502
- function virtualIdentifierLocation(context, directory, fileName2, line, sourceLine, identifier) {
48503
- const rendered = virtualCSharpIdentifier(identifier);
49158
+ function virtualIdentifierLocation(context, directory, fileName2, line, sourceLine, identifier2) {
49159
+ const rendered = virtualCSharpIdentifier(identifier2);
48504
49160
  const character = sourceLine.indexOf(rendered);
48505
49161
  if (character < 0) {
48506
49162
  throw new Error(
48507
- `Cannot locate Neo schema identifier ${JSON.stringify(identifier)} in virtual C# line ${JSON.stringify(sourceLine)}.`
49163
+ `Cannot locate Neo schema identifier ${JSON.stringify(identifier2)} in virtual C# line ${JSON.stringify(sourceLine)}.`
48508
49164
  );
48509
49165
  }
48510
49166
  return {
@@ -49765,7 +50421,7 @@ function applyOverlayAssignment(target, targetTypeInfo, value, scope, ctx) {
49765
50421
  invalidateEvaluatorIndexes(ctx);
49766
50422
  return;
49767
50423
  }
49768
- const object = objectArg(receiver, "Assignment target");
50424
+ const object2 = objectArg(receiver, "Assignment target");
49769
50425
  const stringKey = String(key);
49770
50426
  if (referenceValueId !== null) {
49771
50427
  const parentId = findKnownRowIdByValueReference(receiver, ctx);
@@ -49780,11 +50436,11 @@ function applyOverlayAssignment(target, targetTypeInfo, value, scope, ctx) {
49780
50436
  ctx
49781
50437
  );
49782
50438
  }
49783
- object[stringKey] = referenceValueId;
50439
+ object2[stringKey] = referenceValueId;
49784
50440
  invalidateEvaluatorIndexes(ctx);
49785
50441
  return;
49786
50442
  }
49787
- const existing = object[stringKey];
50443
+ const existing = object2[stringKey];
49788
50444
  if (typeof existing === "string") {
49789
50445
  const row = evalValueById(
49790
50446
  ctx.vm,
@@ -49798,7 +50454,7 @@ function applyOverlayAssignment(target, targetTypeInfo, value, scope, ctx) {
49798
50454
  return;
49799
50455
  }
49800
50456
  }
49801
- object[stringKey] = value;
50457
+ object2[stringKey] = value;
49802
50458
  invalidateEvaluatorIndexes(ctx);
49803
50459
  }
49804
50460
  function applyOverlayStaticAssignment(memberId, value, ctx) {
@@ -56266,12 +56922,12 @@ function resolveWriteTarget(write, env, migrationName) {
56266
56922
  );
56267
56923
  }
56268
56924
  const keyOf = pointer.keyOf;
56269
- const literalKey = readLiteralKey(keyOf.key, migrationName);
56925
+ const literalKey2 = readLiteralKey(keyOf.key, migrationName);
56270
56926
  const container = resolveContainerMap(keyOf.pointer, env, migrationName);
56271
- const leaf = container[literalKey];
56927
+ const leaf = container[literalKey2];
56272
56928
  if (typeof leaf !== "string") {
56273
56929
  throw new Error(
56274
- `Migration "${migrationName}" writes "${literalKey}" but the container has no stored value id for that key.`
56930
+ `Migration "${migrationName}" writes "${literalKey2}" but the container has no stored value id for that key.`
56275
56931
  );
56276
56932
  }
56277
56933
  return { leafValueId: leaf };
@@ -58149,8 +58805,8 @@ function checkWriteOwnership(write, compiledAction, label, ctx, world, violate,
58149
58805
  return;
58150
58806
  }
58151
58807
  if (write.kind !== "assign") {
58152
- const literalKey = targetLiteralKey(target);
58153
- if (literalKey !== null && world.lookupKeys.has(literalKey)) return;
58808
+ const literalKey2 = targetLiteralKey(target);
58809
+ if (literalKey2 !== null && world.lookupKeys.has(literalKey2)) return;
58154
58810
  }
58155
58811
  const writability = typeof target.writability === "string" ? target.writability : null;
58156
58812
  const sessionLike = writability === "session" || writability === "immutableToSessionLookup" || writability === "local";
@@ -58191,14 +58847,14 @@ function checkLookupMutationArgs(compiledAction, label, world, violate) {
58191
58847
  const mutation = value.mutation;
58192
58848
  const target = isObjectRecord2(value.target) ? value.target : null;
58193
58849
  if (typeof mutation === "string" && target !== null) {
58194
- const literalKey = targetLiteralKey(target);
58195
- if (literalKey !== null && world.lookupKeys.has(literalKey)) {
58850
+ const literalKey2 = targetLiteralKey(target);
58851
+ if (literalKey2 !== null && world.lookupKeys.has(literalKey2)) {
58196
58852
  const args = Array.isArray(value.args) ? value.args : [];
58197
58853
  for (const arg of args) {
58198
58854
  if (isObjectRecord2(arg) && arg.type === "value" && isObjectRecord2(arg.value) && typeof arg.value.value === "string") {
58199
58855
  violate(
58200
58856
  label,
58201
- `${mutation} on lookup "${literalKey}" passes an id string literal \u2014 the runtime needs a collection entry (bind the node to the item and use Add(this))`
58857
+ `${mutation} on lookup "${literalKey2}" passes an id string literal \u2014 the runtime needs a collection entry (bind the node to the item and use Add(this))`
58202
58858
  );
58203
58859
  }
58204
58860
  }
@@ -58243,10 +58899,10 @@ function resolveWriteRowId(write, target, compiledAction, ctx, world) {
58243
58899
  if (pointer.type === "keyOf" && isObjectRecord2(pointer.keyOf)) {
58244
58900
  const keyOf = pointer.keyOf;
58245
58901
  const key = isObjectRecord2(keyOf.key) ? keyOf.key : null;
58246
- const literalKey = key !== null && isObjectRecord2(key.value) ? key.value.value : void 0;
58902
+ const literalKey2 = key !== null && isObjectRecord2(key.value) ? key.value.value : void 0;
58247
58903
  const receiver2 = evalPointer2(keyOf.pointer);
58248
- if (isObjectRecord2(receiver2) && typeof literalKey === "string") {
58249
- const child = receiver2[literalKey];
58904
+ if (isObjectRecord2(receiver2) && typeof literalKey2 === "string") {
58905
+ const child = receiver2[literalKey2];
58250
58906
  if (typeof child === "string" && world.valueById.has(child)) {
58251
58907
  return child;
58252
58908
  }
@@ -59335,8 +59991,8 @@ async function uploadProjectFile(context, filePath, preferredTemplateId) {
59335
59991
  const { readFileSync: readFile } = await import("node:fs");
59336
59992
  const { basename: basename3, extname: extname3 } = await import("node:path");
59337
59993
  const bytes = readFile(filePath);
59338
- const { createHash: createHash3 } = await import("node:crypto");
59339
- const contentSha256 = createHash3("sha256").update(bytes).digest("hex");
59994
+ const { createHash: createHash4 } = await import("node:crypto");
59995
+ const contentSha256 = createHash4("sha256").update(bytes).digest("hex");
59340
59996
  const name = basename3(filePath);
59341
59997
  const extension = extname3(filePath).toLowerCase();
59342
59998
  const mimeByExtension = {
@@ -59545,7 +60201,7 @@ var init_export = __esm({
59545
60201
  });
59546
60202
 
59547
60203
  // ../src/database/project-source-bundle.ts
59548
- import { createHash as createHash2 } from "node:crypto";
60204
+ import { createHash as createHash3 } from "node:crypto";
59549
60205
  import { promisify } from "node:util";
59550
60206
  import { gzip, gunzip } from "node:zlib";
59551
60207
  async function createProjectSourceBundle(inputFiles) {
@@ -59656,7 +60312,7 @@ function assertByteLimit(label, actual, limit) {
59656
60312
  }
59657
60313
  }
59658
60314
  function sha256(value) {
59659
- return createHash2("sha256").update(value).digest("hex");
60315
+ return createHash3("sha256").update(value).digest("hex");
59660
60316
  }
59661
60317
  var gzipAsync, gunzipAsync, MAX_COMPRESSED_SOURCE_BYTES, MAX_UNCOMPRESSED_SOURCE_BYTES, MAX_SOURCE_FILES;
59662
60318
  var init_project_source_bundle = __esm({