@abco20/btxml-checker 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/server.cjs CHANGED
@@ -927,9 +927,9 @@ var require_codegen = __commonJS({
927
927
  }
928
928
  };
929
929
  var Throw = class extends Node {
930
- constructor(error51) {
930
+ constructor(error52) {
931
931
  super();
932
- this.error = error51;
932
+ this.error = error52;
933
933
  }
934
934
  render({ _n }) {
935
935
  return `throw ${this.error};` + _n;
@@ -1166,9 +1166,9 @@ var require_codegen = __commonJS({
1166
1166
  }
1167
1167
  };
1168
1168
  var Catch = class extends BlockNode {
1169
- constructor(error51) {
1169
+ constructor(error52) {
1170
1170
  super();
1171
- this.error = error51;
1171
+ this.error = error52;
1172
1172
  }
1173
1173
  render(opts) {
1174
1174
  return `catch(${this.error})` + super.render(opts);
@@ -1359,9 +1359,9 @@ var require_codegen = __commonJS({
1359
1359
  this._blockNode(node);
1360
1360
  this.code(tryBody);
1361
1361
  if (catchCode) {
1362
- const error51 = this.name("e");
1363
- this._currNode = node.catch = new Catch(error51);
1364
- catchCode(error51);
1362
+ const error52 = this.name("e");
1363
+ this._currNode = node.catch = new Catch(error52);
1364
+ catchCode(error52);
1365
1365
  }
1366
1366
  if (finallyCode) {
1367
1367
  this._currNode = node.finally = new Finally();
@@ -1370,8 +1370,8 @@ var require_codegen = __commonJS({
1370
1370
  return this._endBlockNode(Catch, Finally);
1371
1371
  }
1372
1372
  // `throw` statement
1373
- throw(error51) {
1374
- return this._leafNode(new Throw(error51));
1373
+ throw(error52) {
1374
+ return this._leafNode(new Throw(error52));
1375
1375
  }
1376
1376
  // start self-balancing block
1377
1377
  block(body, nodeCount) {
@@ -1727,10 +1727,10 @@ var require_errors = __commonJS({
1727
1727
  exports2.keyword$DataError = {
1728
1728
  message: ({ keyword, schemaType }) => schemaType ? (0, codegen_1.str)`"${keyword}" keyword must be ${schemaType} ($data)` : (0, codegen_1.str)`"${keyword}" keyword is invalid ($data)`
1729
1729
  };
1730
- function reportError(cxt, error51 = exports2.keywordError, errorPaths, overrideAllErrors) {
1730
+ function reportError(cxt, error52 = exports2.keywordError, errorPaths, overrideAllErrors) {
1731
1731
  const { it } = cxt;
1732
1732
  const { gen, compositeRule, allErrors } = it;
1733
- const errObj = errorObjectCode(cxt, error51, errorPaths);
1733
+ const errObj = errorObjectCode(cxt, error52, errorPaths);
1734
1734
  if (overrideAllErrors !== null && overrideAllErrors !== void 0 ? overrideAllErrors : compositeRule || allErrors) {
1735
1735
  addError(gen, errObj);
1736
1736
  } else {
@@ -1738,10 +1738,10 @@ var require_errors = __commonJS({
1738
1738
  }
1739
1739
  }
1740
1740
  exports2.reportError = reportError;
1741
- function reportExtraError(cxt, error51 = exports2.keywordError, errorPaths) {
1741
+ function reportExtraError(cxt, error52 = exports2.keywordError, errorPaths) {
1742
1742
  const { it } = cxt;
1743
1743
  const { gen, compositeRule, allErrors } = it;
1744
- const errObj = errorObjectCode(cxt, error51, errorPaths);
1744
+ const errObj = errorObjectCode(cxt, error52, errorPaths);
1745
1745
  addError(gen, errObj);
1746
1746
  if (!(compositeRule || allErrors)) {
1747
1747
  returnErrors(it, names_1.default.vErrors);
@@ -1792,19 +1792,19 @@ var require_errors = __commonJS({
1792
1792
  schema: new codegen_1.Name("schema"),
1793
1793
  parentSchema: new codegen_1.Name("parentSchema")
1794
1794
  };
1795
- function errorObjectCode(cxt, error51, errorPaths) {
1795
+ function errorObjectCode(cxt, error52, errorPaths) {
1796
1796
  const { createErrors } = cxt.it;
1797
1797
  if (createErrors === false)
1798
1798
  return (0, codegen_1._)`{}`;
1799
- return errorObject(cxt, error51, errorPaths);
1799
+ return errorObject(cxt, error52, errorPaths);
1800
1800
  }
1801
- function errorObject(cxt, error51, errorPaths = {}) {
1801
+ function errorObject(cxt, error52, errorPaths = {}) {
1802
1802
  const { gen, it } = cxt;
1803
1803
  const keyValues = [
1804
1804
  errorInstancePath(it, errorPaths),
1805
1805
  errorSchemaPath(cxt, errorPaths)
1806
1806
  ];
1807
- extraErrorProps(cxt, error51, keyValues);
1807
+ extraErrorProps(cxt, error52, keyValues);
1808
1808
  return gen.object(...keyValues);
1809
1809
  }
1810
1810
  function errorInstancePath({ errorPath }, { instancePath }) {
@@ -5159,7 +5159,7 @@ var require_limitNumber = __commonJS({
5159
5159
  exclusiveMaximum: { okStr: "<", ok: ops.LT, fail: ops.GTE },
5160
5160
  exclusiveMinimum: { okStr: ">", ok: ops.GT, fail: ops.LTE }
5161
5161
  };
5162
- var error51 = {
5162
+ var error52 = {
5163
5163
  message: ({ keyword, schemaCode }) => (0, codegen_1.str)`must be ${KWDs[keyword].okStr} ${schemaCode}`,
5164
5164
  params: ({ keyword, schemaCode }) => (0, codegen_1._)`{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}`
5165
5165
  };
@@ -5168,7 +5168,7 @@ var require_limitNumber = __commonJS({
5168
5168
  type: "number",
5169
5169
  schemaType: "number",
5170
5170
  $data: true,
5171
- error: error51,
5171
+ error: error52,
5172
5172
  code(cxt) {
5173
5173
  const { keyword, data, schemaCode } = cxt;
5174
5174
  cxt.fail$data((0, codegen_1._)`${data} ${KWDs[keyword].fail} ${schemaCode} || isNaN(${data})`);
@@ -5184,7 +5184,7 @@ var require_multipleOf = __commonJS({
5184
5184
  "use strict";
5185
5185
  Object.defineProperty(exports2, "__esModule", { value: true });
5186
5186
  var codegen_1 = require_codegen();
5187
- var error51 = {
5187
+ var error52 = {
5188
5188
  message: ({ schemaCode }) => (0, codegen_1.str)`must be multiple of ${schemaCode}`,
5189
5189
  params: ({ schemaCode }) => (0, codegen_1._)`{multipleOf: ${schemaCode}}`
5190
5190
  };
@@ -5193,7 +5193,7 @@ var require_multipleOf = __commonJS({
5193
5193
  type: "number",
5194
5194
  schemaType: "number",
5195
5195
  $data: true,
5196
- error: error51,
5196
+ error: error52,
5197
5197
  code(cxt) {
5198
5198
  const { gen, data, schemaCode, it } = cxt;
5199
5199
  const prec = it.opts.multipleOfPrecision;
@@ -5240,7 +5240,7 @@ var require_limitLength = __commonJS({
5240
5240
  var codegen_1 = require_codegen();
5241
5241
  var util_1 = require_util();
5242
5242
  var ucs2length_1 = require_ucs2length();
5243
- var error51 = {
5243
+ var error52 = {
5244
5244
  message({ keyword, schemaCode }) {
5245
5245
  const comp = keyword === "maxLength" ? "more" : "fewer";
5246
5246
  return (0, codegen_1.str)`must NOT have ${comp} than ${schemaCode} characters`;
@@ -5252,7 +5252,7 @@ var require_limitLength = __commonJS({
5252
5252
  type: "string",
5253
5253
  schemaType: "number",
5254
5254
  $data: true,
5255
- error: error51,
5255
+ error: error52,
5256
5256
  code(cxt) {
5257
5257
  const { keyword, data, schemaCode, it } = cxt;
5258
5258
  const op = keyword === "maxLength" ? codegen_1.operators.GT : codegen_1.operators.LT;
@@ -5272,7 +5272,7 @@ var require_pattern = __commonJS({
5272
5272
  var code_1 = require_code2();
5273
5273
  var util_1 = require_util();
5274
5274
  var codegen_1 = require_codegen();
5275
- var error51 = {
5275
+ var error52 = {
5276
5276
  message: ({ schemaCode }) => (0, codegen_1.str)`must match pattern "${schemaCode}"`,
5277
5277
  params: ({ schemaCode }) => (0, codegen_1._)`{pattern: ${schemaCode}}`
5278
5278
  };
@@ -5281,7 +5281,7 @@ var require_pattern = __commonJS({
5281
5281
  type: "string",
5282
5282
  schemaType: "string",
5283
5283
  $data: true,
5284
- error: error51,
5284
+ error: error52,
5285
5285
  code(cxt) {
5286
5286
  const { gen, data, $data, schema, schemaCode, it } = cxt;
5287
5287
  const u = it.opts.unicodeRegExp ? "u" : "";
@@ -5307,7 +5307,7 @@ var require_limitProperties = __commonJS({
5307
5307
  "use strict";
5308
5308
  Object.defineProperty(exports2, "__esModule", { value: true });
5309
5309
  var codegen_1 = require_codegen();
5310
- var error51 = {
5310
+ var error52 = {
5311
5311
  message({ keyword, schemaCode }) {
5312
5312
  const comp = keyword === "maxProperties" ? "more" : "fewer";
5313
5313
  return (0, codegen_1.str)`must NOT have ${comp} than ${schemaCode} properties`;
@@ -5319,7 +5319,7 @@ var require_limitProperties = __commonJS({
5319
5319
  type: "object",
5320
5320
  schemaType: "number",
5321
5321
  $data: true,
5322
- error: error51,
5322
+ error: error52,
5323
5323
  code(cxt) {
5324
5324
  const { keyword, data, schemaCode } = cxt;
5325
5325
  const op = keyword === "maxProperties" ? codegen_1.operators.GT : codegen_1.operators.LT;
@@ -5338,7 +5338,7 @@ var require_required = __commonJS({
5338
5338
  var code_1 = require_code2();
5339
5339
  var codegen_1 = require_codegen();
5340
5340
  var util_1 = require_util();
5341
- var error51 = {
5341
+ var error52 = {
5342
5342
  message: ({ params: { missingProperty } }) => (0, codegen_1.str)`must have required property '${missingProperty}'`,
5343
5343
  params: ({ params: { missingProperty } }) => (0, codegen_1._)`{missingProperty: ${missingProperty}}`
5344
5344
  };
@@ -5347,7 +5347,7 @@ var require_required = __commonJS({
5347
5347
  type: "object",
5348
5348
  schemaType: "array",
5349
5349
  $data: true,
5350
- error: error51,
5350
+ error: error52,
5351
5351
  code(cxt) {
5352
5352
  const { gen, schema, schemaCode, data, $data, it } = cxt;
5353
5353
  const { opts } = it;
@@ -5418,7 +5418,7 @@ var require_limitItems = __commonJS({
5418
5418
  "use strict";
5419
5419
  Object.defineProperty(exports2, "__esModule", { value: true });
5420
5420
  var codegen_1 = require_codegen();
5421
- var error51 = {
5421
+ var error52 = {
5422
5422
  message({ keyword, schemaCode }) {
5423
5423
  const comp = keyword === "maxItems" ? "more" : "fewer";
5424
5424
  return (0, codegen_1.str)`must NOT have ${comp} than ${schemaCode} items`;
@@ -5430,7 +5430,7 @@ var require_limitItems = __commonJS({
5430
5430
  type: "array",
5431
5431
  schemaType: "number",
5432
5432
  $data: true,
5433
- error: error51,
5433
+ error: error52,
5434
5434
  code(cxt) {
5435
5435
  const { keyword, data, schemaCode } = cxt;
5436
5436
  const op = keyword === "maxItems" ? codegen_1.operators.GT : codegen_1.operators.LT;
@@ -5461,7 +5461,7 @@ var require_uniqueItems = __commonJS({
5461
5461
  var codegen_1 = require_codegen();
5462
5462
  var util_1 = require_util();
5463
5463
  var equal_1 = require_equal();
5464
- var error51 = {
5464
+ var error52 = {
5465
5465
  message: ({ params: { i, j } }) => (0, codegen_1.str)`must NOT have duplicate items (items ## ${j} and ${i} are identical)`,
5466
5466
  params: ({ params: { i, j } }) => (0, codegen_1._)`{i: ${i}, j: ${j}}`
5467
5467
  };
@@ -5470,7 +5470,7 @@ var require_uniqueItems = __commonJS({
5470
5470
  type: "array",
5471
5471
  schemaType: "boolean",
5472
5472
  $data: true,
5473
- error: error51,
5473
+ error: error52,
5474
5474
  code(cxt) {
5475
5475
  const { gen, data, $data, schema, parentSchema, schemaCode, it } = cxt;
5476
5476
  if (!$data && !schema)
@@ -5527,14 +5527,14 @@ var require_const = __commonJS({
5527
5527
  var codegen_1 = require_codegen();
5528
5528
  var util_1 = require_util();
5529
5529
  var equal_1 = require_equal();
5530
- var error51 = {
5530
+ var error52 = {
5531
5531
  message: "must be equal to constant",
5532
5532
  params: ({ schemaCode }) => (0, codegen_1._)`{allowedValue: ${schemaCode}}`
5533
5533
  };
5534
5534
  var def = {
5535
5535
  keyword: "const",
5536
5536
  $data: true,
5537
- error: error51,
5537
+ error: error52,
5538
5538
  code(cxt) {
5539
5539
  const { gen, data, $data, schemaCode, schema } = cxt;
5540
5540
  if ($data || schema && typeof schema == "object") {
@@ -5556,7 +5556,7 @@ var require_enum = __commonJS({
5556
5556
  var codegen_1 = require_codegen();
5557
5557
  var util_1 = require_util();
5558
5558
  var equal_1 = require_equal();
5559
- var error51 = {
5559
+ var error52 = {
5560
5560
  message: "must be equal to one of the allowed values",
5561
5561
  params: ({ schemaCode }) => (0, codegen_1._)`{allowedValues: ${schemaCode}}`
5562
5562
  };
@@ -5564,7 +5564,7 @@ var require_enum = __commonJS({
5564
5564
  keyword: "enum",
5565
5565
  schemaType: "array",
5566
5566
  $data: true,
5567
- error: error51,
5567
+ error: error52,
5568
5568
  code(cxt) {
5569
5569
  const { gen, data, $data, schema, schemaCode, it } = cxt;
5570
5570
  if (!$data && schema.length === 0)
@@ -5643,7 +5643,7 @@ var require_additionalItems = __commonJS({
5643
5643
  exports2.validateAdditionalItems = void 0;
5644
5644
  var codegen_1 = require_codegen();
5645
5645
  var util_1 = require_util();
5646
- var error51 = {
5646
+ var error52 = {
5647
5647
  message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`,
5648
5648
  params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}`
5649
5649
  };
@@ -5652,7 +5652,7 @@ var require_additionalItems = __commonJS({
5652
5652
  type: "array",
5653
5653
  schemaType: ["boolean", "object"],
5654
5654
  before: "uniqueItems",
5655
- error: error51,
5655
+ error: error52,
5656
5656
  code(cxt) {
5657
5657
  const { parentSchema, it } = cxt;
5658
5658
  const { items } = parentSchema;
@@ -5771,7 +5771,7 @@ var require_items2020 = __commonJS({
5771
5771
  var util_1 = require_util();
5772
5772
  var code_1 = require_code2();
5773
5773
  var additionalItems_1 = require_additionalItems();
5774
- var error51 = {
5774
+ var error52 = {
5775
5775
  message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`,
5776
5776
  params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}`
5777
5777
  };
@@ -5780,7 +5780,7 @@ var require_items2020 = __commonJS({
5780
5780
  type: "array",
5781
5781
  schemaType: ["object", "boolean"],
5782
5782
  before: "uniqueItems",
5783
- error: error51,
5783
+ error: error52,
5784
5784
  code(cxt) {
5785
5785
  const { schema, parentSchema, it } = cxt;
5786
5786
  const { prefixItems } = parentSchema;
@@ -5804,7 +5804,7 @@ var require_contains = __commonJS({
5804
5804
  Object.defineProperty(exports2, "__esModule", { value: true });
5805
5805
  var codegen_1 = require_codegen();
5806
5806
  var util_1 = require_util();
5807
- var error51 = {
5807
+ var error52 = {
5808
5808
  message: ({ params: { min, max } }) => max === void 0 ? (0, codegen_1.str)`must contain at least ${min} valid item(s)` : (0, codegen_1.str)`must contain at least ${min} and no more than ${max} valid item(s)`,
5809
5809
  params: ({ params: { min, max } }) => max === void 0 ? (0, codegen_1._)`{minContains: ${min}}` : (0, codegen_1._)`{minContains: ${min}, maxContains: ${max}}`
5810
5810
  };
@@ -5814,7 +5814,7 @@ var require_contains = __commonJS({
5814
5814
  schemaType: ["object", "boolean"],
5815
5815
  before: "uniqueItems",
5816
5816
  trackErrors: true,
5817
- error: error51,
5817
+ error: error52,
5818
5818
  code(cxt) {
5819
5819
  const { gen, schema, parentSchema, data, it } = cxt;
5820
5820
  let min;
@@ -5992,7 +5992,7 @@ var require_propertyNames = __commonJS({
5992
5992
  Object.defineProperty(exports2, "__esModule", { value: true });
5993
5993
  var codegen_1 = require_codegen();
5994
5994
  var util_1 = require_util();
5995
- var error51 = {
5995
+ var error52 = {
5996
5996
  message: "property name must be valid",
5997
5997
  params: ({ params }) => (0, codegen_1._)`{propertyName: ${params.propertyName}}`
5998
5998
  };
@@ -6000,7 +6000,7 @@ var require_propertyNames = __commonJS({
6000
6000
  keyword: "propertyNames",
6001
6001
  type: "object",
6002
6002
  schemaType: ["object", "boolean"],
6003
- error: error51,
6003
+ error: error52,
6004
6004
  code(cxt) {
6005
6005
  const { gen, schema, data, it } = cxt;
6006
6006
  if ((0, util_1.alwaysValidSchema)(it, schema))
@@ -6037,7 +6037,7 @@ var require_additionalProperties = __commonJS({
6037
6037
  var codegen_1 = require_codegen();
6038
6038
  var names_1 = require_names();
6039
6039
  var util_1 = require_util();
6040
- var error51 = {
6040
+ var error52 = {
6041
6041
  message: "must NOT have additional properties",
6042
6042
  params: ({ params }) => (0, codegen_1._)`{additionalProperty: ${params.additionalProperty}}`
6043
6043
  };
@@ -6047,7 +6047,7 @@ var require_additionalProperties = __commonJS({
6047
6047
  schemaType: ["boolean", "object"],
6048
6048
  allowUndefined: true,
6049
6049
  trackErrors: true,
6050
- error: error51,
6050
+ error: error52,
6051
6051
  code(cxt) {
6052
6052
  const { gen, schema, parentSchema, data, errsCount, it } = cxt;
6053
6053
  if (!errsCount)
@@ -6321,7 +6321,7 @@ var require_oneOf = __commonJS({
6321
6321
  Object.defineProperty(exports2, "__esModule", { value: true });
6322
6322
  var codegen_1 = require_codegen();
6323
6323
  var util_1 = require_util();
6324
- var error51 = {
6324
+ var error52 = {
6325
6325
  message: "must match exactly one schema in oneOf",
6326
6326
  params: ({ params }) => (0, codegen_1._)`{passingSchemas: ${params.passing}}`
6327
6327
  };
@@ -6329,7 +6329,7 @@ var require_oneOf = __commonJS({
6329
6329
  keyword: "oneOf",
6330
6330
  schemaType: "array",
6331
6331
  trackErrors: true,
6332
- error: error51,
6332
+ error: error52,
6333
6333
  code(cxt) {
6334
6334
  const { gen, schema, parentSchema, it } = cxt;
6335
6335
  if (!Array.isArray(schema))
@@ -6406,7 +6406,7 @@ var require_if = __commonJS({
6406
6406
  Object.defineProperty(exports2, "__esModule", { value: true });
6407
6407
  var codegen_1 = require_codegen();
6408
6408
  var util_1 = require_util();
6409
- var error51 = {
6409
+ var error52 = {
6410
6410
  message: ({ params }) => (0, codegen_1.str)`must match "${params.ifClause}" schema`,
6411
6411
  params: ({ params }) => (0, codegen_1._)`{failingKeyword: ${params.ifClause}}`
6412
6412
  };
@@ -6414,7 +6414,7 @@ var require_if = __commonJS({
6414
6414
  keyword: "if",
6415
6415
  schemaType: ["object", "boolean"],
6416
6416
  trackErrors: true,
6417
- error: error51,
6417
+ error: error52,
6418
6418
  code(cxt) {
6419
6419
  const { gen, parentSchema, it } = cxt;
6420
6420
  if (parentSchema.then === void 0 && parentSchema.else === void 0) {
@@ -6540,7 +6540,7 @@ var require_format = __commonJS({
6540
6540
  "use strict";
6541
6541
  Object.defineProperty(exports2, "__esModule", { value: true });
6542
6542
  var codegen_1 = require_codegen();
6543
- var error51 = {
6543
+ var error52 = {
6544
6544
  message: ({ schemaCode }) => (0, codegen_1.str)`must match format "${schemaCode}"`,
6545
6545
  params: ({ schemaCode }) => (0, codegen_1._)`{format: ${schemaCode}}`
6546
6546
  };
@@ -6549,7 +6549,7 @@ var require_format = __commonJS({
6549
6549
  type: ["number", "string"],
6550
6550
  schemaType: "string",
6551
6551
  $data: true,
6552
- error: error51,
6552
+ error: error52,
6553
6553
  code(cxt, ruleType) {
6554
6554
  const { gen, data, $data, schema, schemaCode, it } = cxt;
6555
6555
  const { opts, errSchemaPath, schemaEnv, self } = it;
@@ -6704,7 +6704,7 @@ var require_discriminator = __commonJS({
6704
6704
  var compile_1 = require_compile();
6705
6705
  var ref_error_1 = require_ref_error();
6706
6706
  var util_1 = require_util();
6707
- var error51 = {
6707
+ var error52 = {
6708
6708
  message: ({ params: { discrError, tagName } }) => discrError === types_1.DiscrError.Tag ? `tag "${tagName}" must be string` : `value of tag "${tagName}" must be in oneOf`,
6709
6709
  params: ({ params: { discrError, tag, tagName } }) => (0, codegen_1._)`{error: ${discrError}, tag: ${tagName}, tagValue: ${tag}}`
6710
6710
  };
@@ -6712,7 +6712,7 @@ var require_discriminator = __commonJS({
6712
6712
  keyword: "discriminator",
6713
6713
  type: "object",
6714
6714
  schemaType: "object",
6715
- error: error51,
6715
+ error: error52,
6716
6716
  code(cxt) {
6717
6717
  const { gen, data, schema, parentSchema, it } = cxt;
6718
6718
  const { oneOf } = parentSchema;
@@ -7044,10 +7044,10 @@ var require_is = __commonJS({
7044
7044
  return typeof value === "number" || value instanceof Number;
7045
7045
  }
7046
7046
  exports2.number = number4;
7047
- function error51(value) {
7047
+ function error52(value) {
7048
7048
  return value instanceof Error;
7049
7049
  }
7050
- exports2.error = error51;
7050
+ exports2.error = error52;
7051
7051
  function func(value) {
7052
7052
  return typeof value === "function";
7053
7053
  }
@@ -7089,10 +7089,10 @@ var require_is2 = __commonJS({
7089
7089
  return typeof value === "number" || value instanceof Number;
7090
7090
  }
7091
7091
  exports2.number = number4;
7092
- function error51(value) {
7092
+ function error52(value) {
7093
7093
  return value instanceof Error;
7094
7094
  }
7095
- exports2.error = error51;
7095
+ exports2.error = error52;
7096
7096
  function func(value) {
7097
7097
  return typeof value === "function";
7098
7098
  }
@@ -8154,8 +8154,8 @@ var require_messageReader = __commonJS({
8154
8154
  get onError() {
8155
8155
  return this.errorEmitter.event;
8156
8156
  }
8157
- fireError(error51) {
8158
- this.errorEmitter.fire(this.asError(error51));
8157
+ fireError(error52) {
8158
+ this.errorEmitter.fire(this.asError(error52));
8159
8159
  }
8160
8160
  get onClose() {
8161
8161
  return this.closeEmitter.event;
@@ -8169,11 +8169,11 @@ var require_messageReader = __commonJS({
8169
8169
  firePartialMessage(info) {
8170
8170
  this.partialMessageEmitter.fire(info);
8171
8171
  }
8172
- asError(error51) {
8173
- if (error51 instanceof Error) {
8174
- return error51;
8172
+ asError(error52) {
8173
+ if (error52 instanceof Error) {
8174
+ return error52;
8175
8175
  } else {
8176
- return new Error(`Reader received error. Reason: ${Is.string(error51.message) ? error51.message : "unknown"}`);
8176
+ return new Error(`Reader received error. Reason: ${Is.string(error52.message) ? error52.message : "unknown"}`);
8177
8177
  }
8178
8178
  }
8179
8179
  };
@@ -8243,7 +8243,7 @@ var require_messageReader = __commonJS({
8243
8243
  const result = this.readable.onData((data) => {
8244
8244
  this.onData(data);
8245
8245
  });
8246
- this.readable.onError((error51) => this.fireError(error51));
8246
+ this.readable.onError((error52) => this.fireError(error52));
8247
8247
  this.readable.onClose(() => this.fireClose());
8248
8248
  return result;
8249
8249
  }
@@ -8280,12 +8280,12 @@ ${JSON.stringify(Object.fromEntries(headers))}`));
8280
8280
  const bytes = this.options.contentDecoder !== void 0 ? await this.options.contentDecoder.decode(body) : body;
8281
8281
  const message = await this.options.contentTypeDecoder.decode(bytes, this.options);
8282
8282
  this.callback(message);
8283
- }).catch((error51) => {
8284
- this.fireError(error51);
8283
+ }).catch((error52) => {
8284
+ this.fireError(error52);
8285
8285
  });
8286
8286
  }
8287
- } catch (error51) {
8288
- this.fireError(error51);
8287
+ } catch (error52) {
8288
+ this.fireError(error52);
8289
8289
  }
8290
8290
  }
8291
8291
  clearPartialMessageTimer() {
@@ -8344,8 +8344,8 @@ var require_messageWriter = __commonJS({
8344
8344
  get onError() {
8345
8345
  return this.errorEmitter.event;
8346
8346
  }
8347
- fireError(error51, message, count) {
8348
- this.errorEmitter.fire([this.asError(error51), message, count]);
8347
+ fireError(error52, message, count) {
8348
+ this.errorEmitter.fire([this.asError(error52), message, count]);
8349
8349
  }
8350
8350
  get onClose() {
8351
8351
  return this.closeEmitter.event;
@@ -8353,11 +8353,11 @@ var require_messageWriter = __commonJS({
8353
8353
  fireClose() {
8354
8354
  this.closeEmitter.fire(void 0);
8355
8355
  }
8356
- asError(error51) {
8357
- if (error51 instanceof Error) {
8358
- return error51;
8356
+ asError(error52) {
8357
+ if (error52 instanceof Error) {
8358
+ return error52;
8359
8359
  } else {
8360
- return new Error(`Writer received error. Reason: ${Is.string(error51.message) ? error51.message : "unknown"}`);
8360
+ return new Error(`Writer received error. Reason: ${Is.string(error52.message) ? error52.message : "unknown"}`);
8361
8361
  }
8362
8362
  }
8363
8363
  };
@@ -8380,7 +8380,7 @@ var require_messageWriter = __commonJS({
8380
8380
  this.options = ResolvedMessageWriterOptions.fromOptions(options);
8381
8381
  this.errorCount = 0;
8382
8382
  this.writeSemaphore = new semaphore_1.Semaphore(1);
8383
- this.writable.onError((error51) => this.fireError(error51));
8383
+ this.writable.onError((error52) => this.fireError(error52));
8384
8384
  this.writable.onClose(() => this.fireClose());
8385
8385
  }
8386
8386
  async write(msg) {
@@ -8397,9 +8397,9 @@ var require_messageWriter = __commonJS({
8397
8397
  headers.push(ContentLength, buffer.byteLength.toString(), CRLF);
8398
8398
  headers.push(CRLF);
8399
8399
  return this.doWrite(msg, headers, buffer);
8400
- }, (error51) => {
8401
- this.fireError(error51);
8402
- throw error51;
8400
+ }, (error52) => {
8401
+ this.fireError(error52);
8402
+ throw error52;
8403
8403
  });
8404
8404
  });
8405
8405
  }
@@ -8407,14 +8407,14 @@ var require_messageWriter = __commonJS({
8407
8407
  try {
8408
8408
  await this.writable.write(headers.join(""), "ascii");
8409
8409
  return this.writable.write(data);
8410
- } catch (error51) {
8411
- this.handleError(error51, msg);
8412
- return Promise.reject(error51);
8410
+ } catch (error52) {
8411
+ this.handleError(error52, msg);
8412
+ return Promise.reject(error52);
8413
8413
  }
8414
8414
  }
8415
- handleError(error51, msg) {
8415
+ handleError(error52, msg) {
8416
8416
  this.errorCount++;
8417
- this.fireError(error51, msg, this.errorCount);
8417
+ this.fireError(error52, msg, this.errorCount);
8418
8418
  }
8419
8419
  end() {
8420
8420
  this.writable.end();
@@ -8867,8 +8867,8 @@ var require_connection = __commonJS({
8867
8867
  closeEmitter.fire(void 0);
8868
8868
  }
8869
8869
  }
8870
- function readErrorHandler(error51) {
8871
- errorEmitter.fire([error51, void 0, void 0]);
8870
+ function readErrorHandler(error52) {
8871
+ errorEmitter.fire([error52, void 0, void 0]);
8872
8872
  }
8873
8873
  function writeErrorHandler(data) {
8874
8874
  errorEmitter.fire(data);
@@ -8962,11 +8962,11 @@ var require_connection = __commonJS({
8962
8962
  traceSendingResponse(message, method, startTime2);
8963
8963
  messageWriter.write(message).catch(() => logger.error(`Sending response failed.`));
8964
8964
  }
8965
- function replyError(error51, method, startTime2) {
8965
+ function replyError(error52, method, startTime2) {
8966
8966
  const message = {
8967
8967
  jsonrpc: version2,
8968
8968
  id: requestMessage.id,
8969
- error: error51.toJson()
8969
+ error: error52.toJson()
8970
8970
  };
8971
8971
  traceSendingResponse(message, method, startTime2);
8972
8972
  messageWriter.write(message).catch(() => logger.error(`Sending response failed.`));
@@ -9034,12 +9034,12 @@ var require_connection = __commonJS({
9034
9034
  promise2.then((resultOrError) => {
9035
9035
  requestTokens.delete(tokenKey);
9036
9036
  reply(resultOrError, requestMessage.method, startTime);
9037
- }, (error51) => {
9037
+ }, (error52) => {
9038
9038
  requestTokens.delete(tokenKey);
9039
- if (error51 instanceof messages_1.ResponseError) {
9040
- replyError(error51, requestMessage.method, startTime);
9041
- } else if (error51 && Is.string(error51.message)) {
9042
- replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error51.message}`), requestMessage.method, startTime);
9039
+ if (error52 instanceof messages_1.ResponseError) {
9040
+ replyError(error52, requestMessage.method, startTime);
9041
+ } else if (error52 && Is.string(error52.message)) {
9042
+ replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error52.message}`), requestMessage.method, startTime);
9043
9043
  } else {
9044
9044
  replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);
9045
9045
  }
@@ -9048,12 +9048,12 @@ var require_connection = __commonJS({
9048
9048
  requestTokens.delete(tokenKey);
9049
9049
  reply(handlerResult, requestMessage.method, startTime);
9050
9050
  }
9051
- } catch (error51) {
9051
+ } catch (error52) {
9052
9052
  requestTokens.delete(tokenKey);
9053
- if (error51 instanceof messages_1.ResponseError) {
9054
- reply(error51, requestMessage.method, startTime);
9055
- } else if (error51 && Is.string(error51.message)) {
9056
- replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error51.message}`), requestMessage.method, startTime);
9053
+ if (error52 instanceof messages_1.ResponseError) {
9054
+ reply(error52, requestMessage.method, startTime);
9055
+ } else if (error52 && Is.string(error52.message)) {
9056
+ replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error52.message}`), requestMessage.method, startTime);
9057
9057
  } else {
9058
9058
  replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);
9059
9059
  }
@@ -9081,16 +9081,16 @@ ${JSON.stringify(responseMessage.error, void 0, 4)}`);
9081
9081
  responsePromises.delete(key);
9082
9082
  try {
9083
9083
  if (responseMessage.error) {
9084
- const error51 = responseMessage.error;
9085
- responsePromise.reject(new messages_1.ResponseError(error51.code, error51.message, error51.data));
9084
+ const error52 = responseMessage.error;
9085
+ responsePromise.reject(new messages_1.ResponseError(error52.code, error52.message, error52.data));
9086
9086
  } else if (responseMessage.result !== void 0) {
9087
9087
  responsePromise.resolve(responseMessage.result);
9088
9088
  } else {
9089
9089
  throw new Error("Should never happen.");
9090
9090
  }
9091
- } catch (error51) {
9092
- if (error51.message) {
9093
- logger.error(`Response handler '${responsePromise.method}' failed with message: ${error51.message}`);
9091
+ } catch (error52) {
9092
+ if (error52.message) {
9093
+ logger.error(`Response handler '${responsePromise.method}' failed with message: ${error52.message}`);
9094
9094
  } else {
9095
9095
  logger.error(`Response handler '${responsePromise.method}' failed unexpectedly.`);
9096
9096
  }
@@ -9151,9 +9151,9 @@ ${JSON.stringify(responseMessage.error, void 0, 4)}`);
9151
9151
  } else if (starNotificationHandler) {
9152
9152
  starNotificationHandler(message.method, message.params);
9153
9153
  }
9154
- } catch (error51) {
9155
- if (error51.message) {
9156
- logger.error(`Notification handler '${message.method}' failed with message: ${error51.message}`);
9154
+ } catch (error52) {
9155
+ if (error52.message) {
9156
+ logger.error(`Notification handler '${message.method}' failed with message: ${error52.message}`);
9157
9157
  } else {
9158
9158
  logger.error(`Notification handler '${message.method}' failed unexpectedly.`);
9159
9159
  }
@@ -9311,8 +9311,8 @@ ${JSON.stringify(message, null, 4)}`);
9311
9311
  }
9312
9312
  }
9313
9313
  if (responsePromise) {
9314
- const error51 = message.error ? ` Request failed: ${message.error.message} (${message.error.code}).` : "";
9315
- tracer.log(`Received response '${responsePromise.method} - (${message.id})' in ${Date.now() - responsePromise.timerStart}ms.${error51}`, data);
9314
+ const error52 = message.error ? ` Request failed: ${message.error.message} (${message.error.code}).` : "";
9315
+ tracer.log(`Received response '${responsePromise.method} - (${message.id})' in ${Date.now() - responsePromise.timerStart}ms.${error52}`, data);
9316
9316
  } else {
9317
9317
  tracer.log(`Received response ${message.id} without active response promise.`, data);
9318
9318
  }
@@ -9451,9 +9451,9 @@ ${JSON.stringify(message, null, 4)}`);
9451
9451
  params: messageParams
9452
9452
  };
9453
9453
  traceSendingNotification(notificationMessage);
9454
- return messageWriter.write(notificationMessage).catch((error51) => {
9454
+ return messageWriter.write(notificationMessage).catch((error52) => {
9455
9455
  logger.error(`Sending notification failed.`);
9456
- throw error51;
9456
+ throw error52;
9457
9457
  });
9458
9458
  },
9459
9459
  onNotification: (type, handler) => {
@@ -9578,10 +9578,10 @@ ${JSON.stringify(message, null, 4)}`);
9578
9578
  try {
9579
9579
  await messageWriter.write(requestMessage);
9580
9580
  responsePromises.set(id, responsePromise);
9581
- } catch (error51) {
9581
+ } catch (error52) {
9582
9582
  logger.error(`Sending request failed.`);
9583
- responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, error51.message ? error51.message : "Unknown reason"));
9584
- throw error51;
9583
+ responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, error52.message ? error52.message : "Unknown reason"));
9584
+ throw error52;
9585
9585
  }
9586
9586
  });
9587
9587
  },
@@ -9654,9 +9654,9 @@ ${JSON.stringify(message, null, 4)}`);
9654
9654
  }
9655
9655
  state = ConnectionState.Disposed;
9656
9656
  disposeEmitter.fire(void 0);
9657
- const error51 = new messages_1.ResponseError(messages_1.ErrorCodes.PendingResponseRejected, "Pending response rejected since connection got disposed");
9657
+ const error52 = new messages_1.ResponseError(messages_1.ErrorCodes.PendingResponseRejected, "Pending response rejected since connection got disposed");
9658
9658
  for (const promise2 of responsePromises.values()) {
9659
- promise2.reject(error51);
9659
+ promise2.reject(error52);
9660
9660
  }
9661
9661
  responsePromises = /* @__PURE__ */ new Map();
9662
9662
  requestTokens = /* @__PURE__ */ new Map();
@@ -9977,11 +9977,11 @@ var require_ril = __commonJS({
9977
9977
  }
9978
9978
  write(data, encoding) {
9979
9979
  return new Promise((resolve, reject) => {
9980
- const callback = (error51) => {
9981
- if (error51 === void 0 || error51 === null) {
9980
+ const callback = (error52) => {
9981
+ if (error52 === void 0 || error52 === null) {
9982
9982
  resolve();
9983
9983
  } else {
9984
- reject(error51);
9984
+ reject(error52);
9985
9985
  }
9986
9986
  };
9987
9987
  if (typeof data === "string") {
@@ -10093,7 +10093,7 @@ var require_main = __commonJS({
10093
10093
  super();
10094
10094
  this.process = process3;
10095
10095
  let eventEmitter = this.process;
10096
- eventEmitter.on("error", (error51) => this.fireError(error51));
10096
+ eventEmitter.on("error", (error52) => this.fireError(error52));
10097
10097
  eventEmitter.on("close", () => this.fireClose());
10098
10098
  }
10099
10099
  listen(callback) {
@@ -10108,30 +10108,30 @@ var require_main = __commonJS({
10108
10108
  this.process = process3;
10109
10109
  this.errorCount = 0;
10110
10110
  const eventEmitter = this.process;
10111
- eventEmitter.on("error", (error51) => this.fireError(error51));
10111
+ eventEmitter.on("error", (error52) => this.fireError(error52));
10112
10112
  eventEmitter.on("close", () => this.fireClose);
10113
10113
  }
10114
10114
  write(msg) {
10115
10115
  try {
10116
10116
  if (typeof this.process.send === "function") {
10117
- this.process.send(msg, void 0, void 0, (error51) => {
10118
- if (error51) {
10117
+ this.process.send(msg, void 0, void 0, (error52) => {
10118
+ if (error52) {
10119
10119
  this.errorCount++;
10120
- this.handleError(error51, msg);
10120
+ this.handleError(error52, msg);
10121
10121
  } else {
10122
10122
  this.errorCount = 0;
10123
10123
  }
10124
10124
  });
10125
10125
  }
10126
10126
  return Promise.resolve();
10127
- } catch (error51) {
10128
- this.handleError(error51, msg);
10129
- return Promise.reject(error51);
10127
+ } catch (error52) {
10128
+ this.handleError(error52, msg);
10129
+ return Promise.reject(error52);
10130
10130
  }
10131
10131
  }
10132
- handleError(error51, msg) {
10132
+ handleError(error52, msg) {
10133
10133
  this.errorCount++;
10134
- this.fireError(error51, msg, this.errorCount);
10134
+ this.fireError(error52, msg, this.errorCount);
10135
10135
  }
10136
10136
  end() {
10137
10137
  }
@@ -10142,7 +10142,7 @@ var require_main = __commonJS({
10142
10142
  super();
10143
10143
  this.onData = new api_1.Emitter();
10144
10144
  port.on("close", () => this.fireClose);
10145
- port.on("error", (error51) => this.fireError(error51));
10145
+ port.on("error", (error52) => this.fireError(error52));
10146
10146
  port.on("message", (message) => {
10147
10147
  this.onData.fire(message);
10148
10148
  });
@@ -10158,20 +10158,20 @@ var require_main = __commonJS({
10158
10158
  this.port = port;
10159
10159
  this.errorCount = 0;
10160
10160
  port.on("close", () => this.fireClose());
10161
- port.on("error", (error51) => this.fireError(error51));
10161
+ port.on("error", (error52) => this.fireError(error52));
10162
10162
  }
10163
10163
  write(msg) {
10164
10164
  try {
10165
10165
  this.port.postMessage(msg);
10166
10166
  return Promise.resolve();
10167
- } catch (error51) {
10168
- this.handleError(error51, msg);
10169
- return Promise.reject(error51);
10167
+ } catch (error52) {
10168
+ this.handleError(error52, msg);
10169
+ return Promise.reject(error52);
10170
10170
  }
10171
10171
  }
10172
- handleError(error51, msg) {
10172
+ handleError(error52, msg) {
10173
10173
  this.errorCount++;
10174
- this.fireError(error51, msg, this.errorCount);
10174
+ this.fireError(error52, msg, this.errorCount);
10175
10175
  }
10176
10176
  end() {
10177
10177
  }
@@ -11908,10 +11908,10 @@ var require_is3 = __commonJS({
11908
11908
  return typeof value === "number" || value instanceof Number;
11909
11909
  }
11910
11910
  exports2.number = number4;
11911
- function error51(value) {
11911
+ function error52(value) {
11912
11912
  return value instanceof Error;
11913
11913
  }
11914
- exports2.error = error51;
11914
+ exports2.error = error52;
11915
11915
  function func(value) {
11916
11916
  return typeof value === "function";
11917
11917
  }
@@ -15066,7 +15066,7 @@ var require_server = __commonJS({
15066
15066
  return value;
15067
15067
  } else if (Is.thenable(value)) {
15068
15068
  return new Promise((resolve, reject) => {
15069
- value.then((resolved) => resolve(resolved), (error51) => reject(error51));
15069
+ value.then((resolved) => resolve(resolved), (error52) => reject(error52));
15070
15070
  });
15071
15071
  } else {
15072
15072
  return Promise.resolve(value);
@@ -15380,8 +15380,8 @@ var require_files = __commonJS({
15380
15380
  reject(new Error(`Starting process to resolve node module ${moduleName} failed`));
15381
15381
  return;
15382
15382
  }
15383
- cp.on("error", (error51) => {
15384
- reject(error51);
15383
+ cp.on("error", (error52) => {
15384
+ reject(error52);
15385
15385
  });
15386
15386
  cp.on("message", (message2) => {
15387
15387
  if (message2.c === "r") {
@@ -15398,8 +15398,8 @@ var require_files = __commonJS({
15398
15398
  a: moduleName
15399
15399
  };
15400
15400
  cp.send(message);
15401
- } catch (error51) {
15402
- reject(error51);
15401
+ } catch (error52) {
15402
+ reject(error52);
15403
15403
  }
15404
15404
  });
15405
15405
  }
@@ -15850,7 +15850,7 @@ var require_main4 = __commonJS({
15850
15850
  console.log = function log(...args) {
15851
15851
  logger.log(serialize(args));
15852
15852
  };
15853
- console.error = function error51(...args) {
15853
+ console.error = function error52(...args) {
15854
15854
  logger.error(serialize(args));
15855
15855
  };
15856
15856
  console.trace = function trace(...args) {
@@ -15932,7 +15932,8 @@ var DEFAULT_RESOLVED_BTXML_CONFIG = {
15932
15932
  files: [],
15933
15933
  augmentations: [],
15934
15934
  definitions: [],
15935
- inline: {}
15935
+ inline: {},
15936
+ convention: "allow-unused"
15936
15937
  },
15937
15938
  linter: {
15938
15939
  enabled: true,
@@ -16069,6 +16070,106 @@ function createTextDocument(uri, text, version2 = 0, languageId = "xml") {
16069
16070
  return document;
16070
16071
  }
16071
16072
 
16073
+ // ../model/src/blackboard-reference.ts
16074
+ var BLACKBOARD_KEY_RE = /^[A-Za-z_][A-Za-z0-9_./:-]*$/;
16075
+ function ok(reference) {
16076
+ return { ok: true, reference };
16077
+ }
16078
+ function error(kind, raw, message) {
16079
+ return {
16080
+ ok: false,
16081
+ error: {
16082
+ kind,
16083
+ raw,
16084
+ message
16085
+ }
16086
+ };
16087
+ }
16088
+ function isValidKey(key) {
16089
+ return BLACKBOARD_KEY_RE.test(key);
16090
+ }
16091
+ function parseScopedKey(raw) {
16092
+ if (!raw) {
16093
+ return error("empty-key", raw, "Blackboard reference key must not be empty");
16094
+ }
16095
+ if (raw[0] === "@") {
16096
+ const key = raw.slice(1);
16097
+ if (!key) {
16098
+ return error("empty-key", raw, "Global blackboard reference key must not be empty");
16099
+ }
16100
+ if (!isValidKey(key)) {
16101
+ return error("invalid-global-key", raw, `Invalid global blackboard reference key: ${raw}`);
16102
+ }
16103
+ return { ok: true, scope: "global", key };
16104
+ }
16105
+ if (!isValidKey(raw)) {
16106
+ return error("invalid-key", raw, `Invalid blackboard reference key: ${raw}`);
16107
+ }
16108
+ return { ok: true, scope: "local", key: raw };
16109
+ }
16110
+ function parsePortBlackboardReference(input) {
16111
+ const { portName } = input;
16112
+ const rawValue = input.rawValue.trim();
16113
+ if (rawValue === "=" || rawValue === "{=}") {
16114
+ return ok({
16115
+ scope: "local",
16116
+ key: portName,
16117
+ raw: rawValue,
16118
+ syntax: "shorthand"
16119
+ });
16120
+ }
16121
+ if (!rawValue.startsWith("{") && !rawValue.endsWith("}")) {
16122
+ return error("not-a-reference", rawValue, `Not a blackboard reference: ${rawValue}`);
16123
+ }
16124
+ if (!(rawValue.startsWith("{") && rawValue.endsWith("}"))) {
16125
+ return error(
16126
+ "unbalanced-braces",
16127
+ rawValue,
16128
+ `Unbalanced blackboard reference braces: ${rawValue}`
16129
+ );
16130
+ }
16131
+ const body = rawValue.slice(1, -1).trim();
16132
+ const parsed = parseScopedKey(body);
16133
+ if (!parsed.ok) {
16134
+ return parsed;
16135
+ }
16136
+ return ok({
16137
+ scope: parsed.scope,
16138
+ key: parsed.key,
16139
+ raw: rawValue,
16140
+ syntax: "braced"
16141
+ });
16142
+ }
16143
+ function parseScriptBlackboardIdentifier(input) {
16144
+ const { rawName } = input;
16145
+ if (!rawName.startsWith("@")) {
16146
+ return error("not-a-reference", rawName, `Not a script blackboard identifier: ${rawName}`);
16147
+ }
16148
+ const parsed = parseScopedKey(rawName);
16149
+ if (!parsed.ok) {
16150
+ return parsed;
16151
+ }
16152
+ if (parsed.scope !== "global") {
16153
+ return error(
16154
+ "not-a-reference",
16155
+ rawName,
16156
+ `Script blackboard identifiers must use the global scope marker: ${rawName}`
16157
+ );
16158
+ }
16159
+ return ok({
16160
+ scope: parsed.scope,
16161
+ key: parsed.key,
16162
+ raw: rawName,
16163
+ syntax: "script"
16164
+ });
16165
+ }
16166
+ function formatBlackboardReference(reference) {
16167
+ return reference.scope === "global" ? `{@${reference.key}}` : `{${reference.key}}`;
16168
+ }
16169
+ function makeBlackboardIdentity(reference) {
16170
+ return `${reference.scope}:${reference.key}`;
16171
+ }
16172
+
16072
16173
  // ../model/src/model.ts
16073
16174
  var BTCPP_DIAGNOSTIC_CODES = {
16074
16175
  DuplicateNodeModelId: "BT006_DUPLICATE_NODE_MODEL_ID"
@@ -16096,31 +16197,76 @@ function toPortSource(document, fallback = "inline-tree-nodes-model") {
16096
16197
  if (document.kind === "model-document") return "external-tree-nodes-model";
16097
16198
  return fallback;
16098
16199
  }
16099
- function collectBlackboardReferences(element, refs, uri) {
16200
+ function advancePosition(start, text) {
16201
+ let line = start.line;
16202
+ let character = start.character;
16203
+ let offset = start.offset;
16204
+ for (const char of text) {
16205
+ offset += char.length;
16206
+ if (char === "\n") {
16207
+ line += 1;
16208
+ character = 0;
16209
+ continue;
16210
+ }
16211
+ character += char.length;
16212
+ }
16213
+ return { line, character, offset };
16214
+ }
16215
+ function rangeFromRawText(start, prefix, text) {
16216
+ const rangeStart = advancePosition(start, prefix);
16217
+ const rangeEnd = advancePosition(rangeStart, text);
16218
+ return {
16219
+ start: rangeStart,
16220
+ end: rangeEnd
16221
+ };
16222
+ }
16223
+ function collectBlackboardReferences(element, refs, uri, documentText) {
16100
16224
  for (const attr of element.attributes || []) {
16101
- const matches = [...String(attr.value).matchAll(/\{([^}]+)\}/g)];
16102
- for (const match of matches) {
16103
- const index = match.index ?? 0;
16104
- const start = attr.valueRange.start;
16105
- const end = {
16106
- ...start,
16107
- character: start.character + match[0].length,
16108
- offset: start.offset + index + match[0].length
16109
- };
16225
+ const baseRange = attr.valueContentRange ?? attr.valueRange;
16226
+ const rawValue = documentText.slice(baseRange.start.offset, baseRange.end.offset);
16227
+ const collectParsedReference = (input) => {
16228
+ const parsed = parsePortBlackboardReference({
16229
+ portName: attr.name,
16230
+ rawValue: input.parsedRaw
16231
+ });
16232
+ if (!parsed.ok) return;
16233
+ const referenceLength = parsed.reference.raw.length;
16110
16234
  refs.push({
16111
- name: match[1],
16235
+ raw: parsed.reference.raw,
16236
+ key: parsed.reference.key,
16237
+ scope: parsed.reference.scope,
16238
+ identity: makeBlackboardIdentity(parsed.reference),
16239
+ syntax: parsed.reference.syntax,
16112
16240
  attributeName: attr.name,
16113
16241
  element,
16114
16242
  uri,
16115
- range: {
16116
- start: { ...start, character: start.character + index, offset: start.offset + index },
16117
- end
16118
- }
16243
+ range: rangeFromRawText(
16244
+ baseRange.start,
16245
+ rawValue.slice(0, input.parsedOffset),
16246
+ parsed.reference.raw.slice(0, referenceLength)
16247
+ )
16119
16248
  });
16249
+ };
16250
+ const parsedWhole = parsePortBlackboardReference({
16251
+ portName: attr.name,
16252
+ rawValue
16253
+ });
16254
+ if (parsedWhole.ok) {
16255
+ const parsedOffset = Math.max(0, rawValue.indexOf(parsedWhole.reference.raw));
16256
+ collectParsedReference({
16257
+ parsedRaw: parsedWhole.reference.raw,
16258
+ parsedOffset
16259
+ });
16260
+ continue;
16261
+ }
16262
+ for (const match of rawValue.matchAll(/\{[^}]*\}/g)) {
16263
+ const parsedRaw = match[0];
16264
+ const parsedOffset = match.index ?? 0;
16265
+ collectParsedReference({ parsedRaw, parsedOffset });
16120
16266
  }
16121
16267
  }
16122
16268
  for (const child of element.children || []) {
16123
- if (child.kind === "element") collectBlackboardReferences(child, refs, uri);
16269
+ if (child.kind === "element") collectBlackboardReferences(child, refs, uri, documentText);
16124
16270
  }
16125
16271
  }
16126
16272
  function extractTreeNodesModel(element, uri, source, editable) {
@@ -16198,8 +16344,10 @@ function extractBehaviorTrees(root, uri) {
16198
16344
  }
16199
16345
  function extractSubTreeReferences(root, uri) {
16200
16346
  const refs = [];
16201
- const walk2 = (node, parentBehaviorTreeId) => {
16347
+ const walk2 = (node, parentBehaviorTreeId, inTreeNodesModel = false) => {
16348
+ if (inTreeNodesModel) return;
16202
16349
  const currentBehaviorTreeId = node.name === "BehaviorTree" ? getAttr(node, "ID")?.value ?? parentBehaviorTreeId : parentBehaviorTreeId;
16350
+ const nextInTreeNodesModel = node.name === "TreeNodesModel";
16203
16351
  if (node.name === "SubTree") {
16204
16352
  const idAttr = getAttr(node, "ID");
16205
16353
  if (idAttr) {
@@ -16216,9 +16364,10 @@ function extractSubTreeReferences(root, uri) {
16216
16364
  }
16217
16365
  }
16218
16366
  for (const child of node.children || []) {
16219
- if (child.kind === "element") walk2(child, currentBehaviorTreeId);
16367
+ if (child.kind === "element") walk2(child, currentBehaviorTreeId, nextInTreeNodesModel);
16220
16368
  }
16221
16369
  };
16370
+ if (root.name === "TreeNodesModel") return refs;
16222
16371
  for (const child of root.children || []) {
16223
16372
  if (child.kind === "element") walk2(child);
16224
16373
  }
@@ -16277,9 +16426,23 @@ function stripSubTreeReferenceAst(def) {
16277
16426
  parentBehaviorTreeId: def.parentBehaviorTreeId
16278
16427
  };
16279
16428
  }
16429
+ function stripNodeUsageAst(def) {
16430
+ return {
16431
+ id: def.id,
16432
+ uri: def.uri,
16433
+ kind: def.kind,
16434
+ range: def.range,
16435
+ elementRange: def.elementRange,
16436
+ parentBehaviorTreeId: def.parentBehaviorTreeId
16437
+ };
16438
+ }
16280
16439
  function stripBlackboardReferenceAst(def) {
16281
16440
  return {
16282
- name: def.name,
16441
+ raw: def.raw,
16442
+ key: def.key,
16443
+ scope: def.scope,
16444
+ identity: def.identity,
16445
+ syntax: def.syntax,
16283
16446
  attributeName: def.attributeName,
16284
16447
  uri: def.uri,
16285
16448
  range: def.range
@@ -16293,12 +16456,56 @@ function toPublicDocumentModel(input) {
16293
16456
  kind: input.kind,
16294
16457
  behaviorTrees: input.behaviorTrees.map(stripBehaviorTreeAst),
16295
16458
  subtreeReferences: input.subtreeReferences.map(stripSubTreeReferenceAst),
16459
+ nodeUsages: input.nodeUsages.map(stripNodeUsageAst),
16296
16460
  blackboardReferences: input.blackboardReferences.map(stripBlackboardReferenceAst),
16297
16461
  treeNodesModel: input.treeNodesModel.map(stripTreeNodeModelAst),
16298
16462
  genericSubTreePorts: input.genericSubTreePorts.map(stripPortAst),
16299
16463
  rootMainTreeToExecute: cloneAttributeValueRef(input.rootMainTreeToExecute)
16300
16464
  };
16301
16465
  }
16466
+ function extractNodeUsages(root, uri) {
16467
+ if (root.name === "TreeNodesModel") return [];
16468
+ const usages = [];
16469
+ const walk2 = (node, parentBehaviorTreeId, inTreeNodesModel = false) => {
16470
+ if (inTreeNodesModel) return;
16471
+ const nextInTreeNodesModel = node.name === "TreeNodesModel";
16472
+ const currentBehaviorTreeId = node.name === "BehaviorTree" ? getAttr(node, "ID")?.value ?? parentBehaviorTreeId : parentBehaviorTreeId;
16473
+ const isInsideBehaviorTree = currentBehaviorTreeId !== void 0;
16474
+ if (node.name === "SubTree") {
16475
+ const idAttr = getAttr(node, "ID");
16476
+ if (idAttr && isInsideBehaviorTree) {
16477
+ usages.push({
16478
+ id: idAttr.value,
16479
+ kind: "SubTree",
16480
+ uri,
16481
+ range: node.range,
16482
+ elementRange: node.range,
16483
+ parentBehaviorTreeId: currentBehaviorTreeId
16484
+ });
16485
+ }
16486
+ } else if (isInsideBehaviorTree && node.name !== "root" && node.name !== "BehaviorTree" && node.name !== "TreeNodesModel") {
16487
+ usages.push({
16488
+ id: node.name,
16489
+ kind: "node",
16490
+ uri,
16491
+ range: node.range,
16492
+ elementRange: node.range,
16493
+ parentBehaviorTreeId: currentBehaviorTreeId
16494
+ });
16495
+ }
16496
+ for (const child of node.children || []) {
16497
+ if (child.kind === "element") {
16498
+ walk2(child, currentBehaviorTreeId, nextInTreeNodesModel);
16499
+ }
16500
+ }
16501
+ };
16502
+ for (const child of root.children || []) {
16503
+ if (child.kind === "element") {
16504
+ walk2(child);
16505
+ }
16506
+ }
16507
+ return usages;
16508
+ }
16302
16509
  function addTreeNodeModelToCollections(input) {
16303
16510
  if (input.node.kind === "SubTree" && input.node.id === "SubTree") {
16304
16511
  input.genericSubTreePorts.push(...input.node.ports);
@@ -16338,7 +16545,11 @@ function extractDocumentModel(document, options) {
16338
16545
  const blockModels = extractTreeNodesModel(block, uri, source, editable);
16339
16546
  const seenInBlock = /* @__PURE__ */ new Map();
16340
16547
  for (const model of blockModels) {
16341
- if (addTreeNodeModelToCollections({ node: model, treeNodesModel, genericSubTreePorts })) {
16548
+ if (addTreeNodeModelToCollections({
16549
+ node: model,
16550
+ treeNodesModel,
16551
+ genericSubTreePorts
16552
+ })) {
16342
16553
  continue;
16343
16554
  }
16344
16555
  if (seenInBlock.has(model.id)) diagnostics.push(createDuplicateNodeModelDiagnostic(model));
@@ -16346,9 +16557,10 @@ function extractDocumentModel(document, options) {
16346
16557
  }
16347
16558
  }
16348
16559
  const subtreeReferences = root ? extractSubTreeReferences(root, uri) : [];
16560
+ const nodeUsages = root ? extractNodeUsages(root, uri) : [];
16349
16561
  const blackboardReferences = root ? (() => {
16350
16562
  const refs = [];
16351
- collectBlackboardReferences(root, refs, uri);
16563
+ collectBlackboardReferences(root, refs, uri, document.originalText);
16352
16564
  return refs;
16353
16565
  })() : [];
16354
16566
  const rootMainTreeToExecute = root ? getAttr(root, "main_tree_to_execute") : void 0;
@@ -16359,10 +16571,15 @@ function extractDocumentModel(document, options) {
16359
16571
  kind,
16360
16572
  behaviorTrees,
16361
16573
  subtreeReferences,
16574
+ nodeUsages,
16362
16575
  blackboardReferences,
16363
16576
  treeNodesModel,
16364
16577
  genericSubTreePorts,
16365
- rootMainTreeToExecute: rootMainTreeToExecute ? { uri, range: rootMainTreeToExecute.range, value: rootMainTreeToExecute.value } : void 0
16578
+ rootMainTreeToExecute: rootMainTreeToExecute ? {
16579
+ uri,
16580
+ range: rootMainTreeToExecute.range,
16581
+ value: rootMainTreeToExecute.value
16582
+ } : void 0
16366
16583
  });
16367
16584
  return {
16368
16585
  extracted: {
@@ -16694,35 +16911,6 @@ function areTypesCompatible(registry2, left, right) {
16694
16911
  }
16695
16912
  return leftType.compatibleWith.includes(rightType.canonical) || rightType.compatibleWith.includes(leftType.canonical);
16696
16913
  }
16697
- function isBlackboardPointer(value, strippedPointer) {
16698
- if (value.length < 3) {
16699
- return false;
16700
- }
16701
- let frontIndex = 0;
16702
- let lastIndex = value.length - 1;
16703
- while (frontIndex <= lastIndex && value[frontIndex] === " ") {
16704
- frontIndex += 1;
16705
- }
16706
- while (frontIndex <= lastIndex && value[lastIndex] === " ") {
16707
- lastIndex -= 1;
16708
- }
16709
- const size = lastIndex - frontIndex + 1;
16710
- const valid = size >= 3 && value[frontIndex] === "{" && value[lastIndex] === "}";
16711
- if (valid && strippedPointer) {
16712
- strippedPointer.current = value.slice(frontIndex + 1, lastIndex);
16713
- }
16714
- return valid;
16715
- }
16716
- function stripBlackboardPointer(value) {
16717
- const strippedPointer = {};
16718
- return isBlackboardPointer(value, strippedPointer) ? strippedPointer.current : void 0;
16719
- }
16720
- function getRemappedKey(portName, rawValue) {
16721
- if (rawValue === "{=}" || rawValue === "=") {
16722
- return portName;
16723
- }
16724
- return stripBlackboardPointer(rawValue);
16725
- }
16726
16914
 
16727
16915
  // ../model/src/generated/btcpp-v4.6.2-builtins.ts
16728
16916
  var btcppV4_6_2BuiltinModels = [
@@ -19254,8 +19442,8 @@ function parse(text, errors = [], options = ParseOptions.DEFAULT) {
19254
19442
  currentParent = previousParents.pop();
19255
19443
  },
19256
19444
  onLiteralValue: onValue,
19257
- onError: (error51, offset, length) => {
19258
- errors.push({ error: error51, offset, length });
19445
+ onError: (error52, offset, length) => {
19446
+ errors.push({ error: error52, offset, length });
19259
19447
  }
19260
19448
  };
19261
19449
  visit(text, visitor, options);
@@ -19308,8 +19496,8 @@ function parseTree(text, errors = [], options = ParseOptions.DEFAULT) {
19308
19496
  }
19309
19497
  }
19310
19498
  },
19311
- onError: (error51, offset, length) => {
19312
- errors.push({ error: error51, offset, length });
19499
+ onError: (error52, offset, length) => {
19500
+ errors.push({ error: error52, offset, length });
19313
19501
  }
19314
19502
  };
19315
19503
  visit(text, visitor, options);
@@ -19457,8 +19645,8 @@ function visit(text, visitor, options = ParseOptions.DEFAULT) {
19457
19645
  }
19458
19646
  }
19459
19647
  }
19460
- function handleError(error51, skipUntilAfter = [], skipUntil = []) {
19461
- onError(error51);
19648
+ function handleError(error52, skipUntilAfter = [], skipUntil = []) {
19649
+ onError(error52);
19462
19650
  if (skipUntilAfter.length + skipUntil.length > 0) {
19463
19651
  let token = _scanner.getToken();
19464
19652
  while (token !== 17) {
@@ -21044,10 +21232,10 @@ var initializer = (inst, def) => {
21044
21232
  };
21045
21233
  var $ZodError = $constructor("$ZodError", initializer);
21046
21234
  var $ZodRealError = $constructor("$ZodError", initializer, { Parent: Error });
21047
- function flattenError(error51, mapper = (issue2) => issue2.message) {
21235
+ function flattenError(error52, mapper = (issue2) => issue2.message) {
21048
21236
  const fieldErrors = {};
21049
21237
  const formErrors = [];
21050
- for (const sub of error51.issues) {
21238
+ for (const sub of error52.issues) {
21051
21239
  if (sub.path.length > 0) {
21052
21240
  fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
21053
21241
  fieldErrors[sub.path[0]].push(mapper(sub));
@@ -21057,10 +21245,10 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
21057
21245
  }
21058
21246
  return { formErrors, fieldErrors };
21059
21247
  }
21060
- function formatError(error51, mapper = (issue2) => issue2.message) {
21248
+ function formatError(error52, mapper = (issue2) => issue2.message) {
21061
21249
  const fieldErrors = { _errors: [] };
21062
- const processError = (error52, path4 = []) => {
21063
- for (const issue2 of error52.issues) {
21250
+ const processError = (error53, path4 = []) => {
21251
+ for (const issue2 of error53.issues) {
21064
21252
  if (issue2.code === "invalid_union" && issue2.errors.length) {
21065
21253
  issue2.errors.map((issues) => processError({ issues }, [...path4, ...issue2.path]));
21066
21254
  } else if (issue2.code === "invalid_key") {
@@ -21090,14 +21278,14 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
21090
21278
  }
21091
21279
  }
21092
21280
  };
21093
- processError(error51);
21281
+ processError(error52);
21094
21282
  return fieldErrors;
21095
21283
  }
21096
- function treeifyError(error51, mapper = (issue2) => issue2.message) {
21284
+ function treeifyError(error52, mapper = (issue2) => issue2.message) {
21097
21285
  const result = { errors: [] };
21098
- const processError = (error52, path4 = []) => {
21286
+ const processError = (error53, path4 = []) => {
21099
21287
  var _a3, _b;
21100
- for (const issue2 of error52.issues) {
21288
+ for (const issue2 of error53.issues) {
21101
21289
  if (issue2.code === "invalid_union" && issue2.errors.length) {
21102
21290
  issue2.errors.map((issues) => processError({ issues }, [...path4, ...issue2.path]));
21103
21291
  } else if (issue2.code === "invalid_key") {
@@ -21132,7 +21320,7 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
21132
21320
  }
21133
21321
  }
21134
21322
  };
21135
- processError(error51);
21323
+ processError(error52);
21136
21324
  return result;
21137
21325
  }
21138
21326
  function toDotPath(_path) {
@@ -21153,9 +21341,9 @@ function toDotPath(_path) {
21153
21341
  }
21154
21342
  return segs.join("");
21155
21343
  }
21156
- function prettifyError(error51) {
21344
+ function prettifyError(error52) {
21157
21345
  const lines = [];
21158
- const issues = [...error51.issues].sort((a, b) => (a.path ?? []).length - (b.path ?? []).length);
21346
+ const issues = [...error52.issues].sort((a, b) => (a.path ?? []).length - (b.path ?? []).length);
21159
21347
  for (const issue2 of issues) {
21160
21348
  lines.push(`\u2716 ${issue2.message}`);
21161
21349
  if (issue2.path?.length)
@@ -24153,7 +24341,7 @@ __export(locales_exports, {
24153
24341
  });
24154
24342
 
24155
24343
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ar.js
24156
- var error = () => {
24344
+ var error2 = () => {
24157
24345
  const Sizable = {
24158
24346
  string: { unit: "\u062D\u0631\u0641", verb: "\u0623\u0646 \u064A\u062D\u0648\u064A" },
24159
24347
  file: { unit: "\u0628\u0627\u064A\u062A", verb: "\u0623\u0646 \u064A\u062D\u0648\u064A" },
@@ -24255,12 +24443,12 @@ var error = () => {
24255
24443
  };
24256
24444
  function ar_default() {
24257
24445
  return {
24258
- localeError: error()
24446
+ localeError: error2()
24259
24447
  };
24260
24448
  }
24261
24449
 
24262
24450
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/az.js
24263
- var error2 = () => {
24451
+ var error3 = () => {
24264
24452
  const Sizable = {
24265
24453
  string: { unit: "simvol", verb: "olmal\u0131d\u0131r" },
24266
24454
  file: { unit: "bayt", verb: "olmal\u0131d\u0131r" },
@@ -24361,7 +24549,7 @@ var error2 = () => {
24361
24549
  };
24362
24550
  function az_default() {
24363
24551
  return {
24364
- localeError: error2()
24552
+ localeError: error3()
24365
24553
  };
24366
24554
  }
24367
24555
 
@@ -24381,7 +24569,7 @@ function getBelarusianPlural(count, one, few, many) {
24381
24569
  }
24382
24570
  return many;
24383
24571
  }
24384
- var error3 = () => {
24572
+ var error4 = () => {
24385
24573
  const Sizable = {
24386
24574
  string: {
24387
24575
  unit: {
@@ -24518,12 +24706,12 @@ var error3 = () => {
24518
24706
  };
24519
24707
  function be_default() {
24520
24708
  return {
24521
- localeError: error3()
24709
+ localeError: error4()
24522
24710
  };
24523
24711
  }
24524
24712
 
24525
24713
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/bg.js
24526
- var error4 = () => {
24714
+ var error5 = () => {
24527
24715
  const Sizable = {
24528
24716
  string: { unit: "\u0441\u0438\u043C\u0432\u043E\u043B\u0430", verb: "\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430" },
24529
24717
  file: { unit: "\u0431\u0430\u0439\u0442\u0430", verb: "\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430" },
@@ -24639,12 +24827,12 @@ var error4 = () => {
24639
24827
  };
24640
24828
  function bg_default() {
24641
24829
  return {
24642
- localeError: error4()
24830
+ localeError: error5()
24643
24831
  };
24644
24832
  }
24645
24833
 
24646
24834
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ca.js
24647
- var error5 = () => {
24835
+ var error6 = () => {
24648
24836
  const Sizable = {
24649
24837
  string: { unit: "car\xE0cters", verb: "contenir" },
24650
24838
  file: { unit: "bytes", verb: "contenir" },
@@ -24748,12 +24936,12 @@ var error5 = () => {
24748
24936
  };
24749
24937
  function ca_default() {
24750
24938
  return {
24751
- localeError: error5()
24939
+ localeError: error6()
24752
24940
  };
24753
24941
  }
24754
24942
 
24755
24943
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/cs.js
24756
- var error6 = () => {
24944
+ var error7 = () => {
24757
24945
  const Sizable = {
24758
24946
  string: { unit: "znak\u016F", verb: "m\xEDt" },
24759
24947
  file: { unit: "bajt\u016F", verb: "m\xEDt" },
@@ -24860,12 +25048,12 @@ var error6 = () => {
24860
25048
  };
24861
25049
  function cs_default() {
24862
25050
  return {
24863
- localeError: error6()
25051
+ localeError: error7()
24864
25052
  };
24865
25053
  }
24866
25054
 
24867
25055
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/da.js
24868
- var error7 = () => {
25056
+ var error8 = () => {
24869
25057
  const Sizable = {
24870
25058
  string: { unit: "tegn", verb: "havde" },
24871
25059
  file: { unit: "bytes", verb: "havde" },
@@ -24976,12 +25164,12 @@ var error7 = () => {
24976
25164
  };
24977
25165
  function da_default() {
24978
25166
  return {
24979
- localeError: error7()
25167
+ localeError: error8()
24980
25168
  };
24981
25169
  }
24982
25170
 
24983
25171
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/de.js
24984
- var error8 = () => {
25172
+ var error9 = () => {
24985
25173
  const Sizable = {
24986
25174
  string: { unit: "Zeichen", verb: "zu haben" },
24987
25175
  file: { unit: "Bytes", verb: "zu haben" },
@@ -25085,12 +25273,12 @@ var error8 = () => {
25085
25273
  };
25086
25274
  function de_default() {
25087
25275
  return {
25088
- localeError: error8()
25276
+ localeError: error9()
25089
25277
  };
25090
25278
  }
25091
25279
 
25092
25280
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/el.js
25093
- var error9 = () => {
25281
+ var error10 = () => {
25094
25282
  const Sizable = {
25095
25283
  string: { unit: "\u03C7\u03B1\u03C1\u03B1\u03BA\u03C4\u03AE\u03C1\u03B5\u03C2", verb: "\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9" },
25096
25284
  file: { unit: "bytes", verb: "\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9" },
@@ -25195,12 +25383,12 @@ var error9 = () => {
25195
25383
  };
25196
25384
  function el_default() {
25197
25385
  return {
25198
- localeError: error9()
25386
+ localeError: error10()
25199
25387
  };
25200
25388
  }
25201
25389
 
25202
25390
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/en.js
25203
- var error10 = () => {
25391
+ var error11 = () => {
25204
25392
  const Sizable = {
25205
25393
  string: { unit: "characters", verb: "to have" },
25206
25394
  file: { unit: "bytes", verb: "to have" },
@@ -25308,12 +25496,12 @@ var error10 = () => {
25308
25496
  };
25309
25497
  function en_default() {
25310
25498
  return {
25311
- localeError: error10()
25499
+ localeError: error11()
25312
25500
  };
25313
25501
  }
25314
25502
 
25315
25503
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/eo.js
25316
- var error11 = () => {
25504
+ var error12 = () => {
25317
25505
  const Sizable = {
25318
25506
  string: { unit: "karaktrojn", verb: "havi" },
25319
25507
  file: { unit: "bajtojn", verb: "havi" },
@@ -25418,12 +25606,12 @@ var error11 = () => {
25418
25606
  };
25419
25607
  function eo_default() {
25420
25608
  return {
25421
- localeError: error11()
25609
+ localeError: error12()
25422
25610
  };
25423
25611
  }
25424
25612
 
25425
25613
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/es.js
25426
- var error12 = () => {
25614
+ var error13 = () => {
25427
25615
  const Sizable = {
25428
25616
  string: { unit: "caracteres", verb: "tener" },
25429
25617
  file: { unit: "bytes", verb: "tener" },
@@ -25551,12 +25739,12 @@ var error12 = () => {
25551
25739
  };
25552
25740
  function es_default() {
25553
25741
  return {
25554
- localeError: error12()
25742
+ localeError: error13()
25555
25743
  };
25556
25744
  }
25557
25745
 
25558
25746
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/fa.js
25559
- var error13 = () => {
25747
+ var error14 = () => {
25560
25748
  const Sizable = {
25561
25749
  string: { unit: "\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631", verb: "\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F" },
25562
25750
  file: { unit: "\u0628\u0627\u06CC\u062A", verb: "\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F" },
@@ -25666,12 +25854,12 @@ var error13 = () => {
25666
25854
  };
25667
25855
  function fa_default() {
25668
25856
  return {
25669
- localeError: error13()
25857
+ localeError: error14()
25670
25858
  };
25671
25859
  }
25672
25860
 
25673
25861
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/fi.js
25674
- var error14 = () => {
25862
+ var error15 = () => {
25675
25863
  const Sizable = {
25676
25864
  string: { unit: "merkki\xE4", subject: "merkkijonon" },
25677
25865
  file: { unit: "tavua", subject: "tiedoston" },
@@ -25779,12 +25967,12 @@ var error14 = () => {
25779
25967
  };
25780
25968
  function fi_default() {
25781
25969
  return {
25782
- localeError: error14()
25970
+ localeError: error15()
25783
25971
  };
25784
25972
  }
25785
25973
 
25786
25974
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/fr.js
25787
- var error15 = () => {
25975
+ var error16 = () => {
25788
25976
  const Sizable = {
25789
25977
  string: { unit: "caract\xE8res", verb: "avoir" },
25790
25978
  file: { unit: "octets", verb: "avoir" },
@@ -25905,12 +26093,12 @@ var error15 = () => {
25905
26093
  };
25906
26094
  function fr_default() {
25907
26095
  return {
25908
- localeError: error15()
26096
+ localeError: error16()
25909
26097
  };
25910
26098
  }
25911
26099
 
25912
26100
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/fr-CA.js
25913
- var error16 = () => {
26101
+ var error17 = () => {
25914
26102
  const Sizable = {
25915
26103
  string: { unit: "caract\xE8res", verb: "avoir" },
25916
26104
  file: { unit: "octets", verb: "avoir" },
@@ -26013,12 +26201,12 @@ var error16 = () => {
26013
26201
  };
26014
26202
  function fr_CA_default() {
26015
26203
  return {
26016
- localeError: error16()
26204
+ localeError: error17()
26017
26205
  };
26018
26206
  }
26019
26207
 
26020
26208
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/he.js
26021
- var error17 = () => {
26209
+ var error18 = () => {
26022
26210
  const TypeNames = {
26023
26211
  string: { label: "\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA", gender: "f" },
26024
26212
  number: { label: "\u05DE\u05E1\u05E4\u05E8", gender: "m" },
@@ -26208,12 +26396,12 @@ var error17 = () => {
26208
26396
  };
26209
26397
  function he_default() {
26210
26398
  return {
26211
- localeError: error17()
26399
+ localeError: error18()
26212
26400
  };
26213
26401
  }
26214
26402
 
26215
26403
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/hr.js
26216
- var error18 = () => {
26404
+ var error19 = () => {
26217
26405
  const Sizable = {
26218
26406
  string: { unit: "znakova", verb: "imati" },
26219
26407
  file: { unit: "bajtova", verb: "imati" },
@@ -26331,12 +26519,12 @@ var error18 = () => {
26331
26519
  };
26332
26520
  function hr_default() {
26333
26521
  return {
26334
- localeError: error18()
26522
+ localeError: error19()
26335
26523
  };
26336
26524
  }
26337
26525
 
26338
26526
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/hu.js
26339
- var error19 = () => {
26527
+ var error20 = () => {
26340
26528
  const Sizable = {
26341
26529
  string: { unit: "karakter", verb: "legyen" },
26342
26530
  file: { unit: "byte", verb: "legyen" },
@@ -26440,7 +26628,7 @@ var error19 = () => {
26440
26628
  };
26441
26629
  function hu_default() {
26442
26630
  return {
26443
- localeError: error19()
26631
+ localeError: error20()
26444
26632
  };
26445
26633
  }
26446
26634
 
@@ -26455,7 +26643,7 @@ function withDefiniteArticle(word) {
26455
26643
  const lastChar = word[word.length - 1];
26456
26644
  return word + (vowels.includes(lastChar) ? "\u0576" : "\u0568");
26457
26645
  }
26458
- var error20 = () => {
26646
+ var error21 = () => {
26459
26647
  const Sizable = {
26460
26648
  string: {
26461
26649
  unit: {
@@ -26588,12 +26776,12 @@ var error20 = () => {
26588
26776
  };
26589
26777
  function hy_default() {
26590
26778
  return {
26591
- localeError: error20()
26779
+ localeError: error21()
26592
26780
  };
26593
26781
  }
26594
26782
 
26595
26783
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/id.js
26596
- var error21 = () => {
26784
+ var error22 = () => {
26597
26785
  const Sizable = {
26598
26786
  string: { unit: "karakter", verb: "memiliki" },
26599
26787
  file: { unit: "byte", verb: "memiliki" },
@@ -26695,12 +26883,12 @@ var error21 = () => {
26695
26883
  };
26696
26884
  function id_default() {
26697
26885
  return {
26698
- localeError: error21()
26886
+ localeError: error22()
26699
26887
  };
26700
26888
  }
26701
26889
 
26702
26890
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/is.js
26703
- var error22 = () => {
26891
+ var error23 = () => {
26704
26892
  const Sizable = {
26705
26893
  string: { unit: "stafi", verb: "a\xF0 hafa" },
26706
26894
  file: { unit: "b\xE6ti", verb: "a\xF0 hafa" },
@@ -26805,12 +26993,12 @@ var error22 = () => {
26805
26993
  };
26806
26994
  function is_default() {
26807
26995
  return {
26808
- localeError: error22()
26996
+ localeError: error23()
26809
26997
  };
26810
26998
  }
26811
26999
 
26812
27000
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/it.js
26813
- var error23 = () => {
27001
+ var error24 = () => {
26814
27002
  const Sizable = {
26815
27003
  string: { unit: "caratteri", verb: "avere" },
26816
27004
  file: { unit: "byte", verb: "avere" },
@@ -26914,12 +27102,12 @@ var error23 = () => {
26914
27102
  };
26915
27103
  function it_default() {
26916
27104
  return {
26917
- localeError: error23()
27105
+ localeError: error24()
26918
27106
  };
26919
27107
  }
26920
27108
 
26921
27109
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ja.js
26922
- var error24 = () => {
27110
+ var error25 = () => {
26923
27111
  const Sizable = {
26924
27112
  string: { unit: "\u6587\u5B57", verb: "\u3067\u3042\u308B" },
26925
27113
  file: { unit: "\u30D0\u30A4\u30C8", verb: "\u3067\u3042\u308B" },
@@ -27022,12 +27210,12 @@ var error24 = () => {
27022
27210
  };
27023
27211
  function ja_default() {
27024
27212
  return {
27025
- localeError: error24()
27213
+ localeError: error25()
27026
27214
  };
27027
27215
  }
27028
27216
 
27029
27217
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ka.js
27030
- var error25 = () => {
27218
+ var error26 = () => {
27031
27219
  const Sizable = {
27032
27220
  string: { unit: "\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD", verb: "\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1" },
27033
27221
  file: { unit: "\u10D1\u10D0\u10D8\u10E2\u10D8", verb: "\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1" },
@@ -27135,12 +27323,12 @@ var error25 = () => {
27135
27323
  };
27136
27324
  function ka_default() {
27137
27325
  return {
27138
- localeError: error25()
27326
+ localeError: error26()
27139
27327
  };
27140
27328
  }
27141
27329
 
27142
27330
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/km.js
27143
- var error26 = () => {
27331
+ var error27 = () => {
27144
27332
  const Sizable = {
27145
27333
  string: { unit: "\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A", verb: "\u1782\u17BD\u179A\u1798\u17B6\u1793" },
27146
27334
  file: { unit: "\u1794\u17C3", verb: "\u1782\u17BD\u179A\u1798\u17B6\u1793" },
@@ -27246,7 +27434,7 @@ var error26 = () => {
27246
27434
  };
27247
27435
  function km_default() {
27248
27436
  return {
27249
- localeError: error26()
27437
+ localeError: error27()
27250
27438
  };
27251
27439
  }
27252
27440
 
@@ -27256,7 +27444,7 @@ function kh_default() {
27256
27444
  }
27257
27445
 
27258
27446
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ko.js
27259
- var error27 = () => {
27447
+ var error28 = () => {
27260
27448
  const Sizable = {
27261
27449
  string: { unit: "\uBB38\uC790", verb: "to have" },
27262
27450
  file: { unit: "\uBC14\uC774\uD2B8", verb: "to have" },
@@ -27363,7 +27551,7 @@ var error27 = () => {
27363
27551
  };
27364
27552
  function ko_default() {
27365
27553
  return {
27366
- localeError: error27()
27554
+ localeError: error28()
27367
27555
  };
27368
27556
  }
27369
27557
 
@@ -27381,7 +27569,7 @@ function getUnitTypeFromNumber(number4) {
27381
27569
  return "one";
27382
27570
  return "few";
27383
27571
  }
27384
- var error28 = () => {
27572
+ var error29 = () => {
27385
27573
  const Sizable = {
27386
27574
  string: {
27387
27575
  unit: {
@@ -27567,12 +27755,12 @@ var error28 = () => {
27567
27755
  };
27568
27756
  function lt_default() {
27569
27757
  return {
27570
- localeError: error28()
27758
+ localeError: error29()
27571
27759
  };
27572
27760
  }
27573
27761
 
27574
27762
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/mk.js
27575
- var error29 = () => {
27763
+ var error30 = () => {
27576
27764
  const Sizable = {
27577
27765
  string: { unit: "\u0437\u043D\u0430\u0446\u0438", verb: "\u0434\u0430 \u0438\u043C\u0430\u0430\u0442" },
27578
27766
  file: { unit: "\u0431\u0430\u0458\u0442\u0438", verb: "\u0434\u0430 \u0438\u043C\u0430\u0430\u0442" },
@@ -27677,12 +27865,12 @@ var error29 = () => {
27677
27865
  };
27678
27866
  function mk_default() {
27679
27867
  return {
27680
- localeError: error29()
27868
+ localeError: error30()
27681
27869
  };
27682
27870
  }
27683
27871
 
27684
27872
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ms.js
27685
- var error30 = () => {
27873
+ var error31 = () => {
27686
27874
  const Sizable = {
27687
27875
  string: { unit: "aksara", verb: "mempunyai" },
27688
27876
  file: { unit: "bait", verb: "mempunyai" },
@@ -27785,12 +27973,12 @@ var error30 = () => {
27785
27973
  };
27786
27974
  function ms_default() {
27787
27975
  return {
27788
- localeError: error30()
27976
+ localeError: error31()
27789
27977
  };
27790
27978
  }
27791
27979
 
27792
27980
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/nl.js
27793
- var error31 = () => {
27981
+ var error32 = () => {
27794
27982
  const Sizable = {
27795
27983
  string: { unit: "tekens", verb: "heeft" },
27796
27984
  file: { unit: "bytes", verb: "heeft" },
@@ -27896,12 +28084,12 @@ var error31 = () => {
27896
28084
  };
27897
28085
  function nl_default() {
27898
28086
  return {
27899
- localeError: error31()
28087
+ localeError: error32()
27900
28088
  };
27901
28089
  }
27902
28090
 
27903
28091
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/no.js
27904
- var error32 = () => {
28092
+ var error33 = () => {
27905
28093
  const Sizable = {
27906
28094
  string: { unit: "tegn", verb: "\xE5 ha" },
27907
28095
  file: { unit: "bytes", verb: "\xE5 ha" },
@@ -28005,12 +28193,12 @@ var error32 = () => {
28005
28193
  };
28006
28194
  function no_default() {
28007
28195
  return {
28008
- localeError: error32()
28196
+ localeError: error33()
28009
28197
  };
28010
28198
  }
28011
28199
 
28012
28200
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ota.js
28013
- var error33 = () => {
28201
+ var error34 = () => {
28014
28202
  const Sizable = {
28015
28203
  string: { unit: "harf", verb: "olmal\u0131d\u0131r" },
28016
28204
  file: { unit: "bayt", verb: "olmal\u0131d\u0131r" },
@@ -28115,12 +28303,12 @@ var error33 = () => {
28115
28303
  };
28116
28304
  function ota_default() {
28117
28305
  return {
28118
- localeError: error33()
28306
+ localeError: error34()
28119
28307
  };
28120
28308
  }
28121
28309
 
28122
28310
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ps.js
28123
- var error34 = () => {
28311
+ var error35 = () => {
28124
28312
  const Sizable = {
28125
28313
  string: { unit: "\u062A\u0648\u06A9\u064A", verb: "\u0648\u0644\u0631\u064A" },
28126
28314
  file: { unit: "\u0628\u0627\u06CC\u067C\u0633", verb: "\u0648\u0644\u0631\u064A" },
@@ -28230,12 +28418,12 @@ var error34 = () => {
28230
28418
  };
28231
28419
  function ps_default() {
28232
28420
  return {
28233
- localeError: error34()
28421
+ localeError: error35()
28234
28422
  };
28235
28423
  }
28236
28424
 
28237
28425
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/pl.js
28238
- var error35 = () => {
28426
+ var error36 = () => {
28239
28427
  const Sizable = {
28240
28428
  string: { unit: "znak\xF3w", verb: "mie\u0107" },
28241
28429
  file: { unit: "bajt\xF3w", verb: "mie\u0107" },
@@ -28340,12 +28528,12 @@ var error35 = () => {
28340
28528
  };
28341
28529
  function pl_default() {
28342
28530
  return {
28343
- localeError: error35()
28531
+ localeError: error36()
28344
28532
  };
28345
28533
  }
28346
28534
 
28347
28535
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/pt.js
28348
- var error36 = () => {
28536
+ var error37 = () => {
28349
28537
  const Sizable = {
28350
28538
  string: { unit: "caracteres", verb: "ter" },
28351
28539
  file: { unit: "bytes", verb: "ter" },
@@ -28449,12 +28637,12 @@ var error36 = () => {
28449
28637
  };
28450
28638
  function pt_default() {
28451
28639
  return {
28452
- localeError: error36()
28640
+ localeError: error37()
28453
28641
  };
28454
28642
  }
28455
28643
 
28456
28644
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ro.js
28457
- var error37 = () => {
28645
+ var error38 = () => {
28458
28646
  const Sizable = {
28459
28647
  string: { unit: "caractere", verb: "s\u0103 aib\u0103" },
28460
28648
  file: { unit: "octe\u021Bi", verb: "s\u0103 aib\u0103" },
@@ -28569,7 +28757,7 @@ var error37 = () => {
28569
28757
  };
28570
28758
  function ro_default() {
28571
28759
  return {
28572
- localeError: error37()
28760
+ localeError: error38()
28573
28761
  };
28574
28762
  }
28575
28763
 
@@ -28589,7 +28777,7 @@ function getRussianPlural(count, one, few, many) {
28589
28777
  }
28590
28778
  return many;
28591
28779
  }
28592
- var error38 = () => {
28780
+ var error39 = () => {
28593
28781
  const Sizable = {
28594
28782
  string: {
28595
28783
  unit: {
@@ -28726,12 +28914,12 @@ var error38 = () => {
28726
28914
  };
28727
28915
  function ru_default() {
28728
28916
  return {
28729
- localeError: error38()
28917
+ localeError: error39()
28730
28918
  };
28731
28919
  }
28732
28920
 
28733
28921
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/sl.js
28734
- var error39 = () => {
28922
+ var error40 = () => {
28735
28923
  const Sizable = {
28736
28924
  string: { unit: "znakov", verb: "imeti" },
28737
28925
  file: { unit: "bajtov", verb: "imeti" },
@@ -28836,12 +29024,12 @@ var error39 = () => {
28836
29024
  };
28837
29025
  function sl_default() {
28838
29026
  return {
28839
- localeError: error39()
29027
+ localeError: error40()
28840
29028
  };
28841
29029
  }
28842
29030
 
28843
29031
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/sv.js
28844
- var error40 = () => {
29032
+ var error41 = () => {
28845
29033
  const Sizable = {
28846
29034
  string: { unit: "tecken", verb: "att ha" },
28847
29035
  file: { unit: "bytes", verb: "att ha" },
@@ -28947,12 +29135,12 @@ var error40 = () => {
28947
29135
  };
28948
29136
  function sv_default() {
28949
29137
  return {
28950
- localeError: error40()
29138
+ localeError: error41()
28951
29139
  };
28952
29140
  }
28953
29141
 
28954
29142
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ta.js
28955
- var error41 = () => {
29143
+ var error42 = () => {
28956
29144
  const Sizable = {
28957
29145
  string: { unit: "\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD", verb: "\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD" },
28958
29146
  file: { unit: "\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD", verb: "\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD" },
@@ -29058,12 +29246,12 @@ var error41 = () => {
29058
29246
  };
29059
29247
  function ta_default() {
29060
29248
  return {
29061
- localeError: error41()
29249
+ localeError: error42()
29062
29250
  };
29063
29251
  }
29064
29252
 
29065
29253
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/th.js
29066
- var error42 = () => {
29254
+ var error43 = () => {
29067
29255
  const Sizable = {
29068
29256
  string: { unit: "\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" },
29069
29257
  file: { unit: "\u0E44\u0E1A\u0E15\u0E4C", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" },
@@ -29169,12 +29357,12 @@ var error42 = () => {
29169
29357
  };
29170
29358
  function th_default() {
29171
29359
  return {
29172
- localeError: error42()
29360
+ localeError: error43()
29173
29361
  };
29174
29362
  }
29175
29363
 
29176
29364
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/tr.js
29177
- var error43 = () => {
29365
+ var error44 = () => {
29178
29366
  const Sizable = {
29179
29367
  string: { unit: "karakter", verb: "olmal\u0131" },
29180
29368
  file: { unit: "bayt", verb: "olmal\u0131" },
@@ -29275,12 +29463,12 @@ var error43 = () => {
29275
29463
  };
29276
29464
  function tr_default() {
29277
29465
  return {
29278
- localeError: error43()
29466
+ localeError: error44()
29279
29467
  };
29280
29468
  }
29281
29469
 
29282
29470
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/uk.js
29283
- var error44 = () => {
29471
+ var error45 = () => {
29284
29472
  const Sizable = {
29285
29473
  string: { unit: "\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" },
29286
29474
  file: { unit: "\u0431\u0430\u0439\u0442\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" },
@@ -29384,7 +29572,7 @@ var error44 = () => {
29384
29572
  };
29385
29573
  function uk_default() {
29386
29574
  return {
29387
- localeError: error44()
29575
+ localeError: error45()
29388
29576
  };
29389
29577
  }
29390
29578
 
@@ -29394,7 +29582,7 @@ function ua_default() {
29394
29582
  }
29395
29583
 
29396
29584
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ur.js
29397
- var error45 = () => {
29585
+ var error46 = () => {
29398
29586
  const Sizable = {
29399
29587
  string: { unit: "\u062D\u0631\u0648\u0641", verb: "\u06C1\u0648\u0646\u0627" },
29400
29588
  file: { unit: "\u0628\u0627\u0626\u0679\u0633", verb: "\u06C1\u0648\u0646\u0627" },
@@ -29500,12 +29688,12 @@ var error45 = () => {
29500
29688
  };
29501
29689
  function ur_default() {
29502
29690
  return {
29503
- localeError: error45()
29691
+ localeError: error46()
29504
29692
  };
29505
29693
  }
29506
29694
 
29507
29695
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/uz.js
29508
- var error46 = () => {
29696
+ var error47 = () => {
29509
29697
  const Sizable = {
29510
29698
  string: { unit: "belgi", verb: "bo\u2018lishi kerak" },
29511
29699
  file: { unit: "bayt", verb: "bo\u2018lishi kerak" },
@@ -29611,12 +29799,12 @@ var error46 = () => {
29611
29799
  };
29612
29800
  function uz_default() {
29613
29801
  return {
29614
- localeError: error46()
29802
+ localeError: error47()
29615
29803
  };
29616
29804
  }
29617
29805
 
29618
29806
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/vi.js
29619
- var error47 = () => {
29807
+ var error48 = () => {
29620
29808
  const Sizable = {
29621
29809
  string: { unit: "k\xFD t\u1EF1", verb: "c\xF3" },
29622
29810
  file: { unit: "byte", verb: "c\xF3" },
@@ -29720,12 +29908,12 @@ var error47 = () => {
29720
29908
  };
29721
29909
  function vi_default() {
29722
29910
  return {
29723
- localeError: error47()
29911
+ localeError: error48()
29724
29912
  };
29725
29913
  }
29726
29914
 
29727
29915
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/zh-CN.js
29728
- var error48 = () => {
29916
+ var error49 = () => {
29729
29917
  const Sizable = {
29730
29918
  string: { unit: "\u5B57\u7B26", verb: "\u5305\u542B" },
29731
29919
  file: { unit: "\u5B57\u8282", verb: "\u5305\u542B" },
@@ -29830,12 +30018,12 @@ var error48 = () => {
29830
30018
  };
29831
30019
  function zh_CN_default() {
29832
30020
  return {
29833
- localeError: error48()
30021
+ localeError: error49()
29834
30022
  };
29835
30023
  }
29836
30024
 
29837
30025
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/zh-TW.js
29838
- var error49 = () => {
30026
+ var error50 = () => {
29839
30027
  const Sizable = {
29840
30028
  string: { unit: "\u5B57\u5143", verb: "\u64C1\u6709" },
29841
30029
  file: { unit: "\u4F4D\u5143\u7D44", verb: "\u64C1\u6709" },
@@ -29938,12 +30126,12 @@ var error49 = () => {
29938
30126
  };
29939
30127
  function zh_TW_default() {
29940
30128
  return {
29941
- localeError: error49()
30129
+ localeError: error50()
29942
30130
  };
29943
30131
  }
29944
30132
 
29945
30133
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/yo.js
29946
- var error50 = () => {
30134
+ var error51 = () => {
29947
30135
  const Sizable = {
29948
30136
  string: { unit: "\xE0mi", verb: "n\xED" },
29949
30137
  file: { unit: "bytes", verb: "n\xED" },
@@ -30046,7 +30234,7 @@ var error50 = () => {
30046
30234
  };
30047
30235
  function yo_default() {
30048
30236
  return {
30049
- localeError: error50()
30237
+ localeError: error51()
30050
30238
  };
30051
30239
  }
30052
30240
 
@@ -34393,7 +34581,7 @@ function parseModelAugmentationFile(text, options) {
34393
34581
  uri,
34394
34582
  path: options?.path
34395
34583
  };
34396
- } catch (error51) {
34584
+ } catch (error52) {
34397
34585
  return {
34398
34586
  ok: false,
34399
34587
  uri,
@@ -34402,7 +34590,7 @@ function parseModelAugmentationFile(text, options) {
34402
34590
  {
34403
34591
  kind: "json",
34404
34592
  message: "the file could not be parsed as JSON",
34405
- notes: [String(error51.message || error51)]
34593
+ notes: [String(error52.message || error52)]
34406
34594
  }
34407
34595
  ]
34408
34596
  };
@@ -34458,12 +34646,14 @@ var resolverConfigSchema = external_exports.object({
34458
34646
  includes: resolverIncludesConfigSchema.optional(),
34459
34647
  behaviorTreeIds: external_exports.enum(["workspace-unique", "file-local-first", "allow-ambiguous"]).optional()
34460
34648
  }).strict();
34649
+ var modelConventionSchema = external_exports.enum(["allow-unused", "used-only", "single-source"]);
34461
34650
  var modelsConfigSchema = external_exports.object({
34462
34651
  builtins: external_exports.array(external_exports.enum(SUPPORTED_BUILTIN_MODEL_SETS)).optional(),
34463
34652
  files: external_exports.array(external_exports.string()).optional(),
34464
34653
  augmentations: external_exports.array(external_exports.string()).optional(),
34465
34654
  definitions: external_exports.array(external_exports.string()).optional(),
34466
- inline: external_exports.record(external_exports.string(), configNodeModelSchema).optional()
34655
+ inline: external_exports.record(external_exports.string(), configNodeModelSchema).optional(),
34656
+ convention: modelConventionSchema.optional()
34467
34657
  }).strict();
34468
34658
  var linterSuppressionsConfigSchema = external_exports.object({
34469
34659
  inline: external_exports.enum(["allow", "deny"]).optional()
@@ -34552,7 +34742,7 @@ function isInvalidValueIssue(issue2) {
34552
34742
  return unionErrors.flat().some(isZodIssueLikeInvalidValue);
34553
34743
  }
34554
34744
  const zodUnionErrors = issue2.unionErrors;
34555
- return Array.isArray(zodUnionErrors) ? zodUnionErrors.flatMap((error51) => error51.issues ?? []).some(isZodIssueLikeInvalidValue) : false;
34745
+ return Array.isArray(zodUnionErrors) ? zodUnionErrors.flatMap((error52) => error52.issues ?? []).some(isZodIssueLikeInvalidValue) : false;
34556
34746
  }
34557
34747
  function isZodIssueLikeInvalidValue(issue2) {
34558
34748
  return typeof issue2 === "object" && issue2 !== null && isInvalidValueIssue(issue2);
@@ -34628,8 +34818,8 @@ function normalizeParsedBtxmlConfig(raw) {
34628
34818
  formatter: normalizeRawFormatterOverrideConfig(override.formatter)
34629
34819
  })
34630
34820
  );
34631
- const ok = !diagnostics.some((d) => d.severity === DiagnosticSeverity.Error);
34632
- return { config: config2, diagnostics, ok };
34821
+ const ok2 = !diagnostics.some((d) => d.severity === DiagnosticSeverity.Error);
34822
+ return { config: config2, diagnostics, ok: ok2 };
34633
34823
  }
34634
34824
  function normalizeBtxmlConfig(raw) {
34635
34825
  const parsed = parseBtxmlConfig(raw);
@@ -34760,6 +34950,7 @@ var RuleCodes = {
34760
34950
  InvalidScriptOperandType: "BT407_INVALID_SCRIPT_OPERAND_TYPE",
34761
34951
  ScriptResultNotBoolCompatible: "BT408_SCRIPT_RESULT_NOT_BOOL_COMPATIBLE",
34762
34952
  ScriptVariableTypeMismatch: "BT410_SCRIPT_VARIABLE_TYPE_MISMATCH",
34953
+ InvalidGlobalBlackboardIdentifier: "BT411_INVALID_GLOBAL_BLACKBOARD_IDENTIFIER",
34763
34954
  InvalidRootElement: "BT001_INVALID_ROOT_ELEMENT",
34764
34955
  MissingBTCPPFormat: "BT002_MISSING_BTCPP_FORMAT",
34765
34956
  MissingBehaviorTreeID: "BT003_MISSING_BEHAVIOR_TREE_ID",
@@ -34799,6 +34990,9 @@ var RuleCodes = {
34799
34990
  AugmentTargetNotFound: "BT117_AUGMENT_TARGET_NOT_FOUND",
34800
34991
  AugmentPortNotFound: "BT118_AUGMENT_PORT_NOT_FOUND",
34801
34992
  InvalidTypeRefinement: "BT119_INVALID_TYPE_REFINEMENT",
34993
+ ConflictingModelKind: "BT120_CONFLICTING_MODEL_KIND",
34994
+ UnusedModelDefinition: "BT121_UNUSED_MODEL_DEFINITION",
34995
+ DuplicateModelDefinition: "BT122_DUPLICATE_MODEL_DEFINITION",
34802
34996
  ExternalModelFileNotFound: "BT321_EXTERNAL_MODEL_FILE_NOT_FOUND",
34803
34997
  AugmentationFileNotFound: "BT324_AUGMENTATION_FILE_NOT_FOUND",
34804
34998
  MissingTreeNodesModel: "BT322_MISSING_TREENODESMODEL",
@@ -34838,7 +35032,8 @@ var RULES = {
34838
35032
  codes: [
34839
35033
  RuleCodes.AssignmentToUnknownVariable,
34840
35034
  RuleCodes.InvalidCompoundAssignment,
34841
- RuleCodes.ScriptVariableTypeMismatch
35035
+ RuleCodes.ScriptVariableTypeMismatch,
35036
+ RuleCodes.InvalidGlobalBlackboardIdentifier
34842
35037
  ],
34843
35038
  defaultSeverity: "error",
34844
35039
  description: "Script assignments must target known variables and use compatible types."
@@ -35041,6 +35236,21 @@ var RULES = {
35041
35236
  defaultSeverity: "error",
35042
35237
  description: "Node model definitions must agree on kind and port shape."
35043
35238
  },
35239
+ "model/no-conflicting-kind-for-id": {
35240
+ code: RuleCodes.ConflictingModelKind,
35241
+ defaultSeverity: "error",
35242
+ description: "A model ID must not be defined with different kinds."
35243
+ },
35244
+ "model/no-unused-definition": {
35245
+ code: RuleCodes.UnusedModelDefinition,
35246
+ defaultSeverity: "error",
35247
+ description: "Inline model definitions should be used in the same BT XML file."
35248
+ },
35249
+ "model/no-duplicate-definition": {
35250
+ code: RuleCodes.DuplicateModelDefinition,
35251
+ defaultSeverity: "error",
35252
+ description: "A user-defined model (ID, kind) should be defined only once."
35253
+ },
35044
35254
  "suppression/no-unused": {
35045
35255
  code: RuleCodes.UnusedSuppression,
35046
35256
  defaultSeverity: "warn",
@@ -35870,6 +36080,18 @@ function getSubTreeReferences(index, id) {
35870
36080
  (model) => model.subtreeReferences.filter((reference) => reference.id === id)
35871
36081
  );
35872
36082
  }
36083
+ function getAllNodeUsages(index) {
36084
+ return getAllDocumentModels(index).flatMap((model) => model.nodeUsages);
36085
+ }
36086
+ function getNodeUsagesByUri(index) {
36087
+ const grouped = /* @__PURE__ */ new Map();
36088
+ for (const usage of getAllNodeUsages(index)) {
36089
+ const list = grouped.get(usage.uri) ?? [];
36090
+ list.push(usage);
36091
+ grouped.set(usage.uri, list);
36092
+ }
36093
+ return grouped;
36094
+ }
35873
36095
  function getBehaviorTreeIds(index) {
35874
36096
  return [...asSemanticIndexState2(index).behaviorTreesById.keys()];
35875
36097
  }
@@ -36201,7 +36423,7 @@ function getBehaviorTreeElements(document) {
36201
36423
  (child) => child.kind === "element" && child.name === "BehaviorTree"
36202
36424
  );
36203
36425
  }
36204
- function advancePosition(start, text) {
36426
+ function advancePosition2(start, text) {
36205
36427
  let line = start.line;
36206
36428
  let character = start.character;
36207
36429
  let offset = start.offset;
@@ -36217,32 +36439,66 @@ function advancePosition(start, text) {
36217
36439
  return { line, character, offset };
36218
36440
  }
36219
36441
  function rangeFromText(start, prefix, text) {
36220
- const rangeStart = advancePosition(start, prefix);
36221
- const rangeEnd = advancePosition(rangeStart, text);
36442
+ const rangeStart = advancePosition2(start, prefix);
36443
+ const rangeEnd = advancePosition2(rangeStart, text);
36222
36444
  return {
36223
36445
  start: rangeStart,
36224
36446
  end: rangeEnd
36225
36447
  };
36226
36448
  }
36227
- function extractBlackboardReferences(document, attribute) {
36449
+ function extractBlackboardReferences(document, portName, attribute) {
36228
36450
  const baseRange = attribute.valueContentRange || attribute.valueRange;
36229
36451
  const rawValue = document.originalText.slice(baseRange.start.offset, baseRange.end.offset);
36230
36452
  const references = [];
36231
- for (const match of rawValue.matchAll(/\{([^}]+)\}/g)) {
36453
+ for (const match of rawValue.matchAll(/\{[^}]*\}/g)) {
36232
36454
  const raw = match[0];
36233
- const key = match[1];
36234
36455
  const index = match.index ?? 0;
36456
+ const parsed = parsePortBlackboardReference({ portName, rawValue: raw });
36457
+ if (parsed.ok) {
36458
+ references.push({
36459
+ raw,
36460
+ key: parsed.reference.key,
36461
+ scope: parsed.reference.scope,
36462
+ identity: makeBlackboardIdentity(parsed.reference),
36463
+ range: rangeFromText(baseRange.start, rawValue.slice(0, index), raw),
36464
+ syntax: parsed.reference.syntax === "shorthand" ? "shorthand" : "braced"
36465
+ });
36466
+ continue;
36467
+ }
36235
36468
  references.push({
36236
36469
  raw,
36237
- key,
36470
+ key: raw,
36471
+ scope: "local",
36472
+ identity: `invalid:${raw}`,
36238
36473
  range: rangeFromText(baseRange.start, rawValue.slice(0, index), raw),
36239
- syntax: "braced"
36474
+ syntax: "invalid"
36240
36475
  });
36241
36476
  }
36477
+ if (references.length === 0) {
36478
+ const parsed = parsePortBlackboardReference({ portName, rawValue });
36479
+ if (parsed.ok) {
36480
+ const parsedOffset = Math.max(0, rawValue.indexOf(parsed.reference.raw));
36481
+ references.push({
36482
+ raw: parsed.reference.raw,
36483
+ key: parsed.reference.key,
36484
+ scope: parsed.reference.scope,
36485
+ identity: makeBlackboardIdentity(parsed.reference),
36486
+ range: rangeFromText(
36487
+ baseRange.start,
36488
+ rawValue.slice(0, parsedOffset),
36489
+ parsed.reference.raw
36490
+ ),
36491
+ syntax: parsed.reference.syntax === "shorthand" ? "shorthand" : "braced"
36492
+ });
36493
+ return references;
36494
+ }
36495
+ }
36242
36496
  if (references.length === 0 && (rawValue.includes("{") || rawValue.includes("}"))) {
36243
36497
  references.push({
36244
36498
  raw: rawValue,
36245
36499
  key: rawValue,
36500
+ scope: "local",
36501
+ identity: `invalid:${rawValue}`,
36246
36502
  range: baseRange,
36247
36503
  syntax: "invalid"
36248
36504
  });
@@ -36349,10 +36605,13 @@ function getSemanticPortDirection(usage) {
36349
36605
  }
36350
36606
  function getSemanticPortValueKind(value, blackboardReferences) {
36351
36607
  if (value === "") return "empty";
36352
- if (value === "{=}") return "substitution";
36608
+ if (value === "{=}" || value === "=") return "substitution";
36353
36609
  if (blackboardReferences.some((reference) => reference.syntax === "braced")) {
36354
36610
  return "blackboard-reference";
36355
36611
  }
36612
+ if (blackboardReferences.some((reference) => reference.syntax === "shorthand")) {
36613
+ return "substitution";
36614
+ }
36356
36615
  if (blackboardReferences.some((reference) => reference.syntax === "invalid")) {
36357
36616
  return "unknown";
36358
36617
  }
@@ -36454,7 +36713,11 @@ function buildBtDocumentView(document, options) {
36454
36713
  attribute: portUsage.attribute,
36455
36714
  declaredPort: toPortResolution(portUsage),
36456
36715
  usage: portUsage,
36457
- blackboardReferences: extractBlackboardReferences(document, portUsage.attribute)
36716
+ blackboardReferences: extractBlackboardReferences(
36717
+ document,
36718
+ portUsage.name,
36719
+ portUsage.attribute
36720
+ )
36458
36721
  }));
36459
36722
  node.children = element.children.filter((child) => child.kind === "element").map(
36460
36723
  (child, childIndex) => buildTreeNode(child, behaviorTree, node, [...path4, childIndex])
@@ -36531,7 +36794,11 @@ function buildSemanticDocumentView(document, index, options) {
36531
36794
  attribute: portUsage.attribute,
36532
36795
  declaredPort: toPortResolution(portUsage),
36533
36796
  usage: portUsage,
36534
- blackboardReferences: extractBlackboardReferences(document, portUsage.attribute)
36797
+ blackboardReferences: extractBlackboardReferences(
36798
+ document,
36799
+ portUsage.name,
36800
+ portUsage.attribute
36801
+ )
36535
36802
  })
36536
36803
  )
36537
36804
  };
@@ -36615,6 +36882,50 @@ function findSemanticPortBindingAtPosition(view, position) {
36615
36882
  return void 0;
36616
36883
  }
36617
36884
 
36885
+ // ../semantic/src/model-definition-facts.ts
36886
+ function modelDefinitionKeyString(key) {
36887
+ return `${key.kind}\0${key.id}`;
36888
+ }
36889
+ function getModelDefinitionFacts(index) {
36890
+ return getAllNodeModelDefinitions(index).map((model) => {
36891
+ const sourceKind = model.source ?? model.sourceMeta?.sourceKind;
36892
+ return {
36893
+ key: {
36894
+ id: model.id,
36895
+ kind: model.kind
36896
+ },
36897
+ model,
36898
+ id: model.id,
36899
+ kind: model.kind,
36900
+ uri: model.uri,
36901
+ range: model.range,
36902
+ sourceKind,
36903
+ isBuiltin: sourceKind === "builtin",
36904
+ isCanonicalModelFile: sourceKind === "external-tree-nodes-model",
36905
+ editable: model.editable !== false
36906
+ };
36907
+ });
36908
+ }
36909
+ function groupModelDefinitionsById(facts) {
36910
+ const grouped = /* @__PURE__ */ new Map();
36911
+ for (const fact of facts) {
36912
+ const list = grouped.get(fact.id) ?? [];
36913
+ list.push(fact);
36914
+ grouped.set(fact.id, list);
36915
+ }
36916
+ return grouped;
36917
+ }
36918
+ function groupModelDefinitionsByKey(facts) {
36919
+ const grouped = /* @__PURE__ */ new Map();
36920
+ for (const fact of facts) {
36921
+ const key = modelDefinitionKeyString(fact.key);
36922
+ const list = grouped.get(key) ?? [];
36923
+ list.push(fact);
36924
+ grouped.set(key, list);
36925
+ }
36926
+ return grouped;
36927
+ }
36928
+
36618
36929
  // ../syntax/src/parse/document-kind.ts
36619
36930
  function finalizeDocumentKind(input) {
36620
36931
  const { document, diagnostics, options, partial: partial2 } = input;
@@ -37503,6 +37814,9 @@ function parseBtXml(text, options = {}) {
37503
37814
  );
37504
37815
  }
37505
37816
  const root = document.root;
37817
+ const looksLikeBtXml = root?.name === "BehaviorTree" || root?.name === "TreeNodesModel" || root?.name === "root" && (root.attributes.some((a) => a.name === "BTCPP_format" && a.value === "4") || root.children.some(
37818
+ (child) => child.kind === "element" && (child.name === "BehaviorTree" || child.name === "TreeNodesModel")
37819
+ ));
37506
37820
  if (root) {
37507
37821
  for (const node of document.nodes) {
37508
37822
  if (node === root) continue;
@@ -37521,7 +37835,7 @@ function parseBtXml(text, options = {}) {
37521
37835
  }
37522
37836
  }
37523
37837
  }
37524
- if (!document.xmlDeclaration) {
37838
+ if (!document.xmlDeclaration && !looksLikeBtXml) {
37525
37839
  addOptionalDiagnostic(
37526
37840
  "XML008_MISSING_DECLARATION",
37527
37841
  DiagnosticSeverity.Warning,
@@ -37535,7 +37849,7 @@ function parseBtXml(text, options = {}) {
37535
37849
  ]
37536
37850
  }
37537
37851
  );
37538
- } else if (document.xmlDeclaration.encoding && document.xmlDeclaration.encoding.toUpperCase() !== "UTF-8") {
37852
+ } else if (document.xmlDeclaration?.encoding && document.xmlDeclaration.encoding.toUpperCase() !== "UTF-8") {
37539
37853
  const encoding = document.xmlDeclaration.encoding;
37540
37854
  addDiagnostic(
37541
37855
  "XML009_INVALID_ENCODING",
@@ -38879,6 +39193,192 @@ async function resolveIncludeGraph(input) {
38879
39193
  };
38880
39194
  }
38881
39195
 
39196
+ // ../project/src/model-conventions.ts
39197
+ var RULE_CONFLICTING_KIND = "model/no-conflicting-kind-for-id";
39198
+ var RULE_UNUSED_DEFINITION = "model/no-unused-definition";
39199
+ var RULE_DUPLICATE_DEFINITION = "model/no-duplicate-definition";
39200
+ function createConventionDiagnostic(input) {
39201
+ const diagnostic = createDiagnostic(
39202
+ input.code,
39203
+ input.severity,
39204
+ input.message,
39205
+ input.range,
39206
+ input.uri,
39207
+ void 0,
39208
+ input.data
39209
+ );
39210
+ return {
39211
+ ...diagnostic,
39212
+ rule: input.rule,
39213
+ ...input.relatedInformation ? { relatedInformation: input.relatedInformation } : {}
39214
+ };
39215
+ }
39216
+ function resolveConventionSeverity(config2, rule) {
39217
+ const severity = getRuleSeverity(config2.linter.rules, rule);
39218
+ if (severity === "off") return void 0;
39219
+ if (severity === "info") return DiagnosticSeverity.Info;
39220
+ if (severity === "warn") return DiagnosticSeverity.Warning;
39221
+ return DiagnosticSeverity.Error;
39222
+ }
39223
+ function definitionRange(definition) {
39224
+ return definition.model.idRange ?? definition.range;
39225
+ }
39226
+ function definitionInfo(definition) {
39227
+ return {
39228
+ uri: definition.uri,
39229
+ sourceKind: definition.sourceKind,
39230
+ modelKind: definition.kind,
39231
+ range: definition.range
39232
+ };
39233
+ }
39234
+ function validateConflictingKinds(input) {
39235
+ const severity = resolveConventionSeverity(input.config, RULE_CONFLICTING_KIND);
39236
+ if (!severity) return [];
39237
+ const diagnostics = [];
39238
+ const groupedById = groupModelDefinitionsById(input.facts.filter((fact) => !fact.isBuiltin));
39239
+ for (const [id, definitions] of groupedById) {
39240
+ const kinds = new Set(definitions.map((definition) => definition.kind));
39241
+ if (kinds.size <= 1) continue;
39242
+ const primary = definitions[0];
39243
+ if (!primary) continue;
39244
+ for (const definition of definitions.slice(1)) {
39245
+ if (definition.kind === primary.kind) continue;
39246
+ const primaryRange = definitionRange(primary);
39247
+ const relatedInformation = primary.uri && primaryRange ? [
39248
+ {
39249
+ uri: primary.uri,
39250
+ range: primaryRange,
39251
+ message: "first conflicting definition"
39252
+ }
39253
+ ] : void 0;
39254
+ diagnostics.push(
39255
+ createConventionDiagnostic({
39256
+ code: "BT120_CONFLICTING_MODEL_KIND",
39257
+ message: `model ID \`${id}\` has conflicting kinds (\`${primary.kind}\` vs \`${definition.kind}\`)`,
39258
+ uri: definition.uri,
39259
+ range: definitionRange(definition),
39260
+ rule: RULE_CONFLICTING_KIND,
39261
+ severity,
39262
+ data: {
39263
+ kind: "conflicting-model-kind",
39264
+ nodeId: id,
39265
+ definitions: definitions.map(definitionInfo)
39266
+ },
39267
+ relatedInformation
39268
+ })
39269
+ );
39270
+ }
39271
+ }
39272
+ return diagnostics;
39273
+ }
39274
+ function validateUsedOnly(input) {
39275
+ if (input.config.models.convention !== "used-only") return [];
39276
+ const severity = resolveConventionSeverity(input.config, RULE_UNUSED_DEFINITION);
39277
+ if (!severity) return [];
39278
+ const diagnostics = [];
39279
+ const usagesByUri = getNodeUsagesByUri(input.index);
39280
+ for (const definition of input.facts) {
39281
+ if (definition.isBuiltin) continue;
39282
+ if (definition.sourceKind !== "inline-tree-nodes-model") continue;
39283
+ if (definition.kind === "SubTree") continue;
39284
+ const sameFileNodeUsages = usagesByUri.get(definition.uri ?? "") ?? [];
39285
+ const usedNodeIds = new Set(
39286
+ sameFileNodeUsages.filter((usage) => usage.kind === "node").map((usage) => usage.id)
39287
+ );
39288
+ if (usedNodeIds.has(definition.id)) continue;
39289
+ diagnostics.push(
39290
+ createConventionDiagnostic({
39291
+ code: "BT121_UNUSED_MODEL_DEFINITION",
39292
+ message: `unused inline model definition \`${definition.id}\` in this file`,
39293
+ uri: definition.uri,
39294
+ range: definitionRange(definition),
39295
+ rule: RULE_UNUSED_DEFINITION,
39296
+ severity,
39297
+ data: {
39298
+ kind: "unused-model-definition",
39299
+ nodeId: definition.id,
39300
+ modelKind: definition.kind,
39301
+ sourceKind: "inline-tree-nodes-model",
39302
+ fix: definition.uri && definitionRange(definition) && definition.editable ? {
39303
+ kind: "delete-definition",
39304
+ uri: definition.uri,
39305
+ range: definitionRange(definition)
39306
+ } : void 0
39307
+ }
39308
+ })
39309
+ );
39310
+ }
39311
+ return diagnostics;
39312
+ }
39313
+ function duplicateFix(definitions) {
39314
+ const canonical = definitions.filter((definition) => definition.isCanonicalModelFile);
39315
+ if (canonical.length !== 1) return void 0;
39316
+ const keep = canonical[0];
39317
+ if (!keep?.uri) return void 0;
39318
+ const deleteTargets = definitions.filter((definition) => definition !== keep);
39319
+ if (deleteTargets.some(
39320
+ (definition) => !definition.uri || !definitionRange(definition) || !definition.editable
39321
+ )) {
39322
+ return void 0;
39323
+ }
39324
+ return {
39325
+ kind: "delete-non-canonical-definitions",
39326
+ keep: {
39327
+ uri: keep.uri,
39328
+ range: definitionRange(keep)
39329
+ },
39330
+ delete: deleteTargets.map((definition) => ({
39331
+ uri: definition.uri,
39332
+ range: definitionRange(definition)
39333
+ }))
39334
+ };
39335
+ }
39336
+ function validateSingleSource(input) {
39337
+ if (input.config.models.convention !== "single-source") return [];
39338
+ const severity = resolveConventionSeverity(input.config, RULE_DUPLICATE_DEFINITION);
39339
+ if (!severity) return [];
39340
+ const diagnostics = [];
39341
+ const groupedByKey = groupModelDefinitionsByKey(input.facts.filter((fact) => !fact.isBuiltin));
39342
+ for (const definitions of groupedByKey.values()) {
39343
+ if (definitions.length <= 1) continue;
39344
+ const primary = definitions[0];
39345
+ if (!primary) continue;
39346
+ diagnostics.push(
39347
+ createConventionDiagnostic({
39348
+ code: "BT122_DUPLICATE_MODEL_DEFINITION",
39349
+ message: `duplicate model definition for \`${primary.id}\` (${primary.kind})`,
39350
+ uri: primary.uri,
39351
+ range: definitionRange(primary),
39352
+ rule: RULE_DUPLICATE_DEFINITION,
39353
+ severity,
39354
+ data: {
39355
+ kind: "duplicate-model-definition",
39356
+ nodeId: primary.id,
39357
+ modelKind: primary.kind,
39358
+ definitions: definitions.map((definition) => ({
39359
+ uri: definition.uri,
39360
+ sourceKind: definition.sourceKind,
39361
+ range: definition.range,
39362
+ canonical: definition.isCanonicalModelFile,
39363
+ editable: definition.editable
39364
+ })),
39365
+ fix: duplicateFix(definitions)
39366
+ }
39367
+ })
39368
+ );
39369
+ }
39370
+ return diagnostics;
39371
+ }
39372
+ function validateModelConventions(input) {
39373
+ if (input.config.linter.enabled === false) return [];
39374
+ const facts = getModelDefinitionFacts(input.index);
39375
+ return [
39376
+ ...validateConflictingKinds({ config: input.config, facts }),
39377
+ ...validateUsedOnly({ config: input.config, index: input.index, facts }),
39378
+ ...validateSingleSource({ config: input.config, facts })
39379
+ ];
39380
+ }
39381
+
38882
39382
  // ../project/src/node-definitions.ts
38883
39383
  function createPositionAt2(text) {
38884
39384
  const lineStarts = [0];
@@ -38941,8 +39441,8 @@ async function loadProjectNodeModels(input) {
38941
39441
  if (parseErrors.length > 0 || !jsonTree) {
38942
39442
  throw new Error(`JSON parse error at offset ${parseErrors[0]?.offset ?? 0}`);
38943
39443
  }
38944
- } catch (error51) {
38945
- const errorMessage = String(error51.message || error51);
39444
+ } catch (error52) {
39445
+ const errorMessage = String(error52.message || error52);
38946
39446
  diagnostics.push(
38947
39447
  createDiagnostic(
38948
39448
  RuleCodes.InvalidNodeDefinitionJson,
@@ -39076,7 +39576,10 @@ async function buildProjectIndex(input) {
39076
39576
  }) : void 0;
39077
39577
  const externalDocs = input.externalModelDocuments;
39078
39578
  const augmentations = input.augmentations;
39079
- const nodeDefinitions = await loadProjectNodeModels({ project: input.project, host: input.host });
39579
+ const nodeDefinitions = await loadProjectNodeModels({
39580
+ project: input.project,
39581
+ host: input.host
39582
+ });
39080
39583
  diagnostics.push(...nodeDefinitions.diagnostics);
39081
39584
  const nodeDefinitionModels = nodeDefinitions.nodeModels;
39082
39585
  const activeDocs = graphResult && (mode === "entrypoints" || input.resolveGraph) ? uniqueDocuments([
@@ -39098,7 +39601,13 @@ async function buildProjectIndex(input) {
39098
39601
  includeIssuesByUri: groupIncludeIssues(graphResult?.issues ?? []),
39099
39602
  suppressionIssuesByUri: /* @__PURE__ */ new Map()
39100
39603
  };
39101
- diagnostics.push(...semanticResult.diagnostics);
39604
+ diagnostics.push(
39605
+ ...semanticResult.diagnostics,
39606
+ ...validateModelConventions({
39607
+ config: resolvedConfig,
39608
+ index: semanticResult.index
39609
+ })
39610
+ );
39102
39611
  const reachableBehaviorTreesById = new Map(
39103
39612
  getBehaviorTreeIds(semanticResult.index).map((id) => [
39104
39613
  id,
@@ -39487,11 +39996,11 @@ function reportLiteralValidation(context, input) {
39487
39996
  });
39488
39997
  }
39489
39998
  function validateLiteralValue(input) {
39490
- const remappedKey = getRemappedKey(input.port.name, input.value);
39491
- if (input.allowRemap && remappedKey !== void 0) {
39999
+ const remappedReference = getExactBlackboardReference(input.port.name, input.value);
40000
+ if (input.allowRemap && remappedReference !== void 0) {
39492
40001
  return void 0;
39493
40002
  }
39494
- if (!input.allowRemap && remappedKey !== void 0) {
40003
+ if (!input.allowRemap && remappedReference !== void 0) {
39495
40004
  return invalidLiteral(input.diagnosticCode, input.value, input.portLabel);
39496
40005
  }
39497
40006
  if (input.port.enum && !input.port.enum.includes(input.value)) {
@@ -39524,8 +40033,12 @@ function getResolvedPortType(port) {
39524
40033
  function getResolvedPortTypeDefinition(registry2, port) {
39525
40034
  return resolveTypeDefinition(registry2, getResolvedPortType(port));
39526
40035
  }
39527
- function getExactRemappedKey(portName, rawValue) {
39528
- return getRemappedKey(portName, rawValue);
40036
+ function getExactBlackboardReference(portName, rawValue) {
40037
+ const parsed = parsePortBlackboardReference({
40038
+ portName,
40039
+ rawValue: rawValue.trim()
40040
+ });
40041
+ return parsed.ok ? parsed.reference : void 0;
39529
40042
  }
39530
40043
  function invalidLiteral(code, literal2, portLabel) {
39531
40044
  return {
@@ -39804,7 +40317,7 @@ var modelRules = [
39804
40317
  const port = model?.ports.find((candidate) => candidate.name === portName);
39805
40318
  if (!port) return;
39806
40319
  if (port.direction === "output") {
39807
- if (getRemappedKey(port.name, defaultAttr.value) === void 0) {
40320
+ if (getExactBlackboardReference(port.name, defaultAttr.value) === void 0) {
39808
40321
  context.report({
39809
40322
  code: RuleCodes.InvalidPortDefaultValue,
39810
40323
  message: `output port default for \`${port.name}\` must be a blackboard remap`,
@@ -39841,30 +40354,34 @@ var modelRules = [
39841
40354
  return {
39842
40355
  ProgramExit() {
39843
40356
  const typeRegistry = getTypeRegistry(context.semantic);
39844
- const bindingsByKey = /* @__PURE__ */ new Map();
40357
+ const bindingsByIdentity = /* @__PURE__ */ new Map();
39845
40358
  const allowStringEntryCompatibility = context.options.allowStringEntryCompatibility ?? true;
39846
40359
  for (const node of context.view.nodes) {
39847
40360
  for (const binding of node.portBindings) {
39848
40361
  if (binding.declaredPort.status !== "resolved") continue;
39849
- const key = getExactRemappedKey(binding.name, binding.value);
39850
- if (!key) continue;
40362
+ const reference = getExactBlackboardReference(binding.name, binding.value);
40363
+ if (!reference) continue;
39851
40364
  const typeDefinition = getResolvedPortTypeDefinition(
39852
40365
  typeRegistry,
39853
40366
  binding.declaredPort.port
39854
40367
  );
39855
40368
  if (!typeDefinition || typeDefinition.kind === "any") continue;
39856
- const records = bindingsByKey.get(key) ?? [];
40369
+ const identity = makeBlackboardIdentity(reference);
40370
+ const records = bindingsByIdentity.get(identity) ?? [];
39857
40371
  records.push({
39858
- key,
40372
+ key: reference.key,
40373
+ scope: reference.scope,
40374
+ displayName: formatBlackboardReference(reference),
40375
+ identity,
39859
40376
  nodeId: describeBindingNode(node.element),
39860
40377
  port: binding.declaredPort.port,
39861
40378
  typeDefinition,
39862
40379
  range: binding.attribute.range
39863
40380
  });
39864
- bindingsByKey.set(key, records);
40381
+ bindingsByIdentity.set(identity, records);
39865
40382
  }
39866
40383
  }
39867
- for (const [key, bindings] of bindingsByKey) {
40384
+ for (const bindings of bindingsByIdentity.values()) {
39868
40385
  const incompatibleTypes = collectIncompatibleTypes(
39869
40386
  context.semantic,
39870
40387
  bindings,
@@ -39876,10 +40393,10 @@ var modelRules = [
39876
40393
  );
39877
40394
  context.report({
39878
40395
  code: RuleCodes.BlackboardTypeMismatch,
39879
- message: `blackboard entry \`${key}\` is used with incompatible port types: ${incompatibleTypes.map((type) => `\`${type}\``).join(", ")}`,
40396
+ message: `blackboard entry \`${primary?.displayName ?? bindings[0]?.displayName ?? bindings[0]?.key ?? ""}\` is used with incompatible port types: ${incompatibleTypes.map((type) => `\`${type}\``).join(", ")}`,
39880
40397
  range: primary?.range,
39881
40398
  details: {
39882
- primaryLabel: `blackboard entry \`${key}\` mixes incompatible port types`,
40399
+ primaryLabel: `blackboard entry \`${primary?.displayName ?? bindings[0]?.displayName ?? bindings[0]?.key ?? ""}\` mixes incompatible port types`,
39883
40400
  notes: bindings.filter((binding) => incompatibleTypes.includes(binding.typeDefinition.canonical)).map(
39884
40401
  (binding) => `${binding.nodeId}.${binding.port.name} declares ${formatPortType(binding.port, binding.typeDefinition)}`
39885
40402
  ),
@@ -39906,7 +40423,8 @@ var modelRules = [
39906
40423
  const portUsage = context.getPortUsage(element, attr.name);
39907
40424
  if (portUsage?.status !== "resolved") continue;
39908
40425
  if (portUsage.port.direction !== "output") continue;
39909
- if (getExactRemappedKey(portUsage.port.name, attr.value) !== void 0) continue;
40426
+ if (getExactBlackboardReference(portUsage.port.name, attr.value) !== void 0)
40427
+ continue;
39910
40428
  context.report({
39911
40429
  code: RuleCodes.OutputPortRequiresRemap,
39912
40430
  message: `output port \`${portUsage.port.name}\` must be remapped to a blackboard entry`,
@@ -39998,6 +40516,22 @@ function classifyScriptAttribute(input) {
39998
40516
  return void 0;
39999
40517
  }
40000
40518
 
40519
+ // ../script/src/analysis/blackboard.ts
40520
+ function classifyScriptIdentifier(name) {
40521
+ if (!name.startsWith("@")) {
40522
+ return { kind: "local", name };
40523
+ }
40524
+ const parsed = parseScriptBlackboardIdentifier({ rawName: name });
40525
+ if (!parsed.ok) {
40526
+ return {
40527
+ kind: "invalid-global-blackboard",
40528
+ raw: name,
40529
+ message: `invalid global blackboard identifier \`${name}\``
40530
+ };
40531
+ }
40532
+ return { kind: "global-blackboard", key: parsed.reference.key };
40533
+ }
40534
+
40001
40535
  // ../script/src/tokenizer.ts
40002
40536
  var TWO_CHAR_TOKENS = /* @__PURE__ */ new Map([
40003
40537
  ["..", "DotDot"],
@@ -40571,12 +41105,22 @@ function createScriptEnvironment(input = {}) {
40571
41105
  const registry2 = createTypeRegistry(input.augmentations ?? []);
40572
41106
  const areTypesCompatible3 = input.areTypesCompatible ?? ((left, right) => areTypesCompatible(registry2, left, right));
40573
41107
  const compatibilityKeys = /* @__PURE__ */ new Map();
41108
+ const globalCompatibilityKeys = /* @__PURE__ */ new Map();
40574
41109
  const environment = {
40575
41110
  symbols: /* @__PURE__ */ new Map(),
41111
+ globalBlackboard: /* @__PURE__ */ new Map(),
40576
41112
  enums: normalizeEnums(input.enums, input.augmentations ?? [])
40577
41113
  };
40578
41114
  for (const symbol2 of input.symbols ?? []) {
40579
- mergeScriptSymbol(environment, compatibilityKeys, symbol2, areTypesCompatible3);
41115
+ mergeScriptSymbol(environment.symbols, compatibilityKeys, symbol2, areTypesCompatible3);
41116
+ }
41117
+ for (const symbol2 of input.globalBlackboardSymbols ?? []) {
41118
+ mergeScriptSymbol(
41119
+ environment.globalBlackboard,
41120
+ globalCompatibilityKeys,
41121
+ symbol2,
41122
+ areTypesCompatible3
41123
+ );
40580
41124
  }
40581
41125
  return environment;
40582
41126
  }
@@ -40585,6 +41129,12 @@ function cloneScriptEnvironment(environment) {
40585
41129
  symbols: new Map(
40586
41130
  [...environment?.symbols.entries() ?? []].map(([name, symbol2]) => [name, { ...symbol2 }])
40587
41131
  ),
41132
+ globalBlackboard: new Map(
41133
+ [...environment?.globalBlackboard.entries() ?? []].map(([name, symbol2]) => [
41134
+ name,
41135
+ { ...symbol2 }
41136
+ ])
41137
+ ),
40588
41138
  enums: new Map(environment?.enums ?? [])
40589
41139
  };
40590
41140
  }
@@ -40613,10 +41163,14 @@ function analyzeScriptFlow(input) {
40613
41163
  ...analysis ? { analysis } : {}
40614
41164
  });
40615
41165
  environment.symbols.clear();
41166
+ environment.globalBlackboard.clear();
40616
41167
  environment.enums.clear();
40617
41168
  for (const [name, symbol2] of environmentAfter.symbols) {
40618
41169
  environment.symbols.set(name, { ...symbol2 });
40619
41170
  }
41171
+ for (const [name, symbol2] of environmentAfter.globalBlackboard) {
41172
+ environment.globalBlackboard.set(name, { ...symbol2 });
41173
+ }
40620
41174
  for (const [name, value] of environmentAfter.enums) {
40621
41175
  environment.enums.set(name, value);
40622
41176
  }
@@ -40692,10 +41246,10 @@ function normalizeEnums(enums, augmentations) {
40692
41246
  }
40693
41247
  return collected;
40694
41248
  }
40695
- function mergeScriptSymbol(environment, compatibilityKeys, next, areTypesCompatible3) {
40696
- const existing = environment.symbols.get(next.name);
41249
+ function mergeScriptSymbol(target, compatibilityKeys, next, areTypesCompatible3) {
41250
+ const existing = target.get(next.name);
40697
41251
  if (!existing) {
40698
- environment.symbols.set(next.name, {
41252
+ target.set(next.name, {
40699
41253
  name: next.name,
40700
41254
  type: next.type,
40701
41255
  source: next.source,
@@ -40707,7 +41261,7 @@ function mergeScriptSymbol(environment, compatibilityKeys, next, areTypesCompati
40707
41261
  }
40708
41262
  const existingCompatibilityKey = compatibilityKeys.get(next.name);
40709
41263
  const conflict = existing.conflict === true || existingCompatibilityKey !== void 0 && next.compatibilityKey !== void 0 && !areTypesCompatible3(existingCompatibilityKey, next.compatibilityKey) || !areScriptTypesCompatible(existing.type, next.type);
40710
- environment.symbols.set(next.name, {
41264
+ target.set(next.name, {
40711
41265
  ...existing,
40712
41266
  readable: existing.readable || next.readable,
40713
41267
  writable: existing.writable || next.writable,
@@ -40729,6 +41283,8 @@ function analyzeScript(input) {
40729
41283
  const identifiers = [];
40730
41284
  const resolvedIdentifiers = [];
40731
41285
  const unknownIdentifiers = [];
41286
+ const globalBlackboardAccesses = [];
41287
+ const invalidGlobalBlackboardIdentifiers = [];
40732
41288
  const introducedSymbols = [];
40733
41289
  const diagnostics = [];
40734
41290
  const statementTypes = [];
@@ -40741,6 +41297,8 @@ function analyzeScript(input) {
40741
41297
  identifiers,
40742
41298
  resolvedIdentifiers,
40743
41299
  unknownIdentifiers,
41300
+ globalBlackboardAccesses,
41301
+ invalidGlobalBlackboardIdentifiers,
40744
41302
  introducedSymbols,
40745
41303
  diagnostics,
40746
41304
  attributeName: input.attributeName ?? "code",
@@ -40753,6 +41311,8 @@ function analyzeScript(input) {
40753
41311
  identifiers,
40754
41312
  resolvedIdentifiers,
40755
41313
  unknownIdentifiers,
41314
+ globalBlackboardAccesses,
41315
+ invalidGlobalBlackboardIdentifiers,
40756
41316
  introducedSymbols,
40757
41317
  diagnostics,
40758
41318
  statementTypes,
@@ -40924,6 +41484,66 @@ function analyzeAssignment(context) {
40924
41484
  statementIndex: context.statementIndex
40925
41485
  };
40926
41486
  identifiers.push(access2);
41487
+ const classified = classifyScriptIdentifier(left.name);
41488
+ if (classified.kind === "invalid-global-blackboard") {
41489
+ context.invalidGlobalBlackboardIdentifiers.push(access2);
41490
+ reportInvalidGlobalBlackboardIdentifier(
41491
+ context,
41492
+ left.range,
41493
+ classified.raw,
41494
+ classified.message
41495
+ );
41496
+ return ERROR_TYPE;
41497
+ }
41498
+ if (classified.kind === "global-blackboard") {
41499
+ const existingSymbol2 = environment.globalBlackboard.get(classified.key);
41500
+ const accessType = expression.operator === ":=" ? rightType : expression.operator === "=" ? existingSymbol2 && isScriptTypeAssignable(existingSymbol2.type, rightType) ? rightType : !existingSymbol2 ? rightType : void 0 : compoundAssignmentResult(
41501
+ existingSymbol2?.type ?? UNKNOWN_TYPE,
41502
+ rightType,
41503
+ expression.operator
41504
+ );
41505
+ if (expression.operator !== ":=" && expression.operator !== "=" && !accessType) {
41506
+ reportDiagnostic(
41507
+ context,
41508
+ "invalid-compound-assignment",
41509
+ expression.range,
41510
+ `operator \`${expression.operator}\` is not valid for these operand types`,
41511
+ `compound assignment \`${expression.operator}\` is not allowed here`,
41512
+ expression.operator === "+=" ? "use number += number or string += string" : "use numeric operands for this compound assignment"
41513
+ );
41514
+ return ERROR_TYPE;
41515
+ }
41516
+ if ((expression.operator === ":=" || expression.operator === "=") && existingSymbol2 && !isScriptTypeAssignable(existingSymbol2.type, rightType)) {
41517
+ reportTypeMismatch(context, left, existingSymbol2.type, rightType);
41518
+ return ERROR_TYPE;
41519
+ }
41520
+ const symbol2 = existingSymbol2 ? { ...existingSymbol2 } : {
41521
+ name: classified.key,
41522
+ type: rightType,
41523
+ source: {
41524
+ kind: "global-blackboard",
41525
+ key: classified.key,
41526
+ range: left.range,
41527
+ originId: context.originId
41528
+ },
41529
+ readable: true,
41530
+ writable: true
41531
+ };
41532
+ symbol2.type = accessType ?? rightType;
41533
+ environment.globalBlackboard.set(classified.key, symbol2);
41534
+ context.resolvedIdentifiers.push({
41535
+ access: access2,
41536
+ resolution: { kind: "global-blackboard", key: classified.key, symbol: symbol2 }
41537
+ });
41538
+ context.globalBlackboardAccesses.push({
41539
+ key: classified.key,
41540
+ rawName: left.name,
41541
+ kind: accessKind,
41542
+ range: left.range,
41543
+ inferredType: symbol2.type
41544
+ });
41545
+ return symbol2.type;
41546
+ }
40927
41547
  const existingSymbol = environment.symbols.get(left.name);
40928
41548
  if (expression.operator === ":=" && !existingSymbol) {
40929
41549
  const symbol2 = {
@@ -41002,6 +41622,27 @@ function analyzeReadIdentifier(context, name, range) {
41002
41622
  statementIndex: context.statementIndex
41003
41623
  };
41004
41624
  context.identifiers.push(access2);
41625
+ const classified = classifyScriptIdentifier(name);
41626
+ if (classified.kind === "invalid-global-blackboard") {
41627
+ context.invalidGlobalBlackboardIdentifiers.push(access2);
41628
+ reportInvalidGlobalBlackboardIdentifier(context, range, classified.raw, classified.message);
41629
+ return ERROR_TYPE;
41630
+ }
41631
+ if (classified.kind === "global-blackboard") {
41632
+ const symbol3 = context.environment.globalBlackboard.get(classified.key);
41633
+ context.globalBlackboardAccesses.push({
41634
+ key: classified.key,
41635
+ rawName: name,
41636
+ kind: "read",
41637
+ range,
41638
+ inferredType: symbol3?.type ?? UNKNOWN_TYPE
41639
+ });
41640
+ context.resolvedIdentifiers.push({
41641
+ access: access2,
41642
+ resolution: { kind: "global-blackboard", key: classified.key, ...symbol3 ? { symbol: symbol3 } : {} }
41643
+ });
41644
+ return symbol3?.type ?? UNKNOWN_TYPE;
41645
+ }
41005
41646
  const enumValue = context.environment.enums.get(name);
41006
41647
  if (enumValue !== void 0) {
41007
41648
  context.resolvedIdentifiers.push({
@@ -41073,6 +41714,16 @@ function reportTypeMismatch(context, identifier, targetType, sourceType) {
41073
41714
  "assign a compatible value or change the variable's source type"
41074
41715
  );
41075
41716
  }
41717
+ function reportInvalidGlobalBlackboardIdentifier(context, range, rawName, message) {
41718
+ reportDiagnostic(
41719
+ context,
41720
+ "invalid-global-blackboard-identifier",
41721
+ range,
41722
+ message,
41723
+ `\`${rawName}\` is not a valid global blackboard identifier`,
41724
+ "use `@name` with a valid blackboard key that starts with a letter or underscore"
41725
+ );
41726
+ }
41076
41727
  function refineLocalSymbol(symbol2, nextType) {
41077
41728
  if (symbol2.source.kind !== "script-assignment") return;
41078
41729
  if (symbol2.type.kind !== "unknown" && symbol2.type.kind !== "error") return;
@@ -41206,7 +41857,10 @@ function getScriptCursorContext(input) {
41206
41857
  };
41207
41858
  }
41208
41859
  if (containing && (containing.type === "Integer" || containing.type === "Real" || containing.type === "String" || containing.type === "Boolean")) {
41209
- return { kind: "literal", range: { start: containing.start, end: containing.end } };
41860
+ return {
41861
+ kind: "literal",
41862
+ range: { start: containing.start, end: containing.end }
41863
+ };
41210
41864
  }
41211
41865
  const operatorRange = scanOperatorRange(source, cursorOffset);
41212
41866
  const previousBeforeOperator = previousToken(tokens, operatorRange.start);
@@ -41260,6 +41914,19 @@ function identifierCompletionItems(input, cursor) {
41260
41914
  sortText: symbol2.source.kind === "script-assignment" ? `1-${symbol2.name}` : `2-${symbol2.name}`
41261
41915
  });
41262
41916
  }
41917
+ for (const symbol2 of environment.globalBlackboard.values()) {
41918
+ if (symbol2.conflict) continue;
41919
+ if (!symbol2.readable) continue;
41920
+ const label = `@${symbol2.name}`;
41921
+ if (!matchesPrefix(label, prefix)) continue;
41922
+ items.push({
41923
+ label,
41924
+ kind: "identifier",
41925
+ detail: describeScriptSymbol(symbol2),
41926
+ replaceRange: cursor.range,
41927
+ sortText: `2-${label}`
41928
+ });
41929
+ }
41263
41930
  for (const value of ["true", "false"]) {
41264
41931
  if (!matchesPrefix(value, prefix)) continue;
41265
41932
  items.push({
@@ -41332,6 +41999,31 @@ function environmentBeforeCursor(input) {
41332
41999
  if (symbol2.source.range.end > input.cursorOffset) continue;
41333
42000
  next.symbols.set(symbol2.name, symbol2);
41334
42001
  }
42002
+ for (const access2 of analyzed.globalBlackboardAccesses) {
42003
+ if (access2.kind === "read") continue;
42004
+ if (access2.range.end > input.cursorOffset) continue;
42005
+ const analyzedSymbol = analyzed.environment.globalBlackboard.get(access2.key);
42006
+ const existing = next.globalBlackboard.get(access2.key);
42007
+ let symbol2;
42008
+ if (analyzedSymbol) {
42009
+ symbol2 = { ...analyzedSymbol };
42010
+ } else if (existing) {
42011
+ symbol2 = { ...existing, type: access2.inferredType };
42012
+ } else {
42013
+ symbol2 = {
42014
+ name: access2.key,
42015
+ type: access2.inferredType,
42016
+ source: {
42017
+ kind: "global-blackboard",
42018
+ key: access2.key,
42019
+ range: access2.range
42020
+ },
42021
+ readable: true,
42022
+ writable: true
42023
+ };
42024
+ }
42025
+ next.globalBlackboard.set(access2.key, symbol2);
42026
+ }
41335
42027
  return next;
41336
42028
  }
41337
42029
  for (const token of tokens) {
@@ -41340,9 +42032,26 @@ function environmentBeforeCursor(input) {
41340
42032
  const next = nextToken(tokens, token.end);
41341
42033
  if (next?.type !== "ColonEqual") continue;
41342
42034
  if (next.end > input.cursorOffset) continue;
41343
- if (environment.symbols.has(token.text)) continue;
41344
- environment.symbols.set(token.text, {
41345
- name: token.text,
42035
+ const classified = classifyScriptIdentifier(token.text);
42036
+ if (classified.kind === "invalid-global-blackboard") continue;
42037
+ if (classified.kind === "global-blackboard") {
42038
+ if (environment.globalBlackboard.has(classified.key)) continue;
42039
+ environment.globalBlackboard.set(classified.key, {
42040
+ name: classified.key,
42041
+ type: { kind: "unknown" },
42042
+ source: {
42043
+ kind: "global-blackboard",
42044
+ key: classified.key,
42045
+ range: { start: token.start, end: token.end }
42046
+ },
42047
+ readable: true,
42048
+ writable: true
42049
+ });
42050
+ continue;
42051
+ }
42052
+ if (environment.symbols.has(classified.name)) continue;
42053
+ environment.symbols.set(classified.name, {
42054
+ name: classified.name,
41346
42055
  type: { kind: "unknown" },
41347
42056
  source: {
41348
42057
  kind: "script-assignment",
@@ -41360,10 +42069,14 @@ function describeScriptSymbol(symbol2) {
41360
42069
  switch (symbol2.source.kind) {
41361
42070
  case "port-remap":
41362
42071
  return `${typeLabel} from ${symbol2.source.nodeType ?? "node"}.${symbol2.source.portName}`;
42072
+ case "global-blackboard-remap":
42073
+ return `${typeLabel} from global blackboard ${symbol2.source.nodeType ?? "node"}.${symbol2.source.portName}`;
41363
42074
  case "subtree-port":
41364
42075
  return `${typeLabel} from ${symbol2.source.nodeType ?? "SubTree"}.${symbol2.source.portName}`;
41365
42076
  case "script-assignment":
41366
42077
  return `${typeLabel} from earlier ${symbol2.source.attributeName} declaration`;
42078
+ case "global-blackboard":
42079
+ return `${typeLabel} from global blackboard @${symbol2.source.key}`;
41367
42080
  case "augmentation":
41368
42081
  return `${typeLabel} from augmentation`;
41369
42082
  case "enum":
@@ -41505,6 +42218,7 @@ function getBehaviorTreeScriptFlow(context, behaviorTree) {
41505
42218
  function buildBaseScriptEnvironment(context, nodes) {
41506
42219
  const registry2 = getTypeRegistry(context.semantic);
41507
42220
  const portSymbols = [];
42221
+ const globalBlackboardSymbols = [];
41508
42222
  const behaviorTreeId = nodes[0]?.behaviorTree.id;
41509
42223
  if (behaviorTreeId) {
41510
42224
  const subtreeModel = context.getNodeModel(behaviorTreeId);
@@ -41530,17 +42244,21 @@ function buildBaseScriptEnvironment(context, nodes) {
41530
42244
  }
41531
42245
  }
41532
42246
  for (const node of nodes) {
41533
- const nodeType = node.usage.model.status === "resolved" ? node.usage.model.model.id : node.usage.nodeType;
41534
42247
  for (const binding of node.portBindings) {
41535
42248
  if (binding.usage.status !== "resolved") continue;
41536
- const remappedKey = getRemappedKey(binding.usage.port.name, binding.usage.value);
41537
- if (!remappedKey) continue;
42249
+ const parsed = parsePortBlackboardReference({
42250
+ portName: binding.usage.port.name,
42251
+ rawValue: binding.usage.value
42252
+ });
42253
+ if (!parsed.ok) continue;
42254
+ if (parsed.reference.scope === "global") continue;
41538
42255
  const resolvedTypeName = getResolvedPortType(binding.usage.port);
41539
42256
  const resolvedDefinition = getTypeDefinition(context.semantic, resolvedTypeName);
41540
42257
  const compatibilityKey = resolvedDefinition?.canonical ?? resolvedTypeName;
41541
42258
  const direction = binding.usage.port.direction;
42259
+ const nodeType = node.usage.model.status === "resolved" ? node.usage.model.model.id : node.usage.nodeType;
41542
42260
  portSymbols.push({
41543
- name: remappedKey,
42261
+ name: parsed.reference.key,
41544
42262
  type: scriptTypeFromTypeName(registry2, resolvedTypeName),
41545
42263
  source: {
41546
42264
  kind: "port-remap",
@@ -41554,12 +42272,47 @@ function buildBaseScriptEnvironment(context, nodes) {
41554
42272
  });
41555
42273
  }
41556
42274
  }
42275
+ globalBlackboardSymbols.push(...collectGlobalBlackboardSeedSymbols(context, registry2));
41557
42276
  return createScriptEnvironment({
41558
42277
  symbols: portSymbols,
42278
+ globalBlackboardSymbols,
41559
42279
  augmentations: getModelAugmentations(context.semantic),
41560
42280
  areTypesCompatible: (left, right) => left && right ? areTypesCompatible2(context.semantic, left, right) : true
41561
42281
  });
41562
42282
  }
42283
+ function collectGlobalBlackboardSeedSymbols(context, registry2) {
42284
+ const symbols = [];
42285
+ for (const node of context.view.nodes) {
42286
+ const nodeType = node.usage.model.status === "resolved" ? node.usage.model.model.id : node.usage.nodeType;
42287
+ for (const binding of node.portBindings) {
42288
+ if (binding.usage.status !== "resolved") continue;
42289
+ const parsed = parsePortBlackboardReference({
42290
+ portName: binding.usage.port.name,
42291
+ rawValue: binding.usage.value
42292
+ });
42293
+ if (!parsed.ok || parsed.reference.scope !== "global") continue;
42294
+ const resolvedTypeName = getResolvedPortType(binding.usage.port);
42295
+ const resolvedDefinition = getTypeDefinition(context.semantic, resolvedTypeName);
42296
+ const compatibilityKey = resolvedDefinition?.canonical ?? resolvedTypeName;
42297
+ const direction = binding.usage.port.direction;
42298
+ symbols.push({
42299
+ name: parsed.reference.key,
42300
+ type: scriptTypeFromTypeName(registry2, resolvedTypeName),
42301
+ source: {
42302
+ kind: "global-blackboard-remap",
42303
+ nodeType,
42304
+ portName: binding.usage.port.name,
42305
+ direction,
42306
+ key: parsed.reference.key
42307
+ },
42308
+ readable: direction === "input" || direction === "output" || direction === "inout",
42309
+ writable: direction === "output" || direction === "inout",
42310
+ compatibilityKey
42311
+ });
42312
+ }
42313
+ }
42314
+ return symbols;
42315
+ }
41563
42316
 
41564
42317
  // ../analyzer/src/analysis/rules/script/no-unknown-variable.ts
41565
42318
  var scriptNoUnknownVariableRule = makeRuleModule({
@@ -41595,7 +42348,7 @@ var scriptValidAssignmentRule = makeRuleModule({
41595
42348
  for (const candidate of getAnalyzedScriptAttributeCandidates(context, element)) {
41596
42349
  if (!candidate.analysis) continue;
41597
42350
  for (const diagnostic of candidate.analysis.diagnostics) {
41598
- const code = diagnostic.code === "assignment-to-unknown-variable" ? RuleCodes.AssignmentToUnknownVariable : diagnostic.code === "invalid-compound-assignment" ? RuleCodes.InvalidCompoundAssignment : diagnostic.code === "variable-type-mismatch" ? RuleCodes.ScriptVariableTypeMismatch : void 0;
42351
+ const code = diagnostic.code === "assignment-to-unknown-variable" ? RuleCodes.AssignmentToUnknownVariable : diagnostic.code === "invalid-compound-assignment" ? RuleCodes.InvalidCompoundAssignment : diagnostic.code === "variable-type-mismatch" ? RuleCodes.ScriptVariableTypeMismatch : diagnostic.code === "invalid-global-blackboard-identifier" ? RuleCodes.InvalidGlobalBlackboardIdentifier : void 0;
41599
42352
  if (!code) continue;
41600
42353
  context.report({
41601
42354
  code,
@@ -41668,16 +42421,16 @@ var scriptValidSyntaxRule = makeRuleModule({
41668
42421
  Element(element) {
41669
42422
  for (const candidate of getScriptAttributeCandidates(context, element)) {
41670
42423
  if (candidate.parseResult.ok) continue;
41671
- for (const error51 of candidate.parseResult.errors) {
41672
- const code = error51.kind === "empty-script" ? RuleCodes.EmptyScript : error51.kind === "invalid-token" ? RuleCodes.InvalidScriptToken : RuleCodes.InvalidScriptSyntax;
42424
+ for (const error52 of candidate.parseResult.errors) {
42425
+ const code = error52.kind === "empty-script" ? RuleCodes.EmptyScript : error52.kind === "invalid-token" ? RuleCodes.InvalidScriptToken : RuleCodes.InvalidScriptSyntax;
41673
42426
  context.report({
41674
42427
  code,
41675
- message: error51.message,
41676
- range: error51.kind === "empty-script" ? candidate.attribute.valueContentRange ?? candidate.attribute.valueRange ?? mapScriptRangeToDocument(
42428
+ message: error52.message,
42429
+ range: error52.kind === "empty-script" ? candidate.attribute.valueContentRange ?? candidate.attribute.valueRange ?? mapScriptRangeToDocument(
41677
42430
  context,
41678
42431
  candidate.attribute,
41679
42432
  attributeScriptRange(candidate.attribute)
41680
- ) : mapScriptRangeToDocument(context, candidate.attribute, error51.range),
42433
+ ) : mapScriptRangeToDocument(context, candidate.attribute, error52.range),
41681
42434
  details: {
41682
42435
  primaryLabel: `invalid script in \`${candidate.attribute.name}\``
41683
42436
  }
@@ -41733,6 +42486,18 @@ var suppressionRules = [
41733
42486
  function getAttr3(element, name) {
41734
42487
  return element.attributes.find((attr) => attr.name === name);
41735
42488
  }
42489
+ function isInsideTreeNodesModel(root, target) {
42490
+ if (!root) return false;
42491
+ const walk2 = (element, inTreeNodesModel) => {
42492
+ const nextInTreeNodesModel = inTreeNodesModel || element.name === "TreeNodesModel";
42493
+ if (element === target) return nextInTreeNodesModel;
42494
+ for (const child of element.children) {
42495
+ if (child.kind === "element" && walk2(child, nextInTreeNodesModel)) return true;
42496
+ }
42497
+ return false;
42498
+ };
42499
+ return walk2(root, false);
42500
+ }
41736
42501
  var treeRules = [
41737
42502
  makeRuleModule({
41738
42503
  name: "tree/require-id",
@@ -41809,6 +42574,7 @@ var treeRules = [
41809
42574
  return {
41810
42575
  Element(element) {
41811
42576
  if (element.name !== "SubTree") return;
42577
+ if (isInsideTreeNodesModel(context.document.root, element)) return;
41812
42578
  const call = context.getSubTreeCallView(element);
41813
42579
  const idAttr = call?.node.element.attributes.find((attr) => attr.name === "ID") ?? getAttr3(element, "ID");
41814
42580
  if (!idAttr) return;
@@ -41829,6 +42595,7 @@ var treeRules = [
41829
42595
  return {
41830
42596
  Element(element) {
41831
42597
  if (element.name !== "SubTree") return;
42598
+ if (isInsideTreeNodesModel(context.document.root, element)) return;
41832
42599
  const idAttr = getAttr3(element, "ID");
41833
42600
  if (!idAttr) return;
41834
42601
  const call = context.getSubTreeCallView(element);
@@ -42795,8 +43562,8 @@ async function discoverBtxmlConfig(input) {
42795
43562
  }
42796
43563
  try {
42797
43564
  raw = await readJson(configUri, input.host);
42798
- } catch (error51) {
42799
- const errorMessage = String(error51.message || error51);
43565
+ } catch (error52) {
43566
+ const errorMessage = String(error52.message || error52);
42800
43567
  return {
42801
43568
  ok: false,
42802
43569
  configUri,
@@ -42856,34 +43623,31 @@ async function discoverBtxmlConfig(input) {
42856
43623
 
42857
43624
  // ../project/src/models.ts
42858
43625
  async function discoverModelFiles(rootUri, modelsConfig, filesConfig, host) {
42859
- const ignore2 = [...filesConfig.ignore];
42860
- const gitignoreLines = filesConfig.useGitignore ? await loadGitignore(rootUri, host) : [];
42861
- const ig = createIgnoreInstance(gitignoreLines);
42862
43626
  const modelFilesPatternResult = await expandPatterns(
42863
43627
  modelsConfig.files,
42864
43628
  rootUri,
42865
- ignore2,
43629
+ [],
42866
43630
  filesConfig.followSymlinks,
42867
43631
  void 0,
42868
- ig,
43632
+ void 0,
42869
43633
  host
42870
43634
  );
42871
43635
  const definitionFilesPatternResult = await expandPatterns(
42872
43636
  modelsConfig.definitions,
42873
43637
  rootUri,
42874
- ignore2,
43638
+ [],
42875
43639
  filesConfig.followSymlinks,
42876
43640
  void 0,
42877
- ig,
43641
+ void 0,
42878
43642
  host
42879
43643
  );
42880
43644
  const augmentationFilesPatternResult = await expandPatterns(
42881
43645
  modelsConfig.augmentations,
42882
43646
  rootUri,
42883
- ignore2,
43647
+ [],
42884
43648
  filesConfig.followSymlinks,
42885
43649
  void 0,
42886
- ig,
43650
+ void 0,
42887
43651
  host
42888
43652
  );
42889
43653
  const modelFiles = modelFilesPatternResult.files.map((uri) => ({
@@ -43362,21 +44126,8 @@ function uniqueItems(items) {
43362
44126
  }
43363
44127
 
43364
44128
  // ../language-service/src/providers/blackboard-symbols.ts
43365
- var BLACKBOARD_KEY_RE = /^[A-Za-z_][A-Za-z0-9_./:-]*$/;
43366
- function validateExtractedBlackboardKey(raw) {
43367
- const key = raw?.trim();
43368
- if (!key) return void 0;
43369
- if (key.includes("{") || key.includes("}")) return void 0;
43370
- return BLACKBOARD_KEY_RE.test(key) ? key : void 0;
43371
- }
43372
- function normalizeBlackboardKey(raw) {
43373
- const value = raw?.trim();
43374
- if (!value) return void 0;
43375
- const extracted = value.startsWith("{") && value.endsWith("}") ? value.slice(1, -1).trim() : value;
43376
- return validateExtractedBlackboardKey(extracted);
43377
- }
43378
- function formatBlackboardReference(key) {
43379
- return `{${key}}`;
44129
+ function formatBlackboardReference2(symbol2) {
44130
+ return formatBlackboardReference(symbol2);
43380
44131
  }
43381
44132
  function normalizeType(type) {
43382
44133
  return type?.trim().replace(/^const\s+/, "").replace(/[&*]\s*$/, "").replace(/\s+/g, " ").toLowerCase();
@@ -43392,31 +44143,32 @@ function collectBlackboardSymbols(context) {
43392
44143
  if (binding.declaredPort.status !== "resolved") continue;
43393
44144
  const port = binding.declaredPort.port;
43394
44145
  for (const ref of binding.blackboardReferences) {
43395
- const key = normalizeBlackboardKey(ref.key);
43396
- if (!key) continue;
44146
+ if (ref.syntax === "invalid") continue;
43397
44147
  const next = {
43398
- key,
44148
+ identity: ref.identity,
44149
+ key: ref.key,
44150
+ scope: ref.scope,
43399
44151
  type: port.type,
43400
44152
  direction: port.direction,
43401
44153
  nodeType: node.usage.nodeType || node.tagName,
43402
44154
  portName: port.name
43403
44155
  };
43404
- const current = grouped.get(key);
44156
+ const current = grouped.get(ref.identity);
43405
44157
  if (!current) {
43406
- grouped.set(key, next);
44158
+ grouped.set(ref.identity, next);
43407
44159
  continue;
43408
44160
  }
43409
44161
  const currentType = normalizeType(current.type);
43410
44162
  const nextType = normalizeType(next.type);
43411
44163
  if (currentType && nextType && currentType !== nextType) {
43412
- grouped.set(key, {
44164
+ grouped.set(ref.identity, {
43413
44165
  ...current,
43414
44166
  conflict: true
43415
44167
  });
43416
44168
  continue;
43417
44169
  }
43418
44170
  if (!currentType && nextType) {
43419
- grouped.set(key, {
44171
+ grouped.set(ref.identity, {
43420
44172
  ...current,
43421
44173
  type: next.type
43422
44174
  });
@@ -43441,23 +44193,45 @@ function getBlackboardReplacementRange(document, attribute, cursorOffset) {
43441
44193
  const endsInBraces = value.endsWith("}");
43442
44194
  if (startsInBraces && cursorOffset > valueStart) {
43443
44195
  const innerStart = valueStart + 1;
44196
+ const innerValueStart = value[1] === "@" ? innerStart + 1 : innerStart;
43444
44197
  const innerEnd = endsInBraces ? valueEnd - 1 : valueEnd;
43445
44198
  return {
43446
- replacementRange: rangeFromOffsets2(document, innerStart, Math.max(innerStart, innerEnd)),
43447
- wrapsReference: false
44199
+ replacementRange: rangeFromOffsets2(
44200
+ document,
44201
+ innerValueStart,
44202
+ Math.max(innerValueStart, innerEnd)
44203
+ ),
44204
+ wrapsReference: false,
44205
+ hasScopeMarker: value[1] === "@"
43448
44206
  };
43449
44207
  }
43450
44208
  return {
43451
44209
  insertText: attribute.value,
43452
44210
  replacementRange: valueContentRange,
43453
- wrapsReference: true
44211
+ wrapsReference: true,
44212
+ hasScopeMarker: false
43454
44213
  };
43455
44214
  }
43456
44215
  function createBlackboardCompletionItem(args) {
43457
44216
  const { document, attribute, cursorOffset, symbol: symbol2, detail } = args;
43458
44217
  const replacement = getBlackboardReplacementRange(document, attribute, cursorOffset);
43459
- const label = formatBlackboardReference(symbol2.key);
43460
- const newText = replacement?.wrapsReference ? label : symbol2.key;
44218
+ const wrapsReference = replacement?.wrapsReference ?? false;
44219
+ const hasScopeMarker = replacement?.hasScopeMarker ?? false;
44220
+ if (hasScopeMarker && symbol2.scope !== "global") return void 0;
44221
+ let label = symbol2.key;
44222
+ if (wrapsReference) {
44223
+ label = formatBlackboardReference2(symbol2);
44224
+ } else if (symbol2.scope === "global") {
44225
+ label = `@${symbol2.key}`;
44226
+ }
44227
+ let newText = symbol2.key;
44228
+ if (wrapsReference) {
44229
+ newText = formatBlackboardReference2(symbol2);
44230
+ } else if (symbol2.scope === "global") {
44231
+ newText = hasScopeMarker ? symbol2.key : `@${symbol2.key}`;
44232
+ }
44233
+ const scopeFilterText = symbol2.scope === "global" ? ` @${symbol2.key}` : "";
44234
+ const filterText = `${symbol2.key} ${label}${scopeFilterText}`.trim();
43461
44235
  return completion(
43462
44236
  label,
43463
44237
  "Reference",
@@ -43467,7 +44241,7 @@ function createBlackboardCompletionItem(args) {
43467
44241
  newText
43468
44242
  } : void 0,
43469
44243
  {
43470
- filterText: `${symbol2.key} ${label}`,
44244
+ filterText,
43471
44245
  insertText: newText
43472
44246
  }
43473
44247
  );
@@ -43501,13 +44275,14 @@ function getScriptIdentifierTarget(context, position) {
43501
44275
  (entry) => entry.access.range.start === cursor.range.start && entry.access.range.end === cursor.range.end && entry.resolution.kind !== "unknown"
43502
44276
  );
43503
44277
  if (!resolved || resolved.resolution.kind === "unknown") return void 0;
43504
- const reference = resolved.resolution.kind === "symbol" ? { kind: "symbol", symbol: resolved.resolution.symbol } : resolved.resolution;
44278
+ const reference = resolved.resolution.kind === "symbol" ? { kind: "symbol", symbol: resolved.resolution.symbol } : resolved.resolution.kind === "global-blackboard" ? { ...resolved.resolution, origin: "script" } : resolved.resolution;
43505
44279
  return {
43506
44280
  attributeContext: scriptContext,
43507
44281
  range: toDocumentRange(context, scriptContext, cursor.range),
43508
44282
  reference,
43509
44283
  flowState,
43510
44284
  occurrence: {
44285
+ uri: context.document.uri,
43511
44286
  attributeContext: scriptContext,
43512
44287
  identifier: resolved.access,
43513
44288
  reference,
@@ -43516,11 +44291,35 @@ function getScriptIdentifierTarget(context, position) {
43516
44291
  };
43517
44292
  }
43518
44293
  function getScriptReferencesForSymbol(context, target) {
43519
- const states = getBehaviorTreeScriptFlow2(context, target.attributeContext.behaviorTree);
43520
- return states.flatMap(
43521
- (state) => collectResolvedOccurrences(context, state).filter(
43522
- (occurrence) => target.reference.kind === "enum" ? occurrence.reference.kind === "enum" && occurrence.reference.name === target.reference.name : sameResolvedSymbol(target.reference.symbol, occurrence.reference)
43523
- )
44294
+ const occurrences = (target.reference.kind === "global-blackboard" ? collectAllScriptOccurrences(context) : getBehaviorTreeScriptFlow2(context, target.attributeContext.behaviorTree).flatMap(
44295
+ (state) => collectResolvedOccurrences(context, state)
44296
+ )).filter(
44297
+ (occurrence) => target.reference.kind === "enum" ? occurrence.reference.kind === "enum" && occurrence.reference.name === target.reference.name : target.reference.kind === "global-blackboard" ? occurrence.reference.kind === "global-blackboard" && occurrence.reference.key === target.reference.key : sameResolvedSymbol(target.reference.symbol, occurrence.reference)
44298
+ );
44299
+ if (target.reference.kind === "global-blackboard") {
44300
+ return uniqueScriptOccurrences([
44301
+ ...occurrences,
44302
+ ...collectGlobalBlackboardRemapOccurrences(context, target.reference.key)
44303
+ ]);
44304
+ }
44305
+ return occurrences;
44306
+ }
44307
+ function getGlobalBlackboardReferenceLocations(context, key) {
44308
+ return uniqueBlackboardLocations(
44309
+ collectGlobalBlackboardRemapOccurrences(context, key).map((occurrence) => ({
44310
+ uri: occurrence.uri,
44311
+ range: occurrence.documentRange
44312
+ }))
44313
+ );
44314
+ }
44315
+ function getGlobalBlackboardScriptLocations(context, key) {
44316
+ return uniqueBlackboardLocations(
44317
+ collectAllScriptOccurrences(context).filter(
44318
+ (occurrence) => occurrence.reference.kind === "global-blackboard" && occurrence.reference.key === key
44319
+ ).map((occurrence) => ({
44320
+ uri: occurrence.uri,
44321
+ range: occurrence.documentRange
44322
+ }))
43524
44323
  );
43525
44324
  }
43526
44325
  function getBehaviorTreeScriptFlowStates(context, behaviorTree) {
@@ -43536,10 +44335,14 @@ function describeScriptSymbol2(symbol2) {
43536
44335
  switch (symbol2.source.kind) {
43537
44336
  case "port-remap":
43538
44337
  return `${typeLabel} from ${symbol2.source.nodeType ?? "node"}.${symbol2.source.portName}`;
44338
+ case "global-blackboard-remap":
44339
+ return `${typeLabel} from global blackboard ${symbol2.source.nodeType ?? "node"}.${symbol2.source.portName}`;
43539
44340
  case "subtree-port":
43540
44341
  return `${typeLabel} from ${symbol2.source.nodeType ?? "SubTree"}.${symbol2.source.portName}`;
43541
44342
  case "script-assignment":
43542
44343
  return `${typeLabel} from earlier ${symbol2.source.attributeName} declaration`;
44344
+ case "global-blackboard":
44345
+ return `${typeLabel} from global blackboard @${symbol2.source.key}`;
43543
44346
  case "augmentation":
43544
44347
  return `${typeLabel} from augmentation`;
43545
44348
  case "enum":
@@ -43615,6 +44418,7 @@ function getScriptAttributeContext(context, element, attribute) {
43615
44418
  function buildBaseScriptEnvironment2(context, nodes) {
43616
44419
  const registry2 = getTypeRegistry(context.semantic);
43617
44420
  const portSymbols = [];
44421
+ const globalBlackboardSymbols = [];
43618
44422
  const behaviorTreeId = nodes[0]?.behaviorTree.id;
43619
44423
  if (behaviorTreeId) {
43620
44424
  const subtreeModel = getNodeModel(context.semantic, behaviorTreeId);
@@ -43640,17 +44444,18 @@ function buildBaseScriptEnvironment2(context, nodes) {
43640
44444
  }
43641
44445
  }
43642
44446
  for (const node of nodes) {
43643
- const nodeType = node.usage.model.status === "resolved" ? node.usage.model.model.id : node.usage.nodeType;
43644
44447
  for (const binding of node.portBindings) {
43645
44448
  if (binding.declaredPort.status !== "resolved") continue;
43646
- const remappedKey = getRemappedKeyFromBinding(binding);
43647
- if (!remappedKey) continue;
44449
+ const reference = getBlackboardReferenceFromBinding(binding);
44450
+ if (!reference) continue;
44451
+ if (reference.scope === "global") continue;
43648
44452
  const resolvedTypeName = binding.declaredPort.port.type;
43649
44453
  const resolvedDefinition = getTypeDefinition(context.semantic, resolvedTypeName);
43650
44454
  const compatibilityKey = resolvedDefinition?.canonical ?? resolvedTypeName;
43651
44455
  const direction = binding.declaredPort.port.direction;
44456
+ const nodeType = node.usage.model.status === "resolved" ? node.usage.model.model.id : node.usage.nodeType;
43652
44457
  portSymbols.push({
43653
- name: remappedKey,
44458
+ name: reference.key,
43654
44459
  type: scriptTypeFromTypeName(registry2, resolvedTypeName),
43655
44460
  source: {
43656
44461
  kind: "port-remap",
@@ -43664,19 +44469,57 @@ function buildBaseScriptEnvironment2(context, nodes) {
43664
44469
  });
43665
44470
  }
43666
44471
  }
44472
+ const workspaceNodes = getDocumentTrees(context).flatMap(
44473
+ ({ trees }) => trees.flatMap((tree) => tree.nodes)
44474
+ );
44475
+ globalBlackboardSymbols.push(
44476
+ ...collectGlobalBlackboardSeedSymbols2(context, registry2, workspaceNodes)
44477
+ );
43667
44478
  return createScriptEnvironment({
43668
44479
  symbols: portSymbols,
44480
+ globalBlackboardSymbols,
43669
44481
  augmentations: getModelAugmentations(context.semantic),
43670
44482
  areTypesCompatible: (left, right) => left && right ? areTypesCompatible2(context.semantic, left, right) : true
43671
44483
  });
43672
44484
  }
44485
+ function collectGlobalBlackboardSeedSymbols2(context, registry2, nodes) {
44486
+ const symbols = [];
44487
+ for (const node of nodes) {
44488
+ const nodeType = node.usage.model.status === "resolved" ? node.usage.model.model.id : node.usage.nodeType;
44489
+ for (const binding of node.portBindings) {
44490
+ if (binding.declaredPort.status !== "resolved") continue;
44491
+ const reference = getBlackboardReferenceFromBinding(binding);
44492
+ if (!reference || reference.scope !== "global") continue;
44493
+ const resolvedTypeName = binding.declaredPort.port.type;
44494
+ const resolvedDefinition = getTypeDefinition(context.semantic, resolvedTypeName);
44495
+ const compatibilityKey = resolvedDefinition?.canonical ?? resolvedTypeName;
44496
+ const direction = binding.declaredPort.port.direction;
44497
+ symbols.push({
44498
+ name: reference.key,
44499
+ type: scriptTypeFromTypeName(registry2, resolvedTypeName),
44500
+ source: {
44501
+ kind: "global-blackboard-remap",
44502
+ nodeType,
44503
+ portName: binding.declaredPort.port.name,
44504
+ direction,
44505
+ key: reference.key
44506
+ },
44507
+ readable: direction === "input" || direction === "output" || direction === "inout",
44508
+ writable: direction === "output" || direction === "inout",
44509
+ compatibilityKey
44510
+ });
44511
+ }
44512
+ }
44513
+ return symbols;
44514
+ }
43673
44515
  function collectResolvedOccurrences(context, state) {
43674
44516
  if (!state.analysis) return [];
43675
44517
  return state.analysis.resolvedIdentifiers.flatMap((entry) => {
43676
44518
  if (entry.resolution.kind === "unknown") return [];
43677
- const reference = entry.resolution.kind === "symbol" ? { kind: "symbol", symbol: entry.resolution.symbol } : entry.resolution;
44519
+ const reference = entry.resolution.kind === "symbol" ? { kind: "symbol", symbol: entry.resolution.symbol } : entry.resolution.kind === "global-blackboard" ? { ...entry.resolution, origin: "script" } : entry.resolution;
43678
44520
  return [
43679
44521
  {
44522
+ uri: context.document.uri,
43680
44523
  attributeContext: state.context,
43681
44524
  identifier: entry.access,
43682
44525
  reference,
@@ -43696,6 +44539,112 @@ function sameResolvedSymbol(symbol2, reference) {
43696
44539
  }
43697
44540
  return symbol2.name === candidate.name && symbol2.source.kind === candidate.source.kind;
43698
44541
  }
44542
+ function uniqueScriptOccurrences(occurrences) {
44543
+ const seen = /* @__PURE__ */ new Set();
44544
+ const result = [];
44545
+ for (const occurrence of occurrences) {
44546
+ const key = `${occurrence.uri}:${occurrence.documentRange.start.offset}:${occurrence.documentRange.end.offset}:${occurrence.reference.kind}`;
44547
+ if (seen.has(key)) continue;
44548
+ seen.add(key);
44549
+ result.push(occurrence);
44550
+ }
44551
+ return result;
44552
+ }
44553
+ function collectGlobalBlackboardRemapOccurrences(context, key) {
44554
+ return getDocumentTrees(context).flatMap(
44555
+ ({ uri, trees }) => trees.flatMap(
44556
+ (behaviorTree) => behaviorTree.nodes.flatMap(
44557
+ (node) => node.portBindings.flatMap(
44558
+ (binding) => binding.blackboardReferences.filter((reference) => reference.scope === "global" && reference.key === key).map((reference) => ({
44559
+ uri,
44560
+ attributeContext: {
44561
+ id: `${node.path.join(".")}:${binding.attribute.name}:${node.element.attributes.indexOf(binding.attribute)}`,
44562
+ node,
44563
+ element: node.element,
44564
+ attribute: binding.attribute,
44565
+ source: binding.attribute.value,
44566
+ behaviorTree: node.behaviorTree
44567
+ },
44568
+ identifier: {
44569
+ name: `@${reference.key}`,
44570
+ kind: "read",
44571
+ range: { start: 0, end: 0 },
44572
+ identifier: {
44573
+ kind: "Identifier",
44574
+ name: `@${reference.key}`,
44575
+ range: { start: 0, end: 0 }
44576
+ },
44577
+ statementIndex: -1
44578
+ },
44579
+ reference: {
44580
+ kind: "global-blackboard",
44581
+ key: reference.key,
44582
+ origin: "port-remap"
44583
+ },
44584
+ documentRange: reference.range
44585
+ }))
44586
+ )
44587
+ )
44588
+ )
44589
+ );
44590
+ }
44591
+ function collectAllScriptOccurrences(context) {
44592
+ return getDocumentTrees(context).flatMap(
44593
+ ({ uri, trees }) => trees.flatMap((behaviorTree) => {
44594
+ const nextContext = getContextForUri(context, uri);
44595
+ return getBehaviorTreeScriptFlow2(nextContext, behaviorTree).flatMap(
44596
+ (state) => collectResolvedOccurrencesByUri(nextContext, uri, state)
44597
+ );
44598
+ })
44599
+ );
44600
+ }
44601
+ function collectResolvedOccurrencesByUri(context, uri, state) {
44602
+ return collectResolvedOccurrences(context, state).map((occurrence) => ({
44603
+ ...occurrence,
44604
+ uri
44605
+ }));
44606
+ }
44607
+ function getDocumentTrees(context) {
44608
+ const current = context.documentView ? [{ uri: context.document.uri, trees: context.documentView.behaviorTrees }] : [];
44609
+ const workspace = context.workspace?.documents ?? [];
44610
+ const others = workspace.filter((document) => document.uri !== context.document.uri).map((document) => {
44611
+ const view = buildBtDocumentView(document, {
44612
+ semantic: context.semantic,
44613
+ config: context.config,
44614
+ policy: context.nodeUsagePolicy
44615
+ });
44616
+ return { uri: document.uri, trees: view.behaviorTrees };
44617
+ }).filter((entry) => entry.trees.length > 0);
44618
+ return [...current, ...others];
44619
+ }
44620
+ function getContextForUri(context, uri) {
44621
+ if (uri === context.document.uri) return context;
44622
+ const parsed = context.workspace?.documents.find((document2) => document2.uri === uri);
44623
+ if (!parsed) return context;
44624
+ const document = createTextDocument(uri, parsed.originalText, 0, "btcpp-xml");
44625
+ const documentView = buildBtDocumentView(parsed, {
44626
+ semantic: context.semantic,
44627
+ config: context.config,
44628
+ policy: context.nodeUsagePolicy
44629
+ });
44630
+ return {
44631
+ ...context,
44632
+ document,
44633
+ parsed,
44634
+ documentView
44635
+ };
44636
+ }
44637
+ function uniqueBlackboardLocations(locations) {
44638
+ const seen = /* @__PURE__ */ new Set();
44639
+ const result = [];
44640
+ for (const location of locations) {
44641
+ const key = `${location.uri}:${location.range.start.offset}:${location.range.end.offset}`;
44642
+ if (seen.has(key)) continue;
44643
+ seen.add(key);
44644
+ result.push(location);
44645
+ }
44646
+ return result;
44647
+ }
43699
44648
  function toDocumentRange(context, scriptContext, range) {
43700
44649
  return mapDecodedAttributeRangeToDocumentRange(
43701
44650
  context.parsed ?? { originalText: context.document.text },
@@ -43721,9 +44670,13 @@ function mapDecodedRangeToReplacementRange(context, attribute, range) {
43721
44670
  const document = context.parsed ?? { originalText: context.document.text };
43722
44671
  return mapDecodedAttributeRangeToDocumentRange(document, attribute, range);
43723
44672
  }
43724
- function getRemappedKeyFromBinding(binding) {
44673
+ function getBlackboardReferenceFromBinding(binding) {
43725
44674
  if (binding.declaredPort.status !== "resolved") return void 0;
43726
- return getRemappedKey(binding.declaredPort.port.name, binding.value);
44675
+ const parsed = parsePortBlackboardReference({
44676
+ portName: binding.declaredPort.port.name,
44677
+ rawValue: binding.value
44678
+ });
44679
+ return parsed.ok ? parsed.reference : void 0;
43727
44680
  }
43728
44681
 
43729
44682
  // ../language-service/src/providers/script-completions.ts
@@ -44006,28 +44959,37 @@ function attributeValueItems(input, inspect, context) {
44006
44959
  const unknownTypeSymbols = symbols.filter(
44007
44960
  (symbol2) => !symbol2.conflict && !normalizeType(symbol2.type) && normalizedCurrentType
44008
44961
  );
44009
- const matchingKeyItems = matchingSymbols.map((symbol2) => ({
44010
- ...createBlackboardCompletionItem({
44962
+ const matchingKeyItems = matchingSymbols.flatMap((symbol2) => {
44963
+ const item = createBlackboardCompletionItem({
44011
44964
  document: input.document,
44012
44965
  attribute,
44013
44966
  cursorOffset: input.position.offset,
44014
44967
  symbol: symbol2,
44015
- detail: `${symbol2.type || "unknown"} blackboard key from ${symbol2.nodeType}.${symbol2.portName}`
44016
- }),
44017
- sortText: `${BLACKBOARD_SORT_TEXT.matchingKey}-${symbol2.key}`
44018
- }));
44019
- const unknownKeyItems = unknownTypeSymbols.map((symbol2) => ({
44020
- ...createBlackboardCompletionItem({
44968
+ detail: symbol2.scope === "global" ? `${symbol2.type || "unknown"} global blackboard key from ${symbol2.nodeType}.${symbol2.portName}` : `${symbol2.type || "unknown"} blackboard key from ${symbol2.nodeType}.${symbol2.portName}`
44969
+ });
44970
+ return item ? [
44971
+ {
44972
+ ...item,
44973
+ sortText: `${BLACKBOARD_SORT_TEXT.matchingKey}-${symbol2.scope === "global" ? symbol2.identity : symbol2.key}`
44974
+ }
44975
+ ] : [];
44976
+ });
44977
+ const unknownKeyItems = unknownTypeSymbols.flatMap((symbol2) => {
44978
+ const item = createBlackboardCompletionItem({
44021
44979
  document: input.document,
44022
44980
  attribute,
44023
44981
  cursorOffset: input.position.offset,
44024
44982
  symbol: symbol2,
44025
- detail: `unknown-type blackboard key from ${symbol2.nodeType}.${symbol2.portName}`
44026
- }),
44027
- sortText: `${BLACKBOARD_SORT_TEXT.unknownKey}-${symbol2.key}`
44028
- }));
44029
- items.push(...matchingKeyItems);
44030
- items.push(...unknownKeyItems);
44983
+ detail: symbol2.scope === "global" ? `unknown-type global blackboard key from ${symbol2.nodeType}.${symbol2.portName}` : `unknown-type blackboard key from ${symbol2.nodeType}.${symbol2.portName}`
44984
+ });
44985
+ return item ? [
44986
+ {
44987
+ ...item,
44988
+ sortText: `${BLACKBOARD_SORT_TEXT.unknownKey}-${symbol2.scope === "global" ? symbol2.identity : symbol2.key}`
44989
+ }
44990
+ ] : [];
44991
+ });
44992
+ items.push(...matchingKeyItems, ...unknownKeyItems);
44031
44993
  if (items.length > 0) {
44032
44994
  return uniqueItems(items);
44033
44995
  }
@@ -44060,7 +45022,9 @@ function getCompletions(context, input) {
44060
45022
  };
44061
45023
  }
44062
45024
  if (inspect.kind === "tag-name") {
44063
- return { items: uniqueItems(elementNameItems(context.semantic, inspect.element?.nameRange)) };
45025
+ return {
45026
+ items: uniqueItems(elementNameItems(context.semantic, inspect.element?.nameRange))
45027
+ };
44064
45028
  }
44065
45029
  if (inspect.kind === "closing-tag-name") {
44066
45030
  return { items: uniqueItems(closingTagItems(inspect)) };
@@ -44069,6 +45033,63 @@ function getCompletions(context, input) {
44069
45033
  }
44070
45034
 
44071
45035
  // ../language-service/src/providers/definition.ts
45036
+ function uniqueLocations(locations) {
45037
+ const seen = /* @__PURE__ */ new Set();
45038
+ const result = [];
45039
+ for (const location of locations) {
45040
+ const key = `${location.uri}:${location.range.start.offset}:${location.range.end.offset}`;
45041
+ if (seen.has(key)) continue;
45042
+ seen.add(key);
45043
+ result.push(location);
45044
+ }
45045
+ return result;
45046
+ }
45047
+ function getSubTreeModelDefinitionLocations(semantic, id, fallbackUri) {
45048
+ return getNodeModelDefinitions(semantic, id).filter((definition) => definition.kind === "SubTree").map((definition) => {
45049
+ if (definition.idRange) {
45050
+ return {
45051
+ uri: definition.uri || fallbackUri,
45052
+ range: definition.idRange
45053
+ };
45054
+ }
45055
+ if (definition.range) {
45056
+ return {
45057
+ uri: definition.uri || fallbackUri,
45058
+ range: definition.range
45059
+ };
45060
+ }
45061
+ return void 0;
45062
+ }).filter((location) => Boolean(location));
45063
+ }
45064
+ function getBlackboardDefinitionLocations(documentView, identity, fallbackUri) {
45065
+ if (!documentView) return [];
45066
+ return uniqueLocations(
45067
+ documentView.nodes.flatMap(
45068
+ (node) => node.portBindings.flatMap(
45069
+ (binding) => binding.blackboardReferences.filter((reference) => reference.identity === identity).map((reference) => ({
45070
+ uri: fallbackUri,
45071
+ range: reference.range
45072
+ }))
45073
+ )
45074
+ )
45075
+ );
45076
+ }
45077
+ function getWorkspaceBlackboardLocations(documentView, workspaceDocuments, semantic, config2, policy, identity, fallbackUri) {
45078
+ const current = getBlackboardDefinitionLocations(documentView, identity, fallbackUri);
45079
+ const workspace = (workspaceDocuments ?? []).flatMap((document) => {
45080
+ if (document.uri === fallbackUri) return [];
45081
+ const view = buildBtDocumentView(document, {
45082
+ semantic,
45083
+ config: config2,
45084
+ policy
45085
+ });
45086
+ return getBlackboardDefinitionLocations(view, identity, document.uri);
45087
+ });
45088
+ return uniqueLocations([...current, ...workspace]);
45089
+ }
45090
+ function getDocumentBlackboardLocations(documentView, identity, fallbackUri) {
45091
+ return getBlackboardDefinitionLocations(documentView, identity, fallbackUri);
45092
+ }
44072
45093
  function getDefinitionLocations(parsed, documentView, position, semantic, config2, policy, workspaceDocuments) {
44073
45094
  if (!parsed) return [];
44074
45095
  const inspect = inspectXmlCursor({
@@ -44094,27 +45115,45 @@ function getDefinitionLocations(parsed, documentView, position, semantic, config
44094
45115
  policy
44095
45116
  }) : void 0;
44096
45117
  if (element?.name === "SubTree" && attribute?.name === "ID") {
45118
+ if (usage?.tagForm === "model-definition") {
45119
+ return getBehaviorTrees(semantic, attribute.value).map((def) => def.idRange ? { uri: def.uri, range: def.idRange } : void 0).filter((location) => Boolean(location));
45120
+ }
45121
+ const subtreeModelDefinitions = getSubTreeModelDefinitionLocations(
45122
+ semantic,
45123
+ attribute.value,
45124
+ parsed.uri
45125
+ );
44097
45126
  const target = usage?.subtree?.target;
44098
45127
  if (target?.status === "resolved" && target.kind === "behavior-tree") {
44099
45128
  const behaviorTree = target.behaviorTree;
44100
45129
  if (behaviorTree.idRange) {
44101
- return [
45130
+ return uniqueLocations([
44102
45131
  {
44103
45132
  uri: behaviorTree.uri,
44104
45133
  range: behaviorTree.idRange
44105
- }
44106
- ];
45134
+ },
45135
+ ...subtreeModelDefinitions
45136
+ ]);
44107
45137
  }
45138
+ return subtreeModelDefinitions;
44108
45139
  }
44109
45140
  if (target?.status === "ambiguous") {
44110
- return [...target.behaviorTrees, ...target.definitions].map(
44111
- (def) => def.idRange ? { uri: def.uri || parsed.uri, range: def.idRange } : def.range ? { uri: def.uri || parsed.uri, range: def.range } : void 0
44112
- ).filter((location) => Boolean(location));
45141
+ return uniqueLocations(
45142
+ [
45143
+ ...target.behaviorTrees.map(
45144
+ (def) => def.idRange ? { uri: def.uri || parsed.uri, range: def.idRange } : void 0
45145
+ ),
45146
+ ...subtreeModelDefinitions
45147
+ ].filter((location) => Boolean(location))
45148
+ );
44113
45149
  }
44114
- if (target?.status === "resolved" && target.kind === "node-model" && target.model.idRange) {
44115
- return [{ uri: target.model.uri || parsed.uri, range: target.model.idRange }];
45150
+ if (target?.status === "resolved" && target.kind === "node-model") {
45151
+ if (subtreeModelDefinitions.length > 0) return subtreeModelDefinitions;
45152
+ if (target.model.idRange) {
45153
+ return [{ uri: target.model.uri || parsed.uri, range: target.model.idRange }];
45154
+ }
44116
45155
  }
44117
- return [];
45156
+ return subtreeModelDefinitions;
44118
45157
  }
44119
45158
  if (element?.name === "root" && attribute?.name === "main_tree_to_execute") {
44120
45159
  return getBehaviorTrees(semantic, attribute.value).map((def) => def.idRange ? { uri: def.uri, range: def.idRange } : void 0).filter((location) => Boolean(location));
@@ -44127,6 +45166,20 @@ function getDefinitionLocations(parsed, documentView, position, semantic, config
44127
45166
  }
44128
45167
  if (attribute && element) {
44129
45168
  const binding = documentView ? findPortBindingAtPosition(documentView, position) : void 0;
45169
+ const blackboardReference = binding?.blackboardReferences.find(
45170
+ (reference) => position.offset >= reference.range.start.offset && position.offset <= reference.range.end.offset
45171
+ );
45172
+ if (blackboardReference) {
45173
+ return blackboardReference.scope === "global" ? getWorkspaceBlackboardLocations(
45174
+ documentView,
45175
+ workspaceDocuments,
45176
+ semantic,
45177
+ config2,
45178
+ policy,
45179
+ blackboardReference.identity,
45180
+ parsed.uri
45181
+ ) : getDocumentBlackboardLocations(documentView, blackboardReference.identity, parsed.uri);
45182
+ }
44130
45183
  if (binding?.declaredPort.status === "resolved") {
44131
45184
  const port = binding.declaredPort.port;
44132
45185
  if (port.nameRange) return [{ uri: port.uri || parsed.uri, range: port.nameRange }];
@@ -44170,12 +45223,16 @@ function getDefinition(context, input) {
44170
45223
  ]
44171
45224
  };
44172
45225
  }
44173
- if (symbol2.source.kind === "port-remap") {
45226
+ if (symbol2.source.kind === "port-remap" || symbol2.source.kind === "global-blackboard-remap") {
44174
45227
  const source = symbol2.source;
45228
+ const targetIdentity = makeBlackboardIdentity({
45229
+ scope: source.kind === "global-blackboard-remap" ? "global" : "local",
45230
+ key: symbol2.name
45231
+ });
44175
45232
  const binding = context.documentView?.nodes.filter((node) => node.behaviorTree === scriptTarget.attributeContext.behaviorTree).flatMap((node) => node.portBindings).filter(
44176
45233
  (binding2) => binding2.declaredPort.status === "resolved"
44177
45234
  ).find(
44178
- (binding2) => binding2.declaredPort.port.name === source.portName && binding2.declaredPort.port.direction === source.direction && getRemappedKey(binding2.declaredPort.port.name, binding2.value) === symbol2.name
45235
+ (binding2) => binding2.declaredPort.port.name === source.portName && binding2.declaredPort.port.direction === source.direction && binding2.blackboardReferences.some((reference) => reference.identity === targetIdentity)
44179
45236
  );
44180
45237
  const location = binding?.declaredPort.port.nameRange;
44181
45238
  if (location) {
@@ -44207,6 +45264,39 @@ function getDefinition(context, input) {
44207
45264
  }
44208
45265
  }
44209
45266
  }
45267
+ if (scriptTarget?.reference.kind === "global-blackboard") {
45268
+ const targetIdentity = makeBlackboardIdentity({
45269
+ scope: "global",
45270
+ key: scriptTarget.reference.key
45271
+ });
45272
+ const locations = getGlobalBlackboardReferenceLocations(context, scriptTarget.reference.key);
45273
+ if (locations.length > 0) {
45274
+ return {
45275
+ locations
45276
+ };
45277
+ }
45278
+ const symbol2 = scriptTarget.reference.symbol;
45279
+ if (symbol2?.source.kind === "global-blackboard") {
45280
+ const source = symbol2.source;
45281
+ const declarationState = getBehaviorTreeScriptFlowStates(
45282
+ context,
45283
+ scriptTarget.attributeContext.behaviorTree
45284
+ ).find((state) => state.id === source.originId);
45285
+ const declarationContext = declarationState?.context ?? scriptTarget.attributeContext;
45286
+ return {
45287
+ locations: [
45288
+ {
45289
+ uri: context.document.uri,
45290
+ range: mapDecodedAttributeRangeToDocumentRange(
45291
+ context.parsed ?? { originalText: context.document.text },
45292
+ declarationContext.attribute,
45293
+ source.range
45294
+ )
45295
+ }
45296
+ ]
45297
+ };
45298
+ }
45299
+ }
44210
45300
  return {
44211
45301
  locations: getDefinitionLocations(
44212
45302
  context.parsed,
@@ -44293,6 +45383,18 @@ function getHover(context, input) {
44293
45383
  Value: \`${scriptTarget.reference.value}\``
44294
45384
  };
44295
45385
  }
45386
+ if (scriptTarget.reference.kind === "global-blackboard") {
45387
+ const symbol3 = scriptTarget.reference.symbol;
45388
+ return {
45389
+ range: scriptTarget.range,
45390
+ contents: symbol3 ? [
45391
+ `**Global Blackboard** \`@${scriptTarget.reference.key}\``,
45392
+ "",
45393
+ `Type: \`${formatScriptType3(symbol3.type)}\``,
45394
+ `Source: ${describeScriptSymbol2(symbol3)}`
45395
+ ].join("\n") : `**Global Blackboard** \`@${scriptTarget.reference.key}\``
45396
+ };
45397
+ }
44296
45398
  const symbol2 = scriptTarget.reference.symbol;
44297
45399
  return {
44298
45400
  range: scriptTarget.range,
@@ -44389,7 +45491,7 @@ Resolves to SubTree model in \`${target.model.uri || context.parsed?.uri || "wor
44389
45491
  function toReferenceLocations(context, id) {
44390
45492
  return getSubTreeReferences(context.semantic, id).filter((ref) => ref.parentBehaviorTreeId && ref.idRange).map((ref) => ({ uri: ref.uri, range: ref.idRange })).filter((location) => Boolean(location.range));
44391
45493
  }
44392
- function uniqueLocations(locations) {
45494
+ function uniqueLocations2(locations) {
44393
45495
  const seen = /* @__PURE__ */ new Set();
44394
45496
  const result = [];
44395
45497
  for (const location of locations) {
@@ -44425,9 +45527,9 @@ function getReferences(context, input) {
44425
45527
  const scriptTarget = getScriptIdentifierTarget(context, input.position);
44426
45528
  if (scriptTarget) {
44427
45529
  return {
44428
- locations: uniqueLocations(
45530
+ locations: uniqueLocations2(
44429
45531
  getScriptReferencesForSymbol(context, scriptTarget).map((occurrence) => ({
44430
- uri: context.document.uri,
45532
+ uri: occurrence.uri,
44431
45533
  range: occurrence.documentRange
44432
45534
  }))
44433
45535
  )
@@ -44440,6 +45542,32 @@ function getReferences(context, input) {
44440
45542
  }) : void 0;
44441
45543
  const element = inspect && "element" in inspect ? inspect.element : void 0;
44442
45544
  const attribute = inspect && "attribute" in inspect ? inspect.attribute : void 0;
45545
+ const binding = context.documentView && context.parsed ? context.documentView.nodes.flatMap((node) => node.portBindings).find(
45546
+ (candidate) => candidate.attribute === attribute && input.position.offset >= (candidate.attribute.valueContentRange ?? candidate.attribute.valueRange).start.offset && input.position.offset <= (candidate.attribute.valueContentRange ?? candidate.attribute.valueRange).end.offset
45547
+ ) : void 0;
45548
+ const blackboardReference = binding?.blackboardReferences.find(
45549
+ (reference) => input.position.offset >= reference.range.start.offset && input.position.offset <= reference.range.end.offset
45550
+ );
45551
+ if (blackboardReference) {
45552
+ const identity = makeBlackboardIdentity({
45553
+ scope: blackboardReference.scope,
45554
+ key: blackboardReference.key
45555
+ });
45556
+ return {
45557
+ locations: uniqueLocations2([
45558
+ ...blackboardReference.scope === "global" ? getWorkspaceBlackboardLocations(
45559
+ context.documentView,
45560
+ context.workspace?.documents,
45561
+ context.semantic,
45562
+ context.config,
45563
+ context.nodeUsagePolicy,
45564
+ identity,
45565
+ context.document.uri
45566
+ ) : getDocumentBlackboardLocations(context.documentView, identity, context.document.uri),
45567
+ ...blackboardReference.scope === "global" ? getGlobalBlackboardScriptLocations(context, blackboardReference.key) : []
45568
+ ])
45569
+ };
45570
+ }
44443
45571
  if (element?.name === "BehaviorTree" && attribute?.name === "ID") {
44444
45572
  return {
44445
45573
  locations: toReferenceLocations(context, attribute.value)
@@ -44472,7 +45600,7 @@ function getReferences(context, input) {
44472
45600
  const ids = getReferencedSubTreeIds(context, defs);
44473
45601
  if (ids.length > 0) {
44474
45602
  return {
44475
- locations: uniqueLocations(ids.flatMap((id) => toReferenceLocations(context, id)))
45603
+ locations: uniqueLocations2(ids.flatMap((id) => toReferenceLocations(context, id)))
44476
45604
  };
44477
45605
  }
44478
45606
  return { locations: [] };
@@ -45081,8 +46209,8 @@ function createNodeWorkspaceHost(cwd = process.cwd()) {
45081
46209
  try {
45082
46210
  await import_promises.default.access(fileUriToPath3(uri), import_node_fs.constants.F_OK);
45083
46211
  return true;
45084
- } catch (error51) {
45085
- if (error51.code !== "ENOENT") throw error51;
46212
+ } catch (error52) {
46213
+ if (error52.code !== "ENOENT") throw error52;
45086
46214
  return false;
45087
46215
  }
45088
46216
  },
@@ -45213,8 +46341,8 @@ function createNodeWorkspaceService(options = {}) {
45213
46341
  resolve(result) {
45214
46342
  resolveReload?.(result);
45215
46343
  },
45216
- reject(error51) {
45217
- rejectReload?.(error51);
46344
+ reject(error52) {
46345
+ rejectReload?.(error52);
45218
46346
  }
45219
46347
  };
45220
46348
  }
@@ -45223,8 +46351,8 @@ function createNodeWorkspaceService(options = {}) {
45223
46351
  const scheduled = pendingReload;
45224
46352
  void load(lastLoadOptions).then((result) => {
45225
46353
  scheduled?.resolve(result);
45226
- }).catch((error51) => {
45227
- scheduled?.reject(error51);
46354
+ }).catch((error52) => {
46355
+ scheduled?.reject(error52);
45228
46356
  }).finally(() => {
45229
46357
  if (pendingReload === scheduled) pendingReload = void 0;
45230
46358
  });
@@ -45724,6 +46852,7 @@ function handleGetChildCapability(workspace, params) {
45724
46852
  }
45725
46853
 
45726
46854
  // src/server.ts
46855
+ var SERVER_VERSION = true ? "0.1.3" : "unknown";
45727
46856
  var connection = (0, import_node4.createConnection)(import_node4.ProposedFeatures.all);
45728
46857
  var documents = new import_node4.TextDocuments(TextDocument);
45729
46858
  var openUris = /* @__PURE__ */ new Set();
@@ -46091,7 +47220,7 @@ connection.onInitialize((params) => {
46091
47220
  return {
46092
47221
  serverInfo: {
46093
47222
  name: "btxml",
46094
- version: "0.1.0"
47223
+ version: SERVER_VERSION
46095
47224
  },
46096
47225
  capabilities: {
46097
47226
  textDocumentSync: import_node4.TextDocumentSyncKind.Incremental,
@@ -46250,8 +47379,8 @@ async function startLanguageServer() {
46250
47379
  }
46251
47380
 
46252
47381
  // src/main.ts
46253
- startLanguageServer().catch((error51) => {
46254
- process.stderr.write(`${String(error51)}
47382
+ startLanguageServer().catch((error52) => {
47383
+ process.stderr.write(`${String(error52)}
46255
47384
  `);
46256
47385
  process.exitCode = 1;
46257
47386
  });