marko 6.0.86 → 6.0.87

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.
@@ -112,7 +112,7 @@ var attrs_default = {
112
112
  };
113
113
 
114
114
  // src/translator/core/await.ts
115
- var import_compiler35 = require("@marko/compiler");
115
+ var import_compiler36 = require("@marko/compiler");
116
116
  var import_babel_utils26 = require("@marko/compiler/babel-utils");
117
117
 
118
118
  // src/common/accessor.debug.ts
@@ -235,7 +235,7 @@ function isNullableExpr(expr) {
235
235
  }
236
236
 
237
237
  // src/translator/util/references.ts
238
- var import_compiler34 = require("@marko/compiler");
238
+ var import_compiler35 = require("@marko/compiler");
239
239
  var import_babel_utils25 = require("@marko/compiler/babel-utils");
240
240
 
241
241
  // src/html/serializer.ts
@@ -690,16 +690,9 @@ function getMarkoRoot(path5) {
690
690
  }
691
691
  function getExprRoot(path5) {
692
692
  let curPath = path5;
693
- let assignmentPath;
694
693
  while (!isMarko(curPath.parentPath)) {
695
- if (curPath.isAssignmentPattern()) {
696
- assignmentPath = curPath;
697
- }
698
694
  curPath = curPath.parentPath;
699
695
  }
700
- if (assignmentPath && curPath.parentPath.isMarkoTag() && (curPath.key === "var" || curPath.listKey === "params")) {
701
- return assignmentPath;
702
- }
703
696
  return curPath;
704
697
  }
