ember-source 6.4.0-alpha.2 → 6.4.0-alpha.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.
Files changed (49) hide show
  1. package/build-metadata.json +3 -3
  2. package/dist/ember-template-compiler.js +907 -1527
  3. package/dist/ember-testing.js +1 -1
  4. package/dist/ember.debug.js +3574 -4029
  5. package/dist/ember.prod.js +3408 -3984
  6. package/dist/packages/@ember/-internals/glimmer/index.js +2 -2
  7. package/dist/packages/@ember/-internals/owner/index.js +1 -0
  8. package/dist/packages/@ember/application/index.js +2 -2
  9. package/dist/packages/@ember/application/instance.js +1 -1
  10. package/dist/packages/@ember/component/helper.js +1 -1
  11. package/dist/packages/@ember/component/index.js +1 -1
  12. package/dist/packages/@ember/debug/lib/capture-render-tree.js +5 -3
  13. package/dist/packages/@ember/engine/index.js +2 -2
  14. package/dist/packages/@ember/helper/index.js +1 -1
  15. package/dist/packages/@ember/modifier/index.js +1 -1
  16. package/dist/packages/@ember/renderer/index.js +1 -1
  17. package/dist/packages/@ember/routing/index.js +1 -1
  18. package/dist/packages/@ember/template/index.js +1 -1
  19. package/dist/packages/@ember/template-compiler/lib/plugins/index.js +1 -1
  20. package/dist/packages/@ember/template-compiler/lib/plugins/transform-resolutions.js +1 -1
  21. package/dist/packages/@ember/template-compiler/lib/template.js +73 -89
  22. package/dist/packages/@glimmer/destroyable/index.js +45 -16
  23. package/dist/packages/@glimmer/encoder/index.js +1 -2
  24. package/dist/packages/@glimmer/global-context/index.js +15 -27
  25. package/dist/packages/@glimmer/manager/index.js +137 -84
  26. package/dist/packages/@glimmer/node/index.js +7 -4
  27. package/dist/packages/@glimmer/opcode-compiler/index.js +564 -534
  28. package/dist/packages/@glimmer/owner/index.js +1 -0
  29. package/dist/packages/@glimmer/program/index.js +42 -109
  30. package/dist/packages/@glimmer/reference/index.js +18 -29
  31. package/dist/packages/@glimmer/runtime/index.js +3435 -3263
  32. package/dist/packages/@glimmer/util/index.js +32 -273
  33. package/dist/packages/@glimmer/validator/index.js +36 -43
  34. package/dist/packages/@glimmer/vm/index.js +2 -140
  35. package/dist/packages/@glimmer/wire-format/index.js +1 -2
  36. package/dist/packages/ember/barrel.js +1 -1
  37. package/dist/packages/ember/version.js +1 -1
  38. package/dist/packages/ember-testing/lib/initializers.js +1 -1
  39. package/dist/packages/shared-chunks/{index-CQygUgr9.js → index-y5ClupI2.js} +50 -45
  40. package/dist/packages/shared-chunks/{setup-registry-DXuvS1Rj.js → setup-registry-8yPevDL_.js} +1 -1
  41. package/dist/packages/shared-chunks/{transform-resolutions-O6uYv8DS.js → transform-resolutions-Dpc2ClA0.js} +298 -441
  42. package/docs/data.json +40 -22
  43. package/package.json +21 -22
  44. package/types/stable/@ember/-internals/glimmer/lib/component-managers/outlet.d.ts +1 -1
  45. package/types/stable/@ember/-internals/glimmer/lib/component-managers/unwrap-template.d.ts +7 -0
  46. package/types/stable/@ember/-internals/glimmer/lib/renderer.d.ts +7 -9
  47. package/types/stable/@ember/-internals/glimmer/lib/resolver.d.ts +2 -5
  48. package/types/stable/index.d.ts +1 -0
  49. package/dist/packages/@glimmer/debug/index.js +0 -168
@@ -1,5 +1,5 @@
1
1
  import '../@ember/debug/index.js';
2
- import { assert as debugAssert, isPresentArray, assertNever, getFirst, getLast, assign, dict, unwrap, asPresentArray, assertPresentArray, deprecate, expect } from '../@glimmer/util/index.js';
2
+ import { assertNever, assign, dict } from '../@glimmer/util/index.js';
3
3
  import { SexpOpcodes as opcodes } from '../@glimmer/wire-format/index.js';
4
4
  import { isDevelopingApp } from '@embroider/macros';
5
5
  import calculateLocationDisplay from '../@ember/template-compiler/lib/system/calculate-location-display.js';
@@ -5049,20 +5049,19 @@ var EventedTokenizer = /** @class */function () {
5049
5049
  return EventedTokenizer;
5050
5050
  }();
5051
5051
 
