@danielx/civet 0.5.94 → 0.6.0

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/main.mjs CHANGED
@@ -421,13 +421,13 @@ var require_lib = __commonJS({
421
421
  };
422
422
  }
423
423
  function convertObjectToJSXAttributes(obj) {
424
- const { content } = obj;
424
+ const { properties } = obj;
425
425
  const parts = [];
426
426
  const rest = [];
427
- for (let i = 0; i < content.length; i++) {
427
+ for (let i = 0; i < properties.length; i++) {
428
428
  if (i > 0)
429
429
  parts.push(" ");
430
- const part = content[i];
430
+ const part = properties[i];
431
431
  switch (part.type) {
432
432
  case "Identifier":
433
433
  parts.push([part.name, "={", part.name, "}"]);
@@ -1066,6 +1066,7 @@ ${input.slice(result.pos)}
1066
1066
  NonPipelineArgumentPart,
1067
1067
  BinaryOpExpression,
1068
1068
  BinaryOpRHS,
1069
+ SingleLineBinaryOpRHS,
1069
1070
  RHS,
1070
1071
  ParenthesizedAssignment,
1071
1072
  UnaryExpression,
@@ -1141,6 +1142,7 @@ ${input.slice(result.pos)}
1141
1142
  BindingIdentifier,
1142
1143
  NWBindingIdentifier,
1143
1144
  AtIdentifierRef,
1145
+ PinPattern,
1144
1146
  BindingPattern,
1145
1147
  ObjectBindingPattern,
1146
1148
  ObjectBindingPatternContent,
@@ -1159,21 +1161,6 @@ ${input.slice(result.pos)}
1159
1161
  BindingElement,
1160
1162
  BindingRestElement,
1161
1163
  EmptyBindingPattern,
1162
- MatchingPattern,
1163
- ObjectMatchingPattern,
1164
- ObjectMatchingPatternContent,
1165
- NestedMatchingProperties,
1166
- MatchingPropertyList,
1167
- NestedMatchingPropertyList,
1168
- MatchingProperty,
1169
- MatchingRestProperty,
1170
- ArrayMatchingPattern,
1171
- ArrayMatchingPatternContent,
1172
- NestedMatchingElements,
1173
- MatchingElementList,
1174
- NestedMatchingElementList,
1175
- MatchingElement,
1176
- MatchingRestElement,
1177
1164
  FunctionDeclaration,
1178
1165
  FunctionSignature,
1179
1166
  FunctionExpression,
@@ -1335,6 +1322,10 @@ ${input.slice(result.pos)}
1335
1322
  AllowMultiLineImplicitObjectLiteral,
1336
1323
  RestoreMultiLineImplicitObjectLiteral,
1337
1324
  MultiLineImplicitObjectLiteralAllowed,
1325
+ AllowNewlineBinaryOp,
1326
+ ForbidNewlineBinaryOp,
1327
+ RestoreNewlineBinaryOp,
1328
+ NewlineBinaryOpAllowed,
1338
1329
  AllowAll,
1339
1330
  RestoreAll,
1340
1331
  ExpressionStatement,
@@ -2749,7 +2740,13 @@ ${input.slice(result.pos)}
2749
2740
  var rhs = $2;
2750
2741
  return [[], op, [], rhs];
2751
2742
  });
2752
- var BinaryOpRHS$1 = $S(NotDedented, BinaryOp, $C(_, $S(EOS, __)), RHS);
2743
+ var BinaryOpRHS$1 = $T($S(NewlineBinaryOpAllowed, $S(NotDedented, BinaryOp, $C(_, $S(EOS, __)), RHS)), function(value) {
2744
+ var rhs = value[1];
2745
+ return rhs;
2746
+ });
2747
+ var BinaryOpRHS$2 = $T($S($N(NewlineBinaryOpAllowed), SingleLineBinaryOpRHS), function(value) {
2748
+ return value[1];
2749
+ });
2753
2750
  function BinaryOpRHS(state) {
2754
2751
  let eventData;
2755
2752
  if (state.events) {
@@ -2761,17 +2758,46 @@ ${input.slice(result.pos)}
2761
2758
  }
2762
2759
  }
2763
2760
  if (state.tokenize) {
2764
- const result = $TOKEN("BinaryOpRHS", state, BinaryOpRHS$0(state) || BinaryOpRHS$1(state));
2761
+ const result = $TOKEN("BinaryOpRHS", state, BinaryOpRHS$0(state) || BinaryOpRHS$1(state) || BinaryOpRHS$2(state));
2765
2762
  if (state.events)
2766
2763
  state.events.exit?.("BinaryOpRHS", state, result, eventData);
2767
2764
  return result;
2768
2765
  } else {
2769
- const result = BinaryOpRHS$0(state) || BinaryOpRHS$1(state);
2766
+ const result = BinaryOpRHS$0(state) || BinaryOpRHS$1(state) || BinaryOpRHS$2(state);
2770
2767
  if (state.events)
2771
2768
  state.events.exit?.("BinaryOpRHS", state, result, eventData);
2772
2769
  return result;
2773
2770
  }
2774
2771
  }
2772
+ var SingleLineBinaryOpRHS$0 = $TS($S($E(_), BinaryOp, $C(_, $S(EOS, __)), RHS), function($skip, $loc, $0, $1, $2, $3, $4) {
2773
+ var ws1 = $1;
2774
+ var op = $2;
2775
+ var ws2 = $3;
2776
+ var rhs = $4;
2777
+ return [ws1 || [], op, ws2, rhs];
2778
+ });
2779
+ function SingleLineBinaryOpRHS(state) {
2780
+ let eventData;
2781
+ if (state.events) {
2782
+ const result = state.events.enter?.("SingleLineBinaryOpRHS", state);
2783
+ if (result) {
2784
+ if (result.cache)
2785
+ return result.cache;
2786
+ eventData = result.data;
2787
+ }
2788
+ }
2789
+ if (state.tokenize) {
2790
+ const result = $TOKEN("SingleLineBinaryOpRHS", state, SingleLineBinaryOpRHS$0(state));
2791
+ if (state.events)
2792
+ state.events.exit?.("SingleLineBinaryOpRHS", state, result, eventData);
2793
+ return result;
2794
+ } else {
2795
+ const result = SingleLineBinaryOpRHS$0(state);
2796
+ if (state.events)
2797
+ state.events.exit?.("SingleLineBinaryOpRHS", state, result, eventData);
2798
+ return result;
2799
+ }
2800
+ }
2775
2801
  var RHS$0 = ParenthesizedAssignment;
2776
2802
  var RHS$1 = UnaryExpression;
2777
2803
  var RHS$2 = ExpressionizedStatement;
@@ -5109,20 +5135,41 @@ ${input.slice(result.pos)}
5109
5135
  return result;
5110
5136
  }
5111
5137
  }
