diff --git a/.gitignore b/.gitignore index ec6143c40f..106b2e8be5 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,6 @@ screenshot_*.png *.bmp *.tiff app.db + +# CodeMirror build artifacts +PolyPilot/codemirror-src/node_modules/ diff --git a/PolyPilot.Tests/DiffParserTests.cs b/PolyPilot.Tests/DiffParserTests.cs index 0d80373b48..b096da85a6 100644 --- a/PolyPilot.Tests/DiffParserTests.cs +++ b/PolyPilot.Tests/DiffParserTests.cs @@ -107,6 +107,125 @@ rename to new.cs Assert.Equal("new.cs", files[0].FileName); } + [Fact] + public void DiffFile_MetadataProperties_ReportStatusAndCounts() + { + var file = new DiffFile + { + FileName = "src/example.cs", + Hunks = new List + { + new() + { + Lines = new List + { + new() { Type = DiffLineType.Context, Content = "keep" }, + new() { Type = DiffLineType.Added, Content = "add 1" }, + new() { Type = DiffLineType.Added, Content = "add 2" }, + new() { Type = DiffLineType.Removed, Content = "remove 1" }, + } + } + } + }; + + Assert.Equal(2, file.AddedLineCount); + Assert.Equal(1, file.RemovedLineCount); + Assert.Equal("MOD", file.StatusLabel); + Assert.Equal("modified", file.StatusCssClass); + Assert.Equal("src/example.cs", file.DisplayName); + } + + [Fact] + public void DiffFile_DisplayName_RenamedFile_ShowsOldAndNewPaths() + { + var file = new DiffFile + { + FileName = "src/new-name.cs", + OldFileName = "src/old-name.cs", + IsRenamed = true + }; + + Assert.Equal("REN", file.StatusLabel); + Assert.Equal("renamed", file.StatusCssClass); + Assert.Equal("src/old-name.cs → src/new-name.cs", file.DisplayName); + } + + [Fact] + public void DiffViewState_ResetSelectionAndModes_TracksGeneration() + { + var files = new List + { + new() { FileName = "a.cs" }, + new() { FileName = "b.cs" } + }; + var state = new DiffViewState(); + + state.Reset(files); + state.SetViewMode(1, DiffViewMode.Editor); + var firstGeneration = state.Generation; + + Assert.Equal(0, state.SelectedFileIndex); + Assert.Equal(DiffViewMode.Editor, state.GetViewMode(1)); + Assert.True(state.SelectFile(1, files.Count)); + Assert.Equal(1, state.SelectedFileIndex); + + state.Reset(files); + + Assert.Equal(firstGeneration + 1, state.Generation); + Assert.Equal(0, state.SelectedFileIndex); + Assert.Equal(DiffViewMode.Table, state.GetViewMode(1)); + Assert.False(state.IsFilePickerCollapsed); + } + + [Fact] + public void DiffLineCommentRequest_ToPrompt_FormatsReviewMessage() + { + var request = new DiffLineCommentRequest("src/ReviewPanel.cs", 42, "Please simplify this branch", "original"); + + Assert.Equal( + "On file src/ReviewPanel.cs, line 42 (original): Please simplify this branch", + request.ToPrompt()); + } + + [Fact] + public void Parse_BinaryDiffLikeOutput_CapturesFileMetadataWithoutHunks() + { + var diff = """ + diff --git a/assets/logo.png b/assets/logo.png + index e69de29..1b2c3d4 100644 + Binary files a/assets/logo.png and b/assets/logo.png differ + """; + + var files = DiffParser.Parse(diff); + + Assert.Single(files); + Assert.Equal("assets/logo.png", files[0].FileName); + Assert.Empty(files[0].Hunks); + Assert.Equal(0, files[0].AddedLineCount); + Assert.Equal(0, files[0].RemovedLineCount); + } + + [Fact] + public void Parse_LargeDiff_AggregatesCountsAcrossHunks() + { + var removedLines = string.Join('\n', Enumerable.Range(1, 12).Select(i => $"-old {i}")); + var addedLines = string.Join('\n', Enumerable.Range(1, 15).Select(i => $"+new {i}")); + var diff = $$""" + diff --git a/huge.cs b/huge.cs + --- a/huge.cs + +++ b/huge.cs + @@ -1,12 +1,15 @@ + {{removedLines}} + {{addedLines}} + """; + + var files = DiffParser.Parse(diff); + + Assert.Single(files); + Assert.Equal(12, files[0].RemovedLineCount); + Assert.Equal(15, files[0].AddedLineCount); + } + [Fact] public void Parse_HunkHeader_ExtractsLineNumbers() { @@ -363,4 +482,983 @@ public void Parse_AngleBracketsInCode_NotEncoded() Assert.Equal("List items = new List();", lines[0].Content); Assert.Equal("Dictionary items = new Dictionary();", lines[1].Content); } + + [Fact] + public void ReconstructOriginal_ReturnsContextAndRemovedLines() + { + var diff = """ + diff --git a/test.cs b/test.cs + --- a/test.cs + +++ b/test.cs + @@ -1,4 +1,4 @@ + using System; + -Console.WriteLine("Hello"); + +Console.WriteLine("World"); + return 0; + """; + var files = DiffParser.Parse(diff); + var original = DiffParser.ReconstructOriginal(files[0]); + + Assert.Contains("using System;", original); + Assert.Contains("Console.WriteLine(\"Hello\")", original); + Assert.DoesNotContain("Console.WriteLine(\"World\")", original); + Assert.Contains("return 0;", original); + } + + [Fact] + public void ReconstructModified_ReturnsContextAndAddedLines() + { + var diff = """ + diff --git a/test.cs b/test.cs + --- a/test.cs + +++ b/test.cs + @@ -1,4 +1,4 @@ + using System; + -Console.WriteLine("Hello"); + +Console.WriteLine("World"); + return 0; + """; + var files = DiffParser.Parse(diff); + var modified = DiffParser.ReconstructModified(files[0]); + + Assert.Contains("using System;", modified); + Assert.DoesNotContain("Console.WriteLine(\"Hello\")", modified); + Assert.Contains("Console.WriteLine(\"World\")", modified); + Assert.Contains("return 0;", modified); + } + + [Fact] + public void ReconstructOriginalAndModified_NewFile_ModifiedHasAllLines() + { + var diff = """ + diff --git a/new.txt b/new.txt + new file mode 100644 + --- /dev/null + +++ b/new.txt + @@ -0,0 +1,3 @@ + +line 1 + +line 2 + +line 3 + """; + var files = DiffParser.Parse(diff); + var original = DiffParser.ReconstructOriginal(files[0]); + var modified = DiffParser.ReconstructModified(files[0]); + + Assert.Equal("", original); + Assert.Contains("line 1", modified); + Assert.Contains("line 2", modified); + Assert.Contains("line 3", modified); + } + + [Fact] + public void ReconstructOriginalAndModified_DeletedFile_OriginalHasAllLines() + { + var diff = """ + diff --git a/old.txt b/old.txt + deleted file mode 100644 + --- a/old.txt + +++ /dev/null + @@ -1,3 +0,0 @@ + -line A + -line B + -line C + """; + var files = DiffParser.Parse(diff); + var original = DiffParser.ReconstructOriginal(files[0]); + var modified = DiffParser.ReconstructModified(files[0]); + + Assert.Contains("line A", original); + Assert.Contains("line B", original); + Assert.Contains("line C", original); + Assert.Equal("", modified); + } + + [Fact] + public void ReconstructOriginalAndModified_EmptyHunks_ReturnsEmpty() + { + var file = new DiffFile { FileName = "empty.txt", Hunks = new List() }; + var original = DiffParser.ReconstructOriginal(file); + var modified = DiffParser.ReconstructModified(file); + + Assert.Equal("", original); + Assert.Equal("", modified); + } + + [Fact] + public void ReconstructOriginalAndModified_MultipleHunks_CombinesAll() + { + var diff = """ + diff --git a/multi.cs b/multi.cs + --- a/multi.cs + +++ b/multi.cs + @@ -1,3 +1,3 @@ + using System; + -using Old; + +using New; + class A {} + @@ -10,3 +10,4 @@ + void Foo() { + - Bar(); + + Baz(); + + Qux(); + } + """; + var files = DiffParser.Parse(diff); + var original = DiffParser.ReconstructOriginal(files[0]); + var modified = DiffParser.ReconstructModified(files[0]); + + // Original should have both hunks' context+removed lines + Assert.Contains("using Old;", original); + Assert.Contains("Bar();", original); + Assert.DoesNotContain("using New;", original); + Assert.DoesNotContain("Baz();", original); + Assert.DoesNotContain("Qux();", original); + + // Modified should have both hunks' context+added lines + Assert.Contains("using New;", modified); + Assert.Contains("Baz();", modified); + Assert.Contains("Qux();", modified); + Assert.DoesNotContain("using Old;", modified); + Assert.DoesNotContain("Bar();", modified); + } + + [Fact] + public void ReconstructOriginalAndModified_ContextOnly_BothIdentical() + { + // A diff with only context lines (no real changes) — e.g., a self-diff view + var file = new DiffFile + { + FileName = "ctx.txt", + Hunks = new List + { + new() + { + Lines = new List + { + new() { Type = DiffLineType.Context, Content = "line 1" }, + new() { Type = DiffLineType.Context, Content = "line 2" }, + new() { Type = DiffLineType.Context, Content = "line 3" }, + } + } + } + }; + var original = DiffParser.ReconstructOriginal(file); + var modified = DiffParser.ReconstructModified(file); + + Assert.Equal(original, modified); + Assert.Contains("line 1", original); + Assert.Contains("line 3", original); + } + + // ========== INTER-HUNK GAP PLACEHOLDER TESTS ========== + + [Fact] + public void ReconstructOriginal_MultipleHunks_InsertsGapPlaceholders() + { + // Hunks at lines 1-3 and 10-12 with a gap of lines 4-9 + var diff = """ + diff --git a/gap.cs b/gap.cs + --- a/gap.cs + +++ b/gap.cs + @@ -1,3 +1,3 @@ + line1 + -old2 + +new2 + line3 + @@ -10,3 +10,3 @@ + line10 + -old11 + +new11 + line12 + """; + var files = DiffParser.Parse(diff); + var original = DiffParser.ReconstructOriginal(files[0]); + var lines = original.Split('\n'); + + // Line 1 should be "line1", line 2 "old2", line 3 "line3" + Assert.Equal("line1", lines[0]); + Assert.Equal("old2", lines[1]); + Assert.Equal("line3", lines[2]); + // Lines 4-9 should be empty gap placeholders + for (int i = 3; i < 9; i++) + { + Assert.Equal("", lines[i]); + } + // Line 10 should be "line10" + Assert.Equal("line10", lines[9]); + Assert.Equal("old11", lines[10]); + Assert.Equal("line12", lines[11]); + } + + [Fact] + public void ReconstructModified_MultipleHunks_InsertsGapPlaceholders() + { + var diff = """ + diff --git a/gap.cs b/gap.cs + --- a/gap.cs + +++ b/gap.cs + @@ -1,3 +1,3 @@ + line1 + -old2 + +new2 + line3 + @@ -10,3 +10,3 @@ + line10 + -old11 + +new11 + line12 + """; + var files = DiffParser.Parse(diff); + var modified = DiffParser.ReconstructModified(files[0]); + var lines = modified.Split('\n'); + + Assert.Equal("line1", lines[0]); + Assert.Equal("new2", lines[1]); + Assert.Equal("line3", lines[2]); + // Lines 4-9 should be empty gap placeholders + for (int i = 3; i < 9; i++) + { + Assert.Equal("", lines[i]); + } + Assert.Equal("line10", lines[9]); + Assert.Equal("new11", lines[10]); + Assert.Equal("line12", lines[11]); + } + + [Fact] + public void ReconstructOriginal_SingleHunkAtLineOne_NoLeadingGap() + { + var diff = """ + diff --git a/f.cs b/f.cs + --- a/f.cs + +++ b/f.cs + @@ -1,2 +1,2 @@ + -old + +new + keep + """; + var files = DiffParser.Parse(diff); + var original = DiffParser.ReconstructOriginal(files[0]); + var lines = original.Split('\n'); + + Assert.Equal("old", lines[0]); + Assert.Equal("keep", lines[1]); + } + + [Fact] + public void ReconstructOriginal_HunkStartingAtLargeOffset_InsertsCorrectGap() + { + // Hunk starts at line 100 — should have 99 empty lines before it + var diff = """ + diff --git a/big.cs b/big.cs + --- a/big.cs + +++ b/big.cs + @@ -100,2 +100,2 @@ + -old at 100 + +new at 100 + line 101 + """; + var files = DiffParser.Parse(diff); + var original = DiffParser.ReconstructOriginal(files[0]); + var lines = original.Split('\n'); + + // Lines 1-99 are gap placeholders + Assert.Equal(101, lines.Length); + for (int i = 0; i < 99; i++) + { + Assert.Equal("", lines[i]); + } + Assert.Equal("old at 100", lines[99]); + Assert.Equal("line 101", lines[100]); + } + + // ========== PAIRLINES TESTS ========== + + [Fact] + public void PairLines_ContextOnly_AllPairedSameOnBothSides() + { + var hunk = new DiffHunk + { + Lines = new List + { + new() { Type = DiffLineType.Context, Content = "a", OldLineNo = 1, NewLineNo = 1 }, + new() { Type = DiffLineType.Context, Content = "b", OldLineNo = 2, NewLineNo = 2 }, + } + }; + var rows = DiffParser.PairLines(hunk); + + Assert.Equal(2, rows.Count); + Assert.Same(rows[0].Left, rows[0].Right); + Assert.Same(rows[1].Left, rows[1].Right); + } + + [Fact] + public void PairLines_MatchedRemoveAndAdd_PairedSideBySide() + { + var hunk = new DiffHunk + { + Lines = new List + { + new() { Type = DiffLineType.Removed, Content = "old", OldLineNo = 1 }, + new() { Type = DiffLineType.Added, Content = "new", NewLineNo = 1 }, + } + }; + var rows = DiffParser.PairLines(hunk); + + Assert.Single(rows); + Assert.Equal("old", rows[0].Left!.Content); + Assert.Equal("new", rows[0].Right!.Content); + } + + [Fact] + public void PairLines_MoreRemovedThanAdded_ExtraRemovedGetNullRight() + { + var hunk = new DiffHunk + { + Lines = new List + { + new() { Type = DiffLineType.Removed, Content = "a", OldLineNo = 1 }, + new() { Type = DiffLineType.Removed, Content = "b", OldLineNo = 2 }, + new() { Type = DiffLineType.Removed, Content = "c", OldLineNo = 3 }, + new() { Type = DiffLineType.Added, Content = "x", NewLineNo = 1 }, + } + }; + var rows = DiffParser.PairLines(hunk); + + Assert.Equal(3, rows.Count); + Assert.Equal("a", rows[0].Left!.Content); + Assert.Equal("x", rows[0].Right!.Content); + Assert.Equal("b", rows[1].Left!.Content); + Assert.Null(rows[1].Right); + Assert.Equal("c", rows[2].Left!.Content); + Assert.Null(rows[2].Right); + } + + [Fact] + public void PairLines_MoreAddedThanRemoved_ExtraAddedGetNullLeft() + { + var hunk = new DiffHunk + { + Lines = new List + { + new() { Type = DiffLineType.Removed, Content = "old", OldLineNo = 1 }, + new() { Type = DiffLineType.Added, Content = "new1", NewLineNo = 1 }, + new() { Type = DiffLineType.Added, Content = "new2", NewLineNo = 2 }, + new() { Type = DiffLineType.Added, Content = "new3", NewLineNo = 3 }, + } + }; + var rows = DiffParser.PairLines(hunk); + + Assert.Equal(3, rows.Count); + Assert.Equal("old", rows[0].Left!.Content); + Assert.Equal("new1", rows[0].Right!.Content); + Assert.Null(rows[1].Left); + Assert.Equal("new2", rows[1].Right!.Content); + Assert.Null(rows[2].Left); + Assert.Equal("new3", rows[2].Right!.Content); + } + + [Fact] + public void PairLines_PureAdditions_AllNullLeft() + { + var hunk = new DiffHunk + { + Lines = new List + { + new() { Type = DiffLineType.Added, Content = "new1", NewLineNo = 1 }, + new() { Type = DiffLineType.Added, Content = "new2", NewLineNo = 2 }, + } + }; + var rows = DiffParser.PairLines(hunk); + + Assert.Equal(2, rows.Count); + Assert.Null(rows[0].Left); + Assert.Equal("new1", rows[0].Right!.Content); + Assert.Null(rows[1].Left); + Assert.Equal("new2", rows[1].Right!.Content); + } + + [Fact] + public void PairLines_PureDeletions_AllNullRight() + { + var hunk = new DiffHunk + { + Lines = new List + { + new() { Type = DiffLineType.Removed, Content = "old1", OldLineNo = 1 }, + new() { Type = DiffLineType.Removed, Content = "old2", OldLineNo = 2 }, + } + }; + var rows = DiffParser.PairLines(hunk); + + Assert.Equal(2, rows.Count); + Assert.Equal("old1", rows[0].Left!.Content); + Assert.Null(rows[0].Right); + Assert.Equal("old2", rows[1].Left!.Content); + Assert.Null(rows[1].Right); + } + + [Fact] + public void PairLines_MixedContextAndChanges_CorrectInterleaving() + { + var hunk = new DiffHunk + { + Lines = new List + { + new() { Type = DiffLineType.Context, Content = "ctx1", OldLineNo = 1, NewLineNo = 1 }, + new() { Type = DiffLineType.Removed, Content = "old", OldLineNo = 2 }, + new() { Type = DiffLineType.Added, Content = "new", NewLineNo = 2 }, + new() { Type = DiffLineType.Context, Content = "ctx2", OldLineNo = 3, NewLineNo = 3 }, + } + }; + var rows = DiffParser.PairLines(hunk); + + Assert.Equal(3, rows.Count); + // First: context + Assert.Equal("ctx1", rows[0].Left!.Content); + Assert.Same(rows[0].Left, rows[0].Right); + // Second: change pair + Assert.Equal("old", rows[1].Left!.Content); + Assert.Equal("new", rows[1].Right!.Content); + // Third: context + Assert.Equal("ctx2", rows[2].Left!.Content); + Assert.Same(rows[2].Left, rows[2].Right); + } + + [Fact] + public void PairLines_EmptyHunk_ReturnsEmpty() + { + var hunk = new DiffHunk { Lines = new List() }; + Assert.Empty(DiffParser.PairLines(hunk)); + } + + [Fact] + public void PairLines_MultipleChangeBlocks_EachPairedIndependently() + { + // context, remove+add, context, remove+add + var hunk = new DiffHunk + { + Lines = new List + { + new() { Type = DiffLineType.Context, Content = "a", OldLineNo = 1, NewLineNo = 1 }, + new() { Type = DiffLineType.Removed, Content = "old1", OldLineNo = 2 }, + new() { Type = DiffLineType.Added, Content = "new1", NewLineNo = 2 }, + new() { Type = DiffLineType.Context, Content = "b", OldLineNo = 3, NewLineNo = 3 }, + new() { Type = DiffLineType.Removed, Content = "old2", OldLineNo = 4 }, + new() { Type = DiffLineType.Added, Content = "new2", NewLineNo = 4 }, + } + }; + var rows = DiffParser.PairLines(hunk); + + Assert.Equal(4, rows.Count); + Assert.Equal("a", rows[0].Left!.Content); + Assert.Equal("old1", rows[1].Left!.Content); + Assert.Equal("new1", rows[1].Right!.Content); + Assert.Equal("b", rows[2].Left!.Content); + Assert.Equal("old2", rows[3].Left!.Content); + Assert.Equal("new2", rows[3].Right!.Content); + } + + // ========== MULTI-FILE MIXED TYPE TESTS ========== + + [Fact] + public void Parse_MixedFileTypes_NewDeletedModifiedRenamed() + { + var diff = """ + diff --git a/modified.cs b/modified.cs + --- a/modified.cs + +++ b/modified.cs + @@ -1,2 +1,2 @@ + -old + +new + keep + diff --git a/brand_new.cs b/brand_new.cs + new file mode 100644 + --- /dev/null + +++ b/brand_new.cs + @@ -0,0 +1,1 @@ + +hello + diff --git a/doomed.cs b/doomed.cs + deleted file mode 100644 + --- a/doomed.cs + +++ /dev/null + @@ -1,1 +0,0 @@ + -goodbye + diff --git a/old_name.cs b/new_name.cs + rename from old_name.cs + rename to new_name.cs + """; + var files = DiffParser.Parse(diff); + + Assert.Equal(4, files.Count); + + Assert.Equal("modified.cs", files[0].FileName); + Assert.False(files[0].IsNew); + Assert.False(files[0].IsDeleted); + Assert.False(files[0].IsRenamed); + + Assert.Equal("brand_new.cs", files[1].FileName); + Assert.True(files[1].IsNew); + + Assert.Equal("doomed.cs", files[2].FileName); + Assert.True(files[2].IsDeleted); + + Assert.Equal("new_name.cs", files[3].FileName); + Assert.True(files[3].IsRenamed); + Assert.Equal("old_name.cs", files[3].OldFileName); + } + + // ========== EDGE CASES ========== + + [Fact] + public void Parse_CRLFLineEndings_ParsesCorrectly() + { + var diff = "diff --git a/f.cs b/f.cs\r\n--- a/f.cs\r\n+++ b/f.cs\r\n@@ -1,2 +1,2 @@\r\n-old\r\n+new\r\n keep\r\n"; + var files = DiffParser.Parse(diff); + + Assert.Single(files); + // Parser produces 3 meaningful lines: removed, added, context + // (trailing empty line from split is also parsed as context) + Assert.True(files[0].Hunks[0].Lines.Count >= 3); + Assert.Equal("old", files[0].Hunks[0].Lines[0].Content); + Assert.Equal("new", files[0].Hunks[0].Lines[1].Content); + Assert.Equal("keep", files[0].Hunks[0].Lines[2].Content); + } + + [Fact] + public void Parse_EmptyRemovedLine_ContentIsEmptyString() + { + var diff = """ + diff --git a/f.txt b/f.txt + --- a/f.txt + +++ b/f.txt + @@ -1,2 +1,1 @@ + - + keep + """; + var files = DiffParser.Parse(diff); + var removed = files[0].Hunks[0].Lines[0]; + + Assert.Equal(DiffLineType.Removed, removed.Type); + Assert.Equal("", removed.Content); + } + + [Fact] + public void Parse_EmptyAddedLine_ContentIsEmptyString() + { + var diff = """ + diff --git a/f.txt b/f.txt + --- a/f.txt + +++ b/f.txt + @@ -1,1 +1,2 @@ + keep + + + """; + var files = DiffParser.Parse(diff); + var added = files[0].Hunks[0].Lines[1]; + + Assert.Equal(DiffLineType.Added, added.Type); + Assert.Equal("", added.Content); + } + + [Fact] + public void Parse_HunkHeaderWithoutFunctionName() + { + var diff = """ + diff --git a/f.cs b/f.cs + --- a/f.cs + +++ b/f.cs + @@ -1,2 +1,2 @@ + -old + +new + """; + var files = DiffParser.Parse(diff); + Assert.Null(files[0].Hunks[0].Header); + } + + [Fact] + public void Parse_HunkHeaderWithFunctionName() + { + var diff = """ + diff --git a/f.cs b/f.cs + --- a/f.cs + +++ b/f.cs + @@ -10,5 +10,5 @@ public void MyMethod() + -old + +new + """; + var files = DiffParser.Parse(diff); + Assert.Equal("public void MyMethod()", files[0].Hunks[0].Header); + } + + [Fact] + public void Parse_LineNumbersAreSequential() + { + var diff = """ + diff --git a/f.cs b/f.cs + --- a/f.cs + +++ b/f.cs + @@ -5,4 +5,4 @@ + ctx5 + -old6 + +new6 + ctx7 + """; + var files = DiffParser.Parse(diff); + var lines = files[0].Hunks[0].Lines; + + // Context line at old 5, new 5 + Assert.Equal(5, lines[0].OldLineNo); + Assert.Equal(5, lines[0].NewLineNo); + // Removed at old 6 + Assert.Equal(6, lines[1].OldLineNo); + Assert.Null(lines[1].NewLineNo); + // Added at new 6 + Assert.Null(lines[2].OldLineNo); + Assert.Equal(6, lines[2].NewLineNo); + // Context at old 7, new 7 + Assert.Equal(7, lines[3].OldLineNo); + Assert.Equal(7, lines[3].NewLineNo); + } + + [Fact] + public void Parse_LineNumbersWithInsertions_CorrectOffset() + { + // When lines are added, new line numbers advance faster than old + var diff = """ + diff --git a/f.cs b/f.cs + --- a/f.cs + +++ b/f.cs + @@ -1,2 +1,4 @@ + keep + +added1 + +added2 + keep2 + """; + var files = DiffParser.Parse(diff); + var lines = files[0].Hunks[0].Lines; + + Assert.Equal(1, lines[0].OldLineNo); // keep: old=1 + Assert.Equal(1, lines[0].NewLineNo); // keep: new=1 + Assert.Equal(2, lines[1].NewLineNo); // added1: new=2 + Assert.Equal(3, lines[2].NewLineNo); // added2: new=3 + Assert.Equal(2, lines[3].OldLineNo); // keep2: old=2 + Assert.Equal(4, lines[3].NewLineNo); // keep2: new=4 + } + + [Fact] + public void Parse_MultipleHunks_LineNumbersResetPerHunk() + { + var diff = """ + diff --git a/f.cs b/f.cs + --- a/f.cs + +++ b/f.cs + @@ -1,2 +1,2 @@ + -old1 + +new1 + ctx + @@ -20,2 +20,2 @@ + -old20 + +new20 + ctx20 + """; + var files = DiffParser.Parse(diff); + + // First hunk starts at line 1 + Assert.Equal(1, files[0].Hunks[0].Lines[0].OldLineNo); + // Second hunk starts at line 20 + Assert.Equal(20, files[0].Hunks[1].Lines[0].OldLineNo); + } + + // ========== SHOULDRENDERDIFFVIEW INTEGRATION ========== + + [Fact] + public void ShouldRenderDiffView_ReadTool_ReturnsFalse() + { + var diff = "--- a/file.txt\n+++ b/file.txt\n@@ -1 +1 @@\n-old\n+new\n"; + Assert.False(DiffParser.ShouldRenderDiffView(diff, "Read")); + } + + [Fact] + public void ShouldRenderDiffView_NullToolName_UsesUnifiedDiffDetection() + { + var diff = "--- a/file.txt\n+++ b/file.txt\n@@ -1 +1 @@\n-old\n+new\n"; + Assert.True(DiffParser.ShouldRenderDiffView(diff, null)); + } + + [Fact] + public void ShouldRenderDiffView_PlainText_ReturnsFalse() + { + Assert.False(DiffParser.ShouldRenderDiffView("hello world", "bash")); + } + + [Fact] + public void ShouldRenderDiffView_EmptyString_ReturnsFalse() + { + Assert.False(DiffParser.ShouldRenderDiffView("", null)); + Assert.False(DiffParser.ShouldRenderDiffView(null, null)); + } + + // ========== ISPLAINTEXTVIEWTOOL ========== + + [Fact] + public void IsPlainTextViewTool_CaseInsensitive() + { + Assert.True(DiffParser.IsPlainTextViewTool("View")); + Assert.True(DiffParser.IsPlainTextViewTool("VIEW")); + Assert.True(DiffParser.IsPlainTextViewTool("view")); + Assert.True(DiffParser.IsPlainTextViewTool("Read")); + Assert.True(DiffParser.IsPlainTextViewTool("READ")); + Assert.True(DiffParser.IsPlainTextViewTool("read")); + } + + [Fact] + public void IsPlainTextViewTool_OtherTools_ReturnsFalse() + { + Assert.False(DiffParser.IsPlainTextViewTool("bash")); + Assert.False(DiffParser.IsPlainTextViewTool("edit")); + Assert.False(DiffParser.IsPlainTextViewTool(null)); + Assert.False(DiffParser.IsPlainTextViewTool("")); + } + + // ========== RECONSTRUCTION ROUND-TRIP INTEGRITY ========== + + [Fact] + public void ReconstructOriginalAndModified_SingleLineChange_ExactContent() + { + var diff = """ + diff --git a/f.txt b/f.txt + --- a/f.txt + +++ b/f.txt + @@ -1,1 +1,1 @@ + -hello world + +goodbye world + """; + var files = DiffParser.Parse(diff); + var original = DiffParser.ReconstructOriginal(files[0]); + var modified = DiffParser.ReconstructModified(files[0]); + + Assert.Equal("hello world", original); + Assert.Equal("goodbye world", modified); + } + + [Fact] + public void ReconstructOriginal_MultiHunk_GapLineCount() + { + // First hunk at line 1 (3 lines), second hunk at line 50 (2 lines) + // Gap should be lines 4-49 = 46 empty lines + var file = new DiffFile + { + FileName = "test.cs", + Hunks = new List + { + new() + { + OldStart = 1, + NewStart = 1, + Lines = new List + { + new() { Type = DiffLineType.Context, Content = "line1" }, + new() { Type = DiffLineType.Removed, Content = "old2" }, + new() { Type = DiffLineType.Context, Content = "line3" }, + } + }, + new() + { + OldStart = 50, + NewStart = 50, + Lines = new List + { + new() { Type = DiffLineType.Context, Content = "line50" }, + new() { Type = DiffLineType.Removed, Content = "old51" }, + } + } + } + }; + + var original = DiffParser.ReconstructOriginal(file); + var lines = original.Split('\n'); + + // Lines: 1=line1, 2=old2, 3=line3, 4-49=empty, 50=line50, 51=old51 + Assert.Equal("line1", lines[0]); + Assert.Equal("old2", lines[1]); + Assert.Equal("line3", lines[2]); + // Gap: lines[3] through lines[48] should be empty + for (int i = 3; i < 49; i++) + Assert.Equal("", lines[i]); + Assert.Equal("line50", lines[49]); + Assert.Equal("old51", lines[50]); + } + + [Fact] + public void ReconstructModified_WithAddedLines_GapCountAdjusted() + { + // When lines are added in hunk 1, the second hunk's NewStart is higher + var file = new DiffFile + { + FileName = "test.cs", + Hunks = new List + { + new() + { + OldStart = 1, + NewStart = 1, + Lines = new List + { + new() { Type = DiffLineType.Context, Content = "a" }, + new() { Type = DiffLineType.Added, Content = "new_line" }, + } + }, + new() + { + OldStart = 10, + NewStart = 11, // offset by +1 due to addition + Lines = new List + { + new() { Type = DiffLineType.Context, Content = "b" }, + } + } + } + }; + + var modified = DiffParser.ReconstructModified(file); + var lines = modified.Split('\n'); + + Assert.Equal("a", lines[0]); + Assert.Equal("new_line", lines[1]); + // Gap: lines[2] through lines[9] (newStart=11, currentLine after hunk1=3, gap=11-3=8) + for (int i = 2; i < 10; i++) + Assert.Equal("", lines[i]); + Assert.Equal("b", lines[10]); + } + + // ========== REAL-WORLD DIFF PATTERNS ========== + + [Fact] + public void Parse_RealWorldGitDiff_WithBinaryFileNotice() + { + // Git sometimes shows "Binary files differ" — parser should handle gracefully + var diff = """ + diff --git a/image.png b/image.png + index abc..def 100644 + Binary files a/image.png and b/image.png differ + diff --git a/code.cs b/code.cs + --- a/code.cs + +++ b/code.cs + @@ -1,1 +1,1 @@ + -old + +new + """; + var files = DiffParser.Parse(diff); + + // The binary file should be parsed as a file entry with no hunks + Assert.Equal(2, files.Count); + Assert.Equal("image.png", files[0].FileName); + Assert.Empty(files[0].Hunks); + Assert.Equal("code.cs", files[1].FileName); + Assert.Single(files[1].Hunks); + } + + [Fact] + public void Parse_DiffWithIndexLine_SkipsIt() + { + var diff = """ + diff --git a/f.cs b/f.cs + index abc1234..def5678 100644 + --- a/f.cs + +++ b/f.cs + @@ -1,1 +1,1 @@ + -old + +new + """; + var files = DiffParser.Parse(diff); + Assert.Single(files); + Assert.Single(files[0].Hunks); + Assert.Equal(2, files[0].Hunks[0].Lines.Count); + } + + [Fact] + public void Parse_ThreeHunks_AllParsed() + { + var diff = """ + diff --git a/f.cs b/f.cs + --- a/f.cs + +++ b/f.cs + @@ -1,2 +1,2 @@ + -a + +A + x + @@ -50,2 +50,2 @@ + -b + +B + y + @@ -100,2 +100,2 @@ + -c + +C + z + """; + var files = DiffParser.Parse(diff); + Assert.Single(files); + Assert.Equal(3, files[0].Hunks.Count); + Assert.Equal(1, files[0].Hunks[0].OldStart); + Assert.Equal(50, files[0].Hunks[1].OldStart); + Assert.Equal(100, files[0].Hunks[2].OldStart); + } + + [Fact] + public void Parse_HunkWithOnlyCount_NoComma() + { + // @@ -1 +1 @@ — no comma means count=1 (implied) + var diff = """ + diff --git a/f.cs b/f.cs + --- a/f.cs + +++ b/f.cs + @@ -1 +1 @@ + -old + +new + """; + var files = DiffParser.Parse(diff); + Assert.Equal(1, files[0].Hunks[0].OldStart); + Assert.Equal(1, files[0].Hunks[0].NewStart); + } + + // ========== TRYEXTRACTNUMBEREDVIEWOUTPUT EDGE CASES ========== + + [Fact] + public void TryExtractNumberedViewOutput_PlainText_ReturnsFalse() + { + Assert.False(DiffParser.TryExtractNumberedViewOutput("hello world", out _)); + } + + [Fact] + public void TryExtractNumberedViewOutput_DiffWithRealChanges_ReturnsFalse() + { + var diff = """ + diff --git a/f.txt b/f.txt + --- a/f.txt + +++ b/f.txt + @@ -1,2 +1,2 @@ + -old + +new + keep + """; + Assert.False(DiffParser.TryExtractNumberedViewOutput(diff, out _)); + } + + [Fact] + public void TryExtractNumberedViewOutput_ContextOnlyDiff_ReturnsNumberedText() + { + var diff = """ + diff --git a/f.txt b/f.txt + --- a/f.txt + +++ b/f.txt + @@ -1,2 +1,2 @@ + first + second + """; + var ok = DiffParser.TryExtractNumberedViewOutput(diff, out var text); + Assert.True(ok); + Assert.Contains("1. first", text); + Assert.Contains("2. second", text); + } } diff --git a/PolyPilot.Tests/PrLinkServiceTests.cs b/PolyPilot.Tests/PrLinkServiceTests.cs new file mode 100644 index 0000000000..8546cd9ae2 --- /dev/null +++ b/PolyPilot.Tests/PrLinkServiceTests.cs @@ -0,0 +1,98 @@ +using PolyPilot.Services; + +namespace PolyPilot.Tests; + +public class PrLinkServiceTests +{ + [Theory] + [InlineData("https://github.com/PureWeen/PolyPilot/pull/507", 507)] + [InlineData("https://github.com/PureWeen/PolyPilot/pull/507/files", 507)] + [InlineData("https://github.contoso.com/org/repo/pulls/42", 42)] + public void ExtractPrNumber_ValidUrls_ReturnsPrNumber(string url, int expected) + { + Assert.Equal(expected, PrLinkService.ExtractPrNumber(url)); + } + + [Theory] + [InlineData(null)] + [InlineData("")] + [InlineData("not-a-url")] + [InlineData("https://github.com/PureWeen/PolyPilot/issues/507")] + [InlineData("https://github.com/PureWeen/PolyPilot/pull/not-a-number")] + public void ExtractPrNumber_InvalidUrls_ReturnsNull(string? url) + { + Assert.Null(PrLinkService.ExtractPrNumber(url)); + } + + [Fact] + public async Task GetPrDiffAsync_Success_ReturnsTrimmedDiffAndUsesExpectedArgs() + { + var service = new TestPrLinkService((workingDirectory, _, args) => + Task.FromResult<(string Output, string Error, int ExitCode)>((""" + diff --git a/test.cs b/test.cs + --- a/test.cs + +++ b/test.cs + @@ -1 +1 @@ + -old + +new + """, "", 0))); + + var diff = await service.GetPrDiffAsync("/tmp/repo", 507); + + Assert.Contains("diff --git a/test.cs b/test.cs", diff); + Assert.Equal("/tmp/repo", service.LastWorkingDirectory); + Assert.Equal(["pr", "diff", "507", "--color", "never"], service.LastArgs); + } + + [Fact] + public async Task GetPrDiffAsync_GhFailure_ThrowsMeaningfulError() + { + var service = new TestPrLinkService((_, _, _) => + Task.FromResult<(string Output, string Error, int ExitCode)>(("", "gh: not logged in", 1))); + + var ex = await Assert.ThrowsAsync(() => service.GetPrDiffAsync("/tmp/repo", 507)); + + Assert.Contains("not logged in", ex.Message); + } + + [Fact] + public async Task GetPrDiffAsync_EmptyDiff_Throws() + { + var service = new TestPrLinkService((_, _, _) => + Task.FromResult<(string Output, string Error, int ExitCode)>((" ", "", 0))); + + var ex = await Assert.ThrowsAsync(() => service.GetPrDiffAsync("/tmp/repo", 507)); + + Assert.Contains("does not have any diff content", ex.Message); + } + + [Theory] + [InlineData("", 507, "working directory")] + [InlineData("/tmp/repo", 0, "greater than zero")] + public async Task GetPrDiffAsync_InvalidArguments_Throw(string workingDirectory, int prNumber, string expected) + { + var service = new TestPrLinkService((_, _, _) => + Task.FromResult<(string Output, string Error, int ExitCode)>(("", "", 0))); + + var ex = await Assert.ThrowsAnyAsync(() => service.GetPrDiffAsync(workingDirectory, prNumber)); + + Assert.Contains(expected, ex.Message, StringComparison.OrdinalIgnoreCase); + } + + private sealed class TestPrLinkService( + Func> runner) : PrLinkService + { + public string? LastWorkingDirectory { get; private set; } + public string[]? LastArgs { get; private set; } + + protected override Task<(string Output, string Error, int ExitCode)> RunGhAsync( + string workingDirectory, + CancellationToken cancellationToken, + params string[] args) + { + LastWorkingDirectory = workingDirectory; + LastArgs = args; + return runner(workingDirectory, cancellationToken, args); + } + } +} diff --git a/PolyPilot.Tests/StaticAssetContractTests.cs b/PolyPilot.Tests/StaticAssetContractTests.cs new file mode 100644 index 0000000000..3445862959 --- /dev/null +++ b/PolyPilot.Tests/StaticAssetContractTests.cs @@ -0,0 +1,32 @@ +using System.Text.RegularExpressions; + +namespace PolyPilot.Tests; + +public class StaticAssetContractTests +{ + private static string GetRepoRoot() + { + var dir = AppContext.BaseDirectory; + while (dir != null && !File.Exists(Path.Combine(dir, "PolyPilot.slnx"))) + dir = Directory.GetParent(dir)?.FullName; + + return dir ?? throw new DirectoryNotFoundException("Could not find repo root (PolyPilot.slnx not found)"); + } + + private static string IndexHtmlPath => + Path.Combine(GetRepoRoot(), "PolyPilot", "wwwroot", "index.html"); + + [Fact] + public void IndexHtml_LoadsLocalCodeMirrorBundleWithoutFragileIntegrityAttributes() + { + var html = File.ReadAllText(IndexHtmlPath); + var match = Regex.Match( + html, + @"]*>", + RegexOptions.IgnoreCase); + + Assert.True(match.Success, "Could not find the local CodeMirror bundle script tag in wwwroot/index.html."); + Assert.DoesNotContain("integrity=", match.Value, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("crossorigin=", match.Value, StringComparison.OrdinalIgnoreCase); + } +} diff --git a/PolyPilot/Components/ChatMessageItem.razor b/PolyPilot/Components/ChatMessageItem.razor index 7aa1f6ecb3..d846a08d7d 100644 --- a/PolyPilot/Components/ChatMessageItem.razor +++ b/PolyPilot/Components/ChatMessageItem.razor @@ -233,17 +233,10 @@ } else if (_hasDiffOutput) { - var _parsedDiff = DiffParser.Parse(Message.Content); - if (_parsedDiff.Count > 0) - { -
- -
- } - else - { -
@ChatMessageList.TruncateResult(Message.Content)
- } +
+ +
} else if (DiffParser.TryExtractNumberedViewOutput(Message.Content, out var _plainViewOutput)) { @@ -420,6 +413,7 @@ [Parameter] public bool IsStreaming { get; set; } [Parameter] public string? UserAvatarUrl { get; set; } [Parameter] public string? RepoUrl { get; set; } + [Parameter] public EventCallback OnDiffCommentRequested { get; set; } private static string? GetImageSource(ChatMessage msg) => msg.ImageDataUri ?? (!string.IsNullOrEmpty(msg.ImagePath) ? ChatMessageList.FileToDataUri(msg.ImagePath) : null); diff --git a/PolyPilot/Components/ChatMessageList.razor b/PolyPilot/Components/ChatMessageList.razor index ec4581d923..452c3e29a7 100644 --- a/PolyPilot/Components/ChatMessageList.razor +++ b/PolyPilot/Components/ChatMessageList.razor @@ -12,7 +12,12 @@ { @foreach (var msg in Messages.ToList()) { - + } @* Current turn tool activity feed — skip activities already in history *@ @@ -135,6 +140,7 @@ [Parameter] public string? RepoUrl { get; set; } [Parameter] public bool HasPermissionIssue { get; set; } [Parameter] public EventCallback OnReconnectRequested { get; set; } + [Parameter] public EventCallback OnDiffCommentRequested { get; set; } private string GetProcessingStatus() { diff --git a/PolyPilot/Components/DiffView.razor b/PolyPilot/Components/DiffView.razor index 349a3213cd..e1f135ba54 100644 --- a/PolyPilot/Components/DiffView.razor +++ b/PolyPilot/Components/DiffView.razor @@ -1,4 +1,7 @@ @using PolyPilot.Models +@using Microsoft.JSInterop +@inject IJSRuntime JS +@implements IAsyncDisposable @if (Files.Count == 0) { @@ -7,55 +10,154 @@ else {
- @foreach (var file in Files) +
+
+ @SummaryLabel + + +@TotalAdded + -@TotalRemoved + +
+ + @if (Files.Count > 1) + { + + } +
+ + @if (!_state.IsFilePickerCollapsed || Files.Count == 1) { -
+
+ @for (var fileIdx = 0; fileIdx < Files.Count; fileIdx++) + { + var listFile = Files[fileIdx]; + var capturedIdx = fileIdx; + + + } +
+ } + + @if (SelectedFile is { } selectedFile) + { + var selectedIdx = _state.SelectedFileIndex; + +
- - @(file.IsNew ? "NEW" : file.IsDeleted ? "DEL" : file.IsRenamed ? "REN" : "MOD") - - - @if (file.IsRenamed) - { - @file.OldFileName → @file.FileName - } - else - { - @file.FileName - } - + @selectedFile.StatusLabel + @selectedFile.DisplayName - @{ var added = file.Hunks.SelectMany(h => h.Lines).Count(l => l.Type == DiffLineType.Added); } - @{ var removed = file.Hunks.SelectMany(h => h.Lines).Count(l => l.Type == DiffLineType.Removed); } - @if (added > 0) { +@added } - @if (removed > 0) { -@removed } + +@selectedFile.AddedLineCount + -@selectedFile.RemovedLineCount + + + +
- @if (!file.IsDeleted || file.Hunks.Count > 0) - { -
- + + @if (CanComment) + { +
Click any line number to send review feedback to chat.
+ } + + @if (_commentDraft is not null) + { +
+
+ Comment on @_commentDraft.FileName:@_commentDraft.LineNumber +
+ +
+ + +
+
+ } + + @if (selectedFile.Hunks.Count == 0) + { +
No diff hunks available for this file.
+ } + else if (_state.GetViewMode(selectedIdx) == DiffViewMode.Editor) + { +
+ } + else + { +
+
- @foreach (var hunk in file.Hunks) - { - @if (!string.IsNullOrEmpty(hunk.Header)) - { - + @foreach (var hunk in selectedFile.Hunks) + { + @if (!string.IsNullOrEmpty(hunk.Header)) + { + - } - @foreach (var row in DiffParser.PairLines(hunk)) - { + } + @foreach (var row in DiffParser.PairLines(hunk)) + { - - - - + + + + } } @@ -69,8 +171,25 @@ else @code { [Parameter] public string RawDiff { get; set; } = ""; + [Parameter] public EventCallback OnCommentRequested { get; set; } private List Files { get; set; } = new(); private string? _lastRawDiff; + private readonly DiffViewState _state = new(); + private readonly Dictionary _cmInstances = new(); + private readonly HashSet _pendingEditorInit = new(); + private readonly string _instancePrefix = Guid.NewGuid().ToString("N")[..8]; + private DotNetObjectReference? _dotNetRef; + private DiffLineCommentRequest? _commentDraft; + private string _commentText = ""; + private bool _disposed; + + private DiffFile? SelectedFile => + _state.SelectedFileIndex >= 0 && _state.SelectedFileIndex < Files.Count ? Files[_state.SelectedFileIndex] : null; + + private int TotalAdded => Files.Sum(file => file.AddedLineCount); + private int TotalRemoved => Files.Sum(file => file.RemovedLineCount); + private string SummaryLabel => Files.Count == 1 ? "1 file changed" : $"{Files.Count} files changed"; + private bool CanComment => OnCommentRequested.HasDelegate; protected override void OnParametersSet() { @@ -78,7 +197,187 @@ else { _lastRawDiff = RawDiff; Files = DiffParser.Parse(RawDiff); + _state.Reset(Files); + _commentDraft = null; + _commentText = ""; + + // Snapshot IDs before clearing so fire-and-forget only disposes these exact instances + var idsToDispose = _cmInstances.Values.ToArray(); + _cmInstances.Clear(); + _pendingEditorInit.Clear(); + + _ = DisposeJsInstancesByIdAsync(idsToDispose); + } + } + + private void ToggleFilePicker() => _state.ToggleFilePicker(); + + private void SelectFile(int fileIdx) + { + var previousIdx = _state.SelectedFileIndex; + if (!_state.SelectFile(fileIdx, Files.Count)) + return; + + DisposeEditorInstance(previousIdx); + CancelComment(); + + if (_state.GetViewMode(fileIdx) == DiffViewMode.Editor) + _pendingEditorInit.Add(fileIdx); + } + + private void SetViewMode(int fileIdx, DiffViewMode mode) + { + CancelComment(); + + if (mode == DiffViewMode.Editor) + { + DisposeEditorInstance(fileIdx); + _state.SetViewMode(fileIdx, mode); + _pendingEditorInit.Add(fileIdx); + } + else + { + _state.SetViewMode(fileIdx, mode); + _pendingEditorInit.Remove(fileIdx); + + // Snapshot and remove before the async JS call + if (_cmInstances.Remove(fileIdx, out var instanceId)) + { + _ = DisposeJsInstancesByIdAsync(new[] { instanceId }); + } + } + } + + private void DisposeEditorInstance(int fileIdx) + { + if (fileIdx < 0) + return; + + if (_cmInstances.Remove(fileIdx, out var instanceId)) + _ = DisposeJsInstancesByIdAsync(new[] { instanceId }); + } + + private void BeginLineComment(int fileIdx, string fileName, int lineNumber, bool isOriginalSide) + { + if (!CanComment) + return; + + SelectFile(fileIdx); + _commentDraft = new DiffLineCommentRequest(fileName, lineNumber, "", isOriginalSide ? "original" : "modified"); + _commentText = ""; + } + + private void CancelComment() + { + _commentDraft = null; + _commentText = ""; + } + + private async Task SubmitCommentAsync() + { + if (_commentDraft is null || string.IsNullOrWhiteSpace(_commentText)) + return; + + var request = _commentDraft with { Comment = _commentText.Trim() }; + await OnCommentRequested.InvokeAsync(request); + CancelComment(); + } + + [JSInvokable] + public Task HandleEditorLineClick(int fileIdx, string fileName, string side, int lineNumber) + { + BeginLineComment(fileIdx, fileName, lineNumber, side.Equals("original", StringComparison.OrdinalIgnoreCase)); + return InvokeAsync(StateHasChanged); + } + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if (_pendingEditorInit.Count > 0) + { + var pending = _pendingEditorInit.ToArray(); + _pendingEditorInit.Clear(); + + foreach (var fileIdx in pending) + { + await InitCodeMirrorForFile(fileIdx); + } } } + private async Task InitCodeMirrorForFile(int fileIdx) + { + if (fileIdx >= Files.Count) return; + + // Double-init guard: if an instance already exists for this file, skip + if (_cmInstances.ContainsKey(fileIdx)) return; + + var gen = _state.Generation; + var file = Files[fileIdx]; + var containerId = $"cm-diff-{_instancePrefix}-{fileIdx}"; + var original = DiffParser.ReconstructOriginal(file); + var modified = DiffParser.ReconstructModified(file); + + try + { + _dotNetRef ??= DotNetObjectReference.Create(this); + var instanceId = await JS.InvokeAsync( + "PolyPilotCodeMirror.createMergeView", + containerId, original, modified, file.FileName, fileIdx, _dotNetRef, CanComment); + + if (instanceId < 0) + { + _state.SetViewMode(fileIdx, DiffViewMode.Table); + await InvokeAsync(StateHasChanged); + return; + } + + // Stale init guard: if generation changed during await, discard the orphan + if (_state.Generation != gen || _disposed) + { + try { await JS.InvokeVoidAsync("PolyPilotCodeMirror.dispose", instanceId); } + catch (Exception ex) { Console.Error.WriteLine($"[DiffView] Failed to dispose stale CM instance {instanceId}: {ex.Message}"); } + return; + } + + if (instanceId >= 0) + _cmInstances[fileIdx] = instanceId; + } + catch (Exception ex) + { + Console.Error.WriteLine($"[DiffView] Failed to create CM merge view for {file.FileName}: {ex.Message}"); + _state.SetViewMode(fileIdx, DiffViewMode.Table); + await InvokeAsync(StateHasChanged); + } + } + + /// + /// Disposes specific JS CodeMirror instances by their IDs. Does not touch _cmInstances dictionary. + /// Callers must snapshot and remove IDs from _cmInstances before calling. + /// + private async Task DisposeJsInstancesByIdAsync(int[] instanceIds) + { + foreach (var instanceId in instanceIds) + { + try + { + await JS.InvokeVoidAsync("PolyPilotCodeMirror.dispose", instanceId); + } + catch (Exception ex) + { + Console.Error.WriteLine($"[DiffView] Failed to dispose CM instance {instanceId}: {ex.Message}"); + } + } + } + + public async ValueTask DisposeAsync() + { + if (_disposed) return; + _disposed = true; + + var idsToDispose = _cmInstances.Values.ToArray(); + _cmInstances.Clear(); + _dotNetRef?.Dispose(); + _dotNetRef = null; + await DisposeJsInstancesByIdAsync(idsToDispose); + } } diff --git a/PolyPilot/Components/DiffView.razor.css b/PolyPilot/Components/DiffView.razor.css index 0c8ad50824..5aad34826d 100644 --- a/PolyPilot/Components/DiffView.razor.css +++ b/PolyPilot/Components/DiffView.razor.css @@ -5,6 +5,7 @@ overflow: hidden; border: 1px solid var(--control-border, rgba(255,255,255,0.1)); margin: 0.5rem 0; + background: var(--bg-primary, rgba(255,255,255,0.02)); } .diff-empty { @@ -13,6 +14,108 @@ padding: 0.5rem; } +.diff-summary-bar { + display: flex; + align-items: center; + justify-content: space-between; + gap: 0.75rem; + padding: 0.55rem 0.8rem; + background: var(--bg-secondary, rgba(255,255,255,0.04)); + border-bottom: 1px solid var(--control-border, rgba(255,255,255,0.1)); + font-family: var(--font-base); +} + +.diff-summary { + display: flex; + align-items: center; + gap: 0.6rem; + min-width: 0; +} + +.diff-summary-title { + color: var(--text-primary, #c8d8f0); + font-size: var(--type-caption1); + font-weight: 700; + white-space: nowrap; +} + +.diff-summary-stats { + display: flex; + gap: 0.4rem; + font-size: var(--type-caption1); + font-weight: 600; +} + +.diff-picker-toggle { + border: 1px solid var(--control-border, rgba(255,255,255,0.12)); + background: transparent; + color: var(--text-dim, rgba(200,216,240,0.8)); + border-radius: 6px; + padding: 0.2rem 0.55rem; + font-size: var(--type-caption1); + font-family: var(--font-base); + cursor: pointer; + white-space: nowrap; +} + +.diff-picker-toggle:hover { + color: var(--text-primary, #c8d8f0); + background: rgba(255,255,255,0.05); +} + +.diff-file-picker { + display: flex; + gap: 0.5rem; + padding: 0.55rem 0.8rem; + overflow-x: auto; + border-bottom: 1px solid var(--control-border, rgba(255,255,255,0.08)); + background: color-mix(in srgb, var(--bg-secondary, rgba(255,255,255,0.04)) 65%, transparent); + scrollbar-width: thin; +} + +.diff-file-tab { + display: inline-flex; + align-items: center; + gap: 0.45rem; + max-width: min(28rem, 100%); + padding: 0.35rem 0.55rem; + border-radius: 8px; + border: 1px solid var(--control-border, rgba(255,255,255,0.1)); + background: transparent; + color: var(--text-dim, rgba(200,216,240,0.82)); + cursor: pointer; + font-family: var(--font-base); + font-size: var(--type-caption1); + transition: all 0.15s ease; +} + +.diff-file-tab:hover { + color: var(--text-primary, #c8d8f0); + border-color: color-mix(in srgb, var(--accent-primary, #4ea8d1) 35%, var(--control-border, rgba(255,255,255,0.1))); + background: rgba(255,255,255,0.04); +} + +.diff-file-tab.selected { + color: var(--text-primary, #c8d8f0); + background: color-mix(in srgb, var(--accent-primary, #4ea8d1) 12%, transparent); + border-color: color-mix(in srgb, var(--accent-primary, #4ea8d1) 50%, var(--control-border, rgba(255,255,255,0.1))); + box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-primary, #4ea8d1) 30%, transparent); +} + +.diff-file-tab-name { + min-width: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + font-weight: 600; +} + +.diff-file-tab-stats { + display: inline-flex; + gap: 0.35rem; + white-space: nowrap; +} + .diff-file { border-bottom: 1px solid var(--control-border, rgba(255,255,255,0.1)); } @@ -24,6 +127,7 @@ .diff-file-header { display: flex; align-items: center; + flex-wrap: wrap; gap: 0.5rem; padding: 0.4rem 0.8rem; background: var(--bg-tertiary, rgba(255,255,255,0.05)); @@ -61,6 +165,86 @@ .stat-add { color: var(--diff-stat-add); } .stat-del { color: var(--diff-stat-del); } +.diff-empty-body { + padding: 0.75rem 0.8rem; + color: var(--text-dim, #6a7a8a); + font-family: var(--font-base); + font-size: var(--type-caption1); +} + +.diff-comment-hint { + padding: 0.45rem 0.8rem 0; + color: var(--text-dim, rgba(200,216,240,0.72)); + font-family: var(--font-base); + font-size: var(--type-caption1); +} + +.diff-comment-box { + margin: 0.45rem 0.8rem 0.7rem; + padding: 0.7rem; + border-radius: 8px; + border: 1px solid color-mix(in srgb, var(--accent-primary, #4ea8d1) 35%, transparent); + background: color-mix(in srgb, var(--accent-primary, #4ea8d1) 8%, var(--bg-secondary, rgba(255,255,255,0.04))); +} + +.diff-comment-title { + margin-bottom: 0.45rem; + color: var(--text-primary, #c8d8f0); + font-family: var(--font-base); + font-size: var(--type-caption1); + font-weight: 600; +} + +.diff-comment-title code { + font-family: var(--font-mono); + font-size: inherit; +} + +.diff-comment-input { + width: 100%; + min-height: 4.5rem; + resize: vertical; + border-radius: 8px; + border: 1px solid var(--control-border, rgba(255,255,255,0.12)); + background: rgba(10, 16, 30, 0.55); + color: var(--text-primary, #c8d8f0); + padding: 0.6rem 0.7rem; + font: inherit; +} + +.diff-comment-actions { + display: flex; + justify-content: flex-end; + gap: 0.5rem; + margin-top: 0.55rem; +} + +.diff-comment-send, +.diff-comment-cancel { + border-radius: 6px; + border: 1px solid var(--control-border, rgba(255,255,255,0.12)); + padding: 0.3rem 0.7rem; + font-family: var(--font-base); + font-size: var(--type-caption1); + cursor: pointer; +} + +.diff-comment-send { + background: var(--accent-primary, #4ea8d1); + color: #fff; + border-color: color-mix(in srgb, var(--accent-primary, #4ea8d1) 60%, transparent); +} + +.diff-comment-send:disabled { + opacity: 0.55; + cursor: default; +} + +.diff-comment-cancel { + background: transparent; + color: var(--text-primary, #c8d8f0); +} + .diff-panes { overflow-x: auto; max-width: 100%; @@ -105,6 +289,29 @@ border-right: 1px solid var(--control-border, rgba(255,255,255,0.06)); } +.diff-line-anchor { + all: unset; + display: inline-block; + min-width: 100%; + cursor: pointer; + color: inherit; + text-align: right; + border-radius: 4px; + padding: 0 2px; +} + +.diff-line-anchor:hover:not(:disabled), +.diff-line-anchor:focus-visible { + color: var(--text-primary, #c8d8f0); + background: rgba(255,255,255,0.06); + outline: none; +} + +.diff-line-anchor:disabled { + cursor: default; + opacity: 1; +} + .diff-code { padding: 0.08rem 0.72rem; vertical-align: top; @@ -155,3 +362,54 @@ border-top: 1px solid var(--control-border, rgba(255,255,255,0.06)); border-bottom: 1px solid var(--control-border, rgba(255,255,255,0.06)); } + +/* Toggle buttons for Table/Editor view */ +.diff-view-toggle { + display: flex; + gap: 1px; + margin-left: auto; + background: var(--control-border, rgba(255,255,255,0.1)); + border-radius: 5px; + overflow: hidden; +} + +.toggle-btn { + background: var(--bg-secondary, rgba(255,255,255,0.03)); + color: var(--text-dim, rgba(200,216,240,0.5)); + border: none; + padding: 0.15rem 0.5rem; + font-size: var(--type-caption1, 0.6rem); + cursor: pointer; + transition: all 0.15s ease; + font-family: var(--font-base); + font-weight: 500; + line-height: 1.4; +} + +.toggle-btn:hover { + color: var(--text-primary, #c8d8f0); + background: rgba(255,255,255,0.06); +} + +.toggle-btn.active { + background: var(--accent-primary, #4ea8d1); + color: #fff; +} + +/* CodeMirror merge view container */ +.diff-cm-container { + min-height: 100px; + max-height: 600px; + overflow: auto; + border-radius: 0 0 8px 8px; +} + +.diff-file-tab:focus-visible, +.diff-picker-toggle:focus-visible, +.toggle-btn:focus-visible, +.diff-comment-input:focus-visible, +.diff-comment-send:focus-visible, +.diff-comment-cancel:focus-visible { + outline: 2px solid color-mix(in srgb, var(--accent-primary, #4ea8d1) 70%, white); + outline-offset: 2px; +} diff --git a/PolyPilot/Components/ExpandedSessionView.razor b/PolyPilot/Components/ExpandedSessionView.razor index 5310b279b0..ec0b36bb75 100644 --- a/PolyPilot/Components/ExpandedSessionView.razor +++ b/PolyPilot/Components/ExpandedSessionView.razor @@ -43,9 +43,20 @@

@displayName

- @if (_prUrl != null && PlatformHelper.IsDesktop) + @if (HasLinkedPr && PlatformHelper.IsDesktop) { - + + } @if (!string.IsNullOrEmpty(headerSecondaryIdentity)) { @@ -192,150 +203,153 @@
} -
- @{ var expandedMessages = GetWindowedMessages(); } - @if (IsLoadingHistory) - { -
-
- Loading conversation… -
- } - else - { - @if (HasMoreRemoteHistory) - { - - } - else if (Session.History.Count > expandedMessages.Count) - { - - } - } - -
- - @if (!string.IsNullOrEmpty(Error)) - { -
- ⚠️ @Error - -
- } - -
- @if (_isListening) - { -
-
- -

@(string.IsNullOrEmpty(_partialText) ? "Listening…" : _partialText)

- @if (!string.IsNullOrEmpty(_partialText)) +
+
+
+ @{ var expandedMessages = GetWindowedMessages(); } + @if (IsLoadingHistory) + { +
+
+ Loading conversation… +
+ } + else + { + @if (HasMoreRemoteHistory) { - } -
+ else if (Session.History.Count > expandedMessages.Count) + { + + } + } +
- } - @{ - var queueSnapshot = Session.MessageQueue.Snapshot(); - var hasInputMeta = !string.IsNullOrEmpty(Intent) || queueSnapshot.Count > 0 || (PendingImages?.Any() == true); - } - @if (hasInputMeta) - { -
- @if (!string.IsNullOrEmpty(Intent)) + + @if (!string.IsNullOrEmpty(Error)) + { +
+ ⚠️ @Error + +
+ } + +
+ @if (_isListening) { -
💭 @Intent
+
+
+ +

@(string.IsNullOrEmpty(_partialText) ? "Listening…" : _partialText)

+ @if (!string.IsNullOrEmpty(_partialText)) + { + + } +
+
} - @if (queueSnapshot.Count > 0) + @{ + var queueSnapshot = Session.MessageQueue.Snapshot(); + var hasInputMeta = !string.IsNullOrEmpty(Intent) || queueSnapshot.Count > 0 || (PendingImages?.Any() == true); + } + @if (hasInputMeta) { -
-
- 📋 Queued (@queueSnapshot.Count) - -
- @for (var i = 0; i < queueSnapshot.Count; i++) +
+ @if (!string.IsNullOrEmpty(Intent)) { - var index = i; - var msg = queueSnapshot[i]; -
- @(index + 1) - @Truncate(msg, 80) - +
💭 @Intent
+ } + @if (queueSnapshot.Count > 0) + { +
+
+ 📋 Queued (@queueSnapshot.Count) + +
+ @for (var i = 0; i < queueSnapshot.Count; i++) + { + var index = i; + var msg = queueSnapshot[i]; +
+ @(index + 1) + @Truncate(msg, 80) + +
+ }
} -
- } - @if (PendingImages != null && PendingImages.Any()) - { -
- @for (var pi = 0; pi < PendingImages.Count; pi++) + @if (PendingImages != null && PendingImages.Any()) { - var pidx = pi; - var pimg = PendingImages[pi]; -
- @pimg.FileName - - @TruncateFileName(pimg.FileName, 15) +
+ @for (var pi = 0; pi < PendingImages.Count; pi++) + { + var pidx = pi; + var pimg = PendingImages[pi]; +
+ @pimg.FileName + + @TruncateFileName(pimg.FileName, 15) +
+ }
}
} -
- } -
- - - - - @if (Session.IsProcessing) - { - - } - -
-
+
+ + + + + @if (Session.IsProcessing) + { + + } + +
+
@@ -411,7 +425,67 @@ }
+
+
+ + @if (_showReviewPanel && PlatformHelper.IsDesktop) + { + + }
@@ -707,6 +781,24 @@ private string _prLabel = "PR"; private string? _lastPrCheckedDir; private string? _lastExpandedSessionId; + private bool _showReviewPanel; + private bool _prDiffLoading; + private string? _prDiffContent; + private string? _prDiffError; + private string? _prDiffCacheKey; + private int? _loadedReviewPrNumber; + private string? _loadedReviewDir; + private int _prDiffRequestVersion; + + private int? CurrentPrNumber => PrLinkService.ExtractPrNumber(_prUrl) ?? Session.PrNumber; + private bool HasLinkedPr => CurrentPrNumber is > 0; + private string PrDisplayLabel => CurrentPrNumber is int prNumber ? $"#{prNumber}" : _prLabel; + private string? EffectivePrUrl => + LinkHelper.IsValidExternalUrl(_prUrl) + ? _prUrl + : CurrentPrNumber is int prNumber && LinkHelper.IsValidExternalUrl(RepoUrl) + ? $"{RepoUrl!.TrimEnd('/')}/pull/{prNumber}" + : null; private List? availableSkills; private List? availableAgents; @@ -803,6 +895,13 @@ { _prUrl = null; _prLabel = "PR"; + _showReviewPanel = false; + _prDiffLoading = false; + _prDiffContent = null; + _prDiffError = null; + _prDiffCacheKey = null; + _loadedReviewPrNumber = null; + _loadedReviewDir = null; } if (!string.IsNullOrEmpty(dir)) @@ -827,17 +926,121 @@ var url = await PrLinkService.GetPrUrlForDirectoryAsync(dir); if (Session.SessionId != capturedId) return; _prUrl = url; - if (_prUrl != null) + var prNumber = PrLinkService.ExtractPrNumber(_prUrl) ?? Session.PrNumber; + _prLabel = prNumber is > 0 ? $"#{prNumber}" : "PR"; + + if (_showReviewPanel && !_prDiffLoading && string.IsNullOrWhiteSpace(_prDiffContent) && prNumber is > 0) + _ = LoadPrDiffAsync(forceReload: true); + + try { await InvokeAsync(StateHasChanged); } catch (ObjectDisposedException) { } + } + + private async Task OpenPrLinkAsync() + { + if (!LinkHelper.IsValidExternalUrl(EffectivePrUrl)) + return; + + try { - var lastSlash = _prUrl.LastIndexOf('/'); - if (lastSlash >= 0 && lastSlash < _prUrl.Length - 1) - _prLabel = "#" + _prUrl[(lastSlash + 1)..]; + await Launcher.Default.OpenAsync(new Uri(EffectivePrUrl!)); } - else + catch (Exception ex) { - _prLabel = "PR"; + _prDiffError = $"Could not open the PR link: {ex.Message}"; + await InvokeAsync(StateHasChanged); } - try { await InvokeAsync(StateHasChanged); } catch (ObjectDisposedException) { } + } + + private async Task ToggleReviewPanelAsync() + { + if (_showReviewPanel) + { + CloseReviewPanel(); + return; + } + + _showReviewPanel = true; + await LoadPrDiffAsync(); + } + + private void CloseReviewPanel() + { + _showReviewPanel = false; + } + + private Task RefreshPrDiffAsync() => LoadPrDiffAsync(forceReload: true); + + private async Task LoadPrDiffAsync(bool forceReload = false) + { + if (!PlatformHelper.IsDesktop) + { + _prDiffError = "The review panel is only available on desktop."; + return; + } + + var workDir = Session.WorkingDirectory; + if (string.IsNullOrWhiteSpace(workDir)) + { + _prDiffError = "This session doesn’t have a working directory, so there’s no PR context to review."; + return; + } + + var prNumber = CurrentPrNumber; + if (prNumber is null or <= 0) + { + _prDiffError = "No linked PR was found for this session."; + return; + } + + if (!forceReload && + !string.IsNullOrWhiteSpace(_prDiffContent) && + _loadedReviewPrNumber == prNumber && + string.Equals(_loadedReviewDir, workDir, StringComparison.Ordinal)) + { + return; + } + + var capturedSessionId = Session.SessionId; + var requestVersion = ++_prDiffRequestVersion; + _prDiffLoading = true; + _prDiffError = null; + if (forceReload) + _prDiffContent = null; + + try + { + var diff = await PrLinkService.GetPrDiffAsync(workDir, prNumber.Value); + if (capturedSessionId != Session.SessionId || requestVersion != _prDiffRequestVersion) + return; + + _prDiffContent = diff; + _prDiffCacheKey = $"{prNumber}:{diff.Length}"; + _loadedReviewPrNumber = prNumber; + _loadedReviewDir = workDir; + } + catch (Exception ex) + { + if (capturedSessionId != Session.SessionId || requestVersion != _prDiffRequestVersion) + return; + + _prDiffError = ex.Message; + } + finally + { + if (capturedSessionId == Session.SessionId && requestVersion == _prDiffRequestVersion) + { + _prDiffLoading = false; + try { await InvokeAsync(StateHasChanged); } catch (ObjectDisposedException) { } + } + } + } + + private async Task HandleDiffCommentAsync(DiffLineCommentRequest request) + { + var inputId = $"input-{Session.Name.Replace(" ", "-")}"; + await JS.InvokeVoidAsync("clearElementValue", inputId); + await JS.InvokeVoidAsync("appendSpeechText", inputId, request.ToPrompt()); + await OnSend.InvokeAsync(Session.Name); } private async Task OnEffortChanged(ChangeEventArgs e) diff --git a/PolyPilot/Components/ExpandedSessionView.razor.css b/PolyPilot/Components/ExpandedSessionView.razor.css index 8197b9bb79..1d79ebc8af 100644 --- a/PolyPilot/Components/ExpandedSessionView.razor.css +++ b/PolyPilot/Components/ExpandedSessionView.razor.css @@ -40,6 +40,31 @@ flex-shrink: 0; } .pr-badge:hover { background: #0550ae; } + +.review-badge { + display: inline-flex; + align-items: center; + gap: 0.28rem; + background: transparent; + color: var(--accent-primary, #4ea8d1); + font-size: var(--type-caption2); + font-weight: 700; + padding: 0.14rem 0.5rem; + border: 1px solid color-mix(in srgb, var(--accent-primary, #4ea8d1) 45%, transparent); + border-radius: 999px; + cursor: pointer; + line-height: 1.2; + flex-shrink: 0; +} + +.review-badge:hover { + background: color-mix(in srgb, var(--accent-primary, #4ea8d1) 12%, transparent); +} + +.review-badge.active { + background: color-mix(in srgb, var(--accent-primary, #4ea8d1) 18%, transparent); + color: var(--text-primary); +} .chat-header-actions { display: flex; align-items: center; gap: 0.4rem; flex: 0 0 auto; margin-left: auto; } /* Info popover */ @@ -331,6 +356,141 @@ gap: 0.5rem; } +.expanded-content { + flex: 1; + min-height: 0; + min-width: 0; + display: flex; + overflow: hidden; +} + +.expanded-main-pane { + flex: 1 1 auto; + min-width: 0; + min-height: 0; + display: flex; + flex-direction: column; + overflow: hidden; +} + +.review-panel { + flex: 0 0 50%; + min-width: 360px; + max-width: 50%; + border-left: 1px solid var(--control-border); + background: color-mix(in srgb, var(--bg-secondary) 72%, var(--bg-primary) 28%); + display: flex; + flex-direction: column; + min-height: 0; + overflow: hidden; +} + +.review-panel-header { + display: flex; + align-items: center; + justify-content: space-between; + gap: 0.75rem; + padding: 0.7rem 0.85rem; + border-bottom: 1px solid var(--control-border); + background: rgba(var(--accent-rgb, 78,168,209),0.05); +} + +.review-panel-heading { + min-width: 0; + display: flex; + flex-direction: column; + gap: 0.2rem; +} + +.review-panel-title { + font-size: var(--type-callout); + font-weight: 700; + color: var(--text-primary); +} + +.review-panel-subtitle { + font-size: var(--type-footnote); + color: var(--text-muted); + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.review-panel-actions { + display: inline-flex; + align-items: center; + gap: 0.45rem; +} + +.review-panel-action, +.review-panel-close { + border: 1px solid var(--control-border); + background: rgba(255,255,255,0.04); + color: var(--text-secondary); + border-radius: 8px; + cursor: pointer; + transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease; +} + +.review-panel-action { + padding: 0.3rem 0.65rem; + font-size: var(--type-footnote); +} + +.review-panel-close { + width: 2rem; + height: 2rem; + font-size: var(--type-callout); + line-height: 1; +} + +.review-panel-action:hover:not(:disabled), +.review-panel-close:hover { + background: rgba(255,255,255,0.08); + color: var(--text-primary); + border-color: rgba(255,255,255,0.16); +} + +.review-panel-action:disabled { + opacity: 0.55; + cursor: default; +} + +.review-panel-body { + flex: 1; + min-height: 0; + overflow: auto; + padding: 0.75rem; +} + +.review-panel-state { + min-height: 12rem; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + gap: 0.75rem; + color: var(--text-secondary); + font-size: var(--type-callout); + text-align: center; +} + +.review-panel-error { + display: flex; + flex-direction: column; + gap: 0.35rem; + padding: 0.8rem 0.9rem; + border-radius: 10px; + border: 1px solid color-mix(in srgb, rgba(239, 68, 68, 0.4) 70%, transparent); + background: color-mix(in srgb, rgba(239, 68, 68, 0.12) 75%, var(--bg-primary)); + color: #fca5a5; + font-size: var(--type-footnote); +} + +.review-panel-body ::deep .diff-viewer { + margin: 0; +} + /* Messages area (expanded) */ .expanded-card .messages { flex: 1; @@ -920,3 +1080,17 @@ font-size: var(--type-footnote); } } + +@media (max-width: 1100px) { + .expanded-content.split-review { + flex-direction: column; + } + + .review-panel { + flex: 0 0 45%; + max-width: none; + min-width: 0; + border-left: none; + border-top: 1px solid var(--control-border); + } +} diff --git a/PolyPilot/Models/DiffParser.cs b/PolyPilot/Models/DiffParser.cs index 7d0a4a44bb..40a699c270 100644 --- a/PolyPilot/Models/DiffParser.cs +++ b/PolyPilot/Models/DiffParser.cs @@ -2,6 +2,61 @@ namespace PolyPilot.Models; +public enum DiffViewMode +{ + Table, + Editor +} + +public sealed class DiffViewState +{ + private readonly Dictionary _viewModes = new(); + + public int Generation { get; private set; } + public int SelectedFileIndex { get; private set; } = -1; + public bool IsFilePickerCollapsed { get; private set; } + public IReadOnlyDictionary ViewModes => _viewModes; + + public void Reset(IReadOnlyList files) + { + Generation++; + SelectedFileIndex = files.Count > 0 ? 0 : -1; + IsFilePickerCollapsed = false; + _viewModes.Clear(); + } + + public void ToggleFilePicker() => IsFilePickerCollapsed = !IsFilePickerCollapsed; + + public bool SelectFile(int fileIdx, int fileCount) + { + if (fileIdx < 0 || fileIdx >= fileCount || fileIdx == SelectedFileIndex) + return false; + + SelectedFileIndex = fileIdx; + return true; + } + + public DiffViewMode GetViewMode(int fileIdx) => + _viewModes.TryGetValue(fileIdx, out var mode) ? mode : DiffViewMode.Table; + + public void SetViewMode(int fileIdx, DiffViewMode mode) => _viewModes[fileIdx] = mode; +} + +public sealed record DiffLineCommentRequest(string FileName, int LineNumber, string Comment, string Side = "modified") +{ + public string ToPrompt() + { + var sideLabel = Side.ToLowerInvariant() switch + { + "left" or "old" or "original" => "original", + "right" or "new" or "modified" => "modified", + _ => Side + }; + + return $"On file {FileName}, line {LineNumber} ({sideLabel}): {Comment.Trim()}"; + } +} + public class DiffFile { public string FileName { get; set; } = ""; @@ -10,6 +65,18 @@ public class DiffFile public bool IsDeleted { get; set; } public bool IsRenamed { get; set; } public List Hunks { get; set; } = new(); + + public int AddedLineCount => Hunks.SelectMany(h => h.Lines).Count(l => l.Type == DiffLineType.Added); + public int RemovedLineCount => Hunks.SelectMany(h => h.Lines).Count(l => l.Type == DiffLineType.Removed); + + public string StatusLabel => IsNew ? "NEW" : IsDeleted ? "DEL" : IsRenamed ? "REN" : "MOD"; + + public string StatusCssClass => IsNew ? "new" : IsDeleted ? "deleted" : IsRenamed ? "renamed" : "modified"; + + public string DisplayName => + IsRenamed && !string.IsNullOrWhiteSpace(OldFileName) + ? $"{OldFileName} → {FileName}" + : FileName; } public class DiffHunk @@ -316,4 +383,66 @@ private static DiffHunk ParseHunkHeader(string line) return rows; } + + /// + /// Reconstructs the original (before) content from parsed diff hunks. + /// Context + Removed lines form the original text. + /// Inserts blank placeholder lines for inter-hunk gaps to preserve line numbering. + /// + public static string ReconstructOriginal(DiffFile file) + { + var sb = new StringBuilder(); + int currentLine = 1; + + foreach (var hunk in file.Hunks) + { + // Fill gap between current position and hunk start with empty lines + while (currentLine < hunk.OldStart) + { + sb.AppendLine(); + currentLine++; + } + + foreach (var line in hunk.Lines) + { + if (line.Type == DiffLineType.Context || line.Type == DiffLineType.Removed) + { + sb.AppendLine(line.Content); + currentLine++; + } + } + } + return sb.ToString().TrimEnd('\r', '\n'); + } + + /// + /// Reconstructs the modified (after) content from parsed diff hunks. + /// Context + Added lines form the modified text. + /// Inserts blank placeholder lines for inter-hunk gaps to preserve line numbering. + /// + public static string ReconstructModified(DiffFile file) + { + var sb = new StringBuilder(); + int currentLine = 1; + + foreach (var hunk in file.Hunks) + { + // Fill gap between current position and hunk start with empty lines + while (currentLine < hunk.NewStart) + { + sb.AppendLine(); + currentLine++; + } + + foreach (var line in hunk.Lines) + { + if (line.Type == DiffLineType.Context || line.Type == DiffLineType.Added) + { + sb.AppendLine(line.Content); + currentLine++; + } + } + } + return sb.ToString().TrimEnd('\r', '\n'); + } } diff --git a/PolyPilot/PolyPilot.csproj b/PolyPilot/PolyPilot.csproj index 13910f99f4..56a3eb0e1f 100644 --- a/PolyPilot/PolyPilot.csproj +++ b/PolyPilot/PolyPilot.csproj @@ -67,6 +67,14 @@ + + + + + + + diff --git a/PolyPilot/Services/CopilotService.Persistence.cs b/PolyPilot/Services/CopilotService.Persistence.cs index ab5e6d315e..25cc09f6fa 100644 --- a/PolyPilot/Services/CopilotService.Persistence.cs +++ b/PolyPilot/Services/CopilotService.Persistence.cs @@ -853,6 +853,30 @@ public async Task RestorePreviousSessionsAsync(CancellationToken cancellationTok RestoreUsageStats(entry); // Check if session is still actively processing on the headless server. var isStillActive = IsSessionStillProcessing(entry.SessionId); + // Even if the last event looks active, check if events.jsonl + // has been written to recently. After a relaunch, the CLI may + // have finished the turn during the restart window — session.idle + // is ephemeral (not written to disk), so IsSessionStillProcessing + // sees the last tool event and thinks it's active. If the file + // hasn't been modified in 30s, the CLI is done. + if (isStillActive) + { + try + { + var eventsPath = Path.Combine(SessionStatePath, entry.SessionId, "events.jsonl"); + if (File.Exists(eventsPath)) + { + var fileAge = (DateTime.UtcNow - File.GetLastWriteTimeUtc(eventsPath)).TotalSeconds; + if (fileAge > 30) + { + Debug($"[RESTORE] '{entry.DisplayName}' events.jsonl looks active but is {fileAge:F0}s old — " + + $"CLI likely finished during relaunch window, downgrading to eager resume"); + isStillActive = false; + } + } + } + catch { /* filesystem error — keep isStillActive=true, safer */ } + } if (isStillActive) { // Session is actively running on the copilot server (tool calls in diff --git a/PolyPilot/Services/PrLinkService.cs b/PolyPilot/Services/PrLinkService.cs index 432477811b..937b8ee036 100644 --- a/PolyPilot/Services/PrLinkService.cs +++ b/PolyPilot/Services/PrLinkService.cs @@ -34,6 +34,64 @@ private record CacheEntry(string? Url, DateTime ExpiresAt); ? entry.Url : null; } + public static int? ExtractPrNumber(string? prUrl) + { + if (string.IsNullOrWhiteSpace(prUrl) || + !Uri.TryCreate(prUrl, UriKind.Absolute, out var uri)) + { + return null; + } + + var segments = uri.AbsolutePath + .Split('/', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); + + for (var i = 0; i < segments.Length - 1; i++) + { + if ((segments[i].Equals("pull", StringComparison.OrdinalIgnoreCase) || + segments[i].Equals("pulls", StringComparison.OrdinalIgnoreCase)) && + int.TryParse(segments[i + 1], out var number) && + number > 0) + { + return number; + } + } + + return null; + } + + public async Task GetPrDiffAsync(string workingDirectory, int prNumber, CancellationToken cancellationToken = default) + { + if (string.IsNullOrWhiteSpace(workingDirectory)) + throw new ArgumentException("A working directory is required to load a PR diff.", nameof(workingDirectory)); + if (prNumber <= 0) + throw new ArgumentOutOfRangeException(nameof(prNumber), "PR number must be greater than zero."); + + var (output, error, exitCode) = await RunGhAsync( + workingDirectory, + cancellationToken, + "pr", "diff", prNumber.ToString(), "--color", "never"); + + if (exitCode != 0) + { + var reason = string.IsNullOrWhiteSpace(error) + ? $"Failed to load the diff for PR #{prNumber}." + : error.Trim(); + throw new InvalidOperationException(reason); + } + + var diff = output.Trim(); + if (string.IsNullOrWhiteSpace(diff)) + throw new InvalidOperationException($"PR #{prNumber} does not have any diff content to display."); + + return diff; + } + + protected virtual Task<(string Output, string Error, int ExitCode)> RunGhAsync( + string workingDirectory, + CancellationToken cancellationToken, + params string[] args) => + RunGhProcessAsync(workingDirectory, cancellationToken, args); + private static async Task FetchPrUrlAsync(string workingDirectory) { Process? process = null; @@ -120,4 +178,47 @@ private record CacheEntry(string? Url, DateTime ExpiresAt); } } } + + private static async Task<(string Output, string Error, int ExitCode)> RunGhProcessAsync( + string workingDirectory, + CancellationToken cancellationToken, + params string[] args) + { + Process? process = null; + try + { + var psi = new ProcessStartInfo + { + FileName = "gh", + WorkingDirectory = workingDirectory, + RedirectStandardOutput = true, + RedirectStandardError = true, + UseShellExecute = false, + CreateNoWindow = true, + }; + + foreach (var arg in args) + psi.ArgumentList.Add(arg); + + process = Process.Start(psi) + ?? throw new InvalidOperationException("Failed to start the GitHub CLI process."); + + using var timeoutCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); + timeoutCts.CancelAfter(TimeSpan.FromSeconds(20)); + + var outputTask = process.StandardOutput.ReadToEndAsync(timeoutCts.Token); + var errorTask = process.StandardError.ReadToEndAsync(timeoutCts.Token); + await process.WaitForExitAsync(timeoutCts.Token); + + return (await outputTask, await errorTask, process.ExitCode); + } + catch (OperationCanceledException) when (!cancellationToken.IsCancellationRequested) + { + throw new TimeoutException("Timed out while loading the PR diff from GitHub."); + } + finally + { + ProcessHelper.SafeKillAndDispose(process); + } + } } diff --git a/PolyPilot/codemirror-src/package-lock.json b/PolyPilot/codemirror-src/package-lock.json new file mode 100644 index 0000000000..debfb2939e --- /dev/null +++ b/PolyPilot/codemirror-src/package-lock.json @@ -0,0 +1,842 @@ +{ + "name": "polypilot-codemirror", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "polypilot-codemirror", + "version": "1.0.0", + "dependencies": { + "@codemirror/autocomplete": "^6.20.1", + "@codemirror/commands": "^6.10.3", + "@codemirror/lang-css": "^6.3.1", + "@codemirror/lang-html": "^6.4.11", + "@codemirror/lang-javascript": "^6.2.5", + "@codemirror/lang-json": "^6.0.2", + "@codemirror/lang-markdown": "^6.5.0", + "@codemirror/lang-python": "^6.2.1", + "@codemirror/lang-xml": "^6.1.0", + "@codemirror/language": "^6.12.3", + "@codemirror/legacy-modes": "^6.5.2", + "@codemirror/lint": "^6.9.5", + "@codemirror/merge": "^6.12.1", + "@codemirror/search": "^6.6.0", + "@codemirror/state": "^6.6.0", + "@codemirror/theme-one-dark": "^6.1.3", + "@codemirror/view": "^6.41.0", + "@lezer/highlight": "^1.2.3", + "codemirror": "^6.0.2", + "esbuild": "^0.28.0" + } + }, + "node_modules/@codemirror/autocomplete": { + "version": "6.20.1", + "resolved": "https://registry.npmjs.org/@codemirror/autocomplete/-/autocomplete-6.20.1.tgz", + "integrity": "sha512-1cvg3Vz1dSSToCNlJfRA2WSI4ht3K+WplO0UMOgmUYPivCyy2oueZY6Lx7M9wThm7SDUBViRmuT+OG/i8+ON9A==", + "license": "MIT", + "dependencies": { + "@codemirror/language": "^6.0.0", + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.17.0", + "@lezer/common": "^1.0.0" + } + }, + "node_modules/@codemirror/commands": { + "version": "6.10.3", + "resolved": "https://registry.npmjs.org/@codemirror/commands/-/commands-6.10.3.tgz", + "integrity": "sha512-JFRiqhKu+bvSkDLI+rUhJwSxQxYb759W5GBezE8Uc8mHLqC9aV/9aTC7yJSqCtB3F00pylrLCwnyS91Ap5ej4Q==", + "license": "MIT", + "dependencies": { + "@codemirror/language": "^6.0.0", + "@codemirror/state": "^6.6.0", + "@codemirror/view": "^6.27.0", + "@lezer/common": "^1.1.0" + } + }, + "node_modules/@codemirror/lang-css": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/@codemirror/lang-css/-/lang-css-6.3.1.tgz", + "integrity": "sha512-kr5fwBGiGtmz6l0LSJIbno9QrifNMUusivHbnA1H6Dmqy4HZFte3UAICix1VuKo0lMPKQr2rqB+0BkKi/S3Ejg==", + "license": "MIT", + "dependencies": { + "@codemirror/autocomplete": "^6.0.0", + "@codemirror/language": "^6.0.0", + "@codemirror/state": "^6.0.0", + "@lezer/common": "^1.0.2", + "@lezer/css": "^1.1.7" + } + }, + "node_modules/@codemirror/lang-html": { + "version": "6.4.11", + "resolved": "https://registry.npmjs.org/@codemirror/lang-html/-/lang-html-6.4.11.tgz", + "integrity": "sha512-9NsXp7Nwp891pQchI7gPdTwBuSuT3K65NGTHWHNJ55HjYcHLllr0rbIZNdOzas9ztc1EUVBlHou85FFZS4BNnw==", + "license": "MIT", + "dependencies": { + "@codemirror/autocomplete": "^6.0.0", + "@codemirror/lang-css": "^6.0.0", + "@codemirror/lang-javascript": "^6.0.0", + "@codemirror/language": "^6.4.0", + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.17.0", + "@lezer/common": "^1.0.0", + "@lezer/css": "^1.1.0", + "@lezer/html": "^1.3.12" + } + }, + "node_modules/@codemirror/lang-javascript": { + "version": "6.2.5", + "resolved": "https://registry.npmjs.org/@codemirror/lang-javascript/-/lang-javascript-6.2.5.tgz", + "integrity": "sha512-zD4e5mS+50htS7F+TYjBPsiIFGanfVqg4HyUz6WNFikgOPf2BgKlx+TQedI1w6n/IqRBVBbBWmGFdLB/7uxO4A==", + "license": "MIT", + "dependencies": { + "@codemirror/autocomplete": "^6.0.0", + "@codemirror/language": "^6.6.0", + "@codemirror/lint": "^6.0.0", + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.17.0", + "@lezer/common": "^1.0.0", + "@lezer/javascript": "^1.0.0" + } + }, + "node_modules/@codemirror/lang-json": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/@codemirror/lang-json/-/lang-json-6.0.2.tgz", + "integrity": "sha512-x2OtO+AvwEHrEwR0FyyPtfDUiloG3rnVTSZV1W8UteaLL8/MajQd8DpvUb2YVzC+/T18aSDv0H9mu+xw0EStoQ==", + "license": "MIT", + "dependencies": { + "@codemirror/language": "^6.0.0", + "@lezer/json": "^1.0.0" + } + }, + "node_modules/@codemirror/lang-markdown": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/@codemirror/lang-markdown/-/lang-markdown-6.5.0.tgz", + "integrity": "sha512-0K40bZ35jpHya6FriukbgaleaqzBLZfOh7HuzqbMxBXkbYMJDxfF39c23xOgxFezR+3G+tR2/Mup+Xk865OMvw==", + "license": "MIT", + "dependencies": { + "@codemirror/autocomplete": "^6.7.1", + "@codemirror/lang-html": "^6.0.0", + "@codemirror/language": "^6.3.0", + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.0.0", + "@lezer/common": "^1.2.1", + "@lezer/markdown": "^1.0.0" + } + }, + "node_modules/@codemirror/lang-python": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/@codemirror/lang-python/-/lang-python-6.2.1.tgz", + "integrity": "sha512-IRjC8RUBhn9mGR9ywecNhB51yePWCGgvHfY1lWN/Mrp3cKuHr0isDKia+9HnvhiWNnMpbGhWrkhuWOc09exRyw==", + "license": "MIT", + "dependencies": { + "@codemirror/autocomplete": "^6.3.2", + "@codemirror/language": "^6.8.0", + "@codemirror/state": "^6.0.0", + "@lezer/common": "^1.2.1", + "@lezer/python": "^1.1.4" + } + }, + "node_modules/@codemirror/lang-xml": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@codemirror/lang-xml/-/lang-xml-6.1.0.tgz", + "integrity": "sha512-3z0blhicHLfwi2UgkZYRPioSgVTo9PV5GP5ducFH6FaHy0IAJRg+ixj5gTR1gnT/glAIC8xv4w2VL1LoZfs+Jg==", + "license": "MIT", + "dependencies": { + "@codemirror/autocomplete": "^6.0.0", + "@codemirror/language": "^6.4.0", + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.0.0", + "@lezer/common": "^1.0.0", + "@lezer/xml": "^1.0.0" + } + }, + "node_modules/@codemirror/language": { + "version": "6.12.3", + "resolved": "https://registry.npmjs.org/@codemirror/language/-/language-6.12.3.tgz", + "integrity": "sha512-QwCZW6Tt1siP37Jet9Tb02Zs81TQt6qQrZR2H+eGMcFsL1zMrk2/b9CLC7/9ieP1fjIUMgviLWMmgiHoJrj+ZA==", + "license": "MIT", + "dependencies": { + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.23.0", + "@lezer/common": "^1.5.0", + "@lezer/highlight": "^1.0.0", + "@lezer/lr": "^1.0.0", + "style-mod": "^4.0.0" + } + }, + "node_modules/@codemirror/legacy-modes": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/@codemirror/legacy-modes/-/legacy-modes-6.5.2.tgz", + "integrity": "sha512-/jJbwSTazlQEDOQw2FJ8LEEKVS72pU0lx6oM54kGpL8t/NJ2Jda3CZ4pcltiKTdqYSRk3ug1B3pil1gsjA6+8Q==", + "license": "MIT", + "dependencies": { + "@codemirror/language": "^6.0.0" + } + }, + "node_modules/@codemirror/lint": { + "version": "6.9.5", + "resolved": "https://registry.npmjs.org/@codemirror/lint/-/lint-6.9.5.tgz", + "integrity": "sha512-GElsbU9G7QT9xXhpUg1zWGmftA/7jamh+7+ydKRuT0ORpWS3wOSP0yT1FOlIZa7mIJjpVPipErsyvVqB9cfTFA==", + "license": "MIT", + "dependencies": { + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.35.0", + "crelt": "^1.0.5" + } + }, + "node_modules/@codemirror/merge": { + "version": "6.12.1", + "resolved": "https://registry.npmjs.org/@codemirror/merge/-/merge-6.12.1.tgz", + "integrity": "sha512-GA8hBq2T+IFM0sb5fk8CunTrqOulA3zurJmHtzcU15EMnL8aYpVINfJ5bkfd53M4ikwoew4Y1ydtSaAlk6+B1w==", + "license": "MIT", + "dependencies": { + "@codemirror/language": "^6.0.0", + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.17.0", + "@lezer/highlight": "^1.0.0", + "style-mod": "^4.1.0" + } + }, + "node_modules/@codemirror/search": { + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/@codemirror/search/-/search-6.6.0.tgz", + "integrity": "sha512-koFuNXcDvyyotWcgOnZGmY7LZqEOXZaaxD/j6n18TCLx2/9HieZJ5H6hs1g8FiRxBD0DNfs0nXn17g872RmYdw==", + "license": "MIT", + "dependencies": { + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.37.0", + "crelt": "^1.0.5" + } + }, + "node_modules/@codemirror/state": { + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/@codemirror/state/-/state-6.6.0.tgz", + "integrity": "sha512-4nbvra5R5EtiCzr9BTHiTLc+MLXK2QGiAVYMyi8PkQd3SR+6ixar/Q/01Fa21TBIDOZXgeWV4WppsQolSreAPQ==", + "license": "MIT", + "dependencies": { + "@marijn/find-cluster-break": "^1.0.0" + } + }, + "node_modules/@codemirror/theme-one-dark": { + "version": "6.1.3", + "resolved": "https://registry.npmjs.org/@codemirror/theme-one-dark/-/theme-one-dark-6.1.3.tgz", + "integrity": "sha512-NzBdIvEJmx6fjeremiGp3t/okrLPYT0d9orIc7AFun8oZcRk58aejkqhv6spnz4MLAevrKNPMQYXEWMg4s+sKA==", + "license": "MIT", + "dependencies": { + "@codemirror/language": "^6.0.0", + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.0.0", + "@lezer/highlight": "^1.0.0" + } + }, + "node_modules/@codemirror/view": { + "version": "6.41.0", + "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.41.0.tgz", + "integrity": "sha512-6H/qadXsVuDY219Yljhohglve8xf4B8xJkVOEWfA5uiYKiTFppjqsvsfR5iPA0RbvRBoOyTZpbLIxe9+0UR8xA==", + "license": "MIT", + "dependencies": { + "@codemirror/state": "^6.6.0", + "crelt": "^1.0.6", + "style-mod": "^4.1.0", + "w3c-keyname": "^2.2.4" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.0.tgz", + "integrity": "sha512-lhRUCeuOyJQURhTxl4WkpFTjIsbDayJHih5kZC1giwE+MhIzAb7mEsQMqMf18rHLsrb5qI1tafG20mLxEWcWlA==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.0.tgz", + "integrity": "sha512-wqh0ByljabXLKHeWXYLqoJ5jKC4XBaw6Hk08OfMrCRd2nP2ZQ5eleDZC41XHyCNgktBGYMbqnrJKq/K/lzPMSQ==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.0.tgz", + "integrity": "sha512-+WzIXQOSaGs33tLEgYPYe/yQHf0WTU0X42Jca3y8NWMbUVhp7rUnw+vAsRC/QiDrdD31IszMrZy+qwPOPjd+rw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.0.tgz", + "integrity": "sha512-+VJggoaKhk2VNNqVL7f6S189UzShHC/mR9EE8rDdSkdpN0KflSwWY/gWjDrNxxisg8Fp1ZCD9jLMo4m0OUfeUA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.0.tgz", + "integrity": "sha512-0T+A9WZm+bZ84nZBtk1ckYsOvyA3x7e2Acj1KdVfV4/2tdG4fzUp91YHx+GArWLtwqp77pBXVCPn2We7Letr0Q==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.0.tgz", + "integrity": "sha512-fyzLm/DLDl/84OCfp2f/XQ4flmORsjU7VKt8HLjvIXChJoFFOIL6pLJPH4Yhd1n1gGFF9mPwtlN5Wf82DZs+LQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.0.tgz", + "integrity": "sha512-l9GeW5UZBT9k9brBYI+0WDffcRxgHQD8ShN2Ur4xWq/NFzUKm3k5lsH4PdaRgb2w7mI9u61nr2gI2mLI27Nh3Q==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.0.tgz", + "integrity": "sha512-BXoQai/A0wPO6Es3yFJ7APCiKGc1tdAEOgeTNy3SsB491S3aHn4S4r3e976eUnPdU+NbdtmBuLncYir2tMU9Nw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.0.tgz", + "integrity": "sha512-CjaaREJagqJp7iTaNQjjidaNbCKYcd4IDkzbwwxtSvjI7NZm79qiHc8HqciMddQ6CKvJT6aBd8lO9kN/ZudLlw==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.0.tgz", + "integrity": "sha512-RVyzfb3FWsGA55n6WY0MEIEPURL1FcbhFE6BffZEMEekfCzCIMtB5yyDcFnVbTnwk+CLAgTujmV/Lgvih56W+A==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.0.tgz", + "integrity": "sha512-KBnSTt1kxl9x70q+ydterVdl+Cn0H18ngRMRCEQfrbqdUuntQQ0LoMZv47uB97NljZFzY6HcfqEZ2SAyIUTQBQ==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.0.tgz", + "integrity": "sha512-zpSlUce1mnxzgBADvxKXX5sl8aYQHo2ezvMNI8I0lbblJtp8V4odlm3Yzlj7gPyt3T8ReksE6bK+pT3WD+aJRg==", + "cpu": [ + "loong64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.0.tgz", + "integrity": "sha512-2jIfP6mmjkdmeTlsX/9vmdmhBmKADrWqN7zcdtHIeNSCH1SqIoNI63cYsjQR8J+wGa4Y5izRcSHSm8K3QWmk3w==", + "cpu": [ + "mips64el" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.0.tgz", + "integrity": "sha512-bc0FE9wWeC0WBm49IQMPSPILRocGTQt3j5KPCA8os6VprfuJ7KD+5PzESSrJ6GmPIPJK965ZJHTUlSA6GNYEhg==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.0.tgz", + "integrity": "sha512-SQPZOwoTTT/HXFXQJG/vBX8sOFagGqvZyXcgLA3NhIqcBv1BJU1d46c0rGcrij2B56Z2rNiSLaZOYW5cUk7yLQ==", + "cpu": [ + "riscv64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.0.tgz", + "integrity": "sha512-SCfR0HN8CEEjnYnySJTd2cw0k9OHB/YFzt5zgJEwa+wL/T/raGWYMBqwDNAC6dqFKmJYZoQBRfHjgwLHGSrn3Q==", + "cpu": [ + "s390x" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.0.tgz", + "integrity": "sha512-us0dSb9iFxIi8srnpl931Nvs65it/Jd2a2K3qs7fz2WfGPHqzfzZTfec7oxZJRNPXPnNYZtanmRc4AL/JwVzHQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.0.tgz", + "integrity": "sha512-CR/RYotgtCKwtftMwJlUU7xCVNg3lMYZ0RzTmAHSfLCXw3NtZtNpswLEj/Kkf6kEL3Gw+BpOekRX0BYCtklhUw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.0.tgz", + "integrity": "sha512-nU1yhmYutL+fQ71Kxnhg8uEOdC0pwEW9entHykTgEbna2pw2dkbFSMeqjjyHZoCmt8SBkOSvV+yNmm94aUrrqw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.0.tgz", + "integrity": "sha512-cXb5vApOsRsxsEl4mcZ1XY3D4DzcoMxR/nnc4IyqYs0rTI8ZKmW6kyyg+11Z8yvgMfAEldKzP7AdP64HnSC/6g==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.0.tgz", + "integrity": "sha512-8wZM2qqtv9UP3mzy7HiGYNH/zjTA355mpeuA+859TyR+e+Tc08IHYpLJuMsfpDJwoLo1ikIJI8jC3GFjnRClzA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.0.tgz", + "integrity": "sha512-FLGfyizszcef5C3YtoyQDACyg95+dndv79i2EekILBofh5wpCa1KuBqOWKrEHZg3zrL3t5ouE5jgr94vA+Wb2w==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.0.tgz", + "integrity": "sha512-1ZgjUoEdHZZl/YlV76TSCz9Hqj9h9YmMGAgAPYd+q4SicWNX3G5GCyx9uhQWSLcbvPW8Ni7lj4gDa1T40akdlw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.0.tgz", + "integrity": "sha512-Q9StnDmQ/enxnpxCCLSg0oo4+34B9TdXpuyPeTedN/6+iXBJ4J+zwfQI28u/Jl40nOYAxGoNi7mFP40RUtkmUA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.0.tgz", + "integrity": "sha512-zF3ag/gfiCe6U2iczcRzSYJKH1DCI+ByzSENHlM2FcDbEeo5Zd2C86Aq0tKUYAJJ1obRP84ymxIAksZUcdztHA==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.0.tgz", + "integrity": "sha512-pEl1bO9mfAmIC+tW5btTmrKaujg3zGtUmWNdCw/xs70FBjwAL3o9OEKNHvNmnyylD6ubxUERiEhdsL0xBQ9efw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@lezer/common": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.5.1.tgz", + "integrity": "sha512-6YRVG9vBkaY7p1IVxL4s44n5nUnaNnGM2/AckNgYOnxTG2kWh1vR8BMxPseWPjRNpb5VtXnMpeYAEAADoRV1Iw==", + "license": "MIT" + }, + "node_modules/@lezer/css": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@lezer/css/-/css-1.3.3.tgz", + "integrity": "sha512-RzBo8r+/6QJeow7aPHIpGVIH59xTcJXp399820gZoMo9noQDRVpJLheIBUicYwKcsbOYoBRoLZlf2720dG/4Tg==", + "license": "MIT", + "dependencies": { + "@lezer/common": "^1.2.0", + "@lezer/highlight": "^1.0.0", + "@lezer/lr": "^1.3.0" + } + }, + "node_modules/@lezer/highlight": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@lezer/highlight/-/highlight-1.2.3.tgz", + "integrity": "sha512-qXdH7UqTvGfdVBINrgKhDsVTJTxactNNxLk7+UMwZhU13lMHaOBlJe9Vqp907ya56Y3+ed2tlqzys7jDkTmW0g==", + "license": "MIT", + "dependencies": { + "@lezer/common": "^1.3.0" + } + }, + "node_modules/@lezer/html": { + "version": "1.3.13", + "resolved": "https://registry.npmjs.org/@lezer/html/-/html-1.3.13.tgz", + "integrity": "sha512-oI7n6NJml729m7pjm9lvLvmXbdoMoi2f+1pwSDJkl9d68zGr7a9Btz8NdHTGQZtW2DA25ybeuv/SyDb9D5tseg==", + "license": "MIT", + "dependencies": { + "@lezer/common": "^1.2.0", + "@lezer/highlight": "^1.0.0", + "@lezer/lr": "^1.0.0" + } + }, + "node_modules/@lezer/javascript": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/@lezer/javascript/-/javascript-1.5.4.tgz", + "integrity": "sha512-vvYx3MhWqeZtGPwDStM2dwgljd5smolYD2lR2UyFcHfxbBQebqx8yjmFmxtJ/E6nN6u1D9srOiVWm3Rb4tmcUA==", + "license": "MIT", + "dependencies": { + "@lezer/common": "^1.2.0", + "@lezer/highlight": "^1.1.3", + "@lezer/lr": "^1.3.0" + } + }, + "node_modules/@lezer/json": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@lezer/json/-/json-1.0.3.tgz", + "integrity": "sha512-BP9KzdF9Y35PDpv04r0VeSTKDeox5vVr3efE7eBbx3r4s3oNLfunchejZhjArmeieBH+nVOpgIiBJpEAv8ilqQ==", + "license": "MIT", + "dependencies": { + "@lezer/common": "^1.2.0", + "@lezer/highlight": "^1.0.0", + "@lezer/lr": "^1.0.0" + } + }, + "node_modules/@lezer/lr": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/@lezer/lr/-/lr-1.4.8.tgz", + "integrity": "sha512-bPWa0Pgx69ylNlMlPvBPryqeLYQjyJjqPx+Aupm5zydLIF3NE+6MMLT8Yi23Bd9cif9VS00aUebn+6fDIGBcDA==", + "license": "MIT", + "dependencies": { + "@lezer/common": "^1.0.0" + } + }, + "node_modules/@lezer/markdown": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/@lezer/markdown/-/markdown-1.6.3.tgz", + "integrity": "sha512-jpGm5Ps+XErS+xA4urw7ogEGkeZOahVQF21Z6oECF0sj+2liwZopd2+I8uH5I/vZsRuuze3OxBREIANLf6KKUw==", + "license": "MIT", + "dependencies": { + "@lezer/common": "^1.5.0", + "@lezer/highlight": "^1.0.0" + } + }, + "node_modules/@lezer/python": { + "version": "1.1.18", + "resolved": "https://registry.npmjs.org/@lezer/python/-/python-1.1.18.tgz", + "integrity": "sha512-31FiUrU7z9+d/ElGQLJFXl+dKOdx0jALlP3KEOsGTex8mvj+SoE1FgItcHWK/axkxCHGUSpqIHt6JAWfWu9Rhg==", + "license": "MIT", + "dependencies": { + "@lezer/common": "^1.2.0", + "@lezer/highlight": "^1.0.0", + "@lezer/lr": "^1.0.0" + } + }, + "node_modules/@lezer/xml": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@lezer/xml/-/xml-1.0.6.tgz", + "integrity": "sha512-CdDwirL0OEaStFue/66ZmFSeppuL6Dwjlk8qk153mSQwiSH/Dlri4GNymrNWnUmPl2Um7QfV1FO9KFUyX3Twww==", + "license": "MIT", + "dependencies": { + "@lezer/common": "^1.2.0", + "@lezer/highlight": "^1.0.0", + "@lezer/lr": "^1.0.0" + } + }, + "node_modules/@marijn/find-cluster-break": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@marijn/find-cluster-break/-/find-cluster-break-1.0.2.tgz", + "integrity": "sha512-l0h88YhZFyKdXIFNfSWpyjStDjGHwZ/U7iobcK1cQQD8sejsONdQtTVU+1wVN1PBw40PiiHB1vA5S7VTfQiP9g==", + "license": "MIT" + }, + "node_modules/codemirror": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-6.0.2.tgz", + "integrity": "sha512-VhydHotNW5w1UGK0Qj96BwSk/Zqbp9WbnyK2W/eVMv4QyF41INRGpjUhFJY7/uDNuudSc33a/PKr4iDqRduvHw==", + "license": "MIT", + "dependencies": { + "@codemirror/autocomplete": "^6.0.0", + "@codemirror/commands": "^6.0.0", + "@codemirror/language": "^6.0.0", + "@codemirror/lint": "^6.0.0", + "@codemirror/search": "^6.0.0", + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.0.0" + } + }, + "node_modules/crelt": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/crelt/-/crelt-1.0.6.tgz", + "integrity": "sha512-VQ2MBenTq1fWZUH9DJNGti7kKv6EeAuYr3cLwxUWhIu1baTaXh4Ib5W2CqHVqib4/MqbYGJqiL3Zb8GJZr3l4g==", + "license": "MIT" + }, + "node_modules/esbuild": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.0.tgz", + "integrity": "sha512-sNR9MHpXSUV/XB4zmsFKN+QgVG82Cc7+/aaxJ8Adi8hyOac+EXptIp45QBPaVyX3N70664wRbTcLTOemCAnyqw==", + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.28.0", + "@esbuild/android-arm": "0.28.0", + "@esbuild/android-arm64": "0.28.0", + "@esbuild/android-x64": "0.28.0", + "@esbuild/darwin-arm64": "0.28.0", + "@esbuild/darwin-x64": "0.28.0", + "@esbuild/freebsd-arm64": "0.28.0", + "@esbuild/freebsd-x64": "0.28.0", + "@esbuild/linux-arm": "0.28.0", + "@esbuild/linux-arm64": "0.28.0", + "@esbuild/linux-ia32": "0.28.0", + "@esbuild/linux-loong64": "0.28.0", + "@esbuild/linux-mips64el": "0.28.0", + "@esbuild/linux-ppc64": "0.28.0", + "@esbuild/linux-riscv64": "0.28.0", + "@esbuild/linux-s390x": "0.28.0", + "@esbuild/linux-x64": "0.28.0", + "@esbuild/netbsd-arm64": "0.28.0", + "@esbuild/netbsd-x64": "0.28.0", + "@esbuild/openbsd-arm64": "0.28.0", + "@esbuild/openbsd-x64": "0.28.0", + "@esbuild/openharmony-arm64": "0.28.0", + "@esbuild/sunos-x64": "0.28.0", + "@esbuild/win32-arm64": "0.28.0", + "@esbuild/win32-ia32": "0.28.0", + "@esbuild/win32-x64": "0.28.0" + } + }, + "node_modules/style-mod": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/style-mod/-/style-mod-4.1.3.tgz", + "integrity": "sha512-i/n8VsZydrugj3Iuzll8+x/00GH2vnYsk1eomD8QiRrSAeW6ItbCQDtfXCeJHd0iwiNagqjQkvpvREEPtW3IoQ==", + "license": "MIT" + }, + "node_modules/w3c-keyname": { + "version": "2.2.8", + "resolved": "https://registry.npmjs.org/w3c-keyname/-/w3c-keyname-2.2.8.tgz", + "integrity": "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==", + "license": "MIT" + } + } +} diff --git a/PolyPilot/codemirror-src/package.json b/PolyPilot/codemirror-src/package.json new file mode 100644 index 0000000000..feff37319d --- /dev/null +++ b/PolyPilot/codemirror-src/package.json @@ -0,0 +1,31 @@ +{ + "name": "polypilot-codemirror", + "version": "1.0.0", + "private": true, + "type": "module", + "scripts": { + "build": "esbuild src/index.js --bundle --format=iife --global-name=CM --outfile=../wwwroot/lib/codemirror/codemirror-bundle.js --minify" + }, + "dependencies": { + "@codemirror/autocomplete": "^6.20.1", + "@codemirror/commands": "^6.10.3", + "@codemirror/lang-css": "^6.3.1", + "@codemirror/lang-html": "^6.4.11", + "@codemirror/lang-javascript": "^6.2.5", + "@codemirror/lang-json": "^6.0.2", + "@codemirror/lang-markdown": "^6.5.0", + "@codemirror/lang-python": "^6.2.1", + "@codemirror/lang-xml": "^6.1.0", + "@codemirror/language": "^6.12.3", + "@codemirror/legacy-modes": "^6.5.2", + "@codemirror/lint": "^6.9.5", + "@codemirror/merge": "^6.12.1", + "@codemirror/search": "^6.6.0", + "@codemirror/state": "^6.6.0", + "@codemirror/theme-one-dark": "^6.1.3", + "@codemirror/view": "^6.41.0", + "@lezer/highlight": "^1.2.3", + "codemirror": "^6.0.2", + "esbuild": "^0.28.0" + } +} diff --git a/PolyPilot/codemirror-src/src/index.js b/PolyPilot/codemirror-src/src/index.js new file mode 100644 index 0000000000..094207412a --- /dev/null +++ b/PolyPilot/codemirror-src/src/index.js @@ -0,0 +1,379 @@ +// CodeMirror 6 bundle for PolyPilot +// Provides: EditorView, MergeView, language support, dark theme + +import { EditorView, lineNumbers, highlightActiveLineGutter, highlightSpecialChars, + drawSelection, highlightActiveLine, keymap, placeholder } from "@codemirror/view"; +import { EditorState, Compartment } from "@codemirror/state"; +import { defaultHighlightStyle, syntaxHighlighting, indentOnInput, + bracketMatching, foldGutter, foldKeymap, LanguageDescription } from "@codemirror/language"; +import { defaultKeymap, history, historyKeymap, indentWithTab } from "@codemirror/commands"; +import { searchKeymap, highlightSelectionMatches, openSearchPanel } from "@codemirror/search"; +import { closeBrackets, closeBracketsKeymap } from "@codemirror/autocomplete"; +import { MergeView } from "@codemirror/merge"; +import { oneDark } from "@codemirror/theme-one-dark"; +import { javascript } from "@codemirror/lang-javascript"; +import { css } from "@codemirror/lang-css"; +import { html } from "@codemirror/lang-html"; +import { json } from "@codemirror/lang-json"; +import { markdown } from "@codemirror/lang-markdown"; +import { python } from "@codemirror/lang-python"; +import { xml } from "@codemirror/lang-xml"; +import { StreamLanguage } from "@codemirror/language"; +import { csharp as csharpMode } from "@codemirror/legacy-modes/mode/clike"; +import { shell as shellMode } from "@codemirror/legacy-modes/mode/shell"; + +// Language support via legacy modes +const csharpLanguage = StreamLanguage.define(csharpMode); +const shellLanguage = StreamLanguage.define(shellMode); + +function csharp() { return csharpLanguage; } +function shell() { return shellLanguage; } + +// Map file extensions to language support +function getLanguageForFile(filename) { + if (!filename) return []; + const ext = filename.split('.').pop()?.toLowerCase(); + switch (ext) { + case 'cs': return [csharp()]; + case 'js': case 'mjs': case 'cjs': return [javascript()]; + case 'ts': case 'tsx': return [javascript({ typescript: true })]; + case 'jsx': return [javascript({ jsx: true })]; + case 'css': case 'scss': case 'less': return [css()]; + case 'html': case 'htm': case 'razor': case 'cshtml': return [html()]; + case 'json': return [json()]; + case 'md': case 'markdown': return [markdown()]; + case 'py': return [python()]; + case 'xml': case 'xaml': case 'csproj': case 'props': case 'targets': case 'sln': case 'slnx': return [xml()]; + case 'sh': case 'bash': case 'zsh': return [shell()]; + default: return []; + } +} + +// PolyPilot custom dark theme overlay +const polyPilotTheme = EditorView.theme({ + "&": { + backgroundColor: "var(--bg-secondary, #1a1e2e)", + color: "var(--text-primary, #c8d8f0)", + fontSize: "var(--type-body, 0.72rem)", + fontFamily: "var(--font-mono, 'SF Mono', Menlo, monospace)", + borderRadius: "0 0 8px 8px", + }, + ".cm-content": { + caretColor: "var(--accent-primary, #4ea8d1)", + padding: "4px 0", + }, + ".cm-cursor": { + borderLeftColor: "var(--accent-primary, #4ea8d1)", + }, + "&.cm-focused .cm-selectionBackground, .cm-selectionBackground": { + backgroundColor: "rgba(78, 168, 209, 0.25) !important", + }, + ".cm-gutters": { + backgroundColor: "var(--bg-tertiary, rgba(255,255,255,0.03))", + color: "var(--text-dim, rgba(200,216,240,0.3))", + border: "none", + borderRight: "1px solid var(--control-border, rgba(255,255,255,0.06))", + }, + ".cm-gutterElement": { + cursor: "pointer", + }, + ".cm-activeLineGutter": { + backgroundColor: "rgba(78, 168, 209, 0.1)", + }, + ".cm-activeLine": { + backgroundColor: "rgba(78, 168, 209, 0.06)", + }, + ".cm-foldPlaceholder": { + backgroundColor: "rgba(78, 168, 209, 0.15)", + color: "var(--accent-primary, #4ea8d1)", + border: "none", + padding: "0 4px", + borderRadius: "3px", + }, + // Merge view specific + ".cm-mergeView": { + borderRadius: "0 0 8px 8px", + overflow: "hidden", + }, + ".cm-merge-a .cm-changedLine": { + backgroundColor: "var(--diff-del-bg, rgba(248,81,73,0.1))", + }, + ".cm-merge-b .cm-changedLine": { + backgroundColor: "var(--diff-add-bg, rgba(63,185,80,0.1))", + }, + ".cm-merge-a .cm-changedText": { + backgroundColor: "var(--diff-del-bg, rgba(248,81,73,0.2))", + }, + ".cm-merge-b .cm-changedText": { + backgroundColor: "var(--diff-add-bg, rgba(63,185,80,0.2))", + }, + ".cm-deletedChunk": { + backgroundColor: "var(--diff-del-bg, rgba(248,81,73,0.08))", + }, + // Collapsed unchanged sections + ".cm-collapsedLines": { + backgroundColor: "var(--bg-tertiary, rgba(255,255,255,0.03))", + color: "var(--text-dim, rgba(200,216,240,0.4))", + padding: "2px 12px", + fontSize: "0.65rem", + cursor: "pointer", + borderTop: "1px solid var(--control-border, rgba(255,255,255,0.06))", + borderBottom: "1px solid var(--control-border, rgba(255,255,255,0.06))", + }, + ".cm-search": { + backgroundColor: "var(--bg-secondary, #1a1e2e)", + }, + ".cm-searchMatch": { + backgroundColor: "rgba(255, 200, 50, 0.3)", + }, + ".cm-searchMatch-selected": { + backgroundColor: "rgba(255, 200, 50, 0.5)", + }, + ".cm-panels": { + backgroundColor: "var(--bg-tertiary, rgba(255,255,255,0.05))", + color: "var(--text-primary, #c8d8f0)", + }, + ".cm-panel input": { + backgroundColor: "var(--bg-secondary, #1a1e2e)", + color: "var(--text-primary, #c8d8f0)", + border: "1px solid var(--control-border, rgba(255,255,255,0.1))", + borderRadius: "4px", + }, + ".cm-panel button": { + backgroundColor: "var(--bg-tertiary, rgba(255,255,255,0.08))", + color: "var(--text-primary, #c8d8f0)", + border: "1px solid var(--control-border, rgba(255,255,255,0.1))", + borderRadius: "4px", + }, +}, { dark: true }); + +// Basic extensions shared by all editor instances +function baseExtensions(filename) { + return [ + lineNumbers(), + highlightActiveLineGutter(), + highlightSpecialChars(), + history(), + foldGutter(), + drawSelection(), + indentOnInput(), + syntaxHighlighting(defaultHighlightStyle, { fallback: true }), + bracketMatching(), + closeBrackets(), + highlightActiveLine(), + highlightSelectionMatches(), + keymap.of([ + ...closeBracketsKeymap, + ...defaultKeymap, + ...searchKeymap, + ...historyKeymap, + ...foldKeymap, + indentWithTab, + ]), + oneDark, + polyPilotTheme, + ...getLanguageForFile(filename), + ]; +} + +// Read-only extensions +function readOnlyExtensions(filename) { + return [ + ...baseExtensions(filename), + EditorState.readOnly.of(true), + EditorView.editable.of(false), + ]; +} + +function resolveClickedLineNumber(target, view, event) { + if (!(target instanceof Element)) return null; + + const gutter = target.closest('.cm-gutterElement'); + if (!gutter) return null; + + const directText = (gutter.textContent || '').trim(); + const parsed = Number.parseInt(directText, 10); + if (Number.isInteger(parsed) && parsed > 0) { + return parsed; + } + + const contentRect = view.contentDOM.getBoundingClientRect(); + const gutterRect = gutter.getBoundingClientRect(); + const pos = view.posAtCoords({ + x: contentRect.left + Math.max(8, Math.min(contentRect.width - 8, 12)), + y: event.clientY || (gutterRect.top + gutterRect.height / 2), + }); + + return pos == null ? null : view.state.doc.lineAt(pos).number; +} + +function getLineClickExtensions(meta, side) { + if (!meta?.enableLineComments || !meta.dotNetRef) return []; + + return [EditorView.domEventHandlers({ + mousedown(event, view) { + const lineNumber = resolveClickedLineNumber(event.target, view, event); + if (lineNumber == null) return false; + + event.preventDefault(); + meta.dotNetRef.invokeMethodAsync( + 'HandleEditorLineClick', + meta.fileIndex ?? -1, + meta.fileName ?? '', + side, + lineNumber + ).catch(err => console.error('[PolyPilotCodeMirror] Failed to send line click to .NET', err)); + return true; + } + })]; +} + +// Global registry of active instances for cleanup +const instances = new Map(); +let nextId = 1; + +// --- Public API exposed to Blazor via JS interop --- + +/** + * Create a read-only code viewer with syntax highlighting and line numbers. + * Returns an instance ID for later disposal. + */ +function createEditor(containerId, content, filename, options = {}) { + const container = document.getElementById(containerId); + if (!container) return -1; + + container.innerHTML = ''; + + const extensions = options.editable ? baseExtensions(filename) : readOnlyExtensions(filename); + + const view = new EditorView({ + doc: content || '', + extensions, + parent: container, + }); + + const id = nextId++; + instances.set(id, { type: 'editor', view, container }); + return id; +} + +/** + * Create a side-by-side diff/merge view. + * `original` is the old content, `modified` is the new content. + */ +function createMergeView(containerId, original, modified, filename, fileIndex = -1, dotNetRef = null, enableLineComments = false, options = {}) { + const container = document.getElementById(containerId); + if (!container) return -1; + + container.innerHTML = ''; + + const lang = getLanguageForFile(filename); + const collapseUnchanged = options.collapseUnchanged !== false ? { margin: 3, minSize: 4 } : undefined; + const commentMeta = { + dotNetRef, + fileIndex, + fileName: filename || '', + enableLineComments, + }; + + const sharedExtensions = [ + lineNumbers(), + highlightSpecialChars(), + foldGutter(), + drawSelection(), + syntaxHighlighting(defaultHighlightStyle, { fallback: true }), + bracketMatching(), + highlightSelectionMatches(), + keymap.of([ + ...defaultKeymap, + ...searchKeymap, + ...foldKeymap, + ]), + oneDark, + polyPilotTheme, + EditorState.readOnly.of(true), + EditorView.editable.of(false), + ...lang, + ]; + + const mergeView = new MergeView({ + a: { + doc: original || '', + extensions: [...sharedExtensions, ...getLineClickExtensions(commentMeta, 'original')], + }, + b: { + doc: modified || '', + extensions: [...sharedExtensions, ...getLineClickExtensions(commentMeta, 'modified')], + }, + parent: container, + collapseUnchanged, + gutter: true, + }); + + const id = nextId++; + instances.set(id, { type: 'merge', mergeView, container }); + return id; +} + +/** + * Update content of an existing editor instance. + */ +function updateContent(instanceId, content) { + const inst = instances.get(instanceId); + if (!inst) return; + + if (inst.type === 'editor') { + inst.view.dispatch({ + changes: { from: 0, to: inst.view.state.doc.length, insert: content }, + }); + } +} + +/** + * Dispose an editor or merge view instance. + */ +function dispose(instanceId) { + const inst = instances.get(instanceId); + if (!inst) return; + + if (inst.type === 'editor') { + inst.view.destroy(); + } else if (inst.type === 'merge') { + inst.mergeView.destroy(); + } + instances.delete(instanceId); +} + +/** + * Dispose all instances. + */ +function disposeAll() { + for (const [id] of instances) { + dispose(id); + } +} + +/** + * Open the search panel for an instance. + */ +function openSearch(instanceId) { + const inst = instances.get(instanceId); + if (!inst) return; + + if (inst.type === 'editor') { + openSearchPanel(inst.view); + } else if (inst.type === 'merge') { + // Open search on the modified (b) side + openSearchPanel(inst.mergeView.b); + } +} + +// Expose API globally for Blazor JS interop +window.PolyPilotCodeMirror = { + createEditor, + createMergeView, + updateContent, + dispose, + disposeAll, + openSearch, +}; diff --git a/PolyPilot/wwwroot/app.css b/PolyPilot/wwwroot/app.css index ef3f09d282..7a1db7e011 100644 --- a/PolyPilot/wwwroot/app.css +++ b/PolyPilot/wwwroot/app.css @@ -1160,3 +1160,30 @@ h1:focus { color: var(--text-muted); text-align: center; } + +/* ══ CodeMirror merge-view overrides ══ + These must be global (not scoped) because CodeMirror + creates its own DOM outside Blazor's scope isolation. */ + +.diff-cm-container .cm-mergeView { + border-radius: 0 0 8px 8px; + overflow: hidden; +} + +.diff-cm-container .cm-editor { + max-height: 600px; +} + +.diff-cm-container .cm-scroller { + overflow: auto; +} + +.diff-cm-container .cm-merge-spacer { + background: var(--bg-tertiary, rgba(255,255,255,0.03)); + border-left: 1px solid var(--control-border, rgba(255,255,255,0.08)); + border-right: 1px solid var(--control-border, rgba(255,255,255,0.08)); +} + +.diff-cm-container .cm-merge-revert { + display: none; /* read-only view — hide revert buttons */ +} diff --git a/PolyPilot/wwwroot/index.html b/PolyPilot/wwwroot/index.html index 9d1d2a86ef..49f57084d3 100644 --- a/PolyPilot/wwwroot/index.html +++ b/PolyPilot/wwwroot/index.html @@ -1466,6 +1466,9 @@ }; + + + diff --git a/PolyPilot/wwwroot/lib/codemirror/codemirror-bundle.js b/PolyPilot/wwwroot/lib/codemirror/codemirror-bundle.js new file mode 100644 index 0000000000..19af3e09c8 --- /dev/null +++ b/PolyPilot/wwwroot/lib/codemirror/codemirror-bundle.js @@ -0,0 +1,33 @@ +var CM=(()=>{var Bo=[],Of=[];(()=>{let i="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,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);for(let e=0,t=0;e>1;if(i=Of[n])e=n+1;else return!0;if(e==t)return!1}}function cf(i){return i>=127462&&i<=127487}var ff=8205;function df(i,e,t=!0,n=!0){return(t?pf:K0)(i,e,n)}function pf(i,e,t){if(e==i.length)return e;e&&mf(i.charCodeAt(e))&&gf(i.charCodeAt(e-1))&&e--;let n=Do(i,e);for(e+=uf(n);e=0&&cf(Do(i,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function K0(i,e,t){for(;e>0;){let n=pf(i,e-2,t);if(n=56320&&i<57344}function gf(i){return i>=55296&&i<56320}function uf(i){return i<65536?1:2}var D=class i{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=Di(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),Li.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Di(this,e,t);let n=[];return this.decompose(e,t,n,0),Li.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new di(this),s=new di(e);for(let o=t,l=t;;){if(r.next(o),s.next(o),o=0,r.lineBreak!=s.lineBreak||r.done!=s.done||r.value!=s.value)return!1;if(l+=r.value.length,r.done||l>=n)return!0}}iter(e=1){return new di(this,e)}iterRange(e,t=this.length){return new Wr(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t==null&&(t=this.lines+1);let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Lr(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?i.empty:e.length<=32?new je(e):Li.from(je.split(e,[]))}},je=class i extends D{constructor(e,t=J0(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let s=0;;s++){let o=this.text[s],l=r+o.length;if((t?n:l)>=e)return new Io(r,l,n,o);r=l+1,n++}}decompose(e,t,n,r){let s=e<=0&&t>=this.length?this:new i(Sf(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(r&1){let o=n.pop(),l=Er(s.text,o.text.slice(),0,s.length);if(l.length<=32)n.push(new i(l,o.length+s.length));else{let a=l.length>>1;n.push(new i(l.slice(0,a)),new i(l.slice(a)))}}else n.push(s)}replace(e,t,n){if(!(n instanceof i))return super.replace(e,t,n);[e,t]=Di(this,e,t);let r=Er(this.text,Er(n.text,Sf(this.text,0,e)),t),s=this.length+n.length-(t-e);return r.length<=32?new i(r,s):Li.from(i.split(r,[]),s)}sliceString(e,t=this.length,n=` +`){[e,t]=Di(this,e,t);let r="";for(let s=0,o=0;s<=t&&oe&&o&&(r+=n),es&&(r+=l.slice(Math.max(0,e-s),t-s)),s=a+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],r=-1;for(let s of e)n.push(s),r+=s.length+1,n.length==32&&(t.push(new i(n,r)),n=[],r=-1);return r>-1&&t.push(new i(n,r)),t}},Li=class i extends D{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let n of e)this.lines+=n.lines}lineInner(e,t,n,r){for(let s=0;;s++){let o=this.children[s],l=r+o.length,a=n+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,n,r);r=l+1,n=a+1}}decompose(e,t,n,r){for(let s=0,o=0;o<=t&&s=o){let h=r&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?n.push(l):l.decompose(e-o,t-o,n,h)}o=a+1}}replace(e,t,n){if([e,t]=Di(this,e,t),n.lines=s&&t<=l){let a=o.replace(e-s,t-s,n),h=this.lines-o.lines+a.lines;if(a.lines>4&&a.lines>h>>6){let c=this.children.slice();return c[r]=a,new i(c,this.length-(t-e)+n.length)}return super.replace(s,l,a)}s=l+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n=` +`){[e,t]=Di(this,e,t);let r="";for(let s=0,o=0;se&&s&&(r+=n),eo&&(r+=l.sliceString(e-o,t-o,n)),o=a+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof i))return 0;let n=0,[r,s,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,s+=t){if(r==o||s==l)return n;let a=this.children[r],h=e.children[s];if(a!=h)return n+a.scanIdentical(h,t);n+=a.length+1}}static from(e,t=e.reduce((n,r)=>n+r.length+1,-1)){let n=0;for(let O of e)n+=O.lines;if(n<32){let O=[];for(let d of e)d.flatten(O);return new je(O,t)}let r=Math.max(32,n>>5),s=r<<1,o=r>>1,l=[],a=0,h=-1,c=[];function f(O){let d;if(O.lines>s&&O instanceof i)for(let m of O.children)f(m);else O.lines>o&&(a>o||!a)?(u(),l.push(O)):O instanceof je&&a&&(d=c[c.length-1])instanceof je&&O.lines+d.lines<=32?(a+=O.lines,h+=O.length+1,c[c.length-1]=new je(d.text.concat(O.text),d.length+1+O.length)):(a+O.lines>r&&u(),a+=O.lines,h+=O.length+1,c.push(O))}function u(){a!=0&&(l.push(c.length==1?c[0]:i.from(c,h)),h=-1,a=c.length=0)}for(let O of e)f(O);return u(),l.length==1?l[0]:new i(l,t)}};D.empty=new je([""],0);function J0(i){let e=-1;for(let t of i)e+=t.length+1;return e}function Er(i,e,t=0,n=1e9){for(let r=0,s=0,o=!0;s=t&&(a>n&&(l=l.slice(0,n-r)),r0?1:(e instanceof je?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],s=this.offsets[n],o=s>>1,l=r instanceof je?r.text.length:r.children.length;if(o==(t>0?l:0)){if(n==0)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=` +`,this;e--}else if(r instanceof je){let a=r.text[o+(t<0?-1:0)];if(this.offsets[n]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=r.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof je?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},Wr=class{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new di(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=n?r:t<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}},Lr=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol<"u"&&(D.prototype[Symbol.iterator]=function(){return this.iter()},di.prototype[Symbol.iterator]=Wr.prototype[Symbol.iterator]=Lr.prototype[Symbol.iterator]=function(){return this});var Io=class{constructor(e,t,n,r){this.from=e,this.to=t,this.number=n,this.text=r}get length(){return this.to-this.from}};function Di(i,e,t){return e=Math.max(0,Math.min(i.length,e)),[e,Math.max(e,Math.min(i.length,t))]}function oe(i,e,t=!0,n=!0){return df(i,e,t,n)}function eS(i){return i>=56320&&i<57344}function tS(i){return i>=55296&&i<56320}function st(i,e){let t=i.charCodeAt(e);if(!tS(t)||e+1==i.length)return t;let n=i.charCodeAt(e+1);return eS(n)?(t-55296<<10)+(n-56320)+65536:t}function Yr(i){return i<=65535?String.fromCharCode(i):(i-=65536,String.fromCharCode((i>>10)+55296,(i&1023)+56320))}function Vt(i){return i<65536?1:2}var Go=/\r\n?|\n/,de=(function(i){return i[i.Simple=0]="Simple",i[i.TrackDel=1]="TrackDel",i[i.TrackBefore=2]="TrackBefore",i[i.TrackAfter=3]="TrackAfter",i})(de||(de={})),wt=class i{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return s+(e-r);s+=l}else{if(n!=de.Simple&&h>=e&&(n==de.TrackDel&&re||n==de.TrackBefore&&re))return null;if(h>e||h==e&&t<0&&!l)return e==r||t<0?s:s+a;s+=a}r=h}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return s}touchesRange(e,t=e){for(let n=0,r=0;n=0&&r<=t&&l>=e)return rt?"cover":!0;r=l}return!1}toString(){let e="";for(let t=0;t=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new i(e)}static create(e){return new i(e)}},me=class i extends wt{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return No(this,(t,n,r,s,o)=>e=e.replace(r,r+(n-t),o),!1),e}mapDesc(e,t=!1){return Uo(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let r=0,s=0;r=0){t[r]=l,t[r+1]=o;let a=r>>1;for(;n.length0&&jt(n,t,s.text),s.forward(c),l+=c}let h=e[o++];for(;l>1].toJSON()))}return e}static of(e,t,n){let r=[],s=[],o=0,l=null;function a(c=!1){if(!c&&!r.length)return;ou||f<0||u>t)throw new RangeError(`Invalid change range ${f} to ${u} (in doc of length ${t})`);let d=O?typeof O=="string"?D.of(O.split(n||Go)):O:D.empty,m=d.length;if(f==u&&m==0)return;fo&&ye(r,f-o,-1),ye(r,u-f,m),jt(s,r,d),o=u}}return h(e),a(!l),l}static empty(e){return new i(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let r=0;rl&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;n.length=0&&t<=0&&t==i[r+1]?i[r]+=e:r>=0&&e==0&&i[r]==0?i[r+1]+=t:n?(i[r]+=e,i[r+1]+=t):i.push(e,t)}function jt(i,e,t){if(t.length==0)return;let n=e.length-2>>1;if(n>1])),!(t||o==i.sections.length||i.sections[o+1]<0);)l=i.sections[o++],a=i.sections[o++];e(r,h,s,c,f),r=h,s=c}}}function Uo(i,e,t,n=!1){let r=[],s=n?[]:null,o=new pi(i),l=new pi(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);ye(r,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len=0&&a=0){let h=0,c=o.len;for(;c;)if(l.ins==-1){let f=Math.min(c,l.len);h+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.lena||o.ins>=0&&o.len>a)&&(l||n.length>h),s.forward2(a),o.forward(a)}}}}var pi=class{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?D.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?D.empty:t[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}},Wi=class i{constructor(e,t,n){this.from=e,this.to=t,this.flags=n}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let n,r;return this.empty?n=r=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),n==this.from&&r==this.to?this:new i(n,r,this.flags)}extend(e,t=e,n=0){if(e<=this.anchor&&t>=this.anchor)return Q.range(e,t,void 0,void 0,n);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return Q.range(this.anchor,r,void 0,void 0,n)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return Q.range(e.anchor,e.head)}static create(e,t,n){return new i(e,t,n)}},Q=class i{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:i.create(this.ranges.map(n=>n.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;ne.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new i(e.ranges.map(t=>Wi.fromJSON(t)),e.main)}static single(e,t=e){return new i([i.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let n=0,r=0;rr.from-s.from),t=e.indexOf(n);for(let r=1;rs.head?i.range(a,l):i.range(l,a))}}return new i(e,t)}};function wf(i,e){for(let t of i.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}var sl=0,A=class i{constructor(e,t,n,r,s){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=sl++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new i(e.combine||(t=>t),e.compareInput||((t,n)=>t===n),e.compare||(e.combine?(t,n)=>t===n:ol),!!e.static,e.enables)}of(e){return new ji([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new ji(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new ji(e,this,2,t)}from(e,t){return t||(t=n=>n),this.compute([e],n=>t(n.field(e)))}};function ol(i,e){return i==e||i.length==e.length&&i.every((t,n)=>t===e[n])}var ji=class{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=sl++}dynamicSlot(e){var t;let n=this.value,r=this.facet.compareInput,s=this.id,o=e[s]>>1,l=this.type==2,a=!1,h=!1,c=[];for(let f of this.dependencies)f=="doc"?a=!0:f=="selection"?h=!0:(((t=e[f.id])!==null&&t!==void 0?t:1)&1)==0&&c.push(e[f.id]);return{create(f){return f.values[o]=n(f),1},update(f,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||Fo(f,c)){let O=n(f);if(l?!Qf(O,f.values[o],r):!r(O,f.values[o]))return f.values[o]=O,1}return 0},reconfigure:(f,u)=>{let O,d=u.config.address[s];if(d!=null){let m=Dr(u,d);if(this.dependencies.every(g=>g instanceof A?u.facet(g)===f.facet(g):g instanceof se?u.field(g,!1)==f.field(g,!1):!0)||(l?Qf(O=n(f),m,r):r(O=n(f),m)))return f.values[o]=m,0}else O=n(f);return f.values[o]=O,1}}}};function Qf(i,e,t){if(i.length!=e.length)return!1;for(let n=0;ni[a.id]),r=t.map(a=>a.type),s=n.filter(a=>!(a&1)),o=i[e.id]>>1;function l(a){let h=[];for(let c=0;cn===r),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(Mr).find(n=>n.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:n=>(n.values[t]=this.create(n),1),update:(n,r)=>{let s=n.values[t],o=this.updateF(s,r);return this.compareF(s,o)?0:(n.values[t]=o,1)},reconfigure:(n,r)=>{let s=n.facet(Mr),o=r.facet(Mr),l;return(l=s.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(n.values[t]=l.create(n),1):r.config.address[this.id]!=null?(n.values[t]=r.field(this),0):(n.values[t]=this.create(n),1)}}}init(e){return[this,Mr.of({field:this,create:e})]}get extension(){return this}},ui={lowest:4,low:3,default:2,high:1,highest:0};function vn(i){return e=>new jr(e,i)}var Te={highest:vn(ui.highest),high:vn(ui.high),default:vn(ui.default),low:vn(ui.low),lowest:vn(ui.lowest)},jr=class{constructor(e,t){this.inner=e,this.prec=t}},mi=class i{of(e){return new Pn(this,e)}reconfigure(e){return i.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}},Pn=class{constructor(e,t){this.compartment=e,this.inner=t}},Vr=class i{constructor(e,t,n,r,s,o){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=r,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,n){let r=[],s=Object.create(null),o=new Map;for(let u of nS(e,t,o))u instanceof se?r.push(u):(s[u.facet.id]||(s[u.facet.id]=[])).push(u);let l=Object.create(null),a=[],h=[];for(let u of r)l[u.id]=h.length<<1,h.push(O=>u.slot(O));let c=n?.config.facets;for(let u in s){let O=s[u],d=O[0].facet,m=c&&c[u]||[];if(O.every(g=>g.type==0))if(l[d.id]=a.length<<1|1,ol(m,O))a.push(n.facet(d));else{let g=d.combine(O.map(S=>S.value));a.push(n&&d.compare(g,n.facet(d))?n.facet(d):g)}else{for(let g of O)g.type==0?(l[g.id]=a.length<<1|1,a.push(g.value)):(l[g.id]=h.length<<1,h.push(S=>g.dynamicSlot(S)));l[d.id]=h.length<<1,h.push(g=>iS(g,d,O))}}let f=h.map(u=>u(l));return new i(e,o,f,l,a,s)}};function nS(i,e,t){let n=[[],[],[],[],[]],r=new Map;function s(o,l){let a=r.get(o);if(a!=null){if(a<=l)return;let h=n[a].indexOf(o);h>-1&&n[a].splice(h,1),o instanceof Pn&&t.delete(o.compartment)}if(r.set(o,l),Array.isArray(o))for(let h of o)s(h,l);else if(o instanceof Pn){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),s(h,l)}else if(o instanceof jr)s(o.inner,o.prec);else if(o instanceof se)n[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof ji)n[l].push(o),o.facet.extensions&&s(o.facet.extensions,ui.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(h,l)}}return s(i,ui.default),n.reduce((o,l)=>o.concat(l))}function $n(i,e){if(e&1)return 2;let t=e>>1,n=i.status[t];if(n==4)throw new Error("Cyclic dependency between fields and/or facets");if(n&2)return n;i.status[t]=4;let r=i.computeSlot(i,i.config.dynamicSlots[t]);return i.status[t]=2|r}function Dr(i,e){return e&1?i.config.staticValues[e>>1]:i.values[e>>1]}var vf=A.define(),Ho=A.define({combine:i=>i.some(e=>e),static:!0}),$f=A.define({combine:i=>i.length?i[0]:void 0,static:!0}),Pf=A.define(),Tf=A.define(),Cf=A.define(),Xf=A.define({combine:i=>i.length?i[0]:!1}),Re=class{constructor(e,t){this.type=e,this.value=t}static define(){return new Ko}},Ko=class{of(e){return new Re(this,e)}},Jo=class{constructor(e){this.map=e}of(e){return new L(this,e)}},L=class i{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new i(this.type,t)}is(e){return this.type==e}static define(e={}){return new Jo(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let r of e){let s=r.map(t);s&&n.push(s)}return n}};L.reconfigure=L.define();L.appendConfig=L.define();var ae=class i{constructor(e,t,n,r,s,o){this.startState=e,this.changes=t,this.selection=n,this.effects=r,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,n&&wf(n,t.newLength),s.some(l=>l.type==i.time)||(this.annotations=s.concat(i.time.of(Date.now())))}static create(e,t,n,r,s,o){return new i(e,t,n,r,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(i.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}};ae.time=Re.define();ae.userEvent=Re.define();ae.addToHistory=Re.define();ae.remote=Re.define();function rS(i,e){let t=[];for(let n=0,r=0;;){let s,o;if(n=i[n]))s=i[n++],o=i[n++];else if(r=0;r--){let s=n[r](i);s instanceof ae?i=s:Array.isArray(s)&&s.length==1&&s[0]instanceof ae?i=s[0]:i=Af(e,Vi(s),!1)}return i}function oS(i){let e=i.startState,t=e.facet(Cf),n=i;for(let r=t.length-1;r>=0;r--){let s=t[r](i);s&&Object.keys(s).length&&(n=Rf(n,el(e,s,i.changes.newLength),!0))}return n==i?i:ae.create(e,i.changes,i.selection,n.effects,n.annotations,n.scrollIntoView)}var lS=[];function Vi(i){return i==null?lS:Array.isArray(i)?i:[i]}var H=(function(i){return i[i.Word=0]="Word",i[i.Space=1]="Space",i[i.Other=2]="Other",i})(H||(H={})),aS=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,tl;try{tl=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function hS(i){if(tl)return tl.test(i);for(let e=0;e"\x80"&&(t.toUpperCase()!=t.toLowerCase()||aS.test(t)))return!0}return!1}function cS(i){return e=>{if(!/\S/.test(e))return H.Space;if(hS(e))return H.Word;for(let t=0;t-1)return H.Word;return H.Other}}var F=class i{constructor(e,t,n,r,s,o){this.config=e,this.doc=t,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let l=0;lr.set(h,a)),t=null),r.set(l.value.compartment,l.value.extension)):l.is(L.reconfigure)?(t=null,n=l.value):l.is(L.appendConfig)&&(t=null,n=Vi(n).concat(l.value));let s;t?s=e.startState.values.slice():(t=Vr.resolve(n,r,this),s=new i(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=e.startState.facet(Ho)?e.newSelection:e.newSelection.asSingle();new i(t,e.newDoc,o,s,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:Q.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),r=this.changes(n.changes),s=[n.range],o=Vi(n.effects);for(let l=1;lo.spec.fromJSON(l,a)))}}return i.create({doc:e.doc,selection:Q.fromJSON(e.selection),extensions:t.extensions?r.concat([t.extensions]):r})}static create(e={}){let t=Vr.resolve(e.extensions||[],new Map),n=e.doc instanceof D?e.doc:D.of((e.doc||"").split(t.staticFacet(i.lineSeparator)||Go)),r=e.selection?e.selection instanceof Q?e.selection:Q.single(e.selection.anchor,e.selection.head):Q.single(0);return wf(r,n.length),t.staticFacet(Ho)||(r=r.asSingle()),new i(t,n,r,t.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(i.tabSize)}get lineBreak(){return this.facet(i.lineSeparator)||` +`}get readOnly(){return this.facet(Xf)}phrase(e,...t){for(let n of this.facet(i.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(n,r)=>{if(r=="$")return"$";let s=+(r||1);return!s||s>t.length?n:t[s-1]})),e}languageDataAt(e,t,n=-1){let r=[];for(let s of this.facet(vf))for(let o of s(this,t,n))Object.prototype.hasOwnProperty.call(o,e)&&r.push(o[e]);return r}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return cS(t.length?t[0]:"")}wordAt(e){let{text:t,from:n,length:r}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-n,l=e-n;for(;o>0;){let a=oe(t,o,!1);if(s(t.slice(a,o))!=H.Word)break;o=a}for(;li.length?i[0]:4});F.lineSeparator=$f;F.readOnly=Xf;F.phrases=A.define({compare(i,e){let t=Object.keys(i),n=Object.keys(e);return t.length==n.length&&t.every(r=>i[r]==e[r])}});F.languageData=vf;F.changeFilter=Pf;F.transactionFilter=Tf;F.transactionExtender=Cf;mi.reconfigure=L.define();function Ve(i,e,t={}){let n={};for(let r of i)for(let s of Object.keys(r)){let o=r[s],l=n[s];if(l===void 0)n[s]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(t,s))n[s]=t[s](l,o);else throw new Error("Config merge conflict for field "+s)}for(let r in e)n[r]===void 0&&(n[r]=e[r]);return n}var He=class{eq(e){return this==e}range(e,t=e){return Tn.create(e,t,this)}};He.prototype.startSide=He.prototype.endSide=0;He.prototype.point=!1;He.prototype.mapMode=de.TrackDel;function ll(i,e){return i==e||i.constructor==e.constructor&&i.eq(e)}var Tn=class i{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new i(e,t,n)}};function il(i,e){return i.from-e.from||i.value.startSide-e.value.startSide}var nl=class i{constructor(e,t,n,r){this.from=e,this.to=t,this.value=n,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,r=0){let s=n?this.to:this.from;for(let o=r,l=s.length;;){if(o==l)return o;let a=o+l>>1,h=s[a]-e||(n?this.value[a].endSide:this.value[a].startSide)-t;if(a==o)return h>=0?o:l;h>=0?l=a:o=a+1}}between(e,t,n,r){for(let s=this.findIndex(t,-1e9,!0),o=this.findIndex(n,1e9,!1,s);sO||u==O&&h.startSide>0&&h.endSide<=0)continue;(O-u||h.endSide-h.startSide)<0||(o<0&&(o=u),h.point&&(l=Math.max(l,O-u)),n.push(h),r.push(u-o),s.push(O-o))}return{mapped:n.length?new i(r,s,n,l):null,pos:o}}},G=class i{constructor(e,t,n,r){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=r}static create(e,t,n,r){return new i(e,t,n,r)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:r=0,filterTo:s=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(n&&(t=t.slice().sort(il)),this.isEmpty)return t.length?i.of(t):this;let l=new Br(this,null,-1).goto(0),a=0,h=[],c=new ge;for(;l.value||a=0){let f=t[a++];c.addInner(f.from,f.to,f.value)||h.push(f)}else l.rangeIndex==1&&l.chunkIndexthis.chunkEnd(l.chunkIndex)||sl.to||s=s&&e<=s+o.length&&o.between(s,e-s,t-s,n)===!1)return}this.nextLayer.between(e,t,n)}}iter(e=0){return Cn.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Cn.from(e).goto(t)}static compare(e,t,n,r,s=-1){let o=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),l=t.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),a=bf(o,l,n),h=new Oi(o,a,s),c=new Oi(l,a,s);n.iterGaps((f,u,O)=>yf(h,f,c,u,O,r)),n.empty&&n.length==0&&yf(h,0,c,0,0,r)}static eq(e,t,n=0,r){r==null&&(r=999999999);let s=e.filter(c=>!c.isEmpty&&t.indexOf(c)<0),o=t.filter(c=>!c.isEmpty&&e.indexOf(c)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let l=bf(s,o),a=new Oi(s,l,0).goto(n),h=new Oi(o,l,0).goto(n);for(;;){if(a.to!=h.to||!rl(a.active,h.active)||a.point&&(!h.point||!ll(a.point,h.point)))return!1;if(a.to>r)return!0;a.next(),h.next()}}static spans(e,t,n,r,s=-1){let o=new Oi(e,null,s).goto(t),l=t,a=o.openStart;for(;;){let h=Math.min(o.to,n);if(o.point){let c=o.activeForPoint(o.to),f=o.pointFroml&&(r.span(l,h,o.active,a),a=o.openEnd(h));if(o.to>n)return a+(o.point&&o.to>n?1:0);l=o.to,o.next()}}static of(e,t=!1){let n=new ge;for(let r of e instanceof Tn?[e]:t?fS(e):e)n.add(r.from,r.to,r.value);return n.finish()}static join(e){if(!e.length)return i.empty;let t=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let r=e[n];r!=i.empty;r=r.nextLayer)t=new i(r.chunkPos,r.chunk,t,Math.max(r.maxPoint,t.maxPoint));return t}};G.empty=new G([],[],null,-1);function fS(i){if(i.length>1)for(let e=i[0],t=1;t0)return i.slice().sort(il);e=n}return i}G.empty.nextLayer=G.empty;var ge=class i{finishChunk(e){this.chunks.push(new nl(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,n){this.addInner(e,t,n)||(this.nextLayer||(this.nextLayer=new i)).add(e,t,n)}addInner(e,t,n){let r=e-this.lastTo||n.startSide-this.last.endSide;if(r<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return r<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(G.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=G.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}};function bf(i,e,t){let n=new Map;for(let s of i)for(let o=0;o=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=n&&r.push(new Br(o,t,n,s));return r.length==1?r[0]:new i(r)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let n=this.heap.length>>1;n>=0;n--)Yo(this.heap,n);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let n=this.heap.length>>1;n>=0;n--)Yo(this.heap,n);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Yo(this.heap,0)}}};function Yo(i,e){for(let t=i[e];;){let n=(e<<1)+1;if(n>=i.length)break;let r=i[n];if(n+1=0&&(r=i[n+1],n++),t.compare(r)<0)break;i[n]=t,i[e]=r,e=n}}var Oi=class{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Cn.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){_r(this.active,e),_r(this.activeTo,e),_r(this.activeRank,e),this.minActive=xf(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:r,rank:s}=this.cursor;for(;t0;)t++;zr(this.active,t,n),zr(this.activeTo,t,r),zr(this.activeRank,t,s),e&&zr(e,t,this.cursor.from),this.minActive=xf(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let r=this.minActive;if(r>-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>e){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),n&&_r(n,r)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(n),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from=0&&n[r]=0&&!(this.activeRank[n]e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}};function yf(i,e,t,n,r,s){i.goto(e),t.goto(n);let o=n+r,l=n,a=n-e,h=!!s.boundChange;for(let c=!1;;){let f=i.to+a-t.to,u=f||i.endSide-t.endSide,O=u<0?i.to+a:t.to,d=Math.min(O,o);if(i.point||t.point?(i.point&&t.point&&ll(i.point,t.point)&&rl(i.activeForPoint(i.to),t.activeForPoint(t.to))||s.comparePoint(l,d,i.point,t.point),c=!1):(c&&s.boundChange(l),d>l&&!rl(i.active,t.active)&&s.compareRange(l,d,i.active,t.active),h&&do)break;l=O,u<=0&&i.next(),u>=0&&t.next()}}function rl(i,e){if(i.length!=e.length)return!1;for(let t=0;t=e;n--)i[n+1]=i[n];i[e]=t}function xf(i,e){let t=-1,n=1e9;for(let r=0;r=e)return r;if(r==i.length)break;s+=i.charCodeAt(r)==9?t-s%t:1,r=oe(i,r)}return n===!0?-1:i.length}var qf=typeof Symbol>"u"?"__\u037C":Symbol.for("\u037C"),al=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Mf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{},Ze=class{constructor(e,t){this.rules=[];let{finish:n}=t||{};function r(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,l,a,h){let c=[],f=/^@(\w+)\b/.exec(o[0]),u=f&&f[1]=="keyframes";if(f&&l==null)return a.push(o[0]+";");for(let O in l){let d=l[O];if(/&/.test(O))s(O.split(/,\s*/).map(m=>o.map(g=>m.replace(/&/,g))).reduce((m,g)=>m.concat(g)),d,a);else if(d&&typeof d=="object"){if(!f)throw new RangeError("The value of a property ("+O+") should be a primitive value.");s(r(O),d,c,u)}else d!=null&&c.push(O.replace(/_.*/,"").replace(/[A-Z]/g,m=>"-"+m.toLowerCase())+": "+d+";")}(c.length||u)&&a.push((n&&!f&&!h?o.map(n):o).join(", ")+" {"+c.join(" ")+"}")}for(let o in e)s(r(o),e[o],this.rules)}getRules(){return this.rules.join(` +`)}static newName(){let e=Mf[qf]||1;return Mf[qf]=e+1,"\u037C"+e.toString(36)}static mount(e,t,n){let r=e[al],s=n&&n.nonce;r?s&&r.setNonce(s):r=new hl(e,s),r.mount(Array.isArray(t)?t:[t],e)}},_f=new Map,hl=class{constructor(e,t){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let s=_f.get(n);if(s)return e[al]=s;this.sheet=new r.CSSStyleSheet,_f.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[al]=this}mount(e,t){let n=this.sheet,r=0,s=0;for(let o=0;o-1&&(this.modules.splice(a,1),s--,a=-1),a==-1){if(this.modules.splice(s++,0,l),n)for(let h=0;h",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},uS=typeof navigator<"u"&&/Mac/.test(navigator.platform),OS=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(he=0;he<10;he++)vt[48+he]=vt[96+he]=String(he);var he;for(he=1;he<=24;he++)vt[he+111]="F"+he;var he;for(he=65;he<=90;he++)vt[he]=String.fromCharCode(he+32),Bi[he]=String.fromCharCode(he);var he;for(Ir in vt)Bi.hasOwnProperty(Ir)||(Bi[Ir]=vt[Ir]);var Ir;function zf(i){var e=uS&&i.metaKey&&i.shiftKey&&!i.ctrlKey&&!i.altKey||OS&&i.shiftKey&&i.key&&i.key.length==1||i.key=="Unidentified",t=!e&&i.key||(i.shiftKey?Bi:vt)[i.keyCode]||i.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function le(){var i=arguments[0];typeof i=="string"&&(i=document.createElement(i));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=t[n];typeof r=="string"?i.setAttribute(n,r):r!=null&&(i[n]=r)}e++}for(;e2),q={mac:jf||/Mac/.test(Ce.platform),windows:/Win/.test(Ce.platform),linux:/Linux|X11/.test(Ce.platform),ie:bs,ie_version:bu?Sl.documentMode||6:bl?+bl[1]:Ql?+Ql[1]:0,gecko:Wf,gecko_version:Wf?+(/Firefox\/(\d+)/.exec(Ce.userAgent)||[0,0])[1]:0,chrome:!!cl,chrome_version:cl?+cl[1]:0,ios:jf,android:/Android\b/.test(Ce.userAgent),webkit:Lf,webkit_version:Lf?+(/\bAppleWebKit\/(\d+)/.exec(Ce.userAgent)||[0,0])[1]:0,safari:yl,safari_version:yl?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Ce.userAgent)||[0,0])[1]:0,tabSize:Sl.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function fa(i,e){for(let t in i)t=="class"&&e.class?e.class+=" "+i.class:t=="style"&&e.style?e.style+=";"+i.style:e[t]=i[t];return e}var ss=Object.create(null);function ua(i,e,t){if(i==e)return!0;i||(i=ss),e||(e=ss);let n=Object.keys(i),r=Object.keys(e);if(n.length-(t&&n.indexOf(t)>-1?1:0)!=r.length-(t&&r.indexOf(t)>-1?1:0))return!1;for(let s of n)if(s!=t&&(r.indexOf(s)==-1||i[s]!==e[s]))return!1;return!0}function dS(i,e){for(let t=i.attributes.length-1;t>=0;t--){let n=i.attributes[t].name;e[n]==null&&i.removeAttribute(n)}for(let t in e){let n=e[t];t=="style"?i.style.cssText=n:i.getAttribute(t)!=n&&i.setAttribute(t,n)}}function Vf(i,e,t){let n=!1;if(e)for(let r in e)t&&r in t||(n=!0,r=="style"?i.style.cssText="":i.removeAttribute(r));if(t)for(let r in t)e&&e[r]==t[r]||(n=!0,r=="style"?i.style.cssText=t[r]:i.setAttribute(r,t[r]));return n}function pS(i){let e=Object.create(null);for(let t=0;t0?3e8:-4e8:t>0?1e8:-1e8,new bi(e,t,t,n,e.widget||null,!1)}static replace(e){let t=!!e.block,n,r;if(e.isBlockGap)n=-5e8,r=4e8;else{let{start:s,end:o}=yu(e,t);n=(s?t?-3e8:-1:5e8)-1,r=(o?t?2e8:1:-6e8)+1}return new bi(e,n,r,t,e.widget||null,!0)}static line(e){return new Vn(e)}static set(e,t=!1){return G.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};M.none=G.empty;var jn=class i extends M{constructor(e){let{start:t,end:n}=yu(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?fa(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||ss}eq(e){return this==e||e instanceof i&&this.tagName==e.tagName&&ua(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}};jn.prototype.point=!1;var Vn=class i extends M{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof i&&this.spec.class==e.spec.class&&ua(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}};Vn.prototype.mapMode=de.TrackBefore;Vn.prototype.point=!0;var bi=class i extends M{constructor(e,t,n,r,s,o){super(t,n,s,e),this.block=r,this.isReplace=o,this.mapMode=r?t<=0?de.TrackBefore:de.TrackAfter:de.TrackDel}get type(){return this.startSide!=this.endSide?Se.WidgetRange:this.startSide<=0?Se.WidgetBefore:Se.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof i&&mS(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}};bi.prototype.point=!0;function yu(i,e=!1){let{inclusiveStart:t,inclusiveEnd:n}=i;return t==null&&(t=i.inclusive),n==null&&(n=i.inclusive),{start:t??e,end:n??e}}function mS(i,e){return i==e||!!(i&&e&&i.compare(e))}function Fi(i,e,t,n=0){let r=t.length-1;r>=0&&t[r]+n>=i?t[r]=Math.max(t[r],e):t.push(i,e)}var os=class i extends He{constructor(e,t){super(),this.tagName=e,this.attributes=t}eq(e){return e==this||e instanceof i&&this.tagName==e.tagName&&ua(this.attributes,e.attributes)}static create(e){return new i(e.tagName,e.attributes||ss)}static set(e,t=!1){return G.of(e,t)}};os.prototype.startSide=os.prototype.endSide=-1;function Dn(i){let e;return i.nodeType==11?e=i.getSelection?i:i.ownerDocument:e=i,e.getSelection()}function xl(i,e){return e?i==e||i.contains(e.nodeType!=1?e.parentNode:e):!1}function An(i,e){if(!e.anchorNode)return!1;try{return xl(i,e.anchorNode)}catch{return!1}}function es(i){return i.nodeType==3?Bn(i,0,i.nodeValue.length).getClientRects():i.nodeType==1?i.getClientRects():[]}function Zn(i,e,t,n){return t?Df(i,e,t,n,-1)||Df(i,e,t,n,1):!1}function Yt(i){for(var e=0;;e++)if(i=i.previousSibling,!i)return e}function ls(i){return i.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(i.nodeName)}function Df(i,e,t,n,r){for(;;){if(i==t&&e==n)return!0;if(e==(r<0?0:Tt(i))){if(i.nodeName=="DIV")return!1;let s=i.parentNode;if(!s||s.nodeType!=1)return!1;e=Yt(i)+(r<0?0:1),i=s}else if(i.nodeType==1){if(i=i.childNodes[e+(r<0?-1:0)],i.nodeType==1&&i.contentEditable=="false")return!1;e=r<0?Tt(i):0}else return!1}}function Tt(i){return i.nodeType==3?i.nodeValue.length:i.childNodes.length}function as(i,e){let t=e?i.left:i.right;return{left:t,right:t,top:i.top,bottom:i.bottom}}function gS(i){let e=i.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:i.innerWidth,top:0,bottom:i.innerHeight}}function xu(i,e){let t=e.width/i.offsetWidth,n=e.height/i.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-i.offsetWidth)<1)&&(t=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.height-i.offsetHeight)<1)&&(n=1),{scaleX:t,scaleY:n}}function SS(i,e,t,n,r,s,o,l){let a=i.ownerDocument,h=a.defaultView||window;for(let c=i,f=!1;c&&!f;)if(c.nodeType==1){let u,O=c==a.body,d=1,m=1;if(O)u=gS(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(f=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let b=c.getBoundingClientRect();({scaleX:d,scaleY:m}=xu(c,b)),u={left:b.left,right:b.left+c.clientWidth*d,top:b.top,bottom:b.top+c.clientHeight*m}}let g=0,S=0;if(r=="nearest")e.top0&&e.bottom>u.bottom+S&&(S=e.bottom-u.bottom+o)):e.bottom>u.bottom-o&&(S=e.bottom-u.bottom+o,t<0&&e.top-S0&&e.right>u.right+g&&(g=e.right-u.right+s)):e.right>u.right-s&&(g=e.right-u.right+s,t<0&&e.leftu.bottom||e.leftu.right)&&(e={left:Math.max(e.left,u.left),right:Math.min(e.right,u.right),top:Math.max(e.top,u.top),bottom:Math.min(e.bottom,u.bottom)}),c=c.assignedSlot||c.parentNode}else if(c.nodeType==11)c=c.host;else break}function ku(i,e=!0){let t=i.ownerDocument,n=null,r=null;for(let s=i.parentNode;s&&!(s==t.body||(!e||n)&&r);)if(s.nodeType==1)!r&&s.scrollHeight>s.clientHeight&&(r=s),e&&!n&&s.scrollWidth>s.clientWidth&&(n=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:n,y:r}}var kl=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?Tt(t):0),n,Math.min(e.focusOffset,n?Tt(n):0))}set(e,t,n,r){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=r}},gi=null;q.safari&&q.safari_version>=26&&(gi=!1);function wu(i){if(i.setActive)return i.setActive();if(gi)return i.focus(gi);let e=[];for(let t=i;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(i.focus(gi==null?{get preventScroll(){return gi={preventScroll:!0},!0}}:void 0),!gi){gi=!1;for(let t=0;tMath.max(0,i.document.documentElement.scrollHeight-i.innerHeight-4):i.scrollTop>Math.max(1,i.scrollHeight-i.clientHeight-4)}function $u(i,e){for(let t=i,n=e;;){if(t.nodeType==3&&n>0)return{node:t,offset:n};if(t.nodeType==1&&n>0){if(t.contentEditable=="false")return null;t=t.childNodes[n-1],n=Tt(t)}else if(t.parentNode&&!ls(t))n=Yt(t),t=t.parentNode;else return null}}function Pu(i,e){for(let t=i,n=e;;){if(t.nodeType==3&&n=t){if(l.level==n)return o;(s<0||(r!=0?r<0?l.fromt:e[s].level>l.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}};function Xu(i,e){if(i.length!=e.length)return!1;for(let t=0;t=0;m-=3)if(mt[m+1]==-O){let g=mt[m+2],S=g&2?r:g&4?g&1?s:r:0;S&&(K[f]=K[mt[m]]=S),l=m;break}}else{if(mt.length==189)break;mt[l++]=f,mt[l++]=u,mt[l++]=a}else if((d=K[f])==2||d==1){let m=d==r;a=m?0:1;for(let g=l-3;g>=0;g-=3){let S=mt[g+2];if(S&2)break;if(m)mt[g+2]|=2;else{if(S&4)break;mt[g+2]|=4}}}}}function $S(i,e,t,n){for(let r=0,s=n;r<=t.length;r++){let o=r?t[r-1].to:i,l=ra;)d==g&&(d=t[--m].from,g=m?t[m-1].to:i),K[--d]=O;a=c}else s=h,a++}}}function vl(i,e,t,n,r,s,o){let l=n%2?2:1;if(n%2==r%2)for(let a=e,h=0;aa&&o.push(new et(a,m.from,O));let g=m.direction==yi!=!(O%2);$l(i,g?n+1:n,r,m.inner,m.from,m.to,o),a=m.to}d=m.to}else{if(d==t||(c?K[d]!=l:K[d]==l))break;d++}u?vl(i,a,d,n+1,r,u,o):ae;){let c=!0,f=!1;if(!h||a>s[h-1].to){let m=K[a-1];m!=l&&(c=!1,f=m==16)}let u=!c&&l==1?[]:null,O=c?n:n+1,d=a;e:for(;;)if(h&&d==s[h-1].to){if(f)break e;let m=s[--h];if(!c)for(let g=m.from,S=h;;){if(g==e)break e;if(S&&s[S-1].to==g)g=s[--S].from;else{if(K[g-1]==l)break e;break}}if(u)u.push(m);else{m.toK.length;)K[K.length]=256;let n=[],r=e==yi?0:1;return $l(i,r,r,t,0,i.length,n),n}function Ru(i){return[new et(0,i,0)]}var Au="";function TS(i,e,t,n,r){var s;let o=n.head-i.from,l=et.find(e,o,(s=n.bidiLevel)!==null&&s!==void 0?s:-1,n.assoc),a=e[l],h=a.side(r,t);if(o==h){let u=l+=r?1:-1;if(u<0||u>=e.length)return null;a=e[l=u],o=a.side(!r,t),h=a.side(r,t)}let c=oe(i.text,o,a.forward(r,t));(ca.to)&&(c=h),Au=i.text.slice(Math.min(o,c),Math.max(o,c));let f=l==(r?e.length-1:0)?null:e[l+(r?1:-1)];return f&&c==h&&f.level+(r?0:1)i.some(e=>e)}),Lu=A.define({combine:i=>i.some(e=>e)}),ju=A.define(),qn=class i{constructor(e,t,n,r,s,o=!1){this.range=e,this.y=t,this.x=n,this.yMargin=r,this.xMargin=s,this.isSnapshot=o}map(e){return e.empty?this:new i(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new i(Q.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}},Gr=L.define({map:(i,e)=>i.map(e)}),Vu=L.define();function tt(i,e,t){let n=i.facet(_u);n.length?n[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}var $t=A.define({combine:i=>i.length?i[0]:!0}),XS=0,Ii=A.define({combine(i){return i.filter((e,t)=>{for(let n=0;n{let a=[];return o&&a.push(ys.of(h=>{let c=h.plugin(l);return c?o(c):M.none})),s&&a.push(s(l)),a})}static fromClass(e,t){return i.define((n,r)=>new e(n,r),t)}},Mn=class{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(n){if(tt(t.state,n,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){tt(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(n){tt(e.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}},Du=A.define(),ma=A.define(),ys=A.define(),Bu=A.define(),ga=A.define(),In=A.define(),Yu=A.define();function Yf(i,e){let t=i.state.facet(Yu);if(!t.length)return t;let n=t.map(s=>s instanceof Function?s(i):s),r=[];return G.spans(n,e.from,e.to,{point(){},span(s,o,l,a){let h=s-e.from,c=o-e.from,f=r;for(let u=l.length-1;u>=0;u--,a--){let O=l[u].spec.bidiIsolate,d;if(O==null&&(O=CS(e.text,h,c)),a>0&&f.length&&(d=f[f.length-1]).to==h&&d.direction==O)d.to=c,f=d.inner;else{let m={from:h,to:c,direction:O,inner:[]};f.push(m),f=m.inner}}}}),r}var Iu=A.define();function Gu(i){let e=0,t=0,n=0,r=0;for(let s of i.state.facet(Iu)){let o=s(i);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(n=Math.max(n,o.top)),o.bottom!=null&&(r=Math.max(r,o.bottom)))}return{left:e,right:t,top:n,bottom:r}}var Xn=A.define(),lt=class i{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}join(e){return new i(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let r=e[t-1];if(!(r.fromA>n.toA)){if(r.toAr.push(new lt(s,o,l,a))),this.changedRanges=r}static create(e,t,n){return new i(e,t,n)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}},RS=[],ne=class{constructor(e,t,n=0){this.dom=e,this.length=t,this.flags=n,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return RS}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let t=this.domAttrs;t&&dS(this.dom,t)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let n=t;for(let r of this.children){if(r==e)return n;n+=r.length+r.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t){return null}domPosFor(e,t){let n=Yt(this.dom),r=this.length?e>0:t>0;return new gt(this.parent.dom,n+(r?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof Ji)return e;return null}static get(e){return e.cmTile}},Ki=class extends ne{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let t=this.dom,n=null,r,s=e?.node==t?e:null,o=0;for(let l of this.children){if(l.sync(e),o+=l.length+l.breakAfter,r=n?n.nextSibling:t.firstChild,s&&r!=l.dom&&(s.written=!0),l.dom.parentNode==t)for(;r&&r!=l.dom;)r=If(r);else t.insertBefore(l.dom,r);n=l.dom}for(r=n?n.nextSibling:t.firstChild,s&&r&&(s.written=!0);r;)r=If(r);this.length=o}};function If(i){let e=i.nextSibling;return i.parentNode.removeChild(i),e}var Ji=class extends Ki{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=ne.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],n=this,r=0,s=0;;)if(r==n.children.length){if(!t.length)return;n=n.parent,n.breakAfter&&s++,r=t.pop()}else{let o=n.children[r++];if(o instanceof Pt)t.push(r),n=o,r=0;else{let l=s+o.length,a=e(o,s);if(a!==void 0)return a;s=l+o.breakAfter}}}resolveBlock(e,t){let n,r=-1,s,o=-1;if(this.blockTiles((l,a)=>{let h=a+l.length;if(e>=a&&e<=h){if(l.isWidget()&&t>=-1&&t<=1){if(l.flags&32)return!0;l.flags&16&&(n=void 0)}(ae||e==a&&(t>1?l.length:l.covers(-1)))&&(!s||!l.isWidget()&&s.isWidget())&&(s=l,o=e-a)}}),!n&&!s)throw new Error("No tile at position "+e);return n&&t<0||!s?{tile:n,offset:r}:{tile:s,offset:o}}},Pt=class i extends Ki{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(e,t){let n=new i(t||document.createElement(e.tagName),e);return t||(n.flags|=4),n}},en=class i extends Ki{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,n){let r=new i(t||document.createElement("div"),e);return(!t||!n)&&(r.flags|=4),r}get domAttrs(){return this.attrs}resolveInline(e,t,n){let r=null,s=-1,o=null,l=-1;function a(c,f){for(let u=0,O=0;u=f&&(d.isComposite()?a(d,f-O):(!o||o.isHidden&&(t>0||n&&ZS(o,d)))&&(m>f||d.flags&32)?(o=d,l=f-O):(On&&(e=n);let r=e,s=e,o=0;e==0&&t<0||e==n&&t>=0?q.chrome||q.gecko||(e?(r--,o=1):s=0)?0:l.length-1];return q.safari&&!o&&a.width==0&&(a=Array.prototype.find.call(l,h=>h.width)||a),o?as(a,o<0):a||null}static of(e,t){let n=new i(t||document.createTextNode(e),e);return t||(n.flags|=2),n}},xi=class i extends ne{constructor(e,t,n,r){super(e,t,r),this.widget=n}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,n){let r=this.widget.coordsAt(this.dom,e,t);if(r)return r;if(n)return as(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let s=this.dom.getClientRects(),o=null;if(!s.length)return null;let l=this.flags&16?!0:this.flags&32?!1:e>0;for(let a=l?s.length-1:0;o=s[a],!(e>0?a==0:a==s.length-1||o.top0;)if(r.isComposite())if(o){if(!e)break;n&&n.break(),e--,o=!1}else if(s==r.children.length){if(!e&&!l.length)break;n&&n.leave(r),o=!!r.breakAfter,{tile:r,index:s}=l.pop(),s++}else{let a=r.children[s],h=a.breakAfter;(t>0?a.length<=e:a.length=0;l--){let a=t.marks[l],h=r.lastChild;if(h instanceof qe&&h.mark.eq(a.mark))h.dom!=a.dom&&h.setDOM(fl(a.dom)),r=h;else{if(this.cache.reused.get(a)){let f=ne.get(a.dom);f&&f.setDOM(fl(a.dom))}let c=qe.of(a.mark,a.dom);r.append(c),r=c}this.cache.reused.set(a,2)}let s=ne.get(e.text);s&&this.cache.reused.set(s,2);let o=new Si(e.text,e.text.nodeValue);o.flags|=8,r.append(o)}addInlineWidget(e,t,n){let r=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);r||this.flushBuffer();let s=this.ensureMarks(t,n);!r&&!(e.flags&16)&&s.append(this.getBuffer(1)),s.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,n){this.flushBuffer(),this.ensureMarks(t,n).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){var n;e||(e=Nu);let r=en.start(e,t||((n=this.cache.find(en))===null||n===void 0?void 0:n.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=r)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){var n;let r=this.curLine;for(let s=e.length-1;s>=0;s--){let o=e[s],l;if(t>0&&(l=r.lastChild)&&l instanceof qe&&l.mark.eq(o))r=l,t--;else{let a=qe.of(o,(n=this.cache.find(qe,h=>h.mark.eq(o)))===null||n===void 0?void 0:n.dom);r.append(a),r=a,t=0}}return r}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!Gf(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(q.ios&&Gf(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(ul,0,32)||new xi(ul.toDOM(),0,ul,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to=this.pos){let t=new Cl(e.from,e.to,e.value,e.rank),n=this.wrappers.length;for(;n>0&&(this.wrappers[n-1].rank-t.rank||this.wrappers[n-1].to-t.to)<0;)n--;this.wrappers.splice(n,0,t)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let n of this.wrappers){let r=t.lastChild;if(n.fromo.wrapper.eq(n.wrapper)))===null||e===void 0?void 0:e.dom);t.append(s),t=s}}return t}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let t=2|(e<0?16:32),n=this.cache.find(tn,void 0,1);return n&&(n.flags=t),n||new tn(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}},Rl=class{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:r,lineBreak:s,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=r;let l=this.textOff=Math.min(e,r.length);return s?null:r.slice(0,l)}let t=Math.min(this.text.length,this.textOff+e),n=this.text.slice(this.textOff,t);return this.textOff=t,n}},cs=[xi,en,Si,qe,tn,Pt,Ji];for(let i=0;i[]),this.index=cs.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,n=this.buckets[t];n.length<6?n.push(e):n[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,n=2){let r=e.bucket,s=this.buckets[r],o=this.index[r];for(let l=s.length-1;l>=0;l--){let a=(l+o)%s.length,h=s[a];if((!t||t(h))&&!this.reused.has(h))return s.splice(a,1),a{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,t){let n=t&&this.getCompositionContext(t.text);for(let r=0,s=0,o=0;;){let l=or){let h=a-r;this.preserve(h,!o,!l),r=a,s+=h}if(!l)break;t&&l.fromA<=t.range.fromA&&l.toA>=t.range.toA?(this.forward(l.fromA,t.range.fromA,t.range.fromA{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(a-l);else{let h=a>0||l{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof qe&&r.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?r.length&&(r.length=s=0):o instanceof qe&&(r.shift(),s=Math.min(s,r.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let n=null,r=this.builder,s=0,o=G.spans(this.decorations,e,t,{point:(l,a,h,c,f,u)=>{if(h instanceof bi){if(this.disallowBlockEffectsFor[u]){if(h.block)throw new RangeError("Block decorations may not be specified via plugins");if(a>this.view.state.doc.lineAt(l).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(s=c.length,f>c.length)r.continueWidget(a-l);else{let O=h.widget||(h.block?It.block:It.inline),d=qS(h),m=this.cache.findWidget(O,a-l,d)||xi.of(O,this.view,a-l,d);h.block?(h.startSide>0&&r.addLineStartIfNotCovered(n),r.addBlockWidget(m)):(r.ensureLine(n),r.addInlineWidget(m,c,f))}n=null}else n=MS(n,h);a>l&&this.text.skip(a-l)},span:(l,a,h,c)=>{for(let f=l;fs,this.openMarks=o}forward(e,t,n=1){t-e<=10?this.old.advance(t-e,n,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,n,this.reuseWalker))}getCompositionContext(e){let t=[],n=null;for(let r=e.parentNode;;r=r.parentNode){let s=ne.get(r);if(r==this.view.contentDOM)break;s instanceof qe?t.push(s):s?.isLine()?n=s:s instanceof Pt||(r.nodeName=="DIV"&&!n&&r!=this.view.contentDOM?n=new en(r,Nu):n||t.push(qe.of(new jn({tagName:r.nodeName.toLowerCase(),attributes:pS(r)}),r)))}return{line:n,marks:t}}};function Gf(i,e){let t=n=>{for(let r of n.children)if((e?r.isText():r.length)||t(r))return!0;return!1};return t(i)}function qS(i){let e=i.isReplace?(i.startSide<0?64:0)|(i.endSide>0?128:0):i.startSide>0?32:16;return i.block&&(e|=256),e}var Nu={class:"cm-line"};function MS(i,e){let t=e.spec.attributes,n=e.spec.class;return!t&&!n||(i||(i={class:"cm-line"}),t&&fa(t,i),n&&(i.class+=" "+n)),i}function _S(i){let e=[];for(let t=i.parents.length;t>1;t--){let n=t==i.parents.length?i.tile:i.parents[t].tile;n instanceof qe&&e.push(n.mark)}return e}function fl(i){let e=ne.get(i);return e&&e.setDOM(i.cloneNode()),i}var It=class extends xe{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}};It.inline=new It("span");It.block=new It("div");var ul=new class extends xe{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}},fs=class{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=M.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new Ji(e,e.contentDOM),this.updateInner([new lt(0,0,0,e.state.doc.length)],null)}update(e){var t;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:c,toA:f})=>fthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let r=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?r=this.domChanged.newSel.head:!BS(e.changes,this.hasComposition)&&!e.selectionSet&&(r=e.state.selection.main.head));let s=r>-1?ES(this.view,e.changes,r):null;if(this.domChanged=null,this.hasComposition){let{from:c,to:f}=this.hasComposition;n=new lt(c,f,e.changes.mapPos(c,-1),e.changes.mapPos(f,1)).addToSet(n.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(q.ie||q.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.blockWrappers;this.updateDeco();let a=jS(o,this.decorations,e.changes);a.length&&(n=lt.extendWithRanges(n,a));let h=VS(l,this.blockWrappers,e.changes);return h.length&&(n=lt.extendWithRanges(n,h)),s&&!n.some(c=>c.fromA<=s.range.fromA&&c.toA>=s.range.toA)&&(n=s.range.addToSet(n.slice())),this.tile.flags&2&&n.length==0?!1:(this.updateInner(n,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:n}=this.view;n.ignore(()=>{if(t||e.length){let o=this.tile,l=new Zl(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&ne.get(t.text)&&l.cache.reused.set(ne.get(t.text),2),this.tile=l.run(e,t),ql(o,l.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let s=q.chrome||q.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(s),s&&(s.written||n.selectionRange.focusNode!=s.node||!this.tile.dom.contains(s.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let r=[];if(this.view.viewport.from||this.view.viewport.to-1)&&An(n,this.view.observer.selectionRange)&&!(r&&n.contains(r));if(!(s||t||o))return;let l=this.forceSelection;this.forceSelection=!1;let a=this.view.state.selection.main,h,c;if(a.empty?c=h=this.inlineDOMNearPos(a.anchor,a.assoc||1):(c=this.inlineDOMNearPos(a.head,a.head==a.from?1:-1),h=this.inlineDOMNearPos(a.anchor,a.anchor==a.from?1:-1)),q.gecko&&a.empty&&!this.hasComposition&&zS(h)){let u=document.createTextNode("");this.view.observer.ignore(()=>h.node.insertBefore(u,h.node.childNodes[h.offset]||null)),h=c=new gt(u,0),l=!0}let f=this.view.observer.selectionRange;(l||!f.focusNode||(!Zn(h.node,h.offset,f.anchorNode,f.anchorOffset)||!Zn(c.node,c.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,a))&&(this.view.observer.ignore(()=>{q.android&&q.chrome&&n.contains(f.focusNode)&&DS(f.focusNode,n)&&(n.blur(),n.focus({preventScroll:!0}));let u=Dn(this.view.root);if(u)if(a.empty){if(q.gecko){let O=WS(h.node,h.offset);if(O&&O!=3){let d=(O==1?$u:Pu)(h.node,h.offset);d&&(h=new gt(d.node,d.offset))}}u.collapse(h.node,h.offset),a.bidiLevel!=null&&u.caretBidiLevel!==void 0&&(u.caretBidiLevel=a.bidiLevel)}else if(u.extend){u.collapse(h.node,h.offset);try{u.extend(c.node,c.offset)}catch{}}else{let O=document.createRange();a.anchor>a.head&&([h,c]=[c,h]),O.setEnd(c.node,c.offset),O.setStart(h.node,h.offset),u.removeAllRanges(),u.addRange(O)}o&&this.view.root.activeElement==n&&(n.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(h,c)),this.impreciseAnchor=h.precise?null:new gt(f.anchorNode,f.anchorOffset),this.impreciseHead=c.precise?null:new gt(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Zn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=Dn(e.root),{anchorNode:r,anchorOffset:s}=e.observer.selectionRange;if(!n||!t.empty||!t.assoc||!n.modify)return;let o=this.lineAt(t.head,t.assoc);if(!o)return;let l=o.posAtStart;if(t.head==l||t.head==l+o.length)return;let a=this.coordsAt(t.head,-1),h=this.coordsAt(t.head,1);if(!a||!h||a.bottom>h.top)return;let c=this.domAtPos(t.head+t.assoc,t.assoc);n.collapse(c.node,c.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let f=e.observer.selectionRange;e.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=t.from&&n.collapse(r,s)}posFromDOM(e,t){let n=this.tile.nearest(e);if(!n)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let r=n.posAtStart;if(n.isComposite()){let s;if(e==n.dom)s=n.dom.childNodes[t];else{let o=Tt(e)==0?0:t==0?-1:1;for(;;){let l=e.parentNode;if(l==n.dom)break;o==0&&l.firstChild!=l.lastChild&&(e==l.firstChild?o=-1:o=1),e=l}o<0?s=e:s=e.nextSibling}if(s==n.dom.firstChild)return r;for(;s&&!ne.get(s);)s=s.nextSibling;if(!s)return r+n.length;for(let o=0,l=r;;o++){let a=n.children[o];if(a.dom==s)return l;l+=a.length+a.breakAfter}}else return n.isText()?e==n.dom?r+t:r+(t?n.length:0):r}domAtPos(e,t){let{tile:n,offset:r}=this.tile.resolveBlock(e,t);return n.isWidget()?n.domPosFor(e,t):n.domIn(r,t)}inlineDOMNearPos(e,t){let n,r=-1,s=!1,o,l=-1,a=!1;return this.tile.blockTiles((h,c)=>{if(h.isWidget()){if(h.flags&32&&c>=e)return!0;h.flags&16&&(s=!0)}else{let f=c+h.length;if(c<=e&&(n=h,r=e-c,s=f=e&&!o&&(o=h,l=e-c,a=c>e),c>e&&o)return!0}}),!n&&!o?this.domAtPos(e,t):(s&&o?n=null:a&&n&&(o=null),n&&t<0||!o?n.domIn(r,t):o.domIn(l,t))}coordsAt(e,t){let{tile:n,offset:r}=this.tile.resolveBlock(e,t);return n.isWidget()?n.widget instanceof _n?null:n.coordsInWidget(r,t,!0):n.coordsIn(r,t)}lineAt(e,t){let{tile:n}=this.tile.resolveBlock(e,t);return n.isLine()?n:null}coordsForChar(e){let{tile:t,offset:n}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function r(s,o){if(s.isComposite())for(let l of s.children){if(l.length>=o){let a=r(l,o);if(a)return a}if(o-=l.length,o<0)break}else if(s.isText()&&oMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,a=this.view.textDirection==J.LTR,h=0,c=(f,u,O)=>{for(let d=0;dr);d++){let m=f.children[d],g=u+m.length,S=m.dom.getBoundingClientRect(),{height:b}=S;if(O&&!d&&(h+=S.top-O.top),m instanceof Pt)g>n&&c(m,u,S);else if(u>=n&&(h>0&&t.push(-h),t.push(b+h),h=0,o)){let y=m.dom.lastChild,Z=y?es(y):[];if(Z.length){let $=Z[Z.length-1],v=a?$.right-S.left:S.right-$.left;v>l&&(l=v,this.minWidth=s,this.minWidthFrom=u,this.minWidthTo=g)}}O&&d==f.children.length-1&&(h+=O.bottom-S.bottom),u=g+m.breakAfter}};return c(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction=="rtl"?J.RTL:J.LTR}measureTextSize(){let e=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let l=0,a;for(let h of o.children){if(!h.isText()||/[^ -~]/.test(h.text))return;let c=es(h.dom);if(c.length!=1)return;l+=c[0].width,a=c[0].height}if(l)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:l/o.length,textHeight:a}}});if(e)return e;let t=document.createElement("div"),n,r,s;return t.className="cm-line",t.style.width="99999px",t.style.position="absolute",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let o=es(t.firstChild)[0];n=t.getBoundingClientRect().height,r=o&&o.width?o.width/27:7,s=o&&o.height?o.height:n,t.remove()}),{lineHeight:n,charWidth:r,textHeight:s}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,r=0;;r++){let s=r==t.viewports.length?null:t.viewports[r],o=s?s.from-1:this.view.state.doc.length;if(o>n){let l=(t.lineBlockAt(o).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(M.replace({widget:new _n(l),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!s)break;n=s.to+1}return M.set(e)}updateDeco(){let e=1,t=this.view.state.facet(ys).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),n=!1,r=this.view.state.facet(ga).map((s,o)=>{let l=typeof s=="function";return l&&(n=!0),l?s(this.view):s});for(r.length&&(this.dynamicDecorationMap[e++]=n,t.push(G.join(r))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];etypeof s=="function"?s(this.view):s)}scrollIntoView(e){var t;if(e.isSnapshot){let c=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=c.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let c of this.view.state.facet(ju))try{if(c(this.view,e.range,e))return!0}catch(f){tt(this.view.state,f,"scroll handler")}let{range:n}=e,r=this.coordsAt(n.head,(t=n.assoc)!==null&&t!==void 0?t:n.empty?0:n.head>n.anchor?-1:1),s;if(!r)return;!n.empty&&(s=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(r={left:Math.min(r.left,s.left),top:Math.min(r.top,s.top),right:Math.max(r.right,s.right),bottom:Math.max(r.bottom,s.bottom)});let o=Gu(this.view),l={left:r.left-o.left,top:r.top-o.top,right:r.right+o.right,bottom:r.bottom+o.bottom},{offsetWidth:a,offsetHeight:h}=this.view.scrollDOM;if(SS(this.view.scrollDOM,l,n.head1&&(r.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||r.bottomn.isWidget()||n.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){ql(this.tile)}};function ql(i,e){let t=e?.get(i);if(t!=1){t==null&&i.destroy();for(let n of i.children)ql(n,e)}}function zS(i){return i.node.nodeType==1&&i.node.firstChild&&(i.offset==0||i.node.childNodes[i.offset-1].contentEditable=="false")&&(i.offset==i.node.childNodes.length||i.node.childNodes[i.offset].contentEditable=="false")}function Uu(i,e){let t=i.observer.selectionRange;if(!t.focusNode)return null;let n=$u(t.focusNode,t.focusOffset),r=Pu(t.focusNode,t.focusOffset),s=n||r;if(r&&n&&r.node!=n.node){let l=ne.get(r.node);if(!l||l.isText()&&l.text!=r.node.nodeValue)s=r;else if(i.docView.lastCompositionAfterCursor){let a=ne.get(n.node);!a||a.isText()&&a.text!=n.node.nodeValue||(s=r)}}if(i.docView.lastCompositionAfterCursor=s!=n,!s)return null;let o=e-s.offset;return{from:o,to:o+s.node.nodeValue.length,node:s.node}}function ES(i,e,t){let n=Uu(i,t);if(!n)return null;let{node:r,from:s,to:o}=n,l=r.nodeValue;if(/[\n\r]/.test(l)||i.state.doc.sliceString(n.from,n.to)!=l)return null;let a=e.invertedDesc;return{range:new lt(a.mapPos(s),a.mapPos(o),s,o),text:r}}function WS(i,e){return i.nodeType!=1?0:(e&&i.childNodes[e-1].contentEditable=="false"?1:0)|(e{ne.from&&(t=!0)}),t}var _n=class extends xe{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}};function YS(i,e,t=1){let n=i.charCategorizer(e),r=i.doc.lineAt(e),s=e-r.from;if(r.length==0)return Q.cursor(e);s==0?t=1:s==r.length&&(t=-1);let o=s,l=s;t<0?o=oe(r.text,s,!1):l=oe(r.text,s);let a=n(r.text.slice(o,l));for(;o>0;){let h=oe(r.text,o,!1);if(n(r.text.slice(h,o))!=a)break;o=h}for(;li.defaultLineHeight*1.5){let l=i.viewState.heightOracle.textHeight,a=Math.floor((r-t.top-(i.defaultLineHeight-l)*.5)/l);s+=a*i.viewState.heightOracle.lineLength}let o=i.state.sliceDoc(t.from,t.to);return t.from+Zf(o,s,i.state.tabSize)}function _l(i,e,t){let n=i.lineBlockAt(e);if(Array.isArray(n.type)){let r;for(let s of n.type){if(s.from>e)break;if(!(s.toe)return s;(!r||s.type==Se.Text&&(r.type!=s.type||(t<0?s.frome)))&&(r=s)}}return r||n}return n}function GS(i,e,t,n){let r=_l(i,e.head,e.assoc||-1),s=!n||r.type!=Se.Text||!(i.lineWrapping||r.widgetLineBreaks)?null:i.coordsAtPos(e.assoc<0&&e.head>r.from?e.head-1:e.head);if(s){let o=i.dom.getBoundingClientRect(),l=i.textDirectionAt(r.from),a=i.posAtCoords({x:t==(l==J.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(a!=null)return Q.cursor(a,t?-1:1)}return Q.cursor(t?r.to:r.from,t?-1:1)}function Nf(i,e,t,n){let r=i.state.doc.lineAt(e.head),s=i.bidiSpans(r),o=i.textDirectionAt(r.from);for(let l=e,a=null;;){let h=TS(r,s,o,l,t),c=Au;if(!h){if(r.number==(t?i.state.doc.lines:1))return l;c=` +`,r=i.state.doc.line(r.number+(t?1:-1)),s=i.bidiSpans(r),h=i.visualLineSide(r,!t)}if(a){if(!a(c))return l}else{if(!n)return h;a=n(c)}l=h}}function NS(i,e,t){let n=i.state.charCategorizer(e),r=n(t);return s=>{let o=n(s);return r==H.Space&&(r=o),r==o}}function US(i,e,t,n){let r=e.head,s=t?1:-1;if(r==(t?i.state.doc.length:0))return Q.cursor(r,e.assoc);let o=e.goalColumn,l,a=i.contentDOM.getBoundingClientRect(),h=i.coordsAtPos(r,e.assoc||((e.empty?t:e.head==e.from)?1:-1)),c=i.documentTop;if(h)o==null&&(o=h.left-a.left),l=s<0?h.top:h.bottom;else{let d=i.viewState.lineBlockAt(r);o==null&&(o=Math.min(a.right-a.left,i.defaultCharacterWidth*(r-d.from))),l=(s<0?d.top:d.bottom)+c}let f=a.left+o,u=i.viewState.heightOracle.textHeight>>1,O=n??u;for(let d=0;;d+=u){let m=l+(O+d)*s,g=zl(i,{x:f,y:m},!1,s);if(t?m>a.bottom:ml:b{if(e>s&&er(i)),t.from,e.head>t.from?-1:1);return n==t.from?t:Q.cursor(n,ni.viewState.docHeight)return new Je(i.state.doc.length,-1);if(h=i.elementAtHeight(a),n==null)break;if(h.type==Se.Text){if(n<0?h.toi.viewport.to)break;let u=i.docView.coordsAt(n<0?h.from:h.to,n>0?-1:1);if(u&&(n<0?u.top<=a+s:u.bottom>=a+s))break}let f=i.viewState.heightOracle.textHeight/2;a=n>0?h.bottom+f:h.top-f}if(i.viewport.from>=h.to||i.viewport.to<=h.from){if(t)return null;if(h.type==Se.Text){let f=IS(i,r,h,o,l);return new Je(f,f==h.from?1:-1)}}if(h.type!=Se.Text)return a<(h.top+h.bottom)/2?new Je(h.from,1):new Je(h.to,-1);let c=i.docView.lineAt(h.from,2);return(!c||c.length!=h.length)&&(c=i.docView.lineAt(h.from,-2)),new El(i,o,l,i.textDirectionAt(h.from)).scanTile(c,h.from)}var El=class{constructor(e,t,n,r){this.view=e,this.x=t,this.y=n,this.baseDir=r,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to1||n.length&&(n[0].level!=this.baseDir||n[0].to+r.from>1;t:if(s.has(d)){let g=n+Math.floor(Math.random()*O);for(let S=0;S1)){if(S.bottomthis.y)(!a||a.top>S.top)&&(a=S),b=-1;else{let y=S.left>this.x?this.x-S.left:S.rightf.top)return this.y=l.bottom-1,this.scan(e,t);if(a&&a.top(f.left+f.right)/2==u}}scanText(e,t){let n=[];for(let s=0;s{let o=n[s]-t,l=n[s+1]-t;return Bn(e.dom,o,l).getClientRects()});return r.after?new Je(n[r.i+1],-1):new Je(n[r.i],1)}scanTile(e,t){if(!e.length)return new Je(t,1);if(e.children.length==1){let l=e.children[0];if(l.isText())return this.scanText(l,t);if(l.isComposite())return this.scanTile(l,t)}let n=[t];for(let l=0,a=t;l{let a=e.children[l];return a.flags&48?null:(a.dom.nodeType==1?a.dom:Bn(a.dom,0,a.length)).getClientRects()}),s=e.children[r.i],o=n[r.i];return s.isText()?this.scanText(s,o):s.isComposite()?this.scanTile(s,o):r.after?new Je(n[r.i+1],-1):new Je(o,1)}},Yi="\uFFFF",Wl=class{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(F.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Yi}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let r=e;;){this.findPointBefore(n,r);let s=this.text.length;this.readNode(r);let o=ne.get(r),l=r.nextSibling;if(l==t){o?.breakAfter&&!l&&n!=this.view.contentDOM&&this.lineBreak();break}let a=ne.get(l);(o&&a?o.breakAfter:(o?o.breakAfter:ls(r))||ls(l)&&(r.nodeName!="BR"||o?.isWidget())&&this.text.length>s)&&!HS(l,t)&&this.lineBreak(),r=l}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,l;if(this.lineSeparator?(s=t.indexOf(this.lineSeparator,n),o=this.lineSeparator.length):(l=r.exec(t))&&(s=l.index,o=l[0].length),this.append(t.slice(n,s<0?t.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=o-1);n=s+o}}readNode(e){let t=ne.get(e),n=t&&t.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let r=n.iter();!r.next().done;)r.lineBreak?this.lineBreak():this.append(r.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(e.nodeType==3?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(FS(e,n.node,n.offset)?t:0))}};function FS(i,e,t){for(;;){if(!e||t-1;let{impreciseHead:s,impreciseAnchor:o}=e.docView,l=e.state.selection;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=Hu(e.docView.tile,t,n,0))){let a=s||o?[]:JS(e),h=new Wl(a,e);h.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=h.text,this.newSel=eQ(a,this.bounds.from)}else{let a=e.observer.selectionRange,h=s&&s.node==a.focusNode&&s.offset==a.focusOffset||!xl(e.contentDOM,a.focusNode)?l.main.head:e.docView.posFromDOM(a.focusNode,a.focusOffset),c=o&&o.node==a.anchorNode&&o.offset==a.anchorOffset||!xl(e.contentDOM,a.anchorNode)?l.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset),f=e.viewport;if((q.ios||q.chrome)&&l.main.empty&&h!=c&&(f.from>0||f.to-1&&l.ranges.length>1)this.newSel=l.replaceRange(Q.range(c,h));else if(e.lineWrapping&&c==h&&!(l.main.empty&&l.main.head==h)&&e.inputState.lastTouchTime>Date.now()-100){let u=e.coordsAtPos(h,-1),O=0;u&&(O=e.inputState.lastTouchY<=u.bottom?-1:1),this.newSel=Q.create([Q.cursor(h,O)])}else this.newSel=Q.single(c,h)}}};function Hu(i,e,t,n){if(i.isComposite()){let r=-1,s=-1,o=-1,l=-1;for(let a=0,h=n,c=n;at)return Hu(f,e,t,h);if(u>=e&&r==-1&&(r=a,s=h),h>t&&f.dom.parentNode==i.dom){o=a,l=c;break}c=u,h=u+f.breakAfter}return{from:s,to:l<0?n+i.length:l,startDOM:(r?i.children[r-1].dom.nextSibling:null)||i.dom.firstChild,endDOM:o=0?i.children[o].dom:null}}else return i.isText()?{from:n,to:n+i.length,startDOM:i.dom,endDOM:i.dom.nextSibling}:null}function Ku(i,e){let t,{newSel:n}=e,{state:r}=i,s=r.selection.main,o=i.inputState.lastKeyTime>Date.now()-100?i.inputState.lastKeyCode:-1;if(e.bounds){let{from:l,to:a}=e.bounds,h=s.from,c=null;(o===8||q.android&&e.text.length=l&&s.to<=a&&(e.typeOver||f!=e.text)&&f.slice(0,s.from-l)==e.text.slice(0,s.from-l)&&f.slice(s.to-l)==e.text.slice(u=e.text.length-(f.length-(s.to-l)))?t={from:s.from,to:s.to,insert:D.of(e.text.slice(s.from-l,u).split(Yi))}:(O=Ju(f,e.text,h-l,c))&&(q.chrome&&o==13&&O.toB==O.from+2&&e.text.slice(O.from,O.toB)==Yi+Yi&&O.toB--,t={from:l+O.from,to:l+O.toA,insert:D.of(e.text.slice(O.from,O.toB).split(Yi))})}else n&&(!i.hasFocus&&r.facet($t)||Os(n,s))&&(n=null);if(!t&&!n)return!1;if((q.mac||q.android)&&t&&t.from==t.to&&t.from==s.head-1&&/^\. ?$/.test(t.insert.toString())&&i.contentDOM.getAttribute("autocorrect")=="off"?(n&&t.insert.length==2&&(n=Q.single(n.main.anchor-1,n.main.head-1)),t={from:t.from,to:t.to,insert:D.of([t.insert.toString().replace("."," ")])}):r.doc.lineAt(s.from).toDate.now()-50?t={from:s.from,to:s.to,insert:r.toText(i.inputState.insertingText)}:q.chrome&&t&&t.from==t.to&&t.from==s.head&&t.insert.toString()==` + `&&i.lineWrapping&&(n&&(n=Q.single(n.main.anchor-1,n.main.head-1)),t={from:s.from,to:s.to,insert:D.of([" "])}),t)return Sa(i,t,n,o);if(n&&!Os(n,s)){let l=!1,a="select";return i.inputState.lastSelectionTime>Date.now()-50&&(i.inputState.lastSelectionOrigin=="select"&&(l=!0),a=i.inputState.lastSelectionOrigin,a=="select.pointer"&&(n=Fu(r.facet(In).map(h=>h(i)),n))),i.dispatch({selection:n,scrollIntoView:l,userEvent:a}),!0}else return!1}function Sa(i,e,t,n=-1){if(q.ios&&i.inputState.flushIOSKey(e))return!0;let r=i.state.selection.main;if(q.android&&(e.to==r.to&&(e.from==r.from||e.from==r.from-1&&i.state.sliceDoc(e.from,r.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Hi(i.contentDOM,"Enter",13)||(e.from==r.from-1&&e.to==r.to&&e.insert.length==0||n==8&&e.insert.lengthr.head)&&Hi(i.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&e.insert.length==0&&Hi(i.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();i.inputState.composing>=0&&i.inputState.composing++;let o,l=()=>o||(o=KS(i,e,t));return i.state.facet(zu).some(a=>a(i,e.from,e.to,s,l))||i.dispatch(l()),!0}function KS(i,e,t){let n,r=i.state,s=r.selection.main,o=-1;if(e.from==e.to&&e.froms.to){let a=e.fromf(i)),h,a);e.from==c&&(o=c)}if(o>-1)n={changes:e,selection:Q.cursor(e.from+e.insert.length,-1)};else if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&i.inputState.composing<0){let a=s.frome.to?r.sliceDoc(e.to,s.to):"";n=r.replaceSelection(i.state.toText(a+e.insert.sliceString(0,void 0,i.state.lineBreak)+h))}else{let a=r.changes(e),h=t&&t.main.to<=a.newLength?t.main:void 0;if(r.selection.ranges.length>1&&(i.inputState.composing>=0||i.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let c=i.state.sliceDoc(e.from,e.to),f,u=t&&Uu(i,t.main.head);if(u){let d=e.insert.length-(e.to-e.from);f={from:u.from,to:u.to-d}}else f=i.state.doc.lineAt(s.head);let O=s.to-e.to;n=r.changeByRange(d=>{if(d.from==s.from&&d.to==s.to)return{changes:a,range:h||d.map(a)};let m=d.to-O,g=m-c.length;if(i.state.sliceDoc(g,m)!=c||m>=f.from&&g<=f.to)return{range:d};let S=r.changes({from:g,to:m,insert:e.insert}),b=d.to-s.to;return{changes:S,range:h?Q.range(Math.max(0,h.anchor+b),Math.max(0,h.head+b)):d.map(S)}})}else n={changes:a,selection:h&&r.selection.replaceRange(h)}}let l="input.type";return(i.composing||i.inputState.compositionPendingChange&&i.inputState.compositionEndedAt>Date.now()-50)&&(i.inputState.compositionPendingChange=!1,l+=".compose",i.inputState.compositionFirstChange&&(l+=".start",i.inputState.compositionFirstChange=!1)),r.update(n,{userEvent:l,scrollIntoView:!0})}function Ju(i,e,t,n){let r=Math.min(i.length,e.length),s=0;for(;s0&&l>0&&i.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(n=="end"){let a=Math.max(0,s-Math.min(o,l));t-=o+a-s}if(o=o?s-t:0;s-=a,l=s+(l-o),o=s}else if(l=l?s-t:0;s-=a,o=s+(o-l),l=s}return{from:s,toA:o,toB:l}}function JS(i){let e=[];if(i.root.activeElement!=i.contentDOM)return e;let{anchorNode:t,anchorOffset:n,focusNode:r,focusOffset:s}=i.observer.selectionRange;return t&&(e.push(new us(t,n)),(r!=t||s!=n)&&e.push(new us(r,s))),e}function eQ(i,e){if(i.length==0)return null;let t=i[0].pos,n=i.length==2?i[1].pos:t;return t>-1&&n>-1?Q.single(t+e,n+e):null}function Os(i,e){return e.head==i.main.head&&e.anchor==i.main.anchor}var jl=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,q.safari&&e.contentDOM.addEventListener("input",()=>null),q.gecko&&dQ(e.contentDOM.ownerDocument)}handleEvent(e){!lQ(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let r of n.observers)r(this.view,t);for(let r of n.handlers){if(t.defaultPrevented)break;if(r(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=tQ(e),n=this.handlers,r=this.view.contentDOM;for(let s in t)if(s!="scroll"){let o=!t[s].handlers.length,l=n[s];l&&o!=!l.handlers.length&&(r.removeEventListener(s,this.handleEvent),l=null),l||r.addEventListener(s,this.handleEvent,{passive:o})}for(let s in n)s!="scroll"&&!t[s]&&r.removeEventListener(s,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&tO.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),q.android&&q.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return q.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&!e.shiftKey&&((t=eO.find(n=>n.keyCode==e.keyCode))&&!e.ctrlKey||iQ.indexOf(e.key)>-1&&e.ctrlKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from0?!0:q.safari&&!q.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}};function Uf(i,e){return(t,n)=>{try{return e.call(i,n,t)}catch(r){tt(t.state,r)}}}function tQ(i){let e=Object.create(null);function t(n){return e[n]||(e[n]={observers:[],handlers:[]})}for(let n of i){let r=n.spec,s=r&&r.plugin.domEventHandlers,o=r&&r.plugin.domEventObservers;if(s)for(let l in s){let a=s[l];a&&t(l).handlers.push(Uf(n.value,a))}if(o)for(let l in o){let a=o[l];a&&t(l).observers.push(Uf(n.value,a))}}for(let n in at)t(n).handlers.push(at[n]);for(let n in Me)t(n).observers.push(Me[n]);return e}var eO=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],iQ="dthko",tO=[16,17,18,20,91,92,224,225],Nr=6;function Ur(i){return Math.max(0,i)*.7+8}function nQ(i,e){return Math.max(Math.abs(i.clientX-e.clientX),Math.abs(i.clientY-e.clientY))}var Vl=class{constructor(e,t,n,r){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=ku(e.contentDOM),this.atoms=e.state.facet(In).map(o=>o(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(F.allowMultipleSelections)&&rQ(e,t),this.dragging=oQ(e,t)&&rO(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&nQ(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,n=0,r=0,s=0,o=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:l}=this.scrollParents.y.getBoundingClientRect());let a=Gu(this.view);e.clientX-a.left<=r+Nr?t=-Ur(r-e.clientX):e.clientX+a.right>=o-Nr&&(t=Ur(e.clientX-o)),e.clientY-a.top<=s+Nr?n=-Ur(s-e.clientY):e.clientY+a.bottom>=l-Nr&&(n=Ur(e.clientY-l)),this.setScrollSpeed(t,n)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,n=Fu(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!n.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}};function rQ(i,e){let t=i.state.facet(Zu);return t.length?t[0](e):q.mac?e.metaKey:e.ctrlKey}function sQ(i,e){let t=i.state.facet(qu);return t.length?t[0](e):q.mac?!e.altKey:!e.ctrlKey}function oQ(i,e){let{main:t}=i.state.selection;if(t.empty)return!1;let n=Dn(i.root);if(!n||n.rangeCount==0)return!0;let r=n.getRangeAt(0).getClientRects();for(let s=0;s=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function lQ(i,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,n;t!=i.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(n=ne.get(t))&&n.isWidget()&&!n.isHidden&&n.widget.ignoreEvent(e))return!1;return!0}var at=Object.create(null),Me=Object.create(null),iO=q.ie&&q.ie_version<15||q.ios&&q.webkit_version<604;function aQ(i){let e=i.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{i.focus(),t.remove(),nO(i,t.value)},50)}function xs(i,e,t){for(let n of i.facet(e))t=n(t,i);return t}function nO(i,e){e=xs(i.state,da,e);let{state:t}=i,n,r=1,s=t.toText(e),o=s.lines==t.selection.ranges.length;if(Dl!=null&&t.selection.ranges.every(a=>a.empty)&&Dl==s.toString()){let a=-1;n=t.changeByRange(h=>{let c=t.doc.lineAt(h.from);if(c.from==a)return{range:h};a=c.from;let f=t.toText((o?s.line(r++).text:e)+t.lineBreak);return{changes:{from:c.from,insert:f},range:Q.cursor(h.from+f.length)}})}else o?n=t.changeByRange(a=>{let h=s.line(r++);return{changes:{from:a.from,to:a.to,insert:h.text},range:Q.cursor(a.from+h.length)}}):n=t.replaceSelection(s);i.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}Me.scroll=i=>{i.inputState.lastScrollTop=i.scrollDOM.scrollTop,i.inputState.lastScrollLeft=i.scrollDOM.scrollLeft};Me.wheel=Me.mousewheel=i=>{i.inputState.lastWheelEvent=Date.now()};at.keydown=(i,e)=>(i.inputState.setSelectionOrigin("select"),e.keyCode==27&&i.inputState.tabFocusMode!=0&&(i.inputState.tabFocusMode=Date.now()+2e3),!1);Me.touchstart=(i,e)=>{let t=i.inputState,n=e.targetTouches[0];t.lastTouchTime=Date.now(),n&&(t.lastTouchX=n.clientX,t.lastTouchY=n.clientY),t.setSelectionOrigin("select.pointer")};Me.touchmove=i=>{i.inputState.setSelectionOrigin("select.pointer")};at.mousedown=(i,e)=>{if(i.observer.flush(),i.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let n of i.state.facet(Mu))if(t=n(i,e),t)break;if(!t&&e.button==0&&(t=cQ(i,e)),t){let n=!i.hasFocus;i.inputState.startMouseSelection(new Vl(i,e,t,n)),n&&i.observer.ignore(()=>{wu(i.contentDOM);let s=i.root.activeElement;s&&!s.contains(i.contentDOM)&&s.blur()});let r=i.inputState.mouseSelection;if(r)return r.start(e),r.dragging===!1}else i.inputState.setSelectionOrigin("select.pointer");return!1};function Ff(i,e,t,n){if(n==1)return Q.cursor(e,t);if(n==2)return YS(i.state,e,t);{let r=i.docView.lineAt(e,t),s=i.state.doc.lineAt(r?r.posAtEnd:e),o=r?r.posAtStart:s.from,l=r?r.posAtEnd:s.to;return lDate.now()-400&&Math.abs(e.clientX-i.clientX)<2&&Math.abs(e.clientY-i.clientY)<2?(Kf+1)%3:1}function cQ(i,e){let t=i.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),n=rO(e),r=i.state.selection;return{update(s){s.docChanged&&(t.pos=s.changes.mapPos(t.pos),r=r.map(s.changes))},get(s,o,l){let a=i.posAndSideAtCoords({x:s.clientX,y:s.clientY},!1),h,c=Ff(i,a.pos,a.assoc,n);if(t.pos!=a.pos&&!o){let f=Ff(i,t.pos,t.assoc,n),u=Math.min(f.from,c.from),O=Math.max(f.to,c.to);c=u1&&(h=fQ(r,a.pos))?h:l?r.addRange(c):Q.create([c])}}}function fQ(i,e){for(let t=0;t=e)return Q.create(i.ranges.slice(0,t).concat(i.ranges.slice(t+1)),i.mainIndex==t?0:i.mainIndex-(i.mainIndex>t?1:0))}return null}at.dragstart=(i,e)=>{let{selection:{main:t}}=i.state;if(e.target.draggable){let r=i.docView.tile.nearest(e.target);if(r&&r.isWidget()){let s=r.posAtStart,o=s+r.length;(s>=t.to||o<=t.from)&&(t=Q.range(s,o))}}let{inputState:n}=i;return n.mouseSelection&&(n.mouseSelection.dragging=!0),n.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",xs(i.state,pa,i.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1};at.dragend=i=>(i.inputState.draggedContent=null,!1);function eu(i,e,t,n){if(t=xs(i.state,da,t),!t)return;let r=i.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=i.inputState,o=n&&s&&sQ(i,e)?{from:s.from,to:s.to}:null,l={from:r,insert:t},a=i.state.changes(o?[o,l]:l);i.focus(),i.dispatch({changes:a,selection:{anchor:a.mapPos(r,-1),head:a.mapPos(r,1)},userEvent:o?"move.drop":"input.drop"}),i.inputState.draggedContent=null}at.drop=(i,e)=>{if(!e.dataTransfer)return!1;if(i.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let n=Array(t.length),r=0,s=()=>{++r==t.length&&eu(i,e,n.filter(o=>o!=null).join(i.state.lineBreak),!1)};for(let o=0;o{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(n[o]=l.result),s()},l.readAsText(t[o])}return!0}else{let n=e.dataTransfer.getData("Text");if(n)return eu(i,e,n,!0),!0}return!1};at.paste=(i,e)=>{if(i.state.readOnly)return!0;i.observer.flush();let t=iO?null:e.clipboardData;return t?(nO(i,t.getData("text/plain")||t.getData("text/uri-list")),!0):(aQ(i),!1)};function uQ(i,e){let t=i.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=e,n.focus(),n.selectionEnd=e.length,n.selectionStart=0,setTimeout(()=>{n.remove(),i.focus()},50)}function OQ(i){let e=[],t=[],n=!1;for(let r of i.selection.ranges)r.empty||(e.push(i.sliceDoc(r.from,r.to)),t.push(r));if(!e.length){let r=-1;for(let{from:s}of i.selection.ranges){let o=i.doc.lineAt(s);o.number>r&&(e.push(o.text),t.push({from:o.from,to:Math.min(i.doc.length,o.to+1)})),r=o.number}n=!0}return{text:xs(i,pa,e.join(i.lineBreak)),ranges:t,linewise:n}}var Dl=null;at.copy=at.cut=(i,e)=>{if(!An(i.contentDOM,i.observer.selectionRange))return!1;let{text:t,ranges:n,linewise:r}=OQ(i.state);if(!t&&!r)return!1;Dl=r?t:null,e.type=="cut"&&!i.state.readOnly&&i.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let s=iO?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",t),!0):(uQ(i,t),!1)};var sO=Re.define();function oO(i,e){let t=[];for(let n of i.facet(Eu)){let r=n(i,e);r&&t.push(r)}return t.length?i.update({effects:t,annotations:sO.of(!0)}):null}function lO(i){setTimeout(()=>{let e=i.hasFocus;if(e!=i.inputState.notifiedFocused){let t=oO(i.state,e);t?i.dispatch(t):i.update([])}},10)}Me.focus=i=>{i.inputState.lastFocusTime=Date.now(),!i.scrollDOM.scrollTop&&(i.inputState.lastScrollTop||i.inputState.lastScrollLeft)&&(i.scrollDOM.scrollTop=i.inputState.lastScrollTop,i.scrollDOM.scrollLeft=i.inputState.lastScrollLeft),lO(i)};Me.blur=i=>{i.observer.clearSelectionRange(),lO(i)};Me.compositionstart=Me.compositionupdate=i=>{i.observer.editContext||(i.inputState.compositionFirstChange==null&&(i.inputState.compositionFirstChange=!0),i.inputState.composing<0&&(i.inputState.composing=0))};Me.compositionend=i=>{i.observer.editContext||(i.inputState.composing=-1,i.inputState.compositionEndedAt=Date.now(),i.inputState.compositionPendingKey=!0,i.inputState.compositionPendingChange=i.observer.pendingRecords().length>0,i.inputState.compositionFirstChange=null,q.chrome&&q.android?i.observer.flushSoon():i.inputState.compositionPendingChange?Promise.resolve().then(()=>i.observer.flush()):setTimeout(()=>{i.inputState.composing<0&&i.docView.hasComposition&&i.update([])},50))};Me.contextmenu=i=>{i.inputState.lastContextMenu=Date.now()};at.beforeinput=(i,e)=>{var t,n;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(i.inputState.insertingText=e.data,i.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&i.observer.editContext){let s=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),o=e.getTargetRanges();if(s&&o.length){let l=o[0],a=i.posAtDOM(l.startContainer,l.startOffset),h=i.posAtDOM(l.endContainer,l.endOffset);return Sa(i,{from:a,to:h,insert:i.state.toText(s)},null),!0}}let r;if(q.chrome&&q.android&&(r=eO.find(s=>s.inputType==e.inputType))&&(i.observer.delayAndroidKey(r.key,r.keyCode),r.key=="Backspace"||r.key=="Delete")){let s=((n=window.visualViewport)===null||n===void 0?void 0:n.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>s+10&&i.hasFocus&&(i.contentDOM.blur(),i.focus())},100)}return q.ios&&e.inputType=="deleteContentForward"&&i.observer.flushSoon(),q.safari&&e.inputType=="insertText"&&i.inputState.composing>=0&&setTimeout(()=>Me.compositionend(i,e),20),!1};var tu=new Set;function dQ(i){tu.has(i)||(tu.add(i),i.addEventListener("copy",()=>{}),i.addEventListener("cut",()=>{}))}var iu=["pre-wrap","normal","pre-line","break-spaces"],nn=!1;function nu(){nn=!1}var Bl=class{constructor(e){this.lineWrapping=e,this.doc=D.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return iu.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n-1,a=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=l||Math.abs(n-this.charWidth)>.1;if(this.lineWrapping=l,this.lineHeight=t,this.charWidth=n,this.textHeight=r,this.lineLength=s,a){this.heightSamples={};for(let h=0;h0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>ts&&(nn=!0),this.height=e)}replace(e,t,n){return i.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,r){let s=this,o=n.doc;for(let l=r.length-1;l>=0;l--){let{fromA:a,toA:h,fromB:c,toB:f}=r[l],u=s.lineAt(a,ee.ByPosNoHeight,n.setDoc(t),0,0),O=u.to>=h?u:s.lineAt(h,ee.ByPosNoHeight,n,0,0);for(f+=O.to-h,h=O.to;l>0&&u.from<=r[l-1].toA;)a=r[l-1].fromA,c=r[l-1].fromB,l--,as*2){let l=e[t-1];l.break?e.splice(--t,1,l.left,null,l.right):e.splice(--t,1,l.left,l.right),n+=1+l.break,r-=l.size}else if(s>r*2){let l=e[n];l.break?e.splice(n,1,l.left,null,l.right):e.splice(n,1,l.left,l.right),n+=2+l.break,s-=l.size}else break;else if(r=s&&o(this.lineAt(0,ee.ByPos,n,r,s))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more&&this.setMeasuredHeight(r),this.outdated=!1,this}toString(){return`block(${this.length})`}},Ke=class i extends ps{constructor(e,t,n){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=n}mainBlock(e,t){return new ot(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,n){let r=n[0];return n.length==1&&(r instanceof i||r instanceof Bt&&r.flags&4)&&Math.abs(this.length-r.length)<10?(r instanceof Bt?r=new i(r.length,this.height,this.spaceAbove):r.height=this.height,this.outdated||(r.outdated=!1),r):De.of(n)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more?this.setMeasuredHeight(r):(n||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}},Bt=class i extends De{constructor(e){super(e,0)}heightMetrics(e,t){let n=e.doc.lineAt(t).number,r=e.doc.lineAt(t+this.length).number,s=r-n+1,o,l=0;if(e.lineWrapping){let a=Math.min(this.height,e.lineHeight*s);o=a/s,this.length>s+1&&(l=(this.height-a)/(this.length-s-1))}else o=this.height/s;return{firstLine:n,lastLine:r,perLine:o,perChar:l}}blockAt(e,t,n,r){let{firstLine:s,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(t,r);if(t.lineWrapping){let h=r+(e0){let s=n[n.length-1];s instanceof i?n[n.length-1]=new i(s.length+r):n.push(null,new i(r-1))}if(e>0){let s=n[0];s instanceof i?n[0]=new i(e+s.length):n.unshift(new i(e-1),null)}return De.of(n)}decomposeLeft(e,t){t.push(new i(e-1),null)}decomposeRight(e,t){t.push(null,new i(this.length-e-1))}updateHeight(e,t=0,n=!1,r){let s=t+this.length;if(r&&r.from<=t+this.length&&r.more){let o=[],l=Math.max(t,r.from),a=-1;for(r.from>t&&o.push(new i(r.from-t-1).updateHeight(e,t));l<=s&&r.more;){let c=e.doc.lineAt(l).length;o.length&&o.push(null);let f=r.heights[r.index++],u=0;f<0&&(u=-f,f=r.heights[r.index++]),a==-1?a=f:Math.abs(f-a)>=ts&&(a=-2);let O=new Ke(c,f,u);O.outdated=!1,o.push(O),l+=c+1}l<=s&&o.push(null,new i(s-l).updateHeight(e,l));let h=De.of(o);return(a<0||Math.abs(h.height-this.height)>=ts||Math.abs(a-this.heightMetrics(e,t).perLine)>=ts)&&(nn=!0),ds(this,h)}else(n||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}},Il=class extends De{constructor(e,t,n){super(e.length+t+n.length,e.height+n.height,t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return this.flags&1}blockAt(e,t,n,r){let s=n+this.left.height;return el))return h;let c=t==ee.ByPosNoHeight?ee.ByPosNoHeight:ee.ByPos;return a?h.join(this.right.lineAt(l,c,n,o,l)):this.left.lineAt(l,c,n,r,s).join(h)}forEachLine(e,t,n,r,s,o){let l=r+this.left.height,a=s+this.left.length+this.break;if(this.break)e=a&&this.right.forEachLine(e,t,n,l,a,o);else{let h=this.lineAt(a,ee.ByPos,n,r,s);e=e&&h.from<=t&&o(h),t>h.to&&this.right.forEachLine(h.to+1,t,n,l,a,o)}}replace(e,t,n){let r=this.left.length+this.break;if(tthis.left.length)return this.balanced(this.left,this.right.replace(e-r,t-r,n));let s=[];e>0&&this.decomposeLeft(e,s);let o=s.length;for(let l of n)s.push(l);if(e>0&&ru(s,o-1),t=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,r=n+this.break;if(e>=r)return this.right.decomposeRight(e-r,t);e2*t.size||t.size>2*e.size?De.of(this.break?[e,null,t]:[e,t]):(this.left=ds(this.left,e),this.right=ds(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,r){let{left:s,right:o}=this,l=t+s.length+this.break,a=null;return r&&r.from<=t+s.length&&r.more?a=s=s.updateHeight(e,t,n,r):s.updateHeight(e,t,n),r&&r.from<=l+o.length&&r.more?a=o=o.updateHeight(e,l,n,r):o.updateHeight(e,l,n),a?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}};function ru(i,e){let t,n;i[e]==null&&(t=i[e-1])instanceof Bt&&(n=i[e+1])instanceof Bt&&i.splice(e-1,3,new Bt(t.length+1+n.length))}var mQ=5,Gl=class i{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let n=Math.min(t,this.lineEnd),r=this.nodes[this.nodes.length-1];r instanceof Ke?r.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new Ke(n-this.pos,-1,0)),this.writtenTo=n,t>n&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e=mQ)&&this.addLineDeco(r,s,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenToe&&this.nodes.push(new Ke(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let n=new Bt(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Ke)return e;let t=new Ke(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let r=this.ensureLine();r.length+=n,r.collapsed+=n,r.widgetHeight=Math.max(r.widgetHeight,e),r.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Ke)&&!this.isCovered?this.nodes.push(new Ke(0,-1,0)):(this.writtenToc.clientHeight||c.scrollWidth>c.clientWidth)&&f.overflow!="visible"){let u=c.getBoundingClientRect();s=Math.max(s,u.left),o=Math.min(o,u.right),l=Math.max(l,u.top),a=Math.min(h==i.parentNode?r.innerHeight:a,u.bottom)}h=f.position=="absolute"||f.position=="fixed"?c.offsetParent:c.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:s-t.left,right:Math.max(s,o)-t.left,top:l-(t.top+e),bottom:Math.max(l,a)-(t.top+e)}}function QQ(i){let e=i.getBoundingClientRect(),t=i.ownerDocument.defaultView||window;return e.left0&&e.top0}function bQ(i,e){let t=i.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}var En=class{constructor(e,t,n,r){this.from=e,this.to=t,this.size=n,this.displaySize=r}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;ntypeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new Bl(n),this.stateDeco=ou(t),this.heightMap=De.empty().applyChanges(this.stateDeco,D.empty,this.heightOracle.setDoc(t.doc),[new lt(0,0,0,t.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=M.set(this.lineGaps.map(r=>r.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let r=n?t.head:t.anchor;if(!e.some(({from:s,to:o})=>r>=s&&r<=o)){let{from:s,to:o}=this.lineBlockAt(r);e.push(new Gi(s,o))}}return this.viewports=e.sort((n,r)=>n.from-r.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?su:new Fl(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Rn(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=ou(this.state);let r=e.changedRanges,s=lt.extendWithRanges(r,gQ(n,this.stateDeco,e?e.changes:me.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);nu(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=o||nn)&&(e.flags|=2),l?(this.scrollAnchorPos=e.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let a=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.heada.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,t));let h=a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,e.flags|=this.updateForViewport(),(h||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(Lu)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,n=window.getComputedStyle(t),r=this.heightOracle,s=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?J.RTL:J.LTR;let o=this.heightOracle.mustRefreshForWrapping(s)||this.mustMeasureContent==="refresh",l=t.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let h=0,c=0;if(l.width&&l.height){let{scaleX:$,scaleY:v}=xu(t,l);($>.005&&Math.abs(this.scaleX-$)>.005||v>.005&&Math.abs(this.scaleY-v)>.005)&&(this.scaleX=$,this.scaleY=v,h|=16,o=a=!0)}let f=(parseInt(n.paddingTop)||0)*this.scaleY,u=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=u)&&(this.paddingTop=f,this.paddingBottom=u,h|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=16);let O=ku(this.view.contentDOM,!1).y;O!=this.scrollParent&&(this.scrollParent=O,this.scrollAnchorHeight=-1,this.scrollOffset=0);let d=this.getScrollOffset();this.scrollOffset!=d&&(this.scrollAnchorHeight=-1,this.scrollOffset=d),this.scrolledToBottom=vu(this.scrollParent||e.win);let m=(this.printing?bQ:SQ)(t,this.paddingTop),g=m.top-this.pixelViewport.top,S=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let b=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(b!=this.inView&&(this.inView=b,b&&(a=!0)),!this.inView&&!this.scrollTarget&&!QQ(e.dom))return 0;let y=l.width;if((this.contentDOMWidth!=y||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),a){let $=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights($)&&(o=!0),o||r.lineWrapping&&Math.abs(y-this.contentDOMWidth)>r.charWidth){let{lineHeight:v,charWidth:T,textHeight:Y}=e.docView.measureTextSize();o=v>0&&r.refresh(s,v,T,Y,Math.max(5,y/T),$),o&&(e.docView.minWidth=0,h|=16)}g>0&&S>0?c=Math.max(g,S):g<0&&S<0&&(c=Math.min(g,S)),nu();for(let v of this.viewports){let T=v.from==this.viewport.from?$:e.docView.measureVisibleLineHeights(v);this.heightMap=(o?De.empty().applyChanges(this.stateDeco,D.empty,this.heightOracle,[new lt(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,o,new Yl(v.from,T))}nn&&(h|=2)}let Z=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return Z&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),h|=this.updateForViewport()),(h&2||Z)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,a=new Gi(r.lineAt(o-n*1e3,ee.ByHeight,s,0,0).from,r.lineAt(l+(1-n)*1e3,ee.ByHeight,s,0,0).to);if(t){let{head:h}=t.range;if(ha.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=r.lineAt(h,ee.ByPos,s,0,0),u;t.y=="center"?u=(f.top+f.bottom)/2-c/2:t.y=="start"||t.y=="nearest"&&h=l+Math.max(10,Math.min(n,250)))&&r>o-2*1e3&&s>1,o=r<<1;if(this.defaultTextDirection!=J.LTR&&!n)return[];let l=[],a=(c,f,u,O)=>{if(f-cc&&SS.from>=u.from&&S.to<=u.to&&Math.abs(S.from-c)S.fromb));if(!g){if(fy.from<=f&&y.to>=f)){let y=t.moveToLineBoundary(Q.cursor(f),!1,!0).head;y>c&&(f=y)}let S=this.gapSize(u,c,f,O),b=n||S<2e6?S:2e6;g=new En(c,f,S,b)}l.push(g)},h=c=>{if(c.length2e6)for(let v of e)v.from>=c.from&&v.fromc.from&&a(c.from,O,c,f),dt.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let n=[];G.spans(t,this.viewport.from,this.viewport.to,{span(s,o){n.push({from:s,to:o})},point(){}},20);let r=0;if(n.length!=this.visibleRanges.length)r=12;else for(let s=0;s=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Rn(this.heightMap.lineAt(e,ee.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||Rn(this.heightMap.lineAt(this.scaler.fromDOM(e),ee.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Rn(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}},Gi=class{constructor(e,t){this.from=e,this.to=t}};function yQ(i,e,t){let n=[],r=i,s=0;return G.spans(t,i,e,{span(){},point(o,l){o>r&&(n.push({from:r,to:o}),s+=o-r),r=l}},20),r=1)return e[e.length-1].to;let n=Math.floor(i*t);for(let r=0;;r++){let{from:s,to:o}=e[r],l=o-s;if(n<=l)return s+n;n-=l}}function Hr(i,e){let t=0;for(let{from:n,to:r}of i.ranges){if(e<=r){t+=e-n;break}t+=r-n}return t/i.total}function xQ(i,e){for(let t of i)if(e(t))return t}var su={toDOM(i){return i},fromDOM(i){return i},scale:1,eq(i){return i==this}};function ou(i){let e=i.facet(ys).filter(n=>typeof n!="function"),t=i.facet(ga).filter(n=>typeof n!="function");return t.length&&e.push(G.join(t)),e}var Fl=class i{constructor(e,t,n){let r=0,s=0,o=0;this.viewports=n.map(({from:l,to:a})=>{let h=t.lineAt(l,ee.ByPos,e,0,0).top,c=t.lineAt(a,ee.ByPos,e,0,0).bottom;return r+=c-h,{from:l,to:a,top:h,bottom:c,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(t.height-r);for(let l of this.viewports)l.domTop=o+(l.top-s)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),s=l.bottom}toDOM(e){for(let t=0,n=0,r=0;;t++){let s=tt.from==e.viewports[n].from&&t.to==e.viewports[n].to):!1}};function Rn(i,e){if(e.scale==1)return i;let t=e.toDOM(i.top),n=e.toDOM(i.bottom);return new ot(i.from,i.length,t,n-t,Array.isArray(i._content)?i._content.map(r=>Rn(r,e)):i._content)}var Kr=A.define({combine:i=>i.join(" ")}),Hl=A.define({combine:i=>i.indexOf(!0)>-1}),Kl=Ze.newName(),aO=Ze.newName(),hO=Ze.newName(),cO={"&light":"."+aO,"&dark":"."+hO};function Jl(i,e,t){return new Ze(e,{finish(n){return/&/.test(n)?n.replace(/&\w*/,r=>{if(r=="&")return i;if(!t||!t[r])throw new RangeError(`Unsupported selector: ${r}`);return t[r]}):i+" "+n}})}var kQ=Jl("."+Kl,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},cO),wQ={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},dl=q.ie&&q.ie_version<=11,ea=class{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new kl,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let n of t)this.queue.push(n);(q.ie&&q.ie_version<=11||q.ios&&e.composing)&&t.some(n=>n.type=="childList"&&n.removedNodes.length||n.type=="characterData"&&n.oldValue.length>n.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&q.android&&e.constructor.EDIT_CONTEXT!==!1&&!(q.chrome&&q.chrome_version<126)&&(this.editContext=new ta(e),e.state.facet($t)&&(e.contentDOM.editContext=this.editContext.editContext)),dl&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,n)=>t!=e[n]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,r=this.selectionRange;if(n.state.facet($t)?n.root.activeElement!=this.dom:!An(this.dom,r))return;let s=r.anchorNode&&n.docView.tile.nearest(r.anchorNode);if(s&&s.isWidget()&&s.widget.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(q.ie&&q.ie_version<=11||q.android&&q.chrome)&&!n.state.selection.main.empty&&r.focusNode&&Zn(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Dn(e.root);if(!t)return!1;let n=q.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&vQ(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let r=An(this.dom,n);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&Hi(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(r)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,r=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(r=!0),t==-1?{from:t,to:n}=o:(t=Math.min(o.from,t),n=Math.max(o.to,n)))}return{from:t,to:n,typeOver:r}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),r=this.selectionChanged&&An(this.dom,this.selectionRange);if(e<0&&!r)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new Ll(this.view,e,t,n);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let n=this.view.state,r=Ku(this.view,t);return this.view.state==n&&(t.domChanged||t.newSel&&!Os(this.view.state.selection,t.newSel.main))&&this.view.update([]),r}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type=="attributes"),e.type=="childList"){let n=lu(t,e.previousSibling||e.target.previousSibling,-1),r=lu(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:r?t.posBefore(r):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet($t)!=e.state.facet($t)&&(e.view.contentDOM.editContext=e.state.facet($t)?this.editContext.editContext:null))}destroy(){var e,t,n;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(n=this.resizeScroll)===null||n===void 0||n.disconnect();for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}};function lu(i,e,t){for(;e;){let n=ne.get(e);if(n&&n.parent==i)return n;let r=e.parentNode;e=r!=i.dom?r:t>0?e.nextSibling:e.previousSibling}return null}function au(i,e){let t=e.startContainer,n=e.startOffset,r=e.endContainer,s=e.endOffset,o=i.docView.domAtPos(i.state.selection.main.anchor,1);return Zn(o.node,o.offset,r,s)&&([t,n,r,s]=[r,s,t,n]),{anchorNode:t,anchorOffset:n,focusNode:r,focusOffset:s}}function vQ(i,e){if(e.getComposedRanges){let r=e.getComposedRanges(i.root)[0];if(r)return au(i,r)}let t=null;function n(r){r.preventDefault(),r.stopImmediatePropagation(),t=r.getTargetRanges()[0]}return i.contentDOM.addEventListener("beforeinput",n,!0),i.dom.ownerDocument.execCommand("indent"),i.contentDOM.removeEventListener("beforeinput",n,!0),t?au(i,t):null}var ta=class{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=n=>{let r=e.state.selection.main,{anchor:s,head:o}=r,l=this.toEditorPos(n.updateRangeStart),a=this.toEditorPos(n.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:l,drifted:!1});let h=a-l>n.text.length;l==this.from&&sthis.to&&(a=s);let c=Ju(e.state.sliceDoc(l,a),n.text,(h?r.from:r.to)-l,h?"end":null);if(!c){let u=Q.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));Os(u,r)||e.dispatch({selection:u,userEvent:"select"});return}let f={from:c.from+l,to:c.toA+l,insert:D.of(n.text.slice(c.from,c.toB).split(` +`))};if((q.mac||q.android)&&f.from==o-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:l,to:a,insert:D.of([n.text.replace("."," ")])}),this.pendingContextChange=f,!e.state.readOnly){let u=this.to-this.from+(f.to-f.from+f.insert.length);Sa(e,f,Q.single(this.toEditorPos(n.selectionStart,u),this.toEditorPos(n.selectionEnd,u)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),f.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(t.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let r=[],s=null;for(let o=this.toEditorPos(n.rangeStart),l=this.toEditorPos(n.rangeEnd);o{let r=[];for(let s of n.getTextFormats()){let o=s.underlineStyle,l=s.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(l)){let a=this.toEditorPos(s.rangeStart),h=this.toEditorPos(s.rangeEnd);if(a{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:n}=this.composing;this.composing=null,n&&this.reset(e.state)}};for(let n in this.handlers)t.addEventListener(n,this.handlers[n]);this.measureReq={read:n=>{this.editContext.updateControlBounds(n.contentDOM.getBoundingClientRect());let r=Dn(n.root);r&&r.rangeCount&&this.editContext.updateSelectionBounds(r.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,r=this.pendingContextChange;return e.changes.iterChanges((s,o,l,a,h)=>{if(n)return;let c=h.length-(o-s);if(r&&o>=r.to)if(r.from==s&&r.to==o&&r.insert.eq(h)){r=this.pendingContextChange=null,t+=c,this.to+=c;return}else r=null,this.revertPending(e.state);if(s+=t,o+=t,o<=this.from)this.from+=c,this.to+=c;else if(sthis.to||this.to-this.from+h.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),h.toString()),this.to+=c}t+=c}),r&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(r=>!r.isUserEvent("input.type")&&r.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),r=this.toContextPos(t.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(n,r)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}},x=class i{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:n}=e;this.dispatchTransactions=e.dispatchTransactions||n&&(r=>r.forEach(s=>n(s,this)))||(r=>this.update(r)),this.dispatch=this.dispatch.bind(this),this._root=e.root||QS(e.parent)||document,this.viewState=new ms(this,e.state||F.create(e)),e.scrollTo&&e.scrollTo.is(Gr)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Ii).map(r=>new Mn(r));for(let r of this.plugins)r.update(this);this.observer=new ea(this),this.inputState=new jl(this),this.inputState.ensureHandlers(this.plugins),this.docView=new fs(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof ae?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,n=!1,r,s=this.state;for(let u of e){if(u.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=u.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,l=0,a=null;e.some(u=>u.annotation(sO))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=oO(s,o),a||(l=1));let h=this.observer.delayedAndroidKey,c=null;if(h?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(c=null)):this.observer.clear(),s.facet(F.phrases)!=this.state.facet(F.phrases))return this.setState(s);r=hs.create(this,s,e),r.flags|=l;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let u of e){if(f&&(f=f.map(u.changes)),u.scrollIntoView){let{main:O}=u.state.selection,{x:d,y:m}=this.state.facet(i.cursorScrollMargin);f=new qn(O.empty?O:Q.cursor(O.head,O.head>O.anchor?-1:1),"nearest","nearest",m,d)}for(let O of u.effects)O.is(Gr)&&(f=O.value.clip(this.state))}this.viewState.update(r,f),this.bidiCache=gs.update(this.bidiCache,r.changes),r.empty||(this.updatePlugins(r),this.inputState.update(r)),t=this.docView.update(r),this.state.facet(Xn)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(u=>u.isUserEvent("select.pointer")))}finally{this.updateState=0}if(r.startState.facet(Kr)!=r.state.facet(Kr)&&(this.viewState.mustMeasureContent=!0),(t||n||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!r.empty)for(let u of this.state.facet(Pl))try{u(r)}catch(O){tt(this.state,O,"update listener")}(a||c)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),c&&!Ku(this,c)&&h.force&&Hi(this.contentDOM,h.key,h.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let n of this.plugins)n.destroy(this);this.viewState=new ms(this,e),this.plugins=e.facet(Ii).map(n=>new Mn(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView.destroy(),this.docView=new fs(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Ii),n=e.state.facet(Ii);if(t!=n){let r=[];for(let s of n){let o=t.indexOf(s);if(o<0)r.push(new Mn(s));else{let l=this.plugins[o];l.mustUpdate=e,r.push(l)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let r of this.plugins)r.mustUpdate=e;for(let r=0;r-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.viewState.scrollParent,r=this.viewState.getScrollOffset(),{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(r-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(vu(n||this.win))s=-1,o=this.viewState.heightMap.height;else{let O=this.viewState.scrollAnchorAt(r);s=O.from,o=O.top}this.updateState=1;let a=this.viewState.measure();if(!a&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];a&4||([this.measureRequests,h]=[h,this.measureRequests]);let c=h.map(O=>{try{return O.read(this)}catch(d){return tt(this.state,d),hu}}),f=hs.create(this,this.state,[]),u=!1;f.flags|=a,t?t.flags|=a:t=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),u=this.docView.update(f),u&&this.docViewUpdate());for(let O=0;O1||d<-1)&&(n==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){r=r+d,n?n.scrollTop+=d:this.win.scrollBy(0,d),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let l of this.state.facet(Pl))l(t)}get themeClasses(){return Kl+" "+(this.state.facet(Hl)?hO:aO)+" "+this.state.facet(Kr)}updateAttrs(){let e=cu(this,Du,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet($t)?"true":"false",class:"cm-content",style:`${q.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),cu(this,ma,t);let n=this.observer.ignore(()=>{let r=Vf(this.contentDOM,this.contentAttrs,t),s=Vf(this.dom,this.editorAttrs,e);return r||s});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(e){let t=!0;for(let n of e)for(let r of n.effects)if(r.is(i.announce)){t&&(this.announceDOM.textContent=""),t=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=r.value}}mountStyles(){this.styleModules=this.state.facet(Xn);let e=this.state.facet(i.cspNonce);Ze.mount(this.root,this.styleModules.concat(kQ).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;tn.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,n){return Ol(this,e,Nf(this,e,t,n))}moveByGroup(e,t){return Ol(this,e,Nf(this,e,t,n=>NS(this,e.head,n)))}visualLineSide(e,t){let n=this.bidiSpans(e),r=this.textDirectionAt(e.from),s=n[t?n.length-1:0];return Q.cursor(s.side(t,r)+e.from,s.forward(!t,r)?1:-1)}moveToLineBoundary(e,t,n=!0){return GS(this,e,t,n)}moveVertically(e,t,n){return Ol(this,e,US(this,e,t,n))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let n=zl(this,e,t);return n&&n.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),zl(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.docView.coordsAt(e,t);if(!n||n.left==n.right)return n;let r=this.state.doc.lineAt(e),s=this.bidiSpans(r),o=s[et.find(s,e-r.from,-1,t)];return as(n,o.dir==J.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(Wu)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>$Q)return Ru(e.length);let t=this.textDirectionAt(e.from),n;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==t&&(s.fresh||Xu(s.isolates,n=Yf(this,e))))return s.order;n||(n=Yf(this,e));let r=PS(e.text,t,n);return this.bidiCache.push(new gs(e.from,e.to,t,n,!0,r)),r}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||q.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{wu(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){var n,r,s,o;return Gr.of(new qn(typeof e=="number"?Q.cursor(e):e,(n=t.y)!==null&&n!==void 0?n:"nearest",(r=t.x)!==null&&r!==void 0?r:"nearest",(s=t.yMargin)!==null&&s!==void 0?s:5,(o=t.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return Gr.of(new qn(Q.cursor(n.from),"start","start",n.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return ce.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return ce.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=Ze.newName(),r=[Kr.of(n),Xn.of(Jl(`.${n}`,e))];return t&&t.dark&&r.push(Hl.of(!0)),r}static baseTheme(e){return Te.lowest(Xn.of(Jl("."+Kl,e,cO)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),r=n&&ne.get(n)||ne.get(e);return((t=r?.root)===null||t===void 0?void 0:t.view)||null}};x.styleModule=Xn;x.inputHandler=zu;x.clipboardInputFilter=da;x.clipboardOutputFilter=pa;x.scrollHandler=ju;x.focusChangeEffect=Eu;x.perLineTextDirection=Wu;x.exceptionSink=_u;x.updateListener=Pl;x.editable=$t;x.mouseSelectionStyle=Mu;x.dragMovesSelection=qu;x.clickAddsSelectionRange=Zu;x.decorations=ys;x.blockWrappers=Bu;x.outerDecorations=ga;x.atomicRanges=In;x.bidiIsolatedRanges=Yu;x.cursorScrollMargin=A.define({combine:i=>{let e=5,t=5;for(let n of i)typeof n=="number"?e=t=n:{x:e,y:t}=n;return{x:e,y:t}}});x.scrollMargins=Iu;x.darkTheme=Hl;x.cspNonce=A.define({combine:i=>i.length?i[0]:""});x.contentAttributes=ma;x.editorAttributes=Du;x.lineWrapping=x.contentAttributes.of({class:"cm-lineWrapping"});x.announce=L.define();var $Q=4096,hu={},gs=class i{constructor(e,t,n,r,s,o){this.from=e,this.to=t,this.dir=n,this.isolates=r,this.fresh=s,this.order=o}static update(e,t){if(t.empty&&!e.some(s=>s.fresh))return e;let n=[],r=e.length?e[e.length-1].dir:J.LTR;for(let s=Math.max(0,e.length-10);s=0;r--){let s=n[r],o=typeof s=="function"?s(i):s;o&&fa(o,t)}return t}var PQ=q.mac?"mac":q.windows?"win":q.linux?"linux":"key";function TQ(i,e){let t=i.split(/-(?!$)/),n=t[t.length-1];n=="Space"&&(n=" ");let r,s,o,l;for(let a=0;an.concat(r),[]))),t}function uO(i,e,t){return OO(fO(i.state),e,i,t)}var Dt=null,XQ=4e3;function RQ(i,e=PQ){let t=Object.create(null),n=Object.create(null),r=(o,l)=>{let a=n[o];if(a==null)n[o]=l;else if(a!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},s=(o,l,a,h,c)=>{var f,u;let O=t[o]||(t[o]=Object.create(null)),d=l.split(/ (?!$)/).map(S=>TQ(S,e));for(let S=1;S{let Z=Dt={view:y,prefix:b,scope:o};return setTimeout(()=>{Dt==Z&&(Dt=null)},XQ),!0}]})}let m=d.join(" ");r(m,!1);let g=O[m]||(O[m]={preventDefault:!1,stopPropagation:!1,run:((u=(f=O._any)===null||f===void 0?void 0:f.run)===null||u===void 0?void 0:u.slice())||[]});a&&g.run.push(a),h&&(g.preventDefault=!0),c&&(g.stopPropagation=!0)};for(let o of i){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let h of l){let c=t[h]||(t[h]=Object.create(null));c._any||(c._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:f}=o;for(let u in c)c[u].run.push(O=>f(O,ia))}let a=o[e]||o.key;if(a)for(let h of l)s(h,a,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(h,"Shift-"+a,o.shift,o.preventDefault,o.stopPropagation)}return t}var ia=null;function OO(i,e,t,n){ia=e;let r=zf(e),s=st(r,0),o=Vt(s)==r.length&&r!=" ",l="",a=!1,h=!1,c=!1;Dt&&Dt.view==t&&Dt.scope==n&&(l=Dt.prefix+" ",tO.indexOf(e.keyCode)<0&&(h=!0,Dt=null));let f=new Set,u=g=>{if(g){for(let S of g.run)if(!f.has(S)&&(f.add(S),S(t)))return g.stopPropagation&&(c=!0),!0;g.preventDefault&&(g.stopPropagation&&(c=!0),h=!0)}return!1},O=i[n],d,m;return O&&(u(O[l+Jr(r,e,!o)])?a=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(q.windows&&e.ctrlKey&&e.altKey)&&!(q.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(d=vt[e.keyCode])&&d!=r?(u(O[l+Jr(d,e,!0)])||e.shiftKey&&(m=Bi[e.keyCode])!=r&&m!=d&&u(O[l+Jr(m,e,!1)]))&&(a=!0):o&&e.shiftKey&&u(O[l+Jr(r,e,!0)])&&(a=!0),!a&&u(O._any)&&(a=!0)),h&&(a=!0),a&&c&&e.stopPropagation(),ia=null,a}var Qi=class i{constructor(e,t,n,r,s){this.className=e,this.left=t,this.top=n,this.width=r,this.height=s}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,n){if(n.empty){let r=e.coordsAtPos(n.head,n.assoc||1);if(!r)return[];let s=dO(e);return[new i(t,r.left-s.left,r.top-s.top,null,r.bottom-r.top)]}else return AQ(e,t,n)}};function dO(i){let e=i.scrollDOM.getBoundingClientRect();return{left:(i.textDirection==J.LTR?e.left:e.right-i.scrollDOM.clientWidth*i.scaleX)-i.scrollDOM.scrollLeft*i.scaleX,top:e.top-i.scrollDOM.scrollTop*i.scaleY}}function uu(i,e,t,n){let r=i.coordsAtPos(e,t*2);if(!r)return n;let s=i.dom.getBoundingClientRect(),o=(r.top+r.bottom)/2,l=i.posAtCoords({x:s.left+1,y:o}),a=i.posAtCoords({x:s.right-1,y:o});return l==null||a==null?n:{from:Math.max(n.from,Math.min(l,a)),to:Math.min(n.to,Math.max(l,a))}}function AQ(i,e,t){if(t.to<=i.viewport.from||t.from>=i.viewport.to)return[];let n=Math.max(t.from,i.viewport.from),r=Math.min(t.to,i.viewport.to),s=i.textDirection==J.LTR,o=i.contentDOM,l=o.getBoundingClientRect(),a=dO(i),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),f=l.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),u=l.right-(c?parseInt(c.paddingRight):0),O=_l(i,n,1),d=_l(i,r,-1),m=O.type==Se.Text?O:null,g=d.type==Se.Text?d:null;if(m&&(i.lineWrapping||O.widgetLineBreaks)&&(m=uu(i,n,1,m)),g&&(i.lineWrapping||d.widgetLineBreaks)&&(g=uu(i,r,-1,g)),m&&g&&m.from==g.from&&m.to==g.to)return b(y(t.from,t.to,m));{let $=m?y(t.from,null,m):Z(O,!1),v=g?y(null,t.to,g):Z(d,!0),T=[];return(m||O).to<(g||d).from-(m&&g?1:0)||O.widgetLineBreaks>1&&$.bottom+i.defaultLineHeight/2w&&W.from=Oe)break;Ue>N&&P(Math.max(pe,N),$==null&&pe<=w,Math.min(Ue,Oe),v==null&&Ue>=X,dt.dir)}if(N=Pe.to+1,N>=Oe)break}return C.length==0&&P(w,$==null,X,v==null,i.textDirection),{top:Y,bottom:V,horizontal:C}}function Z($,v){let T=l.top+(v?$.top:$.bottom);return{top:T,bottom:T,horizontal:[]}}}function ZQ(i,e){return i.constructor==e.constructor&&i.eq(e)}var na=class{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(is)!=e.state.facet(is)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,n=e.facet(is);for(;t!ZQ(t,this.drawn[n]))){let t=this.dom.firstChild,n=0;for(let r of e)r.update&&t&&r.constructor&&this.drawn[n].constructor&&r.update(t,this.drawn[n])?(t=t.nextSibling,n++):this.dom.insertBefore(r.draw(),t);for(;t;){let r=t.nextSibling;t.remove(),t=r}this.drawn=e,q.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}},is=A.define();function pO(i){return[ce.define(e=>new na(e,i)),is.of(i)]}var rn=A.define({combine(i){return Ve(i,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function Qa(i={}){return[rn.of(i),qQ,MQ,_Q,Lu.of(!0)]}function mO(i){return i.startState.facet(rn)!=i.state.facet(rn)}var qQ=pO({above:!0,markers(i){let{state:e}=i,t=e.facet(rn),n=[];for(let r of e.selection.ranges){let s=r==e.selection.main;if(r.empty||t.drawRangeCursor&&!(s&&q.ios&&t.iosSelectionHandles)){let o=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=r.empty?r:Q.cursor(r.head,r.assoc);for(let a of Qi.forRange(i,o,l))n.push(a)}}return n},update(i,e){i.transactions.some(n=>n.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=mO(i);return t&&Ou(i.state,e),i.docChanged||i.selectionSet||t},mount(i,e){Ou(e.state,i)},class:"cm-cursorLayer"});function Ou(i,e){e.style.animationDuration=i.facet(rn).cursorBlinkRate+"ms"}var MQ=pO({above:!1,markers(i){let e=[],{main:t,ranges:n}=i.state.selection;for(let r of n)if(!r.empty)for(let s of Qi.forRange(i,"cm-selectionBackground",r))e.push(s);if(q.ios&&!t.empty&&i.state.facet(rn).iosSelectionHandles){for(let r of Qi.forRange(i,"cm-selectionHandle cm-selectionHandle-start",Q.cursor(t.from,1)))e.push(r);for(let r of Qi.forRange(i,"cm-selectionHandle cm-selectionHandle-end",Q.cursor(t.to,1)))e.push(r)}return e},update(i,e){return i.docChanged||i.selectionSet||i.viewportChanged||mO(i)},class:"cm-selectionLayer"}),_Q=Te.highest(x.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}}));function du(i,e,t,n,r){e.lastIndex=0;for(let s=i.iterRange(t,n),o=t,l;!s.next().done;o+=s.value.length)if(!s.lineBreak)for(;l=e.exec(s.value);)r(o+l.index,l)}function zQ(i,e){let t=i.visibleRanges;if(t.length==1&&t[0].from==i.viewport.from&&t[0].to==i.viewport.to)return t;let n=[];for(let{from:r,to:s}of t)r=Math.max(i.state.doc.lineAt(r).from,r-e),s=Math.min(i.state.doc.lineAt(s).to,s+e),n.length&&n[n.length-1].to>=r?n[n.length-1].to=s:n.push({from:r,to:s});return n}var ra=class{constructor(e){let{regexp:t,decoration:n,decorate:r,boundary:s,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,r)this.addMatch=(l,a,h,c)=>r(c,h,h+l[0].length,l,a);else if(typeof n=="function")this.addMatch=(l,a,h,c)=>{let f=n(l,a,h);f&&c(h,h+l[0].length,f)};else if(n)this.addMatch=(l,a,h,c)=>c(h,h+l[0].length,n);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=s,this.maxLength=o}createDeco(e){let t=new ge,n=t.add.bind(t);for(let{from:r,to:s}of zQ(e,this.maxLength))du(e.state.doc,this.regexp,r,s,(o,l)=>this.addMatch(l,e,o,n));return t.finish()}updateDeco(e,t){let n=1e9,r=-1;return e.docChanged&&e.changes.iterChanges((s,o,l,a)=>{a>=e.view.viewport.from&&l<=e.view.viewport.to&&(n=Math.min(l,n),r=Math.max(a,r))}),e.viewportMoved||r-n>1e3?this.createDeco(e.view):r>-1?this.updateRange(e.view,t.map(e.changes),n,r):t}updateRange(e,t,n,r){for(let s of e.visibleRanges){let o=Math.max(s.from,n),l=Math.min(s.to,r);if(l>=o){let a=e.state.doc.lineAt(o),h=a.toa.from;o--)if(this.boundary.test(a.text[o-1-a.from])){c=o;break}for(;lu.push(S.range(m,g));if(a==h)for(this.regexp.lastIndex=c-a.from;(O=this.regexp.exec(a.text))&&O.indexthis.addMatch(g,e,m,d));t=t.update({filterFrom:c,filterTo:f,filter:(m,g)=>mf,add:u})}}return t}},sa=/x/.unicode!=null?"gu":"g",EQ=new RegExp(`[\0-\b +-\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]`,sa),WQ={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"},pl=null;function LQ(){var i;if(pl==null&&typeof document<"u"&&document.body){let e=document.body.style;pl=((i=e.tabSize)!==null&&i!==void 0?i:e.MozTabSize)!=null}return pl||!1}var ns=A.define({combine(i){let e=Ve(i,{render:null,specialChars:EQ,addSpecialChars:null});return(e.replaceTabs=!LQ())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,sa)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,sa)),e}});function ba(i={}){return[ns.of(i),jQ()]}var pu=null;function jQ(){return pu||(pu=ce.fromClass(class{constructor(i){this.view=i,this.decorations=M.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(i.state.facet(ns)),this.decorations=this.decorator.createDeco(i)}makeDecorator(i){return new ra({regexp:i.specialChars,decoration:(e,t,n)=>{let{doc:r}=t.state,s=st(e[0],0);if(s==9){let o=r.lineAt(n),l=t.state.tabSize,a=Ae(o.text,l,n-o.from);return M.replace({widget:new la((l-a%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=M.replace({widget:new oa(i,s)}))},boundary:i.replaceTabs?void 0:/[^]/})}update(i){let e=i.state.facet(ns);i.startState.facet(ns)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(i.view)):this.decorations=this.decorator.updateDeco(i,this.decorations)}},{decorations:i=>i.decorations}))}var VQ="\u2022";function DQ(i){return i>=32?VQ:i==10?"\u2424":String.fromCharCode(9216+i)}var oa=class extends xe{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=DQ(this.code),n=e.state.phrase("Control character")+" "+(WQ[this.code]||"0x"+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,n,t);if(r)return r;let s=document.createElement("span");return s.textContent=t,s.title=n,s.setAttribute("aria-label",n),s.className="cm-specialChar",s}ignoreEvent(){return!1}},la=class extends xe{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}};function gO(){return YQ}var BQ=M.line({class:"cm-activeLine"}),YQ=ce.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){(i.docChanged||i.selectionSet)&&(this.decorations=this.getDeco(i.view))}getDeco(i){let e=-1,t=[];for(let n of i.state.selection.ranges){let r=i.lineBlockAt(n.head);r.from>e&&(t.push(BQ.range(r.from)),e=r.from)}return M.set(t)}},{decorations:i=>i.decorations});var mu=A.define({combine(i){let e,t;for(let n of i)e=e||n.topContainer,t=t||n.bottomContainer;return{topContainer:e,bottomContainer:t}}});function ya(i,e){let t=i.plugin(SO),n=t?t.specs.indexOf(e):-1;return n>-1?t.panels[n]:null}var SO=ce.fromClass(class{constructor(i){this.input=i.state.facet(Yn),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(i));let e=i.state.facet(mu);this.top=new Ni(i,!0,e.topContainer),this.bottom=new Ni(i,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(i){let e=i.state.facet(mu);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Ni(i.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Ni(i.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=i.state.facet(Yn);if(t!=this.input){let n=t.filter(a=>a),r=[],s=[],o=[],l=[];for(let a of n){let h=this.specs.indexOf(a),c;h<0?(c=a(i.view),l.push(c)):(c=this.panels[h],c.update&&c.update(i)),r.push(c),(c.top?s:o).push(c)}this.specs=n,this.panels=r,this.top.sync(s),this.bottom.sync(o);for(let a of l)a.dom.classList.add("cm-panel"),a.mount&&a.mount()}else for(let n of this.panels)n.update&&n.update(i)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:i=>x.scrollMargins.of(e=>{let t=e.plugin(i);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})}),Ni=class{constructor(e,t,n){this.view=e,this.top=t,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=gu(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=gu(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}};function gu(i){let e=i.nextSibling;return i.remove(),e}var Yn=A.define({enables:SO});function QO(i,e){let t,n=new Promise(o=>t=o),r=o=>IQ(o,e,t);i.state.field(ml,!1)?i.dispatch({effects:bO.of(r)}):i.dispatch({effects:L.appendConfig.of(ml.init(()=>[r]))});let s=yO.of(r);return{close:s,result:n.then(o=>((i.win.queueMicrotask||(a=>i.win.setTimeout(a,10)))(()=>{i.state.field(ml).indexOf(r)>-1&&i.dispatch({effects:s})}),o))}}var ml=se.define({create(){return[]},update(i,e){for(let t of e.effects)t.is(bO)?i=[t.value].concat(i):t.is(yO)&&(i=i.filter(n=>n!=t.value));return i},provide:i=>Yn.computeN([i],e=>e.field(i))}),bO=L.define(),yO=L.define();function IQ(i,e,t){let n=e.content?e.content(i,()=>o(null)):null;if(!n){if(n=le("form"),e.input){let l=le("input",e.input);/^(text|password|number|email|tel|url)$/.test(l.type)&&l.classList.add("cm-textfield"),l.name||(l.name="input"),n.appendChild(le("label",(e.label||"")+": ",l))}else n.appendChild(document.createTextNode(e.label||""));n.appendChild(document.createTextNode(" ")),n.appendChild(le("button",{class:"cm-button",type:"submit"},e.submitLabel||"OK"))}let r=n.nodeName=="FORM"?[n]:n.querySelectorAll("form");for(let l=0;l{h.keyCode==27?(h.preventDefault(),o(null)):h.keyCode==13&&(h.preventDefault(),o(a))}),a.addEventListener("submit",h=>{h.preventDefault(),o(a)})}let s=le("div",n,le("button",{onclick:()=>o(null),"aria-label":i.state.phrase("close"),class:"cm-dialog-close",type:"button"},["\xD7"]));e.class&&(s.className=e.class),s.classList.add("cm-dialog");function o(l){s.contains(s.ownerDocument.activeElement)&&i.focus(),t(l)}return{dom:s,top:e.top,mount:()=>{if(e.focus){let l;typeof e.focus=="string"?l=n.querySelector(e.focus):l=n.querySelector("input")||n.querySelector("button"),l&&"select"in l?l.select():l&&"focus"in l&&l.focus()}}}}var _e=class extends He{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}};_e.prototype.elementClass="";_e.prototype.toDOM=void 0;_e.prototype.mapMode=de.TrackBefore;_e.prototype.startSide=_e.prototype.endSide=-1;_e.prototype.point=!0;var rs=A.define(),GQ=A.define(),NQ={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>G.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},Wn=A.define();function ks(i){return[xO(),Wn.of({...NQ,...i})]}var aa=A.define({combine:i=>i.some(e=>e)});function xO(i){let e=[UQ];return i&&i.fixed===!1&&e.push(aa.of(!0)),e}var UQ=ce.fromClass(class{constructor(i){this.view=i,this.domAfter=null,this.prevViewport=i.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=i.state.facet(Wn).map(e=>new Ss(i,e)),this.fixed=!i.state.facet(aa);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),i.scrollDOM.insertBefore(this.dom,i.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(i){if(this.updateGutters(i)){let e=this.prevViewport,t=i.view.viewport,n=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(n<(t.to-t.from)*.8)}if(i.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(aa)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=i.view.viewport}syncGutters(i){let e=this.dom.nextSibling;i&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let t=G.iter(this.view.state.facet(rs),this.view.viewport.from),n=[],r=this.gutters.map(s=>new ca(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(n.length&&(n=[]),Array.isArray(s.type)){let o=!0;for(let l of s.type)if(l.type==Se.Text&&o){ha(t,n,l.from);for(let a of r)a.line(this.view,l,n);o=!1}else if(l.widget)for(let a of r)a.widget(this.view,l)}else if(s.type==Se.Text){ha(t,n,s.from);for(let o of r)o.line(this.view,s,n)}else if(s.widget)for(let o of r)o.widget(this.view,s);for(let s of r)s.finish();i&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(i){let e=i.startState.facet(Wn),t=i.state.facet(Wn),n=i.docChanged||i.heightChanged||i.viewportChanged||!G.eq(i.startState.facet(rs),i.state.facet(rs),i.view.viewport.from,i.view.viewport.to);if(e==t)for(let r of this.gutters)r.update(i)&&(n=!0);else{n=!0;let r=[];for(let s of t){let o=e.indexOf(s);o<0?r.push(new Ss(this.view,s)):(this.gutters[o].update(i),r.push(this.gutters[o]))}for(let s of this.gutters)s.dom.remove(),r.indexOf(s)<0&&s.destroy();for(let s of r)s.config.side=="after"?this.getDOMAfter().appendChild(s.dom):this.dom.appendChild(s.dom);this.gutters=r}return n}destroy(){for(let i of this.gutters)i.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:i=>x.scrollMargins.of(e=>{let t=e.plugin(i);if(!t||t.gutters.length==0||!t.fixed)return null;let n=t.dom.offsetWidth*e.scaleX,r=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==J.LTR?{left:n,right:r}:{right:n,left:r}})});function Su(i){return Array.isArray(i)?i:[i]}function ha(i,e,t){for(;i.value&&i.from<=t;)i.from==t&&e.push(i.value),i.next()}var ca=class{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=G.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:r}=this,s=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==r.elements.length){let l=new Qs(e,o,s,n);r.elements.push(l),r.dom.appendChild(l.dom)}else r.elements[this.i].update(e,o,s,n);this.height=t.bottom,this.i++}line(e,t,n){let r=[];ha(this.cursor,r,t.from),n.length&&(r=r.concat(n));let s=this.gutter.config.lineMarker(e,t,r);s&&r.unshift(s);let o=this.gutter;r.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,r)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t),r=n?[n]:null;for(let s of e.state.facet(GQ)){let o=s(e,t.widget,t);o&&(r||(r=[])).push(o)}r&&this.addElement(e,t,r)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}},Ss=class{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in t.domEventHandlers)this.dom.addEventListener(n,r=>{let s=r.target,o;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let a=s.getBoundingClientRect();o=(a.top+a.bottom)/2}else o=r.clientY;let l=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[n](e,l,r)&&r.preventDefault()});this.markers=Su(t.markers(e)),t.initialSpacer&&(this.spacer=new Qs(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=Su(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let r=this.config.updateSpacer(this.spacer.markers[0],e);r!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[r])}let n=e.view.viewport;return!G.eq(this.markers,t,n.from,n.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}},Qs=class{constructor(e,t,n,r){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,n,r)}update(e,t,n,r){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),FQ(this.markers,r)||this.setMarkers(e,r)}setMarkers(e,t){let n="cm-gutterElement",r=this.dom.firstChild;for(let s=0,o=0;;){let l=o,a=ss(l,a,h)||o(l,a,h):o}return n}})}}),Ln=class extends _e{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}};function gl(i,e){return i.state.facet(Ui).formatNumber(e,i.state)}var JQ=Wn.compute([Ui],i=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(HQ)},lineMarker(e,t,n){return n.some(r=>r.toDOM)?null:new Ln(gl(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,n)=>{for(let r of e.state.facet(KQ)){let s=r(e,t,n);if(s)return s}return null},lineMarkerChange:e=>e.startState.facet(Ui)!=e.state.facet(Ui),initialSpacer(e){return new Ln(gl(e,Qu(e.state.doc.lines)))},updateSpacer(e,t){let n=gl(t.view,Qu(t.view.state.doc.lines));return n==e.number?e:new Ln(n)},domEventHandlers:i.facet(Ui).domEventHandlers,side:"before"}));function xa(i={}){return[Ui.of(i),xO(),JQ]}function Qu(i){let e=9;for(;e{let e=[],t=-1;for(let n of i.selection.ranges){let r=i.doc.lineAt(n.head).from;r>t&&(t=r,e.push(e1.range(r)))}return G.of(e)});function kO(){return t1}var i1=0,ze=class{constructor(e,t){this.from=e,this.to=t}},E=class{constructor(e={}){this.id=i1++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=re.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}};E.closedBy=new E({deserialize:i=>i.split(" ")});E.openedBy=new E({deserialize:i=>i.split(" ")});E.group=new E({deserialize:i=>i.split(" ")});E.isolate=new E({deserialize:i=>{if(i&&i!="rtl"&&i!="ltr"&&i!="auto")throw new RangeError("Invalid value for isolate: "+i);return i||"auto"}});E.contextHash=new E({perNode:!0});E.lookAhead=new E({perNode:!0});E.mounted=new E({perNode:!0});var Nt=class{constructor(e,t,n,r=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=r}static get(e){return e&&e.props&&e.props[E.mounted.id]}},n1=Object.create(null),re=class i{constructor(e,t,n,r=0){this.name=e,this.props=t,this.id=n,this.flags=r}static define(e){let t=e.props&&e.props.length?Object.create(null):n1,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),r=new i(e.name||"",t,e.id,n);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(r)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1]}}return r}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(E.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let r of n.split(" "))t[r]=e[n];return n=>{for(let r=n.prop(E.group),s=-1;s<(r?r.length:0);s++){let o=t[s<0?n.name:r[s]];if(o)return o}}}};re.none=new re("",Object.create(null),0,8);var Ct=class i{constructor(e){this.types=e;for(let t=0;t0;for(let a=this.cursor(o|I.IncludeAnonymous);;){let h=!1;if(a.from<=s&&a.to>=r&&(!l&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&n&&(l||!a.type.isAnonymous)&&n(a),!a.nextSibling();){if(!a.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:Za(re.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,r)=>new i(this.type,t,n,r,this.propValues),e.makeTree||((t,n,r)=>new i(re.none,t,n,r)))}static build(e){return s1(e)}};j.empty=new j(re.none,[],[],0);var ka=class i{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new i(this.buffer,this.index)}},Ut=class i{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return re.none}toString(){let e=[];for(let t=0;t0));a=o[a+3]);return l}slice(e,t,n){let r=this.buffer,s=new Uint16Array(t-e),o=0;for(let l=e,a=0;l=e&&te;case 1:return t<=e&&n>e;case 2:return n>e;case 4:return!0}}function Gn(i,e,t,n){for(var r;i.from==i.to||(t<1?i.from>=e:i.from>e)||(t>-1?i.to<=e:i.to0?l.length:-1;e!=h;e+=t){let c=l[e],f=a[e]+o.from,u;if(!(!(s&I.EnterBracketed&&c instanceof j&&(u=Nt.get(c))&&!u.overlay&&u.bracketed&&n>=f&&n<=f+c.length)&&!RO(r,n,f,f+c.length))){if(c instanceof Ut){if(s&I.ExcludeBuffers)continue;let O=c.findChild(0,c.buffer.length,t,n-f,r);if(O>-1)return new ki(new va(o,c,e,f),null,O)}else if(s&I.IncludeAnonymous||!c.type.isAnonymous||Aa(c)){let O;if(!(s&I.IgnoreMounts)&&(O=Nt.get(c))&&!O.overlay)return new i(O.tree,f,e,o);let d=new i(c,f,e,o);return s&I.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(t<0?c.children.length-1:0,t,n,r,s)}}}if(s&I.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,n=0){let r;if(!(n&I.IgnoreOverlays)&&(r=Nt.get(this._tree))&&r.overlay){let s=e-this.from,o=n&I.EnterBracketed&&r.bracketed;for(let{from:l,to:a}of r.overlay)if((t>0||o?l<=s:l=s:a>s))return new i(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function vO(i,e,t,n){let r=i.cursor(),s=[];if(!r.firstChild())return s;if(t!=null){for(let o=!1;!o;)if(o=r.type.is(t),!r.nextSibling())return s}for(;;){if(n!=null&&r.type.is(n))return s;if(r.type.is(e)&&s.push(r.node),!r.nextSibling())return n==null?s:[]}}function wa(i,e,t=e.length-1){for(let n=i;t>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[t]&&e[t]!=n.name)return!1;t--}}return!0}var va=class{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}},ki=class i extends $s{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.context.start,n);return s<0?null:new i(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,n=0){if(n&I.ExcludeBuffers)return null;let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new i(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new i(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new i(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,r=this.index+4,s=n.buffer[this.index+3];if(s>r){let o=n.buffer[this.index+1];e.push(n.slice(r,s,o)),t.push(0)}return new j(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function AO(i){if(!i.length)return null;let e=0,t=i[0];for(let s=1;st.from||o.to=e){let l=new Ee(o.tree,o.overlay[0].from+s.from,-1,s);(r||(r=[n])).push(Gn(l,e,t,!1))}}return r?AO(r):n}var sn=class{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~I.EnterBracketed,e instanceof Ee)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:n,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=n+r.buffer[e+1],this.to=n+r.buffer[e+2],!0}yield(e){return e?e instanceof Ee?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:r}=this.buffer,s=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?n&I.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&I.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&I.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let r=n<0?0:this.stack[n]+4;if(this.index!=r)return this.yieldBuf(t.findChild(r,this.index,-1,0,4))}else{let r=t.buffer[this.index+3];if(r<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(r)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:r}=this;if(r){if(e>0){if(this.index-1)for(let s=t+e,o=e<0?-1:n._tree.children.length;s!=o;s+=e){let l=n._tree.children[s];if(this.mode&I.IncludeAnonymous||l instanceof Ut||!l.type.isAnonymous||Aa(l))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let o=e;o;o=o._parent)if(o.index==r){if(r==this.index)return o;t=o,n=s+1;break e}r=this.stack[--s]}for(let r=n;r=0;s--){if(s<0)return wa(this._tree,e,r);let o=n[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[r]&&e[r]!=o.name)return!1;r--}}return!0}};function Aa(i){return i.children.some(e=>e instanceof Ut||!e.type.isAnonymous||Aa(e))}function s1(i){var e;let{buffer:t,nodeSet:n,maxBufferLength:r=1024,reused:s=[],minRepeatType:o=n.types.length}=i,l=Array.isArray(t)?new ka(t,t.length):t,a=n.types,h=0,c=0;function f($,v,T,Y,V,C){let{id:P,start:w,end:X,size:W}=l,N=c,Oe=h;if(W<0)if(l.next(),W==-1){let kt=s[P];T.push(kt),Y.push(w-$);return}else if(W==-3){h=P;return}else if(W==-4){c=P;return}else throw new RangeError(`Unrecognized record size: ${W}`);let Pe=a[P],dt,pe,Ue=w-$;if(X-w<=r&&(pe=g(l.pos-v,V))){let kt=new Uint16Array(pe.size-pe.skip),Fe=l.pos-pe.size,pt=kt.length;for(;l.pos>Fe;)pt=S(pe.start,kt,pt);dt=new Ut(kt,X-pe.start,n),Ue=pe.start-$}else{let kt=l.pos-W;l.next();let Fe=[],pt=[],fi=P>=o?P:-1,Ei=0,qr=X;for(;l.pos>kt;)fi>=0&&l.id==fi&&l.size>=0?(l.end<=qr-r&&(d(Fe,pt,w,Ei,l.end,qr,fi,N,Oe),Ei=Fe.length,qr=l.end),l.next()):C>2500?u(w,kt,Fe,pt):f(w,kt,Fe,pt,fi,C+1);if(fi>=0&&Ei>0&&Ei-1&&Ei>0){let hf=O(Pe,Oe);dt=Za(Pe,Fe,pt,0,Fe.length,0,X-w,hf,hf)}else dt=m(Pe,Fe,pt,X-w,N-X,Oe)}T.push(dt),Y.push(Ue)}function u($,v,T,Y){let V=[],C=0,P=-1;for(;l.pos>v;){let{id:w,start:X,end:W,size:N}=l;if(N>4)l.next();else{if(P>-1&&X=0;W-=3)w[N++]=V[W],w[N++]=V[W+1]-X,w[N++]=V[W+2]-X,w[N++]=N;T.push(new Ut(w,V[2]-X,n)),Y.push(X-$)}}function O($,v){return(T,Y,V)=>{let C=0,P=T.length-1,w,X;if(P>=0&&(w=T[P])instanceof j){if(!P&&w.type==$&&w.length==V)return w;(X=w.prop(E.lookAhead))&&(C=Y[P]+w.length+X)}return m($,T,Y,V,C,v)}}function d($,v,T,Y,V,C,P,w,X){let W=[],N=[];for(;$.length>Y;)W.push($.pop()),N.push(v.pop()+T-V);$.push(m(n.types[P],W,N,C-V,w-C,X)),v.push(V-T)}function m($,v,T,Y,V,C,P){if(C){let w=[E.contextHash,C];P=P?[w].concat(P):[w]}if(V>25){let w=[E.lookAhead,V];P=P?[w].concat(P):[w]}return new j($,v,T,Y,P)}function g($,v){let T=l.fork(),Y=0,V=0,C=0,P=T.end-r,w={size:0,start:0,skip:0};e:for(let X=T.pos-$;T.pos>X;){let W=T.size;if(T.id==v&&W>=0){w.size=Y,w.start=V,w.skip=C,C+=4,Y+=4,T.next();continue}let N=T.pos-W;if(W<0||N=o?4:0,Pe=T.start;for(T.next();T.pos>N;){if(T.size<0)if(T.size==-3||T.size==-4)Oe+=4;else break e;else T.id>=o&&(Oe+=4);T.next()}V=Pe,Y+=W,C+=Oe}return(v<0||Y==$)&&(w.size=Y,w.start=V,w.skip=C),w.size>4?w:void 0}function S($,v,T){let{id:Y,start:V,end:C,size:P}=l;if(l.next(),P>=0&&Y4){let X=l.pos-(P-4);for(;l.pos>X;)T=S($,v,T)}v[--T]=w,v[--T]=C-$,v[--T]=V-$,v[--T]=Y}else P==-3?h=Y:P==-4&&(c=Y);return T}let b=[],y=[];for(;l.pos>0;)f(i.start||0,i.bufferStart||0,b,y,-1,0);let Z=(e=i.length)!==null&&e!==void 0?e:b.length?y[0]+b[0].length:0;return new j(a[i.topID],b.reverse(),y.reverse(),Z)}var $O=new WeakMap;function vs(i,e){if(!i.isAnonymous||e instanceof Ut||e.type!=i)return 1;let t=$O.get(e);if(t==null){t=1;for(let n of e.children){if(n.type!=i||!(n instanceof j)){t=1;break}t+=vs(i,n)}$O.set(e,t)}return t}function Za(i,e,t,n,r,s,o,l,a){let h=0;for(let d=n;d=c)break;v+=T}if(y==Z+1){if(v>c){let T=d[Z];O(T.children,T.positions,0,T.children.length,m[Z]+b);continue}f.push(d[Z])}else{let T=m[y-1]+d[y-1].length-$;f.push(Za(i,d,m,Z,y,$,T,null,a))}u.push($+b-s)}}return O(e,t,n,r,0),(l||a)(f,u,o)}var Ft=class{constructor(){this.map=new WeakMap}setBuffer(e,t,n){let r=this.map.get(e);r||this.map.set(e,r=new Map),r.set(t,n)}getBuffer(e,t){let n=this.map.get(e);return n&&n.get(t)}set(e,t){e instanceof ki?this.setBuffer(e.context.buffer,e.index,t):e instanceof Ee&&this.map.set(e.tree,t)}get(e){return e instanceof ki?this.getBuffer(e.context.buffer,e.index):e instanceof Ee?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}},Xt=class i{constructor(e,t,n,r,s=!1,o=!1){this.from=e,this.to=t,this.tree=n,this.offset=r,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],n=!1){let r=[new i(0,e.length,e,0,!1,n)];for(let s of t)s.to>e.length&&r.push(s);return r}static applyChanges(e,t,n=128){if(!t.length)return e;let r=[],s=1,o=e.length?e[0]:null;for(let l=0,a=0,h=0;;l++){let c=l=n)for(;o&&o.from=u.from||f<=u.to||h){let O=Math.max(u.from,a)-h,d=Math.min(u.to,f)-h;u=O>=d?null:new i(O,d,u.tree,u.offset+h,l>0,!!c)}if(u&&r.push(u),o.to>f)break;o=snew ze(r.from,r.to)):[new ze(0,0)]:[new ze(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let r=this.startParse(e,t,n);for(;;){let s=r.advance();if(s)return s}}},Pa=class{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}};function Cs(i){return(e,t,n,r)=>new Xa(e,i,t,n,r)}var Ps=class{constructor(e,t,n,r,s,o){this.parser=e,this.parse=t,this.overlay=n,this.bracketed=r,this.target=s,this.from=o}};function PO(i){if(!i.length||i.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(i))}var Ta=class{constructor(e,t,n,r,s,o,l,a){this.parser=e,this.predicate=t,this.mounts=n,this.index=r,this.start=s,this.bracketed=o,this.target=l,this.prev=a,this.depth=0,this.ranges=[]}},Ca=new E({perNode:!0}),Xa=class{constructor(e,t,n,r,s){this.nest=t,this.input=n,this.fragments=r,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let n=this.baseParse.advance();if(!n)return null;if(this.baseParse=null,this.baseTree=n,this.startInner(),this.stoppedAt!=null)for(let r of this.inner)r.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let n=this.baseTree;return this.stoppedAt!=null&&(n=new j(n.type,n.children,n.positions,n.length,n.propValues.concat([[Ca,this.stoppedAt]]))),n}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let n=Object.assign(Object.create(null),e.target.props);n[E.mounted.id]=new Nt(t,e.overlay,e.parser,e.bracketed),e.target.props=n}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t=this.stoppedAt)l=!1;else if(e.hasNode(r)){if(t){let h=t.mounts.find(c=>c.frag.from<=r.from&&c.frag.to>=r.to&&c.mount.overlay);if(h)for(let c of h.mount.overlay){let f=c.from+h.pos,u=c.to+h.pos;f>=r.from&&u<=r.to&&!t.ranges.some(O=>O.fromf)&&t.ranges.push({from:f,to:u})}}l=!1}else if(n&&(o=o1(n.ranges,r.from,r.to)))l=o!=2;else if(!r.type.isAnonymous&&(s=this.nest(r,this.input))&&(r.fromnew ze(f.from-r.from,f.to-r.from)):null,!!s.bracketed,r.tree,c.length?c[0].from:r.from)),s.overlay?c.length&&(n={ranges:c,depth:0,prev:n}):l=!1}}else if(t&&(a=t.predicate(r))&&(a===!0&&(a=new ze(r.from,r.to)),a.from=0&&t.ranges[h].to==a.from?t.ranges[h]={from:t.ranges[h].from,to:a.to}:t.ranges.push(a)}if(l&&r.firstChild())t&&t.depth++,n&&n.depth++;else for(;!r.nextSibling();){if(!r.parent())break e;if(t&&!--t.depth){let h=CO(this.ranges,t.ranges);h.length&&(PO(h),this.inner.splice(t.index,0,new Ps(t.parser,t.parser.startParse(this.input,XO(t.mounts,h),h),t.ranges.map(c=>new ze(c.from-t.start,c.to-t.start)),t.bracketed,t.target,h[0].from))),t=t.prev}n&&!--n.depth&&(n=n.prev)}}}};function o1(i,e,t){for(let n of i){if(n.from>=t)break;if(n.to>e)return n.from<=e&&n.to>=t?2:1}return 0}function TO(i,e,t,n,r,s){if(e=e&&t.enter(n,1,I.IgnoreOverlays|I.ExcludeBuffers)||t.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof j)t=t.children[0];else break}return!1}},Ra=class{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let n=this.curFrag=e[0];this.curTo=(t=n.tree.prop(Ca))!==null&&t!==void 0?t:n.to,this.inner=new Ts(n.tree,-n.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(Ca))!==null&&e!==void 0?e:t.to,this.inner=new Ts(t.tree,-t.offset)}}findMounts(e,t){var n;let r=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let s=this.inner.cursor.node;s;s=s.parent){let o=(n=s.tree)===null||n===void 0?void 0:n.prop(E.mounted);if(o&&o.parser==t)for(let l=this.fragI;l=s.to)break;a.tree==this.curFrag.tree&&r.push({frag:a,pos:s.from-a.offset,mount:o})}}}return r}};function CO(i,e){let t=null,n=e;for(let r=1,s=0;r=l)break;a.to<=o||(t||(n=t=e.slice()),a.froml&&t.splice(s+1,0,new ze(l,a.to))):a.to>l?t[s--]=new ze(l,a.to):t.splice(s--,1))}}return n}function a1(i,e,t,n){let r=0,s=0,o=!1,l=!1,a=-1e9,h=[];for(;;){let c=r==i.length?1e9:o?i[r].to:i[r].from,f=s==e.length?1e9:l?e[s].to:e[s].from;if(o!=l){let u=Math.max(a,t),O=Math.min(c,f,n);unew ze(u.from+n,u.to+n)),f=a1(e,c,a,h);for(let u=0,O=a;;u++){let d=u==f.length,m=d?h:f[u].from;if(m>O&&t.push(new Xt(O,m,r.tree,-o,s.from>=O||s.openStart,s.to<=m||s.openEnd)),d)break;O=f[u].to}}else t.push(new Xt(a,h,r.tree,-o,s.from>=o||s.openStart,s.to<=l||s.openEnd))}return t}var h1=0,Be=class i{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=h1++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let n=typeof e=="string"?e:"?";if(e instanceof i&&(t=e),t?.base)throw new Error("Can not derive from a modified tag");let r=new i(n,[],null,[]);if(r.set.push(r),t)for(let s of t.set)r.set.push(s);return r}static defineModifier(e){let t=new Zs(e);return n=>n.modified.indexOf(t)>-1?n:Zs.get(n.base||n,n.modified.concat(t).sort((r,s)=>r.id-s.id))}},c1=0,Zs=class i{constructor(e){this.name=e,this.instances=[],this.id=c1++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(l=>l.base==e&&f1(t,l.modified));if(n)return n;let r=[],s=new Be(e.name,r,e,t);for(let l of t)l.instances.push(s);let o=u1(t);for(let l of e.set)if(!l.modified.length)for(let a of o)r.push(i.get(l,a));return s}};function f1(i,e){return i.length==e.length&&i.every((t,n)=>t==e[n])}function u1(i){let e=[[]];for(let t=0;tn.length-t.length)}function Qe(i){let e=Object.create(null);for(let t in i){let n=i[t];Array.isArray(n)||(n=[n]);for(let r of t.split(" "))if(r){let s=[],o=2,l=r;for(let f=0;;){if(l=="..."&&f>0&&f+3==r.length){o=1;break}let u=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!u)throw new RangeError("Invalid path: "+r);if(s.push(u[0]=="*"?"":u[0][0]=='"'?JSON.parse(u[0]):u[0]),f+=u[0].length,f==r.length)break;let O=r[f++];if(f==r.length&&O=="!"){o=0;break}if(O!="/")throw new RangeError("Invalid path: "+r);l=r.slice(f)}let a=s.length-1,h=s[a];if(!h)throw new RangeError("Invalid path: "+r);let c=new vi(n,o,a>0?s.slice(0,a):null);e[h]=c.sort(e[h])}}return MO.add(e)}var MO=new E({combine(i,e){let t,n,r;for(;i||e;){if(!i||e&&i.depth>=e.depth?(r=e,e=e.next):(r=i,i=i.next),t&&t.mode==r.mode&&!r.context&&!t.context)continue;let s=new vi(r.tags,r.mode,r.context);t?t.next=s:n=s,t=s}return n}}),vi=class{constructor(e,t,n,r){this.tags=e,this.mode=t,this.context=n,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let o=r;for(let l of s)for(let a of l.set){let h=t[a.id];if(h){o=o?o+" "+h:h;break}}return o},scope:n}}function O1(i,e){let t=null;for(let n of i){let r=n.style(e);r&&(t=t?t+" "+r:r)}return t}function Ea(i,e,t,n=0,r=i.length){let s=new Ma(n,Array.isArray(e)?e:[e],t);s.highlightRange(i.cursor(),n,r,"",s.highlighters),s.flush(r)}var Ma=class{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,r,s){let{type:o,from:l,to:a}=e;if(l>=n||a<=t)return;o.isTop&&(s=this.highlighters.filter(O=>!O.scope||O.scope(o)));let h=r,c=d1(e)||vi.empty,f=O1(s,c.tags);if(f&&(h&&(h+=" "),h+=f,c.mode==1&&(r+=(r?" ":"")+f)),this.startSpan(Math.max(t,l),h),c.opaque)return;let u=e.tree&&e.tree.prop(E.mounted);if(u&&u.overlay){let O=e.node.enter(u.overlay[0].from+l,1),d=this.highlighters.filter(g=>!g.scope||g.scope(u.tree.type)),m=e.firstChild();for(let g=0,S=l;;g++){let b=g=y||!e.nextSibling())););if(!b||y>n)break;S=b.to+l,S>t&&(this.highlightRange(O.cursor(),Math.max(t,b.from+l),Math.min(n,S),"",d),this.startSpan(Math.min(n,S),h))}m&&e.parent()}else if(e.firstChild()){u&&(r="");do if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,r,s),this.startSpan(Math.min(n,e.to),h)}while(e.nextSibling());e.parent()}}};function d1(i){let e=i.type.prop(MO);for(;e&&e.context&&!i.matchContext(e.context);)e=e.next;return e||null}var R=Be.define,Xs=R(),Ht=R(),ZO=R(Ht),qO=R(Ht),Kt=R(),Rs=R(Kt),qa=R(Kt),bt=R(),wi=R(bt),St=R(),Qt=R(),_a=R(),Nn=R(_a),As=R(),p={comment:Xs,lineComment:R(Xs),blockComment:R(Xs),docComment:R(Xs),name:Ht,variableName:R(Ht),typeName:ZO,tagName:R(ZO),propertyName:qO,attributeName:R(qO),className:R(Ht),labelName:R(Ht),namespace:R(Ht),macroName:R(Ht),literal:Kt,string:Rs,docString:R(Rs),character:R(Rs),attributeValue:R(Rs),number:qa,integer:R(qa),float:R(qa),bool:R(Kt),regexp:R(Kt),escape:R(Kt),color:R(Kt),url:R(Kt),keyword:St,self:R(St),null:R(St),atom:R(St),unit:R(St),modifier:R(St),operatorKeyword:R(St),controlKeyword:R(St),definitionKeyword:R(St),moduleKeyword:R(St),operator:Qt,derefOperator:R(Qt),arithmeticOperator:R(Qt),logicOperator:R(Qt),bitwiseOperator:R(Qt),compareOperator:R(Qt),updateOperator:R(Qt),definitionOperator:R(Qt),typeOperator:R(Qt),controlOperator:R(Qt),punctuation:_a,separator:R(_a),bracket:Nn,angleBracket:R(Nn),squareBracket:R(Nn),paren:R(Nn),brace:R(Nn),content:bt,heading:wi,heading1:R(wi),heading2:R(wi),heading3:R(wi),heading4:R(wi),heading5:R(wi),heading6:R(wi),contentSeparator:R(bt),list:R(bt),quote:R(bt),emphasis:R(bt),strong:R(bt),link:R(bt),monospace:R(bt),strikethrough:R(bt),inserted:R(),deleted:R(),changed:R(),invalid:R(),meta:As,documentMeta:R(As),annotation:R(As),processingInstruction:R(As),definition:Be.defineModifier("definition"),constant:Be.defineModifier("constant"),function:Be.defineModifier("function"),standard:Be.defineModifier("standard"),local:Be.defineModifier("local"),special:Be.defineModifier("special")};for(let i in p){let e=p[i];e instanceof Be&&(e.name=i)}var MP=za([{tag:p.link,class:"tok-link"},{tag:p.heading,class:"tok-heading"},{tag:p.emphasis,class:"tok-emphasis"},{tag:p.strong,class:"tok-strong"},{tag:p.keyword,class:"tok-keyword"},{tag:p.atom,class:"tok-atom"},{tag:p.bool,class:"tok-bool"},{tag:p.url,class:"tok-url"},{tag:p.labelName,class:"tok-labelName"},{tag:p.inserted,class:"tok-inserted"},{tag:p.deleted,class:"tok-deleted"},{tag:p.literal,class:"tok-literal"},{tag:p.string,class:"tok-string"},{tag:p.number,class:"tok-number"},{tag:[p.regexp,p.escape,p.special(p.string)],class:"tok-string2"},{tag:p.variableName,class:"tok-variableName"},{tag:p.local(p.variableName),class:"tok-variableName tok-local"},{tag:p.definition(p.variableName),class:"tok-variableName tok-definition"},{tag:p.special(p.variableName),class:"tok-variableName2"},{tag:p.definition(p.propertyName),class:"tok-propertyName tok-definition"},{tag:p.typeName,class:"tok-typeName"},{tag:p.namespace,class:"tok-namespace"},{tag:p.className,class:"tok-className"},{tag:p.macroName,class:"tok-macroName"},{tag:p.propertyName,class:"tok-propertyName"},{tag:p.operator,class:"tok-operator"},{tag:p.comment,class:"tok-comment"},{tag:p.meta,class:"tok-meta"},{tag:p.invalid,class:"tok-invalid"},{tag:p.punctuation,class:"tok-punctuation"}]);var Wa,At=new E;function ln(i){return A.define({combine:i?e=>e.concat(i):void 0})}var Es=new E,ke=class{constructor(e,t,n=[],r=""){this.data=e,this.name=r,F.prototype.hasOwnProperty("tree")||Object.defineProperty(F.prototype,"tree",{get(){return B(this)}}),this.parser=t,this.extension=[Jt.of(this),F.languageData.of((s,o,l)=>{let a=_O(s,o,l),h=a.type.prop(At);if(!h)return[];let c=s.facet(h),f=a.type.prop(Es);if(f){let u=a.resolve(o-a.from,l);for(let O of f)if(O.test(u,s)){let d=s.facet(O.facet);return O.type=="replace"?d:d.concat(c)}}return c})].concat(n)}isActiveAt(e,t,n=-1){return _O(e,t,n).type.prop(At)==this.data}findRegions(e){let t=e.facet(Jt);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],r=(s,o)=>{if(s.prop(At)==this.data){n.push({from:o,to:o+s.length});return}let l=s.prop(E.mounted);if(l){if(l.tree.prop(At)==this.data){if(l.overlay)for(let a of l.overlay)n.push({from:a.from+o,to:a.to+o});else n.push({from:o,to:o+s.length});return}else if(l.overlay){let a=n.length;if(r(l.tree,l.overlay[0].from+o),n.length>a)return}}for(let a=0;an.isTop?t:void 0)]}),e.name)}configure(e,t){return new i(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}};function B(i){let e=i.field(ke.state,!1);return e?e.tree:j.empty}var Da=class{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}},Un=null,$i=class i{constructor(e,t,n=[],r,s,o,l,a){this.parser=e,this.state=t,this.fragments=n,this.tree=r,this.treeLen=s,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new i(e,t,[],j.empty,0,n,[],null)}startParse(){return this.parser.startParse(new Da(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=j.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if(typeof e=="number"){let r=Date.now()+e;e=()=>Date.now()>r}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(Xt.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=Un;Un=this;try{return e()}finally{Un=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=zO(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:r,treeLen:s,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let a=[];if(e.iterChangedRanges((h,c,f,u)=>a.push({fromA:h,toA:c,fromB:f,toB:u})),n=Xt.applyChanges(n,a),r=j.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let h of this.skipped){let c=e.mapPos(h.from,1),f=e.mapPos(h.to,-1);ce.from&&(this.fragments=zO(this.fragments,r,s),this.skipped.splice(n--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends Rt{createParse(t,n,r){let s=r[0].from,o=r[r.length-1].to;return{parsedPos:s,advance(){let a=Un;if(a){for(let h of r)a.tempSkipped.push(h);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=o,new j(re.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return Un}};function zO(i,e,t){return Xt.applyChanges(i,[{fromA:e,toA:t,fromB:e,toB:t}])}var Hn=class i{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new i(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=$i.create(e.facet(Jt).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new i(n)}};ke.state=se.define({create:Hn.init,update(i,e){for(let t of e.effects)if(t.is(ke.setState))return t.value;return e.startState.facet(Jt)!=e.state.facet(Jt)?Hn.init(e.state):i.apply(e)}});var YO=i=>{let e=setTimeout(()=>i(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(YO=i=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(i,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});var La=typeof navigator<"u"&&(!((Wa=navigator.scheduling)===null||Wa===void 0)&&Wa.isInputPending)?()=>navigator.scheduling.isInputPending():null,p1=ce.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(ke.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(ke.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=YO(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEndr+1e3,a=s.context.work(()=>La&&La()||Date.now()>o,r+(l?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:ke.setState.of(new Hn(s.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>tt(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Jt=A.define({combine(i){return i.length?i[0]:null},enables:i=>[ke.state,p1,x.contentAttributes.compute([i],e=>{let t=e.facet(i);return t&&t.name?{"data-language":t.name}:{}})]}),be=class{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}},Kn=class i{constructor(e,t,n,r,s,o=void 0){this.name=e,this.alias=t,this.extensions=n,this.filename=r,this.loadFunc=s,this.support=o,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e}))}static of(e){let{load:t,support:n}=e;if(!t){if(!n)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");t=()=>Promise.resolve(n)}return new i(e.name,(e.alias||[]).concat(e.name).map(r=>r.toLowerCase()),e.extensions||[],e.filename,t,n)}static matchFilename(e,t){for(let r of e)if(r.filename&&r.filename.test(t))return r;let n=/\.([^.]+)$/.exec(t);if(n){for(let r of e)if(r.extensions.indexOf(n[1])>-1)return r}return null}static matchLanguageName(e,t,n=!0){t=t.toLowerCase();for(let r of e)if(r.alias.some(s=>s==t))return r;if(n)for(let r of e)for(let s of r.alias){let o=t.indexOf(s);if(o>-1&&(s.length>2||!/\w/.test(t[o-1])&&!/\w/.test(t[o+s.length])))return r}return null}},m1=A.define(),ti=A.define({combine:i=>{if(!i.length)return" ";let e=i[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(i[0]));return e}});function ei(i){let e=i.facet(ti);return e.charCodeAt(0)==9?i.tabSize*e.length:e.length}function an(i,e){let t="",n=i.tabSize,r=i.facet(ti)[0];if(r==" "){for(;e>=n;)t+=" ",e-=n;r=" "}for(let s=0;s=e?g1(i,t,e):null}var Pi=class{constructor(e,t={}){this.state=e,this.options=t,this.unit=ei(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:s}=this.options;return r!=null&&r>=n.from&&r<=n.to?s&&r==e?{text:"",from:e}:(t<0?r-1&&(s+=o-this.countColumn(n,n.search(/\S|$/))),s}countColumn(e,t=e.length){return Ae(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:r}=this.lineAt(e,t),s=this.options.overrideIndentation;if(s){let o=s(r);if(o>-1)return o}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}},we=new E;function g1(i,e,t){let n=e.resolveStack(t),r=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(r!=n.node){let s=[];for(let o=r;o&&!(o.fromn.node.to||o.from==n.node.from&&o.type==n.node.type);o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)n={node:s[o],next:n}}return IO(n,i,t)}function IO(i,e,t){for(let n=i;n;n=n.next){let r=Q1(n.node);if(r)return r(Ba.create(e,t,n))}return 0}function S1(i){return i.pos==i.options.simulateBreak&&i.options.simulateDoubleBreak}function Q1(i){let e=i.type.prop(we);if(e)return e;let t=i.firstChild,n;if(t&&(n=t.type.prop(E.closedBy))){let r=i.lastChild,s=r&&n.indexOf(r.name)>-1;return o=>GO(o,!0,1,void 0,s&&!S1(o)?r.from:void 0)}return i.parent==null?b1:null}function b1(){return 0}var Ba=class i extends Pi{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new i(e,t,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(y1(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return IO(this.context.next,this.base,this.pos)}};function y1(i,e){for(let t=e;t;t=t.parent)if(i==t)return!0;return!1}function x1(i){let e=i.node,t=e.childAfter(e.from),n=e.lastChild;if(!t)return null;let r=i.options.simulateBreak,s=i.state.doc.lineAt(t.from),o=r==null||r<=s.from?s.to:Math.min(s.to,r);for(let l=t.to;;){let a=e.childAfter(l);if(!a||a==n)return null;if(!a.type.isSkipped){if(a.from>=o)return null;let h=/^ */.exec(s.text.slice(t.to-s.from))[0].length;return{from:t.from,to:t.to+h}}l=a.to}}function hn({closing:i,align:e=!0,units:t=1}){return n=>GO(n,e,t,i)}function GO(i,e,t,n,r){let s=i.textAfter,o=s.match(/^\s*/)[0].length,l=n&&s.slice(o,o+n.length)==n||r==i.pos+o,a=e?x1(i):null;return a?l?i.column(a.from):i.column(a.to):i.baseIndent+(l?0:i.unit*t)}var NO=i=>i.baseIndent;function Zt({except:i,units:e=1}={}){return t=>{let n=i&&i.test(t.textAfter);return t.baseIndent+(n?0:e*t.unit)}}var k1=200;function UO(){return F.transactionFilter.of(i=>{if(!i.docChanged||!i.isUserEvent("input.type")&&!i.isUserEvent("input.complete"))return i;let e=i.startState.languageDataAt("indentOnInput",i.startState.selection.main.head);if(!e.length)return i;let t=i.newDoc,{head:n}=i.newSelection.main,r=t.lineAt(n);if(n>r.from+k1)return i;let s=t.sliceString(r.from,n);if(!e.some(h=>h.test(s)))return i;let{state:o}=i,l=-1,a=[];for(let{head:h}of o.selection.ranges){let c=o.doc.lineAt(h);if(c.from==l)continue;l=c.from;let f=Ws(o,c.from);if(f==null)continue;let u=/^\s*/.exec(c.text)[0],O=an(o,f);u!=O&&a.push({from:c.from,to:c.from+u.length,insert:O})}return a.length?[i,{changes:a,sequential:!0}]:i})}var Ha=A.define(),ve=new E;function ii(i){let e=i.firstChild,t=i.lastChild;return e&&e.tot)continue;if(s&&l.from=e&&h.to>t&&(s=h)}}return s}function v1(i){let e=i.lastChild;return e&&e.to==i.to&&e.type.isError}function qs(i,e,t){for(let n of i.facet(Ha)){let r=n(i,e,t);if(r)return r}return w1(i,e,t)}function FO(i,e){let t=e.mapPos(i.from,1),n=e.mapPos(i.to,-1);return t>=n?void 0:{from:t,to:n}}var Ls=L.define({map:FO}),tr=L.define({map:FO});function HO(i){let e=[];for(let{head:t}of i.state.selection.ranges)e.some(n=>n.from<=t&&n.to>=t)||e.push(i.lineBlockAt(t));return e}var Ti=se.define({create(){return M.none},update(i,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((t,n)=>i=EO(i,t,n)),i=i.map(e.changes);for(let t of e.effects)if(t.is(Ls)&&!$1(i,t.value.from,t.value.to)){let{preparePlaceholder:n}=e.state.facet(Ja),r=n?M.replace({widget:new Ya(n(e.state,t.value))}):WO;i=i.update({add:[r.range(t.value.from,t.value.to)]})}else t.is(tr)&&(i=i.update({filter:(n,r)=>t.value.from!=n||t.value.to!=r,filterFrom:t.value.from,filterTo:t.value.to}));return e.selection&&(i=EO(i,e.selection.main.head)),i},provide:i=>x.decorations.from(i),toJSON(i,e){let t=[];return i.between(0,e.doc.length,(n,r)=>{t.push(n,r)}),t},fromJSON(i){if(!Array.isArray(i)||i.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t{re&&(n=!0)}),n?i.update({filterFrom:e,filterTo:t,filter:(r,s)=>r>=t||s<=e}):i}function Ms(i,e,t){var n;let r=null;return(n=i.field(Ti,!1))===null||n===void 0||n.between(e,t,(s,o)=>{(!r||r.from>s)&&(r={from:s,to:o})}),r}function $1(i,e,t){let n=!1;return i.between(e,e,(r,s)=>{r==e&&s==t&&(n=!0)}),n}function KO(i,e){return i.field(Ti,!1)?e:e.concat(L.appendConfig.of(ed()))}var P1=i=>{for(let e of HO(i)){let t=qs(i.state,e.from,e.to);if(t)return i.dispatch({effects:KO(i.state,[Ls.of(t),JO(i,t)])}),!0}return!1},T1=i=>{if(!i.state.field(Ti,!1))return!1;let e=[];for(let t of HO(i)){let n=Ms(i.state,t.from,t.to);n&&e.push(tr.of(n),JO(i,n,!1))}return e.length&&i.dispatch({effects:e}),e.length>0};function JO(i,e,t=!0){let n=i.state.doc.lineAt(e.from).number,r=i.state.doc.lineAt(e.to).number;return x.announce.of(`${i.state.phrase(t?"Folded lines":"Unfolded lines")} ${n} ${i.state.phrase("to")} ${r}.`)}var C1=i=>{let{state:e}=i,t=[];for(let n=0;n{let e=i.state.field(Ti,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,i.state.doc.length,(n,r)=>{t.push(tr.of({from:n,to:r}))}),i.dispatch({effects:t}),!0};var Ka=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:P1},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:T1},{key:"Ctrl-Alt-[",run:C1},{key:"Ctrl-Alt-]",run:X1}],R1={placeholderDOM:null,preparePlaceholder:null,placeholderText:"\u2026"},Ja=A.define({combine(i){return Ve(i,R1)}});function ed(i){let e=[Ti,Z1];return i&&e.push(Ja.of(i)),e}function td(i,e){let{state:t}=i,n=t.facet(Ja),r=o=>{let l=i.lineBlockAt(i.posAtDOM(o.target)),a=Ms(i.state,l.from,l.to);a&&i.dispatch({effects:tr.of(a)}),o.preventDefault()};if(n.placeholderDOM)return n.placeholderDOM(i,r,e);let s=document.createElement("span");return s.textContent=n.placeholderText,s.setAttribute("aria-label",t.phrase("folded code")),s.title=t.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=r,s}var WO=M.replace({widget:new class extends xe{toDOM(i){return td(i,null)}}}),Ya=class extends xe{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return td(e,this.value)}},A1={openText:"\u2304",closedText:"\u203A",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1},Fn=class extends _e{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}};function eh(i={}){let e={...A1,...i},t=new Fn(e,!0),n=new Fn(e,!1),r=ce.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(Jt)!=o.state.facet(Jt)||o.startState.field(Ti,!1)!=o.state.field(Ti,!1)||B(o.startState)!=B(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let l=new ge;for(let a of o.viewportLineBlocks){let h=Ms(o.state,a.from,a.to)?n:qs(o.state,a.from,a.to)?t:null;h&&l.add(a.from,a.from,h)}return l.finish()}}),{domEventHandlers:s}=e;return[r,ks({class:"cm-foldGutter",markers(o){var l;return((l=o.plugin(r))===null||l===void 0?void 0:l.markers)||G.empty},initialSpacer(){return new Fn(e,!1)},domEventHandlers:{...s,click:(o,l,a)=>{if(s.click&&s.click(o,l,a))return!0;let h=Ms(o.state,l.from,l.to);if(h)return o.dispatch({effects:tr.of(h)}),!0;let c=qs(o.state,l.from,l.to);return c?(o.dispatch({effects:Ls.of(c)}),!0):!1}}}),ed()]}var Z1=x.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}}),on=class i{constructor(e,t){this.specs=e;let n;function r(l){let a=Ze.newName();return(n||(n=Object.create(null)))["."+a]=l,a}let s=typeof t.all=="string"?t.all:t.all?r(t.all):void 0,o=t.scope;this.scope=o instanceof ke?l=>l.prop(At)==o.data:o?l=>l==o:void 0,this.style=za(e.map(l=>({tag:l.tag,class:l.class||r(Object.assign({},l,{tag:null}))})),{all:s}).style,this.module=n?new Ze(n):null,this.themeType=t.themeType}static define(e,t){return new i(e,t||{})}},Ia=A.define(),id=A.define({combine(i){return i.length?[i[0]]:null}});function ja(i){let e=i.facet(Ia);return e.length?e:i.facet(id)}function ir(i,e){let t=[q1],n;return i instanceof on&&(i.module&&t.push(x.styleModule.of(i.module)),n=i.themeType),e?.fallback?t.push(id.of(i)):n?t.push(Ia.computeN([x.darkTheme],r=>r.facet(x.darkTheme)==(n=="dark")?[i]:[])):t.push(Ia.of(i)),t}var Ga=class{constructor(e){this.markCache=Object.create(null),this.tree=B(e.state),this.decorations=this.buildDeco(e,ja(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=B(e.state),n=ja(e.state),r=n!=ja(e.startState),{viewport:s}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||r)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=s.to)}buildDeco(e,t){if(!t||!this.tree.length)return M.none;let n=new ge;for(let{from:r,to:s}of e.visibleRanges)Ea(this.tree,t,(o,l,a)=>{n.add(o,l,this.markCache[a]||(this.markCache[a]=M.mark({class:a})))},r,s);return n.finish()}},q1=Te.high(ce.fromClass(Ga,{decorations:i=>i.decorations})),th=on.define([{tag:p.meta,color:"#404740"},{tag:p.link,textDecoration:"underline"},{tag:p.heading,textDecoration:"underline",fontWeight:"bold"},{tag:p.emphasis,fontStyle:"italic"},{tag:p.strong,fontWeight:"bold"},{tag:p.strikethrough,textDecoration:"line-through"},{tag:p.keyword,color:"#708"},{tag:[p.atom,p.bool,p.url,p.contentSeparator,p.labelName],color:"#219"},{tag:[p.literal,p.inserted],color:"#164"},{tag:[p.string,p.deleted],color:"#a11"},{tag:[p.regexp,p.escape,p.special(p.string)],color:"#e40"},{tag:p.definition(p.variableName),color:"#00f"},{tag:p.local(p.variableName),color:"#30a"},{tag:[p.typeName,p.namespace],color:"#085"},{tag:p.className,color:"#167"},{tag:[p.special(p.variableName),p.macroName],color:"#256"},{tag:p.definition(p.propertyName),color:"#00c"},{tag:p.comment,color:"#940"},{tag:p.invalid,color:"#f00"}]),M1=x.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),nd=1e4,rd="()[]{}",sd=A.define({combine(i){return Ve(i,{afterCursor:!0,brackets:rd,maxScanDistance:nd,renderMatch:E1})}}),_1=M.mark({class:"cm-matchingBracket"}),z1=M.mark({class:"cm-nonmatchingBracket"});function E1(i){let e=[],t=i.matched?_1:z1;return e.push(t.range(i.start.from,i.start.to)),i.end&&e.push(t.range(i.end.from,i.end.to)),e}function LO(i){let e=[],t=i.facet(sd);for(let n of i.selection.ranges){if(!n.empty)continue;let r=ht(i,n.head,-1,t)||n.head>0&&ht(i,n.head-1,1,t)||t.afterCursor&&(ht(i,n.head,1,t)||n.headi.decorations}),L1=[W1,M1];function ih(i={}){return[sd.of(i),L1]}var nr=new E;function Na(i,e,t){let n=i.prop(e<0?E.openedBy:E.closedBy);if(n)return n;if(i.name.length==1){let r=t.indexOf(i.name);if(r>-1&&r%2==(e<0?1:0))return[t[r+e]]}return null}function Ua(i){let e=i.type.prop(nr);return e?e(i.node):i}function ht(i,e,t,n={}){let r=n.maxScanDistance||nd,s=n.brackets||rd,o=B(i),l=o.resolveInner(e,t);for(let a=l;a;a=a.parent){let h=Na(a.type,t,s);if(h&&a.from0?e>=c.from&&ec.from&&e<=c.to))return j1(i,e,t,a,c,h,s)}}return V1(i,e,t,o,l.type,r,s)}function j1(i,e,t,n,r,s,o){let l=n.parent,a={from:r.from,to:r.to},h=0,c=l?.cursor();if(c&&(t<0?c.childBefore(n.from):c.childAfter(n.to)))do if(t<0?c.to<=n.from:c.from>=n.to){if(h==0&&s.indexOf(c.type.name)>-1&&c.from0)return null;let h={from:t<0?e-1:e,to:t>0?e+1:e},c=i.doc.iterRange(e,t>0?i.doc.length:0),f=0;for(let u=0;!c.next().done&&u<=s;){let O=c.value;t<0&&(u+=O.length);let d=e+u*t;for(let m=t>0?0:O.length-1,g=t>0?O.length:-1;m!=g;m+=t){let S=o.indexOf(O[m]);if(!(S<0||n.resolveInner(d+m,1).type!=r))if(S%2==0==t>0)f++;else{if(f==1)return{start:h,end:{from:d+m,to:d+m+1},matched:S>>1==a>>1};f--}}t>0&&(u+=O.length)}return c.done?{start:h,matched:!1}:null}function jO(i,e,t,n=0,r=0){e==null&&(e=i.search(/[^\s\u00a0]/),e==-1&&(e=i.length));let s=r;for(let o=n;o=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.post}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPosn?o.toLowerCase():o,s=this.string.substr(this.pos,e.length);return r(s)==r(e)?(t!==!1&&(this.pos+=e.length),!0):null}else{let r=this.string.slice(this.pos).match(e);return r&&r.index>0?null:(r&&t!==!1&&(this.pos+=r[0].length),r)}}current(){return this.string.slice(this.start,this.pos)}};function D1(i){return{name:i.name||"",token:i.token,blankLine:i.blankLine||(()=>{}),startState:i.startState||(()=>!0),copyState:i.copyState||B1,indent:i.indent||(()=>null),languageData:i.languageData||{},tokenTable:i.tokenTable||rh,mergeTokens:i.mergeTokens!==!1}}function B1(i){if(typeof i!="object")return i;let e={};for(let t in i){let n=i[t];e[t]=n instanceof Array?n.slice():n}return e}var VO=new WeakMap,Jn=class i extends ke{constructor(e){let t=ln(e.languageData),n=D1(e),r,s=new class extends Rt{createParse(o,l,a){return new Fa(r,o,l,a)}};super(t,s,[],e.name),this.topNode=N1(t,this),r=this,this.streamParser=n,this.stateAfter=new E({perNode:!0}),this.tokenTable=e.tokenTable?new zs(n.tokenTable):G1}static define(e){return new i(e)}getIndent(e){let t,{overrideIndentation:n}=e.options;n&&(t=VO.get(e.state),t!=null&&t1e4)return null;for(;s=n&&t+e.length<=r&&e.prop(i.stateAfter);if(s)return{state:i.streamParser.copyState(s),pos:t+e.length};for(let o=e.children.length-1;o>=0;o--){let l=e.children[o],a=t+e.positions[o],h=l instanceof j&&a=e.length)return e;!r&&t==0&&e.type==i.topNode&&(r=!0);for(let s=e.children.length-1;s>=0;s--){let o=e.positions[s],l=e.children[s],a;if(ot&&nh(i,s.tree,0-s.offset,t,l),h;if(a&&a.pos<=n&&(h=od(i,s.tree,t+s.offset,a.pos+s.offset,!1)))return{state:a.state,tree:h}}return{state:i.streamParser.startState(r?ei(r):4),tree:j.empty}}var Fa=class{constructor(e,t,n,r){this.lang=e,this.input=t,this.fragments=n,this.ranges=r,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=r[r.length-1].to;let s=$i.get(),o=r[0].from,{state:l,tree:a}=Y1(e,n,o,this.to,s?.state);this.state=l,this.parsedPos=this.chunkStart=o+a.length;for(let h=0;hh.from<=s.viewport.from&&h.to>=s.viewport.from)&&(this.state=this.lang.streamParser.startState(ei(s.state)),s.skipUntilInView(this.parsedPos,s.viewport.from),this.parsedPos=s.viewport.from),this.moveRangeIndex()}advance(){let e=$i.get(),t=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),n=Math.min(t,this.chunkStart+512);for(e&&(n=Math.min(n,e.viewport.to));this.parsedPos=t?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,t),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let t=this.input.chunk(e);if(this.input.lineChunks)t==` +`&&(t="");else{let n=t.indexOf(` +`);n>-1&&(t=t.slice(0,n))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),n=e+t.length;for(let r=this.rangeIndex;;){let s=this.ranges[r].to;if(s>=n||(t=t.slice(0,s-(n-t.length)),r++,r==this.ranges.length))break;let o=this.ranges[r].from,l=this.lineAfter(o);t+=l,n=o+l.length}return{line:t,end:n}}skipGapsTo(e,t,n){for(;;){let r=this.ranges[this.rangeIndex].to,s=e+t;if(n>0?r>s:r>=s)break;let o=this.ranges[++this.rangeIndex].from;t+=o-r}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){r=this.skipGapsTo(t,r,1),t+=r;let l=this.chunk.length;r=this.skipGapsTo(n,r,-1),n+=r,s+=this.chunk.length-l}let o=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&s==4&&o>=0&&this.chunk[o]==e&&this.chunk[o+2]==t?this.chunk[o+2]=n:this.chunk.push(e,t,n,s),r}parseLine(e){let{line:t,end:n}=this.nextLine(),r=0,{streamParser:s}=this.lang,o=new _s(t,e?e.state.tabSize:4,e?ei(e.state):2);if(o.eol())s.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let l=ld(s.token,o,this.state);if(l&&(r=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+o.start,this.parsedPos+o.pos,r)),o.start>1e4)break}this.parsedPos=n,this.moveRangeIndex(),this.parsedPose.start)return r}throw new Error("Stream parser failed to advance stream.")}var rh=Object.create(null),er=[re.none],I1=new Ct(er),DO=[],BO=Object.create(null),ad=Object.create(null);for(let[i,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])ad[i]=hd(rh,e);var zs=class{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),ad)}resolve(e){return e?this.table[e]||(this.table[e]=hd(this.extra,e)):0}},G1=new zs(rh);function Va(i,e){DO.indexOf(i)>-1||(DO.push(i),console.warn(e))}function hd(i,e){let t=[];for(let l of e.split(" ")){let a=[];for(let h of l.split(".")){let c=i[h]||p[h];c?typeof c=="function"?a.length?a=a.map(c):Va(h,`Modifier ${h} used at start of tag`):a.length?Va(h,`Tag ${h} used as modifier`):a=Array.isArray(c)?c:[c]:Va(h,`Unknown highlighting tag ${h}`)}for(let h of a)t.push(h)}if(!t.length)return 0;let n=e.replace(/ /g,"_"),r=n+" "+t.map(l=>l.id),s=BO[r];if(s)return s.id;let o=BO[r]=re.define({id:er.length,name:n,props:[Qe({[n]:t})]});return er.push(o),o.id}function N1(i,e){let t=re.define({id:er.length,name:"Document",props:[At.add(()=>i),we.add(()=>n=>e.getIndent(n))],top:!0});return er.push(t),t}var DP={rtl:M.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"rtl"},bidiIsolate:J.RTL}),ltr:M.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"ltr"},bidiIsolate:J.LTR}),auto:M.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"auto"},bidiIsolate:null})};var U1=i=>{let{state:e}=i,t=e.doc.lineAt(e.selection.main.from),n=fh(i.state,t.from);return n.line?F1(i):n.block?K1(i):!1};function ch(i,e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=i(e,t);return r?(n(t.update(r)),!0):!1}}var F1=ch(tb,0);var H1=ch(Sd,0);var K1=ch((i,e)=>Sd(i,e,eb(e)),0);function fh(i,e){let t=i.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}var rr=50;function J1(i,{open:e,close:t},n,r){let s=i.sliceDoc(n-rr,n),o=i.sliceDoc(r,r+rr),l=/\s*$/.exec(s)[0].length,a=/^\s*/.exec(o)[0].length,h=s.length-l;if(s.slice(h-e.length,h)==e&&o.slice(a,a+t.length)==t)return{open:{pos:n-l,margin:l&&1},close:{pos:r+a,margin:a&&1}};let c,f;r-n<=2*rr?c=f=i.sliceDoc(n,r):(c=i.sliceDoc(n,n+rr),f=i.sliceDoc(r-rr,r));let u=/^\s*/.exec(c)[0].length,O=/\s*$/.exec(f)[0].length,d=f.length-O-t.length;return c.slice(u,u+e.length)==e&&f.slice(d,d+t.length)==t?{open:{pos:n+u+e.length,margin:/\s/.test(c.charAt(u+e.length))?1:0},close:{pos:r-O-t.length,margin:/\s/.test(f.charAt(d-1))?1:0}}:null}function eb(i){let e=[];for(let t of i.selection.ranges){let n=i.doc.lineAt(t.from),r=t.to<=n.to?n:i.doc.lineAt(t.to);r.from>n.from&&r.from==t.to&&(r=t.to==n.to+1?n:i.doc.lineAt(t.to-1));let s=e.length-1;s>=0&&e[s].to>n.from?e[s].to=r.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:r.to})}return e}function Sd(i,e,t=e.selection.ranges){let n=t.map(s=>fh(e,s.from).block);if(!n.every(s=>s))return null;let r=t.map((s,o)=>J1(e,n[o],s.from,s.to));if(i!=2&&!r.every(s=>s))return{changes:e.changes(t.map((s,o)=>r[o]?[]:[{from:s.from,insert:n[o].open+" "},{from:s.to,insert:" "+n[o].close}]))};if(i!=1&&r.some(s=>s)){let s=[];for(let o=0,l;or&&(s==o||o>f.from)){r=f.from;let u=/^\s*/.exec(f.text)[0].length,O=u==f.length,d=f.text.slice(u,u+h.length)==h?u:-1;us.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:l,token:a,indent:h,empty:c,single:f}of n)(f||!c)&&s.push({from:l.from+h,insert:a+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(i!=1&&n.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:l,token:a}of n)if(l>=0){let h=o.from+l,c=h+a.length;o.text[c-o.from]==" "&&c++,s.push({from:h,to:c})}return{changes:s}}return null}var oh=Re.define(),ib=Re.define(),nb=A.define(),Qd=A.define({combine(i){return Ve(i,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}}),bd=se.define({create(){return Ci.empty},update(i,e){let t=e.state.facet(Qd),n=e.annotation(oh);if(n){let a=ct.fromTransaction(e,n.selection),h=n.side,c=h==0?i.undone:i.done;return a?c=Vs(c,c.length,t.minDepth,a):c=wd(c,e.startState.selection),new Ci(h==0?n.rest:c,h==0?c:n.rest)}let r=e.annotation(ib);if((r=="full"||r=="before")&&(i=i.isolate()),e.annotation(ae.addToHistory)===!1)return e.changes.empty?i:i.addMapping(e.changes.desc);let s=ct.fromTransaction(e),o=e.annotation(ae.time),l=e.annotation(ae.userEvent);return s?i=i.addChanges(s,o,l,t,e):e.selection&&(i=i.addSelection(e.startState.selection,o,l,t.newGroupDelay)),(r=="full"||r=="after")&&(i=i.isolate()),i},toJSON(i){return{done:i.done.map(e=>e.toJSON()),undone:i.undone.map(e=>e.toJSON())}},fromJSON(i){return new Ci(i.done.map(ct.fromJSON),i.undone.map(ct.fromJSON))}});function yd(i={}){return[bd,Qd.of(i),x.domEventHandlers({beforeinput(e,t){let n=e.inputType=="historyUndo"?xd:e.inputType=="historyRedo"?lh:null;return n?(e.preventDefault(),n(t)):!1}})]}function Ds(i,e){return function({state:t,dispatch:n}){if(!e&&t.readOnly)return!1;let r=t.field(bd,!1);if(!r)return!1;let s=r.pop(i,t,e);return s?(n(s),!0):!1}}var xd=Ds(0,!1),lh=Ds(1,!1),rb=Ds(0,!0),sb=Ds(1,!0);var ct=class i{constructor(e,t,n,r,s){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=s}setSelAfter(e){return new i(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(r=>r.toJSON())}}static fromJSON(e){return new i(e.changes&&me.fromJSON(e.changes),[],e.mapped&&wt.fromJSON(e.mapped),e.startSelection&&Q.fromJSON(e.startSelection),e.selectionsAfter.map(Q.fromJSON))}static fromTransaction(e,t){let n=it;for(let r of e.startState.facet(nb)){let s=r(e);s.length&&(n=n.concat(s))}return!n.length&&e.changes.empty?null:new i(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,it)}static selection(e){return new i(void 0,it,void 0,void 0,e)}};function Vs(i,e,t,n){let r=e+1>t+20?e-t-1:0,s=i.slice(r,e);return s.push(n),s}function ob(i,e){let t=[],n=!1;return i.iterChangedRanges((r,s)=>t.push(r,s)),e.iterChangedRanges((r,s,o,l)=>{for(let a=0;a=h&&o<=c&&(n=!0)}}),n}function lb(i,e){return i.ranges.length==e.ranges.length&&i.ranges.filter((t,n)=>t.empty!=e.ranges[n].empty).length===0}function kd(i,e){return i.length?e.length?i.concat(e):i:e}var it=[],ab=200;function wd(i,e){if(i.length){let t=i[i.length-1],n=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-ab));return n.length&&n[n.length-1].eq(e)?i:(n.push(e),Vs(i,i.length-1,1e9,t.setSelAfter(n)))}else return[ct.selection([e])]}function hb(i){let e=i[i.length-1],t=i.slice();return t[i.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function sh(i,e){if(!i.length)return i;let t=i.length,n=it;for(;t;){let r=cb(i[t-1],e,n);if(r.changes&&!r.changes.empty||r.effects.length){let s=i.slice(0,t);return s[t-1]=r,s}else e=r.mapped,t--,n=r.selectionsAfter}return n.length?[ct.selection(n)]:it}function cb(i,e,t){let n=kd(i.selectionsAfter.length?i.selectionsAfter.map(l=>l.map(e)):it,t);if(!i.changes)return ct.selection(n);let r=i.changes.map(e),s=e.mapDesc(i.changes,!0),o=i.mapped?i.mapped.composeDesc(s):s;return new ct(r,L.mapEffects(i.effects,e),o,i.startSelection.map(s),n)}var fb=/^(input\.type|delete)($|\.)/,Ci=class i{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new i(this.done,this.undone):this}addChanges(e,t,n,r,s){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!n||fb.test(n))&&(!l.selectionsAfter.length&&t-this.prevTime0&&t-this.prevTimet.empty?i.moveByChar(t,e):Bs(t,e))}function $e(i){return i.textDirectionAt(i.state.selection.main.head)==J.LTR}var Pd=i=>$d(i,!$e(i)),Td=i=>$d(i,$e(i));function Cd(i,e){return ut(i,t=>t.empty?i.moveByGroup(t,e):Bs(t,e))}var ub=i=>Cd(i,!$e(i)),Ob=i=>Cd(i,$e(i));var eT=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function db(i,e,t){if(e.type.prop(t))return!0;let n=e.to-e.from;return n&&(n>2||/[^\s,.;:]/.test(i.sliceDoc(e.from,e.to)))||e.firstChild}function Ys(i,e,t){let n=B(i).resolveInner(e.head),r=t?E.closedBy:E.openedBy;for(let a=e.head;;){let h=t?n.childAfter(a):n.childBefore(a);if(!h)break;db(i,h,r)?n=h:a=t?h.to:h.from}let s=n.type.prop(r),o,l;return s&&(o=t?ht(i,n.from,1):ht(i,n.to,-1))&&o.matched?l=t?o.end.to:o.end.from:l=t?n.to:n.from,Q.cursor(l,t?-1:1)}var pb=i=>ut(i,e=>Ys(i.state,e,!$e(i))),mb=i=>ut(i,e=>Ys(i.state,e,$e(i)));function Xd(i,e){return ut(i,t=>{if(!t.empty)return Bs(t,e);let n=i.moveVertically(t,e);return n.head!=t.head?n:i.moveToLineBoundary(t,e)})}var Rd=i=>Xd(i,!1),Ad=i=>Xd(i,!0);function Zd(i){let e=i.scrollDOM.clientHeighto.empty?i.moveVertically(o,e,t.height):Bs(o,e));if(r.eq(n.selection))return!1;let s;if(t.selfScroll){let o=i.coordsAtPos(n.selection.main.head),l=i.scrollDOM.getBoundingClientRect(),a=l.top+t.marginTop,h=l.bottom-t.marginBottom;o&&o.top>a&&o.bottomqd(i,!1),ah=i=>qd(i,!0);function ni(i,e,t){let n=i.lineBlockAt(e.head),r=i.moveToLineBoundary(e,t);if(r.head==e.head&&r.head!=(t?n.to:n.from)&&(r=i.moveToLineBoundary(e,t,!1)),!t&&r.head==n.from&&n.length){let s=/^\s*/.exec(i.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;s&&e.head!=n.from+s&&(r=Q.cursor(n.from+s))}return r}var gb=i=>ut(i,e=>ni(i,e,!0)),Sb=i=>ut(i,e=>ni(i,e,!1)),Qb=i=>ut(i,e=>ni(i,e,!$e(i))),bb=i=>ut(i,e=>ni(i,e,$e(i))),yb=i=>ut(i,e=>Q.cursor(i.lineBlockAt(e.head).from,1)),xb=i=>ut(i,e=>Q.cursor(i.lineBlockAt(e.head).to,-1));function kb(i,e,t){let n=!1,r=cn(i.selection,s=>{let o=ht(i,s.head,-1)||ht(i,s.head,1)||s.head>0&&ht(i,s.head-1,1)||s.headkb(i,e,!1);function nt(i,e){let t=cn(i.state.selection,n=>{let r=e(n);return Q.range(n.anchor,r.head,r.goalColumn,r.bidiLevel||void 0,r.assoc)});return t.eq(i.state.selection)?!1:(i.dispatch(ft(i.state,t)),!0)}function Md(i,e){return nt(i,t=>i.moveByChar(t,e))}var _d=i=>Md(i,!$e(i)),zd=i=>Md(i,$e(i));function Ed(i,e){return nt(i,t=>i.moveByGroup(t,e))}var vb=i=>Ed(i,!$e(i)),$b=i=>Ed(i,$e(i));var Pb=i=>nt(i,e=>Ys(i.state,e,!$e(i))),Tb=i=>nt(i,e=>Ys(i.state,e,$e(i)));function Wd(i,e){return nt(i,t=>i.moveVertically(t,e))}var Ld=i=>Wd(i,!1),jd=i=>Wd(i,!0);function Vd(i,e){return nt(i,t=>i.moveVertically(t,e,Zd(i).height))}var fd=i=>Vd(i,!1),ud=i=>Vd(i,!0),Cb=i=>nt(i,e=>ni(i,e,!0)),Xb=i=>nt(i,e=>ni(i,e,!1)),Rb=i=>nt(i,e=>ni(i,e,!$e(i))),Ab=i=>nt(i,e=>ni(i,e,$e(i))),Zb=i=>nt(i,e=>Q.cursor(i.lineBlockAt(e.head).from)),qb=i=>nt(i,e=>Q.cursor(i.lineBlockAt(e.head).to)),Od=({state:i,dispatch:e})=>(e(ft(i,{anchor:0})),!0),dd=({state:i,dispatch:e})=>(e(ft(i,{anchor:i.doc.length})),!0),pd=({state:i,dispatch:e})=>(e(ft(i,{anchor:i.selection.main.anchor,head:0})),!0),md=({state:i,dispatch:e})=>(e(ft(i,{anchor:i.selection.main.anchor,head:i.doc.length})),!0),Mb=({state:i,dispatch:e})=>(e(i.update({selection:{anchor:0,head:i.doc.length},userEvent:"select"})),!0),_b=({state:i,dispatch:e})=>{let t=Is(i).map(({from:n,to:r})=>Q.range(n,Math.min(r+1,i.doc.length)));return e(i.update({selection:Q.create(t),userEvent:"select"})),!0},zb=({state:i,dispatch:e})=>{let t=cn(i.selection,n=>{let r=B(i),s=r.resolveStack(n.from,1);if(n.empty){let o=r.resolveStack(n.from,-1);o.node.from>=s.node.from&&o.node.to<=s.node.to&&(s=o)}for(let o=s;o;o=o.next){let{node:l}=o;if((l.from=n.to||l.to>n.to&&l.from<=n.from)&&o.next)return Q.range(l.to,l.from)}return n});return t.eq(i.selection)?!1:(e(ft(i,t)),!0)};function Dd(i,e){let{state:t}=i,n=t.selection,r=t.selection.ranges.slice();for(let s of t.selection.ranges){let o=t.doc.lineAt(s.head);if(e?o.to0)for(let l=s;;){let a=i.moveVertically(l,e);if(a.heado.to){r.some(h=>h.head==a.head)||r.push(a);break}else{if(a.head==l.head)break;l=a}}}return r.length==n.ranges.length?!1:(i.dispatch(ft(t,Q.create(r,r.length-1))),!0)}var Eb=i=>Dd(i,!1),Wb=i=>Dd(i,!0),Lb=({state:i,dispatch:e})=>{let t=i.selection,n=null;return t.ranges.length>1?n=Q.create([t.main]):t.main.empty||(n=Q.create([Q.cursor(t.main.head)])),n?(e(ft(i,n)),!0):!1};function sr(i,e){if(i.state.readOnly)return!1;let t="delete.selection",{state:n}=i,r=n.changeByRange(s=>{let{from:o,to:l}=s;if(o==l){let a=e(s);ao&&(t="delete.forward",a=js(i,a,!0)),o=Math.min(o,a),l=Math.max(l,a)}else o=js(i,o,!1),l=js(i,l,!0);return o==l?{range:s}:{changes:{from:o,to:l},range:Q.cursor(o,or(i)))n.between(e,e,(r,s)=>{re&&(e=t?s:r)});return e}var Bd=(i,e,t)=>sr(i,n=>{let r=n.from,{state:s}=i,o=s.doc.lineAt(r),l,a;if(t&&!e&&r>o.from&&rBd(i,!1,!0);var Yd=i=>Bd(i,!0,!1),Id=(i,e)=>sr(i,t=>{let n=t.head,{state:r}=i,s=r.doc.lineAt(n),o=r.charCategorizer(n);for(let l=null;;){if(n==(e?s.to:s.from)){n==t.head&&s.number!=(e?r.doc.lines:1)&&(n+=e?1:-1);break}let a=oe(s.text,n-s.from,e)+s.from,h=s.text.slice(Math.min(n,a)-s.from,Math.max(n,a)-s.from),c=o(h);if(l!=null&&c!=l)break;(h!=" "||n!=t.head)&&(l=c),n=a}return n}),Gd=i=>Id(i,!1),jb=i=>Id(i,!0);var Vb=i=>sr(i,e=>{let t=i.lineBlockAt(e.head).to;return e.headsr(i,e=>{let t=i.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),Bb=i=>sr(i,e=>{let t=i.moveToLineBoundary(e,!0).head;return e.head{if(i.readOnly)return!1;let t=i.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:D.of(["",""])},range:Q.cursor(n.from)}));return e(i.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},Ib=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let t=i.changeByRange(n=>{if(!n.empty||n.from==0||n.from==i.doc.length)return{range:n};let r=n.from,s=i.doc.lineAt(r),o=r==s.from?r-1:oe(s.text,r-s.from,!1)+s.from,l=r==s.to?r+1:oe(s.text,r-s.from,!0)+s.from;return{changes:{from:o,to:l,insert:i.doc.slice(r,l).append(i.doc.slice(o,r))},range:Q.cursor(l)}});return t.changes.empty?!1:(e(i.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Is(i){let e=[],t=-1;for(let n of i.selection.ranges){let r=i.doc.lineAt(n.from),s=i.doc.lineAt(n.to);if(!n.empty&&n.to==s.from&&(s=i.doc.lineAt(n.to-1)),t>=r.number){let o=e[e.length-1];o.to=s.to,o.ranges.push(n)}else e.push({from:r.from,to:s.to,ranges:[n]});t=s.number+1}return e}function Nd(i,e,t){if(i.readOnly)return!1;let n=[],r=[];for(let s of Is(i)){if(t?s.to==i.doc.length:s.from==0)continue;let o=i.doc.lineAt(t?s.to+1:s.from-1),l=o.length+1;if(t){n.push({from:s.to,to:o.to},{from:s.from,insert:o.text+i.lineBreak});for(let a of s.ranges)r.push(Q.range(Math.min(i.doc.length,a.anchor+l),Math.min(i.doc.length,a.head+l)))}else{n.push({from:o.from,to:s.from},{from:s.to,insert:i.lineBreak+o.text});for(let a of s.ranges)r.push(Q.range(a.anchor-l,a.head-l))}}return n.length?(e(i.update({changes:n,scrollIntoView:!0,selection:Q.create(r,i.selection.mainIndex),userEvent:"move.line"})),!0):!1}var Gb=({state:i,dispatch:e})=>Nd(i,e,!1),Nb=({state:i,dispatch:e})=>Nd(i,e,!0);function Ud(i,e,t){if(i.readOnly)return!1;let n=[];for(let s of Is(i))t?n.push({from:s.from,insert:i.doc.slice(s.from,s.to)+i.lineBreak}):n.push({from:s.to,insert:i.lineBreak+i.doc.slice(s.from,s.to)});let r=i.changes(n);return e(i.update({changes:r,selection:i.selection.map(r,t?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}var Ub=({state:i,dispatch:e})=>Ud(i,e,!1),Fb=({state:i,dispatch:e})=>Ud(i,e,!0),Hb=i=>{if(i.state.readOnly)return!1;let{state:e}=i,t=e.changes(Is(e).map(({from:r,to:s})=>(r>0?r--:s{let s;if(i.lineWrapping){let o=i.lineBlockAt(r.head),l=i.coordsAtPos(r.head,r.assoc||1);l&&(s=o.bottom+i.documentTop-l.bottom+i.defaultLineHeight/2)}return i.moveVertically(r,!0,s)}).map(t);return i.dispatch({changes:t,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0};function Kb(i,e){if(/\(\)|\[\]|\{\}/.test(i.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=B(i).resolveInner(e),n=t.childBefore(e),r=t.childAfter(e),s;return n&&r&&n.to<=e&&r.from>=e&&(s=n.type.prop(E.closedBy))&&s.indexOf(r.name)>-1&&i.doc.lineAt(n.to).from==i.doc.lineAt(r.from).from&&!/\S/.test(i.sliceDoc(n.to,r.from))?{from:n.to,to:r.from}:null}var gd=Fd(!1),Jb=Fd(!0);function Fd(i){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>{let{from:s,to:o}=r,l=e.doc.lineAt(s),a=!i&&s==o&&Kb(e,s);i&&(s=o=(o<=l.to?l:e.doc.lineAt(o)).to);let h=new Pi(e,{simulateBreak:s,simulateDoubleBreak:!!a}),c=Ws(h,s);for(c==null&&(c=Ae(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));ol.from&&s{let r=[];for(let o=n.from;o<=n.to;){let l=i.doc.lineAt(o);l.number>t&&(n.empty||n.to>l.from)&&(e(l,r,n),t=l.number),o=l.to+1}let s=i.changes(r);return{changes:r,range:Q.range(s.mapPos(n.anchor,1),s.mapPos(n.head,1))}})}var ey=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let t=Object.create(null),n=new Pi(i,{overrideIndentation:s=>{let o=t[s];return o??-1}}),r=uh(i,(s,o,l)=>{let a=Ws(n,s.from);if(a==null)return;/\S/.test(s.text)||(a=0);let h=/^\s*/.exec(s.text)[0],c=an(i,a);(h!=c||l.fromi.readOnly?!1:(e(i.update(uh(i,(t,n)=>{n.push({from:t.from,insert:i.facet(ti)})}),{userEvent:"input.indent"})),!0),Kd=({state:i,dispatch:e})=>i.readOnly?!1:(e(i.update(uh(i,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let s=Ae(r,i.tabSize),o=0,l=an(i,Math.max(0,s-ei(i)));for(;o(i.setTabFocusMode(),!0);var iy=[{key:"Ctrl-b",run:Pd,shift:_d,preventDefault:!0},{key:"Ctrl-f",run:Td,shift:zd},{key:"Ctrl-p",run:Rd,shift:Ld},{key:"Ctrl-n",run:Ad,shift:jd},{key:"Ctrl-a",run:yb,shift:Zb},{key:"Ctrl-e",run:xb,shift:qb},{key:"Ctrl-d",run:Yd},{key:"Ctrl-h",run:hh},{key:"Ctrl-k",run:Vb},{key:"Ctrl-Alt-h",run:Gd},{key:"Ctrl-o",run:Yb},{key:"Ctrl-t",run:Ib},{key:"Ctrl-v",run:ah}],ny=[{key:"ArrowLeft",run:Pd,shift:_d,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:ub,shift:vb,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Qb,shift:Rb,preventDefault:!0},{key:"ArrowRight",run:Td,shift:zd,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Ob,shift:$b,preventDefault:!0},{mac:"Cmd-ArrowRight",run:bb,shift:Ab,preventDefault:!0},{key:"ArrowUp",run:Rd,shift:Ld,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Od,shift:pd},{mac:"Ctrl-ArrowUp",run:cd,shift:fd},{key:"ArrowDown",run:Ad,shift:jd,preventDefault:!0},{mac:"Cmd-ArrowDown",run:dd,shift:md},{mac:"Ctrl-ArrowDown",run:ah,shift:ud},{key:"PageUp",run:cd,shift:fd},{key:"PageDown",run:ah,shift:ud},{key:"Home",run:Sb,shift:Xb,preventDefault:!0},{key:"Mod-Home",run:Od,shift:pd},{key:"End",run:gb,shift:Cb,preventDefault:!0},{key:"Mod-End",run:dd,shift:md},{key:"Enter",run:gd,shift:gd},{key:"Mod-a",run:Mb},{key:"Backspace",run:hh,shift:hh,preventDefault:!0},{key:"Delete",run:Yd,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Gd,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:jb,preventDefault:!0},{mac:"Mod-Backspace",run:Db,preventDefault:!0},{mac:"Mod-Delete",run:Bb,preventDefault:!0}].concat(iy.map(i=>({mac:i.key,run:i.run,shift:i.shift}))),Oh=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:pb,shift:Pb},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:mb,shift:Tb},{key:"Alt-ArrowUp",run:Gb},{key:"Shift-Alt-ArrowUp",run:Ub},{key:"Alt-ArrowDown",run:Nb},{key:"Shift-Alt-ArrowDown",run:Fb},{key:"Mod-Alt-ArrowUp",run:Eb},{key:"Mod-Alt-ArrowDown",run:Wb},{key:"Escape",run:Lb},{key:"Mod-Enter",run:Jb},{key:"Alt-l",mac:"Ctrl-l",run:_b},{key:"Mod-i",run:zb,preventDefault:!0},{key:"Mod-[",run:Kd},{key:"Mod-]",run:Hd},{key:"Mod-Alt-\\",run:ey},{key:"Shift-Mod-k",run:Hb},{key:"Shift-Mod-\\",run:wb},{key:"Mod-/",run:U1},{key:"Alt-A",run:H1},{key:"Ctrl-m",mac:"Shift-Alt-m",run:ty}].concat(ny),Jd={key:"Tab",run:Hd,shift:Kd};var ep=typeof String.prototype.normalize=="function"?i=>i.normalize("NFKD"):i=>i,si=class{constructor(e,t,n=0,r=e.length,s,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=s?l=>s(ep(l)):ep,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return st(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=Yr(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=Vt(e);let r=this.normalize(t);if(r.length)for(let s=0,o=n;;s++){let l=r.charCodeAt(s),a=this.match(l,o,this.bufferPos+this.bufferStart);if(s==r.length-1){if(a)return this.value=a,this;break}o==n&&sthis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=Ks(this.text,r+(n==r?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(nthis.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=n||r.to<=t){let l=new i(t,e.sliceString(t,n));return dh.set(e,l),l}if(r.from==t&&r.to==n)return r;let{text:s,from:o}=r;return o>t&&(s=e.sliceString(t,o)+s,o=t),r.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let n=this.flat.from+t.index,r=n+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,match:t},this.matchPos=Ks(this.text,r+(n==r?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Fs.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<"u"&&(Us.prototype[Symbol.iterator]=Hs.prototype[Symbol.iterator]=function(){return this});function ry(i){try{return new RegExp(i,Qh),!0}catch{return!1}}function Ks(i,e){if(e>=i.length)return e;let t=i.lineAt(e),n;for(;e=56320&&n<57344;)e++;return e}var sy=i=>{let{state:e}=i,t=String(e.doc.lineAt(i.state.selection.main.head).number),{close:n,result:r}=QO(i,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:t},focus:!0,submitLabel:e.phrase("go")});return r.then(s=>{let o=s&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(s.elements.line.value);if(!o){i.dispatch({effects:n});return}let l=e.doc.lineAt(e.selection.main.head),[,a,h,c,f]=o,u=c?+c.slice(1):0,O=h?+h:l.number;if(h&&f){let g=O/100;a&&(g=g*(a=="-"?-1:1)+l.number/e.doc.lines),O=Math.round(e.doc.lines*g)}else h&&a&&(O=O*(a=="-"?-1:1)+l.number);let d=e.doc.line(Math.max(1,Math.min(e.doc.lines,O))),m=Q.cursor(d.from+Math.max(0,Math.min(u,d.length)));i.dispatch({effects:[n,x.scrollIntoView(m.from,{y:"center"})],selection:m})}),!0},oy={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},rp=A.define({combine(i){return Ve(i,oy,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function bh(i){let e=[fy,cy];return i&&e.push(rp.of(i)),e}var ly=M.mark({class:"cm-selectionMatch"}),ay=M.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function tp(i,e,t,n){return(t==0||i(e.sliceDoc(t-1,t))!=H.Word)&&(n==e.doc.length||i(e.sliceDoc(n,n+1))!=H.Word)}function hy(i,e,t,n){return i(e.sliceDoc(t,t+1))==H.Word&&i(e.sliceDoc(n-1,n))==H.Word}var cy=ce.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){(i.selectionSet||i.docChanged||i.viewportChanged)&&(this.decorations=this.getDeco(i.view))}getDeco(i){let e=i.state.facet(rp),{state:t}=i,n=t.selection;if(n.ranges.length>1)return M.none;let r=n.main,s,o=null;if(r.empty){if(!e.highlightWordAroundCursor)return M.none;let a=t.wordAt(r.head);if(!a)return M.none;o=t.charCategorizer(r.head),s=t.sliceDoc(a.from,a.to)}else{let a=r.to-r.from;if(a200)return M.none;if(e.wholeWords){if(s=t.sliceDoc(r.from,r.to),o=t.charCategorizer(r.head),!(tp(o,t,r.from,r.to)&&hy(o,t,r.from,r.to)))return M.none}else if(s=t.sliceDoc(r.from,r.to),!s)return M.none}let l=[];for(let a of i.visibleRanges){let h=new si(t.doc,s,a.from,a.to);for(;!h.next().done;){let{from:c,to:f}=h.value;if((!o||tp(o,t,c,f))&&(r.empty&&c<=r.from&&f>=r.to?l.push(ay.range(c,f)):(c>=r.to||f<=r.from)&&l.push(ly.range(c,f)),l.length>e.maxMatches))return M.none}}return M.set(l)}},{decorations:i=>i.decorations}),fy=x.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),uy=({state:i,dispatch:e})=>{let{selection:t}=i,n=Q.create(t.ranges.map(r=>i.wordAt(r.head)||Q.cursor(r.head)),t.mainIndex);return n.eq(t)?!1:(e(i.update({selection:n})),!0)};function Oy(i,e){let{main:t,ranges:n}=i.selection,r=i.wordAt(t.head),s=r&&r.from==t.from&&r.to==t.to;for(let o=!1,l=new si(i.doc,e,n[n.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new si(i.doc,e,0,Math.max(0,n[n.length-1].from-1)),o=!0}else{if(o&&n.some(a=>a.from==l.value.from))continue;if(s){let a=i.wordAt(l.value.from);if(!a||a.from!=l.value.from||a.to!=l.value.to)continue}return l.value}}var dy=({state:i,dispatch:e})=>{let{ranges:t}=i.selection;if(t.some(s=>s.from===s.to))return uy({state:i,dispatch:e});let n=i.sliceDoc(t[0].from,t[0].to);if(i.selection.ranges.some(s=>i.sliceDoc(s.from,s.to)!=n))return!1;let r=Oy(i,n);return r?(e(i.update({selection:i.selection.addRange(Q.range(r.from,r.to),!1),effects:x.scrollIntoView(r.to)})),!0):!1},On=A.define({combine(i){return Ve(i,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Sh(e),scrollToMatch:e=>x.scrollIntoView(e)})}});var Js=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||ry(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,n)=>n=="n"?` +`:n=="r"?"\r":n=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new mh(this):new ph(this)}getCursor(e,t=0,n){let r=e.doc?e:F.create({doc:e});return n==null&&(n=r.doc.length),this.regexp?un(this,r,t,n):fn(this,r,t,n)}},eo=class{constructor(e){this.spec=e}};function py(i,e,t){return(n,r,s,o)=>{if(t&&!t(n,r,s,o))return!1;let l=n>=o&&r<=o+s.length?s.slice(n-o,r-o):e.doc.sliceString(n,r);return i(l,e,n,r)}}function fn(i,e,t,n){let r;return i.wholeWord&&(r=my(e.doc,e.charCategorizer(e.selection.main.head))),i.test&&(r=py(i.test,e,r)),new si(e.doc,i.unquoted,t,n,i.caseSensitive?void 0:s=>s.toLowerCase(),r)}function my(i,e){return(t,n,r,s)=>((s>t||s+r.length=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let s=fn(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)r(s.value.from,s.value.to)}};function gy(i,e,t){return(n,r,s)=>(!t||t(n,r,s))&&i(s[0],e,n,r)}function un(i,e,t,n){let r;return i.wholeWord&&(r=Sy(e.charCategorizer(e.selection.main.head))),i.test&&(r=gy(i.test,e,r)),new Us(e.doc,i.search,{ignoreCase:!i.caseSensitive,test:r},t,n)}function to(i,e){return i.slice(oe(i,e,!1),e)}function io(i,e){return i.slice(e,oe(i,e))}function Sy(i){return(e,t,n)=>!n[0].length||(i(to(n.input,n.index))!=H.Word||i(io(n.input,n.index))!=H.Word)&&(i(io(n.input,n.index+n[0].length))!=H.Word||i(to(n.input,n.index+n[0].length))!=H.Word)}var mh=class extends eo{nextMatch(e,t,n){let r=un(this.spec,e,n,e.doc.length).next();return r.done&&(r=un(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let s=Math.max(t,n-r*1e4),o=un(this.spec,e,s,n),l=null;for(;!o.next().done;)l=o.value;if(l&&(s==t||l.from>s+10))return l;if(s==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n=="&")return e.match[0];if(n=="$")return"$";for(let r=n.length;r>0;r--){let s=+n.slice(0,r);if(s>0&&s=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let s=un(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!s.next().done;)r(s.value.from,s.value.to)}},lr=L.define(),yh=L.define(),ri=se.define({create(i){return new or(gh(i).create(),null)},update(i,e){for(let t of e.effects)t.is(lr)?i=new or(t.value.create(),i.panel):t.is(yh)&&(i=new or(i.query,t.value?xh:null));return i},provide:i=>Yn.from(i,e=>e.panel)});var or=class{constructor(e,t){this.query=e,this.panel=t}},Qy=M.mark({class:"cm-searchMatch"}),by=M.mark({class:"cm-searchMatch cm-searchMatch-selected"}),yy=ce.fromClass(class{constructor(i){this.view=i,this.decorations=this.highlight(i.state.field(ri))}update(i){let e=i.state.field(ri);(e!=i.startState.field(ri)||i.docChanged||i.selectionSet||i.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:i,panel:e}){if(!e||!i.spec.valid)return M.none;let{view:t}=this,n=new ge;for(let r=0,s=t.visibleRanges,o=s.length;rs[r+1].from-500;)a=s[++r].to;i.highlight(t.state,l,a,(h,c)=>{let f=t.state.selection.ranges.some(u=>u.from==h&&u.to==c);n.add(h,c,f?by:Qy)})}return n.finish()}},{decorations:i=>i.decorations});function ar(i){return e=>{let t=e.state.field(ri,!1);return t&&t.query.spec.valid?i(e,t):hr(e)}}var no=ar((i,{query:e})=>{let{to:t}=i.state.selection.main,n=e.nextMatch(i.state,t,t);if(!n)return!1;let r=Q.single(n.from,n.to),s=i.state.facet(On);return i.dispatch({selection:r,effects:[wh(i,n),s.scrollToMatch(r.main,i)],userEvent:"select.search"}),op(i),!0}),ro=ar((i,{query:e})=>{let{state:t}=i,{from:n}=t.selection.main,r=e.prevMatch(t,n,n);if(!r)return!1;let s=Q.single(r.from,r.to),o=i.state.facet(On);return i.dispatch({selection:s,effects:[wh(i,r),o.scrollToMatch(s.main,i)],userEvent:"select.search"}),op(i),!0}),xy=ar((i,{query:e})=>{let t=e.matchAll(i.state,1e3);return!t||!t.length?!1:(i.dispatch({selection:Q.create(t.map(n=>Q.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),ky=({state:i,dispatch:e})=>{let t=i.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:n,to:r}=t.main,s=[],o=0;for(let l=new si(i.doc,i.sliceDoc(n,r));!l.next().done;){if(s.length>1e3)return!1;l.value.from==n&&(o=s.length),s.push(Q.range(l.value.from,l.value.to))}return e(i.update({selection:Q.create(s,o),userEvent:"select.search.matches"})),!0},ip=ar((i,{query:e})=>{let{state:t}=i,{from:n,to:r}=t.selection.main;if(t.readOnly)return!1;let s=e.nextMatch(t,n,n);if(!s)return!1;let o=s,l=[],a,h,c=[];o.from==n&&o.to==r&&(h=t.toText(e.getReplacement(o)),l.push({from:o.from,to:o.to,insert:h}),o=e.nextMatch(t,o.from,o.to),c.push(x.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(n).number)+".")));let f=i.state.changes(l);return o&&(a=Q.single(o.from,o.to).map(f),c.push(wh(i,o)),c.push(t.facet(On).scrollToMatch(a.main,i))),i.dispatch({changes:f,selection:a,effects:c,userEvent:"input.replace"}),!0}),wy=ar((i,{query:e})=>{if(i.state.readOnly)return!1;let t=e.matchAll(i.state,1e9).map(r=>{let{from:s,to:o}=r;return{from:s,to:o,insert:e.getReplacement(r)}});if(!t.length)return!1;let n=i.state.phrase("replaced $ matches",t.length)+".";return i.dispatch({changes:t,effects:x.announce.of(n),userEvent:"input.replace.all"}),!0});function xh(i){return i.state.facet(On).createPanel(i)}function gh(i,e){var t,n,r,s,o;let l=i.selection.main,a=l.empty||l.to>l.from+100?"":i.sliceDoc(l.from,l.to);if(e&&!a)return e;let h=i.facet(On);return new Js({search:((t=e?.literal)!==null&&t!==void 0?t:h.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:(n=e?.caseSensitive)!==null&&n!==void 0?n:h.caseSensitive,literal:(r=e?.literal)!==null&&r!==void 0?r:h.literal,regexp:(s=e?.regexp)!==null&&s!==void 0?s:h.regexp,wholeWord:(o=e?.wholeWord)!==null&&o!==void 0?o:h.wholeWord})}function sp(i){let e=ya(i,xh);return e&&e.dom.querySelector("[main-field]")}function op(i){let e=sp(i);e&&e==i.root.activeElement&&e.select()}var hr=i=>{let e=i.state.field(ri,!1);if(e&&e.panel){let t=sp(i);if(t&&t!=i.root.activeElement){let n=gh(i.state,e.query.spec);n.valid&&i.dispatch({effects:lr.of(n)}),t.focus(),t.select()}}else i.dispatch({effects:[yh.of(!0),e?lr.of(gh(i.state,e.query.spec)):L.appendConfig.of($y)]});return!0},lp=i=>{let e=i.state.field(ri,!1);if(!e||!e.panel)return!1;let t=ya(i,xh);return t&&t.dom.contains(i.root.activeElement)&&i.focus(),i.dispatch({effects:yh.of(!1)}),!0},kh=[{key:"Mod-f",run:hr,scope:"editor search-panel"},{key:"F3",run:no,shift:ro,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:no,shift:ro,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:lp,scope:"editor search-panel"},{key:"Mod-Shift-l",run:ky},{key:"Mod-Alt-g",run:sy},{key:"Mod-d",run:dy,preventDefault:!0}],Sh=class{constructor(e){this.view=e;let t=this.query=e.state.field(ri).query.spec;this.commit=this.commit.bind(this),this.searchField=le("input",{value:t.search,placeholder:Ye(e,"Find"),"aria-label":Ye(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=le("input",{value:t.replace,placeholder:Ye(e,"Replace"),"aria-label":Ye(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=le("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=le("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=le("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function n(r,s,o){return le("button",{class:"cm-button",name:r,onclick:s,type:"button"},o)}this.dom=le("div",{onkeydown:r=>this.keydown(r),class:"cm-search"},[this.searchField,n("next",()=>no(e),[Ye(e,"next")]),n("prev",()=>ro(e),[Ye(e,"previous")]),n("select",()=>xy(e),[Ye(e,"all")]),le("label",null,[this.caseField,Ye(e,"match case")]),le("label",null,[this.reField,Ye(e,"regexp")]),le("label",null,[this.wordField,Ye(e,"by word")]),...e.state.readOnly?[]:[le("br"),this.replaceField,n("replace",()=>ip(e),[Ye(e,"replace")]),n("replaceAll",()=>wy(e),[Ye(e,"replace all")])],le("button",{name:"close",onclick:()=>lp(e),"aria-label":Ye(e,"close"),type:"button"},["\xD7"])])}commit(){let e=new Js({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:lr.of(e)}))}keydown(e){uO(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?ro:no)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),ip(this.view))}update(e){for(let t of e.transactions)for(let n of t.effects)n.is(lr)&&!n.value.eq(this.query)&&this.setQuery(n.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(On).top}};function Ye(i,e){return i.state.phrase(e)}var Gs=30,Ns=/[\s\.,:;?!]/;function wh(i,{from:e,to:t}){let n=i.state.doc.lineAt(e),r=i.state.doc.lineAt(t).to,s=Math.max(n.from,e-Gs),o=Math.min(r,t+Gs),l=i.state.sliceDoc(s,o);if(s!=n.from){for(let a=0;al.length-Gs;a--)if(!Ns.test(l[a-1])&&Ns.test(l[a])){l=l.slice(0,a);break}}return x.announce.of(`${i.state.phrase("current match")}. ${l} ${i.state.phrase("on line")} ${n.number}.`)}var vy=x.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),$y=[ri,Te.low(yy),vy];var so=class{constructor(e,t,n,r){this.state=e,this.pos=t,this.explicit=n,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=B(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),r=t.text.slice(n-t.from,this.pos-t.from),s=r.search(Ty(e,!1));return s<0?null:{from:n+s,to:this.pos,text:r.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}};function ap(i){let e=Object.keys(i).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function Py(i){let e=Object.create(null),t=Object.create(null);for(let{label:r}of i){e[r[0]]=!0;for(let s=1;stypeof r=="string"?{label:r}:r),[t,n]=e.every(r=>/^\w+$/.test(r.label))?[/\w*$/,/\w+$/]:Py(e);return r=>{let s=r.matchBefore(n);return s||r.explicit?{from:s?s.from:r.pos,options:e,validFor:t}:null}}function lo(i,e){return t=>{for(let n=B(t.state).resolveInner(t.pos,-1);n;n=n.parent){if(i.indexOf(n.name)>-1)return null;if(n.type.isTop)break}return e(t)}}function Ty(i,e){var t;let{source:n}=i,r=e&&n[0]!="^",s=n[n.length-1]!="$";return!r&&!s?i:new RegExp(`${r?"^":""}(?:${n})${s?"$":""}`,(t=i.flags)!==null&&t!==void 0?t:i.ignoreCase?"i":"")}var Cy=Re.define();var OT=typeof navigator=="object"&&/Win/.test(navigator.platform);var Xy=x.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"\xB7\xB7\xB7"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25CB'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25CC'"}},".cm-completionIcon-variable":{"&:after":{content:"'\u{1D465}'"}},".cm-completionIcon-constant":{"&:after":{content:"'\u{1D436}'"}},".cm-completionIcon-type":{"&:after":{content:"'\u{1D461}'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222A'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25A1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\u{1F511}\uFE0E'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25A2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),$h=class{constructor(e,t,n,r){this.field=e,this.line=t,this.from=n,this.to=r}},Ph=class i{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(e){let t=e.mapPos(this.from,-1,de.TrackDel),n=e.mapPos(this.to,1,de.TrackDel);return t==null||n==null?null:new i(this.field,t,n)}},Th=class i{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],r=[t],s=e.doc.lineAt(t),o=/^\s*/.exec(s.text)[0];for(let a of this.lines){if(n.length){let h=o,c=/^\t*/.exec(a)[0].length;for(let f=0;fnew Ph(a.field,r[a.line]+a.from,r[a.line]+a.to));return{text:n,ranges:l}}static parse(e){let t=[],n=[],r=[],s;for(let o of e.split(/\r\n?|\n/)){for(;s=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(o);){let l=s[1]?+s[1]:null,a=s[2]||s[3]||"",h=-1,c=a.replace(/\\[{}]/g,f=>f[1]);for(let f=0;f=h&&u.field++}for(let f of r)if(f.line==n.length&&f.from>s.index){let u=s[2]?3+(s[1]||"").length:2;f.from-=u,f.to-=u}r.push(new $h(h,n.length,s.index,s.index+c.length)),o=o.slice(0,s.index)+a+o.slice(s.index+s[0].length)}o=o.replace(/\\([{}])/g,(l,a,h)=>{for(let c of r)c.line==n.length&&c.from>h&&(c.from--,c.to--);return a}),n.push(o)}return new i(n,r)}},Ry=M.widget({widget:new class extends xe{toDOM(){let i=document.createElement("span");return i.className="cm-snippetFieldPosition",i}ignoreEvent(){return!1}}}),Ay=M.mark({class:"cm-snippetField"}),dn=class i{constructor(e,t){this.ranges=e,this.active=t,this.deco=M.set(e.map(n=>(n.from==n.to?Ry:Ay).range(n.from,n.to)),!0)}map(e){let t=[];for(let n of this.ranges){let r=n.map(e);if(!r)return null;t.push(r)}return new i(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(n=>n.field==this.active&&n.from<=t.from&&n.to>=t.to))}},ur=L.define({map(i,e){return i&&i.map(e)}}),Zy=L.define(),cr=se.define({create(){return null},update(i,e){for(let t of e.effects){if(t.is(ur))return t.value;if(t.is(Zy)&&i)return new dn(i.ranges,t.value)}return i&&e.docChanged&&(i=i.map(e.changes)),i&&e.selection&&!i.selectionInsideField(e.selection)&&(i=null),i},provide:i=>x.decorations.from(i,e=>e?e.deco:M.none)});function Ch(i,e){return Q.create(i.filter(t=>t.field==e).map(t=>Q.range(t.from,t.to)))}function qy(i){let e=Th.parse(i);return(t,n,r,s)=>{let{text:o,ranges:l}=e.instantiate(t.state,r),{main:a}=t.state.selection,h={changes:{from:r,to:s==a.from?a.to:s,insert:D.of(o)},scrollIntoView:!0,annotations:n?[Cy.of(n),ae.userEvent.of("input.complete")]:void 0};if(l.length&&(h.selection=Ch(l,0)),l.some(c=>c.field>0)){let c=new dn(l,0),f=h.effects=[ur.of(c)];t.state.field(cr,!1)===void 0&&f.push(L.appendConfig.of([cr,Wy,Ly,Xy]))}t.dispatch(t.state.update(h))}}function up(i){return({state:e,dispatch:t})=>{let n=e.field(cr,!1);if(!n||i<0&&n.active==0)return!1;let r=n.active+i,s=i>0&&!n.ranges.some(o=>o.field==r+i);return t(e.update({selection:Ch(n.ranges,r),effects:ur.of(s?null:new dn(n.ranges,r)),scrollIntoView:!0})),!0}}var My=({state:i,dispatch:e})=>i.field(cr,!1)?(e(i.update({effects:ur.of(null)})),!0):!1,_y=up(1),zy=up(-1);var Ey=[{key:"Tab",run:_y,shift:zy},{key:"Escape",run:My}],hp=A.define({combine(i){return i.length?i[0]:Ey}}),Wy=Te.highest(Gt.compute([hp],i=>i.facet(hp)));function ie(i,e){return{...e,apply:qy(i)}}var Ly=x.domEventHandlers({mousedown(i,e){let t=e.state.field(cr,!1),n;if(!t||(n=e.posAtCoords({x:i.clientX,y:i.clientY}))==null)return!1;let r=t.ranges.find(s=>s.from<=n&&s.to>=n);return!r||r.field==t.active?!1:(e.dispatch({selection:Ch(t.ranges,r.field),effects:ur.of(t.ranges.some(s=>s.field>r.field)?new dn(t.ranges,r.field):null),scrollIntoView:!0}),!0)}});var fr={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Xi=L.define({map(i,e){let t=e.mapPos(i,-1,de.TrackAfter);return t??void 0}}),Xh=new class extends He{};Xh.startSide=1;Xh.endSide=-1;var Op=se.define({create(){return G.empty},update(i,e){if(i=i.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);i=i.update({filter:n=>n>=t.from&&n<=t.to})}for(let t of e.effects)t.is(Xi)&&(i=i.update({add:[Xh.range(t.value,t.value+1)]}));return i}});function dp(){return[Vy,Op]}var vh="()[]{}<>\xAB\xBB\xBB\xAB\uFF3B\uFF3D\uFF5B\uFF5D";function pp(i){for(let e=0;e{if((jy?i.composing:i.compositionStarted)||i.state.readOnly)return!1;let r=i.state.selection.main;if(n.length>2||n.length==2&&Vt(st(n,0))==1||e!=r.from||t!=r.to)return!1;let s=By(i.state,n);return s?(i.dispatch(s),!0):!1}),Dy=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let n=mp(i,i.selection.main.head).brackets||fr.brackets,r=null,s=i.changeByRange(o=>{if(o.empty){let l=Yy(i.doc,o.head);for(let a of n)if(a==l&&ao(i.doc,o.head)==pp(st(a,0)))return{changes:{from:o.head-a.length,to:o.head+a.length},range:Q.cursor(o.head-a.length)}}return{range:r=o}});return r||e(i.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!r},gp=[{key:"Backspace",run:Dy}];function By(i,e){let t=mp(i,i.selection.main.head),n=t.brackets||fr.brackets;for(let r of n){let s=pp(st(r,0));if(e==r)return s==r?Ny(i,r,n.indexOf(r+r+r)>-1,t):Iy(i,r,s,t.before||fr.before);if(e==s&&Sp(i,i.selection.main.from))return Gy(i,r,s)}return null}function Sp(i,e){let t=!1;return i.field(Op).between(0,i.doc.length,n=>{n==e&&(t=!0)}),t}function ao(i,e){let t=i.sliceString(e,e+2);return t.slice(0,Vt(st(t,0)))}function Yy(i,e){let t=i.sliceString(e-2,e);return Vt(st(t,0))==t.length?t:t.slice(1)}function Iy(i,e,t,n){let r=null,s=i.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:Xi.of(o.to+e.length),range:Q.range(o.anchor+e.length,o.head+e.length)};let l=ao(i.doc,o.head);return!l||/\s/.test(l)||n.indexOf(l)>-1?{changes:{insert:e+t,from:o.head},effects:Xi.of(o.head+e.length),range:Q.cursor(o.head+e.length)}:{range:r=o}});return r?null:i.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Gy(i,e,t){let n=null,r=i.changeByRange(s=>s.empty&&ao(i.doc,s.head)==t?{changes:{from:s.head,to:s.head+t.length,insert:t},range:Q.cursor(s.head+t.length)}:n={range:s});return n?null:i.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function Ny(i,e,t,n){let r=n.stringPrefixes||fr.stringPrefixes,s=null,o=i.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:Xi.of(l.to+e.length),range:Q.range(l.anchor+e.length,l.head+e.length)};let a=l.head,h=ao(i.doc,a),c;if(h==e){if(cp(i,a))return{changes:{insert:e+e,from:a},effects:Xi.of(a+e.length),range:Q.cursor(a+e.length)};if(Sp(i,a)){let u=t&&i.sliceDoc(a,a+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:a,to:a+u.length,insert:u},range:Q.cursor(a+u.length)}}}else{if(t&&i.sliceDoc(a-2*e.length,a)==e+e&&(c=fp(i,a-2*e.length,r))>-1&&cp(i,c))return{changes:{insert:e+e+e+e,from:a},effects:Xi.of(a+e.length),range:Q.cursor(a+e.length)};if(i.charCategorizer(a)(h)!=H.Word&&fp(i,a,r)>-1&&!Uy(i,a,e,r))return{changes:{insert:e+e,from:a},effects:Xi.of(a+e.length),range:Q.cursor(a+e.length)}}return{range:s=l}});return s?null:i.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function cp(i,e){let t=B(i).resolveInner(e+1);return t.parent&&t.from==e}function Uy(i,e,t,n){let r=B(i).resolveInner(e,-1),s=n.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=i.sliceDoc(r.from,Math.min(r.to,r.from+t.length+s)),a=l.indexOf(t);if(!a||a>-1&&n.indexOf(l.slice(0,a))>-1){let c=r.firstChild;for(;c&&c.from==r.from&&c.to-c.from>t.length+a;){if(i.sliceDoc(c.to-t.length,c.to)==t)return!1;c=c.firstChild}return!0}let h=r.to==e&&r.parent;if(!h)break;r=h}return!1}function fp(i,e,t){let n=i.charCategorizer(e);if(n(i.sliceDoc(e-1,e))!=H.Word)return e;for(let r of t){let s=e-r.length;if(i.sliceDoc(s,e)==r&&n(i.sliceDoc(s-1,s))!=H.Word)return s}return-1}var fe=class i{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}offset(e,t=e){return new i(this.fromA+e,this.toA+e,this.fromB+t,this.toB+t)}};function Ai(i,e,t,n,r,s){if(i==n)return[];let o=Eh(i,e,t,n,r,s),l=Wh(i,e+o,t,n,r+o,s);e+=o,t-=l,r+=o,s-=l;let a=t-e,h=s-r;if(!a||!h)return[new fe(e,t,r,s)];if(a>h){let f=i.slice(e,t).indexOf(n.slice(r,s));if(f>-1)return[new fe(e,e+f,r,r),new fe(e+f+h,t,s,s)]}else if(h>a){let f=n.slice(r,s).indexOf(i.slice(e,t));if(f>-1)return[new fe(e,e,r,r+f),new fe(t,t,r+f+a,s)]}if(a==1||h==1)return[new fe(e,t,r,s)];let c=zp(i,e,t,n,r,s);if(c){let[f,u,O]=c;return Ai(i,e,f,n,r,u).concat(Ai(i,f+O,t,n,u+O,s))}return Fy(i,e,t,n,r,s)}var Or=1e9,dr=0,zh=!1;function Fy(i,e,t,n,r,s){let o=t-e,l=s-r;if(Or<1e9&&Math.min(o,l)>Or*16||dr>0&&Date.now()>dr)return Math.min(o,l)>Or*64?[new fe(e,t,r,s)]:Qp(i,e,t,n,r,s);let a=Math.ceil((o+l)/2);Rh.reset(a),Ah.reset(a);let h=(O,d)=>i.charCodeAt(e+O)==n.charCodeAt(r+d),c=(O,d)=>i.charCodeAt(t-O-1)==n.charCodeAt(s-d-1),f=(o-l)%2!=0?Ah:null,u=f?null:Rh;for(let O=0;OOr||dr>0&&!(O&63)&&Date.now()>dr)return Qp(i,e,t,n,r,s);let d=Rh.advance(O,o,l,a,f,!1,h)||Ah.advance(O,o,l,a,u,!0,c);if(d)return Hy(i,e,t,e+d[0],n,r,s,r+d[1])}return[new fe(e,t,r,s)]}var Oo=class{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let t=0;tt)this.end+=2;else if(f>n)this.start+=2;else if(s){let u=r+(t-n)-a;if(u>=0&&u=t-c)return[O,r+O-u]}else{let O=t-s.vec[u];if(c>=O)return[c,f]}}}return null}},Rh=new Oo,Ah=new Oo;function Hy(i,e,t,n,r,s,o,l){let a=!1;return!gn(i,n)&&++n==t&&(a=!0),!gn(r,l)&&++l==o&&(a=!0),a?[new fe(e,t,s,o)]:Ai(i,e,n,r,s,l).concat(Ai(i,n,t,r,l,o))}function _p(i,e){let t=1,n=Math.min(i,e);for(;tt||c>s||i.slice(l,h)!=n.slice(a,c)){if(o==1)return l-e-(gn(i,l)?0:1);o=o>>1}else{if(h==t||c==s)return h-e;l=h,a=c}}}function Wh(i,e,t,n,r,s){if(e==t||r==s||i.charCodeAt(t-1)!=n.charCodeAt(s-1))return 0;let o=_p(t-e,s-r);for(let l=t,a=s;;){let h=l-o,c=a-o;if(h>1}else{if(h==e||c==r)return t-h;l=h,a=c}}}function Zh(i,e,t,n,r,s,o,l){let a=n.slice(r,s),h=null;for(;;){if(h||o=t)break;let u=i.slice(c,f),O=-1;for(;(O=a.indexOf(u,O+1))!=-1;){let d=Eh(i,f,t,n,r+O+u.length,s),m=Wh(i,e,c,n,r,r+O),g=u.length+d+m;(!h||h[2]>1}}function zp(i,e,t,n,r,s){let o=t-e,l=s-r;if(or.fromA-e&&n.toB>r.fromB-e&&(i[t-1]=new fe(n.fromA,r.toA,n.fromB,r.toB),i.splice(t--,1))}}function Ky(i,e,t){for(;;){Ep(t,1);let n=!1;for(let r=0;r3||l>3){let a=r==i.length-1?e.length:i[r+1].fromA,h=s.fromA-n,c=a-s.toA,f=yp(e,s.fromA,h),u=bp(e,s.toA,c),O=s.fromA-f,d=u-s.toA;if((!o||!l)&&O&&d){let m=Math.max(o,l),[g,S,b]=o?[e,s.fromA,s.toA]:[t,s.fromB,s.toB];m>O&&e.slice(f,s.fromA)==g.slice(b-O,b)?(s=i[r]=new fe(f,f+o,s.fromB-O,s.toB-O),f=s.fromA,u=bp(e,s.toA,a-s.toA)):m>d&&e.slice(s.toA,u)==g.slice(S,S+d)&&(s=i[r]=new fe(u-o,u,s.fromB+d,s.toB+d),u=s.toA,f=yp(e,s.fromA,s.fromA-n)),O=s.fromA-f,d=u-s.toA}if(O||d)s=i[r]=new fe(s.fromA-O,s.toA+d,s.fromB-O,s.toB+d);else if(o){if(!l){let m=kp(e,s.fromA,s.toA),g,S=m<0?-1:xp(e,s.toA,s.fromA);m>-1&&(g=m-s.fromA)<=c&&e.slice(s.fromA,m)==e.slice(s.toA,s.toA+g)?s=i[r]=s.offset(g):S>-1&&(g=s.toA-S)<=h&&e.slice(s.fromA-g,s.fromA)==e.slice(S,s.toA)&&(s=i[r]=s.offset(-g))}}else{let m=kp(t,s.fromB,s.toB),g,S=m<0?-1:xp(t,s.toB,s.fromB);m>-1&&(g=m-s.fromB)<=c&&t.slice(s.fromB,m)==t.slice(s.toB,s.toB+g)?s=i[r]=s.offset(g):S>-1&&(g=s.toB-S)<=h&&t.slice(s.fromB-g,s.fromB)==t.slice(S,s.toB)&&(s=i[r]=s.offset(-g))}}n=s.toA}return Ep(i,3),i}var Ri;try{Ri=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function Wp(i){return i>48&&i<58||i>64&&i<91||i>96&&i<123}function Lp(i,e){if(e==i.length)return 0;let t=i.charCodeAt(e);return t<192?Wp(t)?1:0:Ri?!Dp(t)||e==i.length-1?Ri.test(String.fromCharCode(t))?1:0:Ri.test(i.slice(e,e+2))?2:0:0}function jp(i,e){if(!e)return 0;let t=i.charCodeAt(e-1);return t<192?Wp(t)?1:0:Ri?!Bp(t)||e==1?Ri.test(String.fromCharCode(t))?1:0:Ri.test(i.slice(e-2,e))?2:0:0}var Vp=8;function bp(i,e,t){if(e==i.length||!jp(i,e))return e;for(let n=e,r=e+t,s=0;sr)return n;n+=o}return e}function yp(i,e,t){if(!e||!Lp(i,e))return e;for(let n=e,r=e-t,s=0;si>=55296&&i<=56319,Bp=i=>i>=56320&&i<=57343;function gn(i,e){return!e||e==i.length||!Dp(i.charCodeAt(e-1))||!Bp(i.charCodeAt(e))}function ex(i,e,t){var n;let r=t?.override;return r?r(i,e):(Or=((n=t?.scanLimit)!==null&&n!==void 0?n:1e9)>>1,dr=t?.timeout?Date.now()+t.timeout:0,zh=!1,Ky(i,e,Ai(i,0,i.length,e,0,e.length)))}function Yp(){return!zh}function Ip(i,e,t){return Jy(ex(i,e,t),i,e)}var yt=A.define({combine:i=>i[0]}),qh=L.define(),tx=A.define(),Sn=se.define({create(i){return null},update(i,e){for(let t of e.effects)t.is(qh)&&(i=t.value);for(let t of e.state.facet(tx))i=t(i,e);return i}});var mn=class i{constructor(e,t,n,r,s,o=!0){this.changes=e,this.fromA=t,this.toA=n,this.fromB=r,this.toB=s,this.precise=o}offset(e,t){return e||t?new i(this.changes,this.fromA+e,this.toA+e,this.fromB+t,this.toB+t,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,t,n){let r=Ip(e.toString(),t.toString(),n);return Gp(r,e,t,0,0,Yp())}static updateA(e,t,n,r,s){return Tp(Pp(e,r,!0,n.length),e,t,n,s)}static updateB(e,t,n,r,s){return Tp(Pp(e,r,!1,t.length),e,t,n,s)}};function wp(i,e,t,n){let r=t.lineAt(i),s=n.lineAt(e);return r.to==i&&s.to==e&&if+1&&g>u+1)break;O.push(d.offset(-h+n,-c+r)),[f,u]=vp(d.toA+n,d.toB+r,e,t),l++}o.push(new mn(O,h,Math.max(h,f),c,Math.max(c,u),s))}return o}var ho=1e3;function $p(i,e,t,n){let r=0,s=i.length;for(;;){if(r==s){let c=0,f=0;r&&({toA:c,toB:f}=i[r-1]);let u=e-(t?c:f);return[c+u,f+u]}let o=r+s>>1,l=i[o],[a,h]=t?[l.fromA,l.toA]:[l.fromB,l.toB];if(a>e)s=o;else if(h<=e)r=o+1;else return n?[l.fromA,l.fromB]:[l.toA,l.toB]}}function Pp(i,e,t,n){let r=[];return e.iterChangedRanges((s,o,l,a)=>{let h=0,c=t?e.length:n,f=0,u=t?n:e.length;s>ho&&([h,f]=$p(i,s-ho,t,!0)),o=h?r[r.length-1]={fromA:d.fromA,fromB:d.fromB,toA:c,toB:u,diffA:d.diffA+m,diffB:d.diffB+g}:r.push({fromA:h,toA:c,fromB:f,toB:u,diffA:m,diffB:g})}),r}function Tp(i,e,t,n,r){if(!i.length)return e;let s=[];for(let o=0,l=0,a=0,h=0;;o++){let c=o==i.length?null:i[o],f=c?c.fromA+l:t.length,u=c?c.fromB+a:n.length;for(;hf||g.toB+a>u))break;s.push(g.offset(l,a)),h++}if(!c)break;let O=c.toA+l+c.diffA,d=c.toB+a+c.diffB,m=Ip(t.sliceString(f,O),n.sliceString(u,d),r);for(let g of Gp(m,t,n,f,u,Yp()))s.push(g);for(l+=c.diffA,a+=c.diffB;hO&&g.fromB+a>d)break;h++}}return s}var ix={scanLimit:500},Np=ce.fromClass(class{constructor(i){({deco:this.deco,gutter:this.gutter}=Rp(i))}update(i){(i.docChanged||i.viewportChanged||nx(i.startState,i.state)||rx(i.startState,i.state))&&({deco:this.deco,gutter:this.gutter}=Rp(i.view))}},{decorations:i=>i.deco}),co=Te.low(ks({class:"cm-changeGutter",markers:i=>{var e;return((e=i.plugin(Np))===null||e===void 0?void 0:e.gutter)||G.empty}}));function nx(i,e){return i.field(Sn,!1)!=e.field(Sn,!1)}function rx(i,e){return i.facet(yt)!=e.facet(yt)}var Cp=M.line({class:"cm-changedLine"}),sx=M.mark({class:"cm-changedText"}),ox=M.mark({tagName:"ins",class:"cm-insertedLine"}),lx=M.mark({tagName:"del",class:"cm-deletedLine"}),Xp=new class extends _e{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function ax(i,e,t,n,r,s){let o=t?i.fromA:i.fromB,l=t?i.toA:i.toB,a=0;if(o!=l){r.add(o,o,Cp),r.add(o,l,t?lx:ox),s&&s.add(o,o,Xp);for(let h=e.iterRange(o,l-1),c=o;!h.next().done;){if(h.lineBreak){c++,r.add(c,c,Cp),s&&s.add(c,c,Xp);continue}let f=c+h.value.length;if(n)for(;a=c)break;(o?f.toA:f.toB)>h&&(!s||!s(i.state,f,l,a))&&ax(f,i.state.doc,o,n,l,a)}return{deco:l.finish(),gutter:a&&a.finish()}}var pn=class extends xe{constructor(e){super(),this.height=e}eq(e){return this.height==e.height}toDOM(){let e=document.createElement("div");return e.className="cm-mergeSpacer",e.style.height=this.height+"px",e}updateDOM(e){return e.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}},po=L.define({map:(i,e)=>i.map(e)}),pr=se.define({create:()=>M.none,update:(i,e)=>{for(let t of e.effects)if(t.is(po))return t.value;return i.map(e.changes)},provide:i=>x.decorations.from(i)}),fo=.01;function Ap(i,e){if(i.size!=e.size)return!1;let t=i.iter(),n=e.iter();for(;t.value;){if(t.from!=n.from||Math.abs(t.value.spec.widget.height-n.value.spec.widget.height)>1)return!1;t.next(),n.next()}return!0}function hx(i,e,t){let n=new ge,r=new ge,s=i.state.field(pr).iter(),o=e.state.field(pr).iter(),l=0,a=0,h=0,c=0,f=i.viewport,u=e.viewport;for(let g=0;;g++){let S=gfo&&(c+=v,r.add(a,a,M.widget({widget:new pn(v),block:!0,side:-1})))}if(b>l+1e3&&lf.from&&au.from){let Z=Math.min(f.from-l,u.from-a);l+=Z,a+=Z,g--}else if(S)l=S.toA,a=S.toB;else break;for(;s.value&&s.fromfo&&r.add(e.state.doc.length,e.state.doc.length,M.widget({widget:new pn(O),block:!0,side:1}));let d=n.finish(),m=r.finish();Ap(d,i.state.field(pr))||i.dispatch({effects:po.of(d)}),Ap(m,e.state.field(pr))||e.dispatch({effects:po.of(m)})}var Mh=L.define({map:(i,e)=>e.mapPos(i)});var _h=class extends xe{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let t=document.createElement("div");return t.className="cm-collapsedLines",t.textContent=e.state.phrase("$ unchanged lines",this.lines),t.addEventListener("click",n=>{let r=e.posAtDOM(n.target);e.dispatch({effects:Mh.of(r)});let{side:s,sibling:o}=e.state.facet(yt);o&&o().dispatch({effects:Mh.of(cx(r,e.state.field(Sn),s=="a"))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return"collapsed-unchanged-code"}};function cx(i,e,t){let n=0,r=0;for(let s=0;;s++){let o=s=i)return r+(i-n);[n,r]=t?[o.toA,o.toB]:[o.toB,o.toA]}}var fx=se.define({create(i){return M.none},update(i,e){i=i.map(e.changes);for(let t of e.effects)t.is(Mh)&&(i=i.update({filter:n=>n!=t.value}));return i},provide:i=>x.decorations.from(i)});function Zp({margin:i=3,minSize:e=4}){return fx.init(t=>ux(t,i,e))}function ux(i,e,t){let n=new ge,r=i.facet(yt).side=="a",s=i.field(Sn),o=1;for(let l=0;;l++){let a=l=t&&n.add(i.doc.line(h).from,i.doc.line(c).to,M.replace({widget:new _h(f),block:!0})),!a)break;o=i.doc.lineAt(Math.min(i.doc.length,r?a.toA:a.toB)).number}return n.finish()}var Ox=x.styleModule.of(new Ze({".cm-mergeView":{overflowY:"auto"},".cm-mergeViewEditors":{display:"flex",alignItems:"stretch"},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:"hidden"},".cm-merge-revert":{width:"1.6em",flexGrow:0,flexShrink:0,position:"relative"},".cm-merge-revert button":{position:"absolute",display:"block",width:"100%",boxSizing:"border-box",textAlign:"center",background:"none",border:"none",font:"inherit",cursor:"pointer"}})),dx=x.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:"auto !important",overflowY:"visible !important"},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:"rgba(160, 128, 100, .08)"},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:"rgba(100, 160, 128, .08)"},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat"},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat"},"&light.cm-merge-b .cm-changedText":{background:"linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat"},"&dark.cm-merge-b .cm-changedText":{background:"linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat"},"&.cm-merge-b .cm-deletedText":{background:"#ff000033"},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:"none"},".cm-deletedChunk":{paddingLeft:"6px","& .cm-chunkButtons":{position:"absolute",insetInlineEnd:"5px"},"& button":{border:"none",cursor:"pointer",color:"white",margin:"0 2px",borderRadius:"3px","&[name=accept]":{background:"#2a2"},"&[name=reject]":{background:"#d43"}}},".cm-collapsedLines":{padding:"5px 5px 5px 10px",cursor:"pointer","&:before":{content:'"\u299A"',marginInlineEnd:"7px"},"&:after":{content:'"\u299A"',marginInlineStart:"7px"}},"&light .cm-collapsedLines":{color:"#444",background:"linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)"},"&dark .cm-collapsedLines":{color:"#ddd",background:"linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)"},".cm-changeGutter":{width:"3px",paddingLeft:"1px"},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:"#e43"},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:"#fa9"},"&light.cm-merge-b .cm-changedLineGutter":{background:"#2b2"},"&dark.cm-merge-b .cm-changedLineGutter":{background:"#8f8"},".cm-inlineChangedLineGutter":{background:"#75d"}}),qp=new mi,uo=new mi,mo=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||ix;let t=[Te.low(Np),dx,Ox,pr,x.updateListener.of(f=>{this.measuring<0&&(f.heightChanged||f.viewportChanged)&&!f.transactions.some(u=>u.effects.some(O=>O.is(po)))&&this.measure()})],n=[yt.of({side:"a",sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(co);let r=F.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],x.editorAttributes.of({class:"cm-merge-a"}),uo.of(n),t]}),s=[yt.of({side:"b",sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&s.push(co);let o=F.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],x.editorAttributes.of({class:"cm-merge-b"}),uo.of(s),t]});this.chunks=mn.build(r.doc,o.doc,this.diffConf);let l=[Sn.init(()=>this.chunks),qp.of(e.collapseUnchanged?Zp(e.collapseUnchanged):[])];r=r.update({effects:L.appendConfig.of(l)}).state,o=o.update({effects:L.appendConfig.of(l)}).state,this.dom=document.createElement("div"),this.dom.className="cm-mergeView",this.editorDOM=this.dom.appendChild(document.createElement("div")),this.editorDOM.className="cm-mergeViewEditors";let a=e.orientation||"a-b",h=document.createElement("div");h.className="cm-mergeViewEditor";let c=document.createElement("div");c.className="cm-mergeViewEditor",this.editorDOM.appendChild(a=="a-b"?h:c),this.editorDOM.appendChild(a=="a-b"?c:h),this.a=new x({state:r,parent:h,root:e.root,dispatchTransactions:f=>this.dispatch(f,this.a)}),this.b=new x({state:o,parent:c,root:e.root,dispatchTransactions:f=>this.dispatch(f,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls=="b-to-a",e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,t){if(e.some(n=>n.docChanged)){let n=e[e.length-1],r=e.reduce((o,l)=>o.compose(l.changes),me.empty(e[0].startState.doc.length));this.chunks=t==this.a?mn.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):mn.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:qh.of(this.chunks)})]);let s=t==this.a?this.b:this.a;s.update([s.state.update({effects:qh.of(this.chunks)})]),this.scheduleMeasure()}else t.update(e)}reconfigure(e){if("diffConfig"in e&&(this.diffConf=e.diffConfig),"orientation"in e){let s=e.orientation!="b-a";if(s!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let o=this.a.dom.parentNode,l=this.b.dom.parentNode;o.remove(),l.remove(),this.editorDOM.insertBefore(s?o:l,this.editorDOM.firstChild),this.editorDOM.appendChild(s?l:o),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in e||"renderRevertControl"in e){let s=!!this.revertDOM,o=this.revertToA,l=this.renderRevert;"revertControls"in e&&(s=!!e.revertControls,o=e.revertControls=="b-to-a"),"renderRevertControl"in e&&(l=e.renderRevertControl),this.setupRevertControls(s,o,l)}let t="highlightChanges"in e,n="gutter"in e,r="collapseUnchanged"in e;if(t||n||r){let s=[],o=[];if(t||n){let l=this.a.state.facet(yt),a=n?e.gutter!==!1:l.markGutter,h=t?e.highlightChanges!==!1:l.highlightChanges;s.push(uo.reconfigure([yt.of({side:"a",sibling:()=>this.b,highlightChanges:h,markGutter:a}),a?co:[]])),o.push(uo.reconfigure([yt.of({side:"b",sibling:()=>this.a,highlightChanges:h,markGutter:a}),a?co:[]]))}if(r){let l=qp.reconfigure(e.collapseUnchanged?Zp(e.collapseUnchanged):[]);s.push(l),o.push(l)}this.a.dispatch({effects:s}),this.b.dispatch({effects:o})}this.scheduleMeasure()}setupRevertControls(e,t,n){this.revertToA=t,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=n,!e&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):e&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement("div"),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener("mousedown",r=>this.revertClicked(r)),this.revertDOM.className="cm-merge-revert"):this.revertDOM&&(this.revertDOM.textContent="")}scheduleMeasure(){if(this.measuring<0){let e=this.dom.ownerDocument.defaultView||window;this.measuring=e.requestAnimationFrame(()=>{this.measuring=-1,this.measure()})}}measure(){hx(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,t=e.firstChild,n=this.a.viewport,r=this.b.viewport;for(let s=0;sn.to||o.fromB>r.to)break;if(o.fromA-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}};function Mp(i){let e=i.nextSibling;return i.remove(),e}var px="#e5c07b",Up="#e06c75",mx="#56b6c2",gx="#ffffff",go="#abb2bf",jh="#7d8799",Sx="#61afef",Qx="#98c379",Fp="#d19a66",bx="#c678dd",yx="#21252b",Hp="#2c313a",Kp="#282c34",Lh="#353a42",xx="#3E4451",Jp="#528bff";var kx=x.theme({"&":{color:go,backgroundColor:Kp},".cm-content":{caretColor:Jp},".cm-cursor, .cm-dropCursor":{borderLeftColor:Jp},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:xx},".cm-panels":{backgroundColor:yx,color:go},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:Kp,color:jh,border:"none"},".cm-activeLineGutter":{backgroundColor:Hp},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Lh},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Lh,borderBottomColor:Lh},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Hp,color:go}}},{dark:!0}),wx=on.define([{tag:p.keyword,color:bx},{tag:[p.name,p.deleted,p.character,p.propertyName,p.macroName],color:Up},{tag:[p.function(p.variableName),p.labelName],color:Sx},{tag:[p.color,p.constant(p.name),p.standard(p.name)],color:Fp},{tag:[p.definition(p.name),p.separator],color:go},{tag:[p.typeName,p.className,p.number,p.changed,p.annotation,p.modifier,p.self,p.namespace],color:px},{tag:[p.operator,p.operatorKeyword,p.url,p.escape,p.regexp,p.link,p.special(p.string)],color:mx},{tag:[p.meta,p.comment],color:jh},{tag:p.strong,fontWeight:"bold"},{tag:p.emphasis,fontStyle:"italic"},{tag:p.strikethrough,textDecoration:"line-through"},{tag:p.link,color:jh,textDecoration:"underline"},{tag:p.heading,fontWeight:"bold",color:Up},{tag:[p.atom,p.bool,p.special(p.variableName)],color:Fp},{tag:[p.processingInstruction,p.string,p.inserted],color:Qx},{tag:p.invalid,color:gx}]),Vh=[kx,ir(wx)];var Yh=class i{constructor(e,t,n,r,s,o,l,a,h,c=0,f){this.p=e,this.stack=t,this.state=n,this.reducePos=r,this.pos=s,this.score=o,this.buffer=l,this.bufferBase=a,this.curContext=h,this.lookAhead=c,this.parent=f}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let r=e.parser.context;return new i(e,[],t,n,n,0,[],0,r?new So(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,r=e&65535,{parser:s}=this.p,o=this.reducePos=2e3&&!(!((t=this.p.parser.nodeSet.types[r])===null||t===void 0)&&t.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizea;)this.stack.pop();this.reduceContext(r,h)}storeNode(e,t,n,r=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&o.buffer[l-4]==0&&o.buffer[l-1]>-1){if(t==n)return;if(o.buffer[l-2]>=t){o.buffer[l-2]=n;return}}}if(!s||this.pos==n)this.buffer.push(e,t,n,r);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let l=!1;for(let a=o;a>0&&this.buffer[a-2]>n;a-=4)if(this.buffer[a-1]>=0){l=!0;break}if(l)for(;o>0&&this.buffer[o-2]>n;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,r>4&&(r-=4)}this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=n,this.buffer[o+3]=r}}shift(e,t,n,r){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let s=e,{parser:o}=this.p;this.pos=r;let l=o.stateFlag(s,1);!l&&(r>n||t<=o.maxNode)&&(this.reducePos=r),this.pushState(s,l?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=o.maxNode&&this.buffer.push(t,n,r,4)}else this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4)}apply(e,t,n,r){e&65536?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(t,r),this.buffer.push(n,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),r=e.bufferBase+t;for(;e&&r==e.bufferBase;)e=e.parent;return new i(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,r,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new Ih(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if((n&65536)==0)return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let r=[];for(let s=0,o;sa&1&&l==o)||r.push(t[s],o)}t=r}let n=[];for(let r=0;r>19,r=t&65535,s=this.stack.length-n*3;if(s<0||e.getGoto(this.stack[s],r,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,s)=>{if(!t.includes(r))return t.push(r),e.allActions(r,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-s;if(l>1){let a=o&65535,h=this.stack.length-l*3;if(h>=0&&e.getGoto(this.stack[h],a,!1)>=0)return l<<19|65536|a}}else{let l=n(o,s+1);if(l!=null)return l}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t0&&this.emitLookAhead()}},So=class{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}},Ih=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=r}},Gh=class i{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new i(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new i(this.stack,this.pos,this.index)}};function mr(i,e=Uint16Array){if(typeof i!="string")return i;let t=null;for(let n=0,r=0;n=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),s+=a,l)break;s*=46}t?t[r++]=s:t=new e(s)}return t}var Qn=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},em=new Qn,Nh=class{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=em,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,s=this.pos+e;for(;sn.to:s>=n.to;){if(r==this.ranges.length-1)return null;let o=this.ranges[++r];s+=o.from-n.to,n=o}return s}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,r;if(t>=0&&t=this.chunk2Pos&&nl.to&&(this.chunk2=this.chunk2.slice(0,l.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=em,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}},oi=class{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;sm(this.data,e,t,this.id,n.data,n.tokenPrecTable)}};oi.prototype.contextual=oi.prototype.fallback=oi.prototype.extend=!1;var li=class{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e=="string"?mr(e):e}token(e,t){let n=e.pos,r=0;for(;;){let s=e.next<0,o=e.resolveOffset(1,1);if(sm(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||r++,o==null)break;e.reset(o,e.token)}r&&(e.reset(n,e.token),e.acceptToken(this.elseToken,r))}};li.prototype.contextual=oi.prototype.fallback=oi.prototype.extend=!1;var te=class{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}};function sm(i,e,t,n,r,s){let o=0,l=1<0){let d=i[O];if(a.allows(d)&&(e.token.value==-1||e.token.value==d||$x(d,e.token.value,r,s))){e.acceptToken(d);break}}let c=e.next,f=0,u=i[o+2];if(e.next<0&&u>f&&i[h+u*3-3]==65535){o=i[h+u*3-1];continue e}for(;f>1,d=h+O+(O<<1),m=i[d],g=i[d+1]||65536;if(c=g)f=O+1;else{o=i[d+2],e.advance();continue e}}break}}function tm(i,e,t){for(let n=e,r;(r=i[n])!=65535;n++)if(r==t)return n-e;return-1}function $x(i,e,t,n){let r=tm(t,n,e);return r<0||tm(t,n,i)e)&&!n.type.isError)return t<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(i.length,Math.max(n.from+1,e+25));if(t<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return t<0?0:i.length}}var Uh=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?im(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?im(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=o,null;if(s instanceof j){if(o==e){if(o=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+s.length}}},Fh=class{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new Qn)}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:s}=r,o=r.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,a=0;for(let h=0;hf.end+25&&(a=Math.max(f.lookAhead,a)),f.value!=0)){let u=t;if(f.extended>-1&&(t=this.addActions(e,f.extended,f.end,t)),t=this.addActions(e,f.value,f.end,t),!c.extend&&(n=f,t>u))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),!n&&e.pos==this.stream.end&&(n=new Qn,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Qn,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:s}=n.p;for(let o=0;o=0&&n.p.parser.dialect.allows(l>>1)){(l&1)==0?e.value=l>>1:e.extended=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let s=0;se.bufferLength*4?new Uh(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],r,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;ot)n.push(l);else{if(this.advanceStack(l,n,e))continue;{r||(r=[],s=[]),r.push(l);let a=this.tokens.getMainToken(l);s.push(a.value,a.end)}}break}}if(!n.length){let o=r&&Px(r);if(o)return Ie&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Ie&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&r){let o=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,s,n);if(o)return Ie&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(n.length>o)for(n.sort((l,a)=>a.score-l.score);n.length>o;)n.pop();n.some(l=>l.reducePos>t)&&this.recovering--}else if(n.length>1){e:for(let o=0;o500&&h.buffer.length>500)if((l.score-h.score||l.buffer.length-h.buffer.length)>0)n.splice(a--,1);else{n.splice(o--,1);continue e}}}n.length>12&&(n.sort((o,l)=>l.score-o.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let o=1;o ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,c=h?e.curContext.hash:0;for(let f=this.fragments.nodeAt(r);f;){let u=this.parser.nodeSet.types[f.type.id]==f.type?s.getGoto(e.state,f.type.id):-1;if(u>-1&&f.length&&(!h||(f.prop(E.contextHash)||0)==c))return e.useNode(f,u),Ie&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(f.type.id)})`),!0;if(!(f instanceof j)||f.children.length==0||f.positions[0]>0)break;let O=f.children[0];if(O instanceof j&&f.positions[0]==0)f=O;else break}}let l=s.stateSlot(e.state,4);if(l>0)return e.reduce(l),Ie&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let h=0;hr?t.push(d):n.push(d)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return nm(e,t),!0}}runRecovery(e,t,n){let r=null,s=!1;for(let o=0;o ":"";if(l.deadEnd&&(s||(s=!0,l.restart(),Ie&&console.log(c+this.stackID(l)+" (restarted)"),this.advanceFully(l,n))))continue;let f=l.split(),u=c;for(let O=0;O<10&&f.forceReduce()&&(Ie&&console.log(u+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,n));O++)Ie&&(u=this.stackID(f)+" -> ");for(let O of l.recoverByInsert(a))Ie&&console.log(c+this.stackID(O)+" (via recover-insert)"),this.advanceFully(O,n);this.stream.end>l.pos?(h==l.pos&&(h++,a=0),l.recoverByDelete(a,h),Ie&&console.log(c+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),nm(l,n)):(!r||r.scorei,xt=class{constructor(e){this.start=e.start,this.shift=e.shift||Bh,this.reduce=e.reduce||Bh,this.reuse=e.reuse||Bh,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}},Le=class i extends Rt{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let l=0;le.topRules[l][1]),r=[];for(let l=0;l=0)s(c,a,l[h++]);else{let f=l[h+-c];for(let u=-c;u>0;u--)s(l[h++],a,f);h++}}}this.nodeSet=new Ct(t.map((l,a)=>re.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:r[a],top:n.indexOf(a)>-1,error:a==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(a)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=1024;let o=mr(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;ltypeof l=="number"?new oi(o,l):l),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let r=new Hh(this,e,t,n);for(let s of this.wrappers)r=s(r,e,t,n);return r}getGoto(e,t,n=!1){let r=this.goto;if(t>=r[0])return-1;for(let s=r[t+1];;){let o=r[s++],l=o&1,a=r[s++];if(l&&n)return a;for(let h=s+(o>>1);s0}validAction(e,t){return!!this.allActions(e,n=>n==t?!0:null)}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let s=this.stateSlot(e,1);r==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=qt(this.data,s+2);else break;r=t(qt(this.data,s+1))}return r}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=qt(this.data,n+2);else break;if((this.data[n+2]&1)==0){let r=this.data[n+1];t.some((s,o)=>o&1&&s==r)||t.push(this.data[n],r)}}return t}configure(e){let t=Object.assign(Object.create(i.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(n=>{let r=e.tokenizers.find(s=>s.from==n);return r?r.to:n})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((n,r)=>{let s=e.specializers.find(l=>l.from==n.external);if(!s)return n;let o=Object.assign(Object.assign({},n),{external:s.to});return t.specializers[r]=rm(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let s of e.split(" ")){let o=t.indexOf(s);o>=0&&(n[o]=!0)}let r=null;for(let s=0;sn)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.scorei.external(t,n)<<1|e}return i.get}var Tx=316,Cx=317,om=1,Xx=2,Rx=3,Ax=4,Zx=318,qx=320,Mx=321,_x=5,zx=6,Ex=0,ec=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],lm=125,Wx=59,tc=47,Lx=42,jx=43,Vx=45,Dx=60,Bx=44,Yx=63,Ix=46,Gx=91,Nx=new xt({start:!1,shift(i,e){return e==_x||e==zx||e==qx?i:e==Mx},strict:!1}),Ux=new te((i,e)=>{let{next:t}=i;(t==lm||t==-1||e.context)&&i.acceptToken(Zx)},{contextual:!0,fallback:!0}),Fx=new te((i,e)=>{let{next:t}=i,n;ec.indexOf(t)>-1||t==tc&&((n=i.peek(1))==tc||n==Lx)||t!=lm&&t!=Wx&&t!=-1&&!e.context&&i.acceptToken(Tx)},{contextual:!0}),Hx=new te((i,e)=>{i.next==Gx&&!e.context&&i.acceptToken(Cx)},{contextual:!0}),Kx=new te((i,e)=>{let{next:t}=i;if(t==jx||t==Vx){if(i.advance(),t==i.next){i.advance();let n=!e.context&&e.canShift(om);i.acceptToken(n?om:Xx)}}else t==Yx&&i.peek(1)==Ix&&(i.advance(),i.advance(),(i.next<48||i.next>57)&&i.acceptToken(Rx))},{contextual:!0});function Jh(i,e){return i>=65&&i<=90||i>=97&&i<=122||i==95||i>=192||!e&&i>=48&&i<=57}var Jx=new te((i,e)=>{if(i.next!=Dx||!e.dialectEnabled(Ex)||(i.advance(),i.next==tc))return;let t=0;for(;ec.indexOf(i.next)>-1;)i.advance(),t++;if(Jh(i.next,!0)){for(i.advance(),t++;Jh(i.next,!1);)i.advance(),t++;for(;ec.indexOf(i.next)>-1;)i.advance(),t++;if(i.next==Bx)return;for(let n=0;;n++){if(n==7){if(!Jh(i.next,!0))return;break}if(i.next!="extends".charCodeAt(n))break;i.advance(),t++}}i.acceptToken(Ax,-t)}),ek=Qe({"get set async static":p.modifier,"for while do if else switch try catch finally return throw break continue default case defer":p.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":p.operatorKeyword,"let var const using function class extends":p.definitionKeyword,"import export from":p.moduleKeyword,"with debugger new":p.keyword,TemplateString:p.special(p.string),super:p.atom,BooleanLiteral:p.bool,this:p.self,null:p.null,Star:p.modifier,VariableName:p.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":p.function(p.variableName),VariableDefinition:p.definition(p.variableName),Label:p.labelName,PropertyName:p.propertyName,PrivatePropertyName:p.special(p.propertyName),"CallExpression/MemberExpression/PropertyName":p.function(p.propertyName),"FunctionDeclaration/VariableDefinition":p.function(p.definition(p.variableName)),"ClassDeclaration/VariableDefinition":p.definition(p.className),"NewExpression/VariableName":p.className,PropertyDefinition:p.definition(p.propertyName),PrivatePropertyDefinition:p.definition(p.special(p.propertyName)),UpdateOp:p.updateOperator,"LineComment Hashbang":p.lineComment,BlockComment:p.blockComment,Number:p.number,String:p.string,Escape:p.escape,ArithOp:p.arithmeticOperator,LogicOp:p.logicOperator,BitOp:p.bitwiseOperator,CompareOp:p.compareOperator,RegExp:p.regexp,Equals:p.definitionOperator,Arrow:p.function(p.punctuation),": Spread":p.punctuation,"( )":p.paren,"[ ]":p.squareBracket,"{ }":p.brace,"InterpolationStart InterpolationEnd":p.special(p.brace),".":p.derefOperator,", ;":p.separator,"@":p.meta,TypeName:p.typeName,TypeDefinition:p.definition(p.typeName),"type enum interface implements namespace module declare":p.definitionKeyword,"abstract global Privacy readonly override":p.modifier,"is keyof unique infer asserts":p.operatorKeyword,JSXAttributeValue:p.attributeValue,JSXText:p.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":p.angleBracket,"JSXIdentifier JSXNameSpacedName":p.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":p.attributeName,"JSXBuiltin/JSXIdentifier":p.standard(p.tagName)}),tk={__proto__:null,export:20,as:25,from:33,default:36,async:41,function:42,in:52,out:55,const:56,extends:60,this:64,true:72,false:72,null:84,void:88,typeof:92,super:108,new:142,delete:154,yield:163,await:167,class:172,public:235,private:235,protected:235,readonly:237,instanceof:256,satisfies:259,import:292,keyof:349,unique:353,infer:359,asserts:395,is:397,abstract:417,implements:419,type:421,let:424,var:426,using:429,interface:435,enum:439,namespace:445,module:447,declare:451,global:455,defer:471,for:476,of:485,while:488,with:492,do:496,if:500,else:502,switch:506,case:512,try:518,catch:522,finally:526,return:530,throw:534,break:538,continue:542,debugger:546},ik={__proto__:null,async:129,get:131,set:133,declare:195,public:197,private:197,protected:197,static:199,abstract:201,override:203,readonly:209,accessor:211,new:401},nk={__proto__:null,"<":193},am=Le.deserialize({version:14,states:"$F|Q%TQlOOO%[QlOOO'_QpOOP(lO`OOO*zQ!0MxO'#CiO+RO#tO'#CjO+aO&jO'#CjO+oO#@ItO'#DaO.QQlO'#DgO.bQlO'#DrO%[QlO'#DzO0fQlO'#ESOOQ!0Lf'#E['#E[O1PQ`O'#EXOOQO'#Ep'#EpOOQO'#Il'#IlO1XQ`O'#GsO1dQ`O'#EoO1iQ`O'#EoO3hQ!0MxO'#JrO6[Q!0MxO'#JsO6uQ`O'#F]O6zQ,UO'#FtOOQ!0Lf'#Ff'#FfO7VO7dO'#FfO9XQMhO'#F|O9`Q`O'#F{OOQ!0Lf'#Js'#JsOOQ!0Lb'#Jr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VQ5j1XQ8a5iR:V8bQ+w&QR1[+wQ2_,xR6m2_YrOXst#dQ&v!ZQ+a%mQ,r&rQ,t&tQ,u&uQ,w&wQ2Y,sS2],x2_R6l2[Q%opQ&z!_Q&}!aQ'P!bQ'R!cQ'q!uQ+`%lQ+l%zQ,Q&XQ,h&mQ-P&|W-p'k's't'wQ-w'oQ0X*nQ1P+mQ1c,PS2O,i,lQ2g-OQ2h-RQ2i-SQ2}-oW3P-r-s-v-xQ5a1QQ5m1_Q5q1eQ6V1uQ6a2QQ6k2ZU6z3O3R3UQ6}3SQ8]5bQ8e5oQ8g5rQ8l5zQ8u6WQ8{6`S9[6{7PQ9^7OQ:W8cQ:b8vQ:g8|Q:n9]Q;U:XQ;]:cQ;a:oQ;l;VR;o;^Q%zyQ'd!iQ'o!uU+m%{%|%}Q-W'VU-k'e'f'gS-o'k'uQ0Q*jS1Q+n+oQ2o-YS2{-l-mQ3S-tS4p0R0UQ5b1RQ6v2uQ6y2|Q7O3TU7{4r4s4vQ9z7}R;O9{S$wi>PR*{%VU%Ui%V>PR0f*yQ$viS(u#v+iS)c$b$cQ)e$dQ*[$xS*e${*YQ*t%OQ*u%QQ+Q%^Q+R%_Q+V%cQ.lPQ=}>XQ>O>YQ>Z>]R>[>^Q+O%]Q.nSR#[WR'Z!el!tQ!r!v!y!z'`'l'm'n-e-u1o5{5}S'V!e-]U*j$|*Z*oS-Y'W'_S0U*k*qQ0^*rQ2u-cQ4v0[R4{0_R({#xQ!fQT-d'`-e]!qQ!r'`-e1o5{Q#p]R'i < TypeParamList in out const TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewTarget new NewExpression ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression TypeArgList CompareOp < declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression InstantiationExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast < ArrowFunction TypeParamList SequenceExpression InstantiationExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate asserts is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration defer ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:380,context:Nx,nodeProps:[["isolate",-8,5,6,14,37,39,51,53,55,""],["group",-26,9,17,19,68,207,211,215,216,218,221,224,234,237,243,245,247,249,252,258,264,266,268,270,272,274,275,"Statement",-34,13,14,32,35,36,42,51,54,55,57,62,70,72,76,80,82,84,85,110,111,120,121,136,139,141,142,143,144,145,147,148,167,169,171,"Expression",-23,31,33,37,41,43,45,173,175,177,178,180,181,182,184,185,186,188,189,190,201,203,205,206,"Type",-3,88,103,109,"ClassItem"],["openedBy",23,"<",38,"InterpolationStart",56,"[",60,"{",73,"(",160,"JSXStartCloseTag"],["closedBy",-2,24,168,">",40,"InterpolationEnd",50,"]",61,"}",74,")",165,"JSXEndTag"]],propSources:[ek],skippedNodes:[0,5,6,278],repeatNodeCount:37,tokenData:"$Fq07[R!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#:O!R![#<_![!]#I_!]!^#Jk!^!_#Ku!_!`$![!`!a$$v!a!b$*T!b!c$,r!c!}Er!}#O$-|#O#P$/W#P#Q$4o#Q#R$5y#R#SEr#S#T$7W#T#o$8b#o#p$x#r#s$@U#s$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$I|Er$I|$I}$Dk$I}$JO$Dk$JO$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr(n%d_$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$i&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$i&j(Z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=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]#t(T,2j(e$I[OX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr07[$D|k$i&j(Wp(Z!b'}0/l$]#t(T,2j(e$I[OY%ZYZ&cZr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$g%Z$g;'SEr;'S;=`I|<%lOEr",tokenizers:[Fx,Hx,Kx,Jx,2,3,4,5,6,7,8,9,10,11,12,13,14,Ux,new li("$S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOx~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!U~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(c~~",141,340),new li("j~RQYZXz{^~^O(Q~~aP!P!Qd~iO(R~~",25,323)],topRules:{Script:[0,7],SingleExpression:[1,276],SingleClassItem:[2,277]},dialects:{jsx:0,ts:15175},dynamicPrecedences:{80:1,82:1,94:1,169:1,199:1},specialized:[{term:327,get:i=>tk[i]||-1},{term:343,get:i=>ik[i]||-1},{term:95,get:i=>nk[i]||-1}],tokenPrec:15201});var um=[ie("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),ie("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),ie("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),ie("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),ie("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),ie(`try { + \${} +} catch (\${error}) { + \${} +}`,{label:"try",detail:"/ catch block",type:"keyword"}),ie("if (${}) {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),ie(`if (\${}) { + \${} +} else { + \${} +}`,{label:"if",detail:"/ else block",type:"keyword"}),ie(`class \${name} { + constructor(\${params}) { + \${} + } +}`,{label:"class",detail:"definition",type:"keyword"}),ie('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),ie('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],rk=um.concat([ie("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),ie("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),ie("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),hm=new Ft,Om=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function gr(i){return(e,t)=>{let n=e.node.getChild("VariableDefinition");return n&&t(n,i),!0}}var sk=["FunctionDeclaration"],ok={FunctionDeclaration:gr("function"),ClassDeclaration:gr("class"),ClassExpression:()=>!0,EnumDeclaration:gr("constant"),TypeAliasDeclaration:gr("type"),NamespaceDeclaration:gr("namespace"),VariableDefinition(i,e){i.matchContext(sk)||e(i,"variable")},TypeDefinition(i,e){e(i,"type")},__proto__:null};function dm(i,e){let t=hm.get(e);if(t)return t;let n=[],r=!0;function s(o,l){let a=i.sliceString(o.from,o.to);n.push({label:a,type:l})}return e.cursor(I.IncludeAnonymous).iterate(o=>{if(r)r=!1;else if(o.name){let l=ok[o.name];if(l&&l(o,s)||Om.has(o.name))return!1}else if(o.to-o.from>8192){for(let l of dm(i,o.node))n.push(l);return!1}}),hm.set(e,n),n}var cm=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,pm=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function lk(i){let e=B(i.state).resolveInner(i.pos,-1);if(pm.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&cm.test(i.state.sliceDoc(e.from,e.to));if(!t&&!i.explicit)return null;let n=[];for(let r=e;r;r=r.parent)Om.has(r.name)&&(n=n.concat(dm(i.state.doc,r)));return{options:n,from:t?e.from:i.pos,validFor:cm}}var Ot=We.define({name:"javascript",parser:am.configure({props:[we.add({IfStatement:Zt({except:/^\s*({|else\b)/}),TryStatement:Zt({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:NO,SwitchBody:i=>{let e=i.textAfter,t=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return i.baseIndent+(t?0:n?1:2)*i.unit},Block:hn({closing:"}"}),ArrowFunction:i=>i.baseIndent+i.unit,"TemplateString BlockComment":()=>null,"Statement Property":Zt({except:/^\s*{/}),JSXElement(i){let e=/^\s*<\//.test(i.textAfter);return i.lineIndent(i.node.from)+(e?0:i.unit)},JSXEscape(i){let e=/\s*\}/.test(i.textAfter);return i.lineIndent(i.node.from)+(e?0:i.unit)},"JSXOpenTag JSXSelfClosingTag"(i){return i.column(i.node.from)+i.unit}}),ve.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":ii,BlockComment(i){return{from:i.from+2,to:i.to-2}},JSXElement(i){let e=i.firstChild;if(!e||e.name=="JSXSelfClosingTag")return null;let t=i.lastChild;return{from:e.to,to:t.type.isError?i.to:t.from}},"JSXSelfClosingTag JSXOpenTag"(i){var e;let t=(e=i.firstChild)===null||e===void 0?void 0:e.nextSibling,n=i.lastChild;return!t||t.type.isError?null:{from:t.to,to:n.type.isError?i.to:n.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),mm={test:i=>/^JSX/.test(i.name),facet:ln({commentTokens:{block:{open:"{/*",close:"*/}"}}})},ic=Ot.configure({dialect:"ts"},"typescript"),nc=Ot.configure({dialect:"jsx",props:[Es.add(i=>i.isTop?[mm]:void 0)]}),rc=Ot.configure({dialect:"jsx ts",props:[Es.add(i=>i.isTop?[mm]:void 0)]},"typescript"),gm=i=>({label:i,type:"keyword"}),Sm="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(gm),ak=Sm.concat(["declare","implements","private","protected","public"].map(gm));function bn(i={}){let e=i.jsx?i.typescript?rc:nc:i.typescript?ic:Ot,t=i.typescript?rk.concat(ak):um.concat(Sm);return new be(e,[Ot.data.of({autocomplete:lo(pm,oo(t))}),Ot.data.of({autocomplete:lk}),i.jsx?fk:[]])}function hk(i){for(;;){if(i.name=="JSXOpenTag"||i.name=="JSXSelfClosingTag"||i.name=="JSXFragmentTag")return i;if(i.name=="JSXEscape"||!i.parent)return null;i=i.parent}}function fm(i,e,t=i.length){for(let n=e?.firstChild;n;n=n.nextSibling)if(n.name=="JSXIdentifier"||n.name=="JSXBuiltin"||n.name=="JSXNamespacedName"||n.name=="JSXMemberExpression")return i.sliceString(n.from,Math.min(n.to,t));return""}var ck=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),fk=x.inputHandler.of((i,e,t,n,r)=>{if((ck?i.composing:i.compositionStarted)||i.state.readOnly||e!=t||n!=">"&&n!="/"||!Ot.isActiveAt(i.state,e,-1))return!1;let s=r(),{state:o}=s,l=o.changeByRange(a=>{var h;let{head:c}=a,f=B(o).resolveInner(c-1,-1),u;if(f.name=="JSXStartTag"&&(f=f.parent),!(o.doc.sliceString(c-1,c)!=n||f.name=="JSXAttributeValue"&&f.to>c)){if(n==">"&&f.name=="JSXFragmentTag")return{range:a,changes:{from:c,insert:""}};if(n=="/"&&f.name=="JSXStartCloseTag"){let O=f.parent,d=O.parent;if(d&&O.from==c-2&&((u=fm(o.doc,d.firstChild,c))||((h=d.firstChild)===null||h===void 0?void 0:h.name)=="JSXFragmentTag")){let m=`${u}>`;return{range:Q.cursor(c+m.length,-1),changes:{from:c,insert:m}}}}else if(n==">"){let O=hk(f);if(O&&O.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(o.doc.sliceString(c,c+2))&&(u=fm(o.doc,O,c)))return{range:a,changes:{from:c,insert:``}}}}return{range:a}});return l.changes.empty?!1:(i.dispatch([s,o.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});var uk=135,Qm=1,Ok=136,dk=137,ym=2,pk=138,mk=3,gk=4,xm=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],Sk=58,Qk=40,km=95,bk=91,Qo=45,yk=46,xk=35,kk=37,wk=38,vk=92,$k=10,Pk=42;function Sr(i){return i>=65&&i<=90||i>=97&&i<=122||i>=161}function sc(i){return i>=48&&i<=57}function bm(i){return sc(i)||i>=97&&i<=102||i>=65&&i<=70}var wm=(i,e,t)=>(n,r)=>{for(let s=!1,o=0,l=0;;l++){let{next:a}=n;if(Sr(a)||a==Qo||a==km||s&&sc(a))!s&&(a!=Qo||l>0)&&(s=!0),o===l&&a==Qo&&o++,n.advance();else if(a==vk&&n.peek(1)!=$k){if(n.advance(),bm(n.next)){do n.advance();while(bm(n.next));n.next==32&&n.advance()}else n.next>-1&&n.advance();s=!0}else{s&&n.acceptToken(o==2&&r.canShift(ym)?e:a==Qk?t:i);break}}},Tk=new te(wm(Ok,ym,dk),{contextual:!0}),Ck=new te(wm(pk,mk,gk),{contextual:!0}),Xk=new te(i=>{if(xm.includes(i.peek(-1))){let{next:e}=i;(Sr(e)||e==km||e==xk||e==yk||e==Pk||e==bk||e==Sk&&Sr(i.peek(1))||e==Qo||e==wk)&&i.acceptToken(uk)}}),Rk=new te(i=>{if(!xm.includes(i.peek(-1))){let{next:e}=i;if(e==kk&&(i.advance(),i.acceptToken(Qm)),Sr(e)){do i.advance();while(Sr(i.next)||sc(i.next));i.acceptToken(Qm)}}}),Ak=Qe({"AtKeyword import charset namespace keyframes media supports font-feature-values":p.definitionKeyword,"from to selector scope MatchFlag":p.keyword,NamespaceName:p.namespace,KeyframeName:p.labelName,KeyframeRangeName:p.operatorKeyword,TagName:p.tagName,ClassName:p.className,PseudoClassName:p.constant(p.className),IdName:p.labelName,"FeatureName PropertyName":p.propertyName,AttributeName:p.attributeName,NumberLiteral:p.number,KeywordQuery:p.keyword,UnaryQueryOp:p.operatorKeyword,"CallTag ValueName FontName":p.atom,VariableName:p.variableName,Callee:p.operatorKeyword,Unit:p.unit,"UniversalSelector NestingSelector":p.definitionOperator,"MatchOp CompareOp":p.compareOperator,"ChildOp SiblingOp, LogicOp":p.logicOperator,BinOp:p.arithmeticOperator,Important:p.modifier,Comment:p.blockComment,ColorLiteral:p.color,"ParenthesizedContent StringLiteral":p.string,":":p.punctuation,"PseudoOp #":p.derefOperator,"; , |":p.separator,"( )":p.paren,"[ ]":p.squareBracket,"{ }":p.brace}),Zk={__proto__:null,lang:44,"nth-child":44,"nth-last-child":44,"nth-of-type":44,"nth-last-of-type":44,dir:44,"host-context":44,if:90,url:132,"url-prefix":132,domain:132,regexp:132},qk={__proto__:null,or:104,and:104,not:112,only:112,layer:186},Mk={__proto__:null,selector:118,layer:182},_k={__proto__:null,"@import":178,"@media":190,"@charset":194,"@namespace":198,"@keyframes":204,"@supports":216,"@scope":220,"@font-feature-values":226},zk={__proto__:null,to:223},vm=Le.deserialize({version:14,states:"IpQYQ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!}#T%j#T#oCP#o;'S%j;'S;=`%{<%lO%jjCW[lY!e`Oy%jz}%j}!OCP!O!Q%j!Q![CP![!c%j!c!}CP!}#T%j#T#oCP#o;'S%j;'S;=`%{<%lO%jhDRS!pWOy%jz;'S%j;'S;=`%{<%lO%jjDdSpYOy%jz;'S%j;'S;=`%{<%lO%jnDuSo^Oy%jz;'S%j;'S;=`%{<%lO%jjEWU!pWOy%jz#a%j#a#bEj#b;'S%j;'S;=`%{<%lO%jbEoU!e`Oy%jz#d%j#d#eFR#e;'S%j;'S;=`%{<%lO%jbFWU!e`Oy%jz#c%j#c#dFj#d;'S%j;'S;=`%{<%lO%jbFoU!e`Oy%jz#f%j#f#gGR#g;'S%j;'S;=`%{<%lO%jbGWU!e`Oy%jz#h%j#h#iGj#i;'S%j;'S;=`%{<%lO%jbGoU!e`Oy%jz#T%j#T#UHR#U;'S%j;'S;=`%{<%lO%jbHWU!e`Oy%jz#b%j#b#cHj#c;'S%j;'S;=`%{<%lO%jbHoU!e`Oy%jz#h%j#h#iIR#i;'S%j;'S;=`%{<%lO%jbIYS$cQ!e`Oy%jz;'S%j;'S;=`%{<%lO%jjIkSsYOy%jz;'S%j;'S;=`%{<%lO%jfI|U$XUOy%jz!_%j!_!`2n!`;'S%j;'S;=`%{<%lO%jjJeSrYOy%jz;'S%j;'S;=`%{<%lO%jfJvU!uQOy%jz!_%j!_!`2n!`;'S%j;'S;=`%{<%lO%j`K]P;=`<%l%Z",tokenizers:[Xk,Rk,Tk,Ck,1,2,3,4,new li("m~RRYZ[z{a~~g~aO$T~~dP!P!Qg~lO$U~~",28,142)],topRules:{StyleSheet:[0,6],Styles:[1,116]},dynamicPrecedences:{84:1},specialized:[{term:137,get:i=>Zk[i]||-1},{term:138,get:i=>qk[i]||-1},{term:4,get:i=>Mk[i]||-1},{term:28,get:i=>_k[i]||-1},{term:136,get:i=>zk[i]||-1}],tokenPrec:2256});var oc=null;function lc(){if(!oc&&typeof document=="object"&&document.body){let{style:i}=document.body,e=[],t=new Set;for(let n in i)n!="cssText"&&n!="cssFloat"&&typeof i[n]=="string"&&(/[A-Z]/.test(n)&&(n=n.replace(/[A-Z]/g,r=>"-"+r.toLowerCase())),t.has(n)||(e.push(n),t.add(n)));oc=e.sort().map(n=>({type:"property",label:n,apply:n+": "}))}return oc||[]}var $m=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map(i=>({type:"class",label:i})),Pm=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map(i=>({type:"keyword",label:i})).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map(i=>({type:"constant",label:i}))),Ek=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map(i=>({type:"type",label:i})),Wk=["@charset","@color-profile","@container","@counter-style","@font-face","@font-feature-values","@font-palette-values","@import","@keyframes","@layer","@media","@namespace","@page","@position-try","@property","@scope","@starting-style","@supports","@view-transition"].map(i=>({type:"keyword",label:i})),Mt=/^(\w[\w-]*|-\w[\w-]*|)$/,Lk=/^-(-[\w-]*)?$/;function jk(i,e){var t;if((i.name=="("||i.type.isError)&&(i=i.parent||i),i.name!="ArgList")return!1;let n=(t=i.parent)===null||t===void 0?void 0:t.firstChild;return n?.name!="Callee"?!1:e.sliceString(n.from,n.to)=="var"}var Tm=new Ft,Vk=["Declaration"];function Dk(i){for(let e=i;;){if(e.type.isTop)return e;if(!(e=e.parent))return i}}function Cm(i,e,t){if(e.to-e.from>4096){let n=Tm.get(e);if(n)return n;let r=[],s=new Set,o=e.cursor(I.IncludeAnonymous);if(o.firstChild())do for(let l of Cm(i,o.node,t))s.has(l.label)||(s.add(l.label),r.push(l));while(o.nextSibling());return Tm.set(e,r),r}else{let n=[],r=new Set;return e.cursor().iterate(s=>{var o;if(t(s)&&s.matchContext(Vk)&&((o=s.node.nextSibling)===null||o===void 0?void 0:o.name)==":"){let l=i.sliceString(s.from,s.to);r.has(l)||(r.add(l),n.push({label:l,type:"variable"}))}}),n}}var Bk=i=>e=>{let{state:t,pos:n}=e,r=B(t).resolveInner(n,-1),s=r.type.isError&&r.from==r.to-1&&t.doc.sliceString(r.from,r.to)=="-";if(r.name=="PropertyName"||(s||r.name=="TagName")&&/^(Block|Styles)$/.test(r.resolve(r.to).name))return{from:r.from,options:lc(),validFor:Mt};if(r.name=="ValueName")return{from:r.from,options:Pm,validFor:Mt};if(r.name=="PseudoClassName")return{from:r.from,options:$m,validFor:Mt};if(i(r)||(e.explicit||s)&&jk(r,t.doc))return{from:i(r)||s?r.from:n,options:Cm(t.doc,Dk(r),i),validFor:Lk};if(r.name=="TagName"){for(let{parent:a}=r;a;a=a.parent)if(a.name=="Block")return{from:r.from,options:lc(),validFor:Mt};return{from:r.from,options:Ek,validFor:Mt}}if(r.name=="AtKeyword")return{from:r.from,options:Wk,validFor:Mt};if(!e.explicit)return null;let o=r.resolve(n),l=o.childBefore(n);return l&&l.name==":"&&o.name=="PseudoClassSelector"?{from:n,options:$m,validFor:Mt}:l&&l.name==":"&&o.name=="Declaration"||o.name=="ArgList"?{from:n,options:Pm,validFor:Mt}:o.name=="Block"||o.name=="Styles"?{from:n,options:lc(),validFor:Mt}:null},Yk=Bk(i=>i.name=="VariableName"),Qr=We.define({name:"css",parser:vm.configure({props:[we.add({Declaration:Zt()}),ve.add({"Block KeyframeList":ii})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function bo(){return new be(Qr,Qr.data.of({autocomplete:Yk}))}var Ik=55,Gk=1,Nk=56,Uk=2,Fk=57,Hk=3,Xm=4,Kk=5,uc=6,Em=7,Wm=8,Lm=9,jm=10,Jk=11,ew=12,tw=13,ac=58,iw=14,nw=15,Rm=59,Vm=21,rw=23,Dm=24,sw=25,cc=27,Bm=28,ow=29,lw=32,aw=35,hw=37,cw=38,fw=0,uw=1,Ow={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},dw={dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},Am={dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}};function pw(i){return i==45||i==46||i==58||i>=65&&i<=90||i==95||i>=97&&i<=122||i>=161}var Zm=null,qm=null,Mm=0;function fc(i,e){let t=i.pos+e;if(Mm==t&&qm==i)return Zm;let n=i.peek(e),r="";for(;pw(n);)r+=String.fromCharCode(n),n=i.peek(++e);return qm=i,Mm=t,Zm=r?r.toLowerCase():n==mw||n==gw?void 0:null}var Ym=60,yo=62,Oc=47,mw=63,gw=33,Sw=45;function _m(i,e){this.name=i,this.parent=e}var Qw=[uc,jm,Em,Wm,Lm],bw=new xt({start:null,shift(i,e,t,n){return Qw.indexOf(e)>-1?new _m(fc(n,1)||"",i):i},reduce(i,e){return e==Vm&&i?i.parent:i},reuse(i,e,t,n){let r=e.type.id;return r==uc||r==hw?new _m(fc(n,1)||"",i):i},strict:!1}),yw=new te((i,e)=>{if(i.next!=Ym){i.next<0&&e.context&&i.acceptToken(ac);return}i.advance();let t=i.next==Oc;t&&i.advance();let n=fc(i,0);if(n===void 0)return;if(!n)return i.acceptToken(t?nw:iw);let r=e.context?e.context.name:null;if(t){if(n==r)return i.acceptToken(Jk);if(r&&dw[r])return i.acceptToken(ac,-2);if(e.dialectEnabled(fw))return i.acceptToken(ew);for(let s=e.context;s;s=s.parent)if(s.name==n)return;i.acceptToken(tw)}else{if(n=="script")return i.acceptToken(Em);if(n=="style")return i.acceptToken(Wm);if(n=="textarea")return i.acceptToken(Lm);if(Ow.hasOwnProperty(n))return i.acceptToken(jm);r&&Am[r]&&Am[r][n]?i.acceptToken(ac,-1):i.acceptToken(uc)}},{contextual:!0}),xw=new te(i=>{for(let e=0,t=0;;t++){if(i.next<0){t&&i.acceptToken(Rm);break}if(i.next==Sw)e++;else if(i.next==yo&&e>=2){t>=3&&i.acceptToken(Rm,-2);break}else e=0;i.advance()}});function kw(i){for(;i;i=i.parent)if(i.name=="svg"||i.name=="math")return!0;return!1}var ww=new te((i,e)=>{if(i.next==Oc&&i.peek(1)==yo){let t=e.dialectEnabled(uw)||kw(e.context);i.acceptToken(t?Kk:Xm,2)}else i.next==yo&&i.acceptToken(Xm,1)});function dc(i,e,t){let n=2+i.length;return new te(r=>{for(let s=0,o=0,l=0;;l++){if(r.next<0){l&&r.acceptToken(e);break}if(s==0&&r.next==Ym||s==1&&r.next==Oc||s>=2&&so?r.acceptToken(e,-o):r.acceptToken(t,-(o-2));break}else if((r.next==10||r.next==13)&&l){r.acceptToken(e,1);break}else s=o=0;r.advance()}})}var vw=dc("script",Ik,Gk),$w=dc("style",Nk,Uk),Pw=dc("textarea",Fk,Hk),Tw=Qe({"Text RawText IncompleteTag IncompleteCloseTag":p.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":p.angleBracket,TagName:p.tagName,"MismatchedCloseTag/TagName":[p.tagName,p.invalid],AttributeName:p.attributeName,"AttributeValue UnquotedAttributeValue":p.attributeValue,Is:p.definitionOperator,"EntityReference CharacterReference":p.character,Comment:p.blockComment,ProcessingInst:p.processingInstruction,DoctypeDecl:p.documentMeta}),Im=Le.deserialize({version:14,states:",xOVO!rOOO!ZQ#tO'#CrO!`Q#tO'#C{O!eQ#tO'#DOO!jQ#tO'#DRO!oQ#tO'#DTO!tOaO'#CqO#PObO'#CqO#[OdO'#CqO$kO!rO'#CqOOO`'#Cq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mP~O!YiOQpP![pP~O!ZlORsP![sP~OUSOVPOWQOXROYTOZqO[]O][O^^O_^Oa^Ob^Oc^Od^Oy^O!eZO~O![rO~P#gO!]sO!fuO~OgvO~OgwO~OS|OT}OiyO~OS!POT}OiyO~OS!ROT}OiyO~OS!TOT}OiyO~OS}OT}OiyO~O!XfOPmX![mX~OP!WO![!XO~O!YiOQpX![pX~OQ!ZO![!XO~O!ZlORsX![sX~OR!]O![!XO~O![!XO~P#gOg!_O~O!]sO!f!aO~OS!bO~OS!cO~Oj!dOShXThXihX~OS!fOT!gOiyO~OS!hOT!gOiyO~OS!iOT!gOiyO~OS!jOT!gOiyO~OS!gOT!gOiyO~Og!kO~Og!lO~Og!mO~OS!nO~Ol!qO!a!oO!c!pO~OS!rO~OS!sO~OS!tO~Ob!uOc!uOd!uO!a!wO!b!uO~Ob!xOc!xOd!xO!c!wO!d!xO~Ob!uOc!uOd!uO!a!{O!b!uO~Ob!xOc!xOd!xO!c!{O!d!xO~OT~cbd!ey|!e~",goto:"%q!aPPPPPPPPPPPPPPPPPPPPP!b!hP!nPP!zP!}#Q#T#Z#^#a#g#j#m#s#y!bP!b!bP$P$V$m$s$y%P%V%]%cPPPPPPPP%iX^OX`pXUOX`pezabcde{!O!Q!S!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ!ObQ!QcQ!SdQ!UeZ!e{!O!Q!S!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"\u26A0 StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:68,context:bw,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,22,31,34,37,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,30,33,36,38,"OpenTag"],["group",-10,14,15,18,19,20,21,40,41,42,43,"Entity",17,"Entity TextContent",-3,29,32,35,"TextContent Entity"],["isolate",-11,22,30,31,33,34,36,37,38,39,42,43,"ltr",-3,27,28,40,""]],propSources:[Tw],skippedNodes:[0],repeatNodeCount:9,tokenData:"!]tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^/^!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!Z5zblWOX5uXZ7SZ[5u[^7S^p5uqr5urs7Sst+Ptw5uwx7Sx!]5u!]!^7w!^!a7S!a#S5u#S#T7S#T;'S5u;'S;=`8n<%lO5u!R7VVOp7Sqs7St!]7S!]!^7l!^;'S7S;'S;=`7q<%lO7S!R7qOb!R!R7tP;=`<%l7S!Z8OYlWb!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!Z8qP;=`<%l5u!_8{iiSlWOX5uXZ7SZ[5u[^7S^p5uqr8trs7Sst/^tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^:j!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!_:sbiSlWb!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!VP<%l?Ah;{?Ah?BY7S?BY?Mn;{?MnO7S!V=dXiSb!Rqr0msw0mx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rs(O||(O=Gm(f,a))))){let m=c.lastChild,g=m.type.id==cw?m.from:c.to;if(g>f.to)return{parser:d.parser,overlay:[{from:f.to,to:g}]}}}}if(o&&h==Dm){let c=l.node,f;if(f=c.firstChild){let u=o[a.read(f.from,f.to)];if(u)for(let O of u){if(O.tagName&&O.tagName!=zm(c.parent,a))continue;let d=c.lastChild;if(d.type.id==cc){let m=d.from+1,g=d.lastChild,S=d.to-(g&&g.isError?0:1);if(S>m)return{parser:O.parser,overlay:[{from:m,to:S}],bracketed:!0}}else if(d.type.id==Bm)return{parser:O.parser,overlay:[{from:d.from,to:d.to}]}}}}return null})}var br=["_blank","_self","_top","_parent"],mc=["ascii","utf-8","utf-16","latin1","latin1"],gc=["get","post","put","delete"],Sc=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Ge=["true","false"],z={},Cw={a:{attrs:{href:null,ping:null,type:null,media:null,target:br,hreflang:null}},abbr:z,address:z,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:z,aside:z,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:z,base:{attrs:{href:null,target:br}},bdi:z,bdo:z,blockquote:{attrs:{cite:null}},body:z,br:z,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:Sc,formmethod:gc,formnovalidate:["novalidate"],formtarget:br,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:z,center:z,cite:z,code:z,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:z,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:z,div:z,dl:z,dt:z,em:z,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:z,figure:z,footer:z,form:{attrs:{action:null,name:null,"accept-charset":mc,autocomplete:["on","off"],enctype:Sc,method:gc,novalidate:["novalidate"],target:br}},h1:z,h2:z,h3:z,h4:z,h5:z,h6:z,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:z,hgroup:z,hr:z,html:{attrs:{manifest:null}},i:z,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:Sc,formmethod:gc,formnovalidate:["novalidate"],formtarget:br,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:z,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:z,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:z,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:mc,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:z,noscript:z,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:z,param:{attrs:{name:null,value:null}},pre:z,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:z,rt:z,ruby:z,samp:z,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:mc}},section:z,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:z,source:{attrs:{src:null,type:null,media:null}},span:z,strong:z,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:z,summary:z,sup:z,table:z,tbody:z,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:z,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:z,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:z,time:{attrs:{datetime:null}},title:z,tr:z,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:z,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:z},Hm={accesskey:null,class:null,contenteditable:Ge,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Ge,autocorrect:Ge,autocapitalize:Ge,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Ge,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Ge,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Ge,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Ge,"aria-hidden":Ge,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Ge,"aria-multiselectable":Ge,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Ge,"aria-relevant":null,"aria-required":Ge,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},Km="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(i=>"on"+i);for(let i of Km)Hm[i]=null;var Zi=class{constructor(e,t){this.tags={...Cw,...e},this.globalAttrs={...Hm,...t},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};Zi.default=new Zi;function yn(i,e,t=i.length){if(!e)return"";let n=e.firstChild,r=n&&n.getChild("TagName");return r?i.sliceString(r.from,Math.min(r.to,t)):""}function xn(i,e=!1){for(;i;i=i.parent)if(i.name=="Element")if(e)e=!1;else return i;return null}function Jm(i,e,t){let n=t.tags[yn(i,xn(e))];return n?.children||t.allTags}function Qc(i,e){let t=[];for(let n=xn(e);n&&!n.type.isTop;n=xn(n.parent)){let r=yn(i,n);if(r&&n.lastChild.name=="CloseTag")break;r&&t.indexOf(r)<0&&(e.name=="EndTag"||e.from>=n.firstChild.to)&&t.push(r)}return t}var eg=/^[:\-\.\w\u00b7-\uffff]*$/;function Nm(i,e,t,n,r){let s=/\s*>/.test(i.sliceDoc(r,r+5))?"":">",o=xn(t,t.name=="StartTag"||t.name=="TagName");return{from:n,to:r,options:Jm(i.doc,o,e).map(l=>({label:l,type:"type"})).concat(Qc(i.doc,t).map((l,a)=>({label:"/"+l,apply:"/"+l+s,type:"type",boost:99-a}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function Um(i,e,t,n){let r=/\s*>/.test(i.sliceDoc(n,n+5))?"":">";return{from:t,to:n,options:Qc(i.doc,e).map((s,o)=>({label:s,apply:s+r,type:"type",boost:99-o})),validFor:eg}}function Xw(i,e,t,n){let r=[],s=0;for(let o of Jm(i.doc,t,e))r.push({label:"<"+o,type:"type"});for(let o of Qc(i.doc,t))r.push({label:"",type:"type",boost:99-s++});return{from:n,to:n,options:r,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function Rw(i,e,t,n,r){let s=xn(t),o=s?e.tags[yn(i.doc,s)]:null,l=o&&o.attrs?Object.keys(o.attrs):[],a=o&&o.globalAttrs===!1?l:l.length?l.concat(e.globalAttrNames):e.globalAttrNames;return{from:n,to:r,options:a.map(h=>({label:h,type:"property"})),validFor:eg}}function Aw(i,e,t,n,r){var s;let o=(s=t.parent)===null||s===void 0?void 0:s.getChild("AttributeName"),l=[],a;if(o){let h=i.sliceDoc(o.from,o.to),c=e.globalAttrs[h];if(!c){let f=xn(t),u=f?e.tags[yn(i.doc,f)]:null;c=u?.attrs&&u.attrs[h]}if(c){let f=i.sliceDoc(n,r).toLowerCase(),u='"',O='"';/^['"]/.test(f)?(a=f[0]=='"'?/^[^"]*$/:/^[^']*$/,u="",O=i.sliceDoc(r,r+1)==f[0]?"":f[0],f=f.slice(1),n++):a=/^[^\s<>='"]*$/;for(let d of c)l.push({label:d,apply:u+d+O,type:"constant"})}}return{from:n,to:r,options:l,validFor:a}}function tg(i,e){let{state:t,pos:n}=e,r=B(t).resolveInner(n,-1),s=r.resolve(n);for(let o=n,l;s==r&&(l=r.childBefore(o));){let a=l.lastChild;if(!a||!a.type.isError||a.fromtg(n,r)}var qw=Ot.parser.configure({top:"SingleExpression"}),ng=[{tag:"script",attrs:i=>i.type=="text/typescript"||i.lang=="ts",parser:ic.parser},{tag:"script",attrs:i=>i.type=="text/babel"||i.type=="text/jsx",parser:nc.parser},{tag:"script",attrs:i=>i.type=="text/typescript-jsx",parser:rc.parser},{tag:"script",attrs(i){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(i.type)},parser:qw},{tag:"script",attrs(i){return!i.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(i.type)},parser:Ot.parser},{tag:"style",attrs(i){return(!i.lang||i.lang=="css")&&(!i.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(i.type))},parser:Qr.parser}],rg=[{name:"style",parser:Qr.parser.configure({top:"Styles"})}].concat(Km.map(i=>({name:i,parser:Ot.parser}))),sg=We.define({name:"html",parser:Im.configure({props:[we.add({Element(i){let e=/^(\s*)(<\/)?/.exec(i.textAfter);return i.node.to<=i.pos+e[0].length?i.continue():i.lineIndent(i.node.from)+(e[2]?0:i.unit)},"OpenTag CloseTag SelfClosingTag"(i){return i.column(i.node.from)+i.unit},Document(i){if(i.pos+/\s*/.exec(i.textAfter)[0].lengthi.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:""}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),xo=sg.configure({wrap:pc(ng,rg)});function ko(i={}){let e="",t;i.matchClosingTags===!1&&(e="noMatch"),i.selfClosingTags===!0&&(e=(e?e+" ":"")+"selfClosing"),(i.nestedLanguages&&i.nestedLanguages.length||i.nestedAttributes&&i.nestedAttributes.length)&&(t=pc((i.nestedLanguages||[]).concat(ng),(i.nestedAttributes||[]).concat(rg)));let n=t?sg.configure({wrap:t,dialect:e}):e?xo.configure({dialect:e}):xo;return new be(n,[xo.data.of({autocomplete:Zw(i)}),i.autoCloseTags!==!1?Mw:[],bn().support,bo().support])}var Fm=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),Mw=x.inputHandler.of((i,e,t,n,r)=>{if(i.composing||i.state.readOnly||e!=t||n!=">"&&n!="/"||!xo.isActiveAt(i.state,e,-1))return!1;let s=r(),{state:o}=s,l=o.changeByRange(a=>{var h,c,f;let u=o.doc.sliceString(a.from-1,a.to)==n,{head:O}=a,d=B(o).resolveInner(O,-1),m;if(u&&n==">"&&d.name=="EndTag"){let g=d.parent;if(((c=(h=g.parent)===null||h===void 0?void 0:h.lastChild)===null||c===void 0?void 0:c.name)!="CloseTag"&&(m=yn(o.doc,g.parent,O))&&!Fm.has(m)){let S=O+(o.doc.sliceString(O,O+1)===">"?1:0),b=``;return{range:a,changes:{from:O,to:S,insert:b}}}}else if(u&&n=="/"&&d.name=="IncompleteCloseTag"){let g=d.parent;if(d.from==O-2&&((f=g.lastChild)===null||f===void 0?void 0:f.name)!="CloseTag"&&(m=yn(o.doc,g,O))&&!Fm.has(m)){let S=O+(o.doc.sliceString(O,O+1)===">"?1:0),b=`${m}>`;return{range:Q.cursor(O+b.length,-1),changes:{from:O,to:S,insert:b}}}}return{range:a}});return l.changes.empty?!1:(i.dispatch([s,o.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});var _w=Qe({String:p.string,Number:p.number,"True False":p.bool,PropertyName:p.propertyName,Null:p.null,", :":p.separator,"[ ]":p.squareBracket,"{ }":p.brace}),og=Le.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"\u26A0 JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[_w],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0});var zw=We.define({name:"json",parser:og.configure({props:[we.add({Object:Zt({except:/^\s*\}/}),Array:Zt({except:/^\s*\]/})}),ve.add({"Object Array":ii})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function lg(){return new be(zw)}var $o=class i{static create(e,t,n,r,s){let o=r+(r<<8)+e+(t<<4)|0;return new i(e,t,n,o,s,[],[])}constructor(e,t,n,r,s,o,l){this.type=e,this.value=t,this.from=n,this.hash=r,this.end=s,this.children=o,this.positions=l,this.hashProp=[[E.contextHash,r]]}addChild(e,t){e.prop(E.contextHash)!=this.hash&&(e=new j(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(t)}toTree(e,t=this.end){let n=this.children.length-1;return n>=0&&(t=Math.max(t,this.positions[n]+this.children[n].length+this.from)),new j(e.types[this.type],this.children,this.positions,t-this.from).balance({makeTree:(r,s,o)=>new j(re.none,r,s,o,this.hashProp)})}},k;(function(i){i[i.Document=1]="Document",i[i.CodeBlock=2]="CodeBlock",i[i.FencedCode=3]="FencedCode",i[i.Blockquote=4]="Blockquote",i[i.HorizontalRule=5]="HorizontalRule",i[i.BulletList=6]="BulletList",i[i.OrderedList=7]="OrderedList",i[i.ListItem=8]="ListItem",i[i.ATXHeading1=9]="ATXHeading1",i[i.ATXHeading2=10]="ATXHeading2",i[i.ATXHeading3=11]="ATXHeading3",i[i.ATXHeading4=12]="ATXHeading4",i[i.ATXHeading5=13]="ATXHeading5",i[i.ATXHeading6=14]="ATXHeading6",i[i.SetextHeading1=15]="SetextHeading1",i[i.SetextHeading2=16]="SetextHeading2",i[i.HTMLBlock=17]="HTMLBlock",i[i.LinkReference=18]="LinkReference",i[i.Paragraph=19]="Paragraph",i[i.CommentBlock=20]="CommentBlock",i[i.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",i[i.Escape=22]="Escape",i[i.Entity=23]="Entity",i[i.HardBreak=24]="HardBreak",i[i.Emphasis=25]="Emphasis",i[i.StrongEmphasis=26]="StrongEmphasis",i[i.Link=27]="Link",i[i.Image=28]="Image",i[i.InlineCode=29]="InlineCode",i[i.HTMLTag=30]="HTMLTag",i[i.Comment=31]="Comment",i[i.ProcessingInstruction=32]="ProcessingInstruction",i[i.Autolink=33]="Autolink",i[i.HeaderMark=34]="HeaderMark",i[i.QuoteMark=35]="QuoteMark",i[i.ListMark=36]="ListMark",i[i.LinkMark=37]="LinkMark",i[i.EmphasisMark=38]="EmphasisMark",i[i.CodeMark=39]="CodeMark",i[i.CodeText=40]="CodeText",i[i.CodeInfo=41]="CodeInfo",i[i.LinkTitle=42]="LinkTitle",i[i.LinkLabel=43]="LinkLabel",i[i.URL=44]="URL"})(k||(k={}));var xc=class{constructor(e,t){this.start=e,this.content=t,this.marks=[],this.parsers=[]}},kc=class{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent),this.pos=e,this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return xr(this.text,e)}reset(e){for(this.text=e,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(e){this.basePos=e,this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e,this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,t=0,n=0){for(let r=t;r=e.stack[t.depth+1].value+t.baseIndent)return!0;if(t.indent>=t.baseIndent+4)return!1;let n=(i.type==k.OrderedList?Mc:qc)(t,e,!1);return n>0&&(i.type!=k.BulletList||Zc(t,e,!1)<0)&&t.text.charCodeAt(t.pos+n-1)==i.value}var Qg={[k.Blockquote](i,e,t){return t.next!=62?!1:(t.markers.push(U(k.QuoteMark,e.lineStart+t.pos,e.lineStart+t.pos+1)),t.moveBase(t.pos+(rt(t.text.charCodeAt(t.pos+1))?2:1)),i.end=e.lineStart+t.text.length,!0)},[k.ListItem](i,e,t){return t.indent-1?!1:(t.moveBaseColumn(t.baseIndent+i.value),!0)},[k.OrderedList]:ag,[k.BulletList]:ag,[k.Document](){return!0}};function rt(i){return i==32||i==9||i==10||i==13}function xr(i,e=0){for(;et&&rt(i.charCodeAt(e-1));)e--;return e}function bg(i){if(i.next!=96&&i.next!=126)return-1;let e=i.pos+1;for(;e-1&&i.depth==e.stack.length&&e.parser.leafBlockParsers.indexOf(Tg.SetextHeading)>-1||n<3?-1:1}function xg(i,e){for(let t=i.stack.length-1;t>=0;t--)if(i.stack[t].type==e)return!0;return!1}function qc(i,e,t){return(i.next==45||i.next==43||i.next==42)&&(i.pos==i.text.length-1||rt(i.text.charCodeAt(i.pos+1)))&&(!t||xg(e,k.BulletList)||i.skipSpace(i.pos+2)=48&&r<=57;){n++;if(n==i.text.length)return-1;r=i.text.charCodeAt(n)}return n==i.pos||n>i.pos+9||r!=46&&r!=41||ni.pos+1||i.next!=49)?-1:n+1-i.pos}function kg(i){if(i.next!=35)return-1;let e=i.pos+1;for(;e6?-1:t}function wg(i){if(i.next!=45&&i.next!=61||i.indent>=i.baseIndent+4)return-1;let e=i.pos+1;for(;e/,$g=/\?>/,vc=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*/i.exec(n);if(s)return i.append(U(k.Comment,t,t+1+s[0].length));let o=/^\?[^]*?\?>/.exec(n);if(o)return i.append(U(k.ProcessingInstruction,t,t+1+o[0].length));let l=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(n);return l?i.append(U(k.HTMLTag,t,t+1+l[0].length)):-1},Emphasis(i,e,t){if(e!=95&&e!=42)return-1;let n=t+1;for(;i.char(n)==e;)n++;let r=i.slice(t-1,t),s=i.slice(n,n+1),o=vr.test(r),l=vr.test(s),a=/\s|^$/.test(r),h=/\s|^$/.test(s),c=!h&&(!l||a||o),f=!a&&(!o||h||l),u=c&&(e==42||!f||o),O=f&&(e==42||!c||l);return i.append(new Xe(e==95?Rg:Ag,t,n,(u?1:0)|(O?2:0)))},HardBreak(i,e,t){if(e==92&&i.char(t+1)==10)return i.append(U(k.HardBreak,t,t+2));if(e==32){let n=t+1;for(;i.char(n)==32;)n++;if(i.char(n)==10&&n>=t+2)return i.append(U(k.HardBreak,t,n+1))}return-1},Link(i,e,t){return e==91?i.append(new Xe(qi,t,t+1,1)):-1},Image(i,e,t){return e==33&&i.char(t+1)==91?i.append(new Xe(Co,t,t+2,1)):-1},LinkEnd(i,e,t){if(e!=93)return-1;for(let n=i.parts.length-1;n>=0;n--){let r=i.parts[n];if(r instanceof Xe&&(r.type==qi||r.type==Co)){if(!r.side||i.skipSpace(r.to)==t&&!/[(\[]/.test(i.slice(t+1,t+2)))return i.parts[n]=null,-1;let s=i.takeContent(n),o=i.parts[n]=Lw(i,s,r.type==qi?k.Link:k.Image,r.from,t+1);if(r.type==qi)for(let l=0;le?U(k.URL,e+t,s+t):s==i.length?null:!1}}function qg(i,e,t){let n=i.charCodeAt(e);if(n!=39&&n!=34&&n!=40)return!1;let r=n==40?41:n;for(let s=e+1,o=!1;s=this.end?-1:this.text.charCodeAt(e-this.offset)}get end(){return this.offset+this.text.length}slice(e,t){return this.text.slice(e-this.offset,t-this.offset)}append(e){return this.parts.push(e),e.to}addDelimiter(e,t,n,r,s){return this.append(new Xe(e,t,n,(r?1:0)|(s?2:0)))}get hasOpenLink(){for(let e=this.parts.length-1;e>=0;e--){let t=this.parts[e];if(t instanceof Xe&&(t.type==qi||t.type==Co))return!0}return!1}addElement(e){return this.append(e)}resolveMarkers(e){for(let n=e;n=e;a--){let m=this.parts[a];if(m instanceof Xe&&m.side&1&&m.type==r.type&&!(s&&(r.side&1||m.side&2)&&(m.to-m.from+o)%3==0&&((m.to-m.from)%3||o%3))){l=m;break}}if(!l)continue;let h=r.type.resolve,c=[],f=l.from,u=r.to;if(s){let m=Math.min(2,l.to-l.from,o);f=l.to-m,u=r.from+m,h=m==1?"Emphasis":"StrongEmphasis"}l.type.mark&&c.push(this.elt(l.type.mark,f,l.to));for(let m=a+1;m=0;t--){let n=this.parts[t];if(n instanceof Xe&&n.type==e&&n.side&1)return t}return null}takeContent(e){let t=this.resolveMarkers(e);return this.parts.length=e,t}getDelimiterAt(e){let t=this.parts[e];return t instanceof Xe?t:null}skipSpace(e){return xr(this.text,e-this.offset)+this.offset}elt(e,t,n,r){return typeof e=="string"?U(this.parser.getNodeType(e),t,n,r):new To(e,t)}};$r.linkStart=qi;$r.imageStart=Co;function Xc(i,e){if(!e.length)return i;if(!i.length)return e;let t=i.slice(),n=0;for(let r of e){for(;n(e?e-1:0))return!1;if(this.fragmentEnd<0){let s=this.fragment.to;for(;s>0&&this.input.read(s-1,s)!=` +`;)s--;this.fragmentEnd=s?s-1:0}let n=this.cursor;n||(n=this.cursor=this.fragment.tree.cursor(),n.firstChild());let r=e+this.fragment.offset;for(;n.to<=r;)if(!n.parent())return!1;for(;;){if(n.from>=r)return this.fragment.from<=t;if(!n.childAfter(r))return!1}}matches(e){let t=this.cursor.tree;return t&&t.prop(E.contextHash)==e}takeNodes(e){let t=this.cursor,n=this.fragment.offset,r=this.fragmentEnd-(this.fragment.openEnd?1:0),s=e.absoluteLineStart,o=s,l=e.block.children.length,a=o,h=l;for(;;){if(t.to-n>r){if(t.type.isAnonymous&&t.firstChild())continue;break}let c=_g(t.from-n,e.ranges);if(t.to-n<=e.ranges[e.rangeI].to)e.addNode(t.tree,c);else{let f=new j(e.parser.nodeSet.types[k.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(f,t.tree),e.addNode(f,c)}if(t.type.is("Block")&&(jw.indexOf(t.type.id)<0?(o=t.to-n,l=e.block.children.length):(o=a,l=h),a=t.to-n,h=e.block.children.length),!t.nextSibling())break}for(;e.block.children.length>l;)e.block.children.pop(),e.block.positions.pop();return o-s}};function _g(i,e){let t=i;for(let n=1;nwo[i]),Object.keys(wo).map(i=>Tg[i]),Object.keys(wo),Ew,Qg,Object.keys(yc).map(i=>yc[i]),Object.keys(yc),[]);function Dw(i,e,t){let n=[];for(let r=i.firstChild,s=e;;r=r.nextSibling){let o=r?r.from:t;if(o>s&&n.push({from:s,to:o}),!r)break;s=r.to}return n}function Eg(i){let{codeParser:e,htmlParser:t}=i;return{wrap:Cs((r,s)=>{let o=r.type.id;if(e&&(o==k.CodeBlock||o==k.FencedCode)){let l="";if(o==k.FencedCode){let h=r.node.getChild(k.CodeInfo);h&&(l=s.read(h.from,h.to))}let a=e(l);if(a)return{parser:a,overlay:h=>h.type.id==k.CodeText,bracketed:o==k.FencedCode}}else if(t&&(o==k.HTMLBlock||o==k.HTMLTag||o==k.CommentBlock))return{parser:t,overlay:Dw(r.node,r.from,r.to)};return null})}}var Bw={resolve:"Strikethrough",mark:"StrikethroughMark"},Yw={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":p.strikethrough}},{name:"StrikethroughMark",style:p.processingInstruction}],parseInline:[{name:"Strikethrough",parse(i,e,t){if(e!=126||i.char(t+1)!=126||i.char(t+2)==126)return-1;let n=i.slice(t-1,t),r=i.slice(t+2,t+3),s=/\s|^$/.test(n),o=/\s|^$/.test(r),l=vr.test(n),a=vr.test(r);return i.addDelimiter(Bw,t,t+2,!o&&(!a||s||l),!s&&(!l||o||a))},after:"Emphasis"}]};function kr(i,e,t=0,n,r=0){let s=0,o=!0,l=-1,a=-1,h=!1,c=()=>{n.push(i.elt("TableCell",r+l,r+a,i.parser.parseInline(e.slice(l,a),r+l)))};for(let f=t;f-1)&&s++,o=!1,n&&(l>-1&&c(),n.push(i.elt("TableDelimiter",f+r,f+r+1))),l=a=-1):(h||u!=32&&u!=9)&&(l<0&&(l=f),a=f+1),h=!h&&u==92}return l>-1&&(s++,n&&c()),s}function ug(i,e){for(let t=e;tr instanceof Xo)||!ug(e.text,e.basePos))return!1;let n=i.peekLine();return Wg.test(n)&&kr(i,e.text,e.basePos)==kr(i,n,e.basePos)},before:"SetextHeading"}]},Ac=class{nextLine(){return!1}finish(e,t){return e.addLeafElement(t,e.elt("Task",t.start,t.start+t.content.length,[e.elt("TaskMarker",t.start,t.start+3),...e.parser.parseInline(t.content.slice(3),t.start+3)])),!0}},Gw={defineNodes:[{name:"Task",block:!0,style:p.list},{name:"TaskMarker",style:p.atom}],parseBlock:[{name:"TaskList",leaf(i,e){return/^\[[ xX]\][ \t]/.test(e.content)&&i.parentType().name=="ListItem"?new Ac:null},after:"SetextHeading"}]},Og=/(www\.)|(https?:\/\/)|([\w.+-]{1,100}@)|(mailto:|xmpp:)/gy,dg=/[\w-]+(\.[\w-]+)+(\/[^\s<]*)?/gy,Nw=/[\w-]+\.[\w-]+($|\/)/,pg=/[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy,mg=/\/[a-zA-Z\d@.]+/gy;function gg(i,e,t,n){let r=0;for(let s=e;s-1)return-1;let n=e+t[0].length;for(;;){let r=i[n-1],s;if(/[?!.,:*_~]/.test(r)||r==")"&&gg(i,e,n,")")>gg(i,e,n,"("))n--;else if(r==";"&&(s=/&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(i.slice(e,n))))n=e+s.index;else break}return n}function Sg(i,e){pg.lastIndex=e;let t=pg.exec(i);if(!t)return-1;let n=t[0][t[0].length-1];return n=="_"||n=="-"?-1:e+t[0].length-(n=="."?1:0)}var Fw={parseInline:[{name:"Autolink",parse(i,e,t){let n=t-i.offset;if(n&&/\w/.test(i.text[n-1]))return-1;Og.lastIndex=n;let r=Og.exec(i.text),s=-1;if(!r)return-1;if(r[1]||r[2]){if(s=Uw(i.text,n+r[0].length),s>-1&&i.hasOpenLink){let o=/([^\[\]]|\[[^\]]*\])*/.exec(i.text.slice(n,s));s=n+o[0].length}}else r[3]?s=Sg(i.text,n):(s=Sg(i.text,n+r[0].length),s>-1&&r[0]=="xmpp:"&&(mg.lastIndex=s,r=mg.exec(i.text),r&&(s=r.index+r[0].length)));return s<0?-1:(i.addElement(i.elt("URL",t,s+i.offset)),s+i.offset)}}]},Lg=[Iw,Gw,Yw,Fw];function jg(i,e,t){return(n,r,s)=>{if(r!=i||n.char(s+1)==i)return-1;let o=[n.elt(t,s,s+1)];for(let l=s+1;l"}}}),Ng=new E,Ug=zg.configure({props:[ve.add(i=>!i.is("Block")||i.is("Document")||Ec(i)!=null||Hw(i)?void 0:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})),Ng.add(Ec),we.add({Document:()=>null}),At.add({Document:Gg})]});function Ec(i){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(i.name);return e?+e[1]:void 0}function Hw(i){return i.name=="OrderedList"||i.name=="BulletList"}function Kw(i,e){let t=i;for(;;){let n=t.nextSibling,r;if(!n||(r=Ec(n.type))!=null&&r<=e)break;t=n}return t.to}var Jw=Ha.of((i,e,t)=>{for(let n=B(i).resolveInner(t,-1);n&&!(n.fromt)return{from:t,to:s}}return null});function Wc(i){return new ke(Gg,i,[],"markdown")}var ev=Wc(Ug),tv=Ug.configure([Lg,Dg,Vg,Bg,{props:[ve.add({Table:(i,e)=>({from:e.doc.lineAt(i.from).to,to:i.to})})]}]),Ro=Wc(tv);function iv(i,e){return t=>{if(t&&i){let n=null;if(t=/\S*/.exec(t)[0],typeof i=="function"?n=i(t):n=Kn.matchLanguageName(i,t,!0),n instanceof Kn)return n.support?n.support.language.parser:$i.getSkippingParser(n.load());if(n)return n.parser}return e?e.parser:null}}var Pr=class{constructor(e,t,n,r,s,o,l){this.node=e,this.from=t,this.to=n,this.spaceBefore=r,this.spaceAfter=s,this.type=o,this.item=l}blank(e,t=!0){let n=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(e!=null){for(;n.length0;r--)n+=" ";return n+(t?this.spaceAfter:"")}}marker(e,t){let n=this.node.name=="OrderedList"?String(+Hg(this.item,e)[2]+t):"";return this.spaceBefore+n+this.type+this.spaceAfter}};function Fg(i,e){let t=[],n=[];for(let r=i;r;r=r.parent){if(r.name=="FencedCode")return n;(r.name=="ListItem"||r.name=="Blockquote")&&t.push(r)}for(let r=t.length-1;r>=0;r--){let s=t[r],o,l=e.lineAt(s.from),a=s.from-l.from;if(s.name=="Blockquote"&&(o=/^ *>( ?)/.exec(l.text.slice(a))))n.push(new Pr(s,a,a+o[0].length,"",o[1],">",null));else if(s.name=="ListItem"&&s.parent.name=="OrderedList"&&(o=/^( *)\d+([.)])( *)/.exec(l.text.slice(a)))){let h=o[3],c=o[0].length;h.length>=4&&(h=h.slice(0,h.length-4),c-=4),n.push(new Pr(s.parent,a,a+c,o[1],h,o[2],s))}else if(s.name=="ListItem"&&s.parent.name=="BulletList"&&(o=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(l.text.slice(a)))){let h=o[4],c=o[0].length;h.length>4&&(h=h.slice(0,h.length-4),c-=4);let f=o[2];o[3]&&(f+=o[3].replace(/[xX]/," ")),n.push(new Pr(s.parent,a,a+c,o[1],h,f,s))}}return n}function Hg(i,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(i.from,i.from+10))}function _c(i,e,t,n=0){for(let r=-1,s=i;;){if(s.name=="ListItem"){let l=Hg(s,e),a=+l[2];if(r>=0){if(a!=r+1)return;t.push({from:s.from+l[1].length,to:s.from+l[0].length,insert:String(r+2+n)})}r=a}let o=s.nextSibling;if(!o)break;s=o}}function Lc(i,e){let t=/^[ \t]*/.exec(i)[0].length;if(!t||e.facet(ti)!=" ")return i;let n=Ae(i,4,t),r="";for(let s=n;s>0;)s>=4?(r+=" ",s-=4):(r+=" ",s--);return r+i.slice(t)}var nv=(i={})=>({state:e,dispatch:t})=>{let n=B(e),{doc:r}=e,s=null,o=e.changeByRange(l=>{if(!l.empty||!Ro.isActiveAt(e,l.from,-1)&&!Ro.isActiveAt(e,l.from,1))return s={range:l};let a=l.from,h=r.lineAt(a),c=Fg(n.resolveInner(a,-1),r);for(;c.length&&c[c.length-1].from>a-h.from;)c.pop();if(!c.length)return s={range:l};let f=c[c.length-1];if(f.to-f.spaceAfter.length>a-h.from)return s={range:l};let u=a>=f.to-f.spaceAfter.length&&!/\S/.test(h.text.slice(f.to));if(f.item&&u){let S=f.node.firstChild,b=f.node.getChild("ListItem","ListItem");if(S.to>=a||b&&b.to0&&!/[^\s>]/.test(r.lineAt(h.from-1).text)||i.nonTightLists===!1){let y=c.length>1?c[c.length-2]:null,Z,$="";y&&y.item?(Z=h.from+y.from,$=y.marker(r,1)):Z=h.from+(y?y.to:0);let v=[{from:Z,to:a,insert:$}];return f.node.name=="OrderedList"&&_c(f.item,r,v,-2),y&&y.node.name=="OrderedList"&&_c(y.item,r,v),{range:Q.cursor(Z+$.length),changes:v}}else{let y=Ig(c,e,h);return{range:Q.cursor(a+y.length+1),changes:{from:h.from,insert:y+e.lineBreak}}}}if(f.node.name=="Blockquote"&&u&&h.from){let S=r.lineAt(h.from-1),b=/>\s*$/.exec(S.text);if(b&&b.index==f.from){let y=e.changes([{from:S.from+b.index,to:S.to},{from:h.from+f.from,to:h.to}]);return{range:l.map(y),changes:y}}}let O=[];f.node.name=="OrderedList"&&_c(f.item,r,O);let d=f.item&&f.item.from]*/.exec(h.text)[0].length>=f.to)for(let S=0,b=c.length-1;S<=b;S++)m+=S==b&&!d?c[S].marker(r,1):c[S].blank(Sh.from&&/\s/.test(h.text.charAt(g-h.from-1));)g--;return m=Lc(m,e),sv(f.node,e.doc)&&(m=Ig(c,e,h)+e.lineBreak+m),O.push({from:g,to:a,insert:e.lineBreak+m}),{range:Q.cursor(g+m.length+1),changes:O}});return s?!1:(t(e.update(o,{scrollIntoView:!0,userEvent:"input"})),!0)},rv=nv();function Yg(i){return i.name=="QuoteMark"||i.name=="ListMark"}function sv(i,e){if(i.name!="OrderedList"&&i.name!="BulletList")return!1;let t=i.firstChild,n=i.getChild("ListItem","ListItem");if(!n)return!1;let r=e.lineAt(t.to),s=e.lineAt(n.from),o=/^[\s>]*$/.test(r.text);return r.number+(o?0:1){let t=B(i),n=null,r=i.changeByRange(s=>{let o=s.from,{doc:l}=i;if(s.empty&&Ro.isActiveAt(i,s.from)){let a=l.lineAt(o),h=Fg(ov(t,o),l);if(h.length){let c=h[h.length-1],f=c.to-c.spaceAfter.length+(c.spaceAfter?1:0);if(o-a.from>f&&!/\S/.test(a.text.slice(f,o-a.from)))return{range:Q.cursor(a.from+f),changes:{from:a.from+f,to:o}};if(o-a.from==f&&(!c.item||a.from<=c.item.from||!/\S/.test(a.text.slice(0,c.to)))){let u=a.from+c.from;if(c.item&&c.node.from{var t;let{main:n}=e.state.selection;if(n.empty)return!1;let r=(t=i.clipboardData)===null||t===void 0?void 0:t.getData("text/plain");if(!r||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(r)||(/^www\./.test(r)&&(r="https://"+r),!Ro.isActiveAt(e.state,n.from,1)))return!1;let s=B(e.state),o=!1;return s.iterate({from:n.from,to:n.to,enter:l=>{(l.from>n.from||fv.test(l.name))&&(o=!0)},leave:l=>{l.to=48&&i<=57||i>=65&&i<=70||i>=97&&i<=102}var u$=new te((i,e)=>{let t;if(i.next<0)i.acceptToken(mv);else if(e.context.flags&Ao)jc(i.next)&&i.acceptToken(pv,1);else if(((t=i.peek(-1))<0||jc(t))&&e.canShift(e0)){let n=0;for(;i.next==Bc||i.next==qo;)i.advance(),n++;(i.next==_i||i.next==Tr||i.next==Yc)&&i.acceptToken(e0,-n)}else jc(i.next)&&i.acceptToken(dv,1)},{contextual:!0}),O$=new te((i,e)=>{let t=e.context;if(t.flags)return;let n=i.peek(-1);if(n==_i||n==Tr){let r=0,s=0;for(;;){if(i.next==Bc)r++;else if(i.next==qo)r+=8-r%8;else break;i.advance(),s++}r!=t.indent&&i.next!=_i&&i.next!=Tr&&i.next!=Yc&&(r[i,e|f0])),m$=new xt({start:d$,reduce(i,e,t,n){return i.flags&Ao&&f$.has(e)||(e==Zv||e==a0)&&i.flags&f0?i.parent:i},shift(i,e,t,n){return e==s0?new Zo(i,p$(n.read(n.pos,t.pos)),0):e==o0?i.parent:e==Qv||e==kv||e==$v||e==l0?new Zo(i,0,Ao):r0.has(e)?new Zo(i,0,r0.get(e)|i.flags&Ao):i},hash(i){return i.hash}}),g$=new te(i=>{for(let e=0;e<5;e++){if(i.next!="print".charCodeAt(e))return;i.advance()}if(!/\w/.test(String.fromCharCode(i.next)))for(let e=0;;e++){let t=i.peek(e);if(!(t==Bc||t==qo)){t!=r$&&t!=s$&&t!=_i&&t!=Tr&&t!=Yc&&i.acceptToken(Ov);return}}}),S$=new te((i,e)=>{let{flags:t}=e.context,n=t&_t?c0:h0,r=(t&zt)>0,s=!(t&Et),o=(t&Wt)>0,l=i.pos;for(;!(i.next<0);)if(o&&i.next==Dc)if(i.peek(1)==Dc)i.advance(2);else{if(i.pos==l){i.acceptToken(l0,1);return}break}else if(s&&i.next==n0){if(i.pos==l){i.advance();let a=i.next;a>=0&&(i.advance(),Q$(i,a)),i.acceptToken(Sv);return}break}else if(i.next==n0&&!s&&i.peek(1)>-1)i.advance(2);else if(i.next==n&&(!r||i.peek(1)==n&&i.peek(2)==n)){if(i.pos==l){i.acceptToken(t0,r?3:1);return}break}else if(i.next==_i){if(r)i.advance();else if(i.pos==l){i.acceptToken(t0);return}break}else i.advance();i.pos>l&&i.acceptToken(gv)});function Q$(i,e){if(e==o$)for(let t=0;t<2&&i.next>=48&&i.next<=55;t++)i.advance();else if(e==l$)for(let t=0;t<2&&Vc(i.next);t++)i.advance();else if(e==h$)for(let t=0;t<4&&Vc(i.next);t++)i.advance();else if(e==c$)for(let t=0;t<8&&Vc(i.next);t++)i.advance();else if(e==a$&&i.next==Dc){for(i.advance();i.next>=0&&i.next!=i0&&i.next!=h0&&i.next!=c0&&i.next!=_i;)i.advance();i.next==i0&&i.advance()}}var b$=Qe({'async "*" "**" FormatConversion FormatSpec':p.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":p.controlKeyword,"in not and or is del":p.operatorKeyword,"from def class global nonlocal lambda":p.definitionKeyword,import:p.moduleKeyword,"with as print":p.keyword,Boolean:p.bool,None:p.null,VariableName:p.variableName,"CallExpression/VariableName":p.function(p.variableName),"FunctionDefinition/VariableName":p.function(p.definition(p.variableName)),"ClassDefinition/VariableName":p.definition(p.className),PropertyName:p.propertyName,"CallExpression/MemberExpression/PropertyName":p.function(p.propertyName),Comment:p.lineComment,Number:p.number,String:p.string,FormatString:p.special(p.string),Escape:p.escape,UpdateOp:p.updateOperator,"ArithOp!":p.arithmeticOperator,BitOp:p.bitwiseOperator,CompareOp:p.compareOperator,AssignOp:p.definitionOperator,Ellipsis:p.punctuation,At:p.meta,"( )":p.paren,"[ ]":p.squareBracket,"{ }":p.brace,".":p.derefOperator,", ;":p.separator}),y$={__proto__:null,await:44,or:54,and:56,in:60,not:62,is:64,if:70,else:72,lambda:76,yield:94,from:96,async:102,for:104,None:162,True:164,False:164,del:178,pass:182,break:186,continue:190,return:194,raise:202,import:206,as:208,global:212,nonlocal:214,assert:218,type:223,elif:236,while:240,try:246,except:248,finally:250,with:254,def:258,class:268,match:279,case:285},u0=Le.deserialize({version:14,states:"##jO`QeOOP$}OSOOO&WQtO'#HUOOQS'#Co'#CoOOQS'#Cp'#CpO'vQdO'#CnO*UQtO'#HTOOQS'#HU'#HUOOQS'#DU'#DUOOQS'#HT'#HTO*rQdO'#D_O+VQdO'#DfO+gQdO'#DjO+zOWO'#DuO,VOWO'#DvO.[QtO'#GuOOQS'#Gu'#GuO'vQdO'#GtO0ZQtO'#GtOOQ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:[0,5]},specialized:[{term:221,get:i=>y$[i]||-1}],tokenPrec:7668});var O0=new Ft,p0=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function Mo(i){return(e,t,n)=>{if(n)return!1;let r=e.node.getChild("VariableName");return r&&t(r,i),!0}}var x$={FunctionDefinition:Mo("function"),ClassDefinition:Mo("class"),ForStatement(i,e,t){if(t){for(let n=i.node.firstChild;n;n=n.nextSibling)if(n.name=="VariableName")e(n,"variable");else if(n.name=="in")break}},ImportStatement(i,e){var t,n;let{node:r}=i,s=((t=r.firstChild)===null||t===void 0?void 0:t.name)=="from";for(let o=r.getChild("import");o;o=o.nextSibling)o.name=="VariableName"&&((n=o.nextSibling)===null||n===void 0?void 0:n.name)!="as"&&e(o,s?"variable":"namespace")},AssignStatement(i,e){for(let t=i.node.firstChild;t;t=t.nextSibling)if(t.name=="VariableName")e(t,"variable");else if(t.name==":"||t.name=="AssignOp")break},ParamList(i,e){for(let t=null,n=i.node.firstChild;n;n=n.nextSibling)n.name=="VariableName"&&(!t||!/\*|AssignOp/.test(t.name))&&e(n,"variable"),t=n},CapturePattern:Mo("variable"),AsPattern:Mo("variable"),__proto__:null};function m0(i,e){let t=O0.get(e);if(t)return t;let n=[],r=!0;function s(o,l){let a=i.sliceString(o.from,o.to);n.push({label:a,type:l})}return e.cursor(I.IncludeAnonymous).iterate(o=>{if(o.name){let l=x$[o.name];if(l&&l(o,s,r)||!r&&p0.has(o.name))return!1;r=!1}else if(o.to-o.from>8192){for(let l of m0(i,o.node))n.push(l);return!1}}),O0.set(e,n),n}var d0=/^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/,g0=["String","FormatString","Comment","PropertyName"];function k$(i){let e=B(i.state).resolveInner(i.pos,-1);if(g0.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&d0.test(i.state.sliceDoc(e.from,e.to));if(!t&&!i.explicit)return null;let n=[];for(let r=e;r;r=r.parent)p0.has(r.name)&&(n=n.concat(m0(i.state.doc,r)));return{options:n,from:t?e.from:i.pos,validFor:d0}}var w$=["__annotations__","__builtins__","__debug__","__doc__","__import__","__name__","__loader__","__package__","__spec__","False","None","True"].map(i=>({label:i,type:"constant"})).concat(["ArithmeticError","AssertionError","AttributeError","BaseException","BlockingIOError","BrokenPipeError","BufferError","BytesWarning","ChildProcessError","ConnectionAbortedError","ConnectionError","ConnectionRefusedError","ConnectionResetError","DeprecationWarning","EOFError","Ellipsis","EncodingWarning","EnvironmentError","Exception","FileExistsError","FileNotFoundError","FloatingPointError","FutureWarning","GeneratorExit","IOError","ImportError","ImportWarning","IndentationError","IndexError","InterruptedError","IsADirectoryError","KeyError","KeyboardInterrupt","LookupError","MemoryError","ModuleNotFoundError","NameError","NotADirectoryError","NotImplemented","NotImplementedError","OSError","OverflowError","PendingDeprecationWarning","PermissionError","ProcessLookupError","RecursionError","ReferenceError","ResourceWarning","RuntimeError","RuntimeWarning","StopAsyncIteration","StopIteration","SyntaxError","SyntaxWarning","SystemError","SystemExit","TabError","TimeoutError","TypeError","UnboundLocalError","UnicodeDecodeError","UnicodeEncodeError","UnicodeError","UnicodeTranslateError","UnicodeWarning","UserWarning","ValueError","Warning","ZeroDivisionError"].map(i=>({label:i,type:"type"}))).concat(["bool","bytearray","bytes","classmethod","complex","float","frozenset","int","list","map","memoryview","object","range","set","staticmethod","str","super","tuple","type"].map(i=>({label:i,type:"class"}))).concat(["abs","aiter","all","anext","any","ascii","bin","breakpoint","callable","chr","compile","delattr","dict","dir","divmod","enumerate","eval","exec","exit","filter","format","getattr","globals","hasattr","hash","help","hex","id","input","isinstance","issubclass","iter","len","license","locals","max","min","next","oct","open","ord","pow","print","property","quit","repr","reversed","round","setattr","slice","sorted","sum","vars","zip"].map(i=>({label:i,type:"function"}))),v$=[ie("def ${name}(${params}):\n ${}",{label:"def",detail:"function",type:"keyword"}),ie("for ${name} in ${collection}:\n ${}",{label:"for",detail:"loop",type:"keyword"}),ie("while ${}:\n ${}",{label:"while",detail:"loop",type:"keyword"}),ie("try:\n ${}\nexcept ${error}:\n ${}",{label:"try",detail:"/ except block",type:"keyword"}),ie(`if \${}: + +`,{label:"if",detail:"block",type:"keyword"}),ie("if ${}:\n ${}\nelse:\n ${}",{label:"if",detail:"/ else block",type:"keyword"}),ie("class ${name}:\n def __init__(self, ${params}):\n ${}",{label:"class",detail:"definition",type:"keyword"}),ie("import ${module}",{label:"import",detail:"statement",type:"keyword"}),ie("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],$$=lo(g0,oo(w$.concat(v$)));function Ic(i){let{node:e,pos:t}=i,n=i.lineIndent(t,-1),r=null;for(;;){let s=e.childBefore(t);if(s)if(s.name=="Comment")t=s.from;else if(s.name=="Body"||s.name=="MatchBody")i.baseIndentFor(s)+i.unit<=n&&(r=s),e=s;else if(s.name=="MatchClause")e=s;else if(s.type.is("Statement"))e=s;else break;else break}return r}function Gc(i,e){let t=i.baseIndentFor(e),n=i.lineAt(i.pos,-1),r=n.from+n.text.length;return/^\s*($|#)/.test(n.text)&&i.node.tot?null:t+i.unit}var Nc=We.define({name:"python",parser:u0.configure({props:[we.add({Body:i=>{var e;let t=/^\s*(#|$)/.test(i.textAfter)&&Ic(i)||i.node;return(e=Gc(i,t))!==null&&e!==void 0?e:i.continue()},MatchBody:i=>{var e;let t=Ic(i);return(e=Gc(i,t||i.node))!==null&&e!==void 0?e:i.continue()},IfStatement:i=>/^\s*(else:|elif )/.test(i.textAfter)?i.baseIndent:i.continue(),"ForStatement WhileStatement":i=>/^\s*else:/.test(i.textAfter)?i.baseIndent:i.continue(),TryStatement:i=>/^\s*(except[ :]|finally:|else:)/.test(i.textAfter)?i.baseIndent:i.continue(),MatchStatement:i=>/^\s*case /.test(i.textAfter)?i.baseIndent+i.unit:i.continue(),"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression":hn({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":hn({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":hn({closing:"]"}),MemberExpression:i=>i.baseIndent+i.unit,"String FormatString":()=>null,Script:i=>{var e;let t=Ic(i);return(e=t&&Gc(i,t))!==null&&e!==void 0?e:i.continue()}}),ve.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":ii,Body:(i,e)=>({from:i.from+1,to:i.to-(i.to==e.doc.length?0:1)}),"String FormatString":(i,e)=>({from:e.doc.lineAt(i.from).to,to:i.to})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"'''",'"""'],stringPrefixes:["f","fr","rf","r","u","b","br","rb","F","FR","RF","R","U","B","BR","RB"]},commentTokens:{line:"#"},indentOnInput:/^\s*([\}\]\)]|else:|elif |except |finally:|case\s+[^:]*:?)$/}});function S0(){return new be(Nc,[Nc.data.of({autocomplete:k$}),Nc.data.of({autocomplete:$$})])}var Uc=1,P$=2,T$=3,C$=4,X$=5,R$=36,A$=37,Z$=38,q$=11,M$=13;function _$(i){return i==45||i==46||i==58||i>=65&&i<=90||i==95||i>=97&&i<=122||i>=161}function z$(i){return i==9||i==10||i==13||i==32}var Q0=null,b0=null,y0=0;function Fc(i,e){let t=i.pos+e;if(b0==i&&y0==t)return Q0;for(;z$(i.peek(e));)e++;let n="";for(;;){let r=i.peek(e);if(!_$(r))break;n+=String.fromCharCode(r),e++}return b0=i,y0=t,Q0=n||null}function x0(i,e){this.name=i,this.parent=e}var E$=new xt({start:null,shift(i,e,t,n){return e==Uc?new x0(Fc(n,1)||"",i):i},reduce(i,e){return e==q$&&i?i.parent:i},reuse(i,e,t,n){let r=e.type.id;return r==Uc||r==M$?new x0(Fc(n,1)||"",i):i},strict:!1}),W$=new te((i,e)=>{if(i.next==60){if(i.advance(),i.next==47){i.advance();let t=Fc(i,0);if(!t)return i.acceptToken(X$);if(e.context&&t==e.context.name)return i.acceptToken(P$);for(let n=e.context;n;n=n.parent)if(n.name==t)return i.acceptToken(T$,-2);i.acceptToken(C$)}else if(i.next!=33&&i.next!=63)return i.acceptToken(Uc)}},{contextual:!0});function Hc(i,e){return new te(t=>{let n=0,r=e.charCodeAt(0);e:for(;!(t.next<0);t.advance(),n++)if(t.next==r){for(let s=1;s"),j$=Hc(A$,"?>"),V$=Hc(Z$,"]]>"),D$=Qe({Text:p.content,"StartTag StartCloseTag EndTag SelfCloseEndTag":p.angleBracket,TagName:p.tagName,"MismatchedCloseTag/TagName":[p.tagName,p.invalid],AttributeName:p.attributeName,AttributeValue:p.attributeValue,Is:p.definitionOperator,"EntityReference CharacterReference":p.character,Comment:p.blockComment,ProcessingInst:p.processingInstruction,DoctypeDecl:p.documentMeta,Cdata:p.special(p.string)}),k0=Le.deserialize({version:14,states:",lOQOaOOOrOxO'#CfOzOpO'#CiO!tOaO'#CgOOOP'#Cg'#CgO!{OrO'#CrO#TOtO'#CsO#]OpO'#CtOOOP'#DT'#DTOOOP'#Cv'#CvQQOaOOOOOW'#Cw'#CwO#eOxO,59QOOOP,59Q,59QOOOO'#Cx'#CxO#mOpO,59TO#uO!bO,59TOOOP'#C|'#C|O$TOaO,59RO$[OpO'#CoOOOP,59R,59ROOOQ'#C}'#C}O$dOrO,59^OOOP,59^,59^OOOS'#DO'#DOO$lOtO,59_OOOP,59_,59_O$tOpO,59`O$|OpO,59`OOOP-E6t-E6tOOOW-E6u-E6uOOOP1G.l1G.lOOOO-E6v-E6vO%UO!bO1G.oO%UO!bO1G.oO%dOpO'#CkO%lO!bO'#CyO%zO!bO1G.oOOOP1G.o1G.oOOOP1G.w1G.wOOOP-E6z-E6zOOOP1G.m1G.mO&VOpO,59ZO&_OpO,59ZOOOQ-E6{-E6{OOOP1G.x1G.xOOOS-E6|-E6|OOOP1G.y1G.yO&gOpO1G.zO&gOpO1G.zOOOP1G.z1G.zO&oO!bO7+$ZO&}O!bO7+$ZOOOP7+$Z7+$ZOOOP7+$c7+$cO'YOpO,59VO'bOpO,59VO'mO!bO,59eOOOO-E6w-E6wO'{OpO1G.uO'{OpO1G.uOOOP1G.u1G.uO(T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sliceString(t.from,t.to):""}function Kc(i,e){let t=e&&e.firstChild;return!t||t.name!="OpenTag"?"":_o(i,t)}function B$(i,e,t){let n=e&&e.getChildren("Attribute").find(s=>s.from<=t&&s.to>=t),r=n&&n.getChild("AttributeName");return r?i.sliceString(r.from,r.to):""}function Jc(i){for(let e=i&&i.parent;e;e=e.parent)if(e.name=="Element")return e;return null}function Y$(i,e){var t;let n=B(i).resolveInner(e,-1),r=null;for(let s=n;!r&&s.parent;s=s.parent)(s.name=="OpenTag"||s.name=="CloseTag"||s.name=="SelfClosingTag"||s.name=="MismatchedCloseTag")&&(r=s);if(r&&(r.to>e||r.lastChild.type.isError)){let s=r.parent;if(n.name=="TagName")return r.name=="CloseTag"||r.name=="MismatchedCloseTag"?{type:"closeTag",from:n.from,context:s}:{type:"openTag",from:n.from,context:Jc(s)};if(n.name=="AttributeName")return{type:"attrName",from:n.from,context:r};if(n.name=="AttributeValue")return{type:"attrValue",from:n.from,context:r};let o=n==r||n.name=="Attribute"?n.childBefore(e):n;return o?.name=="StartTag"?{type:"openTag",from:e,context:Jc(s)}:o?.name=="StartCloseTag"&&o.to<=e?{type:"closeTag",from:e,context:s}:o?.name=="Is"?{type:"attrValue",from:e,context:r}:o?{type:"attrName",from:e,context:r}:null}else if(n.name=="StartCloseTag")return{type:"closeTag",from:e,context:n.parent};for(;n.parent&&n.to==e&&!(!((t=n.lastChild)===null||t===void 0)&&t.type.isError);)n=n.parent;return n.name=="Element"||n.name=="Text"||n.name=="Document"?{type:"tag",from:e,context:n.name=="Element"?n:Jc(n)}:null}var tf=class{constructor(e,t,n){this.attrs=t,this.attrValues=n,this.children=[],this.name=e.name,this.completion=Object.assign(Object.assign({type:"type"},e.completion||{}),{label:this.name}),this.openCompletion=Object.assign(Object.assign({},this.completion),{label:"<"+this.name}),this.closeCompletion=Object.assign(Object.assign({},this.completion),{label:"",boost:2}),this.closeNameCompletion=Object.assign(Object.assign({},this.completion),{label:this.name+">"}),this.text=e.textContent?e.textContent.map(r=>({label:r,type:"text"})):[]}},ef=/^[:\-\.\w\u00b7-\uffff]*$/;function w0(i){return Object.assign(Object.assign({type:"property"},i.completion||{}),{label:i.name})}function v0(i){return typeof i=="string"?{label:`"${i}"`,type:"constant"}:/^"/.test(i.label)?i:Object.assign(Object.assign({},i),{label:`"${i.label}"`})}function I$(i,e){let t=[],n=[],r=Object.create(null);for(let a of e){let h=w0(a);t.push(h),a.global&&n.push(h),a.values&&(r[a.name]=a.values.map(v0))}let s=[],o=[],l=Object.create(null);for(let a of i){let h=n,c=r;a.attributes&&(h=h.concat(a.attributes.map(u=>typeof u=="string"?t.find(O=>O.label==u)||{label:u,type:"property"}:(u.values&&(c==r&&(c=Object.create(c)),c[u.name]=u.values.map(v0)),w0(u)))));let f=new tf(a,h,c);l[f.name]=f,s.push(f),a.top&&o.push(f)}o.length||(o=s);for(let a=0;a{var h;let{doc:c}=a.state,f=Y$(a.state,a.pos);if(!f||f.type=="tag"&&!a.explicit)return null;let{type:u,from:O,context:d}=f;if(u=="openTag"){let m=o,g=Kc(c,d);if(g){let S=l[g];m=S?.children||s}return{from:O,options:m.map(S=>S.completion),validFor:ef}}else if(u=="closeTag"){let m=Kc(c,d);return m?{from:O,to:a.pos+(c.sliceString(a.pos,a.pos+1)==">"?1:0),options:[((h=l[m])===null||h===void 0?void 0:h.closeNameCompletion)||{label:m+">",type:"type"}],validFor:ef}:null}else if(u=="attrName"){let m=l[_o(c,d)];return{from:O,options:m?.attrs||n,validFor:ef}}else if(u=="attrValue"){let m=B$(c,d,O);if(!m)return null;let g=l[_o(c,d)],S=(g?.attrValues||r)[m];return!S||!S.length?null:{from:O,to:a.pos+(c.sliceString(a.pos,a.pos+1)=='"'?1:0),options:S,validFor:/^"[^"]*"?$/}}else if(u=="tag"){let m=Kc(c,d),g=l[m],S=[],b=d&&d.lastChild;m&&(!b||b.name!="CloseTag"||_o(c,b)!=m)&&S.push(g?g.closeCompletion:{label:"",type:"type",boost:2});let y=S.concat((g?.children||(d?s:o)).map(Z=>Z.openCompletion));if(d&&g?.text.length){let Z=d.firstChild;Z.to>a.pos-20&&!/\S/.test(a.state.sliceDoc(Z.to,a.pos))&&(y=y.concat(g.text))}return{from:O,options:y,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}else return null}}var nf=We.define({name:"xml",parser:k0.configure({props:[we.add({Element(i){let e=/^\s*<\//.test(i.textAfter);return i.lineIndent(i.node.from)+(e?0:i.unit)},"OpenTag CloseTag SelfClosingTag"(i){return i.column(i.node.from)+i.unit}}),ve.add({Element(i){let e=i.firstChild,t=i.lastChild;return!e||e.name!="OpenTag"?null:{from:e.to,to:t.name=="CloseTag"?t.from:i.to}}}),nr.add({"OpenTag CloseTag":i=>i.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:""}},indentOnInput:/^\s*<\/$/}});function P0(i={}){let e=[nf.data.of({autocomplete:I$(i.elements||[],i.attributes||[])})];return i.autoCloseTags!==!1&&e.push(G$),new be(nf,e)}function $0(i,e,t=i.length){if(!e)return"";let n=e.firstChild,r=n&&n.getChild("TagName");return r?i.sliceString(r.from,Math.min(r.to,t)):""}var G$=x.inputHandler.of((i,e,t,n,r)=>{if(i.composing||i.state.readOnly||e!=t||n!=">"&&n!="/"||!nf.isActiveAt(i.state,e,-1))return!1;let s=r(),{state:o}=s,l=o.changeByRange(a=>{var h,c,f;let{head:u}=a,O=o.doc.sliceString(u-1,u)==n,d=B(o).resolveInner(u,-1),m;if(O&&n==">"&&d.name=="EndTag"){let g=d.parent;if(((c=(h=g.parent)===null||h===void 0?void 0:h.lastChild)===null||c===void 0?void 0:c.name)!="CloseTag"&&(m=$0(o.doc,g.parent,u))){let S=u+(o.doc.sliceString(u,u+1)===">"?1:0),b=``;return{range:a,changes:{from:u,to:S,insert:b}}}}else if(O&&n=="/"&&d.name=="StartCloseTag"){let g=d.parent;if(d.from==u-2&&((f=g.lastChild)===null||f===void 0?void 0:f.name)!="CloseTag"&&(m=$0(o.doc,g,u))){let S=u+(o.doc.sliceString(u,u+1)===">"?1:0),b=`${m}>`;return{range:Q.cursor(u+b.length,-1),changes:{from:u,to:S,insert:b}}}}return{range:a}});return l.changes.empty?!1:(i.dispatch([s,o.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});function of(i,e,t,n,r,s){this.indented=i,this.column=e,this.type=t,this.info=n,this.align=r,this.prev=s}function zo(i,e,t,n){var r=i.indented;return i.context&&i.context.type=="statement"&&t!="statement"&&(r=i.context.indented),i.context=new of(r,e,t,n,null,i.context)}function Cr(i){var e=i.context.type;return(e==")"||e=="]"||e=="}")&&(i.indented=i.context.indented),i.context=i.context.prev}function T0(i,e,t){if(e.prevToken=="variable"||e.prevToken=="type"||/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(i.string.slice(0,t))||e.typeAtEndOfLine&&i.column()==i.indentation())return!0}function rf(i){for(;;){if(!i||i.type=="top")return!0;if(i.type=="}"&&i.prev.info!="namespace")return!1;i=i.prev}}function Ne(i){var e=i.statementIndentUnit,t=i.dontAlignCalls,n=i.keywords||{},r=i.types||{},s=i.builtin||{},o=i.blockKeywords||{},l=i.defKeywords||{},a=i.atoms||{},h=i.hooks||{},c=i.multiLineStrings,f=i.indentStatements!==!1,u=i.indentSwitch!==!1,O=i.namespaceSeparator,d=i.isPunctuationChar||/[\[\]{}\(\),;\:\.]/,m=i.numberStart||/[\d\.]/,g=i.number||/^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,S=i.isOperatorChar||/[+\-*&%=<>!?|\/]/,b=i.isIdentifierChar||/[\w\$_\xa1-\uffff]/,y=i.isReservedIdentifier||!1,Z,$;function v(C,P){var w=C.next();if(h[w]){var X=h[w](C,P);if(X!==!1)return X}if(w=='"'||w=="'")return P.tokenize=T(w),P.tokenize(C,P);if(m.test(w)){if(C.backUp(1),C.match(g))return"number";C.next()}if(d.test(w))return Z=w,null;if(w=="/"){if(C.eat("*"))return P.tokenize=Y,Y(C,P);if(C.eat("/"))return C.skipToEnd(),"comment"}if(S.test(w)){for(;!C.match(/^\/[\/*]/,!1)&&C.eat(S););return"operator"}if(C.eatWhile(b),O)for(;C.match(O);)C.eatWhile(b);var W=C.current();return Lt(n,W)?(Lt(o,W)&&(Z="newstatement"),Lt(l,W)&&($=!0),"keyword"):Lt(r,W)?"type":Lt(s,W)||y&&y(W)?(Lt(o,W)&&(Z="newstatement"),"builtin"):Lt(a,W)?"atom":"variable"}function T(C){return function(P,w){for(var X=!1,W,N=!1;(W=P.next())!=null;){if(W==C&&!X){N=!0;break}X=!X&&W=="\\"}return(N||!(X||c))&&(w.tokenize=null),"string"}}function Y(C,P){for(var w=!1,X;X=C.next();){if(X=="/"&&w){P.tokenize=null;break}w=X=="*"}return"comment"}function V(C,P){i.typeFirstDefinitions&&C.eol()&&rf(P.context)&&(P.typeAtEndOfLine=T0(C,P,C.pos))}return{name:i.name,startState:function(C){return{tokenize:null,context:new of(-C,0,"top",null,!1),indented:0,startOfLine:!0,prevToken:null}},token:function(C,P){var w=P.context;if(C.sol()&&(w.align==null&&(w.align=!1),P.indented=C.indentation(),P.startOfLine=!0),C.eatSpace())return V(C,P),null;Z=$=null;var X=(P.tokenize||v)(C,P);if(X=="comment"||X=="meta")return X;if(w.align==null&&(w.align=!0),Z==";"||Z==":"||Z==","&&C.match(/^\s*(?:\/\/.*)?$/,!1))for(;P.context.type=="statement";)Cr(P);else if(Z=="{")zo(P,C.column(),"}");else if(Z=="[")zo(P,C.column(),"]");else if(Z=="(")zo(P,C.column(),")");else if(Z=="}"){for(;w.type=="statement";)w=Cr(P);for(w.type=="}"&&(w=Cr(P));w.type=="statement";)w=Cr(P)}else Z==w.type?Cr(P):f&&((w.type=="}"||w.type=="top")&&Z!=";"||w.type=="statement"&&Z=="newstatement")&&zo(P,C.column(),"statement",C.current());if(X=="variable"&&(P.prevToken=="def"||i.typeFirstDefinitions&&T0(C,P,C.start)&&rf(P.context)&&C.match(/^\s*\(/,!1))&&(X="def"),h.token){var W=h.token(C,P,X);W!==void 0&&(X=W)}return X=="def"&&i.styleDefs===!1&&(X="variable"),P.startOfLine=!1,P.prevToken=$?"def":X||Z,V(C,P),X},indent:function(C,P,w){if(C.tokenize!=v&&C.tokenize!=null||C.typeAtEndOfLine&&rf(C.context))return null;var X=C.context,W=P&&P.charAt(0),N=W==X.type;if(X.type=="statement"&&W=="}"&&(X=X.prev),i.dontIndentStatements)for(;X.type=="statement"&&i.dontIndentStatements.test(X.info);)X=X.prev;if(h.indent){var Oe=h.indent(C,X,P,w.unit);if(typeof Oe=="number")return Oe}var Pe=X.prev&&X.prev.info=="switch";if(i.allmanIndentation&&/[{(]/.test(W)){for(;X.type!="top"&&X.type!="}";)X=X.prev;return X.indented}return X.type=="statement"?X.indented+(W=="{"?0:e||w.unit):X.align&&(!t||X.type!=")")?X.column+(N?0:1):X.type==")"&&!N?X.indented+(e||w.unit):X.indented+(N?0:w.unit)+(!N&&Pe&&!/^(?:case|default)\b/.test(P)?w.unit:0)},languageData:{indentOnInput:u?/^\s*(?:case .*?:|default:|\{\}?|\})$/:/^\s*[{}]$/,commentTokens:{line:"//",block:{open:"/*",close:"*/"}},autocomplete:Object.keys(n).concat(Object.keys(r)).concat(Object.keys(s)).concat(Object.keys(a)),...i.languageData}}}function _(i){for(var e={},t=i.split(" "),n=0;n!?|\/#:@]/,hooks:{"@":function(i){return i.eatWhile(/[\w\$_]/),"meta"},'"':function(i,e){return i.match('""')?(e.tokenize=z0,e.tokenize(i,e)):!1},"'":function(i){return i.match(/^(\\[^'\s]+|[^\\'])'/)?"character":(i.eatWhile(/[\w\$_\xa1-\uffff]/),"atom")},"=":function(i,e){var t=e.context;return t.type=="}"&&t.align&&i.eat(">")?(e.context=new of(t.indented,t.column,t.type,t.info,null,t.prev),"operator"):!1},"/":function(i,e){return i.eat("*")?(e.tokenize=Xr(1),e.tokenize(i,e)):!1}},languageData:{closeBrackets:{brackets:["(","[","{","'",'"','"""']}}});function F$(i){return function(e,t){for(var n=!1,r,s=!1;!e.eol();){if(!i&&!n&&e.match('"')){s=!0;break}if(i&&e.match('"""')){s=!0;break}r=e.next(),!n&&r=="$"&&e.match("{")&&e.skipTo("}"),n=!n&&r=="\\"&&!i}return(s||!i)&&(t.tokenize=null),"string"}}var jC=Ne({name:"kotlin",keywords:_("package as typealias class interface this super val operator var fun for is in This throw return annotation break continue object if else while do try when !in !is as? file import where by get set abstract enum open inner override private public internal protected catch finally out final vararg reified dynamic companion constructor init sealed field property receiver param sparam lateinit data inline noinline tailrec external annotation crossinline const operator infix suspend actual expect setparam"),types:_("Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void Annotation Any BooleanArray ByteArray Char CharArray DeprecationLevel DoubleArray Enum FloatArray Function Int IntArray Lazy LazyThreadSafetyMode LongArray Nothing ShortArray Unit"),intendSwitch:!1,indentStatements:!1,multiLineStrings:!0,number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+(\.\d+)?|\.\d+)(?:e[-+]?[\d_]+)?)(ul?|l|f)?/i,blockKeywords:_("catch class do else finally for if where try while enum"),defKeywords:_("class val var object interface fun"),atoms:_("true false null this"),hooks:{"@":function(i){return i.eatWhile(/[\w\$_]/),"meta"},"*":function(i,e){return e.prevToken=="."?"variable":"operator"},'"':function(i,e){return e.tokenize=F$(i.match('""')),e.tokenize(i,e)},"/":function(i,e){return i.eat("*")?(e.tokenize=Xr(1),e.tokenize(i,e)):!1},indent:function(i,e,t,n){var r=t&&t.charAt(0);if((i.prevToken=="}"||i.prevToken==")")&&t=="")return i.indented;if(i.prevToken=="operator"&&t!="}"&&i.context.type!="}"||i.prevToken=="variable"&&r=="."||(i.prevToken=="}"||i.prevToken==")")&&r==".")return n*2+e.indented;if(e.align&&e.type=="}")return e.indented+(i.context.type==(t||"").charAt(0)?0:n)}},languageData:{closeBrackets:{brackets:["(","[","{","'",'"','"""']}}}),VC=Ne({name:"shader",keywords:_("sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),types:_("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4"),blockKeywords:_("for while do if else struct"),builtin:_("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),atoms:_("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TextureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),indentSwitch:!1,hooks:{"#":ci}}),DC=Ne({name:"nesc",keywords:_(Rr+" as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),types:Ar,blockKeywords:_(Zr),atoms:_("null true false"),hooks:{"#":ci}}),BC=Ne({name:"objectivec",keywords:_(Rr+" "+A0),types:q0,builtin:_(Z0),blockKeywords:_(Zr+" @synthesize @try @catch @finally @autoreleasepool @synchronized"),defKeywords:_(Wo+" @interface @implementation @protocol @class"),dontIndentStatements:/^@.*$/,typeFirstDefinitions:!0,atoms:_("YES NO NULL Nil nil true false nullptr"),isReservedIdentifier:jo,hooks:{"#":ci,"*":Lo}}),YC=Ne({name:"objectivecpp",keywords:_(Rr+" "+A0+" "+R0),types:q0,builtin:_(Z0),blockKeywords:_(Zr+" @synthesize @try @catch @finally @autoreleasepool @synchronized class try catch"),defKeywords:_(Wo+" @interface @implementation @protocol @class class namespace"),dontIndentStatements:/^@.*$|^template$/,typeFirstDefinitions:!0,atoms:_("YES NO NULL Nil nil true false nullptr"),isReservedIdentifier:jo,hooks:{"#":ci,"*":Lo,u:hi,U:hi,L:hi,R:hi,0:ue,1:ue,2:ue,3:ue,4:ue,5:ue,6:ue,7:ue,8:ue,9:ue,token:function(i,e,t){if(t=="variable"&&i.peek()=="("&&(e.prevToken==";"||e.prevToken==null||e.prevToken=="}")&&M0(i.current()))return"def"}},namespaceSeparator:"::"}),IC=Ne({name:"squirrel",keywords:_("base break clone continue const default delete enum extends function in class foreach local resume return this throw typeof yield constructor instanceof static"),types:Ar,blockKeywords:_("case catch class else for foreach if switch try while"),defKeywords:_("function local class"),typeFirstDefinitions:!0,atoms:_("true false null"),hooks:{"#":ci}}),Eo=null;function E0(i){return function(e,t){for(var n=!1,r,s=!1;!e.eol();){if(!n&&e.match('"')&&(i=="single"||e.match('""'))){s=!0;break}if(!n&&e.match("``")){Eo=E0(i),s=!0;break}r=e.next(),n=i=="single"&&!n&&r=="\\"}return s&&(t.tokenize=null),"string"}}var GC=Ne({name:"ceylon",keywords:_("abstracts alias assembly assert assign break case catch class continue dynamic else exists extends finally for function given if import in interface is let module new nonempty object of out outer package return satisfies super switch then this throw try value void while"),types:function(i){var e=i.charAt(0);return e===e.toUpperCase()&&e!==e.toLowerCase()},blockKeywords:_("case catch class dynamic else finally for function if interface module new object switch try while"),defKeywords:_("class dynamic function interface module object package value"),builtin:_("abstract actual aliased annotation by default deprecated doc final formal late license native optional sealed see serializable shared suppressWarnings tagged throws variable"),isPunctuationChar:/[\[\]{}\(\),;\:\.`]/,isOperatorChar:/[+\-*&%=<>!?|^~:\/]/,numberStart:/[\d#$]/,number:/^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,multiLineStrings:!0,typeFirstDefinitions:!0,atoms:_("true false null larger smaller equal empty finished"),indentSwitch:!1,styleDefs:!1,hooks:{"@":function(i){return i.eatWhile(/[\w\$_]/),"meta"},'"':function(i,e){return e.tokenize=E0(i.match('""')?"triple":"single"),e.tokenize(i,e)},"`":function(i,e){return!Eo||!i.match("`")?!1:(e.tokenize=Eo,Eo=null,e.tokenize(i,e))},"'":function(i){return i.match(/^(\\[^'\s]+|[^\\'])'/)?"string.special":(i.eatWhile(/[\w\$_\xa1-\uffff]/),"atom")},token:function(i,e,t){if((t=="variable"||t=="type")&&e.prevToken==".")return"variableName.special"}},languageData:{closeBrackets:{brackets:["(","[","{","'",'"','"""']}}});function H$(i){(i.interpolationStack||(i.interpolationStack=[])).push(i.tokenize)}function W0(i){return(i.interpolationStack||(i.interpolationStack=[])).pop()}function K$(i){return i.interpolationStack?i.interpolationStack.length:0}function sf(i,e,t,n){var r=!1;if(e.eat(i))if(e.eat(i))r=!0;else return"string";function s(o,l){for(var a=!1;!o.eol();){if(!n&&!a&&o.peek()=="$")return H$(l),l.tokenize=J$,"string";var h=o.next();if(h==i&&!a&&(!r||o.match(i+i))){l.tokenize=null;break}a=!n&&!a&&h=="\\"}return"string"}return t.tokenize=s,s(e,t)}function J$(i,e){return i.eat("$"),i.eat("{")?e.tokenize=null:e.tokenize=eP,null}function eP(i,e){return i.eatWhile(/[\w_]/),e.tokenize=W0(e),"variable"}var NC=Ne({name:"dart",keywords:_("this super static final const abstract class extends external factory implements mixin get native set typedef with enum throw rethrow assert break case continue default in return new deferred async await covariant try catch finally do else for if switch while import library export part of show hide is as extension on yield late required sealed base interface when inline"),blockKeywords:_("try catch finally do else for if switch while"),builtin:_("void bool num int double dynamic var String Null Never"),atoms:_("true false null"),number:/^(?:0x[a-f\d_]+|(?:[\d_]+\.?[\d_]*|\.[\d_]+)(?:e[-+]?[\d_]+)?)/i,hooks:{"@":function(i){return i.eatWhile(/[\w\$_\.]/),"meta"},"'":function(i,e){return sf("'",i,e,!1)},'"':function(i,e){return sf('"',i,e,!1)},r:function(i,e){var t=i.peek();return t=="'"||t=='"'?sf(i.next(),i,e,!0):!1},"}":function(i,e){return K$(e)>0?(e.tokenize=W0(e),null):!1},"/":function(i,e){return i.eat("*")?(e.tokenize=Xr(1),e.tokenize(i,e)):!1},token:function(i,e,t){if(t=="variable"){var n=RegExp("^[_$]*[A-Z][a-zA-Z0-9_$]*$","g");if(n.test(i.current()))return"type"}}}});var lf={};function af(i,e){for(var t=0;t1&&i.eat("$");var t=i.next();return/['"({]/.test(t)?(e.tokens[0]=Vo(t,t=="("?"quote":t=="{"?"def":"string"),wn(i,e)):(/\d/.test(t)||i.eatWhile(/\w/),e.tokens.shift(),"def")};function nP(i){return function(e,t){return e.sol()&&e.string==i&&t.tokens.shift(),e.skipToEnd(),"string.special"}}function wn(i,e){return(e.tokens[0]||tP)(i,e)}var B0={name:"shell",startState:function(){return{tokens:[]}},token:function(i,e){return wn(i,e)},languageData:{autocomplete:L0.concat(j0,V0),closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"#"}}};var rP=Jn.define(_0),sP=Jn.define(B0);function oP(){return rP}function lP(){return sP}function I0(i){if(!i)return[];switch(i.split(".").pop()?.toLowerCase()){case"cs":return[oP()];case"js":case"mjs":case"cjs":return[bn()];case"ts":case"tsx":return[bn({typescript:!0})];case"jsx":return[bn({jsx:!0})];case"css":case"scss":case"less":return[bo()];case"html":case"htm":case"razor":case"cshtml":return[ko()];case"json":return[lg()];case"md":case"markdown":return[Jg()];case"py":return[S0()];case"xml":case"xaml":case"csproj":case"props":case"targets":case"sln":case"slnx":return[P0()];case"sh":case"bash":case"zsh":return[lP()];default:return[]}}var G0=x.theme({"&":{backgroundColor:"var(--bg-secondary, #1a1e2e)",color:"var(--text-primary, #c8d8f0)",fontSize:"var(--type-body, 0.72rem)",fontFamily:"var(--font-mono, 'SF Mono', Menlo, monospace)",borderRadius:"0 0 8px 8px"},".cm-content":{caretColor:"var(--accent-primary, #4ea8d1)",padding:"4px 0"},".cm-cursor":{borderLeftColor:"var(--accent-primary, #4ea8d1)"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground":{backgroundColor:"rgba(78, 168, 209, 0.25) !important"},".cm-gutters":{backgroundColor:"var(--bg-tertiary, rgba(255,255,255,0.03))",color:"var(--text-dim, rgba(200,216,240,0.3))",border:"none",borderRight:"1px solid var(--control-border, rgba(255,255,255,0.06))"},".cm-gutterElement":{cursor:"pointer"},".cm-activeLineGutter":{backgroundColor:"rgba(78, 168, 209, 0.1)"},".cm-activeLine":{backgroundColor:"rgba(78, 168, 209, 0.06)"},".cm-foldPlaceholder":{backgroundColor:"rgba(78, 168, 209, 0.15)",color:"var(--accent-primary, #4ea8d1)",border:"none",padding:"0 4px",borderRadius:"3px"},".cm-mergeView":{borderRadius:"0 0 8px 8px",overflow:"hidden"},".cm-merge-a .cm-changedLine":{backgroundColor:"var(--diff-del-bg, rgba(248,81,73,0.1))"},".cm-merge-b .cm-changedLine":{backgroundColor:"var(--diff-add-bg, rgba(63,185,80,0.1))"},".cm-merge-a .cm-changedText":{backgroundColor:"var(--diff-del-bg, rgba(248,81,73,0.2))"},".cm-merge-b .cm-changedText":{backgroundColor:"var(--diff-add-bg, rgba(63,185,80,0.2))"},".cm-deletedChunk":{backgroundColor:"var(--diff-del-bg, rgba(248,81,73,0.08))"},".cm-collapsedLines":{backgroundColor:"var(--bg-tertiary, rgba(255,255,255,0.03))",color:"var(--text-dim, rgba(200,216,240,0.4))",padding:"2px 12px",fontSize:"0.65rem",cursor:"pointer",borderTop:"1px solid var(--control-border, rgba(255,255,255,0.06))",borderBottom:"1px solid var(--control-border, rgba(255,255,255,0.06))"},".cm-search":{backgroundColor:"var(--bg-secondary, #1a1e2e)"},".cm-searchMatch":{backgroundColor:"rgba(255, 200, 50, 0.3)"},".cm-searchMatch-selected":{backgroundColor:"rgba(255, 200, 50, 0.5)"},".cm-panels":{backgroundColor:"var(--bg-tertiary, rgba(255,255,255,0.05))",color:"var(--text-primary, #c8d8f0)"},".cm-panel input":{backgroundColor:"var(--bg-secondary, #1a1e2e)",color:"var(--text-primary, #c8d8f0)",border:"1px solid var(--control-border, rgba(255,255,255,0.1))",borderRadius:"4px"},".cm-panel button":{backgroundColor:"var(--bg-tertiary, rgba(255,255,255,0.08))",color:"var(--text-primary, #c8d8f0)",border:"1px solid var(--control-border, rgba(255,255,255,0.1))",borderRadius:"4px"}},{dark:!0});function N0(i){return[xa(),kO(),ba(),yd(),eh(),Qa(),UO(),ir(th,{fallback:!0}),ih(),dp(),gO(),bh(),Gt.of([...gp,...Oh,...kh,...vd,...Ka,Jd]),Vh,G0,...I0(i)]}function aP(i){return[...N0(i),F.readOnly.of(!0),x.editable.of(!1)]}function hP(i,e,t){if(!(i instanceof Element))return null;let n=i.closest(".cm-gutterElement");if(!n)return null;let r=(n.textContent||"").trim(),s=Number.parseInt(r,10);if(Number.isInteger(s)&&s>0)return s;let o=e.contentDOM.getBoundingClientRect(),l=n.getBoundingClientRect(),a=e.posAtCoords({x:o.left+Math.max(8,Math.min(o.width-8,12)),y:t.clientY||l.top+l.height/2});return a==null?null:e.state.doc.lineAt(a).number}function Y0(i,e){return!i?.enableLineComments||!i.dotNetRef?[]:[x.domEventHandlers({mousedown(t,n){let r=hP(t.target,n,t);return r==null?!1:(t.preventDefault(),i.dotNetRef.invokeMethodAsync("HandleEditorLineClick",i.fileIndex??-1,i.fileName??"",e,r).catch(s=>console.error("[PolyPilotCodeMirror] Failed to send line click to .NET",s)),!0)}})]}var zi=new Map,U0=1;function cP(i,e,t,n={}){let r=document.getElementById(i);if(!r)return-1;r.innerHTML="";let s=n.editable?N0(t):aP(t),o=new x({doc:e||"",extensions:s,parent:r}),l=U0++;return zi.set(l,{type:"editor",view:o,container:r}),l}function fP(i,e,t,n,r=-1,s=null,o=!1,l={}){let a=document.getElementById(i);if(!a)return-1;a.innerHTML="";let h=I0(n),c=l.collapseUnchanged!==!1?{margin:3,minSize:4}:void 0,f={dotNetRef:s,fileIndex:r,fileName:n||"",enableLineComments:o},u=[xa(),ba(),eh(),Qa(),ir(th,{fallback:!0}),ih(),bh(),Gt.of([...Oh,...kh,...Ka]),Vh,G0,F.readOnly.of(!0),x.editable.of(!1),...h],O=new mo({a:{doc:e||"",extensions:[...u,...Y0(f,"original")]},b:{doc:t||"",extensions:[...u,...Y0(f,"modified")]},parent:a,collapseUnchanged:c,gutter:!0}),d=U0++;return zi.set(d,{type:"merge",mergeView:O,container:a}),d}function uP(i,e){let t=zi.get(i);t&&t.type==="editor"&&t.view.dispatch({changes:{from:0,to:t.view.state.doc.length,insert:e}})}function F0(i){let e=zi.get(i);e&&(e.type==="editor"?e.view.destroy():e.type==="merge"&&e.mergeView.destroy(),zi.delete(i))}function OP(){for(let[i]of zi)F0(i)}function dP(i){let e=zi.get(i);e&&(e.type==="editor"?hr(e.view):e.type==="merge"&&hr(e.mergeView.b))}window.PolyPilotCodeMirror={createEditor:cP,createMergeView:fP,updateContent:uP,dispose:F0,disposeAll:OP,openSearch:dP};})();
@hunk.Header
@(row.Left?.OldLineNo?.ToString() ?? "")
@(row.Left?.Content ?? "")
@(row.Right?.NewLineNo?.ToString() ?? "")
@(row.Right?.Content ?? "")
+ @if (row.Left?.OldLineNo is int oldLineNo) + { + + } +
@(row.Left?.Content ?? "")
+ @if (row.Right?.NewLineNo is int newLineNo) + { + + } +
@(row.Right?.Content ?? "")