@neocompose/cli 0.56.1 → 0.57.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.
- package/CHANGELOG.md +19 -0
- package/dist/neo.mjs +1317 -567
- package/package.json +1 -1
- package/skills/neocompose-cli/SKILL.md +5 -2
- package/skills/neocompose-cli/references/animation-and-world-authoring.md +3 -1
- package/skills/neocompose-cli/references/cli-development.md +1 -1
- package/skills/neocompose-cli/references/declarations-and-construction.md +3 -2
- package/skills/neocompose-cli/references/neoscript.md +22 -2
- package/skills/neocompose-cli/references/values-identities-and-references.md +11 -0
package/dist/neo.mjs
CHANGED
|
@@ -1359,7 +1359,7 @@ function indexLocals(tokens, pairs, lexed, diagnostics) {
|
|
|
1359
1359
|
}
|
|
1360
1360
|
const loop = tryParseLoopLocal(tokens, index, pairs, lexed, diagnostics);
|
|
1361
1361
|
if (loop) {
|
|
1362
|
-
locals.push(loop.
|
|
1362
|
+
locals.push(...loop.locals);
|
|
1363
1363
|
index = loop.resumeTokenIndex;
|
|
1364
1364
|
continue;
|
|
1365
1365
|
}
|
|
@@ -1793,7 +1793,7 @@ function tryParseLoopLocal(tokens, start, pairs, lexed, diagnostics) {
|
|
|
1793
1793
|
});
|
|
1794
1794
|
}
|
|
1795
1795
|
return {
|
|
1796
|
-
|
|
1796
|
+
locals: [{ ...declaration.local, scopeEnd }],
|
|
1797
1797
|
resumeTokenIndex: declaration.endTokenIndex
|
|
1798
1798
|
};
|
|
1799
1799
|
}
|
|
@@ -1805,22 +1805,65 @@ function tryParseLoopLocal(tokens, start, pairs, lexed, diagnostics) {
|
|
|
1805
1805
|
const inIndex = start + 2 + inOffset;
|
|
1806
1806
|
const name = tokens[inIndex - 1];
|
|
1807
1807
|
const first = tokens[start + 2];
|
|
1808
|
-
if (!
|
|
1808
|
+
if (!first) return null;
|
|
1809
1809
|
const inferred = first.kind === "identifier" && first.text === NEOSCRIPT_INFERRED_LOCAL_KEYWORD;
|
|
1810
|
+
const receiver = tokens.slice(inIndex + 1, closeIndex);
|
|
1811
|
+
const local = (token, typeTokens, key) => ({
|
|
1812
|
+
name: token.text,
|
|
1813
|
+
nameRange: token.range,
|
|
1814
|
+
typeTokens,
|
|
1815
|
+
inferred,
|
|
1816
|
+
...inferred ? { contextualKeywordRange: first.range } : {},
|
|
1817
|
+
initializerTokens: receiver,
|
|
1818
|
+
collectionIteration: true,
|
|
1819
|
+
...key ? { collectionIterationKey: true } : {},
|
|
1820
|
+
declarationRange: lexed.source.range(first.start, token.end),
|
|
1821
|
+
scopeStart: tokens[closeIndex]?.end ?? token.end,
|
|
1822
|
+
scopeEnd,
|
|
1823
|
+
lambdaParameter: false
|
|
1824
|
+
});
|
|
1825
|
+
const tupleOpenIndex = start + (inferred ? 3 : 2);
|
|
1826
|
+
const tupleOpen = tokens[tupleOpenIndex];
|
|
1827
|
+
if (tupleOpen?.kind === "punctuation" && tupleOpen.text === "(") {
|
|
1828
|
+
const tupleCloseIndex = pairs.get(tupleOpenIndex);
|
|
1829
|
+
if (tupleCloseIndex !== inIndex - 1) return null;
|
|
1830
|
+
let commaIndex = -1;
|
|
1831
|
+
let angleDepth = 0;
|
|
1832
|
+
for (let cursor = tupleOpenIndex + 1; cursor < tupleCloseIndex; cursor++) {
|
|
1833
|
+
const text = tokens[cursor]?.text;
|
|
1834
|
+
if (text === "<") angleDepth++;
|
|
1835
|
+
if (text === ">") angleDepth--;
|
|
1836
|
+
if (text === "," && angleDepth === 0) {
|
|
1837
|
+
commaIndex = cursor;
|
|
1838
|
+
break;
|
|
1839
|
+
}
|
|
1840
|
+
}
|
|
1841
|
+
if (commaIndex < 0) return null;
|
|
1842
|
+
const keyName = tokens[commaIndex - 1];
|
|
1843
|
+
const valueName = tokens[tupleCloseIndex - 1];
|
|
1844
|
+
if (keyName?.kind !== "identifier" || valueName?.kind !== "identifier")
|
|
1845
|
+
return null;
|
|
1846
|
+
return {
|
|
1847
|
+
locals: [
|
|
1848
|
+
local(
|
|
1849
|
+
keyName,
|
|
1850
|
+
inferred ? [] : tokens.slice(tupleOpenIndex + 1, commaIndex - 1),
|
|
1851
|
+
true
|
|
1852
|
+
),
|
|
1853
|
+
local(
|
|
1854
|
+
valueName,
|
|
1855
|
+
inferred ? [] : tokens.slice(commaIndex + 1, tupleCloseIndex - 1),
|
|
1856
|
+
false
|
|
1857
|
+
)
|
|
1858
|
+
],
|
|
1859
|
+
resumeTokenIndex: inIndex - 1
|
|
1860
|
+
};
|
|
1861
|
+
}
|
|
1862
|
+
if (!name || name.kind !== "identifier") return null;
|
|
1810
1863
|
return {
|
|
1811
|
-
|
|
1812
|
-
name:
|
|
1813
|
-
|
|
1814
|
-
typeTokens: inferred ? [] : tokens.slice(start + 2, inIndex - 1),
|
|
1815
|
-
inferred,
|
|
1816
|
-
...inferred ? { contextualKeywordRange: first.range } : {},
|
|
1817
|
-
initializerTokens: tokens.slice(inIndex + 1, closeIndex),
|
|
1818
|
-
collectionIteration: true,
|
|
1819
|
-
declarationRange: lexed.source.range(first.start, name.end),
|
|
1820
|
-
scopeStart: tokens[closeIndex]?.end ?? name.end,
|
|
1821
|
-
scopeEnd,
|
|
1822
|
-
lambdaParameter: false
|
|
1823
|
-
},
|
|
1864
|
+
locals: [
|
|
1865
|
+
local(name, inferred ? [] : tokens.slice(start + 2, inIndex - 1), false)
|
|
1866
|
+
],
|
|
1824
1867
|
resumeTokenIndex: inIndex - 1
|
|
1825
1868
|
};
|
|
1826
1869
|
}
|
|
@@ -2877,14 +2920,25 @@ var init_executable_parser = __esm({
|
|
|
2877
2920
|
const token = this.expect("keyword", "foreach");
|
|
2878
2921
|
this.expect("punctuation", "(");
|
|
2879
2922
|
const inferred = this.peek().kind === "identifier" && this.peek().text === NEOSCRIPT_INFERRED_LOCAL_KEYWORD;
|
|
2923
|
+
if (inferred) this.next();
|
|
2924
|
+
const deconstructed = this.peek().kind === "punctuation" && this.peek().text === "(";
|
|
2925
|
+
if (deconstructed) this.next();
|
|
2880
2926
|
let type;
|
|
2881
2927
|
if (inferred) {
|
|
2882
|
-
this.next();
|
|
2883
2928
|
type = null;
|
|
2884
2929
|
} else {
|
|
2885
2930
|
type = this.parseType();
|
|
2886
2931
|
}
|
|
2887
|
-
const
|
|
2932
|
+
const firstName = this.expect("identifier");
|
|
2933
|
+
let key;
|
|
2934
|
+
let name = firstName;
|
|
2935
|
+
if (deconstructed) {
|
|
2936
|
+
key = { name: firstName.text, type };
|
|
2937
|
+
this.expect("punctuation", ",");
|
|
2938
|
+
type = inferred ? null : this.parseType();
|
|
2939
|
+
name = this.expect("identifier");
|
|
2940
|
+
this.expect("punctuation", ")");
|
|
2941
|
+
}
|
|
2888
2942
|
this.expect("keyword", "in");
|
|
2889
2943
|
const collection = this.parseExpr();
|
|
2890
2944
|
this.expect("punctuation", ")");
|
|
@@ -2892,6 +2946,7 @@ var init_executable_parser = __esm({
|
|
|
2892
2946
|
kind: "forEach",
|
|
2893
2947
|
type,
|
|
2894
2948
|
name: name.text,
|
|
2949
|
+
...key ? { key } : {},
|
|
2895
2950
|
collection,
|
|
2896
2951
|
body: this.parseStatementBody(),
|
|
2897
2952
|
pos: at(token)
|
|
@@ -5834,6 +5889,9 @@ function collectionParts(type) {
|
|
|
5834
5889
|
function collectionPartsFor(expression) {
|
|
5835
5890
|
return collectionParts(expression.type);
|
|
5836
5891
|
}
|
|
5892
|
+
function isCollectionPath(expression) {
|
|
5893
|
+
return expression.kind === "ident" || expression.kind === "member" && !expression.optional && isCollectionPath(expression.receiver);
|
|
5894
|
+
}
|
|
5837
5895
|
function collectionOperationValueType(expression, collection) {
|
|
5838
5896
|
if (isLookupSelectionCollection(expression, collection)) {
|
|
5839
5897
|
return { kind: "primitive", name: "string" };
|
|
@@ -6934,6 +6992,12 @@ var init_strict_resolver = __esm({
|
|
|
6934
6992
|
};
|
|
6935
6993
|
}
|
|
6936
6994
|
case "forEach": {
|
|
6995
|
+
if (statement.key && !isCollectionPath(statement.collection)) {
|
|
6996
|
+
throw new CompileError(
|
|
6997
|
+
"Assign the dictionary to a local before deconstructing it in foreach.",
|
|
6998
|
+
statement.collection.pos
|
|
6999
|
+
);
|
|
7000
|
+
}
|
|
6937
7001
|
const collection = this.resolveExpression(statement.collection, scope);
|
|
6938
7002
|
if (isNullable(collection.type)) {
|
|
6939
7003
|
throw new CompileError(
|
|
@@ -6948,36 +7012,88 @@ var init_strict_resolver = __esm({
|
|
|
6948
7012
|
statement.collection.pos
|
|
6949
7013
|
);
|
|
6950
7014
|
}
|
|
7015
|
+
if (statement.key && parts.kind !== "dictionary") {
|
|
7016
|
+
throw new CompileError(
|
|
7017
|
+
`foreach key/value deconstruction requires a Dictionary, got ${this.describe(collection.type)}`,
|
|
7018
|
+
statement.collection.pos
|
|
7019
|
+
);
|
|
7020
|
+
}
|
|
6951
7021
|
this.assertLocalNameAvailable(statement.name, scope, statement.pos);
|
|
6952
|
-
|
|
6953
|
-
|
|
6954
|
-
|
|
7022
|
+
if (statement.key) {
|
|
7023
|
+
this.assertLocalNameAvailable(
|
|
7024
|
+
statement.key.name,
|
|
7025
|
+
scope,
|
|
7026
|
+
statement.pos
|
|
7027
|
+
);
|
|
7028
|
+
if (statement.key.name === statement.name) {
|
|
7029
|
+
throw new CompileError(
|
|
7030
|
+
"foreach key and value need different names.",
|
|
7031
|
+
statement.pos
|
|
7032
|
+
);
|
|
7033
|
+
}
|
|
7034
|
+
}
|
|
7035
|
+
const inferredType = statement.key ? parts.keyType : parts.valueType;
|
|
7036
|
+
const declared = statement.key ? statement.key.type : statement.type;
|
|
7037
|
+
const bindingType = declared ? this.resolveType(declared) : inferredType;
|
|
7038
|
+
if (declared) {
|
|
6955
7039
|
this.requireAssignable(
|
|
6956
7040
|
inferredType,
|
|
6957
7041
|
bindingType,
|
|
6958
7042
|
statement.pos,
|
|
6959
|
-
"foreach iterator"
|
|
7043
|
+
statement.key ? "foreach key" : "foreach iterator"
|
|
6960
7044
|
);
|
|
6961
7045
|
}
|
|
6962
7046
|
const binding = variable(
|
|
6963
|
-
statement.name,
|
|
7047
|
+
statement.key?.name ?? statement.name,
|
|
6964
7048
|
bindingType,
|
|
6965
7049
|
void 0,
|
|
6966
7050
|
this.project
|
|
6967
7051
|
);
|
|
7052
|
+
const iterationCollection = statement.key ? this.selectDictionaryKeys(collection, parts) : collection;
|
|
6968
7053
|
const bindingWritability = collection.entryWritability ?? collection.writability ?? "runtime" /* Runtime */;
|
|
7054
|
+
const collectionWriteRoot = this.expressionWriteRoot(collection, scope);
|
|
6969
7055
|
const loopScope = new Scope(scope);
|
|
6970
7056
|
loopScope.define(
|
|
6971
7057
|
scopeVariable(
|
|
6972
|
-
statement.name,
|
|
7058
|
+
statement.key?.name ?? statement.name,
|
|
6973
7059
|
binding,
|
|
6974
7060
|
bindingType,
|
|
6975
7061
|
bindingWritability,
|
|
6976
7062
|
bindingWritability,
|
|
6977
|
-
|
|
7063
|
+
collectionWriteRoot,
|
|
6978
7064
|
"foreach"
|
|
6979
7065
|
)
|
|
6980
7066
|
);
|
|
7067
|
+
if (statement.key) {
|
|
7068
|
+
const valueType = statement.type ? this.resolveType(statement.type) : parts.valueType;
|
|
7069
|
+
if (statement.type) {
|
|
7070
|
+
this.requireAssignable(
|
|
7071
|
+
parts.valueType,
|
|
7072
|
+
valueType,
|
|
7073
|
+
statement.pos,
|
|
7074
|
+
"foreach value"
|
|
7075
|
+
);
|
|
7076
|
+
}
|
|
7077
|
+
const indexed = this.resolveIndex(
|
|
7078
|
+
statement.collection,
|
|
7079
|
+
{ kind: "ident", name: statement.key.name, pos: statement.pos },
|
|
7080
|
+
loopScope,
|
|
7081
|
+
statement.pos,
|
|
7082
|
+
false
|
|
7083
|
+
);
|
|
7084
|
+
loopScope.define({
|
|
7085
|
+
name: statement.name,
|
|
7086
|
+
type: valueType,
|
|
7087
|
+
variableId: statement.name,
|
|
7088
|
+
pointer: indexed.pointer,
|
|
7089
|
+
...indexed.writability ? {
|
|
7090
|
+
writability: indexed.writability,
|
|
7091
|
+
ownership: indexed.writability
|
|
7092
|
+
} : {},
|
|
7093
|
+
writeRoot: collectionWriteRoot,
|
|
7094
|
+
readonlyBinding: "foreach"
|
|
7095
|
+
});
|
|
7096
|
+
}
|
|
6981
7097
|
const iterationScope = new Scope(loopScope);
|
|
6982
7098
|
invalidateLoopEntryNarrowingsAssignedBy(
|
|
6983
7099
|
iterationScope,
|
|
@@ -7025,8 +7141,8 @@ var init_strict_resolver = __esm({
|
|
|
7025
7141
|
readonly: true,
|
|
7026
7142
|
writability: bindingWritability
|
|
7027
7143
|
},
|
|
7028
|
-
collectionPointer:
|
|
7029
|
-
collectionTypeInfo:
|
|
7144
|
+
collectionPointer: iterationCollection.pointer,
|
|
7145
|
+
collectionTypeInfo: iterationCollection.wireType ?? toWireType(iterationCollection.type, this.project),
|
|
7030
7146
|
instructions
|
|
7031
7147
|
};
|
|
7032
7148
|
}
|
|
@@ -7468,6 +7584,8 @@ var init_strict_resolver = __esm({
|
|
|
7468
7584
|
let label = "foreach iterator";
|
|
7469
7585
|
if (local.readonlyBinding === "catch") label = "catch parameter";
|
|
7470
7586
|
if (local.readonlyBinding === "capture") label = "captured value";
|
|
7587
|
+
if (local.readonlyBinding === "enumKey")
|
|
7588
|
+
label = "enum dictionary key parameter";
|
|
7471
7589
|
throw new CompileError(
|
|
7472
7590
|
`Cannot assign to ${label} '${local.name}' because it is read-only.`,
|
|
7473
7591
|
statement.pos
|
|
@@ -11631,6 +11749,67 @@ var init_strict_resolver = __esm({
|
|
|
11631
11749
|
}
|
|
11632
11750
|
return value.pointer;
|
|
11633
11751
|
}
|
|
11752
|
+
selectDictionaryKeys(dictionary, parts) {
|
|
11753
|
+
const key = this.collectionLambdaParameter(
|
|
11754
|
+
"__foreach_key__",
|
|
11755
|
+
parts.keyType,
|
|
11756
|
+
parts,
|
|
11757
|
+
0
|
|
11758
|
+
);
|
|
11759
|
+
const value = variable(
|
|
11760
|
+
"__foreach_value__",
|
|
11761
|
+
parts.valueType,
|
|
11762
|
+
void 0,
|
|
11763
|
+
this.project
|
|
11764
|
+
);
|
|
11765
|
+
const alias = this.enumDictionaryKeyPointer(key, parts.keyType, parts, 0);
|
|
11766
|
+
const fn = {
|
|
11767
|
+
compilerRevision: NEOSCRIPT_COMPILER_REVISION,
|
|
11768
|
+
parameters: [key, value],
|
|
11769
|
+
instructions: [
|
|
11770
|
+
{
|
|
11771
|
+
type: "return" /* Return */,
|
|
11772
|
+
pointer: alias ?? {
|
|
11773
|
+
type: "variable" /* Variable */,
|
|
11774
|
+
variableId: key.id
|
|
11775
|
+
}
|
|
11776
|
+
}
|
|
11777
|
+
],
|
|
11778
|
+
typeInfo: toWireType(parts.keyType, this.project)
|
|
11779
|
+
};
|
|
11780
|
+
return intrinsic(
|
|
11781
|
+
"select" /* Select */,
|
|
11782
|
+
{ collectionPointer: dictionary.pointer, function: fn },
|
|
11783
|
+
{ kind: "list", elementType: parts.keyType, readOnly: true }
|
|
11784
|
+
);
|
|
11785
|
+
}
|
|
11786
|
+
collectionLambdaParameter(name, type, collection, index) {
|
|
11787
|
+
const rawType = this.isEnumDictionaryKey(type, collection, index) ? { kind: "primitive", name: "string" } : type;
|
|
11788
|
+
return variable(name, rawType, void 0, this.project);
|
|
11789
|
+
}
|
|
11790
|
+
isEnumDictionaryKey(type, collection, index) {
|
|
11791
|
+
return collection.kind === "dictionary" && index === 0 && type.kind === "named" && this.project.typeById.get(type.typeId)?.kind === "enum";
|
|
11792
|
+
}
|
|
11793
|
+
enumDictionaryKeyPointer(parameter4, type, collection, index) {
|
|
11794
|
+
if (!this.isEnumDictionaryKey(type, collection, index)) return void 0;
|
|
11795
|
+
const wire = toWireType(
|
|
11796
|
+
{
|
|
11797
|
+
kind: "list",
|
|
11798
|
+
elementType: { kind: "primitive", name: "string" }
|
|
11799
|
+
},
|
|
11800
|
+
this.project
|
|
11801
|
+
);
|
|
11802
|
+
if (wire.type !== 6 /* List */) {
|
|
11803
|
+
throw new Error("Enum key alias requires a list wire type.");
|
|
11804
|
+
}
|
|
11805
|
+
return {
|
|
11806
|
+
type: "listLiteral" /* ListLiteral */,
|
|
11807
|
+
typeInfo: wire,
|
|
11808
|
+
entries: [
|
|
11809
|
+
{ type: "variable" /* Variable */, variableId: parameter4.id }
|
|
11810
|
+
]
|
|
11811
|
+
};
|
|
11812
|
+
}
|
|
11634
11813
|
resolveCollectionLambda(ast, collection, returnType, outerScope, pos) {
|
|
11635
11814
|
if (ast.kind !== "lambda") {
|
|
11636
11815
|
throw new CompileError(
|
|
@@ -11658,16 +11837,30 @@ var init_strict_resolver = __esm({
|
|
|
11658
11837
|
parameter4.pos,
|
|
11659
11838
|
"lambda parameter"
|
|
11660
11839
|
);
|
|
11661
|
-
const item =
|
|
11662
|
-
|
|
11663
|
-
|
|
11840
|
+
const item = this.collectionLambdaParameter(
|
|
11841
|
+
parameter4.name,
|
|
11842
|
+
declared,
|
|
11843
|
+
collection,
|
|
11844
|
+
index
|
|
11845
|
+
);
|
|
11846
|
+
const alias = this.enumDictionaryKeyPointer(
|
|
11847
|
+
item,
|
|
11848
|
+
declared,
|
|
11849
|
+
collection,
|
|
11850
|
+
index
|
|
11851
|
+
);
|
|
11852
|
+
scope.define({
|
|
11853
|
+
...scopeVariable(
|
|
11664
11854
|
parameter4.name,
|
|
11665
11855
|
item,
|
|
11666
11856
|
declared,
|
|
11667
11857
|
void 0,
|
|
11668
|
-
"runtime" /* Runtime
|
|
11669
|
-
|
|
11670
|
-
|
|
11858
|
+
"runtime" /* Runtime */,
|
|
11859
|
+
void 0,
|
|
11860
|
+
alias ? "enumKey" : void 0
|
|
11861
|
+
),
|
|
11862
|
+
...alias ? { pointer: alias } : {}
|
|
11863
|
+
});
|
|
11671
11864
|
return item;
|
|
11672
11865
|
});
|
|
11673
11866
|
this.functionControlBoundaries.push({
|
|
@@ -11714,16 +11907,30 @@ var init_strict_resolver = __esm({
|
|
|
11714
11907
|
this.assertLocalNameAvailable(parameter4.name, scope, parameter4.pos);
|
|
11715
11908
|
const type = parameter4.type ? this.resolveType(parameter4.type) : requiredAt(parameterTypes, index);
|
|
11716
11909
|
const isValueParameter = index === valueParameterIndex;
|
|
11717
|
-
|
|
11718
|
-
|
|
11910
|
+
const item = this.collectionLambdaParameter(
|
|
11911
|
+
parameter4.name,
|
|
11912
|
+
type,
|
|
11913
|
+
collection,
|
|
11914
|
+
index
|
|
11915
|
+
);
|
|
11916
|
+
const alias = this.enumDictionaryKeyPointer(
|
|
11917
|
+
item,
|
|
11918
|
+
type,
|
|
11919
|
+
collection,
|
|
11920
|
+
index
|
|
11921
|
+
);
|
|
11922
|
+
scope.define({
|
|
11923
|
+
...scopeVariable(
|
|
11719
11924
|
parameter4.name,
|
|
11720
|
-
|
|
11925
|
+
item,
|
|
11721
11926
|
type,
|
|
11722
11927
|
isValueParameter ? sourceWritability : "runtime" /* Runtime */,
|
|
11723
11928
|
isValueParameter ? sourceWritability : "runtime" /* Runtime */,
|
|
11724
|
-
isValueParameter ? sourceWriteRoot : "local"
|
|
11725
|
-
|
|
11726
|
-
|
|
11929
|
+
isValueParameter ? sourceWriteRoot : "local",
|
|
11930
|
+
alias ? "enumKey" : void 0
|
|
11931
|
+
),
|
|
11932
|
+
...alias ? { pointer: alias } : {}
|
|
11933
|
+
});
|
|
11727
11934
|
});
|
|
11728
11935
|
let inferred = null;
|
|
11729
11936
|
let inferredWritability = null;
|
|
@@ -14252,7 +14459,9 @@ function inferLocalType(local, snapshot) {
|
|
|
14252
14459
|
tokens[0]?.start ?? snapshot.source.offsetAt(local.nameRange.end)
|
|
14253
14460
|
);
|
|
14254
14461
|
if (!local.collectionIteration) return inferred;
|
|
14255
|
-
if (inferred.kind === "dictionary")
|
|
14462
|
+
if (inferred.kind === "dictionary") {
|
|
14463
|
+
return local.collectionIterationKey ? inferred.keyType : inferred.valueType;
|
|
14464
|
+
}
|
|
14256
14465
|
if (inferred.kind === "list" || inferred.kind === "set") {
|
|
14257
14466
|
return inferred.elementType;
|
|
14258
14467
|
}
|
|
@@ -22707,6 +22916,7 @@ function collectIdentifierReads(expression, names) {
|
|
|
22707
22916
|
walk(statement.collection, visible);
|
|
22708
22917
|
const inner = new Set(visible);
|
|
22709
22918
|
inner.delete(statement.name);
|
|
22919
|
+
if (statement.key) inner.delete(statement.key.name);
|
|
22710
22920
|
for (const bodyStatement of statement.body) {
|
|
22711
22921
|
walkStatement(bodyStatement, inner);
|
|
22712
22922
|
}
|
|
@@ -38029,6 +38239,12 @@ function normalizeDocumentFields(recordKind, value) {
|
|
|
38029
38239
|
}
|
|
38030
38240
|
}
|
|
38031
38241
|
}
|
|
38242
|
+
if (recordKind === "class" && Array.isArray(normalized.genericParams)) {
|
|
38243
|
+
for (const parameter4 of normalized.genericParams) {
|
|
38244
|
+
if (!isRecord(parameter4) || !isRecord(parameter4.constraint)) continue;
|
|
38245
|
+
if (parameter4.constraint.kind === 0) delete parameter4.constraint.kind;
|
|
38246
|
+
}
|
|
38247
|
+
}
|
|
38032
38248
|
omitRedundantDeclarationOrder(recordKind, normalized);
|
|
38033
38249
|
return normalized;
|
|
38034
38250
|
}
|
|
@@ -45095,6 +45311,109 @@ var init_project_manifest = __esm({
|
|
|
45095
45311
|
}
|
|
45096
45312
|
});
|
|
45097
45313
|
|
|
45314
|
+
// src/project-source/source-format.ts
|
|
45315
|
+
function quoteNeoString(value) {
|
|
45316
|
+
return JSON.stringify(value);
|
|
45317
|
+
}
|
|
45318
|
+
function indentNeoSource(value, spaces) {
|
|
45319
|
+
return indentLines(value, spaces, true);
|
|
45320
|
+
}
|
|
45321
|
+
function indentNeoSourceNonEmptyLines(value, spaces) {
|
|
45322
|
+
return indentLines(value, spaces, false);
|
|
45323
|
+
}
|
|
45324
|
+
function indentLines(value, spaces, indentEmptyLines) {
|
|
45325
|
+
const prefix = " ".repeat(spaces);
|
|
45326
|
+
return value.split("\n").map(
|
|
45327
|
+
(line) => indentEmptyLines || line.length > 0 ? `${prefix}${line}` : line
|
|
45328
|
+
).join("\n");
|
|
45329
|
+
}
|
|
45330
|
+
function formatNeoNumber(value) {
|
|
45331
|
+
if (!Number.isFinite(value)) {
|
|
45332
|
+
throw new Error(`Cannot emit non-finite Neo number ${String(value)}.`);
|
|
45333
|
+
}
|
|
45334
|
+
const source = String(value);
|
|
45335
|
+
const match = /^(?<sign>-?)(?<integer>\d+)(?:\.(?<fraction>\d+))?[eE](?<exponent>[+-]?\d+)$/u.exec(
|
|
45336
|
+
source
|
|
45337
|
+
);
|
|
45338
|
+
if (match?.groups === void 0) return source;
|
|
45339
|
+
const sign = match.groups.sign ?? "";
|
|
45340
|
+
const integer3 = match.groups.integer ?? "";
|
|
45341
|
+
const fraction = match.groups.fraction ?? "";
|
|
45342
|
+
const digits = `${integer3}${fraction}`;
|
|
45343
|
+
const decimalIndex = integer3.length + Number(match.groups.exponent);
|
|
45344
|
+
if (decimalIndex <= 0) {
|
|
45345
|
+
return `${sign}0.${"0".repeat(-decimalIndex)}${digits}`;
|
|
45346
|
+
}
|
|
45347
|
+
if (decimalIndex >= digits.length) {
|
|
45348
|
+
return `${sign}${digits}${"0".repeat(decimalIndex - digits.length)}`;
|
|
45349
|
+
}
|
|
45350
|
+
return `${sign}${digits.slice(0, decimalIndex)}.${digits.slice(decimalIndex)}`;
|
|
45351
|
+
}
|
|
45352
|
+
function invariantCaseKey(value) {
|
|
45353
|
+
return value.toLowerCase();
|
|
45354
|
+
}
|
|
45355
|
+
var init_source_format = __esm({
|
|
45356
|
+
"src/project-source/source-format.ts"() {
|
|
45357
|
+
"use strict";
|
|
45358
|
+
init_machine_strings();
|
|
45359
|
+
}
|
|
45360
|
+
});
|
|
45361
|
+
|
|
45362
|
+
// src/project-source/dictionary-enum-keys.ts
|
|
45363
|
+
function lowerDictionaryKey(expression, keyEnum, path) {
|
|
45364
|
+
if (expression.kind === "litString") {
|
|
45365
|
+
if (keyEnum?.optionsByName.has(expression.value)) {
|
|
45366
|
+
throw new Error(
|
|
45367
|
+
`Dictionary key ${JSON.stringify(expression.value)} at ${path} names an option in enum ${JSON.stringify(keyEnum.name)}. Write .${expression.value} or its option ID.`
|
|
45368
|
+
);
|
|
45369
|
+
}
|
|
45370
|
+
return expression.value;
|
|
45371
|
+
}
|
|
45372
|
+
if (keyEnum === null) {
|
|
45373
|
+
throw new Error(`Dictionary ${path} requires string keys.`);
|
|
45374
|
+
}
|
|
45375
|
+
let optionName;
|
|
45376
|
+
if (expression.kind === "contextualEnum") {
|
|
45377
|
+
optionName = expression.name;
|
|
45378
|
+
} else if (expression.kind === "member" && expression.receiver.kind === "ident") {
|
|
45379
|
+
if (expression.receiver.name !== keyEnum.name) {
|
|
45380
|
+
throw new Error(
|
|
45381
|
+
`Dictionary key at ${path} names enum ${JSON.stringify(expression.receiver.name)}, expected ${JSON.stringify(keyEnum.name)}.`
|
|
45382
|
+
);
|
|
45383
|
+
}
|
|
45384
|
+
optionName = expression.name;
|
|
45385
|
+
} else {
|
|
45386
|
+
throw new Error(
|
|
45387
|
+
`Dictionary key at ${path} must be .Option, ${keyEnum.name}.Option, or a quoted option ID.`
|
|
45388
|
+
);
|
|
45389
|
+
}
|
|
45390
|
+
const optionId = keyEnum.optionsByName.get(optionName);
|
|
45391
|
+
if (optionId === void 0) {
|
|
45392
|
+
throw new Error(
|
|
45393
|
+
`Enum ${JSON.stringify(keyEnum.name)} has no option ${JSON.stringify(optionName)} at ${path}.`
|
|
45394
|
+
);
|
|
45395
|
+
}
|
|
45396
|
+
return optionId;
|
|
45397
|
+
}
|
|
45398
|
+
function emitDictionaryKey(key, options) {
|
|
45399
|
+
const name = options?.get(key)?.name;
|
|
45400
|
+
return name === void 0 ? quoteNeoString(key) : `.${name}`;
|
|
45401
|
+
}
|
|
45402
|
+
function orderedDictionaryEntries(value, options) {
|
|
45403
|
+
return Object.entries(value).sort(([left], [right]) => {
|
|
45404
|
+
const leftOrder = options?.get(left)?.order ?? Infinity;
|
|
45405
|
+
const rightOrder = options?.get(right)?.order ?? Infinity;
|
|
45406
|
+
if (leftOrder !== rightOrder) return leftOrder - rightOrder;
|
|
45407
|
+
return compareCodePoints(left, right);
|
|
45408
|
+
});
|
|
45409
|
+
}
|
|
45410
|
+
var init_dictionary_enum_keys = __esm({
|
|
45411
|
+
"src/project-source/dictionary-enum-keys.ts"() {
|
|
45412
|
+
"use strict";
|
|
45413
|
+
init_source_format();
|
|
45414
|
+
}
|
|
45415
|
+
});
|
|
45416
|
+
|
|
45098
45417
|
// ../src/models/system-record-id.ts
|
|
45099
45418
|
function isSystemRecordId(id2) {
|
|
45100
45419
|
return id2.startsWith(SYSTEM_RECORD_ID_PREFIX2);
|
|
@@ -45153,54 +45472,6 @@ var init_declaration_path = __esm({
|
|
|
45153
45472
|
}
|
|
45154
45473
|
});
|
|
45155
45474
|
|
|
45156
|
-
// src/project-source/source-format.ts
|
|
45157
|
-
function quoteNeoString(value) {
|
|
45158
|
-
return JSON.stringify(value);
|
|
45159
|
-
}
|
|
45160
|
-
function indentNeoSource(value, spaces) {
|
|
45161
|
-
return indentLines(value, spaces, true);
|
|
45162
|
-
}
|
|
45163
|
-
function indentNeoSourceNonEmptyLines(value, spaces) {
|
|
45164
|
-
return indentLines(value, spaces, false);
|
|
45165
|
-
}
|
|
45166
|
-
function indentLines(value, spaces, indentEmptyLines) {
|
|
45167
|
-
const prefix = " ".repeat(spaces);
|
|
45168
|
-
return value.split("\n").map(
|
|
45169
|
-
(line) => indentEmptyLines || line.length > 0 ? `${prefix}${line}` : line
|
|
45170
|
-
).join("\n");
|
|
45171
|
-
}
|
|
45172
|
-
function formatNeoNumber(value) {
|
|
45173
|
-
if (!Number.isFinite(value)) {
|
|
45174
|
-
throw new Error(`Cannot emit non-finite Neo number ${String(value)}.`);
|
|
45175
|
-
}
|
|
45176
|
-
const source = String(value);
|
|
45177
|
-
const match = /^(?<sign>-?)(?<integer>\d+)(?:\.(?<fraction>\d+))?[eE](?<exponent>[+-]?\d+)$/u.exec(
|
|
45178
|
-
source
|
|
45179
|
-
);
|
|
45180
|
-
if (match?.groups === void 0) return source;
|
|
45181
|
-
const sign = match.groups.sign ?? "";
|
|
45182
|
-
const integer3 = match.groups.integer ?? "";
|
|
45183
|
-
const fraction = match.groups.fraction ?? "";
|
|
45184
|
-
const digits = `${integer3}${fraction}`;
|
|
45185
|
-
const decimalIndex = integer3.length + Number(match.groups.exponent);
|
|
45186
|
-
if (decimalIndex <= 0) {
|
|
45187
|
-
return `${sign}0.${"0".repeat(-decimalIndex)}${digits}`;
|
|
45188
|
-
}
|
|
45189
|
-
if (decimalIndex >= digits.length) {
|
|
45190
|
-
return `${sign}${digits}${"0".repeat(decimalIndex - digits.length)}`;
|
|
45191
|
-
}
|
|
45192
|
-
return `${sign}${digits.slice(0, decimalIndex)}.${digits.slice(decimalIndex)}`;
|
|
45193
|
-
}
|
|
45194
|
-
function invariantCaseKey(value) {
|
|
45195
|
-
return value.toLowerCase();
|
|
45196
|
-
}
|
|
45197
|
-
var init_source_format = __esm({
|
|
45198
|
-
"src/project-source/source-format.ts"() {
|
|
45199
|
-
"use strict";
|
|
45200
|
-
init_machine_strings();
|
|
45201
|
-
}
|
|
45202
|
-
});
|
|
45203
|
-
|
|
45204
45475
|
// src/project-source/ui-action-source.ts
|
|
45205
45476
|
function isCompleteUIAction(rawAction) {
|
|
45206
45477
|
const action = object(rawAction);
|
|
@@ -52927,7 +53198,7 @@ function assertReadOnlyMembersValid(document) {
|
|
|
52927
53198
|
`Read-only member "${member.name}" (${member.id}) must declare Immutable storage; ${ownerContext}.`
|
|
52928
53199
|
);
|
|
52929
53200
|
}
|
|
52930
|
-
if (isAbstractMember(
|
|
53201
|
+
if (isAbstractMember(resolved) !== true && resolved.kind !== 21 /* Generic */ && resolved.defaultValue === void 0) {
|
|
52931
53202
|
throw new Error(
|
|
52932
53203
|
`Read-only member "${member.name}" (${member.id}) requires an explicit defaultValue; ${ownerContext}.`
|
|
52933
53204
|
);
|
|
@@ -52967,7 +53238,7 @@ function assertReadOnlyMembersValid(document) {
|
|
|
52967
53238
|
`Read-only member "${member.name}" (${member.id}) must be value-bearing in every closed Generic placement; ${ownerContext}.`
|
|
52968
53239
|
);
|
|
52969
53240
|
}
|
|
52970
|
-
if (isAbstractMember(
|
|
53241
|
+
if (isAbstractMember(resolved) === true) continue;
|
|
52971
53242
|
if (effective.defaultValue == null) {
|
|
52972
53243
|
throw new Error(
|
|
52973
53244
|
`Read-only member "${member.name}" (${member.id}) requires an explicit field defaultValue in every closed Generic placement; ${ownerContext}.`
|
|
@@ -52984,7 +53255,7 @@ function assertReadOnlyMembersValid(document) {
|
|
|
52984
53255
|
);
|
|
52985
53256
|
}
|
|
52986
53257
|
}
|
|
52987
|
-
if (isAbstractMember(
|
|
53258
|
+
if (isAbstractMember(resolved) === true) continue;
|
|
52988
53259
|
assertOwnedSchemaIsImmutable({
|
|
52989
53260
|
member,
|
|
52990
53261
|
memberId: member.id,
|
|
@@ -53209,6 +53480,25 @@ function virtualValueId(instanceRootId, sourceIdentity3) {
|
|
|
53209
53480
|
)
|
|
53210
53481
|
);
|
|
53211
53482
|
}
|
|
53483
|
+
function virtualSourceIdentityHead(sourceIdentity3) {
|
|
53484
|
+
const pathStart = sourceIdentity3.indexOf(":$");
|
|
53485
|
+
return pathStart < 0 ? sourceIdentity3 : sourceIdentity3.slice(0, pathStart);
|
|
53486
|
+
}
|
|
53487
|
+
function hasPendingVirtualSourceIdentity(sourceIdentity3) {
|
|
53488
|
+
const head = virtualSourceIdentityHead(sourceIdentity3);
|
|
53489
|
+
return head.startsWith("path:__pending__:") || head.startsWith("__pending__:");
|
|
53490
|
+
}
|
|
53491
|
+
function rewriteVirtualSourceIdentity(sourceIdentity3, rewriteId) {
|
|
53492
|
+
const head = virtualSourceIdentityHead(sourceIdentity3);
|
|
53493
|
+
const path = sourceIdentity3.slice(head.length);
|
|
53494
|
+
if (head.startsWith("path:__pending__:")) {
|
|
53495
|
+
return `path:${rewriteId(head.slice("path:".length))}${path}`;
|
|
53496
|
+
}
|
|
53497
|
+
if (head.startsWith("__pending__:")) {
|
|
53498
|
+
return `${rewriteId(head)}${path}`;
|
|
53499
|
+
}
|
|
53500
|
+
return sourceIdentity3;
|
|
53501
|
+
}
|
|
53212
53502
|
function pendingVirtualValueId(pendingInstanceRootId, sourceIdentity3) {
|
|
53213
53503
|
return `${PENDING_VIRTUAL_VALUE_PREFIX}${encodeURIComponent(pendingInstanceRootId)}:${encodeURIComponent(sourceIdentity3)}`;
|
|
53214
53504
|
}
|
|
@@ -57815,6 +58105,7 @@ function emitProjectSourcesV4(manifest, options = {}) {
|
|
|
57815
58105
|
classes: new Map(manifest.classes.map((entry) => [entry.id, entry])),
|
|
57816
58106
|
interfaces: new Map(manifest.interfaces.map((entry) => [entry.id, entry])),
|
|
57817
58107
|
enums: new Map(manifest.enums.map((entry) => [entry.id, entry])),
|
|
58108
|
+
dictionaryKeyOptions: /* @__PURE__ */ new Map(),
|
|
57818
58109
|
members: new Map(manifest.members.map((entry) => [entry.id, entry])),
|
|
57819
58110
|
constructorsById: new Map(
|
|
57820
58111
|
manifest.constructors.map((entry) => [entry.id, entry])
|
|
@@ -58833,6 +59124,18 @@ function initDefaultSource(member) {
|
|
|
58833
59124
|
if (!("init" in value)) return void 0;
|
|
58834
59125
|
return value.init.code;
|
|
58835
59126
|
}
|
|
59127
|
+
function dictionaryOptions(context, enumId) {
|
|
59128
|
+
const cached = context.dictionaryKeyOptions.get(enumId);
|
|
59129
|
+
if (cached !== void 0) return cached;
|
|
59130
|
+
const result = new Map(
|
|
59131
|
+
required(context.enums, enumId, "enum").options.map((option, order) => [
|
|
59132
|
+
option.id,
|
|
59133
|
+
{ name: option.name, order }
|
|
59134
|
+
])
|
|
59135
|
+
);
|
|
59136
|
+
context.dictionaryKeyOptions.set(enumId, result);
|
|
59137
|
+
return result;
|
|
59138
|
+
}
|
|
58836
59139
|
function renderDefaultValue(context, member, wrapper, enclosingClassId) {
|
|
58837
59140
|
const value = wrapper.value;
|
|
58838
59141
|
if (value === null) return "null";
|
|
@@ -58861,8 +59164,10 @@ function renderDefaultValue(context, member, wrapper, enclosingClassId) {
|
|
|
58861
59164
|
member.entryMemberId,
|
|
58862
59165
|
"dictionary entry"
|
|
58863
59166
|
);
|
|
58864
|
-
|
|
58865
|
-
|
|
59167
|
+
const keyOptions = member.key.kind === "enum" ? dictionaryOptions(context, member.key.enumId) : null;
|
|
59168
|
+
const entries = keyOptions ? orderedDictionaryEntries(value, keyOptions) : Object.entries(value);
|
|
59169
|
+
return `{ ${entries.map(
|
|
59170
|
+
([key, item]) => `${emitDictionaryKey(key, keyOptions)}: ${renderNestedValue(context, entry, item, enclosingClassId)}`
|
|
58866
59171
|
).join(", ")} }`;
|
|
58867
59172
|
}
|
|
58868
59173
|
if (member.kind === "class" && isObject3(value)) {
|
|
@@ -59478,6 +59783,7 @@ var SPECIALIZED_RELATION_PROPERTIES;
|
|
|
59478
59783
|
var init_emitter = __esm({
|
|
59479
59784
|
"src/project-source/emitter.ts"() {
|
|
59480
59785
|
"use strict";
|
|
59786
|
+
init_dictionary_enum_keys();
|
|
59481
59787
|
init_declaration_path();
|
|
59482
59788
|
init_src();
|
|
59483
59789
|
init_source_format();
|
|
@@ -59516,6 +59822,263 @@ var init_emitter = __esm({
|
|
|
59516
59822
|
}
|
|
59517
59823
|
});
|
|
59518
59824
|
|
|
59825
|
+
// ../src/models/dialogue/dialogue-source-identifiers.ts
|
|
59826
|
+
function isDialogueSourceIdentifier(value) {
|
|
59827
|
+
return isValidProjectSourceIdentifier(value);
|
|
59828
|
+
}
|
|
59829
|
+
var init_dialogue_source_identifiers = __esm({
|
|
59830
|
+
"../src/models/dialogue/dialogue-source-identifiers.ts"() {
|
|
59831
|
+
"use strict";
|
|
59832
|
+
init_project_source_identifiers2();
|
|
59833
|
+
}
|
|
59834
|
+
});
|
|
59835
|
+
|
|
59836
|
+
// ../src/models/dialogue/logic-types.ts
|
|
59837
|
+
function isNSBoolGetter2(value) {
|
|
59838
|
+
if (!isNSGetter(value)) return false;
|
|
59839
|
+
if (value.typeInfo.type !== 1 /* Bool */) return false;
|
|
59840
|
+
return value.typeInfo.required === true;
|
|
59841
|
+
}
|
|
59842
|
+
function isNSVoidBody2(value) {
|
|
59843
|
+
if (!isNSGetter(value)) return false;
|
|
59844
|
+
if (value.typeInfo.type !== 0 /* Null */) return false;
|
|
59845
|
+
return value.typeInfo.required === true;
|
|
59846
|
+
}
|
|
59847
|
+
function isUILogicCondition(value) {
|
|
59848
|
+
const v = value;
|
|
59849
|
+
if (typeof v !== "object") return false;
|
|
59850
|
+
if (v === null) return false;
|
|
59851
|
+
if (!isNonEmptyString(v.id)) return false;
|
|
59852
|
+
if (v.type !== 0 /* UI */) return false;
|
|
59853
|
+
if (!isNSBoolGetter2(v.getter)) return false;
|
|
59854
|
+
return isUIRenderableCondition(v.getter);
|
|
59855
|
+
}
|
|
59856
|
+
function isCodeLogicCondition(value) {
|
|
59857
|
+
const v = value;
|
|
59858
|
+
if (typeof v !== "object") return false;
|
|
59859
|
+
if (v === null) return false;
|
|
59860
|
+
if (!isNonEmptyString(v.id)) return false;
|
|
59861
|
+
if (v.type !== 1 /* Code */) return false;
|
|
59862
|
+
if (!isNonEmptyString(v.sourceFunctionId)) return false;
|
|
59863
|
+
if (!isDialogueSourceIdentifier(v.sourceFunctionName)) return false;
|
|
59864
|
+
if (typeof v.code !== "string") return false;
|
|
59865
|
+
return isNSBoolGetter2(v.getter);
|
|
59866
|
+
}
|
|
59867
|
+
function isLogicCondition(value) {
|
|
59868
|
+
return isUILogicCondition(value) || isCodeLogicCondition(value);
|
|
59869
|
+
}
|
|
59870
|
+
function isUILogicAction(value) {
|
|
59871
|
+
const v = value;
|
|
59872
|
+
if (typeof v !== "object") return false;
|
|
59873
|
+
if (v === null) return false;
|
|
59874
|
+
if (v.type !== 0 /* UI */) return false;
|
|
59875
|
+
if (!isNSVoidBody2(v.action)) return false;
|
|
59876
|
+
return isUIRenderableAction(v.action);
|
|
59877
|
+
}
|
|
59878
|
+
function isCodeLogicAction(value) {
|
|
59879
|
+
const v = value;
|
|
59880
|
+
if (typeof v !== "object") return false;
|
|
59881
|
+
if (v === null) return false;
|
|
59882
|
+
if (v.type !== 1 /* Code */) return false;
|
|
59883
|
+
if (!isNonEmptyString(v.sourceFunctionId)) return false;
|
|
59884
|
+
if (!isDialogueSourceIdentifier(v.sourceFunctionName)) return false;
|
|
59885
|
+
if (typeof v.code !== "string") return false;
|
|
59886
|
+
return isNSVoidBody2(v.action);
|
|
59887
|
+
}
|
|
59888
|
+
function isNonEmptyString(value) {
|
|
59889
|
+
return typeof value === "string" && value.length > 0;
|
|
59890
|
+
}
|
|
59891
|
+
function isLogicAction(value) {
|
|
59892
|
+
return isUILogicAction(value) || isCodeLogicAction(value);
|
|
59893
|
+
}
|
|
59894
|
+
function isUIRenderableCondition(getter) {
|
|
59895
|
+
if (getter.instructions.length !== 1) return false;
|
|
59896
|
+
return getter.instructions[0]?.type === "return" /* return */;
|
|
59897
|
+
}
|
|
59898
|
+
function isUIRenderableAction(action) {
|
|
59899
|
+
if (action.instructions.length === 0) return true;
|
|
59900
|
+
if (action.instructions.length !== 1) return false;
|
|
59901
|
+
const instruction = action.instructions[0];
|
|
59902
|
+
if (!instruction) return false;
|
|
59903
|
+
return instruction.type === "return" /* return */ || instruction.type === "assign" /* assign */ || instruction.type === "collectionCall" /* collectionCall */ || instruction.type === "functionCall" /* functionCall */;
|
|
59904
|
+
}
|
|
59905
|
+
function isDialogueLogicCompileTarget(value) {
|
|
59906
|
+
return value === 0 /* Condition */ || value === 1 /* Action */ || value === 2 /* TextVariable */;
|
|
59907
|
+
}
|
|
59908
|
+
function isDialogueLogicCompileDialogueContext(value) {
|
|
59909
|
+
const v = value;
|
|
59910
|
+
if (typeof v !== "object") return false;
|
|
59911
|
+
if (v === null) return false;
|
|
59912
|
+
if (!isOptionalCompileLinkedValues(v.linkedValues)) return false;
|
|
59913
|
+
if (!isOptionalNullableString2(v.primaryLinkedValueId)) return false;
|
|
59914
|
+
if (v.triggerNode === void 0) return true;
|
|
59915
|
+
if (v.triggerNode === null) return true;
|
|
59916
|
+
return isDialogueLogicCompileTriggerContext(v.triggerNode);
|
|
59917
|
+
}
|
|
59918
|
+
function isDialogueLogicCompileNodeContext(value) {
|
|
59919
|
+
const v = value;
|
|
59920
|
+
if (typeof v !== "object") return false;
|
|
59921
|
+
if (v === null) return false;
|
|
59922
|
+
if (!isOptionalCompileLinkedValues(v.linkedValues)) return false;
|
|
59923
|
+
return isOptionalNullableString2(v.primaryLinkedValueId);
|
|
59924
|
+
}
|
|
59925
|
+
function isDialogueLogicCompileDialogueGroupContext(value) {
|
|
59926
|
+
const v = value;
|
|
59927
|
+
if (typeof v !== "object") return false;
|
|
59928
|
+
if (v === null) return false;
|
|
59929
|
+
if (!isOptionalNullableString2(v.name)) return false;
|
|
59930
|
+
if (typeof v.name === "string" && v.name.length > 0 && !isDialogueSourceIdentifier(v.name)) {
|
|
59931
|
+
return false;
|
|
59932
|
+
}
|
|
59933
|
+
if (!isDialogueGroupType(v.type)) return false;
|
|
59934
|
+
if (!isOptionalNullableString2(v.collectionMemberId)) return false;
|
|
59935
|
+
return isOptionalNullableString2(v.collectionValueId);
|
|
59936
|
+
}
|
|
59937
|
+
function isDialogueLogicCompileTextOptionConditionContext(value) {
|
|
59938
|
+
const v = value;
|
|
59939
|
+
if (typeof v !== "object") return false;
|
|
59940
|
+
if (v === null) return false;
|
|
59941
|
+
if (typeof v.nodeId !== "string") return false;
|
|
59942
|
+
if (typeof v.optionId !== "string") return false;
|
|
59943
|
+
return isDialogueTextOptionConditionBucket(v.bucket);
|
|
59944
|
+
}
|
|
59945
|
+
function isDialogueLogicCompileTextVariableContext(value) {
|
|
59946
|
+
const v = value;
|
|
59947
|
+
if (typeof v !== "object") return false;
|
|
59948
|
+
if (v === null) return false;
|
|
59949
|
+
if (typeof v.nodeId !== "string") return false;
|
|
59950
|
+
if (!isNSPointer(v.pointer)) return false;
|
|
59951
|
+
if (typeof v.sourcePath !== "string") return false;
|
|
59952
|
+
if (!isNSTypeInfo(v.typeInfo)) return false;
|
|
59953
|
+
if (typeof v.variableId !== "string") return false;
|
|
59954
|
+
return isOptionalNullableString2(v.optionId);
|
|
59955
|
+
}
|
|
59956
|
+
function isCompileDialogueLogicRequest(value) {
|
|
59957
|
+
const v = value;
|
|
59958
|
+
if (typeof v !== "object") return false;
|
|
59959
|
+
if (v === null) return false;
|
|
59960
|
+
if (typeof v.code !== "string") return false;
|
|
59961
|
+
if (!isDialogueLogicCompileTarget(v.target)) return false;
|
|
59962
|
+
if (v.dialogue === void 0) {
|
|
59963
|
+
if (!isDialogueLogicCompileDialogueGroupContext(v.dialogueGroup)) {
|
|
59964
|
+
return false;
|
|
59965
|
+
}
|
|
59966
|
+
} else if (!isDialogueLogicCompileDialogueContext(v.dialogue)) return false;
|
|
59967
|
+
if (v.dialogueGroup !== void 0) {
|
|
59968
|
+
if (!isDialogueLogicCompileDialogueGroupContext(v.dialogueGroup)) {
|
|
59969
|
+
return false;
|
|
59970
|
+
}
|
|
59971
|
+
}
|
|
59972
|
+
if (v.node !== void 0 && v.node !== null && !isDialogueLogicCompileNodeContext(v.node)) {
|
|
59973
|
+
return false;
|
|
59974
|
+
}
|
|
59975
|
+
if (v.textOptionCondition !== void 0 && v.textOptionCondition !== null && !isDialogueLogicCompileTextOptionConditionContext(v.textOptionCondition)) {
|
|
59976
|
+
return false;
|
|
59977
|
+
}
|
|
59978
|
+
if (v.textVariable === void 0) return true;
|
|
59979
|
+
if (v.textVariable === null) return true;
|
|
59980
|
+
return isDialogueLogicCompileTextVariableContext(v.textVariable);
|
|
59981
|
+
}
|
|
59982
|
+
function isDialogueLogicCompileTriggerContext(value) {
|
|
59983
|
+
const v = value;
|
|
59984
|
+
if (typeof v !== "object") return false;
|
|
59985
|
+
if (v === null) return false;
|
|
59986
|
+
if (!isOptionalCompileLinkedValues(v.linkedValues)) return false;
|
|
59987
|
+
if (!isOptionalNullableString2(v.primaryLinkedValueId)) return false;
|
|
59988
|
+
if (v.dialogueGroupSettings === void 0) return true;
|
|
59989
|
+
if (v.dialogueGroupSettings === null) return true;
|
|
59990
|
+
return isDialogueLogicCompileGroupSettingsContext(v.dialogueGroupSettings);
|
|
59991
|
+
}
|
|
59992
|
+
function isOptionalCompileLinkedValues(value) {
|
|
59993
|
+
if (value === void 0) return true;
|
|
59994
|
+
if (!Array.isArray(value)) return false;
|
|
59995
|
+
return value.every((candidate) => {
|
|
59996
|
+
const linked = candidate;
|
|
59997
|
+
return typeof linked === "object" && linked !== null && typeof linked.valueId === "string" && (linked.sourceName === void 0 || isDialogueSourceIdentifier(linked.sourceName)) && (linked.declaredTypeName === void 0 || linked.declaredTypeName === null || isDialogueSourceIdentifier(linked.declaredTypeName));
|
|
59998
|
+
});
|
|
59999
|
+
}
|
|
60000
|
+
function isDialogueLogicCompileGroupSettingsContext(value) {
|
|
60001
|
+
const v = value;
|
|
60002
|
+
if (typeof v !== "object") return false;
|
|
60003
|
+
if (v === null) return false;
|
|
60004
|
+
return isOptionalNullableString2(v.lookupValueId);
|
|
60005
|
+
}
|
|
60006
|
+
function isOptionalNullableString2(value) {
|
|
60007
|
+
if (value === void 0) return true;
|
|
60008
|
+
if (value === null) return true;
|
|
60009
|
+
return typeof value === "string";
|
|
60010
|
+
}
|
|
60011
|
+
function isDialogueTextOptionConditionBucket(value) {
|
|
60012
|
+
return value === "conditions" || value === "selectableConditions";
|
|
60013
|
+
}
|
|
60014
|
+
function isDialogueGroupType(value) {
|
|
60015
|
+
return value === 0 /* Standard */ || value === 1 /* Lookup */ || value === 2 /* Folder */;
|
|
60016
|
+
}
|
|
60017
|
+
var init_logic_types = __esm({
|
|
60018
|
+
"../src/models/dialogue/logic-types.ts"() {
|
|
60019
|
+
"use strict";
|
|
60020
|
+
init_members();
|
|
60021
|
+
init_neoscript();
|
|
60022
|
+
init_dialogue_group_types();
|
|
60023
|
+
init_dialogue_source_identifiers();
|
|
60024
|
+
}
|
|
60025
|
+
});
|
|
60026
|
+
|
|
60027
|
+
// ../src/models/dialogue/dialogue-group-types.ts
|
|
60028
|
+
function isOptionalNullableString3(value) {
|
|
60029
|
+
if (value === void 0) return true;
|
|
60030
|
+
if (value === null) return true;
|
|
60031
|
+
return typeof value === "string";
|
|
60032
|
+
}
|
|
60033
|
+
function isDialogueGroupType2(value) {
|
|
60034
|
+
return value === 0 /* Standard */ || value === 1 /* Lookup */ || value === 2 /* Folder */;
|
|
60035
|
+
}
|
|
60036
|
+
function isDialogueGroupBase(value, expectedType) {
|
|
60037
|
+
const v = value;
|
|
60038
|
+
if (typeof v !== "object") return false;
|
|
60039
|
+
if (v === null) return false;
|
|
60040
|
+
if (typeof v.name !== "string") return false;
|
|
60041
|
+
if (!isDialogueGroupType2(v.type)) return false;
|
|
60042
|
+
if (expectedType !== void 0 && v.type !== expectedType) return false;
|
|
60043
|
+
if (!isOptionalNullableString3(v.parentDialogueGroupId)) return false;
|
|
60044
|
+
if (!Array.isArray(v.conditions)) return false;
|
|
60045
|
+
if (!v.conditions.every(isLogicCondition)) return false;
|
|
60046
|
+
return isOptionalNullableString3(v.priorityGroupIdOverride);
|
|
60047
|
+
}
|
|
60048
|
+
function isStandardDialogueGroupBase(value) {
|
|
60049
|
+
return isDialogueGroupBase(value, 0 /* Standard */);
|
|
60050
|
+
}
|
|
60051
|
+
function isLookupDialogueGroupBase(value) {
|
|
60052
|
+
const v = value;
|
|
60053
|
+
if (!isDialogueGroupBase(value, 1 /* Lookup */)) return false;
|
|
60054
|
+
if (typeof v?.collectionMemberId !== "string") return false;
|
|
60055
|
+
return isOptionalNullableString3(v.collectionValueId);
|
|
60056
|
+
}
|
|
60057
|
+
function isFolderDialogueGroupBase(value) {
|
|
60058
|
+
return isDialogueGroupBase(value, 2 /* Folder */);
|
|
60059
|
+
}
|
|
60060
|
+
function isDialogueGroupProps(value, expectedType) {
|
|
60061
|
+
const v = value;
|
|
60062
|
+
if (!isDialogueGroupBase(value, expectedType)) return false;
|
|
60063
|
+
if (!isWithId(value)) return false;
|
|
60064
|
+
if (!isIWithTimestamps(value)) return false;
|
|
60065
|
+
return typeof v?.projectId === "string";
|
|
60066
|
+
}
|
|
60067
|
+
function isDialogueGroup(value, expectedType) {
|
|
60068
|
+
return isDialogueGroupProps(value, expectedType);
|
|
60069
|
+
}
|
|
60070
|
+
function isAnyDialogueGroup(value) {
|
|
60071
|
+
if (!isDialogueGroup(value)) return false;
|
|
60072
|
+
return isStandardDialogueGroupBase(value) || isLookupDialogueGroupBase(value) || isFolderDialogueGroupBase(value);
|
|
60073
|
+
}
|
|
60074
|
+
var init_dialogue_group_types = __esm({
|
|
60075
|
+
"../src/models/dialogue/dialogue-group-types.ts"() {
|
|
60076
|
+
"use strict";
|
|
60077
|
+
init_core();
|
|
60078
|
+
init_logic_types();
|
|
60079
|
+
}
|
|
60080
|
+
});
|
|
60081
|
+
|
|
59519
60082
|
// ../src/database/neoscript/project-file-registry.ts
|
|
59520
60083
|
function projectFileRegistryProjection(files) {
|
|
59521
60084
|
const symbols = assignDeterministicProjectFileSymbols(
|
|
@@ -60478,22 +61041,33 @@ function lowerPriorityGroup(baseValue, global) {
|
|
|
60478
61041
|
}
|
|
60479
61042
|
return result;
|
|
60480
61043
|
}
|
|
60481
|
-
function
|
|
60482
|
-
const base = optionalBase(baseValue);
|
|
60483
|
-
const baseWithoutLookup = { ...base };
|
|
60484
|
-
Reflect.deleteProperty(baseWithoutLookup, "collectionMemberId");
|
|
60485
|
-
Reflect.deleteProperty(baseWithoutLookup, "collectionValueId");
|
|
61044
|
+
function sourceDialogueGroupType(global) {
|
|
60486
61045
|
const authored = parseDialogueGroupInitializer(global.initializer);
|
|
60487
|
-
|
|
61046
|
+
return dialogueGroupType(
|
|
61047
|
+
global.name,
|
|
61048
|
+
constructorArguments(authored.constructor, "DialogueGroup")
|
|
61049
|
+
);
|
|
61050
|
+
}
|
|
61051
|
+
function dialogueGroupType(name, args) {
|
|
60488
61052
|
const kind = args.get("kind");
|
|
60489
61053
|
if (kind?.kind !== "contextualEnum") {
|
|
60490
61054
|
throw new Error(
|
|
60491
|
-
`DialogueGroup ${
|
|
61055
|
+
`DialogueGroup ${name} requires kind: .Standard, .Lookup, or .Folder.`
|
|
60492
61056
|
);
|
|
60493
61057
|
}
|
|
60494
|
-
const type = kind.name === "Lookup" ? 1 : kind.name === "Folder" ? 2 : kind.name === "Standard" ? 0 : null;
|
|
61058
|
+
const type = kind.name === "Lookup" ? 1 /* Lookup */ : kind.name === "Folder" ? 2 /* Folder */ : kind.name === "Standard" ? 0 /* Standard */ : null;
|
|
60495
61059
|
if (type === null)
|
|
60496
61060
|
throw new Error(`Unknown dialogue group kind .${kind.name}.`);
|
|
61061
|
+
return type;
|
|
61062
|
+
}
|
|
61063
|
+
function lowerDialogueGroup(baseValue, global, priorityIds, dialogueIds, uiLogicResolver) {
|
|
61064
|
+
const base = optionalBase(baseValue);
|
|
61065
|
+
const baseWithoutLookup = { ...base };
|
|
61066
|
+
Reflect.deleteProperty(baseWithoutLookup, "collectionMemberId");
|
|
61067
|
+
Reflect.deleteProperty(baseWithoutLookup, "collectionValueId");
|
|
61068
|
+
const authored = parseDialogueGroupInitializer(global.initializer);
|
|
61069
|
+
const args = constructorArguments(authored.constructor, "DialogueGroup");
|
|
61070
|
+
const type = dialogueGroupType(global.name, args);
|
|
60497
61071
|
const collectionMemberId = resolveOptionalReference(
|
|
60498
61072
|
args.get("collection"),
|
|
60499
61073
|
/* @__PURE__ */ new Map()
|
|
@@ -61081,6 +61655,7 @@ var init_supplemental_records = __esm({
|
|
|
61081
61655
|
"use strict";
|
|
61082
61656
|
init_src();
|
|
61083
61657
|
init_declaration_path();
|
|
61658
|
+
init_dialogue_group_types();
|
|
61084
61659
|
init_projection();
|
|
61085
61660
|
init_project_file_source();
|
|
61086
61661
|
init_source_format();
|
|
@@ -61089,263 +61664,6 @@ var init_supplemental_records = __esm({
|
|
|
61089
61664
|
}
|
|
61090
61665
|
});
|
|
61091
61666
|
|
|
61092
|
-
// ../src/models/dialogue/dialogue-group-types.ts
|
|
61093
|
-
function isOptionalNullableString2(value) {
|
|
61094
|
-
if (value === void 0) return true;
|
|
61095
|
-
if (value === null) return true;
|
|
61096
|
-
return typeof value === "string";
|
|
61097
|
-
}
|
|
61098
|
-
function isDialogueGroupType(value) {
|
|
61099
|
-
return value === 0 /* Standard */ || value === 1 /* Lookup */ || value === 2 /* Folder */;
|
|
61100
|
-
}
|
|
61101
|
-
function isDialogueGroupBase(value, expectedType) {
|
|
61102
|
-
const v = value;
|
|
61103
|
-
if (typeof v !== "object") return false;
|
|
61104
|
-
if (v === null) return false;
|
|
61105
|
-
if (typeof v.name !== "string") return false;
|
|
61106
|
-
if (!isDialogueGroupType(v.type)) return false;
|
|
61107
|
-
if (expectedType !== void 0 && v.type !== expectedType) return false;
|
|
61108
|
-
if (!isOptionalNullableString2(v.parentDialogueGroupId)) return false;
|
|
61109
|
-
if (!Array.isArray(v.conditions)) return false;
|
|
61110
|
-
if (!v.conditions.every(isLogicCondition)) return false;
|
|
61111
|
-
return isOptionalNullableString2(v.priorityGroupIdOverride);
|
|
61112
|
-
}
|
|
61113
|
-
function isStandardDialogueGroupBase(value) {
|
|
61114
|
-
return isDialogueGroupBase(value, 0 /* Standard */);
|
|
61115
|
-
}
|
|
61116
|
-
function isLookupDialogueGroupBase(value) {
|
|
61117
|
-
const v = value;
|
|
61118
|
-
if (!isDialogueGroupBase(value, 1 /* Lookup */)) return false;
|
|
61119
|
-
if (typeof v?.collectionMemberId !== "string") return false;
|
|
61120
|
-
return isOptionalNullableString2(v.collectionValueId);
|
|
61121
|
-
}
|
|
61122
|
-
function isFolderDialogueGroupBase(value) {
|
|
61123
|
-
return isDialogueGroupBase(value, 2 /* Folder */);
|
|
61124
|
-
}
|
|
61125
|
-
function isDialogueGroupProps(value, expectedType) {
|
|
61126
|
-
const v = value;
|
|
61127
|
-
if (!isDialogueGroupBase(value, expectedType)) return false;
|
|
61128
|
-
if (!isWithId(value)) return false;
|
|
61129
|
-
if (!isIWithTimestamps(value)) return false;
|
|
61130
|
-
return typeof v?.projectId === "string";
|
|
61131
|
-
}
|
|
61132
|
-
function isDialogueGroup(value, expectedType) {
|
|
61133
|
-
return isDialogueGroupProps(value, expectedType);
|
|
61134
|
-
}
|
|
61135
|
-
function isAnyDialogueGroup(value) {
|
|
61136
|
-
if (!isDialogueGroup(value)) return false;
|
|
61137
|
-
return isStandardDialogueGroupBase(value) || isLookupDialogueGroupBase(value) || isFolderDialogueGroupBase(value);
|
|
61138
|
-
}
|
|
61139
|
-
var init_dialogue_group_types = __esm({
|
|
61140
|
-
"../src/models/dialogue/dialogue-group-types.ts"() {
|
|
61141
|
-
"use strict";
|
|
61142
|
-
init_core();
|
|
61143
|
-
init_logic_types();
|
|
61144
|
-
}
|
|
61145
|
-
});
|
|
61146
|
-
|
|
61147
|
-
// ../src/models/dialogue/dialogue-source-identifiers.ts
|
|
61148
|
-
function isDialogueSourceIdentifier(value) {
|
|
61149
|
-
return isValidProjectSourceIdentifier(value);
|
|
61150
|
-
}
|
|
61151
|
-
var init_dialogue_source_identifiers = __esm({
|
|
61152
|
-
"../src/models/dialogue/dialogue-source-identifiers.ts"() {
|
|
61153
|
-
"use strict";
|
|
61154
|
-
init_project_source_identifiers2();
|
|
61155
|
-
}
|
|
61156
|
-
});
|
|
61157
|
-
|
|
61158
|
-
// ../src/models/dialogue/logic-types.ts
|
|
61159
|
-
function isNSBoolGetter2(value) {
|
|
61160
|
-
if (!isNSGetter(value)) return false;
|
|
61161
|
-
if (value.typeInfo.type !== 1 /* Bool */) return false;
|
|
61162
|
-
return value.typeInfo.required === true;
|
|
61163
|
-
}
|
|
61164
|
-
function isNSVoidBody2(value) {
|
|
61165
|
-
if (!isNSGetter(value)) return false;
|
|
61166
|
-
if (value.typeInfo.type !== 0 /* Null */) return false;
|
|
61167
|
-
return value.typeInfo.required === true;
|
|
61168
|
-
}
|
|
61169
|
-
function isUILogicCondition(value) {
|
|
61170
|
-
const v = value;
|
|
61171
|
-
if (typeof v !== "object") return false;
|
|
61172
|
-
if (v === null) return false;
|
|
61173
|
-
if (!isNonEmptyString(v.id)) return false;
|
|
61174
|
-
if (v.type !== 0 /* UI */) return false;
|
|
61175
|
-
if (!isNSBoolGetter2(v.getter)) return false;
|
|
61176
|
-
return isUIRenderableCondition(v.getter);
|
|
61177
|
-
}
|
|
61178
|
-
function isCodeLogicCondition(value) {
|
|
61179
|
-
const v = value;
|
|
61180
|
-
if (typeof v !== "object") return false;
|
|
61181
|
-
if (v === null) return false;
|
|
61182
|
-
if (!isNonEmptyString(v.id)) return false;
|
|
61183
|
-
if (v.type !== 1 /* Code */) return false;
|
|
61184
|
-
if (!isNonEmptyString(v.sourceFunctionId)) return false;
|
|
61185
|
-
if (!isDialogueSourceIdentifier(v.sourceFunctionName)) return false;
|
|
61186
|
-
if (typeof v.code !== "string") return false;
|
|
61187
|
-
return isNSBoolGetter2(v.getter);
|
|
61188
|
-
}
|
|
61189
|
-
function isLogicCondition(value) {
|
|
61190
|
-
return isUILogicCondition(value) || isCodeLogicCondition(value);
|
|
61191
|
-
}
|
|
61192
|
-
function isUILogicAction(value) {
|
|
61193
|
-
const v = value;
|
|
61194
|
-
if (typeof v !== "object") return false;
|
|
61195
|
-
if (v === null) return false;
|
|
61196
|
-
if (v.type !== 0 /* UI */) return false;
|
|
61197
|
-
if (!isNSVoidBody2(v.action)) return false;
|
|
61198
|
-
return isUIRenderableAction(v.action);
|
|
61199
|
-
}
|
|
61200
|
-
function isCodeLogicAction(value) {
|
|
61201
|
-
const v = value;
|
|
61202
|
-
if (typeof v !== "object") return false;
|
|
61203
|
-
if (v === null) return false;
|
|
61204
|
-
if (v.type !== 1 /* Code */) return false;
|
|
61205
|
-
if (!isNonEmptyString(v.sourceFunctionId)) return false;
|
|
61206
|
-
if (!isDialogueSourceIdentifier(v.sourceFunctionName)) return false;
|
|
61207
|
-
if (typeof v.code !== "string") return false;
|
|
61208
|
-
return isNSVoidBody2(v.action);
|
|
61209
|
-
}
|
|
61210
|
-
function isNonEmptyString(value) {
|
|
61211
|
-
return typeof value === "string" && value.length > 0;
|
|
61212
|
-
}
|
|
61213
|
-
function isLogicAction(value) {
|
|
61214
|
-
return isUILogicAction(value) || isCodeLogicAction(value);
|
|
61215
|
-
}
|
|
61216
|
-
function isUIRenderableCondition(getter) {
|
|
61217
|
-
if (getter.instructions.length !== 1) return false;
|
|
61218
|
-
return getter.instructions[0]?.type === "return" /* return */;
|
|
61219
|
-
}
|
|
61220
|
-
function isUIRenderableAction(action) {
|
|
61221
|
-
if (action.instructions.length === 0) return true;
|
|
61222
|
-
if (action.instructions.length !== 1) return false;
|
|
61223
|
-
const instruction = action.instructions[0];
|
|
61224
|
-
if (!instruction) return false;
|
|
61225
|
-
return instruction.type === "return" /* return */ || instruction.type === "assign" /* assign */ || instruction.type === "collectionCall" /* collectionCall */ || instruction.type === "functionCall" /* functionCall */;
|
|
61226
|
-
}
|
|
61227
|
-
function isDialogueLogicCompileTarget(value) {
|
|
61228
|
-
return value === 0 /* Condition */ || value === 1 /* Action */ || value === 2 /* TextVariable */;
|
|
61229
|
-
}
|
|
61230
|
-
function isDialogueLogicCompileDialogueContext(value) {
|
|
61231
|
-
const v = value;
|
|
61232
|
-
if (typeof v !== "object") return false;
|
|
61233
|
-
if (v === null) return false;
|
|
61234
|
-
if (!isOptionalCompileLinkedValues(v.linkedValues)) return false;
|
|
61235
|
-
if (!isOptionalNullableString3(v.primaryLinkedValueId)) return false;
|
|
61236
|
-
if (v.triggerNode === void 0) return true;
|
|
61237
|
-
if (v.triggerNode === null) return true;
|
|
61238
|
-
return isDialogueLogicCompileTriggerContext(v.triggerNode);
|
|
61239
|
-
}
|
|
61240
|
-
function isDialogueLogicCompileNodeContext(value) {
|
|
61241
|
-
const v = value;
|
|
61242
|
-
if (typeof v !== "object") return false;
|
|
61243
|
-
if (v === null) return false;
|
|
61244
|
-
if (!isOptionalCompileLinkedValues(v.linkedValues)) return false;
|
|
61245
|
-
return isOptionalNullableString3(v.primaryLinkedValueId);
|
|
61246
|
-
}
|
|
61247
|
-
function isDialogueLogicCompileDialogueGroupContext(value) {
|
|
61248
|
-
const v = value;
|
|
61249
|
-
if (typeof v !== "object") return false;
|
|
61250
|
-
if (v === null) return false;
|
|
61251
|
-
if (!isOptionalNullableString3(v.name)) return false;
|
|
61252
|
-
if (typeof v.name === "string" && v.name.length > 0 && !isDialogueSourceIdentifier(v.name)) {
|
|
61253
|
-
return false;
|
|
61254
|
-
}
|
|
61255
|
-
if (!isDialogueGroupType2(v.type)) return false;
|
|
61256
|
-
if (!isOptionalNullableString3(v.collectionMemberId)) return false;
|
|
61257
|
-
return isOptionalNullableString3(v.collectionValueId);
|
|
61258
|
-
}
|
|
61259
|
-
function isDialogueLogicCompileTextOptionConditionContext(value) {
|
|
61260
|
-
const v = value;
|
|
61261
|
-
if (typeof v !== "object") return false;
|
|
61262
|
-
if (v === null) return false;
|
|
61263
|
-
if (typeof v.nodeId !== "string") return false;
|
|
61264
|
-
if (typeof v.optionId !== "string") return false;
|
|
61265
|
-
return isDialogueTextOptionConditionBucket(v.bucket);
|
|
61266
|
-
}
|
|
61267
|
-
function isDialogueLogicCompileTextVariableContext(value) {
|
|
61268
|
-
const v = value;
|
|
61269
|
-
if (typeof v !== "object") return false;
|
|
61270
|
-
if (v === null) return false;
|
|
61271
|
-
if (typeof v.nodeId !== "string") return false;
|
|
61272
|
-
if (!isNSPointer(v.pointer)) return false;
|
|
61273
|
-
if (typeof v.sourcePath !== "string") return false;
|
|
61274
|
-
if (!isNSTypeInfo(v.typeInfo)) return false;
|
|
61275
|
-
if (typeof v.variableId !== "string") return false;
|
|
61276
|
-
return isOptionalNullableString3(v.optionId);
|
|
61277
|
-
}
|
|
61278
|
-
function isCompileDialogueLogicRequest(value) {
|
|
61279
|
-
const v = value;
|
|
61280
|
-
if (typeof v !== "object") return false;
|
|
61281
|
-
if (v === null) return false;
|
|
61282
|
-
if (typeof v.code !== "string") return false;
|
|
61283
|
-
if (!isDialogueLogicCompileTarget(v.target)) return false;
|
|
61284
|
-
if (v.dialogue === void 0) {
|
|
61285
|
-
if (!isDialogueLogicCompileDialogueGroupContext(v.dialogueGroup)) {
|
|
61286
|
-
return false;
|
|
61287
|
-
}
|
|
61288
|
-
} else if (!isDialogueLogicCompileDialogueContext(v.dialogue)) return false;
|
|
61289
|
-
if (v.dialogueGroup !== void 0) {
|
|
61290
|
-
if (!isDialogueLogicCompileDialogueGroupContext(v.dialogueGroup)) {
|
|
61291
|
-
return false;
|
|
61292
|
-
}
|
|
61293
|
-
}
|
|
61294
|
-
if (v.node !== void 0 && v.node !== null && !isDialogueLogicCompileNodeContext(v.node)) {
|
|
61295
|
-
return false;
|
|
61296
|
-
}
|
|
61297
|
-
if (v.textOptionCondition !== void 0 && v.textOptionCondition !== null && !isDialogueLogicCompileTextOptionConditionContext(v.textOptionCondition)) {
|
|
61298
|
-
return false;
|
|
61299
|
-
}
|
|
61300
|
-
if (v.textVariable === void 0) return true;
|
|
61301
|
-
if (v.textVariable === null) return true;
|
|
61302
|
-
return isDialogueLogicCompileTextVariableContext(v.textVariable);
|
|
61303
|
-
}
|
|
61304
|
-
function isDialogueLogicCompileTriggerContext(value) {
|
|
61305
|
-
const v = value;
|
|
61306
|
-
if (typeof v !== "object") return false;
|
|
61307
|
-
if (v === null) return false;
|
|
61308
|
-
if (!isOptionalCompileLinkedValues(v.linkedValues)) return false;
|
|
61309
|
-
if (!isOptionalNullableString3(v.primaryLinkedValueId)) return false;
|
|
61310
|
-
if (v.dialogueGroupSettings === void 0) return true;
|
|
61311
|
-
if (v.dialogueGroupSettings === null) return true;
|
|
61312
|
-
return isDialogueLogicCompileGroupSettingsContext(v.dialogueGroupSettings);
|
|
61313
|
-
}
|
|
61314
|
-
function isOptionalCompileLinkedValues(value) {
|
|
61315
|
-
if (value === void 0) return true;
|
|
61316
|
-
if (!Array.isArray(value)) return false;
|
|
61317
|
-
return value.every((candidate) => {
|
|
61318
|
-
const linked = candidate;
|
|
61319
|
-
return typeof linked === "object" && linked !== null && typeof linked.valueId === "string" && (linked.sourceName === void 0 || isDialogueSourceIdentifier(linked.sourceName)) && (linked.declaredTypeName === void 0 || linked.declaredTypeName === null || isDialogueSourceIdentifier(linked.declaredTypeName));
|
|
61320
|
-
});
|
|
61321
|
-
}
|
|
61322
|
-
function isDialogueLogicCompileGroupSettingsContext(value) {
|
|
61323
|
-
const v = value;
|
|
61324
|
-
if (typeof v !== "object") return false;
|
|
61325
|
-
if (v === null) return false;
|
|
61326
|
-
return isOptionalNullableString3(v.lookupValueId);
|
|
61327
|
-
}
|
|
61328
|
-
function isOptionalNullableString3(value) {
|
|
61329
|
-
if (value === void 0) return true;
|
|
61330
|
-
if (value === null) return true;
|
|
61331
|
-
return typeof value === "string";
|
|
61332
|
-
}
|
|
61333
|
-
function isDialogueTextOptionConditionBucket(value) {
|
|
61334
|
-
return value === "conditions" || value === "selectableConditions";
|
|
61335
|
-
}
|
|
61336
|
-
function isDialogueGroupType2(value) {
|
|
61337
|
-
return value === 0 /* Standard */ || value === 1 /* Lookup */ || value === 2 /* Folder */;
|
|
61338
|
-
}
|
|
61339
|
-
var init_logic_types = __esm({
|
|
61340
|
-
"../src/models/dialogue/logic-types.ts"() {
|
|
61341
|
-
"use strict";
|
|
61342
|
-
init_members();
|
|
61343
|
-
init_neoscript();
|
|
61344
|
-
init_dialogue_group_types();
|
|
61345
|
-
init_dialogue_source_identifiers();
|
|
61346
|
-
}
|
|
61347
|
-
});
|
|
61348
|
-
|
|
61349
61667
|
// ../src/models/dialogue/dialogue-types.ts
|
|
61350
61668
|
function isNonArrayObject(value) {
|
|
61351
61669
|
if (!isRequiredType(value, isObject)) return false;
|
|
@@ -68646,6 +68964,76 @@ var init_unattributable_reads = __esm({
|
|
|
68646
68964
|
}
|
|
68647
68965
|
});
|
|
68648
68966
|
|
|
68967
|
+
// ../src/runtime/neoscript/NSGetterRuntimeError.ts
|
|
68968
|
+
var NSGetterRuntimeError, UncompiledInitializerRuntimeError;
|
|
68969
|
+
var init_NSGetterRuntimeError = __esm({
|
|
68970
|
+
"../src/runtime/neoscript/NSGetterRuntimeError.ts"() {
|
|
68971
|
+
"use strict";
|
|
68972
|
+
NSGetterRuntimeError = class extends Error {
|
|
68973
|
+
constructor(message, options) {
|
|
68974
|
+
super(message, options);
|
|
68975
|
+
this.name = "NSGetterRuntimeError";
|
|
68976
|
+
}
|
|
68977
|
+
};
|
|
68978
|
+
UncompiledInitializerRuntimeError = class extends NSGetterRuntimeError {
|
|
68979
|
+
constructor(memberId, memberName, initializer = null, valueId = null) {
|
|
68980
|
+
super(
|
|
68981
|
+
`Initializer for '${memberName}' has no compiled body; push the project so the server compiles it.`
|
|
68982
|
+
);
|
|
68983
|
+
this.memberId = memberId;
|
|
68984
|
+
this.initializer = initializer;
|
|
68985
|
+
this.valueId = valueId;
|
|
68986
|
+
this.name = "UncompiledInitializerRuntimeError";
|
|
68987
|
+
}
|
|
68988
|
+
memberId;
|
|
68989
|
+
initializer;
|
|
68990
|
+
valueId;
|
|
68991
|
+
};
|
|
68992
|
+
}
|
|
68993
|
+
});
|
|
68994
|
+
|
|
68995
|
+
// ../src/runtime/neoscript/initializer-dependencies.ts
|
|
68996
|
+
function materializeInitializerDependencies(pending, materialize) {
|
|
68997
|
+
const active = /* @__PURE__ */ new Set();
|
|
68998
|
+
for (const rootId of pending) {
|
|
68999
|
+
const stack = [rootId];
|
|
69000
|
+
active.add(rootId);
|
|
69001
|
+
while (stack.length > 0) {
|
|
69002
|
+
const valueId = stack[stack.length - 1];
|
|
69003
|
+
try {
|
|
69004
|
+
materialize(valueId);
|
|
69005
|
+
pending.delete(valueId);
|
|
69006
|
+
active.delete(valueId);
|
|
69007
|
+
stack.pop();
|
|
69008
|
+
} catch (error) {
|
|
69009
|
+
if (!(error instanceof PendingInitializerDependency)) throw error;
|
|
69010
|
+
if (!pending.has(error.valueId)) throw error;
|
|
69011
|
+
if (active.has(error.valueId)) {
|
|
69012
|
+
throw new Error(
|
|
69013
|
+
`Initializer dependency cycle: ${[...stack, error.valueId].join(" -> ")}.`
|
|
69014
|
+
);
|
|
69015
|
+
}
|
|
69016
|
+
active.add(error.valueId);
|
|
69017
|
+
stack.push(error.valueId);
|
|
69018
|
+
}
|
|
69019
|
+
}
|
|
69020
|
+
}
|
|
69021
|
+
}
|
|
69022
|
+
var PendingInitializerDependency;
|
|
69023
|
+
var init_initializer_dependencies = __esm({
|
|
69024
|
+
"../src/runtime/neoscript/initializer-dependencies.ts"() {
|
|
69025
|
+
"use strict";
|
|
69026
|
+
init_NSGetterRuntimeError();
|
|
69027
|
+
PendingInitializerDependency = class extends NSGetterRuntimeError {
|
|
69028
|
+
constructor(valueId) {
|
|
69029
|
+
super(`Initializer dependency "${valueId}" has not been materialized.`);
|
|
69030
|
+
this.valueId = valueId;
|
|
69031
|
+
}
|
|
69032
|
+
valueId;
|
|
69033
|
+
};
|
|
69034
|
+
}
|
|
69035
|
+
});
|
|
69036
|
+
|
|
68649
69037
|
// ../src/runtime/neoscript/cell-pattern.ts
|
|
68650
69038
|
function integer2(value, name, minimum = -2147483648) {
|
|
68651
69039
|
if (typeof value !== "number" || !Number.isInteger(value)) {
|
|
@@ -70581,37 +70969,9 @@ var init_NeoScriptScope = __esm({
|
|
|
70581
70969
|
}
|
|
70582
70970
|
});
|
|
70583
70971
|
|
|
70584
|
-
// ../src/runtime/neoscript/NSGetterRuntimeError.ts
|
|
70585
|
-
var NSGetterRuntimeError, UncompiledInitializerRuntimeError;
|
|
70586
|
-
var init_NSGetterRuntimeError = __esm({
|
|
70587
|
-
"../src/runtime/neoscript/NSGetterRuntimeError.ts"() {
|
|
70588
|
-
"use strict";
|
|
70589
|
-
NSGetterRuntimeError = class extends Error {
|
|
70590
|
-
constructor(message, options) {
|
|
70591
|
-
super(message, options);
|
|
70592
|
-
this.name = "NSGetterRuntimeError";
|
|
70593
|
-
}
|
|
70594
|
-
};
|
|
70595
|
-
UncompiledInitializerRuntimeError = class extends NSGetterRuntimeError {
|
|
70596
|
-
constructor(memberId, memberName, initializer = null, valueId = null) {
|
|
70597
|
-
super(
|
|
70598
|
-
`Initializer for '${memberName}' has no compiled body; push the project so the server compiles it.`
|
|
70599
|
-
);
|
|
70600
|
-
this.memberId = memberId;
|
|
70601
|
-
this.initializer = initializer;
|
|
70602
|
-
this.valueId = valueId;
|
|
70603
|
-
this.name = "UncompiledInitializerRuntimeError";
|
|
70604
|
-
}
|
|
70605
|
-
memberId;
|
|
70606
|
-
initializer;
|
|
70607
|
-
valueId;
|
|
70608
|
-
};
|
|
70609
|
-
}
|
|
70610
|
-
});
|
|
70611
|
-
|
|
70612
70972
|
// ../src/runtime/neoscript/evaluateNSGetter.ts
|
|
70613
70973
|
function isCatchableNeoScriptRuntimeError(error) {
|
|
70614
|
-
return error instanceof NSGetterRuntimeError && !(error instanceof UncompiledInitializerRuntimeError) && !(error instanceof NonCatchableNSGetterRuntimeError);
|
|
70974
|
+
return error instanceof NSGetterRuntimeError && !(error instanceof UncompiledInitializerRuntimeError) && !(error instanceof PendingInitializerDependency) && !(error instanceof NonCatchableNSGetterRuntimeError);
|
|
70615
70975
|
}
|
|
70616
70976
|
function makeUnindexedEvaluatorLookups(members, storedValues) {
|
|
70617
70977
|
const values = expandPackedValueRows(storedValues);
|
|
@@ -73910,7 +74270,7 @@ function evalStaticMember(memberId, ctx) {
|
|
|
73910
74270
|
`Static member '${member.name}' is bound to missing value '${targetId}'.`
|
|
73911
74271
|
);
|
|
73912
74272
|
}
|
|
73913
|
-
return shouldUnwrapSingleLookupValue(member) ? unwrapSingleLookupValue(row
|
|
74273
|
+
return shouldUnwrapSingleLookupValue(member) ? unwrapSingleLookupValue(readRowValue(row, ctx), ctx) : resolveLocalizedRowValueForMember(row, member, ctx);
|
|
73914
74274
|
}
|
|
73915
74275
|
function evalPointer(pointer, scope, ctx) {
|
|
73916
74276
|
switch (pointer.type) {
|
|
@@ -73950,7 +74310,7 @@ function evalPointer(pointer, scope, ctx) {
|
|
|
73950
74310
|
`Missing value reference: ${pointer.valueId}`
|
|
73951
74311
|
);
|
|
73952
74312
|
}
|
|
73953
|
-
return row
|
|
74313
|
+
return readRowValue(row, ctx);
|
|
73954
74314
|
}
|
|
73955
74315
|
case "variant" /* variant */:
|
|
73956
74316
|
return {
|
|
@@ -74328,7 +74688,7 @@ function invokeDelegateValue(value, args, ctx, callSiteId, ownerReceiver) {
|
|
|
74328
74688
|
`NeoDelegate target '${member.name}' has missing receiver value '${value.valueId}'.`
|
|
74329
74689
|
);
|
|
74330
74690
|
}
|
|
74331
|
-
receiver = row
|
|
74691
|
+
receiver = readRowValue(row, ctx);
|
|
74332
74692
|
} else if (ownerReceiver !== null && ownerReceiver !== void 0) {
|
|
74333
74693
|
receiver = listenerReceiverOnOwner(member.id, ownerReceiver, ctx);
|
|
74334
74694
|
}
|
|
@@ -75363,6 +75723,20 @@ function dispatchSchemaMember(receiver, schemaKey, ctx) {
|
|
|
75363
75723
|
if (typeof receiver !== "object" || receiver === null) {
|
|
75364
75724
|
return { kind: "no-info", matchedMember: false };
|
|
75365
75725
|
}
|
|
75726
|
+
if (ctx.vm.databaseVM?.onInitializerRead !== void 0 && receiver === ctx.rootValue) {
|
|
75727
|
+
const root = PROJECT_ROOTS.find((root2) => root2.key === schemaKey);
|
|
75728
|
+
if (root !== void 0) {
|
|
75729
|
+
const memberId = ctx.vm.project[root.projectField];
|
|
75730
|
+
let bindings;
|
|
75731
|
+
if (root.storage === 2 /* Save */)
|
|
75732
|
+
bindings = ctx.__saveStaticBindings;
|
|
75733
|
+
if (root.storage === 3 /* Session */)
|
|
75734
|
+
bindings = ctx.__sessionStaticBindings;
|
|
75735
|
+
const targetId = bindings?.has(memberId) ? bindings.get(memberId) : evalMemberById(ctx.vm, memberId)?.valueId;
|
|
75736
|
+
if (typeof targetId === "string")
|
|
75737
|
+
ctx.vm.databaseVM.onInitializerRead(targetId);
|
|
75738
|
+
}
|
|
75739
|
+
}
|
|
75366
75740
|
const member = resolveRuntimeSchemaMember(receiver, schemaKey, ctx);
|
|
75367
75741
|
if (!member) return { kind: "no-info", matchedMember: false };
|
|
75368
75742
|
if (member.kind === 10 /* NSProperty */) {
|
|
@@ -75688,20 +76062,27 @@ function unwrapSingleLookupValue(value, ctx) {
|
|
|
75688
76062
|
ctx.__valueOverlay
|
|
75689
76063
|
);
|
|
75690
76064
|
if (next) {
|
|
75691
|
-
return next
|
|
76065
|
+
return readRowValue(next, ctx);
|
|
75692
76066
|
}
|
|
75693
76067
|
}
|
|
75694
76068
|
return value;
|
|
75695
76069
|
}
|
|
76070
|
+
function readRowValue(row, ctx) {
|
|
76071
|
+
const onInitializerRead = ctx.vm.databaseVM?.onInitializerRead;
|
|
76072
|
+
if (onInitializerRead !== void 0 && isInitValueContent(row)) {
|
|
76073
|
+
onInitializerRead(row.id);
|
|
76074
|
+
}
|
|
76075
|
+
return row.value;
|
|
76076
|
+
}
|
|
75696
76077
|
function resolveLocalizedRowValue(row, ctx) {
|
|
75697
|
-
const value = row
|
|
76078
|
+
const value = readRowValue(row, ctx);
|
|
75698
76079
|
if (typeof value !== "string") return value;
|
|
75699
76080
|
const member = memberForValueRow(row, ctx);
|
|
75700
76081
|
if (member === null) return value;
|
|
75701
76082
|
return resolveLocalizedRowValueForMember(row, member, ctx);
|
|
75702
76083
|
}
|
|
75703
76084
|
function resolveLocalizedRowValueForMember(row, member, ctx) {
|
|
75704
|
-
const value = row
|
|
76085
|
+
const value = readRowValue(row, ctx);
|
|
75705
76086
|
if (typeof value !== "string") return value;
|
|
75706
76087
|
if (!isMemberString(member)) return value;
|
|
75707
76088
|
if (isLocalizedStringMember(member) === false) return value;
|
|
@@ -76003,7 +76384,7 @@ function evaluateSystemNative(memberId, receiver, args, ctx) {
|
|
|
76003
76384
|
`Tile placement '${tile.placementValueId}' is missing.`
|
|
76004
76385
|
);
|
|
76005
76386
|
}
|
|
76006
|
-
return { handled: true, value: row
|
|
76387
|
+
return { handled: true, value: readRowValue(row, ctx) };
|
|
76007
76388
|
}
|
|
76008
76389
|
return evaluateCellPatternNative(memberId, receiver, args, {
|
|
76009
76390
|
readPattern: (value) => readCellPattern(value, ctx),
|
|
@@ -78813,7 +79194,7 @@ function resolveVariantGraph(selection2, ctx) {
|
|
|
78813
79194
|
`Variant '${record6.name}' has no root value row '${record6.valueId}'.`
|
|
78814
79195
|
);
|
|
78815
79196
|
}
|
|
78816
|
-
const root = row
|
|
79197
|
+
const root = readRowValue(row, ctx);
|
|
78817
79198
|
if (typeof root !== "object" || root === null || Array.isArray(root)) {
|
|
78818
79199
|
throw new NSGetterRuntimeError(
|
|
78819
79200
|
`Variant '${record6.name}' root row is not a class record.`
|
|
@@ -78886,19 +79267,21 @@ function resolveVariantRowParameter(args) {
|
|
|
78886
79267
|
ctx.__runtimeSessionValues,
|
|
78887
79268
|
ctx.__valueOverlay
|
|
78888
79269
|
);
|
|
78889
|
-
const
|
|
79270
|
+
const collectionValue = collection === null ? null : readRowValue(collection, ctx);
|
|
79271
|
+
const isOrderedEntry = Array.isArray(collectionValue) ? collectionValue.includes(rowId) : false;
|
|
78890
79272
|
const isUnorderedEntry = row.containerId === binding.collectionValueId;
|
|
78891
79273
|
if (!isOrderedEntry && !isUnorderedEntry) {
|
|
78892
79274
|
throw new NSGetterRuntimeError(
|
|
78893
79275
|
`Lookup variant '${graph.name}' row '${rowId}' is not an entry of collection '${binding.collectionValueId}'.`
|
|
78894
79276
|
);
|
|
78895
79277
|
}
|
|
78896
|
-
|
|
79278
|
+
const resolvedRowValue = readRowValue(row, ctx);
|
|
79279
|
+
if (explicitPointer !== void 0 && rowValue !== resolvedRowValue) {
|
|
78897
79280
|
throw new NSGetterRuntimeError(
|
|
78898
79281
|
`Lookup variant '${graph.name}' received a value that does not resolve to bound row '${rowId}'.`
|
|
78899
79282
|
);
|
|
78900
79283
|
}
|
|
78901
|
-
return [
|
|
79284
|
+
return [resolvedRowValue];
|
|
78902
79285
|
}
|
|
78903
79286
|
function invokeVariantClosure(args) {
|
|
78904
79287
|
const { closureValueId, ctx, label, lexicalThis, parameters } = args;
|
|
@@ -80306,7 +80689,7 @@ function constructorCollectionEntryValue(value, ctx, resolveStoredId) {
|
|
|
80306
80689
|
ctx.__runtimeSessionValues,
|
|
80307
80690
|
ctx.__valueOverlay
|
|
80308
80691
|
);
|
|
80309
|
-
return row === null ? value : row
|
|
80692
|
+
return row === null ? value : readRowValue(row, ctx);
|
|
80310
80693
|
}
|
|
80311
80694
|
function retainOnlyCreatedRowsReachableFrom(rootId, createdValues, ctx) {
|
|
80312
80695
|
const byId = new Map(createdValues.map((row) => [row.id, row]));
|
|
@@ -80716,14 +81099,16 @@ function readOptionalMember(receiver, key, ctx) {
|
|
|
80716
81099
|
const record6 = receiver;
|
|
80717
81100
|
if (!Object.prototype.hasOwnProperty.call(record6, key)) return null;
|
|
80718
81101
|
return resolveValueIfId(record6[key], ctx);
|
|
80719
|
-
} catch {
|
|
81102
|
+
} catch (error) {
|
|
81103
|
+
if (error instanceof PendingInitializerDependency) throw error;
|
|
80720
81104
|
return null;
|
|
80721
81105
|
}
|
|
80722
81106
|
}
|
|
80723
81107
|
function collectionEntriesOrEmpty(value, ctx) {
|
|
80724
81108
|
try {
|
|
80725
81109
|
return collectionEntries(value, ctx);
|
|
80726
|
-
} catch {
|
|
81110
|
+
} catch (error) {
|
|
81111
|
+
if (error instanceof PendingInitializerDependency) throw error;
|
|
80727
81112
|
return [];
|
|
80728
81113
|
}
|
|
80729
81114
|
}
|
|
@@ -80816,6 +81201,8 @@ var DELEGATE_LEXICAL_THIS, DELEGATE_LEXICAL_ROOT, NonCatchableNSGetterRuntimeErr
|
|
|
80816
81201
|
var init_evaluateNSGetter = __esm({
|
|
80817
81202
|
"../src/runtime/neoscript/evaluateNSGetter.ts"() {
|
|
80818
81203
|
"use strict";
|
|
81204
|
+
init_project_root_members();
|
|
81205
|
+
init_initializer_dependencies();
|
|
80819
81206
|
init_unattributable_reads();
|
|
80820
81207
|
init_value_row_owner_members();
|
|
80821
81208
|
init_src();
|
|
@@ -84137,7 +84524,8 @@ function createHeadlessVirtualInstanceResolver(args) {
|
|
|
84137
84524
|
readsByRootId.set(rootId, reads);
|
|
84138
84525
|
remember(graph, rows);
|
|
84139
84526
|
return rows;
|
|
84140
|
-
} catch {
|
|
84527
|
+
} catch (error) {
|
|
84528
|
+
if (error instanceof PendingInitializerDependency) throw error;
|
|
84141
84529
|
failedRootIds.add(rootId);
|
|
84142
84530
|
return emptyRows;
|
|
84143
84531
|
} finally {
|
|
@@ -84253,6 +84641,7 @@ var KEPT_ROW_SAMPLE_LIMIT, CORPUS_SCANNING_MEMBER_KINDS, VirtualExpansionUnsuppo
|
|
|
84253
84641
|
var init_virtual_instance_graph = __esm({
|
|
84254
84642
|
"../src/runtime/virtual-instance-graph.ts"() {
|
|
84255
84643
|
"use strict";
|
|
84644
|
+
init_initializer_dependencies();
|
|
84256
84645
|
init_constructor_argument_ownership();
|
|
84257
84646
|
init_classes();
|
|
84258
84647
|
init_constructor_parameter_settlement();
|
|
@@ -84320,6 +84709,7 @@ function initializerEvaluatorLookups(document, readTracking) {
|
|
|
84320
84709
|
const lookups2 = {
|
|
84321
84710
|
memberById: (id2) => databaseVM.memberById(id2),
|
|
84322
84711
|
valueById: (id2) => databaseVM.valueById(id2),
|
|
84712
|
+
onInitializerRead: databaseVM.onInitializerRead,
|
|
84323
84713
|
localizedTextById: (id2) => databaseVM.localizedTextById?.(id2) ?? null,
|
|
84324
84714
|
...databaseVM.hasStoredValueId === void 0 ? {} : {
|
|
84325
84715
|
hasStoredValueId: (id2) => databaseVM.hasStoredValueId?.(id2) ?? false
|
|
@@ -84475,7 +84865,7 @@ function indexedInitializerEvaluatorLookups(document, key, revision) {
|
|
|
84475
84865
|
});
|
|
84476
84866
|
return lookups;
|
|
84477
84867
|
}
|
|
84478
|
-
function createInitializerMaterializationBatch(authoredDocument) {
|
|
84868
|
+
function createInitializerMaterializationBatch(authoredDocument, pendingInitializerIds) {
|
|
84479
84869
|
const indexed = createInitializerBatchLookups(authoredDocument);
|
|
84480
84870
|
const unorderedListEntryIds2 = indexed.snapshot().unorderedListEntryIds;
|
|
84481
84871
|
let materializedIndex;
|
|
@@ -84526,6 +84916,9 @@ function createInitializerMaterializationBatch(authoredDocument) {
|
|
|
84526
84916
|
globalReads.delete(entry);
|
|
84527
84917
|
};
|
|
84528
84918
|
return {
|
|
84919
|
+
get valuesById() {
|
|
84920
|
+
return indexed.valuesById;
|
|
84921
|
+
},
|
|
84529
84922
|
upsert(rows) {
|
|
84530
84923
|
const previousRows = [];
|
|
84531
84924
|
const touched = /* @__PURE__ */ new Set();
|
|
@@ -84600,6 +84993,12 @@ function createInitializerMaterializationBatch(authoredDocument) {
|
|
|
84600
84993
|
});
|
|
84601
84994
|
const lookups = {
|
|
84602
84995
|
...base,
|
|
84996
|
+
...pendingInitializerIds === void 0 ? {} : {
|
|
84997
|
+
onInitializerRead: (id2) => {
|
|
84998
|
+
if (pendingInitializerIds.has(id2))
|
|
84999
|
+
throw new PendingInitializerDependency(id2);
|
|
85000
|
+
}
|
|
85001
|
+
},
|
|
84603
85002
|
valueById: (id2) => base.valueById(id2) ?? expandedById.get(id2) ?? virtual().valueById(id2),
|
|
84604
85003
|
rowForValueReference: (value) => base.rowForValueReference(value) ?? expandedByReference.get(value) ?? virtual().rowForValueReference(value),
|
|
84605
85004
|
virtualInstanceRowsForValue: (id2) => {
|
|
@@ -84666,7 +85065,8 @@ function buildInitializerRootValueWithLookups(document, lookups, tracking) {
|
|
|
84666
85065
|
continue;
|
|
84667
85066
|
}
|
|
84668
85067
|
tracking?.valueDependencies?.add(targetId);
|
|
84669
|
-
|
|
85068
|
+
const row = lookups.valueById(targetId);
|
|
85069
|
+
rootValue[root.key] = row?.value ?? null;
|
|
84670
85070
|
}
|
|
84671
85071
|
return rootValue;
|
|
84672
85072
|
}
|
|
@@ -84823,6 +85223,7 @@ var evaluatorLookupsByDocument, headlessResolversByLookupKey, indexedEvaluatorLo
|
|
|
84823
85223
|
var init_evaluateInitializer = __esm({
|
|
84824
85224
|
"../src/runtime/neoscript/evaluateInitializer.ts"() {
|
|
84825
85225
|
"use strict";
|
|
85226
|
+
init_initializer_dependencies();
|
|
84826
85227
|
init_deep_clone_plain_data();
|
|
84827
85228
|
init_members();
|
|
84828
85229
|
init_instance_provenance();
|
|
@@ -93044,7 +93445,9 @@ function validateWorldPlacementSidecars(args) {
|
|
|
93044
93445
|
`Placement value "${args.placement.id}" under layer link "${args.linkValueId}" must store a class record.`
|
|
93045
93446
|
);
|
|
93046
93447
|
}
|
|
93047
|
-
const
|
|
93448
|
+
const hasObjectSidecar = !args.isTile && WORLD_PLACEMENT_SIDECAR_KEYS.some((key) => Object.hasOwn(record6, key));
|
|
93449
|
+
const objectClassId = hasObjectSidecar ? record6.assetClassId : args.placement.classId;
|
|
93450
|
+
const assetClassId = args.isTile ? requiredValueClassId(args.placement, "tile") : optionalNonEmptyString(objectClassId);
|
|
93048
93451
|
if (assetClassId === null) {
|
|
93049
93452
|
throw new Error(
|
|
93050
93453
|
`Class-backed placement value "${args.placement.id}" is missing assetClassId.`
|
|
@@ -93093,10 +93496,10 @@ function validateWorldPlacementSidecars(args) {
|
|
|
93093
93496
|
assetClassId,
|
|
93094
93497
|
placementId: args.placement.id,
|
|
93095
93498
|
variantId: optionalNonEmptyString(
|
|
93096
|
-
args.isTile ? getField(args.placement, "instanceVariantId") : record6.variantId
|
|
93499
|
+
args.isTile || !hasObjectSidecar ? getField(args.placement, "instanceVariantId") : record6.variantId
|
|
93097
93500
|
),
|
|
93098
93501
|
rowValueId: optionalNonEmptyString(
|
|
93099
|
-
args.isTile ? getField(args.placement, "instanceVariantRowValueId") : record6.rowValueId
|
|
93502
|
+
args.isTile || !hasObjectSidecar ? getField(args.placement, "instanceVariantRowValueId") : record6.rowValueId
|
|
93100
93503
|
),
|
|
93101
93504
|
context: args.context
|
|
93102
93505
|
});
|
|
@@ -98167,37 +98570,49 @@ function materializePreparedInstanceInitializers(args) {
|
|
|
98167
98570
|
materializationScope.document.localizedTexts.map((text) => text.id)
|
|
98168
98571
|
);
|
|
98169
98572
|
const replayOnlyIndexes = [];
|
|
98573
|
+
const pendingSites = /* @__PURE__ */ new Map();
|
|
98170
98574
|
for (const [valueId, site] of sites) {
|
|
98171
98575
|
const existingRoot = existingValueById.get(valueId);
|
|
98172
|
-
const existingConstructedRoot = existingRoot !== void 0 && isLiteralValueContent(existingRoot) && (typeof existingRoot.classId === "string" || existingRoot.constructorArgs !== void 0 && existingRoot.constructorArgs !== null);
|
|
98173
|
-
if (rootKinds.get(valueId) === "declaration" && !existingConstructedRoot)
|
|
98576
|
+
const existingConstructedRoot = existingRoot !== void 0 && isLiteralValueContent(existingRoot) && (typeof existingRoot.classId === "string" || existingRoot.constructorArgs !== void 0 && existingRoot.constructorArgs !== null) ? existingRoot : void 0;
|
|
98577
|
+
if (rootKinds.get(valueId) === "declaration" && !existingConstructedRoot)
|
|
98174
98578
|
continue;
|
|
98175
|
-
}
|
|
98579
|
+
pendingSites.set(valueId, { ...site, existingConstructedRoot });
|
|
98580
|
+
}
|
|
98581
|
+
const pendingInitializerIds = new Set(pendingSites.keys());
|
|
98582
|
+
if (pendingInitializerIds.size === 0) return;
|
|
98583
|
+
const batch = createInitializerMaterializationBatch(
|
|
98584
|
+
materializationScope.document,
|
|
98585
|
+
pendingInitializerIds
|
|
98586
|
+
);
|
|
98587
|
+
materializeInitializerDependencies(pendingInitializerIds, (valueId) => {
|
|
98588
|
+
const site = pendingSites.get(valueId);
|
|
98589
|
+
const existingConstructedRoot = site.existingConstructedRoot;
|
|
98176
98590
|
const member = owners.get(valueId);
|
|
98177
98591
|
if (member === void 0) {
|
|
98178
98592
|
throw new Error(
|
|
98179
98593
|
`Value "${valueId}" carries an initializer but no ownership path resolves its declared member.`
|
|
98180
98594
|
);
|
|
98181
98595
|
}
|
|
98596
|
+
const currentDocument = batch.document();
|
|
98182
98597
|
const materialized = materializeInitializerValue2({
|
|
98183
98598
|
// Every site that survives the declaration-default guard is source for
|
|
98184
98599
|
// a persisted instance construction. The trusted replay mode both
|
|
98185
98600
|
// admits Immutable storage and installs the concrete generic slot; the
|
|
98186
98601
|
// CLI uses the same mode on the first push, so it cannot be conditional
|
|
98187
98602
|
// on a literal row already existing.
|
|
98188
|
-
document:
|
|
98603
|
+
document: currentDocument,
|
|
98189
98604
|
member,
|
|
98190
98605
|
row: site.row,
|
|
98191
98606
|
storedConstructionReplay: true
|
|
98192
98607
|
});
|
|
98193
|
-
if (existingConstructedRoot) {
|
|
98194
|
-
if (!isLiteralValueContent(materialized.root) ||
|
|
98608
|
+
if (existingConstructedRoot !== void 0) {
|
|
98609
|
+
if (!isLiteralValueContent(materialized.root) || existingConstructedRoot.classId !== materialized.root.classId || !replayedCreationDataMatches({
|
|
98195
98610
|
// The synthetic variant binding members are part of the ownership
|
|
98196
98611
|
// scope that compiled and evaluated this initializer. Stored replay
|
|
98197
98612
|
// closes its generic slot from the same ephemeral member id, so its
|
|
98198
98613
|
// expansion must read that scoped document too.
|
|
98199
98614
|
currentReader: requireCurrentReader(),
|
|
98200
|
-
currentRoot:
|
|
98615
|
+
currentRoot: existingConstructedRoot,
|
|
98201
98616
|
rootMember: member,
|
|
98202
98617
|
replayRoot: materialized.root,
|
|
98203
98618
|
replayCreated: materialized.createdValues
|
|
@@ -98207,10 +98622,11 @@ function materializePreparedInstanceInitializers(args) {
|
|
|
98207
98622
|
);
|
|
98208
98623
|
}
|
|
98209
98624
|
replayOnlyIndexes.push(site.index);
|
|
98210
|
-
|
|
98625
|
+
batch.upsert([existingConstructedRoot]);
|
|
98626
|
+
return;
|
|
98211
98627
|
}
|
|
98212
98628
|
const baseline = materializeInitializerValue2({
|
|
98213
|
-
document:
|
|
98629
|
+
document: currentDocument,
|
|
98214
98630
|
member,
|
|
98215
98631
|
row: {
|
|
98216
98632
|
...site.row,
|
|
@@ -98221,7 +98637,7 @@ function materializePreparedInstanceInitializers(args) {
|
|
|
98221
98637
|
});
|
|
98222
98638
|
const sparse2 = sparsifyConstructedInstance({
|
|
98223
98639
|
localizedTextIds,
|
|
98224
|
-
document:
|
|
98640
|
+
document: currentDocument,
|
|
98225
98641
|
rootMember: member,
|
|
98226
98642
|
constructed: {
|
|
98227
98643
|
root: materialized.root,
|
|
@@ -98237,7 +98653,7 @@ function materializePreparedInstanceInitializers(args) {
|
|
|
98237
98653
|
pinnedRootSchemaKeys: materialized.pinnedRootSchemaKeys
|
|
98238
98654
|
});
|
|
98239
98655
|
const original = args.prepared[site.index];
|
|
98240
|
-
if (original === void 0)
|
|
98656
|
+
if (original === void 0) return;
|
|
98241
98657
|
args.prepared[site.index] = {
|
|
98242
98658
|
...original,
|
|
98243
98659
|
nextData: sparse2.root
|
|
@@ -98278,7 +98694,8 @@ function materializePreparedInstanceInitializers(args) {
|
|
|
98278
98694
|
});
|
|
98279
98695
|
existingValueById.set(created.id, created);
|
|
98280
98696
|
}
|
|
98281
|
-
|
|
98697
|
+
batch.upsert([sparse2.root, ...sparse2.createdChildren]);
|
|
98698
|
+
});
|
|
98282
98699
|
for (const index of replayOnlyIndexes.sort((left, right) => right - left)) {
|
|
98283
98700
|
args.prepared.splice(index, 1);
|
|
98284
98701
|
}
|
|
@@ -101481,6 +101898,7 @@ var init_project_version_schema_commit = __esm({
|
|
|
101481
101898
|
init_variants2();
|
|
101482
101899
|
init_effective_value_reader();
|
|
101483
101900
|
init_materialize_values();
|
|
101901
|
+
init_initializer_dependencies();
|
|
101484
101902
|
init_neoscript2();
|
|
101485
101903
|
init_evaluateInitializer();
|
|
101486
101904
|
init_virtual_instance_graph();
|
|
@@ -101617,6 +102035,7 @@ var init_animation_clips = __esm({
|
|
|
101617
102035
|
"../src/models/animation/animation-clips.ts"() {
|
|
101618
102036
|
"use strict";
|
|
101619
102037
|
init_inheritance();
|
|
102038
|
+
init_read_class_member();
|
|
101620
102039
|
init_generics();
|
|
101621
102040
|
init_world_system_classes();
|
|
101622
102041
|
init_member_kinds();
|
|
@@ -102635,14 +103054,7 @@ var init_animation_clips = __esm({
|
|
|
102635
103054
|
* when it is dangling, then the member default, then the retained value row.
|
|
102636
103055
|
*/
|
|
102637
103056
|
listFieldIds(parent, field) {
|
|
102638
|
-
|
|
102639
|
-
if (typeof mapped === "string") {
|
|
102640
|
-
return this.valueById.get(mapped)?.value;
|
|
102641
|
-
}
|
|
102642
|
-
if (field.member.defaultValue !== void 0) {
|
|
102643
|
-
return field.member.defaultValue.value;
|
|
102644
|
-
}
|
|
102645
|
-
return typeof field.member.valueId === "string" ? this.valueById.get(field.member.valueId)?.value : void 0;
|
|
103057
|
+
return this.fieldValue(parent, field);
|
|
102646
103058
|
}
|
|
102647
103059
|
/** Class a list's rows carry when a row omits its own `classId`. */
|
|
102648
103060
|
listEntryClassId(member) {
|
|
@@ -102692,11 +103104,21 @@ var init_animation_clips = __esm({
|
|
|
102692
103104
|
}
|
|
102693
103105
|
scalarField(parent, classId, memberId) {
|
|
102694
103106
|
const field = this.requireField(classId, memberId, `Class "${classId}"`);
|
|
102695
|
-
|
|
102696
|
-
|
|
102697
|
-
|
|
103107
|
+
return this.fieldValue(parent, field);
|
|
103108
|
+
}
|
|
103109
|
+
fieldValue(parent, field) {
|
|
103110
|
+
const slot = readClassMember({
|
|
103111
|
+
member: field.member,
|
|
103112
|
+
schemaKey: field.schemaKey,
|
|
103113
|
+
record: isRecord6(parent.value) ? parent.value : {},
|
|
103114
|
+
expandedRecord: () => null,
|
|
103115
|
+
mode: "declaration"
|
|
103116
|
+
});
|
|
103117
|
+
if (slot.kind === "declaration") return slot.content.value;
|
|
103118
|
+
if (slot.kind === "value") {
|
|
103119
|
+
return typeof slot.value === "string" ? this.valueById.get(slot.value)?.value : slot.value;
|
|
102698
103120
|
}
|
|
102699
|
-
return field.member.
|
|
103121
|
+
return typeof field.member.valueId === "string" ? this.valueById.get(field.member.valueId)?.value : void 0;
|
|
102700
103122
|
}
|
|
102701
103123
|
requireNodeClassId(node, expectedWorldKind) {
|
|
102702
103124
|
if (typeof node.classId !== "string" || !this.classHasWorldKind(node.classId, expectedWorldKind)) {
|
|
@@ -102735,7 +103157,13 @@ var init_animation_clips = __esm({
|
|
|
102735
103157
|
);
|
|
102736
103158
|
if (entry === void 0) return null;
|
|
102737
103159
|
const member = this.memberById.get(entry.memberId);
|
|
102738
|
-
return member === void 0 ? null : {
|
|
103160
|
+
return member === void 0 ? null : {
|
|
103161
|
+
...entry,
|
|
103162
|
+
member: {
|
|
103163
|
+
...member,
|
|
103164
|
+
...resolveMember2(member, this.document.members)
|
|
103165
|
+
}
|
|
103166
|
+
};
|
|
102739
103167
|
}
|
|
102740
103168
|
requireField(classId, memberId, label) {
|
|
102741
103169
|
const field = this.field(classId, memberId);
|
|
@@ -104334,7 +104762,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
104334
104762
|
`Read-only member "${member.name}" (${member.id}) must declare Immutable storage; ${ownerLabel}.`
|
|
104335
104763
|
);
|
|
104336
104764
|
}
|
|
104337
|
-
if (!isAbstractMember(
|
|
104765
|
+
if (!isAbstractMember(resolved) && resolved.kind !== 21 && (resolved.defaultValue === void 0 || resolved.defaultValue === null)) {
|
|
104338
104766
|
throw new Error(
|
|
104339
104767
|
`Read-only member "${member.name}" (${member.id}) requires an explicit defaultValue; ${ownerLabel}.`
|
|
104340
104768
|
);
|
|
@@ -104398,7 +104826,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
104398
104826
|
`Read-only member "${member.name}" (${member.id}) must be value-bearing in every closed Generic placement; ${ownerLabel}.`
|
|
104399
104827
|
);
|
|
104400
104828
|
}
|
|
104401
|
-
if (isAbstractMember(
|
|
104829
|
+
if (isAbstractMember(inherited)) return;
|
|
104402
104830
|
if (owned.defaultValue === void 0 || owned.defaultValue === null) {
|
|
104403
104831
|
throw new Error(
|
|
104404
104832
|
`Read-only member "${member.name}" (${member.id}) requires an explicit defaultValue from every closed Generic binding; ${ownerLabel}.`
|
|
@@ -104416,7 +104844,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
104416
104844
|
}
|
|
104417
104845
|
}
|
|
104418
104846
|
}
|
|
104419
|
-
if (rawOwned.id === member.id && isAbstractMember(
|
|
104847
|
+
if (rawOwned.id === member.id && isAbstractMember(inherited)) return;
|
|
104420
104848
|
if (owned.storage === 2 /* Save */ || owned.storage === 3 /* Session */ || owned.storage === 4 /* Writable */) {
|
|
104421
104849
|
throw new Error(
|
|
104422
104850
|
`Read-only member "${member.name}" has a non-Immutable owned default child "${owned.name}"; ${ownerLabel}.`
|
|
@@ -106561,7 +106989,10 @@ function assertProjectVersionWholeGraphWritesValid(args) {
|
|
|
106561
106989
|
assertStagedInternalRecordRelationsValid(args.document, projected, changes);
|
|
106562
106990
|
assertStagedWorldContentLayerBindingsValid(args.document, projected, changes);
|
|
106563
106991
|
assertAnimationClipDocumentValid(
|
|
106564
|
-
materializeDeclarationInitializersForAnimationValidation(
|
|
106992
|
+
materializeDeclarationInitializersForAnimationValidation(
|
|
106993
|
+
projected,
|
|
106994
|
+
args.animationValidationMemberIds
|
|
106995
|
+
),
|
|
106565
106996
|
args.animationValidationMemberIds === void 0 ? void 0 : { memberIds: args.animationValidationMemberIds }
|
|
106566
106997
|
);
|
|
106567
106998
|
if (args.operation === void 0 || !isSystemOwnedProjectVersionOperation(args.operation)) {
|
|
@@ -106679,7 +107110,71 @@ function valueDematerializationRefusal(args) {
|
|
|
106679
107110
|
}
|
|
106680
107111
|
return null;
|
|
106681
107112
|
}
|
|
106682
|
-
function
|
|
107113
|
+
function animationRootsInValidationScope(args) {
|
|
107114
|
+
const {
|
|
107115
|
+
document,
|
|
107116
|
+
valuesById,
|
|
107117
|
+
animationFamilyClassIds,
|
|
107118
|
+
animationRoots,
|
|
107119
|
+
scopeMemberIds
|
|
107120
|
+
} = args;
|
|
107121
|
+
if (scopeMemberIds === void 0 || animationRoots.length === 0) {
|
|
107122
|
+
return animationRoots;
|
|
107123
|
+
}
|
|
107124
|
+
const segmentIds = new Set(
|
|
107125
|
+
[...valuesById.values()].flatMap(
|
|
107126
|
+
(row) => typeof row.classId === "string" && animationFamilyClassIds.get(row.classId) === "animationSegment" ? [row.id] : []
|
|
107127
|
+
)
|
|
107128
|
+
);
|
|
107129
|
+
const placements = findSemanticOwnerPlacementsForValues(
|
|
107130
|
+
document,
|
|
107131
|
+
/* @__PURE__ */ new Set([...animationRoots.map((row) => row.id), ...segmentIds]),
|
|
107132
|
+
void 0,
|
|
107133
|
+
true
|
|
107134
|
+
);
|
|
107135
|
+
const segmentAncestors = /* @__PURE__ */ new Set();
|
|
107136
|
+
for (const segmentId of segmentIds) {
|
|
107137
|
+
let id2 = segmentId;
|
|
107138
|
+
while (id2 !== null && !segmentAncestors.has(id2)) {
|
|
107139
|
+
segmentAncestors.add(id2);
|
|
107140
|
+
id2 = placements.get(id2)?.parentValueId ?? null;
|
|
107141
|
+
}
|
|
107142
|
+
}
|
|
107143
|
+
const insideValidatedRootById = /* @__PURE__ */ new Map();
|
|
107144
|
+
return animationRoots.filter((row) => {
|
|
107145
|
+
if (segmentAncestors.has(row.id)) return true;
|
|
107146
|
+
let id2 = row.id;
|
|
107147
|
+
const path = [];
|
|
107148
|
+
const seen = /* @__PURE__ */ new Set();
|
|
107149
|
+
let insideValidatedRoot = false;
|
|
107150
|
+
while (id2 !== null && !seen.has(id2)) {
|
|
107151
|
+
const cached = insideValidatedRootById.get(id2);
|
|
107152
|
+
if (cached !== void 0) {
|
|
107153
|
+
insideValidatedRoot = cached;
|
|
107154
|
+
break;
|
|
107155
|
+
}
|
|
107156
|
+
if (segmentIds.has(id2)) {
|
|
107157
|
+
insideValidatedRoot = true;
|
|
107158
|
+
break;
|
|
107159
|
+
}
|
|
107160
|
+
seen.add(id2);
|
|
107161
|
+
path.push(id2);
|
|
107162
|
+
const placement = placements.get(id2);
|
|
107163
|
+
if (placement === void 0) break;
|
|
107164
|
+
if (placement.parentValueId === null) {
|
|
107165
|
+
const memberId = getField(placement.member, "id");
|
|
107166
|
+
insideValidatedRoot = typeof memberId === "string" && scopeMemberIds.has(memberId);
|
|
107167
|
+
break;
|
|
107168
|
+
}
|
|
107169
|
+
id2 = placement.parentValueId;
|
|
107170
|
+
}
|
|
107171
|
+
for (const valueId of path) {
|
|
107172
|
+
insideValidatedRootById.set(valueId, insideValidatedRoot);
|
|
107173
|
+
}
|
|
107174
|
+
return insideValidatedRoot;
|
|
107175
|
+
});
|
|
107176
|
+
}
|
|
107177
|
+
function materializeDeclarationInitializersForAnimationValidation(document, scopeMemberIds) {
|
|
106683
107178
|
const animationFamilyClassIds = animationFamilyClassKinds(document.classes);
|
|
106684
107179
|
const initializers = document.values.filter(
|
|
106685
107180
|
(value) => isInitValueContent(value)
|
|
@@ -106692,12 +107187,13 @@ function materializeDeclarationInitializersForAnimationValidation(document) {
|
|
|
106692
107187
|
if (initializers.length === 0 && defaultInitializerMemberIds.size === 0) {
|
|
106693
107188
|
return document;
|
|
106694
107189
|
}
|
|
107190
|
+
const initializerRootOwners = /* @__PURE__ */ new Map();
|
|
106695
107191
|
const rootKinds = /* @__PURE__ */ new Map();
|
|
106696
107192
|
const owners = resolveSemanticOwnerMembersForValues(
|
|
106697
107193
|
document,
|
|
106698
107194
|
new Set(initializers.map((value) => value.id)),
|
|
106699
107195
|
void 0,
|
|
106700
|
-
|
|
107196
|
+
initializerRootOwners,
|
|
106701
107197
|
rootKinds
|
|
106702
107198
|
);
|
|
106703
107199
|
const valuesById = new Map(
|
|
@@ -106706,6 +107202,7 @@ function materializeDeclarationInitializersForAnimationValidation(document) {
|
|
|
106706
107202
|
const materializationBatch = createInitializerMaterializationBatch(document);
|
|
106707
107203
|
let members = document.members;
|
|
106708
107204
|
const deferred = /* @__PURE__ */ new Set();
|
|
107205
|
+
const parameterizedDeclarationMemberIds = /* @__PURE__ */ new Set();
|
|
106709
107206
|
if (defaultInitializerMemberIds.size > 0) {
|
|
106710
107207
|
members = document.members.map((member) => {
|
|
106711
107208
|
if (!defaultInitializerMemberIds.has(member.id)) return member;
|
|
@@ -106713,6 +107210,7 @@ function materializeDeclarationInitializersForAnimationValidation(document) {
|
|
|
106713
107210
|
if (!isInitValueContent(defaultValue)) return member;
|
|
106714
107211
|
const parameters = defaultValue.init.compiled?.parameters;
|
|
106715
107212
|
if (parameters === void 0 || parameters.length > 2) {
|
|
107213
|
+
parameterizedDeclarationMemberIds.add(member.id);
|
|
106716
107214
|
const deferredMember = { ...member };
|
|
106717
107215
|
delete deferredMember.defaultValue;
|
|
106718
107216
|
delete deferredMember.valueId;
|
|
@@ -106751,6 +107249,11 @@ function materializeDeclarationInitializersForAnimationValidation(document) {
|
|
|
106751
107249
|
const parameters = row.init.compiled?.parameters;
|
|
106752
107250
|
if (parameters === void 0 || parameters.length > 2) {
|
|
106753
107251
|
deferred.add(row.id);
|
|
107252
|
+
const rootOwner = initializerRootOwners.get(row.id);
|
|
107253
|
+
const rootOwnerId = rootOwner === void 0 ? void 0 : getField(rootOwner, "id");
|
|
107254
|
+
if (typeof rootOwnerId === "string") {
|
|
107255
|
+
parameterizedDeclarationMemberIds.add(rootOwnerId);
|
|
107256
|
+
}
|
|
106754
107257
|
continue;
|
|
106755
107258
|
}
|
|
106756
107259
|
const materialized = materializeInitializerValue2({
|
|
@@ -106767,6 +107270,73 @@ function materializeDeclarationInitializersForAnimationValidation(document) {
|
|
|
106767
107270
|
valuesById.set(created.id, created);
|
|
106768
107271
|
}
|
|
106769
107272
|
}
|
|
107273
|
+
const expandedRows = /* @__PURE__ */ new Map();
|
|
107274
|
+
const classesById = new Map(
|
|
107275
|
+
document.classes.map((entry) => [entry.id, entry])
|
|
107276
|
+
);
|
|
107277
|
+
const membersById = new Map(
|
|
107278
|
+
document.members.map((entry) => [entry.id, entry])
|
|
107279
|
+
);
|
|
107280
|
+
const classNeedsExpansion = /* @__PURE__ */ new Map();
|
|
107281
|
+
const memberHasParameterizedDefault = /* @__PURE__ */ new Map();
|
|
107282
|
+
const reachesParameterizedDefault = (memberId) => {
|
|
107283
|
+
const path = [];
|
|
107284
|
+
const visited = /* @__PURE__ */ new Set();
|
|
107285
|
+
let currentId = memberId;
|
|
107286
|
+
let result = false;
|
|
107287
|
+
while (currentId !== void 0 && !visited.has(currentId)) {
|
|
107288
|
+
const cached = memberHasParameterizedDefault.get(currentId);
|
|
107289
|
+
if (cached !== void 0) {
|
|
107290
|
+
result = cached;
|
|
107291
|
+
break;
|
|
107292
|
+
}
|
|
107293
|
+
if (parameterizedDeclarationMemberIds.has(currentId)) {
|
|
107294
|
+
result = true;
|
|
107295
|
+
break;
|
|
107296
|
+
}
|
|
107297
|
+
visited.add(currentId);
|
|
107298
|
+
path.push(currentId);
|
|
107299
|
+
currentId = membersById.get(currentId)?.extendsMemberId;
|
|
107300
|
+
}
|
|
107301
|
+
for (const id2 of path) memberHasParameterizedDefault.set(id2, result);
|
|
107302
|
+
return result;
|
|
107303
|
+
};
|
|
107304
|
+
const inheritsParameterizedDefault = (classId) => {
|
|
107305
|
+
const cached = classNeedsExpansion.get(classId);
|
|
107306
|
+
if (cached !== void 0) return cached;
|
|
107307
|
+
const schemaClass2 = classesById.get(classId);
|
|
107308
|
+
if (schemaClass2 === void 0) return false;
|
|
107309
|
+
classNeedsExpansion.set(classId, false);
|
|
107310
|
+
for (const memberId of Object.values(schemaClass2.schema)) {
|
|
107311
|
+
if (reachesParameterizedDefault(memberId)) {
|
|
107312
|
+
classNeedsExpansion.set(classId, true);
|
|
107313
|
+
return true;
|
|
107314
|
+
}
|
|
107315
|
+
}
|
|
107316
|
+
const result = typeof schemaClass2.extendsClassId === "string" && inheritsParameterizedDefault(schemaClass2.extendsClassId);
|
|
107317
|
+
classNeedsExpansion.set(classId, result);
|
|
107318
|
+
return result;
|
|
107319
|
+
};
|
|
107320
|
+
const animationRoots = parameterizedDeclarationMemberIds.size === 0 ? [] : [...valuesById.values()].filter(
|
|
107321
|
+
(row) => isLiteralValueContent(row) && isVirtualInstanceRootShape(row) && typeof row.classId === "string" && animationFamilyClassIds.has(row.classId) && inheritsParameterizedDefault(row.classId)
|
|
107322
|
+
);
|
|
107323
|
+
const rootsToExpand = animationRootsInValidationScope({
|
|
107324
|
+
document,
|
|
107325
|
+
valuesById,
|
|
107326
|
+
animationFamilyClassIds,
|
|
107327
|
+
animationRoots,
|
|
107328
|
+
scopeMemberIds
|
|
107329
|
+
});
|
|
107330
|
+
if (rootsToExpand.length > 0) {
|
|
107331
|
+
const lookups = initializerEvaluatorLookups(
|
|
107332
|
+
materializationBatch.document()
|
|
107333
|
+
);
|
|
107334
|
+
for (const root of rootsToExpand) {
|
|
107335
|
+
for (const row of lookups.virtualInstanceRowsForValue(root.id)) {
|
|
107336
|
+
expandedRows.set(row.id, row);
|
|
107337
|
+
}
|
|
107338
|
+
}
|
|
107339
|
+
}
|
|
106770
107340
|
if (deferred.size > 0) {
|
|
106771
107341
|
for (const id2 of deferred) valuesById.delete(id2);
|
|
106772
107342
|
members = members.map((member) => {
|
|
@@ -106858,6 +107428,9 @@ function materializeDeclarationInitializersForAnimationValidation(document) {
|
|
|
106858
107428
|
}
|
|
106859
107429
|
}
|
|
106860
107430
|
}
|
|
107431
|
+
for (const [id2, row] of expandedRows) {
|
|
107432
|
+
if (!deferred.has(id2)) valuesById.set(id2, row);
|
|
107433
|
+
}
|
|
106861
107434
|
return { ...document, members, values: [...valuesById.values()] };
|
|
106862
107435
|
}
|
|
106863
107436
|
function containsDirectValueId(value, ids) {
|
|
@@ -107596,6 +108169,7 @@ var init_project_version_whole_graph_validation = __esm({
|
|
|
107596
108169
|
init_project_version_system_protection_writes();
|
|
107597
108170
|
init_reserved_record_id_validation();
|
|
107598
108171
|
init_members();
|
|
108172
|
+
init_instance_provenance();
|
|
107599
108173
|
init_generics();
|
|
107600
108174
|
init_inheritance();
|
|
107601
108175
|
init_neoscript();
|
|
@@ -110927,29 +111501,25 @@ function lowerExpressionValue(context, expression, declaredExpected, ownerClass,
|
|
|
110927
111501
|
}
|
|
110928
111502
|
case "litDict": {
|
|
110929
111503
|
const valueType = expected.arguments[1] ?? expected;
|
|
111504
|
+
const keyType = expected.arguments[0];
|
|
111505
|
+
const keyEnumId = context.enumIdsByName.get(keyType?.name ?? "");
|
|
111506
|
+
const keyEnum = keyEnumId === void 0 ? null : {
|
|
111507
|
+
name: keyType.name,
|
|
111508
|
+
optionsByName: context.enumOptionsByName.get(keyEnumId) ?? /* @__PURE__ */ new Map()
|
|
111509
|
+
};
|
|
110930
111510
|
const value = {};
|
|
110931
111511
|
for (const entry of expression.entries) {
|
|
110932
111512
|
if (positionRequiresEvaluation(
|
|
110933
111513
|
context,
|
|
110934
111514
|
entry.key,
|
|
110935
|
-
|
|
111515
|
+
keyType ?? expected,
|
|
110936
111516
|
ownerClass
|
|
110937
111517
|
)) {
|
|
110938
111518
|
throw new Error(
|
|
110939
|
-
`Dictionary key at ${path} is a computed expression. Dictionary keys must be string literals.`
|
|
111519
|
+
`Dictionary key at ${path} is a computed expression. Dictionary keys must be ${keyEnum === null ? "string literals" : "enum options or quoted option IDs"}.`
|
|
110940
111520
|
);
|
|
110941
111521
|
}
|
|
110942
|
-
const key =
|
|
110943
|
-
context,
|
|
110944
|
-
entry.key,
|
|
110945
|
-
DICTIONARY_KEY_TYPE,
|
|
110946
|
-
ownerClass,
|
|
110947
|
-
path,
|
|
110948
|
-
genericEnvironment,
|
|
110949
|
-
sourceText
|
|
110950
|
-
);
|
|
110951
|
-
if (typeof key !== "string")
|
|
110952
|
-
throw new Error("Dictionary keys must be strings.");
|
|
111522
|
+
const key = lowerDictionaryKey(entry.key, keyEnum, path);
|
|
110953
111523
|
value[key] = lowerExpressionValue(
|
|
110954
111524
|
context,
|
|
110955
111525
|
entry.value,
|
|
@@ -112072,7 +112642,7 @@ function variantPathSegments2(expression) {
|
|
|
112072
112642
|
if (segments.length < 3) return null;
|
|
112073
112643
|
return segments;
|
|
112074
112644
|
}
|
|
112075
|
-
var UNSET_LIST_COLUMN_WIDTH, EMPTY_GENERIC_TYPE_ENVIRONMENT,
|
|
112645
|
+
var UNSET_LIST_COLUMN_WIDTH, EMPTY_GENERIC_TYPE_ENVIRONMENT, STRUCTURED_LEAF_COMPONENT_TYPE, primitiveMemberKinds;
|
|
112076
112646
|
var init_lower_members = __esm({
|
|
112077
112647
|
"src/project-source/lower-members.ts"() {
|
|
112078
112648
|
"use strict";
|
|
@@ -112091,13 +112661,9 @@ var init_lower_members = __esm({
|
|
|
112091
112661
|
init_member_kind_type_names();
|
|
112092
112662
|
init_source_diagnostics();
|
|
112093
112663
|
init_key_reference_spelling();
|
|
112664
|
+
init_dictionary_enum_keys();
|
|
112094
112665
|
UNSET_LIST_COLUMN_WIDTH = -1;
|
|
112095
112666
|
EMPTY_GENERIC_TYPE_ENVIRONMENT = /* @__PURE__ */ new Map();
|
|
112096
|
-
DICTIONARY_KEY_TYPE = {
|
|
112097
|
-
name: "string",
|
|
112098
|
-
nullable: false,
|
|
112099
|
-
arguments: []
|
|
112100
|
-
};
|
|
112101
112667
|
STRUCTURED_LEAF_COMPONENT_TYPE = {
|
|
112102
112668
|
name: "float",
|
|
112103
112669
|
nullable: false,
|
|
@@ -113158,11 +113724,14 @@ function builtinTextVariableMember(receiver, name) {
|
|
|
113158
113724
|
function lowerDialogueProjectSourcesV4(state, analysis) {
|
|
113159
113725
|
const result = [];
|
|
113160
113726
|
const mainLocale = readMainLocale(state);
|
|
113161
|
-
const
|
|
113162
|
-
|
|
113163
|
-
|
|
113164
|
-
|
|
113165
|
-
|
|
113727
|
+
const dialogueGroups = analysis.dialogueGroups.globals.filter(
|
|
113728
|
+
(global) => global.type.name === "DialogueGroup"
|
|
113729
|
+
);
|
|
113730
|
+
const dialogueGroupIds = globalIds2(dialogueGroups, "dialogue-group");
|
|
113731
|
+
const lookupDialogueGroupIds = new Set(
|
|
113732
|
+
dialogueGroups.filter(
|
|
113733
|
+
(global) => sourceDialogueGroupType(global) === 1 /* Lookup */
|
|
113734
|
+
).map((global) => dialogueGroupIds.get(global.name))
|
|
113166
113735
|
);
|
|
113167
113736
|
const priorityGroupsById = recordsById(state, "priority-group");
|
|
113168
113737
|
const sourceSchema = new SourceSchemaIndex(analysis);
|
|
@@ -113192,6 +113761,7 @@ function lowerDialogueProjectSourcesV4(state, analysis) {
|
|
|
113192
113761
|
existingLogic: indexExistingLogic(nodesById.values()),
|
|
113193
113762
|
mainLocale,
|
|
113194
113763
|
dialogueGroupIds,
|
|
113764
|
+
lookupDialogueGroupIds,
|
|
113195
113765
|
priorityGroupsById,
|
|
113196
113766
|
valueSymbols,
|
|
113197
113767
|
sourceSchema,
|
|
@@ -114382,6 +114952,7 @@ function lowerDialogueGroupSettings(context, member, base) {
|
|
|
114382
114952
|
}
|
|
114383
114953
|
return {
|
|
114384
114954
|
...old,
|
|
114955
|
+
...lookupValueSettings(context, referencedGroupId, old),
|
|
114385
114956
|
dialogueGroupId: referencedGroupId,
|
|
114386
114957
|
priority: {
|
|
114387
114958
|
...isObjectRecord2(old.priority) ? old.priority : {},
|
|
@@ -114410,6 +114981,7 @@ function lowerDialogueGroupSettings(context, member, base) {
|
|
|
114410
114981
|
}
|
|
114411
114982
|
return {
|
|
114412
114983
|
...old,
|
|
114984
|
+
...lookupValueSettings(context, groupId, old),
|
|
114413
114985
|
dialogueGroupId: groupId,
|
|
114414
114986
|
priority: {
|
|
114415
114987
|
...isObjectRecord2(old.priority) ? old.priority : {},
|
|
@@ -114418,6 +114990,11 @@ function lowerDialogueGroupSettings(context, member, base) {
|
|
|
114418
114990
|
}
|
|
114419
114991
|
};
|
|
114420
114992
|
}
|
|
114993
|
+
function lookupValueSettings(context, groupId, old) {
|
|
114994
|
+
if (context.lookupDialogueGroupIds.has(groupId))
|
|
114995
|
+
return { lookupValueId: context.dialoguePrimaryValueId };
|
|
114996
|
+
return old.lookupValueId == null ? {} : { lookupValueId: null };
|
|
114997
|
+
}
|
|
114421
114998
|
function referenceId2(expression, typeName) {
|
|
114422
114999
|
const pattern = new RegExp(
|
|
114423
115000
|
`^Reference<${typeName}>\\(id:\\s*("(?:[^"\\\\]|\\\\.)*")\\)$`,
|
|
@@ -114928,6 +115505,8 @@ var init_dialogue_lower = __esm({
|
|
|
114928
115505
|
init_neoscript_source_rewrite();
|
|
114929
115506
|
init_ui_action_source();
|
|
114930
115507
|
init_source_format();
|
|
115508
|
+
init_supplemental_records();
|
|
115509
|
+
init_dialogue_group_types();
|
|
114931
115510
|
SourceSchemaIndex = class {
|
|
114932
115511
|
classesByName;
|
|
114933
115512
|
classesById;
|
|
@@ -116355,6 +116934,23 @@ var init_neoscript_build_cache = __esm({
|
|
|
116355
116934
|
});
|
|
116356
116935
|
|
|
116357
116936
|
// src/project-source/local-initializer-materialization.ts
|
|
116937
|
+
function initializerRecompileTargets(args) {
|
|
116938
|
+
return collectNeoScriptRecompileTargets({
|
|
116939
|
+
currentDocument: args.currentDocument,
|
|
116940
|
+
postDocument: args.postDocument,
|
|
116941
|
+
forceRecompile: args.forceRecompile,
|
|
116942
|
+
changes: args.changes.map((change) => {
|
|
116943
|
+
const operation = "operation" in change ? change.operation : change.kind;
|
|
116944
|
+
return {
|
|
116945
|
+
recordKind: change.recordKind,
|
|
116946
|
+
recordId: change.recordId,
|
|
116947
|
+
operation,
|
|
116948
|
+
...operation === "delete" ? { deleted: true } : {},
|
|
116949
|
+
...change.nextData === void 0 ? {} : { nextData: change.nextData }
|
|
116950
|
+
};
|
|
116951
|
+
})
|
|
116952
|
+
});
|
|
116953
|
+
}
|
|
116358
116954
|
function materializedInitializerReconciliationFailuresV4(args) {
|
|
116359
116955
|
if (args.reconciliations.size === 0) return [];
|
|
116360
116956
|
const records2 = reconciliationRecords(
|
|
@@ -116365,17 +116961,11 @@ function materializedInitializerReconciliationFailuresV4(args) {
|
|
|
116365
116961
|
const document = readPulledProjectDocumentV4(records2);
|
|
116366
116962
|
const currentRecords = reconciliationRecords(args.workspace, []);
|
|
116367
116963
|
const currentDocument = readPulledProjectDocumentV4(currentRecords);
|
|
116368
|
-
const recompileTargets =
|
|
116964
|
+
const recompileTargets = initializerRecompileTargets({
|
|
116369
116965
|
currentDocument,
|
|
116370
116966
|
postDocument: document,
|
|
116371
116967
|
forceRecompile: args.forceRecompile,
|
|
116372
|
-
changes: args.changes
|
|
116373
|
-
recordKind: change.recordKind,
|
|
116374
|
-
recordId: change.recordId,
|
|
116375
|
-
operation: change.kind,
|
|
116376
|
-
...change.kind === "delete" ? { deleted: true } : {},
|
|
116377
|
-
...change.nextData === void 0 ? {} : { nextData: change.nextData }
|
|
116378
|
-
}))
|
|
116968
|
+
changes: args.changes
|
|
116379
116969
|
});
|
|
116380
116970
|
const reconciliationByValueId = /* @__PURE__ */ new Map();
|
|
116381
116971
|
const candidateValueIds = /* @__PURE__ */ new Set();
|
|
@@ -116448,8 +117038,14 @@ function materializedInitializerReconciliationFailuresV4(args) {
|
|
|
116448
117038
|
let compilationProject;
|
|
116449
117039
|
if (replayableValueIds.size > 0) {
|
|
116450
117040
|
compilationProject = args.useBuildCaches === false ? createNeoScriptCompilationProject(document) : loadOrBuildNeoScriptProjectV1(args.workspace.root, document);
|
|
117041
|
+
compilePulledProjectDocumentForEvaluationV4(
|
|
117042
|
+
document,
|
|
117043
|
+
compilationProject,
|
|
117044
|
+
recompileTargets
|
|
117045
|
+
);
|
|
116451
117046
|
}
|
|
116452
|
-
const
|
|
117047
|
+
const replayDocument = replayableValueIds.size > 0 ? { ...document } : document;
|
|
117048
|
+
const replayContext = replayableValueIds.size > 0 ? createPulledConstructionReplayContext({ document: replayDocument }) : void 0;
|
|
116453
117049
|
let currentRows;
|
|
116454
117050
|
let currentReader;
|
|
116455
117051
|
const failures = [];
|
|
@@ -116484,7 +117080,7 @@ function materializedInitializerReconciliationFailuresV4(args) {
|
|
|
116484
117080
|
const replayRows = /* @__PURE__ */ new Map();
|
|
116485
117081
|
for (const [id2, row] of replayStoredConstructionV4({
|
|
116486
117082
|
records: records2,
|
|
116487
|
-
document,
|
|
117083
|
+
document: replayDocument,
|
|
116488
117084
|
replayContext,
|
|
116489
117085
|
valueId: reconciliation.valueId,
|
|
116490
117086
|
code: reconciliation.code,
|
|
@@ -116498,9 +117094,9 @@ function materializedInitializerReconciliationFailuresV4(args) {
|
|
|
116498
117094
|
}
|
|
116499
117095
|
replayRows.set(id2, row);
|
|
116500
117096
|
}
|
|
116501
|
-
assertPulledConstructorsCompiled(
|
|
117097
|
+
assertPulledConstructorsCompiled(replayDocument, replayContext);
|
|
116502
117098
|
currentRows ??= new Map(currentDocument.values.map((row) => [row.id, row]));
|
|
116503
|
-
currentReader ??= new EffectiveValueReader(
|
|
117099
|
+
currentReader ??= new EffectiveValueReader(replayDocument, currentRows);
|
|
116504
117100
|
const replay = replayRows.get(reconciliation.valueId);
|
|
116505
117101
|
const replayArgs = replay !== void 0 && isLiteralValueContent(replay) ? replay.constructorArgs : void 0;
|
|
116506
117102
|
const currentRoot = currentRows.get(reconciliation.valueId);
|
|
@@ -116558,10 +117154,10 @@ function materializeInitializersLocallyV4(args) {
|
|
|
116558
117154
|
readPulledProjectDocumentV4(records2),
|
|
116559
117155
|
variantOwnershipRootRecords(records2)
|
|
116560
117156
|
);
|
|
116561
|
-
|
|
117157
|
+
const authoredDocument = variantScope.document;
|
|
116562
117158
|
const rootKinds = /* @__PURE__ */ new Map();
|
|
116563
117159
|
const rootOwners = resolveSemanticOwnerMembersForValues(
|
|
116564
|
-
|
|
117160
|
+
authoredDocument,
|
|
116565
117161
|
sourceRoots,
|
|
116566
117162
|
variantScope.roots,
|
|
116567
117163
|
void 0,
|
|
@@ -116569,19 +117165,73 @@ function materializeInitializersLocallyV4(args) {
|
|
|
116569
117165
|
);
|
|
116570
117166
|
const roots = [];
|
|
116571
117167
|
const localizedTextIds = new Set(
|
|
116572
|
-
|
|
117168
|
+
authoredDocument.localizedTexts?.map((text) => text.id)
|
|
116573
117169
|
);
|
|
116574
|
-
|
|
116575
|
-
|
|
116576
|
-
|
|
117170
|
+
const pendingRoots = new Set(
|
|
117171
|
+
[...sourceRoots].filter((id2) => rootKinds.get(id2) !== "declaration").sort()
|
|
117172
|
+
);
|
|
117173
|
+
if (pendingRoots.size === 0) return { roots };
|
|
117174
|
+
const compilationProject = createNeoScriptCompilationProject(authoredDocument);
|
|
117175
|
+
const changedBodies = {
|
|
117176
|
+
memberIds: /* @__PURE__ */ new Set(),
|
|
117177
|
+
constructorIds: /* @__PURE__ */ new Set()
|
|
117178
|
+
};
|
|
117179
|
+
for (const change of args.changes) {
|
|
117180
|
+
if (change.operation === "delete") continue;
|
|
117181
|
+
if (change.recordKind === "member") {
|
|
117182
|
+
changedBodies.memberIds.add(change.recordId);
|
|
117183
|
+
} else if (change.recordKind === "constructor") {
|
|
117184
|
+
changedBodies.constructorIds.add(change.recordId);
|
|
117185
|
+
}
|
|
117186
|
+
}
|
|
117187
|
+
const needsDependentBodies = args.forceRecompile === true || args.changes.some(
|
|
117188
|
+
(change) => ["class", "member", "constructor", "enum", "interface"].includes(
|
|
117189
|
+
change.recordKind
|
|
117190
|
+
)
|
|
117191
|
+
);
|
|
117192
|
+
if (needsDependentBodies) {
|
|
117193
|
+
const currentDocument = readPulledProjectDocumentV4(
|
|
117194
|
+
reconciliationRecords(args.workspace, [])
|
|
117195
|
+
);
|
|
117196
|
+
const dependentBodies = initializerRecompileTargets({
|
|
117197
|
+
currentDocument,
|
|
117198
|
+
postDocument: authoredDocument,
|
|
117199
|
+
changes: args.changes,
|
|
117200
|
+
forceRecompile: args.forceRecompile
|
|
117201
|
+
});
|
|
117202
|
+
for (const id2 of dependentBodies.memberIds) changedBodies.memberIds.add(id2);
|
|
117203
|
+
for (const id2 of dependentBodies.constructorIds) {
|
|
117204
|
+
changedBodies.constructorIds.add(id2);
|
|
117205
|
+
}
|
|
117206
|
+
}
|
|
117207
|
+
compilePulledProjectDocumentForEvaluationV4(
|
|
117208
|
+
authoredDocument,
|
|
117209
|
+
compilationProject,
|
|
117210
|
+
changedBodies
|
|
117211
|
+
);
|
|
117212
|
+
assertPulledConstructorsCompiled(authoredDocument);
|
|
117213
|
+
const batch = createInitializerMaterializationBatch(
|
|
117214
|
+
authoredDocument,
|
|
117215
|
+
pendingRoots
|
|
117216
|
+
);
|
|
117217
|
+
const compiledInitializers = /* @__PURE__ */ new Map();
|
|
117218
|
+
materializeInitializerDependencies(pendingRoots, (sourceValueId) => {
|
|
117219
|
+
const batchDocument = batch.document();
|
|
117220
|
+
const document = {
|
|
117221
|
+
...authoredDocument,
|
|
117222
|
+
values: batchDocument.values,
|
|
117223
|
+
databaseVM: batchDocument.databaseVM
|
|
117224
|
+
};
|
|
116577
117225
|
const rootOwner = rootOwners.get(sourceValueId);
|
|
116578
117226
|
if (rootOwner === void 0) {
|
|
116579
117227
|
throw new Error(
|
|
116580
117228
|
`CLI initializer materialization cannot resolve the owning member for root "${sourceValueId}".`
|
|
116581
117229
|
);
|
|
116582
117230
|
}
|
|
116583
|
-
|
|
116584
|
-
|
|
117231
|
+
const replayContext = createPulledConstructionReplayContext({
|
|
117232
|
+
document,
|
|
117233
|
+
valuesById: batch.valuesById
|
|
117234
|
+
});
|
|
116585
117235
|
const code = initializerCode(records2, sourceValueId);
|
|
116586
117236
|
let compiledInitializer;
|
|
116587
117237
|
let pinnedRootSchemaKeys = /* @__PURE__ */ new Set();
|
|
@@ -116593,8 +117243,10 @@ function materializeInitializersLocallyV4(args) {
|
|
|
116593
117243
|
compilationProject,
|
|
116594
117244
|
replayContext,
|
|
116595
117245
|
member: rootOwner,
|
|
117246
|
+
compiledInitializer: compiledInitializers.get(sourceValueId),
|
|
116596
117247
|
onCompiledInitializer: (init) => {
|
|
116597
117248
|
compiledInitializer = init;
|
|
117249
|
+
compiledInitializers.set(sourceValueId, init);
|
|
116598
117250
|
},
|
|
116599
117251
|
onPinnedRootSchemaKeys: (schemaKeys) => {
|
|
116600
117252
|
pinnedRootSchemaKeys = schemaKeys;
|
|
@@ -116628,6 +117280,7 @@ function materializeInitializersLocallyV4(args) {
|
|
|
116628
117280
|
compilationProject,
|
|
116629
117281
|
replayContext,
|
|
116630
117282
|
member: rootOwner,
|
|
117283
|
+
compiledInitializer,
|
|
116631
117284
|
omitConstructionFields: true
|
|
116632
117285
|
});
|
|
116633
117286
|
const baselineRoot = baseline.get(sourceValueId);
|
|
@@ -116661,15 +117314,9 @@ function materializeInitializersLocallyV4(args) {
|
|
|
116661
117314
|
// class default, so the evaluated construction's own field list is what
|
|
116662
117315
|
// pins rows against collapse. The server commit pins the same set.
|
|
116663
117316
|
pinnedRootSchemaKeys,
|
|
116664
|
-
virtualValueIdForSource: (instanceRootId, sourceIdentity3) => isPendingId(instanceRootId) ? pendingVirtualValueId(instanceRootId, sourceIdentity3) : virtualValueId(instanceRootId, sourceIdentity3)
|
|
117317
|
+
virtualValueIdForSource: (instanceRootId, sourceIdentity3) => isPendingId(instanceRootId) || hasPendingVirtualSourceIdentity(sourceIdentity3) ? pendingVirtualValueId(instanceRootId, sourceIdentity3) : virtualValueId(instanceRootId, sourceIdentity3)
|
|
116665
117318
|
});
|
|
116666
117319
|
const evaluatedRows = [sparse2.root, ...sparse2.createdChildren];
|
|
116667
|
-
const valuesById = new Map(document.values.map((row) => [row.id, row]));
|
|
116668
|
-
for (const row of evaluatedRows) valuesById.set(row.id, row);
|
|
116669
|
-
const materializedDocument = {
|
|
116670
|
-
...document,
|
|
116671
|
-
values: [...valuesById.values()]
|
|
116672
|
-
};
|
|
116673
117320
|
roots.push({
|
|
116674
117321
|
sourceValueId,
|
|
116675
117322
|
rows: evaluatedRows.map((row) => ({ ...row }))
|
|
@@ -116683,8 +117330,8 @@ function materializeInitializersLocallyV4(args) {
|
|
|
116683
117330
|
data: row
|
|
116684
117331
|
});
|
|
116685
117332
|
}
|
|
116686
|
-
|
|
116687
|
-
}
|
|
117333
|
+
batch.upsert(evaluatedRows);
|
|
117334
|
+
});
|
|
116688
117335
|
return { roots };
|
|
116689
117336
|
}
|
|
116690
117337
|
function prospectiveInitializerRecordsV4(args) {
|
|
@@ -116833,6 +117480,8 @@ function variantOwnershipRootRecords(records2) {
|
|
|
116833
117480
|
var init_local_initializer_materialization = __esm({
|
|
116834
117481
|
"src/project-source/local-initializer-materialization.ts"() {
|
|
116835
117482
|
"use strict";
|
|
117483
|
+
init_evaluateInitializer();
|
|
117484
|
+
init_initializer_dependencies();
|
|
116836
117485
|
init_initializer_replay();
|
|
116837
117486
|
init_effective_value_comparison();
|
|
116838
117487
|
init_constructor_argument_ownership();
|
|
@@ -117750,6 +118399,7 @@ function computeWorkspaceStatus(workspace, options) {
|
|
|
117750
118399
|
try {
|
|
117751
118400
|
localInitializerMaterialization = materializeInitializersLocallyV4({
|
|
117752
118401
|
workspace,
|
|
118402
|
+
forceRecompile: options.forceRecompile,
|
|
117753
118403
|
changes: changes.map((change) => ({
|
|
117754
118404
|
recordKind: change.recordKind,
|
|
117755
118405
|
recordId: change.recordId,
|
|
@@ -117882,9 +118532,11 @@ function replayAnimationDeclarationInitializersV4(records2, document, fallbackDo
|
|
|
117882
118532
|
...document.values.map((row) => [row.id, row])
|
|
117883
118533
|
]);
|
|
117884
118534
|
for (const { row, code } of initializers) {
|
|
117885
|
-
if (rootKinds.get(row.id) !== "declaration") continue;
|
|
117886
118535
|
const owner = owners.get(row.id);
|
|
117887
118536
|
if (owner === void 0) continue;
|
|
118537
|
+
if (rootKinds.get(row.id) !== "declaration" && !isStaticMember(owner)) {
|
|
118538
|
+
continue;
|
|
118539
|
+
}
|
|
117888
118540
|
const declaredClassId = typeof row.classId === "string" ? row.classId : Reflect.get(owner, "classId");
|
|
117889
118541
|
if (typeof declaredClassId !== "string") continue;
|
|
117890
118542
|
if (!classBelongsToAnimationFamily(document.classesById, declaredClassId)) {
|
|
@@ -118856,6 +119508,7 @@ function verifyProjectSourceCommitAgainstStateV4(args) {
|
|
|
118856
119508
|
}
|
|
118857
119509
|
}
|
|
118858
119510
|
const status = computeWorkspaceStatus(workspace, {
|
|
119511
|
+
forceRecompile: args.forceRecompile,
|
|
118859
119512
|
skipProjectBinaryInspection: true,
|
|
118860
119513
|
useBuildCaches: false,
|
|
118861
119514
|
writeProjectAnalysisCache: () => void 0,
|
|
@@ -119021,7 +119674,18 @@ function derivedAssignment(pendingId2) {
|
|
|
119021
119674
|
if (virtualIdentity !== null) {
|
|
119022
119675
|
return {
|
|
119023
119676
|
ownerLocator: virtualIdentity.instanceRootId,
|
|
119024
|
-
derive: (ownerId) => virtualValueId(
|
|
119677
|
+
derive: (ownerId, assignments) => virtualValueId(
|
|
119678
|
+
ownerId,
|
|
119679
|
+
rewriteVirtualSourceIdentity(virtualIdentity.sourceIdentity, (id2) => {
|
|
119680
|
+
const assigned = assignments.get(id2);
|
|
119681
|
+
if (assigned === void 0) {
|
|
119682
|
+
throw new ProjectSourceCommitVerificationError(
|
|
119683
|
+
`Virtual value assignment ${pendingId2} names source ${id2}, which has no pending id assignment.`
|
|
119684
|
+
);
|
|
119685
|
+
}
|
|
119686
|
+
return assigned;
|
|
119687
|
+
})
|
|
119688
|
+
),
|
|
119025
119689
|
label: "Virtual value assignment",
|
|
119026
119690
|
ownerNoun: "instance root"
|
|
119027
119691
|
};
|
|
@@ -119038,7 +119702,7 @@ function assertDerivedAssignmentsAreDerived(assignments) {
|
|
|
119038
119702
|
`${derivation.label} ${pendingId2} names ${derivation.ownerNoun} ${derivation.ownerLocator}, which has no pending id assignment.`
|
|
119039
119703
|
);
|
|
119040
119704
|
}
|
|
119041
|
-
const derived = derivation.derive(ownerId);
|
|
119705
|
+
const derived = derivation.derive(ownerId, assignments);
|
|
119042
119706
|
if (assignedId !== derived) {
|
|
119043
119707
|
throw new ProjectSourceCommitVerificationError(
|
|
119044
119708
|
`${derivation.label} ${pendingId2} is ${assignedId}, but ${derivation.ownerNoun} ${ownerId} owns ${derived}.`
|
|
@@ -119068,24 +119732,51 @@ function positionIndependentAssignments(assignments) {
|
|
|
119068
119732
|
}
|
|
119069
119733
|
return resolved;
|
|
119070
119734
|
}
|
|
119071
|
-
function relocatedAssignment(pendingId2, assignments, byPosition) {
|
|
119735
|
+
function relocatedAssignment(pendingId2, assignments, byPosition, used) {
|
|
119072
119736
|
const key = positionIndependentPendingKey(pendingId2);
|
|
119073
119737
|
const relocated = key === null ? void 0 : byPosition.get(key);
|
|
119074
119738
|
if (relocated !== void 0) return relocated;
|
|
119739
|
+
for (const [owner, rebuild] of [
|
|
119740
|
+
[pendingMemberValueMemberId(pendingId2), pendingMemberValueId],
|
|
119741
|
+
[pendingEntryMemberDeclaringId(pendingId2), pendingEntryMemberId],
|
|
119742
|
+
[
|
|
119743
|
+
pendingRequiredConstructorClassId(pendingId2),
|
|
119744
|
+
pendingRequiredConstructorId
|
|
119745
|
+
]
|
|
119746
|
+
]) {
|
|
119747
|
+
if (owner === null) continue;
|
|
119748
|
+
const relocatedOwner = assignments.has(owner) ? owner : relocatedAssignment(owner, assignments, byPosition, used);
|
|
119749
|
+
if (relocatedOwner === null) return null;
|
|
119750
|
+
const rebuilt = rebuild(relocatedOwner);
|
|
119751
|
+
return assignments.has(rebuilt) ? rebuilt : null;
|
|
119752
|
+
}
|
|
119075
119753
|
const virtual = pendingVirtualValueIdentity(pendingId2);
|
|
119076
119754
|
if (virtual === null) return null;
|
|
119077
119755
|
let relocatedRoot = virtual.instanceRootId;
|
|
119078
|
-
if (!assignments.has(relocatedRoot)) {
|
|
119079
|
-
const
|
|
119080
|
-
|
|
119081
|
-
|
|
119082
|
-
|
|
119756
|
+
if (isPendingId(relocatedRoot) && !assignments.has(relocatedRoot)) {
|
|
119757
|
+
const canonicalRoot = relocatedAssignment(
|
|
119758
|
+
relocatedRoot,
|
|
119759
|
+
assignments,
|
|
119760
|
+
byPosition,
|
|
119761
|
+
used
|
|
119762
|
+
);
|
|
119763
|
+
if (canonicalRoot === null) return null;
|
|
119083
119764
|
relocatedRoot = canonicalRoot;
|
|
119084
119765
|
}
|
|
119085
|
-
const
|
|
119086
|
-
|
|
119087
|
-
|
|
119766
|
+
const sourceIdentity3 = rewriteVirtualSourceIdentity(
|
|
119767
|
+
virtual.sourceIdentity,
|
|
119768
|
+
(sourceId3) => {
|
|
119769
|
+
const relocatedSource = assignments.has(sourceId3) ? sourceId3 : relocatedAssignment(sourceId3, assignments, byPosition, used);
|
|
119770
|
+
if (relocatedSource === null) {
|
|
119771
|
+
throw new ProjectSourceCommitVerificationError(
|
|
119772
|
+
`Virtual value ${pendingId2} names source ${sourceId3}, which has no pending id assignment.`
|
|
119773
|
+
);
|
|
119774
|
+
}
|
|
119775
|
+
used.add(relocatedSource);
|
|
119776
|
+
return relocatedSource;
|
|
119777
|
+
}
|
|
119088
119778
|
);
|
|
119779
|
+
const relocatedVirtual = pendingVirtualValueId(relocatedRoot, sourceIdentity3);
|
|
119089
119780
|
return assignments.has(relocatedVirtual) ? relocatedVirtual : null;
|
|
119090
119781
|
}
|
|
119091
119782
|
function rewritePending(value, assignments, used, positionless) {
|
|
@@ -119096,7 +119787,12 @@ function rewritePending(value, assignments, used, positionless) {
|
|
|
119096
119787
|
return exact;
|
|
119097
119788
|
}
|
|
119098
119789
|
if (value.startsWith("__pending__:")) {
|
|
119099
|
-
const relocated = relocatedAssignment(
|
|
119790
|
+
const relocated = relocatedAssignment(
|
|
119791
|
+
value,
|
|
119792
|
+
assignments,
|
|
119793
|
+
positionless,
|
|
119794
|
+
used
|
|
119795
|
+
);
|
|
119100
119796
|
if (relocated !== null) {
|
|
119101
119797
|
used.add(relocated);
|
|
119102
119798
|
return assignments.get(relocated);
|
|
@@ -119958,7 +120654,7 @@ function createPulledConstructionReplayContext(args) {
|
|
|
119958
120654
|
return {
|
|
119959
120655
|
document: args.document,
|
|
119960
120656
|
constructorsValidated: false,
|
|
119961
|
-
valuesById: new Map(args.document.values.map((value) => [value.id, value]))
|
|
120657
|
+
valuesById: args.valuesById ?? new Map(args.document.values.map((value) => [value.id, value]))
|
|
119962
120658
|
};
|
|
119963
120659
|
}
|
|
119964
120660
|
function describePulledProjectBodyCompileError(error) {
|
|
@@ -120034,26 +120730,27 @@ function replayStoredConstructionV4(args) {
|
|
|
120034
120730
|
delete envelope.init;
|
|
120035
120731
|
const candidate = {
|
|
120036
120732
|
...envelope,
|
|
120037
|
-
init: { code: args.code }
|
|
120733
|
+
init: args.compiledInitializer ?? { code: args.code }
|
|
120038
120734
|
};
|
|
120039
|
-
|
|
120040
|
-
|
|
120041
|
-
|
|
120042
|
-
|
|
120043
|
-
|
|
120044
|
-
|
|
120045
|
-
|
|
120046
|
-
|
|
120047
|
-
|
|
120048
|
-
|
|
120049
|
-
|
|
120050
|
-
|
|
120051
|
-
|
|
120052
|
-
|
|
120053
|
-
|
|
120054
|
-
|
|
120055
|
-
|
|
120056
|
-
|
|
120735
|
+
if (args.compiledInitializer === void 0)
|
|
120736
|
+
compileValueRowInitializerBody({
|
|
120737
|
+
project: document.project,
|
|
120738
|
+
projectFiles: document.projectFiles,
|
|
120739
|
+
members: document.members,
|
|
120740
|
+
classes: document.classes,
|
|
120741
|
+
enums: document.enums,
|
|
120742
|
+
interfaces: document.interfaces,
|
|
120743
|
+
constructors: document.constructors,
|
|
120744
|
+
member: compileMember,
|
|
120745
|
+
valueRow: candidate,
|
|
120746
|
+
valueId: args.valueId,
|
|
120747
|
+
// Instance calls are self-contained. Declaration calls inherit the class
|
|
120748
|
+
// header parameters that are in lexical scope at their source site.
|
|
120749
|
+
initializerOwnerClass: args.initializerOwnerClass ?? null,
|
|
120750
|
+
lexicalThisClass: args.lexicalThisClass ?? null,
|
|
120751
|
+
storedConstructionReplay: true,
|
|
120752
|
+
...compilationProject === void 0 ? {} : { compilationProject }
|
|
120753
|
+
});
|
|
120057
120754
|
if (!isMemberValue(candidate) || !isInitValueContent(candidate)) {
|
|
120058
120755
|
throw new Error(
|
|
120059
120756
|
`Construction replay for value "${args.valueId}" did not compile an initializer row.`
|
|
@@ -120131,7 +120828,7 @@ function compilePulledUncompiledConstructorsV4(document, compilationProject, rep
|
|
|
120131
120828
|
}
|
|
120132
120829
|
assertPulledConstructorsCompiled(document, replayContext);
|
|
120133
120830
|
}
|
|
120134
|
-
function compilePulledProjectDocumentForEvaluationV4(document, compilationProject) {
|
|
120831
|
+
function compilePulledProjectDocumentForEvaluationV4(document, compilationProject, targets) {
|
|
120135
120832
|
const sharedCompilationProject = compilationProject ?? createNeoScriptCompilationProject({
|
|
120136
120833
|
project: document.project,
|
|
120137
120834
|
projectFiles: document.projectFiles,
|
|
@@ -120153,11 +120850,15 @@ function compilePulledProjectDocumentForEvaluationV4(document, compilationProjec
|
|
|
120153
120850
|
compilationProject: sharedCompilationProject
|
|
120154
120851
|
};
|
|
120155
120852
|
for (const constructor2 of compileArgs.constructors) {
|
|
120853
|
+
if (targets !== void 0 && !targets.constructorIds.has(constructor2.id) && !hasPendingNeoScriptDerivation("constructor", constructor2))
|
|
120854
|
+
continue;
|
|
120156
120855
|
compileConstructorRecord({ ...compileArgs, constructor: constructor2 });
|
|
120157
120856
|
}
|
|
120158
120857
|
assertPulledConstructorsCompiled(document);
|
|
120159
120858
|
const memberIndex = documentMemberCompilationIndex(document);
|
|
120160
120859
|
for (const member of compileArgs.members) {
|
|
120860
|
+
if (targets !== void 0 && !targets.memberIds.has(member.id) && !hasPendingNeoScriptDerivation("member", member))
|
|
120861
|
+
continue;
|
|
120161
120862
|
try {
|
|
120162
120863
|
compileAuthoredMemberBodies({
|
|
120163
120864
|
...compileArgs,
|
|
@@ -120344,6 +121045,7 @@ var init_initializer_replay = __esm({
|
|
|
120344
121045
|
init_server_preparation_preflight();
|
|
120345
121046
|
init_projection();
|
|
120346
121047
|
init_constructors2();
|
|
121048
|
+
init_neo_script_derived_bodies();
|
|
120347
121049
|
init_compiler_adapter();
|
|
120348
121050
|
pulledBodyCompileSites = /* @__PURE__ */ new WeakMap();
|
|
120349
121051
|
recentPulledDocuments = [];
|
|
@@ -120437,6 +121139,7 @@ function buildValueEmitContext(records2, manifest, options = {}) {
|
|
|
120437
121139
|
ownerClassIds: memberOwnerClassIdIndex(classes),
|
|
120438
121140
|
values,
|
|
120439
121141
|
enums,
|
|
121142
|
+
dictionaryKeyOptions: /* @__PURE__ */ new Map(),
|
|
120440
121143
|
localizedTexts,
|
|
120441
121144
|
mainLocale: projectMainLocale(records2),
|
|
120442
121145
|
symbolsByValueId,
|
|
@@ -121000,6 +121703,7 @@ function buildValueLowerContext(state, manifest, options = {}) {
|
|
|
121000
121703
|
new Map(entry.options.map((option) => [option.name, option.id]))
|
|
121001
121704
|
])
|
|
121002
121705
|
),
|
|
121706
|
+
enumNames: new Map(manifest.enums.map((entry) => [entry.id, entry.name])),
|
|
121003
121707
|
staticValueIdsBySymbol: staticTargets,
|
|
121004
121708
|
get rootValueTargetsByPath() {
|
|
121005
121709
|
return rootValueTargets ??= rootValueTargetsByPath(
|
|
@@ -121630,15 +122334,17 @@ function lowerMemberDefaultSourcesV4(state, analysis, manifest, options = {}) {
|
|
|
121630
122334
|
`Member default ${label} was classified as an owned literal graph but lowered as an initializer.`
|
|
121631
122335
|
);
|
|
121632
122336
|
}
|
|
121633
|
-
|
|
122337
|
+
const emptyInlineClassDefault = member.kind === "class" && isObjectRecord2(seed.value) && Object.keys(seed.value).length === 0 && (seed.constructorArgs === void 0 || Object.keys(seed.constructorArgs).length === 0) && seed.instanceConstructorId == null && seed.instanceVariantId == null && seed.instanceVariantRowValueId == null;
|
|
122338
|
+
const matchesStoredDefault = storedDefault !== null && canonicallyEqual(seed.value, storedDefault.value) && (seed.classId ?? null) === (typeof storedDefaultClassId === "string" ? storedDefaultClassId : null);
|
|
122339
|
+
if ((emptyInlineClassDefault || matchesStoredDefault) && (seed.values === void 0 || seed.values.length === 0) && (seed.bindingMembers === void 0 || seed.bindingMembers.length === 0) && (seed.localizedTexts === void 0 || seed.localizedTexts.length === 0)) {
|
|
121634
122340
|
for (const id2 of context.pendingValues.keys()) {
|
|
121635
122341
|
if (!pendingValueIdsBeforeSeed.has(id2)) {
|
|
121636
122342
|
deletePendingValue(context, id2);
|
|
121637
122343
|
}
|
|
121638
122344
|
}
|
|
121639
122345
|
memberDefaultValues.set(memberId, {
|
|
121640
|
-
value:
|
|
121641
|
-
classId:
|
|
122346
|
+
value: seed.value,
|
|
122347
|
+
classId: seed.classId
|
|
121642
122348
|
});
|
|
121643
122349
|
continue;
|
|
121644
122350
|
}
|
|
@@ -122335,24 +123041,21 @@ function lowerRowBackedDefault(context, member, backed, baseData3, binding) {
|
|
|
122335
123041
|
throw new Error(`Default value ${binding.label} requires {...}.`);
|
|
122336
123042
|
}
|
|
122337
123043
|
const entryMember = requiredMember(context, member.entryMemberId);
|
|
123044
|
+
const keyEnum = dictionaryKeyEnum(context, member);
|
|
122338
123045
|
const baseBody = backed.body;
|
|
122339
123046
|
const body = {};
|
|
122340
123047
|
const entrySlices = topLevelEntrySlices(binding.initializer, "{", "}");
|
|
122341
123048
|
let entryIndex = 0;
|
|
122342
123049
|
for (const entry of expression.entries) {
|
|
122343
|
-
|
|
122344
|
-
|
|
122345
|
-
`Default dictionary ${binding.label} requires string keys.`
|
|
122346
|
-
);
|
|
122347
|
-
}
|
|
122348
|
-
const existingId = isObjectRecord2(baseBody) ? baseBody[entry.key.value] : void 0;
|
|
123050
|
+
const key = lowerDictionaryKey(entry.key, keyEnum, binding.label);
|
|
123051
|
+
const existingId = isObjectRecord2(baseBody) ? baseBody[key] : void 0;
|
|
122349
123052
|
const entryId = typeof existingId === "string" ? existingId : annotatedValue(entry.value).id;
|
|
122350
123053
|
if (entryId === null || entryId === void 0) {
|
|
122351
123054
|
throw new Error(
|
|
122352
|
-
`Default dictionary ${binding.label}[${JSON.stringify(
|
|
123055
|
+
`Default dictionary ${binding.label}[${JSON.stringify(key)}] has no existing owned value row. Creating new default rows from source is not implemented by this slice.`
|
|
122353
123056
|
);
|
|
122354
123057
|
}
|
|
122355
|
-
body[
|
|
123058
|
+
body[key] = lowerValueRow(
|
|
122356
123059
|
context,
|
|
122357
123060
|
entryMember,
|
|
122358
123061
|
entry.value,
|
|
@@ -122956,19 +123659,18 @@ function lowerSeedRow(context, member, sourceExpression, source, valueId, path,
|
|
|
122956
123659
|
throw new Error(`Dictionary value ${path} requires {...}.`);
|
|
122957
123660
|
}
|
|
122958
123661
|
const entryMember = requiredMember(context, resolvedMember.entryMemberId);
|
|
123662
|
+
const keyEnum = dictionaryKeyEnum(context, resolvedMember);
|
|
122959
123663
|
const body = {};
|
|
122960
123664
|
const entrySlices = authoredSlice === void 0 ? [] : topLevelEntrySlices(authoredSlice, "{", "}");
|
|
122961
123665
|
let entryIndex = 0;
|
|
122962
123666
|
for (const entry of expression.entries) {
|
|
122963
|
-
|
|
122964
|
-
|
|
122965
|
-
}
|
|
122966
|
-
body[entry.key.value] = lowerSeedChild(
|
|
123667
|
+
const key = lowerDictionaryKey(entry.key, keyEnum, path);
|
|
123668
|
+
body[key] = lowerSeedChild(
|
|
122967
123669
|
context,
|
|
122968
123670
|
entryMember,
|
|
122969
123671
|
entry.value,
|
|
122970
123672
|
source,
|
|
122971
|
-
`${path}[${JSON.stringify(
|
|
123673
|
+
`${path}[${JSON.stringify(key)}]`,
|
|
122972
123674
|
rows,
|
|
122973
123675
|
localizedTexts,
|
|
122974
123676
|
void 0,
|
|
@@ -124587,32 +125289,31 @@ function lowerDictionaryValue(context, member, expression, base, source, inherit
|
|
|
124587
125289
|
throw new Error("Dictionary values require {...}.");
|
|
124588
125290
|
}
|
|
124589
125291
|
const baseBody = isObjectRecord2(base.value) ? base.value : {};
|
|
125292
|
+
const keyEnum = dictionaryKeyEnum(context, member);
|
|
124590
125293
|
const entryMember = requiredMember(context, member.entryMemberId);
|
|
124591
125294
|
const environment = valueGenericEnvironment(base, inheritedEnvironment);
|
|
124592
125295
|
const body = {};
|
|
124593
125296
|
for (const entry of expression.entries) {
|
|
124594
|
-
|
|
124595
|
-
|
|
124596
|
-
}
|
|
124597
|
-
const existingId = baseBody[entry.key.value];
|
|
125297
|
+
const key = lowerDictionaryKey(entry.key, keyEnum, member.name);
|
|
125298
|
+
const existingId = baseBody[key];
|
|
124598
125299
|
const symbolId = sourceValueSymbol(context, entry.value);
|
|
124599
125300
|
if (symbolId !== null) {
|
|
124600
125301
|
if (symbolId !== existingId) {
|
|
124601
125302
|
throw new Error(
|
|
124602
|
-
`Dictionary ${member.name}[${JSON.stringify(
|
|
125303
|
+
`Dictionary ${member.name}[${JSON.stringify(key)}] changes value placement from ${String(existingId)} to ${symbolId}. The atomic placement transaction is not implemented by this slice.`
|
|
124603
125304
|
);
|
|
124604
125305
|
}
|
|
124605
|
-
body[
|
|
125306
|
+
body[key] = symbolId;
|
|
124606
125307
|
continue;
|
|
124607
125308
|
}
|
|
124608
125309
|
const explicitId = annotatedValue(entry.value).id;
|
|
124609
125310
|
const valueId = explicitId ?? existingId;
|
|
124610
125311
|
if (typeof valueId !== "string") {
|
|
124611
125312
|
throw new Error(
|
|
124612
|
-
`Dictionary ${member.name}[${JSON.stringify(
|
|
125313
|
+
`Dictionary ${member.name}[${JSON.stringify(key)}] has no existing row. New dictionary entries are not implemented by this slice.`
|
|
124613
125314
|
);
|
|
124614
125315
|
}
|
|
124615
|
-
body[
|
|
125316
|
+
body[key] = lowerValueRow(
|
|
124616
125317
|
context,
|
|
124617
125318
|
entryMember,
|
|
124618
125319
|
entry.value,
|
|
@@ -125841,6 +126542,20 @@ function requiredMember(context, id2) {
|
|
|
125841
126542
|
if (member === void 0) throw new Error(`Missing member ${id2}.`);
|
|
125842
126543
|
return member;
|
|
125843
126544
|
}
|
|
126545
|
+
function dictionaryKeyEnum(context, member) {
|
|
126546
|
+
if (member.key.kind === "string") return null;
|
|
126547
|
+
const name = context.enumNames.get(member.key.enumId);
|
|
126548
|
+
const optionsByName = context.enumOptions.get(member.key.enumId);
|
|
126549
|
+
if (name === void 0) {
|
|
126550
|
+
throw new Error(`Unknown dictionary key enum ${member.key.enumId}.`);
|
|
126551
|
+
}
|
|
126552
|
+
if (optionsByName === void 0) {
|
|
126553
|
+
throw new Error(
|
|
126554
|
+
`Dictionary key enum ${member.key.enumId} has no option index.`
|
|
126555
|
+
);
|
|
126556
|
+
}
|
|
126557
|
+
return { name, optionsByName };
|
|
126558
|
+
}
|
|
125844
126559
|
function requiredClassByName(context, name) {
|
|
125845
126560
|
const schemaClass2 = context.classesByName.get(name);
|
|
125846
126561
|
if (schemaClass2 === void 0) throw new Error(`Unknown class ${name}.`);
|
|
@@ -126983,14 +127698,13 @@ ${ids.map(
|
|
|
126983
127698
|
if (!isObjectRecord2(row.value)) {
|
|
126984
127699
|
return storedRowIdentitySource(valueId, writeIdentity, "{}");
|
|
126985
127700
|
}
|
|
126986
|
-
const
|
|
126987
|
-
|
|
126988
|
-
);
|
|
127701
|
+
const keyOptions = dictionaryOptions2(context, type.keyEnumId);
|
|
127702
|
+
const entries = orderedDictionaryEntries(row.value, keyOptions);
|
|
126989
127703
|
const expression = entries.length === 0 ? "{}" : `{
|
|
126990
127704
|
${entries.flatMap(
|
|
126991
127705
|
([key, id2]) => typeof id2 === "string" ? [
|
|
126992
127706
|
indentNeoSourceNonEmptyLines(
|
|
126993
|
-
`${
|
|
127707
|
+
`${emitDictionaryKey(key, keyOptions)}: ${storedTypedRowSource(
|
|
126994
127708
|
context,
|
|
126995
127709
|
type.entryType,
|
|
126996
127710
|
id2,
|
|
@@ -127414,22 +128128,29 @@ function dictionaryValue(context, member, value, visited, inheritedEnvironment)
|
|
|
127414
128128
|
if (entryMember === void 0)
|
|
127415
128129
|
throw new Error(`Dictionary entry member was not pulled.`);
|
|
127416
128130
|
const environment = valueGenericEnvironment(value, inheritedEnvironment);
|
|
127417
|
-
const
|
|
127418
|
-
|
|
128131
|
+
const keyOptions = dictionaryOptions2(
|
|
128132
|
+
context,
|
|
128133
|
+
typeof member.keyEnumId === "string" ? member.keyEnumId : null
|
|
127419
128134
|
);
|
|
128135
|
+
const entries = orderedDictionaryEntries(body, keyOptions);
|
|
127420
128136
|
if (entries.length === 0) return "{}";
|
|
127421
128137
|
return `{
|
|
127422
128138
|
${entries.flatMap(
|
|
127423
128139
|
([key, id2]) => typeof id2 === "string" ? [
|
|
127424
128140
|
indentNeoSourceNonEmptyLines(
|
|
127425
|
-
`${
|
|
127426
|
-
|
|
127427
|
-
|
|
127428
|
-
|
|
127429
|
-
|
|
127430
|
-
|
|
127431
|
-
|
|
127432
|
-
|
|
128141
|
+
`${emitDictionaryKey(key, keyOptions)}: ${emitValue(
|
|
128142
|
+
context,
|
|
128143
|
+
entryMember,
|
|
128144
|
+
id2,
|
|
128145
|
+
{
|
|
128146
|
+
environment,
|
|
128147
|
+
definitionSite: !context.symbolsByValueId.has(id2),
|
|
128148
|
+
// Dictionary keys, like class schema keys, recover entry
|
|
128149
|
+
// identity from the owning row. Only list entries need an id.
|
|
128150
|
+
writeIdentity: false,
|
|
128151
|
+
visited
|
|
128152
|
+
}
|
|
128153
|
+
)}`,
|
|
127433
128154
|
2
|
|
127434
128155
|
)
|
|
127435
128156
|
] : []
|
|
@@ -127736,6 +128457,32 @@ function enumOptionNames(value) {
|
|
|
127736
128457
|
}
|
|
127737
128458
|
return result;
|
|
127738
128459
|
}
|
|
128460
|
+
function dictionaryOptions2(context, enumId) {
|
|
128461
|
+
if (enumId === null) return null;
|
|
128462
|
+
const cached = context.dictionaryKeyOptions.get(enumId);
|
|
128463
|
+
if (cached !== void 0) return cached;
|
|
128464
|
+
const schemaEnum = context.enums.get(enumId);
|
|
128465
|
+
if (schemaEnum === void 0) {
|
|
128466
|
+
throw new Error(`Dictionary key enum ${enumId} was not pulled.`);
|
|
128467
|
+
}
|
|
128468
|
+
const options = isObjectRecord2(schemaEnum.options) ? schemaEnum.options : {};
|
|
128469
|
+
const keys = appendMissingKeys(
|
|
128470
|
+
optionalStringArray(schemaEnum.optionKeyOrder),
|
|
128471
|
+
Object.keys(options)
|
|
128472
|
+
);
|
|
128473
|
+
const result = /* @__PURE__ */ new Map();
|
|
128474
|
+
for (const [order, key] of keys.entries()) {
|
|
128475
|
+
const option = options[key];
|
|
128476
|
+
if (!isObjectRecord2(option)) continue;
|
|
128477
|
+
const id2 = typeof option.id === "string" ? option.id : key;
|
|
128478
|
+
const name = typeof option.name === "string" ? option.name : key;
|
|
128479
|
+
const entry = { name, order };
|
|
128480
|
+
result.set(id2, entry);
|
|
128481
|
+
result.set(key, entry);
|
|
128482
|
+
}
|
|
128483
|
+
context.dictionaryKeyOptions.set(enumId, result);
|
|
128484
|
+
return result;
|
|
128485
|
+
}
|
|
127739
128486
|
function dataById(records2, kind) {
|
|
127740
128487
|
return new Map(
|
|
127741
128488
|
[...records2.values()].flatMap(
|
|
@@ -127820,6 +128567,7 @@ var init_value_sources = __esm({
|
|
|
127820
128567
|
init_local_values();
|
|
127821
128568
|
init_initializer_reference_spellings();
|
|
127822
128569
|
init_lower_members();
|
|
128570
|
+
init_dictionary_enum_keys();
|
|
127823
128571
|
init_lower_variants();
|
|
127824
128572
|
init_member_kind_type_names();
|
|
127825
128573
|
init_member_records();
|
|
@@ -130942,7 +131690,7 @@ function assignPendingIds(changes, authoredValueSeeds, reconstructed3, localInit
|
|
|
130942
131690
|
const instanceRootId = isPendingId(pendingVirtual.instanceRootId) ? assign(pendingVirtual.instanceRootId) : pendingVirtual.instanceRootId;
|
|
130943
131691
|
const derived = virtualValueId(
|
|
130944
131692
|
instanceRootId,
|
|
130945
|
-
pendingVirtual.sourceIdentity
|
|
131693
|
+
rewriteVirtualSourceIdentity(pendingVirtual.sourceIdentity, assign)
|
|
130946
131694
|
);
|
|
130947
131695
|
assigned.set(pendingId2, derived);
|
|
130948
131696
|
return derived;
|
|
@@ -132367,7 +133115,8 @@ async function prepareLocalPushArtifactsV4(workspace, status, onPhase = () => vo
|
|
|
132367
133115
|
const localInitializerMaterialization = status.localInitializerMaterialization ?? materializeInitializersLocallyV4({
|
|
132368
133116
|
workspace,
|
|
132369
133117
|
changes: pendingTransportChanges,
|
|
132370
|
-
authoredValueSeeds: pendingTransportSeeds
|
|
133118
|
+
authoredValueSeeds: pendingTransportSeeds,
|
|
133119
|
+
forceRecompile: options.forceRecompile
|
|
132371
133120
|
});
|
|
132372
133121
|
onPhase("Assigning pending value identities\u2026");
|
|
132373
133122
|
const pendingAssignment = assignPendingIds(
|
|
@@ -132410,6 +133159,7 @@ async function prepareLocalPushArtifactsV4(workspace, status, onPhase = () => vo
|
|
|
132410
133159
|
changes: transportChanges,
|
|
132411
133160
|
authoredValueSeeds: transportSeeds,
|
|
132412
133161
|
initializerMaterialization: pendingAssignment.localInitializerMaterialization ?? { roots: [] },
|
|
133162
|
+
forceRecompile: options.forceRecompile,
|
|
132413
133163
|
pendingIdAssignments: Object.fromEntries(pendingAssignment.assigned),
|
|
132414
133164
|
stagedFiles: preparedFiles
|
|
132415
133165
|
});
|
|
@@ -139540,7 +140290,7 @@ var init_registry2 = __esm({
|
|
|
139540
140290
|
"schema-contract/registry.mjs"() {
|
|
139541
140291
|
"use strict";
|
|
139542
140292
|
PROJECT_SCHEMA_CONTRACT = Object.freeze({
|
|
139543
|
-
cliVersion: "0.
|
|
140293
|
+
cliVersion: "0.57.1",
|
|
139544
140294
|
projectFileUploadBatchSize: 32,
|
|
139545
140295
|
documentRecords: {
|
|
139546
140296
|
member: {
|
|
@@ -147361,7 +148111,7 @@ There is no --keep-current: preserving current semantic state defines flatten.
|
|
|
147361
148111
|
async function main() {
|
|
147362
148112
|
const args = parseArgs(process.argv.slice(2));
|
|
147363
148113
|
if (args.command === "--version") {
|
|
147364
|
-
console.log("0.
|
|
148114
|
+
console.log("0.57.1");
|
|
147365
148115
|
return;
|
|
147366
148116
|
}
|
|
147367
148117
|
if (args.command === null || args.command === "help" || args.command === "--help" || args.command === "-h") {
|