prettier 4.0.0-alpha.11 → 4.0.0-alpha.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/doc.js CHANGED
@@ -47,22 +47,93 @@
47
47
  utils: () => utils
48
48
  });
49
49
 
50
- // src/document/constants.js
51
- var DOC_TYPE_STRING = "string";
52
- var DOC_TYPE_ARRAY = "array";
53
- var DOC_TYPE_CURSOR = "cursor";
54
- var DOC_TYPE_INDENT = "indent";
55
- var DOC_TYPE_ALIGN = "align";
56
- var DOC_TYPE_TRIM = "trim";
57
- var DOC_TYPE_GROUP = "group";
58
- var DOC_TYPE_FILL = "fill";
59
- var DOC_TYPE_IF_BREAK = "if-break";
60
- var DOC_TYPE_INDENT_IF_BREAK = "indent-if-break";
61
- var DOC_TYPE_LINE_SUFFIX = "line-suffix";
62
- var DOC_TYPE_LINE_SUFFIX_BOUNDARY = "line-suffix-boundary";
63
- var DOC_TYPE_LINE = "line";
64
- var DOC_TYPE_LABEL = "label";
65
- var DOC_TYPE_BREAK_PARENT = "break-parent";
50
+ // scripts/build/shims/shared.js
51
+ var OPTIONAL_OBJECT = 1;
52
+ var createMethodShim = (methodName, getImplementation) => (flags, object, ...arguments_) => {
53
+ if (flags | OPTIONAL_OBJECT && (object === void 0 || object === null)) {
54
+ return;
55
+ }
56
+ const implementation = getImplementation.call(object) ?? object[methodName];
57
+ return implementation.apply(object, arguments_);
58
+ };
59
+
60
+ // scripts/build/shims/method-at.js
61
+ function stringOrArrayAt(index) {
62
+ return this[index < 0 ? this.length + index : index];
63
+ }
64
+ var at = createMethodShim("at", function() {
65
+ if (Array.isArray(this) || typeof this === "string") {
66
+ return stringOrArrayAt;
67
+ }
68
+ });
69
+ var method_at_default = at;
70
+
71
+ // src/utils/noop.js
72
+ var noop = () => {
73
+ };
74
+ var noop_default = noop;
75
+
76
+ // src/document/builders/types.js
77
+ var DOC_TYPE_STRING = (
78
+ /** @type {const} */
79
+ "string"
80
+ );
81
+ var DOC_TYPE_ARRAY = (
82
+ /** @type {const} */
83
+ "array"
84
+ );
85
+ var DOC_TYPE_CURSOR = (
86
+ /** @type {const} */
87
+ "cursor"
88
+ );
89
+ var DOC_TYPE_INDENT = (
90
+ /** @type {const} */
91
+ "indent"
92
+ );
93
+ var DOC_TYPE_ALIGN = (
94
+ /** @type {const} */
95
+ "align"
96
+ );
97
+ var DOC_TYPE_TRIM = (
98
+ /** @type {const} */
99
+ "trim"
100
+ );
101
+ var DOC_TYPE_GROUP = (
102
+ /** @type {const} */
103
+ "group"
104
+ );
105
+ var DOC_TYPE_FILL = (
106
+ /** @type {const} */
107
+ "fill"
108
+ );
109
+ var DOC_TYPE_IF_BREAK = (
110
+ /** @type {const} */
111
+ "if-break"
112
+ );
113
+ var DOC_TYPE_INDENT_IF_BREAK = (
114
+ /** @type {const} */
115
+ "indent-if-break"
116
+ );
117
+ var DOC_TYPE_LINE_SUFFIX = (
118
+ /** @type {const} */
119
+ "line-suffix"
120
+ );
121
+ var DOC_TYPE_LINE_SUFFIX_BOUNDARY = (
122
+ /** @type {const} */
123
+ "line-suffix-boundary"
124
+ );
125
+ var DOC_TYPE_LINE = (
126
+ /** @type {const} */
127
+ "line"
128
+ );
129
+ var DOC_TYPE_LABEL = (
130
+ /** @type {const} */
131
+ "label"
132
+ );
133
+ var DOC_TYPE_BREAK_PARENT = (
134
+ /** @type {const} */
135
+ "break-parent"
136
+ );
66
137
  var VALID_OBJECT_DOC_TYPES = /* @__PURE__ */ new Set([
67
138
  DOC_TYPE_CURSOR,
68
139
  DOC_TYPE_INDENT,
@@ -79,19 +150,16 @@
79
150
  DOC_TYPE_BREAK_PARENT
80
151
  ]);
81
152
 
