@impermeable/waterproof-editor 0.12.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/dist/api/InputAreaStatus.d.ts +7 -7
  2. package/dist/api/InputAreaStatus.d.ts.map +1 -1
  3. package/dist/api/MessageHandlerEditor.d.ts +29 -0
  4. package/dist/api/MessageHandlerEditor.d.ts.map +1 -0
  5. package/dist/api/index.d.ts +6 -7
  6. package/dist/api/index.d.ts.map +1 -1
  7. package/dist/api/types.d.ts +125 -58
  8. package/dist/api/types.d.ts.map +1 -1
  9. package/dist/autocomplete/renderSymbol.d.ts +1 -2
  10. package/dist/autocomplete/renderSymbol.d.ts.map +1 -1
  11. package/dist/codeview/busy-indicator.d.ts +113 -0
  12. package/dist/codeview/busy-indicator.d.ts.map +1 -0
  13. package/dist/codeview/code-plugin.d.ts +6 -5
  14. package/dist/codeview/code-plugin.d.ts.map +1 -1
  15. package/dist/codeview/nodeview.d.ts +24 -15
  16. package/dist/codeview/nodeview.d.ts.map +1 -1
  17. package/dist/commands/command-helpers.d.ts +7 -22
  18. package/dist/commands/command-helpers.d.ts.map +1 -1
  19. package/dist/commands/commands.d.ts +6 -28
  20. package/dist/commands/commands.d.ts.map +1 -1
  21. package/dist/commands/index.d.ts +1 -2
  22. package/dist/commands/index.d.ts.map +1 -1
  23. package/dist/commands/insert-command.d.ts +7 -33
  24. package/dist/commands/insert-command.d.ts.map +1 -1
  25. package/dist/commands/types.d.ts +2 -2
  26. package/dist/commands/types.d.ts.map +1 -1
  27. package/dist/commands/utils.d.ts +16 -0
  28. package/dist/commands/utils.d.ts.map +1 -0
  29. package/dist/document/blocks/block.d.ts +12 -6
  30. package/dist/document/blocks/block.d.ts.map +1 -1
  31. package/dist/document/blocks/blocktypes.d.ts +78 -35
  32. package/dist/document/blocks/blocktypes.d.ts.map +1 -1
  33. package/dist/document/blocks/index.d.ts +2 -1
  34. package/dist/document/blocks/index.d.ts.map +1 -1
  35. package/dist/document/blocks/schema.d.ts +4 -7
  36. package/dist/document/blocks/schema.d.ts.map +1 -1
  37. package/dist/document/blocks/typeguards.d.ts +4 -5
  38. package/dist/document/blocks/typeguards.d.ts.map +1 -1
  39. package/dist/document/utils.d.ts +6 -10
  40. package/dist/document/utils.d.ts.map +1 -1
  41. package/dist/edit-utils.d.ts +10 -0
  42. package/dist/edit-utils.d.ts.map +1 -0
  43. package/dist/editor.d.ts +88 -34
  44. package/dist/editor.d.ts.map +1 -1
  45. package/dist/embedded-codemirror/embedded-codemirror-keymap.d.ts.map +1 -1
  46. package/dist/embedded-codemirror/embeddedCodemirror.d.ts +2 -2
  47. package/dist/embedded-codemirror/embeddedCodemirror.d.ts.map +1 -1
  48. package/dist/hinting/hint-plugin.d.ts +1 -2
  49. package/dist/hinting/hint-plugin.d.ts.map +1 -1
  50. package/dist/index.css +2 -2
  51. package/dist/index.d.ts +6 -1
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +62 -81
  54. package/dist/inputArea.d.ts +2 -3
  55. package/dist/inputArea.d.ts.map +1 -1
  56. package/dist/mapping/Tree.d.ts +91 -0
  57. package/dist/mapping/Tree.d.ts.map +1 -0
  58. package/dist/mapping/helper-functions.d.ts +4 -0
  59. package/dist/mapping/helper-functions.d.ts.map +1 -0
  60. package/dist/mapping/index.d.ts +4 -0
  61. package/dist/mapping/index.d.ts.map +1 -0
  62. package/dist/mapping/mapping.d.ts +82 -0
  63. package/dist/mapping/mapping.d.ts.map +1 -0
  64. package/dist/mapping/nodeUpdate.d.ts +27 -0
  65. package/dist/mapping/nodeUpdate.d.ts.map +1 -0
  66. package/dist/mapping/textUpdate.d.ts +16 -0
  67. package/dist/mapping/textUpdate.d.ts.map +1 -0
  68. package/dist/mapping/types.d.ts +22 -0
  69. package/dist/mapping/types.d.ts.map +1 -0
  70. package/dist/markdown-defaults/index.d.ts +4 -0
  71. package/dist/markdown-defaults/index.d.ts.map +1 -0
  72. package/dist/markdown-defaults/statemachine.d.ts +23 -0
  73. package/dist/markdown-defaults/statemachine.d.ts.map +1 -0
  74. package/dist/markup-views/SwitchableViewPlugin.d.ts +22 -0
  75. package/dist/markup-views/SwitchableViewPlugin.d.ts.map +1 -0
  76. package/dist/markup-views/index.d.ts +1 -4
  77. package/dist/markup-views/index.d.ts.map +1 -1
  78. package/dist/markup-views/switchable-view/EditableView.d.ts.map +1 -1
  79. package/dist/markup-views/switchable-view/RenderedView.d.ts +1 -1
  80. package/dist/markup-views/switchable-view/RenderedView.d.ts.map +1 -1
  81. package/dist/markup-views/switchable-view/SwitchableView.d.ts +5 -8
  82. package/dist/markup-views/switchable-view/SwitchableView.d.ts.map +1 -1
  83. package/dist/menubar/menubar.d.ts +2 -4
  84. package/dist/menubar/menubar.d.ts.map +1 -1
  85. package/dist/progressBar.d.ts +31 -11
  86. package/dist/progressBar.d.ts.map +1 -1
  87. package/dist/qedStatus.d.ts.map +1 -1
  88. package/dist/schema/schema.d.ts +4 -3
  89. package/dist/schema/schema.d.ts.map +1 -1
  90. package/dist/serialization/DocumentSerializer.d.ts +127 -0
  91. package/dist/serialization/DocumentSerializer.d.ts.map +1 -0
  92. package/dist/styles/index.d.ts +3 -5
  93. package/dist/styles/index.d.ts.map +1 -1
  94. package/dist/styles/waterproof-defaults.css +2 -0
  95. package/dist/translation/index.d.ts +1 -1
  96. package/dist/translation/index.d.ts.map +1 -1
  97. package/dist/translation/toMarkdownTranslation.d.ts +3 -0
  98. package/dist/translation/toMarkdownTranslation.d.ts.map +1 -0
  99. package/impermeable-waterproof-editor-0.14.0.tgz +0 -0
  100. package/package.json +33 -10
  101. package/tsconfig.test.json +14 -0
