weml-monaco 0.3.3 → 0.4.2

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.
@@ -4,15 +4,23 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
8
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
9
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
10
  }) : x)(function(x) {
10
11
  if (typeof require !== "undefined") return require.apply(this, arguments);
11
12
  throw Error('Dynamic require of "' + x + '" is not supported');
12
13
  });
14
+ var __esm = (fn, res) => function __init() {
15
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
16
+ };
13
17
  var __commonJS = (cb, mod) => function __require2() {
14
18
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
15
19
  };
20
+ var __export = (target, all) => {
21
+ for (var name in all)
22
+ __defProp(target, name, { get: all[name], enumerable: true });
23
+ };
16
24
  var __copyProps = (to, from, except, desc) => {
17
25
  if (from && typeof from === "object" || typeof from === "function") {
18
26
  for (let key of __getOwnPropNames(from))
@@ -29,10 +37,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
29
37
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
30
38
  mod
31
39
  ));
40
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
41
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
32
42
 
33
43
  // ../node_modules/he/he.js
34
44
  var require_he = __commonJS({
35
45
  "../node_modules/he/he.js"(exports, module) {
46
+ "use strict";
36
47
  (function(root) {
37
48
  var freeExports = typeof exports == "object" && exports;
38
49
  var freeModule = typeof module == "object" && module && module.exports == freeExports && module;
@@ -288,7 +299,7 @@ var require_node = __commonJS({
288
299
  var he_1 = require_he();
289
300
  var Node7 = (
290
301
  /** @class */
291
- function() {
302
+ (function() {
292
303
  function Node8(parentNode, range) {
293
304
  if (parentNode === void 0) {
294
305
  parentNode = null;
@@ -331,7 +342,7 @@ var require_node = __commonJS({
331
342
  configurable: true
332
343
  });
333
344
  return Node8;
334
- }()
345
+ })()
335
346
  );
336
347
  exports.default = Node7;
337
348
  }
@@ -356,7 +367,7 @@ var require_type = __commonJS({
356
367
  var require_comment = __commonJS({
357
368
  "../node_modules/node-html-parser/dist/nodes/comment.js"(exports) {
358
369
  "use strict";
359
- var __extends = exports && exports.__extends || /* @__PURE__ */ function() {
370
+ var __extends = exports && exports.__extends || /* @__PURE__ */ (function() {
360
371
  var extendStatics = function(d, b) {
361
372
  extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
362
373
  d2.__proto__ = b2;
@@ -374,7 +385,7 @@ var require_comment = __commonJS({
374
385
  }
375
386
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
376
387
  };
377
- }();
388
+ })();
378
389
  var __importDefault = exports && exports.__importDefault || function(mod) {
379
390
  return mod && mod.__esModule ? mod : { "default": mod };
380
391
  };
@@ -383,7 +394,7 @@ var require_comment = __commonJS({
383
394
  var type_1 = __importDefault(require_type());
384
395
  var CommentNode = (
385
396
  /** @class */
386
- function(_super) {
397
+ (function(_super) {
387
398
  __extends(CommentNode2, _super);
388
399
  function CommentNode2(rawText, parentNode, range, rawTagName) {
389
400
  if (parentNode === void 0) {
@@ -416,7 +427,7 @@ var require_comment = __commonJS({
416
427
  return "<!--".concat(this.rawText, "-->");
417
428
  };
418
429
  return CommentNode2;
419
- }(node_1.default)
430
+ })(node_1.default)
420
431
  );
421
432
  exports.default = CommentNode;
422
433
  }
@@ -460,7 +471,7 @@ var require_lib = __commonJS({
460
471
  var require_node2 = __commonJS({
461
472
  "../node_modules/domhandler/lib/node.js"(exports) {
462
473
  "use strict";
463
- var __extends = exports && exports.__extends || /* @__PURE__ */ function() {
474
+ var __extends = exports && exports.__extends || /* @__PURE__ */ (function() {
464
475
  var extendStatics = function(d, b) {
465
476
  extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
466
477
  d2.__proto__ = b2;
@@ -478,7 +489,7 @@ var require_node2 = __commonJS({
478
489
  }
479
490
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
480
491
  };
481
- }();
492
+ })();
482
493
  var __assign = exports && exports.__assign || function() {
483
494
  __assign = Object.assign || function(t2) {
484
495
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -495,7 +506,7 @@ var require_node2 = __commonJS({
495
506
  var domelementtype_1 = require_lib();
496
507
  var Node7 = (
497
508
  /** @class */
498
- function() {
509
+ (function() {
499
510
  function Node8() {
500
511
  this.parent = null;
501
512
  this.prev = null;
@@ -553,12 +564,12 @@ var require_node2 = __commonJS({
553
564
  return cloneNode(this, recursive);
554
565
  };
555
566
  return Node8;
556
- }()
567
+ })()
557
568
  );
558
569
  exports.Node = Node7;
559
570
  var DataNode = (
560
571
  /** @class */
561
- function(_super) {
572
+ (function(_super) {
562
573
  __extends(DataNode2, _super);
563
574
  function DataNode2(data) {
564
575
  var _this = _super.call(this) || this;
@@ -580,12 +591,12 @@ var require_node2 = __commonJS({
580
591
  configurable: true
581
592
  });
582
593
  return DataNode2;
583
- }(Node7)
594
+ })(Node7)
584
595
  );
585
596
  exports.DataNode = DataNode;
586
597
  var Text = (
587
598
  /** @class */
588
- function(_super) {
599
+ (function(_super) {
589
600
  __extends(Text2, _super);
590
601
  function Text2() {
591
602
  var _this = _super !== null && _super.apply(this, arguments) || this;
@@ -600,12 +611,12 @@ var require_node2 = __commonJS({
600
611
  configurable: true
601
612
  });
602
613
  return Text2;
603
- }(DataNode)
614
+ })(DataNode)
604
615
  );
605
616
  exports.Text = Text;
606
617
  var Comment = (
607
618
  /** @class */
608
- function(_super) {
619
+ (function(_super) {
609
620
  __extends(Comment2, _super);
610
621
  function Comment2() {
611
622
  var _this = _super !== null && _super.apply(this, arguments) || this;
@@ -620,12 +631,12 @@ var require_node2 = __commonJS({
620
631
  configurable: true
621
632
  });
622
633
  return Comment2;
623
- }(DataNode)
634
+ })(DataNode)
624
635
  );
625
636
  exports.Comment = Comment;
626
637
  var ProcessingInstruction = (
627
638
  /** @class */
628
- function(_super) {
639
+ (function(_super) {
629
640
  __extends(ProcessingInstruction2, _super);
630
641
  function ProcessingInstruction2(name, data) {
631
642
  var _this = _super.call(this, data) || this;
@@ -641,12 +652,12 @@ var require_node2 = __commonJS({
641
652
  configurable: true
642
653
  });
643
654
  return ProcessingInstruction2;
644
- }(DataNode)
655
+ })(DataNode)
645
656
  );
646
657
  exports.ProcessingInstruction = ProcessingInstruction;
647
658
  var NodeWithChildren = (
648
659
  /** @class */
649
- function(_super) {
660
+ (function(_super) {
650
661
  __extends(NodeWithChildren2, _super);
651
662
  function NodeWithChildren2(children) {
652
663
  var _this = _super.call(this) || this;
@@ -686,12 +697,12 @@ var require_node2 = __commonJS({
686
697
  configurable: true
687
698
  });
688
699
  return NodeWithChildren2;
689
- }(Node7)
700
+ })(Node7)
690
701
  );
691
702
  exports.NodeWithChildren = NodeWithChildren;
692
703
  var CDATA = (
693
704
  /** @class */
694
- function(_super) {
705
+ (function(_super) {
695
706
  __extends(CDATA2, _super);
696
707
  function CDATA2() {
697
708
  var _this = _super !== null && _super.apply(this, arguments) || this;
@@ -706,12 +717,12 @@ var require_node2 = __commonJS({
706
717
  configurable: true
707
718
  });
708
719
  return CDATA2;
709
- }(NodeWithChildren)
720
+ })(NodeWithChildren)
710
721
  );
711
722
  exports.CDATA = CDATA;
712
723
  var Document = (
713
724
  /** @class */
714
- function(_super) {
725
+ (function(_super) {
715
726
  __extends(Document2, _super);
716
727
  function Document2() {
717
728
  var _this = _super !== null && _super.apply(this, arguments) || this;
@@ -726,12 +737,12 @@ var require_node2 = __commonJS({
726
737
  configurable: true
727
738
  });
728
739
  return Document2;
729
- }(NodeWithChildren)
740
+ })(NodeWithChildren)
730
741
  );
731
742
  exports.Document = Document;
732
743
  var Element = (
733
744
  /** @class */
734
- function(_super) {
745
+ (function(_super) {
735
746
  __extends(Element2, _super);
736
747
  function Element2(name, attribs, children, type) {
737
748
  if (children === void 0) {
@@ -785,7 +796,7 @@ var require_node2 = __commonJS({
785
796
  configurable: true
786
797
  });
787
798
  return Element2;
788
- }(NodeWithChildren)
799
+ })(NodeWithChildren)
789
800
  );
790
801
  exports.Element = Element;
791
802
  function isTag(node) {
@@ -894,7 +905,7 @@ var require_node2 = __commonJS({
894
905
  var require_lib2 = __commonJS({
895
906
  "../node_modules/domhandler/lib/index.js"(exports) {
896
907
  "use strict";
897
- var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
908
+ var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
898
909
  if (k2 === void 0) k2 = k;
899
910
  var desc = Object.getOwnPropertyDescriptor(m, k);
900
911
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
@@ -903,10 +914,10 @@ var require_lib2 = __commonJS({
903
914
  } };
904
915
  }
905
916
  Object.defineProperty(o, k2, desc);
906
- } : function(o, m, k, k2) {
917
+ }) : (function(o, m, k, k2) {
907
918
  if (k2 === void 0) k2 = k;
908
919
  o[k2] = m[k];
909
- });
920
+ }));
910
921
  var __exportStar = exports && exports.__exportStar || function(m, exports2) {
911
922
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
912
923
  };
@@ -922,7 +933,7 @@ var require_lib2 = __commonJS({
922
933
  };
923
934
  var DomHandler = (
924
935
  /** @class */
925
- function() {
936
+ (function() {
926
937
  function DomHandler2(callback, options, elementCB) {
927
938
  this.dom = [];
928
939
  this.root = new node_js_1.Document(this.dom);
@@ -1042,7 +1053,7 @@ var require_lib2 = __commonJS({
1042
1053
  this.lastNode = null;
1043
1054
  };
1044
1055
  return DomHandler2;
1045
- }()
1056
+ })()
1046
1057
  );
1047
1058
  exports.DomHandler = DomHandler;
1048
1059
  exports.default = DomHandler;
@@ -1145,7 +1156,7 @@ var require_decode_codepoint = __commonJS({
1145
1156
  var require_decode = __commonJS({
1146
1157
  "../node_modules/entities/lib/decode.js"(exports) {
1147
1158
  "use strict";
1148
- var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
1159
+ var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
1149
1160
  if (k2 === void 0) k2 = k;
1150
1161
  var desc = Object.getOwnPropertyDescriptor(m, k);
1151
1162
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
@@ -1154,13 +1165,13 @@ var require_decode = __commonJS({
1154
1165
  } };
1155
1166
  }
1156
1167
  Object.defineProperty(o, k2, desc);
1157
- } : function(o, m, k, k2) {
1168
+ }) : (function(o, m, k, k2) {
1158
1169
  if (k2 === void 0) k2 = k;
1159
1170
  o[k2] = m[k];
1160
- });
1161
- var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
1171
+ }));
1172
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
1162
1173
  Object.defineProperty(o, "default", { enumerable: true, value: v });
1163
- } : function(o, v) {
1174
+ }) : function(o, v) {
1164
1175
  o["default"] = v;
1165
1176
  });
1166
1177
  var __importStar = exports && exports.__importStar || function(mod) {
@@ -1240,7 +1251,7 @@ var require_decode = __commonJS({
1240
1251
  })(DecodingMode = exports.DecodingMode || (exports.DecodingMode = {}));
1241
1252
  var EntityDecoder = (
1242
1253
  /** @class */
1243
- function() {
1254
+ (function() {
1244
1255
  function EntityDecoder2(decodeTree, emitCodePoint, errors) {
1245
1256
  this.decodeTree = decodeTree;
1246
1257
  this.emitCodePoint = emitCodePoint;
@@ -1402,6 +1413,7 @@ var require_decode = __commonJS({
1402
1413
  case EntityDecoderState.NamedEntity: {
1403
1414
  return this.result !== 0 && (this.decodeMode !== DecodingMode.Attribute || this.result === this.treeIndex) ? this.emitNotTerminatedNamedEntity() : 0;
1404
1415
  }
1416
+ // Otherwise, emit a numeric entity if we have one.
1405
1417
  case EntityDecoderState.NumericDecimal: {
1406
1418
  return this.emitNumericEntity(0, 2);
1407
1419
  }
@@ -1418,7 +1430,7 @@ var require_decode = __commonJS({
1418
1430
  }
1419
1431
  };
1420
1432
  return EntityDecoder2;
1421
- }()
1433
+ })()
1422
1434
  );
1423
1435
  exports.EntityDecoder = EntityDecoder;
1424
1436
  function getDecoder(decodeTree) {
@@ -1900,7 +1912,7 @@ var require_lib4 = __commonJS({
1900
1912
  };
1901
1913
  return __assign.apply(this, arguments);
1902
1914
  };
1903
- var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
1915
+ var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
1904
1916
  if (k2 === void 0) k2 = k;
1905
1917
  var desc = Object.getOwnPropertyDescriptor(m, k);
1906
1918
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
@@ -1909,13 +1921,13 @@ var require_lib4 = __commonJS({
1909
1921
  } };
1910
1922
  }
1911
1923
  Object.defineProperty(o, k2, desc);
1912
- } : function(o, m, k, k2) {
1924
+ }) : (function(o, m, k, k2) {
1913
1925
  if (k2 === void 0) k2 = k;
1914
1926
  o[k2] = m[k];
1915
- });
1916
- var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
1927
+ }));
1928
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
1917
1929
  Object.defineProperty(o, "default", { enumerable: true, value: v });
1918
- } : function(o, v) {
1930
+ }) : function(o, v) {
1919
1931
  o["default"] = v;
1920
1932
  });
1921
1933
  var __importStar = exports && exports.__importStar || function(mod) {
@@ -2000,6 +2012,7 @@ var require_lib4 = __commonJS({
2000
2012
  switch (node.type) {
2001
2013
  case ElementType.Root:
2002
2014
  return render(node.children, options);
2015
+ // @ts-expect-error We don't use `Doctype` yet
2003
2016
  case ElementType.Doctype:
2004
2017
  case ElementType.Directive:
2005
2018
  return renderDirective(node);
@@ -2760,7 +2773,7 @@ var require_feeds = __commonJS({
2760
2773
  var require_lib5 = __commonJS({
2761
2774
  "../node_modules/domutils/lib/index.js"(exports) {
2762
2775
  "use strict";
2763
- var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
2776
+ var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
2764
2777
  if (k2 === void 0) k2 = k;
2765
2778
  var desc = Object.getOwnPropertyDescriptor(m, k);
2766
2779
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
@@ -2769,10 +2782,10 @@ var require_lib5 = __commonJS({
2769
2782
  } };
2770
2783
  }
2771
2784
  Object.defineProperty(o, k2, desc);
2772
- } : function(o, m, k, k2) {
2785
+ }) : (function(o, m, k, k2) {
2773
2786
  if (k2 === void 0) k2 = k;
2774
2787
  o[k2] = m[k];
2775
- });
2788
+ }));
2776
2789
  var __exportStar = exports && exports.__exportStar || function(m, exports2) {
2777
2790
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
2778
2791
  };
@@ -2810,6 +2823,7 @@ var require_lib5 = __commonJS({
2810
2823
  // ../node_modules/boolbase/index.js
2811
2824
  var require_boolbase = __commonJS({
2812
2825
  "../node_modules/boolbase/index.js"(exports, module) {
2826
+ "use strict";
2813
2827
  module.exports = {
2814
2828
  trueFunc: function trueFunc() {
2815
2829
  return true;
@@ -2821,13 +2835,11 @@ var require_boolbase = __commonJS({
2821
2835
  }
2822
2836
  });
2823
2837
 
2824
- // ../node_modules/css-what/lib/commonjs/types.js
2825
- var require_types = __commonJS({
2826
- "../node_modules/css-what/lib/commonjs/types.js"(exports) {
2838
+ // ../node_modules/css-what/lib/es/types.js
2839
+ var SelectorType, IgnoreCaseMode, AttributeAction;
2840
+ var init_types = __esm({
2841
+ "../node_modules/css-what/lib/es/types.js"() {
2827
2842
  "use strict";
2828
- Object.defineProperty(exports, "__esModule", { value: true });
2829
- exports.AttributeAction = exports.IgnoreCaseMode = exports.SelectorType = void 0;
2830
- var SelectorType;
2831
2843
  (function(SelectorType2) {
2832
2844
  SelectorType2["Attribute"] = "attribute";
2833
2845
  SelectorType2["Pseudo"] = "pseudo";
@@ -2840,14 +2852,13 @@ var require_types = __commonJS({
2840
2852
  SelectorType2["Parent"] = "parent";
2841
2853
  SelectorType2["Sibling"] = "sibling";
2842
2854
  SelectorType2["ColumnCombinator"] = "column-combinator";
2843
- })(SelectorType = exports.SelectorType || (exports.SelectorType = {}));
2844
- exports.IgnoreCaseMode = {
2855
+ })(SelectorType || (SelectorType = {}));
2856
+ IgnoreCaseMode = {
2845
2857
  Unknown: null,
2846
2858
  QuirksMode: "quirks",
2847
2859
  IgnoreCase: true,
2848
2860
  CaseSensitive: false
2849
2861
  };
2850
- var AttributeAction;
2851
2862
  (function(AttributeAction2) {
2852
2863
  AttributeAction2["Any"] = "any";
2853
2864
  AttributeAction2["Element"] = "element";
@@ -2857,387 +2868,452 @@ var require_types = __commonJS({
2857
2868
  AttributeAction2["Hyphen"] = "hyphen";
2858
2869
  AttributeAction2["Not"] = "not";
2859
2870
  AttributeAction2["Start"] = "start";
2860
- })(AttributeAction = exports.AttributeAction || (exports.AttributeAction = {}));
2871
+ })(AttributeAction || (AttributeAction = {}));
2861
2872
  }
2862
2873
  });
2863
2874
 
2864
- // ../node_modules/css-what/lib/commonjs/parse.js
2865
- var require_parse = __commonJS({
2866
- "../node_modules/css-what/lib/commonjs/parse.js"(exports) {
2867
- "use strict";
2868
- Object.defineProperty(exports, "__esModule", { value: true });
2869
- exports.parse = exports.isTraversal = void 0;
2870
- var types_1 = require_types();
2871
- var reName = /^[^\\#]?(?:\\(?:[\da-f]{1,6}\s?|.)|[\w\-\u00b0-\uFFFF])+/;
2872
- var reEscape = /\\([\da-f]{1,6}\s?|(\s)|.)/gi;
2873
- var actionTypes = /* @__PURE__ */ new Map([
2874
- [126, types_1.AttributeAction.Element],
2875
- [94, types_1.AttributeAction.Start],
2876
- [36, types_1.AttributeAction.End],
2877
- [42, types_1.AttributeAction.Any],
2878
- [33, types_1.AttributeAction.Not],
2879
- [124, types_1.AttributeAction.Hyphen]
2880
- ]);
2881
- var unpackPseudos = /* @__PURE__ */ new Set([
2882
- "has",
2883
- "not",
2884
- "matches",
2885
- "is",
2886
- "where",
2887
- "host",
2888
- "host-context"
2889
- ]);
2890
- function isTraversal(selector) {
2891
- switch (selector.type) {
2892
- case types_1.SelectorType.Adjacent:
2893
- case types_1.SelectorType.Child:
2894
- case types_1.SelectorType.Descendant:
2895
- case types_1.SelectorType.Parent:
2896
- case types_1.SelectorType.Sibling:
2897
- case types_1.SelectorType.ColumnCombinator:
2898
- return true;
2899
- default:
2900
- return false;
2901
- }
2875
+ // ../node_modules/css-what/lib/es/parse.js
2876
+ function isTraversal(selector) {
2877
+ switch (selector.type) {
2878
+ case SelectorType.Adjacent:
2879
+ case SelectorType.Child:
2880
+ case SelectorType.Descendant:
2881
+ case SelectorType.Parent:
2882
+ case SelectorType.Sibling:
2883
+ case SelectorType.ColumnCombinator:
2884
+ return true;
2885
+ default:
2886
+ return false;
2887
+ }
2888
+ }
2889
+ function funescape(_, escaped, escapedWhitespace) {
2890
+ const high = parseInt(escaped, 16) - 65536;
2891
+ return high !== high || escapedWhitespace ? escaped : high < 0 ? (
2892
+ // BMP codepoint
2893
+ String.fromCharCode(high + 65536)
2894
+ ) : (
2895
+ // Supplemental Plane codepoint (surrogate pair)
2896
+ String.fromCharCode(high >> 10 | 55296, high & 1023 | 56320)
2897
+ );
2898
+ }
2899
+ function unescapeCSS(str) {
2900
+ return str.replace(reEscape, funescape);
2901
+ }
2902
+ function isQuote(c) {
2903
+ return c === 39 || c === 34;
2904
+ }
2905
+ function isWhitespace(c) {
2906
+ return c === 32 || c === 9 || c === 10 || c === 12 || c === 13;
2907
+ }
2908
+ function parse(selector) {
2909
+ const subselects = [];
2910
+ const endIndex = parseSelector(subselects, `${selector}`, 0);
2911
+ if (endIndex < selector.length) {
2912
+ throw new Error(`Unmatched selector: ${selector.slice(endIndex)}`);
2913
+ }
2914
+ return subselects;
2915
+ }
2916
+ function parseSelector(subselects, selector, selectorIndex) {
2917
+ let tokens = [];
2918
+ function getName(offset) {
2919
+ const match = selector.slice(selectorIndex + offset).match(reName);
2920
+ if (!match) {
2921
+ throw new Error(`Expected name, found ${selector.slice(selectorIndex)}`);
2902
2922
  }
2903
- exports.isTraversal = isTraversal;
2904
- var stripQuotesFromPseudos = /* @__PURE__ */ new Set(["contains", "icontains"]);
2905
- function funescape(_, escaped, escapedWhitespace) {
2906
- var high = parseInt(escaped, 16) - 65536;
2907
- return high !== high || escapedWhitespace ? escaped : high < 0 ? (
2908
- // BMP codepoint
2909
- String.fromCharCode(high + 65536)
2910
- ) : (
2911
- // Supplemental Plane codepoint (surrogate pair)
2912
- String.fromCharCode(high >> 10 | 55296, high & 1023 | 56320)
2913
- );
2923
+ const [name] = match;
2924
+ selectorIndex += offset + name.length;
2925
+ return unescapeCSS(name);
2926
+ }
2927
+ function stripWhitespace(offset) {
2928
+ selectorIndex += offset;
2929
+ while (selectorIndex < selector.length && isWhitespace(selector.charCodeAt(selectorIndex))) {
2930
+ selectorIndex++;
2914
2931
  }
2915
- function unescapeCSS(str) {
2916
- return str.replace(reEscape, funescape);
2932
+ }
2933
+ function readValueWithParenthesis() {
2934
+ selectorIndex += 1;
2935
+ const start = selectorIndex;
2936
+ let counter = 1;
2937
+ for (; counter > 0 && selectorIndex < selector.length; selectorIndex++) {
2938
+ if (selector.charCodeAt(selectorIndex) === 40 && !isEscaped(selectorIndex)) {
2939
+ counter++;
2940
+ } else if (selector.charCodeAt(selectorIndex) === 41 && !isEscaped(selectorIndex)) {
2941
+ counter--;
2942
+ }
2917
2943
  }
2918
- function isQuote2(c) {
2919
- return c === 39 || c === 34;
2944
+ if (counter) {
2945
+ throw new Error("Parenthesis not matched");
2920
2946
  }
2921
- function isWhitespace2(c) {
2922
- return c === 32 || c === 9 || c === 10 || c === 12 || c === 13;
2947
+ return unescapeCSS(selector.slice(start, selectorIndex - 1));
2948
+ }
2949
+ function isEscaped(pos) {
2950
+ let slashCount = 0;
2951
+ while (selector.charCodeAt(--pos) === 92)
2952
+ slashCount++;
2953
+ return (slashCount & 1) === 1;
2954
+ }
2955
+ function ensureNotTraversal() {
2956
+ if (tokens.length > 0 && isTraversal(tokens[tokens.length - 1])) {
2957
+ throw new Error("Did not expect successive traversals.");
2923
2958
  }
2924
- function parse(selector) {
2925
- var subselects = [];
2926
- var endIndex = parseSelector(subselects, "".concat(selector), 0);
2927
- if (endIndex < selector.length) {
2928
- throw new Error("Unmatched selector: ".concat(selector.slice(endIndex)));
2929
- }
2930
- return subselects;
2959
+ }
2960
+ function addTraversal(type) {
2961
+ if (tokens.length > 0 && tokens[tokens.length - 1].type === SelectorType.Descendant) {
2962
+ tokens[tokens.length - 1].type = type;
2963
+ return;
2931
2964
  }
2932
- exports.parse = parse;
2933
- function parseSelector(subselects, selector, selectorIndex) {
2934
- var tokens = [];
2935
- function getName(offset) {
2936
- var match = selector.slice(selectorIndex + offset).match(reName);
2937
- if (!match) {
2938
- throw new Error("Expected name, found ".concat(selector.slice(selectorIndex)));
2939
- }
2940
- var name = match[0];
2941
- selectorIndex += offset + name.length;
2942
- return unescapeCSS(name);
2965
+ ensureNotTraversal();
2966
+ tokens.push({ type });
2967
+ }
2968
+ function addSpecialAttribute(name, action) {
2969
+ tokens.push({
2970
+ type: SelectorType.Attribute,
2971
+ name,
2972
+ action,
2973
+ value: getName(1),
2974
+ namespace: null,
2975
+ ignoreCase: "quirks"
2976
+ });
2977
+ }
2978
+ function finalizeSubselector() {
2979
+ if (tokens.length && tokens[tokens.length - 1].type === SelectorType.Descendant) {
2980
+ tokens.pop();
2981
+ }
2982
+ if (tokens.length === 0) {
2983
+ throw new Error("Empty sub-selector");
2984
+ }
2985
+ subselects.push(tokens);
2986
+ }
2987
+ stripWhitespace(0);
2988
+ if (selector.length === selectorIndex) {
2989
+ return selectorIndex;
2990
+ }
2991
+ loop: while (selectorIndex < selector.length) {
2992
+ const firstChar = selector.charCodeAt(selectorIndex);
2993
+ switch (firstChar) {
2994
+ // Whitespace
2995
+ case 32:
2996
+ case 9:
2997
+ case 10:
2998
+ case 12:
2999
+ case 13: {
3000
+ if (tokens.length === 0 || tokens[0].type !== SelectorType.Descendant) {
3001
+ ensureNotTraversal();
3002
+ tokens.push({ type: SelectorType.Descendant });
3003
+ }
3004
+ stripWhitespace(1);
3005
+ break;
2943
3006
  }
2944
- function stripWhitespace(offset) {
2945
- selectorIndex += offset;
2946
- while (selectorIndex < selector.length && isWhitespace2(selector.charCodeAt(selectorIndex))) {
2947
- selectorIndex++;
2948
- }
3007
+ // Traversals
3008
+ case 62: {
3009
+ addTraversal(SelectorType.Child);
3010
+ stripWhitespace(1);
3011
+ break;
2949
3012
  }
2950
- function readValueWithParenthesis() {
2951
- selectorIndex += 1;
2952
- var start = selectorIndex;
2953
- var counter = 1;
2954
- for (; counter > 0 && selectorIndex < selector.length; selectorIndex++) {
2955
- if (selector.charCodeAt(selectorIndex) === 40 && !isEscaped(selectorIndex)) {
2956
- counter++;
2957
- } else if (selector.charCodeAt(selectorIndex) === 41 && !isEscaped(selectorIndex)) {
2958
- counter--;
2959
- }
2960
- }
2961
- if (counter) {
2962
- throw new Error("Parenthesis not matched");
2963
- }
2964
- return unescapeCSS(selector.slice(start, selectorIndex - 1));
3013
+ case 60: {
3014
+ addTraversal(SelectorType.Parent);
3015
+ stripWhitespace(1);
3016
+ break;
2965
3017
  }
2966
- function isEscaped(pos) {
2967
- var slashCount = 0;
2968
- while (selector.charCodeAt(--pos) === 92)
2969
- slashCount++;
2970
- return (slashCount & 1) === 1;
3018
+ case 126: {
3019
+ addTraversal(SelectorType.Sibling);
3020
+ stripWhitespace(1);
3021
+ break;
2971
3022
  }
2972
- function ensureNotTraversal() {
2973
- if (tokens.length > 0 && isTraversal(tokens[tokens.length - 1])) {
2974
- throw new Error("Did not expect successive traversals.");
2975
- }
3023
+ case 43: {
3024
+ addTraversal(SelectorType.Adjacent);
3025
+ stripWhitespace(1);
3026
+ break;
2976
3027
  }
2977
- function addTraversal(type) {
2978
- if (tokens.length > 0 && tokens[tokens.length - 1].type === types_1.SelectorType.Descendant) {
2979
- tokens[tokens.length - 1].type = type;
2980
- return;
2981
- }
2982
- ensureNotTraversal();
2983
- tokens.push({ type });
3028
+ // Special attribute selectors: .class, #id
3029
+ case 46: {
3030
+ addSpecialAttribute("class", AttributeAction.Element);
3031
+ break;
2984
3032
  }
2985
- function addSpecialAttribute(name, action2) {
2986
- tokens.push({
2987
- type: types_1.SelectorType.Attribute,
2988
- name,
2989
- action: action2,
2990
- value: getName(1),
2991
- namespace: null,
2992
- ignoreCase: "quirks"
2993
- });
3033
+ case 35: {
3034
+ addSpecialAttribute("id", AttributeAction.Equals);
3035
+ break;
2994
3036
  }
2995
- function finalizeSubselector() {
2996
- if (tokens.length && tokens[tokens.length - 1].type === types_1.SelectorType.Descendant) {
2997
- tokens.pop();
2998
- }
2999
- if (tokens.length === 0) {
3000
- throw new Error("Empty sub-selector");
3001
- }
3002
- subselects.push(tokens);
3003
- }
3004
- stripWhitespace(0);
3005
- if (selector.length === selectorIndex) {
3006
- return selectorIndex;
3007
- }
3008
- loop: while (selectorIndex < selector.length) {
3009
- var firstChar = selector.charCodeAt(selectorIndex);
3010
- switch (firstChar) {
3011
- case 32:
3012
- case 9:
3013
- case 10:
3014
- case 12:
3015
- case 13: {
3016
- if (tokens.length === 0 || tokens[0].type !== types_1.SelectorType.Descendant) {
3017
- ensureNotTraversal();
3018
- tokens.push({ type: types_1.SelectorType.Descendant });
3037
+ case 91: {
3038
+ stripWhitespace(1);
3039
+ let name;
3040
+ let namespace = null;
3041
+ if (selector.charCodeAt(selectorIndex) === 124) {
3042
+ name = getName(1);
3043
+ } else if (selector.startsWith("*|", selectorIndex)) {
3044
+ namespace = "*";
3045
+ name = getName(2);
3046
+ } else {
3047
+ name = getName(0);
3048
+ if (selector.charCodeAt(selectorIndex) === 124 && selector.charCodeAt(selectorIndex + 1) !== 61) {
3049
+ namespace = name;
3050
+ name = getName(1);
3051
+ }
3052
+ }
3053
+ stripWhitespace(0);
3054
+ let action = AttributeAction.Exists;
3055
+ const possibleAction = actionTypes.get(selector.charCodeAt(selectorIndex));
3056
+ if (possibleAction) {
3057
+ action = possibleAction;
3058
+ if (selector.charCodeAt(selectorIndex + 1) !== 61) {
3059
+ throw new Error("Expected `=`");
3060
+ }
3061
+ stripWhitespace(2);
3062
+ } else if (selector.charCodeAt(selectorIndex) === 61) {
3063
+ action = AttributeAction.Equals;
3064
+ stripWhitespace(1);
3065
+ }
3066
+ let value = "";
3067
+ let ignoreCase = null;
3068
+ if (action !== "exists") {
3069
+ if (isQuote(selector.charCodeAt(selectorIndex))) {
3070
+ const quote = selector.charCodeAt(selectorIndex);
3071
+ let sectionEnd = selectorIndex + 1;
3072
+ while (sectionEnd < selector.length && (selector.charCodeAt(sectionEnd) !== quote || isEscaped(sectionEnd))) {
3073
+ sectionEnd += 1;
3019
3074
  }
3020
- stripWhitespace(1);
3021
- break;
3022
- }
3023
- case 62: {
3024
- addTraversal(types_1.SelectorType.Child);
3025
- stripWhitespace(1);
3026
- break;
3027
- }
3028
- case 60: {
3029
- addTraversal(types_1.SelectorType.Parent);
3030
- stripWhitespace(1);
3031
- break;
3075
+ if (selector.charCodeAt(sectionEnd) !== quote) {
3076
+ throw new Error("Attribute value didn't end");
3077
+ }
3078
+ value = unescapeCSS(selector.slice(selectorIndex + 1, sectionEnd));
3079
+ selectorIndex = sectionEnd + 1;
3080
+ } else {
3081
+ const valueStart = selectorIndex;
3082
+ while (selectorIndex < selector.length && (!isWhitespace(selector.charCodeAt(selectorIndex)) && selector.charCodeAt(selectorIndex) !== 93 || isEscaped(selectorIndex))) {
3083
+ selectorIndex += 1;
3084
+ }
3085
+ value = unescapeCSS(selector.slice(valueStart, selectorIndex));
3032
3086
  }
3033
- case 126: {
3034
- addTraversal(types_1.SelectorType.Sibling);
3087
+ stripWhitespace(0);
3088
+ const forceIgnore = selector.charCodeAt(selectorIndex) | 32;
3089
+ if (forceIgnore === 115) {
3090
+ ignoreCase = false;
3035
3091
  stripWhitespace(1);
3036
- break;
3037
- }
3038
- case 43: {
3039
- addTraversal(types_1.SelectorType.Adjacent);
3092
+ } else if (forceIgnore === 105) {
3093
+ ignoreCase = true;
3040
3094
  stripWhitespace(1);
3041
- break;
3042
- }
3043
- case 46: {
3044
- addSpecialAttribute("class", types_1.AttributeAction.Element);
3045
- break;
3046
3095
  }
3047
- case 35: {
3048
- addSpecialAttribute("id", types_1.AttributeAction.Equals);
3049
- break;
3050
- }
3051
- case 91: {
3052
- stripWhitespace(1);
3053
- var name_1 = void 0;
3054
- var namespace = null;
3055
- if (selector.charCodeAt(selectorIndex) === 124) {
3056
- name_1 = getName(1);
3057
- } else if (selector.startsWith("*|", selectorIndex)) {
3058
- namespace = "*";
3059
- name_1 = getName(2);
3060
- } else {
3061
- name_1 = getName(0);
3062
- if (selector.charCodeAt(selectorIndex) === 124 && selector.charCodeAt(selectorIndex + 1) !== 61) {
3063
- namespace = name_1;
3064
- name_1 = getName(1);
3065
- }
3066
- }
3067
- stripWhitespace(0);
3068
- var action = types_1.AttributeAction.Exists;
3069
- var possibleAction = actionTypes.get(selector.charCodeAt(selectorIndex));
3070
- if (possibleAction) {
3071
- action = possibleAction;
3072
- if (selector.charCodeAt(selectorIndex + 1) !== 61) {
3073
- throw new Error("Expected `=`");
3074
- }
3075
- stripWhitespace(2);
3076
- } else if (selector.charCodeAt(selectorIndex) === 61) {
3077
- action = types_1.AttributeAction.Equals;
3078
- stripWhitespace(1);
3079
- }
3080
- var value = "";
3081
- var ignoreCase = null;
3082
- if (action !== "exists") {
3083
- if (isQuote2(selector.charCodeAt(selectorIndex))) {
3084
- var quote = selector.charCodeAt(selectorIndex);
3085
- var sectionEnd = selectorIndex + 1;
3086
- while (sectionEnd < selector.length && (selector.charCodeAt(sectionEnd) !== quote || isEscaped(sectionEnd))) {
3087
- sectionEnd += 1;
3088
- }
3089
- if (selector.charCodeAt(sectionEnd) !== quote) {
3090
- throw new Error("Attribute value didn't end");
3091
- }
3092
- value = unescapeCSS(selector.slice(selectorIndex + 1, sectionEnd));
3093
- selectorIndex = sectionEnd + 1;
3094
- } else {
3095
- var valueStart = selectorIndex;
3096
- while (selectorIndex < selector.length && (!isWhitespace2(selector.charCodeAt(selectorIndex)) && selector.charCodeAt(selectorIndex) !== 93 || isEscaped(selectorIndex))) {
3097
- selectorIndex += 1;
3098
- }
3099
- value = unescapeCSS(selector.slice(valueStart, selectorIndex));
3100
- }
3101
- stripWhitespace(0);
3102
- var forceIgnore = selector.charCodeAt(selectorIndex) | 32;
3103
- if (forceIgnore === 115) {
3104
- ignoreCase = false;
3105
- stripWhitespace(1);
3106
- } else if (forceIgnore === 105) {
3107
- ignoreCase = true;
3108
- stripWhitespace(1);
3109
- }
3096
+ }
3097
+ if (selector.charCodeAt(selectorIndex) !== 93) {
3098
+ throw new Error("Attribute selector didn't terminate");
3099
+ }
3100
+ selectorIndex += 1;
3101
+ const attributeSelector = {
3102
+ type: SelectorType.Attribute,
3103
+ name,
3104
+ action,
3105
+ value,
3106
+ namespace,
3107
+ ignoreCase
3108
+ };
3109
+ tokens.push(attributeSelector);
3110
+ break;
3111
+ }
3112
+ case 58: {
3113
+ if (selector.charCodeAt(selectorIndex + 1) === 58) {
3114
+ tokens.push({
3115
+ type: SelectorType.PseudoElement,
3116
+ name: getName(2).toLowerCase(),
3117
+ data: selector.charCodeAt(selectorIndex) === 40 ? readValueWithParenthesis() : null
3118
+ });
3119
+ continue;
3120
+ }
3121
+ const name = getName(1).toLowerCase();
3122
+ let data = null;
3123
+ if (selector.charCodeAt(selectorIndex) === 40) {
3124
+ if (unpackPseudos.has(name)) {
3125
+ if (isQuote(selector.charCodeAt(selectorIndex + 1))) {
3126
+ throw new Error(`Pseudo-selector ${name} cannot be quoted`);
3110
3127
  }
3111
- if (selector.charCodeAt(selectorIndex) !== 93) {
3112
- throw new Error("Attribute selector didn't terminate");
3128
+ data = [];
3129
+ selectorIndex = parseSelector(data, selector, selectorIndex + 1);
3130
+ if (selector.charCodeAt(selectorIndex) !== 41) {
3131
+ throw new Error(`Missing closing parenthesis in :${name} (${selector})`);
3113
3132
  }
3114
3133
  selectorIndex += 1;
3115
- var attributeSelector = {
3116
- type: types_1.SelectorType.Attribute,
3117
- name: name_1,
3118
- action,
3119
- value,
3120
- namespace,
3121
- ignoreCase
3122
- };
3123
- tokens.push(attributeSelector);
3124
- break;
3125
- }
3126
- case 58: {
3127
- if (selector.charCodeAt(selectorIndex + 1) === 58) {
3128
- tokens.push({
3129
- type: types_1.SelectorType.PseudoElement,
3130
- name: getName(2).toLowerCase(),
3131
- data: selector.charCodeAt(selectorIndex) === 40 ? readValueWithParenthesis() : null
3132
- });
3133
- continue;
3134
- }
3135
- var name_2 = getName(1).toLowerCase();
3136
- var data = null;
3137
- if (selector.charCodeAt(selectorIndex) === 40) {
3138
- if (unpackPseudos.has(name_2)) {
3139
- if (isQuote2(selector.charCodeAt(selectorIndex + 1))) {
3140
- throw new Error("Pseudo-selector ".concat(name_2, " cannot be quoted"));
3141
- }
3142
- data = [];
3143
- selectorIndex = parseSelector(data, selector, selectorIndex + 1);
3144
- if (selector.charCodeAt(selectorIndex) !== 41) {
3145
- throw new Error("Missing closing parenthesis in :".concat(name_2, " (").concat(selector, ")"));
3146
- }
3147
- selectorIndex += 1;
3148
- } else {
3149
- data = readValueWithParenthesis();
3150
- if (stripQuotesFromPseudos.has(name_2)) {
3151
- var quot = data.charCodeAt(0);
3152
- if (quot === data.charCodeAt(data.length - 1) && isQuote2(quot)) {
3153
- data = data.slice(1, -1);
3154
- }
3155
- }
3156
- data = unescapeCSS(data);
3134
+ } else {
3135
+ data = readValueWithParenthesis();
3136
+ if (stripQuotesFromPseudos.has(name)) {
3137
+ const quot = data.charCodeAt(0);
3138
+ if (quot === data.charCodeAt(data.length - 1) && isQuote(quot)) {
3139
+ data = data.slice(1, -1);
3157
3140
  }
3158
3141
  }
3159
- tokens.push({ type: types_1.SelectorType.Pseudo, name: name_2, data });
3160
- break;
3142
+ data = unescapeCSS(data);
3161
3143
  }
3162
- case 44: {
3163
- finalizeSubselector();
3164
- tokens = [];
3165
- stripWhitespace(1);
3144
+ }
3145
+ tokens.push({ type: SelectorType.Pseudo, name, data });
3146
+ break;
3147
+ }
3148
+ case 44: {
3149
+ finalizeSubselector();
3150
+ tokens = [];
3151
+ stripWhitespace(1);
3152
+ break;
3153
+ }
3154
+ default: {
3155
+ if (selector.startsWith("/*", selectorIndex)) {
3156
+ const endIndex = selector.indexOf("*/", selectorIndex + 2);
3157
+ if (endIndex < 0) {
3158
+ throw new Error("Comment was not terminated");
3159
+ }
3160
+ selectorIndex = endIndex + 2;
3161
+ if (tokens.length === 0) {
3162
+ stripWhitespace(0);
3163
+ }
3164
+ break;
3165
+ }
3166
+ let namespace = null;
3167
+ let name;
3168
+ if (firstChar === 42) {
3169
+ selectorIndex += 1;
3170
+ name = "*";
3171
+ } else if (firstChar === 124) {
3172
+ name = "";
3173
+ if (selector.charCodeAt(selectorIndex + 1) === 124) {
3174
+ addTraversal(SelectorType.ColumnCombinator);
3175
+ stripWhitespace(2);
3166
3176
  break;
3167
3177
  }
3168
- default: {
3169
- if (selector.startsWith("/*", selectorIndex)) {
3170
- var endIndex = selector.indexOf("*/", selectorIndex + 2);
3171
- if (endIndex < 0) {
3172
- throw new Error("Comment was not terminated");
3173
- }
3174
- selectorIndex = endIndex + 2;
3175
- if (tokens.length === 0) {
3176
- stripWhitespace(0);
3177
- }
3178
- break;
3179
- }
3180
- var namespace = null;
3181
- var name_3 = void 0;
3182
- if (firstChar === 42) {
3183
- selectorIndex += 1;
3184
- name_3 = "*";
3185
- } else if (firstChar === 124) {
3186
- name_3 = "";
3187
- if (selector.charCodeAt(selectorIndex + 1) === 124) {
3188
- addTraversal(types_1.SelectorType.ColumnCombinator);
3189
- stripWhitespace(2);
3190
- break;
3191
- }
3192
- } else if (reName.test(selector.slice(selectorIndex))) {
3193
- name_3 = getName(0);
3194
- } else {
3195
- break loop;
3196
- }
3197
- if (selector.charCodeAt(selectorIndex) === 124 && selector.charCodeAt(selectorIndex + 1) !== 124) {
3198
- namespace = name_3;
3199
- if (selector.charCodeAt(selectorIndex + 1) === 42) {
3200
- name_3 = "*";
3201
- selectorIndex += 2;
3202
- } else {
3203
- name_3 = getName(1);
3204
- }
3205
- }
3206
- tokens.push(name_3 === "*" ? { type: types_1.SelectorType.Universal, namespace } : { type: types_1.SelectorType.Tag, name: name_3, namespace });
3178
+ } else if (reName.test(selector.slice(selectorIndex))) {
3179
+ name = getName(0);
3180
+ } else {
3181
+ break loop;
3182
+ }
3183
+ if (selector.charCodeAt(selectorIndex) === 124 && selector.charCodeAt(selectorIndex + 1) !== 124) {
3184
+ namespace = name;
3185
+ if (selector.charCodeAt(selectorIndex + 1) === 42) {
3186
+ name = "*";
3187
+ selectorIndex += 2;
3188
+ } else {
3189
+ name = getName(1);
3207
3190
  }
3208
3191
  }
3192
+ tokens.push(name === "*" ? { type: SelectorType.Universal, namespace } : { type: SelectorType.Tag, name, namespace });
3209
3193
  }
3210
- finalizeSubselector();
3211
- return selectorIndex;
3212
3194
  }
3213
3195
  }
3196
+ finalizeSubselector();
3197
+ return selectorIndex;
3198
+ }
3199
+ var reName, reEscape, actionTypes, unpackPseudos, stripQuotesFromPseudos;
3200
+ var init_parse = __esm({
3201
+ "../node_modules/css-what/lib/es/parse.js"() {
3202
+ "use strict";
3203
+ init_types();
3204
+ reName = /^[^\\#]?(?:\\(?:[\da-f]{1,6}\s?|.)|[\w\-\u00b0-\uFFFF])+/;
3205
+ reEscape = /\\([\da-f]{1,6}\s?|(\s)|.)/gi;
3206
+ actionTypes = /* @__PURE__ */ new Map([
3207
+ [126, AttributeAction.Element],
3208
+ [94, AttributeAction.Start],
3209
+ [36, AttributeAction.End],
3210
+ [42, AttributeAction.Any],
3211
+ [33, AttributeAction.Not],
3212
+ [124, AttributeAction.Hyphen]
3213
+ ]);
3214
+ unpackPseudos = /* @__PURE__ */ new Set([
3215
+ "has",
3216
+ "not",
3217
+ "matches",
3218
+ "is",
3219
+ "where",
3220
+ "host",
3221
+ "host-context"
3222
+ ]);
3223
+ stripQuotesFromPseudos = /* @__PURE__ */ new Set(["contains", "icontains"]);
3224
+ }
3214
3225
  });
3215
3226
 
3216
- // ../node_modules/css-what/lib/commonjs/stringify.js
3217
- var require_stringify2 = __commonJS({
3218
- "../node_modules/css-what/lib/commonjs/stringify.js"(exports) {
3227
+ // ../node_modules/css-what/lib/es/stringify.js
3228
+ function stringify(selector) {
3229
+ return selector.map((token) => token.map(stringifyToken).join("")).join(", ");
3230
+ }
3231
+ function stringifyToken(token, index, arr) {
3232
+ switch (token.type) {
3233
+ // Simple types
3234
+ case SelectorType.Child:
3235
+ return index === 0 ? "> " : " > ";
3236
+ case SelectorType.Parent:
3237
+ return index === 0 ? "< " : " < ";
3238
+ case SelectorType.Sibling:
3239
+ return index === 0 ? "~ " : " ~ ";
3240
+ case SelectorType.Adjacent:
3241
+ return index === 0 ? "+ " : " + ";
3242
+ case SelectorType.Descendant:
3243
+ return " ";
3244
+ case SelectorType.ColumnCombinator:
3245
+ return index === 0 ? "|| " : " || ";
3246
+ case SelectorType.Universal:
3247
+ return token.namespace === "*" && index + 1 < arr.length && "name" in arr[index + 1] ? "" : `${getNamespace(token.namespace)}*`;
3248
+ case SelectorType.Tag:
3249
+ return getNamespacedName(token);
3250
+ case SelectorType.PseudoElement:
3251
+ return `::${escapeName(token.name, charsToEscapeInName)}${token.data === null ? "" : `(${escapeName(token.data, charsToEscapeInPseudoValue)})`}`;
3252
+ case SelectorType.Pseudo:
3253
+ return `:${escapeName(token.name, charsToEscapeInName)}${token.data === null ? "" : `(${typeof token.data === "string" ? escapeName(token.data, charsToEscapeInPseudoValue) : stringify(token.data)})`}`;
3254
+ case SelectorType.Attribute: {
3255
+ if (token.name === "id" && token.action === AttributeAction.Equals && token.ignoreCase === "quirks" && !token.namespace) {
3256
+ return `#${escapeName(token.value, charsToEscapeInName)}`;
3257
+ }
3258
+ if (token.name === "class" && token.action === AttributeAction.Element && token.ignoreCase === "quirks" && !token.namespace) {
3259
+ return `.${escapeName(token.value, charsToEscapeInName)}`;
3260
+ }
3261
+ const name = getNamespacedName(token);
3262
+ if (token.action === AttributeAction.Exists) {
3263
+ return `[${name}]`;
3264
+ }
3265
+ return `[${name}${getActionValue(token.action)}="${escapeName(token.value, charsToEscapeInAttributeValue)}"${token.ignoreCase === null ? "" : token.ignoreCase ? " i" : " s"}]`;
3266
+ }
3267
+ }
3268
+ }
3269
+ function getActionValue(action) {
3270
+ switch (action) {
3271
+ case AttributeAction.Equals:
3272
+ return "";
3273
+ case AttributeAction.Element:
3274
+ return "~";
3275
+ case AttributeAction.Start:
3276
+ return "^";
3277
+ case AttributeAction.End:
3278
+ return "$";
3279
+ case AttributeAction.Any:
3280
+ return "*";
3281
+ case AttributeAction.Not:
3282
+ return "!";
3283
+ case AttributeAction.Hyphen:
3284
+ return "|";
3285
+ case AttributeAction.Exists:
3286
+ throw new Error("Shouldn't be here");
3287
+ }
3288
+ }
3289
+ function getNamespacedName(token) {
3290
+ return `${getNamespace(token.namespace)}${escapeName(token.name, charsToEscapeInName)}`;
3291
+ }
3292
+ function getNamespace(namespace) {
3293
+ return namespace !== null ? `${namespace === "*" ? "*" : escapeName(namespace, charsToEscapeInName)}|` : "";
3294
+ }
3295
+ function escapeName(str, charsToEscape) {
3296
+ let lastIdx = 0;
3297
+ let ret = "";
3298
+ for (let i = 0; i < str.length; i++) {
3299
+ if (charsToEscape.has(str.charCodeAt(i))) {
3300
+ ret += `${str.slice(lastIdx, i)}\\${str.charAt(i)}`;
3301
+ lastIdx = i + 1;
3302
+ }
3303
+ }
3304
+ return ret.length > 0 ? ret + str.slice(lastIdx) : str;
3305
+ }
3306
+ var attribValChars, pseudoValChars, charsToEscapeInAttributeValue, charsToEscapeInPseudoValue, charsToEscapeInName;
3307
+ var init_stringify = __esm({
3308
+ "../node_modules/css-what/lib/es/stringify.js"() {
3219
3309
  "use strict";
3220
- var __spreadArray = exports && exports.__spreadArray || function(to, from, pack) {
3221
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
3222
- if (ar || !(i in from)) {
3223
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
3224
- ar[i] = from[i];
3225
- }
3226
- }
3227
- return to.concat(ar || Array.prototype.slice.call(from));
3228
- };
3229
- Object.defineProperty(exports, "__esModule", { value: true });
3230
- exports.stringify = void 0;
3231
- var types_1 = require_types();
3232
- var attribValChars = ["\\", '"'];
3233
- var pseudoValChars = __spreadArray(__spreadArray([], attribValChars, true), ["(", ")"], false);
3234
- var charsToEscapeInAttributeValue = new Set(attribValChars.map(function(c) {
3235
- return c.charCodeAt(0);
3236
- }));
3237
- var charsToEscapeInPseudoValue = new Set(pseudoValChars.map(function(c) {
3238
- return c.charCodeAt(0);
3239
- }));
3240
- var charsToEscapeInName = new Set(__spreadArray(__spreadArray([], pseudoValChars, true), [
3310
+ init_types();
3311
+ attribValChars = ["\\", '"'];
3312
+ pseudoValChars = [...attribValChars, "(", ")"];
3313
+ charsToEscapeInAttributeValue = new Set(attribValChars.map((c) => c.charCodeAt(0)));
3314
+ charsToEscapeInPseudoValue = new Set(pseudoValChars.map((c) => c.charCodeAt(0)));
3315
+ charsToEscapeInName = new Set([
3316
+ ...pseudoValChars,
3241
3317
  "~",
3242
3318
  "^",
3243
3319
  "$",
@@ -3250,126 +3326,26 @@ var require_stringify2 = __commonJS({
3250
3326
  "]",
3251
3327
  " ",
3252
3328
  "."
3253
- ], false).map(function(c) {
3254
- return c.charCodeAt(0);
3255
- }));
3256
- function stringify(selector) {
3257
- return selector.map(function(token) {
3258
- return token.map(stringifyToken).join("");
3259
- }).join(", ");
3260
- }
3261
- exports.stringify = stringify;
3262
- function stringifyToken(token, index, arr) {
3263
- switch (token.type) {
3264
- case types_1.SelectorType.Child:
3265
- return index === 0 ? "> " : " > ";
3266
- case types_1.SelectorType.Parent:
3267
- return index === 0 ? "< " : " < ";
3268
- case types_1.SelectorType.Sibling:
3269
- return index === 0 ? "~ " : " ~ ";
3270
- case types_1.SelectorType.Adjacent:
3271
- return index === 0 ? "+ " : " + ";
3272
- case types_1.SelectorType.Descendant:
3273
- return " ";
3274
- case types_1.SelectorType.ColumnCombinator:
3275
- return index === 0 ? "|| " : " || ";
3276
- case types_1.SelectorType.Universal:
3277
- return token.namespace === "*" && index + 1 < arr.length && "name" in arr[index + 1] ? "" : "".concat(getNamespace(token.namespace), "*");
3278
- case types_1.SelectorType.Tag:
3279
- return getNamespacedName(token);
3280
- case types_1.SelectorType.PseudoElement:
3281
- return "::".concat(escapeName(token.name, charsToEscapeInName)).concat(token.data === null ? "" : "(".concat(escapeName(token.data, charsToEscapeInPseudoValue), ")"));
3282
- case types_1.SelectorType.Pseudo:
3283
- return ":".concat(escapeName(token.name, charsToEscapeInName)).concat(token.data === null ? "" : "(".concat(typeof token.data === "string" ? escapeName(token.data, charsToEscapeInPseudoValue) : stringify(token.data), ")"));
3284
- case types_1.SelectorType.Attribute: {
3285
- if (token.name === "id" && token.action === types_1.AttributeAction.Equals && token.ignoreCase === "quirks" && !token.namespace) {
3286
- return "#".concat(escapeName(token.value, charsToEscapeInName));
3287
- }
3288
- if (token.name === "class" && token.action === types_1.AttributeAction.Element && token.ignoreCase === "quirks" && !token.namespace) {
3289
- return ".".concat(escapeName(token.value, charsToEscapeInName));
3290
- }
3291
- var name_1 = getNamespacedName(token);
3292
- if (token.action === types_1.AttributeAction.Exists) {
3293
- return "[".concat(name_1, "]");
3294
- }
3295
- return "[".concat(name_1).concat(getActionValue(token.action), '="').concat(escapeName(token.value, charsToEscapeInAttributeValue), '"').concat(token.ignoreCase === null ? "" : token.ignoreCase ? " i" : " s", "]");
3296
- }
3297
- }
3298
- }
3299
- function getActionValue(action) {
3300
- switch (action) {
3301
- case types_1.AttributeAction.Equals:
3302
- return "";
3303
- case types_1.AttributeAction.Element:
3304
- return "~";
3305
- case types_1.AttributeAction.Start:
3306
- return "^";
3307
- case types_1.AttributeAction.End:
3308
- return "$";
3309
- case types_1.AttributeAction.Any:
3310
- return "*";
3311
- case types_1.AttributeAction.Not:
3312
- return "!";
3313
- case types_1.AttributeAction.Hyphen:
3314
- return "|";
3315
- case types_1.AttributeAction.Exists:
3316
- throw new Error("Shouldn't be here");
3317
- }
3318
- }
3319
- function getNamespacedName(token) {
3320
- return "".concat(getNamespace(token.namespace)).concat(escapeName(token.name, charsToEscapeInName));
3321
- }
3322
- function getNamespace(namespace) {
3323
- return namespace !== null ? "".concat(namespace === "*" ? "*" : escapeName(namespace, charsToEscapeInName), "|") : "";
3324
- }
3325
- function escapeName(str, charsToEscape) {
3326
- var lastIdx = 0;
3327
- var ret = "";
3328
- for (var i = 0; i < str.length; i++) {
3329
- if (charsToEscape.has(str.charCodeAt(i))) {
3330
- ret += "".concat(str.slice(lastIdx, i), "\\").concat(str.charAt(i));
3331
- lastIdx = i + 1;
3332
- }
3333
- }
3334
- return ret.length > 0 ? ret + str.slice(lastIdx) : str;
3335
- }
3329
+ ].map((c) => c.charCodeAt(0)));
3336
3330
  }
3337
3331
  });
3338
3332
 
3339
- // ../node_modules/css-what/lib/commonjs/index.js
3340
- var require_commonjs = __commonJS({
3341
- "../node_modules/css-what/lib/commonjs/index.js"(exports) {
3333
+ // ../node_modules/css-what/lib/es/index.js
3334
+ var es_exports = {};
3335
+ __export(es_exports, {
3336
+ AttributeAction: () => AttributeAction,
3337
+ IgnoreCaseMode: () => IgnoreCaseMode,
3338
+ SelectorType: () => SelectorType,
3339
+ isTraversal: () => isTraversal,
3340
+ parse: () => parse,
3341
+ stringify: () => stringify
3342
+ });
3343
+ var init_es = __esm({
3344
+ "../node_modules/css-what/lib/es/index.js"() {
3342
3345
  "use strict";
3343
- var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
3344
- if (k2 === void 0) k2 = k;
3345
- var desc = Object.getOwnPropertyDescriptor(m, k);
3346
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
3347
- desc = { enumerable: true, get: function() {
3348
- return m[k];
3349
- } };
3350
- }
3351
- Object.defineProperty(o, k2, desc);
3352
- } : function(o, m, k, k2) {
3353
- if (k2 === void 0) k2 = k;
3354
- o[k2] = m[k];
3355
- });
3356
- var __exportStar = exports && exports.__exportStar || function(m, exports2) {
3357
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
3358
- };
3359
- Object.defineProperty(exports, "__esModule", { value: true });
3360
- exports.stringify = exports.parse = exports.isTraversal = void 0;
3361
- __exportStar(require_types(), exports);
3362
- var parse_1 = require_parse();
3363
- Object.defineProperty(exports, "isTraversal", { enumerable: true, get: function() {
3364
- return parse_1.isTraversal;
3365
- } });
3366
- Object.defineProperty(exports, "parse", { enumerable: true, get: function() {
3367
- return parse_1.parse;
3368
- } });
3369
- var stringify_1 = require_stringify2();
3370
- Object.defineProperty(exports, "stringify", { enumerable: true, get: function() {
3371
- return stringify_1.stringify;
3372
- } });
3346
+ init_types();
3347
+ init_parse();
3348
+ init_stringify();
3373
3349
  }
3374
3350
  });
3375
3351
 
@@ -3379,17 +3355,17 @@ var require_sort = __commonJS({
3379
3355
  "use strict";
3380
3356
  Object.defineProperty(exports, "__esModule", { value: true });
3381
3357
  exports.isTraversal = void 0;
3382
- var css_what_1 = require_commonjs();
3358
+ var css_what_1 = (init_es(), __toCommonJS(es_exports));
3383
3359
  var procedure = /* @__PURE__ */ new Map([
3384
3360
  [css_what_1.SelectorType.Universal, 50],
3385
3361
  [css_what_1.SelectorType.Tag, 30],
3386
3362
  [css_what_1.SelectorType.Attribute, 1],
3387
3363
  [css_what_1.SelectorType.Pseudo, 0]
3388
3364
  ]);
3389
- function isTraversal(token) {
3365
+ function isTraversal2(token) {
3390
3366
  return !procedure.has(token.type);
3391
3367
  }
3392
- exports.isTraversal = isTraversal;
3368
+ exports.isTraversal = isTraversal2;
3393
3369
  var attributes = /* @__PURE__ */ new Map([
3394
3370
  [css_what_1.AttributeAction.Exists, 10],
3395
3371
  [css_what_1.AttributeAction.Equals, 8],
@@ -3645,7 +3621,7 @@ var require_attributes = __commonJS({
3645
3621
  });
3646
3622
 
3647
3623
  // ../node_modules/nth-check/lib/parse.js
3648
- var require_parse2 = __commonJS({
3624
+ var require_parse = __commonJS({
3649
3625
  "../node_modules/nth-check/lib/parse.js"(exports) {
3650
3626
  "use strict";
3651
3627
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -3653,7 +3629,7 @@ var require_parse2 = __commonJS({
3653
3629
  var whitespace = /* @__PURE__ */ new Set([9, 10, 12, 13, 32]);
3654
3630
  var ZERO = "0".charCodeAt(0);
3655
3631
  var NINE = "9".charCodeAt(0);
3656
- function parse(formula) {
3632
+ function parse2(formula) {
3657
3633
  formula = formula.trim().toLowerCase();
3658
3634
  if (formula === "even") {
3659
3635
  return [2, 0];
@@ -3705,7 +3681,7 @@ var require_parse2 = __commonJS({
3705
3681
  }
3706
3682
  }
3707
3683
  }
3708
- exports.parse = parse;
3684
+ exports.parse = parse2;
3709
3685
  }
3710
3686
  });
3711
3687
 
@@ -3786,7 +3762,7 @@ var require_lib6 = __commonJS({
3786
3762
  "use strict";
3787
3763
  Object.defineProperty(exports, "__esModule", { value: true });
3788
3764
  exports.sequence = exports.generate = exports.compile = exports.parse = void 0;
3789
- var parse_js_1 = require_parse2();
3765
+ var parse_js_1 = require_parse();
3790
3766
  Object.defineProperty(exports, "parse", { enumerable: true, get: function() {
3791
3767
  return parse_js_1.parse;
3792
3768
  } });
@@ -4197,7 +4173,7 @@ var require_pseudo_selectors = __commonJS({
4197
4173
  "use strict";
4198
4174
  Object.defineProperty(exports, "__esModule", { value: true });
4199
4175
  exports.compilePseudoSelector = exports.aliases = exports.pseudos = exports.filters = void 0;
4200
- var css_what_1 = require_commonjs();
4176
+ var css_what_1 = (init_es(), __toCommonJS(es_exports));
4201
4177
  var filters_js_1 = require_filters();
4202
4178
  Object.defineProperty(exports, "filters", { enumerable: true, get: function() {
4203
4179
  return filters_js_1.filters;
@@ -4259,7 +4235,7 @@ var require_general = __commonJS({
4259
4235
  exports.compileGeneralSelector = void 0;
4260
4236
  var attributes_js_1 = require_attributes();
4261
4237
  var index_js_1 = require_pseudo_selectors();
4262
- var css_what_1 = require_commonjs();
4238
+ var css_what_1 = (init_es(), __toCommonJS(es_exports));
4263
4239
  function getElementParent(node, adapter) {
4264
4240
  var parent = adapter.getParent(node);
4265
4241
  if (parent && adapter.isTag(parent)) {
@@ -4288,6 +4264,7 @@ var require_general = __commonJS({
4288
4264
  case css_what_1.SelectorType.Pseudo: {
4289
4265
  return (0, index_js_1.compilePseudoSelector)(next, selector, options, context, compileToken);
4290
4266
  }
4267
+ // Tags
4291
4268
  case css_what_1.SelectorType.Tag: {
4292
4269
  if (selector.namespace != null) {
4293
4270
  throw new Error("Namespaced tag names are not yet supported by css-select");
@@ -4300,6 +4277,7 @@ var require_general = __commonJS({
4300
4277
  return adapter.getName(elem) === name_1 && next(elem);
4301
4278
  };
4302
4279
  }
4280
+ // Traversal
4303
4281
  case css_what_1.SelectorType.Descendant: {
4304
4282
  if (options.cacheResults === false || typeof WeakSet === "undefined") {
4305
4283
  return function descendant(elem) {
@@ -4400,7 +4378,7 @@ var require_general = __commonJS({
4400
4378
  var require_compile2 = __commonJS({
4401
4379
  "../node_modules/css-select/lib/compile.js"(exports) {
4402
4380
  "use strict";
4403
- var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
4381
+ var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
4404
4382
  if (k2 === void 0) k2 = k;
4405
4383
  var desc = Object.getOwnPropertyDescriptor(m, k);
4406
4384
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
@@ -4409,13 +4387,13 @@ var require_compile2 = __commonJS({
4409
4387
  } };
4410
4388
  }
4411
4389
  Object.defineProperty(o, k2, desc);
4412
- } : function(o, m, k, k2) {
4390
+ }) : (function(o, m, k, k2) {
4413
4391
  if (k2 === void 0) k2 = k;
4414
4392
  o[k2] = m[k];
4415
- });
4416
- var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
4393
+ }));
4394
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
4417
4395
  Object.defineProperty(o, "default", { enumerable: true, value: v });
4418
- } : function(o, v) {
4396
+ }) : function(o, v) {
4419
4397
  o["default"] = v;
4420
4398
  });
4421
4399
  var __importStar = exports && exports.__importStar || function(mod) {
@@ -4432,7 +4410,7 @@ var require_compile2 = __commonJS({
4432
4410
  };
4433
4411
  Object.defineProperty(exports, "__esModule", { value: true });
4434
4412
  exports.compileToken = exports.compileUnsafe = exports.compile = void 0;
4435
- var css_what_1 = require_commonjs();
4413
+ var css_what_1 = (init_es(), __toCommonJS(es_exports));
4436
4414
  var boolbase_1 = __importDefault(require_boolbase());
4437
4415
  var sort_js_1 = __importStar(require_sort());
4438
4416
  var general_js_1 = require_general();
@@ -4532,7 +4510,7 @@ var require_compile2 = __commonJS({
4532
4510
  var require_lib7 = __commonJS({
4533
4511
  "../node_modules/css-select/lib/index.js"(exports) {
4534
4512
  "use strict";
4535
- var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
4513
+ var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
4536
4514
  if (k2 === void 0) k2 = k;
4537
4515
  var desc = Object.getOwnPropertyDescriptor(m, k);
4538
4516
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
@@ -4541,13 +4519,13 @@ var require_lib7 = __commonJS({
4541
4519
  } };
4542
4520
  }
4543
4521
  Object.defineProperty(o, k2, desc);
4544
- } : function(o, m, k, k2) {
4522
+ }) : (function(o, m, k, k2) {
4545
4523
  if (k2 === void 0) k2 = k;
4546
4524
  o[k2] = m[k];
4547
- });
4548
- var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
4525
+ }));
4526
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
4549
4527
  Object.defineProperty(o, "default", { enumerable: true, value: v });
4550
- } : function(o, v) {
4528
+ }) : function(o, v) {
4551
4529
  o["default"] = v;
4552
4530
  });
4553
4531
  var __importStar = exports && exports.__importStar || function(mod) {
@@ -4771,7 +4749,7 @@ var require_void_tag = __commonJS({
4771
4749
  Object.defineProperty(exports, "__esModule", { value: true });
4772
4750
  var VoidTag = (
4773
4751
  /** @class */
4774
- function() {
4752
+ (function() {
4775
4753
  function VoidTag2(addClosingSlash, tags) {
4776
4754
  if (addClosingSlash === void 0) {
4777
4755
  addClosingSlash = false;
@@ -4797,7 +4775,7 @@ var require_void_tag = __commonJS({
4797
4775
  return this.voidTags.has(tag);
4798
4776
  };
4799
4777
  return VoidTag2;
4800
- }()
4778
+ })()
4801
4779
  );
4802
4780
  exports.default = VoidTag;
4803
4781
  }
@@ -4807,7 +4785,7 @@ var require_void_tag = __commonJS({
4807
4785
  var require_text = __commonJS({
4808
4786
  "../node_modules/node-html-parser/dist/nodes/text.js"(exports) {
4809
4787
  "use strict";
4810
- var __extends = exports && exports.__extends || /* @__PURE__ */ function() {
4788
+ var __extends = exports && exports.__extends || /* @__PURE__ */ (function() {
4811
4789
  var extendStatics = function(d, b) {
4812
4790
  extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
4813
4791
  d2.__proto__ = b2;
@@ -4825,7 +4803,7 @@ var require_text = __commonJS({
4825
4803
  }
4826
4804
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
4827
4805
  };
4828
- }();
4806
+ })();
4829
4807
  var __importDefault = exports && exports.__importDefault || function(mod) {
4830
4808
  return mod && mod.__esModule ? mod : { "default": mod };
4831
4809
  };
@@ -4835,7 +4813,7 @@ var require_text = __commonJS({
4835
4813
  var type_1 = __importDefault(require_type());
4836
4814
  var TextNode = (
4837
4815
  /** @class */
4838
- function(_super) {
4816
+ (function(_super) {
4839
4817
  __extends(TextNode2, _super);
4840
4818
  function TextNode2(rawText, parentNode, range) {
4841
4819
  if (parentNode === void 0) {
@@ -4917,7 +4895,7 @@ var require_text = __commonJS({
4917
4895
  return this.rawText;
4918
4896
  };
4919
4897
  return TextNode2;
4920
- }(node_1.default)
4898
+ })(node_1.default)
4921
4899
  );
4922
4900
  exports.default = TextNode;
4923
4901
  function trimText(text) {
@@ -4954,7 +4932,7 @@ var require_text = __commonJS({
4954
4932
  var require_html = __commonJS({
4955
4933
  "../node_modules/node-html-parser/dist/nodes/html.js"(exports) {
4956
4934
  "use strict";
4957
- var __extends = exports && exports.__extends || /* @__PURE__ */ function() {
4935
+ var __extends = exports && exports.__extends || /* @__PURE__ */ (function() {
4958
4936
  var extendStatics = function(d, b) {
4959
4937
  extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
4960
4938
  d2.__proto__ = b2;
@@ -4972,7 +4950,7 @@ var require_html = __commonJS({
4972
4950
  }
4973
4951
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
4974
4952
  };
4975
- }();
4953
+ })();
4976
4954
  var __assign = exports && exports.__assign || function() {
4977
4955
  __assign = Object.assign || function(t2) {
4978
4956
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -5036,7 +5014,7 @@ var require_html = __commonJS({
5036
5014
  addToKBlockElement(Htags, Dtags, Ftags, tableTags, htmlTags);
5037
5015
  var DOMTokenList = (
5038
5016
  /** @class */
5039
- function() {
5017
+ (function() {
5040
5018
  function DOMTokenList2(valuesInit, afterUpdate) {
5041
5019
  if (valuesInit === void 0) {
5042
5020
  valuesInit = [];
@@ -5100,11 +5078,11 @@ var require_html = __commonJS({
5100
5078
  return Array.from(this._set.values()).join(" ");
5101
5079
  };
5102
5080
  return DOMTokenList2;
5103
- }()
5081
+ })()
5104
5082
  );
5105
5083
  var HTMLElement = (
5106
5084
  /** @class */
5107
- function(_super) {
5085
+ (function(_super) {
5108
5086
  __extends(HTMLElement2, _super);
5109
5087
  function HTMLElement2(tagName, keyAttrs, rawAttrs, parentNode, range, voidTag, _parseOptions) {
5110
5088
  if (rawAttrs === void 0) {
@@ -5293,7 +5271,7 @@ var require_html = __commonJS({
5293
5271
  }).join("");
5294
5272
  },
5295
5273
  set: function(content) {
5296
- var r = parse(content, this._parseOptions);
5274
+ var r = parse2(content, this._parseOptions);
5297
5275
  var nodes = r.childNodes.length ? r.childNodes : [new text_1.default(content, this)];
5298
5276
  resetParent(nodes, this);
5299
5277
  resetParent(this.childNodes, null);
@@ -5310,7 +5288,7 @@ var require_html = __commonJS({
5310
5288
  content = [content];
5311
5289
  } else if (typeof content == "string") {
5312
5290
  options = __assign(__assign({}, this._parseOptions), options);
5313
- var r = parse(content, options);
5291
+ var r = parse2(content, options);
5314
5292
  content = r.childNodes.length ? r.childNodes : [new text_1.default(r.innerHTML, this)];
5315
5293
  }
5316
5294
  resetParent(this.childNodes, null);
@@ -5329,7 +5307,7 @@ var require_html = __commonJS({
5329
5307
  if (node instanceof node_1.default) {
5330
5308
  return [node];
5331
5309
  } else if (typeof node == "string") {
5332
- var r = parse(node, _this._parseOptions);
5310
+ var r = parse2(node, _this._parseOptions);
5333
5311
  return r.childNodes.length ? r.childNodes : [new text_1.default(node, _this)];
5334
5312
  }
5335
5313
  return [];
@@ -5688,7 +5666,7 @@ var require_html = __commonJS({
5688
5666
  if (arguments.length < 2) {
5689
5667
  throw new Error("2 arguments required");
5690
5668
  }
5691
- var p = parse(html, this._parseOptions);
5669
+ var p = parse2(html, this._parseOptions);
5692
5670
  if (where === "afterend") {
5693
5671
  var idx = this.parentNode.childNodes.findIndex(function(child) {
5694
5672
  return child === _this;
@@ -5797,10 +5775,10 @@ var require_html = __commonJS({
5797
5775
  configurable: true
5798
5776
  });
5799
5777
  HTMLElement2.prototype.clone = function() {
5800
- return parse(this.toString(), this._parseOptions).firstChild;
5778
+ return parse2(this.toString(), this._parseOptions).firstChild;
5801
5779
  };
5802
5780
  return HTMLElement2;
5803
- }(node_1.default)
5781
+ })(node_1.default)
5804
5782
  );
5805
5783
  exports.default = HTMLElement;
5806
5784
  var kMarkupPattern = /<!--[\s\S]*?-->|<(\/?)([a-zA-Z][-.:0-9_a-zA-Z]*)((?:\s+[^>]*?(?:(?:'[^']*')|(?:"[^"]*"))?)*)\s*(\/?)>/g;
@@ -5985,7 +5963,7 @@ var require_html = __commonJS({
5985
5963
  return stack;
5986
5964
  }
5987
5965
  exports.base_parse = base_parse;
5988
- function parse(data, options) {
5966
+ function parse2(data, options) {
5989
5967
  if (options === void 0) {
5990
5968
  options = {};
5991
5969
  }
@@ -6019,7 +5997,7 @@ var require_html = __commonJS({
6019
5997
  }
6020
5998
  return root;
6021
5999
  }
6022
- exports.parse = parse;
6000
+ exports.parse = parse2;
6023
6001
  function resetParent(nodes, parent) {
6024
6002
  return nodes.map(function(node) {
6025
6003
  node.parentNode = parent;
@@ -6030,7 +6008,7 @@ var require_html = __commonJS({
6030
6008
  });
6031
6009
 
6032
6010
  // ../node_modules/node-html-parser/dist/parse.js
6033
- var require_parse3 = __commonJS({
6011
+ var require_parse2 = __commonJS({
6034
6012
  "../node_modules/node-html-parser/dist/parse.js"(exports) {
6035
6013
  "use strict";
6036
6014
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -6078,24 +6056,24 @@ var require_dist = __commonJS({
6078
6056
  exports.TextNode = text_1.default;
6079
6057
  var type_1 = __importDefault(require_type());
6080
6058
  exports.NodeType = type_1.default;
6081
- var parse_1 = __importDefault(require_parse3());
6059
+ var parse_1 = __importDefault(require_parse2());
6082
6060
  var valid_1 = __importDefault(require_valid());
6083
6061
  exports.valid = valid_1.default;
6084
- function parse(data, options) {
6062
+ function parse2(data, options) {
6085
6063
  if (options === void 0) {
6086
6064
  options = {};
6087
6065
  }
6088
6066
  return (0, parse_1.default)(data, options);
6089
6067
  }
6090
- exports.default = parse;
6091
- exports.parse = parse;
6092
- parse.parse = parse_1.default;
6093
- parse.HTMLElement = html_1.default;
6094
- parse.CommentNode = comment_1.default;
6095
- parse.valid = valid_1.default;
6096
- parse.Node = node_1.default;
6097
- parse.TextNode = text_1.default;
6098
- parse.NodeType = type_1.default;
6068
+ exports.default = parse2;
6069
+ exports.parse = parse2;
6070
+ parse2.parse = parse_1.default;
6071
+ parse2.HTMLElement = html_1.default;
6072
+ parse2.CommentNode = comment_1.default;
6073
+ parse2.valid = valid_1.default;
6074
+ parse2.Node = node_1.default;
6075
+ parse2.TextNode = text_1.default;
6076
+ parse2.NodeType = type_1.default;
6099
6077
  }
6100
6078
  });
6101
6079
 
@@ -6103,7 +6081,7 @@ var require_dist = __commonJS({
6103
6081
  var require_wemlContentNormalizeV2 = __commonJS({
6104
6082
  "../wemlContentNormalizeV2.js"(exports, module) {
6105
6083
  "use strict";
6106
- var { parse, TextNode } = require_dist();
6084
+ var { parse: parse2, TextNode } = require_dist();
6107
6085
  var BLOCK_ELEMENTS = /* @__PURE__ */ new Set([
6108
6086
  "div",
6109
6087
  "w-para",
@@ -6133,21 +6111,41 @@ var require_wemlContentNormalizeV2 = __commonJS({
6133
6111
  "a",
6134
6112
  "w-anchor",
6135
6113
  "w-sent",
6136
- "w-page"
6114
+ "w-page",
6115
+ "w-color"
6137
6116
  ]);
6138
- var VOID_HTML_ELEMENTS = /* @__PURE__ */ new Set(["meta", "br", "hr", "img", "link"]);
6139
- var VOID_TAG_RE = /<\s*(meta|br|hr|img|link)\b([^<>]*?)(?:\/\s*)?>/gi;
6140
- var ENTITY_RE2 = /&(#[xX][0-9a-fA-F]+|#[0-9]+|[a-zA-Z][a-zA-Z0-9]*);/g;
6117
+ var VOID_HTML_ELEMENTS = /* @__PURE__ */ new Set([
6118
+ "area",
6119
+ "base",
6120
+ "br",
6121
+ "col",
6122
+ "embed",
6123
+ "hr",
6124
+ "img",
6125
+ "input",
6126
+ "link",
6127
+ "meta",
6128
+ "source",
6129
+ "track",
6130
+ "wbr",
6131
+ "param"
6132
+ ]);
6133
+ var VOID_TAG_RE = /<[ \t\n\f\r]*(area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr|param)(?=[ \t\n\f\r/>])((?:[^<>"']|"[^"]*"|'[^']*')*?)>/gi;
6134
+ var ENTITY_RE2 = /&(#[xX][0-9a-fA-F]+|#[0-9]+|[a-zA-Z][a-zA-Z0-9]*);?/g;
6141
6135
  var PH_OPEN = "\uE000";
6142
6136
  var PH_CLOSE = "\uE001";
6143
- var PH_RE = /\uE000([0-9]+)\uE001/g;
6144
- var VOID_ELEMENTS = /* @__PURE__ */ new Set(["meta", "br", "hr", "img", "link"]);
6137
+ var VOID_ELEMENTS = VOID_HTML_ELEMENTS;
6138
+ var SPACE_SEPARATED_ATTRIBUTES = /* @__PURE__ */ new Set(["class", "headers", "rel", "rev"]);
6145
6139
  var WHITE_SPACE = /* @__PURE__ */ new Set([
6146
6140
  9,
6147
6141
  10,
6148
6142
  11,
6149
6143
  12,
6150
6144
  13,
6145
+ 28,
6146
+ 29,
6147
+ 30,
6148
+ 31,
6151
6149
  32,
6152
6150
  133,
6153
6151
  160,
@@ -6167,40 +6165,104 @@ var require_wemlContentNormalizeV2 = __commonJS({
6167
6165
  8233,
6168
6166
  8239,
6169
6167
  8287,
6170
- 12288
6168
+ 12288,
6169
+ 65279
6171
6170
  ]);
6172
6171
  function formatWeml(input) {
6173
- const { html, entities: entities2 } = protectEntities(input);
6174
- const doc = parse(normalizeVoidTagSyntax(html));
6172
+ const { html, entities: entities2, marker } = protectEntities(input);
6173
+ const doc = parse2(normalizeVoidTagSyntax(html));
6174
+ const title = doc.querySelector("head title");
6175
+ if (title) processInlineContent(title, true);
6175
6176
  const body = doc.querySelector("body");
6176
6177
  if (body) processBlockElement(body);
6177
- return restoreEntities(serializeDocument(doc), entities2);
6178
+ return restoreEntities(serializeDocument(doc, entities2, marker), entities2, marker);
6178
6179
  }
6179
6180
  function protectEntities(input) {
6181
+ let markerLength = 1;
6182
+ let marker = PH_OPEN.repeat(markerLength) + PH_CLOSE;
6183
+ while (input.includes(marker)) {
6184
+ markerLength += 1;
6185
+ marker = PH_OPEN.repeat(markerLength) + PH_CLOSE;
6186
+ }
6180
6187
  const entities2 = [];
6181
6188
  const html = input.replace(ENTITY_RE2, (match) => {
6182
6189
  const index = entities2.length;
6183
6190
  entities2.push(match);
6184
- return `${PH_OPEN}${index}${PH_CLOSE}`;
6191
+ return `${marker}${index}${marker}`;
6185
6192
  });
6186
- return { html, entities: entities2 };
6187
- }
6188
- function restoreEntities(text, entities2) {
6189
- return text.replace(PH_RE, (_, index) => entities2[Number(index)]);
6193
+ return { html, entities: entities2, marker };
6194
+ }
6195
+ function restoreEntities(text, entities2, marker) {
6196
+ const result = [];
6197
+ let position = 0;
6198
+ while (position < text.length) {
6199
+ const open = text.indexOf(marker, position);
6200
+ if (open < 0) {
6201
+ result.push(text.slice(position));
6202
+ break;
6203
+ }
6204
+ result.push(text.slice(position, open));
6205
+ const indexStart = open + marker.length;
6206
+ const close = text.indexOf(marker, indexStart);
6207
+ const indexText = close >= 0 ? text.slice(indexStart, close) : "";
6208
+ const entityIndex = Number(indexText);
6209
+ if (close < 0 || !/^[0-9]+$/.test(indexText) || !Number.isSafeInteger(entityIndex) || entityIndex >= entities2.length) {
6210
+ throw new Error("Invalid internal entity placeholder.");
6211
+ }
6212
+ result.push(entities2[entityIndex]);
6213
+ position = close + marker.length;
6214
+ }
6215
+ return result.join("");
6190
6216
  }
6191
6217
  function normalizeVoidTagSyntax(input) {
6192
- return input.replace(VOID_TAG_RE, (_, name, attrs) => `<${name.toLowerCase()}${attrs.trimEnd()} />`);
6218
+ function slashBelongsToUnquotedValue(attrs) {
6219
+ let index = 0;
6220
+ const whitespace = /* @__PURE__ */ new Set([" ", " ", "\n", "\f", "\r"]);
6221
+ while (index < attrs.length) {
6222
+ while (index < attrs.length && whitespace.has(attrs[index])) index += 1;
6223
+ if (index >= attrs.length || attrs[index] === "/") return false;
6224
+ while (index < attrs.length && !whitespace.has(attrs[index]) && !["=", "/"].includes(attrs[index])) index += 1;
6225
+ while (index < attrs.length && whitespace.has(attrs[index])) index += 1;
6226
+ if (index >= attrs.length || attrs[index] !== "=") continue;
6227
+ index += 1;
6228
+ while (index < attrs.length && whitespace.has(attrs[index])) index += 1;
6229
+ if (index >= attrs.length) return false;
6230
+ if (attrs[index] === '"' || attrs[index] === "'") {
6231
+ const quote = attrs[index];
6232
+ index += 1;
6233
+ while (index < attrs.length && attrs[index] !== quote) index += 1;
6234
+ if (index < attrs.length) index += 1;
6235
+ continue;
6236
+ }
6237
+ const valueStart = index;
6238
+ while (index < attrs.length && !whitespace.has(attrs[index])) index += 1;
6239
+ if (index === attrs.length) {
6240
+ return valueStart < attrs.length && attrs.endsWith("/");
6241
+ }
6242
+ }
6243
+ return false;
6244
+ }
6245
+ return input.replace(VOID_TAG_RE, (_, name, rawAttrs) => {
6246
+ let attrs = trimRawEndWhitespace(rawAttrs);
6247
+ if (attrs.endsWith("/") && !slashBelongsToUnquotedValue(attrs)) {
6248
+ attrs = trimRawEndWhitespace(attrs.slice(0, -1));
6249
+ }
6250
+ return `<${name.toLowerCase()}${attrs} />`;
6251
+ });
6193
6252
  }
6194
6253
  function processBlockElement(node) {
6195
6254
  for (const child of [...node.childNodes]) {
6196
- if (child.nodeType === 3 && child.rawText.trim() === "") child.remove();
6255
+ if (child.nodeType !== 3) continue;
6256
+ const normalized = trimWhitespace(child.rawText);
6257
+ if (normalized) child.rawText = normalized;
6258
+ else child.remove();
6197
6259
  }
6198
6260
  for (const child of [...node.childNodes]) {
6199
6261
  if (child.nodeType !== 1) continue;
6200
6262
  const name = child.rawTagName.toLowerCase();
6201
6263
  if (INLINE_CONTAINERS.has(name)) processInlineContainer(child);
6202
6264
  else if (BLOCK_ELEMENTS.has(name)) processBlockElement(child);
6203
- else if (INLINE_ELEMENTS.has(name)) processInlineContent(child, true);
6265
+ else if (isInlineTextElement(child)) processInlineContent(child, true);
6204
6266
  }
6205
6267
  }
6206
6268
  function processInlineContainer(node) {
@@ -6211,7 +6273,7 @@ var require_wemlContentNormalizeV2 = __commonJS({
6211
6273
  for (const child of [...node.childNodes]) {
6212
6274
  if (child.nodeType !== 1) continue;
6213
6275
  const name = child.rawTagName.toLowerCase();
6214
- if (INLINE_ELEMENTS.has(name)) {
6276
+ if (isInlineTextElement(child)) {
6215
6277
  if (hasDirectSentChildren(child)) processSentContainer(child);
6216
6278
  else processInlineContent(child, false);
6217
6279
  } else if (BLOCK_ELEMENTS.has(name)) {
@@ -6221,19 +6283,19 @@ var require_wemlContentNormalizeV2 = __commonJS({
6221
6283
  }
6222
6284
  }
6223
6285
  for (const child of [...node.childNodes]) {
6224
- if (child.nodeType === 1 && INLINE_ELEMENTS.has(child.rawTagName.toLowerCase())) {
6286
+ if (child.nodeType === 1 && isInlineTextElement(child)) {
6225
6287
  bleedEdgeSpaces(child);
6226
6288
  }
6227
6289
  }
6228
6290
  for (const child of [...node.childNodes]) {
6229
- if (child.nodeType === 3) child.rawText = child.rawText.replace(/[ \t\r\n]+/g, " ");
6291
+ if (child.nodeType === 3) child.rawText = collapseWhitespace(child.rawText);
6230
6292
  }
6231
6293
  for (const child of [...node.childNodes]) {
6232
6294
  if (child.nodeType === 1 && child.rawTagName.toLowerCase() === "br") {
6233
6295
  const prev = child.previousSibling;
6234
- if (prev && prev.nodeType === 3) prev.rawText = prev.rawText.replace(/\s+$/, "");
6296
+ if (prev && prev.nodeType === 3) prev.rawText = trimEndWhitespace(prev.rawText);
6235
6297
  const next = child.nextSibling;
6236
- if (next && next.nodeType === 3) next.rawText = next.rawText.replace(/^\s+/, "");
6298
+ if (next && next.nodeType === 3) next.rawText = trimStartWhitespace(next.rawText);
6237
6299
  }
6238
6300
  }
6239
6301
  trimContainerEdges(node);
@@ -6247,17 +6309,17 @@ var require_wemlContentNormalizeV2 = __commonJS({
6247
6309
  const first = children[0];
6248
6310
  const last = children[children.length - 1];
6249
6311
  if (children.length === 1) {
6250
- if (first.nodeType === 3) first.rawText = first.rawText.trim();
6312
+ if (first.nodeType === 3) first.rawText = trimWhitespace(first.rawText);
6251
6313
  } else {
6252
- if (first.nodeType === 3) first.rawText = first.rawText.replace(/^\s+/, "");
6253
- if (last.nodeType === 3) last.rawText = last.rawText.replace(/\s+$/, "");
6314
+ if (first.nodeType === 3) first.rawText = trimStartWhitespace(first.rawText);
6315
+ if (last.nodeType === 3) last.rawText = trimEndWhitespace(last.rawText);
6254
6316
  }
6255
6317
  }
6256
6318
  function processInlineContent(node, trimEdges) {
6257
6319
  for (const child of [...node.childNodes]) {
6258
6320
  if (child.nodeType !== 1) continue;
6259
6321
  const name = child.rawTagName.toLowerCase();
6260
- if (INLINE_ELEMENTS.has(name)) {
6322
+ if (isInlineTextElement(child)) {
6261
6323
  if (hasDirectSentChildren(child)) processSentContainer(child);
6262
6324
  else processInlineContent(child, false);
6263
6325
  } else if (BLOCK_ELEMENTS.has(name)) {
@@ -6267,19 +6329,19 @@ var require_wemlContentNormalizeV2 = __commonJS({
6267
6329
  }
6268
6330
  }
6269
6331
  for (const child of [...node.childNodes]) {
6270
- if (child.nodeType === 1 && INLINE_ELEMENTS.has(child.rawTagName.toLowerCase())) {
6332
+ if (child.nodeType === 1 && isInlineTextElement(child)) {
6271
6333
  bleedEdgeSpaces(child);
6272
6334
  }
6273
6335
  }
6274
6336
  for (const child of [...node.childNodes]) {
6275
- if (child.nodeType === 3) child.rawText = child.rawText.replace(/[ \t\r\n]+/g, " ");
6337
+ if (child.nodeType === 3) child.rawText = collapseWhitespace(child.rawText);
6276
6338
  }
6277
6339
  for (const child of [...node.childNodes]) {
6278
6340
  if (child.nodeType === 1 && child.rawTagName.toLowerCase() === "br") {
6279
6341
  const prev = child.previousSibling;
6280
- if (prev && prev.nodeType === 3) prev.rawText = prev.rawText.replace(/\s+$/, "");
6342
+ if (prev && prev.nodeType === 3) prev.rawText = trimEndWhitespace(prev.rawText);
6281
6343
  const next = child.nextSibling;
6282
- if (next && next.nodeType === 3) next.rawText = next.rawText.replace(/^\s+/, "");
6344
+ if (next && next.nodeType === 3) next.rawText = trimStartWhitespace(next.rawText);
6283
6345
  }
6284
6346
  }
6285
6347
  if (trimEdges) trimEdgeTextNodes(node);
@@ -6317,7 +6379,7 @@ var require_wemlContentNormalizeV2 = __commonJS({
6317
6379
  const first = getFirstTextNode(node);
6318
6380
  if (!first) return "";
6319
6381
  const raw = first.rawText;
6320
- const trimmed = raw.replace(/^\s+/, "");
6382
+ const trimmed = trimStartWhitespace(raw);
6321
6383
  if (trimmed === raw) return "";
6322
6384
  first.rawText = trimmed;
6323
6385
  return " ";
@@ -6326,7 +6388,7 @@ var require_wemlContentNormalizeV2 = __commonJS({
6326
6388
  const last = getLastTextNode(node);
6327
6389
  if (!last) return "";
6328
6390
  const raw = last.rawText;
6329
- const trimmed = raw.replace(/\s+$/, "");
6391
+ const trimmed = trimEndWhitespace(raw);
6330
6392
  if (trimmed === raw) return "";
6331
6393
  last.rawText = trimmed;
6332
6394
  return " ";
@@ -6363,10 +6425,10 @@ var require_wemlContentNormalizeV2 = __commonJS({
6363
6425
  const first = children[0];
6364
6426
  const last = children[children.length - 1];
6365
6427
  if (first === last) {
6366
- if (first.nodeType === 3) first.rawText = first.rawText.trim();
6428
+ if (first.nodeType === 3) first.rawText = trimWhitespace(first.rawText);
6367
6429
  } else {
6368
- if (first.nodeType === 3) first.rawText = first.rawText.replace(/^\s+/, "");
6369
- if (last.nodeType === 3) last.rawText = last.rawText.replace(/\s+$/, "");
6430
+ if (first.nodeType === 3) first.rawText = trimStartWhitespace(first.rawText);
6431
+ if (last.nodeType === 3) last.rawText = trimEndWhitespace(last.rawText);
6370
6432
  }
6371
6433
  }
6372
6434
  function hasDirectSentChildren(node) {
@@ -6374,17 +6436,22 @@ var require_wemlContentNormalizeV2 = __commonJS({
6374
6436
  (child) => child.nodeType === 1 && child.rawTagName.toLowerCase() === "w-sent"
6375
6437
  );
6376
6438
  }
6377
- function serializeDocument(doc) {
6439
+ function isInlineTextElement(node) {
6440
+ if (node.nodeType !== 1) return false;
6441
+ const name = node.rawTagName.toLowerCase();
6442
+ return INLINE_ELEMENTS.has(name) || !BLOCK_ELEMENTS.has(name) && !INLINE_CONTAINERS.has(name) && !VOID_HTML_ELEMENTS.has(name);
6443
+ }
6444
+ function serializeDocument(doc, entities2, marker) {
6378
6445
  const parts = ["<!DOCTYPE html>\n"];
6379
6446
  const htmlNode = doc.querySelector("html");
6380
- parts.push(`<html${serializeAttrs(htmlNode ? htmlNode.attrs : {})}>
6447
+ parts.push(`<html${serializeAttrs(htmlNode ? htmlNode.rawAttrs : "", entities2, marker)}>
6381
6448
 
6382
6449
  `);
6383
6450
  const head = doc.querySelector("head");
6384
6451
  parts.push("<head>\n");
6385
6452
  if (head) {
6386
6453
  for (const child of head.childNodes) {
6387
- if (child.nodeType === 1) parts.push(serializeNode(child), "\n");
6454
+ if (child.nodeType === 1) parts.push(serializeNode(child, entities2, marker), "\n");
6388
6455
  }
6389
6456
  }
6390
6457
  parts.push("</head>\n\n");
@@ -6392,28 +6459,81 @@ var require_wemlContentNormalizeV2 = __commonJS({
6392
6459
  parts.push("<body>\n");
6393
6460
  if (body) {
6394
6461
  for (const child of body.childNodes) {
6395
- if (child.nodeType === 1) parts.push(serializeNode(child), "\n");
6462
+ if (child.nodeType === 1) parts.push(serializeNode(child, entities2, marker), "\n");
6396
6463
  }
6397
6464
  }
6398
6465
  parts.push("</body>\n</html>");
6399
6466
  return parts.join("");
6400
6467
  }
6401
- function serializeNode(node) {
6468
+ function serializeNode(node, entities2, marker) {
6402
6469
  if (node.nodeType === 3) return node.rawText;
6403
6470
  if (node.nodeType === 8 || node.nodeType !== 1) return "";
6404
6471
  const name = node.rawTagName.toLowerCase();
6405
- const attrs = serializeAttrs(node.attrs);
6472
+ const attrs = serializeAttrs(node.rawAttrs, entities2, marker);
6406
6473
  if (VOID_HTML_ELEMENTS.has(name)) return `<${name}${attrs} />`;
6407
6474
  const isBlock = BLOCK_ELEMENTS.has(name);
6408
6475
  const inner = [];
6409
6476
  for (const child of node.childNodes) {
6410
- if (isBlock && child.nodeType === 3 && child.rawText.trim() === "") continue;
6411
- inner.push(serializeNode(child));
6477
+ if (isBlock && child.nodeType === 3 && isWhitespaceOnly(child.rawText)) continue;
6478
+ inner.push(serializeNode(child, entities2, marker));
6412
6479
  }
6413
6480
  return `<${name}${attrs}>${inner.join("")}</${name}>`;
6414
6481
  }
6415
- function serializeAttrs(attrs) {
6416
- return Object.entries(attrs).map(([name, value]) => ` ${name}="${encodeAttr(String(value))}"`).join("");
6482
+ function serializeAttrs(rawAttrs, entities2, marker) {
6483
+ const canonical = /* @__PURE__ */ new Map();
6484
+ let index = 0;
6485
+ while (index < rawAttrs.length) {
6486
+ while (index < rawAttrs.length && isNormalizableWhitespace(rawAttrs[index])) index++;
6487
+ if (index >= rawAttrs.length || rawAttrs[index] === "/") break;
6488
+ const nameStart = index;
6489
+ while (index < rawAttrs.length && !isNormalizableWhitespace(rawAttrs[index]) && !"=/>".includes(rawAttrs[index])) index++;
6490
+ if (index === nameStart) {
6491
+ index++;
6492
+ continue;
6493
+ }
6494
+ const name = rawAttrs.slice(nameStart, index).toLowerCase();
6495
+ while (index < rawAttrs.length && isNormalizableWhitespace(rawAttrs[index])) index++;
6496
+ let value = "";
6497
+ if (rawAttrs[index] === "=") {
6498
+ index++;
6499
+ while (index < rawAttrs.length && isNormalizableWhitespace(rawAttrs[index])) index++;
6500
+ if (rawAttrs[index] === '"' || rawAttrs[index] === "'") {
6501
+ const quote = rawAttrs[index++];
6502
+ const valueStart = index;
6503
+ while (index < rawAttrs.length && rawAttrs[index] !== quote) index++;
6504
+ value = rawAttrs.slice(valueStart, index);
6505
+ if (index < rawAttrs.length) index++;
6506
+ } else {
6507
+ const valueStart = index;
6508
+ while (index < rawAttrs.length && !isNormalizableWhitespace(rawAttrs[index])) index++;
6509
+ value = rawAttrs.slice(valueStart, index);
6510
+ }
6511
+ }
6512
+ canonical.set(
6513
+ name,
6514
+ SPACE_SEPARATED_ATTRIBUTES.has(name) ? normalizeTokenList(value, entities2, marker) : value
6515
+ );
6516
+ }
6517
+ return [...canonical.entries()].sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0).map(([name, value]) => ` ${name}="${encodeAttr(String(value))}"`).join("");
6518
+ }
6519
+ function normalizeTokenList(value, entities2, marker) {
6520
+ const normalized = trimWhitespace(value);
6521
+ if (!normalized) return normalized;
6522
+ return normalized.split(" ").sort((left, right) => compareUnicodeScalars(
6523
+ restoreEntities(left, entities2, marker),
6524
+ restoreEntities(right, entities2, marker)
6525
+ )).join(" ");
6526
+ }
6527
+ function compareUnicodeScalars(left, right) {
6528
+ const leftScalars = Array.from(left, (character) => character.codePointAt(0));
6529
+ const rightScalars = Array.from(right, (character) => character.codePointAt(0));
6530
+ const limit = Math.min(leftScalars.length, rightScalars.length);
6531
+ for (let index = 0; index < limit; index++) {
6532
+ if (leftScalars[index] !== rightScalars[index]) {
6533
+ return leftScalars[index] - rightScalars[index];
6534
+ }
6535
+ }
6536
+ return leftScalars.length - rightScalars.length;
6417
6537
  }
6418
6538
  function encodeAttr(value) {
6419
6539
  return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
@@ -6451,6 +6571,7 @@ var require_wemlContentNormalizeV2 = __commonJS({
6451
6571
  }
6452
6572
  };
6453
6573
  function wemlContentNormalize2(input, isWemlValid = false) {
6574
+ if (input.startsWith("\uFEFF")) input = input.slice(1);
6454
6575
  const inputText = withoutWhiteSpace(analyze(input, !isWemlValid).text);
6455
6576
  const result = formatWeml(input);
6456
6577
  const outputText = withoutWhiteSpace(analyze(result, true).text);
@@ -6465,6 +6586,9 @@ var require_wemlContentNormalizeV2 = __commonJS({
6465
6586
  if (source[index2] === "\n") lineStarts.push(index2 + 1);
6466
6587
  }
6467
6588
  const stack = [];
6589
+ const rootTagCounts = /* @__PURE__ */ new Map([["html", 0], ["head", 0], ["body", 0]]);
6590
+ let seenHead = false;
6591
+ let seenBody = false;
6468
6592
  const textParts = [];
6469
6593
  let textStart = 0;
6470
6594
  let index = 0;
@@ -6548,6 +6672,26 @@ var require_wemlContentNormalizeV2 = __commonJS({
6548
6672
  if (expected !== name) fail("MISMATCHED_CLOSING_TAG", index, expected, name);
6549
6673
  stack.pop();
6550
6674
  } else {
6675
+ if (rootTagCounts.has(name)) {
6676
+ if (rootTagCounts.get(name) > 0) {
6677
+ fail("DUPLICATE_ROOT_TAG", index, null, name);
6678
+ }
6679
+ const parent = stack.length > 0 ? stack.at(-1).name : null;
6680
+ if (name === "html") {
6681
+ if (parent !== null) fail("INVALID_ROOT_TAG_PARENT", index, null, name);
6682
+ } else if (parent !== "html") {
6683
+ fail("INVALID_ROOT_TAG_PARENT", index, "html", name);
6684
+ }
6685
+ if (name === "body" && !seenHead) {
6686
+ fail("BODY_BEFORE_HEAD", index, "head", "body");
6687
+ }
6688
+ if (name === "head" && seenBody) {
6689
+ fail("HEAD_AFTER_BODY", index, "body", "head");
6690
+ }
6691
+ rootTagCounts.set(name, rootTagCounts.get(name) + 1);
6692
+ seenHead || (seenHead = name === "head");
6693
+ seenBody || (seenBody = name === "body");
6694
+ }
6551
6695
  let last = found.end - 1;
6552
6696
  while (last >= cursor && isSourceSpace(source[last])) last--;
6553
6697
  const selfClosing = last >= cursor && source[last] === "/";
@@ -6569,6 +6713,11 @@ var require_wemlContentNormalizeV2 = __commonJS({
6569
6713
  null
6570
6714
  );
6571
6715
  }
6716
+ if (validateStructure) {
6717
+ for (const name of ["html", "head", "body"]) {
6718
+ if (rootTagCounts.get(name) === 0) fail("MISSING_ROOT_TAG", 0, name, null);
6719
+ }
6720
+ }
6572
6721
  return { text: textParts.join("") };
6573
6722
  }
6574
6723
  function findTagEnd(source, start) {
@@ -6597,6 +6746,42 @@ var require_wemlContentNormalizeV2 = __commonJS({
6597
6746
  function withoutWhiteSpace(text) {
6598
6747
  return Array.from(text, (character) => WHITE_SPACE.has(character.codePointAt(0)) ? "" : character).join("");
6599
6748
  }
6749
+ function isNormalizableWhitespace(character) {
6750
+ return character !== void 0 && WHITE_SPACE.has(character.codePointAt(0));
6751
+ }
6752
+ function collapseWhitespace(text) {
6753
+ const result = [];
6754
+ let inWhitespace = false;
6755
+ for (const character of text) {
6756
+ if (isNormalizableWhitespace(character)) {
6757
+ if (!inWhitespace) result.push(" ");
6758
+ inWhitespace = true;
6759
+ } else {
6760
+ result.push(character);
6761
+ inWhitespace = false;
6762
+ }
6763
+ }
6764
+ return result.join("");
6765
+ }
6766
+ function trimStartWhitespace(text) {
6767
+ return collapseWhitespace(text).replace(/^ +/, "");
6768
+ }
6769
+ function trimEndWhitespace(text) {
6770
+ return collapseWhitespace(text).replace(/ +$/, "");
6771
+ }
6772
+ function trimWhitespace(text) {
6773
+ return collapseWhitespace(text).replace(/^ +| +$/g, "");
6774
+ }
6775
+ function trimRawEndWhitespace(text) {
6776
+ const characters = Array.from(text);
6777
+ while (characters.length > 0 && isNormalizableWhitespace(characters.at(-1))) {
6778
+ characters.pop();
6779
+ }
6780
+ return characters.join("");
6781
+ }
6782
+ function isWhitespaceOnly(text) {
6783
+ return Array.from(text).every(isNormalizableWhitespace);
6784
+ }
6600
6785
  function sha256(text) {
6601
6786
  const crypto = __require("crypto");
6602
6787
  return crypto.createHash("sha256").update(text, "utf8").digest("hex");
@@ -6616,6 +6801,16 @@ var require_wemlContentNormalizeV2 = __commonJS({
6616
6801
  detail = `unexpected closing tag </${actualTag}>.`;
6617
6802
  } else if (code === "UNCLOSED_TAG") {
6618
6803
  detail = `tag <${expectedTag}> is not closed.`;
6804
+ } else if (code === "DUPLICATE_ROOT_TAG") {
6805
+ detail = `document contains more than one <${actualTag}> tag.`;
6806
+ } else if (code === "INVALID_ROOT_TAG_PARENT") {
6807
+ detail = expectedTag ? `tag <${actualTag}> must be a direct child of <${expectedTag}>.` : `root tag <${actualTag}> must not be nested.`;
6808
+ } else if (code === "BODY_BEFORE_HEAD") {
6809
+ detail = "tag <body> appears before <head>.";
6810
+ } else if (code === "HEAD_AFTER_BODY") {
6811
+ detail = "tag <head> appears after <body>.";
6812
+ } else if (code === "MISSING_ROOT_TAG") {
6813
+ detail = `required root tag <${expectedTag}> is missing.`;
6619
6814
  } else if (code === "UNTERMINATED_COMMENT") {
6620
6815
  detail = "comment is not terminated.";
6621
6816
  } else if (code === "UNTERMINATED_DECLARATION") {
@@ -8707,6 +8902,7 @@ function createScanner(input, initialOffset = 0, initialState = ScannerState.Wit
8707
8902
  }
8708
8903
  state = ScannerState.WithinTag;
8709
8904
  return internalScan();
8905
+ // no advance yet - jump to WithinTag
8710
8906
  case ScannerState.BeforeAttributeValue:
8711
8907
  if (stream.skipWhitespace()) {
8712
8908
  return finishToken(offset, TokenType.Whitespace);
@@ -8742,6 +8938,7 @@ function createScanner(input, initialOffset = 0, initialState = ScannerState.Wit
8742
8938
  state = ScannerState.WithinTag;
8743
8939
  hasSpaceAfterTag = false;
8744
8940
  return internalScan();
8941
+ // no advance yet - jump to WithinTag
8745
8942
  case ScannerState.WithinScriptContent:
8746
8943
  let sciptState = 1;
8747
8944
  while (!stream.eos()) {
@@ -8773,6 +8970,7 @@ function createScanner(input, initialOffset = 0, initialState = ScannerState.Wit
8773
8970
  return finishToken(offset, TokenType.Script);
8774
8971
  }
8775
8972
  return internalScan();
8973
+ // no advance yet - jump to content
8776
8974
  case ScannerState.WithinStyleContent:
8777
8975
  stream.advanceUntilRegExp(/<\/style/i);
8778
8976
  state = ScannerState.WithinContent;
@@ -11898,7 +12096,7 @@ var HTMLCompletion = class {
11898
12096
  let range;
11899
12097
  let addQuotes;
11900
12098
  let valuePrefix;
11901
- if (offset > valueStart && offset <= valueEnd && isQuote(text[valueStart])) {
12099
+ if (offset > valueStart && offset <= valueEnd && isQuote2(text[valueStart])) {
11902
12100
  const valueContentStart = valueStart + 1;
11903
12101
  let valueContentEnd = valueEnd;
11904
12102
  if (valueEnd > valueStart && text[valueEnd - 1] === text[valueStart]) {
@@ -12191,7 +12389,7 @@ var HTMLCompletion = class {
12191
12389
  return this.supportsMarkdown;
12192
12390
  }
12193
12391
  };
12194
- function isQuote(s) {
12392
+ function isQuote2(s) {
12195
12393
  return /^["']*$/.test(s);
12196
12394
  }
12197
12395
  function isWhiteSpace(s) {
@@ -12478,7 +12676,7 @@ var legacy_beautify_css;
12478
12676
  ,
12479
12677
  /* 2 */
12480
12678
  /***/
12481
- function(module) {
12679
+ (function(module) {
12482
12680
  function OutputLine(parent) {
12483
12681
  this.__parent = parent;
12484
12682
  this.__character_count = 0;
@@ -12795,13 +12993,13 @@ var legacy_beautify_css;
12795
12993
  }
12796
12994
  };
12797
12995
  module.exports.Output = Output;
12798
- },
12996
+ }),
12799
12997
  ,
12800
12998
  ,
12801
12999
  ,
12802
13000
  /* 6 */
12803
13001
  /***/
12804
- function(module) {
13002
+ (function(module) {
12805
13003
  function Options(options, merge_child_field) {
12806
13004
  this.raw_options = _mergeOpts(options, merge_child_field);
12807
13005
  this.disabled = this._get_boolean("disabled");
@@ -12921,11 +13119,11 @@ var legacy_beautify_css;
12921
13119
  module.exports.Options = Options;
12922
13120
  module.exports.normalizeOpts = _normalizeOpts;
12923
13121
  module.exports.mergeOpts = _mergeOpts;
12924
- },
13122
+ }),
12925
13123
  ,
12926
13124
  /* 8 */
12927
13125
  /***/
12928
- function(module) {
13126
+ (function(module) {
12929
13127
  var regexp_has_sticky = RegExp.prototype.hasOwnProperty("sticky");
12930
13128
  function InputScanner(input_string) {
12931
13129
  this.__input = input_string || "";
@@ -13054,14 +13252,14 @@ var legacy_beautify_css;
13054
13252
  return start >= testVal.length && this.__input.substring(start - testVal.length, start).toLowerCase() === testVal;
13055
13253
  };
13056
13254
  module.exports.InputScanner = InputScanner;
13057
- },
13255
+ }),
13058
13256
  ,
13059
13257
  ,
13060
13258
  ,
13061
13259
  ,
13062
13260
  /* 13 */
13063
13261
  /***/
13064
- function(module) {
13262
+ (function(module) {
13065
13263
  function Directives(start_block_pattern, end_block_pattern) {
13066
13264
  start_block_pattern = typeof start_block_pattern === "string" ? start_block_pattern : start_block_pattern.source;
13067
13265
  end_block_pattern = typeof end_block_pattern === "string" ? end_block_pattern : end_block_pattern.source;
@@ -13086,11 +13284,11 @@ var legacy_beautify_css;
13086
13284
  return input.readUntilAfter(this.__directives_end_ignore_pattern);
13087
13285
  };
13088
13286
  module.exports.Directives = Directives;
13089
- },
13287
+ }),
13090
13288
  ,
13091
13289
  /* 15 */
13092
13290
  /***/
13093
- function(module, __unused_webpack_exports, __webpack_require__2) {
13291
+ (function(module, __unused_webpack_exports, __webpack_require__2) {
13094
13292
  var Beautifier = __webpack_require__2(16).Beautifier, Options = __webpack_require__2(17).Options;
13095
13293
  function css_beautify2(source_text, options) {
13096
13294
  var beautifier = new Beautifier(source_text, options);
@@ -13100,10 +13298,10 @@ var legacy_beautify_css;
13100
13298
  module.exports.defaultOptions = function() {
13101
13299
  return new Options();
13102
13300
  };
13103
- },
13301
+ }),
13104
13302
  /* 16 */
13105
13303
  /***/
13106
- function(module, __unused_webpack_exports, __webpack_require__2) {
13304
+ (function(module, __unused_webpack_exports, __webpack_require__2) {
13107
13305
  var Options = __webpack_require__2(17).Options;
13108
13306
  var Output = __webpack_require__2(2).Output;
13109
13307
  var InputScanner = __webpack_require__2(8).InputScanner;
@@ -13504,10 +13702,10 @@ var legacy_beautify_css;
13504
13702
  return sweetCode;
13505
13703
  };
13506
13704
  module.exports.Beautifier = Beautifier;
13507
- },
13705
+ }),
13508
13706
  /* 17 */
13509
13707
  /***/
13510
- function(module, __unused_webpack_exports, __webpack_require__2) {
13708
+ (function(module, __unused_webpack_exports, __webpack_require__2) {
13511
13709
  var BaseOptions = __webpack_require__2(6).Options;
13512
13710
  function Options(options) {
13513
13711
  BaseOptions.call(this, options, "css");
@@ -13527,7 +13725,7 @@ var legacy_beautify_css;
13527
13725
  }
13528
13726
  Options.prototype = new BaseOptions();
13529
13727
  module.exports.Options = Options;
13530
- }
13728
+ })
13531
13729
  /******/
13532
13730
  ];
13533
13731
  var __webpack_module_cache__ = {};
@@ -13562,7 +13760,7 @@ var legacy_beautify_html;
13562
13760
  ,
13563
13761
  /* 2 */
13564
13762
  /***/
13565
- function(module) {
13763
+ (function(module) {
13566
13764
  function OutputLine(parent) {
13567
13765
  this.__parent = parent;
13568
13766
  this.__character_count = 0;
@@ -13879,10 +14077,10 @@ var legacy_beautify_html;
13879
14077
  }
13880
14078
  };
13881
14079
  module.exports.Output = Output;
13882
- },
14080
+ }),
13883
14081
  /* 3 */
13884
14082
  /***/
13885
- function(module) {
14083
+ (function(module) {
13886
14084
  function Token(type, text, newlines, whitespace_before) {
13887
14085
  this.type = type;
13888
14086
  this.text = text;
@@ -13897,12 +14095,12 @@ var legacy_beautify_html;
13897
14095
  this.directives = null;
13898
14096
  }
13899
14097
  module.exports.Token = Token;
13900
- },
14098
+ }),
13901
14099
  ,
13902
14100
  ,
13903
14101
  /* 6 */
13904
14102
  /***/
13905
- function(module) {
14103
+ (function(module) {
13906
14104
  function Options(options, merge_child_field) {
13907
14105
  this.raw_options = _mergeOpts(options, merge_child_field);
13908
14106
  this.disabled = this._get_boolean("disabled");
@@ -14022,11 +14220,11 @@ var legacy_beautify_html;
14022
14220
  module.exports.Options = Options;
14023
14221
  module.exports.normalizeOpts = _normalizeOpts;
14024
14222
  module.exports.mergeOpts = _mergeOpts;
14025
- },
14223
+ }),
14026
14224
  ,
14027
14225
  /* 8 */
14028
14226
  /***/
14029
- function(module) {
14227
+ (function(module) {
14030
14228
  var regexp_has_sticky = RegExp.prototype.hasOwnProperty("sticky");
14031
14229
  function InputScanner(input_string) {
14032
14230
  this.__input = input_string || "";
@@ -14155,10 +14353,10 @@ var legacy_beautify_html;
14155
14353
  return start >= testVal.length && this.__input.substring(start - testVal.length, start).toLowerCase() === testVal;
14156
14354
  };
14157
14355
  module.exports.InputScanner = InputScanner;
14158
- },
14356
+ }),
14159
14357
  /* 9 */
14160
14358
  /***/
14161
- function(module, __unused_webpack_exports, __webpack_require__2) {
14359
+ (function(module, __unused_webpack_exports, __webpack_require__2) {
14162
14360
  var InputScanner = __webpack_require__2(8).InputScanner;
14163
14361
  var Token = __webpack_require__2(3).Token;
14164
14362
  var TokenStream = __webpack_require__2(10).TokenStream;
@@ -14248,10 +14446,10 @@ var legacy_beautify_html;
14248
14446
  };
14249
14447
  module.exports.Tokenizer = Tokenizer;
14250
14448
  module.exports.TOKEN = TOKEN;
14251
- },
14449
+ }),
14252
14450
  /* 10 */
14253
14451
  /***/
14254
- function(module) {
14452
+ (function(module) {
14255
14453
  function TokenStream(parent_token) {
14256
14454
  this.__tokens = [];
14257
14455
  this.__tokens_length = this.__tokens.length;
@@ -14292,10 +14490,10 @@ var legacy_beautify_html;
14292
14490
  this.__tokens_length += 1;
14293
14491
  };
14294
14492
  module.exports.TokenStream = TokenStream;
14295
- },
14493
+ }),
14296
14494
  /* 11 */
14297
14495
  /***/
14298
- function(module, __unused_webpack_exports, __webpack_require__2) {
14496
+ (function(module, __unused_webpack_exports, __webpack_require__2) {
14299
14497
  var Pattern = __webpack_require__2(12).Pattern;
14300
14498
  function WhitespacePattern(input_scanner, parent) {
14301
14499
  Pattern.call(this, input_scanner, parent);
@@ -14359,10 +14557,10 @@ var legacy_beautify_html;
14359
14557
  return result;
14360
14558
  };
14361
14559
  module.exports.WhitespacePattern = WhitespacePattern;
14362
- },
14560
+ }),
14363
14561
  /* 12 */
14364
14562
  /***/
14365
- function(module) {
14563
+ (function(module) {
14366
14564
  function Pattern(input_scanner, parent) {
14367
14565
  this._input = input_scanner;
14368
14566
  this._starting_pattern = null;
@@ -14418,10 +14616,10 @@ var legacy_beautify_html;
14418
14616
  Pattern.prototype._update = function() {
14419
14617
  };
14420
14618
  module.exports.Pattern = Pattern;
14421
- },
14619
+ }),
14422
14620
  /* 13 */
14423
14621
  /***/
14424
- function(module) {
14622
+ (function(module) {
14425
14623
  function Directives(start_block_pattern, end_block_pattern) {
14426
14624
  start_block_pattern = typeof start_block_pattern === "string" ? start_block_pattern : start_block_pattern.source;
14427
14625
  end_block_pattern = typeof end_block_pattern === "string" ? end_block_pattern : end_block_pattern.source;
@@ -14446,10 +14644,10 @@ var legacy_beautify_html;
14446
14644
  return input.readUntilAfter(this.__directives_end_ignore_pattern);
14447
14645
  };
14448
14646
  module.exports.Directives = Directives;
14449
- },
14647
+ }),
14450
14648
  /* 14 */
14451
14649
  /***/
14452
- function(module, __unused_webpack_exports, __webpack_require__2) {
14650
+ (function(module, __unused_webpack_exports, __webpack_require__2) {
14453
14651
  var Pattern = __webpack_require__2(12).Pattern;
14454
14652
  var template_names = {
14455
14653
  django: false,
@@ -14598,13 +14796,13 @@ var legacy_beautify_html;
14598
14796
  return resulting_string;
14599
14797
  };
14600
14798
  module.exports.TemplatablePattern = TemplatablePattern;
14601
- },
14799
+ }),
14602
14800
  ,
14603
14801
  ,
14604
14802
  ,
14605
14803
  /* 18 */
14606
14804
  /***/
14607
- function(module, __unused_webpack_exports, __webpack_require__2) {
14805
+ (function(module, __unused_webpack_exports, __webpack_require__2) {
14608
14806
  var Beautifier = __webpack_require__2(19).Beautifier, Options = __webpack_require__2(20).Options;
14609
14807
  function style_html(html_source, options, js_beautify2, css_beautify2) {
14610
14808
  var beautifier = new Beautifier(html_source, options, js_beautify2, css_beautify2);
@@ -14614,10 +14812,10 @@ var legacy_beautify_html;
14614
14812
  module.exports.defaultOptions = function() {
14615
14813
  return new Options();
14616
14814
  };
14617
- },
14815
+ }),
14618
14816
  /* 19 */
14619
14817
  /***/
14620
- function(module, __unused_webpack_exports, __webpack_require__2) {
14818
+ (function(module, __unused_webpack_exports, __webpack_require__2) {
14621
14819
  var Options = __webpack_require__2(20).Options;
14622
14820
  var Output = __webpack_require__2(2).Output;
14623
14821
  var Tokenizer = __webpack_require__2(21).Tokenizer;
@@ -15249,10 +15447,10 @@ var legacy_beautify_html;
15249
15447
  return result;
15250
15448
  };
15251
15449
  module.exports.Beautifier = Beautifier;
15252
- },
15450
+ }),
15253
15451
  /* 20 */
15254
15452
  /***/
15255
- function(module, __unused_webpack_exports, __webpack_require__2) {
15453
+ (function(module, __unused_webpack_exports, __webpack_require__2) {
15256
15454
  var BaseOptions = __webpack_require__2(6).Options;
15257
15455
  function Options(options) {
15258
15456
  BaseOptions.call(this, options, "html");
@@ -15372,10 +15570,10 @@ var legacy_beautify_html;
15372
15570
  }
15373
15571
  Options.prototype = new BaseOptions();
15374
15572
  module.exports.Options = Options;
15375
- },
15573
+ }),
15376
15574
  /* 21 */
15377
15575
  /***/
15378
- function(module, __unused_webpack_exports, __webpack_require__2) {
15576
+ (function(module, __unused_webpack_exports, __webpack_require__2) {
15379
15577
  var BaseTokenizer = __webpack_require__2(9).Tokenizer;
15380
15578
  var BASETOKEN = __webpack_require__2(9).TOKEN;
15381
15579
  var Directives = __webpack_require__2(13).Directives;
@@ -15664,7 +15862,7 @@ var legacy_beautify_html;
15664
15862
  };
15665
15863
  module.exports.Tokenizer = Tokenizer;
15666
15864
  module.exports.TOKEN = TOKEN;
15667
- }
15865
+ })
15668
15866
  /******/
15669
15867
  ];
15670
15868
  var __webpack_module_cache__ = {};
@@ -15701,7 +15899,7 @@ function format2(document2, range, options) {
15701
15899
  if (range) {
15702
15900
  let startOffset = document2.offsetAt(range.start);
15703
15901
  let extendedStart = startOffset;
15704
- while (extendedStart > 0 && isWhitespace(value, extendedStart - 1)) {
15902
+ while (extendedStart > 0 && isWhitespace2(value, extendedStart - 1)) {
15705
15903
  extendedStart--;
15706
15904
  }
15707
15905
  if (extendedStart === 0 || isEOL2(value, extendedStart - 1)) {
@@ -15713,7 +15911,7 @@ function format2(document2, range, options) {
15713
15911
  }
15714
15912
  let endOffset = document2.offsetAt(range.end);
15715
15913
  let extendedEnd = endOffset;
15716
- while (extendedEnd < value.length && isWhitespace(value, extendedEnd)) {
15914
+ while (extendedEnd < value.length && isWhitespace2(value, extendedEnd)) {
15717
15915
  extendedEnd++;
15718
15916
  }
15719
15917
  if (extendedEnd === value.length || isEOL2(value, extendedEnd)) {
@@ -15822,7 +16020,7 @@ function computeIndentLevel(content, offset, options) {
15822
16020
  function isEOL2(text, offset) {
15823
16021
  return "\r\n".indexOf(text.charAt(offset)) !== -1;
15824
16022
  }
15825
- function isWhitespace(text, offset) {
16023
+ function isWhitespace2(text, offset) {
15826
16024
  return " ".indexOf(text.charAt(offset)) !== -1;
15827
16025
  }
15828
16026
 
@@ -15951,10 +16149,10 @@ var LIB;
15951
16149
  return -1 === r3 || -1 === i2 || 0 === s2 || 1 === s2 && r3 === i2 - 1 && r3 === n3 + 1 ? "" : t4.slice(r3, i2);
15952
16150
  }, format: function(t4) {
15953
16151
  if (null === t4 || "object" != typeof t4) throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof t4);
15954
- return function(t5, e3) {
16152
+ return (function(t5, e3) {
15955
16153
  var r3 = e3.dir || e3.root, n3 = e3.base || (e3.name || "") + (e3.ext || "");
15956
16154
  return r3 ? r3 === e3.root ? r3 + n3 : r3 + "/" + n3 : n3;
15957
- }(0, t4);
16155
+ })(0, t4);
15958
16156
  }, parse: function(t4) {
15959
16157
  e2(t4);
15960
16158
  var r3 = { root: "", dir: "", base: "", ext: "", name: "" };
@@ -16000,18 +16198,15 @@ var LIB;
16000
16198
  }
16001
16199
  const c = "", f = "/", u = /^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;
16002
16200
  class l {
16003
- static isUri(t3) {
16004
- return t3 instanceof l || !!t3 && "string" == typeof t3.authority && "string" == typeof t3.fragment && "string" == typeof t3.path && "string" == typeof t3.query && "string" == typeof t3.scheme && "string" == typeof t3.fsPath && "function" == typeof t3.with && "function" == typeof t3.toString;
16005
- }
16006
- scheme;
16007
- authority;
16008
- path;
16009
- query;
16010
- fragment;
16011
16201
  constructor(t3, e2, r2, n2, i2, o2 = false) {
16012
- "object" == typeof t3 ? (this.scheme = t3.scheme || c, this.authority = t3.authority || c, this.path = t3.path || c, this.query = t3.query || c, this.fragment = t3.fragment || c) : (this.scheme = /* @__PURE__ */ function(t4, e3) {
16202
+ __publicField(this, "scheme");
16203
+ __publicField(this, "authority");
16204
+ __publicField(this, "path");
16205
+ __publicField(this, "query");
16206
+ __publicField(this, "fragment");
16207
+ "object" == typeof t3 ? (this.scheme = t3.scheme || c, this.authority = t3.authority || c, this.path = t3.path || c, this.query = t3.query || c, this.fragment = t3.fragment || c) : (this.scheme = /* @__PURE__ */ (function(t4, e3) {
16013
16208
  return t4 || e3 ? t4 : "file";
16014
- }(t3, o2), this.authority = e2 || c, this.path = function(t4, e3) {
16209
+ })(t3, o2), this.authority = e2 || c, this.path = (function(t4, e3) {
16015
16210
  switch (t4) {
16016
16211
  case "https":
16017
16212
  case "http":
@@ -16019,7 +16214,10 @@ var LIB;
16019
16214
  e3 ? e3[0] !== f && (e3 = f + e3) : e3 = f;
16020
16215
  }
16021
16216
  return e3;
16022
- }(this.scheme, r2 || c), this.query = n2 || c, this.fragment = i2 || c, a(this, o2));
16217
+ })(this.scheme, r2 || c), this.query = n2 || c, this.fragment = i2 || c, a(this, o2));
16218
+ }
16219
+ static isUri(t3) {
16220
+ return t3 instanceof l || !!t3 && "string" == typeof t3.authority && "string" == typeof t3.fragment && "string" == typeof t3.path && "string" == typeof t3.query && "string" == typeof t3.scheme && "string" == typeof t3.fsPath && "function" == typeof t3.with && "function" == typeof t3.toString;
16023
16221
  }
16024
16222
  get fsPath() {
16025
16223
  return v(this, false);
@@ -16064,8 +16262,11 @@ var LIB;
16064
16262
  }
16065
16263
  const g = i ? 1 : void 0;
16066
16264
  class d extends l {
16067
- _formatted = null;
16068
- _fsPath = null;
16265
+ constructor() {
16266
+ super(...arguments);
16267
+ __publicField(this, "_formatted", null);
16268
+ __publicField(this, "_fsPath", null);
16269
+ }
16069
16270
  get fsPath() {
16070
16271
  return this._fsPath || (this._fsPath = v(this, false)), this._fsPath;
16071
16272
  }
@@ -16135,12 +16336,12 @@ var LIB;
16135
16336
  }
16136
16337
  const A = /(%[0-9A-Za-z][0-9A-Za-z])+/g;
16137
16338
  function w(t3) {
16138
- return t3.match(A) ? t3.replace(A, (t4) => C(t4)) : t3;
16339
+ return t3.match(A) ? t3.replace(A, ((t4) => C(t4))) : t3;
16139
16340
  }
16140
16341
  var x = r(975);
16141
16342
  const P = x.posix || x, _ = "/";
16142
16343
  var I;
16143
- !function(t3) {
16344
+ !(function(t3) {
16144
16345
  t3.joinPath = function(t4, ...e2) {
16145
16346
  return t4.with({ path: P.join(t4.path, ...e2) });
16146
16347
  }, t3.resolvePath = function(t4, ...e2) {
@@ -16157,7 +16358,7 @@ var LIB;
16157
16358
  }, t3.extname = function(t4) {
16158
16359
  return P.extname(t4.path);
16159
16360
  };
16160
- }(I || (I = {})), LIB = n;
16361
+ })(I || (I = {})), LIB = n;
16161
16362
  })();
16162
16363
  var { URI: URI2, Utils } = LIB;
16163
16364
 
@@ -16590,6 +16791,7 @@ var HTMLFolding = class {
16590
16791
  if (!this.dataManager.isVoidElement(lastTagName, voidElements)) {
16591
16792
  break;
16592
16793
  }
16794
+ // fallthrough
16593
16795
  case TokenType.EndTagClose:
16594
16796
  case TokenType.StartTagSelfClose: {
16595
16797
  let i = stack.length - 1;
@@ -29260,6 +29462,13 @@ var TAGS = {
29260
29462
  "default": "paragraph",
29261
29463
  "description": "Type of the paragraph. See corresponding page for values",
29262
29464
  "enumRef": "paragraph-type"
29465
+ },
29466
+ {
29467
+ "name": "align",
29468
+ "required": false,
29469
+ "default": "`left` for LTR, `right` for RTL",
29470
+ "description": "Horizontal alignment. See corresponding page for allowed values",
29471
+ "enumRef": "horizontal-alignment"
29263
29472
  }
29264
29473
  ],
29265
29474
  "notes": "",
@@ -29272,6 +29481,24 @@ var TAGS = {
29272
29481
  "notes": "Current line is broken and the next line is started. Next line has the same alignment\nas the current line, and the same indentation level as any line other than the first.",
29273
29482
  "source": "inlines/br.md"
29274
29483
  },
29484
+ "w-color": {
29485
+ "tag": "w-color",
29486
+ "description": "Represents an inline span with a foreground color, a background color, or both.",
29487
+ "attributes": [
29488
+ {
29489
+ "name": "background",
29490
+ "required": false,
29491
+ "description": "Background color. See Colors."
29492
+ },
29493
+ {
29494
+ "name": "foreground",
29495
+ "required": false,
29496
+ "description": "Foreground color. See Colors."
29497
+ }
29498
+ ],
29499
+ "notes": "Any inline elements.",
29500
+ "source": "inlines/w-color.md"
29501
+ },
29275
29502
  "w-entity": {
29276
29503
  "tag": "w-entity",
29277
29504
  "description": "An entity is a reference to a person, place, or thing. Entities are used to",
@@ -29404,6 +29631,16 @@ var TAGS = {
29404
29631
  "name": "override-chapter-number",
29405
29632
  "required": false,
29406
29633
  "description": "Chapter number for manual set"
29634
+ },
29635
+ {
29636
+ "name": "background",
29637
+ "required": false,
29638
+ "description": "Background color. See Colors"
29639
+ },
29640
+ {
29641
+ "name": "foreground",
29642
+ "required": false,
29643
+ "description": "Foreground color. See Colors"
29407
29644
  }
29408
29645
  ],
29409
29646
  "notes": "Must contain a single text block element.",
@@ -29434,6 +29671,16 @@ var TAGS = {
29434
29671
  "required": false,
29435
29672
  "description": "Horizontal alignment. See corresponding page for allowed values. Defaults to `left` for left-to-right languages and `right` to right-to-left",
29436
29673
  "enumRef": "horizontal-alignment"
29674
+ },
29675
+ {
29676
+ "name": "background",
29677
+ "required": false,
29678
+ "description": "Background color. See Colors"
29679
+ },
29680
+ {
29681
+ "name": "foreground",
29682
+ "required": false,
29683
+ "description": "Foreground color. See Colors"
29437
29684
  }
29438
29685
  ],
29439
29686
  "notes": "Must contain a single block element.",
@@ -29790,8 +30037,12 @@ var META_FIELDS = [
29790
30037
  "description": "Publication description."
29791
30038
  },
29792
30039
  {
29793
- "name": "parent_id",
29794
- "description": "Parent publication version GUID."
30040
+ "name": "purchase-link",
30041
+ "description": "Purchase link."
30042
+ },
30043
+ {
30044
+ "name": "version-id",
30045
+ "description": "Publication version GUID."
29795
30046
  }
29796
30047
  ];
29797
30048
 
@@ -30048,7 +30299,7 @@ Unicode: \`U+${resolved.codePoint.toString(16).toUpperCase().padStart(4, "0")}\`
30048
30299
  // src/schema/structureRules.ts
30049
30300
  var CONTAINER_TAGS = ["w-para", "w-heading", "w-para-group", "w-toc"];
30050
30301
  var BLOCK_TAGS = ["w-text-block", "figure", "w-list", "table", "hr"];
30051
- var INLINE_TAGS = ["a", "br", "w-entity", "w-format", "w-lang", "w-non-egw", "w-note", "w-page", "w-sent"];
30302
+ var INLINE_TAGS = ["a", "br", "w-color", "w-entity", "w-format", "w-lang", "w-non-egw", "w-note", "w-page", "w-sent"];
30052
30303
  var STRUCTURE_RULES = {
30053
30304
  html: {
30054
30305
  children: [
@@ -30195,6 +30446,13 @@ var STRUCTURE_RULES = {
30195
30446
  allowText: true,
30196
30447
  description: "With href: a link that may contain inline content. With id: a named anchor that must be empty. Exactly one of href/id is required, not both."
30197
30448
  },
30449
+ "w-color": {
30450
+ children: [
30451
+ { tags: [...INLINE_TAGS], min: 0, max: null, description: "inline elements" }
30452
+ ],
30453
+ allowText: true,
30454
+ description: "May contain inline elements and text; requires a foreground or background color."
30455
+ },
30198
30456
  "w-entity": {
30199
30457
  children: [
30200
30458
  { tags: [...INLINE_TAGS], min: 0, max: null, description: "inline elements" }
@@ -30268,11 +30526,18 @@ var STRUCTURE_RULES = {
30268
30526
  }
30269
30527
  };
30270
30528
  var ARABIC_OR_ROMAN = /^(?:\d+|[ivxlcdm]+)$/i;
30529
+ var COLOR_VALUE = /^#(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i;
30271
30530
  var ATTRIBUTE_CONSTRAINTS = [
30272
30531
  { tag: "w-heading", attribute: "level", kind: "integer-range", min: 1, max: 6, message: "`level` must be an integer between 1 and 6." },
30273
30532
  { tag: "w-heading", attribute: "override-chapter-number", kind: "integer-min", min: 0, message: "`override-chapter-number` must be a non-negative integer." },
30533
+ { tag: "w-heading", attribute: "background", kind: "pattern", pattern: COLOR_VALUE, allowEmpty: false, message: "`background` must be a color in #RGB, #RGBA, #RRGGBB or #RRGGBBAA format." },
30534
+ { tag: "w-heading", attribute: "foreground", kind: "pattern", pattern: COLOR_VALUE, allowEmpty: false, message: "`foreground` must be a color in #RGB, #RGBA, #RRGGBB or #RRGGBBAA format." },
30274
30535
  { tag: "w-page", attribute: "number", kind: "pattern", pattern: ARABIC_OR_ROMAN, message: "`number` must be an arabic or roman number." },
30275
30536
  { tag: "w-para", attribute: "indent", kind: "integer-min", min: -4, message: "`indent` must be an integer >= -4." },
30537
+ { tag: "w-para", attribute: "background", kind: "pattern", pattern: COLOR_VALUE, allowEmpty: false, message: "`background` must be a color in #RGB, #RGBA, #RRGGBB or #RRGGBBAA format." },
30538
+ { tag: "w-para", attribute: "foreground", kind: "pattern", pattern: COLOR_VALUE, allowEmpty: false, message: "`foreground` must be a color in #RGB, #RGBA, #RRGGBB or #RRGGBBAA format." },
30539
+ { tag: "w-color", attribute: "background", kind: "pattern", pattern: COLOR_VALUE, allowEmpty: false, message: "`background` must be a color in #RGB, #RGBA, #RRGGBB or #RRGGBBAA format." },
30540
+ { tag: "w-color", attribute: "foreground", kind: "pattern", pattern: COLOR_VALUE, allowEmpty: false, message: "`foreground` must be a color in #RGB, #RGBA, #RRGGBB or #RRGGBBAA format." },
30276
30541
  { tag: "w-note-para", attribute: "indent", kind: "integer-min", min: 0, message: "`indent` must be an integer >= 0." },
30277
30542
  { tag: "td", attribute: "indent", kind: "integer-min", min: -4, message: "`indent` must be an integer >= -4." },
30278
30543
  { tag: "th", attribute: "indent", kind: "integer-min", min: -4, message: "`indent` must be an integer >= -4." },
@@ -30413,6 +30678,9 @@ function indent(text) {
30413
30678
  function buildElement(tag, counter, depth) {
30414
30679
  const schema = TAGS[tag];
30415
30680
  let attrs = "";
30681
+ if (tag === "w-color") {
30682
+ attrs = ` foreground="${placeholder(counter)}"`;
30683
+ }
30416
30684
  for (const attr of schema?.attributes ?? []) {
30417
30685
  if (attr.required) {
30418
30686
  attrs += ` ${attr.name}="${placeholder(counter)}"`;
@@ -30448,6 +30716,9 @@ function buildElementSnippet(tag) {
30448
30716
  function buildOpeningTag(tag) {
30449
30717
  const counter = { n: 1 };
30450
30718
  let attrs = "";
30719
+ if (tag === "w-color") {
30720
+ attrs = ` foreground="${placeholder(counter)}"`;
30721
+ }
30451
30722
  for (const attr of TAGS[tag]?.attributes ?? []) {
30452
30723
  if (attr.required) {
30453
30724
  attrs += ` ${attr.name}="${placeholder(counter)}"`;
@@ -30651,6 +30922,7 @@ function dedupe(items) {
30651
30922
  function hasValueSuggestions(tag, attribute, enumRef) {
30652
30923
  if (enumRef && ENUMS[enumRef]) return true;
30653
30924
  if (tag === "w-heading" && attribute === "level") return true;
30925
+ if (tag === "meta" && attribute === "name") return true;
30654
30926
  if (tag === "meta" && attribute === "content") return true;
30655
30927
  if (tag === "a" && attribute === "href") return true;
30656
30928
  return false;
@@ -30820,6 +31092,18 @@ var WemlCompletionProvider = class {
30820
31092
  });
30821
31093
  }
30822
31094
  }
31095
+ if (ctx.tag === "meta" && ctx.attribute === "name") {
31096
+ for (const field of META_FIELDS) {
31097
+ items.push({
31098
+ label: field.name,
31099
+ kind: this.m.languages.CompletionItemKind.Property,
31100
+ detail: "WEML metadata field",
31101
+ documentation: metaFieldMarkdown(field.name),
31102
+ insertText: wrap(field.name),
31103
+ range
31104
+ });
31105
+ }
31106
+ }
30823
31107
  if (ctx.tag === "meta" && ctx.attribute === "content" && stripQuotes2(node.attributes?.["name"]) === "type") {
30824
31108
  const codeEnum = ENUMS["publication-type"];
30825
31109
  if (codeEnum) {
@@ -30977,6 +31261,9 @@ function validateWemlModel(m, model) {
30977
31261
  push(href.valueRange, `Unrecognized href format "${href.value}". Expected formats like: ${types}.`, "warning");
30978
31262
  }
30979
31263
  }
31264
+ if (tag === "w-color" && !attrs.has("background") && !attrs.has("foreground")) {
31265
+ push(tagRange, '<w-color> must have either "background" or "foreground".', "error");
31266
+ }
30980
31267
  if (tag === "div") {
30981
31268
  const id = stripQuotes2(node.attributes?.["id"]);
30982
31269
  const range = attrs.get("id")?.valueRange ?? tagRange;
@@ -30990,7 +31277,8 @@ function validateWemlModel(m, model) {
30990
31277
  function validateConstraint(constraint, info) {
30991
31278
  if (info.value === void 0 || !info.valueRange) return;
30992
31279
  if (constraint.kind === "pattern") {
30993
- if (info.value !== "" && constraint.pattern && !constraint.pattern.test(info.value)) {
31280
+ const emptyIsInvalid = constraint.allowEmpty === false && info.value === "";
31281
+ if (emptyIsInvalid || info.value !== "" && constraint.pattern && !constraint.pattern.test(info.value)) {
30994
31282
  push(info.valueRange, constraint.message, "error");
30995
31283
  }
30996
31284
  return;
@@ -31369,7 +31657,7 @@ function escapeSnippet(text) {
31369
31657
  return text.replace(/\\/g, "\\\\").replace(/\$/g, "\\$").replace(/}/g, "\\}");
31370
31658
  }
31371
31659
  function buildWrapSnippet(tag, type, selection) {
31372
- const attrs = type ? ` type="${type}"` : tag === "a" ? ' href="$1"' : (TAGS[tag]?.attributes ?? []).filter((a) => a.required).map((a) => ` ${a.name}="$1"`).join("");
31660
+ const attrs = type ? ` type="${type}"` : tag === "a" ? ' href="$1"' : tag === "w-color" ? ' foreground="$1"' : (TAGS[tag]?.attributes ?? []).filter((a) => a.required).map((a) => ` ${a.name}="$1"`).join("");
31373
31661
  const inner = selection.length > 0 ? escapeSnippet(selection) : attrs.includes("$1") ? "$2" : "$1";
31374
31662
  return `<${tag}${attrs}>${inner}</${tag}>`;
31375
31663
  }
@@ -31522,7 +31810,7 @@ var WRAP_OPTIONS = [
31522
31810
  tag: "w-format",
31523
31811
  type: v.value
31524
31812
  })),
31525
- ...["w-lang", "w-non-egw", "w-entity", "a"].map((t2) => ({ value: t2, label: t2, tag: t2 }))
31813
+ ...["w-color", "w-lang", "w-non-egw", "w-entity", "a"].map((t2) => ({ value: t2, label: t2, tag: t2 }))
31526
31814
  ];
31527
31815
  var SNIPPET_BUTTONS = [
31528
31816
  { label: "w-para", id: "w-para" },
@@ -31745,4 +32033,4 @@ export {
31745
32033
  he/he.js:
31746
32034
  (*! https://mths.be/he v1.2.0 by @mathias | MIT license *)
31747
32035
  */
31748
- //# sourceMappingURL=weml-monaco.esm.js.map
32036
+ //# sourceMappingURL=index.mjs.map