5112
- var BindingPattern$0 = $TS($S(__, ObjectBindingPattern), function($skip, $loc, $0, $1, $2) {
5113
- var p = $2;
5114
- return {
5115
- children: [...$1, p],
5116
- names: p.names
5117
- };
5118
- });
5119
- var BindingPattern$1 = $TS($S(__, ArrayBindingPattern), function($skip, $loc, $0, $1, $2) {
5120
- var p = $2;
5138
+ var PinPattern$0 = $TS($S($EXPECT($L17, fail, 'PinPattern "^"'), Identifier), function($skip, $loc, $0, $1, $2) {
5139
+ var identifier = $2;
5121
5140
  return {
5122
- children: [...$1, p.children],
5123
- names: p.names
5141
+ type: "PinPattern",
5142
+ children: $0,
5143
+ identifier
5124
5144
  };
5125
5145
  });
5146
+ function PinPattern(state) {
5147
+ let eventData;
5148
+ if (state.events) {
5149
+ const result = state.events.enter?.("PinPattern", state);
5150
+ if (result) {
5151
+ if (result.cache)
5152
+ return result.cache;
5153
+ eventData = result.data;
5154
+ }
5155
+ }
5156
+ if (state.tokenize) {
5157
+ const result = $TOKEN("PinPattern", state, PinPattern$0(state));
5158
+ if (state.events)
5159
+ state.events.exit?.("PinPattern", state, result, eventData);
5160
+ return result;
5161
+ } else {
5162
+ const result = PinPattern$0(state);
5163
+ if (state.events)
5164
+ state.events.exit?.("PinPattern", state, result, eventData);
5165
+ return result;
5166
+ }
5167
+ }
5168
+ var BindingPattern$0 = ObjectBindingPattern;
5169
+ var BindingPattern$1 = ArrayBindingPattern;
5170
+ var BindingPattern$2 = PinPattern;
5171
+ var BindingPattern$3 = Literal;
5172
+ var BindingPattern$4 = RegularExpressionLiteral;
5126
5173
  function BindingPattern(state) {
5127
5174
  let eventData;
5128
5175
  if (state.events) {
@@ -5134,24 +5181,24 @@ ${input.slice(result.pos)}
5134
5181
  }
5135
5182
  }
5136
5183
  if (state.tokenize) {
5137
- const result = $TOKEN("BindingPattern", state, BindingPattern$0(state) || BindingPattern$1(state));
5184
+ const result = $TOKEN("BindingPattern", state, BindingPattern$0(state) || BindingPattern$1(state) || BindingPattern$2(state) || BindingPattern$3(state) || BindingPattern$4(state));
5138
5185
  if (state.events)
5139
5186
  state.events.exit?.("BindingPattern", state, result, eventData);
5140
5187
  return result;
5141
5188
  } else {
5142
- const result = BindingPattern$0(state) || BindingPattern$1(state);
5189
+ const result = BindingPattern$0(state) || BindingPattern$1(state) || BindingPattern$2(state) || BindingPattern$3(state) || BindingPattern$4(state);
5143
5190
  if (state.events)
5144
5191
  state.events.exit?.("BindingPattern", state, result, eventData);
5145
5192
  return result;
5146
5193
  }
5147
5194
  }
5148
- var ObjectBindingPattern$0 = $TS($S(OpenBrace, ObjectBindingPatternContent, __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4) {
5149
- var c = $2;
5195
+ var ObjectBindingPattern$0 = $TS($S($E(_), OpenBrace, ObjectBindingPatternContent, __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
5196
+ var c = $3;
5150
5197
  return {
5151
5198
  type: "ObjectBindingPattern",
5152
- children: [$1, ...c.children, $3, $4],
5153
- content: c.children,
5154
- names: c.names
5199
+ children: $0,
5200
+ names: c.names,
5201
+ properties: c.children
5155
5202
  };
5156
5203
  });
5157
5204
  function ObjectBindingPattern(state) {
@@ -5178,10 +5225,10 @@ ${input.slice(result.pos)}
5178
5225
  }
5179
5226
  var ObjectBindingPatternContent$0 = NestedBindingProperties;
5180
5227
  var ObjectBindingPatternContent$1 = $TV($E(BindingPropertyList), function($skip, $loc, $0, $1) {
5181
- var props2 = $0;
5182
- if (!props2)
5228
+ var props = $0;
5229
+ if (!props)
5183
5230
  return { children: [], names: [] };
5184
- return module.reorderBindingRestProperty(props2);
5231
+ return module.reorderBindingRestProperty(props);
5185
5232
  });
5186
5233
  function ObjectBindingPatternContent(state) {
5187
5234
  let eventData;
@@ -5206,8 +5253,8 @@ ${input.slice(result.pos)}
5206
5253
  }
5207
5254
  }
5208
5255
  var BindingPropertyList$0 = $TV($P($S(BindingProperty, ObjectPropertyDelimiter)), function($skip, $loc, $0, $1) {
5209
- var props2 = $0;
5210
- return props2.map(([prop, delim]) => {
5256
+ var props = $0;
5257
+ return props.map(([prop, delim]) => {
5211
5258
  return {
5212
5259
  ...prop,
5213
5260
  children: [...prop.children, delim]
@@ -5236,12 +5283,14 @@ ${input.slice(result.pos)}
5236
5283
  return result;
5237
5284
  }
5238
5285
  }
5239
- var ArrayBindingPattern$0 = $TS($S(OpenBracket, ArrayBindingPatternContent, __, CloseBracket), function($skip, $loc, $0, $1, $2, $3, $4) {
5240
- var c = $2;
5286
+ var ArrayBindingPattern$0 = $TS($S($E(_), OpenBracket, ArrayBindingPatternContent, __, CloseBracket), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
5287
+ var c = $3;
5241
5288
  return {
5242
5289
  type: "ArrayBindingPattern",
5290
+ children: $0,
5243
5291
  names: c.names,
5244
- children: $0
5292
+ elements: c.children,
5293
+ length: c.length
5245
5294
  };
5246
5295
  });
5247
5296
  function ArrayBindingPattern(state) {
@@ -5270,7 +5319,7 @@ ${input.slice(result.pos)}
5270
5319
  var ArrayBindingPatternContent$1 = $TV($E(BindingElementList), function($skip, $loc, $0, $1) {
5271
5320
  var elements = $0;
5272
5321
  if (!elements)
5273
- return { children: [], names: [] };
5322
+ return { children: [], names: [], length: 0 };
5274
5323
  return module.adjustBindingElements(elements);
5275
5324
  });
5276
5325
  function ArrayBindingPatternContent(state) {
@@ -5384,10 +5433,10 @@ ${input.slice(result.pos)}
5384
5433
  }
5385
5434
  }
5386
5435
  var NestedBindingProperties$0 = $TS($S(PushIndent, $Q(NestedBindingPropertyList), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
5387
- var props2 = $2;
5388
- if (!props2.length)
5436
+ var props = $2;
5437
+ if (!props.length)
5389
5438
  return $skip;
5390
- return module.reorderBindingRestProperty(props2.flat());
5439
+ return module.reorderBindingRestProperty(props.flat());
5391
5440
  });
5392
5441
  function NestedBindingProperties(state) {
5393
5442
  let eventData;
@@ -5413,8 +5462,8 @@ ${input.slice(result.pos)}
5413
5462
  }
5414
5463
  var NestedBindingPropertyList$0 = $TS($S(Nested, BindingPropertyList), function($skip, $loc, $0, $1, $2) {
5415
5464
  var ws = $1;
5416
- var props2 = $2;
5417
- return props2.map((prop, i) => {
5465
+ var props = $2;
5466
+ return props.map((prop, i) => {
5418
5467
  if (i > 0)
5419
5468
  return prop;
5420
5469
  return {
@@ -5446,35 +5495,53 @@ ${input.slice(result.pos)}
5446
5495
  }
5447
5496
  }
5448
5497
  var BindingProperty$0 = BindingRestProperty;
5449
- var BindingProperty$1 = $TS($S($E(_), PropertyName, $E(_), Colon, $C(BindingIdentifier, BindingPattern), $E(Initializer)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
5498
+ var BindingProperty$1 = $TS($S($E(_), PropertyName, $E(_), Colon, $E(_), $C(BindingIdentifier, BindingPattern), $E(Initializer)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
5450
5499
  var name = $2;
5451
- var b = $5;
5452
- var init = $6;
5500
+ var value = $6;
5501
+ var init = $7;
5453
5502
  return {
5503
+ type: "BindingProperty",
5504
+ children: $0,
5454
5505
  name,
5455
- value: b,
5506
+ value,
5456
5507
  init,
5457
- names: b.names,
5458
- children: $0
5508
+ names: value.names
5459
5509
  };
5460
5510
  });
5461
- var BindingProperty$2 = $TS($S(BindingIdentifier, $E(Initializer)), function($skip, $loc, $0, $1, $2) {
5462
- var b = $1;
5463
- var init = $2;
5464
- if (b.type === "AtBinding") {
5511
+ var BindingProperty$2 = $TS($S($E(_), $E($EXPECT($L17, fail, 'BindingProperty "^"')), BindingIdentifier, $E(Initializer)), function($skip, $loc, $0, $1, $2, $3, $4) {
5512
+ var ws = $1;
5513
+ var pin = $2;
5514
+ var binding = $3;
5515
+ var init = $4;
5516
+ if (binding.type === "AtBinding") {
5465
5517
  return {
5466
5518
  type: "AtBindingProperty",
5467
- ref: b.ref,
5519
+ children: $0,
5520
+ binding,
5521
+ ref: binding.ref,
5468
5522
  init,
5469
- names: [],
5470
- children: $0
5523
+ names: []
5524
+ };
5525
+ }
5526
+ if (pin) {
5527
+ return {
5528
+ type: "PinProperty",
5529
+ children: [ws, binding],
5530
+ name: binding,
5531
+ value: {
5532
+ type: "PinPattern",
5533
+ identifier: binding
5534
+ }
5471
5535
  };
5472
5536
  }
5473
5537
  return {
5474
- name: b,
5538
+ type: "BindingProperty",
5539
+ children: $0,
5540
+ name: binding,
5541
+ value: void 0,
5475
5542
  init,
5476
- names: b.names,
5477
- children: $0
5543
+ names: binding.names,
5544
+ identifier: binding
5478
5545
  };
5479
5546
  });
5480
5547
  function BindingProperty(state) {
@@ -5519,501 +5586,10 @@ ${input.slice(result.pos)}
5519
5586
  children: [...ws || [], dots, ...id.children]
5520
5587
  };
5521
5588
  });
5522
- function BindingRestProperty(state) {
5523
- let eventData;
5524
- if (state.events) {
5525
- const result = state.events.enter?.("BindingRestProperty", state);
5526
- if (result) {
5527
- if (result.cache)
5528
- return result.cache;
5529
- eventData = result.data;
5530
- }
5531
- }
5532
- if (state.tokenize) {
5533
- const result = $TOKEN("BindingRestProperty", state, BindingRestProperty$0(state) || BindingRestProperty$1(state));
5534
- if (state.events)
5535
- state.events.exit?.("BindingRestProperty", state, result, eventData);
5536
- return result;
5537
- } else {
5538
- const result = BindingRestProperty$0(state) || BindingRestProperty$1(state);
5539
- if (state.events)
5540
- state.events.exit?.("BindingRestProperty", state, result, eventData);
5541
- return result;
5542
- }
5543
- }
5544
- var NestedBindingElements$0 = $TS($S(PushIndent, $Q(NestedBindingElementList), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
5545
- var elements = $2;
5546
- if (!elements.length)
5547
- return $skip;
5548
- return module.adjustBindingElements(elements.flat());
5549
- });
5550
- function NestedBindingElements(state) {
5551
- let eventData;
5552
- if (state.events) {
5553
- const result = state.events.enter?.("NestedBindingElements", state);
5554
- if (result) {
5555
- if (result.cache)
5556
- return result.cache;
5557
- eventData = result.data;
5558
- }
5559
- }
5560
- if (state.tokenize) {
5561
- const result = $TOKEN("NestedBindingElements", state, NestedBindingElements$0(state));
5562
- if (state.events)
5563
- state.events.exit?.("NestedBindingElements", state, result, eventData);
5564
- return result;
5565
- } else {
5566
- const result = NestedBindingElements$0(state);
5567
- if (state.events)
5568
- state.events.exit?.("NestedBindingElements", state, result, eventData);
5569
- return result;
5570
- }
5571
- }
5572
- var NestedBindingElement$0 = $TS($S(Nested, BindingElement), function($skip, $loc, $0, $1, $2) {
5573
- var indent = $1;
5574
- var element = $2;
5575
- return {
5576
- ...element,
5577
- children: [indent, ...element.children]
5578
- };
5579
- });
5580
- function NestedBindingElement(state) {
5581
- let eventData;
5582
- if (state.events) {
5583
- const result = state.events.enter?.("NestedBindingElement", state);
5584
- if (result) {
5585
- if (result.cache)
5586
- return result.cache;
5587
- eventData = result.data;
5588
- }
5589
- }
5590
- if (state.tokenize) {
5591
- const result = $TOKEN("NestedBindingElement", state, NestedBindingElement$0(state));
5592
- if (state.events)
5593
- state.events.exit?.("NestedBindingElement", state, result, eventData);
5594
- return result;
5595
- } else {
5596
- const result = NestedBindingElement$0(state);
5597
- if (state.events)
5598
- state.events.exit?.("NestedBindingElement", state, result, eventData);
5599
- return result;
5600
- }
5601
- }
5602
- var BindingElement$0 = BindingRestElement;
5603
- var BindingElement$1 = $TS($S($C(BindingIdentifier, BindingPattern), $E(Initializer)), function($skip, $loc, $0, $1, $2) {
5604
- var binding = $1;
5605
- return {
5606
- names: binding.names,
5607
- children: $0
5608
- };
5609
- });
5610
- var BindingElement$2 = $TV($Y($S($E(_), $EXPECT($L21, fail, 'BindingElement ","'))), function($skip, $loc, $0, $1) {
5611
- return {
5612
- children: [{
5613
- type: "ElisionElement",
5614
- children: [""]
5615
- }],
5616
- names: []
5617
- };
5618
- });
5619
- function BindingElement(state) {
5620
- let eventData;
5621
- if (state.events) {
5622
- const result = state.events.enter?.("BindingElement", state);
5623
- if (result) {
5624
- if (result.cache)
5625
- return result.cache;
5626
- eventData = result.data;
5627
- }
5628
- }
5629
- if (state.tokenize) {
5630
- const result = $TOKEN("BindingElement", state, BindingElement$0(state) || BindingElement$1(state) || BindingElement$2(state));
5631
- if (state.events)
5632
- state.events.exit?.("BindingElement", state, result, eventData);
5633
- return result;
5634
- } else {
5635
- const result = BindingElement$0(state) || BindingElement$1(state) || BindingElement$2(state);
5636
- if (state.events)
5637
- state.events.exit?.("BindingElement", state, result, eventData);
5638
- return result;
5639
- }
5640
- }
5641
- var BindingRestElement$0 = $TS($S($E(_), DotDotDot, $C(BindingIdentifier, BindingPattern, EmptyBindingPattern)), function($skip, $loc, $0, $1, $2, $3) {
5642
- var ws = $1;
5643
- var dots = $2;
5644
- var binding = $3;
5645
- return {
5646
- ...binding,
5647
- children: [...ws || [], dots, ...binding.children],
5648
- rest: true
5649
- };
5650
- });
5651
- var BindingRestElement$1 = $TS($S($E(_), $C(BindingIdentifier, BindingPattern), DotDotDot), function($skip, $loc, $0, $1, $2, $3) {
5652
- var ws = $1;
5653
- var binding = $2;
5654
- var dots = $3;
5655
- return {
5656
- ...binding,
5657
- children: [...ws || [], dots, ...binding.children],
5658
- rest: true
5659
- };
5660
- });
5661
- function BindingRestElement(state) {
5662
- let eventData;
5663
- if (state.events) {
5664
- const result = state.events.enter?.("BindingRestElement", state);
5665
- if (result) {
5666
- if (result.cache)
5667
- return result.cache;
5668
- eventData = result.data;
5669
- }
5670
- }
5671
- if (state.tokenize) {
5672
- const result = $TOKEN("BindingRestElement", state, BindingRestElement$0(state) || BindingRestElement$1(state));
5673
- if (state.events)
5674
- state.events.exit?.("BindingRestElement", state, result, eventData);
5675
- return result;
5676
- } else {
5677
- const result = BindingRestElement$0(state) || BindingRestElement$1(state);
5678
- if (state.events)
5679
- state.events.exit?.("BindingRestElement", state, result, eventData);
5680
- return result;
5681
- }
5682
- }
5683
- var EmptyBindingPattern$0 = $TV($EXPECT($L0, fail, 'EmptyBindingPattern ""'), function($skip, $loc, $0, $1) {
5684
- const ref = {
5685
- type: "Ref",
5686
- base: "ref",
5687
- id: "ref"
5688
- };
5689
- return {
5690
- type: "EmptyBinding",
5691
- children: [ref],
5692
- names: [],
5693
- ref
5694
- };
5695
- });
5696
- function EmptyBindingPattern(state) {
5697
- let eventData;
5698
- if (state.events) {
5699
- const result = state.events.enter?.("EmptyBindingPattern", state);
5700
- if (result) {
5701
- if (result.cache)
5702
- return result.cache;
5703
- eventData = result.data;
5704
- }
5705
- }
5706
- if (state.tokenize) {
5707
- const result = $TOKEN("EmptyBindingPattern", state, EmptyBindingPattern$0(state));
5708
- if (state.events)
5709
- state.events.exit?.("EmptyBindingPattern", state, result, eventData);
5710
- return result;
5711
- } else {
5712
- const result = EmptyBindingPattern$0(state);
5713
- if (state.events)
5714
- state.events.exit?.("EmptyBindingPattern", state, result, eventData);
5715
- return result;
5716
- }
5717
- }
5718
- var MatchingPattern$0 = ObjectMatchingPattern;
5719
- var MatchingPattern$1 = ArrayMatchingPattern;
5720
- var MatchingPattern$2 = Literal;
5721
- var MatchingPattern$3 = RegularExpressionLiteral;
5722
- function MatchingPattern(state) {
5723
- let eventData;
5724
- if (state.events) {
5725
- const result = state.events.enter?.("MatchingPattern", state);
5726
- if (result) {
5727
- if (result.cache)
5728
- return result.cache;
5729
- eventData = result.data;
5730
- }
5731
- }
5732
- if (state.tokenize) {
5733
- const result = $TOKEN("MatchingPattern", state, MatchingPattern$0(state) || MatchingPattern$1(state) || MatchingPattern$2(state) || MatchingPattern$3(state));
5734
- if (state.events)
5735
- state.events.exit?.("MatchingPattern", state, result, eventData);
5736
- return result;
5737
- } else {
5738
- const result = MatchingPattern$0(state) || MatchingPattern$1(state) || MatchingPattern$2(state) || MatchingPattern$3(state);
5739
- if (state.events)
5740
- state.events.exit?.("MatchingPattern", state, result, eventData);
5741
- return result;
5742
- }
5743
- }
5744
- var ObjectMatchingPattern$0 = $TS($S($E(_), OpenBrace, ObjectMatchingPatternContent, __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
5745
- var ws = $1;
5746
- var open = $2;
5747
- var properties = $3;
5748
- var ws = $4;
5749
- var close = $5;
5750
- return {
5751
- type: "ObjectMatchingPattern",
5752
- children: [ws, open, ...properties.children, ...ws, close],
5753
- properties: properties.children
5754
- };
5755
- });
5756
- function ObjectMatchingPattern(state) {
5757
- let eventData;
5758
- if (state.events) {
5759
- const result = state.events.enter?.("ObjectMatchingPattern", state);
5760
- if (result) {
5761
- if (result.cache)
5762
- return result.cache;
5763
- eventData = result.data;
5764
- }
5765
- }
5766
- if (state.tokenize) {
5767
- const result = $TOKEN("ObjectMatchingPattern", state, ObjectMatchingPattern$0(state));
5768
- if (state.events)
5769
- state.events.exit?.("ObjectMatchingPattern", state, result, eventData);
5770
- return result;
5771
- } else {
5772
- const result = ObjectMatchingPattern$0(state);
5773
- if (state.events)
5774
- state.events.exit?.("ObjectMatchingPattern", state, result, eventData);
5775
- return result;
5776
- }
5777
- }
5778
- var ObjectMatchingPatternContent$0 = NestedMatchingProperties;
5779
- var ObjectMatchingPatternContent$1 = $TV($E(MatchingPropertyList), function($skip, $loc, $0, $1) {
5780
- var properties = $0;
5781
- if (!properties)
5782
- return { children: [], names: [] };
5783
- return module.reorderBindingRestProperty(properties);
5784
- });
5785
- function ObjectMatchingPatternContent(state) {
5786
- let eventData;
5787
- if (state.events) {
5788
- const result = state.events.enter?.("ObjectMatchingPatternContent", state);
5789
- if (result) {
5790
- if (result.cache)
5791
- return result.cache;
5792
- eventData = result.data;
5793
- }
5794
- }
5795
- if (state.tokenize) {
5796
- const result = $TOKEN("ObjectMatchingPatternContent", state, ObjectMatchingPatternContent$0(state) || ObjectMatchingPatternContent$1(state));
5797
- if (state.events)
5798
- state.events.exit?.("ObjectMatchingPatternContent", state, result, eventData);
5799
- return result;
5800
- } else {
5801
- const result = ObjectMatchingPatternContent$0(state) || ObjectMatchingPatternContent$1(state);
5802
- if (state.events)
5803
- state.events.exit?.("ObjectMatchingPatternContent", state, result, eventData);
5804
- return result;
5805
- }
5806
- }
5807
- var NestedMatchingProperties$0 = $TS($S(PushIndent, $Q(NestedMatchingPropertyList), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
5808
- var properties = $2;
5809
- if (!props.length)
5810
- return $skip;
5811
- return module.reorderBindingRestProperty(props.flat());
5812
- });
5813
- function NestedMatchingProperties(state) {
5814
- let eventData;
5815
- if (state.events) {
5816
- const result = state.events.enter?.("NestedMatchingProperties", state);
5817
- if (result) {
5818
- if (result.cache)
5819
- return result.cache;
5820
- eventData = result.data;
5821
- }
5822
- }
5823
- if (state.tokenize) {
5824
- const result = $TOKEN("NestedMatchingProperties", state, NestedMatchingProperties$0(state));
5825
- if (state.events)
5826
- state.events.exit?.("NestedMatchingProperties", state, result, eventData);
5827
- return result;
5828
- } else {
5829
- const result = NestedMatchingProperties$0(state);
5830
- if (state.events)
5831
- state.events.exit?.("NestedMatchingProperties", state, result, eventData);
5832
- return result;
5833
- }
5834
- }
5835
- var MatchingPropertyList$0 = $TV($P($S(MatchingProperty, ObjectPropertyDelimiter)), function($skip, $loc, $0, $1) {
5836
- var props2 = $0;
5837
- return props2.map(([prop, delim]) => {
5838
- return {
5839
- ...prop,
5840
- children: [...prop.children, delim]
5841
- };
5842
- });
5843
- });
5844
- function MatchingPropertyList(state) {
5845
- let eventData;
5846
- if (state.events) {
5847
- const result = state.events.enter?.("MatchingPropertyList", state);
5848
- if (result) {
5849
- if (result.cache)
5850
- return result.cache;
5851
- eventData = result.data;
5852
- }
5853
- }
5854
- if (state.tokenize) {
5855
- const result = $TOKEN("MatchingPropertyList", state, MatchingPropertyList$0(state));
5856
- if (state.events)
5857
- state.events.exit?.("MatchingPropertyList", state, result, eventData);
5858
- return result;
5859
- } else {
5860
- const result = MatchingPropertyList$0(state);
5861
- if (state.events)
5862
- state.events.exit?.("MatchingPropertyList", state, result, eventData);
5863
- return result;
5864
- }
5865
- }
5866
- var NestedMatchingPropertyList$0 = $TS($S(Nested, MatchingPropertyList), function($skip, $loc, $0, $1, $2) {
5867
- var ws = $1;
5868
- var props2 = $2;
5869
- return props2.map((prop, i) => {
5870
- if (i > 0)
5871
- return prop;
5872
- return {
5873
- ...prop,
5874
- children: [ws, ...prop.children]
5875
- };
5876
- });
5877
- });
5878
- function NestedMatchingPropertyList(state) {
5879
- let eventData;
5880
- if (state.events) {
5881
- const result = state.events.enter?.("NestedMatchingPropertyList", state);
5882
- if (result) {
5883
- if (result.cache)
5884
- return result.cache;
5885
- eventData = result.data;
5886
- }
5887
- }
5888
- if (state.tokenize) {
5889
- const result = $TOKEN("NestedMatchingPropertyList", state, NestedMatchingPropertyList$0(state));
5890
- if (state.events)
5891
- state.events.exit?.("NestedMatchingPropertyList", state, result, eventData);
5892
- return result;
5893
- } else {
5894
- const result = NestedMatchingPropertyList$0(state);
5895
- if (state.events)
5896
- state.events.exit?.("NestedMatchingPropertyList", state, result, eventData);
5897
- return result;
5898
- }
5899
- }
5900
- var MatchingProperty$0 = MatchingRestProperty;
5901
- var MatchingProperty$1 = $TS($S($E(_), PropertyName, $E(_), Colon, $E(_), $C(BindingIdentifier, MatchingPattern)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
5902
- var name = $2;
5903
- var match = $6;
5904
- return {
5905
- type: "BindingMatchProperty",
5906
- name,
5907
- match,
5908
- children: $0
5909
- };
5910
- });
5911
- var MatchingProperty$2 = $TS($S($E(_), BindingIdentifier), function($skip, $loc, $0, $1, $2) {
5912
- var ws = $1;
5913
- var b = $2;
5914
- if (b.type === "AtBinding") {
5915
- return {
5916
- type: "AtBindingProperty",
5917
- ref: b.ref,
5918
- names: [],
5919
- children: [ws, b]
5920
- };
5921
- }
5922
- return {
5923
- type: "BindingProperty",
5924
- names: b.names,
5925
- children: [ws, b],
5926
- identifier: b
5927
- };
5928
- });
5929
- function MatchingProperty(state) {
5930
- let eventData;
5931
- if (state.events) {
5932
- const result = state.events.enter?.("MatchingProperty", state);
5933
- if (result) {
5934
- if (result.cache)
5935
- return result.cache;
5936
- eventData = result.data;
5937
- }
5938
- }
5939
- if (state.tokenize) {
5940
- const result = $TOKEN("MatchingProperty", state, MatchingProperty$0(state) || MatchingProperty$1(state) || MatchingProperty$2(state));
5941
- if (state.events)
5942
- state.events.exit?.("MatchingProperty", state, result, eventData);
5943
- return result;
5944
- } else {
5945
- const result = MatchingProperty$0(state) || MatchingProperty$1(state) || MatchingProperty$2(state);
5946
- if (state.events)
5947
- state.events.exit?.("MatchingProperty", state, result, eventData);
5948
- return result;
5949
- }
5950
- }
5951
- var MatchingRestProperty$0 = BindingRestProperty;
5952
- function MatchingRestProperty(state) {
5953
- let eventData;
5954
- if (state.events) {
5955
- const result = state.events.enter?.("MatchingRestProperty", state);
5956
- if (result) {
5957
- if (result.cache)
5958
- return result.cache;
5959
- eventData = result.data;
5960
- }
5961
- }
5962
- if (state.tokenize) {
5963
- const result = $TOKEN("MatchingRestProperty", state, MatchingRestProperty$0(state));
5964
- if (state.events)
5965
- state.events.exit?.("MatchingRestProperty", state, result, eventData);
5966
- return result;
5967
- } else {
5968
- const result = MatchingRestProperty$0(state);
5969
- if (state.events)
5970
- state.events.exit?.("MatchingRestProperty", state, result, eventData);
5971
- return result;
5972
- }
5973
- }
5974
- var ArrayMatchingPattern$0 = $TS($S($E(_), OpenBracket, ArrayMatchingPatternContent, __, CloseBracket), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
5975
- var ws = $1;
5976
- var elements = $3;
5977
- return {
5978
- type: "ArrayMatchingPattern",
5979
- children: $0,
5980
- elements: elements.children,
5981
- length: elements.length
5982
- };
5983
- });
5984
- function ArrayMatchingPattern(state) {
5985
- let eventData;
5986
- if (state.events) {
5987
- const result = state.events.enter?.("ArrayMatchingPattern", state);
5988
- if (result) {
5989
- if (result.cache)
5990
- return result.cache;
5991
- eventData = result.data;
5992
- }
5993
- }
5994
- if (state.tokenize) {
5995
- const result = $TOKEN("ArrayMatchingPattern", state, ArrayMatchingPattern$0(state));
5996
- if (state.events)
5997
- state.events.exit?.("ArrayMatchingPattern", state, result, eventData);
5998
- return result;
5999
- } else {
6000
- const result = ArrayMatchingPattern$0(state);
6001
- if (state.events)
6002
- state.events.exit?.("ArrayMatchingPattern", state, result, eventData);
6003
- return result;
6004
- }
6005
- }
6006
- var ArrayMatchingPatternContent$0 = NestedMatchingElements;
6007
- var ArrayMatchingPatternContent$1 = $TV($E(MatchingElementList), function($skip, $loc, $0, $1) {
6008
- var elements = $0;
6009
- if (!elements)
6010
- return { children: [], names: [], length: 0 };
6011
- return module.adjustBindingElements(elements);
6012
- });
6013
- function ArrayMatchingPatternContent(state) {
5589
+ function BindingRestProperty(state) {
6014
5590
  let eventData;
6015
5591
  if (state.events) {
6016
- const result = state.events.enter?.("ArrayMatchingPatternContent", state);
5592
+ const result = state.events.enter?.("BindingRestProperty", state);
6017
5593
  if (result) {
6018
5594
  if (result.cache)
6019
5595
  return result.cache;
@@ -6021,25 +5597,27 @@ ${input.slice(result.pos)}
6021
5597
  }
6022
5598
  }
6023
5599
  if (state.tokenize) {
6024
- const result = $TOKEN("ArrayMatchingPatternContent", state, ArrayMatchingPatternContent$0(state) || ArrayMatchingPatternContent$1(state));
5600
+ const result = $TOKEN("BindingRestProperty", state, BindingRestProperty$0(state) || BindingRestProperty$1(state));
6025
5601
  if (state.events)
6026
- state.events.exit?.("ArrayMatchingPatternContent", state, result, eventData);
5602
+ state.events.exit?.("BindingRestProperty", state, result, eventData);
6027
5603
  return result;
6028
5604
  } else {
6029
- const result = ArrayMatchingPatternContent$0(state) || ArrayMatchingPatternContent$1(state);
5605
+ const result = BindingRestProperty$0(state) || BindingRestProperty$1(state);
6030
5606
  if (state.events)
6031
- state.events.exit?.("ArrayMatchingPatternContent", state, result, eventData);
5607
+ state.events.exit?.("BindingRestProperty", state, result, eventData);
6032
5608
  return result;
6033
5609
  }
6034
5610
  }
6035
- var NestedMatchingElements$0 = $TS($S(PushIndent, $Q(NestedMatchingElementList), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
5611
+ var NestedBindingElements$0 = $TS($S(PushIndent, $Q(NestedBindingElementList), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
6036
5612
  var elements = $2;
5613
+ if (!elements.length)
5614
+ return $skip;
6037
5615
  return module.adjustBindingElements(elements.flat());
6038
5616
  });
6039
- function NestedMatchingElements(state) {
5617
+ function NestedBindingElements(state) {
6040
5618
  let eventData;
6041
5619
  if (state.events) {
6042
- const result = state.events.enter?.("NestedMatchingElements", state);
5620
+ const result = state.events.enter?.("NestedBindingElements", state);
6043
5621
  if (result) {
6044
5622
  if (result.cache)
6045
5623
  return result.cache;
@@ -6047,30 +5625,29 @@ ${input.slice(result.pos)}
6047
5625
  }
6048
5626
  }
6049
5627
  if (state.tokenize) {
6050
- const result = $TOKEN("NestedMatchingElements", state, NestedMatchingElements$0(state));
5628
+ const result = $TOKEN("NestedBindingElements", state, NestedBindingElements$0(state));
6051
5629
  if (state.events)
6052
- state.events.exit?.("NestedMatchingElements", state, result, eventData);
5630
+ state.events.exit?.("NestedBindingElements", state, result, eventData);
6053
5631
  return result;
6054
5632
  } else {
6055
- const result = NestedMatchingElements$0(state);
5633
+ const result = NestedBindingElements$0(state);
6056
5634
  if (state.events)
6057
- state.events.exit?.("NestedMatchingElements", state, result, eventData);
5635
+ state.events.exit?.("NestedBindingElements", state, result, eventData);
6058
5636
  return result;
6059
5637
  }
6060
5638
  }
6061
- var MatchingElementList$0 = $TV($P($S(MatchingElement, ArrayElementDelimiter)), function($skip, $loc, $0, $1) {
6062
- var elements = $0;
6063
- return elements.map(([element, delim]) => {
6064
- return {
6065
- ...element,
6066
- children: [...element.children, delim]
6067
- };
6068
- });
5639
+ var NestedBindingElement$0 = $TS($S(Nested, BindingElement), function($skip, $loc, $0, $1, $2) {
5640
+ var indent = $1;
5641
+ var element = $2;
5642
+ return {
5643
+ ...element,
5644
+ children: [indent, ...element.children]
5645
+ };
6069
5646
  });
6070
- function MatchingElementList(state) {
5647
+ function NestedBindingElement(state) {
6071
5648
  let eventData;
6072
5649
  if (state.events) {
6073
- const result = state.events.enter?.("MatchingElementList", state);
5650
+ const result = state.events.enter?.("NestedBindingElement", state);
6074
5651
  if (result) {
6075
5652
  if (result.cache)
6076
5653
  return result.cache;
@@ -6078,33 +5655,46 @@ ${input.slice(result.pos)}
6078
5655
  }
6079
5656
  }
6080
5657
  if (state.tokenize) {
6081
- const result = $TOKEN("MatchingElementList", state, MatchingElementList$0(state));
5658
+ const result = $TOKEN("NestedBindingElement", state, NestedBindingElement$0(state));
6082
5659
  if (state.events)
6083
- state.events.exit?.("MatchingElementList", state, result, eventData);
5660
+ state.events.exit?.("NestedBindingElement", state, result, eventData);
6084
5661
  return result;
6085
5662
  } else {
6086
- const result = MatchingElementList$0(state);
5663
+ const result = NestedBindingElement$0(state);
6087
5664
  if (state.events)
6088
- state.events.exit?.("MatchingElementList", state, result, eventData);
5665
+ state.events.exit?.("NestedBindingElement", state, result, eventData);
6089
5666
  return result;
6090
5667
  }
6091
5668
  }
6092
- var NestedMatchingElementList$0 = $TS($S(Nested, MatchingElementList), function($skip, $loc, $0, $1, $2) {
5669
+ var BindingElement$0 = BindingRestElement;
5670
+ var BindingElement$1 = $TS($S($E(_), $C(BindingIdentifier, BindingPattern), $E(Initializer)), function($skip, $loc, $0, $1, $2, $3) {
6093
5671
  var ws = $1;
6094
- var elements = $2;
6095
- return elements.map((element, i) => {
6096
- if (i > 0)
6097
- return element;
6098
- return {
6099
- ...element,
6100
- children: [ws, ...element.children]
5672
+ var binding = $2;
5673
+ var initializer = $3;
5674
+ if (binding.children) {
5675
+ binding = {
5676
+ ...binding,
5677
+ children: [...binding.children, initializer]
6101
5678
  };
6102
- });
5679
+ }
5680
+ return {
5681
+ names: binding.names,
5682
+ children: [ws, binding]
5683
+ };
5684
+ });
5685
+ var BindingElement$2 = $TV($Y($S($E(_), $EXPECT($L21, fail, 'BindingElement ","'))), function($skip, $loc, $0, $1) {
5686
+ return {
5687
+ children: [{
5688
+ type: "ElisionElement",
5689
+ children: [""]
5690
+ }],
5691
+ names: []
5692
+ };
6103
5693
  });
6104
- function NestedMatchingElementList(state) {
5694
+ function BindingElement(state) {
6105
5695
  let eventData;
6106
5696
  if (state.events) {
6107
- const result = state.events.enter?.("NestedMatchingElementList", state);
5697
+ const result = state.events.enter?.("BindingElement", state);
6108
5698
  if (result) {
6109
5699
  if (result.cache)
6110
5700
  return result.cache;
@@ -6112,63 +5702,41 @@ ${input.slice(result.pos)}
6112
5702
  }
6113
5703
  }
6114
5704
  if (state.tokenize) {
6115
- const result = $TOKEN("NestedMatchingElementList", state, NestedMatchingElementList$0(state));
5705
+ const result = $TOKEN("BindingElement", state, BindingElement$0(state) || BindingElement$1(state) || BindingElement$2(state));
6116
5706
  if (state.events)
6117
- state.events.exit?.("NestedMatchingElementList", state, result, eventData);
5707
+ state.events.exit?.("BindingElement", state, result, eventData);
6118
5708
  return result;
6119
5709
  } else {
6120
- const result = NestedMatchingElementList$0(state);
5710
+ const result = BindingElement$0(state) || BindingElement$1(state) || BindingElement$2(state);
6121
5711
  if (state.events)
6122
- state.events.exit?.("NestedMatchingElementList", state, result, eventData);
5712
+ state.events.exit?.("BindingElement", state, result, eventData);
6123
5713
  return result;
6124
5714
  }
6125
5715
  }
6126
- var MatchingElement$0 = MatchingRestElement;
6127
- var MatchingElement$1 = $TS($S($E(_), BindingIdentifier, $E(_), Colon, $E(_), $C(BindingIdentifier, MatchingPattern)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
5716
+ var BindingRestElement$0 = $TS($S($E(_), DotDotDot, $C(BindingIdentifier, BindingPattern, EmptyBindingPattern)), function($skip, $loc, $0, $1, $2, $3) {
6128
5717
  var ws = $1;
6129
- var name = $2;
6130
- var match = $6;
6131
- let blockPrefix;
6132
- switch (match.type) {
6133
- case "ArrayMatchingPattern":
6134
- case "ObjectMatchingPattern":
6135
- blockPrefix = [match, " = ", name];
6136
- break;
6137
- default:
6138
- break;
6139
- }
5718
+ var dots = $2;
5719
+ var binding = $3;
6140
5720
  return {
6141
- names: name.names,
6142
- children: [ws, {
6143
- type: "BindingMatchElement",
6144
- name,
6145
- match,
6146
- children: [name],
6147
- blockPrefix
6148
- }]
5721
+ ...binding,
5722
+ children: [...ws || [], dots, ...binding.children],
5723
+ rest: true
6149
5724
  };
6150
5725
  });
6151
- var MatchingElement$2 = $TS($S($E(_), $C(BindingIdentifier, MatchingPattern)), function($skip, $loc, $0, $1, $2) {
5726
+ var BindingRestElement$1 = $TS($S($E(_), $C(BindingIdentifier, BindingPattern), DotDotDot), function($skip, $loc, $0, $1, $2, $3) {
6152
5727
  var ws = $1;
6153
5728
  var binding = $2;
5729
+ var dots = $3;
6154
5730
  return {
6155
- names: binding.names,
6156
- children: [ws, binding]
6157
- };
6158
- });
6159
- var MatchingElement$3 = $TV($Y($S($E(_), $EXPECT($L21, fail, 'MatchingElement ","'))), function($skip, $loc, $0, $1) {
6160
- return {
6161
- children: [{
6162
- type: "ElisionElement",
6163
- children: [""]
6164
- }],
6165
- names: []
5731
+ ...binding,
5732
+ children: [...ws || [], dots, ...binding.children],
5733
+ rest: true
6166
5734
  };
6167
5735
  });
6168
- function MatchingElement(state) {
5736
+ function BindingRestElement(state) {
6169
5737
  let eventData;
6170
5738
  if (state.events) {
6171
- const result = state.events.enter?.("MatchingElement", state);
5739
+ const result = state.events.enter?.("BindingRestElement", state);
6172
5740
  if (result) {
6173
5741
  if (result.cache)
6174
5742
  return result.cache;
@@ -6176,22 +5744,34 @@ ${input.slice(result.pos)}
6176
5744
  }
6177
5745
  }
6178
5746
  if (state.tokenize) {
6179
- const result = $TOKEN("MatchingElement", state, MatchingElement$0(state) || MatchingElement$1(state) || MatchingElement$2(state) || MatchingElement$3(state));
5747
+ const result = $TOKEN("BindingRestElement", state, BindingRestElement$0(state) || BindingRestElement$1(state));
6180
5748
  if (state.events)
6181
- state.events.exit?.("MatchingElement", state, result, eventData);
5749
+ state.events.exit?.("BindingRestElement", state, result, eventData);
6182
5750
  return result;
6183
5751
  } else {
6184
- const result = MatchingElement$0(state) || MatchingElement$1(state) || MatchingElement$2(state) || MatchingElement$3(state);
5752
+ const result = BindingRestElement$0(state) || BindingRestElement$1(state);
6185
5753
  if (state.events)
6186
- state.events.exit?.("MatchingElement", state, result, eventData);
5754
+ state.events.exit?.("BindingRestElement", state, result, eventData);
6187
5755
  return result;
6188
5756
  }
6189
5757
  }
6190
- var MatchingRestElement$0 = BindingRestElement;
6191
- function MatchingRestElement(state) {
5758
+ var EmptyBindingPattern$0 = $TV($EXPECT($L0, fail, 'EmptyBindingPattern ""'), function($skip, $loc, $0, $1) {
5759
+ const ref = {
5760
+ type: "Ref",
5761
+ base: "ref",
5762
+ id: "ref"
5763
+ };
5764
+ return {
5765
+ type: "EmptyBinding",
5766
+ children: [ref],
5767
+ names: [],
5768
+ ref
5769
+ };
5770
+ });
5771
+ function EmptyBindingPattern(state) {
6192
5772
  let eventData;
6193
5773
  if (state.events) {
6194
- const result = state.events.enter?.("MatchingRestElement", state);
5774
+ const result = state.events.enter?.("EmptyBindingPattern", state);
6195
5775
  if (result) {
6196
5776
  if (result.cache)
6197
5777
  return result.cache;
@@ -6199,14 +5779,14 @@ ${input.slice(result.pos)}
6199
5779
  }
6200
5780
  }
6201
5781
  if (state.tokenize) {
6202
- const result = $TOKEN("MatchingRestElement", state, MatchingRestElement$0(state));
5782
+ const result = $TOKEN("EmptyBindingPattern", state, EmptyBindingPattern$0(state));
6203
5783
  if (state.events)
6204
- state.events.exit?.("MatchingRestElement", state, result, eventData);
5784
+ state.events.exit?.("EmptyBindingPattern", state, result, eventData);
6205
5785
  return result;
6206
5786
  } else {
6207
- const result = MatchingRestElement$0(state);
5787
+ const result = EmptyBindingPattern$0(state);
6208
5788
  if (state.events)
6209
- state.events.exit?.("MatchingRestElement", state, result, eventData);
5789
+ state.events.exit?.("EmptyBindingPattern", state, result, eventData);
6210
5790
  return result;
6211
5791
  }
6212
5792
  }
@@ -7911,16 +7491,16 @@ ${input.slice(result.pos)}
7911
7491
  var open = $1;
7912
7492
  if (!$3)
7913
7493
  return $skip;
7914
- const [content, ...close] = $3;
7915
- if (content) {
7916
- const children = [open, ...content, close];
7494
+ const [properties, ...close] = $3;
7495
+ if (properties) {
7496
+ const children = [open, ...properties, close];
7917
7497
  return {
7918
7498
  type: "ObjectExpression",
7919
- content,
7920
7499
  children,
7921
7500
  names: children.flatMap((c) => {
7922
7501
  return c.names || [];
7923
- })
7502
+ }),
7503
+ properties
7924
7504
  };
7925
7505
  }
7926
7506
  return {
@@ -11027,7 +10607,7 @@ ${input.slice(result.pos)}
11027
10607
  return result;
11028
10608
  }
11029
10609
  }
11030
- var CaseClause$0 = $TS($S(MatchingPattern, $C(ThenClause, NestedBlockStatements, EmptyBareBlock)), function($skip, $loc, $0, $1, $2) {
10610
+ var CaseClause$0 = $TS($S(BindingPattern, $C(ThenClause, NestedBlockStatements, EmptyBareBlock)), function($skip, $loc, $0, $1, $2) {
11031
10611
  var pattern = $1;
11032
10612
  var block = $2;
11033
10613
  return {
@@ -11037,10 +10617,23 @@ ${input.slice(result.pos)}
11037
10617
  pattern
11038
10618
  };
11039
10619
  });
11040
- var CaseClause$1 = $T($S(Case, CaseExpressionList, $C(NestedBlockStatements, EmptyBareBlock)), function(value) {
10620
+ var CaseClause$1 = $TS($S(SingleLineBinaryOpRHS, $C(ThenClause, NestedBlockStatements, EmptyBareBlock)), function($skip, $loc, $0, $1, $2) {
10621
+ var pattern = $1;
10622
+ var block = $2;
10623
+ return {
10624
+ type: "PatternClause",
10625
+ children: $0,
10626
+ block,
10627
+ pattern: {
10628
+ type: "ConditionFragment",
10629
+ children: pattern
10630
+ }
10631
+ };
10632
+ });
10633
+ var CaseClause$2 = $T($S(Case, CaseExpressionList, $C(NestedBlockStatements, EmptyBareBlock)), function(value) {
11041
10634
  return { "type": "CaseClause", "children": value };
11042
10635
  });
11043
- var CaseClause$2 = $TS($S(When, CaseExpressionList, InsertOpenBrace, $C(ThenClause, NestedBlockStatements, EmptyBareBlock), InsertBreak, InsertNewline, InsertIndent, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8) {
10636
+ var CaseClause$3 = $TS($S(When, CaseExpressionList, InsertOpenBrace, $C(ThenClause, NestedBlockStatements, EmptyBareBlock), InsertBreak, InsertNewline, InsertIndent, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8) {
11044
10637
  var cases = $2;
11045
10638
  var block = $4;
11046
10639
  var b = $5;
@@ -11052,7 +10645,7 @@ ${input.slice(result.pos)}
11052
10645
  children: $0
11053
10646
  };
11054
10647
  });
11055
- var CaseClause$3 = $TS($S(Default, ImpliedColon, $C(NestedBlockStatements, EmptyBareBlock)), function($skip, $loc, $0, $1, $2, $3) {
10648
+ var CaseClause$4 = $TS($S(Default, ImpliedColon, $C(NestedBlockStatements, EmptyBareBlock)), function($skip, $loc, $0, $1, $2, $3) {
11056
10649
  var block = $3;
11057
10650
  return {
11058
10651
  type: "DefaultClause",
@@ -11060,7 +10653,7 @@ ${input.slice(result.pos)}
11060
10653
  children: $0
11061
10654
  };
11062
10655
  });
11063
- var CaseClause$4 = $TS($S(Else, ImpliedColon, $C(ThenClause, BracedBlock, EmptyBlock)), function($skip, $loc, $0, $1, $2, $3) {
10656
+ var CaseClause$5 = $TS($S(Else, ImpliedColon, $C(ThenClause, BracedBlock, EmptyBlock)), function($skip, $loc, $0, $1, $2, $3) {
11064
10657
  var block = $3;
11065
10658
  $1.token = "default";
11066
10659
  return {
@@ -11080,12 +10673,12 @@ ${input.slice(result.pos)}
11080
10673
  }
11081
10674
  }
11082
10675
  if (state.tokenize) {
11083
- const result = $TOKEN("CaseClause", state, CaseClause$0(state) || CaseClause$1(state) || CaseClause$2(state) || CaseClause$3(state) || CaseClause$4(state));
10676
+ const result = $TOKEN("CaseClause", state, CaseClause$0(state) || CaseClause$1(state) || CaseClause$2(state) || CaseClause$3(state) || CaseClause$4(state) || CaseClause$5(state));
11084
10677
  if (state.events)
11085
10678
  state.events.exit?.("CaseClause", state, result, eventData);
11086
10679
  return result;
11087
10680
  } else {
11088
- const result = CaseClause$0(state) || CaseClause$1(state) || CaseClause$2(state) || CaseClause$3(state) || CaseClause$4(state);
10681
+ const result = CaseClause$0(state) || CaseClause$1(state) || CaseClause$2(state) || CaseClause$3(state) || CaseClause$4(state) || CaseClause$5(state);
11089
10682
  if (state.events)
11090
10683
  state.events.exit?.("CaseClause", state, result, eventData);
11091
10684
  return result;
@@ -11439,8 +11032,8 @@ ${input.slice(result.pos)}
11439
11032
  return result;
11440
11033
  }
11441
11034
  }
11442
- var ExpressionWithIndentedApplicationForbidden$0 = $TS($S(ForbidIndentedApplication, $E(ExtendedExpression), RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3) {
11443
- var exp = $2;
11035
+ var ExpressionWithIndentedApplicationForbidden$0 = $TS($S(ForbidIndentedApplication, ForbidNewlineBinaryOp, $E(ExtendedExpression), RestoreNewlineBinaryOp, RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
11036
+ var exp = $3;
11444
11037
  if (exp)
11445
11038
  return exp;
11446
11039
  return $skip;
@@ -11882,7 +11475,111 @@ ${input.slice(result.pos)}
11882
11475
  return result;
11883
11476
  }
11884
11477
  }
11885
- var AllowAll$0 = $S(AllowTrailingMemberProperty, AllowIndentedApplication, AllowMultiLineImplicitObjectLiteral, AllowClassImplicitCall);
11478
+ var AllowNewlineBinaryOp$0 = $TV($EXPECT($L0, fail, 'AllowNewlineBinaryOp ""'), function($skip, $loc, $0, $1) {
11479
+ module.forbidNewlineBinaryOp.push(false);
11480
+ });
11481
+ function AllowNewlineBinaryOp(state) {
11482
+ let eventData;
11483
+ if (state.events) {
11484
+ const result = state.events.enter?.("AllowNewlineBinaryOp", state);
11485
+ if (result) {
11486
+ if (result.cache)
11487
+ return result.cache;
11488
+ eventData = result.data;
11489
+ }
11490
+ }
11491
+ if (state.tokenize) {
11492
+ const result = $TOKEN("AllowNewlineBinaryOp", state, AllowNewlineBinaryOp$0(state));
11493
+ if (state.events)
11494
+ state.events.exit?.("AllowNewlineBinaryOp", state, result, eventData);
11495
+ return result;
11496
+ } else {
11497
+ const result = AllowNewlineBinaryOp$0(state);
11498
+ if (state.events)
11499
+ state.events.exit?.("AllowNewlineBinaryOp", state, result, eventData);
11500
+ return result;
11501
+ }
11502
+ }
11503
+ var ForbidNewlineBinaryOp$0 = $TV($EXPECT($L0, fail, 'ForbidNewlineBinaryOp ""'), function($skip, $loc, $0, $1) {
11504
+ module.forbidNewlineBinaryOp.push(true);
11505
+ });
11506
+ function ForbidNewlineBinaryOp(state) {
11507
+ let eventData;
11508
+ if (state.events) {
11509
+ const result = state.events.enter?.("ForbidNewlineBinaryOp", state);
11510
+ if (result) {
11511
+ if (result.cache)
11512
+ return result.cache;
11513
+ eventData = result.data;
11514
+ }
11515
+ }
11516
+ if (state.tokenize) {
11517
+ const result = $TOKEN("ForbidNewlineBinaryOp", state, ForbidNewlineBinaryOp$0(state));
11518
+ if (state.events)
11519
+ state.events.exit?.("ForbidNewlineBinaryOp", state, result, eventData);
11520
+ return result;
11521
+ } else {
11522
+ const result = ForbidNewlineBinaryOp$0(state);
11523
+ if (state.events)
11524
+ state.events.exit?.("ForbidNewlineBinaryOp", state, result, eventData);
11525
+ return result;
11526
+ }
11527
+ }
11528
+ var RestoreNewlineBinaryOp$0 = $TV($EXPECT($L0, fail, 'RestoreNewlineBinaryOp ""'), function($skip, $loc, $0, $1) {
11529
+ module.forbidNewlineBinaryOp.pop();
11530
+ });
11531
+ function RestoreNewlineBinaryOp(state) {
11532
+ let eventData;
11533
+ if (state.events) {
11534
+ const result = state.events.enter?.("RestoreNewlineBinaryOp", state);
11535
+ if (result) {
11536
+ if (result.cache)
11537
+ return result.cache;
11538
+ eventData = result.data;
11539
+ }
11540
+ }
11541
+ if (state.tokenize) {
11542
+ const result = $TOKEN("RestoreNewlineBinaryOp", state, RestoreNewlineBinaryOp$0(state));
11543
+ if (state.events)
11544
+ state.events.exit?.("RestoreNewlineBinaryOp", state, result, eventData);
11545
+ return result;
11546
+ } else {
11547
+ const result = RestoreNewlineBinaryOp$0(state);
11548
+ if (state.events)
11549
+ state.events.exit?.("RestoreNewlineBinaryOp", state, result, eventData);
11550
+ return result;
11551
+ }
11552
+ }
11553
+ var NewlineBinaryOpAllowed$0 = $TV($EXPECT($L0, fail, 'NewlineBinaryOpAllowed ""'), function($skip, $loc, $0, $1) {
11554
+ if (module.config.verbose) {
11555
+ console.log("forbidNewlineBinaryOp:", module.forbidNewlineBinaryOp);
11556
+ }
11557
+ if (module.newlineBinaryOpForbidden)
11558
+ return $skip;
11559
+ });
11560
+ function NewlineBinaryOpAllowed(state) {
11561
+ let eventData;
11562
+ if (state.events) {
11563
+ const result = state.events.enter?.("NewlineBinaryOpAllowed", state);
11564
+ if (result) {
11565
+ if (result.cache)
11566
+ return result.cache;
11567
+ eventData = result.data;
11568
+ }
11569
+ }
11570
+ if (state.tokenize) {
11571
+ const result = $TOKEN("NewlineBinaryOpAllowed", state, NewlineBinaryOpAllowed$0(state));
11572
+ if (state.events)
11573
+ state.events.exit?.("NewlineBinaryOpAllowed", state, result, eventData);
11574
+ return result;
11575
+ } else {
11576
+ const result = NewlineBinaryOpAllowed$0(state);
11577
+ if (state.events)
11578
+ state.events.exit?.("NewlineBinaryOpAllowed", state, result, eventData);
11579
+ return result;
11580
+ }
11581
+ }
11582
+ var AllowAll$0 = $S(AllowTrailingMemberProperty, AllowIndentedApplication, AllowMultiLineImplicitObjectLiteral, AllowClassImplicitCall, AllowNewlineBinaryOp);
11886
11583
  function AllowAll(state) {
11887
11584
  let eventData;
11888
11585
  if (state.events) {
@@ -11905,7 +11602,7 @@ ${input.slice(result.pos)}
11905
11602
  return result;
11906
11603
  }
11907
11604
  }
11908
- var RestoreAll$0 = $S(RestoreTrailingMemberProperty, RestoreIndentedApplication, RestoreMultiLineImplicitObjectLiteral, RestoreClassImplicitCall);
11605
+ var RestoreAll$0 = $S(RestoreTrailingMemberProperty, RestoreIndentedApplication, RestoreMultiLineImplicitObjectLiteral, RestoreClassImplicitCall, RestoreNewlineBinaryOp);
11909
11606
  function RestoreAll(state) {
11910
11607
  let eventData;
11911
11608
  if (state.events) {
@@ -18573,9 +18270,9 @@ ${input.slice(result.pos)}
18573
18270
  }
18574
18271
  }
18575
18272
  var NestedInterfaceProperties$0 = $TS($S(PushIndent, $Q(NestedInterfaceProperty), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
18576
- var props2 = $2;
18577
- if (props2.length)
18578
- return props2;
18273
+ var props = $2;
18274
+ if (props.length)
18275
+ return props;
18579
18276
  return $skip;
18580
18277
  });
18581
18278
  function NestedInterfaceProperties(state) {
@@ -18956,23 +18653,23 @@ ${input.slice(result.pos)}
18956
18653
  }
18957
18654
  }
18958
18655
  var EnumBlock$0 = $TS($S(__, OpenBrace, NestedEnumProperties, __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
18959
- var props2 = $3;
18656
+ var props = $3;
18960
18657
  return {
18961
- properties: props2.properties,
18658
+ properties: props.properties,
18962
18659
  children: $0
18963
18660
  };
18964
18661
  });
18965
18662
  var EnumBlock$1 = $TS($S(__, OpenBrace, $Q($S(__, EnumProperty)), __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
18966
- var props2 = $3;
18663
+ var props = $3;
18967
18664
  return {
18968
- properties: props2.map((p) => p[1]),
18665
+ properties: props.map((p) => p[1]),
18969
18666
  children: $0
18970
18667
  };
18971
18668
  });
18972
18669
  var EnumBlock$2 = $TS($S(InsertOpenBrace, NestedEnumProperties, InsertNewline, InsertIndent, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
18973
- var props2 = $2;
18670
+ var props = $2;
18974
18671
  return {
18975
- properties: props2.properties,
18672
+ properties: props.properties,
18976
18673
  children: $0
18977
18674
  };
18978
18675
  });
@@ -18999,11 +18696,11 @@ ${input.slice(result.pos)}
18999
18696
  }
19000
18697
  }
19001
18698
  var NestedEnumProperties$0 = $TS($S(PushIndent, $Q(NestedEnumProperty), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
19002
- var props2 = $2;
19003
- if (!props2.length)
18699
+ var props = $2;
18700
+ if (!props.length)
19004
18701
  return $skip;
19005
18702
  return {
19006
- properties: props2.map((p) => p.property),
18703
+ properties: props.map((p) => p.property),
19007
18704
  children: $0
19008
18705
  };
19009
18706
  });
@@ -21175,6 +20872,7 @@ ${input.slice(result.pos)}
21175
20872
  module.forbidIndentedApplication = [false];
21176
20873
  module.forbidTrailingMemberProperty = [false];
21177
20874
  module.forbidMultiLineImplicitObjectLiteral = [false];
20875
+ module.forbidNewlineBinaryOp = [false];
21178
20876
  module.JSXTagStack = [];
21179
20877
  module.operators = /* @__PURE__ */ new Set();
21180
20878
  if (!module._init) {
@@ -21210,6 +20908,12 @@ ${input.slice(result.pos)}
21210
20908
  return s[s.length - 1];
21211
20909
  }
21212
20910
  },
20911
+ newlineBinaryOpForbidden: {
20912
+ get() {
20913
+ const { forbidNewlineBinaryOp: s } = module;
20914
+ return s[s.length - 1];
20915
+ }
20916
+ },
21213
20917
  currentJSXTag: {
21214
20918
  get() {
21215
20919
  const { JSXTagStack: s } = module;
@@ -21484,7 +21188,7 @@ ${input.slice(result.pos)}
21484
21188
  if (glob?.type === "PropertyGlob") {
21485
21189
  const prefix = children.slice(0, i).concat(glob.dot);
21486
21190
  const parts = [];
21487
- for (const part of glob.object.content) {
21191
+ for (const part of glob.object.properties) {
21488
21192
  if (part.type === "MethodDefinition") {
21489
21193
  throw new Error("Glob pattern cannot have method definition");
21490
21194
  }
@@ -21525,12 +21229,12 @@ ${input.slice(result.pos)}
21525
21229
  }
21526
21230
  const object = {
21527
21231
  type: "ObjectExpression",
21528
- content: parts,
21529
21232
  children: [
21530
21233
  glob.object.children[0],
21531
21234
  ...parts,
21532
21235
  glob.object.children.at(-1)
21533
- ]
21236
+ ],
21237
+ properties: parts
21534
21238
  };
21535
21239
  if (i === children.length - 1)
21536
21240
  return object;
@@ -22140,11 +21844,11 @@ ${input.slice(result.pos)}
22140
21844
  length
22141
21845
  };
22142
21846
  };
22143
- module.reorderBindingRestProperty = function(props2) {
22144
- const names = props2.flatMap((p) => p.names);
21847
+ module.reorderBindingRestProperty = function(props) {
21848
+ const names = props.flatMap((p) => p.names);
22145
21849
  let restIndex = -1;
22146
21850
  let restCount = 0;
22147
- props2.forEach(({ type }, i) => {
21851
+ props.forEach(({ type }, i) => {
22148
21852
  if (type === "BindingRestProperty") {
22149
21853
  if (restIndex < 0)
22150
21854
  restIndex = i;
@@ -22153,19 +21857,19 @@ ${input.slice(result.pos)}
22153
21857
  });
22154
21858
  if (restCount === 0) {
22155
21859
  return {
22156
- children: props2,
21860
+ children: props,
22157
21861
  names
22158
21862
  };
22159
21863
  } else if (restCount === 1) {
22160
- let after = props2.slice(restIndex + 1);
22161
- let rest = props2[restIndex];
22162
- props2 = props2.slice(0, restIndex);
21864
+ let after = props.slice(restIndex + 1);
21865
+ let rest = props[restIndex];
21866
+ props = props.slice(0, restIndex);
22163
21867
  if (after.length) {
22164
21868
  const [restDelim] = rest.children.slice(-1), lastAfterProp = after[after.length - 1], lastAfterChildren = lastAfterProp.children, [lastDelim] = lastAfterChildren.slice(-1);
22165
21869
  rest = { ...rest, children: [...rest.children.slice(0, -1), lastDelim] };
22166
21870
  after = [...after.slice(0, -1), { ...lastAfterProp, children: [...lastAfterChildren.slice(0, -1), restDelim] }];
22167
21871
  }
22168
- const children = [...props2, ...after, rest];
21872
+ const children = [...props, ...after, rest];
22169
21873
  return {
22170
21874
  children,
22171
21875
  names
@@ -22175,7 +21879,7 @@ ${input.slice(result.pos)}
22175
21879
  children: [{
22176
21880
  type: "Error",
22177
21881
  message: "Multiple rest properties in object pattern"
22178
- }, props2]
21882
+ }, props]
22179
21883
  };
22180
21884
  };
22181
21885
  function addParentPointers(node, parent) {
@@ -22249,7 +21953,7 @@ ${input.slice(result.pos)}
22249
21953
  gatherRecursiveAll(statements, (n) => n.type === "AtBindingProperty").forEach((binding) => {
22250
21954
  const { ref } = binding;
22251
21955
  if (asThis) {
22252
- const atBinding = binding.children[0];
21956
+ const atBinding = binding.binding;
22253
21957
  atBinding.children.pop();
22254
21958
  atBinding.type = void 0;
22255
21959
  binding.children.unshift(ref.id, ": this.", ref.base);
@@ -22496,8 +22200,10 @@ ${input.slice(result.pos)}
22496
22200
  }
22497
22201
  };
22498
22202
  function getPatternConditions(pattern, ref, conditions) {
22203
+ if (pattern.rest)
22204
+ return;
22499
22205
  switch (pattern.type) {
22500
- case "ArrayMatchingPattern": {
22206
+ case "ArrayBindingPattern": {
22501
22207
  const { elements, length } = pattern, hasRest = elements.some((e) => e.rest), comparator = hasRest ? " >= " : " === ", l = [comparator, (length - hasRest).toString()];
22502
22208
  conditions.push(
22503
22209
  ["Array.isArray(", ref, ")"],
@@ -22505,46 +22211,28 @@ ${input.slice(result.pos)}
22505
22211
  );
22506
22212
  elements.forEach(({ children: [, e] }, i) => {
22507
22213
  const subRef = [ref, "[", i.toString(), "]"];
22508
- switch (e.type) {
22509
- case "ArrayMatchingPattern":
22510
- case "ObjectMatchingPattern":
22511
- case "RegularExpressionLiteral":
22512
- getPatternConditions(e, subRef, conditions);
22513
- break;
22514
- case "BindingMatchElement":
22515
- getPatternConditions(e.match, subRef, conditions);
22516
- break;
22517
- }
22214
+ getPatternConditions(e, subRef, conditions);
22518
22215
  });
22519
22216
  const postRest = pattern.children.find((c) => c?.blockPrefix);
22520
22217
  if (postRest) {
22521
22218
  const postElements = postRest.blockPrefix.children[1], { length: postLength } = postElements;
22522
22219
  postElements.forEach(({ children: [, e] }, i) => {
22523
22220
  const subRef = [ref, "[", ref, ".length - ", (postLength + i).toString(), "]"];
22524
- switch (e.type) {
22525
- case "ArrayMatchingPattern":
22526
- case "ObjectMatchingPattern":
22527
- case "RegularExpressionLiteral":
22528
- case "Literal":
22529
- getPatternConditions(e, subRef, conditions);
22530
- break;
22531
- case "BindingMatchElement":
22532
- getPatternConditions(e.match, subRef, conditions);
22533
- break;
22534
- }
22221
+ getPatternConditions(e, subRef, conditions);
22535
22222
  });
22536
22223
  }
22537
22224
  break;
22538
22225
  }
22539
- case "ObjectMatchingPattern": {
22226
+ case "ObjectBindingPattern": {
22540
22227
  conditions.push(
22541
22228
  ["typeof ", ref, " === 'object'"],
22542
22229
  [ref, " != null"]
22543
22230
  );
22544
22231
  pattern.properties.forEach((p) => {
22545
22232
  switch (p.type) {
22546
- case "BindingMatchProperty": {
22547
- const { name, match } = p;
22233
+ case "PinProperty":
22234
+ case "BindingProperty": {
22235
+ const { name, value } = p;
22548
22236
  let subRef;
22549
22237
  switch (name.type) {
22550
22238
  case "ComputedPropertyName":
@@ -22561,16 +22249,20 @@ ${input.slice(result.pos)}
22561
22249
  conditions.push(["'", name, "' in ", ref]);
22562
22250
  subRef = [ref, ".", name];
22563
22251
  }
22564
- getPatternConditions(p.match, subRef, conditions);
22252
+ if (value) {
22253
+ getPatternConditions(value, subRef, conditions);
22254
+ }
22565
22255
  break;
22566
22256
  }
22567
- case "BindingProperty":
22568
- conditions.push(["'", p.identifier, "' in ", ref]);
22569
- break;
22570
22257
  }
22571
22258
  });
22572
22259
  break;
22573
22260
  }
22261
+ case "ConditionFragment":
22262
+ conditions.push(
22263
+ [ref, " ", pattern.children]
22264
+ );
22265
+ break;
22574
22266
  case "RegularExpressionLiteral": {
22575
22267
  conditions.push(
22576
22268
  ["typeof ", ref, " === 'string'"],
@@ -22578,13 +22270,22 @@ ${input.slice(result.pos)}
22578
22270
  );
22579
22271
  break;
22580
22272
  }
22581
- default: {
22273
+ case "PinPattern":
22274
+ conditions.push([
22275
+ ref,
22276
+ " === ",
22277
+ pattern.identifier
22278
+ ]);
22279
+ break;
22280
+ case "Literal":
22582
22281
  conditions.push([
22583
22282
  ref,
22584
22283
  " === ",
22585
22284
  pattern
22586
22285
  ]);
22587
- }
22286
+ break;
22287
+ default:
22288
+ break;
22588
22289
  }
22589
22290
  }
22590
22291
  function elideMatchersFromArrayBindings(elements) {
@@ -22593,6 +22294,7 @@ ${input.slice(result.pos)}
22593
22294
  case "Literal":
22594
22295
  case "RegularExpressionLiteral":
22595
22296
  case "StringLiteral":
22297
+ case "PinPattern":
22596
22298
  return sep;
22597
22299
  default:
22598
22300
  return [ws, nonMatcherBindings(e), sep];
@@ -22602,27 +22304,19 @@ ${input.slice(result.pos)}
22602
22304
  function elideMatchersFromPropertyBindings(properties) {
22603
22305
  return properties.map((p) => {
22604
22306
  switch (p.type) {
22605
- case "BindingMatchProperty": {
22606
- const { children, name, match } = p;
22607
- const [ws, , , , , , sep] = children;
22608
- switch (match.type) {
22609
- case "ArrayMatchingPattern":
22610
- case "ObjectMatchingPattern":
22307
+ case "BindingProperty": {
22308
+ const { children, name, value } = p;
22309
+ const [ws] = children;
22310
+ const sep = children[children.length - 1];
22311
+ switch (value && value.type) {
22312
+ case "ArrayBindingPattern":
22313
+ case "ObjectBindingPattern":
22611
22314
  return {
22612
22315
  ...p,
22613
- children: [ws, name, ": ", nonMatcherBindings(match)]
22316
+ children: [ws, name, ": ", nonMatcherBindings(value)]
22614
22317
  };
22615
22318
  case "Identifier":
22616
- switch (name.type) {
22617
- case "ComputedPropertyName":
22618
- case "Literal":
22619
- case "StringLiteral":
22620
- case "NumericLiteral":
22621
- return {
22622
- ...p,
22623
- children: [ws, name, ": ", match, sep]
22624
- };
22625
- }
22319
+ return p;
22626
22320
  case "Literal":
22627
22321
  case "RegularExpressionLiteral":
22628
22322
  case "StringLiteral":
@@ -22633,7 +22327,7 @@ ${input.slice(result.pos)}
22633
22327
  };
22634
22328
  }
22635
22329
  }
22636
- case "BindingProperty":
22330
+ case "PinProperty":
22637
22331
  case "BindingRestProperty":
22638
22332
  default:
22639
22333
  return p;
@@ -22642,7 +22336,7 @@ ${input.slice(result.pos)}
22642
22336
  }
22643
22337
  function nonMatcherBindings(pattern) {
22644
22338
  switch (pattern.type) {
22645
- case "ArrayMatchingPattern":
22339
+ case "ArrayBindingPattern":
22646
22340
  return ["[", elideMatchersFromArrayBindings(pattern.elements), "]"];
22647
22341
  case "PostRestBindingElements": {
22648
22342
  const els = elideMatchersFromArrayBindings(pattern.children[1]);
@@ -22655,19 +22349,19 @@ ${input.slice(result.pos)}
22655
22349
  ]
22656
22350
  };
22657
22351
  }
22658
- case "ObjectMatchingPattern":
22352
+ case "ObjectBindingPattern":
22659
22353
  return ["{", elideMatchersFromPropertyBindings(pattern.properties), "}"];
22660
22354
  default:
22661
22355
  return pattern;
22662
22356
  }
22663
22357
  }
22664
22358
  function aggregateDuplicateBindings(bindings) {
22665
- const props2 = gatherRecursiveAll(bindings, (n) => n.type === "BindingMatchProperty");
22359
+ const props = gatherRecursiveAll(bindings, (n) => n.type === "BindingProperty");
22666
22360
  const declarations = [];
22667
22361
  const propsGroupedByName = /* @__PURE__ */ new Map();
22668
- for (const p of props2) {
22669
- const { name } = p;
22670
- const key = name.name;
22362
+ for (const p of props) {
22363
+ const { name, value } = p;
22364
+ const key = value?.name || name.name;
22671
22365
  if (propsGroupedByName.has(key)) {
22672
22366
  propsGroupedByName.get(key).push(p);
22673
22367
  } else {
@@ -22755,10 +22449,10 @@ ${input.slice(result.pos)}
22755
22449
  };
22756
22450
  const prefix = [];
22757
22451
  switch (pattern.type) {
22758
- case "ArrayMatchingPattern":
22452
+ case "ArrayBindingPattern":
22759
22453
  if (pattern.length === 0)
22760
22454
  break;
22761
- case "ObjectMatchingPattern": {
22455
+ case "ObjectBindingPattern": {
22762
22456
  if (pattern.properties?.length === 0)
22763
22457
  break;
22764
22458
  let [splices, thisAssignments] = gatherBindingCode(pattern);
@@ -23927,7 +23621,7 @@ var parse;
23927
23621
  var uncacheable;
23928
23622
  ({ parse } = import_parser.default);
23929
23623
  ({ SourceMap: SourceMap2 } = util_exports);
23930
- uncacheable = /* @__PURE__ */ new Set(["ActualAssignment", "AllowAll", "AllowClassImplicitCall", "AllowIndentedApplication", "AllowMultiLineImplicitObjectLiteral", "AllowTrailingMemberProperty", "AllowedTrailingMemberExpressions", "ApplicationStart", "Arguments", "ArgumentsWithTrailingMemberExpressions", "ArrowFunction", "ArrowFunctionTail", "AssignmentExpression", "AssignmentExpressionTail", "BinaryOpExpression", "BinaryOpRHS", "BracedBlock", "BracedObjectLiteralContent", "BracedOrEmptyBlock", "CallExpression", "CallExpressionRest", "ClassImplicitCallForbidden", "CoffeeCommentEnabled", "CommaDelimiter", "ConditionalExpression", "Declaration", "Debugger", "Dedented", "ElementListWithIndentedApplicationForbidden", "ElseClause", "Expression", "ExpressionStatement", "ExpressionWithIndentedApplicationForbidden", "ExtendedExpression", "FatArrowBody", "ForbidClassImplicitCall", "ForbidIndentedApplication", "ForbidMultiLineImplicitObjectLiteral", "ForbidTrailingMemberProperty", "FunctionDeclaration", "FunctionExpression", "HoistableDeclaration", "ImplicitArguments", "ImplicitInlineObjectPropertyDelimiter", "ImplicitNestedBlock", "IndentedApplicationAllowed", "IndentedFurther", "IndentedJSXChildExpression", "InlineObjectLiteral", "InsertIndent", "JSXChild", "JSXChildren", "JSXElement", "JSXFragment", "JSXImplicitFragment", "JSXMixedChildren", "JSXNested", "JSXNestedChildren", "JSXOptionalClosingElement", "JSXOptionalClosingFragment", "JSXTag", "LeftHandSideExpression", "MemberExpression", "MemberExpressionRest", "Nested", "NestedBindingElement", "NestedBindingElements", "NestedBlockExpression", "NestedBlockExpression", "NestedBlockStatement", "NestedBlockStatements", "NestedClassSignatureElement", "NestedClassSignatureElements", "NestedDeclareElement", "NestedDeclareElements", "NestedElement", "NestedElementList", "NestedImplicitObjectLiteral", "NestedImplicitPropertyDefinition", "NestedImplicitPropertyDefinitions", "NestedInterfaceProperty", "NestedJSXChildExpression", "NestedModuleItem", "NestedModuleItems", "NestedNonAssignmentExtendedExpression", "NestedObject", "NestedPropertyDefinitions", "NonSingleBracedBlock", "NotDedented", "ObjectLiteral", "PopIndent", "PopJSXStack", "PostfixedExpression", "PostfixedStatement", "PrimaryExpression", "PushIndent", "PushJSXOpeningElement", "PushJSXOpeningFragment", "RestoreAll", "RestoreClassImplicitCall", "RestoreMultiLineImplicitObjectLiteral", "RestoreIndentedApplication", "RestoreTrailingMemberProperty", "RHS", "Samedent", "ShortCircuitExpression", "SingleLineAssignmentExpression", "SingleLineComment", "SingleLineStatements", "SnugNamedProperty", "Statement", "StatementListItem", "SuffixedExpression", "SuffixedStatement", "ThinArrowFunction", "TrackIndented", "TrailingMemberExpressions", "TrailingMemberPropertyAllowed", "TypedJSXElement", "TypedJSXFragment", "UnaryExpression", "UpdateExpression"]);
23624
+ uncacheable = /* @__PURE__ */ new Set(["ActualAssignment", "AllowAll", "AllowClassImplicitCall", "AllowIndentedApplication", "AllowMultiLineImplicitObjectLiteral", "AllowNewlineBinaryOp", "AllowTrailingMemberProperty", "AllowedTrailingMemberExpressions", "ApplicationStart", "Arguments", "ArgumentsWithTrailingMemberExpressions", "ArrowFunction", "ArrowFunctionTail", "AssignmentExpression", "AssignmentExpressionTail", "BinaryOpExpression", "BinaryOpRHS", "BracedBlock", "BracedObjectLiteralContent", "BracedOrEmptyBlock", "CallExpression", "CallExpressionRest", "ClassImplicitCallForbidden", "CoffeeCommentEnabled", "CommaDelimiter", "ConditionalExpression", "Declaration", "Debugger", "Dedented", "ElementListWithIndentedApplicationForbidden", "ElseClause", "Expression", "ExpressionStatement", "ExpressionWithIndentedApplicationForbidden", "ExtendedExpression", "FatArrowBody", "ForbidClassImplicitCall", "ForbidIndentedApplication", "ForbidMultiLineImplicitObjectLiteral", "ForbidNewlineBinaryOp", "ForbidTrailingMemberProperty", "FunctionDeclaration", "FunctionExpression", "HoistableDeclaration", "ImplicitArguments", "ImplicitInlineObjectPropertyDelimiter", "ImplicitNestedBlock", "IndentedApplicationAllowed", "IndentedFurther", "IndentedJSXChildExpression", "InlineObjectLiteral", "InsertIndent", "JSXChild", "JSXChildren", "JSXElement", "JSXFragment", "JSXImplicitFragment", "JSXMixedChildren", "JSXNested", "JSXNestedChildren", "JSXOptionalClosingElement", "JSXOptionalClosingFragment", "JSXTag", "LeftHandSideExpression", "MemberExpression", "MemberExpressionRest", "Nested", "NestedBindingElement", "NestedBindingElements", "NestedBlockExpression", "NestedBlockExpression", "NestedBlockStatement", "NestedBlockStatements", "NestedClassSignatureElement", "NestedClassSignatureElements", "NestedDeclareElement", "NestedDeclareElements", "NestedElement", "NestedElementList", "NestedImplicitObjectLiteral", "NestedImplicitPropertyDefinition", "NestedImplicitPropertyDefinitions", "NestedInterfaceProperty", "NestedJSXChildExpression", "NestedModuleItem", "NestedModuleItems", "NestedNonAssignmentExtendedExpression", "NestedObject", "NestedPropertyDefinitions", "NewlineBinaryOpAllowed", "NonSingleBracedBlock", "NotDedented", "ObjectLiteral", "PopIndent", "PopJSXStack", "PostfixedExpression", "PostfixedStatement", "PrimaryExpression", "PushIndent", "PushJSXOpeningElement", "PushJSXOpeningFragment", "RestoreAll", "RestoreClassImplicitCall", "RestoreMultiLineImplicitObjectLiteral", "RestoreIndentedApplication", "RestoreTrailingMemberProperty", "RestoreNewlineBinaryOp", "RHS", "Samedent", "ShortCircuitExpression", "SingleLineAssignmentExpression", "SingleLineBinaryOpRHS", "SingleLineComment", "SingleLineStatements", "SnugNamedProperty", "Statement", "StatementListItem", "SuffixedExpression", "SuffixedStatement", "ThinArrowFunction", "TrackIndented", "TrailingMemberExpressions", "TrailingMemberPropertyAllowed", "TypedJSXElement", "TypedJSXFragment", "UnaryExpression", "UpdateExpression"]);
23931
23625
  var compile = function(src, options) {
23932
23626
  var ast, code, events, filename, ref, result, sm;
23933
23627
  if (!options) {