@@ -2,13 +2,13 @@
2
2
  * The status of an input area.
3
3
  */
4
4
  export declare enum InputAreaStatus {
5
- /** The proof is correct. */
6
- Proven = "proven",
7
- /** The proof is unfinished or contains an error. */
8
- Incomplete = "incomplete",
9
- /** The input area does not contain `Qed.` at the end, so the status cannot be determined. */
5
+ /** The content of the input area is considered correct. */
6
+ Correct = "correct",
7
+ /** The content of the input area is considered incorrect. */
8
+ Incorrect = "incorrect",
9
+ /** The input area is invalid and hence the status can not be determined. */
10
10
  Invalid = "invalid",
11
- /** Not in view, so was not requested */
12
- NotInView = "not-in-view"
11
+ /** The input area was out of view and thus the status was not determined. */
12
+ OutOfView = "out-of-view"
13
13
  }
14
14
  //# sourceMappingURL=InputAreaStatus.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"InputAreaStatus.d.ts","sourceRoot":"","sources":["../../src/api/InputAreaStatus.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,eAAe;IACvB,4BAA4B;IAC5B,MAAM,WAAW;IACjB,oDAAoD;IACpD,UAAU,eAAe;IACzB,6FAA6F;IAC7F,OAAO,YAAY;IACnB,wCAAwC;IACxC,SAAS,gBAAgB;CAC5B"}