5052
- var Char = function (Char) {
5053
- return Char[Char.NBSP = 160] = "NBSP", Char[Char.QUOT = 34] = "QUOT", Char[Char.LT = 60] = "LT", Char[Char.GT = 62] = "GT", Char[Char.AMP = 38] = "AMP", Char;
5054
- }(Char || {});
5055
- const ATTR_VALUE_REGEX_TEST = /["&\xA0]/u,
5052
+ const ATTR_VALUE_REGEX_TEST = /["\x26\xa0]/u,
5056
5053
  ATTR_VALUE_REGEX_REPLACE = new RegExp(ATTR_VALUE_REGEX_TEST.source, "gu"),
5057
- TEXT_REGEX_TEST = /[&<>\xA0]/u,
5054
+ TEXT_REGEX_TEST = /[&<>\xa0]/u,
5058
5055
  TEXT_REGEX_REPLACE = new RegExp(TEXT_REGEX_TEST.source, "gu");
5056
+
5057
+ // \x26 is ampersand, \xa0 is non-breaking space
5059
5058
  function attrValueReplacer(char) {
5060
5059
  switch (char.charCodeAt(0)) {
5061
- case Char.NBSP:
5060
+ case 160:
5062
5061
  return "&nbsp;";
5063
- case Char.QUOT:
5062
+ case 34:
5064
5063
  return "&quot;";
5065
- case Char.AMP:
5064
+ case 38:
5066
5065
  return "&amp;";
5067
5066
  default:
5068
5067
  return char;
@@ -5070,13 +5069,13 @@ function attrValueReplacer(char) {
5070
5069
  }
5071
5070
  function textReplacer(char) {
5072
5071
  switch (char.charCodeAt(0)) {
5073
- case Char.NBSP:
5072
+ case 160:
5074
5073
  return "&nbsp;";
5075
- case Char.AMP:
5074
+ case 38:
5076
5075
  return "&amp;";
5077
- case Char.LT:
5076
+ case 60:
5078
5077
  return "&lt;";
5079
- case Char.GT:
5078
+ case 62:
5080
5079
  return "&gt;";
5081
5080
  default:
5082
5081
  return char;
@@ -5101,10 +5100,8 @@ function isVoidTag(tag) {
5101
5100
  return voidMap.has(tag.toLowerCase()) && tag[0]?.toLowerCase() === tag[0];
5102
5101
  }
5103
5102
  class Printer {
5104
- buffer = "";
5105
- options;
5106
5103
  constructor(options) {
5107
- this.options = options;
5104
+ this.buffer = "", this.options = options;
5108
5105
  }
5109
5106
  /*
5110
5107
  This is used by _all_ methods on this Printer class that add to `this.buffer`,
@@ -5327,10 +5324,10 @@ class Printer {
5327
5324
  this.handledByOverride(str) || (this.buffer += JSON.stringify(str.value));
5328
5325
  }
5329
5326
  BooleanLiteral(bool) {
5330
- this.handledByOverride(bool) || (this.buffer += bool.value);
5327
+ this.handledByOverride(bool) || (this.buffer += String(bool.value));
5331
5328
  }
5332
5329
  NumberLiteral(number) {
5333
- this.handledByOverride(number) || (this.buffer += number.value);
5330
+ this.handledByOverride(number) || (this.buffer += String(number.value));
5334
5331
  }
5335
5332
  UndefinedLiteral(node) {
5336
5333
  this.handledByOverride(node) || (this.buffer += "undefined");
@@ -5352,6 +5349,7 @@ class Printer {
5352
5349
  function build(ast, options = {
5353
5350
  entityEncoding: "transformed"
5354
5351
  }) {
5352
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- JS users
5355
5353
  return ast ? new Printer(options).print(ast) : "";
5356
5354
  }
5357
5355
  function isKeyword(word, type) {
@@ -5363,28 +5361,39 @@ function isKeyword(word, type) {
5363
5361
  * language, and where their valid usages are.
5364
5362
  */
5365
5363
  const KEYWORDS_TYPES = {
5366
- action: ["Call", "Modifier"],
5367
- component: ["Call", "Append", "Block"],
5368
- debugger: ["Append"],
5369
- "each-in": ["Block"],
5370
- each: ["Block"],
5371
- "has-block-params": ["Call", "Append"],
5372
- "has-block": ["Call", "Append"],
5373
- helper: ["Call", "Append"],
5374
- if: ["Call", "Append", "Block"],
5375
- "in-element": ["Block"],
5376
- let: ["Block"],
5377
- log: ["Call", "Append"],
5378
- modifier: ["Call", "Modifier"],
5379
- mount: ["Append"],
5380
- mut: ["Call", "Append"],
5381
- outlet: ["Append"],
5382
- readonly: ["Call", "Append"],
5383
- unbound: ["Call", "Append"],
5384
- unless: ["Call", "Append", "Block"],
5385
- yield: ["Append"]
5386
- },
5387
- UNKNOWN_POSITION = Object.freeze({
5364
+ action: ["Call", "Modifier"],
5365
+ component: ["Call", "Append", "Block"],
5366
+ debugger: ["Append"],
5367
+ "each-in": ["Block"],
5368
+ each: ["Block"],
5369
+ "has-block-params": ["Call", "Append"],
5370
+ "has-block": ["Call", "Append"],
5371
+ helper: ["Call", "Append"],
5372
+ if: ["Call", "Append", "Block"],
5373
+ "in-element": ["Block"],
5374
+ let: ["Block"],
5375
+ log: ["Call", "Append"],
5376
+ modifier: ["Call", "Modifier"],
5377
+ mount: ["Append"],
5378
+ mut: ["Call", "Append"],
5379
+ outlet: ["Append"],
5380
+ readonly: ["Call", "Append"],
5381
+ unbound: ["Call", "Append"],
5382
+ unless: ["Call", "Append", "Block"],
5383
+ yield: ["Append"]
5384
+ };
5385
+
5386
+ // import Logger from './logger';
5387
+ function isPresentArray(list) {
5388
+ return !!list && list.length > 0;
5389
+ }
5390
+ function getLast(list) {
5391
+ return 0 === list.length ? void 0 : list[list.length - 1];
5392
+ }
5393
+ function getFirst(list) {
5394
+ return 0 === list.length ? void 0 : list[0];
5395
+ }
5396
+ const UNKNOWN_POSITION = Object.freeze({
5388
5397
  line: 1,
5389
5398
  column: 0
5390
5399
  }),
@@ -5403,20 +5412,7 @@ const KEYWORDS_TYPES = {
5403
5412
  start: UNKNOWN_POSITION,
5404
5413
  end: UNKNOWN_POSITION
5405
5414
  });
5406
- let OffsetKind = function (OffsetKind) {
5407
- return OffsetKind.CharPosition = "CharPosition", OffsetKind.HbsPosition = "HbsPosition", OffsetKind.InternalsSynthetic = "InternalsSynthetic", OffsetKind.NonExistent = "NonExistent", OffsetKind.Broken = "Broken", OffsetKind;
5408
- }({});
5409
-
5410
- /**
5411
- * This file implements the DSL used by span and offset in places where they need to exhaustively
5412
- * consider all combinations of states (Handlebars offsets, character offsets and invisible/broken
5413
- * offsets).
5414
- *
5415
- * It's probably overkill, but it makes the code that uses it clear. It could be refactored or
5416
- * removed.
5417
- */
5418
5415
  class WhenList {
5419
- _whens;
5420
5416
  constructor(whens) {
5421
5417
  this._whens = whens;
5422
5418
  }
@@ -5429,7 +5425,6 @@ class WhenList {
5429
5425
  }
5430
5426
  }
5431
5427
  class When {
5432
- _map = new Map();
5433
5428
  get(pattern, or) {
5434
5429
  let value = this._map.get(pattern);
5435
5430
  return value || (value = or(), this._map.set(pattern, value), value);
@@ -5440,9 +5435,9 @@ class When {
5440
5435
  match(kind) {
5441
5436
  const pattern = function (kind) {
5442
5437
  switch (kind) {
5443
- case OffsetKind.Broken:
5444
- case OffsetKind.InternalsSynthetic:
5445
- case OffsetKind.NonExistent:
5438
+ case "Broken":
5439
+ case "InternalsSynthetic":
5440
+ case "NonExistent":
5446
5441
  return "IS_INVISIBLE";
5447
5442
  default:
5448
5443
  return kind;
@@ -5453,30 +5448,32 @@ class When {
5453
5448
  fallback = this._map.get("MATCH_ANY");
5454
5449
  return exact && out.push(exact), fallback && out.push(fallback), out;
5455
5450
  }
5451
+ constructor() {
5452
+ this._map = new Map();
5453
+ }
5456
5454
  }
5457
5455
  function match(callback) {
5458
- return callback(new Matcher()).check();
5456
+ return callback(new Matcher()).validate();
5459
5457
  }
5460
5458
  class Matcher {
5461
- _whens = new When();
5462
5459
  /**
5463
5460
  * You didn't exhaustively match all possibilities.
5464
5461
  */
5465
- check() {
5462
+ validate() {
5466
5463
  return (left, right) => this.matchFor(left.kind, right.kind)(left, right);
5467
5464
  }
5468
5465
  matchFor(left, right) {
5469
5466
  const nesteds = this._whens.match(left);
5470
- debugAssert(isPresentArray(nesteds), `no match defined for (${left}, ${right}) and no AnyMatch defined either`);
5471
- const callback = new WhenList(nesteds).first(right);
5472
- return debugAssert(null !== callback, `no match defined for (${left}, ${right}) and no AnyMatch defined either`), callback;
5473
- }
5474
- // This big block is the bulk of the heavy lifting in this file. It facilitates exhaustiveness
5475
- // checking so that matchers can ensure they've actually covered all the cases (and TypeScript
5476
- // will treat it as an exhaustive match).
5477
- when(left, right, callback) {
5467
+ return isPresentArray(), new WhenList(nesteds).first(right);
5468
+ }
5469
+ when(left, right,
5470
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5471
+ callback) {
5478
5472
  return this._whens.get(left, () => new When()).add(right, callback), this;
5479
5473
  }
5474
+ constructor() {
5475
+ this._whens = new When();
5476
+ }
5480
5477
  }
5481
5478
  class SourceSlice {
5482
5479
  static synthetic(chars) {
@@ -5492,8 +5489,6 @@ class SourceSlice {
5492
5489
  chars: slice[0]
5493
5490
  });
5494
5491
  }
5495
- chars;
5496
- loc;
5497
5492
  constructor(options) {
5498
5493
  this.loc = options.loc, this.chars = options.chars;
5499
5494
  }
@@ -5505,9 +5500,6 @@ class SourceSlice {
5505
5500
  }
5506
5501
  }
5507
5502
 
5508
- /**
5509
- * All spans have these details in common.
5510
- */
5511
5503
  /**
5512
5504
  * A `SourceSpan` object represents a span of characters inside of a template source.
5513
5505
  *
@@ -5544,10 +5536,10 @@ class SourceSlice {
5544
5536
  */
5545
5537
  class SourceSpan {
5546
5538
  static get NON_EXISTENT() {
5547
- return new InvisibleSpan(OffsetKind.NonExistent, NON_EXISTENT_LOCATION).wrap();
5539
+ return new InvisibleSpan("NonExistent", NON_EXISTENT_LOCATION).wrap();
5548
5540
  }
5549
5541
  static load(source, serialized) {
5550
- return "number" == typeof serialized ? SourceSpan.forCharPositions(source, serialized, serialized) : "string" == typeof serialized ? SourceSpan.synthetic(serialized) : Array.isArray(serialized) ? SourceSpan.forCharPositions(source, serialized[0], serialized[1]) : serialized === OffsetKind.NonExistent ? SourceSpan.NON_EXISTENT : serialized === OffsetKind.Broken ? SourceSpan.broken(BROKEN_LOCATION) : void assertNever(serialized);
5542
+ return "number" == typeof serialized ? SourceSpan.forCharPositions(source, serialized, serialized) : "string" == typeof serialized ? SourceSpan.synthetic(serialized) : Array.isArray(serialized) ? SourceSpan.forCharPositions(source, serialized[0], serialized[1]) : "NonExistent" === serialized ? SourceSpan.NON_EXISTENT : "Broken" === serialized ? SourceSpan.broken(BROKEN_LOCATION) : void assertNever(serialized);
5551
5543
  }
5552
5544
  static forHbsLoc(source, loc) {
5553
5545
  const start = new HbsPosition(source, loc.start),
@@ -5566,14 +5558,22 @@ class SourceSpan {
5566
5558
  }).wrap();
5567
5559
  }
5568
5560
  static synthetic(chars) {
5569
- return new InvisibleSpan(OffsetKind.InternalsSynthetic, NON_EXISTENT_LOCATION, chars).wrap();
5561
+ return new InvisibleSpan("InternalsSynthetic", NON_EXISTENT_LOCATION, chars).wrap();
5570
5562
  }
5571
5563
  static broken(pos = BROKEN_LOCATION) {
5572
- return new InvisibleSpan(OffsetKind.Broken, pos).wrap();
5564
+ return new InvisibleSpan("Broken", pos).wrap();
5573
5565
  }
5574
- isInvisible;
5575
5566
  constructor(data) {
5576
- this.data = data, this.isInvisible = data.kind !== OffsetKind.CharPosition && data.kind !== OffsetKind.HbsPosition;
5567
+ var kind;
5568
+ /**
5569
+ * This file implements the DSL used by span and offset in places where they need to exhaustively
5570
+ * consider all combinations of states (Handlebars offsets, character offsets and invisible/broken
5571
+ * offsets).
5572
+ *
5573
+ * It's probably overkill, but it makes the code that uses it clear. It could be refactored or
5574
+ * removed.
5575
+ */
5576
+ this.data = data, this.isInvisible = "CharPosition" !== (kind = data.kind) && "HbsPosition" !== kind;
5577
5577
  }
5578
5578
  getStart() {
5579
5579
  return this.data.getStart().wrap();
@@ -5713,10 +5713,9 @@ class SourceSpan {
5713
5713
  }
5714
5714
  }
5715
5715
  class CharPositionSpan {
5716
- kind = OffsetKind.CharPosition;
5717
- _locPosSpan = null;
5716
+ #locPosSpan;
5718
5717
  constructor(source, charPositions) {
5719
- this.source = source, this.charPositions = charPositions;
5718
+ this.source = source, this.charPositions = charPositions, this.kind = "CharPosition", this.#locPosSpan = null;
5720
5719
  }
5721
5720
  wrap() {
5722
5721
  return new SourceSpan(this);
@@ -5735,11 +5734,11 @@ class CharPositionSpan {
5735
5734
  }
5736
5735
  locDidUpdate() {}
5737
5736
  toHbsSpan() {
5738
- let locPosSpan = this._locPosSpan;
5737
+ let locPosSpan = this.#locPosSpan;
5739
5738
  if (null === locPosSpan) {
5740
5739
  const start = this.charPositions.start.toHbsPos(),
5741
5740
  end = this.charPositions.end.toHbsPos();
5742
- locPosSpan = this._locPosSpan = null === start || null === end ? BROKEN : new HbsSpan(this.source, {
5741
+ locPosSpan = this.#locPosSpan = null === start || null === end ? BROKEN : new HbsSpan(this.source, {
5743
5742
  start: start,
5744
5743
  end: end
5745
5744
  });
@@ -5762,24 +5761,23 @@ class CharPositionSpan {
5762
5761
  }
5763
5762
  }
5764
5763
  class HbsSpan {
5765
- kind = OffsetKind.HbsPosition;
5766
- _charPosSpan = null;
5764
+ #charPosSpan;
5767
5765
  // the source location from Handlebars + AST Plugins -- could be wrong
5768
- _providedHbsLoc;
5766
+ #providedHbsLoc;
5769
5767
  constructor(source, hbsPositions, providedHbsLoc = null) {
5770
- this.source = source, this.hbsPositions = hbsPositions, this._providedHbsLoc = providedHbsLoc;
5768
+ this.source = source, this.hbsPositions = hbsPositions, this.kind = "HbsPosition", this.#charPosSpan = null, this.#providedHbsLoc = providedHbsLoc;
5771
5769
  }
5772
5770
  serialize() {
5773
5771
  const charPos = this.toCharPosSpan();
5774
- return null === charPos ? OffsetKind.Broken : charPos.wrap().serialize();
5772
+ return null === charPos ? "Broken" : charPos.wrap().serialize();
5775
5773
  }
5776
5774
  wrap() {
5777
5775
  return new SourceSpan(this);
5778
5776
  }
5779
5777
  updateProvided(pos, edge) {
5780
- this._providedHbsLoc && (this._providedHbsLoc[edge] = pos),
5778
+ this.#providedHbsLoc && (this.#providedHbsLoc[edge] = pos),
5781
5779
  // invalidate computed character offsets
5782
- this._charPosSpan = null, this._providedHbsLoc = {
5780
+ this.#charPosSpan = null, this.#providedHbsLoc = {
5783
5781
  start: pos,
5784
5782
  end: pos
5785
5783
  };
@@ -5813,12 +5811,12 @@ class HbsSpan {
5813
5811
  return this;
5814
5812
  }
5815
5813
  toCharPosSpan() {
5816
- let charPosSpan = this._charPosSpan;
5814
+ let charPosSpan = this.#charPosSpan;
5817
5815
  if (null === charPosSpan) {
5818
5816
  const start = this.hbsPositions.start.toCharPos(),
5819
5817
  end = this.hbsPositions.end.toCharPos();
5820
- if (!start || !end) return charPosSpan = this._charPosSpan = BROKEN, null;
5821
- charPosSpan = this._charPosSpan = new CharPositionSpan(this.source, {
5818
+ if (!start || !end) return charPosSpan = this.#charPosSpan = BROKEN, null;
5819
+ charPosSpan = this.#charPosSpan = new CharPositionSpan(this.source, {
5822
5820
  start: start,
5823
5821
  end: end
5824
5822
  });
@@ -5836,10 +5834,10 @@ class InvisibleSpan {
5836
5834
  }
5837
5835
  serialize() {
5838
5836
  switch (this.kind) {
5839
- case OffsetKind.Broken:
5840
- case OffsetKind.NonExistent:
5837
+ case "Broken":
5838
+ case "NonExistent":
5841
5839
  return this.kind;
5842
- case OffsetKind.InternalsSynthetic:
5840
+ case "InternalsSynthetic":
5843
5841
  return this.string || "";
5844
5842
  }
5845
5843
  }
@@ -5875,25 +5873,21 @@ class InvisibleSpan {
5875
5873
  return BROKEN_LOCATION;
5876
5874
  }
5877
5875
  }
5878
- const span = match(m => m.when(OffsetKind.HbsPosition, OffsetKind.HbsPosition, (left, right) => new HbsSpan(left.source, {
5876
+ const span = match(m => m.when("HbsPosition", "HbsPosition", (left, right) => new HbsSpan(left.source, {
5879
5877
  start: left,
5880
5878
  end: right
5881
- }).wrap()).when(OffsetKind.CharPosition, OffsetKind.CharPosition, (left, right) => new CharPositionSpan(left.source, {
5879
+ }).wrap()).when("CharPosition", "CharPosition", (left, right) => new CharPositionSpan(left.source, {
5882
5880
  start: left,
5883
5881
  end: right
5884
- }).wrap()).when(OffsetKind.CharPosition, OffsetKind.HbsPosition, (left, right) => {
5882
+ }).wrap()).when("CharPosition", "HbsPosition", (left, right) => {
5885
5883
  const rightCharPos = right.toCharPos();
5886
- return null === rightCharPos ? new InvisibleSpan(OffsetKind.Broken, BROKEN_LOCATION).wrap() : span(left, rightCharPos);
5887
- }).when(OffsetKind.HbsPosition, OffsetKind.CharPosition, (left, right) => {
5884
+ return null === rightCharPos ? new InvisibleSpan("Broken", BROKEN_LOCATION).wrap() : span(left, rightCharPos);
5885
+ }).when("HbsPosition", "CharPosition", (left, right) => {
5888
5886
  const leftCharPos = left.toCharPos();
5889
- return null === leftCharPos ? new InvisibleSpan(OffsetKind.Broken, BROKEN_LOCATION).wrap() : span(leftCharPos, right);
5887
+ return null === leftCharPos ? new InvisibleSpan("Broken", BROKEN_LOCATION).wrap() : span(leftCharPos, right);
5890
5888
  }).when("IS_INVISIBLE", "MATCH_ANY", left => new InvisibleSpan(left.kind, BROKEN_LOCATION).wrap()).when("MATCH_ANY", "IS_INVISIBLE", (_, right) => new InvisibleSpan(right.kind, BROKEN_LOCATION).wrap())),
5891
5889
  BROKEN = "BROKEN";
5892
5890
 
5893
- /**
5894
- * All positions have these details in common. Most notably, all three kinds of positions can
5895
- * must be able to attempt to convert themselves into {@see CharPosition}.
5896
- */
5897
5891
  /**
5898
5892
  * Used to indicate that an attempt to convert a `SourcePosition` to a character offset failed. It
5899
5893
  * is separate from `null` so that `null` can be used to indicate that the computation wasn't yet
@@ -5924,7 +5918,7 @@ class SourceOffset {
5924
5918
  * any part of the source.
5925
5919
  */
5926
5920
  static broken(pos = UNKNOWN_POSITION) {
5927
- return new InvisiblePosition(OffsetKind.Broken, pos).wrap();
5921
+ return new InvisiblePosition("Broken", pos).wrap();
5928
5922
  }
5929
5923
  constructor(data) {
5930
5924
  this.data = data;
@@ -5969,7 +5963,7 @@ class SourceOffset {
5969
5963
  if (null === charPos) return SourceOffset.broken();
5970
5964
  {
5971
5965
  const result = charPos.offset + by;
5972
- return charPos.source.check(result) ? new CharPosition(charPos.source, result).wrap() : SourceOffset.broken();
5966
+ return charPos.source.validate(result) ? new CharPosition(charPos.source, result).wrap() : SourceOffset.broken();
5973
5967
  }
5974
5968
  }
5975
5969
  /**
@@ -5988,11 +5982,8 @@ class SourceOffset {
5988
5982
  }
5989
5983
  }
5990
5984
  class CharPosition {
5991
- kind = OffsetKind.CharPosition;
5992
- /** Computed from char offset */
5993
- _locPos = null;
5994
5985
  constructor(source, charPos) {
5995
- this.source = source, this.charPos = charPos;
5986
+ this.source = source, this.charPos = charPos, this.kind = "CharPosition", this._locPos = null;
5996
5987
  }
5997
5988
  /**
5998
5989
  * This is already a `CharPosition`.
@@ -6035,10 +6026,8 @@ class CharPosition {
6035
6026
  }
6036
6027
  }
6037
6028
  class HbsPosition {
6038
- kind = OffsetKind.HbsPosition;
6039
- _charPos;
6040
6029
  constructor(source, hbsPos, charPos = null) {
6041
- this.source = source, this.hbsPos = hbsPos, this._charPos = null === charPos ? null : new CharPosition(source, charPos);
6030
+ this.source = source, this.hbsPos = hbsPos, this.kind = "HbsPosition", this._charPos = null === charPos ? null : new CharPosition(source, charPos);
6042
6031
  }
6043
6032
  /**
6044
6033
  * Lazily compute the character offset from the {@see SourcePosition}. Once an `HbsPosition` has
@@ -6108,17 +6097,17 @@ class InvisiblePosition {
6108
6097
  *
6109
6098
  * @see {SourceOffset#eql}
6110
6099
  */
6111
- const eql = match(m => m.when(OffsetKind.HbsPosition, OffsetKind.HbsPosition, ({
6100
+ const eql = match(m => m.when("HbsPosition", "HbsPosition", ({
6112
6101
  hbsPos: left
6113
6102
  }, {
6114
6103
  hbsPos: right
6115
- }) => left.column === right.column && left.line === right.line).when(OffsetKind.CharPosition, OffsetKind.CharPosition, ({
6104
+ }) => left.column === right.column && left.line === right.line).when("CharPosition", "CharPosition", ({
6116
6105
  charPos: left
6117
6106
  }, {
6118
6107
  charPos: right
6119
- }) => left === right).when(OffsetKind.CharPosition, OffsetKind.HbsPosition, ({
6108
+ }) => left === right).when("CharPosition", "HbsPosition", ({
6120
6109
  offset: left
6121
- }, right) => left === right.toCharPos()?.offset).when(OffsetKind.HbsPosition, OffsetKind.CharPosition, (left, {
6110
+ }, right) => left === right.toCharPos()?.offset).when("HbsPosition", "CharPosition", (left, {
6122
6111
  offset: right
6123
6112
  }) => left.toCharPos()?.offset === right).when("MATCH_ANY", "MATCH_ANY", () => !1));
6124
6113
  class Source {
@@ -6131,7 +6120,7 @@ class Source {
6131
6120
  /**
6132
6121
  * Validate that the character offset represents a position in the source string.
6133
6122
  */
6134
- check(offset) {
6123
+ validate(offset) {
6135
6124
  return offset >= 0 && offset <= this.source.length;
6136
6125
  }
6137
6126
  slice(start, end) {
@@ -6162,7 +6151,6 @@ class Source {
6162
6151
  let seenLines = 0,
6163
6152
  seenChars = 0;
6164
6153
  if (offset > this.source.length) return null;
6165
- // eslint-disable-next-line no-constant-condition
6166
6154
  for (;;) {
6167
6155
  let nextLine = this.source.indexOf("\n", seenChars);
6168
6156
  if (offset <= nextLine || -1 === nextLine) return {
@@ -6186,7 +6174,7 @@ class Source {
6186
6174
  if (seenChars + column > nextLine) return nextLine;
6187
6175
  if (isDevelopingApp()) {
6188
6176
  let roundTrip = this.hbsPosFor(seenChars + column);
6189
- debugAssert(null !== roundTrip, "the returned offset failed to round-trip"), debugAssert(roundTrip.line === line, "the round-tripped line didn't match the original line"), debugAssert(roundTrip.column === column, "the round-tripped column didn't match the original column");
6177
+ roundTrip.line, roundTrip.column;
6190
6178
  }
6191
6179
  return seenChars + column;
6192
6180
  }
@@ -6200,7 +6188,6 @@ class SpanList {
6200
6188
  static range(span, fallback = SourceSpan.NON_EXISTENT) {
6201
6189
  return new SpanList(span.map(loc)).getRangeOffset(fallback);
6202
6190
  }
6203
- _span;
6204
6191
  constructor(span = []) {
6205
6192
  this._span = span;
6206
6193
  }
@@ -6230,7 +6217,7 @@ function hasSpan(span) {
6230
6217
  function maybeLoc(location, fallback) {
6231
6218
  return hasSpan(location) ? loc(location) : fallback;
6232
6219
  }
6233
- var api$2 = Object.freeze({
6220
+ var api$1 = Object.freeze({
6234
6221
  __proto__: null,
6235
6222
  NON_EXISTENT_LOCATION: NON_EXISTENT_LOCATION,
6236
6223
  SYNTHETIC_LOCATION: SYNTHETIC_LOCATION,
@@ -6288,7 +6275,10 @@ const visitorKeys = {
6288
6275
  let error = Error.call(this, message);
6289
6276
  this.key = key, this.message = message, this.node = node, this.parent = parent, error.stack && (this.stack = error.stack);
6290
6277
  }
6291
- return TraversalError.prototype = Object.create(Error.prototype), TraversalError.prototype.constructor = TraversalError, TraversalError;
6278
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
6279
+ return TraversalError.prototype = Object.create(Error.prototype),
6280
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
6281
+ TraversalError.prototype.constructor = TraversalError, TraversalError;
6292
6282
  }();
6293
6283
  function cannotRemoveNode(node, parent, key) {
6294
6284
  return new TraversalError("Cannot remove a node unless it is part of an array", node, parent, key);
@@ -6300,9 +6290,6 @@ function cannotReplaceOrRemoveInKeyHandlerYet(node, key) {
6300
6290
  return new TraversalError("Replacing and removing in key handlers is not yet supported.", node, null, key);
6301
6291
  }
6302
6292
  class WalkerPath {
6303
- node;
6304
- parent;
6305
- parentKey;
6306
6293
  constructor(node, parent = null, parentKey = null) {
6307
6294
  this.node = node, this.parent = parent, this.parentKey = parentKey;
6308
6295
  }
@@ -6316,7 +6303,6 @@ class WalkerPath {
6316
6303
  }
6317
6304
  }
6318
6305
  class PathParentsIterator {
6319
- path;
6320
6306
  constructor(path) {
6321
6307
  this.path = path;
6322
6308
  }
@@ -6346,7 +6332,10 @@ function visitNode(visitor, path) {
6346
6332
  parentKey: parentKey
6347
6333
  } = path,
6348
6334
  handler = function (visitor, nodeType) {
6349
- if (visitor.Program && ("Template" === nodeType && !visitor.Template || "Block" === nodeType && !visitor.Block)) return deprecate(`The 'Program' visitor node is deprecated. Use 'Template' or 'Block' instead (node was '${nodeType}') `), visitor.Program;
6335
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
6336
+ if (visitor.Program && ("Template" === nodeType && !visitor.Template || "Block" === nodeType && !visitor.Block))
6337
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
6338
+ return visitor.Program;
6350
6339
  let handler = visitor[nodeType];
6351
6340
  return void 0 !== handler ? handler : visitor.All;
6352
6341
  }(visitor, node.type);
@@ -6391,9 +6380,11 @@ function visitKey(visitor, handler, path, key) {
6391
6380
  void 0 !== result &&
6392
6381
  // TODO: dynamically check the results by having a table of
6393
6382
  // expected node types in value space, not just type space
6383
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any
6394
6384
  function (node, key, value, result) {
6395
6385
  if (null === result) throw cannotRemoveNode(value, node, key);
6396
6386
  if (Array.isArray(result)) {
6387
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
6397
6388
  if (1 !== result.length) throw 0 === result.length ? cannotRemoveNode(value, node, key) : cannotReplaceNode(value, node, key);
6398
6389
  set(node, key, result[0]);
6399
6390
  } else set(node, key, result);
@@ -6404,7 +6395,7 @@ function visitKey(visitor, handler, path, key) {
6404
6395
  }
6405
6396
  function visitArray(visitor, array, parent, parentKey) {
6406
6397
  for (let i = 0; i < array.length; i++) {
6407
- let node = unwrap(array[i]),
6398
+ let node = array[i],
6408
6399
  result = visitNode(visitor, new WalkerPath(node, parent, parentKey));
6409
6400
  void 0 !== result && (i += spliceArray(array, i, result) - 1);
6410
6401
  }
@@ -6416,9 +6407,8 @@ function traverse(node, visitor) {
6416
6407
  visitNode(visitor, new WalkerPath(node));
6417
6408
  }
6418
6409
  class Walker {
6419
- stack = [];
6420
6410
  constructor(order) {
6421
- this.order = order;
6411
+ this.order = order, this.stack = [];
6422
6412
  }
6423
6413
  visit(node, visitor) {
6424
6414
  node && (this.stack.push(node), "post" === this.order ? (this.children(node, visitor), visitor(node, this)) : (visitor(node, this), this.children(node, visitor)), this.stack.pop());
@@ -6458,9 +6448,6 @@ let _SOURCE;
6458
6448
  function SOURCE() {
6459
6449
  return _SOURCE || (_SOURCE = new Source("", "(synthetic)")), _SOURCE;
6460
6450
  }
6461
-
6462
- // const SOURCE = new Source('', '(tests)');
6463
- // Statements
6464
6451
  function buildVar(name, loc) {
6465
6452
  return b.var({
6466
6453
  name: name,
@@ -6472,7 +6459,7 @@ function buildPath(path, loc) {
6472
6459
  if ("string" != typeof path) {
6473
6460
  if ("type" in path) return path;
6474
6461
  {
6475
- debugAssert(-1 === path.head.indexOf("."), "builder.path({ head, tail }) should not be called with a head with dots in it");
6462
+ path.head.indexOf(".");
6476
6463
  let {
6477
6464
  head: head,
6478
6465
  tail: tail
@@ -6493,7 +6480,7 @@ function buildPath(path, loc) {
6493
6480
  head: head,
6494
6481
  tail: tail
6495
6482
  } = function (original, loc) {
6496
- let [head, ...tail] = asPresentArray(original.split(".")),
6483
+ let [head, ...tail] = original.split("."),
6497
6484
  headNode = b.head({
6498
6485
  original: head,
6499
6486
  loc: buildLoc(loc || null)
@@ -6580,11 +6567,11 @@ var publicBuilder = {
6580
6567
  block: function (path, params, hash, _defaultBlock, _elseBlock = null, loc, openStrip, inverseStrip, closeStrip) {
6581
6568
  let defaultBlock,
6582
6569
  elseBlock = null;
6583
- return "Template" === _defaultBlock.type ? (deprecate("b.program is deprecated. Use b.blockItself instead."), defaultBlock = b.blockItself({
6570
+ return defaultBlock = "Template" === _defaultBlock.type ? b.blockItself({
6584
6571
  params: buildBlockParams(_defaultBlock.blockParams),
6585
6572
  body: _defaultBlock.body,
6586
6573
  loc: _defaultBlock.loc
6587
- })) : defaultBlock = _defaultBlock, "Template" === _elseBlock?.type ? (deprecate("b.program is deprecated. Use b.blockItself instead."), debugAssert(0 === _elseBlock.blockParams.length, "{{else}} block cannot have block params"), elseBlock = b.blockItself({
6574
+ }) : _defaultBlock, "Template" === _elseBlock?.type ? (_elseBlock.blockParams.length, elseBlock = b.blockItself({
6588
6575
  params: [],
6589
6576
  body: _elseBlock.body,
6590
6577
  loc: _elseBlock.loc
@@ -6612,9 +6599,7 @@ var publicBuilder = {
6612
6599
  loc: buildLoc(loc || null)
6613
6600
  });
6614
6601
  },
6615
- element:
6616
- // Nodes
6617
- function (tag, options = {}) {
6602
+ element: function (tag, options = {}) {
6618
6603
  let path,
6619
6604
  selfClosing,
6620
6605
  {
@@ -6628,10 +6613,10 @@ var publicBuilder = {
6628
6613
  loc: loc
6629
6614
  } = options;
6630
6615
  // this is used for backwards compat, prior to `selfClosing` being part of the ElementNode AST
6631
- "string" == typeof tag ? tag.endsWith("/") ? (path = buildPath(tag.slice(0, -1)), selfClosing = !0) : path = buildPath(tag) : "type" in tag ? (debugAssert("PathExpression" === tag.type, `Invalid tag type ${tag.type}`), path = tag) : "path" in tag ? (debugAssert("PathExpression" === tag.path.type, `Invalid tag type ${tag.path.type}`), path = tag.path, selfClosing = tag.selfClosing) : (path = buildPath(tag.name), selfClosing = tag.selfClosing), selfClosing && debugAssert(null == _closeTag, "Cannot build a self-closing tag with a closeTag source location");
6616
+ "string" == typeof tag ? tag.endsWith("/") ? (path = buildPath(tag.slice(0, -1)), selfClosing = !0) : path = buildPath(tag) : "type" in tag ? (tag.type, tag.type, path = tag) : "path" in tag ? (tag.path.type, tag.path.type, path = tag.path, selfClosing = tag.selfClosing) : (path = buildPath(tag.name), selfClosing = tag.selfClosing);
6632
6617
  let params = blockParams?.map(param => "string" == typeof param ? buildVar(param) : param),
6633
6618
  closeTag = null;
6634
- return _closeTag ? closeTag = buildLoc(_closeTag || null) : void 0 === _closeTag && (closeTag = selfClosing || isVoidTag(path.original) ? null : buildLoc(null)), b.element({
6619
+ return _closeTag ? closeTag = buildLoc(_closeTag) : void 0 === _closeTag && (closeTag = selfClosing || isVoidTag(path.original) ? null : buildLoc(null)), b.element({
6635
6620
  path: path,
6636
6621
  selfClosing: selfClosing || !1,
6637
6622
  attributes: attrs || [],
@@ -6693,7 +6678,7 @@ var publicBuilder = {
6693
6678
  },
6694
6679
  literal: buildLiteral,
6695
6680
  program: function (body, blockParams, loc) {
6696
- return deprecate("b.program is deprecated. Use b.template or b.blockItself instead."), blockParams && blockParams.length ? buildBlockItself(body, blockParams, !1, loc) : buildTemplate(body, [], loc);
6681
+ return blockParams && blockParams.length ? buildBlockItself(body, blockParams, !1, loc) : buildTemplate(body, [], loc);
6697
6682
  },
6698
6683
  blockItself: buildBlockItself,
6699
6684
  template: buildTemplate,
@@ -6764,21 +6749,21 @@ const DEFAULT_STRIP = {
6764
6749
  }
6765
6750
  blockItself({
6766
6751
  body: body,
6767
- params: params,
6752
+ params: params1,
6768
6753
  chained = !1,
6769
6754
  loc: loc
6770
6755
  }) {
6771
6756
  return {
6772
6757
  type: "Block",
6773
6758
  body: body,
6774
- params: params,
6759
+ params: params1,
6775
6760
  get blockParams() {
6776
6761
  return this.params.map(p => p.name);
6777
6762
  },
6778
6763
  set blockParams(params) {
6779
- this.params = params.map(name => b.var({
6780
- name: name,
6781
- loc: SourceSpan.synthetic(name)
6764
+ this.params = params.map(name1 => b.var({
6765
+ name: name1,
6766
+ loc: SourceSpan.synthetic(name1)
6782
6767
  }));
6783
6768
  },
6784
6769
  chained: chained,
@@ -6799,7 +6784,7 @@ const DEFAULT_STRIP = {
6799
6784
  }
6800
6785
  mustache({
6801
6786
  path: path,
6802
- params: params,
6787
+ params: params1,
6803
6788
  hash: hash,
6804
6789
  trusting: trusting,
6805
6790
  loc: loc,
@@ -6825,15 +6810,15 @@ const DEFAULT_STRIP = {
6825
6810
  return Object.defineProperty(node, "escaped", {
6826
6811
  enumerable: !1,
6827
6812
  get() {
6828
- return deprecate("The escaped property on mustache nodes is deprecated, use trusting instead"), !this.trusting;
6813
+ return !this.trusting;
6829
6814
  },
6830
- set(value) {
6831
- deprecate("The escaped property on mustache nodes is deprecated, use trusting instead"), this.trusting = !value;
6815
+ set(value1) {
6816
+ this.trusting = !value1;
6832
6817
  }
6833
6818
  }), node;
6834
6819
  }({
6835
6820
  path: path,
6836
- params: params,
6821
+ params: params1,
6837
6822
  hash: hash,
6838
6823
  trusting: trusting,
6839
6824
  strip: strip,
@@ -6842,7 +6827,7 @@ const DEFAULT_STRIP = {
6842
6827
  }
6843
6828
  block({
6844
6829
  path: path,
6845
- params: params,
6830
+ params: params1,
6846
6831
  hash: hash,
6847
6832
  defaultBlock: defaultBlock,
6848
6833
  elseBlock = null,
@@ -6854,7 +6839,7 @@ const DEFAULT_STRIP = {
6854
6839
  return {
6855
6840
  type: "BlockStatement",
6856
6841
  path: path,
6857
- params: params,
6842
+ params: params1,
6858
6843
  hash: hash,
6859
6844
  program: defaultBlock,
6860
6845
  inverse: elseBlock,
@@ -6865,22 +6850,22 @@ const DEFAULT_STRIP = {
6865
6850
  };
6866
6851
  }
6867
6852
  comment({
6868
- value: value,
6853
+ value: value1,
6869
6854
  loc: loc
6870
6855
  }) {
6871
6856
  return {
6872
6857
  type: "CommentStatement",
6873
- value: value,
6858
+ value: value1,
6874
6859
  loc: loc
6875
6860
  };
6876
6861
  }
6877
6862
  mustacheComment({
6878
- value: value,
6863
+ value: value1,
6879
6864
  loc: loc
6880
6865
  }) {
6881
6866
  return {
6882
6867
  type: "MustacheCommentStatement",
6883
- value: value,
6868
+ value: value1,
6884
6869
  loc: loc
6885
6870
  };
6886
6871
  }
@@ -6896,23 +6881,23 @@ const DEFAULT_STRIP = {
6896
6881
  }
6897
6882
  element({
6898
6883
  path: path,
6899
- selfClosing: selfClosing,
6884
+ selfClosing: selfClosing1,
6900
6885
  attributes: attributes,
6901
6886
  modifiers: modifiers,
6902
- params: params,
6887
+ params: params1,
6903
6888
  comments: comments,
6904
6889
  children: children,
6905
6890
  openTag: openTag,
6906
6891
  closeTag: closeTag,
6907
6892
  loc: loc
6908
6893
  }) {
6909
- let _selfClosing = selfClosing;
6894
+ let _selfClosing = selfClosing1;
6910
6895
  return {
6911
6896
  type: "ElementNode",
6912
6897
  path: path,
6913
6898
  attributes: attributes,
6914
6899
  modifiers: modifiers,
6915
- params: params,
6900
+ params: params1,
6916
6901
  comments: comments,
6917
6902
  children: children,
6918
6903
  openTag: openTag,
@@ -6928,9 +6913,9 @@ const DEFAULT_STRIP = {
6928
6913
  return this.params.map(p => p.name);
6929
6914
  },
6930
6915
  set blockParams(params) {
6931
- this.params = params.map(name => b.var({
6932
- name: name,
6933
- loc: SourceSpan.synthetic(name)
6916
+ this.params = params.map(name1 => b.var({
6917
+ name: name1,
6918
+ loc: SourceSpan.synthetic(name1)
6934
6919
  }));
6935
6920
  },
6936
6921
  get selfClosing() {
@@ -6943,27 +6928,27 @@ const DEFAULT_STRIP = {
6943
6928
  }
6944
6929
  elementModifier({
6945
6930
  path: path,
6946
- params: params,
6931
+ params: params1,
6947
6932
  hash: hash,
6948
6933
  loc: loc
6949
6934
  }) {
6950
6935
  return {
6951
6936
  type: "ElementModifierStatement",
6952
6937
  path: path,
6953
- params: params,
6938
+ params: params1,
6954
6939
  hash: hash,
6955
6940
  loc: loc
6956
6941
  };
6957
6942
  }
6958
6943
  attr({
6959
- name: name,
6960
- value: value,
6944
+ name: name1,
6945
+ value: value1,
6961
6946
  loc: loc
6962
6947
  }) {
6963
6948
  return {
6964
6949
  type: "AttrNode",
6965
- name: name,
6966
- value: value,
6950
+ name: name1,
6951
+ value: value1,
6967
6952
  loc: loc
6968
6953
  };
6969
6954
  }
@@ -6979,14 +6964,14 @@ const DEFAULT_STRIP = {
6979
6964
  }
6980
6965
  sexpr({
6981
6966
  path: path,
6982
- params: params,
6967
+ params: params1,
6983
6968
  hash: hash,
6984
6969
  loc: loc
6985
6970
  }) {
6986
6971
  return {
6987
6972
  type: "SubExpression",
6988
6973
  path: path,
6989
- params: params,
6974
+ params: params1,
6990
6975
  hash: hash,
6991
6976
  loc: loc
6992
6977
  };
@@ -7009,7 +6994,7 @@ const DEFAULT_STRIP = {
7009
6994
  return [this.head.original, ...this.tail].join(".");
7010
6995
  },
7011
6996
  set original(value) {
7012
- let [head, ...tail] = asPresentArray(value.split("."));
6997
+ let [head, ...tail] = value.split(".");
7013
6998
  this.head = publicBuilder.head(head, this.head.loc), this.tail = tail;
7014
6999
  },
7015
7000
  loc: loc
@@ -7017,8 +7002,7 @@ const DEFAULT_STRIP = {
7017
7002
  return Object.defineProperty(node, "parts", {
7018
7003
  enumerable: !1,
7019
7004
  get() {
7020
- deprecate("The parts property on path nodes is deprecated, use head and tail instead");
7021
- let parts = asPresentArray(this.original.split("."));
7005
+ let parts = this.original.split(".");
7022
7006
  return "this" === parts[0] ?
7023
7007
  // parts does not include `this`
7024
7008
  parts.shift() : parts[0].startsWith("@") && (
@@ -7026,7 +7010,6 @@ const DEFAULT_STRIP = {
7026
7010
  parts[0] = parts[0].slice(1)), Object.freeze(parts);
7027
7011
  },
7028
7012
  set(values) {
7029
- deprecate("The parts property on mustache nodes is deprecated, use head and tail instead");
7030
7013
  let parts = [...values];
7031
7014
  // you are not supposed to already have `this` or `@` in the parts, but since this is
7032
7015
  // deprecated anyway, we will infer what you meant and allow it
@@ -7035,12 +7018,12 @@ const DEFAULT_STRIP = {
7035
7018
  }), Object.defineProperty(node, "this", {
7036
7019
  enumerable: !1,
7037
7020
  get() {
7038
- return deprecate("The this property on path nodes is deprecated, use head.type instead"), "ThisHead" === this.head.type;
7021
+ return "ThisHead" === this.head.type;
7039
7022
  }
7040
7023
  }), Object.defineProperty(node, "data", {
7041
7024
  enumerable: !1,
7042
7025
  get() {
7043
- return deprecate("The data property on path nodes is deprecated, use head.type instead"), "AtHead" === this.head.type;
7026
+ return "AtHead" === this.head.type;
7044
7027
  }
7045
7028
  }), node;
7046
7029
  }({
@@ -7075,7 +7058,7 @@ const DEFAULT_STRIP = {
7075
7058
  };
7076
7059
  }
7077
7060
  atName({
7078
- name: name,
7061
+ name: name1,
7079
7062
  loc: loc
7080
7063
  }) {
7081
7064
  let _name = "";
@@ -7085,7 +7068,7 @@ const DEFAULT_STRIP = {
7085
7068
  return _name;
7086
7069
  },
7087
7070
  set name(value) {
7088
- debugAssert("@" === value[0], "call builders.at() with a string that starts with '@'"), debugAssert(-1 === value.indexOf("."), "builder.at() should not be called with a name with dots in it"), _name = value;
7071
+ value[0], value.indexOf("."), _name = value;
7089
7072
  },
7090
7073
  get original() {
7091
7074
  return this.name;
@@ -7096,10 +7079,10 @@ const DEFAULT_STRIP = {
7096
7079
  loc: loc
7097
7080
  };
7098
7081
  // trigger the assertions
7099
- return node.name = name, node;
7082
+ return node.name = name1, node;
7100
7083
  }
7101
7084
  var({
7102
- name: name,
7085
+ name: name1,
7103
7086
  loc: loc
7104
7087
  }) {
7105
7088
  let _name = "";
@@ -7109,7 +7092,7 @@ const DEFAULT_STRIP = {
7109
7092
  return _name;
7110
7093
  },
7111
7094
  set name(value) {
7112
- debugAssert("this" !== value, "You called builders.var() with 'this'. Call builders.this instead"), debugAssert("@" !== value[0], `You called builders.var() with '${name}'. Call builders.at('${name}') instead`), debugAssert(-1 === value.indexOf("."), "builder.var() should not be called with a name with dots in it"), _name = value;
7095
+ value[0], value.indexOf("."), _name = value;
7113
7096
  },
7114
7097
  get original() {
7115
7098
  return this.name;
@@ -7120,7 +7103,7 @@ const DEFAULT_STRIP = {
7120
7103
  loc: loc
7121
7104
  };
7122
7105
  // trigger the assertions
7123
- return node.name = name, node;
7106
+ return node.name = name1, node;
7124
7107
  }
7125
7108
  hash({
7126
7109
  pairs: pairs,
@@ -7134,56 +7117,50 @@ const DEFAULT_STRIP = {
7134
7117
  }
7135
7118
  pair({
7136
7119
  key: key,
7137
- value: value,
7120
+ value: value1,
7138
7121
  loc: loc
7139
7122
  }) {
7140
7123
  return {
7141
7124
  type: "HashPair",
7142
7125
  key: key,
7143
- value: value,
7126
+ value: value1,
7144
7127
  loc: loc
7145
7128
  };
7146
7129
  }
7147
7130
  literal({
7148
7131
  type: type,
7149
- value: value,
7132
+ value: value1,
7150
7133
  loc: loc
7151
7134
  }) {
7152
7135
  return function ({
7153
7136
  type: type,
7154
- value: value,
7137
+ value: value1,
7155
7138
  loc: loc
7156
7139
  }) {
7157
7140
  const node = {
7158
7141
  type: type,
7159
- value: value,
7142
+ value: value1,
7160
7143
  loc: loc
7161
7144
  };
7162
7145
  return Object.defineProperty(node, "original", {
7163
7146
  enumerable: !1,
7164
7147
  get() {
7165
- return deprecate("The original property on literal nodes is deprecated, use value instead"), this.value;
7148
+ return this.value;
7166
7149
  },
7167
- set(value) {
7168
- deprecate("The original property on literal nodes is deprecated, use value instead"), this.value = value;
7150
+ set(value1) {
7151
+ this.value = value1;
7169
7152
  }
7170
7153
  }), node;
7171
7154
  }({
7172
7155
  type: type,
7173
- value: value,
7156
+ value: value1,
7174
7157
  loc: loc
7175
7158
  });
7176
7159
  }
7177
7160
  }();
7178
7161
  class Parser {
7179
- elementStack = [];
7180
- lines;
7181
- source;
7182
- currentAttribute = null;
7183
- currentNode = null;
7184
- tokenizer;
7185
7162
  constructor(source, entityParser = new EntityParser(namedCharRefs), mode = "precompile") {
7186
- this.source = source, this.lines = source.source.split(/\r\n?|\n/u), this.tokenizer = new EventedTokenizer(this, entityParser, mode);
7163
+ this.elementStack = [], this.currentAttribute = null, this.currentNode = null, this.source = source, this.lines = source.source.split(/\r\n?|\n/u), this.tokenizer = new EventedTokenizer(this, entityParser, mode);
7187
7164
  }
7188
7165
  offset() {
7189
7166
  let {
@@ -7205,33 +7182,33 @@ class Parser {
7205
7182
  // node.loc = node.loc.withEnd(end);
7206
7183
  }
7207
7184
  get currentAttr() {
7208
- return expect(this.currentAttribute, "expected attribute");
7185
+ return this.currentAttribute;
7209
7186
  }
7210
7187
  get currentTag() {
7211
7188
  let node = this.currentNode;
7212
- return debugAssert(node && ("StartTag" === node.type || "EndTag" === node.type), "expected tag"), node;
7189
+ return node && ("StartTag" === node.type || node.type), node;
7213
7190
  }
7214
7191
  get currentStartTag() {
7215
7192
  let node = this.currentNode;
7216
- return debugAssert(node && "StartTag" === node.type, "expected start tag"), node;
7193
+ return node && node.type, node;
7217
7194
  }
7218
7195
  get currentEndTag() {
7219
7196
  let node = this.currentNode;
7220
- return debugAssert(node && "EndTag" === node.type, "expected end tag"), node;
7197
+ return node && node.type, node;
7221
7198
  }
7222
7199
  get currentComment() {
7223
7200
  let node = this.currentNode;
7224
- return debugAssert(node && "CommentStatement" === node.type, "expected a comment"), node;
7201
+ return node && node.type, node;
7225
7202
  }
7226
7203
  get currentData() {
7227
7204
  let node = this.currentNode;
7228
- return debugAssert(node && "TextNode" === node.type, "expected a text node"), node;
7205
+ return node && node.type, node;
7229
7206
  }
7230
7207
  acceptNode(node) {
7231
7208
  return this[node.type](node);
7232
7209
  }
7233
7210
  currentElement() {
7234
- return getLast(asPresentArray(this.elementStack));
7211
+ return getLast(this.elementStack);
7235
7212
  }
7236
7213
  sourceForNode(node, endNode) {
7237
7214
  let line,
@@ -7241,20 +7218,13 @@ class Parser {
7241
7218
  currentLine = firstLine - 1,
7242
7219
  firstColumn = node.loc.start.column,
7243
7220
  string = [];
7244
- for (endNode ? (lastLine = endNode.loc.end.line - 1, lastColumn = endNode.loc.end.column) : (lastLine = node.loc.end.line - 1, lastColumn = node.loc.end.column); currentLine < lastLine;) currentLine++, line = unwrap(this.lines[currentLine]), currentLine === firstLine ? firstLine === lastLine ? string.push(line.slice(firstColumn, lastColumn)) : string.push(line.slice(firstColumn)) : currentLine === lastLine ? string.push(line.slice(0, lastColumn)) : string.push(line);
7221
+ for (endNode ? (lastLine = endNode.loc.end.line - 1, lastColumn = endNode.loc.end.column) : (lastLine = node.loc.end.line - 1, lastColumn = node.loc.end.column); currentLine < lastLine;) currentLine++, line = this.lines[currentLine], currentLine === firstLine ? firstLine === lastLine ? string.push(line.slice(firstColumn, lastColumn)) : string.push(line.slice(firstColumn)) : currentLine === lastLine ? string.push(line.slice(0, lastColumn)) : string.push(line);
7245
7222
  return string.join("\n");
7246
7223
  }
7247
7224
  }
7248
7225
  class HandlebarsNodeVisitors extends Parser {
7249
- // Because we interleave the HTML and HBS parsing, sometimes the HTML
7250
- // tokenizer can run out of tokens when we switch into {{...}} or reached
7251
- // EOF. There are positions where neither of these are expected, and it would
7252
- // like to generate an error, but there is no span to attach the error to.
7253
- // This allows the HTML tokenization to stash an error message and the next
7254
- // mustache visitor will attach the message to the appropriate span and throw
7255
- // the error.
7256
- pendingError = null;
7257
7226
  parse(program, blockParams) {
7227
+ program.loc;
7258
7228
  let node = b.template({
7259
7229
  body: [],
7260
7230
  blockParams: blockParams,
@@ -7267,10 +7237,7 @@ class HandlebarsNodeVisitors extends Parser {
7267
7237
  return this.pendingError?.eof(template.loc.getEnd()), template;
7268
7238
  }
7269
7239
  Program(program, blockParams) {
7270
- // The abstract signature doesn't have the blockParams argument, but in
7271
- // practice we can only come from this.BlockStatement() which adds the
7272
- // extra argument for us
7273
- debugAssert(Array.isArray(blockParams), "[BUG] Program in parser unexpectedly called without block params");
7240
+ program.loc;
7274
7241
  let node = b.blockItself({
7275
7242
  body: [],
7276
7243
  params: blockParams,
@@ -7291,14 +7258,12 @@ class HandlebarsNodeVisitors extends Parser {
7291
7258
  // Ensure that that the element stack is balanced properly.
7292
7259
  if (node !== poppedNode) {
7293
7260
  if ("ElementNode" === poppedNode?.type) throw generateSyntaxError(`Unclosed element \`${poppedNode.tag}\``, poppedNode.loc);
7294
- // If the stack is not balanced, then it is likely our own bug, because
7295
- // any unclosed Handlebars blocks should already been caught by now
7296
- debugAssert(void 0 !== poppedNode, "[BUG] empty parser elementStack"), debugAssert(!1, `[BUG] mismatched parser elementStack node: ${node.type}`);
7261
+ node.type;
7297
7262
  }
7298
7263
  return node;
7299
7264
  }
7300
7265
  BlockStatement(block) {
7301
- if ("comment" === this.tokenizer.state) return void this.appendToCommentData(this.sourceForNode(block));
7266
+ if ("comment" === this.tokenizer.state) return block.loc, void this.appendToCommentData(this.sourceForNode(block));
7302
7267
  if ("data" !== this.tokenizer.state && "beforeData" !== this.tokenizer.state) throw generateSyntaxError("A block may only be used inside an HTML element or another block.", this.source.spanFor(block.loc));
7303
7268
  const {
7304
7269
  path: path,
@@ -7307,22 +7272,19 @@ class HandlebarsNodeVisitors extends Parser {
7307
7272
  } = acceptCallNodes(this, block),
7308
7273
  loc = this.source.spanFor(block.loc);
7309
7274
  // Backfill block params loc for the default block
7310
- let blockParams = [];
7275
+ let repairedBlock,
7276
+ blockParams = [];
7311
7277
  if (block.program.blockParams?.length) {
7312
7278
  // Start from right after the hash
7313
7279
  let span = hash.loc.collapse("end");
7314
7280
  // Extend till the beginning of the block
7315
- span = block.program.loc ? span.withEnd(this.source.spanFor(block.program.loc).getStart()) : block.program.body[0] ? span.withEnd(this.source.spanFor(block.program.body[0].loc).getStart()) : span.withEnd(loc.getEnd());
7281
+ span = block.program.loc ? span.withEnd(this.source.spanFor(block.program.loc).getStart()) : block.program.body[0] ? span.withEnd(this.source.spanFor(block.program.body[0].loc).getStart()) : span.withEnd(loc.getEnd()), repairedBlock = repairBlock(this.source, block, span);
7316
7282
  // Now we have a span for something like this:
7317
-
7318
7283
  // {{#foo bar baz=bat as |wow wat|}}
7319
7284
  // ~~~~~~~~~~~~~~~
7320
-
7321
7285
  // Or, if we are unlucky:
7322
-
7323
7286
  // {{#foo bar baz=bat as |wow wat|}}{{/foo}}
7324
7287
  // ~~~~~~~~~~~~~~~~~~~~~~~
7325
-
7326
7288
  // Either way, within this span, there should be exactly two pipes
7327
7289
  // fencing our block params, neatly whitespace separated and with
7328
7290
  // legal identifiers only
@@ -7339,11 +7301,9 @@ class HandlebarsNodeVisitors extends Parser {
7339
7301
  loc: loc
7340
7302
  }));
7341
7303
  }
7342
- }
7343
- // These are bugs in Handlebars upstream
7344
- block.program.loc || (block.program.loc = NON_EXISTENT_LOCATION), block.inverse && !block.inverse.loc && (block.inverse.loc = NON_EXISTENT_LOCATION);
7345
- const program = this.Program(block.program, blockParams),
7346
- inverse = block.inverse ? this.Program(block.inverse, []) : null,
7304
+ } else repairedBlock = repairBlock(this.source, block, loc);
7305
+ const program = this.Program(repairedBlock.program, blockParams),
7306
+ inverse = repairedBlock.inverse ? this.Program(repairedBlock.inverse, []) : null,
7347
7307
  node = b.block({
7348
7308
  path: path,
7349
7309
  params: params,
@@ -7459,7 +7419,7 @@ class HandlebarsNodeVisitors extends Parser {
7459
7419
  lineCount = lines.length - 1;
7460
7420
  return {
7461
7421
  lines: lineCount,
7462
- columns: unwrap(lines[lineCount]).length
7422
+ columns: lines[lineCount].length
7463
7423
  };
7464
7424
  }(content.original, content.value);
7465
7425
  line += offsets.lines, offsets.lines ? column = offsets.columns : column += offsets.columns, tokenizer.line = line, tokenizer.column = column;
@@ -7630,6 +7590,17 @@ class HandlebarsNodeVisitors extends Parser {
7630
7590
  loc: this.source.spanFor(nul.loc)
7631
7591
  });
7632
7592
  }
7593
+ constructor(...args) {
7594
+ super(...args),
7595
+ // Because we interleave the HTML and HBS parsing, sometimes the HTML
7596
+ // tokenizer can run out of tokens when we switch into {{...}} or reached
7597
+ // EOF. There are positions where neither of these are expected, and it would
7598
+ // like to generate an error, but there is no span to attach the error to.
7599
+ // This allows the HTML tokenization to stash an error message and the next
7600
+ // mustache visitor will attach the message to the appropriate span and throw
7601
+ // the error.
7602
+ this.pendingError = null;
7603
+ }
7633
7604
  }
7634
7605
  function acceptCallNodes(compiler, node) {
7635
7606
  let path;
@@ -7650,7 +7621,7 @@ function acceptCallNodes(compiler, node) {
7650
7621
  throw value = "BooleanLiteral" === node.path.type ? node.path.original.toString() : "StringLiteral" === node.path.type ? `"${node.path.original}"` : "NullLiteral" === node.path.type ? "null" : "NumberLiteral" === node.path.type ? node.path.value.toString() : "undefined", generateSyntaxError(`${node.path.type} "${"StringLiteral" === node.path.type ? node.path.original : value}" cannot be called as a sub-expression, replace (${value}) with ${value}`, compiler.source.spanFor(node.path.loc));
7651
7622
  }
7652
7623
  }
7653
- const params = node.params ? node.params.map(e => compiler.acceptNode(e)) : [],
7624
+ const params = node.params.map(e => compiler.acceptNode(e)),
7654
7625
  end = isPresentArray(params) ? getLast(params).loc : path.loc;
7655
7626
  // if there is no hash, position it as a collapsed node immediately after the last param (or the
7656
7627
  // path, if there are also no params)
@@ -7684,14 +7655,28 @@ function addElementModifier(element, mustache) {
7684
7655
  });
7685
7656
  element.modifiers.push(modifier);
7686
7657
  }
7658
+ function repairBlock(source, block, fallbackStart) {
7659
+ // Extend till the beginning of the block
7660
+ if (!block.program.loc) {
7661
+ const start = block.program.body.at(0),
7662
+ end = block.program.body.at(-1);
7663
+ if (start && end) block.program.loc = {
7664
+ ...start.loc,
7665
+ end: end.loc.end
7666
+ };else {
7667
+ const loc = source.spanFor(block.loc);
7668
+ block.program.loc = fallbackStart.withEnd(loc.getEnd());
7669
+ }
7670
+ }
7671
+ let endProgram = source.spanFor(block.program.loc).getEnd();
7672
+ return block.inverse && !block.inverse.loc && (block.inverse.loc = endProgram.collapsed()), block;
7673
+ }
7687
7674
 
7688
7675
  // vendored from simple-html-tokenizer because it's unexported
7689
7676
  function isSpace(char) {
7690
7677
  return /[\t\n\f ]/u.test(char);
7691
7678
  }
7692
7679
  class TokenizerEventHandlers extends HandlebarsNodeVisitors {
7693
- tagOpenLine = 0;
7694
- tagOpenColumn = 0;
7695
7680
  reset() {
7696
7681
  this.currentNode = null;
7697
7682
  }
@@ -7756,18 +7741,16 @@ class TokenizerEventHandlers extends HandlebarsNodeVisitors {
7756
7741
  end: this.offset().toJSON()
7757
7742
  }));
7758
7743
  (voidMap.has(tag.name) || tag.selfClosing) && this.finishEndTag(!0);
7759
- } else "EndTag" === tag.type && this.finishEndTag(!1);
7744
+ } else tag.type, tag.type, this.finishEndTag(!1);
7760
7745
  }
7761
7746
  finishStartTag() {
7762
7747
  let {
7763
- name: name,
7764
- nameStart: nameStart,
7765
- nameEnd: nameEnd
7766
- } = this.currentStartTag;
7767
- // <> should probably be a syntax error, but s-h-t is currently broken for that case
7768
- debugAssert("" !== name, "tag name cannot be empty"), debugAssert(null !== nameStart, "nameStart unexpectedly null"), debugAssert(null !== nameEnd, "nameEnd unexpectedly null");
7769
- let nameLoc = nameStart.until(nameEnd),
7770
- [head, ...tail] = asPresentArray(name.split(".")),
7748
+ name: name,
7749
+ nameStart: nameStart,
7750
+ nameEnd: nameEnd
7751
+ } = this.currentStartTag,
7752
+ nameLoc = nameStart.until(nameEnd),
7753
+ [head, ...tail] = name.split("."),
7771
7754
  path = b.path({
7772
7755
  head: b.head({
7773
7756
  original: head,
@@ -7808,7 +7791,7 @@ class TokenizerEventHandlers extends HandlebarsNodeVisitors {
7808
7791
  element = this.elementStack.pop();
7809
7792
  this.validateEndTag(tag, element, isVoid);
7810
7793
  let parent = this.currentElement();
7811
- isVoid ? element.closeTag = null : element.selfClosing ? debugAssert(null === element.closeTag, "element.closeTag unexpectedly present") : element.closeTag = closeTagStart.until(this.offset()), element.loc = element.loc.withEnd(this.offset()), appendChild(parent, b.element(element));
7794
+ isVoid ? element.closeTag = null : element.selfClosing ? element.closeTag : element.closeTag = closeTagStart.until(this.offset()), element.loc = element.loc.withEnd(this.offset()), appendChild(parent, b.element(element));
7812
7795
  }
7813
7796
  markTagAsSelfClosing() {
7814
7797
  let tag = this.currentTag;
@@ -7823,7 +7806,7 @@ class TokenizerEventHandlers extends HandlebarsNodeVisitors {
7823
7806
  let tag = this.currentTag;
7824
7807
  if (tag.name += char, "StartTag" === tag.type) {
7825
7808
  let offset = this.offset();
7826
- null === tag.nameStart && (debugAssert(null === tag.nameEnd, "nameStart and nameEnd must both be null"),
7809
+ null === tag.nameStart && (tag.nameEnd,
7827
7810
  // Note that the tokenizer already consumed the token here
7828
7811
  tag.nameStart = offset.move(-1)), tag.nameEnd = offset;
7829
7812
  }
@@ -7897,7 +7880,7 @@ class TokenizerEventHandlers extends HandlebarsNodeVisitors {
7897
7880
  parsePossibleBlockParams() {
7898
7881
  // const enums that we can't use directly
7899
7882
  const ID_INVERSE_PATTERN = /[!"#%&'()*+./;<=>@[\\\]^`{|}~]/u;
7900
- debugAssert("attributeName" === this.tokenizer.state, "must be in TokenizerState.attributeName");
7883
+ this.tokenizer.state;
7901
7884
  const element = this.currentStartTag,
7902
7885
  as = this.currentAttr;
7903
7886
  let state = {
@@ -7905,7 +7888,7 @@ class TokenizerEventHandlers extends HandlebarsNodeVisitors {
7905
7888
  };
7906
7889
  const handlers = {
7907
7890
  PossibleAs: next => {
7908
- if (debugAssert("PossibleAs" === state.state, "bug in block params parser"), isSpace(next))
7891
+ if (state.state, isSpace(next))
7909
7892
  // " as ..."
7910
7893
  state = {
7911
7894
  state: "BeforeStartPipe"
@@ -7922,7 +7905,7 @@ class TokenizerEventHandlers extends HandlebarsNodeVisitors {
7922
7905
  }
7923
7906
  },
7924
7907
  BeforeStartPipe: next => {
7925
- debugAssert("BeforeStartPipe" === state.state, "bug in block params parser"), isSpace(next) ? this.tokenizer.consume() : "|" === next ? (state = {
7908
+ state.state, isSpace(next) ? this.tokenizer.consume() : "|" === next ? (state = {
7926
7909
  state: "BeforeBlockParamName"
7927
7910
  }, this.tokenizer.transitionTo("beforeAttributeName"), this.tokenizer.consume()) :
7928
7911
  // " as {{...", " as bs...", " as =...", " as ...", " as/>..."
@@ -7932,7 +7915,7 @@ class TokenizerEventHandlers extends HandlebarsNodeVisitors {
7932
7915
  };
7933
7916
  },
7934
7917
  BeforeBlockParamName: next => {
7935
- if (debugAssert("BeforeBlockParamName" === state.state, "bug in block params parser"), isSpace(next)) this.tokenizer.consume();else if ("" === next)
7918
+ if (state.state, isSpace(next)) this.tokenizer.consume();else if ("" === next)
7936
7919
  // The HTML tokenizer ran out of characters, so we are either
7937
7920
  // encountering mustache or <EOF>
7938
7921
  state = {
@@ -7962,7 +7945,7 @@ class TokenizerEventHandlers extends HandlebarsNodeVisitors {
7962
7945
  }
7963
7946
  },
7964
7947
  BlockParamName: next => {
7965
- if (debugAssert("BlockParamName" === state.state, "bug in block params parser"), "" === next)
7948
+ if (state.state, "" === next)
7966
7949
  // The HTML tokenizer ran out of characters, so we are either
7967
7950
  // encountering mustache or <EOF>, HBS side will attach the error
7968
7951
  // to the next span
@@ -7993,7 +7976,7 @@ class TokenizerEventHandlers extends HandlebarsNodeVisitors {
7993
7976
  }
7994
7977
  },
7995
7978
  AfterEndPipe: next => {
7996
- debugAssert("AfterEndPipe" === state.state, "bug in block params parser"), isSpace(next) ? this.tokenizer.consume() : "" === next ? (
7979
+ state.state, isSpace(next) ? this.tokenizer.consume() : "" === next ? (
7997
7980
  // The HTML tokenizer ran out of characters, so we are either
7998
7981
  // encountering mustache or <EOF>, HBS side will attach the error
7999
7982
  // to the next span
@@ -8019,26 +8002,22 @@ class TokenizerEventHandlers extends HandlebarsNodeVisitors {
8019
8002
  }, this.tokenizer.consume());
8020
8003
  },
8021
8004
  Error: next => {
8022
- if (debugAssert("Error" === state.state, "bug in block params parser"), "" === next || "/" === next || ">" === next || isSpace(next)) throw generateSyntaxError(state.message, state.start.until(this.offset()));
8005
+ if (state.state, "" === next || "/" === next || ">" === next || isSpace(next)) throw generateSyntaxError(state.message, state.start.until(this.offset()));
8023
8006
  // Slurp up the next "token" for the error span
8024
8007
  this.tokenizer.consume();
8025
8008
  },
8026
- Done: () => {
8027
- debugAssert(!1, "This should never be called");
8028
- }
8009
+ Done: () => {}
8029
8010
  };
8030
8011
  let next;
8031
8012
  do {
8032
8013
  next = this.tokenizer.peek(), handlers[state.state](next);
8033
8014
  } while ("Done" !== state.state && "" !== next);
8034
- debugAssert("Done" === state.state, "bug in block params parser");
8015
+ state.state;
8035
8016
  }
8036
8017
  reportSyntaxError(message) {
8037
8018
  throw generateSyntaxError(message, this.offset().collapsed());
8038
8019
  }
8039
8020
  assembleConcatenatedValue(parts) {
8040
- for (const part of parts) if ("MustacheStatement" !== part.type && "TextNode" !== part.type) throw generateSyntaxError(`Unsupported node in quoted attribute value: ${part.type}`, part.loc);
8041
- assertPresentArray(parts, "the concatenation parts of an element should not be empty");
8042
8021
  let first = getFirst(parts),
8043
8022
  last = getLast(parts);
8044
8023
  return b.concat({
@@ -8052,14 +8031,13 @@ class TokenizerEventHandlers extends HandlebarsNodeVisitors {
8052
8031
  // <input> or <br />, so we need to check for that here. Otherwise, we would
8053
8032
  // throw an error for those cases.
8054
8033
  throw generateSyntaxError(`<${tag.name}> elements do not need end tags. You should remove it`, tag.loc);
8055
- if (void 0 === element.tag) throw generateSyntaxError(`Closing tag </${tag.name}> without an open tag`, tag.loc);
8034
+ if ("ElementNode" !== element.type) throw generateSyntaxError(`Closing tag </${tag.name}> without an open tag`, tag.loc);
8056
8035
  if (element.tag !== tag.name) throw generateSyntaxError(`Closing tag </${tag.name}> did not match last open tag <${element.tag}> (on line ${element.loc.startPosition.line})`, tag.loc);
8057
8036
  }
8058
8037
  assembleAttributeValue(parts, isQuoted, isDynamic, span) {
8059
8038
  if (isDynamic) {
8060
8039
  if (isQuoted) return this.assembleConcatenatedValue(parts);
8061
8040
  {
8062
- assertPresentArray(parts);
8063
8041
  const [head, a] = parts;
8064
8042
  if (void 0 === a || "TextNode" === a.type && "/" === a.chars) return head;
8065
8043
  throw generateSyntaxError("An unquoted attribute value must be a string or a mustache, preceded by whitespace or a '=' character, and followed by whitespace, a '>' character, or '/>'", span);
@@ -8070,12 +8048,10 @@ class TokenizerEventHandlers extends HandlebarsNodeVisitors {
8070
8048
  loc: span
8071
8049
  });
8072
8050
  }
8051
+ constructor(...args) {
8052
+ super(...args), this.tagOpenLine = 0, this.tagOpenColumn = 0;
8053
+ }
8073
8054
  }
8074
-
8075
- /**
8076
- ASTPlugins can make changes to the Glimmer template AST before
8077
- compilation begins.
8078
- */
8079
8055
  const syntax = {
8080
8056
  parse: preprocess,
8081
8057
  builders: publicBuilder,
@@ -8103,48 +8079,18 @@ function preprocess(input, options = {}) {
8103
8079
  end: offsets.endPosition
8104
8080
  };
8105
8081
  let template = new TokenizerEventHandlers(source, entityParser, mode).parse(ast, options.locals ?? []);
8106
- if (options?.plugins?.ast) for (const transform of options.plugins.ast) traverse(template, transform(assign({}, options, {
8082
+ if (options.plugins?.ast) for (const transform of options.plugins.ast) traverse(template, transform(assign({}, options, {
8107
8083
  syntax: syntax
8108
8084
  }, {
8109
8085
  plugins: void 0
8110
8086
  })).visitor);
8111
8087
  return template;
8112
8088
  }
8113
-
8114
- /**
8115
- * This is a convenience function for creating ASTv2 nodes, with an optional name and the node's
8116
- * options.
8117
- *
8118
- * ```ts
8119
- * export class HtmlText extends node('HtmlText').fields<{ chars: string }>() {}
8120
- * ```
8121
- *
8122
- * This creates a new ASTv2 node with the name `'HtmlText'` and one field `chars: string` (in
8123
- * addition to a `loc: SourceOffsets` field, which all nodes have).
8124
- *
8125
- * ```ts
8126
- * export class Args extends node().fields<{
8127
- * positional: PositionalArguments;
8128
- * named: NamedArguments
8129
- * }>() {}
8130
- * ```
8131
- *
8132
- * This creates a new un-named ASTv2 node with two fields (`positional: Positional` and `named:
8133
- * Named`, in addition to the generic `loc: SourceOffsets` field).
8134
- *
8135
- * Once you create a node using `node`, it is instantiated with all of its fields (including `loc`):
8136
- *
8137
- * ```ts
8138
- * new HtmlText({ loc: offsets, chars: someString });
8139
- * ```
8140
- */
8141
8089
  function node(name) {
8142
8090
  if (void 0 !== name) {
8143
8091
  const type = name;
8144
8092
  return {
8145
8093
  fields: () => class {
8146
- // SAFETY: initialized via `assign` in the constructor.
8147
- type;
8148
8094
  constructor(fields) {
8149
8095
  this.type = type, assign(this, fields);
8150
8096
  }
@@ -8153,7 +8099,6 @@ function node(name) {
8153
8099
  }
8154
8100
  return {
8155
8101
  fields: () => class {
8156
- // SAFETY: initialized via `assign` in the constructor.
8157
8102
  constructor(fields) {
8158
8103
  assign(this, fields);
8159
8104
  }
@@ -8258,30 +8203,11 @@ class NamedArguments extends node().fields() {
8258
8203
  * ```
8259
8204
  */
8260
8205
  class NamedArgument {
8261
- loc;
8262
- name;
8263
- value;
8264
8206
  constructor(options) {
8265
8207
  this.loc = options.name.loc.extend(options.value.loc), this.name = options.name, this.value = options.value;
8266
8208
  }
8267
8209
  }
8268
8210
 
8269
- /**
8270
- * Attr nodes look like HTML attributes, but are classified as:
8271
- *
8272
- * 1. `HtmlAttr`, which means a regular HTML attribute in Glimmer
8273
- * 2. `SplatAttr`, which means `...attributes`
8274
- * 3. `ComponentArg`, which means an attribute whose name begins with `@`, and it is therefore a
8275
- * component argument.
8276
- */
8277
- /**
8278
- * `HtmlAttr` and `SplatAttr` are grouped together because the order of the `SplatAttr` node,
8279
- * relative to other attributes, matters.
8280
- */
8281
- /**
8282
- * "Attr Block" nodes are allowed inside an open element tag in templates. They interact with the
8283
- * element (or component).
8284
- */
8285
8211
  /**
8286
8212
  * `HtmlAttr` nodes are valid HTML attributes, with or without a value.
8287
8213
  *
@@ -8312,13 +8238,6 @@ class ComponentArg extends node().fields() {
8312
8238
  * An `ElementModifier` is just a normal call node in modifier position.
8313
8239
  */
8314
8240
  class ElementModifier extends node("ElementModifier").fields() {}
8315
-
8316
- /**
8317
- * Content Nodes are allowed in content positions in templates. They correspond to behavior in the
8318
- * [Data][data] tokenization state in HTML.
8319
- *
8320
- * [data]: https://html.spec.whatwg.org/multipage/parsing.html#data-state
8321
- */
8322
8241
  class GlimmerComment extends node("GlimmerComment").fields() {}
8323
8242
  class HtmlText extends node("HtmlText").fields() {}
8324
8243
  class HtmlComment extends node("HtmlComment").fields() {}
@@ -8361,11 +8280,6 @@ class SimpleElement extends node("SimpleElement").fields() {
8361
8280
  }
8362
8281
  }
8363
8282
 
8364
- /**
8365
- * A Handlebars literal.
8366
- *
8367
- * {@link https://handlebarsjs.com/guide/expressions.html#literal-segments}
8368
- */
8369
8283
  /**
8370
8284
  * Corresponds to a Handlebars literal.
8371
8285
  *
@@ -8441,9 +8355,6 @@ class Block extends node().fields() {}
8441
8355
  * Corresponds to a collection of named blocks.
8442
8356
  */
8443
8357
  class NamedBlocks extends node().fields() {
8444
- /**
8445
- * Get the `NamedBlock` for a given name.
8446
- */
8447
8358
  get(name) {
8448
8359
  return this.blocks.filter(block => block.name.chars === name)[0] || null;
8449
8360
  }
@@ -8490,18 +8401,7 @@ class LocalVarReference extends node("Local").fields() {}
8490
8401
  */
8491
8402
  class FreeVarReference extends node("Free").fields() {}
8492
8403
 
8493
- /**
8494
- * A free variable is resolved according to a resolution rule:
8495
- *
8496
- * 1. Strict resolution
8497
- * 2. Namespaced resolution
8498
- */
8499
- /**
8500
- * Strict resolution is used:
8501
- *
8502
- * 1. in a strict mode template
8503
- * 2. in an local variable invocation with dot paths
8504
- */
8404
+ /// FreeVarNamespace ///
8505
8405
  const STRICT_RESOLUTION = {
8506
8406
  resolution: () => opcodes.GetStrictKeyword,
8507
8407
  serialize: () => "Strict",
@@ -8545,7 +8445,7 @@ class LooseModeResolution {
8545
8445
  * ^ In either case, `x` should be resolved in the `component` and `helper` namespaces.
8546
8446
  */
8547
8447
  static append() {
8548
- return new LooseModeResolution([FreeVarNamespace.Component, FreeVarNamespace.Helper]);
8448
+ return new LooseModeResolution(["Component", "Helper"]);
8549
8449
  }
8550
8450
  /**
8551
8451
  * Trusting append resolution is used when the variable should be resolved only in the
@@ -8562,7 +8462,7 @@ class LooseModeResolution {
8562
8462
  * ^ In either case, `x` should be resolved in the `helper` namespace.
8563
8463
  */
8564
8464
  static trustingAppend() {
8565
- return this.namespaced(FreeVarNamespace.Helper);
8465
+ return this.namespaced("Helper");
8566
8466
  }
8567
8467
  constructor(namespaces, isAngleBracket = !1) {
8568
8468
  this.namespaces = namespaces, this.isAngleBracket = isAngleBracket;
@@ -8570,11 +8470,11 @@ class LooseModeResolution {
8570
8470
  resolution() {
8571
8471
  if (1 !== this.namespaces.length) return opcodes.GetFreeAsComponentOrHelperHead;
8572
8472
  switch (this.namespaces[0]) {
8573
- case FreeVarNamespace.Helper:
8473
+ case "Helper":
8574
8474
  return opcodes.GetFreeAsHelperHead;
8575
- case FreeVarNamespace.Modifier:
8475
+ case "Modifier":
8576
8476
  return opcodes.GetFreeAsModifierHead;
8577
- case FreeVarNamespace.Component:
8477
+ case "Component":
8578
8478
  return opcodes.GetFreeAsComponentHead;
8579
8479
  }
8580
8480
  }
@@ -8582,26 +8482,19 @@ class LooseModeResolution {
8582
8482
  return 1 === this.namespaces.length ? this.namespaces[0] : "ComponentOrHelper";
8583
8483
  }
8584
8484
  }
8585
- let FreeVarNamespace = function (FreeVarNamespace) {
8586
- return FreeVarNamespace.Helper = "Helper", FreeVarNamespace.Modifier = "Modifier", FreeVarNamespace.Component = "Component", FreeVarNamespace;
8587
- }({});
8588
- const HELPER_NAMESPACE = FreeVarNamespace.Helper,
8589
- MODIFIER_NAMESPACE = FreeVarNamespace.Modifier,
8590
- COMPONENT_NAMESPACE = FreeVarNamespace.Component;
8591
- var api$1 = Object.freeze({
8485
+ var api = Object.freeze({
8592
8486
  __proto__: null,
8593
8487
  AppendContent: AppendContent,
8594
8488
  ArgReference: ArgReference,
8595
8489
  Args: Args,
8596
8490
  Block: Block,
8597
- COMPONENT_NAMESPACE: COMPONENT_NAMESPACE,
8491
+ COMPONENT_NAMESPACE: "Component",
8598
8492
  CallExpression: CallExpression,
8599
8493
  ComponentArg: ComponentArg,
8600
8494
  ElementModifier: ElementModifier,
8601
- FreeVarNamespace: FreeVarNamespace,
8602
8495
  FreeVarReference: FreeVarReference,
8603
8496
  GlimmerComment: GlimmerComment,
8604
- HELPER_NAMESPACE: HELPER_NAMESPACE,
8497
+ HELPER_NAMESPACE: "Helper",
8605
8498
  HTML_RESOLUTION: HTML_RESOLUTION,
8606
8499
  HtmlAttr: HtmlAttr,
8607
8500
  HtmlComment: HtmlComment,
@@ -8613,7 +8506,7 @@ var api$1 = Object.freeze({
8613
8506
  LiteralExpression: LiteralExpression,
8614
8507
  LocalVarReference: LocalVarReference,
8615
8508
  LooseModeResolution: LooseModeResolution,
8616
- MODIFIER_NAMESPACE: MODIFIER_NAMESPACE,
8509
+ MODIFIER_NAMESPACE: "Modifier",
8617
8510
  NamedArgument: NamedArgument,
8618
8511
  NamedArguments: NamedArguments,
8619
8512
  NamedBlock: NamedBlock,
@@ -8631,30 +8524,7 @@ var api$1 = Object.freeze({
8631
8524
  isStrictResolution: function (value) {
8632
8525
  return value === STRICT_RESOLUTION;
8633
8526
  },
8634
- loadResolution:
8635
- /**
8636
- * A `Namespaced` must be resolved in one or more namespaces.
8637
- *
8638
- * ```hbs
8639
- * <X />
8640
- * ```
8641
- *
8642
- * ^ `X` is resolved in the `component` namespace
8643
- *
8644
- * ```hbs
8645
- * (x)
8646
- * ```
8647
- *
8648
- * ^ `x` is resolved in the `helper` namespace
8649
- *
8650
- * ```hbs
8651
- * <a {{x}} />
8652
- * ```
8653
- *
8654
- * ^ `x` is resolved in the `modifier` namespace
8655
- */
8656
- // Serialization
8657
- function (resolution) {
8527
+ loadResolution: function (resolution) {
8658
8528
  return "Strict" === resolution ? STRICT_RESOLUTION : "ComponentOrHelper" === resolution ? LooseModeResolution.append() : LooseModeResolution.namespaced(resolution);
8659
8529
  },
8660
8530
  node: node
@@ -8670,15 +8540,11 @@ class SymbolTable {
8670
8540
  }
8671
8541
  class ProgramSymbolTable extends SymbolTable {
8672
8542
  constructor(templateLocals, keywords, options) {
8673
- super(), this.templateLocals = templateLocals, this.keywords = keywords, this.options = options;
8674
- }
8675
- symbols = [];
8676
- upvars = [];
8677
- size = 1;
8678
- named = dict();
8679
- blocks = dict();
8680
- usedTemplateLocals = [];
8681
- #hasDebugger = !1;
8543
+ super(), this.templateLocals = templateLocals, this.keywords = keywords, this.options = options, this.symbols = [], this.upvars = [], this.size = 1, this.named = dict(), this.blocks = dict(), this.usedTemplateLocals = [];
8544
+ }
8545
+ root() {
8546
+ return this;
8547
+ }
8682
8548
  hasLexical(name) {
8683
8549
  return this.options.lexicalScope(name);
8684
8550
  }
@@ -8691,12 +8557,6 @@ class ProgramSymbolTable extends SymbolTable {
8691
8557
  getUsedTemplateLocals() {
8692
8558
  return this.usedTemplateLocals;
8693
8559
  }
8694
- setHasDebugger() {
8695
- this.#hasDebugger = !0;
8696
- }
8697
- get hasEval() {
8698
- return this.#hasDebugger;
8699
- }
8700
8560
  has(name) {
8701
8561
  return this.templateLocals.includes(name);
8702
8562
  }
@@ -8708,7 +8568,7 @@ class ProgramSymbolTable extends SymbolTable {
8708
8568
  return dict();
8709
8569
  }
8710
8570
  getDebugInfo() {
8711
- return Object.values(this.getLocalsMap());
8571
+ return [this.getLocalsMap(), this.named];
8712
8572
  }
8713
8573
  allocateFree(name, resolution) {
8714
8574
  // If the name in question is an uppercase (i.e. angle-bracket) component invocation, run
@@ -8734,6 +8594,9 @@ class BlockSymbolTable extends SymbolTable {
8734
8594
  constructor(parent, symbols, slots) {
8735
8595
  super(), this.parent = parent, this.symbols = symbols, this.slots = slots;
8736
8596
  }
8597
+ root() {
8598
+ return this.parent.root();
8599
+ }
8737
8600
  get locals() {
8738
8601
  return this.symbols;
8739
8602
  }
@@ -8755,17 +8618,19 @@ class BlockSymbolTable extends SymbolTable {
8755
8618
  }
8756
8619
  #get(name) {
8757
8620
  let slot = this.symbols.indexOf(name);
8758
- return -1 === slot ? null : unwrap(this.slots[slot]);
8621
+ return -1 === slot ? null : this.slots[slot];
8759
8622
  }
8760
8623
  getLocalsMap() {
8761
8624
  let dict = this.parent.getLocalsMap();
8762
8625
  return this.symbols.forEach(symbol => dict[symbol] = this.get(symbol)[0]), dict;
8763
8626
  }
8764
8627
  getDebugInfo() {
8765
- return Object.values(this.getLocalsMap());
8766
- }
8767
- setHasDebugger() {
8768
- this.parent.setHasDebugger();
8628
+ const locals = this.getLocalsMap(),
8629
+ root = this.root();
8630
+ return [{
8631
+ ...locals,
8632
+ ...root.named
8633
+ }, Object.fromEntries(root.upvars.map((s, i) => [s, i]))];
8769
8634
  }
8770
8635
  allocateFree(name, resolution) {
8771
8636
  return this.parent.allocateFree(name, resolution);
@@ -8898,8 +8763,7 @@ class Builder {
8898
8763
  });
8899
8764
  }
8900
8765
  at(name, symbol, loc) {
8901
- // the `@` should be included so we have a complete source range
8902
- return debugAssert("@" === name[0], "call builders.at() with a string that starts with '@'"), new ArgReference({
8766
+ return name[0], new ArgReference({
8903
8767
  loc: loc,
8904
8768
  name: new SourceSlice({
8905
8769
  loc: loc,
@@ -8914,7 +8778,7 @@ class Builder {
8914
8778
  symbol: symbol,
8915
8779
  loc: loc
8916
8780
  }) {
8917
- return debugAssert("this" !== name, "You called builders.freeVar() with 'this'. Call builders.this instead"), debugAssert("@" !== name[0], `You called builders.freeVar() with '${name}'. Call builders.at('${name}') instead`), new FreeVarReference({
8781
+ return name[0], new FreeVarReference({
8918
8782
  name: name,
8919
8783
  resolution: context,
8920
8784
  symbol: symbol,
@@ -8922,7 +8786,7 @@ class Builder {
8922
8786
  });
8923
8787
  }
8924
8788
  localVar(name, symbol, isTemplateLocal, loc) {
8925
- return debugAssert("this" !== name, "You called builders.var() with 'this'. Call builders.this instead"), debugAssert("@" !== name[0], `You called builders.var() with '${name}'. Call builders.at('${name}') instead`), new LocalVarReference({
8789
+ return name[0], new LocalVarReference({
8926
8790
  loc: loc,
8927
8791
  name: name,
8928
8792
  isTemplateLocal: isTemplateLocal,
@@ -8937,7 +8801,7 @@ class Builder {
8937
8801
  });
8938
8802
  }
8939
8803
  interpolate(parts, loc) {
8940
- return assertPresentArray(parts), new InterpolateExpression({
8804
+ return new InterpolateExpression({
8941
8805
  loc: loc,
8942
8806
  parts: parts
8943
8807
  });
@@ -8996,7 +8860,6 @@ class Builder {
8996
8860
  }
8997
8861
  }
8998
8862
  class BuildElement {
8999
- builder;
9000
8863
  constructor(base) {
9001
8864
  this.base = base, this.builder = new Builder();
9002
8865
  }
@@ -9049,16 +8912,16 @@ class BuildElement {
9049
8912
  }
9050
8913
  }
9051
8914
  function SexpSyntaxContext(node) {
9052
- return isSimpleCallee(node) ? LooseModeResolution.namespaced(HELPER_NAMESPACE) : null;
8915
+ return isSimpleCallee(node) ? LooseModeResolution.namespaced("Helper") : null;
9053
8916
  }
9054
8917
  function ModifierSyntaxContext(node) {
9055
- return isSimpleCallee(node) ? LooseModeResolution.namespaced(MODIFIER_NAMESPACE) : null;
8918
+ return isSimpleCallee(node) ? LooseModeResolution.namespaced("Modifier") : null;
9056
8919
  }
9057
8920
  function BlockSyntaxContext(node) {
9058
- return isSimpleCallee(node) ? LooseModeResolution.namespaced(COMPONENT_NAMESPACE) : null;
8921
+ return isSimpleCallee(node) ? LooseModeResolution.namespaced("Component") : null;
9059
8922
  }
9060
8923
  function ComponentSyntaxContext(node) {
9061
- return isSimplePath(node) ? LooseModeResolution.namespaced(COMPONENT_NAMESPACE, !0) : null;
8924
+ return isSimplePath(node) ? LooseModeResolution.namespaced("Component", !0) : null;
9062
8925
  }
9063
8926
 
9064
8927
  /**
@@ -9066,7 +8929,7 @@ function ComponentSyntaxContext(node) {
9066
8929
  * In strict mode, this also corresponds to arg curlies.
9067
8930
  */
9068
8931
  function AttrValueSyntaxContext(node) {
9069
- return isSimpleCallee(node) ? LooseModeResolution.namespaced(HELPER_NAMESPACE) : null;
8932
+ return isSimpleCallee(node) ? LooseModeResolution.namespaced("Helper") : null;
9070
8933
  }
9071
8934
 
9072
8935
  /**
@@ -9142,7 +9005,6 @@ function normalize(source, options = {
9142
9005
  * `BlockContext` is stateless.
9143
9006
  */
9144
9007
  class BlockContext {
9145
- builder;
9146
9008
  constructor(source, options, table) {
9147
9009
  this.source = source, this.options = options, this.table = table, this.builder = new Builder();
9148
9010
  }
@@ -9199,12 +9061,6 @@ class ExpressionNormalizer {
9199
9061
  constructor(block) {
9200
9062
  this.block = block;
9201
9063
  }
9202
- /**
9203
- * The `normalize` method takes an arbitrary expression and its original syntax context and
9204
- * normalizes it to an ASTv2 expression.
9205
- *
9206
- * @see {SyntaxContext}
9207
- */
9208
9064
  normalize(expr, resolution) {
9209
9065
  switch (expr.type) {
9210
9066
  case "NullLiteral":
@@ -9214,7 +9070,7 @@ class ExpressionNormalizer {
9214
9070
  case "UndefinedLiteral":
9215
9071
  return this.block.builder.literal(expr.value, this.block.loc(expr.loc));
9216
9072
  case "PathExpression":
9217
- return debugAssert(resolution, "[BUG] resolution is required"), this.path(expr, resolution);
9073
+ return this.path(expr, resolution);
9218
9074
  case "SubExpression":
9219
9075
  {
9220
9076
  // expr.path used to incorrectly have the type ASTv1.Expression
@@ -9300,6 +9156,10 @@ class ExpressionNormalizer {
9300
9156
  offsets = block.loc(head.loc);
9301
9157
  switch (head.type) {
9302
9158
  case "ThisHead":
9159
+ if (block.hasBinding("this")) {
9160
+ let [symbol, isRoot] = table.get("this");
9161
+ return block.builder.localVar("this", symbol, isRoot, offsets);
9162
+ }
9303
9163
  return builder.self(offsets);
9304
9164
  case "AtHead":
9305
9165
  {
@@ -9464,7 +9324,7 @@ class ElementNormalizer {
9464
9324
  comments: comments
9465
9325
  } = element,
9466
9326
  loc = this.ctx.loc(element.loc),
9467
- [tagHead, ...rest] = asPresentArray(tag.split(".")),
9327
+ [tagHead, ...rest] = tag.split("."),
9468
9328
  path = this.classifyTag(tagHead, rest, element.loc),
9469
9329
  attrs = element.attributes.filter(a => "@" !== a.name[0]).map(a => this.attr(a)),
9470
9330
  args = element.attributes.filter(a => "@" === a.name[0]).map(a => this.arg(a)),
@@ -9557,7 +9417,7 @@ class ElementNormalizer {
9557
9417
  return this.attrPart(part);
9558
9418
  }
9559
9419
  attr(m) {
9560
- if (debugAssert("@" !== m.name[0], "An attr name must not start with `@`"), "...attributes" === m.name) return this.ctx.builder.splatAttr(this.ctx.table.allocateBlock("attrs"), this.ctx.loc(m.loc));
9420
+ if (m.name[0], "...attributes" === m.name) return this.ctx.builder.splatAttr(this.ctx.table.allocateBlock("attrs"), this.ctx.loc(m.loc));
9561
9421
  let offsets = this.ctx.loc(m.loc),
9562
9422
  nameSlice = offsets.sliceStartChars({
9563
9423
  chars: m.name.length
@@ -9586,7 +9446,7 @@ class ElementNormalizer {
9586
9446
  if ("error" === resolution.result && "has-block" !== resolution.path) throw generateSyntaxError(`You attempted to pass a path as argument (\`${arg.name}={{${resolution.path}}}\`) but ${resolution.head} was not in scope. Try:\n* \`${arg.name}={{this.${resolution.path}}}\` if this is meant to be a property lookup, or\n* \`${arg.name}={{(${resolution.path})}}\` if this is meant to invoke the resolved helper, or\n* \`${arg.name}={{helper "${resolution.path}"}}\` if this is meant to pass the resolved helper by value`, arg.loc);
9587
9447
  }
9588
9448
  arg(arg) {
9589
- debugAssert("@" === arg.name[0], "An arg name must start with `@`"), this.checkArgCall(arg);
9449
+ arg.name[0], this.checkArgCall(arg);
9590
9450
  let offsets = this.ctx.loc(arg.loc),
9591
9451
  nameSlice = offsets.sliceStartChars({
9592
9452
  chars: arg.name.length
@@ -9658,9 +9518,6 @@ class ElementNormalizer {
9658
9518
  }
9659
9519
  }
9660
9520
  class Children {
9661
- namedBlocks;
9662
- hasSemanticContent;
9663
- nonBlockChildren;
9664
9521
  constructor(loc, children, block) {
9665
9522
  this.loc = loc, this.children = children, this.block = block, this.namedBlocks = children.filter(c => c instanceof NamedBlock), this.hasSemanticContent = Boolean(children.filter(c => {
9666
9523
  if (c instanceof NamedBlock) return !1;
@@ -9827,4 +9684,4 @@ function transformParams(b, params, type, moduleName, loc) {
9827
9684
  }
9828
9685
  }
9829
9686
 
9830
- export { KEYWORDS_TYPES as K, SourceSlice as S, api$2 as a, api$1 as b, normalize as c, generateSyntaxError as g, isKeyword as i, loc as l, maybeLoc as m, node as n, transformResolutions as t };
9687
+ export { KEYWORDS_TYPES as K, SourceSlice as S, api$1 as a, api as b, normalize as c, generateSyntaxError as g, isKeyword as i, loc as l, maybeLoc as m, node as n, transformResolutions as t };