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