eddyter 1.3.55 → 1.3.57

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.
Files changed (231) hide show
  1. package/LICENSE +24 -24
  2. package/README.md +493 -493
  3. package/dist/App.d.ts +3 -2
  4. package/dist/Provider/EditorProvider.d.ts +32 -31
  5. package/dist/Provider/LexicalProvider.d.ts +6 -5
  6. package/dist/api/ai/index.d.ts +39 -83
  7. package/dist/api/analytics.d.ts +21 -21
  8. package/dist/api/auth.d.ts +108 -108
  9. package/dist/api/bugReport.d.ts +27 -27
  10. package/dist/api/config/axios.d.ts +2 -1
  11. package/dist/api/config/endpoints.d.ts +24 -27
  12. package/dist/api/featureSuggestion.d.ts +23 -23
  13. package/dist/api/feedback.d.ts +26 -26
  14. package/dist/api/linkPreview.d.ts +15 -15
  15. package/dist/api/transcript/index.d.ts +68 -68
  16. package/dist/assets/style.css +1 -1
  17. package/dist/babel-1c4a328b.js +7478 -0
  18. package/dist/components/AiPlugin/index.d.ts +6 -6
  19. package/dist/components/AlignMenu/AlignMenu.d.ts +9 -8
  20. package/dist/components/AlignMenu/AlignMenuDrop.d.ts +3 -2
  21. package/dist/components/AlignMenu/index.d.ts +1 -1
  22. package/dist/components/AutoExpandingDemo.d.ts +6 -5
  23. package/dist/components/BlockFormatMenu/BlockFormatMenu.d.ts +3 -2
  24. package/dist/components/BlockFormatMenu/constants.d.ts +14 -14
  25. package/dist/components/BlockFormatMenu/index.d.ts +1 -1
  26. package/dist/components/BugReportDialog/index.d.ts +6 -6
  27. package/dist/components/ChartEditDialog.d.ts +9 -8
  28. package/dist/components/ChartInsertDialog.d.ts +8 -7
  29. package/dist/components/CodeActionMenuPlugin/components/CopyButton/index.d.ts +7 -6
  30. package/dist/components/CodeActionMenuPlugin/components/PrettierButton/index.d.ts +9 -8
  31. package/dist/components/CodeActionMenuPlugin/index.d.ts +5 -4
  32. package/dist/components/CodeActionMenuPlugin/utils.d.ts +1 -1
  33. package/dist/components/ColorPicker/ColorPicker.d.ts +3 -2
  34. package/dist/components/ColorPicker/index.d.ts +1 -1
  35. package/dist/components/CommentSidebar/CommentSidebar.d.ts +8 -7
  36. package/dist/components/CommentSidebar/index.d.ts +1 -1
  37. package/dist/components/CommentToggle/CommentToggle.d.ts +8 -7
  38. package/dist/components/CommentToggle/index.d.ts +1 -1
  39. package/dist/components/CommentView/CommentView.d.ts +9 -8
  40. package/dist/components/CommentView/index.d.ts +1 -1
  41. package/dist/components/ConfigurableEditorWithAuth.d.ts +35 -34
  42. package/dist/components/ContentPreview/index.d.ts +37 -36
  43. package/dist/components/DatePicker/DatePickerWidget.d.ts +7 -6
  44. package/dist/components/EmojiPickerWidget/EmojiPickerWidget.d.ts +3 -2
  45. package/dist/components/EmojiPickerWidget/index.d.ts +1 -1
  46. package/dist/components/FeatureSuggestionDialog/index.d.ts +6 -6
  47. package/dist/components/FeedbackDialog/index.d.ts +7 -7
  48. package/dist/components/FileUpload/InsertFileDialog.d.ts +7 -7
  49. package/dist/components/FileUpload/InsertFileUploadedDialogBody.d.ts +5 -4
  50. package/dist/components/FileView/index.d.ts +9 -8
  51. package/dist/components/FloatingHighlightColorPicker/index.d.ts +9 -8
  52. package/dist/components/FontFamilySelect/FontFamilyMenu.d.ts +7 -6
  53. package/dist/components/FontSizePicker/FontSizeControl.d.ts +3 -2
  54. package/dist/components/FormatTextMenu/FormatTextMenu.d.ts +3 -2
  55. package/dist/components/FormatTextMenu/FormatTextMenuDrop.d.ts +3 -2
  56. package/dist/components/FormatTextMenu/index.d.ts +1 -1
  57. package/dist/components/HighlightColorPicker/HighlightColorPicker.d.ts +7 -6
  58. package/dist/components/HtmlViewDisplay.d.ts +3 -2
  59. package/dist/components/ImageComparisonDialog/index.d.ts +11 -10
  60. package/dist/components/ImageGenerationDialog/ImageGenerationManager.d.ts +11 -10
  61. package/dist/components/ImageGenerationDialog/index.d.ts +11 -10
  62. package/dist/components/ImageInsertTest.d.ts +3 -2
  63. package/dist/components/ImageView/ImageDialog/ImageUploadDialogBody.d.ts +9 -8
  64. package/dist/components/ImageView/ImageDialog/index.d.ts +6 -5
  65. package/dist/components/ImageView/ImageResizer.d.ts +16 -15
  66. package/dist/components/ImageView/index.d.ts +17 -16
  67. package/dist/components/InsertMenu/InsertMenu.d.ts +9 -8
  68. package/dist/components/InsertMenu/InsertMenuDrop.d.ts +9 -8
  69. package/dist/components/InsertMenu/index.d.ts +1 -1
  70. package/dist/components/LanguageSelectorDialog/index.d.ts +8 -7
  71. package/dist/components/LinkPreviewHover/index.d.ts +40 -40
  72. package/dist/components/NotePanelMenu/NotePanelMenu.d.ts +6 -5
  73. package/dist/components/NotePanelMenu/index.d.ts +1 -1
  74. package/dist/components/NotePanelView/NotePanelView.d.ts +9 -8
  75. package/dist/components/NotePanelView/index.d.ts +1 -1
  76. package/dist/components/Placeholder/Placeholder.d.ts +3 -2
  77. package/dist/components/Placeholder/index.d.ts +1 -1
  78. package/dist/components/Placeholder/styles.d.ts +1 -1
  79. package/dist/components/PreviewDialog/index.d.ts +10 -0
  80. package/dist/components/ScopedEditor.d.ts +8 -8
  81. package/dist/components/SignatureCaption/index.d.ts +6 -5
  82. package/dist/components/SpeechLanguageSelector/index.d.ts +9 -8
  83. package/dist/components/TableColorPicker/index.d.ts +8 -7
  84. package/dist/components/TableModal/TableModal.d.ts +10 -9
  85. package/dist/components/TextEnhanceDialog/index.d.ts +10 -9
  86. package/dist/components/ToneAdjustDialog/index.d.ts +8 -7
  87. package/dist/components/Toolbar/Toolbar.d.ts +3 -2
  88. package/dist/components/Toolbar/index.d.ts +1 -1
  89. package/dist/components/Toolbar/styles.d.ts +6 -6
  90. package/dist/components/VoiceTranscriptIcon/VoiceTranscriptIcon.d.ts +2 -1
  91. package/dist/components/VoiceTranscriptIcon/index.d.ts +1 -1
  92. package/dist/components/ui/avatar.d.ts +6 -6
  93. package/dist/components/ui/badge.d.ts +9 -8
  94. package/dist/components/ui/button.d.ts +11 -10
  95. package/dist/components/ui/calendar.d.ts +8 -7
  96. package/dist/components/ui/card.d.ts +8 -8
  97. package/dist/components/ui/checkbox.d.ts +4 -4
  98. package/dist/components/ui/dialog.d.ts +19 -19
  99. package/dist/components/ui/dropdown-menu.d.ts +27 -27
  100. package/dist/components/ui/input.d.ts +3 -3
  101. package/dist/components/ui/label.d.ts +4 -4
  102. package/dist/components/ui/popover.d.ts +7 -7
  103. package/dist/components/ui/select.d.ts +13 -13
  104. package/dist/components/ui/separator.d.ts +4 -4
  105. package/dist/components/ui/sheet.d.ts +24 -24
  106. package/dist/components/ui/skeleton.d.ts +3 -3
  107. package/dist/components/ui/tabs.d.ts +7 -7
  108. package/dist/components/ui/textarea.d.ts +3 -3
  109. package/dist/components/ui/tooltip.d.ts +7 -7
  110. package/dist/constants.d.ts +22 -21
  111. package/dist/context/CommentContext.d.ts +43 -42
  112. package/dist/context/HtmlViewContext.d.ts +17 -16
  113. package/dist/context/ToolbarContext.d.ts +56 -55
  114. package/dist/editorConfig.d.ts +70 -70
  115. package/dist/estree-2cbea43c.js +4667 -0
  116. package/dist/hooks/useAutoExpandingHeight.d.ts +15 -15
  117. package/dist/hooks/useBlockFormat.d.ts +17 -16
  118. package/dist/hooks/useColorPicker.d.ts +6 -6
  119. package/dist/hooks/useCustomCommands.d.ts +3 -2
  120. package/dist/hooks/useDebounce.d.ts +1 -1
  121. package/dist/hooks/useEditorToolbar.d.ts +10 -9
  122. package/dist/hooks/useFeedbackEligibility.d.ts +18 -18
  123. package/dist/hooks/useInsertMenu.d.ts +9 -9
  124. package/dist/hooks/useModal.d.ts +5 -5
  125. package/dist/hooks/useReactNativeBridge.d.ts +54 -54
  126. package/dist/hooks/useS3Uploader.d.ts +21 -21
  127. package/dist/hooks/useVoiceToText.d.ts +20 -20
  128. package/dist/html-c18fb60e.js +2841 -0
  129. package/dist/{html2pdf.bundle-bd00e24a.js → html2pdf.bundle-065f580a.js} +1 -1
  130. package/dist/{html2pdf.bundle.min-4dffe6d7.js → html2pdf.bundle.min-c9c3c4f0.js} +1 -1
  131. package/dist/{index-4f0e0157.js → index-39aec401.js} +14746 -16371
  132. package/dist/{index-5647e7d9.js → index-5b27923c.js} +4 -3
  133. package/dist/{index-4cfc35d0.js → index-a9f00b0b.js} +47 -46
  134. package/dist/index.d.ts +14 -14
  135. package/dist/index.js +14 -13
  136. package/dist/lib/utils.d.ts +2 -1
  137. package/dist/main.d.ts +1 -0
  138. package/dist/markdown-39c3822b.js +3547 -0
  139. package/dist/nodes/ChartNode.d.ts +41 -40
  140. package/dist/nodes/CommentNode.d.ts +34 -33
  141. package/dist/nodes/CommentedTextNode.d.ts +29 -28
  142. package/dist/nodes/EmbedNode.d.ts +32 -31
  143. package/dist/nodes/FileNode.d.ts +33 -32
  144. package/dist/nodes/ImageNode.d.ts +65 -64
  145. package/dist/nodes/MentionNode.d.ts +75 -74
  146. package/dist/nodes/NotePanelNode.d.ts +31 -30
  147. package/dist/nodes/UploadingFileNode.d.ts +30 -29
  148. package/dist/nodes/UploadingImageNode.d.ts +30 -29
  149. package/dist/pages/ConfigurableEditor/ConfigurableEditor.d.ts +25 -24
  150. package/dist/pages/ConfigurableEditor/index.d.ts +2 -2
  151. package/dist/pages/NotFound.d.ts +2 -2
  152. package/dist/pages/RichTextEditor.d.ts +6 -6
  153. package/dist/pages/TextareaEditor.d.ts +6 -6
  154. package/dist/pages/styles.d.ts +5 -5
  155. package/dist/plugins/AIChatPlugin.d.ts +11 -10
  156. package/dist/plugins/AndroidKeyboardFixPlugin.d.ts +16 -16
  157. package/dist/plugins/AutocompletePlugin.d.ts +22 -22
  158. package/dist/plugins/CodeBlockNormalizerPlugin.d.ts +8 -8
  159. package/dist/plugins/CodeBlockSelectAllPlugin.d.ts +8 -8
  160. package/dist/plugins/CodeHighlightPlugin.d.ts +3 -2
  161. package/dist/plugins/CombinedAutocompletGrammarPlugin.d.ts +21 -20
  162. package/dist/plugins/CommentBubblePlugin.d.ts +3 -2
  163. package/dist/plugins/CommentPlugin.d.ts +7 -6
  164. package/dist/plugins/CustomHorizontalRulePlugin/CustomHorizontalRuleNode.d.ts +29 -28
  165. package/dist/plugins/CustomHorizontalRulePlugin/CustomHorizontalRulePlugin.d.ts +3 -3
  166. package/dist/plugins/CustomHorizontalRulePlugin/HorizontalRuleCustomizationDialog.d.ts +7 -6
  167. package/dist/plugins/CustomHorizontalRulePlugin/index.d.ts +3 -3
  168. package/dist/plugins/DragDropPastePlugin/index.d.ts +8 -8
  169. package/dist/plugins/DragDropPastePlugin/indexs.d.ts +1 -1
  170. package/dist/plugins/DraggableBlockPlugin/index.d.ts +4 -0
  171. package/dist/plugins/EmbedPreviewPlugin/FloatingEmbedMenuPlugin.d.ts +4 -3
  172. package/dist/plugins/EmbedPreviewPlugin/index.d.ts +6 -5
  173. package/dist/plugins/FilePlugin.d.ts +8 -7
  174. package/dist/plugins/FloatingLinkEditorPlugin/index.d.ts +6 -5
  175. package/dist/plugins/FloatingTextFormatToolbarPlugin/index.d.ts +27 -26
  176. package/dist/plugins/GrammarCheckPlugin.d.ts +2 -1
  177. package/dist/plugins/HtmlCodeViewPlugin/index.d.ts +2 -2
  178. package/dist/plugins/HtmlImportPlugin.d.ts +5 -5
  179. package/dist/plugins/HtmlSyncPlugin.d.ts +3 -3
  180. package/dist/plugins/ImagePlugin.d.ts +7 -6
  181. package/dist/plugins/LinkPlugin/index.d.ts +6 -5
  182. package/dist/plugins/LinkPreviewPlugin/index.d.ts +4 -4
  183. package/dist/plugins/LocalStoragePlugin.d.ts +7 -6
  184. package/dist/plugins/MarkdownShortcutsPlugin/index.d.ts +20 -20
  185. package/dist/plugins/MentionsPlugin/index.d.ts +7 -6
  186. package/dist/plugins/NotePanelPlugin.d.ts +7 -6
  187. package/dist/plugins/PasteOptionsPlugin/index.d.ts +17 -17
  188. package/dist/plugins/RichTextPastePlugin/index.d.ts +6 -5
  189. package/dist/plugins/SignatureCanvasPlugin/SignatureCanvasDialog.d.ts +6 -5
  190. package/dist/plugins/SignatureCanvasPlugin/SignatureCanvasPlugin.d.ts +9 -9
  191. package/dist/plugins/SignatureCanvasPlugin/index.d.ts +2 -2
  192. package/dist/plugins/SlashCommandPlugin/index.d.ts +2 -2
  193. package/dist/plugins/TableActionMenuPlugin/index.d.ts +6 -5
  194. package/dist/plugins/TableCellResizer/index.d.ts +2 -1
  195. package/dist/plugins/TableHoverActionsPlugin/index.d.ts +4 -4
  196. package/dist/plugins/TablePlugin.d.ts +5 -4
  197. package/dist/plugins/Tableimageautoresizeplugin.d.ts +1 -1
  198. package/dist/plugins/TextEnhancePlugin.d.ts +6 -6
  199. package/dist/plugins/TreeViewPlugin.d.ts +3 -2
  200. package/dist/plugins/UsageTrackingPlugin.d.ts +15 -15
  201. package/dist/plugins/VoiceTranscriptPlugin.d.ts +25 -25
  202. package/dist/plugins/WordCountPlugin.d.ts +3 -2
  203. package/dist/postcss-bbcc713e.js +5151 -0
  204. package/dist/services/chartService.d.ts +19 -18
  205. package/dist/standalone-36ad3877.js +2600 -0
  206. package/dist/styles/PlaygroundEditorTheme.d.ts +3 -2
  207. package/dist/types.d.ts +205 -203
  208. package/dist/typescript-39d06710.js +13533 -0
  209. package/dist/ui/ColorPicker.d.ts +14 -13
  210. package/dist/ui/Icons.d.ts +84 -84
  211. package/dist/ui/TextInput.d.ts +11 -10
  212. package/dist/utils/dateFormats.d.ts +33 -33
  213. package/dist/utils/debounce.d.ts +6 -5
  214. package/dist/utils/editorStyleConverter.d.ts +17 -16
  215. package/dist/utils/export.d.ts +2 -1
  216. package/dist/utils/getDOMRangeRect.d.ts +13 -13
  217. package/dist/utils/getSelectedNode.d.ts +3 -2
  218. package/dist/utils/helper.d.ts +3 -3
  219. package/dist/utils/index.d.ts +4 -3
  220. package/dist/utils/invarient.d.ts +1 -1
  221. package/dist/utils/setFloatingElemPosition.d.ts +8 -8
  222. package/dist/utils/setFloatingElemPositionForLinkEditor.d.ts +1 -1
  223. package/dist/utils/url.d.ts +9 -9
  224. package/package.json +149 -149
  225. package/dist/babel-2d5b260f.js +0 -7770
  226. package/dist/estree-28f5912a.js +0 -4920
  227. package/dist/html-3f297a3a.js +0 -3021
  228. package/dist/markdown-08edd93b.js +0 -3625
  229. package/dist/postcss-0e22bc25.js +0 -5187
  230. package/dist/standalone-83d5947a.js +0 -2728
  231. package/dist/typescript-0559ee85.js +0 -13660