705
698
  function getFnRoot(path5) {
@@ -1627,17 +1620,17 @@ function startSection(path5) {
1627
1620
  const extra = path5.node.extra ??= {};
1628
1621
  let section = extra.section;
1629
1622
  if (!section && (path5.type === "Program" || path5.get("body").length)) {
1623
+ const parentTag = path5.parentPath?.isMarkoTag() ? path5.parentPath : void 0;
1630
1624
  const parentSection = path5.parentPath ? getOrCreateSection(path5.parentPath) : void 0;
1631
- const sectionNamePath = path5.parentPath?.get(
1632
- "name"
1633
- );
1634
- const sectionName = path5.isProgram() ? "" : generateUid(sectionNamePath.toString() + "_content");
1625
+ const sectionName = parentTag ? generateUid(
1626
+ (isCoreTagName(parentTag, "define") && import_compiler7.types.isIdentifier(parentTag.node.var) ? parentTag.node.var.name : parentTag.get("name").toString()) + "_content"
1627
+ ) : "";
1635
1628
  const programExtra = path5.hub.file.path.node.extra ??= {};
1636
1629
  const sections = programExtra.sections ??= [];
1637
1630
  section = extra.section = {
1638
1631
  id: sections.length,
1639
1632
  name: sectionName,
1640
- loc: sectionNamePath?.node.loc || void 0,
1633
+ loc: parentTag?.node.name.loc || void 0,
1641
1634
  depth: parentSection ? parentSection.depth + 1 : 0,
1642
1635
  parent: parentSection,
1643
1636
  sectionAccessor: void 0,
@@ -2113,11 +2106,11 @@ function isEventOrChangeHandler(prop) {
2113
2106
  }
2114
2107
 
2115
2108
  // src/translator/util/known-tag.ts
2116
- var import_compiler33 = require("@marko/compiler");
2109
+ var import_compiler34 = require("@marko/compiler");
2117
2110
  var import_babel_utils24 = require("@marko/compiler/babel-utils");
2118
2111
 
2119
2112
  // src/translator/visitors/program/index.ts
2120
- var import_compiler25 = require("@marko/compiler");
2113
+ var import_compiler26 = require("@marko/compiler");
2121
2114
  var import_babel_utils17 = require("@marko/compiler/babel-utils");
2122
2115
  var import_path2 = __toESM(require("path"));
2123
2116
 
@@ -4659,6 +4652,285 @@ function getRegisteredFnExpression2(node) {
4659
4652
  }
4660
4653
  }
4661
4654
 
4655
+ // src/translator/visitors/program/pre-analyze.ts
4656
+ var import_compiler25 = require("@marko/compiler");
4657
+
4658
+ // src/translator/util/with-previous-location.ts
4659
+ function withPreviousLocation(newNode, originalNode) {
4660
+ newNode.start = originalNode.start;
4661
+ newNode.loc = originalNode.loc;
4662
+ newNode.end = originalNode.end;
4663
+ return newNode;
4664
+ }
4665
+
4666
+ // src/translator/visitors/program/pre-analyze.ts
4667
+ var TAG_NAME_IDENTIFIER_REG = /^[A-Z][a-zA-Z0-9_$]*$/;
4668
+ var BINDING_CHANGE_HANDLER = /* @__PURE__ */ new WeakMap();
4669
+ function preAnalyze(program) {
4670
+ const state = { crawl: false };
4671
+ normalizeBody(state, program.get("body"));
4672
+ if (state.crawl) {
4673
+ program.scope.crawl();
4674
+ }
4675
+ }
4676
+ function normalizeBody(state, body) {
4677
+ for (const child of body) {
4678
+ if (child.isMarkoTag()) {
4679
+ normalizeTag(state, child);
4680
+ }
4681
+ }
4682
+ }
4683
+ function normalizeTag(state, tag) {
4684
+ const { node } = tag;
4685
+ const { name: name2, attributes } = node;
4686
+ normalizeBody(state, tag.get("body").get("body"));
4687
+ if (node.var) {
4688
+ const insertions = getAssignmentInsertions(node.var);
4689
+ if (insertions) {
4690
+ state.crawl = true;
4691
+ tag.insertAfter(insertions);
4692
+ }
4693
+ }
4694
+ if (node.body.params.length) {
4695
+ let insertions;
4696
+ for (const param of node.body.params) {
4697
+ insertions = getAssignmentInsertions(param, insertions);
4698
+ }
4699
+ if (insertions) {
4700
+ state.crawl = true;
4701
+ node.body.body = [...insertions, ...node.body.body];
4702
+ }
4703
+ }
4704
+ if (name2.type === "StringLiteral") {
4705
+ const tagName = name2.value;
4706
+ if (tag.scope.getBinding(tagName) && TAG_NAME_IDENTIFIER_REG.test(tagName)) {
4707
+ state.crawl = true;
4708
+ node.name = withPreviousLocation(import_compiler25.types.identifier(tagName), name2);
4709
+ }
4710
+ }
4711
+ for (let i = 0; i < attributes.length; i++) {
4712
+ const attr = attributes[i];
4713
+ if (import_compiler25.types.isMarkoAttribute(attr) && attr.bound) {
4714
+ state.crawl = true;
4715
+ attr.bound = false;
4716
+ attributes.splice(++i, 0, getChangeHandler(tag, attr));
4717
+ }
4718
+ }
4719
+ }
4720
+ function getChangeHandler(tag, attr) {
4721
+ const attrName = attr.name;
4722
+ const changeAttrName = attrName + "Change";
4723
+ if (import_compiler25.types.isIdentifier(attr.value)) {
4724
+ const binding = tag.scope.getBinding(attr.value.name);
4725
+ if (!binding)
4726
+ return import_compiler25.types.markoAttribute(
4727
+ changeAttrName,
4728
+ buildChangeHandlerFunction(attr.value)
4729
+ );
4730
+ const existingChangedAttr = BINDING_CHANGE_HANDLER.get(binding.identifier);
4731
+ if (!existingChangedAttr) {
4732
+ const bindingIdentifierPath = binding.path.getOuterBindingIdentifierPaths()[binding.identifier.name];
4733
+ const changeAttrExpr = bindingIdentifierPath ? bindingIdentifierPath.parentPath === binding.path ? buildChangeHandlerFunction(attr.value) : bindingIdentifierPath.parentPath.isObjectProperty() ? getChangeHandlerFromObjectPattern(
4734
+ bindingIdentifierPath.parentPath
4735
+ ) : void 0 : void 0;
4736
+ if (!changeAttrExpr) {
4737
+ throw tag.hub.buildError(attr.value, "Unable to bind to value.");
4738
+ }
4739
+ const changeHandlerAttr = import_compiler25.types.markoAttribute(
4740
+ changeAttrName,
4741
+ changeAttrExpr
4742
+ );
4743
+ BINDING_CHANGE_HANDLER.set(binding.identifier, changeHandlerAttr);
4744
+ return changeHandlerAttr;
4745
+ }
4746
+ if (existingChangedAttr.type === "Identifier") {
4747
+ return import_compiler25.types.markoAttribute(
4748
+ changeAttrName,
4749
+ withPreviousLocation(
4750
+ import_compiler25.types.identifier(existingChangedAttr.name),
4751
+ attr.value
4752
+ )
4753
+ );
4754
+ }
4755
+ const markoRoot = isMarko(binding.path) ? binding.path : getMarkoRoot(binding.path);
4756
+ if (!(markoRoot?.isMarkoTag() || markoRoot?.isMarkoTagBody())) {
4757
+ throw tag.hub.buildError(attr.value, "Unable to bind to value.");
4758
+ }
4759
+ const changeHandlerId = generateUid(changeAttrName);
4760
+ const changeHandlerConst = import_compiler25.types.markoTag(
4761
+ import_compiler25.types.stringLiteral("const"),
4762
+ [import_compiler25.types.markoAttribute("value", existingChangedAttr.value, null, null, true)],
4763
+ import_compiler25.types.markoTagBody([]),
4764
+ null,
4765
+ import_compiler25.types.identifier(changeHandlerId)
4766
+ );
4767
+ BINDING_CHANGE_HANDLER.set(
4768
+ binding.identifier,
4769
+ existingChangedAttr.value = import_compiler25.types.identifier(changeHandlerId)
4770
+ );
4771
+ if (markoRoot.isMarkoTag()) {
4772
+ markoRoot.insertAfter(changeHandlerConst);
4773
+ } else {
4774
+ markoRoot.unshiftContainer("body", changeHandlerConst);
4775
+ }
4776
+ markoRoot.scope.crawl();
4777
+ return import_compiler25.types.markoAttribute(
4778
+ changeAttrName,
4779
+ withPreviousLocation(import_compiler25.types.identifier(changeHandlerId), attr.value)
4780
+ );
4781
+ } else if (import_compiler25.types.isMemberExpression(attr.value)) {
4782
+ const prop = attr.value.property;
4783
+ if (!import_compiler25.types.isPrivateName(attr.value.property)) {
4784
+ return import_compiler25.types.markoAttribute(
4785
+ changeAttrName,
4786
+ import_compiler25.types.memberExpression(
4787
+ import_compiler25.types.cloneNode(attr.value.object),
4788
+ prop.type === "Identifier" ? withPreviousLocation(import_compiler25.types.identifier(prop.name + "Change"), prop) : import_compiler25.types.binaryExpression(
4789
+ "+",
4790
+ import_compiler25.types.cloneNode(prop),
4791
+ import_compiler25.types.stringLiteral("Change")
4792
+ ),
4793
+ prop.type !== "Identifier"
4794
+ )
4795
+ );
4796
+ }
4797
+ }
4798
+ throw tag.hub.buildError(
4799
+ attr.value,
4800
+ "Attributes may only be bound to identifiers or member expressions"
4801
+ );
4802
+ }
4803
+ function buildChangeHandlerFunction(id) {
4804
+ const newId = "_new_" + id.name;
4805
+ return import_compiler25.types.arrowFunctionExpression(
4806
+ [withPreviousLocation(import_compiler25.types.identifier(newId), id)],
4807
+ import_compiler25.types.blockStatement([
4808
+ import_compiler25.types.expressionStatement(
4809
+ import_compiler25.types.assignmentExpression(
4810
+ "=",
4811
+ withPreviousLocation(import_compiler25.types.identifier(id.name), id),
4812
+ withPreviousLocation(import_compiler25.types.identifier(newId), id)
4813
+ )
4814
+ )
4815
+ ])
4816
+ );
4817
+ }
4818
+ function getChangeHandlerFromObjectPattern(parent) {
4819
+ let changeKey;
4820
+ const pattern = parent.parentPath;
4821
+ if (parent.node.computed) {
4822
+ changeKey = generateUidIdentifier("dynamicChange");
4823
+ pattern.pushContainer(
4824
+ "properties",
4825
+ import_compiler25.types.objectProperty(
4826
+ import_compiler25.types.binaryExpression(
4827
+ "+",
4828
+ parent.get("key").node,
4829
+ import_compiler25.types.stringLiteral("Change")
4830
+ ),
4831
+ changeKey,
4832
+ true
4833
+ )
4834
+ );
4835
+ } else {
4836
+ const key = parent.get("key");
4837
+ const searchKey = `${getStringOrIdentifierValue(key)}Change`;
4838
+ for (const prop of pattern.get("properties")) {
4839
+ if (prop.isObjectProperty()) {
4840
+ const propKey = prop.get("key");
4841
+ const propValue = prop.get("value");
4842
+ if (!prop.node.computed && getStringOrIdentifierValue(propKey) === searchKey && propValue.isIdentifier()) {
4843
+ changeKey = propValue.node;
4844
+ break;
4845
+ }
4846
+ }
4847
+ }
4848
+ if (!changeKey) {
4849
+ pattern.unshiftContainer(
4850
+ "properties",
4851
+ import_compiler25.types.objectProperty(
4852
+ import_compiler25.types.stringLiteral(searchKey),
4853
+ changeKey = generateUidIdentifier(searchKey)
4854
+ )
4855
+ );
4856
+ }
4857
+ }
4858
+ return changeKey;
4859
+ }
4860
+ function getStringOrIdentifierValue(path5) {
4861
+ return getLiteralName(path5.node);
4862
+ }
4863
+ function getLiteralName(node) {
4864
+ switch (node.type) {
4865
+ case "Identifier":
4866
+ return node.name;
4867
+ case "StringLiteral":
4868
+ return node.value;
4869
+ }
4870
+ }
4871
+ function getAssignmentInsertions(node, insertions) {
4872
+ switch (node.type) {
4873
+ case "ObjectPattern":
4874
+ for (const prop of node.properties) {
4875
+ if (prop.type === "ObjectProperty") {
4876
+ if (prop.value.type === "AssignmentPattern") {
4877
+ const { left, right } = prop.value;
4878
+ const sourceName = generateUid(
4879
+ getLiteralName(left) || getLiteralName(prop.key) || "pattern"
4880
+ );
4881
+ prop.shorthand = false;
4882
+ prop.value = import_compiler25.types.identifier(sourceName);
4883
+ (insertions ||= []).push(
4884
+ toConstTag(left, toFallbackExpr(sourceName, right))
4885
+ );
4886
+ getAssignmentInsertions(left, insertions);
4887
+ } else {
4888
+ insertions = getAssignmentInsertions(prop.value, insertions);
4889
+ }
4890
+ }
4891
+ }
4892
+ break;
4893
+ case "ArrayPattern":
4894
+ for (let i = 0, len = node.elements.length; i < len; i++) {
4895
+ const el = node.elements[i];
4896
+ if (el != null) {
4897
+ if (el.type === "AssignmentPattern") {
4898
+ const { left, right } = el;
4899
+ const sourceName = generateUid(getLiteralName(left) || "pattern");
4900
+ node.elements[i] = import_compiler25.types.identifier(sourceName);
4901
+ (insertions ||= []).push(
4902
+ toConstTag(left, toFallbackExpr(sourceName, right))
4903
+ );
4904
+ getAssignmentInsertions(left, insertions);
4905
+ } else {
4906
+ insertions = getAssignmentInsertions(el, insertions);
4907
+ }
4908
+ }
4909
+ }
4910
+ break;
4911
+ }
4912
+ return insertions;
4913
+ }
4914
+ function toFallbackExpr(id, fallback) {
4915
+ return import_compiler25.types.conditionalExpression(
4916
+ import_compiler25.types.binaryExpression("!==", buildUndefined(), import_compiler25.types.identifier(id)),
4917
+ import_compiler25.types.identifier(id),
4918
+ fallback
4919
+ );
4920
+ }
4921
+ function toConstTag(id, expr) {
4922
+ return import_compiler25.types.markoTag(
4923
+ import_compiler25.types.stringLiteral("const"),
4924
+ [import_compiler25.types.markoAttribute("value", expr, null, null, true)],
4925
+ import_compiler25.types.markoTagBody(),
4926
+ null,
4927
+ id
4928
+ );
4929
+ }
4930
+ function buildUndefined() {
4931
+ return import_compiler25.types.unaryExpression("void", import_compiler25.types.numericLiteral(0));
4932
+ }
4933
+
4662
4934
  // src/translator/visitors/program/index.ts
4663
4935
  var cleanIdentifier;
4664
4936
  var scopeIdentifier;
@@ -4668,12 +4940,15 @@ function isScopeIdentifier(node) {
4668
4940
  var program_default = {
4669
4941
  migrate: {
4670
4942
  enter(program) {
4671
- program.node.params = [import_compiler25.types.identifier("input")];
4943
+ program.node.params = [import_compiler26.types.identifier("input")];
4672
4944
  },
4673
4945
  exit(program) {
4674
4946
  program.scope.crawl();
4675
4947
  }
4676
4948
  },
4949
+ transform: {
4950
+ exit: preAnalyze
4951
+ },
4677
4952
  analyze: {
4678
4953
  enter(program) {
4679
4954
  startSection(program);
@@ -4751,7 +5026,7 @@ var program_default = {
4751
5026
  body.push(child);
4752
5027
  }
4753
5028
  }
4754
- body[0] ??= import_compiler25.types.importDeclaration([], import_compiler25.types.stringLiteral(compatFile));
5029
+ body[0] ??= import_compiler26.types.importDeclaration([], import_compiler26.types.stringLiteral(compatFile));
4755
5030
  program.node.body = body;
4756
5031
  }
4757
5032
  }
@@ -4765,7 +5040,7 @@ function resolveRelativeToEntry(entryFile, file, req) {
4765
5040
  }
4766
5041
 
4767
5042
  // src/translator/util/nested-attribute-tags.ts
4768
- var import_compiler26 = require("@marko/compiler");
5043
+ var import_compiler27 = require("@marko/compiler");
4769
5044
  var import_babel_utils18 = require("@marko/compiler/babel-utils");
4770
5045
  var attrTagToIdentifierLookup = /* @__PURE__ */ new WeakMap();
4771
5046
  function getAttrTagIdentifier(meta) {
@@ -4774,7 +5049,7 @@ function getAttrTagIdentifier(meta) {
4774
5049
  name2 = generateUid(meta.name);
4775
5050
  attrTagToIdentifierLookup.set(meta, name2);
4776
5051
  }
4777
- return import_compiler26.types.identifier(name2);
5052
+ return import_compiler27.types.identifier(name2);
4778
5053
  }
4779
5054
  function analyzeAttributeTags(tag) {
4780
5055
  if (tag.node.extra?.attributeTags) return tag.node.extra.attributeTags;
@@ -4887,7 +5162,7 @@ function getConditionRoot(tag) {
4887
5162
  }
4888
5163
 
4889
5164
  // src/translator/util/set-tag-sections-downstream.ts
4890
- var import_compiler27 = require("@marko/compiler");
5165
+ var import_compiler28 = require("@marko/compiler");
4891
5166
  var import_babel_utils19 = require("@marko/compiler/babel-utils");
4892
5167
  var [getTagDownstreams] = createSectionState(
4893
5168
  "tag-downstreams",
@@ -4934,23 +5209,23 @@ function crawlSectionsAndSetBinding(tag, binding, tree, skip2) {
4934
5209
  }
4935
5210
 
4936
5211
  // src/translator/util/translate-attrs.ts
4937
- var import_compiler32 = require("@marko/compiler");
5212
+ var import_compiler33 = require("@marko/compiler");
4938
5213
  var import_babel_utils23 = require("@marko/compiler/babel-utils");
4939
5214
 
4940
5215
  // src/translator/core/for.ts
4941
- var import_compiler31 = require("@marko/compiler");
5216
+ var import_compiler32 = require("@marko/compiler");
4942
5217
  var import_babel_utils22 = require("@marko/compiler/babel-utils");
4943
5218
 
4944
5219
  // src/translator/util/is-only-child-in-parent.ts
4945
- var import_compiler30 = require("@marko/compiler");
5220
+ var import_compiler31 = require("@marko/compiler");
4946
5221
  var import_babel_utils21 = require("@marko/compiler/babel-utils");
4947
5222
 
4948
5223
  // src/translator/visitors/tag/native-tag.ts
4949
- var import_compiler29 = require("@marko/compiler");
5224
+ var import_compiler30 = require("@marko/compiler");
4950
5225
  var import_babel_utils20 = require("@marko/compiler/babel-utils");
4951
5226
 
4952
5227
  // src/translator/util/translate-var.ts
4953
- var import_compiler28 = require("@marko/compiler");
5228
+ var import_compiler29 = require("@marko/compiler");
4954
5229
  function translateVar(tag, initialValue, kind = "const") {
4955
5230
  const {
4956
5231
  node: { var: tagVar }
@@ -4968,15 +5243,15 @@ function translateVar(tag, initialValue, kind = "const") {
4968
5243
  if (changeBinding && changeName !== changeBinding.name) {
4969
5244
  getDestructurePattern(id)?.pushContainer(
4970
5245
  "properties",
4971
- import_compiler28.types.objectProperty(
4972
- import_compiler28.types.identifier(changeName),
4973
- import_compiler28.types.identifier(changeBinding.name)
5246
+ import_compiler29.types.objectProperty(
5247
+ import_compiler29.types.identifier(changeName),
5248
+ import_compiler29.types.identifier(changeBinding.name)
4974
5249
  )
4975
5250
  );
4976
5251
  }
4977
5252
  });
4978
5253
  tag.insertBefore(
4979
- import_compiler28.types.variableDeclaration(kind, [import_compiler28.types.variableDeclarator(tagVar, initialValue)])
5254
+ import_compiler29.types.variableDeclaration(kind, [import_compiler29.types.variableDeclarator(tagVar, initialValue)])
4980
5255
  );
4981
5256
  }
4982
5257
  function getDestructurePattern(id) {
@@ -4996,39 +5271,13 @@ var kGetterId = Symbol("node getter id");
4996
5271
  var kTagContentAttr = Symbol("tag could have dynamic content attribute");
4997
5272
  var htmlSelectArgs = /* @__PURE__ */ new WeakMap();
4998
5273
  var native_tag_default = {
4999
- transform: {
5000
- enter(tag) {
5001
- const tagName = getTagName(tag);
5002
- if (tagName === "textarea" && tag.node.body.body.length) {
5003
- const parts = [];
5004
- for (const child of tag.node.body.body) {
5005
- if (child.type === "MarkoText" || child.type === "MarkoPlaceholder" && child.escape) {
5006
- parts.push(child.value);
5007
- } else {
5008
- throw tag.hub.file.hub.buildError(
5009
- child,
5010
- "Unexpected content in textarea, only text and placeholders are supported.",
5011
- SyntaxError
5012
- );
5013
- }
5014
- }
5015
- tag.node.attributes.push(
5016
- import_compiler29.types.markoAttribute(
5017
- "value",
5018
- normalizeStringExpression(parts) || buildUndefined()
5019
- )
5020
- );
5021
- tag.node.body.body = [];
5022
- }
5023
- }
5024
- },
5025
5274
  analyze: {
5026
5275
  enter(tag) {
5027
5276
  (0, import_babel_utils20.assertNoArgs)(tag);
5028
5277
  (0, import_babel_utils20.assertNoParams)(tag);
5029
5278
  (0, import_babel_utils20.assertNoAttributeTags)(tag);
5030
5279
  const { node } = tag;
5031
- if (node.var && !import_compiler29.types.isIdentifier(node.var)) {
5280
+ if (node.var && !import_compiler30.types.isIdentifier(node.var)) {
5032
5281
  throw tag.get("var").buildCodeFrameError(
5033
5282
  "Tag variables on [native tags](https://markojs.com/docs/reference/native-tag) cannot be destructured."
5034
5283
  );
@@ -5044,7 +5293,7 @@ var native_tag_default = {
5044
5293
  for (let i = attributes.length; i--; ) {
5045
5294
  const attr = attributes[i];
5046
5295
  const valueExtra = attr.value.extra ??= {};
5047
- if (import_compiler29.types.isMarkoAttribute(attr)) {
5296
+ if (import_compiler30.types.isMarkoAttribute(attr)) {
5048
5297
  if (seen[attr.name]) {
5049
5298
  dropReferences(attr.value);
5050
5299
  continue;
@@ -5056,14 +5305,14 @@ var native_tag_default = {
5056
5305
  } else if (!evaluate(attr.value).confident) {
5057
5306
  hasDynamicAttributes = true;
5058
5307
  }
5059
- } else if (import_compiler29.types.isMarkoSpreadAttribute(attr)) {
5308
+ } else if (import_compiler30.types.isMarkoSpreadAttribute(attr)) {
5060
5309
  valueExtra.isEffect = true;
5061
5310
  hasEventHandlers = true;
5062
5311
  hasDynamicAttributes = true;
5063
5312
  }
5064
5313
  if (spreadReferenceNodes) {
5065
5314
  spreadReferenceNodes.push(attr.value);
5066
- } else if (import_compiler29.types.isMarkoSpreadAttribute(attr)) {
5315
+ } else if (import_compiler30.types.isMarkoSpreadAttribute(attr)) {
5067
5316
  spreadReferenceNodes = [attr.value];
5068
5317
  relatedControllable = getRelatedControllable(tagName, seen);
5069
5318
  } else {
@@ -5075,7 +5324,7 @@ var native_tag_default = {
5075
5324
  const tagExtra = node.extra ??= {};
5076
5325
  const tagSection = getOrCreateSection(tag);
5077
5326
  const nodeBinding = tagExtra[kNativeTagBinding] = createBinding(
5078
- "#" + (node.name.type === "StringLiteral" ? node.name.value : import_compiler29.types.toIdentifier(tag.get("name"))),
5327
+ "#" + (node.name.type === "StringLiteral" ? node.name.value : import_compiler30.types.toIdentifier(tag.get("name"))),
5079
5328
  0 /* dom */,
5080
5329
  tagSection
5081
5330
  );
@@ -5154,7 +5403,7 @@ var native_tag_default = {
5154
5403
  callRuntime(
5155
5404
  "_el",
5156
5405
  getterId && getScopeIdIdentifier(tagSection),
5157
- getterId && import_compiler29.types.stringLiteral(getterId)
5406
+ getterId && import_compiler30.types.stringLiteral(getterId)
5158
5407
  )
5159
5408
  );
5160
5409
  }
@@ -5180,24 +5429,24 @@ var native_tag_default = {
5180
5429
  if (tagName === "select") {
5181
5430
  if (staticControllable) {
5182
5431
  htmlSelectArgs.set(tag.node, {
5183
- value: staticControllable.attrs[0]?.value || buildUndefined(),
5184
- valueChange: staticControllable.attrs[1]?.value || buildUndefined()
5432
+ value: staticControllable.attrs[0]?.value || buildUndefined2(),
5433
+ valueChange: staticControllable.attrs[1]?.value || buildUndefined2()
5185
5434
  });
5186
5435
  } else if (spreadExpression) {
5187
5436
  const spreadIdentifier = generateUidIdentifier("select_input");
5188
5437
  tag.insertBefore(
5189
- import_compiler29.types.variableDeclaration("const", [
5190
- import_compiler29.types.variableDeclarator(spreadIdentifier, spreadExpression)
5438
+ import_compiler30.types.variableDeclaration("const", [
5439
+ import_compiler30.types.variableDeclarator(spreadIdentifier, spreadExpression)
5191
5440
  ])
5192
5441
  );
5193
5442
  htmlSelectArgs.set(tag.node, {
5194
- value: import_compiler29.types.memberExpression(
5443
+ value: import_compiler30.types.memberExpression(
5195
5444
  spreadIdentifier,
5196
- import_compiler29.types.identifier("value")
5445
+ import_compiler30.types.identifier("value")
5197
5446
  ),
5198
- valueChange: import_compiler29.types.memberExpression(
5447
+ valueChange: import_compiler30.types.memberExpression(
5199
5448
  spreadIdentifier,
5200
- import_compiler29.types.identifier("valueChange")
5449
+ import_compiler30.types.identifier("valueChange")
5201
5450
  )
5202
5451
  });
5203
5452
  spreadExpression = spreadIdentifier;
@@ -5211,14 +5460,14 @@ var native_tag_default = {
5211
5460
  } else if (spreadExpression) {
5212
5461
  const spreadIdentifier = generateUidIdentifier("textarea_input");
5213
5462
  tag.insertBefore(
5214
- import_compiler29.types.variableDeclaration("const", [
5215
- import_compiler29.types.variableDeclarator(spreadIdentifier, spreadExpression)
5463
+ import_compiler30.types.variableDeclaration("const", [
5464
+ import_compiler30.types.variableDeclarator(spreadIdentifier, spreadExpression)
5216
5465
  ])
5217
5466
  );
5218
- value = import_compiler29.types.memberExpression(spreadIdentifier, import_compiler29.types.identifier("value"));
5219
- valueChange = import_compiler29.types.memberExpression(
5467
+ value = import_compiler30.types.memberExpression(spreadIdentifier, import_compiler30.types.identifier("value"));
5468
+ valueChange = import_compiler30.types.memberExpression(
5220
5469
  spreadIdentifier,
5221
- import_compiler29.types.identifier("valueChange")
5470
+ import_compiler30.types.identifier("valueChange")
5222
5471
  );
5223
5472
  spreadExpression = spreadIdentifier;
5224
5473
  }
@@ -5259,7 +5508,7 @@ var native_tag_default = {
5259
5508
  } else if (isEventHandler(name2)) {
5260
5509
  addHTMLEffectCall(tagSection, valueReferences);
5261
5510
  } else {
5262
- write`${callRuntime("_attr", import_compiler29.types.stringLiteral(name2), value)}`;
5511
+ write`${callRuntime("_attr", import_compiler30.types.stringLiteral(name2), value)}`;
5263
5512
  }
5264
5513
  break;
5265
5514
  }
@@ -5291,7 +5540,7 @@ var native_tag_default = {
5291
5540
  write`>`;
5292
5541
  tagExtra[kTagContentAttr] = true;
5293
5542
  tag.node.body.body = [
5294
- import_compiler29.types.expressionStatement(
5543
+ import_compiler30.types.expressionStatement(
5295
5544
  callRuntime(
5296
5545
  "_attr_content",
5297
5546
  visitAccessor,
@@ -5313,7 +5562,7 @@ var native_tag_default = {
5313
5562
  );
5314
5563
  tagExtra[kTagContentAttr] = true;
5315
5564
  tag.node.body.body = [
5316
- skipExpression ? import_compiler29.types.expressionStatement(
5565
+ skipExpression ? import_compiler30.types.expressionStatement(
5317
5566
  callRuntime(
5318
5567
  "_attrs_partial_content",
5319
5568
  spreadExpression,
@@ -5323,7 +5572,7 @@ var native_tag_default = {
5323
5572
  tag.node.name,
5324
5573
  serializeReason
5325
5574
  )
5326
- ) : import_compiler29.types.expressionStatement(
5575
+ ) : import_compiler30.types.expressionStatement(
5327
5576
  callRuntime(
5328
5577
  "_attrs_content",
5329
5578
  spreadExpression,
@@ -5340,7 +5589,7 @@ var native_tag_default = {
5340
5589
  }
5341
5590
  if (tagExtra.tagNameNullable) {
5342
5591
  tag.insertBefore(
5343
- import_compiler29.types.ifStatement(tag.node.name, consumeHTML(tag))
5592
+ import_compiler30.types.ifStatement(tag.node.name, consumeHTML(tag))
5344
5593
  )[0].skip();
5345
5594
  }
5346
5595
  if (writeAtStartOfBody) {
@@ -5366,16 +5615,16 @@ var native_tag_default = {
5366
5615
  }
5367
5616
  flushInto(tag);
5368
5617
  tag.insertBefore(
5369
- import_compiler29.types.expressionStatement(
5618
+ import_compiler30.types.expressionStatement(
5370
5619
  callRuntime(
5371
5620
  "_attr_select_value",
5372
5621
  getScopeIdIdentifier(getSection(tag)),
5373
5622
  nodeBinding && getScopeAccessorLiteral(nodeBinding),
5374
5623
  selectArgs.value,
5375
5624
  selectArgs.valueChange,
5376
- import_compiler29.types.arrowFunctionExpression(
5625
+ import_compiler30.types.arrowFunctionExpression(
5377
5626
  [],
5378
- import_compiler29.types.blockStatement(tag.node.body.body)
5627
+ import_compiler30.types.blockStatement(tag.node.body.body)
5379
5628
  )
5380
5629
  )
5381
5630
  )
@@ -5392,7 +5641,7 @@ var native_tag_default = {
5392
5641
  }
5393
5642
  if (tagExtra.tagNameNullable) {
5394
5643
  tag.insertBefore(
5395
- import_compiler29.types.ifStatement(tag.node.name, consumeHTML(tag))
5644
+ import_compiler30.types.ifStatement(tag.node.name, consumeHTML(tag))
5396
5645
  )[0].skip();
5397
5646
  }
5398
5647
  if (markerSerializeReason) {
@@ -5417,13 +5666,13 @@ var native_tag_default = {
5417
5666
  if (getterId) {
5418
5667
  getterFnIdentifier = generateUidIdentifier(`get_${varName}`);
5419
5668
  (0, import_babel_utils20.getProgram)().node.body.push(
5420
- import_compiler29.types.variableDeclaration("const", [
5421
- import_compiler29.types.variableDeclarator(
5669
+ import_compiler30.types.variableDeclaration("const", [
5670
+ import_compiler30.types.variableDeclarator(
5422
5671
  getterFnIdentifier,
5423
5672
  callRuntime(
5424
5673
  "_el",
5425
- import_compiler29.types.stringLiteral(getterId),
5426
- import_compiler29.types.stringLiteral(
5674
+ import_compiler30.types.stringLiteral(getterId),
5675
+ import_compiler30.types.stringLiteral(
5427
5676
  getAccessorPrefix().Getter + getScopeAccessorLiteral(nodeBinding).value
5428
5677
  )
5429
5678
  )
@@ -5436,22 +5685,22 @@ var native_tag_default = {
5436
5685
  if (isSameOrChildSection(tagSection, referenceSection)) {
5437
5686
  if (isInvokedFunction(reference)) {
5438
5687
  reference.parentPath.replaceWith(
5439
- import_compiler29.types.expressionStatement(
5688
+ import_compiler30.types.expressionStatement(
5440
5689
  createScopeReadExpression(referenceSection, nodeBinding)
5441
5690
  )
5442
5691
  );
5443
5692
  } else if (getterFnIdentifier) {
5444
5693
  reference.replaceWith(
5445
- import_compiler29.types.callExpression(getterFnIdentifier, [
5694
+ import_compiler30.types.callExpression(getterFnIdentifier, [
5446
5695
  getScopeExpression(referenceSection, getSection(tag))
5447
5696
  ])
5448
5697
  );
5449
5698
  } else {
5450
5699
  reference.replaceWith(
5451
- import_compiler29.types.expressionStatement(
5452
- import_compiler29.types.memberExpression(
5700
+ import_compiler30.types.expressionStatement(
5701
+ import_compiler30.types.memberExpression(
5453
5702
  getScopeExpression(tagSection, referenceSection),
5454
- import_compiler29.types.stringLiteral(
5703
+ import_compiler30.types.stringLiteral(
5455
5704
  getAccessorPrefix().Getter + getScopeAccessorLiteral(nodeBinding).value
5456
5705
  ),
5457
5706
  true
@@ -5481,7 +5730,7 @@ var native_tag_default = {
5481
5730
  "render",
5482
5731
  tagSection,
5483
5732
  referencedBindings,
5484
- import_compiler29.types.expressionStatement(
5733
+ import_compiler30.types.expressionStatement(
5485
5734
  callRuntime(helper, scopeIdentifier, visitAccessor, ...values)
5486
5735
  )
5487
5736
  );
@@ -5490,7 +5739,7 @@ var native_tag_default = {
5490
5739
  "effect",
5491
5740
  tagSection,
5492
5741
  void 0,
5493
- import_compiler29.types.expressionStatement(
5742
+ import_compiler30.types.expressionStatement(
5494
5743
  callRuntime(`${helper}_script`, scopeIdentifier, visitAccessor)
5495
5744
  )
5496
5745
  );
@@ -5507,7 +5756,7 @@ var native_tag_default = {
5507
5756
  if (confident) {
5508
5757
  write`${getHTMLRuntime()[helper](computed)}`;
5509
5758
  } else {
5510
- const nodeExpr = import_compiler29.types.memberExpression(
5759
+ const nodeExpr = import_compiler30.types.memberExpression(
5511
5760
  scopeIdentifier,
5512
5761
  visitAccessor,
5513
5762
  true
@@ -5520,7 +5769,7 @@ var native_tag_default = {
5520
5769
  let stmt;
5521
5770
  trackDelimitedAttrValue(value, meta);
5522
5771
  if (meta.dynamicItems) {
5523
- stmt = import_compiler29.types.expressionStatement(
5772
+ stmt = import_compiler30.types.expressionStatement(
5524
5773
  callRuntime(helper, nodeExpr, value)
5525
5774
  );
5526
5775
  } else {
@@ -5532,11 +5781,11 @@ var native_tag_default = {
5532
5781
  if (keys.length === 1) {
5533
5782
  const [key] = keys;
5534
5783
  const value2 = meta.dynamicValues[key];
5535
- stmt = import_compiler29.types.expressionStatement(
5784
+ stmt = import_compiler30.types.expressionStatement(
5536
5785
  callRuntime(
5537
5786
  `_attr_${name2}_item`,
5538
5787
  nodeExpr,
5539
- import_compiler29.types.stringLiteral(key),
5788
+ import_compiler30.types.stringLiteral(key),
5540
5789
  value2
5541
5790
  )
5542
5791
  );
@@ -5545,14 +5794,14 @@ var native_tag_default = {
5545
5794
  for (const key of keys) {
5546
5795
  const value2 = meta.dynamicValues[key];
5547
5796
  props.push(
5548
- import_compiler29.types.objectProperty(toPropertyName(key), value2)
5797
+ import_compiler30.types.objectProperty(toPropertyName(key), value2)
5549
5798
  );
5550
5799
  }
5551
- stmt = import_compiler29.types.expressionStatement(
5800
+ stmt = import_compiler30.types.expressionStatement(
5552
5801
  callRuntime(
5553
5802
  `_attr_${name2}_items`,
5554
5803
  nodeExpr,
5555
- import_compiler29.types.objectExpression(props)
5804
+ import_compiler30.types.objectExpression(props)
5556
5805
  )
5557
5806
  );
5558
5807
  }
@@ -5572,11 +5821,11 @@ var native_tag_default = {
5572
5821
  "effect",
5573
5822
  tagSection,
5574
5823
  valueReferences,
5575
- import_compiler29.types.expressionStatement(
5824
+ import_compiler30.types.expressionStatement(
5576
5825
  callRuntime(
5577
5826
  "_on",
5578
- import_compiler29.types.memberExpression(scopeIdentifier, visitAccessor, true),
5579
- import_compiler29.types.stringLiteral(getEventHandlerName(name2)),
5827
+ import_compiler30.types.memberExpression(scopeIdentifier, visitAccessor, true),
5828
+ import_compiler30.types.stringLiteral(getEventHandlerName(name2)),
5580
5829
  value
5581
5830
  )
5582
5831
  )
@@ -5586,11 +5835,11 @@ var native_tag_default = {
5586
5835
  "render",
5587
5836
  tagSection,
5588
5837
  valueReferences,
5589
- import_compiler29.types.expressionStatement(
5838
+ import_compiler30.types.expressionStatement(
5590
5839
  callRuntime(
5591
5840
  "_attr",
5592
- import_compiler29.types.memberExpression(scopeIdentifier, visitAccessor, true),
5593
- import_compiler29.types.stringLiteral(name2),
5841
+ import_compiler30.types.memberExpression(scopeIdentifier, visitAccessor, true),
5842
+ import_compiler30.types.stringLiteral(name2),
5594
5843
  value
5595
5844
  )
5596
5845
  )
@@ -5606,7 +5855,7 @@ var native_tag_default = {
5606
5855
  "render",
5607
5856
  tagSection,
5608
5857
  tagExtra.referencedBindings,
5609
- import_compiler29.types.expressionStatement(
5858
+ import_compiler30.types.expressionStatement(
5610
5859
  callRuntime(
5611
5860
  canHaveAttrContent ? "_attrs_partial_content" : "_attrs_partial",
5612
5861
  scopeIdentifier,
@@ -5621,7 +5870,7 @@ var native_tag_default = {
5621
5870
  "render",
5622
5871
  tagSection,
5623
5872
  tagExtra.referencedBindings,
5624
- import_compiler29.types.expressionStatement(
5873
+ import_compiler30.types.expressionStatement(
5625
5874
  callRuntime(
5626
5875
  canHaveAttrContent ? "_attrs_content" : "_attrs",
5627
5876
  scopeIdentifier,
@@ -5635,7 +5884,7 @@ var native_tag_default = {
5635
5884
  "effect",
5636
5885
  tagSection,
5637
5886
  tagExtra.referencedBindings,
5638
- import_compiler29.types.expressionStatement(
5887
+ import_compiler30.types.expressionStatement(
5639
5888
  callRuntime("_attrs_script", scopeIdentifier, visitAccessor)
5640
5889
  ),
5641
5890
  false
@@ -5647,7 +5896,7 @@ var native_tag_default = {
5647
5896
  "render",
5648
5897
  tagSection,
5649
5898
  contentAttrValue.extra?.referencedBindings,
5650
- import_compiler29.types.expressionStatement(
5899
+ import_compiler30.types.expressionStatement(
5651
5900
  callRuntime(
5652
5901
  "_attr_content",
5653
5902
  scopeIdentifier,
@@ -5765,7 +6014,7 @@ function getUsedAttrs(tagName, tag) {
5765
6014
  for (let i = attributes.length; i--; ) {
5766
6015
  const attr = attributes[i];
5767
6016
  const { value } = attr;
5768
- if (import_compiler29.types.isMarkoSpreadAttribute(attr)) {
6017
+ if (import_compiler30.types.isMarkoSpreadAttribute(attr)) {
5769
6018
  if (!spreadProps) {
5770
6019
  spreadProps = [];
5771
6020
  staticControllable = getRelatedControllable(tagName, seen);
@@ -5779,7 +6028,7 @@ function getUsedAttrs(tagName, tag) {
5779
6028
  staticControllable = void 0;
5780
6029
  }
5781
6030
  }
5782
- spreadProps.push(import_compiler29.types.spreadElement(value));
6031
+ spreadProps.push(import_compiler30.types.spreadElement(value));
5783
6032
  } else if (!seen[attr.name] || !(attr.name === "content" && tag.body.body.length)) {
5784
6033
  seen[attr.name] = attr;
5785
6034
  if (spreadProps) {
@@ -5811,18 +6060,18 @@ function getUsedAttrs(tagName, tag) {
5811
6060
  for (const attr of staticControllable.attrs) {
5812
6061
  if (attr) {
5813
6062
  (skipProps ||= []).push(
5814
- toObjectProperty(attr.name, import_compiler29.types.numericLiteral(1))
6063
+ toObjectProperty(attr.name, import_compiler30.types.numericLiteral(1))
5815
6064
  );
5816
6065
  }
5817
6066
  }
5818
6067
  }
5819
6068
  for (const { name: name2 } of staticAttrs) {
5820
- (skipProps ||= []).push(toObjectProperty(name2, import_compiler29.types.numericLiteral(1)));
6069
+ (skipProps ||= []).push(toObjectProperty(name2, import_compiler30.types.numericLiteral(1)));
5821
6070
  }
5822
6071
  spreadExpression = propsToExpression(spreadProps);
5823
6072
  }
5824
6073
  if (skipProps) {
5825
- skipExpression = import_compiler29.types.objectExpression(skipProps);
6074
+ skipExpression = import_compiler30.types.objectExpression(skipProps);
5826
6075
  }
5827
6076
  return {
5828
6077
  staticAttrs,
@@ -5909,14 +6158,14 @@ function trackDelimitedAttrObjectProperties(obj, meta) {
5909
6158
  (meta.staticItems ||= []).push(staticProps);
5910
6159
  }
5911
6160
  if (dynamicProps) {
5912
- (meta.dynamicItems ||= []).push(import_compiler29.types.objectExpression(dynamicProps));
6161
+ (meta.dynamicItems ||= []).push(import_compiler30.types.objectExpression(dynamicProps));
5913
6162
  }
5914
6163
  }
5915
6164
  function isNativeTagChangeHandler(propName) {
5916
6165
  return /^(?:value|checked(?:Value)?|open)Change$/.test(propName);
5917
6166
  }
5918
- function buildUndefined() {
5919
- return import_compiler29.types.unaryExpression("void", import_compiler29.types.numericLiteral(0));
6167
+ function buildUndefined2() {
6168
+ return import_compiler30.types.unaryExpression("void", import_compiler30.types.numericLiteral(0));
5920
6169
  }
5921
6170
 
5922
6171
  // src/translator/util/is-only-child-in-parent.ts
@@ -6052,7 +6301,7 @@ var for_default = {
6052
6301
  const forTagArgs = getBaseArgsInForTag(forType, forAttrs);
6053
6302
  const forTagHTMLRuntime = branchSerializeReason ? forTypeToHTMLResumeRuntime(forType) : forTypeToRuntime(forType);
6054
6303
  forTagArgs.push(
6055
- import_compiler31.types.arrowFunctionExpression(params, import_compiler31.types.blockStatement(bodyStatements))
6304
+ import_compiler32.types.arrowFunctionExpression(params, import_compiler32.types.blockStatement(bodyStatements))
6056
6305
  );
6057
6306
  if (branchSerializeReason) {
6058
6307
  const skipParentEnd = onlyChildParentTagName && markerSerializeReason;
@@ -6067,7 +6316,7 @@ var for_default = {
6067
6316
  !statefulSerializeArg
6068
6317
  );
6069
6318
  forTagArgs.push(
6070
- forAttrs.by || import_compiler31.types.numericLiteral(0),
6319
+ forAttrs.by || import_compiler32.types.numericLiteral(0),
6071
6320
  getScopeIdIdentifier(tagSection),
6072
6321
  getScopeAccessorLiteral(nodeBinding),
6073
6322
  getSerializeGuard(
@@ -6080,17 +6329,17 @@ var for_default = {
6080
6329
  );
6081
6330
  if (skipParentEnd) {
6082
6331
  getParentTag(tag).node.extra[kSkipEndTag] = true;
6083
- forTagArgs.push(import_compiler31.types.stringLiteral(`</${onlyChildParentTagName}>`));
6332
+ forTagArgs.push(import_compiler32.types.stringLiteral(`</${onlyChildParentTagName}>`));
6084
6333
  }
6085
6334
  if (singleNodeOptimization) {
6086
6335
  if (!skipParentEnd) {
6087
- forTagArgs.push(import_compiler31.types.numericLiteral(0));
6336
+ forTagArgs.push(import_compiler32.types.numericLiteral(0));
6088
6337
  }
6089
- forTagArgs.push(import_compiler31.types.numericLiteral(1));
6338
+ forTagArgs.push(import_compiler32.types.numericLiteral(1));
6090
6339
  }
6091
6340
  }
6092
6341
  statements.push(
6093
- import_compiler31.types.expressionStatement(callRuntime(forTagHTMLRuntime, ...forTagArgs))
6342
+ import_compiler32.types.expressionStatement(callRuntime(forTagHTMLRuntime, ...forTagArgs))
6094
6343
  );
6095
6344
  for (const replacement of tag.replaceWithMultiple(statements)) {
6096
6345
  replacement.skip();
@@ -6135,7 +6384,7 @@ var for_default = {
6135
6384
  return callRuntime(
6136
6385
  forTypeToDOMRuntime(forType),
6137
6386
  getScopeAccessorLiteral(nodeRef),
6138
- import_compiler31.types.identifier(bodySection.name)
6387
+ import_compiler32.types.identifier(bodySection.name)
6139
6388
  );
6140
6389
  };
6141
6390
  const forAttrs = getKnownAttrValues(node);
@@ -6147,7 +6396,7 @@ var for_default = {
6147
6396
  tagSection,
6148
6397
  referencedBindings,
6149
6398
  signal,
6150
- import_compiler31.types.arrayExpression(loopArgs)
6399
+ import_compiler32.types.arrayExpression(loopArgs)
6151
6400
  );
6152
6401
  tag.remove();
6153
6402
  }
@@ -6225,11 +6474,11 @@ var for_default = {
6225
6474
  ]
6226
6475
  };
6227
6476
  function buildForRuntimeCall(type, attrs, params, statements) {
6228
- return import_compiler31.types.expressionStatement(
6477
+ return import_compiler32.types.expressionStatement(
6229
6478
  callRuntime(
6230
6479
  forTypeToRuntime(type),
6231
6480
  ...getBaseArgsInForTag(type, attrs),
6232
- import_compiler31.types.arrowFunctionExpression(params, import_compiler31.types.blockStatement(statements))
6481
+ import_compiler32.types.arrowFunctionExpression(params, import_compiler32.types.blockStatement(statements))
6233
6482
  )
6234
6483
  );
6235
6484
  }
@@ -6291,14 +6540,14 @@ function getBaseArgsInForTag(type, attrs) {
6291
6540
  case "to":
6292
6541
  return [
6293
6542
  attrs.to,
6294
- attrs.from || import_compiler31.types.numericLiteral(0),
6295
- attrs.step || import_compiler31.types.numericLiteral(1)
6543
+ attrs.from || import_compiler32.types.numericLiteral(0),
6544
+ attrs.step || import_compiler32.types.numericLiteral(1)
6296
6545
  ];
6297
6546
  case "until":
6298
6547
  return [
6299
6548
  attrs.until,
6300
- attrs.from || import_compiler31.types.numericLiteral(0),
6301
- attrs.step || import_compiler31.types.numericLiteral(1)
6549
+ attrs.from || import_compiler32.types.numericLiteral(0),
6550
+ attrs.step || import_compiler32.types.numericLiteral(1)
6302
6551
  ];
6303
6552
  }
6304
6553
  }
@@ -6316,8 +6565,8 @@ function translateAttrs(tag, templateExports, statements = [], contentKey = "con
6316
6565
  seen.add(attrTagMeta.name);
6317
6566
  if (attrTagMeta.dynamic) {
6318
6567
  statements.push(
6319
- import_compiler32.types.variableDeclaration("let", [
6320
- import_compiler32.types.variableDeclarator(getAttrTagIdentifier(attrTagMeta))
6568
+ import_compiler33.types.variableDeclaration("let", [
6569
+ import_compiler33.types.variableDeclarator(getAttrTagIdentifier(attrTagMeta))
6321
6570
  ])
6322
6571
  );
6323
6572
  properties.push(
@@ -6398,8 +6647,8 @@ function translateAttrs(tag, templateExports, statements = [], contentKey = "con
6398
6647
  if (!seen.has(contentKey) && usesExport(templateExports, contentKey)) {
6399
6648
  const contentExpression = buildContent(tag.get("body"));
6400
6649
  if (contentExpression) {
6401
- const contentProp = import_compiler32.types.objectProperty(
6402
- import_compiler32.types.identifier(contentKey),
6650
+ const contentProp = import_compiler33.types.objectProperty(
6651
+ import_compiler33.types.identifier(contentKey),
6403
6652
  contentExpression
6404
6653
  );
6405
6654
  seen.add(contentKey);
@@ -6411,8 +6660,8 @@ function translateAttrs(tag, templateExports, statements = [], contentKey = "con
6411
6660
  for (let i = attributes.length; i--; ) {
6412
6661
  const attr = attributes[i];
6413
6662
  const { value } = attr;
6414
- if (import_compiler32.types.isMarkoSpreadAttribute(attr)) {
6415
- properties.push(import_compiler32.types.spreadElement(value));
6663
+ if (import_compiler33.types.isMarkoSpreadAttribute(attr)) {
6664
+ properties.push(import_compiler33.types.spreadElement(value));
6416
6665
  } else if (!seen.has(attr.name) && usesExport(templateExports, attr.name)) {
6417
6666
  seen.add(attr.name);
6418
6667
  properties.push(toObjectProperty(attr.name, value));
@@ -6442,8 +6691,8 @@ function addDynamicAttrTagStatements(attrTags2, index, attrTagLookup, statements
6442
6691
  );
6443
6692
  if (attrTagMeta.repeated) {
6444
6693
  statements.push(
6445
- import_compiler32.types.expressionStatement(
6446
- import_compiler32.types.assignmentExpression(
6694
+ import_compiler33.types.expressionStatement(
6695
+ import_compiler33.types.assignmentExpression(
6447
6696
  "=",
6448
6697
  getAttrTagIdentifier(attrTagMeta),
6449
6698
  callRuntime(
@@ -6456,8 +6705,8 @@ function addDynamicAttrTagStatements(attrTags2, index, attrTagLookup, statements
6456
6705
  );
6457
6706
  } else {
6458
6707
  statements.push(
6459
- import_compiler32.types.expressionStatement(
6460
- import_compiler32.types.assignmentExpression(
6708
+ import_compiler33.types.expressionStatement(
6709
+ import_compiler33.types.assignmentExpression(
6461
6710
  "=",
6462
6711
  getAttrTagIdentifier(attrTagMeta),
6463
6712
  callRuntime(
@@ -6496,7 +6745,7 @@ function addDynamicAttrTagStatements(attrTags2, index, attrTagLookup, statements
6496
6745
  return index;
6497
6746
  }
6498
6747
  function propsToExpression(props) {
6499
- return props.length === 1 && import_compiler32.types.isSpreadElement(props[0]) ? props[0].argument : import_compiler32.types.objectExpression(props);
6748
+ return props.length === 1 && import_compiler33.types.isSpreadElement(props[0]) ? props[0].argument : import_compiler33.types.objectExpression(props);
6500
6749
  }
6501
6750
  function translateForAttrTag(attrTags2, index, attrTagLookup, statements, templateExports, contentKey) {
6502
6751
  const forTag = attrTags2[index];
@@ -6521,9 +6770,9 @@ function translateForAttrTag(attrTags2, index, attrTagLookup, statements, templa
6521
6770
  function translateIfAttrTag(attrTags2, index, attrTagLookup, statements, templateExports, contentKey) {
6522
6771
  const ifTag = attrTags2[index];
6523
6772
  const consequentStatements = [];
6524
- let ifStatement = import_compiler32.types.ifStatement(
6773
+ let ifStatement = import_compiler33.types.ifStatement(
6525
6774
  getConditionTestValue(ifTag),
6526
- import_compiler32.types.blockStatement(consequentStatements)
6775
+ import_compiler33.types.blockStatement(consequentStatements)
6527
6776
  );
6528
6777
  statements.push(ifStatement);
6529
6778
  addAllAttrTagsAsDynamic(
@@ -6550,14 +6799,14 @@ function translateIfAttrTag(attrTags2, index, attrTagLookup, statements, templat
6550
6799
  contentKey
6551
6800
  );
6552
6801
  if (testValue) {
6553
- ifStatement.alternate = ifStatement = import_compiler32.types.ifStatement(
6802
+ ifStatement.alternate = ifStatement = import_compiler33.types.ifStatement(
6554
6803
  testValue,
6555
- import_compiler32.types.blockStatement(alternateStatements)
6804
+ import_compiler33.types.blockStatement(alternateStatements)
6556
6805
  );
6557
6806
  nextIndex++;
6558
6807
  continue;
6559
6808
  } else {
6560
- ifStatement.alternate = import_compiler32.types.blockStatement(alternateStatements);
6809
+ ifStatement.alternate = import_compiler33.types.blockStatement(alternateStatements);
6561
6810
  break;
6562
6811
  }
6563
6812
  }
@@ -6623,9 +6872,9 @@ function buildContent(body) {
6623
6872
  }
6624
6873
  if (dynamicSerializeReason) {
6625
6874
  body.node.body.unshift(
6626
- import_compiler32.types.variableDeclaration("const", [
6627
- import_compiler32.types.variableDeclarator(
6628
- import_compiler32.types.identifier(
6875
+ import_compiler33.types.variableDeclaration("const", [
6876
+ import_compiler33.types.variableDeclarator(
6877
+ import_compiler33.types.identifier(
6629
6878
  getSharedUid(`scope${bodySection.id}_reason`, bodySection)
6630
6879
  ),
6631
6880
  callRuntime("_scope_reason")
@@ -6635,10 +6884,10 @@ function buildContent(body) {
6635
6884
  }
6636
6885
  return callRuntime(
6637
6886
  serialized ? "_content_resume" : "_content",
6638
- import_compiler32.types.stringLiteral(getResumeRegisterId(bodySection, "content")),
6639
- import_compiler32.types.arrowFunctionExpression(
6887
+ import_compiler33.types.stringLiteral(getResumeRegisterId(bodySection, "content")),
6888
+ import_compiler33.types.arrowFunctionExpression(
6640
6889
  body.node.params,
6641
- import_compiler32.types.blockStatement(body.node.body)
6890
+ import_compiler33.types.blockStatement(body.node.body)
6642
6891
  ),
6643
6892
  serialized ? getScopeIdIdentifier(
6644
6893
  getSection(
@@ -6649,17 +6898,17 @@ function buildContent(body) {
6649
6898
  ) : void 0
6650
6899
  );
6651
6900
  } else {
6652
- return import_compiler32.types.callExpression(
6653
- import_compiler32.types.identifier(bodySection.name),
6901
+ return import_compiler33.types.callExpression(
6902
+ import_compiler33.types.identifier(bodySection.name),
6654
6903
  bodySection.referencedLocalClosures ? [
6655
6904
  scopeIdentifier,
6656
- import_compiler32.types.objectExpression(
6905
+ import_compiler33.types.objectExpression(
6657
6906
  toArray(bodySection.referencedLocalClosures, (ref) => {
6658
6907
  const accessor = getScopeAccessor(ref);
6659
6908
  const isShorthand = accessor === ref.name;
6660
- return import_compiler32.types.objectProperty(
6909
+ return import_compiler33.types.objectProperty(
6661
6910
  toPropertyName(accessor),
6662
- import_compiler32.types.identifier(ref.name),
6911
+ import_compiler33.types.identifier(ref.name),
6663
6912
  false,
6664
6913
  isShorthand
6665
6914
  );
@@ -6744,8 +6993,8 @@ function knownTagTranslateHTML(tag, tagIdentifier, contentSection, propTree) {
6744
6993
  if (childScopeSerializeReason) {
6745
6994
  const peekScopeId = generateUidIdentifier(childScopeBinding?.name);
6746
6995
  tag.insertBefore(
6747
- import_compiler33.types.variableDeclaration("const", [
6748
- import_compiler33.types.variableDeclarator(peekScopeId, callRuntime("_peek_scope_id"))
6996
+ import_compiler34.types.variableDeclaration("const", [
6997
+ import_compiler34.types.variableDeclarator(peekScopeId, callRuntime("_peek_scope_id"))
6749
6998
  ])
6750
6999
  );
6751
7000
  setBindingSerializedValue(
@@ -6755,13 +7004,13 @@ function knownTagTranslateHTML(tag, tagIdentifier, contentSection, propTree) {
6755
7004
  );
6756
7005
  if (tagVar) {
6757
7006
  statements.push(
6758
- import_compiler33.types.expressionStatement(
7007
+ import_compiler34.types.expressionStatement(
6759
7008
  callRuntime(
6760
7009
  "_var",
6761
7010
  getScopeIdIdentifier(section),
6762
7011
  getScopeAccessorLiteral(tag.node.extra[kChildOffsetScopeBinding]),
6763
7012
  peekScopeId,
6764
- import_compiler33.types.stringLiteral(
7013
+ import_compiler34.types.stringLiteral(
6765
7014
  getResumeRegisterId(
6766
7015
  section,
6767
7016
  node.var.extra?.binding,
@@ -6790,9 +7039,9 @@ function knownTagTranslateHTML(tag, tagIdentifier, contentSection, propTree) {
6790
7039
  if (reason) {
6791
7040
  hasDynamicReasons ||= reason !== true && !reason.state;
6792
7041
  props.push(
6793
- import_compiler33.types.objectProperty(
7042
+ import_compiler34.types.objectProperty(
6794
7043
  withLeadingComment(
6795
- import_compiler33.types.numericLiteral(i),
7044
+ import_compiler34.types.numericLiteral(i),
6796
7045
  getDebugNames(group.reason)
6797
7046
  ),
6798
7047
  getSerializeGuard(section, reason, false)
@@ -6803,12 +7052,12 @@ function knownTagTranslateHTML(tag, tagIdentifier, contentSection, propTree) {
6803
7052
  }
6804
7053
  }
6805
7054
  if (props.length) {
6806
- childSerializeReasonExpr = hasDynamicReasons || hasSkippedReasons ? import_compiler33.types.objectExpression(props) : import_compiler33.types.numericLiteral(1);
7055
+ childSerializeReasonExpr = hasDynamicReasons || hasSkippedReasons ? import_compiler34.types.objectExpression(props) : import_compiler34.types.numericLiteral(1);
6807
7056
  }
6808
7057
  }
6809
7058
  if (childSerializeReasonExpr) {
6810
7059
  tag.insertBefore(
6811
- import_compiler33.types.expressionStatement(
7060
+ import_compiler34.types.expressionStatement(
6812
7061
  callRuntime("_set_serialize_reason", childSerializeReasonExpr)
6813
7062
  )
6814
7063
  );
@@ -6831,8 +7080,8 @@ function knownTagTranslateHTML(tag, tagIdentifier, contentSection, propTree) {
6831
7080
  const contentExpression = contentProp.value;
6832
7081
  contentProp.value = contentId = generateUidIdentifier("content");
6833
7082
  const [contentPath] = tag.insertBefore(
6834
- import_compiler33.types.variableDeclaration("const", [
6835
- import_compiler33.types.variableDeclarator(
7083
+ import_compiler34.types.variableDeclaration("const", [
7084
+ import_compiler34.types.variableDeclarator(
6836
7085
  contentId,
6837
7086
  // TODO: only register if needed (child template analysis)
6838
7087
  contentExpression
@@ -6846,13 +7095,13 @@ function knownTagTranslateHTML(tag, tagIdentifier, contentSection, propTree) {
6846
7095
  ...getArgs()
6847
7096
  );
6848
7097
  if (tagVar) {
6849
- translateVar(tag, import_compiler33.types.unaryExpression("void", import_compiler33.types.numericLiteral(0)), "let");
6850
- renderTagExpr = import_compiler33.types.assignmentExpression("=", tagVar, renderTagExpr);
7098
+ translateVar(tag, import_compiler34.types.unaryExpression("void", import_compiler34.types.numericLiteral(0)), "let");
7099
+ renderTagExpr = import_compiler34.types.assignmentExpression("=", tagVar, renderTagExpr);
6851
7100
  }
6852
7101
  statements.push(
6853
- import_compiler33.types.ifStatement(
7102
+ import_compiler34.types.ifStatement(
6854
7103
  tagIdentifier,
6855
- import_compiler33.types.expressionStatement(renderTagExpr),
7104
+ import_compiler34.types.expressionStatement(renderTagExpr),
6856
7105
  contentId && callStatement(contentId)
6857
7106
  )
6858
7107
  );
@@ -6883,15 +7132,15 @@ function knownTagTranslateDOM(tag, propTree, getBindingIdentifier, callSetup) {
6883
7132
  value
6884
7133
  ];
6885
7134
  if (!isOptimize()) {
6886
- changeArgs.push(import_compiler33.types.stringLiteral(varBinding.name));
7135
+ changeArgs.push(import_compiler34.types.stringLiteral(varBinding.name));
6887
7136
  }
6888
- return import_compiler33.types.callExpression(importRuntime("_var_change"), changeArgs);
7137
+ return import_compiler34.types.callExpression(importRuntime("_var_change"), changeArgs);
6889
7138
  };
6890
7139
  addStatement(
6891
7140
  "render",
6892
7141
  tagSection,
6893
7142
  void 0,
6894
- import_compiler33.types.expressionStatement(
7143
+ import_compiler34.types.expressionStatement(
6895
7144
  callRuntime(
6896
7145
  "_var",
6897
7146
  scopeIdentifier,
@@ -6936,7 +7185,7 @@ function analyzeParams(rootTagExtra, section, tag, propTree, rootAttrExprs) {
6936
7185
  dropReferences(getAllTagReferenceNodes(tag.node));
6937
7186
  return inputExpr;
6938
7187
  }
6939
- if (!propTree.props || tag.node.arguments?.some((node) => import_compiler33.types.isSpreadElement(node))) {
7188
+ if (!propTree.props || tag.node.arguments?.some((node) => import_compiler34.types.isSpreadElement(node))) {
6940
7189
  const extra = inputExpr.value = mergeReferences(
6941
7190
  section,
6942
7191
  tag.node,
@@ -7086,7 +7335,7 @@ function analyzeAttrs(rootTagExtra, section, tag, propTree, rootAttrExprs) {
7086
7335
  let spreadReferenceNodes;
7087
7336
  for (let i = attributes.length; i--; ) {
7088
7337
  const attr = attributes[i];
7089
- if (import_compiler33.types.isMarkoAttribute(attr)) {
7338
+ if (import_compiler34.types.isMarkoAttribute(attr)) {
7090
7339
  const templateExportAttr = propTree.props[attr.name];
7091
7340
  if (!templateExportAttr || seen.has(attr.name)) {
7092
7341
  dropReferences(attr.value);
@@ -7100,7 +7349,7 @@ function analyzeAttrs(rootTagExtra, section, tag, propTree, rootAttrExprs) {
7100
7349
  }
7101
7350
  if (spreadReferenceNodes) {
7102
7351
  spreadReferenceNodes.push(attr.value);
7103
- } else if (import_compiler33.types.isMarkoSpreadAttribute(attr)) {
7352
+ } else if (import_compiler34.types.isMarkoSpreadAttribute(attr)) {
7104
7353
  spreadReferenceNodes = [attr.value];
7105
7354
  } else {
7106
7355
  const attrValueExtra = attr.value.extra ??= {};
@@ -7132,7 +7381,7 @@ function analyzeAttrs(rootTagExtra, section, tag, propTree, rootAttrExprs) {
7132
7381
  return inputExpr;
7133
7382
  }
7134
7383
  function writeParamsToSignals(tag, propTree, importAlias, info) {
7135
- if (!propTree.props || tag.node.arguments?.some((node) => import_compiler33.types.isSpreadElement(node))) {
7384
+ if (!propTree.props || tag.node.arguments?.some((node) => import_compiler34.types.isSpreadElement(node))) {
7136
7385
  const referencedBindings = tag.node.extra?.referencedBindings;
7137
7386
  const tagInputIdentifier = info.getBindingIdentifier(
7138
7387
  propTree.binding,
@@ -7160,8 +7409,8 @@ function writeParamsToSignals(tag, propTree, importAlias, info) {
7160
7409
  "render",
7161
7410
  info.tagSection,
7162
7411
  referencedBindings,
7163
- import_compiler33.types.expressionStatement(
7164
- import_compiler33.types.callExpression(tagInputIdentifier, [import_compiler33.types.arrayExpression(renderArgs)])
7412
+ import_compiler34.types.expressionStatement(
7413
+ import_compiler34.types.callExpression(tagInputIdentifier, [import_compiler34.types.arrayExpression(renderArgs)])
7165
7414
  )
7166
7415
  );
7167
7416
  return;
@@ -7180,8 +7429,8 @@ function writeParamsToSignals(tag, propTree, importAlias, info) {
7180
7429
  info.tagSection,
7181
7430
  arg.extra?.referencedBindings,
7182
7431
  // TODO: pretty sure content needs to have the reference group of it's param defaults.
7183
- import_compiler33.types.expressionStatement(
7184
- import_compiler33.types.callExpression(argExportIdentifier, [
7432
+ import_compiler34.types.expressionStatement(
7433
+ import_compiler34.types.callExpression(argExportIdentifier, [
7185
7434
  createScopeReadExpression(
7186
7435
  info.tagSection,
7187
7436
  info.childScopeBinding
@@ -7241,7 +7490,7 @@ function writeAttrsToSignals(tag, propTree, importAlias, info) {
7241
7490
  } else {
7242
7491
  attrTagCallsForTag.set(
7243
7492
  attrTagName,
7244
- translatedProps = import_compiler33.types.parenthesizedExpression(
7493
+ translatedProps = import_compiler34.types.parenthesizedExpression(
7245
7494
  callRuntime("attrTag", translatedProps)
7246
7495
  )
7247
7496
  );
@@ -7254,8 +7503,8 @@ function writeAttrsToSignals(tag, propTree, importAlias, info) {
7254
7503
  "render",
7255
7504
  info.tagSection,
7256
7505
  referencedBindings,
7257
- import_compiler33.types.expressionStatement(
7258
- import_compiler33.types.callExpression(tagInputIdentifier, [
7506
+ import_compiler34.types.expressionStatement(
7507
+ import_compiler34.types.callExpression(tagInputIdentifier, [
7259
7508
  createScopeReadExpression(info.tagSection, info.childScopeBinding),
7260
7509
  translatedProps
7261
7510
  ])
@@ -7328,17 +7577,17 @@ function writeAttrsToSignals(tag, propTree, importAlias, info) {
7328
7577
  childAttrExports.binding,
7329
7578
  `${importAlias}_${attrTagMeta.name}`
7330
7579
  );
7331
- decls.push(import_compiler33.types.variableDeclarator(getAttrTagIdentifier(attrTagMeta)));
7580
+ decls.push(import_compiler34.types.variableDeclarator(getAttrTagIdentifier(attrTagMeta)));
7332
7581
  addStatement("render", info.tagSection, referencedBindings, [
7333
- import_compiler33.types.variableDeclaration("let", decls),
7582
+ import_compiler34.types.variableDeclaration("let", decls),
7334
7583
  ...statements
7335
7584
  ]);
7336
7585
  addStatement(
7337
7586
  "render",
7338
7587
  info.tagSection,
7339
7588
  referencedBindings,
7340
- import_compiler33.types.expressionStatement(
7341
- import_compiler33.types.callExpression(attrExportIdentifier, [
7589
+ import_compiler34.types.expressionStatement(
7590
+ import_compiler34.types.callExpression(attrExportIdentifier, [
7342
7591
  createScopeReadExpression(
7343
7592
  info.tagSection,
7344
7593
  info.childScopeBinding
@@ -7363,10 +7612,10 @@ function writeAttrsToSignals(tag, propTree, importAlias, info) {
7363
7612
  info.tagSection,
7364
7613
  void 0,
7365
7614
  // TODO: pretty sure content needs to have the reference group of it's param defaults.
7366
- import_compiler33.types.expressionStatement(
7367
- import_compiler33.types.callExpression(contentExportIdentifier, [
7615
+ import_compiler34.types.expressionStatement(
7616
+ import_compiler34.types.callExpression(contentExportIdentifier, [
7368
7617
  createScopeReadExpression(info.tagSection, info.childScopeBinding),
7369
- import_compiler33.types.callExpression(import_compiler33.types.identifier(bodySection.name), [scopeIdentifier])
7618
+ import_compiler34.types.callExpression(import_compiler34.types.identifier(bodySection.name), [scopeIdentifier])
7370
7619
  ])
7371
7620
  )
7372
7621
  );
@@ -7377,7 +7626,7 @@ function writeAttrsToSignals(tag, propTree, importAlias, info) {
7377
7626
  let spreadProps;
7378
7627
  for (let i = attributes.length; i--; ) {
7379
7628
  const attr = attributes[i];
7380
- if (import_compiler33.types.isMarkoAttribute(attr)) {
7629
+ if (import_compiler34.types.isMarkoAttribute(attr)) {
7381
7630
  const childAttrExports = propTree.props[attr.name];
7382
7631
  if (!childAttrExports || seen.has(attr.name)) continue;
7383
7632
  seen.add(attr.name);
@@ -7387,9 +7636,9 @@ function writeAttrsToSignals(tag, propTree, importAlias, info) {
7387
7636
  }
7388
7637
  staticAttrs.push(attr);
7389
7638
  } else if (spreadProps) {
7390
- spreadProps.push(import_compiler33.types.spreadElement(attr.value));
7639
+ spreadProps.push(import_compiler34.types.spreadElement(attr.value));
7391
7640
  } else {
7392
- spreadProps = [import_compiler33.types.spreadElement(attr.value)];
7641
+ spreadProps = [import_compiler34.types.spreadElement(attr.value)];
7393
7642
  }
7394
7643
  }
7395
7644
  for (const attr of staticAttrs.reverse()) {
@@ -7402,8 +7651,8 @@ function writeAttrsToSignals(tag, propTree, importAlias, info) {
7402
7651
  "render",
7403
7652
  info.tagSection,
7404
7653
  attr.value.extra?.referencedBindings,
7405
- import_compiler33.types.expressionStatement(
7406
- import_compiler33.types.callExpression(attrExportIdentifier, [
7654
+ import_compiler34.types.expressionStatement(
7655
+ import_compiler34.types.callExpression(attrExportIdentifier, [
7407
7656
  createScopeReadExpression(info.tagSection, info.childScopeBinding),
7408
7657
  attr.value
7409
7658
  ])
@@ -7414,14 +7663,14 @@ function writeAttrsToSignals(tag, propTree, importAlias, info) {
7414
7663
  for (const name2 of seen) missing.delete(name2);
7415
7664
  if (missing.size) {
7416
7665
  const referencedBindings = tag.node.extra?.referencedBindings;
7417
- let getMissingPropValue = buildUndefined2;
7666
+ let getMissingPropValue = buildUndefined3;
7418
7667
  if (spreadProps) {
7419
7668
  const spreadId = generateUidIdentifier(`${importAlias}_spread`);
7420
7669
  spreadProps.reverse();
7421
7670
  getMissingPropValue = (name2) => toMemberExpression(spreadId, name2);
7422
7671
  addStatement("render", info.tagSection, referencedBindings, [
7423
- import_compiler33.types.variableDeclaration("const", [
7424
- import_compiler33.types.variableDeclarator(spreadId, propsToExpression(spreadProps))
7672
+ import_compiler34.types.variableDeclaration("const", [
7673
+ import_compiler34.types.variableDeclarator(spreadId, propsToExpression(spreadProps))
7425
7674
  ])
7426
7675
  ]);
7427
7676
  }
@@ -7435,8 +7684,8 @@ function writeAttrsToSignals(tag, propTree, importAlias, info) {
7435
7684
  "render",
7436
7685
  info.tagSection,
7437
7686
  referencedBindings,
7438
- import_compiler33.types.expressionStatement(
7439
- import_compiler33.types.callExpression(attrExportIdentifier, [
7687
+ import_compiler34.types.expressionStatement(
7688
+ import_compiler34.types.callExpression(attrExportIdentifier, [
7440
7689
  createScopeReadExpression(info.tagSection, info.childScopeBinding),
7441
7690
  getMissingPropValue(name2)
7442
7691
  ])
@@ -7472,21 +7721,13 @@ function mapParamReasonToExpr(exprs, reason) {
7472
7721
  }
7473
7722
  }
7474
7723
  function callStatement(id, ...args) {
7475
- return import_compiler33.types.expressionStatement(callExpression(id, ...args));
7724
+ return import_compiler34.types.expressionStatement(callExpression(id, ...args));
7476
7725
  }
7477
7726
  function callExpression(id, ...args) {
7478
- return import_compiler33.types.callExpression(id, args.filter(Boolean));
7479
- }
7480
- function buildUndefined2() {
7481
- return import_compiler33.types.unaryExpression("void", import_compiler33.types.numericLiteral(0));
7727
+ return import_compiler34.types.callExpression(id, args.filter(Boolean));
7482
7728
  }
7483
-
7484
- // src/translator/util/with-previous-location.ts
7485
- function withPreviousLocation(newNode, originalNode) {
7486
- newNode.start = originalNode.start;
7487
- newNode.loc = originalNode.loc;
7488
- newNode.end = originalNode.end;
7489
- return newNode;
7729
+ function buildUndefined3() {
7730
+ return import_compiler34.types.unaryExpression("void", import_compiler34.types.numericLiteral(0));
7490
7731
  }
7491
7732
 
7492
7733
  // src/translator/util/references.ts
@@ -7599,7 +7840,7 @@ function trackParamsReferences(body, type, upstreamAlias) {
7599
7840
  void 0,
7600
7841
  i > 0 ? addNumericPropertiesUntil(void 0, i - 1) : void 0
7601
7842
  );
7602
- } else if (import_compiler34.types.isLVal(param)) {
7843
+ } else if (import_compiler35.types.isLVal(param)) {
7603
7844
  createBindingsAndTrackReferences(
7604
7845
  param,
7605
7846
  type,
@@ -7770,7 +8011,7 @@ function createBindingsAndTrackReferences(lVal, type, scope, section, upstreamAl
7770
8011
  if (hasRest) {
7771
8012
  excludeProperties = propsUtil.add(excludeProperties, key);
7772
8013
  }
7773
- if (import_compiler34.types.isLVal(prop.value)) {
8014
+ if (import_compiler35.types.isLVal(prop.value)) {
7774
8015
  createBindingsAndTrackReferences(
7775
8016
  prop.value,
7776
8017
  type,
@@ -7810,7 +8051,7 @@ function createBindingsAndTrackReferences(lVal, type, scope, section, upstreamAl
7810
8051
  property,
7811
8052
  excludeProperties
7812
8053
  );
7813
- } else if (import_compiler34.types.isLVal(element)) {
8054
+ } else if (import_compiler35.types.isLVal(element)) {
7814
8055
  createBindingsAndTrackReferences(
7815
8056
  element,
7816
8057
  type,
@@ -7825,23 +8066,6 @@ function createBindingsAndTrackReferences(lVal, type, scope, section, upstreamAl
7825
8066
  }
7826
8067
  break;
7827
8068
  }
7828
- case "AssignmentPattern":
7829
- createBindingsAndTrackReferences(
7830
- lVal.left,
7831
- type,
7832
- scope,
7833
- section,
7834
- upstreamAlias,
7835
- property,
7836
- void 0
7837
- );
7838
- if (lVal.left.extra?.binding) {
7839
- setBindingDownstream(
7840
- lVal.left.extra.binding,
7841
- lVal.right.extra ??= {}
7842
- );
7843
- }
7844
- break;
7845
8069
  }
7846
8070
  }
7847
8071
  function trackReference(referencePath, binding) {
@@ -7850,7 +8074,7 @@ function trackReference(referencePath, binding) {
7850
8074
  let propPath = binding.name;
7851
8075
  while (true) {
7852
8076
  const { parent } = root;
7853
- if (!import_compiler34.types.isMemberExpression(parent)) break;
8077
+ if (!import_compiler35.types.isMemberExpression(parent)) break;
7854
8078
  const prop = getMemberExpressionPropString(parent);
7855
8079
  if (prop === void 0) break;
7856
8080
  if (reference.upstreamAlias && reference.excludeProperties !== void 0 && !propsUtil.has(reference.excludeProperties, prop)) {
@@ -8381,9 +8605,9 @@ function getAllTagReferenceNodes(tag, referenceNodes = []) {
8381
8605
  function getScopeAccessorLiteral(binding, includeId) {
8382
8606
  const canonicalBinding = getCanonicalBinding(binding);
8383
8607
  if (isOptimize()) {
8384
- return import_compiler34.types.numericLiteral(canonicalBinding.id);
8608
+ return import_compiler35.types.numericLiteral(canonicalBinding.id);
8385
8609
  }
8386
- return import_compiler34.types.stringLiteral(
8610
+ return import_compiler35.types.stringLiteral(
8387
8611
  canonicalBinding.name + (includeId || canonicalBinding.type === 0 /* dom */ ? `/${canonicalBinding.id}` : "")
8388
8612
  );
8389
8613
  }
@@ -8431,7 +8655,7 @@ function getSectionInstancesAccessor(section) {
8431
8655
  }
8432
8656
  function getSectionInstancesAccessorLiteral(section) {
8433
8657
  const accessor = getSectionInstancesAccessor(section);
8434
- return accessor ? typeof accessor === "number" ? import_compiler34.types.numericLiteral(accessor) : import_compiler34.types.stringLiteral(accessor) : void 0;
8658
+ return accessor ? typeof accessor === "number" ? import_compiler35.types.numericLiteral(accessor) : import_compiler35.types.stringLiteral(accessor) : void 0;
8435
8659
  }
8436
8660
  function getReadReplacement(node) {
8437
8661
  const { extra } = node;
@@ -8449,18 +8673,18 @@ function getReadReplacement(node) {
8449
8673
  if (binding) {
8450
8674
  if (node.type === "Identifier") {
8451
8675
  if (binding.type === 6 /* hoist */) {
8452
- replacement = node.extra?.[kIsInvoked] ? import_compiler34.types.callExpression(getHoistFunctionIdentifier(binding), [
8676
+ replacement = node.extra?.[kIsInvoked] ? import_compiler35.types.callExpression(getHoistFunctionIdentifier(binding), [
8453
8677
  getScopeExpression(node.extra.section, binding.section)
8454
- ]) : import_compiler34.types.identifier(binding.name);
8678
+ ]) : import_compiler35.types.identifier(binding.name);
8455
8679
  } else if (binding.name !== node.name) {
8456
8680
  node.name = binding.name;
8457
8681
  }
8458
8682
  } else {
8459
- replacement = import_compiler34.types.identifier(binding.name);
8683
+ replacement = import_compiler35.types.identifier(binding.name);
8460
8684
  }
8461
8685
  } else if (read) {
8462
8686
  replacement = toMemberExpression(
8463
- import_compiler34.types.identifier(read.binding.name),
8687
+ import_compiler35.types.identifier(read.binding.name),
8464
8688
  Array.isArray(read.props) ? read.props[0] : read.props
8465
8689
  );
8466
8690
  if (Array.isArray(read.props)) {
@@ -8673,7 +8897,7 @@ var await_default = {
8673
8897
  "The [`<await>` tag](https://markojs.com/docs/reference/core-tag#await) requires a [`value=` attribute](https://markojs.com/docs/reference/language#shorthand-value)."
8674
8898
  );
8675
8899
  }
8676
- if (node.attributes.length > 1 || !import_compiler35.types.isMarkoAttribute(valueAttr) || valueAttr.name !== "value") {
8900
+ if (node.attributes.length > 1 || !import_compiler36.types.isMarkoAttribute(valueAttr) || valueAttr.name !== "value") {
8677
8901
  throw tag.get("name").buildCodeFrameError(
8678
8902
  "The [`<await>` tag](https://markojs.com/docs/reference/core-tag#await) only supports the [`value=` attribute](https://markojs.com/docs/reference/language#shorthand-value)."
8679
8903
  );
@@ -8683,7 +8907,7 @@ var await_default = {
8683
8907
  "The [`<await>` tag](https://markojs.com/docs/reference/core-tag#await) requires [content](https://markojs.com/docs/reference/language#tag-content)."
8684
8908
  );
8685
8909
  }
8686
- if (node.body.params.length && (node.body.params.length > 1 || import_compiler35.types.isSpreadElement(node.body.params[0]))) {
8910
+ if (node.body.params.length && (node.body.params.length > 1 || import_compiler36.types.isSpreadElement(node.body.params[0]))) {
8687
8911
  throw tag.get("name").buildCodeFrameError(
8688
8912
  "The [`<await>` tag](https://markojs.com/docs/reference/core-tag#await) only supports a single parameter."
8689
8913
  );
@@ -8720,13 +8944,13 @@ var await_default = {
8720
8944
  flushInto(tag);
8721
8945
  writeHTMLResumeStatements(tagBody);
8722
8946
  tag.replaceWith(
8723
- import_compiler35.types.expressionStatement(
8947
+ import_compiler36.types.expressionStatement(
8724
8948
  callRuntime(
8725
8949
  "_await",
8726
8950
  getScopeIdIdentifier(section),
8727
8951
  getScopeAccessorLiteral(nodeRef),
8728
8952
  valueAttr.value,
8729
- import_compiler35.types.arrowFunctionExpression(
8953
+ import_compiler36.types.arrowFunctionExpression(
8730
8954
  node.body.params,
8731
8955
  toFirstExpressionOrBlock(node.body.body)
8732
8956
  ),
@@ -8760,7 +8984,7 @@ var await_default = {
8760
8984
  return callRuntime(
8761
8985
  "_await",
8762
8986
  getScopeAccessorLiteral(nodeRef),
8763
- import_compiler35.types.identifier(bodySection.name)
8987
+ import_compiler36.types.identifier(bodySection.name)
8764
8988
  );
8765
8989
  };
8766
8990
  addValue(
@@ -8784,7 +9008,7 @@ var await_default = {
8784
9008
  };
8785
9009
 
8786
9010
  // src/translator/core/client.ts
8787
- var import_compiler36 = require("@marko/compiler");
9011
+ var import_compiler37 = require("@marko/compiler");
8788
9012
  var import_babel_utils27 = require("@marko/compiler/babel-utils");
8789
9013
  var client_default = {
8790
9014
  parse(tag) {
@@ -8796,10 +9020,10 @@ var client_default = {
8796
9020
  const code = rawValue.replace(/^client\s*/, "");
8797
9021
  const start = node.start + (rawValue.length - code.length);
8798
9022
  let body = (0, import_babel_utils27.parseStatements)(file, code, start, start + code.length);
8799
- if (body.length === 1 && import_compiler36.types.isBlockStatement(body[0])) {
9023
+ if (body.length === 1 && import_compiler37.types.isBlockStatement(body[0])) {
8800
9024
  body = body[0].body;
8801
9025
  }
8802
- tag.replaceWith(import_compiler36.types.markoScriptlet(body, true, "client"));
9026
+ tag.replaceWith(import_compiler37.types.markoScriptlet(body, true, "client"));
8803
9027
  },
8804
9028
  parseOptions: {
8805
9029
  statement: true,
@@ -8815,7 +9039,7 @@ var client_default = {
8815
9039
  };
8816
9040
 
8817
9041
  // src/translator/core/const.ts
8818
- var import_compiler37 = require("@marko/compiler");
9042
+ var import_compiler38 = require("@marko/compiler");
8819
9043
  var import_babel_utils28 = require("@marko/compiler/babel-utils");
8820
9044
  var const_default = {
8821
9045
  analyze(tag) {
@@ -8834,13 +9058,13 @@ var const_default = {
8834
9058
  "The [`<const>` tag](https://markojs.com/docs/reference/core-tag#const) requires a [`value=` attribute](https://markojs.com/docs/reference/language#shorthand-value)."
8835
9059
  );
8836
9060
  }
8837
- if (node.attributes.length > 1 || !import_compiler37.types.isMarkoAttribute(valueAttr) || !valueAttr.default && valueAttr.name !== "value") {
9061
+ if (node.attributes.length > 1 || !import_compiler38.types.isMarkoAttribute(valueAttr) || !valueAttr.default && valueAttr.name !== "value") {
8838
9062
  throw tag.get("name").buildCodeFrameError(
8839
9063
  "The [`<const>` tag](https://markojs.com/docs/reference/core-tag#const) only supports the [`value=` attribute](https://markojs.com/docs/reference/language#shorthand-value)."
8840
9064
  );
8841
9065
  }
8842
9066
  const valueExtra = evaluate(valueAttr.value);
8843
- const upstreamAlias = import_compiler37.types.isIdentifier(valueAttr.value) ? tag.scope.getBinding(valueAttr.value.name)?.identifier.extra?.binding : void 0;
9067
+ const upstreamAlias = import_compiler38.types.isIdentifier(valueAttr.value) ? tag.scope.getBinding(valueAttr.value.name)?.identifier.extra?.binding : void 0;
8844
9068
  if (upstreamAlias) {
8845
9069
  valueExtra.pruned = true;
8846
9070
  }
@@ -8890,7 +9114,7 @@ var const_default = {
8890
9114
  };
8891
9115
 
8892
9116
  // src/translator/core/debug.ts
8893
- var import_compiler38 = require("@marko/compiler");
9117
+ var import_compiler39 = require("@marko/compiler");
8894
9118
  var import_babel_utils29 = require("@marko/compiler/babel-utils");
8895
9119
  var debug_default = {
8896
9120
  analyze(tag) {
@@ -8899,7 +9123,7 @@ var debug_default = {
8899
9123
  (0, import_babel_utils29.assertNoArgs)(tag);
8900
9124
  (0, import_babel_utils29.assertNoParams)(tag);
8901
9125
  assertNoBodyContent(tag);
8902
- if (tag.node.attributes.length > 1 || tag.node.attributes.length === 1 && (!import_compiler38.types.isMarkoAttribute(valueAttr) || !valueAttr.default && valueAttr.name !== "value")) {
9126
+ if (tag.node.attributes.length > 1 || tag.node.attributes.length === 1 && (!import_compiler39.types.isMarkoAttribute(valueAttr) || !valueAttr.default && valueAttr.name !== "value")) {
8903
9127
  throw tag.get("name").buildCodeFrameError(
8904
9128
  "The [`<debug>` tag](https://markojs.com/docs/reference/core-tag#debug) only supports the [`value=` attribute](https://markojs.com/docs/reference/language#shorthand-value)."
8905
9129
  );
@@ -8910,7 +9134,7 @@ var debug_default = {
8910
9134
  const section = getSection(tag);
8911
9135
  const [valueAttr] = tag.node.attributes;
8912
9136
  const referencedBindings = valueAttr?.value.extra?.referencedBindings;
8913
- const statement = withPreviousLocation(import_compiler38.types.debuggerStatement(), tag.node);
9137
+ const statement = withPreviousLocation(import_compiler39.types.debuggerStatement(), tag.node);
8914
9138
  if (isOutputHTML()) {
8915
9139
  tag.insertBefore(statement);
8916
9140
  } else {
@@ -8933,7 +9157,7 @@ var debug_default = {
8933
9157
  };
8934
9158
 
8935
9159
  // src/translator/core/define.ts
8936
- var import_compiler39 = require("@marko/compiler");
9160
+ var import_compiler40 = require("@marko/compiler");
8937
9161
  var import_babel_utils30 = require("@marko/compiler/babel-utils");
8938
9162
  var define_default = {
8939
9163
  analyze(tag) {
@@ -8953,7 +9177,7 @@ var define_default = {
8953
9177
  trackParamsReferences(tagBody, 3 /* param */);
8954
9178
  setTagDownstream(tag, varBinding);
8955
9179
  if (bodySection) {
8956
- if (import_compiler39.types.isIdentifier(tag.node.var)) {
9180
+ if (import_compiler40.types.isIdentifier(tag.node.var)) {
8957
9181
  const babelBinding = tag.scope.getBinding(tag.node.var.name);
8958
9182
  let allDirectReferences = true;
8959
9183
  for (const ref of babelBinding.referencePaths) {
@@ -8997,7 +9221,7 @@ var define_default = {
8997
9221
  tag.insertBefore(translatedAttrs.statements);
8998
9222
  translateVar(tag, propsToExpression(translatedAttrs.properties));
8999
9223
  } else {
9000
- if (import_compiler39.types.isIdentifier(node.var)) {
9224
+ if (import_compiler40.types.isIdentifier(node.var)) {
9001
9225
  const babelBinding = tag.scope.getBinding(node.var.name);
9002
9226
  let hasDirectReferences = false;
9003
9227
  let allDirectReferences = true;
@@ -9052,7 +9276,7 @@ var define_default = {
9052
9276
  };
9053
9277
 
9054
9278
  // src/translator/core/effect.ts
9055
- var import_compiler40 = require("@marko/compiler");
9279
+ var import_compiler41 = require("@marko/compiler");
9056
9280
  var import_babel_utils31 = require("@marko/compiler/babel-utils");
9057
9281
  var effect_default = {
9058
9282
  migrate: [
@@ -9068,8 +9292,8 @@ var effect_default = {
9068
9292
  fix() {
9069
9293
  const { node } = tag;
9070
9294
  tag.replaceWith(
9071
- import_compiler40.types.markoTag(
9072
- withPreviousLocation(import_compiler40.types.stringLiteral("script"), node.name),
9295
+ import_compiler41.types.markoTag(
9296
+ withPreviousLocation(import_compiler41.types.stringLiteral("script"), node.name),
9073
9297
  node.attributes,
9074
9298
  node.body,
9075
9299
  node.arguments,
@@ -9106,20 +9330,20 @@ var export_default = {
9106
9330
  };
9107
9331
 
9108
9332
  // src/translator/core/html-comment.ts
9109
- var import_compiler42 = require("@marko/compiler");
9333
+ var import_compiler43 = require("@marko/compiler");
9110
9334
  var import_babel_utils33 = require("@marko/compiler/babel-utils");
9111
9335
 
9112
9336
  // src/translator/util/body-to-text-literal.ts
9113
- var import_compiler41 = require("@marko/compiler");
9337
+ var import_compiler42 = require("@marko/compiler");
9114
9338
  function bodyToTextLiteral(body) {
9115
9339
  const templateQuasis = [];
9116
9340
  const templateExpressions = [];
9117
9341
  let currentQuasi = "";
9118
9342
  let placeholderExtra;
9119
9343
  for (const child of body.body) {
9120
- if (import_compiler41.types.isMarkoText(child)) {
9344
+ if (import_compiler42.types.isMarkoText(child)) {
9121
9345
  currentQuasi += child.value;
9122
- } else if (import_compiler41.types.isMarkoPlaceholder(child)) {
9346
+ } else if (import_compiler42.types.isMarkoPlaceholder(child)) {
9123
9347
  placeholderExtra ||= child.value.extra;
9124
9348
  templateQuasis.push(templateElement(currentQuasi, false));
9125
9349
  templateExpressions.push(child.value);
@@ -9128,14 +9352,14 @@ function bodyToTextLiteral(body) {
9128
9352
  }
9129
9353
  if (templateExpressions.length) {
9130
9354
  templateQuasis.push(templateElement(currentQuasi, true));
9131
- const literal = import_compiler41.types.templateLiteral(templateQuasis, templateExpressions);
9355
+ const literal = import_compiler42.types.templateLiteral(templateQuasis, templateExpressions);
9132
9356
  literal.extra = placeholderExtra;
9133
9357
  return literal;
9134
9358
  }
9135
- return import_compiler41.types.stringLiteral(currentQuasi);
9359
+ return import_compiler42.types.stringLiteral(currentQuasi);
9136
9360
  }
9137
9361
  function templateElement(value, tail) {
9138
- return import_compiler41.types.templateElement(
9362
+ return import_compiler42.types.templateElement(
9139
9363
  {
9140
9364
  raw: value.replace(/`/g, "\\`"),
9141
9365
  cooked: value
@@ -9156,7 +9380,7 @@ var html_comment_default = {
9156
9380
  let needsBinding = false;
9157
9381
  let needsGetter = false;
9158
9382
  if (tagVar) {
9159
- if (!import_compiler42.types.isIdentifier(tagVar)) {
9383
+ if (!import_compiler43.types.isIdentifier(tagVar)) {
9160
9384
  throw tag.get("var").buildCodeFrameError(
9161
9385
  "The [`<html-comment>` tag](https://markojs.com/docs/reference/core-tag#html-comment) tag variable cannot be destructured."
9162
9386
  );
@@ -9208,7 +9432,7 @@ var html_comment_default = {
9208
9432
  callRuntime(
9209
9433
  "_el",
9210
9434
  getterId && getScopeIdIdentifier(getSection(tag)),
9211
- getterId && import_compiler42.types.stringLiteral(getterId)
9435
+ getterId && import_compiler43.types.stringLiteral(getterId)
9212
9436
  )
9213
9437
  );
9214
9438
  } else {
@@ -9218,12 +9442,12 @@ var html_comment_default = {
9218
9442
  if (getterId) {
9219
9443
  getterFnIdentifier = generateUidIdentifier(`get_${varName}`);
9220
9444
  (0, import_babel_utils33.getProgram)().node.body.push(
9221
- import_compiler42.types.variableDeclaration("const", [
9222
- import_compiler42.types.variableDeclarator(
9445
+ import_compiler43.types.variableDeclaration("const", [
9446
+ import_compiler43.types.variableDeclarator(
9223
9447
  getterFnIdentifier,
9224
9448
  callRuntime(
9225
9449
  "_el",
9226
- import_compiler42.types.stringLiteral(getterId),
9450
+ import_compiler43.types.stringLiteral(getterId),
9227
9451
  getScopeAccessorLiteral(nodeBinding)
9228
9452
  )
9229
9453
  )
@@ -9234,13 +9458,13 @@ var html_comment_default = {
9234
9458
  const referenceSection = getSection(reference);
9235
9459
  if (isInvokedFunction(reference)) {
9236
9460
  reference.parentPath.replaceWith(
9237
- import_compiler42.types.expressionStatement(
9461
+ import_compiler43.types.expressionStatement(
9238
9462
  createScopeReadExpression(referenceSection, nodeBinding)
9239
9463
  )
9240
9464
  );
9241
9465
  } else if (getterFnIdentifier) {
9242
9466
  reference.replaceWith(
9243
- import_compiler42.types.callExpression(getterFnIdentifier, [
9467
+ import_compiler43.types.callExpression(getterFnIdentifier, [
9244
9468
  getScopeExpression(referenceSection, getSection(tag))
9245
9469
  ])
9246
9470
  );
@@ -9261,25 +9485,25 @@ var html_comment_default = {
9261
9485
  const write = writeTo(tag);
9262
9486
  if (isOutputHTML()) {
9263
9487
  for (const child of tag.node.body.body) {
9264
- if (import_compiler42.types.isMarkoText(child)) {
9488
+ if (import_compiler43.types.isMarkoText(child)) {
9265
9489
  write`${child.value}`;
9266
- } else if (import_compiler42.types.isMarkoPlaceholder(child)) {
9490
+ } else if (import_compiler43.types.isMarkoPlaceholder(child)) {
9267
9491
  write`${callRuntime("_escape", child.value)}`;
9268
9492
  }
9269
9493
  }
9270
9494
  } else {
9271
9495
  const textLiteral = bodyToTextLiteral(tag.node.body);
9272
- if (import_compiler42.types.isStringLiteral(textLiteral)) {
9496
+ if (import_compiler43.types.isStringLiteral(textLiteral)) {
9273
9497
  write`${textLiteral}`;
9274
9498
  } else {
9275
9499
  addStatement(
9276
9500
  "render",
9277
9501
  getSection(tag),
9278
9502
  tagExtra.referencedBindings,
9279
- import_compiler42.types.expressionStatement(
9503
+ import_compiler43.types.expressionStatement(
9280
9504
  callRuntime(
9281
9505
  "_text",
9282
- import_compiler42.types.memberExpression(
9506
+ import_compiler43.types.memberExpression(
9283
9507
  scopeIdentifier,
9284
9508
  getScopeAccessorLiteral(nodeBinding),
9285
9509
  true
@@ -9315,7 +9539,7 @@ var html_comment_default = {
9315
9539
  };
9316
9540
 
9317
9541
  // src/translator/core/html-script.ts
9318
- var import_compiler43 = require("@marko/compiler");
9542
+ var import_compiler44 = require("@marko/compiler");
9319
9543
  var import_babel_utils34 = require("@marko/compiler/babel-utils");
9320
9544
  var kNodeBinding2 = Symbol("script tag node binding");
9321
9545
  var kGetterId3 = Symbol("node getter id");
@@ -9324,7 +9548,7 @@ var html_script_default = {
9324
9548
  (0, import_babel_utils34.assertNoArgs)(tag);
9325
9549
  (0, import_babel_utils34.assertNoParams)(tag);
9326
9550
  const { node } = tag;
9327
- if (node.var && !import_compiler43.types.isIdentifier(node.var)) {
9551
+ if (node.var && !import_compiler44.types.isIdentifier(node.var)) {
9328
9552
  throw tag.get("var").buildCodeFrameError(
9329
9553
  "Tag variables on native elements cannot be destructured."
9330
9554
  );
@@ -9338,7 +9562,7 @@ var html_script_default = {
9338
9562
  for (let i = attributes.length; i--; ) {
9339
9563
  const attr = attributes[i];
9340
9564
  const valueExtra = attr.value.extra ??= {};
9341
- if (import_compiler43.types.isMarkoAttribute(attr)) {
9565
+ if (import_compiler44.types.isMarkoAttribute(attr)) {
9342
9566
  if (seen[attr.name]) {
9343
9567
  dropReferences(attr.value);
9344
9568
  continue;
@@ -9350,14 +9574,14 @@ var html_script_default = {
9350
9574
  } else if (!evaluate(attr.value).confident) {
9351
9575
  hasDynamicAttributes = true;
9352
9576
  }
9353
- } else if (import_compiler43.types.isMarkoSpreadAttribute(attr)) {
9577
+ } else if (import_compiler44.types.isMarkoSpreadAttribute(attr)) {
9354
9578
  valueExtra.isEffect = true;
9355
9579
  hasEventHandlers = true;
9356
9580
  hasDynamicAttributes = true;
9357
9581
  }
9358
9582
  if (spreadReferenceNodes) {
9359
9583
  spreadReferenceNodes.push(attr.value);
9360
- } else if (import_compiler43.types.isMarkoSpreadAttribute(attr)) {
9584
+ } else if (import_compiler44.types.isMarkoSpreadAttribute(attr)) {
9361
9585
  spreadReferenceNodes = [attr.value];
9362
9586
  } else {
9363
9587
  exprExtras = push(exprExtras, valueExtra);
@@ -9366,10 +9590,10 @@ var html_script_default = {
9366
9590
  const bodyPlaceholderNodes = [];
9367
9591
  let hasBodyPlaceholders = false;
9368
9592
  for (const child of tag.node.body.body) {
9369
- if (import_compiler43.types.isMarkoPlaceholder(child)) {
9593
+ if (import_compiler44.types.isMarkoPlaceholder(child)) {
9370
9594
  bodyPlaceholderNodes.push(child.value);
9371
9595
  hasBodyPlaceholders = true;
9372
- } else if (!import_compiler43.types.isMarkoText(child)) {
9596
+ } else if (!import_compiler44.types.isMarkoText(child)) {
9373
9597
  throw tag.hub.buildError(
9374
9598
  child,
9375
9599
  "Invalid child. Only text is allowed inside an html-script."
@@ -9438,7 +9662,7 @@ var html_script_default = {
9438
9662
  callRuntime(
9439
9663
  "_el",
9440
9664
  getterId && getScopeIdIdentifier(tagSection),
9441
- getterId && import_compiler43.types.stringLiteral(getterId)
9665
+ getterId && import_compiler44.types.stringLiteral(getterId)
9442
9666
  )
9443
9667
  );
9444
9668
  } else {
@@ -9448,12 +9672,12 @@ var html_script_default = {
9448
9672
  if (getterId) {
9449
9673
  getterFnIdentifier = generateUidIdentifier(`get_${varName}`);
9450
9674
  (0, import_babel_utils34.getProgram)().node.body.push(
9451
- import_compiler43.types.variableDeclaration("const", [
9452
- import_compiler43.types.variableDeclarator(
9675
+ import_compiler44.types.variableDeclaration("const", [
9676
+ import_compiler44.types.variableDeclarator(
9453
9677
  getterFnIdentifier,
9454
9678
  callRuntime(
9455
9679
  "_el",
9456
- import_compiler43.types.stringLiteral(getterId),
9680
+ import_compiler44.types.stringLiteral(getterId),
9457
9681
  getScopeAccessorLiteral(nodeBinding)
9458
9682
  )
9459
9683
  )
@@ -9464,13 +9688,13 @@ var html_script_default = {
9464
9688
  const referenceSection = getSection(reference);
9465
9689
  if (isInvokedFunction(reference)) {
9466
9690
  reference.parentPath.replaceWith(
9467
- import_compiler43.types.expressionStatement(
9691
+ import_compiler44.types.expressionStatement(
9468
9692
  createScopeReadExpression(referenceSection, nodeBinding)
9469
9693
  )
9470
9694
  );
9471
9695
  } else if (getterFnIdentifier) {
9472
9696
  reference.replaceWith(
9473
- import_compiler43.types.callExpression(getterFnIdentifier, [
9697
+ import_compiler44.types.callExpression(getterFnIdentifier, [
9474
9698
  getScopeExpression(referenceSection, getSection(tag))
9475
9699
  ])
9476
9700
  );
@@ -9502,10 +9726,10 @@ var html_script_default = {
9502
9726
  "render",
9503
9727
  tagSection,
9504
9728
  valueReferences,
9505
- import_compiler43.types.expressionStatement(
9729
+ import_compiler44.types.expressionStatement(
9506
9730
  callRuntime(
9507
9731
  helper,
9508
- import_compiler43.types.memberExpression(scopeIdentifier, visitAccessor, true),
9732
+ import_compiler44.types.memberExpression(scopeIdentifier, visitAccessor, true),
9509
9733
  value
9510
9734
  )
9511
9735
  )
@@ -9520,18 +9744,18 @@ var html_script_default = {
9520
9744
  if (isEventHandler(name2)) {
9521
9745
  addHTMLEffectCall(tagSection, valueReferences);
9522
9746
  } else {
9523
- write`${callRuntime("_attr", import_compiler43.types.stringLiteral(name2), value)}`;
9747
+ write`${callRuntime("_attr", import_compiler44.types.stringLiteral(name2), value)}`;
9524
9748
  }
9525
9749
  } else if (isEventHandler(name2)) {
9526
9750
  addStatement(
9527
9751
  "effect",
9528
9752
  tagSection,
9529
9753
  valueReferences,
9530
- import_compiler43.types.expressionStatement(
9754
+ import_compiler44.types.expressionStatement(
9531
9755
  callRuntime(
9532
9756
  "_on",
9533
- import_compiler43.types.memberExpression(scopeIdentifier, visitAccessor, true),
9534
- import_compiler43.types.stringLiteral(getEventHandlerName(name2)),
9757
+ import_compiler44.types.memberExpression(scopeIdentifier, visitAccessor, true),
9758
+ import_compiler44.types.stringLiteral(getEventHandlerName(name2)),
9535
9759
  value
9536
9760
  )
9537
9761
  )
@@ -9541,11 +9765,11 @@ var html_script_default = {
9541
9765
  "render",
9542
9766
  tagSection,
9543
9767
  valueReferences,
9544
- import_compiler43.types.expressionStatement(
9768
+ import_compiler44.types.expressionStatement(
9545
9769
  callRuntime(
9546
9770
  "_attr",
9547
- import_compiler43.types.memberExpression(scopeIdentifier, visitAccessor, true),
9548
- import_compiler43.types.stringLiteral(name2),
9771
+ import_compiler44.types.memberExpression(scopeIdentifier, visitAccessor, true),
9772
+ import_compiler44.types.stringLiteral(name2),
9549
9773
  value
9550
9774
  )
9551
9775
  )
@@ -9558,9 +9782,9 @@ var html_script_default = {
9558
9782
  if (isHTML) {
9559
9783
  addHTMLEffectCall(tagSection, tagExtra.referencedBindings);
9560
9784
  if (skipExpression) {
9561
- write`${callRuntime("_attrs_partial", spreadExpression, skipExpression, visitAccessor, getScopeIdIdentifier(tagSection), import_compiler43.types.stringLiteral("script"))}`;
9785
+ write`${callRuntime("_attrs_partial", spreadExpression, skipExpression, visitAccessor, getScopeIdIdentifier(tagSection), import_compiler44.types.stringLiteral("script"))}`;
9562
9786
  } else {
9563
- write`${callRuntime("_attrs", spreadExpression, visitAccessor, getScopeIdIdentifier(tagSection), import_compiler43.types.stringLiteral("script"))}`;
9787
+ write`${callRuntime("_attrs", spreadExpression, visitAccessor, getScopeIdIdentifier(tagSection), import_compiler44.types.stringLiteral("script"))}`;
9564
9788
  }
9565
9789
  } else {
9566
9790
  if (skipExpression) {
@@ -9568,7 +9792,7 @@ var html_script_default = {
9568
9792
  "render",
9569
9793
  tagSection,
9570
9794
  tagExtra.referencedBindings,
9571
- import_compiler43.types.expressionStatement(
9795
+ import_compiler44.types.expressionStatement(
9572
9796
  callRuntime(
9573
9797
  "_attrs_partial",
9574
9798
  scopeIdentifier,
@@ -9583,7 +9807,7 @@ var html_script_default = {
9583
9807
  "render",
9584
9808
  tagSection,
9585
9809
  tagExtra.referencedBindings,
9586
- import_compiler43.types.expressionStatement(
9810
+ import_compiler44.types.expressionStatement(
9587
9811
  callRuntime(
9588
9812
  "_attrs",
9589
9813
  scopeIdentifier,
@@ -9597,7 +9821,7 @@ var html_script_default = {
9597
9821
  "effect",
9598
9822
  tagSection,
9599
9823
  tagExtra.referencedBindings,
9600
- import_compiler43.types.expressionStatement(
9824
+ import_compiler44.types.expressionStatement(
9601
9825
  callRuntime("_attrs_script", scopeIdentifier, visitAccessor)
9602
9826
  ),
9603
9827
  false
@@ -9614,25 +9838,25 @@ var html_script_default = {
9614
9838
  const write = writeTo(tag);
9615
9839
  if (isOutputHTML()) {
9616
9840
  for (const child of tag.node.body.body) {
9617
- if (import_compiler43.types.isMarkoText(child)) {
9841
+ if (import_compiler44.types.isMarkoText(child)) {
9618
9842
  write`${child.value}`;
9619
- } else if (import_compiler43.types.isMarkoPlaceholder(child)) {
9843
+ } else if (import_compiler44.types.isMarkoPlaceholder(child)) {
9620
9844
  write`${callRuntime("_escape_script", child.value)}`;
9621
9845
  }
9622
9846
  }
9623
9847
  } else {
9624
9848
  const textLiteral = bodyToTextLiteral(tag.node.body);
9625
- if (import_compiler43.types.isStringLiteral(textLiteral)) {
9849
+ if (import_compiler44.types.isStringLiteral(textLiteral)) {
9626
9850
  write`${textLiteral.value}`;
9627
9851
  } else {
9628
9852
  addStatement(
9629
9853
  "render",
9630
9854
  getSection(tag),
9631
9855
  textLiteral.extra?.referencedBindings,
9632
- import_compiler43.types.expressionStatement(
9856
+ import_compiler44.types.expressionStatement(
9633
9857
  callRuntime(
9634
9858
  "_text_content",
9635
- import_compiler43.types.memberExpression(
9859
+ import_compiler44.types.memberExpression(
9636
9860
  scopeIdentifier,
9637
9861
  getScopeAccessorLiteral(nodeBinding),
9638
9862
  true
@@ -9687,11 +9911,11 @@ function getUsedAttrs2(tag) {
9687
9911
  for (let i = attributes.length; i--; ) {
9688
9912
  const attr = attributes[i];
9689
9913
  const { value } = attr;
9690
- if (import_compiler43.types.isMarkoSpreadAttribute(attr)) {
9914
+ if (import_compiler44.types.isMarkoSpreadAttribute(attr)) {
9691
9915
  if (!spreadProps) {
9692
9916
  spreadProps = [];
9693
9917
  }
9694
- spreadProps.push(import_compiler43.types.spreadElement(value));
9918
+ spreadProps.push(import_compiler44.types.spreadElement(value));
9695
9919
  } else if (!seen[attr.name]) {
9696
9920
  seen[attr.name] = attr;
9697
9921
  if (spreadProps) {
@@ -9705,10 +9929,10 @@ function getUsedAttrs2(tag) {
9705
9929
  if (spreadProps) {
9706
9930
  spreadProps.reverse();
9707
9931
  for (const { name: name2 } of staticAttrs) {
9708
- (skipProps ||= []).push(toObjectProperty(name2, import_compiler43.types.numericLiteral(1)));
9932
+ (skipProps ||= []).push(toObjectProperty(name2, import_compiler44.types.numericLiteral(1)));
9709
9933
  }
9710
9934
  if (skipProps) {
9711
- skipExpression = import_compiler43.types.objectExpression(skipProps);
9935
+ skipExpression = import_compiler44.types.objectExpression(skipProps);
9712
9936
  }
9713
9937
  spreadExpression = propsToExpression(spreadProps);
9714
9938
  }
@@ -9720,7 +9944,7 @@ function getUsedAttrs2(tag) {
9720
9944
  }
9721
9945
 
9722
9946
  // src/translator/core/html-style.ts
9723
- var import_compiler44 = require("@marko/compiler");
9947
+ var import_compiler45 = require("@marko/compiler");
9724
9948
  var import_babel_utils35 = require("@marko/compiler/babel-utils");
9725
9949
  var kNodeBinding3 = Symbol("style tag node binding");
9726
9950
  var kGetterId4 = Symbol("node getter id");
@@ -9729,7 +9953,7 @@ var html_style_default = {
9729
9953
  (0, import_babel_utils35.assertNoArgs)(tag);
9730
9954
  (0, import_babel_utils35.assertNoParams)(tag);
9731
9955
  const { node } = tag;
9732
- if (node.var && !import_compiler44.types.isIdentifier(node.var)) {
9956
+ if (node.var && !import_compiler45.types.isIdentifier(node.var)) {
9733
9957
  throw tag.get("var").buildCodeFrameError(
9734
9958
  "Tag variables on native elements cannot be destructured."
9735
9959
  );
@@ -9743,7 +9967,7 @@ var html_style_default = {
9743
9967
  for (let i = attributes.length; i--; ) {
9744
9968
  const attr = attributes[i];
9745
9969
  const valueExtra = attr.value.extra ??= {};
9746
- if (import_compiler44.types.isMarkoAttribute(attr)) {
9970
+ if (import_compiler45.types.isMarkoAttribute(attr)) {
9747
9971
  if (seen[attr.name]) {
9748
9972
  dropReferences(attr.value);
9749
9973
  continue;
@@ -9755,14 +9979,14 @@ var html_style_default = {
9755
9979
  } else if (!evaluate(attr.value).confident) {
9756
9980
  hasDynamicAttributes = true;
9757
9981
  }
9758
- } else if (import_compiler44.types.isMarkoSpreadAttribute(attr)) {
9982
+ } else if (import_compiler45.types.isMarkoSpreadAttribute(attr)) {
9759
9983
  valueExtra.isEffect = true;
9760
9984
  hasEventHandlers = true;
9761
9985
  hasDynamicAttributes = true;
9762
9986
  }
9763
9987
  if (spreadReferenceNodes) {
9764
9988
  spreadReferenceNodes.push(attr.value);
9765
- } else if (import_compiler44.types.isMarkoSpreadAttribute(attr)) {
9989
+ } else if (import_compiler45.types.isMarkoSpreadAttribute(attr)) {
9766
9990
  spreadReferenceNodes = [attr.value];
9767
9991
  } else {
9768
9992
  exprExtras = push(exprExtras, valueExtra);
@@ -9771,10 +9995,10 @@ var html_style_default = {
9771
9995
  const bodyPlaceholderNodes = [];
9772
9996
  let hasBodyPlaceholders = false;
9773
9997
  for (const child of tag.node.body.body) {
9774
- if (import_compiler44.types.isMarkoPlaceholder(child)) {
9998
+ if (import_compiler45.types.isMarkoPlaceholder(child)) {
9775
9999
  bodyPlaceholderNodes.push(child.value);
9776
10000
  hasBodyPlaceholders = true;
9777
- } else if (!import_compiler44.types.isMarkoText(child)) {
10001
+ } else if (!import_compiler45.types.isMarkoText(child)) {
9778
10002
  throw tag.hub.buildError(
9779
10003
  child,
9780
10004
  "Invalid child. Only text is allowed inside an html-style."
@@ -9843,7 +10067,7 @@ var html_style_default = {
9843
10067
  callRuntime(
9844
10068
  "_el",
9845
10069
  getterId && getScopeIdIdentifier(tagSection),
9846
- getterId && import_compiler44.types.stringLiteral(getterId)
10070
+ getterId && import_compiler45.types.stringLiteral(getterId)
9847
10071
  )
9848
10072
  );
9849
10073
  } else {
@@ -9853,12 +10077,12 @@ var html_style_default = {
9853
10077
  if (getterId) {
9854
10078
  getterFnIdentifier = generateUidIdentifier(`get_${varName}`);
9855
10079
  (0, import_babel_utils35.getProgram)().node.body.push(
9856
- import_compiler44.types.variableDeclaration("const", [
9857
- import_compiler44.types.variableDeclarator(
10080
+ import_compiler45.types.variableDeclaration("const", [
10081
+ import_compiler45.types.variableDeclarator(
9858
10082
  getterFnIdentifier,
9859
10083
  callRuntime(
9860
10084
  "_el",
9861
- import_compiler44.types.stringLiteral(getterId),
10085
+ import_compiler45.types.stringLiteral(getterId),
9862
10086
  getScopeAccessorLiteral(nodeBinding)
9863
10087
  )
9864
10088
  )
@@ -9869,13 +10093,13 @@ var html_style_default = {
9869
10093
  const referenceSection = getSection(reference);
9870
10094
  if (isInvokedFunction(reference)) {
9871
10095
  reference.parentPath.replaceWith(
9872
- import_compiler44.types.expressionStatement(
10096
+ import_compiler45.types.expressionStatement(
9873
10097
  createScopeReadExpression(referenceSection, nodeBinding)
9874
10098
  )
9875
10099
  );
9876
10100
  } else if (getterFnIdentifier) {
9877
10101
  reference.replaceWith(
9878
- import_compiler44.types.callExpression(getterFnIdentifier, [
10102
+ import_compiler45.types.callExpression(getterFnIdentifier, [
9879
10103
  getScopeExpression(referenceSection, getSection(tag))
9880
10104
  ])
9881
10105
  );
@@ -9907,10 +10131,10 @@ var html_style_default = {
9907
10131
  "render",
9908
10132
  tagSection,
9909
10133
  valueReferences,
9910
- import_compiler44.types.expressionStatement(
10134
+ import_compiler45.types.expressionStatement(
9911
10135
  callRuntime(
9912
10136
  helper,
9913
- import_compiler44.types.memberExpression(scopeIdentifier, visitAccessor, true),
10137
+ import_compiler45.types.memberExpression(scopeIdentifier, visitAccessor, true),
9914
10138
  value
9915
10139
  )
9916
10140
  )
@@ -9925,18 +10149,18 @@ var html_style_default = {
9925
10149
  if (isEventHandler(name2)) {
9926
10150
  addHTMLEffectCall(tagSection, valueReferences);
9927
10151
  } else {
9928
- write`${callRuntime("_attr", import_compiler44.types.stringLiteral(name2), value)}`;
10152
+ write`${callRuntime("_attr", import_compiler45.types.stringLiteral(name2), value)}`;
9929
10153
  }
9930
10154
  } else if (isEventHandler(name2)) {
9931
10155
  addStatement(
9932
10156
  "effect",
9933
10157
  tagSection,
9934
10158
  valueReferences,
9935
- import_compiler44.types.expressionStatement(
10159
+ import_compiler45.types.expressionStatement(
9936
10160
  callRuntime(
9937
10161
  "_on",
9938
- import_compiler44.types.memberExpression(scopeIdentifier, visitAccessor, true),
9939
- import_compiler44.types.stringLiteral(getEventHandlerName(name2)),
10162
+ import_compiler45.types.memberExpression(scopeIdentifier, visitAccessor, true),
10163
+ import_compiler45.types.stringLiteral(getEventHandlerName(name2)),
9940
10164
  value
9941
10165
  )
9942
10166
  )
@@ -9946,11 +10170,11 @@ var html_style_default = {
9946
10170
  "render",
9947
10171
  tagSection,
9948
10172
  valueReferences,
9949
- import_compiler44.types.expressionStatement(
10173
+ import_compiler45.types.expressionStatement(
9950
10174
  callRuntime(
9951
10175
  "_attr",
9952
- import_compiler44.types.memberExpression(scopeIdentifier, visitAccessor, true),
9953
- import_compiler44.types.stringLiteral(name2),
10176
+ import_compiler45.types.memberExpression(scopeIdentifier, visitAccessor, true),
10177
+ import_compiler45.types.stringLiteral(name2),
9954
10178
  value
9955
10179
  )
9956
10180
  )
@@ -9963,9 +10187,9 @@ var html_style_default = {
9963
10187
  if (isHTML) {
9964
10188
  addHTMLEffectCall(tagSection, tagExtra.referencedBindings);
9965
10189
  if (skipExpression) {
9966
- write`${callRuntime("_attrs_partial", spreadExpression, skipExpression, visitAccessor, getScopeIdIdentifier(tagSection), import_compiler44.types.stringLiteral("style"))}`;
10190
+ write`${callRuntime("_attrs_partial", spreadExpression, skipExpression, visitAccessor, getScopeIdIdentifier(tagSection), import_compiler45.types.stringLiteral("style"))}`;
9967
10191
  } else {
9968
- write`${callRuntime("_attrs", spreadExpression, visitAccessor, getScopeIdIdentifier(tagSection), import_compiler44.types.stringLiteral("style"))}`;
10192
+ write`${callRuntime("_attrs", spreadExpression, visitAccessor, getScopeIdIdentifier(tagSection), import_compiler45.types.stringLiteral("style"))}`;
9969
10193
  }
9970
10194
  } else {
9971
10195
  if (skipExpression) {
@@ -9973,7 +10197,7 @@ var html_style_default = {
9973
10197
  "render",
9974
10198
  tagSection,
9975
10199
  tagExtra.referencedBindings,
9976
- import_compiler44.types.expressionStatement(
10200
+ import_compiler45.types.expressionStatement(
9977
10201
  callRuntime(
9978
10202
  "_attrs_partial",
9979
10203
  scopeIdentifier,
@@ -9988,7 +10212,7 @@ var html_style_default = {
9988
10212
  "render",
9989
10213
  tagSection,
9990
10214
  tagExtra.referencedBindings,
9991
- import_compiler44.types.expressionStatement(
10215
+ import_compiler45.types.expressionStatement(
9992
10216
  callRuntime(
9993
10217
  "_attrs",
9994
10218
  scopeIdentifier,
@@ -10002,7 +10226,7 @@ var html_style_default = {
10002
10226
  "effect",
10003
10227
  tagSection,
10004
10228
  tagExtra.referencedBindings,
10005
- import_compiler44.types.expressionStatement(
10229
+ import_compiler45.types.expressionStatement(
10006
10230
  callRuntime("_attrs_script", scopeIdentifier, visitAccessor)
10007
10231
  ),
10008
10232
  false
@@ -10019,25 +10243,25 @@ var html_style_default = {
10019
10243
  const write = writeTo(tag);
10020
10244
  if (isOutputHTML()) {
10021
10245
  for (const child of tag.node.body.body) {
10022
- if (import_compiler44.types.isMarkoText(child)) {
10246
+ if (import_compiler45.types.isMarkoText(child)) {
10023
10247
  write`${child.value}`;
10024
- } else if (import_compiler44.types.isMarkoPlaceholder(child)) {
10248
+ } else if (import_compiler45.types.isMarkoPlaceholder(child)) {
10025
10249
  write`${callRuntime("_escape_style", child.value)}`;
10026
10250
  }
10027
10251
  }
10028
10252
  } else {
10029
10253
  const textLiteral = bodyToTextLiteral(tag.node.body);
10030
- if (import_compiler44.types.isStringLiteral(textLiteral)) {
10254
+ if (import_compiler45.types.isStringLiteral(textLiteral)) {
10031
10255
  write`${textLiteral}`;
10032
10256
  } else {
10033
10257
  addStatement(
10034
10258
  "render",
10035
10259
  getSection(tag),
10036
10260
  textLiteral.extra?.referencedBindings,
10037
- import_compiler44.types.expressionStatement(
10261
+ import_compiler45.types.expressionStatement(
10038
10262
  callRuntime(
10039
10263
  "_text_content",
10040
- import_compiler44.types.memberExpression(
10264
+ import_compiler45.types.memberExpression(
10041
10265
  scopeIdentifier,
10042
10266
  getScopeAccessorLiteral(nodeBinding),
10043
10267
  true
@@ -10087,11 +10311,11 @@ function getUsedAttrs3(tag) {
10087
10311
  for (let i = attributes.length; i--; ) {
10088
10312
  const attr = attributes[i];
10089
10313
  const { value } = attr;
10090
- if (import_compiler44.types.isMarkoSpreadAttribute(attr)) {
10314
+ if (import_compiler45.types.isMarkoSpreadAttribute(attr)) {
10091
10315
  if (!spreadProps) {
10092
10316
  spreadProps = [];
10093
10317
  }
10094
- spreadProps.push(import_compiler44.types.spreadElement(value));
10318
+ spreadProps.push(import_compiler45.types.spreadElement(value));
10095
10319
  } else if (!seen[attr.name]) {
10096
10320
  seen[attr.name] = attr;
10097
10321
  if (spreadProps) {
@@ -10105,10 +10329,10 @@ function getUsedAttrs3(tag) {
10105
10329
  if (spreadProps) {
10106
10330
  spreadProps.reverse();
10107
10331
  for (const { name: name2 } of staticAttrs) {
10108
- (skipProps ||= []).push(toObjectProperty(name2, import_compiler44.types.numericLiteral(1)));
10332
+ (skipProps ||= []).push(toObjectProperty(name2, import_compiler45.types.numericLiteral(1)));
10109
10333
  }
10110
10334
  if (skipProps) {
10111
- skipExpression = import_compiler44.types.objectExpression(skipProps);
10335
+ skipExpression = import_compiler45.types.objectExpression(skipProps);
10112
10336
  }
10113
10337
  spreadExpression = propsToExpression(spreadProps);
10114
10338
  }
@@ -10120,7 +10344,7 @@ function getUsedAttrs3(tag) {
10120
10344
  }
10121
10345
 
10122
10346
  // src/translator/core/id.ts
10123
- var import_compiler45 = require("@marko/compiler");
10347
+ var import_compiler46 = require("@marko/compiler");
10124
10348
  var import_babel_utils36 = require("@marko/compiler/babel-utils");
10125
10349
  var id_default = {
10126
10350
  analyze(tag) {
@@ -10135,12 +10359,12 @@ var id_default = {
10135
10359
  "The [`<id>` tag](https://markojs.com/docs/reference/core-tag#id) requires a [tag variable](https://markojs.com/docs/reference/language#tag-variables)."
10136
10360
  );
10137
10361
  }
10138
- if (!import_compiler45.types.isIdentifier(node.var)) {
10362
+ if (!import_compiler46.types.isIdentifier(node.var)) {
10139
10363
  throw tag.get("var").buildCodeFrameError(
10140
10364
  "The [`<id>` tag](https://markojs.com/docs/reference/core-tag#id) cannot be destructured."
10141
10365
  );
10142
10366
  }
10143
- if (tag.node.attributes.length > 1 || tag.node.attributes.length === 1 && (!import_compiler45.types.isMarkoAttribute(valueAttr) || !valueAttr.default && valueAttr.name !== "value")) {
10367
+ if (tag.node.attributes.length > 1 || tag.node.attributes.length === 1 && (!import_compiler46.types.isMarkoAttribute(valueAttr) || !valueAttr.default && valueAttr.name !== "value")) {
10144
10368
  throw tag.get("name").buildCodeFrameError(
10145
10369
  "The [`<id>` tag](https://markojs.com/docs/reference/core-tag#id) only supports the [`value=` attribute](https://markojs.com/docs/reference/language#shorthand-value)."
10146
10370
  );
@@ -10157,10 +10381,10 @@ var id_default = {
10157
10381
  const [valueAttr] = tag.node.attributes;
10158
10382
  if (isOutputHTML()) {
10159
10383
  tag.replaceWith(
10160
- import_compiler45.types.variableDeclaration("const", [
10161
- import_compiler45.types.variableDeclarator(
10384
+ import_compiler46.types.variableDeclaration("const", [
10385
+ import_compiler46.types.variableDeclarator(
10162
10386
  node.var,
10163
- valueAttr ? import_compiler45.types.logicalExpression("||", valueAttr.value, id) : id
10387
+ valueAttr ? import_compiler46.types.logicalExpression("||", valueAttr.value, id) : id
10164
10388
  )
10165
10389
  ])
10166
10390
  );
@@ -10173,7 +10397,7 @@ var id_default = {
10173
10397
  section,
10174
10398
  value.extra?.referencedBindings,
10175
10399
  source,
10176
- import_compiler45.types.logicalExpression("||", value, id)
10400
+ import_compiler46.types.logicalExpression("||", value, id)
10177
10401
  );
10178
10402
  } else {
10179
10403
  addValue(section, void 0, source, id);
@@ -10198,17 +10422,17 @@ var id_default = {
10198
10422
  };
10199
10423
 
10200
10424
  // src/translator/core/if.ts
10201
- var import_compiler47 = require("@marko/compiler");
10425
+ var import_compiler48 = require("@marko/compiler");
10202
10426
  var import_babel_utils37 = require("@marko/compiler/babel-utils");
10203
10427
 
10204
10428
  // src/translator/util/to-first-statement-or-block.ts
10205
- var import_compiler46 = require("@marko/compiler");
10429
+ var import_compiler47 = require("@marko/compiler");
10206
10430
  function toFirstStatementOrBlock(body) {
10207
10431
  if (Array.isArray(body)) {
10208
10432
  if (body.length === 1) {
10209
10433
  return body[0];
10210
10434
  }
10211
- return import_compiler46.types.blockStatement(body);
10435
+ return import_compiler47.types.blockStatement(body);
10212
10436
  }
10213
10437
  return body;
10214
10438
  }
@@ -10316,14 +10540,14 @@ var IfTag = {
10316
10540
  }
10317
10541
  }
10318
10542
  bodyStatements.push(
10319
- import_compiler47.types.returnStatement(import_compiler47.types.numericLiteral(i))
10543
+ import_compiler48.types.returnStatement(import_compiler48.types.numericLiteral(i))
10320
10544
  );
10321
10545
  }
10322
10546
  }
10323
10547
  const [testAttr] = branchTag.node.attributes;
10324
10548
  const curStatement = toFirstStatementOrBlock(bodyStatements);
10325
10549
  if (testAttr) {
10326
- statement = import_compiler47.types.ifStatement(
10550
+ statement = import_compiler48.types.ifStatement(
10327
10551
  testAttr.value,
10328
10552
  curStatement,
10329
10553
  statement
@@ -10348,11 +10572,11 @@ var IfTag = {
10348
10572
  markerSerializeReason,
10349
10573
  !statefulSerializeArg
10350
10574
  );
10351
- const cbNode = import_compiler47.types.arrowFunctionExpression(
10575
+ const cbNode = import_compiler48.types.arrowFunctionExpression(
10352
10576
  [],
10353
- import_compiler47.types.blockStatement([statement])
10577
+ import_compiler48.types.blockStatement([statement])
10354
10578
  );
10355
- statement = import_compiler47.types.expressionStatement(
10579
+ statement = import_compiler48.types.expressionStatement(
10356
10580
  callRuntime(
10357
10581
  "_if",
10358
10582
  cbNode,
@@ -10365,8 +10589,8 @@ var IfTag = {
10365
10589
  ),
10366
10590
  markerSerializeArg,
10367
10591
  statefulSerializeArg,
10368
- skipParentEnd ? import_compiler47.types.stringLiteral(`</${onlyChildParentTagName}>`) : singleNodeOptimization ? import_compiler47.types.numericLiteral(0) : void 0,
10369
- singleNodeOptimization ? import_compiler47.types.numericLiteral(1) : void 0
10592
+ skipParentEnd ? import_compiler48.types.stringLiteral(`</${onlyChildParentTagName}>`) : singleNodeOptimization ? import_compiler48.types.numericLiteral(0) : void 0,
10593
+ singleNodeOptimization ? import_compiler48.types.numericLiteral(1) : void 0
10370
10594
  )
10371
10595
  );
10372
10596
  }
@@ -10396,25 +10620,25 @@ var IfTag = {
10396
10620
  const ifTagExtra = branches[0][0].node.extra;
10397
10621
  const nodeRef = getOptimizedOnlyChildNodeBinding(ifTag, ifTagSection);
10398
10622
  const rendererIdentifiers = [];
10399
- let expr = import_compiler47.types.numericLiteral(branches.length);
10623
+ let expr = import_compiler48.types.numericLiteral(branches.length);
10400
10624
  for (let i = branches.length; i--; ) {
10401
10625
  const [branchTag, branchBodySection] = branches[i];
10402
10626
  const [testAttr] = branchTag.node.attributes;
10403
- const consequent = import_compiler47.types.numericLiteral(branchBodySection ? i : -1);
10627
+ const consequent = import_compiler48.types.numericLiteral(branchBodySection ? i : -1);
10404
10628
  if (branchBodySection) {
10405
- rendererIdentifiers.push(import_compiler47.types.identifier(branchBodySection.name));
10629
+ rendererIdentifiers.push(import_compiler48.types.identifier(branchBodySection.name));
10406
10630
  setClosureSignalBuilder(branchTag, (closure, render) => {
10407
10631
  return callRuntime(
10408
10632
  "_if_closure",
10409
10633
  getScopeAccessorLiteral(closure),
10410
10634
  getScopeAccessorLiteral(nodeRef),
10411
- import_compiler47.types.numericLiteral(i),
10635
+ import_compiler48.types.numericLiteral(i),
10412
10636
  render
10413
10637
  );
10414
10638
  });
10415
10639
  }
10416
10640
  branchTag.remove();
10417
- expr = testAttr ? import_compiler47.types.conditionalExpression(testAttr.value, consequent, expr) : consequent;
10641
+ expr = testAttr ? import_compiler48.types.conditionalExpression(testAttr.value, consequent, expr) : consequent;
10418
10642
  }
10419
10643
  const signal = getSignal(ifTagSection, nodeRef, "if");
10420
10644
  signal.build = () => {
@@ -10496,7 +10720,7 @@ function assertHasBody(tag) {
10496
10720
  function assertHasValueAttribute(tag) {
10497
10721
  const { node } = tag;
10498
10722
  const [valueAttr] = node.attributes;
10499
- if (!import_compiler47.types.isMarkoAttribute(valueAttr) || !valueAttr.default) {
10723
+ if (!import_compiler48.types.isMarkoAttribute(valueAttr) || !valueAttr.default) {
10500
10724
  throw tag.get("name").buildCodeFrameError(
10501
10725
  `The [\`${getTagName(tag)}\` tag](https://markojs.com/docs/reference/core-tag#if--else) requires a [\`value=\` attribute](https://markojs.com/docs/reference/language#shorthand-value).`
10502
10726
  );
@@ -10582,7 +10806,7 @@ var import_default = {
10582
10806
  };
10583
10807
 
10584
10808
  // src/translator/core/let.ts
10585
- var import_compiler48 = require("@marko/compiler");
10809
+ var import_compiler49 = require("@marko/compiler");
10586
10810
  var import_babel_utils39 = require("@marko/compiler/babel-utils");
10587
10811
  var let_default = {
10588
10812
  analyze(tag) {
@@ -10591,7 +10815,7 @@ var let_default = {
10591
10815
  let valueAttr;
10592
10816
  let valueChangeAttr;
10593
10817
  for (const attr of node.attributes) {
10594
- if (import_compiler48.types.isMarkoAttribute(attr)) {
10818
+ if (import_compiler49.types.isMarkoAttribute(attr)) {
10595
10819
  if (attr.name === "value") {
10596
10820
  valueAttr = attr;
10597
10821
  } else if (attr.name === "valueChange") {
@@ -10621,7 +10845,7 @@ var let_default = {
10621
10845
  "The [`<let>` tag](https://markojs.com/docs/reference/core-tag#let) requires a [tag variable](https://markojs.com/docs/reference/language#tag-variables)."
10622
10846
  );
10623
10847
  }
10624
- if (!import_compiler48.types.isIdentifier(tagVar)) {
10848
+ if (!import_compiler49.types.isIdentifier(tagVar)) {
10625
10849
  throw tag.get("var").buildCodeFrameError(
10626
10850
  "The [`<let>` tag](https://markojs.com/docs/reference/core-tag#let) variable cannot be destructured."
10627
10851
  );
@@ -10651,10 +10875,10 @@ var let_default = {
10651
10875
  const { node } = tag;
10652
10876
  const tagVar = node.var;
10653
10877
  const valueAttr = node.attributes.find(
10654
- (attr) => import_compiler48.types.isMarkoAttribute(attr) && (attr.default || attr.name === "value")
10655
- ) ?? import_compiler48.types.markoAttribute("value", import_compiler48.types.identifier("undefined"));
10878
+ (attr) => import_compiler49.types.isMarkoAttribute(attr) && (attr.default || attr.name === "value")
10879
+ ) ?? import_compiler49.types.markoAttribute("value", import_compiler49.types.identifier("undefined"));
10656
10880
  const valueChangeAttr = node.attributes.find(
10657
- (attr) => import_compiler48.types.isMarkoAttribute(attr) && attr.name === "valueChange"
10881
+ (attr) => import_compiler49.types.isMarkoAttribute(attr) && attr.name === "valueChange"
10658
10882
  );
10659
10883
  const section = getSection(tag);
10660
10884
  const binding = tagVar.extra.binding;
@@ -10667,7 +10891,7 @@ var let_default = {
10667
10891
  }
10668
10892
  signal.buildAssignment = (valueSection, value) => {
10669
10893
  if (valueChangeAttr || signalHasStatements(signal)) {
10670
- return import_compiler48.types.callExpression(signal.identifier, [
10894
+ return import_compiler49.types.callExpression(signal.identifier, [
10671
10895
  getScopeExpression(valueSection, signal.section),
10672
10896
  value
10673
10897
  ]);
@@ -10679,10 +10903,10 @@ var let_default = {
10679
10903
  setBindingSerializedValue(
10680
10904
  section,
10681
10905
  binding,
10682
- import_compiler48.types.logicalExpression(
10906
+ import_compiler49.types.logicalExpression(
10683
10907
  "||",
10684
10908
  valueChangeAttr.value,
10685
- import_compiler48.types.unaryExpression("void", import_compiler48.types.numericLiteral(0))
10909
+ import_compiler49.types.unaryExpression("void", import_compiler49.types.numericLiteral(0))
10686
10910
  ),
10687
10911
  getAccessorPrefix().TagVariableChange
10688
10912
  );
@@ -10705,7 +10929,7 @@ var let_default = {
10705
10929
  };
10706
10930
 
10707
10931
  // src/translator/core/lifecycle.ts
10708
- var import_compiler49 = require("@marko/compiler");
10932
+ var import_compiler50 = require("@marko/compiler");
10709
10933
  var import_babel_utils40 = require("@marko/compiler/babel-utils");
10710
10934
  var kRef = Symbol("lifecycle attrs reference");
10711
10935
  var lifecycle_default = {
@@ -10733,7 +10957,7 @@ var lifecycle_default = {
10733
10957
  );
10734
10958
  }
10735
10959
  for (const attr of node.attributes) {
10736
- if (import_compiler49.types.isMarkoSpreadAttribute(attr)) {
10960
+ if (import_compiler50.types.isMarkoSpreadAttribute(attr)) {
10737
10961
  throw tag.get("name").buildCodeFrameError(
10738
10962
  "The [`<lifecycle>` tag](https://markojs.com/docs/reference/core-tag#lifecycle) does not support [`...spread` attributes](https://markojs.com/docs/reference/language#spread-attributes)."
10739
10963
  );
@@ -10752,7 +10976,7 @@ var lifecycle_default = {
10752
10976
  if (isOutputDOM()) {
10753
10977
  const translatedAttrs = translateAttrs(tag);
10754
10978
  translatedAttrs.statements.push(
10755
- import_compiler49.types.expressionStatement(
10979
+ import_compiler50.types.expressionStatement(
10756
10980
  callRuntime(
10757
10981
  "_lifecycle",
10758
10982
  scopeIdentifier,
@@ -10787,7 +11011,7 @@ var lifecycle_default = {
10787
11011
  };
10788
11012
 
10789
11013
  // src/translator/core/log.ts
10790
- var import_compiler50 = require("@marko/compiler");
11014
+ var import_compiler51 = require("@marko/compiler");
10791
11015
  var import_babel_utils41 = require("@marko/compiler/babel-utils");
10792
11016
  var log_default = {
10793
11017
  analyze(tag) {
@@ -10801,7 +11025,7 @@ var log_default = {
10801
11025
  "The [`<log>` tag](https://markojs.com/docs/reference/core-tag#log) requires a [`value=` attribute](https://markojs.com/docs/reference/language#shorthand-value)."
10802
11026
  );
10803
11027
  }
10804
- if (tag.node.attributes.length > 1 || !import_compiler50.types.isMarkoAttribute(valueAttr) || !valueAttr.default && valueAttr.name !== "value") {
11028
+ if (tag.node.attributes.length > 1 || !import_compiler51.types.isMarkoAttribute(valueAttr) || !valueAttr.default && valueAttr.name !== "value") {
10805
11029
  throw tag.get("name").buildCodeFrameError(
10806
11030
  "The [`<log>` tag](https://markojs.com/docs/reference/core-tag#log) only supports the [`value=` attribute](https://markojs.com/docs/reference/language#shorthand-value)."
10807
11031
  );
@@ -10813,9 +11037,9 @@ var log_default = {
10813
11037
  const [valueAttr] = tag.node.attributes;
10814
11038
  const { value } = valueAttr;
10815
11039
  const referencedBindings = value.extra?.referencedBindings;
10816
- const statement = import_compiler50.types.expressionStatement(
10817
- import_compiler50.types.callExpression(
10818
- import_compiler50.types.memberExpression(import_compiler50.types.identifier("console"), import_compiler50.types.identifier("log")),
11040
+ const statement = import_compiler51.types.expressionStatement(
11041
+ import_compiler51.types.callExpression(
11042
+ import_compiler51.types.memberExpression(import_compiler51.types.identifier("console"), import_compiler51.types.identifier("log")),
10819
11043
  [value]
10820
11044
  )
10821
11045
  );
@@ -10841,7 +11065,7 @@ var log_default = {
10841
11065
  };
10842
11066
 
10843
11067
  // src/translator/core/script.ts
10844
- var import_compiler51 = require("@marko/compiler");
11068
+ var import_compiler52 = require("@marko/compiler");
10845
11069
  var import_babel_utils42 = require("@marko/compiler/babel-utils");
10846
11070
  var htmlScriptTagAlternateMsg = " For a native html [`<script>` tag](https://markojs.com/docs/reference/core-tag#script) use the `html-script` core tag instead.";
10847
11071
  var script_default = {
@@ -10864,12 +11088,12 @@ var script_default = {
10864
11088
  const end = body[body.length - 1]?.end;
10865
11089
  const bodyStatements = (0, import_babel_utils42.parseStatements)(tag.hub.file, code, start, end);
10866
11090
  if (bodyStatements.length) {
10867
- const valueFn = import_compiler51.types.arrowFunctionExpression(
11091
+ const valueFn = import_compiler52.types.arrowFunctionExpression(
10868
11092
  [],
10869
- import_compiler51.types.blockStatement(bodyStatements),
11093
+ import_compiler52.types.blockStatement(bodyStatements),
10870
11094
  traverseContains(bodyStatements, isAwaitExpression)
10871
11095
  );
10872
- node.attributes.push(import_compiler51.types.markoAttribute("value", valueFn));
11096
+ node.attributes.push(import_compiler52.types.markoAttribute("value", valueFn));
10873
11097
  }
10874
11098
  node.body.body = [];
10875
11099
  }
@@ -10919,28 +11143,28 @@ var script_default = {
10919
11143
  const referencedBindings = value.extra?.referencedBindings;
10920
11144
  if (isOutputDOM()) {
10921
11145
  const { value: value2 } = valueAttr;
10922
- const isFunction2 = import_compiler51.types.isFunctionExpression(value2) || import_compiler51.types.isArrowFunctionExpression(value2);
11146
+ const isFunction2 = import_compiler52.types.isFunctionExpression(value2) || import_compiler52.types.isArrowFunctionExpression(value2);
10923
11147
  let inlineBody = null;
10924
11148
  if (isFunction2 && !(value2.async || value2.generator)) {
10925
- if (import_compiler51.types.isBlockStatement(value2.body)) {
11149
+ if (import_compiler52.types.isBlockStatement(value2.body)) {
10926
11150
  let hasDeclaration = false;
10927
11151
  for (const child of value2.body.body) {
10928
- if (import_compiler51.types.isDeclaration(child)) {
11152
+ if (import_compiler52.types.isDeclaration(child)) {
10929
11153
  hasDeclaration = true;
10930
11154
  break;
10931
11155
  }
10932
11156
  }
10933
11157
  inlineBody = hasDeclaration ? value2.body : value2.body.body;
10934
11158
  } else {
10935
- inlineBody = import_compiler51.types.expressionStatement(value2.body);
11159
+ inlineBody = import_compiler52.types.expressionStatement(value2.body);
10936
11160
  }
10937
11161
  }
10938
11162
  addStatement(
10939
11163
  "effect",
10940
11164
  section,
10941
11165
  referencedBindings,
10942
- inlineBody || import_compiler51.types.expressionStatement(
10943
- import_compiler51.types.callExpression(value2, isFunction2 ? [] : [scopeIdentifier])
11166
+ inlineBody || import_compiler52.types.expressionStatement(
11167
+ import_compiler52.types.callExpression(value2, isFunction2 ? [] : [scopeIdentifier])
10944
11168
  )
10945
11169
  );
10946
11170
  } else {
@@ -10981,7 +11205,7 @@ function isAwaitExpression(node) {
10981
11205
  }
10982
11206
 
10983
11207
  // src/translator/core/server.ts
10984
- var import_compiler52 = require("@marko/compiler");
11208
+ var import_compiler53 = require("@marko/compiler");
10985
11209
  var import_babel_utils43 = require("@marko/compiler/babel-utils");
10986
11210
  var server_default = {
10987
11211
  parse(tag) {
@@ -10993,10 +11217,10 @@ var server_default = {
10993
11217
  const code = rawValue.replace(/^server\s*/, "");
10994
11218
  const start = node.start + (rawValue.length - code.length);
10995
11219
  let body = (0, import_babel_utils43.parseStatements)(file, code, start, start + code.length);
10996
- if (body.length === 1 && import_compiler52.types.isBlockStatement(body[0])) {
11220
+ if (body.length === 1 && import_compiler53.types.isBlockStatement(body[0])) {
10997
11221
  body = body[0].body;
10998
11222
  }
10999
- tag.replaceWith(import_compiler52.types.markoScriptlet(body, true, "server"));
11223
+ tag.replaceWith(import_compiler53.types.markoScriptlet(body, true, "server"));
11000
11224
  },
11001
11225
  parseOptions: {
11002
11226
  statement: true,
@@ -11012,7 +11236,7 @@ var server_default = {
11012
11236
  };
11013
11237
 
11014
11238
  // src/translator/core/static.ts
11015
- var import_compiler53 = require("@marko/compiler");
11239
+ var import_compiler54 = require("@marko/compiler");
11016
11240
  var import_babel_utils44 = require("@marko/compiler/babel-utils");
11017
11241
  var static_default = {
11018
11242
  parse(tag) {
@@ -11024,10 +11248,10 @@ var static_default = {
11024
11248
  const code = rawValue.replace(/^static\s*/, "");
11025
11249
  const start = node.start + (rawValue.length - code.length);
11026
11250
  let body = (0, import_babel_utils44.parseStatements)(file, code, start, start + code.length);
11027
- if (body.length === 1 && import_compiler53.types.isBlockStatement(body[0])) {
11251
+ if (body.length === 1 && import_compiler54.types.isBlockStatement(body[0])) {
11028
11252
  body = body[0].body;
11029
11253
  }
11030
- tag.replaceWith(import_compiler53.types.markoScriptlet(body, true));
11254
+ tag.replaceWith(import_compiler54.types.markoScriptlet(body, true));
11031
11255
  },
11032
11256
  parseOptions: {
11033
11257
  statement: true,
@@ -11043,7 +11267,7 @@ var static_default = {
11043
11267
  };
11044
11268
 
11045
11269
  // src/translator/core/style.ts
11046
- var import_compiler54 = require("@marko/compiler");
11270
+ var import_compiler55 = require("@marko/compiler");
11047
11271
  var import_babel_utils45 = require("@marko/compiler/babel-utils");
11048
11272
  var import_magic_string = __toESM(require("magic-string"));
11049
11273
  var import_path3 = __toESM(require("path"));
@@ -11120,21 +11344,21 @@ var style_default = {
11120
11344
  if (importPath) {
11121
11345
  if (!node.var) {
11122
11346
  (0, import_babel_utils45.getProgram)().node.body.push(
11123
- import_compiler54.types.importDeclaration([], import_compiler54.types.stringLiteral(importPath))
11347
+ import_compiler55.types.importDeclaration([], import_compiler55.types.stringLiteral(importPath))
11124
11348
  );
11125
- } else if (import_compiler54.types.isIdentifier(node.var)) {
11349
+ } else if (import_compiler55.types.isIdentifier(node.var)) {
11126
11350
  (0, import_babel_utils45.getProgram)().node.body.push(
11127
- import_compiler54.types.importDeclaration(
11128
- [import_compiler54.types.importNamespaceSpecifier(node.var)],
11129
- import_compiler54.types.stringLiteral(importPath)
11351
+ import_compiler55.types.importDeclaration(
11352
+ [import_compiler55.types.importNamespaceSpecifier(node.var)],
11353
+ import_compiler55.types.stringLiteral(importPath)
11130
11354
  )
11131
11355
  );
11132
11356
  } else {
11133
- const varDecl = import_compiler54.types.variableDeclaration("const", [
11134
- import_compiler54.types.variableDeclarator(node.var, (0, import_babel_utils45.importStar)(file, importPath, "style"))
11357
+ const varDecl = import_compiler55.types.variableDeclaration("const", [
11358
+ import_compiler55.types.variableDeclarator(node.var, (0, import_babel_utils45.importStar)(file, importPath, "style"))
11135
11359
  ]);
11136
11360
  (0, import_babel_utils45.getProgram)().node.body.push(
11137
- isOutputDOM() ? varDecl : import_compiler54.types.markoScriptlet([varDecl], true)
11361
+ isOutputDOM() ? varDecl : import_compiler55.types.markoScriptlet([varDecl], true)
11138
11362
  );
11139
11363
  }
11140
11364
  }
@@ -11149,8 +11373,43 @@ var style_default = {
11149
11373
  attributes: {}
11150
11374
  };
11151
11375
 
11376
+ // src/translator/core/textarea.ts
11377
+ var import_compiler56 = require("@marko/compiler");
11378
+ var textarea_default = {
11379
+ parse(tag) {
11380
+ if (tag.node.body.body.length) {
11381
+ const parts = [];
11382
+ for (const child of tag.node.body.body) {
11383
+ if (child.type === "MarkoText" || child.type === "MarkoPlaceholder" && child.escape) {
11384
+ parts.push(child.value);
11385
+ } else {
11386
+ throw tag.hub.file.hub.buildError(
11387
+ child,
11388
+ "Unexpected content in textarea, only text and placeholders are supported.",
11389
+ SyntaxError
11390
+ );
11391
+ }
11392
+ }
11393
+ tag.node.attributes.push(
11394
+ import_compiler56.types.markoAttribute(
11395
+ "value",
11396
+ normalizeStringExpression(parts) || buildUndefined4()
11397
+ )
11398
+ );
11399
+ tag.node.body.body = [];
11400
+ }
11401
+ },
11402
+ parseOptions: {
11403
+ text: true,
11404
+ preserveWhitespace: true
11405
+ }
11406
+ };
11407
+ function buildUndefined4() {
11408
+ return import_compiler56.types.unaryExpression("void", import_compiler56.types.numericLiteral(0));
11409
+ }
11410
+
11152
11411
  // src/translator/core/try.ts
11153
- var import_compiler55 = require("@marko/compiler");
11412
+ var import_compiler57 = require("@marko/compiler");
11154
11413
  var import_babel_utils46 = require("@marko/compiler/babel-utils");
11155
11414
  var kDOMBinding2 = Symbol("try tag dom binding");
11156
11415
  var try_default = {
@@ -11210,7 +11469,7 @@ var try_default = {
11210
11469
  writeHTMLResumeStatements(tagBody);
11211
11470
  tag.insertBefore(translatedAttrs.statements);
11212
11471
  tag.replaceWith(
11213
- import_compiler55.types.expressionStatement(
11472
+ import_compiler57.types.expressionStatement(
11214
11473
  callRuntime(
11215
11474
  "_try",
11216
11475
  getScopeIdIdentifier(section),
@@ -11252,7 +11511,7 @@ var try_default = {
11252
11511
  return callRuntime(
11253
11512
  "_try",
11254
11513
  getScopeAccessorLiteral(nodeRef),
11255
- import_compiler55.types.identifier(bodySection.name)
11514
+ import_compiler57.types.identifier(bodySection.name)
11256
11515
  );
11257
11516
  };
11258
11517
  if (translatedAttrs.statements.length) {
@@ -11264,7 +11523,7 @@ var try_default = {
11264
11523
  );
11265
11524
  }
11266
11525
  (0, import_babel_utils46.getProgram)().node.body.push(
11267
- import_compiler55.types.expressionStatement(callRuntime("_enable_catch"))
11526
+ import_compiler57.types.expressionStatement(callRuntime("_enable_catch"))
11268
11527
  );
11269
11528
  addValue(
11270
11529
  section,
@@ -11314,6 +11573,7 @@ var core_default = {
11314
11573
  "<server>": server_default,
11315
11574
  "<static>": static_default,
11316
11575
  "<style>": style_default,
11576
+ "<textarea>": textarea_default,
11317
11577
  "<try>": try_default
11318
11578
  };
11319
11579
 
@@ -11390,10 +11650,10 @@ var import_declaration_default = {
11390
11650
  };
11391
11651
 
11392
11652
  // src/translator/visitors/placeholder.ts
11393
- var import_compiler57 = require("@marko/compiler");
11653
+ var import_compiler59 = require("@marko/compiler");
11394
11654
 
11395
11655
  // src/translator/util/is-non-html-text.ts
11396
- var import_compiler56 = require("@marko/compiler");
11656
+ var import_compiler58 = require("@marko/compiler");
11397
11657
  function isNonHTMLText(placeholder) {
11398
11658
  const parentTag = placeholder.parentPath.isMarkoTagBody() && placeholder.parentPath.parentPath;
11399
11659
  if (parentTag && isCoreTag(parentTag)) {
@@ -11483,10 +11743,10 @@ var placeholder_default = {
11483
11743
  "render",
11484
11744
  getSection(placeholder),
11485
11745
  valueExtra.referencedBindings,
11486
- import_compiler57.types.expressionStatement(
11746
+ import_compiler59.types.expressionStatement(
11487
11747
  method === "_text" ? callRuntime(
11488
11748
  "_text",
11489
- import_compiler57.types.memberExpression(
11749
+ import_compiler59.types.memberExpression(
11490
11750
  scopeIdentifier,
11491
11751
  getScopeAccessorLiteral(nodeBinding),
11492
11752
  true
@@ -11525,7 +11785,7 @@ function analyzeSiblingText(placeholder) {
11525
11785
  break;
11526
11786
  }
11527
11787
  }
11528
- if (!prev.node && import_compiler57.types.isProgram(placeholder.parentPath)) {
11788
+ if (!prev.node && import_compiler59.types.isProgram(placeholder.parentPath)) {
11529
11789
  return placeholderExtra[kSiblingText] = 1 /* Before */;
11530
11790
  }
11531
11791
  let next = placeholder.getNextSibling();
@@ -11542,7 +11802,7 @@ function analyzeSiblingText(placeholder) {
11542
11802
  break;
11543
11803
  }
11544
11804
  }
11545
- if (!next.node && import_compiler57.types.isProgram(placeholder.parentPath)) {
11805
+ if (!next.node && import_compiler59.types.isProgram(placeholder.parentPath)) {
11546
11806
  return placeholderExtra[kSiblingText] = 2 /* After */;
11547
11807
  }
11548
11808
  return placeholderExtra[kSiblingText] = 0 /* None */;
@@ -11584,7 +11844,7 @@ function isEmptyPlaceholder(placeholder) {
11584
11844
  }
11585
11845
 
11586
11846
  // src/translator/visitors/referenced-identifier.ts
11587
- var import_compiler58 = require("@marko/compiler");
11847
+ var import_compiler60 = require("@marko/compiler");
11588
11848
  var abortIdsByExpressionForSection = /* @__PURE__ */ new WeakMap();
11589
11849
  var referenced_identifier_default = {
11590
11850
  migrate(identifier) {
@@ -11592,8 +11852,8 @@ var referenced_identifier_default = {
11592
11852
  if (identifier.scope.hasBinding(name2)) return;
11593
11853
  switch (name2) {
11594
11854
  case "out":
11595
- if (import_compiler58.types.isMemberExpression(identifier.parent) && import_compiler58.types.isIdentifier(identifier.parent.property) && identifier.parent.property.name === "global") {
11596
- identifier.parentPath.replaceWith(import_compiler58.types.identifier("$global"));
11855
+ if (import_compiler60.types.isMemberExpression(identifier.parent) && import_compiler60.types.isIdentifier(identifier.parent.property) && identifier.parent.property.name === "global") {
11856
+ identifier.parentPath.replaceWith(import_compiler60.types.identifier("$global"));
11597
11857
  } else {
11598
11858
  throw identifier.buildCodeFrameError(
11599
11859
  "Only `out.global` is supported for compatibility."
@@ -11620,24 +11880,24 @@ var referenced_identifier_default = {
11620
11880
  case "$global":
11621
11881
  if (isOutputHTML()) {
11622
11882
  identifier.replaceWith(
11623
- import_compiler58.types.callExpression(importRuntime("$global"), [])
11883
+ import_compiler60.types.callExpression(importRuntime("$global"), [])
11624
11884
  );
11625
11885
  } else {
11626
11886
  identifier.replaceWith(
11627
- import_compiler58.types.memberExpression(scopeIdentifier, import_compiler58.types.identifier("$global"))
11887
+ import_compiler60.types.memberExpression(scopeIdentifier, import_compiler60.types.identifier("$global"))
11628
11888
  );
11629
11889
  }
11630
11890
  break;
11631
11891
  case "$signal":
11632
11892
  if (isOutputHTML()) {
11633
11893
  identifier.replaceWith(
11634
- import_compiler58.types.callExpression(
11635
- import_compiler58.types.arrowFunctionExpression(
11894
+ import_compiler60.types.callExpression(
11895
+ import_compiler60.types.arrowFunctionExpression(
11636
11896
  [],
11637
- import_compiler58.types.blockStatement([
11638
- import_compiler58.types.throwStatement(
11639
- import_compiler58.types.newExpression(import_compiler58.types.identifier("Error"), [
11640
- import_compiler58.types.stringLiteral("Cannot use $signal in a server render.")
11897
+ import_compiler60.types.blockStatement([
11898
+ import_compiler60.types.throwStatement(
11899
+ import_compiler60.types.newExpression(import_compiler60.types.identifier("Error"), [
11900
+ import_compiler60.types.stringLiteral("Cannot use $signal in a server render.")
11641
11901
  ])
11642
11902
  )
11643
11903
  ])
@@ -11663,19 +11923,19 @@ var referenced_identifier_default = {
11663
11923
  "render",
11664
11924
  section,
11665
11925
  exprRoot.node.extra?.referencedBindings,
11666
- import_compiler58.types.expressionStatement(
11667
- import_compiler58.types.callExpression(importRuntime("$signalReset"), [
11926
+ import_compiler60.types.expressionStatement(
11927
+ import_compiler60.types.callExpression(importRuntime("$signalReset"), [
11668
11928
  scopeIdentifier,
11669
- import_compiler58.types.numericLiteral(exprId)
11929
+ import_compiler60.types.numericLiteral(exprId)
11670
11930
  ])
11671
11931
  ),
11672
11932
  false
11673
11933
  );
11674
11934
  }
11675
11935
  identifier.replaceWith(
11676
- import_compiler58.types.callExpression(importRuntime("$signal"), [
11936
+ import_compiler60.types.callExpression(importRuntime("$signal"), [
11677
11937
  scopeIdentifier,
11678
- import_compiler58.types.numericLiteral(exprId)
11938
+ import_compiler60.types.numericLiteral(exprId)
11679
11939
  ])
11680
11940
  );
11681
11941
  }
@@ -11719,11 +11979,11 @@ var scriptlet_default = {
11719
11979
  };
11720
11980
 
11721
11981
  // src/translator/visitors/tag/index.ts
11722
- var import_compiler62 = require("@marko/compiler");
11982
+ var import_compiler64 = require("@marko/compiler");
11723
11983
  var import_babel_utils52 = require("@marko/compiler/babel-utils");
11724
11984
 
11725
11985
  // src/translator/visitors/tag/attribute-tag.ts
11726
- var import_compiler59 = require("@marko/compiler");
11986
+ var import_compiler61 = require("@marko/compiler");
11727
11987
  var import_babel_utils49 = require("@marko/compiler/babel-utils");
11728
11988
  var attribute_tag_default = {
11729
11989
  analyze: {
@@ -11756,7 +12016,7 @@ var attribute_tag_default = {
11756
12016
  };
11757
12017
 
11758
12018
  // src/translator/visitors/tag/custom-tag.ts
11759
- var import_compiler60 = require("@marko/compiler");
12019
+ var import_compiler62 = require("@marko/compiler");
11760
12020
  var import_babel_utils50 = require("@marko/compiler/babel-utils");
11761
12021
  var import_path4 = __toESM(require("path"));
11762
12022
  var custom_tag_default = {
@@ -11810,9 +12070,9 @@ function translateHTML(tag) {
11810
12070
  const childProgram = (0, import_babel_utils50.loadFileForTag)(tag).ast.program;
11811
12071
  const childExtra = childProgram.extra;
11812
12072
  let tagIdentifier;
11813
- if (import_compiler60.types.isStringLiteral(node.name)) {
12073
+ if (import_compiler62.types.isStringLiteral(node.name)) {
11814
12074
  const relativePath = getTagRelativePath(tag);
11815
- tagIdentifier = isCircularRequest(tag.hub.file, relativePath) ? import_compiler60.types.identifier(getTemplateContentName()) : (0, import_babel_utils50.importDefault)(tag.hub.file, relativePath, getTagName(tag));
12075
+ tagIdentifier = isCircularRequest(tag.hub.file, relativePath) ? import_compiler62.types.identifier(getTemplateContentName()) : (0, import_babel_utils50.importDefault)(tag.hub.file, relativePath, getTagName(tag));
11816
12076
  } else {
11817
12077
  tagIdentifier = node.name;
11818
12078
  }
@@ -11833,7 +12093,7 @@ function translateDOM(tag) {
11833
12093
  const childExtra = childFile.ast.program.extra;
11834
12094
  const childExports = childExtra.domExports;
11835
12095
  const childSection = childExtra.section;
11836
- const tagName = import_compiler60.types.isIdentifier(node.name) ? node.name.name : import_compiler60.types.isStringLiteral(node.name) ? node.name.value : "tag";
12096
+ const tagName = import_compiler62.types.isIdentifier(node.name) ? node.name.name : import_compiler62.types.isStringLiteral(node.name) ? node.name.value : "tag";
11837
12097
  if (programSection === childSection) {
11838
12098
  knownTagTranslateDOM(
11839
12099
  tag,
@@ -11844,16 +12104,16 @@ function translateDOM(tag) {
11844
12104
  "render",
11845
12105
  section,
11846
12106
  void 0,
11847
- import_compiler60.types.expressionStatement(
11848
- import_compiler60.types.callExpression(import_compiler60.types.identifier(childExports.setup), [
12107
+ import_compiler62.types.expressionStatement(
12108
+ import_compiler62.types.callExpression(import_compiler62.types.identifier(childExports.setup), [
11849
12109
  createScopeReadExpression(section, childBinding)
11850
12110
  ])
11851
12111
  )
11852
12112
  );
11853
12113
  }
11854
12114
  );
11855
- write`${import_compiler60.types.identifier(childExports.template)}`;
11856
- injectWalks(tag, import_compiler60.types.identifier(childExports.walks));
12115
+ write`${import_compiler62.types.identifier(childExports.template)}`;
12116
+ injectWalks(tag, import_compiler62.types.identifier(childExports.walks));
11857
12117
  } else {
11858
12118
  knownTagTranslateDOM(
11859
12119
  tag,
@@ -11869,8 +12129,8 @@ function translateDOM(tag) {
11869
12129
  "render",
11870
12130
  section,
11871
12131
  void 0,
11872
- import_compiler60.types.expressionStatement(
11873
- import_compiler60.types.callExpression(
12132
+ import_compiler62.types.expressionStatement(
12133
+ import_compiler62.types.callExpression(
11874
12134
  importOrSelfReferenceName(
11875
12135
  file,
11876
12136
  relativePath,
@@ -11897,7 +12157,7 @@ function getTagRelativePath(tag) {
11897
12157
  hub: { file }
11898
12158
  } = tag;
11899
12159
  let relativePath;
11900
- if (import_compiler60.types.isStringLiteral(node.name)) {
12160
+ if (import_compiler62.types.isStringLiteral(node.name)) {
11901
12161
  const template = (0, import_babel_utils50.getTagTemplate)(tag);
11902
12162
  relativePath = template && (0, import_babel_utils50.resolveRelativePath)(file, template);
11903
12163
  } else if (node.extra?.tagNameImported) {
@@ -11918,7 +12178,7 @@ function getTagRelativePath(tag) {
11918
12178
  }
11919
12179
  function importOrSelfReferenceName(file, request, name2, nameHint) {
11920
12180
  if (isCircularRequest(file, request)) {
11921
- return import_compiler60.types.identifier(name2);
12181
+ return import_compiler62.types.identifier(name2);
11922
12182
  }
11923
12183
  return (0, import_babel_utils50.importNamed)(file, request, name2, nameHint);
11924
12184
  }
@@ -11928,7 +12188,7 @@ function isCircularRequest(file, request) {
11928
12188
  }
11929
12189
 
11930
12190
  // src/translator/visitors/tag/dynamic-tag.ts
11931
- var import_compiler61 = require("@marko/compiler");
12191
+ var import_compiler63 = require("@marko/compiler");
11932
12192
  var import_babel_utils51 = require("@marko/compiler/babel-utils");
11933
12193
  var kDOMBinding3 = Symbol("dynamic tag dom binding");
11934
12194
  var kChildOffsetScopeBinding2 = Symbol("custom tag scope offset");
@@ -11960,7 +12220,7 @@ var dynamic_tag_default = {
11960
12220
  tagSection
11961
12221
  );
11962
12222
  if (hasVar || tag.node.attributes.some(
11963
- (attr) => import_compiler61.types.isMarkoSpreadAttribute(attr) || isEventOrChangeHandler(attr.name)
12223
+ (attr) => import_compiler63.types.isMarkoSpreadAttribute(attr) || isEventOrChangeHandler(attr.name)
11964
12224
  )) {
11965
12225
  (0, import_babel_utils51.getProgram)().node.extra.isInteractive = true;
11966
12226
  }
@@ -12000,7 +12260,7 @@ var dynamic_tag_default = {
12000
12260
  if (isOutputHTML()) {
12001
12261
  knownTagTranslateHTML(
12002
12262
  tag,
12003
- import_compiler61.types.memberExpression(tag.node.name, import_compiler61.types.identifier("content")),
12263
+ import_compiler63.types.memberExpression(tag.node.name, import_compiler63.types.identifier("content")),
12004
12264
  definedBodySection,
12005
12265
  propTree
12006
12266
  );
@@ -12017,9 +12277,9 @@ var dynamic_tag_default = {
12017
12277
  "render",
12018
12278
  section,
12019
12279
  void 0,
12020
- import_compiler61.types.expressionStatement(
12021
- import_compiler61.types.callExpression(
12022
- import_compiler61.types.memberExpression(signal.identifier, import_compiler61.types.identifier("_")),
12280
+ import_compiler63.types.expressionStatement(
12281
+ import_compiler63.types.callExpression(
12282
+ import_compiler63.types.memberExpression(signal.identifier, import_compiler63.types.identifier("_")),
12023
12283
  [
12024
12284
  createScopeReadExpression(section, childBinding),
12025
12285
  getScopeExpression(section, definedBodySection.parent)
@@ -12043,7 +12303,7 @@ var dynamic_tag_default = {
12043
12303
  const nodeBinding = tagExtra[kDOMBinding3];
12044
12304
  const isClassAPI = tagExtra.featureType === "class";
12045
12305
  let tagExpression = node.name;
12046
- if (import_compiler61.types.isStringLiteral(tagExpression)) {
12306
+ if (import_compiler63.types.isStringLiteral(tagExpression)) {
12047
12307
  tagExpression = (0, import_babel_utils51.importDefault)(
12048
12308
  tag.hub.file,
12049
12309
  getTagRelativePath(tag),
@@ -12053,14 +12313,14 @@ var dynamic_tag_default = {
12053
12313
  if (isClassAPI) {
12054
12314
  if (isOutputHTML()) {
12055
12315
  (0, import_babel_utils51.getProgram)().node.body.push(
12056
- import_compiler61.types.markoScriptlet(
12316
+ import_compiler63.types.markoScriptlet(
12057
12317
  [
12058
- import_compiler61.types.expressionStatement(
12059
- import_compiler61.types.callExpression(
12318
+ import_compiler63.types.expressionStatement(
12319
+ import_compiler63.types.callExpression(
12060
12320
  (0, import_babel_utils51.importNamed)(tag.hub.file, getCompatRuntimeFile(), "s"),
12061
12321
  [
12062
- import_compiler61.types.identifier(tagExpression.name),
12063
- import_compiler61.types.stringLiteral((0, import_babel_utils51.loadFileForTag)(tag).metadata.marko.id)
12322
+ import_compiler63.types.identifier(tagExpression.name),
12323
+ import_compiler63.types.stringLiteral((0, import_babel_utils51.loadFileForTag)(tag).metadata.marko.id)
12064
12324
  ]
12065
12325
  )
12066
12326
  )
@@ -12070,11 +12330,11 @@ var dynamic_tag_default = {
12070
12330
  );
12071
12331
  } else {
12072
12332
  (0, import_babel_utils51.getProgram)().node.body.push(
12073
- import_compiler61.types.expressionStatement(
12333
+ import_compiler63.types.expressionStatement(
12074
12334
  callRuntime(
12075
12335
  "_resume",
12076
- import_compiler61.types.stringLiteral((0, import_babel_utils51.loadFileForTag)(tag).metadata.marko.id),
12077
- import_compiler61.types.identifier(tagExpression.name)
12336
+ import_compiler63.types.stringLiteral((0, import_babel_utils51.loadFileForTag)(tag).metadata.marko.id),
12337
+ import_compiler63.types.identifier(tagExpression.name)
12078
12338
  )
12079
12339
  )
12080
12340
  );
@@ -12116,9 +12376,9 @@ var dynamic_tag_default = {
12116
12376
  getScopeIdIdentifier(tagSection),
12117
12377
  getScopeAccessorLiteral(nodeBinding),
12118
12378
  tagExpression,
12119
- import_compiler61.types.arrayExpression(args),
12120
- import_compiler61.types.numericLiteral(0),
12121
- import_compiler61.types.numericLiteral(1),
12379
+ import_compiler63.types.arrayExpression(args),
12380
+ import_compiler63.types.numericLiteral(0),
12381
+ import_compiler63.types.numericLiteral(1),
12122
12382
  serializeArg
12123
12383
  ) : callRuntime(
12124
12384
  "_dynamic_tag",
@@ -12126,8 +12386,8 @@ var dynamic_tag_default = {
12126
12386
  getScopeAccessorLiteral(nodeBinding),
12127
12387
  tagExpression,
12128
12388
  args[0],
12129
- args[1] || (serializeArg ? import_compiler61.types.numericLiteral(0) : void 0),
12130
- serializeArg ? import_compiler61.types.numericLiteral(0) : void 0,
12389
+ args[1] || (serializeArg ? import_compiler63.types.numericLiteral(0) : void 0),
12390
+ serializeArg ? import_compiler63.types.numericLiteral(0) : void 0,
12131
12391
  serializeArg
12132
12392
  );
12133
12393
  if (node.var) {
@@ -12135,18 +12395,18 @@ var dynamic_tag_default = {
12135
12395
  tag.get("name").toString() + "_scope"
12136
12396
  );
12137
12397
  statements.push(
12138
- import_compiler61.types.variableDeclaration("const", [
12139
- import_compiler61.types.variableDeclarator(
12398
+ import_compiler63.types.variableDeclaration("const", [
12399
+ import_compiler63.types.variableDeclarator(
12140
12400
  dynamicScopeIdentifier,
12141
12401
  callRuntime("_peek_scope_id")
12142
12402
  )
12143
12403
  ])
12144
12404
  );
12145
12405
  statements.push(
12146
- import_compiler61.types.variableDeclaration("let", [
12147
- import_compiler61.types.variableDeclarator(node.var, dynamicTagExpr)
12406
+ import_compiler63.types.variableDeclaration("let", [
12407
+ import_compiler63.types.variableDeclarator(node.var, dynamicTagExpr)
12148
12408
  ]),
12149
- import_compiler61.types.expressionStatement(
12409
+ import_compiler63.types.expressionStatement(
12150
12410
  callRuntime(
12151
12411
  "_var",
12152
12412
  getScopeIdIdentifier(tagSection),
@@ -12154,7 +12414,7 @@ var dynamic_tag_default = {
12154
12414
  tag.node.extra[kChildOffsetScopeBinding2]
12155
12415
  ),
12156
12416
  dynamicScopeIdentifier,
12157
- import_compiler61.types.stringLiteral(
12417
+ import_compiler63.types.stringLiteral(
12158
12418
  getResumeRegisterId(
12159
12419
  tagSection,
12160
12420
  node.var.extra?.binding,
@@ -12166,7 +12426,7 @@ var dynamic_tag_default = {
12166
12426
  )
12167
12427
  );
12168
12428
  } else {
12169
- statements.push(import_compiler61.types.expressionStatement(dynamicTagExpr));
12429
+ statements.push(import_compiler63.types.expressionStatement(dynamicTagExpr));
12170
12430
  }
12171
12431
  for (const replacement of tag.replaceWithMultiple(statements)) {
12172
12432
  replacement.skip();
@@ -12185,9 +12445,9 @@ var dynamic_tag_default = {
12185
12445
  tagVarSignal.register = true;
12186
12446
  tagVarSignal.buildAssignment = (valueSection, value) => {
12187
12447
  const changeArgs = [
12188
- import_compiler61.types.memberExpression(
12448
+ import_compiler63.types.memberExpression(
12189
12449
  getScopeExpression(tagVarSignal.section, valueSection),
12190
- import_compiler61.types.stringLiteral(
12450
+ import_compiler63.types.stringLiteral(
12191
12451
  getAccessorPrefix().ConditionalScope + getScopeAccessor(nodeBinding)
12192
12452
  ),
12193
12453
  true
@@ -12195,28 +12455,28 @@ var dynamic_tag_default = {
12195
12455
  value
12196
12456
  ];
12197
12457
  if (!isOptimize()) {
12198
- changeArgs.push(import_compiler61.types.stringLiteral(varBinding.name));
12458
+ changeArgs.push(import_compiler63.types.stringLiteral(varBinding.name));
12199
12459
  }
12200
- return import_compiler61.types.callExpression(importRuntime("_var_change"), changeArgs);
12460
+ return import_compiler63.types.callExpression(importRuntime("_var_change"), changeArgs);
12201
12461
  };
12202
12462
  }
12203
12463
  signal.build = () => {
12204
12464
  return callRuntime(
12205
12465
  "_dynamic_tag",
12206
12466
  getScopeAccessorLiteral(nodeBinding),
12207
- bodySection && import_compiler61.types.identifier(bodySection.name),
12208
- tagVarSignal ? import_compiler61.types.arrowFunctionExpression([], tagVarSignal.identifier) : void 0,
12209
- hasTagArgs && import_compiler61.types.numericLiteral(1)
12467
+ bodySection && import_compiler63.types.identifier(bodySection.name),
12468
+ tagVarSignal ? import_compiler63.types.arrowFunctionExpression([], tagVarSignal.identifier) : void 0,
12469
+ hasTagArgs && import_compiler63.types.numericLiteral(1)
12210
12470
  );
12211
12471
  };
12212
12472
  if (args.length) {
12213
- const argsOrInput = hasTagArgs ? import_compiler61.types.arrayExpression(args) : args[0];
12214
- if (!import_compiler61.types.isObjectExpression(argsOrInput) || argsOrInput.properties.length) {
12473
+ const argsOrInput = hasTagArgs ? import_compiler63.types.arrayExpression(args) : args[0];
12474
+ if (!import_compiler63.types.isObjectExpression(argsOrInput) || argsOrInput.properties.length) {
12215
12475
  signal.extraArgs = [
12216
- import_compiler61.types.arrowFunctionExpression(
12476
+ import_compiler63.types.arrowFunctionExpression(
12217
12477
  [],
12218
- statements.length ? import_compiler61.types.blockStatement(
12219
- statements.concat(import_compiler61.types.returnStatement(argsOrInput))
12478
+ statements.length ? import_compiler63.types.blockStatement(
12479
+ statements.concat(import_compiler63.types.returnStatement(argsOrInput))
12220
12480
  ) : argsOrInput
12221
12481
  )
12222
12482
  ];
@@ -12230,34 +12490,7 @@ var dynamic_tag_default = {
12230
12490
  };
12231
12491
 
12232
12492
  // src/translator/visitors/tag/index.ts
12233
- var TAG_NAME_IDENTIFIER_REG = /^[A-Z][a-zA-Z0-9_$]*$/;
12234
- var BINDING_CHANGE_HANDLER = /* @__PURE__ */ new WeakMap();
12235
12493
  var tag_default = {
12236
- transform: {
12237
- enter(tag) {
12238
- const { node } = tag;
12239
- const { name: name2, attributes } = tag.node;
12240
- let crawl = false;
12241
- if (import_compiler62.types.isStringLiteral(name2)) {
12242
- const tagName = name2.value;
12243
- if (tag.scope.getBinding(tagName) && TAG_NAME_IDENTIFIER_REG.test(tagName)) {
12244
- node.name = withPreviousLocation(import_compiler62.types.identifier(tagName), name2);
12245
- crawl = true;
12246
- }
12247
- }
12248
- for (let i = 0; i < attributes.length; i++) {
12249
- const attr = attributes[i];
12250
- if (import_compiler62.types.isMarkoAttribute(attr) && attr.bound) {
12251
- attr.bound = false;
12252
- attributes.splice(++i, 0, getChangeHandler(tag, attr));
12253
- crawl = true;
12254
- }
12255
- }
12256
- if (crawl) {
12257
- tag.scope.crawl();
12258
- }
12259
- }
12260
- },
12261
12494
  analyze: {
12262
12495
  enter(tag) {
12263
12496
  const tagDef = (0, import_babel_utils52.getTagDef)(tag);
@@ -12323,8 +12556,8 @@ var tag_default = {
12323
12556
  if (extra.tagNameDynamic && extra.tagNameNullable && !tag.get("name").isIdentifier() && isOutputHTML()) {
12324
12557
  const tagNameId = generateUidIdentifier("tagName");
12325
12558
  const [tagNameVarPath] = tag.insertBefore(
12326
- import_compiler62.types.variableDeclaration("const", [
12327
- import_compiler62.types.variableDeclarator(tagNameId, tag.node.name)
12559
+ import_compiler64.types.variableDeclaration("const", [
12560
+ import_compiler64.types.variableDeclarator(tagNameId, tag.node.name)
12328
12561
  ])
12329
12562
  );
12330
12563
  tagNameVarPath.skip();
@@ -12368,152 +12601,9 @@ var tag_default = {
12368
12601
  }
12369
12602
  }
12370
12603
  };
12371
- function getChangeHandler(tag, attr) {
12372
- const attrName = attr.name;
12373
- const changeAttrName = attrName + "Change";
12374
- if (import_compiler62.types.isIdentifier(attr.value)) {
12375
- const binding = tag.scope.getBinding(attr.value.name);
12376
- if (!binding)
12377
- return import_compiler62.types.markoAttribute(
12378
- changeAttrName,
12379
- buildChangeHandlerFunction(attr.value)
12380
- );
12381
- const existingChangedAttr = BINDING_CHANGE_HANDLER.get(binding.identifier);
12382
- if (!existingChangedAttr) {
12383
- const bindingIdentifierPath = binding.path.getOuterBindingIdentifierPaths()[binding.identifier.name];
12384
- const changeAttrExpr = bindingIdentifierPath ? bindingIdentifierPath.parentPath === binding.path ? buildChangeHandlerFunction(attr.value) : bindingIdentifierPath.parentPath.isObjectProperty() ? getChangeHandlerFromObjectPattern(
12385
- bindingIdentifierPath.parentPath
12386
- ) : void 0 : void 0;
12387
- if (!changeAttrExpr) {
12388
- throw tag.hub.buildError(attr.value, "Unable to bind to value.");
12389
- }
12390
- const changeHandlerAttr = import_compiler62.types.markoAttribute(
12391
- changeAttrName,
12392
- changeAttrExpr
12393
- );
12394
- BINDING_CHANGE_HANDLER.set(binding.identifier, changeHandlerAttr);
12395
- return changeHandlerAttr;
12396
- }
12397
- if (existingChangedAttr.type === "Identifier") {
12398
- return import_compiler62.types.markoAttribute(
12399
- changeAttrName,
12400
- withPreviousLocation(
12401
- import_compiler62.types.identifier(existingChangedAttr.name),
12402
- attr.value
12403
- )
12404
- );
12405
- }
12406
- const markoRoot = isMarko(binding.path) ? binding.path : getMarkoRoot(binding.path);
12407
- if (!(markoRoot?.isMarkoTag() || markoRoot?.isMarkoTagBody())) {
12408
- throw tag.hub.buildError(attr.value, "Unable to bind to value.");
12409
- }
12410
- const changeHandlerId = generateUid(changeAttrName);
12411
- const changeHandlerConst = import_compiler62.types.markoTag(
12412
- import_compiler62.types.stringLiteral("const"),
12413
- [import_compiler62.types.markoAttribute("value", existingChangedAttr.value, null, null, true)],
12414
- import_compiler62.types.markoTagBody([]),
12415
- null,
12416
- import_compiler62.types.identifier(changeHandlerId)
12417
- );
12418
- BINDING_CHANGE_HANDLER.set(
12419
- binding.identifier,
12420
- existingChangedAttr.value = import_compiler62.types.identifier(changeHandlerId)
12421
- );
12422
- if (markoRoot.isMarkoTag()) {
12423
- markoRoot.insertAfter(changeHandlerConst);
12424
- } else {
12425
- markoRoot.unshiftContainer("body", changeHandlerConst);
12426
- }
12427
- markoRoot.scope.crawl();
12428
- return import_compiler62.types.markoAttribute(
12429
- changeAttrName,
12430
- withPreviousLocation(import_compiler62.types.identifier(changeHandlerId), attr.value)
12431
- );
12432
- } else if (import_compiler62.types.isMemberExpression(attr.value)) {
12433
- const prop = attr.value.property;
12434
- if (!import_compiler62.types.isPrivateName(attr.value.property)) {
12435
- return import_compiler62.types.markoAttribute(
12436
- changeAttrName,
12437
- import_compiler62.types.memberExpression(
12438
- import_compiler62.types.cloneNode(attr.value.object),
12439
- prop.type === "Identifier" ? withPreviousLocation(import_compiler62.types.identifier(prop.name + "Change"), prop) : import_compiler62.types.binaryExpression(
12440
- "+",
12441
- import_compiler62.types.cloneNode(prop),
12442
- import_compiler62.types.stringLiteral("Change")
12443
- ),
12444
- prop.type !== "Identifier"
12445
- )
12446
- );
12447
- }
12448
- }
12449
- throw tag.hub.buildError(
12450
- attr.value,
12451
- "Attributes may only be bound to identifiers or member expressions"
12452
- );
12453
- }
12454
- function buildChangeHandlerFunction(id) {
12455
- const newId = "_new_" + id.name;
12456
- return import_compiler62.types.arrowFunctionExpression(
12457
- [withPreviousLocation(import_compiler62.types.identifier(newId), id)],
12458
- import_compiler62.types.blockStatement([
12459
- import_compiler62.types.expressionStatement(
12460
- import_compiler62.types.assignmentExpression(
12461
- "=",
12462
- withPreviousLocation(import_compiler62.types.identifier(id.name), id),
12463
- withPreviousLocation(import_compiler62.types.identifier(newId), id)
12464
- )
12465
- )
12466
- ])
12467
- );
12468
- }
12469
- function getChangeHandlerFromObjectPattern(parent) {
12470
- let changeKey;
12471
- const pattern = parent.parentPath;
12472
- if (parent.node.computed) {
12473
- changeKey = generateUidIdentifier(`dynamicChange`);
12474
- pattern.pushContainer(
12475
- "properties",
12476
- import_compiler62.types.objectProperty(
12477
- import_compiler62.types.binaryExpression(
12478
- "+",
12479
- parent.get("key").node,
12480
- import_compiler62.types.stringLiteral("Change")
12481
- ),
12482
- changeKey,
12483
- true
12484
- )
12485
- );
12486
- } else {
12487
- const key = parent.get("key");
12488
- const searchKey = `${getStringOrIdentifierValue(key)}Change`;
12489
- for (const prop of pattern.get("properties")) {
12490
- if (prop.isObjectProperty()) {
12491
- const propKey = prop.get("key");
12492
- const propValue = prop.get("value");
12493
- if (!prop.node.computed && getStringOrIdentifierValue(propKey) === searchKey && propValue.isIdentifier()) {
12494
- changeKey = propValue.node;
12495
- break;
12496
- }
12497
- }
12498
- }
12499
- if (!changeKey) {
12500
- pattern.unshiftContainer(
12501
- "properties",
12502
- import_compiler62.types.objectProperty(
12503
- import_compiler62.types.stringLiteral(searchKey),
12504
- changeKey = generateUidIdentifier(searchKey)
12505
- )
12506
- );
12507
- }
12508
- }
12509
- return changeKey;
12510
- }
12511
- function getStringOrIdentifierValue(path5) {
12512
- return path5.isStringLiteral() ? path5.node.value : path5.node.name;
12513
- }
12514
12604
 
12515
12605
  // src/translator/visitors/text.ts
12516
- var import_compiler63 = require("@marko/compiler");
12606
+ var import_compiler65 = require("@marko/compiler");
12517
12607
  var text_default = {
12518
12608
  translate: {
12519
12609
  exit(text) {