@vue/compiler-sfc 3.5.39 → 3.5.41

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-sfc v3.5.39
2
+ * @vue/compiler-sfc v3.5.41
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -216,8 +216,11 @@ const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
216
216
 
217
217
  const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
218
218
  const isBooleanAttr = /* @__PURE__ */ makeMap(
219
- specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
219
+ specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
220
220
  );
221
+ function includeBooleanAttr(value) {
222
+ return !!value || value === "";
223
+ }
221
224
  const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
222
225
  const attrValidationCache = {};
223
226
  function isSSRSafeAttrName(name) {
@@ -4764,6 +4767,7 @@ function requireLib () {
4764
4767
  SloppyFunctionAnnexB: "In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement.",
4765
4768
  SourcePhaseImportRequiresDefault: 'Only `import source x from "./module"` is valid.',
4766
4769
  StaticPrototype: "Classes may not have static property named prototype.",
4770
+ SuperCallNotNewExpression: "Cannot use new with super(...).",
4767
4771
  SuperNotAllowed: "`super()` is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class?",
4768
4772
  SuperPrivateField: "Private fields can't be accessed on super.",
4769
4773
  TrailingDecorator: "Decorators must be attached to a class element.",
@@ -4793,7 +4797,6 @@ function requireLib () {
4793
4797
  UnexpectedTokenUnaryExponentiation: "Illegal expression. Wrap left hand side or entire exponentiation in parentheses.",
4794
4798
  UnexpectedUsingDeclaration: "Using declaration cannot appear in the top level when source type is `script` or in the bare case statement.",
4795
4799
  UnexpectedVoidPattern: "Unexpected void binding.",
4796
- UnsupportedBind: "Binding should be performed on object property.",
4797
4800
  UnsupportedDecoratorExport: "A decorated export must export a class declaration.",
4798
4801
  UnsupportedDefaultExport: "Only expressions, functions or classes are allowed as the `default` export.",
4799
4802
  UnsupportedImport: "`import` can only be used in `import()` or `import.meta`.",
@@ -4861,6 +4864,10 @@ function requireLib () {
4861
4864
  PrimaryTopicNotAllowed: "Topic reference was used in a lexical context without topic binding.",
4862
4865
  PrimaryTopicRequiresSmartPipeline: 'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.'
4863
4866
  });
4867
+ var FunctionBindErrors = {
4868
+ UnsupportedBind: "Binding should be performed on object property.",
4869
+ UnsupportedBindRHS: "The right-hand side of binding can not be super or import."
4870
+ };
4864
4871
  const _excluded = ["message"];
4865
4872
  function defineHidden(obj, key, value) {
4866
4873
  Object.defineProperty(obj, key, {
@@ -4951,7 +4958,7 @@ function requireLib () {
4951
4958
  }
4952
4959
  return ParseErrorConstructors;
4953
4960
  }
4954
- const Errors = Object.assign({}, ParseErrorEnum(ModuleErrors), ParseErrorEnum(StandardErrors), ParseErrorEnum(StrictModeErrors), ParseErrorEnum(ParseExpressionErrors), ParseErrorEnum`pipelineOperator`(PipelineOperatorErrors));
4961
+ const Errors = Object.assign({}, ParseErrorEnum(ModuleErrors), ParseErrorEnum(StandardErrors), ParseErrorEnum(StrictModeErrors), ParseErrorEnum(ParseExpressionErrors), ParseErrorEnum`pipelineOperator`(PipelineOperatorErrors), ParseErrorEnum`functionBind`(FunctionBindErrors));
4955
4962
  function createDefaultOptions() {
4956
4963
  return {
4957
4964
  sourceType: "script",
@@ -15644,7 +15651,7 @@ function requireLib () {
15644
15651
  type
15645
15652
  } = this.state;
15646
15653
  if (!noCalls && type === 15) {
15647
- return this.parseBind(base, startLoc, noCalls, state);
15654
+ return this.parseBind(base, startLoc, state);
15648
15655
  } else if (tokenIsTemplate(type)) {
15649
15656
  return this.parseTaggedTemplateExpression(base, startLoc, state);
15650
15657
  }
@@ -15697,13 +15704,18 @@ function requireLib () {
15697
15704
  return this.finishNode(node, "MemberExpression");
15698
15705
  }
15699
15706
  }
15700
- parseBind(base, startLoc, noCalls, state) {
15707
+ parseBind(base, startLoc, state) {
15701
15708
  const node = this.startNodeAt(startLoc);
15702
15709
  node.object = base;
15703
15710
  this.next();
15704
- node.callee = this.parseNoCallExpr();
15711
+ const isImport = this.match(83);
15712
+ const callee = this.parseNoCallExpr();
15713
+ if (callee.type === "Super" || isImport && callee.type === "ImportExpression" || callee.type === "Import") {
15714
+ throw this.raise(Errors.UnsupportedBindRHS, callee);
15715
+ }
15716
+ node.callee = callee;
15705
15717
  state.stop = true;
15706
- return this.parseSubscripts(this.finishNode(node, "BindExpression"), startLoc, noCalls);
15718
+ return this.parseSubscripts(this.finishNode(node, "BindExpression"), startLoc, false);
15707
15719
  }
15708
15720
  parseCoverCallAndAsyncArrowHead(base, startLoc, state, optional) {
15709
15721
  const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
@@ -16299,9 +16311,12 @@ function requireLib () {
16299
16311
  const isImport = this.match(83);
16300
16312
  const callee = this.parseNoCallExpr();
16301
16313
  node.callee = callee;
16302
- if (isImport && (callee.type === "Import" || callee.type === "ImportExpression")) {
16314
+ if (isImport && callee.type === "ImportExpression" || callee.type === "Import") {
16303
16315
  this.raise(Errors.ImportCallNotNewExpression, callee);
16304
16316
  }
16317
+ if (callee.type === "Super") {
16318
+ this.raise(Errors.SuperCallNotNewExpression, callee);
16319
+ }
16305
16320
  }
16306
16321
  parseTemplateElement(isTagged) {
16307
16322
  const {
@@ -19931,6 +19946,9 @@ function getUnnormalizedProps(props, callPath = []) {
19931
19946
  return [props, callPath];
19932
19947
  }
19933
19948
  function injectProp(node, prop, context) {
19949
+ if (node.type !== 13 && injectSlotKey(node, prop)) {
19950
+ return;
19951
+ }
19934
19952
  let propsWithInjection;
19935
19953
  let props = node.type === 13 ? node.props : node.arguments[2];
19936
19954
  let callPath = [];
@@ -19988,6 +20006,24 @@ function injectProp(node, prop, context) {
19988
20006
  }
19989
20007
  }
19990
20008
  }
20009
+ function injectSlotKey(node, prop) {
20010
+ var _a, _b, _c;
20011
+ if (prop.key.type !== 4 || prop.key.content !== "key") {
20012
+ return false;
20013
+ }
20014
+ const props = node.arguments[2];
20015
+ if (props && !isString$1(props)) {
20016
+ const [unnormalizedProps] = getUnnormalizedProps(props);
20017
+ if (unnormalizedProps && !isString$1(unnormalizedProps) && unnormalizedProps.type === 15 && hasProp(prop, unnormalizedProps)) {
20018
+ return true;
20019
+ }
20020
+ }
20021
+ (_a = node.arguments)[2] || (_a[2] = "{}");
20022
+ (_b = node.arguments)[3] || (_b[3] = "undefined");
20023
+ (_c = node.arguments)[4] || (_c[4] = "undefined");
20024
+ node.arguments[5] = prop.value;
20025
+ return true;
20026
+ }
19991
20027
  function hasProp(prop, props) {
19992
20028
  let result = false;
19993
20029
  if (prop.key.type === 4) {
@@ -26037,6 +26073,7 @@ const transformFor = createStructuralDirectiveTransform(
26037
26073
  node.loc
26038
26074
  );
26039
26075
  return () => {
26076
+ var _a;
26040
26077
  let childBlock;
26041
26078
  const { children } = forNode;
26042
26079
  if (isTemplate) {
@@ -26080,7 +26117,8 @@ const transformFor = createStructuralDirectiveTransform(
26080
26117
  if (isTemplate && keyProperty) {
26081
26118
  injectProp(childBlock, keyProperty, context);
26082
26119
  }
26083
- if (childBlock.isBlock !== !isStableFragment) {
26120
+ const shouldUseBlock = !isStableFragment || childBlock.isBlockRequired === true;
26121
+ if (childBlock.isBlock !== shouldUseBlock) {
26084
26122
  if (childBlock.isBlock) {
26085
26123
  removeHelper(OPEN_BLOCK);
26086
26124
  removeHelper(
@@ -26092,12 +26130,15 @@ const transformFor = createStructuralDirectiveTransform(
26092
26130
  );
26093
26131
  }
26094
26132
  }
26095
- childBlock.isBlock = !isStableFragment;
26133
+ childBlock.isBlock = shouldUseBlock;
26096
26134
  if (childBlock.isBlock) {
26097
26135
  helper(OPEN_BLOCK);
26098
26136
  helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
26099
26137
  } else {
26100
26138
  helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
26139
+ if (childBlock.needsPatch) {
26140
+ childBlock.patchFlag = ((_a = childBlock.patchFlag) != null ? _a : 0) | 512;
26141
+ }
26101
26142
  }
26102
26143
  }
26103
26144
  if (memo) {
@@ -26516,6 +26557,8 @@ const transformElement = (node, context) => {
26516
26557
  let vnodeDynamicProps;
26517
26558
  let dynamicPropNames;
26518
26559
  let vnodeDirectives;
26560
+ let needsPatch = false;
26561
+ let isBlockRequired = false;
26519
26562
  let shouldUseBlock = (
26520
26563
  // dynamic component may resolve to plain elements
26521
26564
  isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && // <svg> and <foreignObject> must be forced into blocks so that block
@@ -26535,6 +26578,8 @@ const transformElement = (node, context) => {
26535
26578
  vnodeProps = propsBuildResult.props;
26536
26579
  patchFlag = propsBuildResult.patchFlag;
26537
26580
  dynamicPropNames = propsBuildResult.dynamicPropNames;
26581
+ needsPatch = propsBuildResult.needsPatch;
26582
+ isBlockRequired = propsBuildResult.isBlockRequired;
26538
26583
  const directives = propsBuildResult.directives;
26539
26584
  vnodeDirectives = directives && directives.length ? createArrayExpression(
26540
26585
  directives.map((dir) => buildDirectiveArgs(dir, context))
@@ -26585,7 +26630,7 @@ const transformElement = (node, context) => {
26585
26630
  if (dynamicPropNames && dynamicPropNames.length) {
26586
26631
  vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
26587
26632
  }
26588
- node.codegenNode = createVNodeCall(
26633
+ const vnodeCall = node.codegenNode = createVNodeCall(
26589
26634
  context,
26590
26635
  vnodeTag,
26591
26636
  vnodeProps,
@@ -26598,6 +26643,13 @@ const transformElement = (node, context) => {
26598
26643
  isComponent,
26599
26644
  node.loc
26600
26645
  );
26646
+ needsPatch = needsPatch && (patchFlag === 0 || patchFlag === 32);
26647
+ if (needsPatch) {
26648
+ vnodeCall.needsPatch = true;
26649
+ }
26650
+ if (isBlockRequired) {
26651
+ vnodeCall.isBlockRequired = true;
26652
+ }
26601
26653
  };
26602
26654
  };
26603
26655
  function resolveComponentType(node, context, ssr = false) {
@@ -26704,6 +26756,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
26704
26756
  const runtimeDirectives = [];
26705
26757
  const hasChildren = children.length > 0;
26706
26758
  let shouldUseBlock = false;
26759
+ let isBlockRequired = false;
26707
26760
  let patchFlag = 0;
26708
26761
  let hasRef = false;
26709
26762
  let hasClassBinding = false;
@@ -26745,19 +26798,20 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
26745
26798
  if (isEventHandler && isReservedProp(name)) {
26746
26799
  hasVnodeHook = true;
26747
26800
  }
26801
+ if (name === "ref") {
26802
+ hasRef = true;
26803
+ }
26748
26804
  if (isEventHandler && value.type === 14) {
26749
26805
  value = value.arguments[0];
26750
26806
  }
26751
26807
  if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
26752
26808
  return;
26753
26809
  }
26754
- if (name === "ref") {
26755
- hasRef = true;
26756
- } else if (name === "class") {
26810
+ if (name === "class") {
26757
26811
  hasClassBinding = true;
26758
26812
  } else if (name === "style") {
26759
26813
  hasStyleBinding = true;
26760
- } else if (name !== "key" && !dynamicPropNames.includes(name)) {
26814
+ } else if (name !== "ref" && name !== "key" && !dynamicPropNames.includes(name)) {
26761
26815
  dynamicPropNames.push(name);
26762
26816
  }
26763
26817
  if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) {
@@ -26822,13 +26876,12 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
26822
26876
  if (isVOn && ssr) {
26823
26877
  continue;
26824
26878
  }
26825
- if (
26826
- // #938: elements with dynamic keys should be forced into blocks
26827
- isVBind && isStaticArgOf(arg, "key") || // inline before-update hooks need to force block so that it is invoked
26828
- // before children
26829
- isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update")
26830
- ) {
26879
+ if (isVBind && isStaticArgOf(arg, "key")) {
26880
+ shouldUseBlock = true;
26881
+ }
26882
+ if (isVOn && hasChildren && arg && isStaticExp(arg) && camelize(arg.content) === "vue:beforeUpdate") {
26831
26883
  shouldUseBlock = true;
26884
+ isBlockRequired = true;
26832
26885
  }
26833
26886
  if (isVBind && isStaticArgOf(arg, "ref")) {
26834
26887
  pushRefVForMarker();
@@ -26880,6 +26933,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
26880
26933
  runtimeDirectives.push(prop);
26881
26934
  if (hasChildren) {
26882
26935
  shouldUseBlock = true;
26936
+ isBlockRequired = true;
26883
26937
  }
26884
26938
  }
26885
26939
  }
@@ -26918,7 +26972,8 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
26918
26972
  patchFlag |= 32;
26919
26973
  }
26920
26974
  }
26921
- if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
26975
+ const needsPatch = (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0);
26976
+ if (!shouldUseBlock && needsPatch) {
26922
26977
  patchFlag |= 512;
26923
26978
  }
26924
26979
  if (!context.inSSR && propsExpression) {
@@ -26984,7 +27039,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
26984
27039
  directives: runtimeDirectives,
26985
27040
  patchFlag,
26986
27041
  dynamicPropNames,
26987
- shouldUseBlock
27042
+ shouldUseBlock,
27043
+ needsPatch,
27044
+ isBlockRequired
26988
27045
  };
26989
27046
  }
26990
27047
  function dedupeProperties(properties) {
@@ -28247,12 +28304,15 @@ function stringifyElement(node, context) {
28247
28304
  res += ` ${p.arg.content}="__VUE_EXP_START__${exp.content}__VUE_EXP_END__"`;
28248
28305
  continue;
28249
28306
  }
28250
- if (isBooleanAttr(p.arg.content) && exp.content === "false") {
28307
+ if ((isBooleanAttr(p.arg.content) || p.arg.content === "hidden") && exp.content === "false") {
28251
28308
  continue;
28252
28309
  }
28253
28310
  let evaluated = evaluateConstant(exp);
28254
28311
  if (evaluated != null) {
28255
28312
  const arg = p.arg && p.arg.content;
28313
+ if (arg === "hidden" && typeof evaluated === "number" && !includeBooleanAttr(evaluated)) {
28314
+ continue;
28315
+ }
28256
28316
  if (arg === "class") {
28257
28317
  evaluated = normalizeClass(evaluated);
28258
28318
  } else if (arg === "style") {
@@ -29150,17 +29210,53 @@ function createCache(max = 500) {
29150
29210
  }
29151
29211
  }
29152
29212
 
29153
- function isImportUsed(local, sfc) {
29154
- return resolveTemplateUsedIdentifiers(sfc).has(local);
29213
+ var __defProp$b = Object.defineProperty;
29214
+ var __defProps$a = Object.defineProperties;
29215
+ var __getOwnPropDescs$a = Object.getOwnPropertyDescriptors;
29216
+ var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
29217
+ var __hasOwnProp$b = Object.prototype.hasOwnProperty;
29218
+ var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
29219
+ var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
29220
+ var __spreadValues$b = (a, b) => {
29221
+ for (var prop in b || (b = {}))
29222
+ if (__hasOwnProp$b.call(b, prop))
29223
+ __defNormalProp$b(a, prop, b[prop]);
29224
+ if (__getOwnPropSymbols$b)
29225
+ for (var prop of __getOwnPropSymbols$b(b)) {
29226
+ if (__propIsEnum$b.call(b, prop))
29227
+ __defNormalProp$b(a, prop, b[prop]);
29228
+ }
29229
+ return a;
29230
+ };
29231
+ var __spreadProps$a = (a, b) => __defProps$a(a, __getOwnPropDescs$a(b));
29232
+ function resolveTemplateAST(inAST, options) {
29233
+ if (!(inAST == null ? void 0 : inAST.transformed)) {
29234
+ return inAST;
29235
+ }
29236
+ const { compiler = CompilerDOM, compilerOptions, ssr, onError } = options;
29237
+ const newAST = (ssr ? CompilerDOM : compiler).parse(inAST.source, __spreadProps$a(__spreadValues$b({
29238
+ prefixIdentifiers: true
29239
+ }, compilerOptions), {
29240
+ parseMode: "sfc",
29241
+ onError
29242
+ }));
29243
+ const template = newAST.children.find(
29244
+ (node) => node.type === 1 && node.tag === "template"
29245
+ );
29246
+ return createRoot(template.children, inAST.source);
29247
+ }
29248
+
29249
+ function isImportUsed(local, sfc, options) {
29250
+ return resolveTemplateUsedIdentifiers(sfc, options).has(local);
29155
29251
  }
29156
29252
  const templateAnalysisCache = createCache();
29157
- function resolveTemplateVModelIdentifiers(sfc) {
29158
- return resolveTemplateAnalysisResult(sfc, false).vModelIds;
29253
+ function resolveTemplateVModelIdentifiers(sfc, options) {
29254
+ return resolveTemplateAnalysisResult(sfc, false, options).vModelIds;
29159
29255
  }
29160
- function resolveTemplateUsedIdentifiers(sfc) {
29161
- return resolveTemplateAnalysisResult(sfc).usedIds;
29256
+ function resolveTemplateUsedIdentifiers(sfc, options) {
29257
+ return resolveTemplateAnalysisResult(sfc, true, options).usedIds;
29162
29258
  }
29163
- function resolveTemplateAnalysisResult(sfc, collectUsedIds = true) {
29259
+ function resolveTemplateAnalysisResult(sfc, collectUsedIds = true, options) {
29164
29260
  const { content, ast } = sfc.template;
29165
29261
  const cached = templateAnalysisCache.get(content);
29166
29262
  if (cached && (!collectUsedIds || cached.usedIds)) {
@@ -29168,7 +29264,15 @@ function resolveTemplateAnalysisResult(sfc, collectUsedIds = true) {
29168
29264
  }
29169
29265
  const ids = collectUsedIds ? /* @__PURE__ */ new Set() : void 0;
29170
29266
  const vModelIds = /* @__PURE__ */ new Set();
29171
- ast.children.forEach(walk);
29267
+ const root = resolveTemplateAST(ast, {
29268
+ compiler: options == null ? void 0 : options.compiler,
29269
+ compilerOptions: options == null ? void 0 : options.compilerOptions,
29270
+ ssr: options == null ? void 0 : options.ssr,
29271
+ // ignore errors since they were already reported by the SFC parser
29272
+ onError: () => {
29273
+ }
29274
+ });
29275
+ root.children.forEach(walk);
29172
29276
  function walk(node) {
29173
29277
  var _a;
29174
29278
  switch (node.type) {
@@ -32481,6 +32585,13 @@ const ssrTransformElement = (node, context) => {
32481
32585
  false
32482
32586
  )
32483
32587
  );
32588
+ } else if (attrName === "hidden") {
32589
+ openTag.push(
32590
+ createCallExpression(
32591
+ context.helper(SSR_RENDER_DYNAMIC_ATTR),
32592
+ [key, value]
32593
+ )
32594
+ );
32484
32595
  } else if (isSSRSafeAttrName(attrName)) {
32485
32596
  openTag.push(
32486
32597
  createCallExpression(context.helper(SSR_RENDER_ATTR), [
@@ -33588,18 +33699,12 @@ function doCompileTemplate({
33588
33699
  if (compiler !== defaultCompiler) {
33589
33700
  inAST = void 0;
33590
33701
  }
33591
- if (inAST == null ? void 0 : inAST.transformed) {
33592
- const newAST = (ssr ? CompilerDOM : compiler).parse(inAST.source, __spreadProps$5(__spreadValues$6({
33593
- prefixIdentifiers: true
33594
- }, compilerOptions), {
33595
- parseMode: "sfc",
33596
- onError: (e) => errors.push(e)
33597
- }));
33598
- const template = newAST.children.find(
33599
- (node) => node.type === 1 && node.tag === "template"
33600
- );
33601
- inAST = createRoot(template.children, inAST.source);
33602
- }
33702
+ inAST = resolveTemplateAST(inAST, {
33703
+ compiler,
33704
+ compilerOptions,
33705
+ ssr,
33706
+ onError: (e) => errors.push(e)
33707
+ });
33603
33708
  let { code, ast, preamble, map } = compiler.compile(inAST || source, __spreadProps$5(__spreadValues$6({
33604
33709
  mode: "module",
33605
33710
  prefixIdentifiers: true,
@@ -34294,6 +34399,10 @@ function requireStringifier () {
34294
34399
  const STYLE_TAG = /(<)(\/?style\b)/gi;
34295
34400
  const COMMENT_OPEN = /(<)(!--)/g;
34296
34401
 
34402
+ // Characters that end an at-rule name, mirroring RE_AT_END in the tokenizer.
34403
+ // Params starting with anything else need a space to stay separate tokens.
34404
+ const AT_NAME_END = /[\t\n\f\r "#'()/;[\\\]{}]/;
34405
+
34297
34406
  function escapeHTMLInCSS(str) {
34298
34407
  if (typeof str !== 'string') return str
34299
34408
  if (!str.includes('<')) return str
@@ -34319,27 +34428,89 @@ function requireStringifier () {
34319
34428
  return str[0].toUpperCase() + str.slice(1)
34320
34429
  }
34321
34430
 
34431
+ function atruleStart(str, node) {
34432
+ let name = '@' + node.name;
34433
+ let params = node.params ? str.rawValue(node, 'params') : '';
34434
+ let afterName = node.raws.afterName;
34435
+
34436
+ if (typeof afterName === 'undefined') {
34437
+ afterName = params ? ' ' : '';
34438
+ } else if (afterName === '' && params && !AT_NAME_END.test(params[0])) {
34439
+ afterName = ' ';
34440
+ }
34441
+
34442
+ return name + afterName + params
34443
+ }
34444
+
34445
+ function pushBody(str, stack, node) {
34446
+ let nodes = node.nodes;
34447
+ let last = nodes.length - 1;
34448
+ while (last > 0) {
34449
+ if (nodes[last].type !== 'comment') break
34450
+ last -= 1;
34451
+ }
34452
+
34453
+ let semicolon = str.raw(node, 'semicolon');
34454
+ let isDocument = node.type === 'document';
34455
+ for (let i = nodes.length - 1; i >= 0; i--) {
34456
+ let child = nodes[i];
34457
+ let childSemicolon = last !== i || semicolon;
34458
+ // A childless at-rule or a custom property declaration that still has
34459
+ // following siblings must be terminated. Without the semicolon those
34460
+ // trailing comments are folded into the at-rule's prelude or the custom
34461
+ // property's value and disappear when the output is re-parsed.
34462
+ if (
34463
+ !childSemicolon &&
34464
+ i < nodes.length - 1 &&
34465
+ ((child.type === 'atrule' && !child.nodes) ||
34466
+ (child.type === 'decl' && child.prop.startsWith('--')))
34467
+ ) {
34468
+ childSemicolon = true;
34469
+ }
34470
+ stack.push({
34471
+ document: isDocument,
34472
+ node: child,
34473
+ semicolon: childSemicolon
34474
+ });
34475
+ }
34476
+ }
34477
+
34478
+ function pushBlock(str, stack, node, start) {
34479
+ let between = str.raw(node, 'between', 'beforeOpen');
34480
+ str.builder(escapeHTMLInCSS(start + between) + '{', node, 'start');
34481
+
34482
+ let hasNodes = node.nodes && node.nodes.length;
34483
+ let close = () => {
34484
+ let after = hasNodes
34485
+ ? str.raw(node, 'after')
34486
+ : str.raw(node, 'after', 'emptyBody');
34487
+ if (after) str.builder(escapeHTMLInCSS(after));
34488
+ str.builder('}', node, 'end');
34489
+ if (node.type === 'rule' && node.raws.ownSemicolon) {
34490
+ str.builder(escapeHTMLInCSS(node.raws.ownSemicolon), node, 'end');
34491
+ }
34492
+ };
34493
+
34494
+ if (hasNodes) {
34495
+ stack.push(close);
34496
+ pushBody(str, stack, node);
34497
+ } else {
34498
+ close();
34499
+ }
34500
+ }
34501
+
34322
34502
  class Stringifier {
34323
34503
  constructor(builder) {
34324
34504
  this.builder = builder;
34325
34505
  }
34326
34506
 
34327
34507
  atrule(node, semicolon) {
34328
- let raws = node.raws;
34329
- let name = '@' + node.name;
34330
- let params = node.params ? this.rawValue(node, 'params') : '';
34331
-
34332
- if (typeof raws.afterName !== 'undefined') {
34333
- name += raws.afterName;
34334
- } else if (params) {
34335
- name += ' ';
34336
- }
34337
-
34508
+ let start = atruleStart(this, node);
34338
34509
  if (node.nodes) {
34339
- this.block(node, name + params);
34510
+ this.block(node, start);
34340
34511
  } else {
34341
- let end = (raws.between || '') + (semicolon ? ';' : '');
34342
- this.builder(escapeHTMLInCSS(name + params + end), node);
34512
+ let end = (node.raws.between || '') + (semicolon ? ';' : '');
34513
+ this.builder(escapeHTMLInCSS(start + end), node);
34343
34514
  }
34344
34515
  }
34345
34516
 
@@ -34389,20 +34560,38 @@ function requireStringifier () {
34389
34560
  }
34390
34561
 
34391
34562
  body(node) {
34392
- let nodes = node.nodes;
34393
- let last = nodes.length - 1;
34394
- while (last > 0) {
34395
- if (nodes[last].type !== 'comment') break
34396
- last -= 1;
34397
- }
34563
+ // Rules and at-rules are expanded into an explicit stack instead of
34564
+ // recursive `stringify()` calls to survive deeply nested trees.
34565
+ // If a subclass changes the traversal methods, its children go
34566
+ // through `stringify()` to keep the override in charge.
34567
+ let proto = Stringifier.prototype;
34568
+ let expandable = ['atrule', 'block', 'body', 'rule', 'stringify'].every(
34569
+ method => this[method] === proto[method]
34570
+ );
34398
34571
 
34399
- let semicolon = this.raw(node, 'semicolon');
34400
- let isDocument = node.type === 'document';
34401
- for (let i = 0; i < nodes.length; i++) {
34402
- let child = nodes[i];
34572
+ let stack = [];
34573
+ pushBody(this, stack, node);
34574
+
34575
+ while (stack.length > 0) {
34576
+ let entry = stack.pop();
34577
+ if (typeof entry === 'function') {
34578
+ entry();
34579
+ continue
34580
+ }
34581
+
34582
+ let child = entry.node;
34403
34583
  let before = this.raw(child, 'before');
34404
- if (before) this.builder(isDocument ? before : escapeHTMLInCSS(before));
34405
- this.stringify(child, last !== i || semicolon);
34584
+ if (before) {
34585
+ this.builder(entry.document ? before : escapeHTMLInCSS(before));
34586
+ }
34587
+
34588
+ if (expandable && child.type === 'rule') {
34589
+ pushBlock(this, stack, child, this.rawValue(child, 'selector'));
34590
+ } else if (expandable && child.type === 'atrule' && child.nodes) {
34591
+ pushBlock(this, stack, child, atruleStart(this, child));
34592
+ } else {
34593
+ this.stringify(child, entry.semicolon);
34594
+ }
34406
34595
  }
34407
34596
  }
34408
34597
 
@@ -34710,25 +34899,41 @@ function requireNode$2 () {
34710
34899
 
34711
34900
  function cloneNode(obj, parent) {
34712
34901
  let cloned = new obj.constructor();
34713
-
34714
- for (let i in obj) {
34715
- if (!Object.prototype.hasOwnProperty.call(obj, i)) {
34716
- /* c8 ignore next 2 */
34717
- continue
34718
- }
34719
- if (i === 'proxyCache') continue
34720
- let value = obj[i];
34721
- let type = typeof value;
34722
-
34723
- if (i === 'parent' && type === 'object') {
34724
- if (parent) cloned[i] = parent;
34725
- } else if (i === 'source') {
34726
- cloned[i] = value;
34727
- } else if (Array.isArray(value)) {
34728
- cloned[i] = value.map(j => cloneNode(j, cloned));
34729
- } else {
34730
- if (type === 'object' && value !== null) value = cloneNode(value);
34731
- cloned[i] = value;
34902
+ // An explicit stack instead of recursive calls to survive deeply
34903
+ // nested trees. Each entry is [source, its clone, clone's parent].
34904
+ let stack = [[obj, cloned, parent]];
34905
+
34906
+ while (stack.length > 0) {
34907
+ let [source, target, targetParent] = stack.pop();
34908
+ for (let i in source) {
34909
+ if (!Object.prototype.hasOwnProperty.call(source, i)) {
34910
+ /* c8 ignore next 2 */
34911
+ continue
34912
+ }
34913
+ if (i === 'proxyCache') continue
34914
+ let value = source[i];
34915
+ let type = typeof value;
34916
+
34917
+ if (i === 'parent' && type === 'object') {
34918
+ if (targetParent) target[i] = targetParent;
34919
+ } else if (i === 'source') {
34920
+ target[i] = value;
34921
+ } else if (Array.isArray(value)) {
34922
+ let children = [];
34923
+ target[i] = children;
34924
+ for (let j of value) {
34925
+ let childClone = new j.constructor();
34926
+ children.push(childClone);
34927
+ stack.push([j, childClone, target]);
34928
+ }
34929
+ } else {
34930
+ if (type === 'object' && value !== null) {
34931
+ let valueClone = new value.constructor();
34932
+ stack.push([value, valueClone, undefined]);
34933
+ value = valueClone;
34934
+ }
34935
+ target[i] = value;
34936
+ }
34732
34937
  }
34733
34938
  }
34734
34939
 
@@ -34772,11 +34977,15 @@ function requireNode$2 () {
34772
34977
  this[isClean] = false;
34773
34978
  this[my] = true;
34774
34979
 
34775
- for (let name in defaults) {
34980
+ for (let name of Object.keys(defaults)) {
34981
+ if (name === '__proto__') continue
34776
34982
  if (name === 'nodes') {
34777
34983
  this.nodes = [];
34778
34984
  for (let node of defaults[name]) {
34779
- if (typeof node.clone === 'function') {
34985
+ // Clone only nodes that already belong to another tree, so passing a
34986
+ // freshly created (parent-less) node adopts that instance instead of
34987
+ // a copy and keeps the caller's reference usable. See #1987.
34988
+ if (typeof node.clone === 'function' && node.parent) {
34780
34989
  this.append(node.clone());
34781
34990
  } else {
34782
34991
  this.append(node);
@@ -34909,14 +35118,18 @@ function requireNode$2 () {
34909
35118
  }
34910
35119
 
34911
35120
  positionBy(opts = {}) {
34912
- let pos = this.source.start;
35121
+ let inputString =
35122
+ 'document' in this.source.input
35123
+ ? this.source.input.document
35124
+ : this.source.input.css;
35125
+ let pos = {
35126
+ column: this.source.start.column,
35127
+ line: this.source.start.line,
35128
+ offset: sourceOffset(inputString, this.source.start)
35129
+ };
34913
35130
  if (opts.index) {
34914
35131
  pos = this.positionInside(opts.index);
34915
35132
  } else if (opts.word) {
34916
- let inputString =
34917
- 'document' in this.source.input
34918
- ? this.source.input.document
34919
- : this.source.input.css;
34920
35133
  let stringRepresentation = inputString.slice(
34921
35134
  sourceOffset(inputString, this.source.start),
34922
35135
  sourceOffset(inputString, this.source.end)
@@ -35001,7 +35214,7 @@ function requireNode$2 () {
35001
35214
  line: opts.start.line,
35002
35215
  offset: sourceOffset(inputString, opts.start)
35003
35216
  };
35004
- } else if (opts.index) {
35217
+ } else if (typeof opts.index === 'number') {
35005
35218
  start = this.positionInside(opts.index);
35006
35219
  }
35007
35220
 
@@ -35013,7 +35226,7 @@ function requireNode$2 () {
35013
35226
  };
35014
35227
  } else if (typeof opts.endIndex === 'number') {
35015
35228
  end = this.positionInside(opts.endIndex);
35016
- } else if (opts.index) {
35229
+ } else if (typeof opts.index === 'number') {
35017
35230
  end = this.positionInside(opts.index + 1);
35018
35231
  }
35019
35232
  }
@@ -35077,47 +35290,68 @@ function requireNode$2 () {
35077
35290
  }
35078
35291
 
35079
35292
  toJSON(_, inputs) {
35080
- let fixed = {};
35081
35293
  let emitInputs = inputs == null;
35082
35294
  inputs = inputs || new Map();
35083
- let inputsNextIndex = 0;
35084
35295
 
35085
- for (let name in this) {
35086
- if (!Object.prototype.hasOwnProperty.call(this, name)) {
35087
- /* c8 ignore next 2 */
35088
- continue
35089
- }
35090
- if (name === 'parent' || name === 'proxyCache') continue
35091
- let value = this[name];
35296
+ // A worklist instead of recursive `toJSON()` calls to survive deeply
35297
+ // nested trees. Each entry converts one node and writes the result
35298
+ // into the already converted parent by [holder, key].
35299
+ let holderOfRoot = [];
35300
+ let queue = [[this, holderOfRoot, 0]];
35092
35301
 
35093
- if (Array.isArray(value)) {
35094
- fixed[name] = value.map(i => {
35095
- if (typeof i === 'object' && i.toJSON) {
35096
- return i.toJSON(null, inputs)
35302
+ for (let step = 0; step < queue.length; step++) {
35303
+ let [node, holder, key] = queue[step];
35304
+ let fixed = {};
35305
+ holder[key] = fixed;
35306
+
35307
+ for (let name in node) {
35308
+ if (!Object.prototype.hasOwnProperty.call(node, name)) {
35309
+ /* c8 ignore next 2 */
35310
+ continue
35311
+ }
35312
+ if (name === 'parent' || name === 'proxyCache') continue
35313
+ let value = node[name];
35314
+
35315
+ if (Array.isArray(value)) {
35316
+ let fixedArray = [];
35317
+ fixed[name] = fixedArray;
35318
+ for (let i = 0; i < value.length; i++) {
35319
+ let item = value[i];
35320
+ if (typeof item === 'object' && item.toJSON) {
35321
+ if (item.toJSON === Node.prototype.toJSON) {
35322
+ queue.push([item, fixedArray, i]);
35323
+ } else {
35324
+ fixedArray[i] = item.toJSON(null, inputs);
35325
+ }
35326
+ } else {
35327
+ fixedArray[i] = item;
35328
+ }
35329
+ }
35330
+ } else if (typeof value === 'object' && value.toJSON) {
35331
+ if (value.toJSON === Node.prototype.toJSON) {
35332
+ queue.push([value, fixed, name]);
35097
35333
  } else {
35098
- return i
35334
+ fixed[name] = value.toJSON(null, inputs);
35099
35335
  }
35100
- });
35101
- } else if (typeof value === 'object' && value.toJSON) {
35102
- fixed[name] = value.toJSON(null, inputs);
35103
- } else if (name === 'source') {
35104
- if (value == null) continue
35105
- let inputId = inputs.get(value.input);
35106
- if (inputId == null) {
35107
- inputId = inputsNextIndex;
35108
- inputs.set(value.input, inputsNextIndex);
35109
- inputsNextIndex++;
35110
- }
35111
- fixed[name] = {
35112
- end: value.end,
35113
- inputId,
35114
- start: value.start
35115
- };
35116
- } else {
35117
- fixed[name] = value;
35336
+ } else if (name === 'source') {
35337
+ if (value == null) continue
35338
+ let inputId = inputs.get(value.input);
35339
+ if (inputId == null) {
35340
+ inputId = inputs.size;
35341
+ inputs.set(value.input, inputId);
35342
+ }
35343
+ fixed[name] = {
35344
+ end: value.end,
35345
+ inputId,
35346
+ start: value.start
35347
+ };
35348
+ } else {
35349
+ fixed[name] = value;
35350
+ }
35118
35351
  }
35119
35352
  }
35120
35353
 
35354
+ let fixed = holderOfRoot[0];
35121
35355
  if (emitInputs) {
35122
35356
  fixed.inputs = [...inputs.keys()].map(input => input.toJSON());
35123
35357
  }
@@ -35221,18 +35455,25 @@ function requireContainer$1 () {
35221
35455
  let AtRule, parse, Root, Rule;
35222
35456
 
35223
35457
  function cleanSource(nodes) {
35224
- return nodes.map(i => {
35225
- if (i.nodes) i.nodes = cleanSource(i.nodes);
35226
- delete i.source;
35227
- return i
35228
- })
35458
+ let stack = nodes.slice();
35459
+ while (stack.length > 0) {
35460
+ let node = stack.pop();
35461
+ delete node.source;
35462
+ if (node.nodes) {
35463
+ node.nodes = node.nodes.slice();
35464
+ for (let i of node.nodes) stack.push(i);
35465
+ }
35466
+ }
35467
+ return nodes.slice()
35229
35468
  }
35230
35469
 
35231
35470
  function markTreeDirty(node) {
35232
- node[isClean] = false;
35233
- if (node.proxyOf.nodes) {
35234
- for (let i of node.proxyOf.nodes) {
35235
- markTreeDirty(i);
35471
+ let stack = [node];
35472
+ while (stack.length > 0) {
35473
+ let next = stack.pop();
35474
+ next[isClean] = false;
35475
+ if (next.proxyOf.nodes) {
35476
+ for (let i of next.proxyOf.nodes) stack.push(i);
35236
35477
  }
35237
35478
  }
35238
35479
  }
@@ -35260,9 +35501,18 @@ function requireContainer$1 () {
35260
35501
  }
35261
35502
 
35262
35503
  cleanRaws(keepBetween) {
35263
- super.cleanRaws(keepBetween);
35264
- if (this.nodes) {
35265
- for (let node of this.nodes) node.cleanRaws(keepBetween);
35504
+ let stack = [this];
35505
+ while (stack.length > 0) {
35506
+ let node = stack.pop();
35507
+ if (node !== this && node.cleanRaws !== Container.prototype.cleanRaws) {
35508
+ // Subclass with own logic; let it handle its subtree
35509
+ node.cleanRaws(keepBetween);
35510
+ continue
35511
+ }
35512
+ Node.prototype.cleanRaws.call(node, keepBetween);
35513
+ if (node.nodes) {
35514
+ for (let child of node.nodes) stack.push(child);
35515
+ }
35266
35516
  }
35267
35517
  }
35268
35518
 
@@ -35522,19 +35772,48 @@ function requireContainer$1 () {
35522
35772
  }
35523
35773
 
35524
35774
  walk(callback) {
35525
- return this.each((child, i) => {
35775
+ if (!this.proxyOf.nodes) return undefined
35776
+
35777
+ // An explicit stack instead of recursive `each()` calls to survive
35778
+ // deeply nested trees. Each frame keeps a live `indexes` slot, so
35779
+ // insertion and removal during the walk behave like `each()`: the
35780
+ // slot stays at the current child until its subtree is finished.
35781
+ let stack = [{ iterator: this.getIterator(), node: this.proxyOf }];
35782
+
35783
+ while (stack.length > 0) {
35784
+ let { iterator, node } = stack[stack.length - 1];
35785
+ let index = node.indexes[iterator];
35786
+
35787
+ if (index >= node.proxyOf.nodes.length) {
35788
+ delete node.indexes[iterator];
35789
+ stack.pop();
35790
+ let parent = stack[stack.length - 1];
35791
+ // Finish the parent’s step for the child subtree we just left
35792
+ if (parent) parent.node.indexes[parent.iterator] += 1;
35793
+ continue
35794
+ }
35795
+
35796
+ let child = node.proxyOf.nodes[index];
35526
35797
  let result;
35527
35798
  try {
35528
- result = callback(child, i);
35799
+ result = callback(child, index);
35529
35800
  } catch (e) {
35530
35801
  throw child.addToError(e)
35531
35802
  }
35532
- if (result !== false && child.walk) {
35533
- result = child.walk(callback);
35803
+ if (result === false) {
35804
+ for (let opened of stack) {
35805
+ delete opened.node.indexes[opened.iterator];
35806
+ }
35807
+ return false
35808
+ }
35809
+ if (child.walk && child.proxyOf.nodes) {
35810
+ stack.push({ iterator: child.getIterator(), node: child });
35811
+ } else {
35812
+ node.indexes[iterator] += 1;
35534
35813
  }
35814
+ }
35535
35815
 
35536
- return result
35537
- })
35816
+ return undefined
35538
35817
  }
35539
35818
 
35540
35819
  walkAtRules(name, callback) {
@@ -35637,24 +35916,26 @@ function requireContainer$1 () {
35637
35916
 
35638
35917
  /* c8 ignore start */
35639
35918
  Container.rebuild = node => {
35640
- if (node.type === 'atrule') {
35641
- Object.setPrototypeOf(node, AtRule.prototype);
35642
- } else if (node.type === 'rule') {
35643
- Object.setPrototypeOf(node, Rule.prototype);
35644
- } else if (node.type === 'decl') {
35645
- Object.setPrototypeOf(node, Declaration.prototype);
35646
- } else if (node.type === 'comment') {
35647
- Object.setPrototypeOf(node, Comment.prototype);
35648
- } else if (node.type === 'root') {
35649
- Object.setPrototypeOf(node, Root.prototype);
35650
- }
35919
+ let stack = [node];
35920
+ while (stack.length > 0) {
35921
+ let next = stack.pop();
35922
+ if (next.type === 'atrule') {
35923
+ Object.setPrototypeOf(next, AtRule.prototype);
35924
+ } else if (next.type === 'rule') {
35925
+ Object.setPrototypeOf(next, Rule.prototype);
35926
+ } else if (next.type === 'decl') {
35927
+ Object.setPrototypeOf(next, Declaration.prototype);
35928
+ } else if (next.type === 'comment') {
35929
+ Object.setPrototypeOf(next, Comment.prototype);
35930
+ } else if (next.type === 'root') {
35931
+ Object.setPrototypeOf(next, Root.prototype);
35932
+ }
35651
35933
 
35652
- node[my] = true;
35934
+ next[my] = true;
35653
35935
 
35654
- if (node.nodes) {
35655
- node.nodes.forEach(child => {
35656
- Container.rebuild(child);
35657
- });
35936
+ if (next.nodes) {
35937
+ for (let child of next.nodes) stack.push(child);
35938
+ }
35658
35939
  }
35659
35940
  };
35660
35941
  /* c8 ignore stop */
@@ -35741,22 +36022,14 @@ var hasRequiredNonSecure;
35741
36022
  function requireNonSecure () {
35742
36023
  if (hasRequiredNonSecure) return nonSecure;
35743
36024
  hasRequiredNonSecure = 1;
35744
- // This alphabet uses `A-Za-z0-9_-` symbols.
35745
- // The order of characters is optimized for better gzip and brotli compression.
35746
- // References to the same file (works both for gzip and brotli):
35747
- // `'use`, `andom`, and `rict'`
35748
- // References to the brotli default dictionary:
35749
- // `-26T`, `1983`, `40px`, `75px`, `bush`, `jack`, `mind`, `very`, and `wolf`
35750
36025
  let urlAlphabet =
35751
36026
  'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
35752
36027
 
35753
36028
  let customAlphabet = (alphabet, defaultSize = 21) => {
35754
36029
  return (size = defaultSize) => {
35755
36030
  let id = '';
35756
- // A compact alternative for `for (var i = 0; i < step; i++)`.
35757
36031
  let i = size | 0;
35758
- while (i--) {
35759
- // `| 0` is more compact and faster than `Math.floor()`.
36032
+ while (i-- > 0) {
35760
36033
  id += alphabet[(Math.random() * alphabet.length) | 0];
35761
36034
  }
35762
36035
  return id
@@ -35765,10 +36038,8 @@ function requireNonSecure () {
35765
36038
 
35766
36039
  let nanoid = (size = 21) => {
35767
36040
  let id = '';
35768
- // A compact alternative for `for (var i = 0; i < step; i++)`.
35769
36041
  let i = size | 0;
35770
- while (i--) {
35771
- // `| 0` is more compact and faster than `Math.floor()`.
36042
+ while (i-- > 0) {
35772
36043
  id += urlAlphabet[(Math.random() * 64) | 0];
35773
36044
  }
35774
36045
  return id
@@ -35788,7 +36059,7 @@ function requirePreviousMap () {
35788
36059
  hasRequiredPreviousMap = 1;
35789
36060
 
35790
36061
  let { existsSync, readFileSync } = require$$0$1;
35791
- let { dirname, join } = require$$1;
36062
+ let { dirname, isAbsolute, join, relative, sep } = require$$1;
35792
36063
  let { SourceMapConsumer, SourceMapGenerator } = /*@__PURE__*/ requireSourceMap$1();
35793
36064
 
35794
36065
  function fromBase64(str) {
@@ -35872,9 +36143,12 @@ function requirePreviousMap () {
35872
36143
  }
35873
36144
 
35874
36145
  loadFile(path, cssFile, trusted) {
35875
- /* c8 ignore next 5 */
35876
36146
  if (!trusted && !this.unsafeMap) {
35877
- if (!/\.map$/i.test(path)) {
36147
+ if (!/\.map$/i.test(path)) return undefined
36148
+ if (!cssFile) return undefined
36149
+
36150
+ let rel = relative(dirname(cssFile), path);
36151
+ if (rel === '..' || rel.startsWith('..' + sep) || isAbsolute(rel)) {
35878
36152
  return undefined
35879
36153
  }
35880
36154
  }
@@ -36162,12 +36436,21 @@ function requireInput () {
36162
36436
  if (!this.map) return false
36163
36437
  let consumer = this.map.consumer();
36164
36438
 
36165
- let from = consumer.originalPositionFor({ column, line });
36439
+ let from = consumer.originalPositionFor({ column: column - 1, line });
36166
36440
  if (!from.source) return false
36167
36441
 
36168
36442
  let to;
36169
36443
  if (typeof endLine === 'number') {
36170
- to = consumer.originalPositionFor({ column: endColumn, line: endLine });
36444
+ let toPosition = consumer.originalPositionFor({
36445
+ column: endColumn - 1,
36446
+ line: endLine
36447
+ });
36448
+ // The source map may not have a mapping that covers the end position
36449
+ // (`originalPositionFor()` then returns `null` for `line`/`column`
36450
+ // instead of omitting them). Treat that the same as not requesting
36451
+ // an end position at all, so `endLine`/`endColumn` stay a consistent
36452
+ // `undefined` pair instead of a mix of `null` and a bogus number.
36453
+ if (toPosition.source) to = toPosition;
36171
36454
  }
36172
36455
 
36173
36456
  let fromUrl;
@@ -36182,8 +36465,8 @@ function requireInput () {
36182
36465
  }
36183
36466
 
36184
36467
  let result = {
36185
- column: from.column,
36186
- endColumn: to && to.column,
36468
+ column: from.column + 1,
36469
+ endColumn: to && to.column + 1,
36187
36470
  endLine: to && to.line,
36188
36471
  line: from.line,
36189
36472
  url: fromUrl.toString()
@@ -36249,6 +36532,19 @@ function requireRoot$1 () {
36249
36532
  }
36250
36533
 
36251
36534
  normalize(child, sample, type) {
36535
+ let keepBefore = new Set();
36536
+ for (let node of Array.isArray(child) ? child : [child]) {
36537
+ if (
36538
+ node &&
36539
+ typeof node === 'object' &&
36540
+ !node.parent &&
36541
+ node.raws &&
36542
+ typeof node.raws.before !== 'undefined'
36543
+ ) {
36544
+ keepBefore.add(node.raws);
36545
+ }
36546
+ }
36547
+
36252
36548
  let nodes = super.normalize(child);
36253
36549
 
36254
36550
  if (sample) {
@@ -36260,7 +36556,9 @@ function requireRoot$1 () {
36260
36556
  }
36261
36557
  } else if (this.first !== sample) {
36262
36558
  for (let node of nodes) {
36263
- node.raws.before = sample.raws.before;
36559
+ if (!keepBefore.has(node.raws)) {
36560
+ node.raws.before = sample.raws.before;
36561
+ }
36264
36562
  }
36265
36563
  }
36266
36564
  }
@@ -36415,26 +36713,24 @@ function requireFromJSON () {
36415
36713
  let Root = /*@__PURE__*/ requireRoot$1();
36416
36714
  let Rule = /*@__PURE__*/ requireRule();
36417
36715
 
36418
- function fromJSON(json, inputs) {
36419
- if (Array.isArray(json)) return json.map(n => fromJSON(n))
36420
-
36421
- let { inputs: ownInputs, ...defaults } = json;
36422
- if (ownInputs) {
36423
- inputs = [];
36424
- for (let input of ownInputs) {
36425
- let inputHydrated = { ...input, __proto__: Input.prototype };
36426
- if (inputHydrated.map) {
36427
- inputHydrated.map = {
36428
- ...inputHydrated.map,
36429
- __proto__: PreviousMap.prototype
36430
- };
36431
- }
36432
- inputs.push(inputHydrated);
36716
+ function hydrateInputs(json, inputs) {
36717
+ if (!json.inputs) return inputs
36718
+ return json.inputs.map(input => {
36719
+ let inputHydrated = { ...input, __proto__: Input.prototype };
36720
+ if (inputHydrated.map) {
36721
+ inputHydrated.map = {
36722
+ ...inputHydrated.map,
36723
+ __proto__: PreviousMap.prototype
36724
+ };
36433
36725
  }
36434
- }
36435
- if (defaults.nodes) {
36436
- defaults.nodes = json.nodes.map(n => fromJSON(n, inputs));
36437
- }
36726
+ return inputHydrated
36727
+ })
36728
+ }
36729
+
36730
+ function constructNode(json, inputs, children) {
36731
+ let defaults = { ...json };
36732
+ delete defaults.inputs;
36733
+ delete defaults.nodes;
36438
36734
  if (defaults.source) {
36439
36735
  let { inputId, ...source } = defaults.source;
36440
36736
  defaults.source = source;
@@ -36442,19 +36738,74 @@ function requireFromJSON () {
36442
36738
  defaults.source.input = inputs[inputId];
36443
36739
  }
36444
36740
  }
36741
+
36742
+ let node;
36445
36743
  if (defaults.type === 'root') {
36446
- return new Root(defaults)
36744
+ node = new Root(defaults);
36447
36745
  } else if (defaults.type === 'decl') {
36448
- return new Declaration(defaults)
36746
+ node = new Declaration(defaults);
36449
36747
  } else if (defaults.type === 'rule') {
36450
- return new Rule(defaults)
36748
+ node = new Rule(defaults);
36451
36749
  } else if (defaults.type === 'comment') {
36452
- return new Comment(defaults)
36750
+ node = new Comment(defaults);
36453
36751
  } else if (defaults.type === 'atrule') {
36454
- return new AtRule(defaults)
36752
+ node = new AtRule(defaults);
36455
36753
  } else {
36456
36754
  throw new Error('Unknown node type: ' + json.type)
36457
36755
  }
36756
+
36757
+ // Rehydrated children are attached after construction. Passing them
36758
+ // through the container constructor would re-run insertion spacing
36759
+ // normalization and overwrite each child's own `raws.before`.
36760
+ if (children) {
36761
+ node.nodes = children;
36762
+ for (let child of children) child.parent = node;
36763
+ }
36764
+
36765
+ return node
36766
+ }
36767
+
36768
+ function fromJSON(json, inputs) {
36769
+ if (Array.isArray(json)) return json.map(n => fromJSON(n))
36770
+
36771
+ // An explicit stack instead of recursive calls to survive deeply
36772
+ // nested trees. Children are rehydrated before their parent node
36773
+ // is constructed.
36774
+ let result;
36775
+ let stack = [
36776
+ { childIndex: 0, children: [], inputs: hydrateInputs(json, inputs), json }
36777
+ ];
36778
+
36779
+ while (stack.length > 0) {
36780
+ let frame = stack[stack.length - 1];
36781
+ let jsonNodes = frame.json.nodes;
36782
+
36783
+ if (jsonNodes && frame.childIndex < jsonNodes.length) {
36784
+ let childJson = jsonNodes[frame.childIndex];
36785
+ frame.childIndex += 1;
36786
+ stack.push({
36787
+ childIndex: 0,
36788
+ children: [],
36789
+ inputs: hydrateInputs(childJson, frame.inputs),
36790
+ json: childJson
36791
+ });
36792
+ continue
36793
+ }
36794
+
36795
+ stack.pop();
36796
+ let node = constructNode(
36797
+ frame.json,
36798
+ frame.inputs,
36799
+ jsonNodes ? frame.children : undefined
36800
+ );
36801
+ if (stack.length > 0) {
36802
+ stack[stack.length - 1].children.push(node);
36803
+ } else {
36804
+ result = node;
36805
+ }
36806
+ }
36807
+
36808
+ return result
36458
36809
  }
36459
36810
 
36460
36811
  fromJSON_1 = fromJSON;
@@ -37529,12 +37880,22 @@ function requireWarning () {
37529
37880
  if (hasRequiredWarning) return warning;
37530
37881
  hasRequiredWarning = 1;
37531
37882
 
37883
+ let Container = /*@__PURE__*/ requireContainer$1();
37884
+ let { my } = /*@__PURE__*/ requireSymbols();
37885
+
37532
37886
  class Warning {
37533
37887
  constructor(text, opts = {}) {
37534
37888
  this.type = 'warning';
37535
37889
  this.text = text;
37536
37890
 
37537
37891
  if (opts.node && opts.node.source) {
37892
+ if (!opts.node[my]) {
37893
+ // The node comes from another PostCSS copy in node_modules, so it does
37894
+ // not have this copy’s methods. Container#normalize() rebuilds such
37895
+ // nodes on insert, but a node passed straight to Result#warn() never
37896
+ // goes through it.
37897
+ Container.rebuild(opts.node);
37898
+ }
37538
37899
  let range = opts.node.rangeBy(opts);
37539
37900
  this.line = range.start.line;
37540
37901
  this.column = range.start.column;
@@ -37743,8 +38104,14 @@ function requireLazyResult () {
37743
38104
  }
37744
38105
 
37745
38106
  function cleanMarks(node) {
37746
- node[isClean] = false;
37747
- if (node.nodes) node.nodes.forEach(i => cleanMarks(i));
38107
+ let stack = [node];
38108
+ while (stack.length > 0) {
38109
+ let next = stack.pop();
38110
+ next[isClean] = false;
38111
+ if (next.nodes) {
38112
+ for (let i of next.nodes) stack.push(i);
38113
+ }
38114
+ }
37748
38115
  return node
37749
38116
  }
37750
38117
 
@@ -38175,21 +38542,57 @@ function requireLazyResult () {
38175
38542
  }
38176
38543
 
38177
38544
  walkSync(node) {
38545
+ // An explicit stack like in async `visitTick()` to survive deeply
38546
+ // nested trees. Unlike `visitTick()`, nodes are marked clean only
38547
+ // on entering, so a node dirtied by its own visitors is revisited
38548
+ // on the next pass.
38178
38549
  node[isClean] = true;
38179
- let events = getEvents(node);
38180
- for (let event of events) {
38181
- if (event === CHILDREN) {
38182
- if (node.nodes) {
38183
- node.each(child => {
38184
- if (!child[isClean]) this.walkSync(child);
38185
- });
38550
+ let stack = [{ eventIndex: 0, events: getEvents(node), iterator: 0, node }];
38551
+
38552
+ while (stack.length > 0) {
38553
+ let visit = stack[stack.length - 1];
38554
+ let visitNode = visit.node;
38555
+
38556
+ if (visit.iterator !== 0) {
38557
+ let iterator = visit.iterator;
38558
+ let child;
38559
+ let descended = false;
38560
+ while ((child = visitNode.nodes[visitNode.indexes[iterator]])) {
38561
+ visitNode.indexes[iterator] += 1;
38562
+ if (!child[isClean]) {
38563
+ child[isClean] = true;
38564
+ stack.push({
38565
+ eventIndex: 0,
38566
+ events: getEvents(child),
38567
+ iterator: 0,
38568
+ node: child
38569
+ });
38570
+ descended = true;
38571
+ break
38572
+ }
38186
38573
  }
38187
- } else {
38188
- let visitors = this.listeners[event];
38189
- if (visitors) {
38190
- if (this.visitSync(visitors, node.toProxy())) return
38574
+ if (descended) continue
38575
+ visit.iterator = 0;
38576
+ delete visitNode.indexes[iterator];
38577
+ }
38578
+
38579
+ if (visit.eventIndex < visit.events.length) {
38580
+ let event = visit.events[visit.eventIndex];
38581
+ visit.eventIndex += 1;
38582
+ if (event === CHILDREN) {
38583
+ if (visitNode.nodes && visitNode.nodes.length) {
38584
+ visit.iterator = visitNode.getIterator();
38585
+ }
38586
+ } else {
38587
+ let visitors = this.listeners[event];
38588
+ if (visitors) {
38589
+ if (this.visitSync(visitors, visitNode.toProxy())) stack.pop();
38590
+ }
38191
38591
  }
38592
+ continue
38192
38593
  }
38594
+
38595
+ stack.pop();
38193
38596
  }
38194
38597
  }
38195
38598
 
@@ -38369,7 +38772,7 @@ function requireProcessor$1 () {
38369
38772
 
38370
38773
  class Processor {
38371
38774
  constructor(plugins = []) {
38372
- this.version = '8.5.15';
38775
+ this.version = '8.5.23';
38373
38776
  this.plugins = this.normalize(plugins);
38374
38777
  }
38375
38778
 
@@ -50645,7 +51048,7 @@ Upgrade your vite or vue-loader version for compatibility with the latest experi
50645
51048
  function registerUserImport(source2, local, imported, isType, isFromSetup, needTemplateUsageCheck) {
50646
51049
  let isUsedInTemplate = needTemplateUsageCheck;
50647
51050
  if (needTemplateUsageCheck && ctx.isTS && sfc.template && !sfc.template.src && !sfc.template.lang) {
50648
- isUsedInTemplate = isImportUsed(local, sfc);
51051
+ isUsedInTemplate = isImportUsed(local, sfc, options.templateOptions);
50649
51052
  }
50650
51053
  ctx.userImports[local] = {
50651
51054
  isType,
@@ -50992,7 +51395,10 @@ const ${normalScriptDefaultVar} = ${defaultSpecifier.local.name}
50992
51395
  ctx.bindingMetadata[key] = setupBindings[key];
50993
51396
  }
50994
51397
  if (sfc.template && !sfc.template.src && sfc.template.ast) {
50995
- const vModelIds = resolveTemplateVModelIdentifiers(sfc);
51398
+ const vModelIds = resolveTemplateVModelIdentifiers(
51399
+ sfc,
51400
+ options.templateOptions
51401
+ );
50996
51402
  if (vModelIds.size) {
50997
51403
  const toDemote = /* @__PURE__ */ new Set();
50998
51404
  for (const id of vModelIds) {
@@ -51470,7 +51876,7 @@ var __spreadValues = (a, b) => {
51470
51876
  }
51471
51877
  return a;
51472
51878
  };
51473
- const version = "3.5.39";
51879
+ const version = "3.5.41";
51474
51880
  const parseCache = parseCache$1;
51475
51881
  const errorMessages = __spreadValues(__spreadValues({}, errorMessages$1), DOMErrorMessages);
51476
51882
  const walk = walk$2;