82
- // scripts/build/shims/at.js
83
- var at = (isOptionalObject, object, index) => {
84
- if (isOptionalObject && (object === void 0 || object === null)) {
85
- return;
153
+ // node_modules/trim-newlines/index.js
154
+ function trimNewlinesEnd(string) {
155
+ let end = string.length;
156
+ while (end > 0 && (string[end - 1] === "\r" || string[end - 1] === "\n")) {
157
+ end--;
86
158
  }
87
- if (Array.isArray(object) || typeof object === "string") {
88
- return object[index < 0 ? object.length + index : index];
89
- }
90
- return object.at(index);
91
- };
92
- var at_default = at;
159
+ return end < string.length ? string.slice(0, end) : string;
160
+ }
93
161
 
94
- // src/document/utils/get-doc-type.js
162
+ // src/document/utilities/get-doc-type.js
95
163
  function getDocType(doc) {
96
164
  if (typeof doc === "string") {
97
165
  return DOC_TYPE_STRING;
@@ -109,7 +177,7 @@
109
177
  }
110
178
  var get_doc_type_default = getDocType;
111
179
 
112
- // src/document/invalid-doc-error.js
180
+ // src/document/utilities/invalid-doc-error.js
113
181
  var disjunctionListFormat = (list) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(list);
114
182
  function getDocErrorMessage(doc) {
115
183
  const type = doc === null ? "null" : typeof doc;
@@ -139,7 +207,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
139
207
  };
140
208
  var invalid_doc_error_default = InvalidDocError;
141
209
 
142
- // src/document/utils/traverse-doc.js
210
+ // src/document/utilities/traverse-doc.js
143
211
  var traverseDocOnExitStackMarker = {};
144
212
  function traverseDoc(doc, onEnter, onExit, shouldTraverseConditionalGroups) {
145
213
  const docsStack = [doc];
@@ -156,7 +224,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
156
224
  if (!docType) {
157
225
  throw new invalid_doc_error_default(doc2);
158
226
  }
159
- if ((onEnter == null ? void 0 : onEnter(doc2)) === false) {
227
+ if (onEnter?.(doc2) === false) {
160
228
  continue;
161
229
  }
162
230
  switch (docType) {
@@ -201,7 +269,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
201
269
  }
202
270
  var traverse_doc_default = traverseDoc;
203
271
 
204
- // src/document/utils.js
272
+ // src/document/utilities/index.js
205
273
  function mapDoc(doc, cb) {
206
274
  if (typeof doc === "string") {
207
275
  return cb(doc);
@@ -221,7 +289,10 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
221
289
  case DOC_TYPE_ARRAY:
222
290
  return cb(doc2.map(rec));
223
291
  case DOC_TYPE_FILL:
224
- return cb({ ...doc2, parts: doc2.parts.map(rec) });
292
+ return cb({
293
+ ...doc2,
294
+ parts: doc2.parts.map(rec)
295
+ });
225
296
  case DOC_TYPE_IF_BREAK:
226
297
  return cb({
227
298
  ...doc2,
@@ -229,21 +300,31 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
229
300
  flatContents: rec(doc2.flatContents)
230
301
  });
231
302
  case DOC_TYPE_GROUP: {
232
- let { expandedStates, contents } = doc2;
303
+ let {
304
+ expandedStates,
305
+ contents
306
+ } = doc2;
233
307
  if (expandedStates) {
234
308
  expandedStates = expandedStates.map(rec);
235
309
  contents = expandedStates[0];
236
310
  } else {
237
311
  contents = rec(contents);
238
312
  }
239
- return cb({ ...doc2, contents, expandedStates });
313
+ return cb({
314
+ ...doc2,
315
+ contents,
316
+ expandedStates
317
+ });
240
318
  }
241
319
  case DOC_TYPE_ALIGN:
242
320
  case DOC_TYPE_INDENT:
243
321
  case DOC_TYPE_INDENT_IF_BREAK:
244
322
  case DOC_TYPE_LABEL:
245
323
  case DOC_TYPE_LINE_SUFFIX:
246
- return cb({ ...doc2, contents: rec(doc2.contents) });
324
+ return cb({
325
+ ...doc2,
326
+ contents: rec(doc2.contents)
327
+ });
247
328
  case DOC_TYPE_STRING:
248
329
  case DOC_TYPE_CURSOR:
249
330
  case DOC_TYPE_TRIM:
@@ -288,9 +369,9 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
288
369
  }
289
370
  function breakParentGroup(groupStack) {
290
371
  if (groupStack.length > 0) {
291
- const parentGroup = at_default(
292
- /* isOptionalObject */
293
- false,
372
+ const parentGroup = method_at_default(
373
+ /* OPTIONAL_OBJECT: false */
374
+ 0,
294
375
  groupStack,
295
376
  -1
296
377
  );
@@ -345,23 +426,23 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
345
426
  }
346
427
  function stripTrailingHardlineFromParts(parts) {
347
428
  parts = [...parts];
348
- while (parts.length >= 2 && at_default(
349
- /* isOptionalObject */
350
- false,
429
+ while (parts.length >= 2 && method_at_default(
430
+ /* OPTIONAL_OBJECT: false */
431
+ 0,
351
432
  parts,
352
433
  -2
353
- ).type === DOC_TYPE_LINE && at_default(
354
- /* isOptionalObject */
355
- false,
434
+ ).type === DOC_TYPE_LINE && method_at_default(
435
+ /* OPTIONAL_OBJECT: false */
436
+ 0,
356
437
  parts,
357
438
  -1
358
439
  ).type === DOC_TYPE_BREAK_PARENT) {
359
440
  parts.length -= 2;
360
441
  }
361
442
  if (parts.length > 0) {
362
- const lastPart = stripTrailingHardlineFromDoc(at_default(
363
- /* isOptionalObject */
364
- false,
443
+ const lastPart = stripTrailingHardlineFromDoc(method_at_default(
444
+ /* OPTIONAL_OBJECT: false */
445
+ 0,
365
446
  parts,
366
447
  -1
367
448
  ));
@@ -377,7 +458,10 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
377
458
  case DOC_TYPE_LINE_SUFFIX:
378
459
  case DOC_TYPE_LABEL: {
379
460
  const contents = stripTrailingHardlineFromDoc(doc.contents);
380
- return { ...doc, contents };
461
+ return {
462
+ ...doc,
463
+ contents
464
+ };
381
465
  }
382
466
  case DOC_TYPE_IF_BREAK:
383
467
  return {
@@ -386,11 +470,14 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
386
470
  flatContents: stripTrailingHardlineFromDoc(doc.flatContents)
387
471
  };
388
472
  case DOC_TYPE_FILL:
389
- return { ...doc, parts: stripTrailingHardlineFromParts(doc.parts) };
473
+ return {
474
+ ...doc,
475
+ parts: stripTrailingHardlineFromParts(doc.parts)
476
+ };
390
477
  case DOC_TYPE_ARRAY:
391
478
  return stripTrailingHardlineFromParts(doc);
392
479
  case DOC_TYPE_STRING:
393
- return doc.replace(/[\n\r]*$/u, "");
480
+ return trimNewlinesEnd(doc);
394
481
  case DOC_TYPE_ALIGN:
395
482
  case DOC_TYPE_CURSOR:
396
483
  case DOC_TYPE_TRIM:
@@ -441,9 +528,9 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
441
528
  continue;
442
529
  }
443
530
  const [currentPart, ...restParts] = Array.isArray(part) ? part : [part];
444
- if (typeof currentPart === "string" && typeof at_default(
445
- /* isOptionalObject */
446
- false,
531
+ if (typeof currentPart === "string" && typeof method_at_default(
532
+ /* OPTIONAL_OBJECT: false */
533
+ 0,
447
534
  parts,
448
535
  -1
449
536
  ) === "string") {
@@ -478,10 +565,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
478
565
  return mapDoc(doc, (currentDoc) => cleanDocFn(currentDoc));
479
566
  }
480
567
  function replaceEndOfLine(doc, replacement = literalline) {
481
- return mapDoc(
482
- doc,
483
- (currentDoc) => typeof currentDoc === "string" ? join(replacement, currentDoc.split("\n")) : currentDoc
484
- );
568
+ return mapDoc(doc, (currentDoc) => typeof currentDoc === "string" ? join(replacement, currentDoc.split("\n")) : currentDoc);
485
569
  }
486
570
  function canBreakFn(doc) {
487
571
  if (doc.type === DOC_TYPE_LINE) {
@@ -492,39 +576,46 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
492
576
  return findInDoc(doc, canBreakFn, false);
493
577
  }
494
578
 
495
- // src/document/utils/assert-doc.js
496
- var noop = () => {
497
- };
498
- var assertDoc = true ? noop : function(doc) {
499
- traverse_doc_default(doc, (doc2) => {
500
- if (checked.has(doc2)) {
501
- return false;
502
- }
503
- if (typeof doc2 !== "string") {
579
+ // src/document/utilities/assert-doc.js
580
+ var assertDoc = true ? noop_default : (
581
+ /**
582
+ @param {Doc} doc
583
+ */
584
+ function(doc) {
585
+ traverse_doc_default(doc, (doc2) => {
586
+ if (typeof doc2 === "string" || checked.has(doc2)) {
587
+ return false;
588
+ }
504
589
  checked.add(doc2);
505
- }
506
- });
507
- };
508
- var assertDocArray = true ? noop : function(docs, optional = false) {
509
- if (optional && !docs) {
510
- return;
590
+ });
511
591
  }
512
- if (!Array.isArray(docs)) {
513
- throw new TypeError("Unexpected doc array.");
514
- }
515
- for (const doc of docs) {
516
- assertDoc(doc);
592
+ );
593
+ var assertDocArray = true ? noop_default : (
594
+ /**
595
+ @param {readonly Doc[]} docs
596
+ @param {boolean} [optional = false]
597
+ */
598
+ function(docs, optional = false) {
599
+ if (optional && !docs) {
600
+ return;
601
+ }
602
+ if (!Array.isArray(docs)) {
603
+ throw new TypeError("Unexpected doc array.");
604
+ }
605
+ for (const doc of docs) {
606
+ assertDoc(doc);
607
+ }
517
608
  }
518
- };
519
- var assertDocFillParts = true ? noop : (
609
+ );
610
+ var assertDocFillParts = true ? noop_default : (
520
611
  /**
521
- * @param {Doc[]} parts
522
- */
612
+ @param {readonly Doc[]} parts
613
+ */
523
614
  function(parts) {
524
615
  assertDocArray(parts);
525
- if (parts.length > 1 && isEmptyDoc(at_default(
526
- /* isOptionalObject */
527
- false,
616
+ if (parts.length > 1 && isEmptyDoc(method_at_default(
617
+ /* OPTIONAL_OBJECT: false */
618
+ 0,
528
619
  parts,
529
620
  -1
530
621
  ))) {
@@ -533,37 +624,28 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
533
624
  for (const [i, doc] of parts.entries()) {
534
625
  if (i % 2 === 1 && !isValidSeparator(doc)) {
535
626
  const type = get_doc_type_default(doc);
536
- throw new Error(
537
- `Unexpected non-line-break doc at ${i}. Doc type is ${type}.`
538
- );
627
+ throw new Error(`Unexpected non-line-break doc at ${i}. Doc type is ${type}.`);
539
628
  }
540
629
  }
541
630
  }
542
631
  );
632
+ var assertAlignType = true ? noop_default : function(alignType) {
633
+ if (!(typeof alignType === "number" || typeof alignType === "string" || alignType?.type === "root")) {
634
+ throw new TypeError(`Invalid alignType '${alignType}'.`);
635
+ }
636
+ };
543
637
 
544
- // src/document/builders.js
638
+ // src/document/builders/indent.js
545
639
  function indent(contents) {
546
640
  assertDoc(contents);
547
641
  return { type: DOC_TYPE_INDENT, contents };
548
642
  }
549
- function align(widthOrString, contents) {
550
- assertDoc(contents);
551
- return { type: DOC_TYPE_ALIGN, contents, n: widthOrString };
552
- }
553
- function group(contents, opts = {}) {
643
+
644
+ // src/document/builders/align.js
645
+ function align(alignType, contents) {
646
+ assertAlignType(alignType);
554
647
  assertDoc(contents);
555
- assertDocArray(
556
- opts.expandedStates,
557
- /* optional */
558
- true
559
- );
560
- return {
561
- type: DOC_TYPE_GROUP,
562
- id: opts.id,
563
- contents,
564
- break: Boolean(opts.shouldBreak),
565
- expandedStates: opts.expandedStates
566
- };
648
+ return { type: DOC_TYPE_ALIGN, contents, n: alignType };
567
649
  }
568
650
  function dedentToRoot(contents) {
569
651
  return align(Number.NEGATIVE_INFINITY, contents);
@@ -574,14 +656,53 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
574
656
  function dedent(contents) {
575
657
  return align(-1, contents);
576
658
  }
577
- function conditionalGroup(states, opts) {
578
- return group(states[0], { ...opts, expandedStates: states });
659
+ function addAlignmentToDoc(doc, size, tabWidth) {
660
+ assertDoc(doc);
661
+ let aligned = doc;
662
+ if (size > 0) {
663
+ for (let level = 0; level < Math.floor(size / tabWidth); ++level) {
664
+ aligned = indent(aligned);
665
+ }
666
+ aligned = align(size % tabWidth, aligned);
667
+ aligned = align(Number.NEGATIVE_INFINITY, aligned);
668
+ }
669
+ return aligned;
579
670
  }
671
+
672
+ // src/document/builders/break-parent.js
673
+ var breakParent = { type: DOC_TYPE_BREAK_PARENT };
674
+
675
+ // src/document/builders/cursor.js
676
+ var cursor = { type: DOC_TYPE_CURSOR };
677
+
678
+ // src/document/builders/fill.js
580
679
  function fill(parts) {
581
680
  assertDocFillParts(parts);
582
681
  return { type: DOC_TYPE_FILL, parts };
583
682
  }
584
- function ifBreak(breakContents, flatContents = "", opts = {}) {
683
+
684
+ // src/document/builders/group.js
685
+ function group(contents, options = {}) {
686
+ assertDoc(contents);
687
+ assertDocArray(
688
+ options.expandedStates,
689
+ /* optional */
690
+ true
691
+ );
692
+ return {
693
+ type: DOC_TYPE_GROUP,
694
+ id: options.id,
695
+ contents,
696
+ break: Boolean(options.shouldBreak),
697
+ expandedStates: options.expandedStates
698
+ };
699
+ }
700
+ function conditionalGroup(states, options) {
701
+ return group(states[0], { ...options, expandedStates: states });
702
+ }
703
+
704
+ // src/document/builders/if-break.js
705
+ function ifBreak(breakContents, flatContents = "", options = {}) {
585
706
  assertDoc(breakContents);
586
707
  if (flatContents !== "") {
587
708
  assertDoc(flatContents);
@@ -590,36 +711,22 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
590
711
  type: DOC_TYPE_IF_BREAK,
591
712
  breakContents,
592
713
  flatContents,
593
- groupId: opts.groupId
714
+ groupId: options.groupId
594
715
  };
595
716
  }
596
- function indentIfBreak(contents, opts) {
717
+
718
+ // src/document/builders/indent-if-break.js
719
+ function indentIfBreak(contents, options) {
597
720
  assertDoc(contents);
598
721
  return {
599
722
  type: DOC_TYPE_INDENT_IF_BREAK,
600
723
  contents,
601
- groupId: opts.groupId,
602
- negate: opts.negate
724
+ groupId: options.groupId,
725
+ negate: options.negate
603
726
  };
604
727
  }
605
- function lineSuffix(contents) {
606
- assertDoc(contents);
607
- return { type: DOC_TYPE_LINE_SUFFIX, contents };
608
- }
609
- var lineSuffixBoundary = { type: DOC_TYPE_LINE_SUFFIX_BOUNDARY };
610
- var breakParent = { type: DOC_TYPE_BREAK_PARENT };
611
- var trim = { type: DOC_TYPE_TRIM };
612
- var hardlineWithoutBreakParent = { type: DOC_TYPE_LINE, hard: true };
613
- var literallineWithoutBreakParent = {
614
- type: DOC_TYPE_LINE,
615
- hard: true,
616
- literal: true
617
- };
618
- var line = { type: DOC_TYPE_LINE };
619
- var softline = { type: DOC_TYPE_LINE, soft: true };
620
- var hardline = [hardlineWithoutBreakParent, breakParent];
621
- var literalline = [literallineWithoutBreakParent, breakParent];
622
- var cursor = { type: DOC_TYPE_CURSOR };
728
+
729
+ // src/document/builders/join.js
623
730
  function join(separator, docs) {
624
731
  assertDoc(separator);
625
732
  assertDocArray(docs);
@@ -632,37 +739,50 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
632
739
  }
633
740
  return parts;
634
741
  }
635
- function addAlignmentToDoc(doc, size, tabWidth) {
636
- assertDoc(doc);
637
- let aligned = doc;
638
- if (size > 0) {
639
- for (let i = 0; i < Math.floor(size / tabWidth); ++i) {
640
- aligned = indent(aligned);
641
- }
642
- aligned = align(size % tabWidth, aligned);
643
- aligned = align(Number.NEGATIVE_INFINITY, aligned);
644
- }
645
- return aligned;
646
- }
742
+
743
+ // src/document/builders/label.js
647
744
  function label(label2, contents) {
648
745
  assertDoc(contents);
649
746
  return label2 ? { type: DOC_TYPE_LABEL, label: label2, contents } : contents;
650
747
  }
651
748
 
652
- // scripts/build/shims/string-replace-all.js
653
- var stringReplaceAll = (isOptionalObject, original, pattern, replacement) => {
654
- if (isOptionalObject && (original === void 0 || original === null)) {
655
- return;
656
- }
657
- if (original.replaceAll) {
658
- return original.replaceAll(pattern, replacement);
659
- }
749
+ // src/document/builders/line.js
750
+ var line = { type: DOC_TYPE_LINE };
751
+ var softline = { type: DOC_TYPE_LINE, soft: true };
752
+ var hardlineWithoutBreakParent = { type: DOC_TYPE_LINE, hard: true };
753
+ var hardline = [hardlineWithoutBreakParent, breakParent];
754
+ var literallineWithoutBreakParent = {
755
+ type: DOC_TYPE_LINE,
756
+ hard: true,
757
+ literal: true
758
+ };
759
+ var literalline = [literallineWithoutBreakParent, breakParent];
760
+
761
+ // src/document/builders/line-suffix.js
762
+ function lineSuffix(contents) {
763
+ assertDoc(contents);
764
+ return { type: DOC_TYPE_LINE_SUFFIX, contents };
765
+ }
766
+
767
+ // src/document/builders/line-suffix-boundary.js
768
+ var lineSuffixBoundary = { type: DOC_TYPE_LINE_SUFFIX_BOUNDARY };
769
+
770
+ // src/document/builders/trim.js
771
+ var trim = { type: DOC_TYPE_TRIM };
772
+
773
+ // scripts/build/shims/method-replace-all.js
774
+ var stringReplaceAll = String.prototype.replaceAll ?? function(pattern, replacement) {
660
775
  if (pattern.global) {
661
- return original.replace(pattern, replacement);
776
+ return this.replace(pattern, replacement);
662
777
  }
663
- return original.split(pattern).join(replacement);
778
+ return this.split(pattern).join(replacement);
664
779
  };
665
- var string_replace_all_default = stringReplaceAll;
780
+ var replaceAll = createMethodShim("replaceAll", function() {
781
+ if (typeof this === "string") {
782
+ return stringReplaceAll;
783
+ }
784
+ });
785
+ var method_replace_all_default = replaceAll;
666
786
 
667
787
  // src/common/end-of-line.js
668
788
  function convertEndOfLineToChars(value) {
@@ -678,7 +798,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
678
798
 
679
799
  // node_modules/emoji-regex/index.mjs
680
800
  var emoji_regex_default = () => {
681
- return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
801
+ return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
682
802
  };
683
803
 
684
804
  // node_modules/get-east-asian-width/lookup.js
@@ -686,14 +806,15 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
686
806
  return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
687
807
  }
688
808
  function isWide(x) {
689
- return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9776 && x <= 9783 || x >= 9800 && x <= 9811 || x === 9855 || x >= 9866 && x <= 9871 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12773 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x === 94192 || x === 94193 || x >= 94208 && x <= 100343 || x >= 100352 && x <= 101589 || x >= 101631 && x <= 101640 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x >= 119552 && x <= 119638 || x >= 119648 && x <= 119670 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128727 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129673 || x >= 129679 && x <= 129734 || x >= 129742 && x <= 129756 || x >= 129759 && x <= 129769 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
809
+ return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9776 && x <= 9783 || x >= 9800 && x <= 9811 || x === 9855 || x >= 9866 && x <= 9871 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12773 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x >= 94192 && x <= 94198 || x >= 94208 && x <= 101589 || x >= 101631 && x <= 101662 || x >= 101760 && x <= 101874 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x >= 119552 && x <= 119638 || x >= 119648 && x <= 119670 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128728 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129674 || x >= 129678 && x <= 129734 || x === 129736 || x >= 129741 && x <= 129756 || x >= 129759 && x <= 129770 || x >= 129775 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
690
810
  }
691
811
 
692
- // node_modules/get-east-asian-width/index.js
693
- var _isNarrowWidth = (codePoint) => !(isFullWidth(codePoint) || isWide(codePoint));
812
+ // src/utils/narrow-emojis.evaluate.js
813
+ var narrow_emojis_evaluate_default = "\xA9\xAE\u203C\u2049\u2122\u2139\u2194\u2195\u2196\u2197\u2198\u2199\u21A9\u21AA\u2328\u23CF\u23F1\u23F2\u23F8\u23F9\u23FA\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600\u2601\u2602\u2603\u2604\u260E\u2611\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638\u2639\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694\u2695\u2696\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F1\u26F7\u26F8\u26F9\u2702\u2708\u2709\u270C\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u2764\u27A1\u2934\u2935\u2B05\u2B06\u2B07";
694
814
 
695
815
  // src/utils/get-string-width.js
696
816
  var notAsciiRegex = /[^\x20-\x7F]/u;
817
+ var narrowEmojisSet = new Set(narrow_emojis_evaluate_default);
697
818
  function getStringWidth(text) {
698
819
  if (!text) {
699
820
  return 0;
@@ -701,7 +822,10 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
701
822
  if (!notAsciiRegex.test(text)) {
702
823
  return text.length;
703
824
  }
704
- text = text.replace(emoji_regex_default(), " ");
825
+ text = text.replace(
826
+ emoji_regex_default(),
827
+ (match) => narrowEmojisSet.has(match) ? " " : " "
828
+ );
705
829
  let width = 0;
706
830
  for (const character of text) {
707
831
  const codePoint = character.codePointAt(0);
@@ -711,48 +835,39 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
711
835
  if (codePoint >= 768 && codePoint <= 879) {
712
836
  continue;
713
837
  }
714
- width += _isNarrowWidth(codePoint) ? 1 : 2;
838
+ if (codePoint >= 65024 && codePoint <= 65039) {
839
+ continue;
840
+ }
841
+ width += isFullWidth(codePoint) || isWide(codePoint) ? 2 : 1;
715
842
  }
716
843
  return width;
717
844
  }
718
845
  var get_string_width_default = getStringWidth;
719
846
 
720
- // src/document/printer.js
721
- var MODE_BREAK = Symbol("MODE_BREAK");
722
- var MODE_FLAT = Symbol("MODE_FLAT");
723
- var CURSOR_PLACEHOLDER = Symbol("cursor");
724
- var DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
725
- function rootIndent() {
726
- return { value: "", length: 0, queue: [] };
727
- }
728
- function makeIndent(ind, options) {
729
- return generateInd(ind, { type: "indent" }, options);
730
- }
731
- function makeAlign(indent2, widthOrDoc, options) {
732
- if (widthOrDoc === Number.NEGATIVE_INFINITY) {
733
- return indent2.root || rootIndent();
734
- }
735
- if (widthOrDoc < 0) {
736
- return generateInd(indent2, { type: "dedent" }, options);
847
+ // src/document/printer/indent.js
848
+ var INDENT_COMMAND_TYPE_INDENT = 0;
849
+ var INDENT_COMMAND_TYPE_DEDENT = 1;
850
+ var INDENT_COMMAND_TYPE_WIDTH = 2;
851
+ var INDENT_COMMAND_TYPE_STRING = 3;
852
+ var INDENT_COMMAND_INDENT = { type: INDENT_COMMAND_TYPE_INDENT };
853
+ var INDENT_COMMAND_DEDENT = { type: INDENT_COMMAND_TYPE_DEDENT };
854
+ var ROOT_INDENT = {
855
+ value: "",
856
+ length: 0,
857
+ queue: [],
858
+ get root() {
859
+ return ROOT_INDENT;
737
860
  }
738
- if (!widthOrDoc) {
739
- return indent2;
740
- }
741
- if (widthOrDoc.type === "root") {
742
- return { ...indent2, root: indent2 };
743
- }
744
- const alignType = typeof widthOrDoc === "string" ? "stringAlign" : "numberAlign";
745
- return generateInd(indent2, { type: alignType, n: widthOrDoc }, options);
746
- }
747
- function generateInd(ind, newPart, options) {
748
- const queue = newPart.type === "dedent" ? ind.queue.slice(0, -1) : [...ind.queue, newPart];
861
+ };
862
+ function generateIndent(indent2, command, options) {
863
+ const queue = command.type === INDENT_COMMAND_TYPE_DEDENT ? indent2.queue.slice(0, -1) : [...indent2.queue, command];
749
864
  let value = "";
750
865
  let length = 0;
751
866
  let lastTabs = 0;
752
867
  let lastSpaces = 0;
753
- for (const part of queue) {
754
- switch (part.type) {
755
- case "indent":
868
+ for (const command2 of queue) {
869
+ switch (command2.type) {
870
+ case INDENT_COMMAND_TYPE_INDENT:
756
871
  flush();
757
872
  if (options.useTabs) {
758
873
  addTabs(1);
@@ -760,21 +875,25 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
760
875
  addSpaces(options.tabWidth);
761
876
  }
762
877
  break;
763
- case "stringAlign":
878
+ case INDENT_COMMAND_TYPE_STRING: {
879
+ const { string } = command2;
764
880
  flush();
765
- value += part.n;
766
- length += part.n.length;
881
+ value += string;
882
+ length += string.length;
767
883
  break;
768
- case "numberAlign":
884
+ }
885
+ case INDENT_COMMAND_TYPE_WIDTH: {
886
+ const { width } = command2;
769
887
  lastTabs += 1;
770
- lastSpaces += part.n;
888
+ lastSpaces += width;
771
889
  break;
890
+ }
772
891
  default:
773
- throw new Error(`Unexpected type '${part.type}'`);
892
+ throw new Error(`Unexpected indent comment '${command2.type}'.`);
774
893
  }
775
894
  }
776
895
  flushSpaces();
777
- return { ...ind, value, length, queue };
896
+ return { ...indent2, value, length, queue };
778
897
  function addTabs(count) {
779
898
  value += " ".repeat(count);
780
899
  length += options.tabWidth * count;
@@ -807,65 +926,97 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
807
926
  lastSpaces = 0;
808
927
  }
809
928
  }
810
- function trim2(out) {
811
- let trimCount = 0;
812
- let cursorCount = 0;
813
- let outIndex = out.length;
814
- outer: while (outIndex--) {
815
- const last = out[outIndex];
816
- if (last === CURSOR_PLACEHOLDER) {
817
- cursorCount++;
818
- continue;
819
- }
820
- if (false) {
821
- throw new Error(`Unexpected value in trim: '${typeof last}'`);
822
- }
823
- for (let charIndex = last.length - 1; charIndex >= 0; charIndex--) {
824
- const char = last[charIndex];
825
- if (char === " " || char === " ") {
826
- trimCount++;
827
- } else {
828
- out[outIndex] = last.slice(0, charIndex + 1);
829
- break outer;
830
- }
929
+ function makeAlign(indent2, indentOptions, options) {
930
+ if (!indentOptions) {
931
+ return indent2;
932
+ }
933
+ if (indentOptions.type === "root") {
934
+ return { ...indent2, root: indent2 };
935
+ }
936
+ if (indentOptions === Number.NEGATIVE_INFINITY) {
937
+ return indent2.root;
938
+ }
939
+ let command;
940
+ if (typeof indentOptions === "number") {
941
+ if (indentOptions < 0) {
942
+ command = INDENT_COMMAND_DEDENT;
943
+ } else {
944
+ command = { type: INDENT_COMMAND_TYPE_WIDTH, width: indentOptions };
831
945
  }
946
+ } else {
947
+ command = { type: INDENT_COMMAND_TYPE_STRING, string: indentOptions };
832
948
  }
833
- if (trimCount > 0 || cursorCount > 0) {
834
- out.length = outIndex + 1;
835
- while (cursorCount-- > 0) {
836
- out.push(CURSOR_PLACEHOLDER);
949
+ return generateIndent(indent2, command, options);
950
+ }
951
+ function makeIndent(indent2, options) {
952
+ return generateIndent(indent2, INDENT_COMMAND_INDENT, options);
953
+ }
954
+
955
+ // src/document/printer/trim-indentation.js
956
+ function getTrailingIndentionLength(text) {
957
+ let length = 0;
958
+ for (let index = text.length - 1; index >= 0; index--) {
959
+ const character = text[index];
960
+ if (character === " " || character === " ") {
961
+ length++;
962
+ } else {
963
+ break;
837
964
  }
838
965
  }
839
- return trimCount;
966
+ return length;
840
967
  }
841
- function fits(next, restCommands, width, hasLineSuffix, groupModeMap, mustBeFlat) {
842
- if (width === Number.POSITIVE_INFINITY) {
968
+ function trimIndentation(text) {
969
+ const length = getTrailingIndentionLength(text);
970
+ const trimmed = length === 0 ? text : text.slice(0, text.length - length);
971
+ return { text: trimmed, count: length };
972
+ }
973
+
974
+ // src/document/printer/printer.js
975
+ var MODE_BREAK = Symbol("MODE_BREAK");
976
+ var MODE_FLAT = Symbol("MODE_FLAT");
977
+ var DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
978
+ function fits(next, restCommands, remainingWidth, hasLineSuffix, groupModeMap, mustBeFlat) {
979
+ if (remainingWidth === Number.POSITIVE_INFINITY) {
843
980
  return true;
844
981
  }
845
- let restIdx = restCommands.length;
846
- const cmds = [next];
847
- const out = [];
848
- while (width >= 0) {
849
- if (cmds.length === 0) {
850
- if (restIdx === 0) {
982
+ let restCommandsIndex = restCommands.length;
983
+ let hasPendingSpace = false;
984
+ const commands = [next];
985
+ let output = "";
986
+ while (remainingWidth >= 0) {
987
+ if (commands.length === 0) {
988
+ if (restCommandsIndex === 0) {
851
989
  return true;
852
990
  }
853
- cmds.push(restCommands[--restIdx]);
991
+ commands.push(restCommands[--restCommandsIndex]);
854
992
  continue;
855
993
  }
856
- const { mode, doc } = cmds.pop();
994
+ const {
995
+ mode,
996
+ doc
997
+ } = commands.pop();
857
998
  const docType = get_doc_type_default(doc);
858
999
  switch (docType) {
859
1000
  case DOC_TYPE_STRING:
860
- out.push(doc);
861
- width -= get_string_width_default(doc);
1001
+ if (doc) {
1002
+ if (hasPendingSpace) {
1003
+ output += " ";
1004
+ remainingWidth -= 1;
1005
+ hasPendingSpace = false;
1006
+ }
1007
+ output += doc;
1008
+ remainingWidth -= get_string_width_default(doc);
1009
+ }
862
1010
  break;
863
1011
  case DOC_TYPE_ARRAY:
864
1012
  case DOC_TYPE_FILL: {
865
1013
  const parts = docType === DOC_TYPE_ARRAY ? doc : doc.parts;
866
1014
  const end = doc[DOC_FILL_PRINTED_LENGTH] ?? 0;
867
- for (let i = parts.length - 1; i >= end; i--) {
868
- cmds.push({ mode, doc: parts[i] });
1015
+ for (let index = parts.length - 1; index >= end; index--) {
1016
+ commands.push({
1017
+ mode,
1018
+ doc: parts[index]
1019
+ });
869
1020
  }
870
1021
  break;
871
1022
  }
@@ -873,30 +1024,45 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
873
1024
  case DOC_TYPE_ALIGN:
874
1025
  case DOC_TYPE_INDENT_IF_BREAK:
875
1026
  case DOC_TYPE_LABEL:
876
- cmds.push({ mode, doc: doc.contents });
1027
+ commands.push({
1028
+ mode,
1029
+ doc: doc.contents
1030
+ });
877
1031
  break;
878
- case DOC_TYPE_TRIM:
879
- width += trim2(out);
1032
+ case DOC_TYPE_TRIM: {
1033
+ const {
1034
+ text,
1035
+ count
1036
+ } = trimIndentation(output);
1037
+ output = text;
1038
+ remainingWidth += count;
880
1039
  break;
1040
+ }
881
1041
  case DOC_TYPE_GROUP: {
882
1042
  if (mustBeFlat && doc.break) {
883
1043
  return false;
884
1044
  }
885
1045
  const groupMode = doc.break ? MODE_BREAK : mode;
886
- const contents = doc.expandedStates && groupMode === MODE_BREAK ? at_default(
887
- /* isOptionalObject */
888
- false,
1046
+ const contents = doc.expandedStates && groupMode === MODE_BREAK ? method_at_default(
1047
+ /* OPTIONAL_OBJECT: false */
1048
+ 0,
889
1049
  doc.expandedStates,
890
1050
  -1
891
1051
  ) : doc.contents;
892
- cmds.push({ mode: groupMode, doc: contents });
1052
+ commands.push({
1053
+ mode: groupMode,
1054
+ doc: contents
1055
+ });
893
1056
  break;
894
1057
  }
895
1058
  case DOC_TYPE_IF_BREAK: {
896
1059
  const groupMode = doc.groupId ? groupModeMap[doc.groupId] || MODE_FLAT : mode;
897
1060
  const contents = groupMode === MODE_BREAK ? doc.breakContents : doc.flatContents;
898
1061
  if (contents) {
899
- cmds.push({ mode, doc: contents });
1062
+ commands.push({
1063
+ mode,
1064
+ doc: contents
1065
+ });
900
1066
  }
901
1067
  break;
902
1068
  }
@@ -905,8 +1071,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
905
1071
  return true;
906
1072
  }
907
1073
  if (!doc.soft) {
908
- out.push(" ");
909
- width--;
1074
+ hasPendingSpace = true;
910
1075
  }
911
1076
  break;
912
1077
  case DOC_TYPE_LINE_SUFFIX:
@@ -922,64 +1087,84 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
922
1087
  return false;
923
1088
  }
924
1089
  function printDocToString(doc, options) {
925
- const groupModeMap = {};
1090
+ const groupModeMap = /* @__PURE__ */ Object.create(null);
926
1091
  const width = options.printWidth;
927
1092
  const newLine = convertEndOfLineToChars(options.endOfLine);
928
- let pos = 0;
929
- const cmds = [{ ind: rootIndent(), mode: MODE_BREAK, doc }];
930
- const out = [];
1093
+ let position = 0;
1094
+ const commands = [{
1095
+ indent: ROOT_INDENT,
1096
+ mode: MODE_BREAK,
1097
+ doc
1098
+ }];
1099
+ let out = [];
931
1100
  let shouldRemeasure = false;
932
1101
  const lineSuffix2 = [];
933
- let printedCursorCount = 0;
1102
+ const cursorPositions = [];
934
1103
  propagateBreaks(doc);
935
- while (cmds.length > 0) {
936
- const { ind, mode, doc: doc2 } = cmds.pop();
1104
+ while (commands.length > 0) {
1105
+ const {
1106
+ indent: indent2,
1107
+ mode,
1108
+ doc: doc2
1109
+ } = commands.pop();
937
1110
  switch (get_doc_type_default(doc2)) {
938
1111
  case DOC_TYPE_STRING: {
939
- const formatted = newLine !== "\n" ? string_replace_all_default(
940
- /* isOptionalObject */
941
- false,
1112
+ const formatted2 = newLine !== "\n" ? method_replace_all_default(
1113
+ /* OPTIONAL_OBJECT: false */
1114
+ 0,
942
1115
  doc2,
943
1116
  "\n",
944
1117
  newLine
945
1118
  ) : doc2;
946
- out.push(formatted);
947
- if (cmds.length > 0) {
948
- pos += get_string_width_default(formatted);
1119
+ if (formatted2) {
1120
+ out.push(formatted2);
1121
+ if (commands.length > 0) {
1122
+ position += get_string_width_default(formatted2);
1123
+ }
949
1124
  }
950
1125
  break;
951
1126
  }
952
1127
  case DOC_TYPE_ARRAY:
953
- for (let i = doc2.length - 1; i >= 0; i--) {
954
- cmds.push({ ind, mode, doc: doc2[i] });
1128
+ for (let index = doc2.length - 1; index >= 0; index--) {
1129
+ commands.push({
1130
+ indent: indent2,
1131
+ mode,
1132
+ doc: doc2[index]
1133
+ });
955
1134
  }
956
1135
  break;
957
- case DOC_TYPE_CURSOR:
958
- if (printedCursorCount >= 2) {
1136
+ case DOC_TYPE_CURSOR: {
1137
+ if (cursorPositions.length >= 2) {
959
1138
  throw new Error("There are too many 'cursor' in doc.");
960
1139
  }
961
- out.push(CURSOR_PLACEHOLDER);
962
- printedCursorCount++;
1140
+ const text = out.join("");
1141
+ out = [text];
1142
+ cursorPositions.push(text.length - 1);
963
1143
  break;
1144
+ }
964
1145
  case DOC_TYPE_INDENT:
965
- cmds.push({ ind: makeIndent(ind, options), mode, doc: doc2.contents });
1146
+ commands.push({
1147
+ indent: makeIndent(indent2, options),
1148
+ mode,
1149
+ doc: doc2.contents
1150
+ });
966
1151
  break;
967
1152
  case DOC_TYPE_ALIGN:
968
- cmds.push({
969
- ind: makeAlign(ind, doc2.n, options),
1153
+ commands.push({
1154
+ indent: makeAlign(indent2, doc2.n, options),
970
1155
  mode,
971
1156
  doc: doc2.contents
972
1157
  });
973
1158
  break;
974
1159
  case DOC_TYPE_TRIM:
975
- pos -= trim2(out);
1160
+ trim2();
976
1161
  break;
977
1162
  case DOC_TYPE_GROUP:
978
1163
  switch (mode) {
979
1164
  case MODE_FLAT:
980
1165
  if (!shouldRemeasure) {
981
- cmds.push({
982
- ind,
1166
+ commands.push({
1167
+ indent: indent2,
983
1168
  mode: doc2.break ? MODE_BREAK : MODE_FLAT,
984
1169
  doc: doc2.contents
985
1170
  });
@@ -988,49 +1173,69 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
988
1173
  // fallthrough
989
1174
  case MODE_BREAK: {
990
1175
  shouldRemeasure = false;
991
- const next = { ind, mode: MODE_FLAT, doc: doc2.contents };
992
- const rem = width - pos;
1176
+ const next = {
1177
+ indent: indent2,
1178
+ mode: MODE_FLAT,
1179
+ doc: doc2.contents
1180
+ };
1181
+ const remainingWidth = width - position;
993
1182
  const hasLineSuffix = lineSuffix2.length > 0;
994
- if (!doc2.break && fits(next, cmds, rem, hasLineSuffix, groupModeMap)) {
995
- cmds.push(next);
1183
+ if (!doc2.break && fits(next, commands, remainingWidth, hasLineSuffix, groupModeMap)) {
1184
+ commands.push(next);
996
1185
  } else {
997
1186
  if (doc2.expandedStates) {
998
- const mostExpanded = at_default(
999
- /* isOptionalObject */
1000
- false,
1187
+ const mostExpanded = method_at_default(
1188
+ /* OPTIONAL_OBJECT: false */
1189
+ 0,
1001
1190
  doc2.expandedStates,
1002
1191
  -1
1003
1192
  );
1004
1193
  if (doc2.break) {
1005
- cmds.push({ ind, mode: MODE_BREAK, doc: mostExpanded });
1194
+ commands.push({
1195
+ indent: indent2,
1196
+ mode: MODE_BREAK,
1197
+ doc: mostExpanded
1198
+ });
1006
1199
  break;
1007
1200
  } else {
1008
- for (let i = 1; i < doc2.expandedStates.length + 1; i++) {
1009
- if (i >= doc2.expandedStates.length) {
1010
- cmds.push({ ind, mode: MODE_BREAK, doc: mostExpanded });
1201
+ for (let index = 1; index < doc2.expandedStates.length + 1; index++) {
1202
+ if (index >= doc2.expandedStates.length) {
1203
+ commands.push({
1204
+ indent: indent2,
1205
+ mode: MODE_BREAK,
1206
+ doc: mostExpanded
1207
+ });
1011
1208
  break;
1012
1209
  } else {
1013
- const state = doc2.expandedStates[i];
1014
- const cmd = { ind, mode: MODE_FLAT, doc: state };
1015
- if (fits(cmd, cmds, rem, hasLineSuffix, groupModeMap)) {
1016
- cmds.push(cmd);
1210
+ const state = doc2.expandedStates[index];
1211
+ const cmd = {
1212
+ indent: indent2,
1213
+ mode: MODE_FLAT,
1214
+ doc: state
1215
+ };
1216
+ if (fits(cmd, commands, remainingWidth, hasLineSuffix, groupModeMap)) {
1217
+ commands.push(cmd);
1017
1218
  break;
1018
1219
  }
1019
1220
  }
1020
1221
  }
1021
1222
  }
1022
1223
  } else {
1023
- cmds.push({ ind, mode: MODE_BREAK, doc: doc2.contents });
1224
+ commands.push({
1225
+ indent: indent2,
1226
+ mode: MODE_BREAK,
1227
+ doc: doc2.contents
1228
+ });
1024
1229
  }
1025
1230
  }
1026
1231
  break;
1027
1232
  }
1028
1233
  }
1029
1234
  if (doc2.id) {
1030
- groupModeMap[doc2.id] = at_default(
1031
- /* isOptionalObject */
1032
- false,
1033
- cmds,
1235
+ groupModeMap[doc2.id] = method_at_default(
1236
+ /* OPTIONAL_OBJECT: false */
1237
+ 0,
1238
+ commands,
1034
1239
  -1
1035
1240
  ).mode;
1036
1241
  }
@@ -1056,68 +1261,76 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
1056
1261
  // * Neither content item fits on the line without breaking
1057
1262
  // -> output the first content item and the whitespace with "break".
1058
1263
  case DOC_TYPE_FILL: {
1059
- const rem = width - pos;
1264
+ const remainingWidth = width - position;
1060
1265
  const offset = doc2[DOC_FILL_PRINTED_LENGTH] ?? 0;
1061
- const { parts } = doc2;
1266
+ const {
1267
+ parts
1268
+ } = doc2;
1062
1269
  const length = parts.length - offset;
1063
1270
  if (length === 0) {
1064
1271
  break;
1065
1272
  }
1066
1273
  const content = parts[offset + 0];
1067
1274
  const whitespace = parts[offset + 1];
1068
- const contentFlatCmd = { ind, mode: MODE_FLAT, doc: content };
1069
- const contentBreakCmd = { ind, mode: MODE_BREAK, doc: content };
1070
- const contentFits = fits(
1071
- contentFlatCmd,
1072
- [],
1073
- rem,
1074
- lineSuffix2.length > 0,
1075
- groupModeMap,
1076
- true
1077
- );
1275
+ const contentFlatCommand = {
1276
+ indent: indent2,
1277
+ mode: MODE_FLAT,
1278
+ doc: content
1279
+ };
1280
+ const contentBreakCommand = {
1281
+ indent: indent2,
1282
+ mode: MODE_BREAK,
1283
+ doc: content
1284
+ };
1285
+ const contentFits = fits(contentFlatCommand, [], remainingWidth, lineSuffix2.length > 0, groupModeMap, true);
1078
1286
  if (length === 1) {
1079
1287
  if (contentFits) {
1080
- cmds.push(contentFlatCmd);
1288
+ commands.push(contentFlatCommand);
1081
1289
  } else {
1082
- cmds.push(contentBreakCmd);
1290
+ commands.push(contentBreakCommand);
1083
1291
  }
1084
1292
  break;
1085
1293
  }
1086
- const whitespaceFlatCmd = { ind, mode: MODE_FLAT, doc: whitespace };
1087
- const whitespaceBreakCmd = { ind, mode: MODE_BREAK, doc: whitespace };
1294
+ const whitespaceFlatCommand = {
1295
+ indent: indent2,
1296
+ mode: MODE_FLAT,
1297
+ doc: whitespace
1298
+ };
1299
+ const whitespaceBreakCommand = {
1300
+ indent: indent2,
1301
+ mode: MODE_BREAK,
1302
+ doc: whitespace
1303
+ };
1088
1304
  if (length === 2) {
1089
1305
  if (contentFits) {
1090
- cmds.push(whitespaceFlatCmd, contentFlatCmd);
1306
+ commands.push(whitespaceFlatCommand, contentFlatCommand);
1091
1307
  } else {
1092
- cmds.push(whitespaceBreakCmd, contentBreakCmd);
1308
+ commands.push(whitespaceBreakCommand, contentBreakCommand);
1093
1309
  }
1094
1310
  break;
1095
1311
  }
1096
1312
  const secondContent = parts[offset + 2];
1097
- const remainingCmd = {
1098
- ind,
1313
+ const remainingCommand = {
1314
+ indent: indent2,
1099
1315
  mode,
1100
- doc: { ...doc2, [DOC_FILL_PRINTED_LENGTH]: offset + 2 }
1316
+ doc: {
1317
+ ...doc2,
1318
+ [DOC_FILL_PRINTED_LENGTH]: offset + 2
1319
+ }
1101
1320
  };
1102
- const firstAndSecondContentFlatCmd = {
1103
- ind,
1321
+ const firstAndSecondContentFlatCommand = {
1322
+ indent: indent2,
1104
1323
  mode: MODE_FLAT,
1105
1324
  doc: [content, whitespace, secondContent]
1106
1325
  };
1107
- const firstAndSecondContentFits = fits(
1108
- firstAndSecondContentFlatCmd,
1109
- [],
1110
- rem,
1111
- lineSuffix2.length > 0,
1112
- groupModeMap,
1113
- true
1114
- );
1326
+ const firstAndSecondContentFits = fits(firstAndSecondContentFlatCommand, [], remainingWidth, lineSuffix2.length > 0, groupModeMap, true);
1327
+ commands.push(remainingCommand);
1115
1328
  if (firstAndSecondContentFits) {
1116
- cmds.push(remainingCmd, whitespaceFlatCmd, contentFlatCmd);
1329
+ commands.push(whitespaceFlatCommand, contentFlatCommand);
1117
1330
  } else if (contentFits) {
1118
- cmds.push(remainingCmd, whitespaceBreakCmd, contentFlatCmd);
1331
+ commands.push(whitespaceBreakCommand, contentFlatCommand);
1119
1332
  } else {
1120
- cmds.push(remainingCmd, whitespaceBreakCmd, contentBreakCmd);
1333
+ commands.push(whitespaceBreakCommand, contentBreakCommand);
1121
1334
  }
1122
1335
  break;
1123
1336
  }
@@ -1127,23 +1340,39 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
1127
1340
  if (groupMode === MODE_BREAK) {
1128
1341
  const breakContents = doc2.type === DOC_TYPE_IF_BREAK ? doc2.breakContents : doc2.negate ? doc2.contents : indent(doc2.contents);
1129
1342
  if (breakContents) {
1130
- cmds.push({ ind, mode, doc: breakContents });
1343
+ commands.push({
1344
+ indent: indent2,
1345
+ mode,
1346
+ doc: breakContents
1347
+ });
1131
1348
  }
1132
1349
  }
1133
1350
  if (groupMode === MODE_FLAT) {
1134
1351
  const flatContents = doc2.type === DOC_TYPE_IF_BREAK ? doc2.flatContents : doc2.negate ? indent(doc2.contents) : doc2.contents;
1135
1352
  if (flatContents) {
1136
- cmds.push({ ind, mode, doc: flatContents });
1353
+ commands.push({
1354
+ indent: indent2,
1355
+ mode,
1356
+ doc: flatContents
1357
+ });
1137
1358
  }
1138
1359
  }
1139
1360
  break;
1140
1361
  }
1141
1362
  case DOC_TYPE_LINE_SUFFIX:
1142
- lineSuffix2.push({ ind, mode, doc: doc2.contents });
1363
+ lineSuffix2.push({
1364
+ indent: indent2,
1365
+ mode,
1366
+ doc: doc2.contents
1367
+ });
1143
1368
  break;
1144
1369
  case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
1145
1370
  if (lineSuffix2.length > 0) {
1146
- cmds.push({ ind, mode, doc: hardlineWithoutBreakParent });
1371
+ commands.push({
1372
+ indent: indent2,
1373
+ mode,
1374
+ doc: hardlineWithoutBreakParent
1375
+ });
1147
1376
  }
1148
1377
  break;
1149
1378
  case DOC_TYPE_LINE:
@@ -1152,7 +1381,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
1152
1381
  if (!doc2.hard) {
1153
1382
  if (!doc2.soft) {
1154
1383
  out.push(" ");
1155
- pos += 1;
1384
+ position += 1;
1156
1385
  }
1157
1386
  break;
1158
1387
  } else {
@@ -1161,60 +1390,76 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
1161
1390
  // fallthrough
1162
1391
  case MODE_BREAK:
1163
1392
  if (lineSuffix2.length > 0) {
1164
- cmds.push({ ind, mode, doc: doc2 }, ...lineSuffix2.reverse());
1393
+ commands.push({
1394
+ indent: indent2,
1395
+ mode,
1396
+ doc: doc2
1397
+ }, ...lineSuffix2.reverse());
1165
1398
  lineSuffix2.length = 0;
1166
1399
  break;
1167
1400
  }
1168
1401
  if (doc2.literal) {
1169
- if (ind.root) {
1170
- out.push(newLine, ind.root.value);
1171
- pos = ind.root.length;
1172
- } else {
1173
- out.push(newLine);
1174
- pos = 0;
1402
+ out.push(newLine);
1403
+ position = 0;
1404
+ if (indent2.root) {
1405
+ if (indent2.root.value) {
1406
+ out.push(indent2.root.value);
1407
+ }
1408
+ position = indent2.root.length;
1175
1409
  }
1176
1410
  } else {
1177
- pos -= trim2(out);
1178
- out.push(newLine + ind.value);
1179
- pos = ind.length;
1411
+ trim2();
1412
+ out.push(newLine + indent2.value);
1413
+ position = indent2.length;
1180
1414
  }
1181
1415
  break;
1182
1416
  }
1183
1417
  break;
1184
1418
  case DOC_TYPE_LABEL:
1185
- cmds.push({ ind, mode, doc: doc2.contents });
1419
+ commands.push({
1420
+ indent: indent2,
1421
+ mode,
1422
+ doc: doc2.contents
1423
+ });
1186
1424
  break;
1187
1425
  case DOC_TYPE_BREAK_PARENT:
1188
1426
  break;
1189
1427
  default:
1190
1428
  throw new invalid_doc_error_default(doc2);
1191
1429
  }
1192
- if (cmds.length === 0 && lineSuffix2.length > 0) {
1193
- cmds.push(...lineSuffix2.reverse());
1430
+ if (commands.length === 0 && lineSuffix2.length > 0) {
1431
+ commands.push(...lineSuffix2.reverse());
1194
1432
  lineSuffix2.length = 0;
1195
1433
  }
1196
1434
  }
1197
- const cursorPlaceholderIndex = out.indexOf(CURSOR_PLACEHOLDER);
1198
- if (cursorPlaceholderIndex !== -1) {
1199
- const otherCursorPlaceholderIndex = out.indexOf(
1200
- CURSOR_PLACEHOLDER,
1201
- cursorPlaceholderIndex + 1
1202
- );
1203
- if (otherCursorPlaceholderIndex === -1) {
1204
- return {
1205
- formatted: out.filter((char) => char !== CURSOR_PLACEHOLDER).join("")
1206
- };
1207
- }
1208
- const beforeCursor = out.slice(0, cursorPlaceholderIndex).join("");
1209
- const aroundCursor = out.slice(cursorPlaceholderIndex + 1, otherCursorPlaceholderIndex).join("");
1210
- const afterCursor = out.slice(otherCursorPlaceholderIndex + 1).join("");
1435
+ const formatted = out.join("");
1436
+ if (cursorPositions.length !== 2) {
1211
1437
  return {
1212
- formatted: beforeCursor + aroundCursor + afterCursor,
1213
- cursorNodeStart: beforeCursor.length,
1214
- cursorNodeText: aroundCursor
1438
+ formatted
1215
1439
  };
1216
1440
  }
1217
- return { formatted: out.join("") };
1441
+ const cursorNodeStart = cursorPositions[0] + 1;
1442
+ return {
1443
+ formatted,
1444
+ cursorNodeStart,
1445
+ cursorNodeText: formatted.slice(cursorNodeStart, method_at_default(
1446
+ /* OPTIONAL_OBJECT: false */
1447
+ 0,
1448
+ cursorPositions,
1449
+ -1
1450
+ ) + 1)
1451
+ };
1452
+ function trim2() {
1453
+ const {
1454
+ text,
1455
+ count
1456
+ } = trimIndentation(out.join(""));
1457
+ out = [text];
1458
+ position -= count;
1459
+ for (let index = 0; index < cursorPositions.length; index++) {
1460
+ cursorPositions[index] = Math.min(cursorPositions[index], text.length - 1);
1461
+ }
1462
+ }
1218
1463
  }
1219
1464
 
1220
1465
  // src/document/public.js