1
+ {"version":3,"file":"InputAreaStatus.d.ts","sourceRoot":"","sources":["../../src/api/InputAreaStatus.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,eAAe;IACvB,2DAA2D;IAC3D,OAAO,YAAY;IACnB,6DAA6D;IAC7D,SAAS,cAAc;IACvB,4EAA4E;IAC5E,OAAO,YAAY;IACnB,6EAA6E;IAC7E,SAAS,gBAAgB;CAC5B"}
@@ -0,0 +1,29 @@
1
+ import type { Completion } from "@codemirror/autocomplete";
2
+ import type { HistoryChange, OffsetDiagnostic, ThemeStyle } from "./types";
3
+ import type { InputAreaStatus } from "./InputAreaStatus";
4
+ /**
5
+ * API surface expected by the extension-side webview message router.
6
+ *
7
+ * This contract lives in the editor package because the extension sends
8
+ * messages to an editor instance and should depend on the editor's public API.
9
+ */
10
+ export interface MessageHandlerEditor {
11
+ init: (value: string, version: number) => void;
12
+ insertSymbol: (symbolUnicode: string) => boolean;
13
+ handleSnippet: (template: string) => void;
14
+ replaceRange: (start: number, end: number, text: string) => boolean;
15
+ handleCompletions: (completions: Completion[]) => void;
16
+ setInputAreaStatus: (statuses: InputAreaStatus[]) => void;
17
+ setShowLineNumbers: (show: boolean) => void;
18
+ setShowMenuItems: (show: boolean) => void;
19
+ handleHistoryChange: (historyChange: HistoryChange) => void;
20
+ updateLockingState: (teacherModeEnabled: boolean) => void;
21
+ removeBusyIndicators: () => void;
22
+ reportProgress: (at: number, numberOfLines: number, label: string) => void;
23
+ setBusyIndicator: (from: number) => void;
24
+ setActiveDiagnostics: (diagnostics: Array<OffsetDiagnostic>) => void;
25
+ startSpinner: () => void;
26
+ stopSpinner: () => void;
27
+ updateNodeViewThemes: (theme: ThemeStyle) => void;
28
+ }
29
+ //# sourceMappingURL=MessageHandlerEditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MessageHandlerEditor.d.ts","sourceRoot":"","sources":["../../src/api/MessageHandlerEditor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACpC,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,YAAY,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,OAAO,CAAC;IACjD,aAAa,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IACpE,iBAAiB,EAAE,CAAC,WAAW,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC;IACvD,kBAAkB,EAAE,CAAC,QAAQ,EAAE,eAAe,EAAE,KAAK,IAAI,CAAC;IAC1D,kBAAkB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5C,gBAAgB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC1C,mBAAmB,EAAE,CAAC,aAAa,EAAE,aAAa,KAAK,IAAI,CAAC;IAC5D,kBAAkB,EAAE,CAAC,kBAAkB,EAAE,OAAO,KAAK,IAAI,CAAC;IAC1D,oBAAoB,EAAE,MAAM,IAAI,CAAC;IACjC,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3E,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,oBAAoB,EAAE,CAAC,WAAW,EAAE,KAAK,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACrE,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,oBAAoB,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;CAClD"}
@@ -1,12 +1,11 @@
1
1
  export { DocChange, WrappingDocChange } from "./DocChange";
2
+ export { EditorState, Transaction } from "prosemirror-state";
2
3
  export { InputAreaStatus } from "./InputAreaStatus";
3
- export { LineNumber } from "./LineNumber";
4
4
  export { Severity, SeverityLabel, SeverityLabelMap } from "./Severity";
5
- export { FileFormat } from "./FileFormat";
5
+ export type { MessageHandlerEditor } from "./MessageHandlerEditor";
6
6
  export * from "./types";
7
- export { WaterproofCompletion, WaterproofSymbol } from "./Completions";
8
- export { Completion } from "@codemirror/autocomplete";
9
- export { Step, ReplaceStep, ReplaceAroundStep } from "prosemirror-transform";
10
- export { Fragment } from "prosemirror-model";
11
- export { ServerStatus, Idle, Busy } from "./ServerStatus";
7
+ export type { WaterproofCompletion, WaterproofSymbol } from "./Completions";
8
+ export type { Completion } from "@codemirror/autocomplete";
9
+ export { DocumentSerializer } from "../serialization/DocumentSerializer";
10
+ export { Mapping } from "../mapping";
12
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAG3D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAC,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEvE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEvE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE3D,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAG7D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACvE,YAAY,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEnE,cAAc,SAAS,CAAC;AAExB,YAAY,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAE5E,YAAY,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAEzE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC"}
@@ -1,24 +1,18 @@
1
- import { Step } from "prosemirror-transform";
2
- import { DocChange, WrappingDocChange, Severity, WaterproofCompletion, WaterproofSymbol } from ".";
1
+ import { HighlightStyle, LanguageSupport } from "@codemirror/language";
2
+ import { EditorState } from "prosemirror-state";
3
3
  import { Block } from "../document";
4
- /**
5
- * Represents an area of text, that is editable in the prosemirror view and its
6
- * mapping to the vscode document
7
- */
8
- export type StringCell = {
9
- /** The prosemirror starting index of this cell */
10
- startProse: number;
11
- /** The prosemirror ending index of this cell */
12
- endProse: number;
13
- /** The starting index of this cell in the text document string vscode side */
14
- startText: number;
15
- /** The ending index of this cell in the text document string vscode side */
16
- endText: number;
17
- };
4
+ import { DocumentSerializer } from "../serialization/DocumentSerializer";
5
+ import { WaterproofCompletion, WaterproofSymbol } from "./Completions";
6
+ import { DocChange, WrappingDocChange } from "./DocChange";
7
+ import { Severity } from "./Severity";
18
8
  export type Positioned<A> = {
19
9
  obj: A;
20
10
  pos: number | undefined;
21
11
  };
12
+ export type Range = {
13
+ from: number;
14
+ to: number;
15
+ };
22
16
  /**
23
17
  * A `WaterproofDocument` is a collection of `Block`s. Every Block in this WaterproofDocument will get translated into some ProseMirror node.
24
18
  *
@@ -43,18 +37,91 @@ export type WaterproofCallbacks = {
43
37
  applyStepError: (errorMessage: string) => void;
44
38
  /** Used by the editor to communicate the current cursor position, `cursorPosition` is an offset based position into the document. */
45
39
  cursorChange: (cursorPosition: number) => void;
46
- /** Used to communicate that the linenumbers need to be recomputed for the current document */
47
- lineNumbers: (linenumbers: Array<number>, version: number) => void;
48
40
  /** Fired by the editor when the viewport (the user visible part of the editor changes) */
49
41
  viewportHint: (start: number, end: number) => void;
50
42
  };