@@ -1,2728 +0,0 @@
1
- var Uu = Object.defineProperty;
2
- var qu = (e, t, u) => t in e ? Uu(e, t, { enumerable: !0, configurable: !0, writable: !0, value: u }) : e[t] = u;
3
- var we = (e, t, u) => (qu(e, typeof t != "symbol" ? t + "" : t, u), u), Hu = (e, t, u) => {
4
- if (!t.has(e))
5
- throw TypeError("Cannot " + u);
6
- };
7
- var Me = (e, t, u) => {
8
- if (t.has(e))
9
- throw TypeError("Cannot add the same private member more than once");
10
- t instanceof WeakSet ? t.add(e) : t.set(e, u);
11
- };
12
- var ce = (e, t, u) => (Hu(e, t, "access private method"), u);
13
- var Gu = Object.create, et = Object.defineProperty, Yu = Object.getOwnPropertyDescriptor, Qu = Object.getOwnPropertyNames, Zu = Object.getPrototypeOf, er = Object.prototype.hasOwnProperty, tr = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), tt = (e, t) => {
14
- for (var u in t)
15
- et(e, u, { get: t[u], enumerable: !0 });
16
- }, ur = (e, t, u, r) => {
17
- if (t && typeof t == "object" || typeof t == "function")
18
- for (let n of Qu(t))
19
- !er.call(e, n) && n !== u && et(e, n, { get: () => t[n], enumerable: !(r = Yu(t, n)) || r.enumerable });
20
- return e;
21
- }, rr = (e, t, u) => (u = e != null ? Gu(Zu(e)) : {}, ur(t || !e || !e.__esModule ? et(u, "default", { value: e, enumerable: !0 }) : u, e)), nr = tr((e, t) => {
22
- var u, r, n, D, a, i, o, s, l, f, c, F, d, p, E, g, m, b, C;
23
- d = /\/(?![*\/])(?:\[(?:[^\]\\\n\r\u2028\u2029]+|\\.)*\]|[^\/\\\n\r\u2028\u2029]+|\\.)*(\/[$_\u200C\u200D\p{ID_Continue}]*|\\)?/yu, F = /--|\+\+|=>|\.{3}|\??\.(?!\d)|(?:&&|\|\||\?\?|[+\-%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2}|\/(?![\/*]))=?|[?~,:;[\](){}]/y, u = /(\x23?)(?=[$_\p{ID_Start}\\])(?:[$_\u200C\u200D\p{ID_Continue}]+|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+/yu, E = /(['"])(?:[^'"\\\n\r]+|(?!\1)['"]|\\(?:\r\n|[^]))*(\1)?/y, c = /(?:0[xX][\da-fA-F](?:_?[\da-fA-F])*|0[oO][0-7](?:_?[0-7])*|0[bB][01](?:_?[01])*)n?|0n|[1-9](?:_?\d)*n|(?:(?:0(?!\d)|0\d*[89]\d*|[1-9](?:_?\d)*)(?:\.(?:\d(?:_?\d)*)?)?|\.\d(?:_?\d)*)(?:[eE][+-]?\d(?:_?\d)*)?|0[0-7]+/y, g = /[`}](?:[^`\\$]+|\\[^]|\$(?!\{))*(`|\$\{)?/y, C = /[\t\v\f\ufeff\p{Zs}]+/yu, s = /\r?\n|[\r\u2028\u2029]/y, l = /\/\*(?:[^*]+|\*(?!\/))*(\*\/)?/y, p = /\/\/.*/y, n = /[<>.:={}]|\/(?![\/*])/y, r = /[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}-]*/yu, D = /(['"])(?:[^'"]+|(?!\1)['"])*(\1)?/y, a = /[^<>{}]+/y, b = /^(?:[\/+-]|\.{3}|\?(?:InterpolationIn(?:JSX|Template)|NoLineTerminatorHere|NonExpressionParenEnd|UnaryIncDec))?$|[{}([,;<>=*%&|^!~?:]$/, m = /^(?:=>|[;\]){}]|else|\?(?:NoLineTerminatorHere|NonExpressionParenEnd))?$/, i = /^(?:await|case|default|delete|do|else|instanceof|new|return|throw|typeof|void|yield)$/, o = /^(?:return|throw|yield)$/, f = RegExp(s.source), t.exports = function* (y, { jsx: w = !1 } = {}) {
24
- var x, L, $, v, B, se, h, P, le, N, ue, A, ge, k;
25
- for ({ length: se } = y, v = 0, B = "", k = [{ tag: "JS" }], x = [], ue = 0, A = !1; v < se; ) {
26
- switch (P = k[k.length - 1], P.tag) {
27
- case "JS":
28
- case "JSNonExpressionParen":
29
- case "InterpolationInTemplate":
30
- case "InterpolationInJSX":
31
- if (y[v] === "/" && (b.test(B) || i.test(B)) && (d.lastIndex = v, h = d.exec(y))) {
32
- v = d.lastIndex, B = h[0], A = !0, yield { type: "RegularExpressionLiteral", value: h[0], closed: h[1] !== void 0 && h[1] !== "\\" };
33
- continue;
34
- }
35
- if (F.lastIndex = v, h = F.exec(y)) {
36
- switch (ge = h[0], le = F.lastIndex, N = ge, ge) {
37
- case "(":
38
- B === "?NonExpressionParenKeyword" && k.push({ tag: "JSNonExpressionParen", nesting: ue }), ue++, A = !1;
39
- break;
40
- case ")":
41
- ue--, A = !0, P.tag === "JSNonExpressionParen" && ue === P.nesting && (k.pop(), N = "?NonExpressionParenEnd", A = !1);
42
- break;
43
- case "{":
44
- F.lastIndex = 0, $ = !m.test(B) && (b.test(B) || i.test(B)), x.push($), A = !1;
45
- break;
46
- case "}":
47
- switch (P.tag) {
48
- case "InterpolationInTemplate":
49
- if (x.length === P.nesting) {
50
- g.lastIndex = v, h = g.exec(y), v = g.lastIndex, B = h[0], h[1] === "${" ? (B = "?InterpolationInTemplate", A = !1, yield { type: "TemplateMiddle", value: h[0] }) : (k.pop(), A = !0, yield { type: "TemplateTail", value: h[0], closed: h[1] === "`" });
51
- continue;
52
- }
53
- break;
54
- case "InterpolationInJSX":
55
- if (x.length === P.nesting) {
56
- k.pop(), v += 1, B = "}", yield { type: "JSXPunctuator", value: "}" };
57
- continue;
58
- }
59
- }
60
- A = x.pop(), N = A ? "?ExpressionBraceEnd" : "}";
61
- break;
62
- case "]":
63
- A = !0;
64
- break;
65
- case "++":
66
- case "--":
67
- N = A ? "?PostfixIncDec" : "?UnaryIncDec";
68
- break;
69
- case "<":
70
- if (w && (b.test(B) || i.test(B))) {
71
- k.push({ tag: "JSXTag" }), v += 1, B = "<", yield { type: "JSXPunctuator", value: ge };
72
- continue;
73
- }
74
- A = !1;
75
- break;
76
- default:
77
- A = !1;
78
- }
79
- v = le, B = N, yield { type: "Punctuator", value: ge };
80
- continue;
81
- }
82
- if (u.lastIndex = v, h = u.exec(y)) {
83
- switch (v = u.lastIndex, N = h[0], h[0]) {
84
- case "for":
85
- case "if":
86
- case "while":
87
- case "with":
88
- B !== "." && B !== "?." && (N = "?NonExpressionParenKeyword");
89
- }
90
- B = N, A = !i.test(h[0]), yield { type: h[1] === "#" ? "PrivateIdentifier" : "IdentifierName", value: h[0] };
91
- continue;
92
- }
93
- if (E.lastIndex = v, h = E.exec(y)) {
94
- v = E.lastIndex, B = h[0], A = !0, yield { type: "StringLiteral", value: h[0], closed: h[2] !== void 0 };
95
- continue;
96
- }
97
- if (c.lastIndex = v, h = c.exec(y)) {
98
- v = c.lastIndex, B = h[0], A = !0, yield { type: "NumericLiteral", value: h[0] };
99
- continue;
100
- }
101
- if (g.lastIndex = v, h = g.exec(y)) {
102
- v = g.lastIndex, B = h[0], h[1] === "${" ? (B = "?InterpolationInTemplate", k.push({ tag: "InterpolationInTemplate", nesting: x.length }), A = !1, yield { type: "TemplateHead", value: h[0] }) : (A = !0, yield { type: "NoSubstitutionTemplate", value: h[0], closed: h[1] === "`" });
103
- continue;
104
- }
105
- break;
106
- case "JSXTag":
107
- case "JSXTagEnd":
108
- if (n.lastIndex = v, h = n.exec(y)) {
109
- switch (v = n.lastIndex, N = h[0], h[0]) {
110
- case "<":
111
- k.push({ tag: "JSXTag" });
112
- break;
113
- case ">":
114
- k.pop(), B === "/" || P.tag === "JSXTagEnd" ? (N = "?JSX", A = !0) : k.push({ tag: "JSXChildren" });
115
- break;
116
- case "{":
117
- k.push({ tag: "InterpolationInJSX", nesting: x.length }), N = "?InterpolationInJSX", A = !1;
118
- break;
119
- case "/":
120
- B === "<" && (k.pop(), k[k.length - 1].tag === "JSXChildren" && k.pop(), k.push({ tag: "JSXTagEnd" }));
121
- }
122
- B = N, yield { type: "JSXPunctuator", value: h[0] };
123
- continue;
124
- }
125
- if (r.lastIndex = v, h = r.exec(y)) {
126
- v = r.lastIndex, B = h[0], yield { type: "JSXIdentifier", value: h[0] };
127
- continue;
128
- }
129
- if (D.lastIndex = v, h = D.exec(y)) {
130
- v = D.lastIndex, B = h[0], yield { type: "JSXString", value: h[0], closed: h[2] !== void 0 };
131
- continue;
132
- }
133
- break;
134
- case "JSXChildren":
135
- if (a.lastIndex = v, h = a.exec(y)) {
136
- v = a.lastIndex, B = h[0], yield { type: "JSXText", value: h[0] };
137
- continue;
138
- }
139
- switch (y[v]) {
140
- case "<":
141
- k.push({ tag: "JSXTag" }), v++, B = "<", yield { type: "JSXPunctuator", value: "<" };
142
- continue;
143
- case "{":
144
- k.push({ tag: "InterpolationInJSX", nesting: x.length }), v++, B = "?InterpolationInJSX", A = !1, yield { type: "JSXPunctuator", value: "{" };
145
- continue;
146
- }
147
- }
148
- if (C.lastIndex = v, h = C.exec(y)) {
149
- v = C.lastIndex, yield { type: "WhiteSpace", value: h[0] };
150
- continue;
151
- }
152
- if (s.lastIndex = v, h = s.exec(y)) {
153
- v = s.lastIndex, A = !1, o.test(B) && (B = "?NoLineTerminatorHere"), yield { type: "LineTerminatorSequence", value: h[0] };
154
- continue;
155
- }
156
- if (l.lastIndex = v, h = l.exec(y)) {
157
- v = l.lastIndex, f.test(h[0]) && (A = !1, o.test(B) && (B = "?NoLineTerminatorHere")), yield { type: "MultiLineComment", value: h[0], closed: h[1] !== void 0 };
158
- continue;
159
- }
160
- if (p.lastIndex = v, h = p.exec(y)) {
161
- v = p.lastIndex, A = !1, yield { type: "SingleLineComment", value: h[0] };
162
- continue;
163
- }
164
- L = String.fromCodePoint(y.codePointAt(v)), v += L.length, B = L, A = !1, yield { type: P.tag.startsWith("JSX") ? "JSXInvalid" : "Invalid", value: L };
165
- }
166
- };
167
- }), Dr = {};
168
- tt(Dr, { __debug: () => qa, check: () => Xa, doc: () => Ru, format: () => Xu, formatWithCursor: () => zu, getSupportInfo: () => Ua, util: () => Vu, version: () => Ea });
169
- var Be = (e, t) => (u, r, ...n) => u | 1 && r == null ? void 0 : (t.call(r) ?? r[e]).apply(r, n), ar = String.prototype.replaceAll ?? function(e, t) {
170
- return e.global ? this.replace(e, t) : this.split(e).join(t);
171
- }, ir = Be("replaceAll", function() {
172
- if (typeof this == "string")
173
- return ar;
174
- }), Oe = ir, or = class {
175
- diff(e, t, u = {}) {
176
- let r;
177
- typeof u == "function" ? (r = u, u = {}) : "callback" in u && (r = u.callback);
178
- let n = this.castInput(e, u), D = this.castInput(t, u), a = this.removeEmpty(this.tokenize(n, u)), i = this.removeEmpty(this.tokenize(D, u));
179
- return this.diffWithOptionsObj(a, i, u, r);
180
- }
181
- diffWithOptionsObj(e, t, u, r) {
182
- var n;
183
- let D = (g) => {
184
- if (g = this.postProcess(g, u), r) {
185
- setTimeout(function() {
186
- r(g);
187
- }, 0);
188
- return;
189
- } else
190
- return g;
191
- }, a = t.length, i = e.length, o = 1, s = a + i;
192
- u.maxEditLength != null && (s = Math.min(s, u.maxEditLength));
193
- let l = (n = u.timeout) !== null && n !== void 0 ? n : 1 / 0, f = Date.now() + l, c = [{ oldPos: -1, lastComponent: void 0 }], F = this.extractCommon(c[0], t, e, 0, u);
194
- if (c[0].oldPos + 1 >= i && F + 1 >= a)
195
- return D(this.buildValues(c[0].lastComponent, t, e));
196
- let d = -1 / 0, p = 1 / 0, E = () => {
197
- for (let g = Math.max(d, -o); g <= Math.min(p, o); g += 2) {
198
- let m, b = c[g - 1], C = c[g + 1];
199
- b && (c[g - 1] = void 0);
200
- let y = !1;
201
- if (C) {
202
- let x = C.oldPos - g;
203
- y = C && 0 <= x && x < a;
204
- }
205
- let w = b && b.oldPos + 1 < i;
206
- if (!y && !w) {
207
- c[g] = void 0;
208
- continue;
209
- }
210
- if (!w || y && b.oldPos < C.oldPos ? m = this.addToPath(C, !0, !1, 0, u) : m = this.addToPath(b, !1, !0, 1, u), F = this.extractCommon(m, t, e, g, u), m.oldPos + 1 >= i && F + 1 >= a)
211
- return D(this.buildValues(m.lastComponent, t, e)) || !0;
212
- c[g] = m, m.oldPos + 1 >= i && (p = Math.min(p, g - 1)), F + 1 >= a && (d = Math.max(d, g + 1));
213
- }
214
- o++;
215
- };
216
- if (r)
217
- (function g() {
218
- setTimeout(function() {
219
- if (o > s || Date.now() > f)
220
- return r(void 0);
221
- E() || g();
222
- }, 0);
223
- })();
224
- else
225
- for (; o <= s && Date.now() <= f; ) {
226
- let g = E();
227
- if (g)
228
- return g;
229
- }
230
- }
231
- addToPath(e, t, u, r, n) {
232
- let D = e.lastComponent;
233
- return D && !n.oneChangePerToken && D.added === t && D.removed === u ? { oldPos: e.oldPos + r, lastComponent: { count: D.count + 1, added: t, removed: u, previousComponent: D.previousComponent } } : { oldPos: e.oldPos + r, lastComponent: { count: 1, added: t, removed: u, previousComponent: D } };
234
- }
235
- extractCommon(e, t, u, r, n) {
236
- let D = t.length, a = u.length, i = e.oldPos, o = i - r, s = 0;
237
- for (; o + 1 < D && i + 1 < a && this.equals(u[i + 1], t[o + 1], n); )
238
- o++, i++, s++, n.oneChangePerToken && (e.lastComponent = { count: 1, previousComponent: e.lastComponent, added: !1, removed: !1 });
239
- return s && !n.oneChangePerToken && (e.lastComponent = { count: s, previousComponent: e.lastComponent, added: !1, removed: !1 }), e.oldPos = i, o;
240
- }
241
- equals(e, t, u) {
242
- return u.comparator ? u.comparator(e, t) : e === t || !!u.ignoreCase && e.toLowerCase() === t.toLowerCase();
243
- }
244
- removeEmpty(e) {
245
- let t = [];
246
- for (let u = 0; u < e.length; u++)
247
- e[u] && t.push(e[u]);
248
- return t;
249
- }
250
- castInput(e, t) {
251
- return e;
252
- }
253
- tokenize(e, t) {
254
- return Array.from(e);
255
- }
256
- join(e) {
257
- return e.join("");
258
- }
259
- postProcess(e, t) {
260
- return e;
261
- }
262
- get useLongestToken() {
263
- return !1;
264
- }
265
- buildValues(e, t, u) {
266
- let r = [], n;
267
- for (; e; )
268
- r.push(e), n = e.previousComponent, delete e.previousComponent, e = n;
269
- r.reverse();
270
- let D = r.length, a = 0, i = 0, o = 0;
271
- for (; a < D; a++) {
272
- let s = r[a];
273
- if (s.removed)
274
- s.value = this.join(u.slice(o, o + s.count)), o += s.count;
275
- else {
276
- if (!s.added && this.useLongestToken) {
277
- let l = t.slice(i, i + s.count);
278
- l = l.map(function(f, c) {
279
- let F = u[o + c];
280
- return F.length > f.length ? F : f;
281
- }), s.value = this.join(l);
282
- } else
283
- s.value = this.join(t.slice(i, i + s.count));
284
- i += s.count, s.added || (o += s.count);
285
- }
286
- }
287
- return r;
288
- }
289
- }, sr = class extends or {
290
- tokenize(e) {
291
- return e.slice();
292
- }
293
- join(e) {
294
- return e;
295
- }
296
- removeEmpty(e) {
297
- return e;
298
- }
299
- }, lr = new sr();
300
- function cr(e, t, u) {
301
- return lr.diff(e, t, u);
302
- }
303
- var fr = () => {
304
- }, Fr = fr, Ut = "cr", qt = "crlf", dr = "lf", pr = dr, ut = "\r", Ht = `\r
305
- `, Te = `
306
- `, hr = Te;
307
- function Cr(e) {
308
- let t = e.indexOf(ut);
309
- return t !== -1 ? e.charAt(t + 1) === Te ? qt : Ut : pr;
310
- }
311
- function rt(e) {
312
- return e === Ut ? ut : e === qt ? Ht : hr;
313
- }
314
- var gr = /* @__PURE__ */ new Map([[Te, /\n/gu], [ut, /\r/gu], [Ht, /\r\n/gu]]);
315
- function Gt(e, t) {
316
- var r;
317
- let u = gr.get(t);
318
- return ((r = e.match(u)) == null ? void 0 : r.length) ?? 0;
319
- }
320
- var Er = /\r\n?/gu;
321
- function mr(e) {
322
- return Oe(0, e, Er, Te);
323
- }
324
- function yr(e) {
325
- return this[e < 0 ? this.length + e : e];
326
- }
327
- var vr = Be("at", function() {
328
- if (Array.isArray(this) || typeof this == "string")
329
- return yr;
330
- }), S = vr, ie = "string", z = "array", ee = "cursor", X = "indent", U = "align", q = "trim", O = "group", R = "fill", T = "if-break", H = "indent-if-break", G = "line-suffix", Y = "line-suffix-boundary", I = "line", V = "label", j = "break-parent", Yt = /* @__PURE__ */ new Set([ee, X, U, q, O, R, T, H, G, Y, I, V, j]);
331
- function Br(e) {
332
- let t = e.length;
333
- for (; t > 0 && (e[t - 1] === "\r" || e[t - 1] === `
334
- `); )
335
- t--;
336
- return t < e.length ? e.slice(0, t) : e;
337
- }
338
- function br(e) {
339
- if (typeof e == "string")
340
- return ie;
341
- if (Array.isArray(e))
342
- return z;
343
- if (!e)
344
- return;
345
- let { type: t } = e;
346
- if (Yt.has(t))
347
- return t;
348
- }
349
- var oe = br, Ar = (e) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(e);
350
- function wr(e) {
351
- let t = e === null ? "null" : typeof e;
352
- if (t !== "string" && t !== "object")
353
- return `Unexpected doc '${t}',
354
- Expected it to be 'string' or 'object'.`;
355
- if (oe(e))
356
- throw new Error("doc is valid.");
357
- let u = Object.prototype.toString.call(e);
358
- if (u !== "[object Object]")
359
- return `Unexpected doc '${u}'.`;
360
- let r = Ar([...Yt].map((n) => `'${n}'`));
361
- return `Unexpected doc.type '${e.type}'.
362
- Expected it to be ${r}.`;
363
- }
364
- var kr = class extends Error {
365
- constructor(t) {
366
- super(wr(t));
367
- we(this, "name", "InvalidDocError");
368
- this.doc = t;
369
- }
370
- }, pe = kr, mt = {};
371
- function xr(e, t, u, r) {
372
- let n = [e];
373
- for (; n.length > 0; ) {
374
- let D = n.pop();
375
- if (D === mt) {
376
- u(n.pop());
377
- continue;
378
- }
379
- u && n.push(D, mt);
380
- let a = oe(D);
381
- if (!a)
382
- throw new pe(D);
383
- if ((t == null ? void 0 : t(D)) !== !1)
384
- switch (a) {
385
- case z:
386
- case R: {
387
- let i = a === z ? D : D.parts;
388
- for (let o = i.length, s = o - 1; s >= 0; --s)
389
- n.push(i[s]);
390
- break;
391
- }
392
- case T:
393
- n.push(D.flatContents, D.breakContents);
394
- break;
395
- case O:
396
- if (r && D.expandedStates)
397
- for (let i = D.expandedStates.length, o = i - 1; o >= 0; --o)
398
- n.push(D.expandedStates[o]);
399
- else
400
- n.push(D.contents);
401
- break;
402
- case U:
403
- case X:
404
- case H:
405
- case V:
406
- case G:
407
- n.push(D.contents);
408
- break;
409
- case ie:
410
- case ee:
411
- case q:
412
- case Y:
413
- case I:
414
- case j:
415
- break;
416
- default:
417
- throw new pe(D);
418
- }
419
- }
420
- }
421
- var nt = xr;
422
- function Pe(e, t) {
423
- if (typeof e == "string")
424
- return t(e);
425
- let u = /* @__PURE__ */ new Map();
426
- return r(e);
427
- function r(D) {
428
- if (u.has(D))
429
- return u.get(D);
430
- let a = n(D);
431
- return u.set(D, a), a;
432
- }
433
- function n(D) {
434
- switch (oe(D)) {
435
- case z:
436
- return t(D.map(r));
437
- case R:
438
- return t({ ...D, parts: D.parts.map(r) });
439
- case T:
440
- return t({ ...D, breakContents: r(D.breakContents), flatContents: r(D.flatContents) });
441
- case O: {
442
- let { expandedStates: a, contents: i } = D;
443
- return a ? (a = a.map(r), i = a[0]) : i = r(i), t({ ...D, contents: i, expandedStates: a });
444
- }
445
- case U:
446
- case X:
447
- case H:
448
- case V:
449
- case G:
450
- return t({ ...D, contents: r(D.contents) });
451
- case ie:
452
- case ee:
453
- case q:
454
- case Y:
455
- case I:
456
- case j:
457
- return t(D);
458
- default:
459
- throw new pe(D);
460
- }
461
- }
462
- }
463
- function Dt(e, t, u) {
464
- let r = u, n = !1;
465
- function D(a) {
466
- if (n)
467
- return !1;
468
- let i = t(a);
469
- i !== void 0 && (n = !0, r = i);
470
- }
471
- return nt(e, D), r;
472
- }
473
- function Sr(e) {
474
- if (e.type === O && e.break || e.type === I && e.hard || e.type === j)
475
- return !0;
476
- }
477
- function Ir(e) {
478
- return Dt(e, Sr, !1);
479
- }
480
- function yt(e) {
481
- if (e.length > 0) {
482
- let t = S(0, e, -1);
483
- !t.expandedStates && !t.break && (t.break = "propagated");
484
- }
485
- return null;
486
- }
487
- function Nr(e) {
488
- let t = /* @__PURE__ */ new Set(), u = [];
489
- function r(D) {
490
- if (D.type === j && yt(u), D.type === O) {
491
- if (u.push(D), t.has(D))
492
- return !1;
493
- t.add(D);
494
- }
495
- }
496
- function n(D) {
497
- D.type === O && u.pop().break && yt(u);
498
- }
499
- nt(e, r, n, !0);
500
- }
501
- function _r(e) {
502
- return e.type === I && !e.hard ? e.soft ? "" : " " : e.type === T ? e.flatContents : e;
503
- }
504
- function Or(e) {
505
- return Pe(e, _r);
506
- }
507
- function vt(e) {
508
- for (e = [...e]; e.length >= 2 && S(0, e, -2).type === I && S(0, e, -1).type === j; )
509
- e.length -= 2;
510
- if (e.length > 0) {
511
- let t = Ee(S(0, e, -1));
512
- e[e.length - 1] = t;
513
- }
514
- return e;
515
- }
516
- function Ee(e) {
517
- switch (oe(e)) {
518
- case X:
519
- case H:
520
- case O:
521
- case G:
522
- case V: {
523
- let t = Ee(e.contents);
524
- return { ...e, contents: t };
525
- }
526
- case T:
527
- return { ...e, breakContents: Ee(e.breakContents), flatContents: Ee(e.flatContents) };
528
- case R:
529
- return { ...e, parts: vt(e.parts) };
530
- case z:
531
- return vt(e);
532
- case ie:
533
- return Br(e);
534
- case U:
535
- case ee:
536
- case q:
537
- case Y:
538
- case I:
539
- case j:
540
- break;
541
- default:
542
- throw new pe(e);
543
- }
544
- return e;
545
- }
546
- function Qt(e) {
547
- return Ee(Pr(e));
548
- }
549
- function Tr(e) {
550
- switch (oe(e)) {
551
- case R:
552
- if (e.parts.every((t) => t === ""))
553
- return "";
554
- break;
555
- case O:
556
- if (!e.contents && !e.id && !e.break && !e.expandedStates)
557
- return "";
558
- if (e.contents.type === O && e.contents.id === e.id && e.contents.break === e.break && e.contents.expandedStates === e.expandedStates)
559
- return e.contents;
560
- break;
561
- case U:
562
- case X:
563
- case H:
564
- case G:
565
- if (!e.contents)
566
- return "";
567
- break;
568
- case T:
569
- if (!e.flatContents && !e.breakContents)
570
- return "";
571
- break;
572
- case z: {
573
- let t = [];
574
- for (let u of e) {
575
- if (!u)
576
- continue;
577
- let [r, ...n] = Array.isArray(u) ? u : [u];
578
- typeof r == "string" && typeof S(0, t, -1) == "string" ? t[t.length - 1] += r : t.push(r), t.push(...n);
579
- }
580
- return t.length === 0 ? "" : t.length === 1 ? t[0] : t;
581
- }
582
- case ie:
583
- case ee:
584
- case q:
585
- case Y:
586
- case I:
587
- case V:
588
- case j:
589
- break;
590
- default:
591
- throw new pe(e);
592
- }
593
- return e;
594
- }
595
- function Pr(e) {
596
- return Pe(e, (t) => Tr(t));
597
- }
598
- function jr(e, t = Du) {
599
- return Pe(e, (u) => typeof u == "string" ? uu(t, u.split(`
600
- `)) : u);
601
- }
602
- function Lr(e) {
603
- if (e.type === I)
604
- return !0;
605
- }
606
- function $r(e) {
607
- return Dt(e, Lr, !1);
608
- }
609
- function Se(e, t) {
610
- return e.type === V ? { ...e, contents: t(e.contents) } : t(e);
611
- }
612
- var Jr = Fr;
613
- function _e(e) {
614
- return { type: X, contents: e };
615
- }
616
- function he(e, t) {
617
- return { type: U, contents: t, n: e };
618
- }
619
- function Mr(e) {
620
- return he(Number.NEGATIVE_INFINITY, e);
621
- }
622
- function Zt(e) {
623
- return he({ type: "root" }, e);
624
- }
625
- function Rr(e) {
626
- return he(-1, e);
627
- }
628
- function eu(e, t, u) {
629
- let r = e;
630
- if (t > 0) {
631
- for (let n = 0; n < Math.floor(t / u); ++n)
632
- r = _e(r);
633
- r = he(t % u, r), r = he(Number.NEGATIVE_INFINITY, r);
634
- }
635
- return r;
636
- }
637
- var je = { type: j }, De = { type: ee };
638
- function Vr(e) {
639
- return { type: R, parts: e };
640
- }
641
- function tu(e, t = {}) {
642
- return Jr(t.expandedStates), { type: O, id: t.id, contents: e, break: !!t.shouldBreak, expandedStates: t.expandedStates };
643
- }
644
- function Wr(e, t) {
645
- return tu(e[0], { ...t, expandedStates: e });
646
- }
647
- function Kr(e, t = "", u = {}) {
648
- return { type: T, breakContents: e, flatContents: t, groupId: u.groupId };
649
- }
650
- function zr(e, t) {
651
- return { type: H, contents: e, groupId: t.groupId, negate: t.negate };
652
- }
653
- function uu(e, t) {
654
- let u = [];
655
- for (let r = 0; r < t.length; r++)
656
- r !== 0 && u.push(e), u.push(t[r]);
657
- return u;
658
- }
659
- function Xr(e, t) {
660
- return e ? { type: V, label: e, contents: t } : t;
661
- }
662
- var ru = { type: I }, Ur = { type: I, soft: !0 }, at = { type: I, hard: !0 }, K = [at, je], nu = { type: I, hard: !0, literal: !0 }, Du = [nu, je];
663
- function He(e) {
664
- return { type: G, contents: e };
665
- }
666
- var qr = { type: Y }, Hr = { type: q };
667
- function W(e) {
668
- var t;
669
- if (!e)
670
- return "";
671
- if (Array.isArray(e)) {
672
- let u = [];
673
- for (let r of e)
674
- if (Array.isArray(r))
675
- u.push(...W(r));
676
- else {
677
- let n = W(r);
678
- n !== "" && u.push(n);
679
- }
680
- return u;
681
- }
682
- return e.type === T ? { ...e, breakContents: W(e.breakContents), flatContents: W(e.flatContents) } : e.type === O ? { ...e, contents: W(e.contents), expandedStates: (t = e.expandedStates) == null ? void 0 : t.map(W) } : e.type === R ? { type: "fill", parts: e.parts.map(W) } : e.contents ? { ...e, contents: W(e.contents) } : e;
683
- }
684
- function Gr(e) {
685
- let t = /* @__PURE__ */ Object.create(null), u = /* @__PURE__ */ new Set();
686
- return r(W(e));
687
- function r(D, a, i) {
688
- var o, s;
689
- if (typeof D == "string")
690
- return JSON.stringify(D);
691
- if (Array.isArray(D)) {
692
- let l = D.map(r).filter(Boolean);
693
- return l.length === 1 ? l[0] : `[${l.join(", ")}]`;
694
- }
695
- if (D.type === I) {
696
- let l = ((o = i == null ? void 0 : i[a + 1]) == null ? void 0 : o.type) === j;
697
- return D.literal ? l ? "literalline" : "literallineWithoutBreakParent" : D.hard ? l ? "hardline" : "hardlineWithoutBreakParent" : D.soft ? "softline" : "line";
698
- }
699
- if (D.type === j)
700
- return ((s = i == null ? void 0 : i[a - 1]) == null ? void 0 : s.type) === I && i[a - 1].hard ? void 0 : "breakParent";
701
- if (D.type === q)
702
- return "trim";
703
- if (D.type === X)
704
- return "indent(" + r(D.contents) + ")";
705
- if (D.type === U)
706
- return D.n === Number.NEGATIVE_INFINITY ? "dedentToRoot(" + r(D.contents) + ")" : D.n < 0 ? "dedent(" + r(D.contents) + ")" : D.n.type === "root" ? "markAsRoot(" + r(D.contents) + ")" : "align(" + JSON.stringify(D.n) + ", " + r(D.contents) + ")";
707
- if (D.type === T)
708
- return "ifBreak(" + r(D.breakContents) + (D.flatContents ? ", " + r(D.flatContents) : "") + (D.groupId ? (D.flatContents ? "" : ', ""') + `, { groupId: ${n(D.groupId)} }` : "") + ")";
709
- if (D.type === H) {
710
- let l = [];
711
- D.negate && l.push("negate: true"), D.groupId && l.push(`groupId: ${n(D.groupId)}`);
712
- let f = l.length > 0 ? `, { ${l.join(", ")} }` : "";
713
- return `indentIfBreak(${r(D.contents)}${f})`;
714
- }
715
- if (D.type === O) {
716
- let l = [];
717
- D.break && D.break !== "propagated" && l.push("shouldBreak: true"), D.id && l.push(`id: ${n(D.id)}`);
718
- let f = l.length > 0 ? `, { ${l.join(", ")} }` : "";
719
- return D.expandedStates ? `conditionalGroup([${D.expandedStates.map((c) => r(c)).join(",")}]${f})` : `group(${r(D.contents)}${f})`;
720
- }
721
- if (D.type === R)
722
- return `fill([${D.parts.map((l) => r(l)).join(", ")}])`;
723
- if (D.type === G)
724
- return "lineSuffix(" + r(D.contents) + ")";
725
- if (D.type === Y)
726
- return "lineSuffixBoundary";
727
- if (D.type === V)
728
- return `label(${JSON.stringify(D.label)}, ${r(D.contents)})`;
729
- if (D.type === ee)
730
- return "cursor";
731
- throw new Error("Unknown doc type " + D.type);
732
- }
733
- function n(D) {
734
- if (typeof D != "symbol")
735
- return JSON.stringify(String(D));
736
- if (D in t)
737
- return t[D];
738
- let a = D.description || "symbol";
739
- for (let i = 0; ; i++) {
740
- let o = a + (i > 0 ? ` #${i}` : "");
741
- if (!u.has(o))
742
- return u.add(o), t[D] = `Symbol.for(${JSON.stringify(o)})`;
743
- }
744
- }
745
- }
746
- var Yr = () => /[#*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;
747
- function Qr(e) {
748
- return e === 12288 || e >= 65281 && e <= 65376 || e >= 65504 && e <= 65510;
749
- }
750
- function Zr(e) {
751
- return e >= 4352 && e <= 4447 || e === 8986 || e === 8987 || e === 9001 || e === 9002 || e >= 9193 && e <= 9196 || e === 9200 || e === 9203 || e === 9725 || e === 9726 || e === 9748 || e === 9749 || e >= 9776 && e <= 9783 || e >= 9800 && e <= 9811 || e === 9855 || e >= 9866 && e <= 9871 || e === 9875 || e === 9889 || e === 9898 || e === 9899 || e === 9917 || e === 9918 || e === 9924 || e === 9925 || e === 9934 || e === 9940 || e === 9962 || e === 9970 || e === 9971 || e === 9973 || e === 9978 || e === 9981 || e === 9989 || e === 9994 || e === 9995 || e === 10024 || e === 10060 || e === 10062 || e >= 10067 && e <= 10069 || e === 10071 || e >= 10133 && e <= 10135 || e === 10160 || e === 10175 || e === 11035 || e === 11036 || e === 11088 || e === 11093 || e >= 11904 && e <= 11929 || e >= 11931 && e <= 12019 || e >= 12032 && e <= 12245 || e >= 12272 && e <= 12287 || e >= 12289 && e <= 12350 || e >= 12353 && e <= 12438 || e >= 12441 && e <= 12543 || e >= 12549 && e <= 12591 || e >= 12593 && e <= 12686 || e >= 12688 && e <= 12773 || e >= 12783 && e <= 12830 || e >= 12832 && e <= 12871 || e >= 12880 && e <= 42124 || e >= 42128 && e <= 42182 || e >= 43360 && e <= 43388 || e >= 44032 && e <= 55203 || e >= 63744 && e <= 64255 || e >= 65040 && e <= 65049 || e >= 65072 && e <= 65106 || e >= 65108 && e <= 65126 || e >= 65128 && e <= 65131 || e >= 94176 && e <= 94180 || e >= 94192 && e <= 94198 || e >= 94208 && e <= 101589 || e >= 101631 && e <= 101662 || e >= 101760 && e <= 101874 || e >= 110576 && e <= 110579 || e >= 110581 && e <= 110587 || e === 110589 || e === 110590 || e >= 110592 && e <= 110882 || e === 110898 || e >= 110928 && e <= 110930 || e === 110933 || e >= 110948 && e <= 110951 || e >= 110960 && e <= 111355 || e >= 119552 && e <= 119638 || e >= 119648 && e <= 119670 || e === 126980 || e === 127183 || e === 127374 || e >= 127377 && e <= 127386 || e >= 127488 && e <= 127490 || e >= 127504 && e <= 127547 || e >= 127552 && e <= 127560 || e === 127568 || e === 127569 || e >= 127584 && e <= 127589 || e >= 127744 && e <= 127776 || e >= 127789 && e <= 127797 || e >= 127799 && e <= 127868 || e >= 127870 && e <= 127891 || e >= 127904 && e <= 127946 || e >= 127951 && e <= 127955 || e >= 127968 && e <= 127984 || e === 127988 || e >= 127992 && e <= 128062 || e === 128064 || e >= 128066 && e <= 128252 || e >= 128255 && e <= 128317 || e >= 128331 && e <= 128334 || e >= 128336 && e <= 128359 || e === 128378 || e === 128405 || e === 128406 || e === 128420 || e >= 128507 && e <= 128591 || e >= 128640 && e <= 128709 || e === 128716 || e >= 128720 && e <= 128722 || e >= 128725 && e <= 128728 || e >= 128732 && e <= 128735 || e === 128747 || e === 128748 || e >= 128756 && e <= 128764 || e >= 128992 && e <= 129003 || e === 129008 || e >= 129292 && e <= 129338 || e >= 129340 && e <= 129349 || e >= 129351 && e <= 129535 || e >= 129648 && e <= 129660 || e >= 129664 && e <= 129674 || e >= 129678 && e <= 129734 || e === 129736 || e >= 129741 && e <= 129756 || e >= 129759 && e <= 129770 || e >= 129775 && e <= 129784 || e >= 131072 && e <= 196605 || e >= 196608 && e <= 262141;
752
- }
753
- var en = "©®‼⁉™ℹ↔↕↖↗↘↙↩↪⌨⏏⏱⏲⏸⏹⏺▪▫▶◀◻◼☀☁☂☃☄☎☑☘☝☠☢☣☦☪☮☯☸☹☺♀♂♟♠♣♥♦♨♻♾⚒⚔⚕⚖⚗⚙⚛⚜⚠⚧⚰⚱⛈⛏⛑⛓⛩⛱⛷⛸⛹✂✈✉✌✍✏✒✔✖✝✡✳✴❄❇❣❤➡⤴⤵⬅⬆⬇", tn = /[^\x20-\x7F]/u, un = new Set(en);
754
- function rn(e) {
755
- if (!e)
756
- return 0;
757
- if (!tn.test(e))
758
- return e.length;
759
- e = e.replace(Yr(), (u) => un.has(u) ? " " : " ");
760
- let t = 0;
761
- for (let u of e) {
762
- let r = u.codePointAt(0);
763
- r <= 31 || r >= 127 && r <= 159 || r >= 768 && r <= 879 || r >= 65024 && r <= 65039 || (t += Qr(r) || Zr(r) ? 2 : 1);
764
- }
765
- return t;
766
- }
767
- var it = rn, nn = { type: 0 }, Dn = { type: 1 }, au = { value: "", length: 0, queue: [], get root() {
768
- return au;
769
- } };
770
- function iu(e, t, u) {
771
- let r = t.type === 1 ? e.queue.slice(0, -1) : [...e.queue, t], n = "", D = 0, a = 0, i = 0;
772
- for (let d of r)
773
- switch (d.type) {
774
- case 0:
775
- l(), u.useTabs ? o(1) : s(u.tabWidth);
776
- break;
777
- case 3: {
778
- let { string: p } = d;
779
- l(), n += p, D += p.length;
780
- break;
781
- }
782
- case 2: {
783
- let { width: p } = d;
784
- a += 1, i += p;
785
- break;
786
- }
787
- default:
788
- throw new Error(`Unexpected indent comment '${d.type}'.`);
789
- }
790
- return c(), { ...e, value: n, length: D, queue: r };
791
- function o(d) {
792
- n += " ".repeat(d), D += u.tabWidth * d;
793
- }
794
- function s(d) {
795
- n += " ".repeat(d), D += d;
796
- }
797
- function l() {
798
- u.useTabs ? f() : c();
799
- }
800
- function f() {
801
- a > 0 && o(a), F();
802
- }
803
- function c() {
804
- i > 0 && s(i), F();
805
- }
806
- function F() {
807
- a = 0, i = 0;
808
- }
809
- }
810
- function an(e, t, u) {
811
- if (!t)
812
- return e;
813
- if (t.type === "root")
814
- return { ...e, root: e };
815
- if (t === Number.NEGATIVE_INFINITY)
816
- return e.root;
817
- let r;
818
- return typeof t == "number" ? t < 0 ? r = Dn : r = { type: 2, width: t } : r = { type: 3, string: t }, iu(e, r, u);
819
- }
820
- function on(e, t) {
821
- return iu(e, nn, t);
822
- }
823
- function sn(e) {
824
- let t = 0;
825
- for (let u = e.length - 1; u >= 0; u--) {
826
- let r = e[u];
827
- if (r === " " || r === " ")
828
- t++;
829
- else
830
- break;
831
- }
832
- return t;
833
- }
834
- function ou(e) {
835
- let t = sn(e);
836
- return { text: t === 0 ? e : e.slice(0, e.length - t), count: t };
837
- }
838
- var _ = Symbol("MODE_BREAK"), J = Symbol("MODE_FLAT"), Ge = Symbol("DOC_FILL_PRINTED_LENGTH");
839
- function ke(e, t, u, r, n, D) {
840
- if (u === Number.POSITIVE_INFINITY)
841
- return !0;
842
- let a = t.length, i = !1, o = [e], s = "";
843
- for (; u >= 0; ) {
844
- if (o.length === 0) {
845
- if (a === 0)
846
- return !0;
847
- o.push(t[--a]);
848
- continue;
849
- }
850
- let { mode: l, doc: f } = o.pop(), c = oe(f);
851
- switch (c) {
852
- case ie:
853
- f && (i && (s += " ", u -= 1, i = !1), s += f, u -= it(f));
854
- break;
855
- case z:
856
- case R: {
857
- let F = c === z ? f : f.parts, d = f[Ge] ?? 0;
858
- for (let p = F.length - 1; p >= d; p--)
859
- o.push({ mode: l, doc: F[p] });
860
- break;
861
- }
862
- case X:
863
- case U:
864
- case H:
865
- case V:
866
- o.push({ mode: l, doc: f.contents });
867
- break;
868
- case q: {
869
- let { text: F, count: d } = ou(s);
870
- s = F, u += d;
871
- break;
872
- }
873
- case O: {
874
- if (D && f.break)
875
- return !1;
876
- let F = f.break ? _ : l, d = f.expandedStates && F === _ ? S(0, f.expandedStates, -1) : f.contents;
877
- o.push({ mode: F, doc: d });
878
- break;
879
- }
880
- case T: {
881
- let F = (f.groupId ? n[f.groupId] || J : l) === _ ? f.breakContents : f.flatContents;
882
- F && o.push({ mode: l, doc: F });
883
- break;
884
- }
885
- case I:
886
- if (l === _ || f.hard)
887
- return !0;
888
- f.soft || (i = !0);
889
- break;
890
- case G:
891
- r = !0;
892
- break;
893
- case Y:
894
- if (r)
895
- return !1;
896
- break;
897
- }
898
- }
899
- return !1;
900
- }
901
- function Le(e, t) {
902
- let u = /* @__PURE__ */ Object.create(null), r = t.printWidth, n = rt(t.endOfLine), D = 0, a = [{ indent: au, mode: _, doc: e }], i = "", o = !1, s = [], l = [], f = [], c = [], F = 0;
903
- for (Nr(e); a.length > 0; ) {
904
- let { indent: m, mode: b, doc: C } = a.pop();
905
- switch (oe(C)) {
906
- case ie: {
907
- let y = n !== `
908
- ` ? Oe(0, C, `
909
- `, n) : C;
910
- y && (i += y, a.length > 0 && (D += it(y)));
911
- break;
912
- }
913
- case z:
914
- for (let y = C.length - 1; y >= 0; y--)
915
- a.push({ indent: m, mode: b, doc: C[y] });
916
- break;
917
- case ee:
918
- if (l.length >= 2)
919
- throw new Error("There are too many 'cursor' in doc.");
920
- l.push(F + i.length);
921
- break;
922
- case X:
923
- a.push({ indent: on(m, t), mode: b, doc: C.contents });
924
- break;
925
- case U:
926
- a.push({ indent: an(m, C.n, t), mode: b, doc: C.contents });
927
- break;
928
- case q:
929
- g();
930
- break;
931
- case O:
932
- switch (b) {
933
- case J:
934
- if (!o) {
935
- a.push({ indent: m, mode: C.break ? _ : J, doc: C.contents });
936
- break;
937
- }
938
- case _: {
939
- o = !1;
940
- let y = { indent: m, mode: J, doc: C.contents }, w = r - D, x = s.length > 0;
941
- if (!C.break && ke(y, a, w, x, u))
942
- a.push(y);
943
- else if (C.expandedStates) {
944
- let L = S(0, C.expandedStates, -1);
945
- if (C.break) {
946
- a.push({ indent: m, mode: _, doc: L });
947
- break;
948
- } else
949
- for (let $ = 1; $ < C.expandedStates.length + 1; $++)
950
- if ($ >= C.expandedStates.length) {
951
- a.push({ indent: m, mode: _, doc: L });
952
- break;
953
- } else {
954
- let v = C.expandedStates[$], B = { indent: m, mode: J, doc: v };
955
- if (ke(B, a, w, x, u)) {
956
- a.push(B);
957
- break;
958
- }
959
- }
960
- } else
961
- a.push({ indent: m, mode: _, doc: C.contents });
962
- break;
963
- }
964
- }
965
- C.id && (u[C.id] = S(0, a, -1).mode);
966
- break;
967
- case R: {
968
- let y = r - D, w = C[Ge] ?? 0, { parts: x } = C, L = x.length - w;
969
- if (L === 0)
970
- break;
971
- let $ = x[w + 0], v = x[w + 1], B = { indent: m, mode: J, doc: $ }, se = { indent: m, mode: _, doc: $ }, h = ke(B, [], y, s.length > 0, u, !0);
972
- if (L === 1) {
973
- h ? a.push(B) : a.push(se);
974
- break;
975
- }
976
- let P = { indent: m, mode: J, doc: v }, le = { indent: m, mode: _, doc: v };
977
- if (L === 2) {
978
- h ? a.push(P, B) : a.push(le, se);
979
- break;
980
- }
981
- let N = x[w + 2], ue = { indent: m, mode: b, doc: { ...C, [Ge]: w + 2 } }, A = ke({ indent: m, mode: J, doc: [$, v, N] }, [], y, s.length > 0, u, !0);
982
- a.push(ue), A ? a.push(P, B) : h ? a.push(le, B) : a.push(le, se);
983
- break;
984
- }
985
- case T:
986
- case H: {
987
- let y = C.groupId ? u[C.groupId] : b;
988
- if (y === _) {
989
- let w = C.type === T ? C.breakContents : C.negate ? C.contents : _e(C.contents);
990
- w && a.push({ indent: m, mode: b, doc: w });
991
- }
992
- if (y === J) {
993
- let w = C.type === T ? C.flatContents : C.negate ? _e(C.contents) : C.contents;
994
- w && a.push({ indent: m, mode: b, doc: w });
995
- }
996
- break;
997
- }
998
- case G:
999
- s.push({ indent: m, mode: b, doc: C.contents });
1000
- break;
1001
- case Y:
1002
- s.length > 0 && a.push({ indent: m, mode: b, doc: at });
1003
- break;
1004
- case I:
1005
- switch (b) {
1006
- case J:
1007
- if (C.hard)
1008
- o = !0;
1009
- else {
1010
- C.soft || (i += " ", D += 1);
1011
- break;
1012
- }
1013
- case _:
1014
- if (s.length > 0) {
1015
- a.push({ indent: m, mode: b, doc: C }, ...s.reverse()), s.length = 0;
1016
- break;
1017
- }
1018
- C.literal ? (i += n, D = 0, m.root && (m.root.value && (i += m.root.value), D = m.root.length)) : (g(), i += n + m.value, D = m.length);
1019
- break;
1020
- }
1021
- break;
1022
- case V:
1023
- a.push({ indent: m, mode: b, doc: C.contents });
1024
- break;
1025
- case j:
1026
- break;
1027
- default:
1028
- throw new pe(C);
1029
- }
1030
- a.length === 0 && s.length > 0 && (a.push(...s.reverse()), s.length = 0);
1031
- }
1032
- let d = f.join("") + i, p = [...c, ...l];
1033
- if (p.length !== 2)
1034
- return { formatted: d };
1035
- let E = p[0];
1036
- return { formatted: d, cursorNodeStart: E, cursorNodeText: d.slice(E, S(0, p, -1)) };
1037
- function g() {
1038
- let { text: m, count: b } = ou(i);
1039
- m && (f.push(m), F += m.length), i = "", D -= b, l.length > 0 && (c.push(...l.map((C) => Math.min(C, F))), l.length = 0);
1040
- }
1041
- }
1042
- function ln(e, t, u = 0) {
1043
- let r = 0;
1044
- for (let n = u; n < e.length; ++n)
1045
- e[n] === " " ? r = r + t - r % t : r++;
1046
- return r;
1047
- }
1048
- var ot = ln, ve, Ye, de, Ie, Xt, cn = (Xt = class {
1049
- constructor(e) {
1050
- Me(this, ve);
1051
- Me(this, de);
1052
- this.stack = [e];
1053
- }
1054
- get key() {
1055
- let { stack: e, siblings: t } = this;
1056
- return S(0, e, t === null ? -2 : -4) ?? null;
1057
- }
1058
- get index() {
1059
- return this.siblings === null ? null : S(0, this.stack, -2);
1060
- }
1061
- get node() {
1062
- return S(0, this.stack, -1);
1063
- }
1064
- get parent() {
1065
- return this.getNode(1);
1066
- }
1067
- get grandparent() {
1068
- return this.getNode(2);
1069
- }
1070
- get isInArray() {
1071
- return this.siblings !== null;
1072
- }
1073
- get siblings() {
1074
- let { stack: e } = this, t = S(0, e, -3);
1075
- return Array.isArray(t) ? t : null;
1076
- }
1077
- get next() {
1078
- let { siblings: e } = this;
1079
- return e === null ? null : e[this.index + 1];
1080
- }
1081
- get previous() {
1082
- let { siblings: e } = this;
1083
- return e === null ? null : e[this.index - 1];
1084
- }
1085
- get isFirst() {
1086
- return this.index === 0;
1087
- }
1088
- get isLast() {
1089
- let { siblings: e, index: t } = this;
1090
- return e !== null && t === e.length - 1;
1091
- }
1092
- get isRoot() {
1093
- return this.stack.length === 1;
1094
- }
1095
- get root() {
1096
- return this.stack[0];
1097
- }
1098
- get ancestors() {
1099
- return [...ce(this, de, Ie).call(this)];
1100
- }
1101
- getName() {
1102
- let { stack: e } = this, { length: t } = e;
1103
- return t > 1 ? S(0, e, -2) : null;
1104
- }
1105
- getValue() {
1106
- return S(0, this.stack, -1);
1107
- }
1108
- getNode(e = 0) {
1109
- let t = ce(this, ve, Ye).call(this, e);
1110
- return t === -1 ? null : this.stack[t];
1111
- }
1112
- getParentNode(e = 0) {
1113
- return this.getNode(e + 1);
1114
- }
1115
- call(e, ...t) {
1116
- let { stack: u } = this, { length: r } = u, n = S(0, u, -1);
1117
- for (let D of t)
1118
- n = n == null ? void 0 : n[D], u.push(D, n);
1119
- try {
1120
- return e(this);
1121
- } finally {
1122
- u.length = r;
1123
- }
1124
- }
1125
- callParent(e, t = 0) {
1126
- let u = ce(this, ve, Ye).call(this, t + 1), r = this.stack.splice(u + 1);
1127
- try {
1128
- return e(this);
1129
- } finally {
1130
- this.stack.push(...r);
1131
- }
1132
- }
1133
- each(e, ...t) {
1134
- let { stack: u } = this, { length: r } = u, n = S(0, u, -1);
1135
- for (let D of t)
1136
- n = n[D], u.push(D, n);
1137
- try {
1138
- for (let D = 0; D < n.length; ++D)
1139
- u.push(D, n[D]), e(this, D, n), u.length -= 2;
1140
- } finally {
1141
- u.length = r;
1142
- }
1143
- }
1144
- map(e, ...t) {
1145
- let u = [];
1146
- return this.each((r, n, D) => {
1147
- u[n] = e(r, n, D);
1148
- }, ...t), u;
1149
- }
1150
- match(...e) {
1151
- let t = this.stack.length - 1, u = null, r = this.stack[t--];
1152
- for (let n of e) {
1153
- if (r === void 0)
1154
- return !1;
1155
- let D = null;
1156
- if (typeof u == "number" && (D = u, u = this.stack[t--], r = this.stack[t--]), n && !n(r, u, D))
1157
- return !1;
1158
- u = this.stack[t--], r = this.stack[t--];
1159
- }
1160
- return !0;
1161
- }
1162
- findAncestor(e) {
1163
- for (let t of ce(this, de, Ie).call(this))
1164
- if (e(t))
1165
- return t;
1166
- }
1167
- hasAncestor(e) {
1168
- for (let t of ce(this, de, Ie).call(this))
1169
- if (e(t))
1170
- return !0;
1171
- return !1;
1172
- }
1173
- }, ve = new WeakSet(), Ye = function(e) {
1174
- let { stack: t } = this;
1175
- for (let u = t.length - 1; u >= 0; u -= 2)
1176
- if (!Array.isArray(t[u]) && --e < 0)
1177
- return u;
1178
- return -1;
1179
- }, de = new WeakSet(), Ie = function* () {
1180
- let { stack: e } = this;
1181
- for (let t = e.length - 3; t >= 0; t -= 2) {
1182
- let u = e[t];
1183
- Array.isArray(u) || (yield u);
1184
- }
1185
- }, Xt), fn = cn;
1186
- function Fn(e) {
1187
- return e !== null && typeof e == "object";
1188
- }
1189
- var st = Fn;
1190
- function be(e) {
1191
- return (t, u, r) => {
1192
- let n = !!(r != null && r.backwards);
1193
- if (u === !1)
1194
- return !1;
1195
- let { length: D } = t, a = u;
1196
- for (; a >= 0 && a < D; ) {
1197
- let i = t.charAt(a);
1198
- if (e instanceof RegExp) {
1199
- if (!e.test(i))
1200
- return a;
1201
- } else if (!e.includes(i))
1202
- return a;
1203
- n ? a-- : a++;
1204
- }
1205
- return a === -1 || a === D ? a : !1;
1206
- };
1207
- }
1208
- var dn = be(/\s/u), Z = be(" "), su = be(",; "), lu = be(/[^\n\r]/u), Bt = (e) => e === `
1209
- ` || e === "\r" || e === "\u2028" || e === "\u2029";
1210
- function pn(e, t, u) {
1211
- let r = !!(u != null && u.backwards);
1212
- if (t === !1)
1213
- return !1;
1214
- let n = e.charAt(t);
1215
- if (r) {
1216
- if (e.charAt(t - 1) === "\r" && n === `
1217
- `)
1218
- return t - 2;
1219
- if (Bt(n))
1220
- return t - 1;
1221
- } else {
1222
- if (n === "\r" && e.charAt(t + 1) === `
1223
- `)
1224
- return t + 2;
1225
- if (Bt(n))
1226
- return t + 1;
1227
- }
1228
- return t;
1229
- }
1230
- var ae = pn;
1231
- function hn(e, t, u = {}) {
1232
- let r = Z(e, u.backwards ? t - 1 : t, u), n = ae(e, r, u);
1233
- return r !== n;
1234
- }
1235
- var Q = hn;
1236
- function Cn(e) {
1237
- return Array.isArray(e) && e.length > 0;
1238
- }
1239
- var gn = Cn;
1240
- function* $e(e, t) {
1241
- let { getVisitorKeys: u, filter: r = () => !0 } = t, n = (D) => st(D) && r(D);
1242
- for (let D of u(e)) {
1243
- let a = e[D];
1244
- if (Array.isArray(a))
1245
- for (let i of a)
1246
- n(i) && (yield i);
1247
- else
1248
- n(a) && (yield a);
1249
- }
1250
- }
1251
- function* En(e, t) {
1252
- let u = [e];
1253
- for (let r = 0; r < u.length; r++) {
1254
- let n = u[r];
1255
- for (let D of $e(n, t))
1256
- yield D, u.push(D);
1257
- }
1258
- }
1259
- function mn(e, t) {
1260
- return $e(e, t).next().done;
1261
- }
1262
- function cu(e, t, u) {
1263
- var s;
1264
- let { cache: r } = u;
1265
- if (r.has(e))
1266
- return r.get(e);
1267
- let { filter: n } = u;
1268
- if (!n)
1269
- return [];
1270
- let D, a = (((s = u.getChildren) == null ? void 0 : s.call(u, e, u)) ?? [...$e(e, { getVisitorKeys: u.getVisitorKeys })]).flatMap((l) => (D ?? (D = [e, ...t]), n(l, D) ? [l] : cu(l, D, u))), { locStart: i, locEnd: o } = u;
1271
- return a.sort((l, f) => i(l) - i(f) || o(l) - o(f)), r.set(e, a), a;
1272
- }
1273
- var fu = cu;
1274
- function yn(e) {
1275
- let t = e.type || e.kind || "(unknown type)", u = String(e.name || e.id && (typeof e.id == "object" ? e.id.name : e.id) || e.key && (typeof e.key == "object" ? e.key.name : e.key) || e.value && (typeof e.value == "object" ? "" : String(e.value)) || e.operator || "");
1276
- return u.length > 20 && (u = u.slice(0, 19) + "…"), t + (u ? " " + u : "");
1277
- }
1278
- function lt(e, t) {
1279
- (e.comments ?? (e.comments = [])).push(t), t.printed = !1, t.nodeDescription = yn(e);
1280
- }
1281
- function me(e, t) {
1282
- t.leading = !0, t.trailing = !1, lt(e, t);
1283
- }
1284
- function re(e, t, u) {
1285
- t.leading = !1, t.trailing = !1, u && (t.marker = u), lt(e, t);
1286
- }
1287
- function ye(e, t) {
1288
- t.leading = !1, t.trailing = !0, lt(e, t);
1289
- }
1290
- var Fu = /* @__PURE__ */ new WeakMap();
1291
- function du(e, t, u, r, n = []) {
1292
- let { locStart: D, locEnd: a } = u, i = D(t), o = a(t), s = fu(e, n, { cache: Fu, locStart: D, locEnd: a, getVisitorKeys: u.getVisitorKeys, filter: u.printer.canAttachComment, getChildren: u.printer.getCommentChildNodes }), l, f, c = 0, F = s.length;
1293
- for (; c < F; ) {
1294
- let d = c + F >> 1, p = s[d], E = D(p), g = a(p);
1295
- if (E <= i && o <= g)
1296
- return du(p, t, u, p, [p, ...n]);
1297
- if (g <= i) {
1298
- l = p, c = d + 1;
1299
- continue;
1300
- }
1301
- if (o <= E) {
1302
- f = p, F = d;
1303
- continue;
1304
- }
1305
- throw new Error("Comment location overlaps with node location");
1306
- }
1307
- if ((r == null ? void 0 : r.type) === "TemplateLiteral") {
1308
- let { quasis: d } = r, p = Ve(d, t, u);
1309
- l && Ve(d, l, u) !== p && (l = null), f && Ve(d, f, u) !== p && (f = null);
1310
- }
1311
- return { enclosingNode: r, precedingNode: l, followingNode: f };
1312
- }
1313
- var Re = () => !1;
1314
- function vn(e, t) {
1315
- let { comments: u } = e;
1316
- if (delete e.comments, !gn(u) || !t.printer.canAttachComment)
1317
- return;
1318
- let r = [], { printer: { features: { experimental_avoidAstMutation: n }, handleComments: D = {} }, originalText: a } = t, { ownLine: i = Re, endOfLine: o = Re, remaining: s = Re } = D, l = u.map((f, c) => ({ ...du(e, f, t), comment: f, text: a, options: t, ast: e, isLastComment: u.length - 1 === c }));
1319
- for (let [f, c] of l.entries()) {
1320
- let { comment: F, precedingNode: d, enclosingNode: p, followingNode: E, text: g, options: m, ast: b, isLastComment: C } = c, y;
1321
- if (n ? y = [c] : (F.enclosingNode = p, F.precedingNode = d, F.followingNode = E, y = [F, g, m, b, C]), Bn(g, m, l, f))
1322
- F.placement = "ownLine", i(...y) || (E ? me(E, F) : d ? ye(d, F) : re(p || b, F));
1323
- else if (bn(g, m, l, f))
1324
- F.placement = "endOfLine", o(...y) || (d ? ye(d, F) : E ? me(E, F) : re(p || b, F));
1325
- else if (F.placement = "remaining", !s(...y))
1326
- if (d && E) {
1327
- let w = r.length;
1328
- w > 0 && r[w - 1].followingNode !== E && bt(r, m), r.push(c);
1329
- } else
1330
- d ? ye(d, F) : E ? me(E, F) : re(p || b, F);
1331
- }
1332
- if (bt(r, t), !n)
1333
- for (let f of u)
1334
- delete f.precedingNode, delete f.enclosingNode, delete f.followingNode;
1335
- }
1336
- var pu = (e) => !/[\S\n\u2028\u2029]/u.test(e);
1337
- function Bn(e, t, u, r) {
1338
- let { comment: n, precedingNode: D } = u[r], { locStart: a, locEnd: i } = t, o = a(n);
1339
- if (D)
1340
- for (let s = r - 1; s >= 0; s--) {
1341
- let { comment: l, precedingNode: f } = u[s];
1342
- if (f !== D || !pu(e.slice(i(l), o)))
1343
- break;
1344
- o = a(l);
1345
- }
1346
- return Q(e, o, { backwards: !0 });
1347
- }
1348
- function bn(e, t, u, r) {
1349
- let { comment: n, followingNode: D } = u[r], { locStart: a, locEnd: i } = t, o = i(n);
1350
- if (D)
1351
- for (let s = r + 1; s < u.length; s++) {
1352
- let { comment: l, followingNode: f } = u[s];
1353
- if (f !== D || !pu(e.slice(o, a(l))))
1354
- break;
1355
- o = i(l);
1356
- }
1357
- return Q(e, o);
1358
- }
1359
- function bt(e, t) {
1360
- var i, o;
1361
- let u = e.length;
1362
- if (u === 0)
1363
- return;
1364
- let { precedingNode: r, followingNode: n } = e[0], D = t.locStart(n), a;
1365
- for (a = u; a > 0; --a) {
1366
- let { comment: s, precedingNode: l, followingNode: f } = e[a - 1], c = t.originalText.slice(t.locEnd(s), D);
1367
- if (((o = (i = t.printer).isGap) == null ? void 0 : o.call(i, c, t)) ?? /^[\s(]*$/u.test(c))
1368
- D = t.locStart(s);
1369
- else
1370
- break;
1371
- }
1372
- for (let [s, { comment: l }] of e.entries())
1373
- s < a ? ye(r, l) : me(n, l);
1374
- for (let s of [r, n])
1375
- s.comments && s.comments.length > 1 && s.comments.sort((l, f) => t.locStart(l) - t.locStart(f));
1376
- e.length = 0;
1377
- }
1378
- function Ve(e, t, u) {
1379
- let r = u.locStart(t) - 1;
1380
- for (let n = 1; n < e.length; ++n)
1381
- if (r < u.locStart(e[n]))
1382
- return n - 1;
1383
- return 0;
1384
- }
1385
- function An(e, t) {
1386
- let u = t - 1;
1387
- u = Z(e, u, { backwards: !0 }), u = ae(e, u, { backwards: !0 }), u = Z(e, u, { backwards: !0 });
1388
- let r = ae(e, u, { backwards: !0 });
1389
- return u !== r;
1390
- }
1391
- var ct = An;
1392
- function hu(e, t) {
1393
- let u = e.node;
1394
- return u.printed = !0, t.printer.printComment(e, t);
1395
- }
1396
- function wn(e, t) {
1397
- var s;
1398
- let u = e.node, r = [hu(e, t)], { printer: n, originalText: D, locStart: a, locEnd: i } = t;
1399
- if ((s = n.isBlockComment) != null && s.call(n, u)) {
1400
- let l = Q(D, i(u)) ? Q(D, a(u), { backwards: !0 }) ? K : ru : " ";
1401
- r.push(l);
1402
- } else
1403
- r.push(K);
1404
- let o = ae(D, Z(D, i(u)));
1405
- return o !== !1 && Q(D, o) && r.push(K), r;
1406
- }
1407
- function kn(e, t, u) {
1408
- var s;
1409
- let r = e.node, n = hu(e, t), { printer: D, originalText: a, locStart: i } = t, o = (s = D.isBlockComment) == null ? void 0 : s.call(D, r);
1410
- if (u != null && u.hasLineSuffix && !(u != null && u.isBlock) || Q(a, i(r), { backwards: !0 })) {
1411
- let l = ct(a, i(r));
1412
- return { doc: He([K, l ? K : "", n]), isBlock: o, hasLineSuffix: !0 };
1413
- }
1414
- return !o || u != null && u.hasLineSuffix ? { doc: [He([" ", n]), je], isBlock: o, hasLineSuffix: !0 } : { doc: [" ", n], isBlock: o, hasLineSuffix: !1 };
1415
- }
1416
- function xn(e, t) {
1417
- let u = e.node;
1418
- if (!u)
1419
- return {};
1420
- let r = t[Symbol.for("printedComments")];
1421
- if ((u.comments || []).filter((i) => !r.has(i)).length === 0)
1422
- return { leading: "", trailing: "" };
1423
- let n = [], D = [], a;
1424
- return e.each(() => {
1425
- let i = e.node;
1426
- if (r != null && r.has(i))
1427
- return;
1428
- let { leading: o, trailing: s } = i;
1429
- o ? n.push(wn(e, t)) : s && (a = kn(e, t, a), D.push(a.doc));
1430
- }, "comments"), { leading: n, trailing: D };
1431
- }
1432
- function Sn(e, t, u) {
1433
- let { leading: r, trailing: n } = xn(e, u);
1434
- return !r && !n ? t : Se(t, (D) => [r, D, n]);
1435
- }
1436
- function In(e) {
1437
- let { [Symbol.for("comments")]: t, [Symbol.for("printedComments")]: u } = e;
1438
- for (let r of t) {
1439
- if (!r.printed && !u.has(r))
1440
- throw new Error('Comment "' + r.value.trim() + '" was not printed. Please report this error!');
1441
- delete r.printed;
1442
- }
1443
- }
1444
- var Cu = class extends Error {
1445
- constructor() {
1446
- super(...arguments);
1447
- we(this, "name", "ConfigError");
1448
- }
1449
- }, At = class extends Error {
1450
- constructor() {
1451
- super(...arguments);
1452
- we(this, "name", "UndefinedParserError");
1453
- }
1454
- }, Nn = { checkIgnorePragma: { category: "Special", type: "boolean", default: !1, description: "Check whether the file's first docblock comment contains '@noprettier' or '@noformat' to determine if it should be formatted.", cliCategory: "Other" }, cursorOffset: { category: "Special", type: "int", default: -1, range: { start: -1, end: 1 / 0, step: 1 }, description: "Print (to stderr) where a cursor at the given position would move to after formatting.", cliCategory: "Editor" }, endOfLine: { category: "Global", type: "choice", default: "lf", description: "Which end of line characters to apply.", choices: [{ value: "lf", description: "Line Feed only (\\n), common on Linux and macOS as well as inside git repos" }, { value: "crlf", description: "Carriage Return + Line Feed characters (\\r\\n), common on Windows" }, { value: "cr", description: "Carriage Return character only (\\r), used very rarely" }, { value: "auto", description: `Maintain existing
1455
- (mixed values within one file are normalised by looking at what's used after the first line)` }] }, filepath: { category: "Special", type: "path", description: "Specify the input filepath. This will be used to do parser inference.", cliName: "stdin-filepath", cliCategory: "Other", cliDescription: "Path to the file to pretend that stdin comes from." }, insertPragma: { category: "Special", type: "boolean", default: !1, description: "Insert @format pragma into file's first docblock comment.", cliCategory: "Other" }, parser: { category: "Global", type: "choice", default: void 0, description: "Which parser to use.", exception: (e) => typeof e == "string" || typeof e == "function", choices: [{ value: "flow", description: "Flow" }, { value: "babel", description: "JavaScript" }, { value: "babel-flow", description: "Flow" }, { value: "babel-ts", description: "TypeScript" }, { value: "typescript", description: "TypeScript" }, { value: "acorn", description: "JavaScript" }, { value: "espree", description: "JavaScript" }, { value: "meriyah", description: "JavaScript" }, { value: "css", description: "CSS" }, { value: "less", description: "Less" }, { value: "scss", description: "SCSS" }, { value: "json", description: "JSON" }, { value: "json5", description: "JSON5" }, { value: "jsonc", description: "JSON with Comments" }, { value: "json-stringify", description: "JSON.stringify" }, { value: "graphql", description: "GraphQL" }, { value: "markdown", description: "Markdown" }, { value: "mdx", description: "MDX" }, { value: "vue", description: "Vue" }, { value: "yaml", description: "YAML" }, { value: "glimmer", description: "Ember / Handlebars" }, { value: "html", description: "HTML" }, { value: "angular", description: "Angular" }, { value: "lwc", description: "Lightning Web Components" }, { value: "mjml", description: "MJML" }] }, plugins: { type: "path", array: !0, default: [{ value: [] }], category: "Global", description: "Add a plugin. Multiple plugins can be passed as separate `--plugin`s.", exception: (e) => typeof e == "string" || typeof e == "object", cliName: "plugin", cliCategory: "Config" }, printWidth: { category: "Global", type: "int", default: 80, description: "The line length where Prettier will try wrap.", range: { start: 0, end: 1 / 0, step: 1 } }, rangeEnd: { category: "Special", type: "int", default: 1 / 0, range: { start: 0, end: 1 / 0, step: 1 }, description: `Format code ending at a given character offset (exclusive).
1456
- The range will extend forwards to the end of the selected statement.`, cliCategory: "Editor" }, rangeStart: { category: "Special", type: "int", default: 0, range: { start: 0, end: 1 / 0, step: 1 }, description: `Format code starting at a given character offset.
1457
- The range will extend backwards to the start of the first line containing the selected statement.`, cliCategory: "Editor" }, requirePragma: { category: "Special", type: "boolean", default: !1, description: "Require either '@prettier' or '@format' to be present in the file's first docblock comment in order for it to be formatted.", cliCategory: "Other" }, tabWidth: { type: "int", category: "Global", default: 2, description: "Number of spaces per indentation level.", range: { start: 0, end: 1 / 0, step: 1 } }, useTabs: { category: "Global", type: "boolean", default: !1, description: "Indent with tabs instead of spaces." }, embeddedLanguageFormatting: { category: "Global", type: "choice", default: "auto", description: "Control how Prettier formats quoted code embedded in the file.", choices: [{ value: "auto", description: "Format embedded code if Prettier can automatically identify it." }, { value: "off", description: "Never automatically format embedded code." }] } };
1458
- function gu({ plugins: e = [], showDeprecated: t = !1 } = {}) {
1459
- let u = e.flatMap((n) => n.languages ?? []), r = [];
1460
- for (let n of On(Object.assign({}, ...e.map(({ options: D }) => D), Nn)))
1461
- !t && n.deprecated || (Array.isArray(n.choices) && (t || (n.choices = n.choices.filter((D) => !D.deprecated)), n.name === "parser" && (n.choices = [...n.choices, ..._n(n.choices, u, e)])), n.pluginDefaults = Object.fromEntries(e.filter((D) => {
1462
- var a;
1463
- return ((a = D.defaultOptions) == null ? void 0 : a[n.name]) !== void 0;
1464
- }).map((D) => [D.name, D.defaultOptions[n.name]])), r.push(n));
1465
- return { languages: u, options: r };
1466
- }
1467
- function* _n(e, t, u) {
1468
- let r = new Set(e.map((n) => n.value));
1469
- for (let n of t)
1470
- if (n.parsers) {
1471
- for (let D of n.parsers)
1472
- if (!r.has(D)) {
1473
- r.add(D);
1474
- let a = u.find((o) => o.parsers && Object.prototype.hasOwnProperty.call(o.parsers, D)), i = n.name;
1475
- a != null && a.name && (i += ` (plugin: ${a.name})`), yield { value: D, description: i };
1476
- }
1477
- }
1478
- }
1479
- function On(e) {
1480
- let t = [];
1481
- for (let [u, r] of Object.entries(e)) {
1482
- let n = { name: u, ...r };
1483
- Array.isArray(n.default) && (n.default = S(0, n.default, -1).value), t.push(n);
1484
- }
1485
- return t;
1486
- }
1487
- var Tn = Array.prototype.toReversed ?? function() {
1488
- return [...this].reverse();
1489
- }, Pn = Be("toReversed", function() {
1490
- if (Array.isArray(this))
1491
- return Tn;
1492
- }), jn = Pn;
1493
- function Ln() {
1494
- var u, r, n, D, a, i;
1495
- let e = globalThis, t = (r = (u = e.Deno) == null ? void 0 : u.build) == null ? void 0 : r.os;
1496
- return typeof t == "string" ? t === "windows" : ((D = (n = e.navigator) == null ? void 0 : n.platform) == null ? void 0 : D.startsWith("Win")) ?? ((i = (a = e.process) == null ? void 0 : a.platform) == null ? void 0 : i.startsWith("win")) ?? !1;
1497
- }
1498
- var $n = Ln();
1499
- function Eu(e) {
1500
- if (e = e instanceof URL ? e : new URL(e), e.protocol !== "file:")
1501
- throw new TypeError(`URL must be a file URL: received "${e.protocol}"`);
1502
- return e;
1503
- }
1504
- function Jn(e) {
1505
- return e = Eu(e), decodeURIComponent(e.pathname.replace(/%(?![0-9A-Fa-f]{2})/g, "%25"));
1506
- }
1507
- function Mn(e) {
1508
- e = Eu(e);
1509
- let t = decodeURIComponent(e.pathname.replace(/\//g, "\\").replace(/%(?![0-9A-Fa-f]{2})/g, "%25")).replace(/^\\*([A-Za-z]:)(\\|$)/, "$1\\");
1510
- return e.hostname !== "" && (t = `\\\\${e.hostname}${t}`), t;
1511
- }
1512
- function Rn(e) {
1513
- return $n ? Mn(e) : Jn(e);
1514
- }
1515
- var Vn = (e) => String(e).split(/[/\\]/u).pop(), Wn = (e) => String(e).startsWith("file:");
1516
- function wt(e, t) {
1517
- if (!t)
1518
- return;
1519
- let u = Vn(t).toLowerCase();
1520
- return e.find(({ filenames: r }) => r == null ? void 0 : r.some((n) => n.toLowerCase() === u)) ?? e.find(({ extensions: r }) => r == null ? void 0 : r.some((n) => u.endsWith(n)));
1521
- }
1522
- function Kn(e, t) {
1523
- if (t)
1524
- return e.find(({ name: u }) => u.toLowerCase() === t) ?? e.find(({ aliases: u }) => u == null ? void 0 : u.includes(t)) ?? e.find(({ extensions: u }) => u == null ? void 0 : u.includes(`.${t}`));
1525
- }
1526
- var We = void 0;
1527
- function kt(e, t) {
1528
- if (t) {
1529
- if (Wn(t))
1530
- try {
1531
- t = Rn(t);
1532
- } catch {
1533
- return;
1534
- }
1535
- if (typeof t == "string")
1536
- return e.find(({ isSupported: u }) => u == null ? void 0 : u({ filepath: t }));
1537
- }
1538
- }
1539
- function zn(e, t) {
1540
- var r;
1541
- let u = jn(0, e.plugins).flatMap((n) => n.languages ?? []);
1542
- return (r = Kn(u, t.language) ?? wt(u, t.physicalFile) ?? wt(u, t.file) ?? kt(u, t.physicalFile) ?? kt(u, t.file) ?? (We == null ? void 0 : We(u, t.physicalFile))) == null ? void 0 : r.parsers[0];
1543
- }
1544
- var mu = zn, Fe = { key: (e) => /^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(e) ? e : JSON.stringify(e), value(e) {
1545
- if (e === null || typeof e != "object")
1546
- return JSON.stringify(e);
1547
- if (Array.isArray(e))
1548
- return `[${e.map((u) => Fe.value(u)).join(", ")}]`;
1549
- let t = Object.keys(e);
1550
- return t.length === 0 ? "{}" : `{ ${t.map((u) => `${Fe.key(u)}: ${Fe.value(e[u])}`).join(", ")} }`;
1551
- }, pair: ({ key: e, value: t }) => Fe.value({ [e]: t }) }, ft = new Proxy(String, { get: () => ft }), M = ft, yu = () => ft, Xn = (e, t, { descriptor: u }) => {
1552
- let r = [`${M.yellow(typeof e == "string" ? u.key(e) : u.pair(e))} is deprecated`];
1553
- return t && r.push(`we now treat it as ${M.blue(typeof t == "string" ? u.key(t) : u.pair(t))}`), r.join("; ") + ".";
1554
- }, vu = Symbol.for("vnopts.VALUE_NOT_EXIST"), Ne = Symbol.for("vnopts.VALUE_UNCHANGED"), xt = " ".repeat(2), Un = (e, t, u) => {
1555
- let { text: r, list: n } = u.normalizeExpectedResult(u.schemas[e].expected(u)), D = [];
1556
- return r && D.push(St(e, t, r, u.descriptor)), n && D.push([St(e, t, n.title, u.descriptor)].concat(n.values.map((a) => Bu(a, u.loggerPrintWidth))).join(`
1557
- `)), bu(D, u.loggerPrintWidth);
1558
- };
1559
- function St(e, t, u, r) {
1560
- return [`Invalid ${M.red(r.key(e))} value.`, `Expected ${M.blue(u)},`, `but received ${t === vu ? M.gray("nothing") : M.red(r.value(t))}.`].join(" ");
1561
- }
1562
- function Bu({ text: e, list: t }, u) {
1563
- let r = [];
1564
- return e && r.push(`- ${M.blue(e)}`), t && r.push([`- ${M.blue(t.title)}:`].concat(t.values.map((n) => Bu(n, u - xt.length).replace(/^|\n/g, `$&${xt}`))).join(`
1565
- `)), bu(r, u);
1566
- }
1567
- function bu(e, t) {
1568
- if (e.length === 1)
1569
- return e[0];
1570
- let [u, r] = e, [n, D] = e.map((a) => a.split(`
1571
- `, 1)[0].length);
1572
- return n > t && n > D ? r : u;
1573
- }
1574
- var fe = [], Ke = [];
1575
- function ze(e, t, u) {
1576
- if (e === t)
1577
- return 0;
1578
- let r = u == null ? void 0 : u.maxDistance, n = e;
1579
- e.length > t.length && (e = t, t = n);
1580
- let D = e.length, a = t.length;
1581
- for (; D > 0 && e.charCodeAt(~-D) === t.charCodeAt(~-a); )
1582
- D--, a--;
1583
- let i = 0;
1584
- for (; i < D && e.charCodeAt(i) === t.charCodeAt(i); )
1585
- i++;
1586
- if (D -= i, a -= i, r !== void 0 && a - D > r)
1587
- return r;
1588
- if (D === 0)
1589
- return r !== void 0 && a > r ? r : a;
1590
- let o, s, l, f, c = 0, F = 0;
1591
- for (; c < D; )
1592
- Ke[c] = e.charCodeAt(i + c), fe[c] = ++c;
1593
- for (; F < a; ) {
1594
- for (o = t.charCodeAt(i + F), l = F++, s = F, c = 0; c < D; c++)
1595
- f = o === Ke[c] ? l : l + 1, l = fe[c], s = fe[c] = l > s ? f > s ? s + 1 : f : f > l ? l + 1 : f;
1596
- if (r !== void 0) {
1597
- let d = s;
1598
- for (c = 0; c < D; c++)
1599
- fe[c] < d && (d = fe[c]);
1600
- if (d > r)
1601
- return r;
1602
- }
1603
- }
1604
- return fe.length = D, Ke.length = D, r !== void 0 && s > r ? r : s;
1605
- }
1606
- function qn(e, t, u) {
1607
- if (!Array.isArray(t) || t.length === 0)
1608
- return;
1609
- let r = u == null ? void 0 : u.maxDistance, n = e.length;
1610
- for (let o of t)
1611
- if (o === e)
1612
- return o;
1613
- if (r === 0)
1614
- return;
1615
- let D, a = Number.POSITIVE_INFINITY, i = /* @__PURE__ */ new Set();
1616
- for (let o of t) {
1617
- if (i.has(o))
1618
- continue;
1619
- i.add(o);
1620
- let s = Math.abs(o.length - n);
1621
- if (s >= a || r !== void 0 && s > r)
1622
- continue;
1623
- let l = Number.isFinite(a) ? r === void 0 ? a : Math.min(a, r) : r, f = l === void 0 ? ze(e, o) : ze(e, o, { maxDistance: l });
1624
- if (r !== void 0 && f > r)
1625
- continue;
1626
- let c = f;
1627
- if (l !== void 0 && f === l && l === r && (c = ze(e, o)), c < a && (a = c, D = o, a === 0))
1628
- break;
1629
- }
1630
- if (!(r !== void 0 && a > r))
1631
- return D;
1632
- }
1633
- var Au = (e, t, { descriptor: u, logger: r, schemas: n }) => {
1634
- let D = [`Ignored unknown option ${M.yellow(u.pair({ key: e, value: t }))}.`], a = qn(e, Object.keys(n), { maxDistance: 3 });
1635
- a && D.push(`Did you mean ${M.blue(u.key(a))}?`), r.warn(D.join(" "));
1636
- }, Hn = ["default", "expected", "validate", "deprecated", "forward", "redirect", "overlap", "preprocess", "postprocess"];
1637
- function Gn(e, t) {
1638
- let u = new e(t), r = Object.create(u);
1639
- for (let n of Hn)
1640
- n in t && (r[n] = Yn(t[n], u, te.prototype[n].length));
1641
- return r;
1642
- }
1643
- var te = class {
1644
- static create(e) {
1645
- return Gn(this, e);
1646
- }
1647
- constructor(e) {
1648
- this.name = e.name;
1649
- }
1650
- default(e) {
1651
- }
1652
- expected(e) {
1653
- return "nothing";
1654
- }
1655
- validate(e, t) {
1656
- return !1;
1657
- }
1658
- deprecated(e, t) {
1659
- return !1;
1660
- }
1661
- forward(e, t) {
1662
- }
1663
- redirect(e, t) {
1664
- }
1665
- overlap(e, t, u) {
1666
- return e;
1667
- }
1668
- preprocess(e, t) {
1669
- return e;
1670
- }
1671
- postprocess(e, t) {
1672
- return Ne;
1673
- }
1674
- };
1675
- function Yn(e, t, u) {
1676
- return typeof e == "function" ? (...r) => e(...r.slice(0, u - 1), t, ...r.slice(u - 1)) : () => e;
1677
- }
1678
- var Qn = class extends te {
1679
- constructor(e) {
1680
- super(e), this._sourceName = e.sourceName;
1681
- }
1682
- expected(e) {
1683
- return e.schemas[this._sourceName].expected(e);
1684
- }
1685
- validate(e, t) {
1686
- return t.schemas[this._sourceName].validate(e, t);
1687
- }
1688
- redirect(e, t) {
1689
- return this._sourceName;
1690
- }
1691
- }, Zn = class extends te {
1692
- expected() {
1693
- return "anything";
1694
- }
1695
- validate() {
1696
- return !0;
1697
- }
1698
- }, eD = class extends te {
1699
- constructor({ valueSchema: e, name: t = e.name, ...u }) {
1700
- super({ ...u, name: t }), this._valueSchema = e;
1701
- }
1702
- expected(e) {
1703
- let { text: t, list: u } = e.normalizeExpectedResult(this._valueSchema.expected(e));
1704
- return { text: t && `an array of ${t}`, list: u && { title: "an array of the following values", values: [{ list: u }] } };
1705
- }
1706
- validate(e, t) {
1707
- if (!Array.isArray(e))
1708
- return !1;
1709
- let u = [];
1710
- for (let r of e) {
1711
- let n = t.normalizeValidateResult(this._valueSchema.validate(r, t), r);
1712
- n !== !0 && u.push(n.value);
1713
- }
1714
- return u.length === 0 ? !0 : { value: u };
1715
- }
1716
- deprecated(e, t) {
1717
- let u = [];
1718
- for (let r of e) {
1719
- let n = t.normalizeDeprecatedResult(this._valueSchema.deprecated(r, t), r);
1720
- n !== !1 && u.push(...n.map(({ value: D }) => ({ value: [D] })));
1721
- }
1722
- return u;
1723
- }
1724
- forward(e, t) {
1725
- let u = [];
1726
- for (let r of e) {
1727
- let n = t.normalizeForwardResult(this._valueSchema.forward(r, t), r);
1728
- u.push(...n.map(It));
1729
- }
1730
- return u;
1731
- }
1732
- redirect(e, t) {
1733
- let u = [], r = [];
1734
- for (let n of e) {
1735
- let D = t.normalizeRedirectResult(this._valueSchema.redirect(n, t), n);
1736
- "remain" in D && u.push(D.remain), r.push(...D.redirect.map(It));
1737
- }
1738
- return u.length === 0 ? { redirect: r } : { redirect: r, remain: u };
1739
- }
1740
- overlap(e, t) {
1741
- return e.concat(t);
1742
- }
1743
- };
1744
- function It({ from: e, to: t }) {
1745
- return { from: [e], to: t };
1746
- }
1747
- var tD = class extends te {
1748
- expected() {
1749
- return "true or false";
1750
- }
1751
- validate(e) {
1752
- return typeof e == "boolean";
1753
- }
1754
- };
1755
- function uD(e, t) {
1756
- let u = /* @__PURE__ */ Object.create(null);
1757
- for (let r of e) {
1758
- let n = r[t];
1759
- if (u[n])
1760
- throw new Error(`Duplicate ${t} ${JSON.stringify(n)}`);
1761
- u[n] = r;
1762
- }
1763
- return u;
1764
- }
1765
- function rD(e, t) {
1766
- let u = /* @__PURE__ */ new Map();
1767
- for (let r of e) {
1768
- let n = r[t];
1769
- if (u.has(n))
1770
- throw new Error(`Duplicate ${t} ${JSON.stringify(n)}`);
1771
- u.set(n, r);
1772
- }
1773
- return u;
1774
- }
1775
- function nD() {
1776
- let e = /* @__PURE__ */ Object.create(null);
1777
- return (t) => {
1778
- let u = JSON.stringify(t);
1779
- return e[u] ? !0 : (e[u] = !0, !1);
1780
- };
1781
- }
1782
- function DD(e, t) {
1783
- let u = [], r = [];
1784
- for (let n of e)
1785
- t(n) ? u.push(n) : r.push(n);
1786
- return [u, r];
1787
- }
1788
- function aD(e) {
1789
- return e === Math.floor(e);
1790
- }
1791
- function iD(e, t) {
1792
- if (e === t)
1793
- return 0;
1794
- let u = typeof e, r = typeof t, n = ["undefined", "object", "boolean", "number", "string"];
1795
- return u !== r ? n.indexOf(u) - n.indexOf(r) : u !== "string" ? Number(e) - Number(t) : e.localeCompare(t);
1796
- }
1797
- function oD(e) {
1798
- return (...t) => {
1799
- let u = e(...t);
1800
- return typeof u == "string" ? new Error(u) : u;
1801
- };
1802
- }
1803
- function Nt(e) {
1804
- return e === void 0 ? {} : e;
1805
- }
1806
- function wu(e) {
1807
- if (typeof e == "string")
1808
- return { text: e };
1809
- let { text: t, list: u } = e;
1810
- return sD((t || u) !== void 0, "Unexpected `expected` result, there should be at least one field."), u ? { text: t, list: { title: u.title, values: u.values.map(wu) } } : { text: t };
1811
- }
1812
- function _t(e, t) {
1813
- return e === !0 ? !0 : e === !1 ? { value: t } : e;
1814
- }
1815
- function Ot(e, t, u = !1) {
1816
- return e === !1 ? !1 : e === !0 ? u ? !0 : [{ value: t }] : "value" in e ? [e] : e.length === 0 ? !1 : e;
1817
- }
1818
- function Tt(e, t) {
1819
- return typeof e == "string" || "key" in e ? { from: t, to: e } : "from" in e ? { from: e.from, to: e.to } : { from: t, to: e.to };
1820
- }
1821
- function Qe(e, t) {
1822
- return e === void 0 ? [] : Array.isArray(e) ? e.map((u) => Tt(u, t)) : [Tt(e, t)];
1823
- }
1824
- function Pt(e, t) {
1825
- let u = Qe(typeof e == "object" && "redirect" in e ? e.redirect : e, t);
1826
- return u.length === 0 ? { remain: t, redirect: u } : typeof e == "object" && "remain" in e ? { remain: e.remain, redirect: u } : { redirect: u };
1827
- }
1828
- function sD(e, t) {
1829
- if (!e)
1830
- throw new Error(t);
1831
- }
1832
- var lD = class extends te {
1833
- constructor(e) {
1834
- super(e), this._choices = rD(e.choices.map((t) => t && typeof t == "object" ? t : { value: t }), "value");
1835
- }
1836
- expected({ descriptor: e }) {
1837
- let t = Array.from(this._choices.keys()).map((n) => this._choices.get(n)).filter(({ hidden: n }) => !n).map((n) => n.value).sort(iD).map(e.value), u = t.slice(0, -2), r = t.slice(-2);
1838
- return { text: u.concat(r.join(" or ")).join(", "), list: { title: "one of the following values", values: t } };
1839
- }
1840
- validate(e) {
1841
- return this._choices.has(e);
1842
- }
1843
- deprecated(e) {
1844
- let t = this._choices.get(e);
1845
- return t && t.deprecated ? { value: e } : !1;
1846
- }
1847
- forward(e) {
1848
- let t = this._choices.get(e);
1849
- return t ? t.forward : void 0;
1850
- }
1851
- redirect(e) {
1852
- let t = this._choices.get(e);
1853
- return t ? t.redirect : void 0;
1854
- }
1855
- }, cD = class extends te {
1856
- expected() {
1857
- return "a number";
1858
- }
1859
- validate(e, t) {
1860
- return typeof e == "number";
1861
- }
1862
- }, fD = class extends cD {
1863
- expected() {
1864
- return "an integer";
1865
- }
1866
- validate(e, t) {
1867
- return t.normalizeValidateResult(super.validate(e, t), e) === !0 && aD(e);
1868
- }
1869
- }, jt = class extends te {
1870
- expected() {
1871
- return "a string";
1872
- }
1873
- validate(e) {
1874
- return typeof e == "string";
1875
- }
1876
- }, FD = Fe, dD = Au, pD = Un, hD = Xn, CD = class {
1877
- constructor(e, t) {
1878
- let { logger: u = console, loggerPrintWidth: r = 80, descriptor: n = FD, unknown: D = dD, invalid: a = pD, deprecated: i = hD, missing: o = () => !1, required: s = () => !1, preprocess: l = (c) => c, postprocess: f = () => Ne } = t || {};
1879
- this._utils = { descriptor: n, logger: u || { warn: () => {
1880
- } }, loggerPrintWidth: r, schemas: uD(e, "name"), normalizeDefaultResult: Nt, normalizeExpectedResult: wu, normalizeDeprecatedResult: Ot, normalizeForwardResult: Qe, normalizeRedirectResult: Pt, normalizeValidateResult: _t }, this._unknownHandler = D, this._invalidHandler = oD(a), this._deprecatedHandler = i, this._identifyMissing = (c, F) => !(c in F) || o(c, F), this._identifyRequired = s, this._preprocess = l, this._postprocess = f, this.cleanHistory();
1881
- }
1882
- cleanHistory() {
1883
- this._hasDeprecationWarned = nD();
1884
- }
1885
- normalize(e) {
1886
- let t = {}, u = [this._preprocess(e, this._utils)], r = () => {
1887
- for (; u.length !== 0; ) {
1888
- let n = u.shift(), D = this._applyNormalization(n, t);
1889
- u.push(...D);
1890
- }
1891
- };
1892
- r();
1893
- for (let n of Object.keys(this._utils.schemas)) {
1894
- let D = this._utils.schemas[n];
1895
- if (!(n in t)) {
1896
- let a = Nt(D.default(this._utils));
1897
- "value" in a && u.push({ [n]: a.value });
1898
- }
1899
- }
1900
- r();
1901
- for (let n of Object.keys(this._utils.schemas)) {
1902
- if (!(n in t))
1903
- continue;
1904
- let D = this._utils.schemas[n], a = t[n], i = D.postprocess(a, this._utils);
1905
- i !== Ne && (this._applyValidation(i, n, D), t[n] = i);
1906
- }
1907
- return this._applyPostprocess(t), this._applyRequiredCheck(t), t;
1908
- }
1909
- _applyNormalization(e, t) {
1910
- let u = [], { knownKeys: r, unknownKeys: n } = this._partitionOptionKeys(e);
1911
- for (let D of r) {
1912
- let a = this._utils.schemas[D], i = a.preprocess(e[D], this._utils);
1913
- this._applyValidation(i, D, a);
1914
- let o = ({ from: f, to: c }) => {
1915
- u.push(typeof c == "string" ? { [c]: f } : { [c.key]: c.value });
1916
- }, s = ({ value: f, redirectTo: c }) => {
1917
- let F = Ot(a.deprecated(f, this._utils), i, !0);
1918
- if (F !== !1)
1919
- if (F === !0)
1920
- this._hasDeprecationWarned(D) || this._utils.logger.warn(this._deprecatedHandler(D, c, this._utils));
1921
- else
1922
- for (let { value: d } of F) {
1923
- let p = { key: D, value: d };
1924
- if (!this._hasDeprecationWarned(p)) {
1925
- let E = typeof c == "string" ? { key: c, value: d } : c;
1926
- this._utils.logger.warn(this._deprecatedHandler(p, E, this._utils));
1927
- }
1928
- }
1929
- };
1930
- Qe(a.forward(i, this._utils), i).forEach(o);
1931
- let l = Pt(a.redirect(i, this._utils), i);
1932
- if (l.redirect.forEach(o), "remain" in l) {
1933
- let f = l.remain;
1934
- t[D] = D in t ? a.overlap(t[D], f, this._utils) : f, s({ value: f });
1935
- }
1936
- for (let { from: f, to: c } of l.redirect)
1937
- s({ value: f, redirectTo: c });
1938
- }
1939
- for (let D of n) {
1940
- let a = e[D];
1941
- this._applyUnknownHandler(D, a, t, (i, o) => {
1942
- u.push({ [i]: o });
1943
- });
1944
- }
1945
- return u;
1946
- }
1947
- _applyRequiredCheck(e) {
1948
- for (let t of Object.keys(this._utils.schemas))
1949
- if (this._identifyMissing(t, e) && this._identifyRequired(t))
1950
- throw this._invalidHandler(t, vu, this._utils);
1951
- }
1952
- _partitionOptionKeys(e) {
1953
- let [t, u] = DD(Object.keys(e).filter((r) => !this._identifyMissing(r, e)), (r) => r in this._utils.schemas);
1954
- return { knownKeys: t, unknownKeys: u };
1955
- }
1956
- _applyValidation(e, t, u) {
1957
- let r = _t(u.validate(e, this._utils), e);
1958
- if (r !== !0)
1959
- throw this._invalidHandler(t, r.value, this._utils);
1960
- }
1961
- _applyUnknownHandler(e, t, u, r) {
1962
- let n = this._unknownHandler(e, t, this._utils);
1963
- if (n)
1964
- for (let D of Object.keys(n)) {
1965
- if (this._identifyMissing(D, n))
1966
- continue;
1967
- let a = n[D];
1968
- D in this._utils.schemas ? r(D, a) : u[D] = a;
1969
- }
1970
- }
1971
- _applyPostprocess(e) {
1972
- let t = this._postprocess(e, this._utils);
1973
- if (t !== Ne) {
1974
- if (t.delete)
1975
- for (let u of t.delete)
1976
- delete e[u];
1977
- if (t.override) {
1978
- let { knownKeys: u, unknownKeys: r } = this._partitionOptionKeys(t.override);
1979
- for (let n of u) {
1980
- let D = t.override[n];
1981
- this._applyValidation(D, n, this._utils.schemas[n]), e[n] = D;
1982
- }
1983
- for (let n of r) {
1984
- let D = t.override[n];
1985
- this._applyUnknownHandler(n, D, e, (a, i) => {
1986
- let o = this._utils.schemas[a];
1987
- this._applyValidation(i, a, o), e[a] = i;
1988
- });
1989
- }
1990
- }
1991
- }
1992
- }
1993
- }, Xe;
1994
- function gD(e, t, { logger: u = !1, isCLI: r = !1, passThrough: n = !1, FlagSchema: D, descriptor: a } = {}) {
1995
- if (r) {
1996
- if (!D)
1997
- throw new Error("'FlagSchema' option is required.");
1998
- if (!a)
1999
- throw new Error("'descriptor' option is required.");
2000
- } else
2001
- a = Fe;
2002
- let i = n ? Array.isArray(n) ? (c, F) => n.includes(c) ? { [c]: F } : void 0 : (c, F) => ({ [c]: F }) : (c, F, d) => {
2003
- let { _: p, ...E } = d.schemas;
2004
- return Au(c, F, { ...d, schemas: E });
2005
- }, o = ED(t, { isCLI: r, FlagSchema: D }), s = new CD(o, { logger: u, unknown: i, descriptor: a }), l = u !== !1;
2006
- l && Xe && (s._hasDeprecationWarned = Xe);
2007
- let f = s.normalize(e);
2008
- return l && (Xe = s._hasDeprecationWarned), f;
2009
- }
2010
- function ED(e, { isCLI: t, FlagSchema: u }) {
2011
- let r = [];
2012
- t && r.push(Zn.create({ name: "_" }));
2013
- for (let n of e)
2014
- r.push(mD(n, { isCLI: t, optionInfos: e, FlagSchema: u })), n.alias && t && r.push(Qn.create({ name: n.alias, sourceName: n.name }));
2015
- return r;
2016
- }
2017
- function mD(e, { isCLI: t, optionInfos: u, FlagSchema: r }) {
2018
- let { name: n } = e, D = { name: n }, a, i = {};
2019
- switch (e.type) {
2020
- case "int":
2021
- a = fD, t && (D.preprocess = Number);
2022
- break;
2023
- case "string":
2024
- a = jt;
2025
- break;
2026
- case "choice":
2027
- a = lD, D.choices = e.choices.map((o) => o != null && o.redirect ? { ...o, redirect: { to: { key: e.name, value: o.redirect } } } : o);
2028
- break;
2029
- case "boolean":
2030
- a = tD;
2031
- break;
2032
- case "flag":
2033
- a = r, D.flags = u.flatMap((o) => [o.alias, o.description && o.name, o.oppositeDescription && `no-${o.name}`].filter(Boolean));
2034
- break;
2035
- case "path":
2036
- a = jt;
2037
- break;
2038
- default:
2039
- throw new Error(`Unexpected type ${e.type}`);
2040
- }
2041
- if (e.exception ? D.validate = (o, s, l) => e.exception(o) || s.validate(o, l) : D.validate = (o, s, l) => o === void 0 || s.validate(o, l), e.redirect && (i.redirect = (o) => o ? { to: typeof e.redirect == "string" ? e.redirect : { key: e.redirect.option, value: e.redirect.value } } : void 0), e.deprecated && (i.deprecated = !0), t && !e.array) {
2042
- let o = D.preprocess || ((s) => s);
2043
- D.preprocess = (s, l, f) => l.preprocess(o(Array.isArray(s) ? S(0, s, -1) : s), f);
2044
- }
2045
- return e.array ? eD.create({ ...t ? { preprocess: (o) => Array.isArray(o) ? o : [o] } : {}, ...i, valueSchema: a.create(D) }) : a.create({ ...D, ...i });
2046
- }
2047
- var yD = gD, vD = Array.prototype.findLast ?? function(e) {
2048
- for (let t = this.length - 1; t >= 0; t--) {
2049
- let u = this[t];
2050
- if (e(u, t, this))
2051
- return u;
2052
- }
2053
- }, BD = Be("findLast", function() {
2054
- if (Array.isArray(this))
2055
- return vD;
2056
- }), ku = BD, bD = Symbol.for("PRETTIER_IS_FRONT_MATTER"), AD = [];
2057
- function wD(e) {
2058
- return !!(e != null && e[bD]);
2059
- }
2060
- var Ft = wD, xu = /* @__PURE__ */ new Set(["yaml", "toml"]), Su = ({ node: e }) => Ft(e) && xu.has(e.language);
2061
- async function kD(e, t, u, r) {
2062
- let { node: n } = u, { language: D } = n;
2063
- if (!xu.has(D))
2064
- return;
2065
- let a = n.value.trim(), i;
2066
- if (a) {
2067
- let o = D === "yaml" ? D : mu(r, { language: D });
2068
- if (!o)
2069
- return;
2070
- i = a ? await e(a, { parser: o }) : "";
2071
- } else
2072
- i = a;
2073
- return Zt([n.startDelimiter, n.explicitLanguage ?? "", K, i, i ? K : "", n.endDelimiter]);
2074
- }
2075
- function xD(e, t) {
2076
- return Su({ node: e }) && (delete t.end, delete t.raw, delete t.value), t;
2077
- }
2078
- var SD = xD;
2079
- function ID({ node: e }) {
2080
- return e.raw;
2081
- }
2082
- var ND = ID, Iu = /* @__PURE__ */ new Set(["tokens", "comments", "parent", "enclosingNode", "precedingNode", "followingNode"]), _D = (e) => Object.keys(e).filter((t) => !Iu.has(t));
2083
- function OD(e, t) {
2084
- let u = e ? (r) => e(r, Iu) : _D;
2085
- return t ? new Proxy(u, { apply: (r, n, D) => Ft(D[0]) ? AD : Reflect.apply(r, n, D) }) : u;
2086
- }
2087
- var Lt = OD;
2088
- function Nu(e, t) {
2089
- if (!t)
2090
- throw new Error("parserName is required.");
2091
- let u = ku(0, e, (n) => n.parsers && Object.prototype.hasOwnProperty.call(n.parsers, t));
2092
- if (u)
2093
- return u;
2094
- let r = `Couldn't resolve parser "${t}".`;
2095
- throw r += " Plugins must be explicitly added to the standalone bundle.", new Cu(r);
2096
- }
2097
- function TD(e, t) {
2098
- if (!t)
2099
- throw new Error("astFormat is required.");
2100
- let u = ku(0, e, (n) => n.printers && Object.prototype.hasOwnProperty.call(n.printers, t));
2101
- if (u)
2102
- return u;
2103
- let r = `Couldn't find plugin for AST format "${t}".`;
2104
- throw r += " Plugins must be explicitly added to the standalone bundle.", new Cu(r);
2105
- }
2106
- function dt({ plugins: e, parser: t }) {
2107
- let u = Nu(e, t);
2108
- return _u(u, t);
2109
- }
2110
- function _u(e, t) {
2111
- let u = e.parsers[t];
2112
- return typeof u == "function" ? u() : u;
2113
- }
2114
- async function PD(e, t) {
2115
- let u = e.printers[t], r = typeof u == "function" ? await u() : u;
2116
- return jD(r);
2117
- }
2118
- var Ue = /* @__PURE__ */ new WeakMap();
2119
- function jD(e) {
2120
- if (Ue.has(e))
2121
- return Ue.get(e);
2122
- let { features: t, getVisitorKeys: u, embed: r, massageAstNode: n, print: D, ...a } = e;
2123
- t = MD(t);
2124
- let i = t.experimental_frontMatterSupport;
2125
- u = Lt(u, i.massageAstNode || i.embed || i.print);
2126
- let o = n;
2127
- n && i.massageAstNode && (o = new Proxy(n, { apply(c, F, d) {
2128
- return SD(...d), Reflect.apply(c, F, d);
2129
- } }));
2130
- let s = r;
2131
- if (r) {
2132
- let c;
2133
- s = new Proxy(r, { get(F, d, p) {
2134
- return d === "getVisitorKeys" ? (c ?? (c = r.getVisitorKeys ? Lt(r.getVisitorKeys, i.massageAstNode || i.embed) : u), c) : Reflect.get(F, d, p);
2135
- }, apply: (F, d, p) => i.embed && Su(...p) ? kD : Reflect.apply(F, d, p) });
2136
- }
2137
- let l = D;
2138
- i.print && (l = new Proxy(D, { apply(c, F, d) {
2139
- let [p] = d;
2140
- return Ft(p.node) ? ND(p) : Reflect.apply(c, F, d);
2141
- } }));
2142
- let f = { features: t, getVisitorKeys: u, embed: s, massageAstNode: o, print: l, ...a };
2143
- return Ue.set(e, f), f;
2144
- }
2145
- var LD = ["clean", "embed", "print"], $D = Object.fromEntries(LD.map((e) => [e, !1]));
2146
- function JD(e) {
2147
- return { ...$D, ...e };
2148
- }
2149
- function MD(e) {
2150
- return { experimental_avoidAstMutation: !1, ...e, experimental_frontMatterSupport: JD(e == null ? void 0 : e.experimental_frontMatterSupport) };
2151
- }
2152
- var $t = { astFormat: "estree", printer: {}, originalText: void 0, locStart: null, locEnd: null, getVisitorKeys: null };
2153
- async function RD(e, t = {}) {
2154
- var f;
2155
- let u = { ...e };
2156
- if (!u.parser)
2157
- if (u.filepath) {
2158
- if (u.parser = mu(u, { physicalFile: u.filepath }), !u.parser)
2159
- throw new At(`No parser could be inferred for file "${u.filepath}".`);
2160
- } else
2161
- throw new At("No parser and no file path given, couldn't infer a parser.");
2162
- let r = gu({ plugins: e.plugins, showDeprecated: !0 }).options, n = { ...$t, ...Object.fromEntries(r.filter((c) => c.default !== void 0).map((c) => [c.name, c.default])) }, D = Nu(u.plugins, u.parser), a = await _u(D, u.parser);
2163
- u.astFormat = a.astFormat, u.locEnd = a.locEnd, u.locStart = a.locStart;
2164
- let i = (f = D.printers) != null && f[a.astFormat] ? D : TD(u.plugins, a.astFormat), o = await PD(i, a.astFormat);
2165
- u.printer = o, u.getVisitorKeys = o.getVisitorKeys;
2166
- let s = i.defaultOptions ? Object.fromEntries(Object.entries(i.defaultOptions).filter(([, c]) => c !== void 0)) : {}, l = { ...n, ...s };
2167
- for (let [c, F] of Object.entries(l))
2168
- (u[c] === null || u[c] === void 0) && (u[c] = F);
2169
- return u.parser === "json" && (u.trailingComma = "none"), yD(u, r, { passThrough: Object.keys($t), ...t });
2170
- }
2171
- var Ce = RD;
2172
- rr(nr(), 1);
2173
- var pt = { keyword: ["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete"], strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"], strictBind: ["eval", "arguments"] };
2174
- new Set(pt.keyword);
2175
- new Set(pt.strict);
2176
- new Set(pt.strictBind);
2177
- var xe = (e, t) => (u) => e(t(u));
2178
- function Ou(e) {
2179
- return { keyword: e.cyan, capitalized: e.yellow, jsxIdentifier: e.yellow, punctuator: e.yellow, number: e.magenta, string: e.green, regex: e.magenta, comment: e.gray, invalid: xe(xe(e.white, e.bgRed), e.bold), gutter: e.gray, marker: xe(e.red, e.bold), message: xe(e.red, e.bold), reset: e.reset };
2180
- }
2181
- Ou(yu());
2182
- Ou(yu());
2183
- function VD() {
2184
- return new Proxy({}, { get: () => (e) => e });
2185
- }
2186
- var Jt = /\r\n|[\n\r\u2028\u2029]/;
2187
- function WD(e, t, u) {
2188
- let r = Object.assign({ column: 0, line: -1 }, e.start), n = Object.assign({}, r, e.end), { linesAbove: D = 2, linesBelow: a = 3 } = u || {}, i = r.line, o = r.column, s = n.line, l = n.column, f = Math.max(i - (D + 1), 0), c = Math.min(t.length, s + a);
2189
- i === -1 && (f = 0), s === -1 && (c = t.length);
2190
- let F = s - i, d = {};
2191
- if (F)
2192
- for (let p = 0; p <= F; p++) {
2193
- let E = p + i;
2194
- if (!o)
2195
- d[E] = !0;
2196
- else if (p === 0) {
2197
- let g = t[E - 1].length;
2198
- d[E] = [o, g - o + 1];
2199
- } else if (p === F)
2200
- d[E] = [0, l];
2201
- else {
2202
- let g = t[E - p].length;
2203
- d[E] = [0, g];
2204
- }
2205
- }
2206
- else
2207
- o === l ? o ? d[i] = [o, 0] : d[i] = !0 : d[i] = [o, l - o];
2208
- return { start: f, end: c, markerLines: d };
2209
- }
2210
- function KD(e, t, u = {}) {
2211
- let r = VD(), n = e.split(Jt), { start: D, end: a, markerLines: i } = WD(t, n, u), o = t.start && typeof t.start.column == "number", s = String(a).length, l = e.split(Jt, a).slice(D, a).map((f, c) => {
2212
- let F = D + 1 + c, d = ` ${` ${F}`.slice(-s)} |`, p = i[F], E = !i[F + 1];
2213
- if (p) {
2214
- let g = "";
2215
- if (Array.isArray(p)) {
2216
- let m = f.slice(0, Math.max(p[0] - 1, 0)).replace(/[^\t]/g, " "), b = p[1] || 1;
2217
- g = [`
2218
- `, r.gutter(d.replace(/\d/g, " ")), " ", m, r.marker("^").repeat(b)].join(""), E && u.message && (g += " " + r.message(u.message));
2219
- }
2220
- return [r.marker(">"), r.gutter(d), f.length > 0 ? ` ${f}` : "", g].join("");
2221
- } else
2222
- return ` ${r.gutter(d)}${f.length > 0 ? ` ${f}` : ""}`;
2223
- }).join(`
2224
- `);
2225
- return u.message && !o && (l = `${" ".repeat(s + 1)}${u.message}
2226
- ${l}`), l;
2227
- }
2228
- async function zD(e, t) {
2229
- let u = await dt(t), r = u.preprocess ? await u.preprocess(e, t) : e;
2230
- t.originalText = r;
2231
- let n;
2232
- try {
2233
- n = await u.parse(r, t, t);
2234
- } catch (D) {
2235
- XD(D, e);
2236
- }
2237
- return { text: r, ast: n };
2238
- }
2239
- function XD(e, t) {
2240
- let { loc: u } = e;
2241
- if (u) {
2242
- let r = KD(t, u, { highlightCode: !0 });
2243
- throw e.message += `
2244
- ` + r, e.codeFrame = r, e;
2245
- }
2246
- throw e;
2247
- }
2248
- var Ae = zD;
2249
- async function UD(e, t, u, r, n) {
2250
- if (u.embeddedLanguageFormatting !== "auto")
2251
- return;
2252
- let { printer: D } = u, { embed: a } = D;
2253
- if (!a)
2254
- return;
2255
- if (a.length > 2)
2256
- throw new Error("printer.embed has too many parameters. The API changed in Prettier v3. Please update your plugin. See https://prettier.io/docs/plugins#optional-embed");
2257
- let { hasPrettierIgnore: i } = D, { getVisitorKeys: o } = a, s = [];
2258
- c();
2259
- let l = e.stack;
2260
- for (let { print: F, node: d, pathStack: p } of s)
2261
- try {
2262
- e.stack = p;
2263
- let E = await F(f, t, e, u);
2264
- E && n.set(d, E);
2265
- } catch (E) {
2266
- if (globalThis.PRETTIER_DEBUG)
2267
- throw E;
2268
- }
2269
- e.stack = l;
2270
- function f(F, d) {
2271
- return qD(F, d, u, r);
2272
- }
2273
- function c() {
2274
- let { node: F } = e;
2275
- if (F === null || typeof F != "object" || i != null && i(e))
2276
- return;
2277
- for (let p of o(F))
2278
- Array.isArray(F[p]) ? e.each(c, p) : e.call(c, p);
2279
- let d = a(e, u);
2280
- if (d) {
2281
- if (typeof d == "function") {
2282
- s.push({ print: d, node: F, pathStack: [...e.stack] });
2283
- return;
2284
- }
2285
- n.set(F, d);
2286
- }
2287
- }
2288
- }
2289
- async function qD(e, t, u, r) {
2290
- let n = await Ce({ ...u, ...t, parentParser: u.parser, originalText: e, cursorOffset: void 0, rangeStart: void 0, rangeEnd: void 0 }, { passThrough: !0 }), { ast: D } = await Ae(e, n), a = await r(D, n);
2291
- return Qt(a);
2292
- }
2293
- function HD(e, t, u, r) {
2294
- let { originalText: n, [Symbol.for("comments")]: D, locStart: a, locEnd: i, [Symbol.for("printedComments")]: o } = t, { node: s } = e, l = a(s), f = i(s);
2295
- for (let F of D)
2296
- a(F) >= l && i(F) <= f && o.add(F);
2297
- let { printPrettierIgnored: c } = t.printer;
2298
- return c ? c(e, t, u, r) : n.slice(l, f);
2299
- }
2300
- var GD = HD;
2301
- async function Je(e, t) {
2302
- ({ ast: e } = await Tu(e, t));
2303
- let u = /* @__PURE__ */ new Map(), r = new fn(e), n = /* @__PURE__ */ new Map();
2304
- await UD(r, a, t, Je, n);
2305
- let D = await Mt(r, t, a, void 0, n);
2306
- if (In(t), t.cursorOffset >= 0) {
2307
- if (t.nodeAfterCursor && !t.nodeBeforeCursor)
2308
- return [De, D];
2309
- if (t.nodeBeforeCursor && !t.nodeAfterCursor)
2310
- return [D, De];
2311
- }
2312
- return D;
2313
- function a(o, s) {
2314
- return o === void 0 || o === r ? i(s) : Array.isArray(o) ? r.call(() => i(s), ...o) : r.call(() => i(s), o);
2315
- }
2316
- function i(o) {
2317
- let s = r.node;
2318
- if (s == null)
2319
- return "";
2320
- let l = st(s) && o === void 0;
2321
- if (l && u.has(s))
2322
- return u.get(s);
2323
- let f = Mt(r, t, a, o, n);
2324
- return l && u.set(s, f), f;
2325
- }
2326
- }
2327
- function Mt(e, t, u, r, n) {
2328
- var o, s;
2329
- let { node: D } = e, { printer: a } = t, i;
2330
- switch ((o = a.hasPrettierIgnore) != null && o.call(a, e) ? i = GD(e, t, u, r) : n.has(D) ? i = n.get(D) : i = a.print(e, t, u, r), D) {
2331
- case t.cursorNode:
2332
- i = Se(i, (l) => [De, l, De]);
2333
- break;
2334
- case t.nodeBeforeCursor:
2335
- i = Se(i, (l) => [l, De]);
2336
- break;
2337
- case t.nodeAfterCursor:
2338
- i = Se(i, (l) => [De, l]);
2339
- break;
2340
- }
2341
- return a.printComment && !((s = a.willPrintOwnComments) != null && s.call(a, e, t)) && (i = Sn(e, i, t)), i;
2342
- }
2343
- async function Tu(e, t) {
2344
- let u = e.comments ?? [];
2345
- t[Symbol.for("comments")] = u, t[Symbol.for("printedComments")] = /* @__PURE__ */ new Set(), vn(e, t);
2346
- let { printer: { preprocess: r } } = t;
2347
- return e = r ? await r(e, t) : e, { ast: e, comments: u };
2348
- }
2349
- function YD(e, t) {
2350
- let { cursorOffset: u, locStart: r, locEnd: n, getVisitorKeys: D } = t, a = (F) => r(F) <= u && n(F) >= u, i = e, o = [e];
2351
- for (let F of En(e, { getVisitorKeys: D, filter: a }))
2352
- o.push(F), i = F;
2353
- if (mn(i, { getVisitorKeys: D }))
2354
- return { cursorNode: i };
2355
- let s, l, f = -1, c = Number.POSITIVE_INFINITY;
2356
- for (; o.length > 0 && (s === void 0 || l === void 0); ) {
2357
- i = o.pop();
2358
- let F = s !== void 0, d = l !== void 0;
2359
- for (let p of $e(i, { getVisitorKeys: D })) {
2360
- if (!F) {
2361
- let E = n(p);
2362
- E <= u && E > f && (s = p, f = E);
2363
- }
2364
- if (!d) {
2365
- let E = r(p);
2366
- E >= u && E < c && (l = p, c = E);
2367
- }
2368
- }
2369
- }
2370
- return { nodeBeforeCursor: s, nodeAfterCursor: l };
2371
- }
2372
- var Pu = YD;
2373
- function QD(e, t) {
2374
- let { printer: u } = t, r = u.massageAstNode;
2375
- if (!r)
2376
- return e;
2377
- let { getVisitorKeys: n } = u, { ignoredProperties: D } = r;
2378
- return a(e);
2379
- function a(i, o) {
2380
- if (!st(i))
2381
- return i;
2382
- if (Array.isArray(i))
2383
- return i.map((c) => a(c, o)).filter(Boolean);
2384
- let s = {}, l = new Set(n(i));
2385
- for (let c in i)
2386
- !Object.prototype.hasOwnProperty.call(i, c) || D != null && D.has(c) || (l.has(c) ? s[c] = a(i[c], i) : s[c] = i[c]);
2387
- let f = r(i, s, o);
2388
- if (f !== null)
2389
- return f ?? s;
2390
- }
2391
- }
2392
- var ZD = QD, ea = Array.prototype.findLastIndex ?? function(e) {
2393
- for (let t = this.length - 1; t >= 0; t--) {
2394
- let u = this[t];
2395
- if (e(u, t, this))
2396
- return t;
2397
- }
2398
- return -1;
2399
- }, ta = Be("findLastIndex", function() {
2400
- if (Array.isArray(this))
2401
- return ea;
2402
- }), ua = ta, ra = ({ parser: e }) => e === "json" || e === "json5" || e === "jsonc" || e === "json-stringify";
2403
- function na(e, t) {
2404
- return t = new Set(t), e.find((u) => ju.has(u.type) && t.has(u));
2405
- }
2406
- function Rt(e) {
2407
- let t = ua(0, e, (u) => u.type !== "Program" && u.type !== "File");
2408
- return t === -1 ? e : e.slice(0, t + 1);
2409
- }
2410
- function Da(e, t, { locStart: u, locEnd: r }) {
2411
- let [n, ...D] = e, [a, ...i] = t;
2412
- if (n === a)
2413
- return [n, a];
2414
- let o = u(n);
2415
- for (let l of Rt(i))
2416
- if (u(l) >= o)
2417
- a = l;
2418
- else
2419
- break;
2420
- let s = r(a);
2421
- for (let l of Rt(D)) {
2422
- if (r(l) <= s)
2423
- n = l;
2424
- else
2425
- break;
2426
- if (n === a)
2427
- break;
2428
- }
2429
- return [n, a];
2430
- }
2431
- function Ze(e, t, u, r, n = [], D) {
2432
- let { locStart: a, locEnd: i } = u, o = a(e), s = i(e);
2433
- if (t > s || t < o || D === "rangeEnd" && t === o || D === "rangeStart" && t === s)
2434
- return;
2435
- let l = [e, ...n], f = fu(e, l, { cache: Fu, locStart: a, locEnd: i, getVisitorKeys: u.getVisitorKeys, filter: u.printer.canAttachComment, getChildren: u.printer.getCommentChildNodes });
2436
- for (let c of f) {
2437
- let F = Ze(c, t, u, r, l, D);
2438
- if (F)
2439
- return F;
2440
- }
2441
- if (r(e, n[0]))
2442
- return l;
2443
- }
2444
- function aa(e, t) {
2445
- return t !== "DeclareExportDeclaration" && e !== "TypeParameterDeclaration" && (e === "Directive" || e === "TypeAlias" || e === "TSExportAssignment" || e.startsWith("Declare") || e.startsWith("TSDeclare") || e.endsWith("Statement") || e.endsWith("Declaration"));
2446
- }
2447
- var ju = /* @__PURE__ */ new Set(["JsonRoot", "ObjectExpression", "ArrayExpression", "StringLiteral", "NumericLiteral", "BooleanLiteral", "NullLiteral", "UnaryExpression", "TemplateLiteral"]), ia = /* @__PURE__ */ new Set(["OperationDefinition", "FragmentDefinition", "VariableDefinition", "TypeExtensionDefinition", "ObjectTypeDefinition", "FieldDefinition", "DirectiveDefinition", "EnumTypeDefinition", "EnumValueDefinition", "InputValueDefinition", "InputObjectTypeDefinition", "SchemaDefinition", "OperationTypeDefinition", "InterfaceTypeDefinition", "UnionTypeDefinition", "ScalarTypeDefinition"]);
2448
- function Vt(e, t, u) {
2449
- if (!t)
2450
- return !1;
2451
- switch (e.parser) {
2452
- case "flow":
2453
- case "hermes":
2454
- case "babel":
2455
- case "babel-flow":
2456
- case "babel-ts":
2457
- case "typescript":
2458
- case "acorn":
2459
- case "espree":
2460
- case "meriyah":
2461
- case "oxc":
2462
- case "oxc-ts":
2463
- case "__babel_estree":
2464
- return aa(t.type, u == null ? void 0 : u.type);
2465
- case "json":
2466
- case "json5":
2467
- case "jsonc":
2468
- case "json-stringify":
2469
- return ju.has(t.type);
2470
- case "graphql":
2471
- return ia.has(t.kind);
2472
- case "vue":
2473
- return t.tag !== "root";
2474
- }
2475
- return !1;
2476
- }
2477
- function oa(e, t, u) {
2478
- let { rangeStart: r, rangeEnd: n, locStart: D, locEnd: a } = t, i = e.slice(r, n).search(/\S/u), o = i === -1;
2479
- if (!o)
2480
- for (r += i; n > r && !/\S/u.test(e[n - 1]); --n)
2481
- ;
2482
- let s = Ze(u, r, t, (F, d) => Vt(t, F, d), [], "rangeStart");
2483
- if (!s)
2484
- return;
2485
- let l = o ? s : Ze(u, n, t, (F) => Vt(t, F), [], "rangeEnd");
2486
- if (!l)
2487
- return;
2488
- let f, c;
2489
- if (ra(t)) {
2490
- let F = na(s, l);
2491
- f = F, c = F;
2492
- } else
2493
- [f, c] = Da(s, l, t);
2494
- return [Math.min(D(f), D(c)), Math.max(a(f), a(c))];
2495
- }
2496
- var Lu = "\uFEFF", Wt = Symbol("cursor");
2497
- async function $u(e, t, u = 0) {
2498
- if (!e || e.trim().length === 0)
2499
- return { formatted: "", cursorOffset: -1, comments: [] };
2500
- let { ast: r, text: n } = await Ae(e, t);
2501
- t.cursorOffset >= 0 && (t = { ...t, ...Pu(r, t) });
2502
- let D = await Je(r, t);
2503
- u > 0 && (D = eu([K, D], u, t.tabWidth));
2504
- let a = Le(D, t);
2505
- if (u > 0) {
2506
- let o = a.formatted.trim();
2507
- a.cursorNodeStart !== void 0 && (a.cursorNodeStart -= a.formatted.indexOf(o), a.cursorNodeStart < 0 && (a.cursorNodeStart = 0, a.cursorNodeText = a.cursorNodeText.trimStart()), a.cursorNodeStart + a.cursorNodeText.length > o.length && (a.cursorNodeText = a.cursorNodeText.trimEnd())), a.formatted = o + rt(t.endOfLine);
2508
- }
2509
- let i = t[Symbol.for("comments")];
2510
- if (t.cursorOffset >= 0) {
2511
- let o, s, l, f;
2512
- if ((t.cursorNode || t.nodeBeforeCursor || t.nodeAfterCursor) && a.cursorNodeText)
2513
- if (l = a.cursorNodeStart, f = a.cursorNodeText, t.cursorNode)
2514
- o = t.locStart(t.cursorNode), s = n.slice(o, t.locEnd(t.cursorNode));
2515
- else {
2516
- if (!t.nodeBeforeCursor && !t.nodeAfterCursor)
2517
- throw new Error("Cursor location must contain at least one of cursorNode, nodeBeforeCursor, nodeAfterCursor");
2518
- o = t.nodeBeforeCursor ? t.locEnd(t.nodeBeforeCursor) : 0;
2519
- let g = t.nodeAfterCursor ? t.locStart(t.nodeAfterCursor) : n.length;
2520
- s = n.slice(o, g);
2521
- }
2522
- else
2523
- o = 0, s = n, l = 0, f = a.formatted;
2524
- let c = t.cursorOffset - o;
2525
- if (s === f)
2526
- return { formatted: a.formatted, cursorOffset: l + c, comments: i };
2527
- let F = s.split("");
2528
- F.splice(c, 0, Wt);
2529
- let d = f.split(""), p = cr(F, d), E = l;
2530
- for (let g of p)
2531
- if (g.removed) {
2532
- if (g.value.includes(Wt))
2533
- break;
2534
- } else
2535
- E += g.count;
2536
- return { formatted: a.formatted, cursorOffset: E, comments: i };
2537
- }
2538
- return { formatted: a.formatted, cursorOffset: -1, comments: i };
2539
- }
2540
- async function sa(e, t) {
2541
- let { ast: u, text: r } = await Ae(e, t), [n, D] = oa(r, t, u) ?? [0, 0], a = r.slice(n, D), i = Math.min(n, r.lastIndexOf(`
2542
- `, n) + 1), o = r.slice(i, n).match(/^\s*/u)[0], s = ot(o, t.tabWidth), l = await $u(a, { ...t, rangeStart: 0, rangeEnd: Number.POSITIVE_INFINITY, cursorOffset: t.cursorOffset > n && t.cursorOffset <= D ? t.cursorOffset - n : -1, endOfLine: "lf" }, s), f = l.formatted.trimEnd(), { cursorOffset: c } = t;
2543
- c > D ? c += f.length - a.length : l.cursorOffset >= 0 && (c = l.cursorOffset + n);
2544
- let F = r.slice(0, n) + f + r.slice(D);
2545
- if (t.endOfLine !== "lf") {
2546
- let d = rt(t.endOfLine);
2547
- c >= 0 && d === `\r
2548
- ` && (c += Gt(F.slice(0, c), `
2549
- `)), F = Oe(0, F, `
2550
- `, d);
2551
- }
2552
- return { formatted: F, cursorOffset: c, comments: l.comments };
2553
- }
2554
- function qe(e, t, u) {
2555
- return typeof t != "number" || Number.isNaN(t) || t < 0 || t > e.length ? u : t;
2556
- }
2557
- function Kt(e, t) {
2558
- let { cursorOffset: u, rangeStart: r, rangeEnd: n } = t;
2559
- return u = qe(e, u, -1), r = qe(e, r, 0), n = qe(e, n, e.length), { ...t, cursorOffset: u, rangeStart: r, rangeEnd: n };
2560
- }
2561
- function Ju(e, t) {
2562
- let { cursorOffset: u, rangeStart: r, rangeEnd: n, endOfLine: D } = Kt(e, t), a = e.charAt(0) === Lu;
2563
- if (a && (e = e.slice(1), u--, r--, n--), D === "auto" && (D = Cr(e)), e.includes("\r")) {
2564
- let i = (o) => Gt(e.slice(0, Math.max(o, 0)), `\r
2565
- `);
2566
- u -= i(u), r -= i(r), n -= i(n), e = mr(e);
2567
- }
2568
- return { hasBOM: a, text: e, options: Kt(e, { ...t, cursorOffset: u, rangeStart: r, rangeEnd: n, endOfLine: D }) };
2569
- }
2570
- async function zt(e, t) {
2571
- let u = await dt(t);
2572
- return !u.hasPragma || u.hasPragma(e);
2573
- }
2574
- async function la(e, t) {
2575
- var u, r;
2576
- return (r = (u = await dt(t)).hasIgnorePragma) == null ? void 0 : r.call(u, e);
2577
- }
2578
- async function Mu(e, t) {
2579
- let { hasBOM: u, text: r, options: n } = Ju(e, await Ce(t));
2580
- if (n.rangeStart >= n.rangeEnd && r !== "" || n.requirePragma && !await zt(r, n) || n.checkIgnorePragma && await la(r, n))
2581
- return { formatted: e, cursorOffset: t.cursorOffset, comments: [] };
2582
- let D;
2583
- return n.rangeStart > 0 || n.rangeEnd < r.length ? D = await sa(r, n) : (!n.requirePragma && n.insertPragma && n.printer.insertPragma && !await zt(r, n) && (r = n.printer.insertPragma(r)), D = await $u(r, n)), u && (D.formatted = Lu + D.formatted, D.cursorOffset >= 0 && D.cursorOffset++), D;
2584
- }
2585
- async function ca(e, t, u) {
2586
- let { text: r, options: n } = Ju(e, await Ce(t)), D = await Ae(r, n);
2587
- return u && (u.preprocessForPrint && (D.ast = await Tu(D.ast, n)), u.massage && (D.ast = ZD(D.ast, n))), D;
2588
- }
2589
- async function fa(e, t) {
2590
- t = await Ce(t);
2591
- let u = await Je(e, t);
2592
- return Le(u, t);
2593
- }
2594
- async function Fa(e, t) {
2595
- let u = Gr(e), { formatted: r } = await Mu(u, { ...t, parser: "__js_expression" });
2596
- return r;
2597
- }
2598
- async function da(e, t) {
2599
- t = await Ce(t);
2600
- let { ast: u } = await Ae(e, t);
2601
- return t.cursorOffset >= 0 && (t = { ...t, ...Pu(u, t) }), Je(u, t);
2602
- }
2603
- async function pa(e, t) {
2604
- return Le(e, await Ce(t));
2605
- }
2606
- var Ru = {};
2607
- tt(Ru, { builders: () => ha, printer: () => Ca, utils: () => ga });
2608
- var ha = { join: uu, line: ru, softline: Ur, hardline: K, literalline: Du, group: tu, conditionalGroup: Wr, fill: Vr, lineSuffix: He, lineSuffixBoundary: qr, cursor: De, breakParent: je, ifBreak: Kr, trim: Hr, indent: _e, indentIfBreak: zr, align: he, addAlignmentToDoc: eu, markAsRoot: Zt, dedentToRoot: Mr, dedent: Rr, hardlineWithoutBreakParent: at, literallineWithoutBreakParent: nu, label: Xr, concat: (e) => e }, Ca = { printDocToString: Le }, ga = { willBreak: Ir, traverseDoc: nt, findInDoc: Dt, mapDoc: Pe, removeLines: Or, stripTrailingHardline: Qt, replaceEndOfLine: jr, canBreak: $r }, Ea = "3.7.4", Vu = {};
2609
- tt(Vu, { addDanglingComment: () => re, addLeadingComment: () => me, addTrailingComment: () => ye, getAlignmentSize: () => ot, getIndentSize: () => Aa, getMaxContinuousCount: () => xa, getNextNonSpaceNonCommentCharacter: () => Ia, getNextNonSpaceNonCommentCharacterIndex: () => Ma, getPreferredQuote: () => Ta, getStringWidth: () => it, hasNewline: () => Q, hasNewlineInRange: () => ja, hasSpaces: () => $a, isNextLineEmpty: () => za, isNextLineEmptyAfterIndex: () => Et, isPreviousLineEmpty: () => Va, makeString: () => Ka, skip: () => be, skipEverythingButNewLine: () => lu, skipInlineComment: () => ht, skipNewline: () => ae, skipSpaces: () => Z, skipToLineEnd: () => su, skipTrailingComment: () => Ct, skipWhitespace: () => dn });
2610
- function ma(e, t) {
2611
- if (t === !1)
2612
- return !1;
2613
- if (e.charAt(t) === "/" && e.charAt(t + 1) === "*") {
2614
- for (let u = t + 2; u < e.length; ++u)
2615
- if (e.charAt(u) === "*" && e.charAt(u + 1) === "/")
2616
- return u + 2;
2617
- }
2618
- return t;
2619
- }
2620
- var ht = ma;
2621
- function ya(e, t) {
2622
- return t === !1 ? !1 : e.charAt(t) === "/" && e.charAt(t + 1) === "/" ? lu(e, t) : t;
2623
- }
2624
- var Ct = ya;
2625
- function va(e, t) {
2626
- let u = null, r = t;
2627
- for (; r !== u; )
2628
- u = r, r = Z(e, r), r = ht(e, r), r = Ct(e, r), r = ae(e, r);
2629
- return r;
2630
- }
2631
- var gt = va;
2632
- function Ba(e, t) {
2633
- let u = null, r = t;
2634
- for (; r !== u; )
2635
- u = r, r = su(e, r), r = ht(e, r), r = Z(e, r);
2636
- return r = Ct(e, r), r = ae(e, r), r !== !1 && Q(e, r);
2637
- }
2638
- var Et = Ba;
2639
- function ba(e, t) {
2640
- let u = e.lastIndexOf(`
2641
- `);
2642
- return u === -1 ? 0 : ot(e.slice(u + 1).match(/^[\t ]*/u)[0], t);
2643
- }
2644
- var Aa = ba;
2645
- function wa(e) {
2646
- if (typeof e != "string")
2647
- throw new TypeError("Expected a string");
2648
- return e.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
2649
- }
2650
- function ka(e, t) {
2651
- let u = e.matchAll(new RegExp(`(?:${wa(t)})+`, "gu"));
2652
- return u.reduce || (u = [...u]), u.reduce((r, [n]) => Math.max(r, n.length), 0) / t.length;
2653
- }
2654
- var xa = ka;
2655
- function Sa(e, t) {
2656
- let u = gt(e, t);
2657
- return u === !1 ? "" : e.charAt(u);
2658
- }
2659
- var Ia = Sa, Wu = Object.freeze({ character: "'", codePoint: 39 }), Ku = Object.freeze({ character: '"', codePoint: 34 }), Na = Object.freeze({ preferred: Wu, alternate: Ku }), _a = Object.freeze({ preferred: Ku, alternate: Wu });
2660
- function Oa(e, t) {
2661
- let { preferred: u, alternate: r } = t === !0 || t === "'" ? Na : _a, { length: n } = e, D = 0, a = 0;
2662
- for (let i = 0; i < n; i++) {
2663
- let o = e.charCodeAt(i);
2664
- o === u.codePoint ? D++ : o === r.codePoint && a++;
2665
- }
2666
- return (D > a ? r : u).character;
2667
- }
2668
- var Ta = Oa;
2669
- function Pa(e, t, u) {
2670
- for (let r = t; r < u; ++r)
2671
- if (e.charAt(r) === `
2672
- `)
2673
- return !0;
2674
- return !1;
2675
- }
2676
- var ja = Pa;
2677
- function La(e, t, u = {}) {
2678
- return Z(e, u.backwards ? t - 1 : t, u) !== t;
2679
- }
2680
- var $a = La;
2681
- function Ja(e, t, u) {
2682
- return gt(e, u(t));
2683
- }
2684
- function Ma(e, t) {
2685
- return arguments.length === 2 || typeof t == "number" ? gt(e, t) : Ja(...arguments);
2686
- }
2687
- function Ra(e, t, u) {
2688
- return ct(e, u(t));
2689
- }
2690
- function Va(e, t) {
2691
- return arguments.length === 2 || typeof t == "number" ? ct(e, t) : Ra(...arguments);
2692
- }
2693
- function Wa(e, t, u) {
2694
- return Et(e, u(t));
2695
- }
2696
- function Ka(e, t, u) {
2697
- let r = t === '"' ? "'" : '"', n = Oe(0, e, /\\(.)|(["'])/gsu, (D, a, i) => a === r ? a : i === t ? "\\" + i : i || (u && /^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/u.test(a) ? a : "\\" + a));
2698
- return t + n + t;
2699
- }
2700
- function za(e, t) {
2701
- return arguments.length === 2 || typeof t == "number" ? Et(e, t) : Wa(...arguments);
2702
- }
2703
- function ne(e, t = 1) {
2704
- return async (...u) => {
2705
- let r = u[t] ?? {}, n = r.plugins ?? [];
2706
- return u[t] = { ...r, plugins: Array.isArray(n) ? n : Object.values(n) }, e(...u);
2707
- };
2708
- }
2709
- var zu = ne(Mu);
2710
- async function Xu(e, t) {
2711
- let { formatted: u } = await zu(e, { ...t, cursorOffset: -1 });
2712
- return u;
2713
- }
2714
- async function Xa(e, t) {
2715
- return await Xu(e, t) === e;
2716
- }
2717
- var Ua = ne(gu, 0), qa = { parse: ne(ca), formatAST: ne(fa), formatDoc: ne(Fa), printToDoc: ne(da), printDocToString: ne(pa) };
2718
- export {
2719
- qa as __debug,
2720
- Xa as check,
2721
- Dr as default,
2722
- Ru as doc,
2723
- Xu as format,
2724
- zu as formatWithCursor,
2725
- Ua as getSupportInfo,
2726
- Vu as util,
2727
- Ea as version
2728
- };