@digabi/exam-engine-core 22.0.3 → 22.0.4-alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (240) hide show
  1. package/dist/__tests__/EditableGradingInstruction.test.d.ts +2 -0
  2. package/dist/__tests__/EditableGradingInstruction.test.d.ts.map +1 -0
  3. package/dist/__tests__/EditableGradingInstruction.test.js +174 -0
  4. package/dist/__tests__/EditableGradingInstruction.test.js.map +1 -0
  5. package/dist/__tests__/EditableGradingInstructionLocalization.test.d.ts +2 -0
  6. package/dist/__tests__/EditableGradingInstructionLocalization.test.d.ts.map +1 -0
  7. package/dist/__tests__/EditableGradingInstructionLocalization.test.js +112 -0
  8. package/dist/__tests__/EditableGradingInstructionLocalization.test.js.map +1 -0
  9. package/dist/__tests__/FormatButton.test.d.ts +2 -0
  10. package/dist/__tests__/FormatButton.test.d.ts.map +1 -0
  11. package/dist/__tests__/FormatButton.test.js +94 -0
  12. package/dist/__tests__/FormatButton.test.js.map +1 -0
  13. package/dist/__tests__/annotations.test.js +7 -7
  14. package/dist/__tests__/annotations.test.js.map +1 -1
  15. package/dist/__tests__/editor/FormatButton.test.d.ts +2 -0
  16. package/dist/__tests__/editor/FormatButton.test.d.ts.map +1 -0
  17. package/dist/__tests__/editor/FormatButton.test.js +98 -0
  18. package/dist/__tests__/editor/FormatButton.test.js.map +1 -0
  19. package/dist/__tests__/editor/Formula.test.d.ts +2 -0
  20. package/dist/__tests__/editor/Formula.test.d.ts.map +1 -0
  21. package/dist/__tests__/editor/Formula.test.js +61 -0
  22. package/dist/__tests__/editor/Formula.test.js.map +1 -0
  23. package/dist/__tests__/editor/ImageUploadButton.test.d.ts +2 -0
  24. package/dist/__tests__/editor/ImageUploadButton.test.d.ts.map +1 -0
  25. package/dist/__tests__/editor/ImageUploadButton.test.js +94 -0
  26. package/dist/__tests__/editor/ImageUploadButton.test.js.map +1 -0
  27. package/dist/__tests__/editor/List.test.d.ts +2 -0
  28. package/dist/__tests__/editor/List.test.d.ts.map +1 -0
  29. package/dist/__tests__/editor/List.test.js +72 -0
  30. package/dist/__tests__/editor/List.test.js.map +1 -0
  31. package/dist/__tests__/editor/Table.test.d.ts +2 -0
  32. package/dist/__tests__/editor/Table.test.d.ts.map +1 -0
  33. package/dist/__tests__/editor/Table.test.js +172 -0
  34. package/dist/__tests__/editor/Table.test.js.map +1 -0
  35. package/dist/__tests__/editor/br.test.d.ts +2 -0
  36. package/dist/__tests__/editor/br.test.d.ts.map +1 -0
  37. package/dist/__tests__/editor/br.test.js +39 -0
  38. package/dist/__tests__/editor/br.test.js.map +1 -0
  39. package/dist/__tests__/editor/hr.test.d.ts +2 -0
  40. package/dist/__tests__/editor/hr.test.d.ts.map +1 -0
  41. package/dist/__tests__/editor/hr.test.js +39 -0
  42. package/dist/__tests__/editor/hr.test.js.map +1 -0
  43. package/dist/__tests__/editor/nbsp.test.d.ts +2 -0
  44. package/dist/__tests__/editor/nbsp.test.d.ts.map +1 -0
  45. package/dist/__tests__/editor/nbsp.test.js +55 -0
  46. package/dist/__tests__/editor/nbsp.test.js.map +1 -0
  47. package/dist/__tests__/editor/noWrap.test.d.ts +2 -0
  48. package/dist/__tests__/editor/noWrap.test.d.ts.map +1 -0
  49. package/dist/__tests__/editor/noWrap.test.js +62 -0
  50. package/dist/__tests__/editor/noWrap.test.js.map +1 -0
  51. package/dist/__tests__/editor/spanWithLang.test.d.ts +2 -0
  52. package/dist/__tests__/editor/spanWithLang.test.d.ts.map +1 -0
  53. package/dist/__tests__/editor/spanWithLang.test.js +38 -0
  54. package/dist/__tests__/editor/spanWithLang.test.js.map +1 -0
  55. package/dist/__tests__/editor/subSup.test.d.ts +2 -0
  56. package/dist/__tests__/editor/subSup.test.d.ts.map +1 -0
  57. package/dist/__tests__/editor/subSup.test.js +50 -0
  58. package/dist/__tests__/editor/subSup.test.js.map +1 -0
  59. package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
  60. package/dist/__tests__/utils/ProseMirrorWrapper.d.ts +8 -0
  61. package/dist/__tests__/utils/ProseMirrorWrapper.d.ts.map +1 -0
  62. package/dist/__tests__/utils/ProseMirrorWrapper.js +44 -0
  63. package/dist/__tests__/utils/ProseMirrorWrapper.js.map +1 -0
  64. package/dist/__tests__/utils/prosemirror.d.ts +2 -0
  65. package/dist/__tests__/utils/prosemirror.d.ts.map +1 -0
  66. package/dist/__tests__/utils/prosemirror.js +30 -0
  67. package/dist/__tests__/utils/prosemirror.js.map +1 -0
  68. package/dist/__tests__/utils/renderEditableGradingInstruction.d.ts +4 -0
  69. package/dist/__tests__/utils/renderEditableGradingInstruction.d.ts.map +1 -0
  70. package/dist/__tests__/utils/renderEditableGradingInstruction.js +22 -0
  71. package/dist/__tests__/utils/renderEditableGradingInstruction.js.map +1 -0
  72. package/dist/__tests__/utils/util.d.ts +2 -0
  73. package/dist/__tests__/utils/util.d.ts.map +1 -0
  74. package/dist/__tests__/utils/util.js +10 -0
  75. package/dist/__tests__/utils/util.js.map +1 -0
  76. package/dist/components/Localization.d.ts +5 -0
  77. package/dist/components/Localization.d.ts.map +1 -0
  78. package/dist/components/Localization.js +9 -0
  79. package/dist/components/Localization.js.map +1 -0
  80. package/dist/components/context/AnnotationProvider.d.ts +2 -2
  81. package/dist/components/context/AnnotationProvider.d.ts.map +1 -1
  82. package/dist/components/context/AnnotationProvider.js +3 -2
  83. package/dist/components/context/AnnotationProvider.js.map +1 -1
  84. package/dist/components/context/AttachmentContext.d.ts.map +1 -1
  85. package/dist/components/context/CommonExamContext.d.ts +1 -0
  86. package/dist/components/context/CommonExamContext.d.ts.map +1 -1
  87. package/dist/components/context/CommonExamContext.js +3 -0
  88. package/dist/components/context/CommonExamContext.js.map +1 -1
  89. package/dist/components/context/ExamContext.d.ts.map +1 -1
  90. package/dist/components/context/GradingInstructionContext.d.ts +17 -0
  91. package/dist/components/context/GradingInstructionContext.d.ts.map +1 -0
  92. package/dist/components/context/GradingInstructionContext.js +3 -0
  93. package/dist/components/context/GradingInstructionContext.js.map +1 -0
  94. package/dist/components/context/QuestionContext.d.ts.map +1 -1
  95. package/dist/components/context/ResultsContext.d.ts.map +1 -1
  96. package/dist/components/context/SectionContext.d.ts.map +1 -1
  97. package/dist/components/grading-instructions/AnswerGradingInstruction.d.ts.map +1 -1
  98. package/dist/components/grading-instructions/AnswerGradingInstruction.js +7 -2
  99. package/dist/components/grading-instructions/AnswerGradingInstruction.js.map +1 -1
  100. package/dist/components/grading-instructions/EditableGradingInstruction.d.ts +6 -0
  101. package/dist/components/grading-instructions/EditableGradingInstruction.d.ts.map +1 -0
  102. package/dist/components/grading-instructions/EditableGradingInstruction.js +121 -0
  103. package/dist/components/grading-instructions/EditableGradingInstruction.js.map +1 -0
  104. package/dist/components/grading-instructions/GradingInstruction.d.ts +7 -0
  105. package/dist/components/grading-instructions/GradingInstruction.d.ts.map +1 -0
  106. package/dist/components/grading-instructions/GradingInstruction.js +9 -0
  107. package/dist/components/grading-instructions/GradingInstruction.js.map +1 -0
  108. package/dist/components/grading-instructions/GradingInstructionProvider.d.ts +4 -0
  109. package/dist/components/grading-instructions/GradingInstructionProvider.d.ts.map +1 -0
  110. package/dist/components/grading-instructions/GradingInstructionProvider.js +7 -0
  111. package/dist/components/grading-instructions/GradingInstructionProvider.js.map +1 -0
  112. package/dist/components/grading-instructions/GradingInstructions.d.ts +2 -1
  113. package/dist/components/grading-instructions/GradingInstructions.d.ts.map +1 -1
  114. package/dist/components/grading-instructions/GradingInstructions.js +18 -15
  115. package/dist/components/grading-instructions/GradingInstructions.js.map +1 -1
  116. package/dist/components/grading-instructions/editor/AttributeToggleButton.d.ts +9 -0
  117. package/dist/components/grading-instructions/editor/AttributeToggleButton.d.ts.map +1 -0
  118. package/dist/components/grading-instructions/editor/AttributeToggleButton.js +53 -0
  119. package/dist/components/grading-instructions/editor/AttributeToggleButton.js.map +1 -0
  120. package/dist/components/grading-instructions/editor/CurrentElement.d.ts +2 -0
  121. package/dist/components/grading-instructions/editor/CurrentElement.d.ts.map +1 -0
  122. package/dist/components/grading-instructions/editor/CurrentElement.js +8 -0
  123. package/dist/components/grading-instructions/editor/CurrentElement.js.map +1 -0
  124. package/dist/components/grading-instructions/editor/CurrentLocalization.d.ts +7 -0
  125. package/dist/components/grading-instructions/editor/CurrentLocalization.d.ts.map +1 -0
  126. package/dist/components/grading-instructions/editor/CurrentLocalization.js +13 -0
  127. package/dist/components/grading-instructions/editor/CurrentLocalization.js.map +1 -0
  128. package/dist/components/grading-instructions/editor/FormatButton.d.ts +9 -0
  129. package/dist/components/grading-instructions/editor/FormatButton.d.ts.map +1 -0
  130. package/dist/components/grading-instructions/editor/FormatButton.js +26 -0
  131. package/dist/components/grading-instructions/editor/FormatButton.js.map +1 -0
  132. package/dist/components/grading-instructions/editor/Formula.d.ts +15 -0
  133. package/dist/components/grading-instructions/editor/Formula.d.ts.map +1 -0
  134. package/dist/components/grading-instructions/editor/Formula.js +41 -0
  135. package/dist/components/grading-instructions/editor/Formula.js.map +1 -0
  136. package/dist/components/grading-instructions/editor/FormulaPopup.d.ts +7 -0
  137. package/dist/components/grading-instructions/editor/FormulaPopup.d.ts.map +1 -0
  138. package/dist/components/grading-instructions/editor/FormulaPopup.js +49 -0
  139. package/dist/components/grading-instructions/editor/FormulaPopup.js.map +1 -0
  140. package/dist/components/grading-instructions/editor/ImageUploadButton.d.ts +6 -0
  141. package/dist/components/grading-instructions/editor/ImageUploadButton.d.ts.map +1 -0
  142. package/dist/components/grading-instructions/editor/ImageUploadButton.js +77 -0
  143. package/dist/components/grading-instructions/editor/ImageUploadButton.js.map +1 -0
  144. package/dist/components/grading-instructions/editor/List.d.ts +9 -0
  145. package/dist/components/grading-instructions/editor/List.d.ts.map +1 -0
  146. package/dist/components/grading-instructions/editor/List.js +41 -0
  147. package/dist/components/grading-instructions/editor/List.js.map +1 -0
  148. package/dist/components/grading-instructions/editor/Localization.d.ts +3 -0
  149. package/dist/components/grading-instructions/editor/Localization.d.ts.map +1 -0
  150. package/dist/components/grading-instructions/editor/Localization.js +36 -0
  151. package/dist/components/grading-instructions/editor/Localization.js.map +1 -0
  152. package/dist/components/grading-instructions/editor/LocalizationButtons.d.ts +6 -0
  153. package/dist/components/grading-instructions/editor/LocalizationButtons.d.ts.map +1 -0
  154. package/dist/components/grading-instructions/editor/LocalizationButtons.js +14 -0
  155. package/dist/components/grading-instructions/editor/LocalizationButtons.js.map +1 -0
  156. package/dist/components/grading-instructions/editor/NBSP.d.ts +4 -0
  157. package/dist/components/grading-instructions/editor/NBSP.d.ts.map +1 -0
  158. package/dist/components/grading-instructions/editor/NBSP.js +17 -0
  159. package/dist/components/grading-instructions/editor/NBSP.js.map +1 -0
  160. package/dist/components/grading-instructions/editor/Table.d.ts +6 -0
  161. package/dist/components/grading-instructions/editor/Table.d.ts.map +1 -0
  162. package/dist/components/grading-instructions/editor/Table.js +186 -0
  163. package/dist/components/grading-instructions/editor/Table.js.map +1 -0
  164. package/dist/components/grading-instructions/editor/findNode.d.ts +3 -0
  165. package/dist/components/grading-instructions/editor/findNode.d.ts.map +1 -0
  166. package/dist/components/grading-instructions/editor/findNode.js +10 -0
  167. package/dist/components/grading-instructions/editor/findNode.js.map +1 -0
  168. package/dist/components/grading-instructions/editor/localizatio.d.ts +3 -0
  169. package/dist/components/grading-instructions/editor/localizatio.d.ts.map +1 -0
  170. package/dist/components/grading-instructions/editor/localizatio.js +36 -0
  171. package/dist/components/grading-instructions/editor/localizatio.js.map +1 -0
  172. package/dist/components/grading-instructions/editor/localizationSpan.d.ts +3 -0
  173. package/dist/components/grading-instructions/editor/localizationSpan.d.ts.map +1 -0
  174. package/dist/components/grading-instructions/editor/localizationSpan.js +36 -0
  175. package/dist/components/grading-instructions/editor/localizationSpan.js.map +1 -0
  176. package/dist/components/grading-instructions/editor/schemas/formulaSchema.d.ts +4 -0
  177. package/dist/components/grading-instructions/editor/schemas/formulaSchema.d.ts.map +1 -0
  178. package/dist/components/grading-instructions/editor/schemas/formulaSchema.js +62 -0
  179. package/dist/components/grading-instructions/editor/schemas/formulaSchema.js.map +1 -0
  180. package/dist/components/grading-instructions/editor/schemas/image-schema.d.ts +4 -0
  181. package/dist/components/grading-instructions/editor/schemas/image-schema.d.ts.map +1 -0
  182. package/dist/components/grading-instructions/editor/schemas/image-schema.js +47 -0
  183. package/dist/components/grading-instructions/editor/schemas/image-schema.js.map +1 -0
  184. package/dist/components/grading-instructions/editor/schemas/imageSchema.d.ts +4 -0
  185. package/dist/components/grading-instructions/editor/schemas/imageSchema.d.ts.map +1 -0
  186. package/dist/components/grading-instructions/editor/schemas/imageSchema.js +61 -0
  187. package/dist/components/grading-instructions/editor/schemas/imageSchema.js.map +1 -0
  188. package/dist/components/grading-instructions/editor/schemas/listSchema.d.ts +72 -0
  189. package/dist/components/grading-instructions/editor/schemas/listSchema.d.ts.map +1 -0
  190. package/dist/components/grading-instructions/editor/schemas/listSchema.js +7 -0
  191. package/dist/components/grading-instructions/editor/schemas/listSchema.js.map +1 -0
  192. package/dist/components/grading-instructions/editor/schemas/localizationSchema.d.ts +3 -0
  193. package/dist/components/grading-instructions/editor/schemas/localizationSchema.d.ts.map +1 -0
  194. package/dist/components/grading-instructions/editor/schemas/localizationSchema.js +39 -0
  195. package/dist/components/grading-instructions/editor/schemas/localizationSchema.js.map +1 -0
  196. package/dist/components/grading-instructions/editor/schemas/spanWithLangSchema.d.ts +3 -0
  197. package/dist/components/grading-instructions/editor/schemas/spanWithLangSchema.d.ts.map +1 -0
  198. package/dist/components/grading-instructions/editor/schemas/spanWithLangSchema.js +19 -0
  199. package/dist/components/grading-instructions/editor/schemas/spanWithLangSchema.js.map +1 -0
  200. package/dist/components/grading-instructions/editor/schemas/spanWithNowrapSchema.d.ts +3 -0
  201. package/dist/components/grading-instructions/editor/schemas/spanWithNowrapSchema.d.ts.map +1 -0
  202. package/dist/components/grading-instructions/editor/schemas/spanWithNowrapSchema.js +19 -0
  203. package/dist/components/grading-instructions/editor/schemas/spanWithNowrapSchema.js.map +1 -0
  204. package/dist/components/grading-instructions/editor/schemas/subSupSchema.d.ts +3 -0
  205. package/dist/components/grading-instructions/editor/schemas/subSupSchema.d.ts.map +1 -0
  206. package/dist/components/grading-instructions/editor/schemas/subSupSchema.js +23 -0
  207. package/dist/components/grading-instructions/editor/schemas/subSupSchema.js.map +1 -0
  208. package/dist/components/grading-instructions/editor/schemas/tableSchema.d.ts +3 -0
  209. package/dist/components/grading-instructions/editor/schemas/tableSchema.d.ts.map +1 -0
  210. package/dist/components/grading-instructions/editor/schemas/tableSchema.js +43 -0
  211. package/dist/components/grading-instructions/editor/schemas/tableSchema.js.map +1 -0
  212. package/dist/components/grading-instructions/editor/spanWithNowrap.d.ts +3 -0
  213. package/dist/components/grading-instructions/editor/spanWithNowrap.d.ts.map +1 -0
  214. package/dist/components/grading-instructions/editor/spanWithNowrap.js +19 -0
  215. package/dist/components/grading-instructions/editor/spanWithNowrap.js.map +1 -0
  216. package/dist/components/grading-instructions/editor/spanWithPath.d.ts +3 -0
  217. package/dist/components/grading-instructions/editor/spanWithPath.d.ts.map +1 -0
  218. package/dist/components/grading-instructions/editor/spanWithPath.js +24 -0
  219. package/dist/components/grading-instructions/editor/spanWithPath.js.map +1 -0
  220. package/dist/components/grading-instructions/editor/util.d.ts +6 -0
  221. package/dist/components/grading-instructions/editor/util.d.ts.map +1 -0
  222. package/dist/components/grading-instructions/editor/util.js +10 -0
  223. package/dist/components/grading-instructions/editor/util.js.map +1 -0
  224. package/dist/components/shared/AnnotationMark.d.ts +1 -1
  225. package/dist/components/shared/AnnotationMark.d.ts.map +1 -1
  226. package/dist/components/shared/AnnotationPopup.d.ts +1 -1
  227. package/dist/components/shared/AnnotationPopup.d.ts.map +1 -1
  228. package/dist/components/shared/AnnotationPopup.js +11 -70
  229. package/dist/components/shared/AnnotationPopup.js.map +1 -1
  230. package/dist/components/shared/Popup.d.ts +15 -0
  231. package/dist/components/shared/Popup.d.ts.map +1 -0
  232. package/dist/components/shared/Popup.js +90 -0
  233. package/dist/components/shared/Popup.js.map +1 -0
  234. package/dist/components/shared/markText.d.ts +1 -1
  235. package/dist/components/shared/markText.d.ts.map +1 -1
  236. package/dist/components/shared/markText.js.map +1 -1
  237. package/dist/main-bundle.js +1 -1
  238. package/dist/main-bundle.js.LICENSE.txt +1 -1
  239. package/dist/main.css +1 -1
  240. package/package.json +11 -2
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const react_1 = require("@testing-library/react");
4
+ const prosemirror_1 = require("../utils/prosemirror");
5
+ const renderEditableGradingInstruction_1 = require("../utils/renderEditableGradingInstruction");
6
+ const util_1 = require("../utils/util");
7
+ const act = react_1.act;
8
+ describe('Editor - BR', () => {
9
+ let cleanup;
10
+ let onContentChangeMock;
11
+ beforeEach(() => {
12
+ onContentChangeMock = jest.fn();
13
+ });
14
+ afterEach(() => {
15
+ if (cleanup) {
16
+ cleanup();
17
+ }
18
+ cleanup = null;
19
+ });
20
+ it('BR is rendered as expected', () => {
21
+ const inputData = '<p>bar<br/></p>';
22
+ const expectedOutput = '<p>bar<br><br class="ProseMirror-trailingBreak"></p>';
23
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData);
24
+ const table = result.container.querySelector('.ProseMirror');
25
+ expect(table.innerHTML).toBe(expectedOutput);
26
+ });
27
+ it('Change in content causes BR to be returned as expected', async () => {
28
+ cleanup = (0, prosemirror_1.mockCreateRange)();
29
+ const inputData = '<p>foo<br/></p><p>bar</p>';
30
+ const expectedOutput = '<p>foo<br/></p><p>foo</p>';
31
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
32
+ await act(async () => {
33
+ (0, util_1.insertText)(await result.findByText('bar'), 'foo');
34
+ });
35
+ expect(onContentChangeMock).toHaveBeenCalledTimes(1);
36
+ expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
37
+ });
38
+ });
39
+ //# sourceMappingURL=br.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"br.test.js","sourceRoot":"","sources":["../../../__tests__/editor/br.test.tsx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AAA;QACF,MAAM,CAAC,mBAAmB,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAA;QACpD,MAAM,CAAC,mBAAmB,CAAC,CAAC,oBAAoB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAA;IACtE,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=hr.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hr.test.d.ts","sourceRoot":"","sources":["../../../__tests__/editor/hr.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const react_1 = require("@testing-library/react");
4
+ const prosemirror_1 = require("../utils/prosemirror");
5
+ const renderEditableGradingInstruction_1 = require("../utils/renderEditableGradingInstruction");
6
+ const util_1 = require("../utils/util");
7
+ const act = react_1.act;
8
+ describe('Editor - HR', () => {
9
+ let cleanup;
10
+ let onContentChangeMock;
11
+ beforeEach(() => {
12
+ onContentChangeMock = jest.fn();
13
+ });
14
+ afterEach(() => {
15
+ if (cleanup) {
16
+ cleanup();
17
+ }
18
+ cleanup = null;
19
+ });
20
+ it('HR is rendered as expected', () => {
21
+ const inputData = '<p>bar</p><hr/>';
22
+ const expectedOutput = '<p>bar</p><hr>';
23
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData);
24
+ const table = result.container.querySelector('.ProseMirror');
25
+ expect(table.innerHTML).toBe(expectedOutput);
26
+ });
27
+ it('Change in content causes HR to be returned as expected', async () => {
28
+ cleanup = (0, prosemirror_1.mockCreateRange)();
29
+ const inputData = '<p>foo</p><hr/><p>bar</p>';
30
+ const expectedOutput = '<p>foo</p><hr/><p>foo</p>';
31
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
32
+ await act(async () => {
33
+ (0, util_1.insertText)(await result.findByText('bar'), 'foo');
34
+ });
35
+ expect(onContentChangeMock).toHaveBeenCalledTimes(1);
36
+ expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
37
+ });
38
+ });
39
+ //# sourceMappingURL=hr.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hr.test.js","sourceRoot":"","sources":["../../../__tests__/editor/hr.test.tsx"],"names":[],"mappings":";;AAAA,kDAAuD;AACvD,sDAAsD;AACtD,gGAAoF;AACpF,wCAA0C;AAE1C,MAAM,GAAG,GAAG,WAAuD,CAAA;AAEnE,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,IAAI,OAA4B,CAAA;IAChC,IAAI,mBAA8B,CAAA;IAElC,UAAU,CAAC,GAAG,EAAE;QACd,mBAAmB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;IACjC,CAAC,CAAC,CAAA;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,EAAE,CAAA;QACX,CAAC;QACD,OAAO,GAAG,IAAI,CAAA;IAChB,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;QACpC,MAAM,SAAS,GAAG,iBAAiB,CAAA;QACnC,MAAM,cAAc,GAAG,gBAAgB,CAAA;QACvC,MAAM,MAAM,GAAG,IAAA,2DAAwB,EAAC,SAAS,CAAC,CAAA;QAClD,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,cAAc,CAAC,CAAA;QAC5D,MAAM,CAAC,KAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;IAC/C,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,wDAAwD,EAAE,KAAK,IAAI,EAAE;QACtE,OAAO,GAAG,IAAA,6BAAe,GAAE,CAAA;QAC3B,MAAM,SAAS,GAAG,2BAA2B,CAAA;QAC7C,MAAM,cAAc,GAAG,2BAA2B,CAAA;QAClD,MAAM,MAAM,GAAG,IAAA,2DAAwB,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAA;QACvE,MAAM,GAAG,CAAC,KAAK,IAAI,EAAE;YACnB,IAAA,iBAAU,EAAC,MAAM,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAA;QACnD,CAAC,CAAC,CAAA;QACF,MAAM,CAAC,mBAAmB,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAA;QACpD,MAAM,CAAC,mBAAmB,CAAC,CAAC,oBAAoB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAA;IACtE,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=nbsp.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nbsp.test.d.ts","sourceRoot":"","sources":["../../../__tests__/editor/nbsp.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = require("@testing-library/react");
7
+ const prosemirror_1 = require("../utils/prosemirror");
8
+ const renderEditableGradingInstruction_1 = require("../utils/renderEditableGradingInstruction");
9
+ const user_event_1 = __importDefault(require("@testing-library/user-event"));
10
+ const util_1 = require("../utils/util");
11
+ const act = react_1.act;
12
+ describe('Editor - NBSP', () => {
13
+ let cleanup;
14
+ let onContentChangeMock;
15
+ beforeEach(() => {
16
+ onContentChangeMock = jest.fn();
17
+ });
18
+ afterEach(() => {
19
+ if (cleanup) {
20
+ cleanup();
21
+ }
22
+ cleanup = null;
23
+ });
24
+ it('NBSP is rendered as expected', () => {
25
+ const inputData = '<p>&#160;bar</p>';
26
+ const expectedOutput = '<p><span class="invisible invisible--nb-space ProseMirror-widget"></span>&nbsp;bar</p>';
27
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData);
28
+ const table = result.container.querySelector('.ProseMirror');
29
+ expect(table.innerHTML).toBe(expectedOutput);
30
+ });
31
+ it('Change in content causes NBSP to be returned as expected', async () => {
32
+ cleanup = (0, prosemirror_1.mockCreateRange)();
33
+ const inputData = '<p>&#160;foo</p><p>bar</p>';
34
+ const expectedOutput = '<p>&#160;foo</p><p>foo</p>';
35
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
36
+ await act(async () => {
37
+ (0, util_1.insertText)(await result.findByText('bar'), 'foo');
38
+ });
39
+ expect(onContentChangeMock).toHaveBeenCalledTimes(1);
40
+ expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
41
+ });
42
+ it('Insert NBSP adds expected string', async () => {
43
+ cleanup = (0, prosemirror_1.mockCreateRange)();
44
+ const inputData = '<p>&#160;foo</p><p>bar</p>';
45
+ const expectedOutput = '<p>&#160;&#160;foo</p><p>bar</p>';
46
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
47
+ expect(onContentChangeMock).toHaveBeenCalledTimes(0);
48
+ await act(async () => {
49
+ await user_event_1.default.click(await result.findByText('NBSP'));
50
+ });
51
+ expect(onContentChangeMock).toHaveBeenCalledTimes(1);
52
+ expect(onContentChangeMock).toHaveBeenLastCalledWith(expectedOutput, '');
53
+ });
54
+ });
55
+ //# sourceMappingURL=nbsp.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nbsp.test.js","sourceRoot":"","sources":["../../../__tests__/editor/nbsp.test.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAuD;AACvD,sDAAsD;AACtD,gGAAoF;AACpF,6EAAmD;AACnD,wCAA0C;AAE1C,MAAM,GAAG,GAAG,WAAuD,CAAA;AAEnE,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,IAAI,OAA4B,CAAA;IAChC,IAAI,mBAA8B,CAAA;IAElC,UAAU,CA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,EAAE;QAChD,OAAO,GAAG,IAAA,6BAAe,GAAE,CAAA;QAC3B,MAAM,SAAS,GAAG,4BAA4B,CAAA;QAC9C,MAAM,cAAc,GAAG,kCAAkC,CAAA;QACzD,MAAM,MAAM,GAAG,IAAA,2DAAwB,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAA;QACvE,MAAM,CAAC,mBAAmB,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAA;QACpD,MAAM,GAAG,CAAC,KAAK,IAAI,EAAE;YACnB,MAAM,oBAAS,CAAC,KAAK,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAA;QACxD,CAAC,CAAC,CAAA;QACF,MAAM,CAAC,mBAAmB,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAA;QACpD,MAAM,CAAC,mBAAmB,CAAC,CAAC,wBAAwB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAA;IAC1E,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=noWrap.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"noWrap.test.d.ts","sourceRoot":"","sources":["../../../__tests__/editor/noWrap.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const react_1 = require("@testing-library/react");
4
+ const prosemirror_1 = require("../utils/prosemirror");
5
+ const renderEditableGradingInstruction_1 = require("../utils/renderEditableGradingInstruction");
6
+ const act = react_1.act;
7
+ describe('Editor - e-nowrap', () => {
8
+ let cleanup;
9
+ let onContentChangeMock;
10
+ beforeEach(() => {
11
+ onContentChangeMock = jest.fn();
12
+ cleanup = (0, prosemirror_1.mockCreateRange)();
13
+ });
14
+ afterEach(() => {
15
+ if (cleanup) {
16
+ cleanup();
17
+ }
18
+ cleanup = null;
19
+ });
20
+ it('e-nowrap is rendered and returned as expected outside paragraph', async () => {
21
+ const inputData = '<p>bar</p><span class="e-nowrap">foo</span>';
22
+ const expectedDom = '<p>foo</p><p><span class="e-nowrap">foo</span></p>';
23
+ const expectedOutput = '<p>foo</p><p><span class="e-nowrap">foo</span></p>';
24
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
25
+ await act(async () => {
26
+ insertText(await result.findByText('bar'), 'foo');
27
+ });
28
+ const element = result.container.querySelector('.ProseMirror');
29
+ expect(element.innerHTML).toBe(expectedDom);
30
+ expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
31
+ });
32
+ it('e:formula is rendered as expected when wrapped inside e-nowrap', async () => {
33
+ const inputData = '<p>bar</p><span class="e-nowrap"><e:formula data-editor-id=e-formula>foo</e:formula></span>';
34
+ const expectedDom = '<p>foo</p><p><span class="e-nowrap"><img alt="foo" formula="true" src="/math.svg?latex=foo"><img class="ProseMirror-separator" alt=""></span><br class="ProseMirror-trailingBreak"></p>';
35
+ const expectedOutput = '<p>foo</p><p><span class="e-nowrap"><e:formula>foo</e:formula></span></p>';
36
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
37
+ await act(async () => {
38
+ insertText(await result.findByText('bar'), 'foo');
39
+ });
40
+ const element = result.container.querySelector('.ProseMirror');
41
+ expect(element.innerHTML).toBe(expectedDom);
42
+ expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
43
+ });
44
+ it('e-nowrap is rendered as expected inside paragraph', async () => {
45
+ const inputData = '<p>bar</p><p><span class="e-nowrap">foo</span></p>';
46
+ const expectedDom = '<p>foo</p><p><span class="e-nowrap">foo</span></p>';
47
+ const expectedOutput = '<p>foo</p><p><span class="e-nowrap">foo</span></p>';
48
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
49
+ await act(async () => {
50
+ insertText(await result.findByText('bar'), 'foo');
51
+ });
52
+ const element = result.container.querySelector('.ProseMirror');
53
+ expect(element.innerHTML).toBe(expectedDom);
54
+ expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
55
+ });
56
+ });
57
+ function insertText(element, text) {
58
+ react_1.fireEvent.input(element, {
59
+ target: { innerText: text, innerHTML: text }
60
+ });
61
+ }
62
+ //# sourceMappingURL=noWrap.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"noWrap.test.js","sourceRoot":"","sources":["../../../__tests__/editor/noWrap.test.tsx"],"names":[],"mappings":";;AAAA,kDAAkE;AAClE,sDAAsD;AACtD,gGAAoF;AAEpF,MAAM,GAAG,GAAG,WAAuD,CAAA;AAEnE,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,IAAI,OAA4B,CAAA;IAChC,IAAI,mBAA8B,CAAA;IAElC,UAAU,CAAC,GAAG,EAAE;QACd,mBAAmB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;QAC/B,OAAO,GAAG,IAAA,6BAAe,GAAE,CAAA;IAC7B,CAAC,CAAC,CAAA;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,EAAE,CAAA;QACX,CAAC;QACD,OAAO,GAAG,IAAI,CAAA;IAChB,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,iEAAiE,EAAE,KAAK,IAAI,EAAE;QAC/E,MAAM,SAAS,GAAG,6CAA6C,CAAA;QAC/D,MAAM,WAAW,GAAG,oDAAoD,CAAA;QACxE,MAAM,cAAc,GAAG,oDAAoD,CAAA;QAC3E,MAAM,MAAM,GAAG,IAAA,2DAAwB,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAA;QACvE,MAAM,GAAG,CAAC,KAAK,IAAI,EAAE;YACnB,UAAU,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAA;QACnD,CAAC,CAAC,CAAA;QACF,MAAM,OAAO,GAAG,MAAM,CAAC,SA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AAC,EAAE,KAAK,CAAC,CAAA;QACnD,CAAC,CAAC,CAAA;QACF,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,cAAc,CAAC,CAAA;QAC9D,MAAM,CAAC,OAAQ,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;QAC5C,MAAM,CAAC,mBAAmB,CAAC,CAAC,oBAAoB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAA;IACtE,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEF,SAAS,UAAU,CAAC,OAAoB,EAAE,IAAY;IACpD,iBAAS,CAAC,KAAK,CAAC,OAAO,EAAE;QACvB,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE;KAC7C,CAAC,CAAA;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=spanWithLang.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spanWithLang.test.d.ts","sourceRoot":"","sources":["../../../__tests__/editor/spanWithLang.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const react_1 = require("@testing-library/react");
4
+ const prosemirror_1 = require("../utils/prosemirror");
5
+ const renderEditableGradingInstruction_1 = require("../utils/renderEditableGradingInstruction");
6
+ const act = react_1.act;
7
+ describe('Editor - span with lang attribute', () => {
8
+ let cleanup;
9
+ let onContentChangeMock;
10
+ beforeEach(() => {
11
+ onContentChangeMock = jest.fn();
12
+ cleanup = (0, prosemirror_1.mockCreateRange)();
13
+ });
14
+ afterEach(() => {
15
+ if (cleanup) {
16
+ cleanup();
17
+ }
18
+ cleanup = null;
19
+ });
20
+ it('span with lang attribute is rendered and returned as expected', async () => {
21
+ const inputData = '<p>bar</p><span lang="en-GB">foo</span>';
22
+ const expectedDom = '<p>foo</p><p><span lang="en-GB">foo</span></p>';
23
+ const expectedOutput = '<p>foo</p><p><span lang="en-GB">foo</span></p>';
24
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
25
+ await act(async () => {
26
+ insertText(await result.findByText('bar'), 'foo');
27
+ });
28
+ const element = result.container.querySelector('.ProseMirror');
29
+ expect(element.innerHTML).toBe(expectedDom);
30
+ expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
31
+ });
32
+ });
33
+ function insertText(element, text) {
34
+ react_1.fireEvent.input(element, {
35
+ target: { innerText: text, innerHTML: text }
36
+ });
37
+ }
38
+ //# sourceMappingURL=spanWithLang.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spanWithLang.test.js","sourceRoot":"","sources":["../../../__tests__/editor/spanWithLang.test.tsx"],"names":[],"mappings":";;AAAA,kDAAkE;AAClE,sDAAsD;AACtD,gGAAoF;AAEpF,MAAM,GAAG,GAAG,WAAuD,CAAA;AAEnE,QAAQ,CAAC,mCAAmC,EAAE,GAAG,EAAE;IACjD,IAAI,OAA4B,CAAA;IAChC,IAAI,mBAA8B,CAAA;IAElC,UAAU,CAAC,GAAG,EAAE;QACd,mBAAmB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;QAC/B,OAAO,GAAG,IAAA,6BAAe,GAAE,CAAA;IAC7B,CAAC,CAAC,CAAA;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,EAAE,CAAA;QACX,CAAC;QACD,OAAO,GAAG,IAAI,CAAA;IAChB,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,+DAA+D,EAAE,KAAK,IAAI,EAAE;QAC7E,MAAM,SAAS,GAAG,yCAAyC,CAAA;QAC3D,MAAM,WAAW,GAAG,gDAAgD,CAAA;QACpE,MAAM,cAAc,GAAG,gDAAgD,CAAA;QACvE,MAAM,MAAM,GAAG,IAAA,2DAAwB,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAA;QACvE,MAAM,GAAG,CAAC,KAAK,IAAI,EAAE;YACnB,UAAU,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAA;QACnD,CAAC,CAAC,CAAA;QACF,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,cAAc,CAAC,CAAA;QAC9D,MAAM,CAAC,OAAQ,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;QAC5C,MAAM,CAAC,mBAAmB,CAAC,CAAC,oBAAoB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAA;IACtE,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEF,SAAS,UAAU,CAAC,OAAoB,EAAE,IAAY;IACpD,iBAAS,CAAC,KAAK,CAAC,OAAO,EAAE;QACvB,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE;KAC7C,CAAC,CAAA;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=subSup.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subSup.test.d.ts","sourceRoot":"","sources":["../../../__tests__/editor/subSup.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const react_1 = require("@testing-library/react");
4
+ const prosemirror_1 = require("../utils/prosemirror");
5
+ const renderEditableGradingInstruction_1 = require("../utils/renderEditableGradingInstruction");
6
+ const act = react_1.act;
7
+ describe('Editor - sub and sup', () => {
8
+ let cleanup;
9
+ let onContentChangeMock;
10
+ beforeEach(() => {
11
+ onContentChangeMock = jest.fn();
12
+ cleanup = (0, prosemirror_1.mockCreateRange)();
13
+ });
14
+ afterEach(() => {
15
+ if (cleanup) {
16
+ cleanup();
17
+ }
18
+ cleanup = null;
19
+ });
20
+ it('sub is rendered and returned as expected', async () => {
21
+ const inputData = '<p>bar</p><sub>foo</sub>';
22
+ const expectedDom = '<p>foo</p><p><sub>foo</sub></p>';
23
+ const expectedOutput = '<p>foo</p><p><sub>foo</sub></p>';
24
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
25
+ await act(async () => {
26
+ insertText(await result.findByText('bar'), 'foo');
27
+ });
28
+ const element = result.container.querySelector('.ProseMirror');
29
+ expect(element.innerHTML).toBe(expectedDom);
30
+ expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
31
+ });
32
+ it('sup is rendered and returned as expected', async () => {
33
+ const inputData = '<p>bar</p><sup>foo</sup>';
34
+ const expectedDom = '<p>foo</p><p><sup>foo</sup></p>';
35
+ const expectedOutput = '<p>foo</p><p><sup>foo</sup></p>';
36
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
37
+ await act(async () => {
38
+ insertText(await result.findByText('bar'), 'foo');
39
+ });
40
+ const element = result.container.querySelector('.ProseMirror');
41
+ expect(element.innerHTML).toBe(expectedDom);
42
+ expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
43
+ });
44
+ });
45
+ function insertText(element, text) {
46
+ react_1.fireEvent.input(element, {
47
+ target: { innerText: text, innerHTML: text }
48
+ });
49
+ }
50
+ //# sourceMappingURL=subSup.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subSup.test.js","sourceRoot":"","sources":["../../../__tests__/editor/subSup.test.tsx"],"names":[],"mappings":";;AAAA,kDAAkE;AAClE,sDAAsD;AACtD,gGAAoF;AAEpF,MAAM,GAAG,GAAG,WAAuD,CAAA;AAEnE,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,IAAI,OAA4B,CAAA;IAChC,IAAI,mBAA8B,CAAA;IAElC,UAAU,CAAC,GAAG,EAAE;QACd,mBAAmB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;QAC/B,OAAO,GAAG,IA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