51
- export declare abstract class WaterproofMapping {
52
- abstract getMapping: () => Map<number, StringCell>;
53
- abstract get version(): number;
54
- abstract findPosition: (index: number) => number;
55
- abstract findInvPosition: (index: number) => number;
56
- abstract update: (step: Step) => DocChange | WrappingDocChange;
43
+ /**
44
+ * Type describing the open and close tag for a cell.
45
+ */
46
+ export type OpenCloseTag = {
47
+ openTag: string;
48
+ closeTag: string;
49
+ };
50
+ export declare const enum TextContentOfSpecifier {
51
+ CODE = 1,// = 001
52
+ MARKDOWN = 2,// = 010
53
+ MATH_DISPLAY = 4
54
+ }
55
+ /**
56
+ * Type describing whether the open tag requires a newline before and whether the closing tag requires a newline after.
57
+ *
58
+ * Together with the string representation this will ensure that the tags marked with `true` will appear on their own line.
59
+ *
60
+ * Example: The ` ```language ` and ` ``` ` tags in a Markdown file should be placed on their own line (i.e. the first backtick should be placed as the first character on a line. )
61
+ * We ensure this by setting the open and close tag (see {@linkcode OpenCloseTag}) to ` ```language\n ` and ` \n``` ` respectively and setting both `openRequiresNewline` and `closeRequiersNewline` to true.
62
+ *
63
+ * When inserting new nodes into the document WaterproofEditor will ensure that the nodes marked with `openRequiresNewline = true` always have a newline before
64
+ * and nodes marked with `closeRequiresNewline = true` always have a newline after.
65
+ */
66
+ export type RequiresNewline = {
67
+ openRequiresNewline: boolean;
68
+ closeRequiresNewline: boolean;
69
+ };
70
+ /**
71
+ * The `TagConfiguration` describes how the different parts of a document on disk are described/delimited. WaterproofEditor will use
72
+ * these tags when generating edits and serializing the document.
73
+ *
74
+ * _Note_: The tags described here should be the same as generating when
75
+ *
76
+ * For example in a Markdown file, code should be placed in between ` ```language ` and ` ``` `, where `language` denotes the language of the code.
77
+ *
78
+ * Every type of cell representable in `WaterproofEditor` should receive some form of tag. If the content of some cell has no open or close tag use `""`.
79
+ */
80
+ export type TagConfiguration = {
81
+ markdown: OpenCloseTag & RequiresNewline;
82
+ code: OpenCloseTag & RequiresNewline;
83
+ hint: {
84
+ openTag: ((title: string) => string);
85
+ closeTag: string;
86
+ } & RequiresNewline;
87
+ input: OpenCloseTag & RequiresNewline;
88
+ math: OpenCloseTag & RequiresNewline;
89
+ container: {
90
+ openTag: (name: string) => string;
91
+ closeTag: string;
92
+ } & RequiresNewline;
93
+ };
94
+ export declare class NodeUpdateError extends Error {
95
+ constructor(message: string);
96
+ }
97
+ export declare class TextUpdateError extends Error {
98
+ constructor(message: string);
99
+ }
100
+ export declare class MappingError extends Error {
101
+ constructor(message: string);
57
102
  }
103
+ export type MenuBarEntry = {
104
+ /** The text to show in the menubar */
105
+ title: string;
106
+ /** The text to show on hover over the menubar entry */
107
+ hoverText: string;
108
+ /** The function to execute when the button is clicked */
109
+ callback: () => void;
110
+ /** Optional predicate called with the current editor state to determine if the button should be active (enabled). When omitted the button is always active. */
111
+ isActive?: (state: EditorState) => boolean;
112
+ /** Control the visibility of the entry */
113
+ buttonVisibility?: {
114
+ /** When set to true the entry will only be visible in teacher mode */
115
+ teacherModeOnly?: boolean;
116
+ /** When set to true the button will be displayed regardless of whether the menubar entries are hidden via the setting */
117
+ showByDefault?: boolean;
118
+ };
119
+ };
120
+ export type LanguageConfiguration = {
121
+ languageSupport: LanguageSupport;
122
+ highlightLight: HighlightStyle;
123
+ highlightDark: HighlightStyle;
124
+ };
58
125
  /**
59
126
  * Configuration object for the WaterproofEditor.
60
127
  *
@@ -71,51 +138,51 @@ export type WaterproofEditorConfig = {
71
138
  api: WaterproofCallbacks;
72
139
  /** Determines how the editor document gets constructed from a string input. */
73
140
  documentConstructor: (document: string) => WaterproofDocument;
74
- /** How to construct a mapping for this editor. The mapping is responsible for mapping changes from the underlying ProseMirror instance into changes that can be applied to the underlying document. */
75
- mapping: new (inputString: string, versionNum: number) => WaterproofMapping;
76
- /** THIS IS A TEMPORARY FEATURE THAT WILL GET REMOVED */
77
- documentPreprocessor?: (inputString: string) => {
78
- resultingDocument: string;
79
- documentChange: DocChange | WrappingDocChange | undefined;
80
- };
141
+ /**
142
+ * The tag configuration to use for this editor.
143
+ *
144
+ * See {@linkcode TagConfiguration} for more information.
145
+ */
146
+ tagConfiguration: TagConfiguration;
147
+ /**
148
+ * The serializer object is used to translate the ProseMirror nodes into
149
+ * text. When none is given we will create a default one from the given {@linkcode TagConfiguration}.
150
+ * The serializer should extend the {@linkcode DocumentSerializer} class.
151
+ */
152
+ serializer?: DocumentSerializer;
153
+ /** The name of the markdown node view, defaults to `"Markdown"`.
154
+ * This name will show up in the editor when editing text in 'Markdown' cells.
155
+ */
156
+ markdownName?: string;
157
+ /**
158
+ * A function that can be used to convert a different markup variant into Markdown.
159
+ *
160
+ * This function is also responsible for converting math-inline content (e.g. in Markdown this is the content between `$` and `$`) to math-inline
161
+ * nodes. That is, the content should be placed inside `<math-inline>` and `</math-inline>`.
162
+ * @param inputString The input string that should be converted to Markdown
163
+ * @returns The output string should be valid Markdown, with possible inline LaTeX wrapped in the tags as described above.
164
+ */
165
+ toMarkdown?: (inputString: string) => string;
166
+ /**
167
+ * Disables Markdown features. Will likely be removed in the future once there is a nice way to support non markdown markup languages.
168
+ */
169
+ disableMarkdownFeatures?: Array<string>;
170
+ /**
171
+ * Specify custom entries that should be added to the menubar
172
+ */
173
+ menubarEntries?: Array<MenuBarEntry>;
174
+ languageConfig?: LanguageConfiguration;
81
175
  };
