@neocompose/cli 0.70.3 → 0.70.5

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/dist/neo.mjs CHANGED
@@ -8893,13 +8893,15 @@ var require_ignore = __commonJS({
8893
8893
  var EMPTY2 = "";
8894
8894
  var SPACE = " ";
8895
8895
  var ESCAPE = "\\";
8896
- var REGEX_TEST_BLANK_LINE = /^\s+$/;
8896
+ var REGEX_LITERAL_SPECIAL = /[.*+?()[\]{}^$|\\/]/;
8897
+ var BOM = "\uFEFF";
8897
8898
  var REGEX_INVALID_TRAILING_BACKSLASH = /(?:[^\\]|^)\\$/;
8898
8899
  var REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/;
8899
8900
  var REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/;
8900
8901
  var REGEX_SPLITALL_CRLF = /\r?\n/g;
8901
- var REGEX_TEST_INVALID_PATH = /^\.{0,2}\/|^\.{1,2}$/;
8902
- var REGEX_TEST_TRAILING_SLASH = /\/$/;
8902
+ var DOUBLE_SLASH = "//";
8903
+ var SLASH_CODE = 47;
8904
+ var DOT_CODE = 46;
8903
8905
  var SLASH = "/";
8904
8906
  var TMP_KEY_IGNORE = "node-ignore";
8905
8907
  if (typeof Symbol !== "undefined") {
@@ -8910,44 +8912,173 @@ var require_ignore = __commonJS({
8910
8912
  Object.defineProperty(object2, key, { value });
8911
8913
  return value;
8912
8914
  };
8913
- var REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g;
8914
8915
  var RETURN_FALSE = () => false;
8915
- var sanitizeRange = (range2) => range2.replace(
8916
- REGEX_REGEXP_RANGE,
8917
- (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) ? match : EMPTY2
8918
- );
8919
- var negateRange = (range2) => range2.startsWith("!") || range2.startsWith("\\^") ? `^${range2.slice(range2[0] === "!" ? 1 : 2)}` : range2;
8920
8916
  var cleanRangeBackSlash = (slashes) => {
8921
8917
  const { length } = slashes;
8922
8918
  return slashes.slice(0, length - length % 2);
8923
8919
  };
8920
+ var POSIX_CLASSES = {
8921
+ alnum: "0-9A-Za-z",
8922
+ alpha: "A-Za-z",
8923
+ blank: " \\t",
8924
+ cntrl: "\\x00-\\x1f\\x7f",
8925
+ digit: "0-9",
8926
+ graph: "!-.0-~",
8927
+ lower: "a-z",
8928
+ print: " -.0-~",
8929
+ punct: "!-.:-@\\[-`{-~",
8930
+ // git's `sane-ctype.h` classifies \v and \f as control, not space,
8931
+ // unlike C's `isspace`
8932
+ space: " \\t\\n\\r",
8933
+ upper: "A-Z",
8934
+ xdigit: "0-9A-Fa-f"
8935
+ };
8936
+ var CLASS_MEMBERS_TO_ESCAPE = "\\]^-[";
8937
+ var escapeMember = (char) => CLASS_MEMBERS_TO_ESCAPE.indexOf(char) < 0 ? char : ESCAPE + char;
8938
+ var NON_SLASH = "(?!\\/)";
8939
+ var classSource = (negated, body) => {
8940
+ if (negated) {
8941
+ return `[^\\/${body}]`;
8942
+ }
8943
+ const source = `[${body}]`;
8944
+ return new RegExp(source).test("/") ? NON_SLASH + source : source;
8945
+ };
8946
+ var scanBracket = (pattern, start) => {
8947
+ const { length } = pattern;
8948
+ let index = start + 1;
8949
+ let negated = EMPTY2;
8950
+ const lead = pattern[index];
8951
+ if (lead === "!" || lead === "^") {
8952
+ negated = "^";
8953
+ index++;
8954
+ }
8955
+ let body = EMPTY2;
8956
+ let prev = EMPTY2;
8957
+ for (; ; ) {
8958
+ const char = pattern[index];
8959
+ if (char === UNDEFINED) {
8960
+ return null;
8961
+ }
8962
+ if (char === ESCAPE) {
8963
+ const escaped = pattern[index + 1];
8964
+ if (escaped === UNDEFINED) {
8965
+ return null;
8966
+ }
8967
+ body += escapeMember(escaped);
8968
+ prev = escaped;
8969
+ index++;
8970
+ } else if (char === "-" && prev && index + 1 < length && pattern[index + 1] !== "]") {
8971
+ index++;
8972
+ let to = pattern[index];
8973
+ if (to === ESCAPE) {
8974
+ to = pattern[index += 1];
8975
+ }
8976
+ if (prev <= to) {
8977
+ body += `-${escapeMember(to)}`;
8978
+ }
8979
+ prev = EMPTY2;
8980
+ } else if (char === "[" && pattern[index + 1] === ":") {
8981
+ const nameStart = index + 2;
8982
+ let end = nameStart;
8983
+ while (end < length && pattern[end] !== "]") {
8984
+ end++;
8985
+ }
8986
+ if (end === length) {
8987
+ return null;
8988
+ }
8989
+ if (end > nameStart && pattern[end - 1] === ":") {
8990
+ const expanded = POSIX_CLASSES[pattern.slice(nameStart, end - 1)];
8991
+ if (expanded === UNDEFINED) {
8992
+ return null;
8993
+ }
8994
+ body += expanded;
8995
+ prev = EMPTY2;
8996
+ index = end;
8997
+ } else {
8998
+ body += escapeMember("[");
8999
+ prev = "[";
9000
+ index = nameStart - 2;
9001
+ }
9002
+ } else {
9003
+ body += escapeMember(char);
9004
+ prev = char;
9005
+ }
9006
+ index++;
9007
+ if (pattern[index] === "]") {
9008
+ return {
9009
+ end: index,
9010
+ source: classSource(negated, body)
9011
+ };
9012
+ }
9013
+ }
9014
+ };
9015
+ var NEVER_MATCH = "[]";
9016
+ var PLACEHOLDER = "\0";
9017
+ var REGEX_RESTORE_PLACEHOLDER = new RegExp(
9018
+ `${PLACEHOLDER}(\\d+)${PLACEHOLDER}`,
9019
+ "g"
9020
+ );
9021
+ var TRAILING_WILDCARD = "\uE000";
9022
+ var TRAILING_DOUBLESTAR = "\uE001";
9023
+ var extractBrackets = (pattern) => {
9024
+ const sources2 = [];
9025
+ const hold = (source) => `${PLACEHOLDER}${sources2.push(source) - 1}${PLACEHOLDER}`;
9026
+ const { length } = pattern;
9027
+ let out = EMPTY2;
9028
+ let index = 0;
9029
+ while (index < length) {
9030
+ const char = pattern[index];
9031
+ if (char === ESCAPE) {
9032
+ const escaped = pattern[index + 1];
9033
+ if (escaped === UNDEFINED || escaped === SLASH && index + 2 === length) {
9034
+ out += hold(NEVER_MATCH);
9035
+ } else if (escaped === "*" || escaped === "[" || escaped === SPACE || escaped === ESCAPE) {
9036
+ out += pattern.slice(index, index + 2);
9037
+ } else {
9038
+ out += hold(
9039
+ REGEX_LITERAL_SPECIAL.test(escaped) ? ESCAPE + escaped : escaped
9040
+ );
9041
+ }
9042
+ index += 2;
9043
+ } else if (char === PLACEHOLDER) {
9044
+ out += hold(`[${PLACEHOLDER}]`);
9045
+ index++;
9046
+ } else if (char === "[") {
9047
+ const scanned = scanBracket(pattern, index);
9048
+ if (scanned === null) {
9049
+ out += hold(NEVER_MATCH);
9050
+ index = length;
9051
+ } else {
9052
+ out += hold(scanned.source);
9053
+ index = scanned.end + 1;
9054
+ }
9055
+ } else {
9056
+ out += char;
9057
+ index++;
9058
+ }
9059
+ }
9060
+ return {
9061
+ source: out,
9062
+ sources: sources2
9063
+ };
9064
+ };
9065
+ var DIRECT = null;
9066
+ var REGEX_INNER_SLASH = /\/(?!$)/;
8924
9067
  var REPLACERS = [
8925
- [
8926
- // Remove BOM
8927
- // TODO:
8928
- // Other similar zero-width characters?
8929
- /^\uFEFF/,
8930
- () => EMPTY2
8931
- ],
8932
- // > Trailing spaces are ignored unless they are quoted with backslash ("\")
8933
- [
8934
- // (a\ ) -> (a )
8935
- // (a ) -> (a)
8936
- // (a ) -> (a)
8937
- // (a \ ) -> (a )
8938
- /((?:\\\\)*?)(\\?\s+)$/,
8939
- (_, m1, m2) => m1 + (m2.indexOf("\\") === 0 ? SPACE : EMPTY2)
8940
- ],
8941
9068
  // Replace (\ ) with ' '
9069
+ // Only a space: an escaped tab or other whitespace is already a literal by
9070
+ // the time it reaches here, and a bare tab must be left as one, not turned
9071
+ // into a space.
8942
9072
  // (\ ) -> ' '
8943
9073
  // (\\ ) -> '\\ '
8944
9074
  // (\\\ ) -> '\\ '
8945
9075
  [
8946
- /(\\+?)\s/g,
8947
- (_, m1) => {
8948
- const { length } = m1;
8949
- return m1.slice(0, length - length % 2) + SPACE;
8950
- }
9076
+ // A run of backslashes is taken whole, from its first one, so no match
9077
+ // ever starts again inside it -- `(\\+?) ` did, which made a long run
9078
+ // quadratic.
9079
+ /(\\+)( ?)/g,
9080
+ (_, run, space) => space ? run.slice(0, run.length - run.length % 2) + SPACE : run,
9081
+ ESCAPE + SPACE
8951
9082
  ],
8952
9083
  // Escape metacharacters
8953
9084
  // which is written down by users but means special for regular expressions.
@@ -8972,7 +9103,8 @@ var require_ignore = __commonJS({
8972
9103
  [
8973
9104
  // > a question mark (?) matches a single character
8974
9105
  /(?!\\)\?/g,
8975
- () => "[^/]"
9106
+ () => "[^/]",
9107
+ "?"
8976
9108
  ],
8977
9109
  // leading slash
8978
9110
  [
@@ -8980,12 +9112,14 @@ var require_ignore = __commonJS({
8980
9112
  // > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".
8981
9113
  // A leading slash matches the beginning of the pathname
8982
9114
  /^\//,
8983
- () => "^"
9115
+ () => "^",
9116
+ SLASH
8984
9117
  ],
8985
9118
  // replace special metacharacter slash after the leading slash
8986
9119
  [
8987
9120
  /\//g,
8988
- () => "\\/"
9121
+ () => "\\/",
9122
+ SLASH
8989
9123
  ],
8990
9124
  [
8991
9125
  // > A leading "**" followed by a slash means match in all directories.
@@ -8996,16 +9130,21 @@ var require_ignore = __commonJS({
8996
9130
  // Notice that the '*'s have been replaced as '\\*'
8997
9131
  /^\^*(?:\\\*\\\*\\\/)+/,
8998
9132
  // '**/foo' <-> 'foo'
8999
- () => "^(?:.*\\/)?"
9133
+ () => "^(?:.*\\/)?",
9134
+ "*"
9000
9135
  ],
9001
9136
  // starting
9002
9137
  [
9003
9138
  // there will be no leading '/'
9004
9139
  // (which has been replaced by section "leading slash")
9005
9140
  // If starts with '**', adding a '^' to the regular expression also works
9006
- /^(?=[^^])/,
9007
- function startingReplacer() {
9008
- return !/\/(?!$)/.test(this) ? "(?:^|\\/)" : "^";
9141
+ DIRECT,
9142
+ (source, pattern) => {
9143
+ if (!source || source[0] === "^") {
9144
+ return source;
9145
+ }
9146
+ const anchor = !REGEX_INNER_SLASH.test(pattern) ? "(?:^|\\/)" : "^";
9147
+ return anchor + source;
9009
9148
  }
9010
9149
  ],
9011
9150
  // two globstars
@@ -9015,7 +9154,8 @@ var require_ignore = __commonJS({
9015
9154
  // Zero, one or several directories
9016
9155
  // should not use '*', or it will be replaced by the next replacer
9017
9156
  // Check if it is not the last `'/**'`
9018
- (_, index, str) => index + 6 < str.length ? "(?:\\/[^\\/]+)*" : "\\/.+"
9157
+ (_, index, str) => index + 6 < str.length ? str.slice(index + 6) === "\\/" ? "(?:\\/[^\\/]+)+" : "(?:\\/[^\\/]+)*" : `\\/${TRAILING_DOUBLESTAR}`,
9158
+ "*"
9019
9159
  ],
9020
9160
  // normal intermediate wildcards
9021
9161
  [
@@ -9030,32 +9170,56 @@ var require_ignore = __commonJS({
9030
9170
  (_, p1, p2) => {
9031
9171
  const unescaped = p2.replace(/\\\*/g, "[^\\/]*");
9032
9172
  return p1 + unescaped;
9033
- }
9173
+ },
9174
+ "*"
9175
+ ],
9176
+ // trailing wildcard, held apart from a literal star
9177
+ [
9178
+ // The step above leaves a trailing `*` alone, so a single `\*` is all that
9179
+ // can be left at the end here. Whether it is a wildcard or a literal
9180
+ // turns on the backslashes the user put in front of it: the escaper has
9181
+ // since doubled every one, so what stands here is those `2N` doubled
9182
+ // backslashes and then the star's own escape. An even number of the
9183
+ // original `N` leaves the star unescaped -- a wildcard -- and an odd
9184
+ // number escapes it -- a literal. This runs while the two are still
9185
+ // distinct, before the unescape steps below collapse the literal onto
9186
+ // the very `\*` a wildcard leaves behind.
9187
+ /(^|[^\\])((?:\\\\)*)\\\*$/,
9188
+ (match, p1, p2) => (
9189
+ // `p2` holds the doubled user backslashes; half of them is `N`.
9190
+ p2.length / 2 % 2 === 0 ? p1 + p2 + TRAILING_WILDCARD : match
9191
+ ),
9192
+ "*"
9034
9193
  ],
9035
9194
  [
9036
9195
  // unescape, revert step 3 except for back slash
9037
9196
  // For example, if a user escape a '\\*',
9038
9197
  // after step 3, the result will be '\\\\\\*'
9039
9198
  /\\\\\\(?=[$.|*+(){^])/g,
9040
- () => ESCAPE
9199
+ () => ESCAPE,
9200
+ ESCAPE + ESCAPE
9041
9201
  ],
9042
9202
  [
9043
9203
  // '\\\\' -> '\\'
9044
9204
  /\\\\/g,
9045
- () => ESCAPE
9205
+ () => ESCAPE,
9206
+ ESCAPE + ESCAPE
9046
9207
  ],
9047
9208
  [
9048
- // > The range notation, e.g. [a-zA-Z],
9049
- // > can be used to match one of the characters in a range.
9209
+ // Every real bracket expression -- POSIX classes included -- has already
9210
+ // been held aside by `extractBrackets`, so the only `[` left in the
9211
+ // pattern is an escaped, literal one.
9050
9212
  // `\` is escaped by step 3
9051
- /(\\)?\[([^\]/]*?)(\\*)($|\])/g,
9052
- (match, leadEscape, range2, endEscape, close) => leadEscape === ESCAPE ? `\\[${range2}${cleanRangeBackSlash(endEscape)}${close}` : close === "]" ? endEscape.length % 2 === 0 ? `[${negateRange(sanitizeRange(range2))}${endEscape}]` : "[]" : "[]"
9213
+ /\\\[([^\]/]*?)(\\*)($|\])/g,
9214
+ // '\\[bar]' -> '\\\\[bar\\]'
9215
+ (match, range2, endEscape, close) => `\\[${range2}${cleanRangeBackSlash(endEscape)}${close}`,
9216
+ "["
9053
9217
  ],
9054
9218
  // ending
9055
9219
  [
9056
9220
  // 'js' will not match 'js.'
9057
9221
  // 'ab' will not match 'abc'
9058
- /(?:[^*])$/,
9222
+ DIRECT,
9059
9223
  // WTF!
9060
9224
  // https://git-scm.com/docs/gitignore
9061
9225
  // changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1)
@@ -9066,29 +9230,175 @@ var require_ignore = __commonJS({
9066
9230
  // 'js*' will not match 'a.js'
9067
9231
  // 'js/' will not match 'a.js'
9068
9232
  // 'js' will match 'a.js' and 'a.js/'
9069
- (match) => /\/$/.test(match) ? `${match}$` : `${match}(?=$|\\/$)`
9233
+ (source) => {
9234
+ const last = source[source.length - 1];
9235
+ if (!last || last === TRAILING_WILDCARD || last === TRAILING_DOUBLESTAR) {
9236
+ return source;
9237
+ }
9238
+ return last === SLASH ? `${source}$` : `${source}(?=$|\\/$)`;
9239
+ }
9070
9240
  ]
9071
9241
  ];
9072
- var REGEX_REPLACE_TRAILING_WILDCARD = /(^|\\\/)?\\\*$/;
9242
+ var REGEX_REPLACE_TRAILING_WILDCARD = /(^|\\\/)?\uE000$/;
9073
9243
  var MODE_IGNORE = "regex";
9074
9244
  var MODE_CHECK_IGNORE = "checkRegex";
9075
9245
  var UNDERSCORE = "_";
9076
- var TRAILING_WILD_CARD_REPLACERS = {
9077
- [MODE_IGNORE](_, p1) {
9078
- const prefix = p1 ? `${p1}[^/]+` : "[^/]*";
9079
- return `${prefix}(?=$|\\/$)`;
9080
- },
9081
- [MODE_CHECK_IGNORE](_, p1) {
9082
- const prefix = p1 ? `${p1}[^/]*` : "[^/]*";
9083
- return `${prefix}(?=$|\\/$)`;
9246
+ var replaceTrailingWildcard = (_, p1) => {
9247
+ const prefix = p1 ? `${p1}[^/]+` : "[^/]*";
9248
+ return `${prefix}(?=$|\\/$)`;
9249
+ };
9250
+ var REGEX_REPLACE_TRAILING_DOUBLESTAR = /\uE001$/;
9251
+ var replaceTrailingDoublestar = () => ".+(?=$|\\/$)";
9252
+ var WILDCARD = "[^\\/]*";
9253
+ var separatorAfter = (run, at3) => {
9254
+ let separator = EMPTY2;
9255
+ for (let index = at3 + 1; index < run.length && !run[index].wildcard; index++) {
9256
+ separator += run[index].single;
9257
+ }
9258
+ return separator;
9259
+ };
9260
+ var pinWildcards = (source) => {
9261
+ if (source.indexOf(WILDCARD) < 0) {
9262
+ return source;
9263
+ }
9264
+ const tokens = [];
9265
+ const { length } = source;
9266
+ let index = 0;
9267
+ while (index < length) {
9268
+ const char = source[index];
9269
+ if (source.startsWith(WILDCARD, index)) {
9270
+ tokens.push({ wildcard: true });
9271
+ index += WILDCARD.length;
9272
+ } else if (char === "[") {
9273
+ let end = index + 1;
9274
+ if (source[end] === "^") {
9275
+ end++;
9276
+ }
9277
+ if (source[end] === "]") {
9278
+ end++;
9279
+ }
9280
+ while (end < length && source[end] !== "]") {
9281
+ end += source[end] === ESCAPE ? 2 : 1;
9282
+ }
9283
+ end++;
9284
+ tokens.push({ single: source.slice(index, end) });
9285
+ index = end;
9286
+ } else if (char === ESCAPE) {
9287
+ tokens.push({ single: source.slice(index, index + 2) });
9288
+ index += 2;
9289
+ } else if (char === "(") {
9290
+ let depth = 0;
9291
+ let end = index;
9292
+ do {
9293
+ if (source[end] === ESCAPE) {
9294
+ end++;
9295
+ } else if (source[end] === "(") {
9296
+ depth++;
9297
+ } else if (source[end] === ")") {
9298
+ depth--;
9299
+ }
9300
+ end++;
9301
+ } while (end < length && depth > 0);
9302
+ if ("*+?".indexOf(source[end]) >= 0) {
9303
+ end++;
9304
+ }
9305
+ tokens.push({ boundary: source.slice(index, end) });
9306
+ index = end;
9307
+ } else if (char === "^" || char === "$") {
9308
+ tokens.push({ boundary: char });
9309
+ index++;
9310
+ } else {
9311
+ tokens.push({ single: char });
9312
+ index++;
9313
+ }
9084
9314
  }
9315
+ let out = EMPTY2;
9316
+ let run = [];
9317
+ const flush = () => {
9318
+ let lastWildcard;
9319
+ run.forEach((token, at3) => {
9320
+ if (token.wildcard) {
9321
+ lastWildcard = at3;
9322
+ }
9323
+ });
9324
+ run.forEach((token, at3) => {
9325
+ if (!token.wildcard) {
9326
+ out += token.single;
9327
+ return;
9328
+ }
9329
+ out += at3 === lastWildcard ? WILDCARD : `(?:(?!${separatorAfter(run, at3)})[^\\/])*`;
9330
+ });
9331
+ run = [];
9332
+ };
9333
+ tokens.forEach((token) => {
9334
+ if (token.boundary === void 0) {
9335
+ run.push(token);
9336
+ return;
9337
+ }
9338
+ flush();
9339
+ out += token.boundary;
9340
+ });
9341
+ flush();
9342
+ return out;
9343
+ };
9344
+ var makeRegexPrefix = (pattern) => {
9345
+ const { source, sources: sources2 } = extractBrackets(pattern);
9346
+ const replaced = REPLACERS.reduce(
9347
+ // A pass whose matcher finds nothing hands back the very string it was
9348
+ // given, so asking first costs a search and saves a rewrite. Ten of the
9349
+ // fifteen passes never fire for a typical .gitignore line, and between
9350
+ // them they were 45% of this chain.
9351
+ (prev, [matcher, replacer, required2]) => {
9352
+ if (matcher === DIRECT) {
9353
+ return replacer(prev, pattern);
9354
+ }
9355
+ if (required2 !== UNDEFINED && prev.indexOf(required2) < 0) {
9356
+ return prev;
9357
+ }
9358
+ return matcher.test(prev) ? prev.replace(matcher, replacer.bind(pattern)) : prev;
9359
+ },
9360
+ source
9361
+ );
9362
+ return sources2.length ? replaced.replace(
9363
+ REGEX_RESTORE_PLACEHOLDER,
9364
+ (match, index) => sources2[index]
9365
+ ) : replaced;
9366
+ };
9367
+ var checkSourceOf = (body, prefix) => {
9368
+ if (body[body.length - 1] === SLASH) {
9369
+ prefix = makeRegexPrefix(body.slice(0, -1));
9370
+ }
9371
+ const head = prefix.slice(0, -1);
9372
+ const last = prefix[prefix.length - 1];
9373
+ return last === TRAILING_WILDCARD ? `${head}$` : last === TRAILING_DOUBLESTAR ? `${head}.*$` : NEVER_MATCH;
9374
+ };
9375
+ var matchesBasename = (body) => {
9376
+ const index = body.indexOf(SLASH);
9377
+ return index < 0 || index === body.length - 1;
9378
+ };
9379
+ var basenameOf = (path) => {
9380
+ const end = path.length - 1;
9381
+ const index = path.lastIndexOf(
9382
+ SLASH,
9383
+ path[end] === SLASH ? end - 1 : end
9384
+ );
9385
+ return index < 0 ? path : path.slice(index + 1);
9386
+ };
9387
+ var parentOf = (path) => {
9388
+ if (path.charCodeAt(0) === SLASH_CODE || path.indexOf(DOUBLE_SLASH) >= 0) {
9389
+ const slices = path.split(SLASH).filter(Boolean);
9390
+ slices.pop();
9391
+ return slices.length ? slices.join(SLASH) + SLASH : EMPTY2;
9392
+ }
9393
+ const end = path.length - 1;
9394
+ const cut = path.lastIndexOf(
9395
+ SLASH,
9396
+ path.charCodeAt(end) === SLASH_CODE ? end - 1 : end
9397
+ );
9398
+ return cut < 0 ? EMPTY2 : path.slice(0, cut + 1);
9085
9399
  };
9086
- var makeRegexPrefix = (pattern) => REPLACERS.reduce(
9087
- (prev, [matcher, replacer]) => prev.replace(matcher, replacer.bind(pattern)),
9088
- pattern
9089
- );
9090
9400
  var isString2 = (subject) => typeof subject === "string";
9091
- var checkPattern = (pattern) => pattern && isString2(pattern) && !REGEX_TEST_BLANK_LINE.test(pattern) && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern) && pattern.indexOf("#") !== 0;
9401
+ var checkPattern = (pattern) => pattern && isString2(pattern) && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern);
9092
9402
  var splitPattern = (pattern) => pattern.split(REGEX_SPLITALL_CRLF).filter(Boolean);
9093
9403
  var IgnoreRule = class {
9094
9404
  constructor(pattern, mark, body, ignoreCase, negative, prefix) {
@@ -9099,6 +9409,14 @@ var require_ignore = __commonJS({
9099
9409
  define(this, "ignoreCase", ignoreCase);
9100
9410
  define(this, "regexPrefix", prefix);
9101
9411
  }
9412
+ // Worked out on first use and kept behind an own property, the way `regex`
9413
+ // caches itself in `_regex`. Deciding it in the constructor instead would
9414
+ // add a fourth `defineProperty` to every rule ever built, which cost 4% of
9415
+ // every compile -- including the compiles of rules that are never matched
9416
+ // against anything.
9417
+ get _basenameOnly() {
9418
+ return define(this, "_basenameOnly", matchesBasename(this.body));
9419
+ }
9102
9420
  get regex() {
9103
9421
  const key = UNDERSCORE + MODE_IGNORE;
9104
9422
  if (this[key]) {
@@ -9114,24 +9432,51 @@ var require_ignore = __commonJS({
9114
9432
  return this._make(MODE_CHECK_IGNORE, key);
9115
9433
  }
9116
9434
  _make(mode, key) {
9117
- const str = this.regexPrefix.replace(
9118
- REGEX_REPLACE_TRAILING_WILDCARD,
9119
- // It does not need to bind pattern
9120
- TRAILING_WILD_CARD_REPLACERS[mode]
9435
+ const str = pinWildcards(
9436
+ mode === MODE_IGNORE ? this.regexPrefix.replace(REGEX_REPLACE_TRAILING_WILDCARD, replaceTrailingWildcard).replace(REGEX_REPLACE_TRAILING_DOUBLESTAR, replaceTrailingDoublestar) : checkSourceOf(this.body, this.regexPrefix)
9121
9437
  );
9122
9438
  const regex = this.ignoreCase ? new RegExp(str, "i") : new RegExp(str);
9123
9439
  return define(this, key, regex);
9124
9440
  }
9125
9441
  };
9442
+ var isLineEnd = (char) => char === "\r" || char === "\n";
9443
+ var trimEnd4 = (body) => {
9444
+ let end = body.length;
9445
+ while (end && isLineEnd(body[end - 1])) {
9446
+ end--;
9447
+ }
9448
+ const lineEnd = end;
9449
+ while (end && body[end - 1] === SPACE) {
9450
+ end--;
9451
+ }
9452
+ if (end === lineEnd) {
9453
+ return body.slice(0, end);
9454
+ }
9455
+ let backslashes = 0;
9456
+ while (backslashes < end && body[end - backslashes - 1] === ESCAPE) {
9457
+ backslashes++;
9458
+ }
9459
+ return backslashes % 2 ? body.slice(0, end - 1) + SPACE : body.slice(0, end);
9460
+ };
9126
9461
  var createRule = ({
9127
9462
  pattern,
9128
9463
  mark
9129
9464
  }, ignoreCase) => {
9465
+ let body = pattern[0] === BOM ? pattern.slice(1) : pattern;
9466
+ if (body[0] === "#") {
9467
+ return;
9468
+ }
9130
9469
  let negative = false;
9131
- let body = pattern;
9132
- if (body.indexOf("!") === 0) {
9470
+ if (body[0] === "!") {
9133
9471
  negative = true;
9134
- body = body.substr(1);
9472
+ body = body.slice(1);
9473
+ }
9474
+ const last = body[body.length - 1];
9475
+ if (last === SPACE || last === "\r" || last === "\n") {
9476
+ body = trimEnd4(body);
9477
+ }
9478
+ if (!body) {
9479
+ return;
9135
9480
  }
9136
9481
  body = body.replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, "!").replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, "#");
9137
9482
  const regexPrefix = makeRegexPrefix(body);
@@ -9148,10 +9493,12 @@ var require_ignore = __commonJS({
9148
9493
  constructor(ignoreCase) {
9149
9494
  this._ignoreCase = ignoreCase;
9150
9495
  this._rules = [];
9496
+ this._basenameCount = 0;
9151
9497
  }
9152
9498
  _add(pattern) {
9153
9499
  if (pattern && pattern[KEY_IGNORE]) {
9154
9500
  this._rules = this._rules.concat(pattern._rules._rules);
9501
+ this._basenameCount += pattern._rules._basenameCount;
9155
9502
  this._added = true;
9156
9503
  return;
9157
9504
  }
@@ -9160,10 +9507,13 @@ var require_ignore = __commonJS({
9160
9507
  pattern
9161
9508
  };
9162
9509
  }
9163
- if (checkPattern(pattern.pattern)) {
9164
- const rule = createRule(pattern, this._ignoreCase);
9510
+ const rule = checkPattern(pattern.pattern) && createRule(pattern, this._ignoreCase);
9511
+ if (rule) {
9165
9512
  this._added = true;
9166
9513
  this._rules.push(rule);
9514
+ if (matchesBasename(rule.body)) {
9515
+ this._basenameCount++;
9516
+ }
9167
9517
  }
9168
9518
  }
9169
9519
  // @param {Array<string> | string | Ignore} pattern
@@ -9172,8 +9522,39 @@ var require_ignore = __commonJS({
9172
9522
  makeArray(
9173
9523
  isString2(pattern) ? splitPattern(pattern) : pattern
9174
9524
  ).forEach(this._add, this);
9525
+ if (this._added) {
9526
+ this._literalRules = UNDEFINED;
9527
+ }
9175
9528
  return this._added;
9176
9529
  }
9530
+ // Match the literal 'abc/' for `checkIgnore`, last rule wins. Only a rule
9531
+ // ending in a wildcard can match it (see `checkSourceOf`), so the rest
9532
+ // are left out once, rather than tested or compiled for every path.
9533
+ testLiteral(path) {
9534
+ const rules = this._literalRules || (this._literalRules = this._rules.filter(
9535
+ ({ body }) => body[body.length - (body[body.length - 1] === SLASH ? 2 : 1)] === "*"
9536
+ ));
9537
+ let ignored = false;
9538
+ let unignored = false;
9539
+ let matchedRule;
9540
+ for (let index = rules.length - 1; index >= 0; index--) {
9541
+ const rule = rules[index];
9542
+ if (rule.checkRegex.test(path)) {
9543
+ ignored = !rule.negative;
9544
+ unignored = rule.negative;
9545
+ matchedRule = rule.negative ? UNDEFINED : rule;
9546
+ break;
9547
+ }
9548
+ }
9549
+ const ret = {
9550
+ ignored,
9551
+ unignored
9552
+ };
9553
+ if (matchedRule) {
9554
+ ret.rule = matchedRule;
9555
+ }
9556
+ return ret;
9557
+ }
9177
9558
  // Test one single path without recursively checking parent directories
9178
9559
  //
9179
9560
  // - checkUnignored `boolean` whether should check if the path is unignored,
@@ -9185,19 +9566,22 @@ var require_ignore = __commonJS({
9185
9566
  let ignored = false;
9186
9567
  let unignored = false;
9187
9568
  let matchedRule;
9188
- this._rules.forEach((rule) => {
9569
+ const rules = this._rules;
9570
+ const { length } = rules;
9571
+ const shortcut = this._basenameCount * 2 >= length;
9572
+ const basename5 = shortcut ? basenameOf(path) : path;
9573
+ for (let index = 0; index < length; index++) {
9574
+ const rule = rules[index];
9189
9575
  const { negative } = rule;
9190
- if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
9191
- return;
9192
- }
9193
- const matched = rule[mode].test(path);
9194
- if (!matched) {
9195
- return;
9576
+ const skip = unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored;
9577
+ if (!skip && rule[mode].test(
9578
+ shortcut && rule._basenameOnly ? basename5 : path
9579
+ )) {
9580
+ ignored = !negative;
9581
+ unignored = negative;
9582
+ matchedRule = negative ? UNDEFINED : rule;
9196
9583
  }
9197
- ignored = !negative;
9198
- unignored = negative;
9199
- matchedRule = negative ? UNDEFINED : rule;
9200
- });
9584
+ }
9201
9585
  const ret = {
9202
9586
  ignored,
9203
9587
  unignored
@@ -9230,7 +9614,26 @@ var require_ignore = __commonJS({
9230
9614
  }
9231
9615
  return true;
9232
9616
  };
9233
- var isNotRelative = (path) => REGEX_TEST_INVALID_PATH.test(path);
9617
+ var isNotRelative = (path) => {
9618
+ const first = path.charCodeAt(0);
9619
+ if (first === SLASH_CODE) {
9620
+ return true;
9621
+ }
9622
+ if (first !== DOT_CODE) {
9623
+ return false;
9624
+ }
9625
+ if (path.length === 1) {
9626
+ return true;
9627
+ }
9628
+ const second = path.charCodeAt(1);
9629
+ if (second === SLASH_CODE) {
9630
+ return true;
9631
+ }
9632
+ if (second !== DOT_CODE) {
9633
+ return false;
9634
+ }
9635
+ return path.length === 2 || path.charCodeAt(2) === SLASH_CODE;
9636
+ };
9234
9637
  checkPath.isNotRelative = isNotRelative;
9235
9638
  checkPath.convert = (p) => p;
9236
9639
  var Ignore = class {
@@ -9259,52 +9662,33 @@ var require_ignore = __commonJS({
9259
9662
  return this.add(pattern);
9260
9663
  }
9261
9664
  // @returns {TestResult}
9262
- _test(originalPath, cache, checkUnignored, slices) {
9665
+ _test(originalPath, cache, checkUnignored) {
9263
9666
  const path = originalPath && checkPath.convert(originalPath);
9264
9667
  checkPath(
9265
9668
  path,
9266
9669
  originalPath,
9267
9670
  this._strictPathCheck ? throwError : RETURN_FALSE
9268
9671
  );
9269
- return this._t(path, cache, checkUnignored, slices);
9672
+ return this._t(path, cache, checkUnignored);
9270
9673
  }
9271
9674
  checkIgnore(path) {
9272
- if (!REGEX_TEST_TRAILING_SLASH.test(path)) {
9675
+ if (path.charCodeAt(path.length - 1) !== SLASH_CODE) {
9273
9676
  return this.test(path);
9274
9677
  }
9275
- const slices = path.split(SLASH).filter(Boolean);
9276
- slices.pop();
9277
- if (slices.length) {
9278
- const parent = this._t(
9279
- slices.join(SLASH) + SLASH,
9280
- this._testCache,
9281
- true,
9282
- slices
9283
- );
9284
- if (parent.ignored) {
9285
- return parent;
9286
- }
9678
+ const dir = this._t(path, this._testCache, true);
9679
+ if (dir.ignored) {
9680
+ return dir;
9287
9681
  }
9288
- return this._rules.test(path, false, MODE_CHECK_IGNORE);
9682
+ const literal3 = this._rules.testLiteral(path);
9683
+ return literal3.ignored || literal3.unignored ? literal3 : dir;
9289
9684
  }
9290
- _t(path, cache, checkUnignored, slices) {
9685
+ _t(path, cache, checkUnignored) {
9291
9686
  if (path in cache) {
9292
9687
  return cache[path];
9293
9688
  }
9294
- if (!slices) {
9295
- slices = path.split(SLASH).filter(Boolean);
9296
- }
9297
- slices.pop();
9298
- if (!slices.length) {
9299
- return cache[path] = this._rules.test(path, checkUnignored, MODE_IGNORE);
9300
- }
9301
- const parent = this._t(
9302
- slices.join(SLASH) + SLASH,
9303
- cache,
9304
- checkUnignored,
9305
- slices
9306
- );
9307
- return cache[path] = parent.ignored ? parent : this._rules.test(path, checkUnignored, MODE_IGNORE);
9689
+ const parentPath = parentOf(path);
9690
+ const parent = parentPath ? this._t(parentPath, cache, checkUnignored) : UNDEFINED;
9691
+ return cache[path] = parent && parent.ignored ? parent : this._rules.test(path, checkUnignored, MODE_IGNORE);
9308
9692
  }
9309
9693
  ignores(path) {
9310
9694
  return this._test(path, this._ignoreCache, false).ignored;
@@ -31614,16 +31998,12 @@ function assertEnum(value, path) {
31614
31998
  }
31615
31999
  function assertGlobal(value, path) {
31616
32000
  const global = record(value, path);
31617
- exactKeys(global, path, [
31618
- "id",
31619
- "state",
31620
- "source",
31621
- "name",
31622
- "type",
31623
- "annotations",
31624
- "initializer",
31625
- "initializerSource"
31626
- ]);
32001
+ exactKeysWithOptional(
32002
+ global,
32003
+ path,
32004
+ ["id", "state", "source", "name", "type", "annotations", "initializer"],
32005
+ ["initializerSource"]
32006
+ );
31627
32007
  assertIdentity(global, path);
31628
32008
  if (global.initializerSource !== void 0)
31629
32009
  assertLocation(global.initializerSource, `${path}.initializerSource`);
@@ -31937,7 +32317,7 @@ var init_registry = __esm({
31937
32317
  "../packages/manifest/schema-contract/registry.mjs"() {
31938
32318
  "use strict";
31939
32319
  PROJECT_SCHEMA_CONTRACT = Object.freeze({
31940
- cliVersion: "0.70.3",
32320
+ cliVersion: "0.70.5",
31941
32321
  projectFileUploadBatchSize: 32,
31942
32322
  documentRecords: {
31943
32323
  member: {
@@ -34972,19 +35352,8 @@ function _addIssue(context, label, dataset, config$1, other) {
34972
35352
  else dataset.issues = [issue];
34973
35353
  }
34974
35354
  // @__NO_SIDE_EFFECTS__
34975
- function _getStandardProps(context) {
34976
- let cached = _standardCache.get(context);
34977
- if (!cached) {
34978
- cached = {
34979
- version: 1,
34980
- vendor: "valibot",
34981
- validate(value$1) {
34982
- return context["~run"]({ value: value$1 }, /* @__PURE__ */ getGlobalConfig());
34983
- }
34984
- };
34985
- _standardCache.set(context, cached);
34986
- }
34987
- return cached;
35355
+ function _isSameValueZero(value1, value2) {
35356
+ return value1 === value2 || Number.isNaN(value1) && Number.isNaN(value2);
34988
35357
  }
34989
35358
  // @__NO_SIDE_EFFECTS__
34990
35359
  function _isValidObjectKey(object$1, key) {
@@ -34996,6 +35365,14 @@ function _joinExpects(values$1, separator) {
34996
35365
  if (list.length > 1) return `(${list.join(` ${separator} `)})`;
34997
35366
  return list[0] ?? "never";
34998
35367
  }
35368
+ function _standardSchema(schema) {
35369
+ schema["~standard"] = {
35370
+ version: 1,
35371
+ vendor: "valibot",
35372
+ validate: (value$1) => schema["~run"]({ value: value$1 }, /* @__PURE__ */ getGlobalConfig())
35373
+ };
35374
+ return schema;
35375
+ }
34999
35376
  // @__NO_SIDE_EFFECTS__
35000
35377
  function check(requirement, message$1) {
35001
35378
  return {
@@ -35181,7 +35558,7 @@ function getDefault(schema, dataset, config$1) {
35181
35558
  }
35182
35559
  // @__NO_SIDE_EFFECTS__
35183
35560
  function array2(item, message$1) {
35184
- return {
35561
+ return _standardSchema({
35185
35562
  kind: "schema",
35186
35563
  type: "array",
35187
35564
  reference: array2,
@@ -35189,9 +35566,6 @@ function array2(item, message$1) {
35189
35566
  async: false,
35190
35567
  item,
35191
35568
  message: message$1,
35192
- get "~standard"() {
35193
- return /* @__PURE__ */ _getStandardProps(this);
35194
- },
35195
35569
  "~run"(dataset, config$1) {
35196
35570
  const input = dataset.value;
35197
35571
  if (Array.isArray(input)) {
@@ -35225,30 +35599,27 @@ function array2(item, message$1) {
35225
35599
  } else _addIssue(this, "type", dataset, config$1);
35226
35600
  return dataset;
35227
35601
  }
35228
- };
35602
+ });
35229
35603
  }
35230
35604
  // @__NO_SIDE_EFFECTS__
35231
35605
  function boolean(message$1) {
35232
- return {
35606
+ return _standardSchema({
35233
35607
  kind: "schema",
35234
35608
  type: "boolean",
35235
35609
  reference: boolean,
35236
35610
  expects: "boolean",
35237
35611
  async: false,
35238
35612
  message: message$1,
35239
- get "~standard"() {
35240
- return /* @__PURE__ */ _getStandardProps(this);
35241
- },
35242
35613
  "~run"(dataset, config$1) {
35243
35614
  if (typeof dataset.value === "boolean") dataset.typed = true;
35244
35615
  else _addIssue(this, "type", dataset, config$1);
35245
35616
  return dataset;
35246
35617
  }
35247
- };
35618
+ });
35248
35619
  }
35249
35620
  // @__NO_SIDE_EFFECTS__
35250
35621
  function custom(check$1, message$1) {
35251
- return {
35622
+ return _standardSchema({
35252
35623
  kind: "schema",
35253
35624
  type: "custom",
35254
35625
  reference: custom,
@@ -35256,19 +35627,16 @@ function custom(check$1, message$1) {
35256
35627
  async: false,
35257
35628
  check: check$1,
35258
35629
  message: message$1,
35259
- get "~standard"() {
35260
- return /* @__PURE__ */ _getStandardProps(this);
35261
- },
35262
35630
  "~run"(dataset, config$1) {
35263
35631
  if (this.check(dataset.value)) dataset.typed = true;
35264
35632
  else _addIssue(this, "type", dataset, config$1);
35265
35633
  return dataset;
35266
35634
  }
35267
- };
35635
+ });
35268
35636
  }
35269
35637
  // @__NO_SIDE_EFFECTS__
35270
35638
  function exactOptional(wrapped, default_) {
35271
- return {
35639
+ return _standardSchema({
35272
35640
  kind: "schema",
35273
35641
  type: "exact_optional",
35274
35642
  reference: exactOptional,
@@ -35276,34 +35644,28 @@ function exactOptional(wrapped, default_) {
35276
35644
  async: false,
35277
35645
  wrapped,
35278
35646
  default: default_,
35279
- get "~standard"() {
35280
- return /* @__PURE__ */ _getStandardProps(this);
35281
- },
35282
35647
  "~run"(dataset, config$1) {
35283
35648
  return this.wrapped["~run"](dataset, config$1);
35284
35649
  }
35285
- };
35650
+ });
35286
35651
  }
35287
35652
  // @__NO_SIDE_EFFECTS__
35288
35653
  function lazy(getter) {
35289
- return {
35654
+ return _standardSchema({
35290
35655
  kind: "schema",
35291
35656
  type: "lazy",
35292
35657
  reference: lazy,
35293
35658
  expects: "unknown",
35294
35659
  async: false,
35295
35660
  getter,
35296
- get "~standard"() {
35297
- return /* @__PURE__ */ _getStandardProps(this);
35298
- },
35299
35661
  "~run"(dataset, config$1) {
35300
35662
  return this.getter(dataset.value)["~run"](dataset, config$1);
35301
35663
  }
35302
- };
35664
+ });
35303
35665
  }
35304
35666
  // @__NO_SIDE_EFFECTS__
35305
35667
  function literal2(literal_, message$1) {
35306
- return {
35668
+ return _standardSchema({
35307
35669
  kind: "schema",
35308
35670
  type: "literal",
35309
35671
  reference: literal2,
@@ -35311,37 +35673,31 @@ function literal2(literal_, message$1) {
35311
35673
  async: false,
35312
35674
  literal: literal_,
35313
35675
  message: message$1,
35314
- get "~standard"() {
35315
- return /* @__PURE__ */ _getStandardProps(this);
35316
- },
35317
35676
  "~run"(dataset, config$1) {
35318
- if (dataset.value === this.literal) dataset.typed = true;
35677
+ if (/* @__PURE__ */ _isSameValueZero(dataset.value, this.literal)) dataset.typed = true;
35319
35678
  else _addIssue(this, "type", dataset, config$1);
35320
35679
  return dataset;
35321
35680
  }
35322
- };
35681
+ });
35323
35682
  }
35324
35683
  // @__NO_SIDE_EFFECTS__
35325
35684
  function never(message$1) {
35326
- return {
35685
+ return _standardSchema({
35327
35686
  kind: "schema",
35328
35687
  type: "never",
35329
35688
  reference: never,
35330
35689
  expects: "never",
35331
35690
  async: false,
35332
35691
  message: message$1,
35333
- get "~standard"() {
35334
- return /* @__PURE__ */ _getStandardProps(this);
35335
- },
35336
35692
  "~run"(dataset, config$1) {
35337
35693
  _addIssue(this, "type", dataset, config$1);
35338
35694
  return dataset;
35339
35695
  }
35340
- };
35696
+ });
35341
35697
  }
35342
35698
  // @__NO_SIDE_EFFECTS__
35343
35699
  function nullable(wrapped, default_) {
35344
- return {
35700
+ return _standardSchema({
35345
35701
  kind: "schema",
35346
35702
  type: "nullable",
35347
35703
  reference: nullable,
@@ -35349,9 +35705,6 @@ function nullable(wrapped, default_) {
35349
35705
  async: false,
35350
35706
  wrapped,
35351
35707
  default: default_,
35352
- get "~standard"() {
35353
- return /* @__PURE__ */ _getStandardProps(this);
35354
- },
35355
35708
  "~run"(dataset, config$1) {
35356
35709
  if (dataset.value === null) {
35357
35710
  if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
@@ -35362,30 +35715,27 @@ function nullable(wrapped, default_) {
35362
35715
  }
35363
35716
  return this.wrapped["~run"](dataset, config$1);
35364
35717
  }
35365
- };
35718
+ });
35366
35719
  }
35367
35720
  // @__NO_SIDE_EFFECTS__
35368
35721
  function number(message$1) {
35369
- return {
35722
+ return _standardSchema({
35370
35723
  kind: "schema",
35371
35724
  type: "number",
35372
35725
  reference: number,
35373
35726
  expects: "number",
35374
35727
  async: false,
35375
35728
  message: message$1,
35376
- get "~standard"() {
35377
- return /* @__PURE__ */ _getStandardProps(this);
35378
- },
35379
35729
  "~run"(dataset, config$1) {
35380
35730
  if (typeof dataset.value === "number" && !isNaN(dataset.value)) dataset.typed = true;
35381
35731
  else _addIssue(this, "type", dataset, config$1);
35382
35732
  return dataset;
35383
35733
  }
35384
- };
35734
+ });
35385
35735
  }
35386
35736
  // @__NO_SIDE_EFFECTS__
35387
35737
  function optional(wrapped, default_) {
35388
- return {
35738
+ return _standardSchema({
35389
35739
  kind: "schema",
35390
35740
  type: "optional",
35391
35741
  reference: optional,
@@ -35393,9 +35743,6 @@ function optional(wrapped, default_) {
35393
35743
  async: false,
35394
35744
  wrapped,
35395
35745
  default: default_,
35396
- get "~standard"() {
35397
- return /* @__PURE__ */ _getStandardProps(this);
35398
- },
35399
35746
  "~run"(dataset, config$1) {
35400
35747
  if (dataset.value === void 0) {
35401
35748
  if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
@@ -35406,11 +35753,11 @@ function optional(wrapped, default_) {
35406
35753
  }
35407
35754
  return this.wrapped["~run"](dataset, config$1);
35408
35755
  }
35409
- };
35756
+ });
35410
35757
  }
35411
35758
  // @__NO_SIDE_EFFECTS__
35412
35759
  function picklist(options, message$1) {
35413
- return {
35760
+ return _standardSchema({
35414
35761
  kind: "schema",
35415
35762
  type: "picklist",
35416
35763
  reference: picklist,
@@ -35418,19 +35765,16 @@ function picklist(options, message$1) {
35418
35765
  async: false,
35419
35766
  options,
35420
35767
  message: message$1,
35421
- get "~standard"() {
35422
- return /* @__PURE__ */ _getStandardProps(this);
35423
- },
35424
35768
  "~run"(dataset, config$1) {
35425
35769
  if (this.options.includes(dataset.value)) dataset.typed = true;
35426
35770
  else _addIssue(this, "type", dataset, config$1);
35427
35771
  return dataset;
35428
35772
  }
35429
- };
35773
+ });
35430
35774
  }
35431
35775
  // @__NO_SIDE_EFFECTS__
35432
35776
  function record2(key, value$1, message$1) {
35433
- return {
35777
+ return _standardSchema({
35434
35778
  kind: "schema",
35435
35779
  type: "record",
35436
35780
  reference: record2,
@@ -35439,9 +35783,6 @@ function record2(key, value$1, message$1) {
35439
35783
  key,
35440
35784
  value: value$1,
35441
35785
  message: message$1,
35442
- get "~standard"() {
35443
- return /* @__PURE__ */ _getStandardProps(this);
35444
- },
35445
35786
  "~run"(dataset, config$1) {
35446
35787
  const input = dataset.value;
35447
35788
  if (input && typeof input === "object") {
@@ -35494,11 +35835,11 @@ function record2(key, value$1, message$1) {
35494
35835
  } else _addIssue(this, "type", dataset, config$1);
35495
35836
  return dataset;
35496
35837
  }
35497
- };
35838
+ });
35498
35839
  }
35499
35840
  // @__NO_SIDE_EFFECTS__
35500
35841
  function strictObject(entries$1, message$1) {
35501
- return {
35842
+ return _standardSchema({
35502
35843
  kind: "schema",
35503
35844
  type: "strict_object",
35504
35845
  reference: strictObject,
@@ -35506,9 +35847,6 @@ function strictObject(entries$1, message$1) {
35506
35847
  async: false,
35507
35848
  entries: entries$1,
35508
35849
  message: message$1,
35509
- get "~standard"() {
35510
- return /* @__PURE__ */ _getStandardProps(this);
35511
- },
35512
35850
  "~run"(dataset, config$1) {
35513
35851
  const input = dataset.value;
35514
35852
  if (input && typeof input === "object") {
@@ -35557,7 +35895,7 @@ function strictObject(entries$1, message$1) {
35557
35895
  }
35558
35896
  }
35559
35897
  if (!dataset.issues || !config$1.abortEarly) {
35560
- for (const key in input) if (!(key in this.entries)) {
35898
+ for (const key in input) if (!Object.prototype.hasOwnProperty.call(this.entries, key)) {
35561
35899
  _addIssue(this, "key", dataset, config$1, {
35562
35900
  input: key,
35563
35901
  expected: "never",
@@ -35575,26 +35913,23 @@ function strictObject(entries$1, message$1) {
35575
35913
  } else _addIssue(this, "type", dataset, config$1);
35576
35914
  return dataset;
35577
35915
  }
35578
- };
35916
+ });
35579
35917
  }
35580
35918
  // @__NO_SIDE_EFFECTS__
35581
35919
  function string2(message$1) {
35582
- return {
35920
+ return _standardSchema({
35583
35921
  kind: "schema",
35584
35922
  type: "string",
35585
35923
  reference: string2,
35586
35924
  expects: "string",
35587
35925
  async: false,
35588
35926
  message: message$1,
35589
- get "~standard"() {
35590
- return /* @__PURE__ */ _getStandardProps(this);
35591
- },
35592
35927
  "~run"(dataset, config$1) {
35593
35928
  if (typeof dataset.value === "string") dataset.typed = true;
35594
35929
  else _addIssue(this, "type", dataset, config$1);
35595
35930
  return dataset;
35596
35931
  }
35597
- };
35932
+ });
35598
35933
  }
35599
35934
  // @__NO_SIDE_EFFECTS__
35600
35935
  function _subIssues(datasets) {
@@ -35605,7 +35940,7 @@ function _subIssues(datasets) {
35605
35940
  }
35606
35941
  // @__NO_SIDE_EFFECTS__
35607
35942
  function union(options, message$1) {
35608
- return {
35943
+ return _standardSchema({
35609
35944
  kind: "schema",
35610
35945
  type: "union",
35611
35946
  reference: union,
@@ -35613,9 +35948,6 @@ function union(options, message$1) {
35613
35948
  async: false,
35614
35949
  options,
35615
35950
  message: message$1,
35616
- get "~standard"() {
35617
- return /* @__PURE__ */ _getStandardProps(this);
35618
- },
35619
35951
  "~run"(dataset, config$1) {
35620
35952
  let validDataset;
35621
35953
  let typedDatasets;
@@ -35640,11 +35972,11 @@ function union(options, message$1) {
35640
35972
  else _addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(untypedDatasets) });
35641
35973
  return dataset;
35642
35974
  }
35643
- };
35975
+ });
35644
35976
  }
35645
35977
  // @__NO_SIDE_EFFECTS__
35646
35978
  function variant(key, options, message$1) {
35647
- return {
35979
+ return _standardSchema({
35648
35980
  kind: "schema",
35649
35981
  type: "variant",
35650
35982
  reference: variant,
@@ -35653,9 +35985,6 @@ function variant(key, options, message$1) {
35653
35985
  key,
35654
35986
  options,
35655
35987
  message: message$1,
35656
- get "~standard"() {
35657
- return /* @__PURE__ */ _getStandardProps(this);
35658
- },
35659
35988
  "~run"(dataset, config$1) {
35660
35989
  const input = dataset.value;
35661
35990
  if (input && typeof input === "object") {
@@ -35710,7 +36039,7 @@ function variant(key, options, message$1) {
35710
36039
  } else _addIssue(this, "type", dataset, config$1);
35711
36040
  return dataset;
35712
36041
  }
35713
- };
36042
+ });
35714
36043
  }
35715
36044
  function parse(schema, input, config$1) {
35716
36045
  const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config$1));
@@ -35719,12 +36048,9 @@ function parse(schema, input, config$1) {
35719
36048
  }
35720
36049
  // @__NO_SIDE_EFFECTS__
35721
36050
  function pipe(...pipe$1) {
35722
- return {
36051
+ return _standardSchema({
35723
36052
  ...pipe$1[0],
35724
36053
  pipe: pipe$1,
35725
- get "~standard"() {
35726
- return /* @__PURE__ */ _getStandardProps(this);
35727
- },
35728
36054
  "~run"(dataset, config$1) {
35729
36055
  for (const item of pipe$1) if (item.kind !== "metadata") {
35730
36056
  if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
@@ -35735,7 +36061,7 @@ function pipe(...pipe$1) {
35735
36061
  }
35736
36062
  return dataset;
35737
36063
  }
35738
- };
36064
+ });
35739
36065
  }
35740
36066
  // @__NO_SIDE_EFFECTS__
35741
36067
  function safeParse(schema, input, config$1) {
@@ -35747,7 +36073,7 @@ function safeParse(schema, input, config$1) {
35747
36073
  issues: dataset.issues
35748
36074
  };
35749
36075
  }
35750
- var store$4, DEFAULT_CONFIG, store$3, store$2, store$1, _standardCache, ValiError, EMOJI_REGEX, ABORT_EARLY_CONFIG;
36076
+ var store$4, DEFAULT_CONFIG, store$3, store$2, store$1, ValiError, EMOJI_REGEX, ABORT_EARLY_CONFIG;
35751
36077
  var init_dist = __esm({
35752
36078
  "node_modules/valibot/dist/index.mjs"() {
35753
36079
  DEFAULT_CONFIG = {
@@ -35756,7 +36082,6 @@ var init_dist = __esm({
35756
36082
  abortEarly: void 0,
35757
36083
  abortPipeEarly: void 0
35758
36084
  };
35759
- _standardCache = /* @__PURE__ */ new WeakMap();
35760
36085
  ValiError = class extends Error {
35761
36086
  /**
35762
36087
  * Creates a Valibot error with useful information.
@@ -112869,6 +113194,22 @@ function createGenerationContext(exportData, diagnostics, docs = EMPTY_UNITY_COD
112869
113194
  `${exportData.project.name}Neo`,
112870
113195
  "NeoProject"
112871
113196
  );
113197
+ const enums = Object.values(exportData.enums);
113198
+ const enumNames = buildEnumNameMap(enums, diagnostics);
113199
+ const typeNames = buildNameMap(
113200
+ Object.values(exportData.classes),
113201
+ "Type",
113202
+ diagnostics
113203
+ );
113204
+ const interfaceNames = buildNameMap(
113205
+ Object.values(exportData.interfaces),
113206
+ "Interface",
113207
+ diagnostics
113208
+ );
113209
+ const dialogueGroupClassNames = buildDialogueGroupClassNameMap(
113210
+ dialogueGroups,
113211
+ diagnostics
113212
+ );
112872
113213
  return {
112873
113214
  exportData,
112874
113215
  docs,
@@ -112876,22 +113217,23 @@ function createGenerationContext(exportData, diagnostics, docs = EMPTY_UNITY_COD
112876
113217
  classes: Object.values(exportData.classes),
112877
113218
  interfaces: Object.values(exportData.interfaces),
112878
113219
  diagnostics,
112879
- enumNames: buildEnumNameMap(Object.values(exportData.enums), diagnostics),
112880
- enumOptionFieldNames: /* @__PURE__ */ new Map(),
112881
- typeNames: buildNameMap(
112882
- Object.values(exportData.classes),
112883
- "Type",
112884
- diagnostics
112885
- ),
112886
- interfaceNames: buildNameMap(
112887
- Object.values(exportData.interfaces),
112888
- "Interface",
112889
- diagnostics
112890
- ),
112891
- dialogueGroupClassNames: buildDialogueGroupClassNameMap(
112892
- dialogueGroups,
113220
+ enumNames,
113221
+ enumOptionsNames: buildEnumOptionsNameMap(
113222
+ enums,
113223
+ enumNames,
113224
+ [
113225
+ projectClassName,
113226
+ ...enumNames.values(),
113227
+ ...typeNames.values(),
113228
+ ...interfaceNames.values(),
113229
+ ...dialogueGroupClassNames.values()
113230
+ ],
112893
113231
  diagnostics
112894
113232
  ),
113233
+ enumOptionFieldNames: /* @__PURE__ */ new Map(),
113234
+ typeNames,
113235
+ interfaceNames,
113236
+ dialogueGroupClassNames,
112895
113237
  dialogueGroupPropertyNames: buildDialogueGroupPropertyNameMap(
112896
113238
  dialogueGroups,
112897
113239
  diagnostics
@@ -112972,6 +113314,29 @@ function buildEnumNameMap(enums, diagnostics) {
112972
113314
  }
112973
113315
  return names;
112974
113316
  }
113317
+ function buildEnumOptionsNameMap(enums, enumNames, typeNames, diagnostics) {
113318
+ const taken = new Set(typeNames);
113319
+ const names = /* @__PURE__ */ new Map();
113320
+ for (const enumDef of enums) {
113321
+ const enumName = enumNames.get(enumDef.id);
113322
+ if (enumName === void 0) continue;
113323
+ const baseName = `${enumName}Options`;
113324
+ if (sdkRuntimeEnumBinding(enumDef.id) !== void 0 || !taken.has(baseName)) {
113325
+ taken.add(baseName);
113326
+ names.set(enumDef.id, baseName);
113327
+ continue;
113328
+ }
113329
+ const uniqueName = `${baseName}_${shortId(enumDef.id)}`;
113330
+ diagnostics.push({
113331
+ severity: "warning",
113332
+ message: `Generated C# options class "${baseName}" for enum "${enumDef.name}" collides with another generated type; using "${uniqueName}".`,
113333
+ path: `enums.${enumDef.id}.name`
113334
+ });
113335
+ taken.add(uniqueName);
113336
+ names.set(enumDef.id, uniqueName);
113337
+ }
113338
+ return names;
113339
+ }
112975
113340
  function buildDialogueGroupClassNameMap(groups, diagnostics) {
112976
113341
  const baseNames = buildNameMap(groups, "DialogueGroup", diagnostics);
112977
113342
  const used = /* @__PURE__ */ new Map();
@@ -146676,8 +147041,13 @@ function staticDelegate(target, parameters) {
146676
147041
  const list = parameters.join(", ");
146677
147042
  return `static (${list}) => ${target}(${list})`;
146678
147043
  }
146679
- function enumParser(enumName) {
146680
- return staticDelegate(`${enumName}.FromOptionId`, ["factoryOptionId"]);
147044
+ function enumOptionsName(ctx, enumId) {
147045
+ return ctx.enumOptionsNames.get(enumId) ?? "NeoEnumOptions";
147046
+ }
147047
+ function enumParser(ctx, enumId) {
147048
+ return staticDelegate(`${enumOptionsName(ctx, enumId)}.FromOptionId`, [
147049
+ "factoryOptionId"
147050
+ ]);
146681
147051
  }
146682
147052
  function immediateInvocationArguments(receiver, argumentNames) {
146683
147053
  const values = argumentNames.length === 1 ? [`(object?)(${argumentNames[0]})`] : argumentNames.length <= 4 ? argumentNames : [`new object?[] { ${argumentNames.join(", ")} }`];
@@ -146691,10 +147061,7 @@ function enumOptionFieldName(ctx, enumId, optionId) {
146691
147061
  const enumDef = ctx.exportData.enums[enumId];
146692
147062
  if (enumDef !== void 0) {
146693
147063
  const enumName = ctx.enumNames.get(enumId) ?? toCSharpTypeName(enumDef.name, "NeoEnum");
146694
- const taken = /* @__PURE__ */ new Set([
146695
- enumName,
146696
- ...GENERATED_ENUM_CLASS_MEMBER_NAMES
146697
- ]);
147064
+ const taken = /* @__PURE__ */ new Set(["value__"]);
146698
147065
  for (const key of getEnumOptionKeyOrder(enumDef)) {
146699
147066
  const option = enumDef.options[key];
146700
147067
  if (option === void 0) continue;
@@ -146707,7 +147074,7 @@ function enumOptionFieldName(ctx, enumId, optionId) {
146707
147074
  unique = `${preferred}_${ordinal}`;
146708
147075
  ctx.diagnostics.push({
146709
147076
  severity: "warning",
146710
- message: `Enum option "${option.name}" collides with a member the generated C# enum class "${enumName}" declares; using "${unique}".`,
147077
+ message: `Enum option "${option.name}" collides with another member of the generated C# enum "${enumName}"; using "${unique}".`,
146711
147078
  path: `enums.${enumId}.options.${key}`
146712
147079
  });
146713
147080
  }
@@ -146718,118 +147085,141 @@ function enumOptionFieldName(ctx, enumId, optionId) {
146718
147085
  }
146719
147086
  return names.get(optionId) ?? null;
146720
147087
  }
147088
+ function enumMemberValue(optionId) {
147089
+ let hash = 2166136261;
147090
+ for (let index = 0; index < optionId.length; index++) {
147091
+ hash = Math.imul(hash ^ optionId.charCodeAt(index), 16777619);
147092
+ }
147093
+ return (hash >>> 0) % 2147483647 + 1;
147094
+ }
146721
147095
  function generateEnumClass(ctx, enumId) {
146722
147096
  const enumDef = ctx.exportData.enums[enumId];
146723
147097
  if (enumDef === void 0) return [];
146724
147098
  if (sdkRuntimeEnumBinding(enumId) !== void 0) return [];
146725
147099
  const enumName = ctx.enumNames.get(enumId) ?? toCSharpTypeName(enumDef.name, "NeoEnum");
146726
- const optionKeyOrder = getEnumOptionKeyOrder(enumDef);
147100
+ const optionsName = enumOptionsName(ctx, enumId);
147101
+ const optionsByValue = /* @__PURE__ */ new Map();
147102
+ const options = getEnumOptionKeyOrder(enumDef).flatMap((optionId) => {
147103
+ const option = enumDef.options[optionId];
147104
+ if (option === void 0) {
147105
+ throw new Error(
147106
+ `Enum ${enumId} option order references missing option ${optionId}.`
147107
+ );
147108
+ }
147109
+ const fieldName = enumOptionFieldName(ctx, enumId, optionId);
147110
+ if (fieldName === null) {
147111
+ ctx.diagnostics.push({
147112
+ severity: "error",
147113
+ message: `Enum option name "${option.name}" is not a valid C# identifier.`,
147114
+ path: `enums.${enumId}.options.${optionId}`
147115
+ });
147116
+ return [];
147117
+ }
147118
+ const value = enumMemberValue(optionId);
147119
+ const clash = optionsByValue.get(value);
147120
+ if (clash !== void 0) {
147121
+ ctx.diagnostics.push({
147122
+ severity: "error",
147123
+ message: `Enum options "${clash}" and "${option.name}" generate the same C# enum value; recreate one of them to give it a new option id.`,
147124
+ path: `enums.${enumId}.options.${optionId}`
147125
+ });
147126
+ return [];
147127
+ }
147128
+ optionsByValue.set(value, option.name);
147129
+ return [
147130
+ {
147131
+ optionId,
147132
+ value,
147133
+ id: `"${escapeCSharpString(optionId)}"`,
147134
+ member: `${enumName}.${fieldName}`,
147135
+ fieldName,
147136
+ text: `"${escapeCSharpString(option.text)}"`
147137
+ }
147138
+ ];
147139
+ });
147140
+ const switchBody = (subject, arms, fallback) => [
147141
+ `return ${subject} switch`,
147142
+ "{",
147143
+ ...indent([...arms, `_ => ${fallback},`]),
147144
+ "};"
147145
+ ];
147146
+ const method2 = (signature, body) => [
147147
+ signature,
147148
+ "{",
147149
+ ...indent(body),
147150
+ "}"
147151
+ ];
146727
147152
  return [
146728
147153
  ...xmlSummary(ctx.docs.enums[enumId]),
146729
- `public sealed class ${enumName} : IEquatable<${enumName}>, global::NeoCompose.Runtime.INeoEnumOption`,
147154
+ `[NeoEnum(typeof(${optionsName}))]`,
147155
+ `public enum ${enumName}`,
147156
+ "{",
147157
+ ...indent(
147158
+ options.flatMap((option) => [
147159
+ ...xmlSummary(ctx.docs.enumOptions[option.optionId]),
147160
+ `${option.fieldName} = ${option.value},`
147161
+ ])
147162
+ ),
147163
+ "}",
147164
+ "",
147165
+ "/// <summary>",
147166
+ `/// Converts <see cref="${enumName}"/> to and from the option ids Neo stores.`,
147167
+ "/// </summary>",
147168
+ `public static class ${optionsName}`,
146730
147169
  "{",
146731
147170
  ...indent([
146732
- `private static readonly Dictionary<string, ${enumName}> values = new Dictionary<string, ${enumName}>();`,
146733
- "public string optionId { get; }",
146734
- "public string Text => TextForOptionId(optionId);",
146735
- "public string TextId => TextIdForOptionId(optionId);",
146736
- "",
146737
- `private ${enumName}(string optionId)`,
146738
- "{",
146739
- ...indent(["this.optionId = optionId;"]),
146740
- "}",
146741
- "",
146742
- ...optionKeyOrder.flatMap((optionId) => {
146743
- const option = enumDef.options[optionId];
146744
- if (option === void 0) {
146745
- throw new Error(
146746
- `Enum ${enumId} option order references missing option ${optionId}.`
146747
- );
146748
- }
146749
- const optionName = option.name;
146750
- const fieldName = enumOptionFieldName(ctx, enumId, optionId);
146751
- if (fieldName === null) {
146752
- ctx.diagnostics.push({
146753
- severity: "error",
146754
- message: `Enum option name "${optionName}" is not a valid C# identifier.`,
146755
- path: `enums.${enumId}.options.${optionId}`
146756
- });
146757
- return [`// Skipped invalid option id: ${optionId}`];
146758
- }
146759
- return [
146760
- ...xmlSummary(ctx.docs.enumOptions[optionId]),
146761
- `public static readonly ${enumName} ${fieldName} = FromOptionId("${escapeCSharpString(optionId)}");`
146762
- ];
146763
- }),
146764
- "",
146765
- `public static ${enumName} FromOptionId(string optionId)`,
146766
- "{",
146767
- ...indent([
146768
- "if (values.TryGetValue(optionId, out var known)) return known;",
146769
- `var created = new ${enumName}(optionId);`,
146770
- "values[optionId] = created;",
146771
- "return created;"
146772
- ]),
146773
- "}",
147171
+ ...method2(
147172
+ `public static ${enumName} FromOptionId(string optionId)`,
147173
+ switchBody(
147174
+ "optionId",
147175
+ options.map((option) => `${option.id} => ${option.member},`),
147176
+ `NeoUndeclaredEnumOptions<${enumName}>.FromOptionId(optionId)`
147177
+ )
147178
+ ),
146774
147179
  "",
146775
- `public static string[] ToOptionIds(IEnumerable<${enumName}>? options)`,
146776
- "{",
146777
- ...indent([
146778
- "if (options is null) return Array.Empty<string>();",
146779
- "var ids = new List<string>();",
146780
- "foreach (var option in options) ids.Add(option.optionId);",
146781
- "return ids.ToArray();"
146782
- ]),
146783
- "}",
147180
+ ...method2(
147181
+ `public static string OptionId(this ${enumName} value)`,
147182
+ switchBody(
147183
+ "value",
147184
+ options.map((option) => `${option.member} => ${option.id},`),
147185
+ `NeoUndeclaredEnumOptions<${enumName}>.OptionId(value)`
147186
+ )
147187
+ ),
146784
147188
  "",
146785
- "public static bool IsKnown(string id)",
146786
- "{",
146787
- ...indent([
146788
- "return id switch",
146789
- "{",
146790
- ...indent([
146791
- ...optionKeyOrder.map(
146792
- (optionId) => `"${escapeCSharpString(optionId)}" => true,`
146793
- ),
146794
- "_ => false,"
146795
- ]),
146796
- "};"
146797
- ]),
146798
- "}",
147189
+ ...method2(
147190
+ `public static string[] ToOptionIds(IEnumerable<${enumName}>? options)`,
147191
+ [
147192
+ "if (options is null) return Array.Empty<string>();",
147193
+ "var ids = new List<string>();",
147194
+ "foreach (var option in options) ids.Add(option.OptionId());",
147195
+ "return ids.ToArray();"
147196
+ ]
147197
+ ),
146799
147198
  "",
146800
- "public static string TextIdForOptionId(string optionId)",
146801
- "{",
146802
- ...indent([
146803
- "return optionId switch",
146804
- "{",
146805
- ...indent([
146806
- ...optionKeyOrder.flatMap((optionId) => {
146807
- const option = enumDef.options[optionId];
146808
- return [
146809
- `"${escapeCSharpString(optionId)}" => "${escapeCSharpString(option.text)}",`
146810
- ];
146811
- }),
146812
- "_ => optionId,"
146813
- ]),
146814
- "};"
146815
- ]),
146816
- "}",
147199
+ ...method2(
147200
+ "public static bool IsKnown(string optionId)",
147201
+ switchBody(
147202
+ "optionId",
147203
+ options.map((option) => `${option.id} => true,`),
147204
+ "false"
147205
+ )
147206
+ ),
146817
147207
  "",
146818
- "public static string TextForOptionId(string optionId, NeoClient? client = null)",
146819
- "{",
146820
- ...indent([
146821
- ctx.singleton ? `return (client ?? ${ctx.projectClassName}.RequireInstance().Client).Localization.ResolveText(TextIdForOptionId(optionId));` : "return client is null ? TextIdForOptionId(optionId) : client.Localization.ResolveText(TextIdForOptionId(optionId));"
146822
- ]),
146823
- "}",
147208
+ ...method2(
147209
+ `public static string TextId(this ${enumName} value)`,
147210
+ switchBody(
147211
+ "value",
147212
+ options.map((option) => `${option.member} => ${option.text},`),
147213
+ "value.OptionId()"
147214
+ )
147215
+ ),
146824
147216
  "",
146825
- `public static implicit operator string(${enumName} value) => value.optionId;`,
146826
- `public static implicit operator ${enumName}(string optionId) => FromOptionId(optionId);`,
146827
- "public override string ToString() => optionId;",
146828
- `public bool Equals(${enumName}? other) => other is not null && optionId == other.optionId;`,
146829
- `public override bool Equals(object? obj) => Equals(obj as ${enumName});`,
146830
- "public override int GetHashCode() => optionId.GetHashCode();",
146831
- `public static bool operator ==(${enumName}? left, ${enumName}? right) => ReferenceEquals(left, right) || (left is not null && left.Equals(right));`,
146832
- `public static bool operator !=(${enumName}? left, ${enumName}? right) => !(left == right);`
147217
+ ...method2(
147218
+ `public static string Text(this ${enumName} value, NeoClient? client = null)`,
147219
+ [
147220
+ ctx.singleton ? `return (client ?? ${ctx.projectClassName}.RequireInstance().Client).Localization.ResolveText(value.TextId());` : "return client is null ? value.TextId() : client.Localization.ResolveText(value.TextId());"
147221
+ ]
147222
+ )
146833
147223
  ]),
146834
147224
  "}"
146835
147225
  ];
@@ -147059,7 +147449,7 @@ function generateIndexedListWrappers(ctx, ownerClass, schemaKey, memberId, env)
147059
147449
  {
147060
147450
  definition: definition2,
147061
147451
  keyType: enumName,
147062
- codecs: enumKeyCodecArguments(indexedMember.enumId, enumName)
147452
+ codecs: enumKeyCodecArguments(ctx, indexedMember.enumId)
147063
147453
  }
147064
147454
  ];
147065
147455
  }
@@ -148329,7 +148719,7 @@ function generateExplicitInterfaceMember(ctx, schemaKey, memberId, interfaceName
148329
148719
  genericEnv,
148330
148720
  ownerClassId
148331
148721
  );
148332
- const setter = isMemberNSPropertyBase(member) && typeof member.setterCode === "string" && !suppressesInheritedSetter(interfaceContract) ? nsPropertyWriteExpression(schemaKey) : null;
148722
+ const setter = isMemberNSPropertyBase(member) && typeof member.setterCode === "string" && !suppressesInheritedSetter(interfaceContract) ? nsPropertyWriteExpression(ctx, member, schemaKey) : null;
148333
148723
  return [
148334
148724
  `${interfaceType2} ${interfaceName}.${memberName}`,
148335
148725
  "{",
@@ -149083,7 +149473,7 @@ function planWorldObjectEmission(ctx, classDef, worldKind) {
149083
149473
  // conversion runs through the wrapper's implicit operator, which is
149084
149474
  // where the required-member throw now lives.
149085
149475
  `Sprite ${SPRITE_OBJECT_VALUE_INTERFACE}.${schemaKeyToMemberName(SPRITE_OBJECT_SPRITE_SCHEMA_KEY)} => ${schemaKeyToMemberName(SPRITE_OBJECT_SPRITE_SCHEMA_KEY)};`,
149086
- `string ${SPRITE_OBJECT_VALUE_INTERFACE}.${schemaKeyToMemberName(SPRITE_OBJECT_MASK_INTERACTION_SCHEMA_KEY)} => ${schemaKeyToMemberName(SPRITE_OBJECT_MASK_INTERACTION_SCHEMA_KEY)}.optionId;`
149476
+ `string ${SPRITE_OBJECT_VALUE_INTERFACE}.${schemaKeyToMemberName(SPRITE_OBJECT_MASK_INTERACTION_SCHEMA_KEY)} => ${schemaKeyToMemberName(SPRITE_OBJECT_MASK_INTERACTION_SCHEMA_KEY)}.OptionId();`
149087
149477
  ],
149088
149478
  shadowedSchemaKeys: /* @__PURE__ */ new Set([
149089
149479
  SPRITE_OBJECT_SPRITE_SCHEMA_KEY,
@@ -149105,7 +149495,7 @@ function planSmartTileEmission(ctx, classDef) {
149105
149495
  return planValidatedContractEmission(ctx, classDef, worldKind, () => ({
149106
149496
  runtimeInterfaces: [SMART_TILE_INTERFACE],
149107
149497
  classMembers: [
149108
- `string ${SMART_TILE_INTERFACE}.${schemaKeyToMemberName(WORLD_SMART_TILE_DEFAULT_COLLIDER_SCHEMA_KEY)} => ${schemaKeyToMemberName(WORLD_SMART_TILE_DEFAULT_COLLIDER_SCHEMA_KEY)}.optionId;`,
149498
+ `string ${SMART_TILE_INTERFACE}.${schemaKeyToMemberName(WORLD_SMART_TILE_DEFAULT_COLLIDER_SCHEMA_KEY)} => ${schemaKeyToMemberName(WORLD_SMART_TILE_DEFAULT_COLLIDER_SCHEMA_KEY)}.OptionId();`,
149109
149499
  `IReadOnlyList<${SMART_TILE_RULE_INTERFACE}> ${SMART_TILE_INTERFACE}.${schemaKeyToMemberName(WORLD_SMART_TILE_RULES_SCHEMA_KEY)} => ${schemaKeyToMemberName(WORLD_SMART_TILE_RULES_SCHEMA_KEY)};`
149110
149500
  ],
149111
149501
  shadowedSchemaKeys: /* @__PURE__ */ new Set([
@@ -149120,9 +149510,9 @@ function planSmartTileEmission(ctx, classDef) {
149120
149510
  classMembers: [
149121
149511
  `IReadOnlyList<${SMART_TILE_NEIGHBOR_INTERFACE}> ${SMART_TILE_RULE_INTERFACE}.${schemaKeyToMemberName(WORLD_SMART_TILE_RULE_NEIGHBORS_SCHEMA_KEY)} => ${schemaKeyToMemberName(WORLD_SMART_TILE_RULE_NEIGHBORS_SCHEMA_KEY)};`,
149122
149512
  `IReadOnlyList<Sprite> ${SMART_TILE_RULE_INTERFACE}.${schemaKeyToMemberName(WORLD_SMART_TILE_RULE_SPRITES_SCHEMA_KEY)} => ${schemaKeyToMemberName(WORLD_SMART_TILE_RULE_SPRITES_SCHEMA_KEY)};`,
149123
- `string ${SMART_TILE_RULE_INTERFACE}.${schemaKeyToMemberName(WORLD_SMART_TILE_RULE_OUTPUT_SCHEMA_KEY)} => ${schemaKeyToMemberName(WORLD_SMART_TILE_RULE_OUTPUT_SCHEMA_KEY)}.optionId;`,
149124
- `string ${SMART_TILE_RULE_INTERFACE}.${schemaKeyToMemberName(WORLD_SMART_TILE_RULE_COLLIDER_SCHEMA_KEY)} => ${schemaKeyToMemberName(WORLD_SMART_TILE_RULE_COLLIDER_SCHEMA_KEY)}.optionId;`,
149125
- `string ${SMART_TILE_RULE_INTERFACE}.${schemaKeyToMemberName(WORLD_SMART_TILE_RULE_TRANSFORM_SCHEMA_KEY)} => ${schemaKeyToMemberName(WORLD_SMART_TILE_RULE_TRANSFORM_SCHEMA_KEY)}.optionId;`,
149513
+ `string ${SMART_TILE_RULE_INTERFACE}.${schemaKeyToMemberName(WORLD_SMART_TILE_RULE_OUTPUT_SCHEMA_KEY)} => ${schemaKeyToMemberName(WORLD_SMART_TILE_RULE_OUTPUT_SCHEMA_KEY)}.OptionId();`,
149514
+ `string ${SMART_TILE_RULE_INTERFACE}.${schemaKeyToMemberName(WORLD_SMART_TILE_RULE_COLLIDER_SCHEMA_KEY)} => ${schemaKeyToMemberName(WORLD_SMART_TILE_RULE_COLLIDER_SCHEMA_KEY)}.OptionId();`,
149515
+ `string ${SMART_TILE_RULE_INTERFACE}.${schemaKeyToMemberName(WORLD_SMART_TILE_RULE_TRANSFORM_SCHEMA_KEY)} => ${schemaKeyToMemberName(WORLD_SMART_TILE_RULE_TRANSFORM_SCHEMA_KEY)}.OptionId();`,
149126
149516
  `float ${SMART_TILE_RULE_INTERFACE}.${schemaKeyToMemberName(WORLD_SMART_TILE_RULE_MIN_ANIMATION_SPEED_SCHEMA_KEY)} => ${schemaKeyToMemberName(WORLD_SMART_TILE_RULE_MIN_ANIMATION_SPEED_SCHEMA_KEY)};`,
149127
149517
  `float ${SMART_TILE_RULE_INTERFACE}.${schemaKeyToMemberName(WORLD_SMART_TILE_RULE_MAX_ANIMATION_SPEED_SCHEMA_KEY)} => ${schemaKeyToMemberName(WORLD_SMART_TILE_RULE_MAX_ANIMATION_SPEED_SCHEMA_KEY)};`
149128
149518
  ],
@@ -149142,7 +149532,7 @@ function planSmartTileEmission(ctx, classDef) {
149142
149532
  runtimeInterfaces: [SMART_TILE_NEIGHBOR_INTERFACE],
149143
149533
  classMembers: [
149144
149534
  `Vector2Int ${SMART_TILE_NEIGHBOR_INTERFACE}.${schemaKeyToMemberName(WORLD_SMART_TILE_NEIGHBOR_CELL_SCHEMA_KEY)} => ${schemaKeyToMemberName(WORLD_SMART_TILE_NEIGHBOR_CELL_SCHEMA_KEY)}.Value;`,
149145
- `string ${SMART_TILE_NEIGHBOR_INTERFACE}.${schemaKeyToMemberName(WORLD_SMART_TILE_NEIGHBOR_CONDITION_SCHEMA_KEY)} => ${schemaKeyToMemberName(WORLD_SMART_TILE_NEIGHBOR_CONDITION_SCHEMA_KEY)}.optionId;`,
149535
+ `string ${SMART_TILE_NEIGHBOR_INTERFACE}.${schemaKeyToMemberName(WORLD_SMART_TILE_NEIGHBOR_CONDITION_SCHEMA_KEY)} => ${schemaKeyToMemberName(WORLD_SMART_TILE_NEIGHBOR_CONDITION_SCHEMA_KEY)}.OptionId();`,
149146
149536
  `string? ${SMART_TILE_NEIGHBOR_INTERFACE}.TileClassId => ${SMART_TILE_NEIGHBOR_TILE_RELATION_EXPRESSION};`
149147
149537
  ],
149148
149538
  shadowedSchemaKeys: /* @__PURE__ */ new Set([
@@ -150366,37 +150756,16 @@ function declaredConstructorParameters(ctx, classId, declared, genericEnv) {
150366
150756
  }
150367
150757
  identifiers.add(identifier2);
150368
150758
  const baseType = csharpFunctionTypeInfoValueType(ctx, argument2, true, genericEnv) ?? "object?";
150369
- const rendered = renderCSharpParameterDefault(
150370
- ctx,
150371
- argument2,
150372
- `constructors.${declared.id}.argumentTypes`
150373
- );
150374
- if (rendered === null) {
150375
- parameters.push({
150376
- declaredName: argument2.name,
150377
- identifier: identifier2,
150378
- csharpType: baseType,
150379
- defaultLiteral: null,
150380
- enumFallback: null
150381
- });
150382
- continue;
150383
- }
150384
- if (rendered.enumFallback === null) {
150385
- parameters.push({
150386
- declaredName: argument2.name,
150387
- identifier: identifier2,
150388
- csharpType: baseType,
150389
- defaultLiteral: rendered.literal,
150390
- enumFallback: null
150391
- });
150392
- continue;
150393
- }
150394
150759
  parameters.push({
150395
150760
  declaredName: argument2.name,
150396
150761
  identifier: identifier2,
150397
- csharpType: baseType.endsWith("?") ? baseType : `${baseType}?`,
150398
- defaultLiteral: rendered.literal,
150399
- enumFallback: rendered.enumFallback
150762
+ csharpType: baseType,
150763
+ defaultLiteral: renderCSharpParameterDefault(
150764
+ ctx,
150765
+ argument2,
150766
+ `constructors.${declared.id}.argumentTypes`
150767
+ ),
150768
+ scriptArgument: scriptValueExpression(ctx, argument2, identifier2)
150400
150769
  });
150401
150770
  }
150402
150771
  return parameters;
@@ -150470,10 +150839,9 @@ function generateDeclaredConstructor(ctx, classId, className, constructorId, par
150470
150839
  );
150471
150840
  const signatureParameters = [...declaredParameters, ...appendedParameters];
150472
150841
  const parameterText = ctx.singleton ? signatureParameters.join(", ") : [`${ctx.projectClassName} project`, ...signatureParameters].join(", ");
150473
- const argumentEntries = parameters.map((parameter4) => {
150474
- const valueExpression = parameter4.enumFallback === null ? parameter4.identifier : `${parameter4.identifier} ?? ${parameter4.enumFallback}`;
150475
- return `new global::NeoCompose.Runtime.NeoDeclaredConstructorArgument("${escapeCSharpString(parameter4.declaredName)}", ${valueExpression})`;
150476
- }).join(", ");
150842
+ const argumentEntries = parameters.map(
150843
+ (parameter4) => `new global::NeoCompose.Runtime.NeoDeclaredConstructorArgument("${escapeCSharpString(parameter4.declaredName)}", ${parameter4.scriptArgument})`
150844
+ ).join(", ");
150477
150845
  const argumentArray = argumentEntries.length === 0 ? "new global::NeoCompose.Runtime.NeoDeclaredConstructorArgument[] { }" : `new global::NeoCompose.Runtime.NeoDeclaredConstructorArgument[] { ${argumentEntries} }`;
150478
150846
  const suppliedValues = appendedMembers.map(
150479
150847
  (member) => `new global::NeoCompose.Runtime.NeoGeneratedConstructorValue("${escapeCSharpString(member.schemaKey)}", "${escapeCSharpString(member.memberId)}", ${member.identifier})`
@@ -150590,21 +150958,18 @@ function generateStaticFunctionMethod(ctx, ownerClass, member, genericEnv) {
150590
150958
  `members.${member.id}.argumentTypes`
150591
150959
  );
150592
150960
  const parameters = parameterList.map((parameter4) => parameter4.declaration).join(", ");
150593
- const coalesceStatements = parameterList.flatMap(
150594
- (parameter4) => parameter4.coalesceStatement === null ? [] : [parameter4.coalesceStatement]
150961
+ const argumentNames = parameterList.map((parameter4) => parameter4.identifier);
150962
+ const scriptArguments = parameterList.map(
150963
+ (parameter4) => parameter4.scriptArgument
150595
150964
  );
150596
- const argumentNames = parameterList.map(
150597
- (parameter4) => parameter4.valueExpression
150598
- );
150599
- const args = argumentNames.length === 0 ? "{ }" : `{ ${argumentNames.join(", ")} }`;
150965
+ const args = scriptArguments.length === 0 ? "{ }" : `{ ${scriptArguments.join(", ")} }`;
150600
150966
  const asyncModifier = member.kind === 23 /* NSFunction */ && callableIsDeferred(member) ? "async " : "";
150601
150967
  const declaration = `${memberAccessKeyword(member)} static ${asyncModifier}${returnType} ${functionMethodName(member.name)}(${parameters})`;
150602
150968
  const docs = xmlSummary(ctx.docs.members[member.id]);
150603
150969
  const stamp = memberMethodStamp(member);
150604
150970
  if (member.kind === 23 /* NSFunction */) {
150605
- const invocation = callableIsDeferred(member) ? `await node.InvokeStaticAsync(new object?[] ${args})` : `node.InvokeStatic(${immediateInvocationArguments(null, argumentNames)})`;
150971
+ const invocation = callableIsDeferred(member) ? `await node.InvokeStaticAsync(new object?[] ${args})` : `node.InvokeStatic(${immediateInvocationArguments(null, scriptArguments)})`;
150606
150972
  const body = [
150607
- ...coalesceStatements,
150608
150973
  `var client = ${ctx.projectClassName}.RequireInstance().Client;`,
150609
150974
  `var node = NeoMemberNSFunction.GetOrCreateStatic(client, "${escapeCSharpString(member.id)}");`,
150610
150975
  ...isFunctionVoidTypeInfo(member.returnTypeInfo) ? [`${invocation};`] : [
@@ -150641,7 +151006,6 @@ function generateStaticFunctionMethod(ctx, ownerClass, member, genericEnv) {
150641
151006
  declaration,
150642
151007
  "{",
150643
151008
  ...indent([
150644
- ...coalesceStatements,
150645
151009
  `if (${handler} is null)`,
150646
151010
  "{",
150647
151011
  ...indent([
@@ -150874,7 +151238,7 @@ function generateStaticNSProperty(ctx, member, memberName, memberId, genericEnv)
150874
151238
  ];
150875
151239
  const setter = typeof member.setterCode === "string" ? [
150876
151240
  ...prelude,
150877
- "var result = node.Set(value);",
151241
+ `var result = node.Set(${scriptValueExpression(ctx, member.returnTypeInfo, "value")});`,
150878
151242
  'if (!result.ok) throw new InvalidOperationException(result.error ?? "Static NSProperty setter failed.");'
150879
151243
  ] : null;
150880
151244
  return [
@@ -151044,7 +151408,7 @@ function generateMember(ctx, schemaKey, memberId, saved, modifier, emitBody, own
151044
151408
  genericEnv,
151045
151409
  ownerClassId
151046
151410
  );
151047
- const declaredPropertySetter = isMemberNSPropertyBase(member) && typeof member.setterCode === "string" ? nsPropertyWriteExpression(schemaKey) : null;
151411
+ const declaredPropertySetter = isMemberNSPropertyBase(member) && typeof member.setterCode === "string" ? nsPropertyWriteExpression(ctx, member, schemaKey) : null;
151048
151412
  const propertySetter = suppressesInheritedSetter(inheritedContract) ? null : declaredPropertySetter;
151049
151413
  const emitsStoredSetter = bindingContract === null ? memberSaved : bindingContract.hasSetter;
151050
151414
  const storedSetterBody = suppressesInheritedSetter(inheritedContract) || !emitsStoredSetter ? null : writeExpression(ctx, member, schemaKey, ownerClassName, ownerClassId);
@@ -151397,10 +151761,10 @@ function descendsFromWorldObject(ctx, classId) {
151397
151761
  }
151398
151762
  return false;
151399
151763
  }
151400
- function nsPropertyWriteExpression(schemaKey) {
151764
+ function nsPropertyWriteExpression(ctx, member, schemaKey) {
151401
151765
  const getNode = `writableNode.Get<NeoMemberNSProperty>("${escapeCSharpString(schemaKey)}")`;
151402
151766
  return [
151403
- `var result = ${getNode}.Set(valueId!, value);`,
151767
+ `var result = ${getNode}.Set(valueId!, ${scriptValueExpression(ctx, member.returnTypeInfo, "value")});`,
151404
151768
  'if (!result.ok) throw new InvalidOperationException(result.error ?? "NSProperty setter failed.");'
151405
151769
  ];
151406
151770
  }
@@ -151470,49 +151834,37 @@ function renderCSharpParameterDefault(ctx, argument2, path) {
151470
151834
  case 1 /* Bool */: {
151471
151835
  const defaultValue = argument2.defaultValue;
151472
151836
  if (defaultValue === void 0) return null;
151473
- if (defaultValue.value === null)
151474
- return { literal: "null", enumFallback: null };
151475
- return {
151476
- literal: defaultValue.value ? "true" : "false",
151477
- enumFallback: null
151478
- };
151837
+ if (defaultValue.value === null) return "null";
151838
+ return defaultValue.value ? "true" : "false";
151479
151839
  }
151480
151840
  case 2 /* Int */: {
151481
151841
  const defaultValue = argument2.defaultValue;
151482
151842
  if (defaultValue === void 0) return null;
151483
- if (defaultValue.value === null)
151484
- return { literal: "null", enumFallback: null };
151485
- return { literal: String(defaultValue.value), enumFallback: null };
151843
+ if (defaultValue.value === null) return "null";
151844
+ return String(defaultValue.value);
151486
151845
  }
151487
151846
  case 4 /* Float */: {
151488
151847
  const defaultValue = argument2.defaultValue;
151489
151848
  if (defaultValue === void 0) return null;
151490
- if (defaultValue.value === null)
151491
- return { literal: "null", enumFallback: null };
151492
- return { literal: `${String(defaultValue.value)}f`, enumFallback: null };
151849
+ if (defaultValue.value === null) return "null";
151850
+ return `${String(defaultValue.value)}f`;
151493
151851
  }
151494
151852
  case 20 /* Decimal */: {
151495
151853
  const defaultValue = argument2.defaultValue;
151496
151854
  if (defaultValue === void 0) return null;
151497
- if (defaultValue.value === null)
151498
- return { literal: "null", enumFallback: null };
151499
- return { literal: `${defaultValue.value}m`, enumFallback: null };
151855
+ if (defaultValue.value === null) return "null";
151856
+ return `${defaultValue.value}m`;
151500
151857
  }
151501
151858
  case 3 /* String */: {
151502
151859
  const defaultValue = argument2.defaultValue;
151503
151860
  if (defaultValue === void 0) return null;
151504
- if (defaultValue.value === null)
151505
- return { literal: "null", enumFallback: null };
151506
- return {
151507
- literal: `"${escapeCSharpString(defaultValue.value)}"`,
151508
- enumFallback: null
151509
- };
151861
+ if (defaultValue.value === null) return "null";
151862
+ return `"${escapeCSharpString(defaultValue.value)}"`;
151510
151863
  }
151511
151864
  case 8 /* Enum */: {
151512
151865
  const defaultValue = argument2.defaultValue;
151513
151866
  if (defaultValue === void 0) return null;
151514
- if (defaultValue.value === null)
151515
- return { literal: "null", enumFallback: null };
151867
+ if (defaultValue.value === null) return "null";
151516
151868
  const enumDef = ctx.exportData.enums[argument2.enumId];
151517
151869
  if (enumDef === void 0) {
151518
151870
  ctx.diagnostics.push({
@@ -151554,22 +151906,22 @@ function renderCSharpParameterDefault(ctx, argument2, path) {
151554
151906
  return null;
151555
151907
  }
151556
151908
  if (argument2.enumId === NEO_CELL_PATTERN_EXCLUDING_ENUM_ID)
151557
- return {
151558
- literal: `NeoCompose.Runtime.NeoCellPatternExcluding.${schemaKeyToMemberName(option.name)}`,
151559
- enumFallback: null
151560
- };
151561
- return { literal: "null", enumFallback: `${enumName}.${accessor}` };
151909
+ return `NeoCompose.Runtime.NeoCellPatternExcluding.${schemaKeyToMemberName(option.name)}`;
151910
+ return `${enumName}.${accessor}`;
151562
151911
  }
151563
151912
  default: {
151564
151913
  if (argument2.defaultValue === void 0) return null;
151565
- return { literal: "null", enumFallback: null };
151914
+ return "null";
151566
151915
  }
151567
151916
  }
151568
151917
  }
151918
+ function scriptValueExpression(ctx, typeInfo, expression) {
151919
+ return typeInfo.type === 8 /* Enum */ && typeInfo.enumId !== NEO_CELL_PATTERN_EXCLUDING_ENUM_ID && ctx.enumNames.has(typeInfo.enumId) ? `${expression}${typeInfo.required ? "" : "?"}.OptionId()` : expression;
151920
+ }
151569
151921
  function renderFunctionParameters(ctx, member, genericBindingSaved, genericEnv, path) {
151570
151922
  return member.argumentTypes.map((argument2, index) => {
151571
151923
  const identifier2 = functionParameterName(argument2.name, index);
151572
- const baseType = csharpFunctionTypeInfoValueType(
151924
+ const type = csharpFunctionTypeInfoValueType(
151573
151925
  ctx,
151574
151926
  argument2,
151575
151927
  genericBindingSaved,
@@ -151577,10 +151929,9 @@ function renderFunctionParameters(ctx, member, genericBindingSaved, genericEnv,
151577
151929
  ) ?? "object?";
151578
151930
  const bare = {
151579
151931
  identifier: identifier2,
151580
- type: baseType,
151581
- declaration: `${baseType} ${identifier2}`,
151582
- valueExpression: identifier2,
151583
- coalesceStatement: null
151932
+ type,
151933
+ declaration: `${type} ${identifier2}`,
151934
+ scriptArgument: scriptValueExpression(ctx, argument2, identifier2)
151584
151935
  };
151585
151936
  if (callableIsDeferred(member) && parameterHasDefault(argument2)) {
151586
151937
  ctx.diagnostics.push({
@@ -151590,26 +151941,8 @@ function renderFunctionParameters(ctx, member, genericBindingSaved, genericEnv,
151590
151941
  });
151591
151942
  return bare;
151592
151943
  }
151593
- const rendered = renderCSharpParameterDefault(ctx, argument2, path);
151594
- if (rendered === null) return bare;
151595
- if (rendered.enumFallback === null) {
151596
- return {
151597
- identifier: identifier2,
151598
- type: baseType,
151599
- declaration: `${baseType} ${identifier2} = ${rendered.literal}`,
151600
- valueExpression: identifier2,
151601
- coalesceStatement: null
151602
- };
151603
- }
151604
- const nullableType = baseType.endsWith("?") ? baseType : `${baseType}?`;
151605
- const coalescedLocal = `${identifier2}Value`;
151606
- return {
151607
- identifier: identifier2,
151608
- type: nullableType,
151609
- declaration: `${nullableType} ${identifier2} = null`,
151610
- valueExpression: coalescedLocal,
151611
- coalesceStatement: `var ${coalescedLocal} = ${identifier2} ?? ${rendered.enumFallback};`
151612
- };
151944
+ const literal3 = renderCSharpParameterDefault(ctx, argument2, path);
151945
+ return literal3 === null ? bare : { ...bare, declaration: `${type} ${identifier2} = ${literal3}` };
151613
151946
  });
151614
151947
  }
151615
151948
  function functionSignature(ctx, member, genericEnv) {
@@ -151677,12 +152010,12 @@ function generateFunctionMethod(ctx, member, schemaKey, modifier = "", emitBody
151677
152010
  ];
151678
152011
  if (!emitBody) return [...docs, `${declaration};`];
151679
152012
  const stamp = memberMethodStamp(member);
151680
- const coalesceStatements = parameterList.flatMap(
151681
- (parameter4) => parameter4.coalesceStatement === null ? [] : [parameter4.coalesceStatement]
151682
- );
151683
- const argumentList = parameterList.map((parameter4) => parameter4.valueExpression).join(", ");
152013
+ const argumentList = parameterList.map((parameter4) => parameter4.identifier).join(", ");
151684
152014
  const call = `FunctionHandler.${methodName}(${argumentList})`;
151685
- const deferredArgs = member.argumentTypes.length === 0 ? "{ }" : `{ ${argumentList} }`;
152015
+ const scriptArguments = parameterList.map(
152016
+ (parameter4) => parameter4.scriptArgument
152017
+ );
152018
+ const deferredArgs = scriptArguments.length === 0 ? "{ }" : `{ ${scriptArguments.join(", ")} }`;
151686
152019
  const deferredCall = isFunctionVoidTypeInfo(member.returnTypeInfo) ? `return client.InvokeDeferredNativeFunction("${escapeCSharpString(member.id)}", this, new object?[] ${deferredArgs});` : `return client.InvokeDeferredNativeFunction<${csharpFunctionReturnType(ctx, member.returnTypeInfo, genericEnv, true)}>("${escapeCSharpString(member.id)}", this, new object?[] ${deferredArgs});`;
151687
152020
  if (member.id === NEO_TILE_CONVERT_MEMBER_ID) {
151688
152021
  return [
@@ -151690,10 +152023,7 @@ function generateFunctionMethod(ctx, member, schemaKey, modifier = "", emitBody
151690
152023
  ...stamp,
151691
152024
  declaration,
151692
152025
  "{",
151693
- ...indent([
151694
- ...coalesceStatements,
151695
- `return base.TryConvert(${argumentList});`
151696
- ]),
152026
+ ...indent([`return base.TryConvert(${argumentList});`]),
151697
152027
  "}"
151698
152028
  ];
151699
152029
  }
@@ -151704,7 +152034,6 @@ function generateFunctionMethod(ctx, member, schemaKey, modifier = "", emitBody
151704
152034
  declaration,
151705
152035
  "{",
151706
152036
  ...indent([
151707
- ...coalesceStatements,
151708
152037
  `var result = client.ScriptGridQueries.Invoke("${member.id}", this, new object?[] ${deferredArgs});`,
151709
152038
  ...nsGetterResultReturnExpression(
151710
152039
  ctx,
@@ -151720,11 +152049,10 @@ function generateFunctionMethod(ctx, member, schemaKey, modifier = "", emitBody
151720
152049
  if (isNSFunction2) {
151721
152050
  const invocation = callableIsDeferred(member) ? `writableNode.Get<NeoMemberNSFunction>("${escapeCSharpString(schemaKey)}").InvokeAsync(valueId!, new object?[] ${deferredArgs})` : `InvokeFunction(${immediateInvocationArguments(
151722
152051
  `"${escapeCSharpString(schemaKey)}"`,
151723
- parameterList.map((parameter4) => parameter4.valueExpression)
152052
+ scriptArguments
151724
152053
  )})`;
151725
152054
  const resultStatement = callableIsDeferred(member) ? `var result = await ${invocation};` : `var result = ${invocation};`;
151726
152055
  const body = [
151727
- ...coalesceStatements,
151728
152056
  ...callableIsDeferred(member) ? [
151729
152057
  `if (valueId is null) throw new InvalidOperationException("Cannot invoke NSFunction '${escapeCSharpString(member.name)}' without a backing receiver value id.");`
151730
152058
  ] : [],
@@ -151749,7 +152077,6 @@ function generateFunctionMethod(ctx, member, schemaKey, modifier = "", emitBody
151749
152077
  declaration,
151750
152078
  "{",
151751
152079
  ...indent([
151752
- ...coalesceStatements,
151753
152080
  ...callableIsDeferred(member) ? [deferredCall] : [
151754
152081
  "if (FunctionHandler is null)",
151755
152082
  "{",
@@ -151822,8 +152149,8 @@ function nativeFunctionArgExpression(ctx, typeInfo, valueExpression, argumentNam
151822
152149
  case 8 /* Enum */: {
151823
152150
  if (typeInfo.enumId === NEO_CELL_PATTERN_EXCLUDING_ENUM_ID)
151824
152151
  return `NeoCellPatternStorage.${required2 ? "ReadExcluding" : "ReadOptionalExcluding"}(${valueExpression})`;
151825
- const enumName = ctx.enumNames.get(typeInfo.enumId) ?? "string";
151826
- return required2 ? `NeoGeneratedTypesSupport.ReadEnumSingle(${valueExpression}, ${enumParser(enumName)}) ?? throw new InvalidOperationException("Required enum argument '${escapeCSharpString(argumentName)}' could not be resolved.")` : `NeoGeneratedTypesSupport.ReadEnumSingle(${valueExpression}, ${enumParser(enumName)})`;
152152
+ const parser = enumParser(ctx, typeInfo.enumId);
152153
+ return required2 ? `NeoGeneratedTypesSupport.ReadEnumSingle(${valueExpression}, ${parser}) ?? throw new InvalidOperationException("Required enum argument '${escapeCSharpString(argumentName)}' could not be resolved.")` : `NeoGeneratedTypesSupport.ReadEnumSingle(${valueExpression}, ${parser})`;
151827
152154
  }
151828
152155
  case 18 /* DialogueLookup */: {
151829
152156
  const dialogueIds = `NeoGeneratedTypesSupport.ToStringArray(${valueExpression})`;
@@ -151862,8 +152189,7 @@ function nativeFunctionArgExpression(ctx, typeInfo, valueExpression, argumentNam
151862
152189
  if (isMemberEnumBase(binding) && isMultiSelectionMember(binding)) {
151863
152190
  if (binding.enumId === NEO_CELL_PATTERN_EXCLUDING_ENUM_ID)
151864
152191
  return `NeoCellPatternStorage.ReadExcludingList(${valueExpression})`;
151865
- const enumName = ctx.enumNames.get(binding.enumId) ?? "string";
151866
- return `NeoGeneratedTypesSupport.ReadEnumList(${valueExpression}, ${enumParser(enumName)})`;
152192
+ return `NeoGeneratedTypesSupport.ReadEnumList(${valueExpression}, ${enumParser(ctx, binding.enumId)})`;
151867
152193
  }
151868
152194
  if (isMemberClassBase(binding)) {
151869
152195
  const typeName = ctx.typeNames.get(binding.classId);
@@ -152107,10 +152433,9 @@ function nsGetterResultReturnExpression(ctx, returnTypeInfo, valueExpression, sa
152107
152433
  ...prefix,
152108
152434
  `return NeoCellPatternStorage.${optional2 ? "ReadOptionalExcluding" : "ReadExcluding"}(${valueExpression});`
152109
152435
  ];
152110
- const enumName = ctx.enumNames.get(returnTypeInfo.enumId) ?? "string";
152111
152436
  return [
152112
152437
  ...prefix,
152113
- `var selected = NeoGeneratedTypesSupport.ReadEnumSingle(${valueExpression}, ${enumParser(enumName)});`,
152438
+ `var selected = NeoGeneratedTypesSupport.ReadEnumSingle(${valueExpression}, ${enumParser(ctx, returnTypeInfo.enumId)});`,
152114
152439
  optional2 ? "return selected;" : 'return selected ?? throw new InvalidOperationException("NSProperty returned null for a required enum value.");'
152115
152440
  ];
152116
152441
  }
@@ -152226,11 +152551,11 @@ function nsGetterGenericResultExpression(ctx, typeInfo, valueExpression, saved,
152226
152551
  if (isMemberEnumBase(binding)) {
152227
152552
  if (binding.enumId === NEO_CELL_PATTERN_EXCLUDING_ENUM_ID)
152228
152553
  return `NeoCellPatternStorage.${isMultiSelectionMember(binding) ? "ReadExcludingList" : required2 ? "ReadExcluding" : "ReadOptionalExcluding"}(${valueExpression})`;
152229
- const enumName = ctx.enumNames.get(binding.enumId) ?? "string";
152554
+ const parser = enumParser(ctx, binding.enumId);
152230
152555
  if (isMultiSelectionMember(binding)) {
152231
- return `NeoGeneratedTypesSupport.ReadEnumList(${valueExpression}, ${enumParser(enumName)})`;
152556
+ return `NeoGeneratedTypesSupport.ReadEnumList(${valueExpression}, ${parser})`;
152232
152557
  }
152233
- const read = `NeoGeneratedTypesSupport.ReadEnumSingle(${valueExpression}, ${enumParser(enumName)})`;
152558
+ const read = `NeoGeneratedTypesSupport.ReadEnumSingle(${valueExpression}, ${parser})`;
152234
152559
  return required2 ? `${read} ?? throw new InvalidOperationException("Required generic enum result was null.")` : read;
152235
152560
  }
152236
152561
  if (isMemberClassBase(binding)) {
@@ -152380,11 +152705,11 @@ function detachedValueExpression(ctx, member, value, required2, saved, genericEn
152380
152705
  if (isMemberEnumBase(member)) {
152381
152706
  if (member.enumId === NEO_CELL_PATTERN_EXCLUDING_ENUM_ID)
152382
152707
  return `NeoCellPatternStorage.${isMultiSelectionMember(member) ? "ReadExcludingList" : required2 ? "ReadExcluding" : "ReadOptionalExcluding"}(${value})`;
152383
- const enumName = ctx.enumNames.get(member.enumId);
152384
- if (enumName === void 0) return null;
152708
+ if (!ctx.enumNames.has(member.enumId)) return null;
152709
+ const parser = enumParser(ctx, member.enumId);
152385
152710
  if (isMultiSelectionMember(member))
152386
- return `NeoGeneratedTypesSupport.ReadEnumList(${value}, ${enumParser(enumName)})`;
152387
- const read = `NeoGeneratedTypesSupport.ReadEnumSingle(${value}, ${enumParser(enumName)})`;
152711
+ return `NeoGeneratedTypesSupport.ReadEnumList(${value}, ${parser})`;
152712
+ const read = `NeoGeneratedTypesSupport.ReadEnumSingle(${value}, ${parser})`;
152388
152713
  return required2 ? `${read} ?? throw new InvalidOperationException("Required enum '${escapeCSharpString(member.name)}' has no selected option.")` : `${value} is null ? null : ${read}`;
152389
152714
  }
152390
152715
  if (isMemberClassBase(member) && member.classArguments == null) {
@@ -152553,15 +152878,15 @@ function storedReadExpression(ctx, member, schemaKey, nodeType, saved, ownerClas
152553
152878
  return [
152554
152879
  `return NeoCellPatternStorage.${isMultiSelectionMember(member) ? "ReadExcludingList" : isRequiredMember2(member) ? "ReadExcluding" : "ReadOptionalExcluding"}(${getNode}.Selected());`
152555
152880
  ];
152556
- const enumName = ctx.enumNames.get(member.enumId) ?? "string";
152881
+ const optionsName = enumOptionsName(ctx, member.enumId);
152557
152882
  return isMultiSelectionMember(member) ? [
152558
- `return NeoGeneratedTypesSupport.ReadEnumList(${getNode}.Selected(), ${enumParser(enumName)});`
152883
+ `return NeoGeneratedTypesSupport.ReadEnumList(${getNode}.Selected(), ${enumParser(ctx, member.enumId)});`
152559
152884
  ] : isRequiredMember2(member) ? [
152560
152885
  `var selected = NeoGeneratedTypesSupport.ReadSingleSelected(${getNode});`,
152561
- `return selected is null ? throw new InvalidOperationException("Required enum '${escapeCSharpString(schemaKey)}' has no selected option.") : ${enumName}.FromOptionId(selected);`
152886
+ `return selected is null ? throw new InvalidOperationException("Required enum '${escapeCSharpString(schemaKey)}' has no selected option.") : ${optionsName}.FromOptionId(selected);`
152562
152887
  ] : [
152563
152888
  `var selected = NeoGeneratedTypesSupport.ReadSingleSelected(${getNode});`,
152564
- `return selected is null ? null : ${enumName}.FromOptionId(selected);`
152889
+ `return selected is null ? null : ${optionsName}.FromOptionId(selected);`
152565
152890
  ];
152566
152891
  }
152567
152892
  if (isMemberLookupBase(member)) {
@@ -152718,13 +153043,12 @@ function writeExpression(ctx, member, schemaKey, ownerClassName, ownerClassId) {
152718
153043
  return [
152719
153044
  `NeoGeneratedTypesSupport.SetValue(writableNode, "${key}", NeoGeneratedTypesSupport.Value(NeoCellPatternStorage.${isMultiSelectionMember(member) ? "ExcludingListIds" : "OptionalExcludingIds"}(value)));`
152720
153045
  ];
152721
- const enumName = ctx.enumNames.get(member.enumId) ?? "string";
152722
153046
  return isMultiSelectionMember(member) ? [
152723
- `NeoGeneratedTypesSupport.SetValue(writableNode, "${key}", NeoGeneratedTypesSupport.Value(${enumName}.ToOptionIds(value)));`
153047
+ `NeoGeneratedTypesSupport.SetValue(writableNode, "${key}", NeoGeneratedTypesSupport.Value(${enumOptionsName(ctx, member.enumId)}.ToOptionIds(value)));`
152724
153048
  ] : isRequiredMember2(member) ? [
152725
- `NeoGeneratedTypesSupport.SetValue(writableNode, "${key}", NeoGeneratedTypesSupport.Value(new[] { value.optionId }));`
153049
+ `NeoGeneratedTypesSupport.SetValue(writableNode, "${key}", NeoGeneratedTypesSupport.Value(new[] { value.OptionId() }));`
152726
153050
  ] : [
152727
- `NeoGeneratedTypesSupport.SetValue(writableNode, "${key}", NeoGeneratedTypesSupport.Value(value is null ? null : new[] { value.optionId }));`
153051
+ `NeoGeneratedTypesSupport.SetValue(writableNode, "${key}", NeoGeneratedTypesSupport.Value(value is null ? null : new[] { value.Value.OptionId() }));`
152728
153052
  ];
152729
153053
  }
152730
153054
  if (isMemberLookupBase(member)) {
@@ -152839,14 +153163,13 @@ function collectionReadExpression(ctx, member, getNode, schemaKey, entryMember,
152839
153163
  `new ${collectionType}(client, memberNode, (client, child) => ${childConverter(ctx, entryMember, false, false, genericEnv)}${keyCodecArguments})`
152840
153164
  );
152841
153165
  }
152842
- function enumKeyCodecArguments(enumId, enumName) {
152843
- return enumId === NEO_CELL_PATTERN_EXCLUDING_ENUM_ID ? ", id => NeoCellPatternStorage.ReadExcluding(new[] { id }), key => NeoCellPatternStorage.ExcludingIds(key)[0]" : `, ${enumParser(enumName)}, key => key.optionId`;
153166
+ function enumKeyCodecArguments(ctx, enumId) {
153167
+ return enumId === NEO_CELL_PATTERN_EXCLUDING_ENUM_ID ? ", id => NeoCellPatternStorage.ReadExcluding(new[] { id }), key => NeoCellPatternStorage.ExcludingIds(key)[0]" : `, ${enumParser(ctx, enumId)}, key => key.OptionId()`;
152844
153168
  }
152845
153169
  function dictionaryKeyCodecArguments(ctx, member) {
152846
153170
  if (!isEnumKeyedDictionaryMember(member)) return "";
152847
- const keyEnumName = ctx.enumNames.get(member.keyEnumId);
152848
- if (keyEnumName === void 0) return "";
152849
- return enumKeyCodecArguments(member.keyEnumId, keyEnumName);
153171
+ if (!ctx.enumNames.has(member.keyEnumId)) return "";
153172
+ return enumKeyCodecArguments(ctx, member.keyEnumId);
152850
153173
  }
152851
153174
  function serializeItemExpression(ctx, member, valueExpression) {
152852
153175
  if (member === null) return valueExpression;
@@ -152855,7 +153178,7 @@ function serializeItemExpression(ctx, member, valueExpression) {
152855
153178
  if (isMemberEnumBase(member)) {
152856
153179
  if (member.enumId === NEO_CELL_PATTERN_EXCLUDING_ENUM_ID)
152857
153180
  return `NeoGeneratedTypesSupport.Value(NeoCellPatternStorage.${isMultiSelectionMember(member) ? "ExcludingListIds" : "OptionalExcludingIds"}(${valueExpression}))`;
152858
- const rawExpression = isMultiSelectionMember(member) ? `${ctx.enumNames.get(member.enumId) ?? "NeoEnum"}.ToOptionIds(${valueExpression})` : `${valueExpression} is null ? null : new[] { ${valueExpression}.optionId }`;
153181
+ const rawExpression = isMultiSelectionMember(member) ? `${enumOptionsName(ctx, member.enumId)}.ToOptionIds(${valueExpression})` : `${valueExpression} is ${ctx.enumNames.get(member.enumId) ?? "NeoEnum"} enumOption ? new[] { enumOption.OptionId() } : null`;
152859
153182
  return `NeoGeneratedTypesSupport.Value(${rawExpression})`;
152860
153183
  }
152861
153184
  if (isMemberLookupBase(member)) {
@@ -153044,8 +153367,8 @@ function childConverter(ctx, member, saved = false, branchOnReadOnly = false, ge
153044
153367
  if (isMemberEnumBase(member)) {
153045
153368
  if (member.enumId === NEO_CELL_PATTERN_EXCLUDING_ENUM_ID)
153046
153369
  return `NeoCellPatternStorage.${isMultiSelectionMember(member) ? "ReadExcludingList" : isRequiredMember2(member) ? "ReadExcluding" : "ReadOptionalExcluding"}(((NeoMemberEnum)child).Selected())`;
153047
- const enumName = ctx.enumNames.get(member.enumId) ?? "string";
153048
- return isMultiSelectionMember(member) ? `NeoGeneratedTypesSupport.ReadEnumList(((NeoMemberEnum)child).Selected(), ${enumParser(enumName)})` : isRequiredMember2(member) ? `NeoGeneratedTypesSupport.ReadEnumSingle(((NeoMemberEnum)child).Selected(), ${enumParser(enumName)}) ?? throw new InvalidOperationException("Required enum '${escapeCSharpString(member.name)}' has no selected option.")` : `NeoGeneratedTypesSupport.ReadEnumSingle(((NeoMemberEnum)child).Selected(), ${enumParser(enumName)})`;
153370
+ const parser = enumParser(ctx, member.enumId);
153371
+ return isMultiSelectionMember(member) ? `NeoGeneratedTypesSupport.ReadEnumList(((NeoMemberEnum)child).Selected(), ${parser})` : isRequiredMember2(member) ? `NeoGeneratedTypesSupport.ReadEnumSingle(((NeoMemberEnum)child).Selected(), ${parser}) ?? throw new InvalidOperationException("Required enum '${escapeCSharpString(member.name)}' has no selected option.")` : `NeoGeneratedTypesSupport.ReadEnumSingle(((NeoMemberEnum)child).Selected(), ${parser})`;
153049
153372
  }
153050
153373
  if (isMemberLookupBase(member)) return "((NeoMemberLookup)child).Selected()";
153051
153374
  if (isMemberDialogueLookupBase(member))
@@ -153099,8 +153422,8 @@ function nsGetterChildConverter(ctx, returnTypeInfo, saved, genericEnv) {
153099
153422
  case 8 /* Enum */: {
153100
153423
  if (returnTypeInfo.enumId === NEO_CELL_PATTERN_EXCLUDING_ENUM_ID)
153101
153424
  return `NeoCellPatternStorage.${returnTypeInfo.required ? "ReadExcluding" : "ReadOptionalExcluding"}(${valueExpression})`;
153102
- const enumName = ctx.enumNames.get(returnTypeInfo.enumId) ?? "string";
153103
- return `NeoGeneratedTypesSupport.ReadEnumSingle(${valueExpression}, ${enumParser(enumName)})`;
153425
+ const readExpression2 = `NeoGeneratedTypesSupport.ReadEnumSingle(${valueExpression}, ${enumParser(ctx, returnTypeInfo.enumId)})`;
153426
+ return returnTypeInfo.required ? `${readExpression2} ?? throw new InvalidOperationException("NSProperty returned null for a required enum value.")` : readExpression2;
153104
153427
  }
153105
153428
  case 18 /* DialogueLookup */: {
153106
153429
  const dialogueIds = `NeoGeneratedTypesSupport.ToStringArray(${valueExpression})`;
@@ -153167,7 +153490,7 @@ function escapeCSharpString(value) {
153167
153490
  (character) => CSHARP_STRING_ESCAPES.get(character) ?? `\\u${character.charCodeAt(0).toString(16).padStart(4, "0")}`
153168
153491
  );
153169
153492
  }
153170
- var NEO_MEMORY_SCHEMA_KEYS, NEO_MEMORY_CLASS_NAMES, GENERATED_ENUM_CLASS_MEMBER_NAMES, CHILDREN_SCHEMA_KEY, TILE_LAYER_LINK_INTERFACE, OBJECT_LAYER_LINK_INTERFACE, OBJECT_SPAWN_HOOKS_INTERFACE, TILE_LAYER_RENDER_TARGET_PROVIDER_INTERFACE, SMART_TILE_SOURCE_INTERFACE, SMART_TILE_INTERFACE, SMART_TILE_RULE_INTERFACE, SMART_TILE_NEIGHBOR_INTERFACE, WORLD_OBJECT_VALUE_INTERFACE, OBJECT_COMPOSITION_SOURCE_INTERFACE, COLLIDER_SOURCE_INTERFACE, SORTING_GROUP_SOURCE_INTERFACE, COLLIDER_INTERFACE, SORTING_GROUP_INTERFACE, SPRITE_OBJECT_VALUE_INTERFACE, SORTING_GROUP_SOURCE_MEMBER_NAME, OBJECT_BASE_NAME_SCHEMA_KEY, OBJECT_BASE_POSITION_SCHEMA_KEY, OBJECT_BASE_SIZE_SCHEMA_KEY, SPRITE_OBJECT_SPRITE_SCHEMA_KEY, SPRITE_OBJECT_FLIP_X_SCHEMA_KEY, SPRITE_OBJECT_FLIP_Y_SCHEMA_KEY, SPRITE_OBJECT_MASK_INTERACTION_SCHEMA_KEY, SPRITE_OBJECT_SORTING_ORDER_SCHEMA_KEY, TILE_CELL_SCHEMA_KEY, EMPTY_RUNTIME_CONTRACT_PLAN, SMART_TILE_CONTRACT_WORLD_KINDS, WORLD_OBJECT_CONTRACT_WORLD_KINDS, SMART_TILE_NEIGHBOR_TILE_RELATION_EXPRESSION, REQUIRED_STRING_CONTRACT_FIELD, REQUIRED_BOOL_CONTRACT_FIELD, OPTIONAL_BOOL_CONTRACT_FIELD, OPTIONAL_INT_CONTRACT_FIELD, REQUIRED_FLOAT_CONTRACT_FIELD, REQUIRED_SPRITE_CONTRACT_FIELD, REQUIRED_VECTOR2_CONTRACT_FIELD, OPTIONAL_VECTOR2_CONTRACT_FIELD, REQUIRED_VECTOR2_INT_CONTRACT_FIELD, REQUIRED_VECTOR3_CONTRACT_FIELD, VARIANTS_SCOPE_NAME, BASE_VARIANT_NAME, VARIANT_APPLY_METHOD_NAME, VARIANT_FOLDER_SEPARATOR, CSHARP_STRING_ESCAPES, UNRESOLVED_VARIANT_TARGET;
153493
+ var NEO_MEMORY_SCHEMA_KEYS, NEO_MEMORY_CLASS_NAMES, CHILDREN_SCHEMA_KEY, TILE_LAYER_LINK_INTERFACE, OBJECT_LAYER_LINK_INTERFACE, OBJECT_SPAWN_HOOKS_INTERFACE, TILE_LAYER_RENDER_TARGET_PROVIDER_INTERFACE, SMART_TILE_SOURCE_INTERFACE, SMART_TILE_INTERFACE, SMART_TILE_RULE_INTERFACE, SMART_TILE_NEIGHBOR_INTERFACE, WORLD_OBJECT_VALUE_INTERFACE, OBJECT_COMPOSITION_SOURCE_INTERFACE, COLLIDER_SOURCE_INTERFACE, SORTING_GROUP_SOURCE_INTERFACE, COLLIDER_INTERFACE, SORTING_GROUP_INTERFACE, SPRITE_OBJECT_VALUE_INTERFACE, SORTING_GROUP_SOURCE_MEMBER_NAME, OBJECT_BASE_NAME_SCHEMA_KEY, OBJECT_BASE_POSITION_SCHEMA_KEY, OBJECT_BASE_SIZE_SCHEMA_KEY, SPRITE_OBJECT_SPRITE_SCHEMA_KEY, SPRITE_OBJECT_FLIP_X_SCHEMA_KEY, SPRITE_OBJECT_FLIP_Y_SCHEMA_KEY, SPRITE_OBJECT_MASK_INTERACTION_SCHEMA_KEY, SPRITE_OBJECT_SORTING_ORDER_SCHEMA_KEY, TILE_CELL_SCHEMA_KEY, EMPTY_RUNTIME_CONTRACT_PLAN, SMART_TILE_CONTRACT_WORLD_KINDS, WORLD_OBJECT_CONTRACT_WORLD_KINDS, SMART_TILE_NEIGHBOR_TILE_RELATION_EXPRESSION, REQUIRED_STRING_CONTRACT_FIELD, REQUIRED_BOOL_CONTRACT_FIELD, OPTIONAL_BOOL_CONTRACT_FIELD, OPTIONAL_INT_CONTRACT_FIELD, REQUIRED_FLOAT_CONTRACT_FIELD, REQUIRED_SPRITE_CONTRACT_FIELD, REQUIRED_VECTOR2_CONTRACT_FIELD, OPTIONAL_VECTOR2_CONTRACT_FIELD, REQUIRED_VECTOR2_INT_CONTRACT_FIELD, REQUIRED_VECTOR3_CONTRACT_FIELD, VARIANTS_SCOPE_NAME, BASE_VARIANT_NAME, VARIANT_APPLY_METHOD_NAME, VARIANT_FOLDER_SEPARATOR, CSHARP_STRING_ESCAPES, UNRESOLVED_VARIANT_TARGET;
153171
153494
  var init_generate_unity_classes = __esm({
153172
153495
  "../src/models/exports/unity-codegen/generate-unity-classes.ts"() {
153173
153496
  "use strict";
@@ -153213,24 +153536,6 @@ var init_generate_unity_classes = __esm({
153213
153536
  textNodeMemory: "NeoTextNodeMemory",
153214
153537
  choiceLog: "NeoChoiceLog"
153215
153538
  };
153216
- GENERATED_ENUM_CLASS_MEMBER_NAMES = /* @__PURE__ */ new Set([
153217
- "values",
153218
- "optionId",
153219
- "Text",
153220
- "TextId",
153221
- "FromOptionId",
153222
- "ToOptionIds",
153223
- "IsKnown",
153224
- "TextIdForOptionId",
153225
- "TextForOptionId",
153226
- "ToString",
153227
- "Equals",
153228
- "GetHashCode",
153229
- "GetType",
153230
- "ReferenceEquals",
153231
- "MemberwiseClone",
153232
- "Finalize"
153233
- ]);
153234
153539
  CHILDREN_SCHEMA_KEY = "Children";
153235
153540
  TILE_LAYER_LINK_INTERFACE = "INeoTileLayerLinkValue";
153236
153541
  OBJECT_LAYER_LINK_INTERFACE = "INeoObjectLayerLinkValue";
@@ -156488,7 +156793,7 @@ var UNITY_CODEGEN_REVISION;
156488
156793
  var init_unity_codegen_revision = __esm({
156489
156794
  "../src/models/exports/unity-codegen-revision.ts"() {
156490
156795
  "use strict";
156491
- UNITY_CODEGEN_REVISION = "03bfbde6bcc46538292d7c03998e5a684d7a0a0bff8959f9aeaa8a38d18753f5";
156796
+ UNITY_CODEGEN_REVISION = "30d96d89e3d179ccf291e522834281f90dbd44b464cf51eea76aae87eed97e7e";
156492
156797
  }
156493
156798
  });
156494
156799
 
@@ -174074,6 +174379,7 @@ function selectedSpecPaths(workspace, selectors) {
174074
174379
  const normalizedSelectors = selectors.map(
174075
174380
  (selector) => selector.replaceAll("\\", "/").replace(/^\.\//u, "")
174076
174381
  );
174382
+ const realRoot = realpathSync2(workspace.root);
174077
174383
  for (const selector of normalizedSelectors) {
174078
174384
  if (/[*?]/u.test(selector)) continue;
174079
174385
  if (isAbsolute3(selector)) {
@@ -174090,7 +174396,7 @@ function selectedSpecPaths(workspace, selectors) {
174090
174396
  }
174091
174397
  if (!existsSync19(absolute)) continue;
174092
174398
  const real = realpathSync2(absolute);
174093
- const realRelative = relative9(workspace.root, real);
174399
+ const realRelative = relative9(realRoot, real);
174094
174400
  if (realRelative === ".." || realRelative.startsWith(`..${sep9}`)) {
174095
174401
  throw new Error(
174096
174402
  `Spec selector ${JSON.stringify(selector)} resolves outside the workspace through a symlink.`
@@ -182175,7 +182481,7 @@ There is no --keep-current: preserving current semantic state defines flatten.
182175
182481
  async function main() {
182176
182482
  const args = parseArgs(process.argv.slice(2));
182177
182483
  if (args.command === "--version") {
182178
- console.log("0.70.3");
182484
+ console.log("0.70.5");
182179
182485
  return;
182180
182486
  }
182181
182487
  if (args.command === null || args.command === "help" || args.command === "--help" || args.command === "-h") {