82
176
  export declare enum HistoryChange {
83
177
  Undo = 0,
84
178
  Redo = 1
85
179
  }
86
- export type SimpleProgressInfo = {
87
- /** Range for which the processing info was reported. */
88
- range: {
89
- start: {
90
- line: number;
91
- character: number;
92
- };
93
- end: {
94
- line: number;
95
- character: number;
96
- };
97
- };
98
- /** Kind of progress that was reported. */
99
- kind?: CoqFileProgressKind;
100
- };
101
- export type SimpleProgressParams = {
102
- numberOfLines: number;
103
- progress: SimpleProgressInfo[];
104
- };
105
- export declare enum CoqFileProgressKind {
106
- Processing = 1,
107
- FatalError = 2
108
- }
109
180
  export interface OffsetDiagnostic {
110
181
  message: string;
111
182
  severity: Severity;
112
183
  startOffset: number;
113
184
  endOffset: number;
114
185
  }
115
- export type DiagnosticMessage = {
116
- positionedDiagnostics: OffsetDiagnostic[];
117
- version: number;
118
- };
119
186
  export declare enum ThemeStyle {
120
187
  Light = 0,
121
188
  Dark = 1
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,QAAQ,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,GAAG,CAAC;AACnG,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG;IACrB,kDAAkD;IAClD,UAAU,EAAE,MAAM,CAAC;IACnB,gDAAgD;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,8EAA8E;IAC9E,SAAS,EAAE,MAAM,CAAC;IAClB,4EAA4E;IAC5E,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI;IACxB,GAAG,EAAE,CAAC,CAAC;IACP,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAAG,KAAK,EAAE,CAAC;AAEzC,MAAM,MAAM,mBAAmB,GAAG;IAC9B,+DAA+D;IAC/D,cAAc,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxD,uGAAuG;IACvG,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,0DAA0D;IAC1D,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB;;;OAGG;IACH,cAAc,EAAE,CAAC,MAAM,EAAE,SAAS,GAAG,iBAAiB,KAAK,IAAI,CAAC;IAChE,gGAAgG;IAChG,cAAc,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,sI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1,6 @@
1
1
  import { Completion } from "@codemirror/autocomplete";
2
- import { EditorState } from "@codemirror/state";
3
2
  export declare const renderIcon: {
4
- render: (completion: Completion, _state: EditorState) => globalThis.Node | null;
3
+ render: (completion: Completion) => globalThis.Node | null;
5
4
  position: number;
6
5
  };
7
6
  //# sourceMappingURL=renderSymbol.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderSymbol.d.ts","sourceRoot":"","sources":["../../src/autocomplete/renderSymbol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAgBhD,eAAO,MAAM,UAAU;yBAdK,UAAU,UAAU,WAAW,KAAG,UAAU,CAAC,IAAI,GAAG,IAAI;;CAiBnF,CAAA"}
1
+ {"version":3,"file":"renderSymbol.d.ts","sourceRoot":"","sources":["../../src/autocomplete/renderSymbol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAgBtD,eAAO,MAAM,UAAU;yBAdK,UAAU,KAAG,UAAU,CAAC,IAAI,GAAG,IAAI;;CAiB9D,CAAA"}
@@ -0,0 +1,113 @@
1
+ import { EditorView, GutterMarker } from "@codemirror/view";
2
+ import { StateField, RangeSet } from "@codemirror/state";
3
+ /**
4
+ * Renders an animated "busy" spinner (`.busy-indicator` CSS class) in the gutter.
5
+ * The {@link delay} prevents flickering for fast operations that complete
6
+ * before the delay elapses.
7
+ * Is exported for testing purposes.
8
+ */
9
+ export declare class BusyIndicatorMarker extends GutterMarker {
10
+ private readonly delay;
11
+ private readonly title;
12
+ /**
13
+ * @param delay Milliseconds to wait before making the spinner visible.
14
+ * This prevents flickering for sentences that finish checking quickly.
15
+ * @param title Tooltip text shown on hover.
16
+ */
17
+ constructor(delay: number, title: string);
18
+ /**
19
+ * CodeMirror calls this to decide whether two markers are identical and the
20
+ * DOM element can be reused without a re-render.
21
+ * All {@link BusyIndicatorMarker} instances look the same, so any instance
22
+ * is equal to any other.
23
+ *
24
+ * @param other The marker on the other side of the comparison.
25
+ * @returns true when other is also a {@link BusyIndicatorMarker}.
26
+ */
27
+ eq(other: GutterMarker): boolean;
28
+ /**
29
+ * Creates the DOM element that CodeMirror inserts into the gutter cell.
30
+ * The element starts invisible; a timer adds the `.busy-indicator` class after
31
+ * {@link delay} ms. If CodeMirror removes the element before the timer
32
+ * fires (e.g. the sentence finished checking), the timer is cancelled so
33
+ * the busy-indicator never flickers into view.
34
+ *
35
+ * @returns A `<div>` that animates into a busy spinner after the delay.
36
+ */
37
+ toDOM(): Node;
38
+ }
39
+ export declare const BUSY_INDICATOR_DELAY_MS = 500;
40
+ export declare const BUSY_INDICATOR_CLASS = "busy-indicator";
41
+ /**
42
+ * Owns the busy-indicator gutter for a single {@link CodeBlockView}.
43
+ *
44
+ * Each block gets its own instance so CodeMirror's effect/state-field identity.
45
+ */
46
+ export declare class CodeBlockBusyIndicator {
47
+ /**
48
+ * Moves the busy marker to a local (per-block CodeMirror) document offset.
49
+ * The `map` function keeps the position valid as the document is edited.
50
+ */
51
+ private readonly setBusyEffect;
52
+ /**
53
+ * Removes the busy marker unconditionally.
54
+ */
55
+ private readonly clearBusyEffect;
56
+ /**
57
+ * A CodeMirror StateField that holds the `RangeSet` of at most one
58
+ * {@link BusyIndicatorMarker} at the currently-checked line.
59
+ */
60
+ private readonly busyState;
61
+ /**
62
+ * A CodeMirror gutter extension that renders the content of
63
+ * {@link busyState} in a narrow fixed-width column to the right of the
64
+ * editor content.
65
+ */
66
+ private readonly busyGutter;
67
+ /**
68
+ * The local CodeMirror offset at which the busy marker was last placed, or
69
+ * null when the marker is not currently shown. Used to skip redundant
70
+ * dispatches when the checked line hasn't changed.
71
+ */
72
+ private currentBusyPos;
73
+ constructor();
74
+ /**
75
+ * Returns the CodeMirror extensions that must be included in this
76
+ * block's editor config (called once during {@link CodeBlockView} construction).
77
+ *
78
+ * @returns An array containing the {@link busyState} StateField and the
79
+ * {@link busyGutter} gutter extension.
80
+ */
81
+ getExtensions(): (import("@codemirror/state").Extension | StateField<RangeSet<GutterMarker>>)[];
82
+ /**
83
+ * Show the busy indicator on the line that contains {@link globalPos}
84
+ * (a ProseMirror document offset).
85
+ *
86
+ * - Translates the global ProseMirror offset to a local CodeMirror offset.
87
+ * - Clamps it to the block's content range.
88
+ * - Skips the dispatch if the indicator is already on the same line.
89
+ * - Clears the indicator when {@link globalPos} falls outside this block.
90
+ *
91
+ * @param view The CodeMirror `EditorView` for this block.
92
+ * @param globalPos The ProseMirror document offset of the sentence
93
+ * currently being checked. This is in the global ProseMirror coordinate
94
+ * space, not the local CodeMirror space.
95
+ * @param blockStartPos The ProseMirror position of the start of this block, as
96
+ * returned by the ProseMirror `getPos()` callback. undefined means the
97
+ * node is no longer in the document.
98
+ */
99
+ setBusy(view: EditorView, globalPos: number, blockStartPos: number | undefined): void;
100
+ /**
101
+ * Remove the busy indicator unconditionally.
102
+ *
103
+ * @param view The CodeMirror `EditorView` for this block.
104
+ */
105
+ clearBusy(view: EditorView): void;
106
+ /**
107
+ * Dispatches the {@link clearBusyEffect} to clear the busy indicator.
108
+ *
109
+ * @param view The CodeMirror `EditorView` to dispatch to.
110
+ */
111
+ private dispatchClearBusy;
112
+ }
113
+ //# sourceMappingURL=busy-indicator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"busy-indicator.d.ts","sourceRoot":"","sources":["../../src/codeview/busy-indicator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAU,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAe,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAEtE;;;;;GAKG;AACH,qBAAa,mBAAoB,SAAQ,YAAY;IAMvC,OAAO,CAAC,QAAQ,CAAC,KAAK;IAAU,OAAO,CAAC,QAAQ,CAAC,KAAK;IALlE;;;;OAIG;gBAC0B,KAAK,EAAE,MAAM,EAAmB,KAAK,EAAE,MAAM;IAI1E;;;;;;;;OAQG;IACH,EAAE,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO;IAIhC;;;;;;;;OAQG;IACH,KAAK,IAAI,IAAI;CAUd;AAMD,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAG3C,eAAO,MAAM,oBAAoB,mBAAmB,CAAC;AAErD;;;;GAIG;AACH,qBAAa,sBAAsB;IAGjC;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,aAAa,CAE3B;IAEH;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA8B;IAI9D;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAqC;IAE/D;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA4B;IAIvD;;;;OAIG;IACH,OAAO,CAAC,cAAc,CAAuB;;IAoC7C;;;;;;OAMG;IACI,aAAa;IAMpB;;;;;;;;;;;;;;;;OAgBG;IACI,OAAO,CACZ,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,GAAG,SAAS,GAChC,IAAI;IAyBP;;;;OAIG;IACI,SAAS,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;IAMxC;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;CAM1B"}
@@ -2,26 +2,27 @@ import { Schema, Node as ProseNode } from "prosemirror-model";
2
2
  import { Plugin as ProsePlugin, PluginKey } from "prosemirror-state";
3
3
  import { EditorView } from "prosemirror-view";
4
4
  import { CodeBlockView } from "./nodeview";
5
- import { LineNumber, ThemeStyle, WaterproofCompletion, WaterproofSymbol } from "../api";
5
+ import { LanguageConfiguration, ThemeStyle, WaterproofCompletion, WaterproofSymbol } from "../api";
6
6
  import { Completion } from "@codemirror/autocomplete";
7
+ import { WaterproofEditor } from "../editor";
7
8
  export interface ICodePluginState {
8
9
  macros: {
9
10
  [cmd: string]: string;
10
11
  };
11
- /** A list of currently active `NodeView`s, in insertion order. */
12
+ /** A set of currently active `NodeView`s in insertion order. Note that insertion order does not necessarily match document order */
12
13
  activeNodeViews: Set<CodeBlockView>;
13
14
  /** The schema of the outer editor */
14
15
  schema: Schema;
15
16
  /** Should the codemirror cells show line numbers */
16
17
  showLines: boolean;
17
18
  /** The lastest versioned linenumbers */
18
- lines: LineNumber;
19
+ lines: Array<number>;
19
20
  }
20
21
  export declare const CODE_PLUGIN_KEY: PluginKey<ICodePluginState>;
21
22
  /**
22
23
  * Returns a function suitable for passing as a field in `EditorProps.nodeViews`.
23
24
  * @see https://prosemirror.net/docs/ref/#view.EditorProps.nodeViews
24
25
  */
25
- export declare function createCoqCodeView(completions: Array<Completion>, symbols: Array<Completion>, initialThemeStyle: ThemeStyle): (node: ProseNode, view: EditorView, getPos: () => number | undefined) => CodeBlockView;
26
- export declare const codePlugin: (completions: Array<WaterproofCompletion>, symbols: Array<WaterproofSymbol>, initialThemeStyle: ThemeStyle) => ProsePlugin<ICodePluginState>;
26
+ export declare function createCoqCodeView(completions: Array<Completion>, symbols: Array<Completion>, editorInstance: WaterproofEditor, initialThemeStyle: ThemeStyle, languageConfig?: LanguageConfiguration): (node: ProseNode, view: EditorView, getPos: () => number | undefined) => CodeBlockView;
27
+ export declare const codePlugin: (completions: Array<WaterproofCompletion>, symbols: Array<WaterproofSymbol>, editorInstance: WaterproofEditor, initialThemeStyle: ThemeStyle, languageConfig?: LanguageConfiguration) => ProsePlugin<ICodePluginState>;
27
28
  //# sourceMappingURL=code-plugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"code-plugin.d.ts","sourceRoot":"","sources":["../../src/codeview/code-plugin.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,SAAS,EAAc,MAAM,mBAAmB,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,kBA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,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AACnG,OAAO,EAAE,UAAU,EAAqB,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAI7C,MAAM,WAAW,gBAAgB;IAChC,MAAM,EAAE;QAAE,CAAC,GAAG,EAAC,MAAM,GAAI,MAAM,CAAA;KAAE,CAAC;IAClC,oIAAoI;IACpI,eAAe,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC;IACjC,qCAAqC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,SAAS,EAAE,OAAO,CAAC;IACtB,wCAAwC;IACxC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACrB;AAED,eAAO,MAAM,eAAe,6BAAmE,CAAC;AAEhG;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,KAAK,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,EAAE,cAAc,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,UAAU,EAAE,cAAc,CAAC,EAAE,qBAAqB,IAC5L,MAAM,SAAS,EAAE,MAAM,UAAU,EAAE,QAAQ,MAAM,MAAM,GAAG,SAAS,KAAG,aAAa,CAgB3F;AA2ED,eAAO,MAAM,UAAU,GAAI,aAAa,KAAK,CAAC,oBAAoB,CAAC,EAAE,SAAS,KAAK,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,gBAAgB,EAAE,mBAAmB,UAAU,EAAE,iBAAiB,qBAAqB,kCAO7M,CAAC"}
@@ -2,25 +2,29 @@ import { Completion, CompletionSource } from "@codemirror/autocomplete";
2
2
  import { Node, Schema } from "prosemirror-model";
3
3
  import { EditorView } from "prosemirror-view";
4
4
  import { EmbeddedCodeMirrorEditor } from "../embedded-codemirror";
5
- import { ThemeStyle } from "../api";
5
+ import { Diagnostic } from "@codemirror/lint";
6
+ import { LanguageConfiguration, ThemeStyle } from "../api";
7
+ import { WaterproofEditor } from "../editor";
6
8
  /**
7
9
  * Export CodeBlockView class that implements the custom codeblock nodeview.
8
10
  * Corresponds with the example as can be found here:
9
11
  * https://prosemirror.net/examples/codemirror/
10
12
  */
11
13
  export declare class CodeBlockView extends EmbeddedCodeMirrorEditor {
14
+ private readonly editorInstance;
15
+ private readonly languageConfig?;
12
16
  dom: HTMLElement;
13
17
  private _lineNumberCompartment;
14
18
  private _lineNumbersExtension;
15
19
  private _dynamicCompletions;
16
20
  private _readOnlyCompartment;
17
21
  private _themeCompartment;
18
- private _diags;
19
- private debouncer;
20
- constructor(node: Node, view: EditorView, getPos: (() => number | undefined), schema: Schema, completions: Array<Completion>, symbols: Array<Completion>, initialThemeStyle: ThemeStyle);
22
+ private lastUsedDiagnosticsVersion;
23
+ private readonly busyIndicator;
24
+ constructor(node: Node, view: EditorView, editorInstance: WaterproofEditor, getPos: (() => number | undefined), schema: Schema, completions: Array<Completion>, symbols: Array<Completion>, initialThemeStyle: ThemeStyle, languageConfig?: LanguageConfiguration | undefined);
25
+ dispatchEmpty(): void;
21
26
  private partOfInputArea;
22
27
  handleSnippet(template: string, posFrom: number, posTo: number, completion?: Completion | undefined): void;
23
- private lintingFunction;
24
28
  /**
25
29
  * set edit permission
26
30
  */
@@ -29,6 +33,13 @@ export declare class CodeBlockView extends EmbeddedCodeMirrorEditor {
29
33
  * Update the theme of the editor.
30
34
  */
31
35
  updateThemeFromVSCode(theme: ThemeStyle): void;
36
+ /**
37
+ * Show the busy spinner on the line currently being checked by coq-lsp.
38
+ * {@link busyIndicatorPos} is a ProseMirror document offset.
39
+ */
40
+ setBusyIndicator(busyIndicatorPos: number): void;
41
+ /** Remove the busy spinner from this block. */
42
+ removeBusyIndicator(): void;
32
43
  /**
33
44
  * Update the line numbers extension
34
45
  */
@@ -42,6 +53,12 @@ export declare class CodeBlockView extends EmbeddedCodeMirrorEditor {
42
53
  * Contains completions for defined theorems/lemmas/etc.
43
54
  */
44
55
  dynamicCompletionSource: CompletionSource;
56
+ /**
57
+ * The {@linkcode LintSource} to use for the codemirror instance.
58
+ * This will use the outer {@linkcode WaterproofEditor} to get diagnostics in the range of this
59
+ * codemirror view.
60
+ */
61
+ private lintingFunction;
45
62
  /**
46
63
  * Add a new coq error to this view
47
64
  * @param from The from position of the error.
@@ -49,16 +66,8 @@ export declare class CodeBlockView extends EmbeddedCodeMirrorEditor {
49
66
  * @param message The message attached to this error.
50
67
  * @param severity The severity attached to this error.
51
68
  */
52
- addCoqError(from: number, to: number, message: string, severity: number): void;
69
+ preprocessDiagnostic(from: number, to: number, message: string, severity: number): Diagnostic;
53
70
  private showCopyNotification;
54
- /**
55
- * Helper function that forces the linter function to run.
56
- * Should be called after an error has been added or after the errors have been cleared.
57
- */
58
- private forceUpdateLinting;
59
- /**
60
- * Clear all coq errors from this view.
61
- */
62
- clearCoqErrors(): void;
63
71
  }
72
+ export declare function severityToString(sv: number): "hint" | "info" | "warning" | "error";
64
73
  //# sourceMappingURL=nodeview.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"nodeview.d.ts","sourceRoot":"","sources":["../../src/codeview/nodeview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAuC,gBAAgB,EAA+L,MAAM,0BAA0B,CAAC;AAQ1S,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAG7C,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAIlE,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC;;;;GAIG;AACH,qBAAa,aAAc,SAAQ,wBAAwB;IAC1D,GAAG,EAAE,WAAW,CAAC;IAEjB,OAAO,CAAC,sBAAsB,CAAc;IAC5C,OAAO,CAAC,qBAAqB,CAA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