@gmb/bitmark-parser-generator 3.33.0 → 3.35.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 (904) hide show
  1. package/README.md +2 -2
  2. package/dist/browser/bitmark-parser-generator.min.js +1 -1
  3. package/dist/browser/bundle-report.html +2 -2
  4. package/dist/index.cjs +34967 -0
  5. package/dist/index.cjs.map +1 -0
  6. package/dist/index.d.cts +8185 -0
  7. package/dist/index.d.ts +8185 -0
  8. package/dist/index.js +34907 -0
  9. package/dist/index.js.map +1 -0
  10. package/package.json +100 -87
  11. package/dist/cjs/BitmarkParserGenerator.js +0 -776
  12. package/dist/cjs/BitmarkParserGenerator.js.map +0 -1
  13. package/dist/cjs/ast/Ast.js +0 -220
  14. package/dist/cjs/ast/Ast.js.map +0 -1
  15. package/dist/cjs/ast/BaseBuilder.js +0 -193
  16. package/dist/cjs/ast/BaseBuilder.js.map +0 -1
  17. package/dist/cjs/ast/Builder.js +0 -1788
  18. package/dist/cjs/ast/Builder.js.map +0 -1
  19. package/dist/cjs/ast/ResourceBuilder.js +0 -964
  20. package/dist/cjs/ast/ResourceBuilder.js.map +0 -1
  21. package/dist/cjs/ast/rules/NodeValidator.js +0 -184
  22. package/dist/cjs/ast/rules/NodeValidator.js.map +0 -1
  23. package/dist/cjs/ast/writer/FileWriter.js +0 -119
  24. package/dist/cjs/ast/writer/FileWriter.js.map +0 -1
  25. package/dist/cjs/ast/writer/StreamWriter.js +0 -89
  26. package/dist/cjs/ast/writer/StreamWriter.js.map +0 -1
  27. package/dist/cjs/ast/writer/StringWriter.js +0 -115
  28. package/dist/cjs/ast/writer/StringWriter.js.map +0 -1
  29. package/dist/cjs/ast/writer/Writer.js +0 -3
  30. package/dist/cjs/ast/writer/Writer.js.map +0 -1
  31. package/dist/cjs/breakscaping/Breakscape.js +0 -80
  32. package/dist/cjs/breakscaping/Breakscape.js.map +0 -1
  33. package/dist/cjs/breakscaping/BreakscapeLoop.js +0 -305
  34. package/dist/cjs/breakscaping/BreakscapeLoop.js.map +0 -1
  35. package/dist/cjs/breakscaping/BreakscapeOptions.js +0 -3
  36. package/dist/cjs/breakscaping/BreakscapeOptions.js.map +0 -1
  37. package/dist/cjs/breakscaping/BreakscapeRegex.js +0 -213
  38. package/dist/cjs/breakscaping/BreakscapeRegex.js.map +0 -1
  39. package/dist/cjs/breakscaping/RegexConfigs.js +0 -38
  40. package/dist/cjs/breakscaping/RegexConfigs.js.map +0 -1
  41. package/dist/cjs/config/Config.js +0 -352
  42. package/dist/cjs/config/Config.js.map +0 -1
  43. package/dist/cjs/config/ConfigHydrator.js +0 -161
  44. package/dist/cjs/config/ConfigHydrator.js.map +0 -1
  45. package/dist/cjs/config/raw/bits.js +0 -2615
  46. package/dist/cjs/config/raw/bits.js.map +0 -1
  47. package/dist/cjs/config/raw/cardSets.js +0 -549
  48. package/dist/cjs/config/raw/cardSets.js.map +0 -1
  49. package/dist/cjs/config/raw/groups.js +0 -1182
  50. package/dist/cjs/config/raw/groups.js.map +0 -1
  51. package/dist/cjs/config/raw/properties.js +0 -1006
  52. package/dist/cjs/config/raw/properties.js.map +0 -1
  53. package/dist/cjs/config/raw/resources.js +0 -103
  54. package/dist/cjs/config/raw/resources.js.map +0 -1
  55. package/dist/cjs/config/raw/tags.js +0 -48
  56. package/dist/cjs/config/raw/tags.js.map +0 -1
  57. package/dist/cjs/generated/build-info.js +0 -13
  58. package/dist/cjs/generated/build-info.js.map +0 -1
  59. package/dist/cjs/generated/parser/bitmark/bitmark-peggy-parser.js +0 -3168
  60. package/dist/cjs/generated/parser/bitmark/bitmark-peggy-parser.js.map +0 -1
  61. package/dist/cjs/generated/parser/text/text-peggy-parser.js +0 -9631
  62. package/dist/cjs/generated/parser/text/text-peggy-parser.js.map +0 -1
  63. package/dist/cjs/generator/AstWalkerGenerator.js +0 -86
  64. package/dist/cjs/generator/AstWalkerGenerator.js.map +0 -1
  65. package/dist/cjs/generator/Generator.js +0 -3
  66. package/dist/cjs/generator/Generator.js.map +0 -1
  67. package/dist/cjs/generator/bitmark/BitmarkFileGenerator.js +0 -49
  68. package/dist/cjs/generator/bitmark/BitmarkFileGenerator.js.map +0 -1
  69. package/dist/cjs/generator/bitmark/BitmarkGenerator.js +0 -2601
  70. package/dist/cjs/generator/bitmark/BitmarkGenerator.js.map +0 -1
  71. package/dist/cjs/generator/bitmark/BitmarkStringGenerator.js +0 -51
  72. package/dist/cjs/generator/bitmark/BitmarkStringGenerator.js.map +0 -1
  73. package/dist/cjs/generator/json/JsonFileGenerator.js +0 -53
  74. package/dist/cjs/generator/json/JsonFileGenerator.js.map +0 -1
  75. package/dist/cjs/generator/json/JsonGenerator.js +0 -1584
  76. package/dist/cjs/generator/json/JsonGenerator.js.map +0 -1
  77. package/dist/cjs/generator/json/JsonObjectGenerator.js +0 -51
  78. package/dist/cjs/generator/json/JsonObjectGenerator.js.map +0 -1
  79. package/dist/cjs/generator/json/JsonStringGenerator.js +0 -50
  80. package/dist/cjs/generator/json/JsonStringGenerator.js.map +0 -1
  81. package/dist/cjs/generator/text/TextGenerator.js +0 -1195
  82. package/dist/cjs/generator/text/TextGenerator.js.map +0 -1
  83. package/dist/cjs/index.js +0 -79
  84. package/dist/cjs/index.js.map +0 -1
  85. package/dist/cjs/info/InfoBuilder.js +0 -43
  86. package/dist/cjs/info/InfoBuilder.js.map +0 -1
  87. package/dist/cjs/init/init.js +0 -15
  88. package/dist/cjs/init/init.js.map +0 -1
  89. package/dist/cjs/model/ast/BreakscapedString.js +0 -3
  90. package/dist/cjs/model/ast/BreakscapedString.js.map +0 -1
  91. package/dist/cjs/model/ast/NodeType.js +0 -557
  92. package/dist/cjs/model/ast/NodeType.js.map +0 -1
  93. package/dist/cjs/model/ast/Nodes.js +0 -3
  94. package/dist/cjs/model/ast/Nodes.js.map +0 -1
  95. package/dist/cjs/model/ast/StardardString.js +0 -3
  96. package/dist/cjs/model/ast/StardardString.js.map +0 -1
  97. package/dist/cjs/model/ast/TextNodes.js +0 -3
  98. package/dist/cjs/model/ast/TextNodes.js.map +0 -1
  99. package/dist/cjs/model/config/AbstractTagConfig.js +0 -18
  100. package/dist/cjs/model/config/AbstractTagConfig.js.map +0 -1
  101. package/dist/cjs/model/config/BitConfig.js +0 -72
  102. package/dist/cjs/model/config/BitConfig.js.map +0 -1
  103. package/dist/cjs/model/config/CardSetConfig.js +0 -26
  104. package/dist/cjs/model/config/CardSetConfig.js.map +0 -1
  105. package/dist/cjs/model/config/CardVariantConfig.js +0 -32
  106. package/dist/cjs/model/config/CardVariantConfig.js.map +0 -1
  107. package/dist/cjs/model/config/MarkupTagConfig.js +0 -41
  108. package/dist/cjs/model/config/MarkupTagConfig.js.map +0 -1
  109. package/dist/cjs/model/config/PropertyTagConfig.js +0 -50
  110. package/dist/cjs/model/config/PropertyTagConfig.js.map +0 -1
  111. package/dist/cjs/model/config/ResourceTagConfig.js +0 -42
  112. package/dist/cjs/model/config/ResourceTagConfig.js.map +0 -1
  113. package/dist/cjs/model/config/ResourcesConfig.js +0 -31
  114. package/dist/cjs/model/config/ResourcesConfig.js.map +0 -1
  115. package/dist/cjs/model/config/TagConfig.js +0 -3
  116. package/dist/cjs/model/config/TagConfig.js.map +0 -1
  117. package/dist/cjs/model/config/TagsConfig.js +0 -3
  118. package/dist/cjs/model/config/TagsConfig.js.map +0 -1
  119. package/dist/cjs/model/config/TagsConfigWithInfo.js +0 -3
  120. package/dist/cjs/model/config/TagsConfigWithInfo.js.map +0 -1
  121. package/dist/cjs/model/config/_Config.js +0 -3
  122. package/dist/cjs/model/config/_Config.js.map +0 -1
  123. package/dist/cjs/model/config/enum/CardSetConfigKey.js +0 -28
  124. package/dist/cjs/model/config/enum/CardSetConfigKey.js.map +0 -1
  125. package/dist/cjs/model/config/enum/ConfigKey.js +0 -29
  126. package/dist/cjs/model/config/enum/ConfigKey.js.map +0 -1
  127. package/dist/cjs/model/config/enum/GroupConfigKey.js +0 -57
  128. package/dist/cjs/model/config/enum/GroupConfigKey.js.map +0 -1
  129. package/dist/cjs/model/config/enum/GroupConfigType.js +0 -14
  130. package/dist/cjs/model/config/enum/GroupConfigType.js.map +0 -1
  131. package/dist/cjs/model/config/enum/PropertyConfigKey.js +0 -215
  132. package/dist/cjs/model/config/enum/PropertyConfigKey.js.map +0 -1
  133. package/dist/cjs/model/config/enum/ResourceConfigKey.js +0 -40
  134. package/dist/cjs/model/config/enum/ResourceConfigKey.js.map +0 -1
  135. package/dist/cjs/model/config/enum/TagConfigKey.js +0 -26
  136. package/dist/cjs/model/config/enum/TagConfigKey.js.map +0 -1
  137. package/dist/cjs/model/enum/BitTagType.js +0 -13
  138. package/dist/cjs/model/enum/BitTagType.js.map +0 -1
  139. package/dist/cjs/model/enum/BitType.js +0 -576
  140. package/dist/cjs/model/enum/BitType.js.map +0 -1
  141. package/dist/cjs/model/enum/BitmarkGeneratorOutput.js +0 -2
  142. package/dist/cjs/model/enum/BitmarkGeneratorOutput.js.map +0 -1
  143. package/dist/cjs/model/enum/BitmarkParserType.js +0 -9
  144. package/dist/cjs/model/enum/BitmarkParserType.js.map +0 -1
  145. package/dist/cjs/model/enum/BitmarkVersion.js +0 -12
  146. package/dist/cjs/model/enum/BitmarkVersion.js.map +0 -1
  147. package/dist/cjs/model/enum/BodyBitType.js +0 -14
  148. package/dist/cjs/model/enum/BodyBitType.js.map +0 -1
  149. package/dist/cjs/model/enum/BodyTextFormat.js +0 -14
  150. package/dist/cjs/model/enum/BodyTextFormat.js.map +0 -1
  151. package/dist/cjs/model/enum/CardSetVersion.js +0 -10
  152. package/dist/cjs/model/enum/CardSetVersion.js.map +0 -1
  153. package/dist/cjs/model/enum/Count.js +0 -9
  154. package/dist/cjs/model/enum/Count.js.map +0 -1
  155. package/dist/cjs/model/enum/DeprecatedTextFormat.js +0 -9
  156. package/dist/cjs/model/enum/DeprecatedTextFormat.js.map +0 -1
  157. package/dist/cjs/model/enum/ExampleType.js +0 -11
  158. package/dist/cjs/model/enum/ExampleType.js.map +0 -1
  159. package/dist/cjs/model/enum/PropertyAstKey.js +0 -18
  160. package/dist/cjs/model/enum/PropertyAstKey.js.map +0 -1
  161. package/dist/cjs/model/enum/PropertyFormat.js +0 -14
  162. package/dist/cjs/model/enum/PropertyFormat.js.map +0 -1
  163. package/dist/cjs/model/enum/PropertyJsonKey.js +0 -14
  164. package/dist/cjs/model/enum/PropertyJsonKey.js.map +0 -1
  165. package/dist/cjs/model/enum/PropertyTag.js +0 -8
  166. package/dist/cjs/model/enum/PropertyTag.js.map +0 -1
  167. package/dist/cjs/model/enum/ResourceJsonKey.js +0 -27
  168. package/dist/cjs/model/enum/ResourceJsonKey.js.map +0 -1
  169. package/dist/cjs/model/enum/ResourceTag.js +0 -37
  170. package/dist/cjs/model/enum/ResourceTag.js.map +0 -1
  171. package/dist/cjs/model/enum/Tag.js +0 -21
  172. package/dist/cjs/model/enum/Tag.js.map +0 -1
  173. package/dist/cjs/model/enum/TextFormat.js +0 -16
  174. package/dist/cjs/model/enum/TextFormat.js.map +0 -1
  175. package/dist/cjs/model/enum/TextLocation.js +0 -15
  176. package/dist/cjs/model/enum/TextLocation.js.map +0 -1
  177. package/dist/cjs/model/enum/TextMarkType.js +0 -54
  178. package/dist/cjs/model/enum/TextMarkType.js.map +0 -1
  179. package/dist/cjs/model/enum/TextNodeType.js +0 -35
  180. package/dist/cjs/model/enum/TextNodeType.js.map +0 -1
  181. package/dist/cjs/model/enum/TextSection.js +0 -18
  182. package/dist/cjs/model/enum/TextSection.js.map +0 -1
  183. package/dist/cjs/model/info/enum/InfoFormat.js +0 -11
  184. package/dist/cjs/model/info/enum/InfoFormat.js.map +0 -1
  185. package/dist/cjs/model/info/enum/InfoType.js +0 -12
  186. package/dist/cjs/model/info/enum/InfoType.js.map +0 -1
  187. package/dist/cjs/model/json/BitJson.js +0 -3
  188. package/dist/cjs/model/json/BitJson.js.map +0 -1
  189. package/dist/cjs/model/json/BitWrapperJson.js +0 -3
  190. package/dist/cjs/model/json/BitWrapperJson.js.map +0 -1
  191. package/dist/cjs/model/json/BodyBitJson.js +0 -3
  192. package/dist/cjs/model/json/BodyBitJson.js.map +0 -1
  193. package/dist/cjs/model/json/ParserJson.js +0 -3
  194. package/dist/cjs/model/json/ParserJson.js.map +0 -1
  195. package/dist/cjs/model/json/ResourceJson.js +0 -3
  196. package/dist/cjs/model/json/ResourceJson.js.map +0 -1
  197. package/dist/cjs/model/parser/ParserData.js +0 -3
  198. package/dist/cjs/model/parser/ParserData.js.map +0 -1
  199. package/dist/cjs/model/parser/ParserError.js +0 -3
  200. package/dist/cjs/model/parser/ParserError.js.map +0 -1
  201. package/dist/cjs/model/parser/ParserInfo.js +0 -3
  202. package/dist/cjs/model/parser/ParserInfo.js.map +0 -1
  203. package/dist/cjs/model/parser/ParserLocation.js +0 -3
  204. package/dist/cjs/model/parser/ParserLocation.js.map +0 -1
  205. package/dist/cjs/model/parser/ParserLocationRange.js +0 -3
  206. package/dist/cjs/model/parser/ParserLocationRange.js.map +0 -1
  207. package/dist/cjs/model/parser/TagValidationData.js +0 -3
  208. package/dist/cjs/model/parser/TagValidationData.js.map +0 -1
  209. package/dist/cjs/parser/bitmark/BitmarkParser.js +0 -25
  210. package/dist/cjs/parser/bitmark/BitmarkParser.js.map +0 -1
  211. package/dist/cjs/parser/bitmark/peg/BitmarkPegParser.js +0 -7
  212. package/dist/cjs/parser/bitmark/peg/BitmarkPegParser.js.map +0 -1
  213. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserHelper.js +0 -614
  214. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserHelper.js.map +0 -1
  215. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserProcessor.js +0 -716
  216. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserProcessor.js.map +0 -1
  217. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserTypes.js +0 -69
  218. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserTypes.js.map +0 -1
  219. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserValidator.js +0 -745
  220. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserValidator.js.map +0 -1
  221. package/dist/cjs/parser/bitmark/peg/PeggyGrammarLocation.js +0 -82
  222. package/dist/cjs/parser/bitmark/peg/PeggyGrammarLocation.js.map +0 -1
  223. package/dist/cjs/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js +0 -260
  224. package/dist/cjs/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js.map +0 -1
  225. package/dist/cjs/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js +0 -50
  226. package/dist/cjs/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js.map +0 -1
  227. package/dist/cjs/parser/bitmark/peg/contentProcessors/CardContentProcessor.js +0 -885
  228. package/dist/cjs/parser/bitmark/peg/contentProcessors/CardContentProcessor.js.map +0 -1
  229. package/dist/cjs/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js +0 -27
  230. package/dist/cjs/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js.map +0 -1
  231. package/dist/cjs/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.js +0 -61
  232. package/dist/cjs/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.js.map +0 -1
  233. package/dist/cjs/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js +0 -63
  234. package/dist/cjs/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js.map +0 -1
  235. package/dist/cjs/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js +0 -161
  236. package/dist/cjs/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js.map +0 -1
  237. package/dist/cjs/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js +0 -55
  238. package/dist/cjs/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js.map +0 -1
  239. package/dist/cjs/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js +0 -31
  240. package/dist/cjs/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js.map +0 -1
  241. package/dist/cjs/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js +0 -59
  242. package/dist/cjs/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js.map +0 -1
  243. package/dist/cjs/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.js +0 -16
  244. package/dist/cjs/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.js.map +0 -1
  245. package/dist/cjs/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.js +0 -29
  246. package/dist/cjs/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.js.map +0 -1
  247. package/dist/cjs/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js +0 -20
  248. package/dist/cjs/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js.map +0 -1
  249. package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js +0 -45
  250. package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js.map +0 -1
  251. package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js +0 -44
  252. package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js.map +0 -1
  253. package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.js +0 -11
  254. package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.js.map +0 -1
  255. package/dist/cjs/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js +0 -57
  256. package/dist/cjs/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js.map +0 -1
  257. package/dist/cjs/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js +0 -158
  258. package/dist/cjs/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js.map +0 -1
  259. package/dist/cjs/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js +0 -37
  260. package/dist/cjs/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js.map +0 -1
  261. package/dist/cjs/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js +0 -24
  262. package/dist/cjs/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js.map +0 -1
  263. package/dist/cjs/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js +0 -163
  264. package/dist/cjs/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js.map +0 -1
  265. package/dist/cjs/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.js +0 -27
  266. package/dist/cjs/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.js.map +0 -1
  267. package/dist/cjs/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js +0 -28
  268. package/dist/cjs/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js.map +0 -1
  269. package/dist/cjs/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js +0 -53
  270. package/dist/cjs/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js.map +0 -1
  271. package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js +0 -203
  272. package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js.map +0 -1
  273. package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js +0 -24
  274. package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js.map +0 -1
  275. package/dist/cjs/parser/json/JsonParser.js +0 -270
  276. package/dist/cjs/parser/json/JsonParser.js.map +0 -1
  277. package/dist/cjs/parser/text/TextParser.js +0 -148
  278. package/dist/cjs/parser/text/TextParser.js.map +0 -1
  279. package/dist/cjs/parser/text/peg/TextPegParser.js +0 -7
  280. package/dist/cjs/parser/text/peg/TextPegParser.js.map +0 -1
  281. package/dist/cjs/utils/ArrayUtils.js +0 -43
  282. package/dist/cjs/utils/ArrayUtils.js.map +0 -1
  283. package/dist/cjs/utils/BitUtils.js +0 -75
  284. package/dist/cjs/utils/BitUtils.js.map +0 -1
  285. package/dist/cjs/utils/BooleanUtils.js +0 -62
  286. package/dist/cjs/utils/BooleanUtils.js.map +0 -1
  287. package/dist/cjs/utils/FileUtils.js +0 -75
  288. package/dist/cjs/utils/FileUtils.js.map +0 -1
  289. package/dist/cjs/utils/NumberUtils.js +0 -62
  290. package/dist/cjs/utils/NumberUtils.js.map +0 -1
  291. package/dist/cjs/utils/ObjectUtils.js +0 -417
  292. package/dist/cjs/utils/ObjectUtils.js.map +0 -1
  293. package/dist/cjs/utils/StringUtils.js +0 -183
  294. package/dist/cjs/utils/StringUtils.js.map +0 -1
  295. package/dist/cjs/utils/UrlUtils.js +0 -37
  296. package/dist/cjs/utils/UrlUtils.js.map +0 -1
  297. package/dist/cjs/utils/env/Env.js +0 -131
  298. package/dist/cjs/utils/env/Env.js.map +0 -1
  299. package/dist/cjs/utils/env/Environment.js +0 -15
  300. package/dist/cjs/utils/env/Environment.js.map +0 -1
  301. package/dist/cjs/utils/env/Os.js +0 -14
  302. package/dist/cjs/utils/env/Os.js.map +0 -1
  303. package/dist/cjs/utils/env/Version.js +0 -12
  304. package/dist/cjs/utils/env/Version.js.map +0 -1
  305. package/dist/cjs/utils/env/userAgent.js +0 -88
  306. package/dist/cjs/utils/env/userAgent.js.map +0 -1
  307. package/dist/cjs/utils/polyfill/fs.js +0 -14
  308. package/dist/cjs/utils/polyfill/fs.js.map +0 -1
  309. package/dist/esm/BitmarkParserGenerator.js +0 -735
  310. package/dist/esm/BitmarkParserGenerator.js.map +0 -1
  311. package/dist/esm/ast/Ast.js +0 -217
  312. package/dist/esm/ast/Ast.js.map +0 -1
  313. package/dist/esm/ast/BaseBuilder.js +0 -190
  314. package/dist/esm/ast/BaseBuilder.js.map +0 -1
  315. package/dist/esm/ast/Builder.js +0 -1782
  316. package/dist/esm/ast/Builder.js.map +0 -1
  317. package/dist/esm/ast/ResourceBuilder.js +0 -961
  318. package/dist/esm/ast/ResourceBuilder.js.map +0 -1
  319. package/dist/esm/ast/rules/NodeValidator.js +0 -181
  320. package/dist/esm/ast/rules/NodeValidator.js.map +0 -1
  321. package/dist/esm/ast/writer/FileWriter.js +0 -80
  322. package/dist/esm/ast/writer/FileWriter.js.map +0 -1
  323. package/dist/esm/ast/writer/StreamWriter.js +0 -83
  324. package/dist/esm/ast/writer/StreamWriter.js.map +0 -1
  325. package/dist/esm/ast/writer/StringWriter.js +0 -112
  326. package/dist/esm/ast/writer/StringWriter.js.map +0 -1
  327. package/dist/esm/ast/writer/Writer.js +0 -2
  328. package/dist/esm/ast/writer/Writer.js.map +0 -1
  329. package/dist/esm/breakscaping/Breakscape.js +0 -77
  330. package/dist/esm/breakscaping/Breakscape.js.map +0 -1
  331. package/dist/esm/breakscaping/BreakscapeLoop.js +0 -302
  332. package/dist/esm/breakscaping/BreakscapeLoop.js.map +0 -1
  333. package/dist/esm/breakscaping/BreakscapeOptions.js +0 -2
  334. package/dist/esm/breakscaping/BreakscapeOptions.js.map +0 -1
  335. package/dist/esm/breakscaping/BreakscapeRegex.js +0 -177
  336. package/dist/esm/breakscaping/BreakscapeRegex.js.map +0 -1
  337. package/dist/esm/breakscaping/RegexConfigs.js +0 -35
  338. package/dist/esm/breakscaping/RegexConfigs.js.map +0 -1
  339. package/dist/esm/config/Config.js +0 -349
  340. package/dist/esm/config/Config.js.map +0 -1
  341. package/dist/esm/config/ConfigHydrator.js +0 -158
  342. package/dist/esm/config/ConfigHydrator.js.map +0 -1
  343. package/dist/esm/config/raw/bits.js +0 -2612
  344. package/dist/esm/config/raw/bits.js.map +0 -1
  345. package/dist/esm/config/raw/cardSets.js +0 -546
  346. package/dist/esm/config/raw/cardSets.js.map +0 -1
  347. package/dist/esm/config/raw/groups.js +0 -1179
  348. package/dist/esm/config/raw/groups.js.map +0 -1
  349. package/dist/esm/config/raw/properties.js +0 -1003
  350. package/dist/esm/config/raw/properties.js.map +0 -1
  351. package/dist/esm/config/raw/resources.js +0 -100
  352. package/dist/esm/config/raw/resources.js.map +0 -1
  353. package/dist/esm/config/raw/tags.js +0 -45
  354. package/dist/esm/config/raw/tags.js.map +0 -1
  355. package/dist/esm/generated/build-info.js +0 -10
  356. package/dist/esm/generated/build-info.js.map +0 -1
  357. package/dist/esm/generated/parser/bitmark/bitmark-peggy-parser.js +0 -3163
  358. package/dist/esm/generated/parser/bitmark/bitmark-peggy-parser.js.map +0 -1
  359. package/dist/esm/generated/parser/text/text-peggy-parser.js +0 -9626
  360. package/dist/esm/generated/parser/text/text-peggy-parser.js.map +0 -1
  361. package/dist/esm/generator/AstWalkerGenerator.js +0 -83
  362. package/dist/esm/generator/AstWalkerGenerator.js.map +0 -1
  363. package/dist/esm/generator/Generator.js +0 -2
  364. package/dist/esm/generator/Generator.js.map +0 -1
  365. package/dist/esm/generator/bitmark/BitmarkFileGenerator.js +0 -46
  366. package/dist/esm/generator/bitmark/BitmarkFileGenerator.js.map +0 -1
  367. package/dist/esm/generator/bitmark/BitmarkGenerator.js +0 -2598
  368. package/dist/esm/generator/bitmark/BitmarkGenerator.js.map +0 -1
  369. package/dist/esm/generator/bitmark/BitmarkStringGenerator.js +0 -48
  370. package/dist/esm/generator/bitmark/BitmarkStringGenerator.js.map +0 -1
  371. package/dist/esm/generator/json/JsonFileGenerator.js +0 -50
  372. package/dist/esm/generator/json/JsonFileGenerator.js.map +0 -1
  373. package/dist/esm/generator/json/JsonGenerator.js +0 -1578
  374. package/dist/esm/generator/json/JsonGenerator.js.map +0 -1
  375. package/dist/esm/generator/json/JsonObjectGenerator.js +0 -48
  376. package/dist/esm/generator/json/JsonObjectGenerator.js.map +0 -1
  377. package/dist/esm/generator/json/JsonStringGenerator.js +0 -47
  378. package/dist/esm/generator/json/JsonStringGenerator.js.map +0 -1
  379. package/dist/esm/generator/text/TextGenerator.js +0 -1192
  380. package/dist/esm/generator/text/TextGenerator.js.map +0 -1
  381. package/dist/esm/index.js +0 -49
  382. package/dist/esm/index.js.map +0 -1
  383. package/dist/esm/info/InfoBuilder.js +0 -40
  384. package/dist/esm/info/InfoBuilder.js.map +0 -1
  385. package/dist/esm/init/init.js +0 -13
  386. package/dist/esm/init/init.js.map +0 -1
  387. package/dist/esm/model/ast/BreakscapedString.js +0 -2
  388. package/dist/esm/model/ast/BreakscapedString.js.map +0 -1
  389. package/dist/esm/model/ast/NodeType.js +0 -554
  390. package/dist/esm/model/ast/NodeType.js.map +0 -1
  391. package/dist/esm/model/ast/Nodes.js +0 -2
  392. package/dist/esm/model/ast/Nodes.js.map +0 -1
  393. package/dist/esm/model/ast/StardardString.js +0 -2
  394. package/dist/esm/model/ast/StardardString.js.map +0 -1
  395. package/dist/esm/model/ast/TextNodes.js +0 -2
  396. package/dist/esm/model/ast/TextNodes.js.map +0 -1
  397. package/dist/esm/model/config/AbstractTagConfig.js +0 -15
  398. package/dist/esm/model/config/AbstractTagConfig.js.map +0 -1
  399. package/dist/esm/model/config/BitConfig.js +0 -69
  400. package/dist/esm/model/config/BitConfig.js.map +0 -1
  401. package/dist/esm/model/config/CardSetConfig.js +0 -23
  402. package/dist/esm/model/config/CardSetConfig.js.map +0 -1
  403. package/dist/esm/model/config/CardVariantConfig.js +0 -29
  404. package/dist/esm/model/config/CardVariantConfig.js.map +0 -1
  405. package/dist/esm/model/config/MarkupTagConfig.js +0 -38
  406. package/dist/esm/model/config/MarkupTagConfig.js.map +0 -1
  407. package/dist/esm/model/config/PropertyTagConfig.js +0 -47
  408. package/dist/esm/model/config/PropertyTagConfig.js.map +0 -1
  409. package/dist/esm/model/config/ResourceTagConfig.js +0 -39
  410. package/dist/esm/model/config/ResourceTagConfig.js.map +0 -1
  411. package/dist/esm/model/config/ResourcesConfig.js +0 -28
  412. package/dist/esm/model/config/ResourcesConfig.js.map +0 -1
  413. package/dist/esm/model/config/TagConfig.js +0 -2
  414. package/dist/esm/model/config/TagConfig.js.map +0 -1
  415. package/dist/esm/model/config/TagsConfig.js +0 -2
  416. package/dist/esm/model/config/TagsConfig.js.map +0 -1
  417. package/dist/esm/model/config/TagsConfigWithInfo.js +0 -2
  418. package/dist/esm/model/config/TagsConfigWithInfo.js.map +0 -1
  419. package/dist/esm/model/config/_Config.js +0 -2
  420. package/dist/esm/model/config/_Config.js.map +0 -1
  421. package/dist/esm/model/config/enum/CardSetConfigKey.js +0 -25
  422. package/dist/esm/model/config/enum/CardSetConfigKey.js.map +0 -1
  423. package/dist/esm/model/config/enum/ConfigKey.js +0 -26
  424. package/dist/esm/model/config/enum/ConfigKey.js.map +0 -1
  425. package/dist/esm/model/config/enum/GroupConfigKey.js +0 -53
  426. package/dist/esm/model/config/enum/GroupConfigKey.js.map +0 -1
  427. package/dist/esm/model/config/enum/GroupConfigType.js +0 -11
  428. package/dist/esm/model/config/enum/GroupConfigType.js.map +0 -1
  429. package/dist/esm/model/config/enum/PropertyConfigKey.js +0 -211
  430. package/dist/esm/model/config/enum/PropertyConfigKey.js.map +0 -1
  431. package/dist/esm/model/config/enum/ResourceConfigKey.js +0 -36
  432. package/dist/esm/model/config/enum/ResourceConfigKey.js.map +0 -1
  433. package/dist/esm/model/config/enum/TagConfigKey.js +0 -22
  434. package/dist/esm/model/config/enum/TagConfigKey.js.map +0 -1
  435. package/dist/esm/model/enum/BitTagType.js +0 -10
  436. package/dist/esm/model/enum/BitTagType.js.map +0 -1
  437. package/dist/esm/model/enum/BitType.js +0 -573
  438. package/dist/esm/model/enum/BitType.js.map +0 -1
  439. package/dist/esm/model/enum/BitmarkGeneratorOutput.js +0 -2
  440. package/dist/esm/model/enum/BitmarkGeneratorOutput.js.map +0 -1
  441. package/dist/esm/model/enum/BitmarkParserType.js +0 -6
  442. package/dist/esm/model/enum/BitmarkParserType.js.map +0 -1
  443. package/dist/esm/model/enum/BitmarkVersion.js +0 -8
  444. package/dist/esm/model/enum/BitmarkVersion.js.map +0 -1
  445. package/dist/esm/model/enum/BodyBitType.js +0 -11
  446. package/dist/esm/model/enum/BodyBitType.js.map +0 -1
  447. package/dist/esm/model/enum/BodyTextFormat.js +0 -11
  448. package/dist/esm/model/enum/BodyTextFormat.js.map +0 -1
  449. package/dist/esm/model/enum/CardSetVersion.js +0 -7
  450. package/dist/esm/model/enum/CardSetVersion.js.map +0 -1
  451. package/dist/esm/model/enum/Count.js +0 -6
  452. package/dist/esm/model/enum/Count.js.map +0 -1
  453. package/dist/esm/model/enum/DeprecatedTextFormat.js +0 -6
  454. package/dist/esm/model/enum/DeprecatedTextFormat.js.map +0 -1
  455. package/dist/esm/model/enum/ExampleType.js +0 -8
  456. package/dist/esm/model/enum/ExampleType.js.map +0 -1
  457. package/dist/esm/model/enum/PropertyAstKey.js +0 -15
  458. package/dist/esm/model/enum/PropertyAstKey.js.map +0 -1
  459. package/dist/esm/model/enum/PropertyFormat.js +0 -11
  460. package/dist/esm/model/enum/PropertyFormat.js.map +0 -1
  461. package/dist/esm/model/enum/PropertyJsonKey.js +0 -11
  462. package/dist/esm/model/enum/PropertyJsonKey.js.map +0 -1
  463. package/dist/esm/model/enum/PropertyTag.js +0 -5
  464. package/dist/esm/model/enum/PropertyTag.js.map +0 -1
  465. package/dist/esm/model/enum/ResourceJsonKey.js +0 -24
  466. package/dist/esm/model/enum/ResourceJsonKey.js.map +0 -1
  467. package/dist/esm/model/enum/ResourceTag.js +0 -34
  468. package/dist/esm/model/enum/ResourceTag.js.map +0 -1
  469. package/dist/esm/model/enum/Tag.js +0 -18
  470. package/dist/esm/model/enum/Tag.js.map +0 -1
  471. package/dist/esm/model/enum/TextFormat.js +0 -13
  472. package/dist/esm/model/enum/TextFormat.js.map +0 -1
  473. package/dist/esm/model/enum/TextLocation.js +0 -12
  474. package/dist/esm/model/enum/TextLocation.js.map +0 -1
  475. package/dist/esm/model/enum/TextMarkType.js +0 -51
  476. package/dist/esm/model/enum/TextMarkType.js.map +0 -1
  477. package/dist/esm/model/enum/TextNodeType.js +0 -32
  478. package/dist/esm/model/enum/TextNodeType.js.map +0 -1
  479. package/dist/esm/model/enum/TextSection.js +0 -15
  480. package/dist/esm/model/enum/TextSection.js.map +0 -1
  481. package/dist/esm/model/info/enum/InfoFormat.js +0 -8
  482. package/dist/esm/model/info/enum/InfoFormat.js.map +0 -1
  483. package/dist/esm/model/info/enum/InfoType.js +0 -9
  484. package/dist/esm/model/info/enum/InfoType.js.map +0 -1
  485. package/dist/esm/model/json/BitJson.js +0 -2
  486. package/dist/esm/model/json/BitJson.js.map +0 -1
  487. package/dist/esm/model/json/BitWrapperJson.js +0 -2
  488. package/dist/esm/model/json/BitWrapperJson.js.map +0 -1
  489. package/dist/esm/model/json/BodyBitJson.js +0 -2
  490. package/dist/esm/model/json/BodyBitJson.js.map +0 -1
  491. package/dist/esm/model/json/ParserJson.js +0 -2
  492. package/dist/esm/model/json/ParserJson.js.map +0 -1
  493. package/dist/esm/model/json/ResourceJson.js +0 -2
  494. package/dist/esm/model/json/ResourceJson.js.map +0 -1
  495. package/dist/esm/model/parser/ParserData.js +0 -2
  496. package/dist/esm/model/parser/ParserData.js.map +0 -1
  497. package/dist/esm/model/parser/ParserError.js +0 -2
  498. package/dist/esm/model/parser/ParserError.js.map +0 -1
  499. package/dist/esm/model/parser/ParserInfo.js +0 -2
  500. package/dist/esm/model/parser/ParserInfo.js.map +0 -1
  501. package/dist/esm/model/parser/ParserLocation.js +0 -2
  502. package/dist/esm/model/parser/ParserLocation.js.map +0 -1
  503. package/dist/esm/model/parser/ParserLocationRange.js +0 -2
  504. package/dist/esm/model/parser/ParserLocationRange.js.map +0 -1
  505. package/dist/esm/model/parser/TagValidationData.js +0 -2
  506. package/dist/esm/model/parser/TagValidationData.js.map +0 -1
  507. package/dist/esm/parser/bitmark/BitmarkParser.js +0 -22
  508. package/dist/esm/parser/bitmark/BitmarkParser.js.map +0 -1
  509. package/dist/esm/parser/bitmark/peg/BitmarkPegParser.js +0 -4
  510. package/dist/esm/parser/bitmark/peg/BitmarkPegParser.js.map +0 -1
  511. package/dist/esm/parser/bitmark/peg/BitmarkPegParserHelper.js +0 -611
  512. package/dist/esm/parser/bitmark/peg/BitmarkPegParserHelper.js.map +0 -1
  513. package/dist/esm/parser/bitmark/peg/BitmarkPegParserProcessor.js +0 -713
  514. package/dist/esm/parser/bitmark/peg/BitmarkPegParserProcessor.js.map +0 -1
  515. package/dist/esm/parser/bitmark/peg/BitmarkPegParserTypes.js +0 -59
  516. package/dist/esm/parser/bitmark/peg/BitmarkPegParserTypes.js.map +0 -1
  517. package/dist/esm/parser/bitmark/peg/BitmarkPegParserValidator.js +0 -742
  518. package/dist/esm/parser/bitmark/peg/BitmarkPegParserValidator.js.map +0 -1
  519. package/dist/esm/parser/bitmark/peg/PeggyGrammarLocation.js +0 -79
  520. package/dist/esm/parser/bitmark/peg/PeggyGrammarLocation.js.map +0 -1
  521. package/dist/esm/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js +0 -257
  522. package/dist/esm/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js.map +0 -1
  523. package/dist/esm/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js +0 -48
  524. package/dist/esm/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js.map +0 -1
  525. package/dist/esm/parser/bitmark/peg/contentProcessors/CardContentProcessor.js +0 -883
  526. package/dist/esm/parser/bitmark/peg/contentProcessors/CardContentProcessor.js.map +0 -1
  527. package/dist/esm/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js +0 -25
  528. package/dist/esm/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js.map +0 -1
  529. package/dist/esm/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.js +0 -58
  530. package/dist/esm/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.js.map +0 -1
  531. package/dist/esm/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js +0 -61
  532. package/dist/esm/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js.map +0 -1
  533. package/dist/esm/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js +0 -159
  534. package/dist/esm/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js.map +0 -1
  535. package/dist/esm/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js +0 -52
  536. package/dist/esm/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js.map +0 -1
  537. package/dist/esm/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js +0 -29
  538. package/dist/esm/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js.map +0 -1
  539. package/dist/esm/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js +0 -57
  540. package/dist/esm/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js.map +0 -1
  541. package/dist/esm/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.js +0 -14
  542. package/dist/esm/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.js.map +0 -1
  543. package/dist/esm/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.js +0 -27
  544. package/dist/esm/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.js.map +0 -1
  545. package/dist/esm/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js +0 -18
  546. package/dist/esm/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js.map +0 -1
  547. package/dist/esm/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js +0 -43
  548. package/dist/esm/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js.map +0 -1
  549. package/dist/esm/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js +0 -42
  550. package/dist/esm/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js.map +0 -1
  551. package/dist/esm/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.js +0 -9
  552. package/dist/esm/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.js.map +0 -1
  553. package/dist/esm/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js +0 -55
  554. package/dist/esm/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js.map +0 -1
  555. package/dist/esm/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js +0 -156
  556. package/dist/esm/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js.map +0 -1
  557. package/dist/esm/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js +0 -35
  558. package/dist/esm/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js.map +0 -1
  559. package/dist/esm/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js +0 -22
  560. package/dist/esm/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js.map +0 -1
  561. package/dist/esm/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js +0 -160
  562. package/dist/esm/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js.map +0 -1
  563. package/dist/esm/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.js +0 -25
  564. package/dist/esm/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.js.map +0 -1
  565. package/dist/esm/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js +0 -26
  566. package/dist/esm/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js.map +0 -1
  567. package/dist/esm/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js +0 -50
  568. package/dist/esm/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js.map +0 -1
  569. package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js +0 -201
  570. package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js.map +0 -1
  571. package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js +0 -22
  572. package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js.map +0 -1
  573. package/dist/esm/parser/json/JsonParser.js +0 -267
  574. package/dist/esm/parser/json/JsonParser.js.map +0 -1
  575. package/dist/esm/parser/text/TextParser.js +0 -145
  576. package/dist/esm/parser/text/TextParser.js.map +0 -1
  577. package/dist/esm/parser/text/peg/TextPegParser.js +0 -4
  578. package/dist/esm/parser/text/peg/TextPegParser.js.map +0 -1
  579. package/dist/esm/utils/ArrayUtils.js +0 -40
  580. package/dist/esm/utils/ArrayUtils.js.map +0 -1
  581. package/dist/esm/utils/BitUtils.js +0 -72
  582. package/dist/esm/utils/BitUtils.js.map +0 -1
  583. package/dist/esm/utils/BooleanUtils.js +0 -59
  584. package/dist/esm/utils/BooleanUtils.js.map +0 -1
  585. package/dist/esm/utils/FileUtils.js +0 -36
  586. package/dist/esm/utils/FileUtils.js.map +0 -1
  587. package/dist/esm/utils/NumberUtils.js +0 -59
  588. package/dist/esm/utils/NumberUtils.js.map +0 -1
  589. package/dist/esm/utils/ObjectUtils.js +0 -411
  590. package/dist/esm/utils/ObjectUtils.js.map +0 -1
  591. package/dist/esm/utils/StringUtils.js +0 -180
  592. package/dist/esm/utils/StringUtils.js.map +0 -1
  593. package/dist/esm/utils/UrlUtils.js +0 -34
  594. package/dist/esm/utils/UrlUtils.js.map +0 -1
  595. package/dist/esm/utils/env/Env.js +0 -127
  596. package/dist/esm/utils/env/Env.js.map +0 -1
  597. package/dist/esm/utils/env/Environment.js +0 -12
  598. package/dist/esm/utils/env/Environment.js.map +0 -1
  599. package/dist/esm/utils/env/Os.js +0 -11
  600. package/dist/esm/utils/env/Os.js.map +0 -1
  601. package/dist/esm/utils/env/Version.js +0 -9
  602. package/dist/esm/utils/env/Version.js.map +0 -1
  603. package/dist/esm/utils/env/userAgent.js +0 -86
  604. package/dist/esm/utils/env/userAgent.js.map +0 -1
  605. package/dist/esm/utils/polyfill/fs.js +0 -10
  606. package/dist/esm/utils/polyfill/fs.js.map +0 -1
  607. package/dist/types/BitmarkParserGenerator.d.ts +0 -478
  608. package/dist/types/BitmarkParserGenerator.d.ts.map +0 -1
  609. package/dist/types/ast/Ast.d.ts +0 -137
  610. package/dist/types/ast/Ast.d.ts.map +0 -1
  611. package/dist/types/ast/BaseBuilder.d.ts +0 -64
  612. package/dist/types/ast/BaseBuilder.d.ts.map +0 -1
  613. package/dist/types/ast/Builder.d.ts +0 -692
  614. package/dist/types/ast/Builder.d.ts.map +0 -1
  615. package/dist/types/ast/ResourceBuilder.d.ts +0 -384
  616. package/dist/types/ast/ResourceBuilder.d.ts.map +0 -1
  617. package/dist/types/ast/rules/NodeValidator.d.ts +0 -28
  618. package/dist/types/ast/rules/NodeValidator.d.ts.map +0 -1
  619. package/dist/types/ast/writer/FileWriter.d.ts +0 -37
  620. package/dist/types/ast/writer/FileWriter.d.ts.map +0 -1
  621. package/dist/types/ast/writer/StreamWriter.d.ts +0 -29
  622. package/dist/types/ast/writer/StreamWriter.d.ts.map +0 -1
  623. package/dist/types/ast/writer/StringWriter.d.ts +0 -30
  624. package/dist/types/ast/writer/StringWriter.d.ts.map +0 -1
  625. package/dist/types/ast/writer/Writer.d.ts +0 -72
  626. package/dist/types/ast/writer/Writer.d.ts.map +0 -1
  627. package/dist/types/breakscaping/Breakscape.d.ts +0 -44
  628. package/dist/types/breakscaping/Breakscape.d.ts.map +0 -1
  629. package/dist/types/breakscaping/BreakscapeLoop.d.ts +0 -142
  630. package/dist/types/breakscaping/BreakscapeLoop.d.ts.map +0 -1
  631. package/dist/types/breakscaping/BreakscapeOptions.d.ts +0 -30
  632. package/dist/types/breakscaping/BreakscapeOptions.d.ts.map +0 -1
  633. package/dist/types/breakscaping/BreakscapeRegex.d.ts +0 -96
  634. package/dist/types/breakscaping/BreakscapeRegex.d.ts.map +0 -1
  635. package/dist/types/breakscaping/RegexConfigs.d.ts +0 -35
  636. package/dist/types/breakscaping/RegexConfigs.d.ts.map +0 -1
  637. package/dist/types/config/Config.d.ts +0 -115
  638. package/dist/types/config/Config.d.ts.map +0 -1
  639. package/dist/types/config/ConfigHydrator.d.ts +0 -16
  640. package/dist/types/config/ConfigHydrator.d.ts.map +0 -1
  641. package/dist/types/config/raw/bits.d.ts +0 -4
  642. package/dist/types/config/raw/bits.d.ts.map +0 -1
  643. package/dist/types/config/raw/cardSets.d.ts +0 -4
  644. package/dist/types/config/raw/cardSets.d.ts.map +0 -1
  645. package/dist/types/config/raw/groups.d.ts +0 -4
  646. package/dist/types/config/raw/groups.d.ts.map +0 -1
  647. package/dist/types/config/raw/properties.d.ts +0 -4
  648. package/dist/types/config/raw/properties.d.ts.map +0 -1
  649. package/dist/types/config/raw/resources.d.ts +0 -4
  650. package/dist/types/config/raw/resources.d.ts.map +0 -1
  651. package/dist/types/config/raw/tags.d.ts +0 -4
  652. package/dist/types/config/raw/tags.d.ts.map +0 -1
  653. package/dist/types/generated/build-info.d.ts +0 -8
  654. package/dist/types/generated/build-info.d.ts.map +0 -1
  655. package/dist/types/generated/parser/bitmark/bitmark-peggy-parser.d.ts +0 -12
  656. package/dist/types/generated/parser/bitmark/bitmark-peggy-parser.d.ts.map +0 -1
  657. package/dist/types/generated/parser/text/text-peggy-parser.d.ts +0 -12
  658. package/dist/types/generated/parser/text/text-peggy-parser.d.ts.map +0 -1
  659. package/dist/types/generator/AstWalkerGenerator.d.ts +0 -32
  660. package/dist/types/generator/AstWalkerGenerator.d.ts.map +0 -1
  661. package/dist/types/generator/Generator.d.ts +0 -6
  662. package/dist/types/generator/Generator.d.ts.map +0 -1
  663. package/dist/types/generator/bitmark/BitmarkFileGenerator.d.ts +0 -41
  664. package/dist/types/generator/bitmark/BitmarkFileGenerator.d.ts.map +0 -1
  665. package/dist/types/generator/bitmark/BitmarkGenerator.d.ts +0 -401
  666. package/dist/types/generator/bitmark/BitmarkGenerator.d.ts.map +0 -1
  667. package/dist/types/generator/bitmark/BitmarkStringGenerator.d.ts +0 -31
  668. package/dist/types/generator/bitmark/BitmarkStringGenerator.d.ts.map +0 -1
  669. package/dist/types/generator/json/JsonFileGenerator.d.ts +0 -45
  670. package/dist/types/generator/json/JsonFileGenerator.d.ts.map +0 -1
  671. package/dist/types/generator/json/JsonGenerator.d.ts +0 -357
  672. package/dist/types/generator/json/JsonGenerator.d.ts.map +0 -1
  673. package/dist/types/generator/json/JsonObjectGenerator.d.ts +0 -32
  674. package/dist/types/generator/json/JsonObjectGenerator.d.ts.map +0 -1
  675. package/dist/types/generator/json/JsonStringGenerator.d.ts +0 -30
  676. package/dist/types/generator/json/JsonStringGenerator.d.ts.map +0 -1
  677. package/dist/types/generator/text/TextGenerator.d.ts +0 -228
  678. package/dist/types/generator/text/TextGenerator.d.ts.map +0 -1
  679. package/dist/types/index.d.ts +0 -50
  680. package/dist/types/index.d.ts.map +0 -1
  681. package/dist/types/info/InfoBuilder.d.ts +0 -18
  682. package/dist/types/info/InfoBuilder.d.ts.map +0 -1
  683. package/dist/types/init/init.d.ts +0 -4
  684. package/dist/types/init/init.d.ts.map +0 -1
  685. package/dist/types/model/ast/BreakscapedString.d.ts +0 -4
  686. package/dist/types/model/ast/BreakscapedString.d.ts.map +0 -1
  687. package/dist/types/model/ast/NodeType.d.ts +0 -1093
  688. package/dist/types/model/ast/NodeType.d.ts.map +0 -1
  689. package/dist/types/model/ast/Nodes.d.ts +0 -268
  690. package/dist/types/model/ast/Nodes.d.ts.map +0 -1
  691. package/dist/types/model/ast/StardardString.d.ts +0 -4
  692. package/dist/types/model/ast/StardardString.d.ts.map +0 -1
  693. package/dist/types/model/ast/TextNodes.d.ts +0 -130
  694. package/dist/types/model/ast/TextNodes.d.ts.map +0 -1
  695. package/dist/types/model/config/AbstractTagConfig.d.ts +0 -24
  696. package/dist/types/model/config/AbstractTagConfig.d.ts.map +0 -1
  697. package/dist/types/model/config/BitConfig.d.ts +0 -48
  698. package/dist/types/model/config/BitConfig.d.ts.map +0 -1
  699. package/dist/types/model/config/CardSetConfig.d.ts +0 -14
  700. package/dist/types/model/config/CardSetConfig.d.ts.map +0 -1
  701. package/dist/types/model/config/CardVariantConfig.d.ts +0 -16
  702. package/dist/types/model/config/CardVariantConfig.d.ts.map +0 -1
  703. package/dist/types/model/config/MarkupTagConfig.d.ts +0 -17
  704. package/dist/types/model/config/MarkupTagConfig.d.ts.map +0 -1
  705. package/dist/types/model/config/PropertyTagConfig.d.ts +0 -23
  706. package/dist/types/model/config/PropertyTagConfig.d.ts.map +0 -1
  707. package/dist/types/model/config/ResourceTagConfig.d.ts +0 -18
  708. package/dist/types/model/config/ResourceTagConfig.d.ts.map +0 -1
  709. package/dist/types/model/config/ResourcesConfig.d.ts +0 -14
  710. package/dist/types/model/config/ResourcesConfig.d.ts.map +0 -1
  711. package/dist/types/model/config/TagConfig.d.ts +0 -5
  712. package/dist/types/model/config/TagConfig.d.ts.map +0 -1
  713. package/dist/types/model/config/TagsConfig.d.ts +0 -5
  714. package/dist/types/model/config/TagsConfig.d.ts.map +0 -1
  715. package/dist/types/model/config/TagsConfigWithInfo.d.ts +0 -9
  716. package/dist/types/model/config/TagsConfigWithInfo.d.ts.map +0 -1
  717. package/dist/types/model/config/_Config.d.ts +0 -119
  718. package/dist/types/model/config/_Config.d.ts.map +0 -1
  719. package/dist/types/model/config/enum/CardSetConfigKey.d.ts +0 -43
  720. package/dist/types/model/config/enum/CardSetConfigKey.d.ts.map +0 -1
  721. package/dist/types/model/config/enum/ConfigKey.d.ts +0 -578
  722. package/dist/types/model/config/enum/ConfigKey.d.ts.map +0 -1
  723. package/dist/types/model/config/enum/GroupConfigKey.d.ts +0 -144
  724. package/dist/types/model/config/enum/GroupConfigKey.d.ts.map +0 -1
  725. package/dist/types/model/config/enum/GroupConfigType.d.ts +0 -16
  726. package/dist/types/model/config/enum/GroupConfigType.d.ts.map +0 -1
  727. package/dist/types/model/config/enum/PropertyConfigKey.d.ts +0 -618
  728. package/dist/types/model/config/enum/PropertyConfigKey.d.ts.map +0 -1
  729. package/dist/types/model/config/enum/ResourceConfigKey.d.ts +0 -87
  730. package/dist/types/model/config/enum/ResourceConfigKey.d.ts.map +0 -1
  731. package/dist/types/model/config/enum/TagConfigKey.d.ts +0 -51
  732. package/dist/types/model/config/enum/TagConfigKey.d.ts.map +0 -1
  733. package/dist/types/model/enum/BitTagType.d.ts +0 -15
  734. package/dist/types/model/enum/BitTagType.d.ts.map +0 -1
  735. package/dist/types/model/enum/BitType.d.ts +0 -1143
  736. package/dist/types/model/enum/BitType.d.ts.map +0 -1
  737. package/dist/types/model/enum/BitmarkGeneratorOutput.d.ts +0 -1
  738. package/dist/types/model/enum/BitmarkGeneratorOutput.d.ts.map +0 -1
  739. package/dist/types/model/enum/BitmarkParserType.d.ts +0 -7
  740. package/dist/types/model/enum/BitmarkParserType.d.ts.map +0 -1
  741. package/dist/types/model/enum/BitmarkVersion.d.ts +0 -12
  742. package/dist/types/model/enum/BitmarkVersion.d.ts.map +0 -1
  743. package/dist/types/model/enum/BodyBitType.d.ts +0 -25
  744. package/dist/types/model/enum/BodyBitType.d.ts.map +0 -1
  745. package/dist/types/model/enum/BodyTextFormat.d.ts +0 -17
  746. package/dist/types/model/enum/BodyTextFormat.d.ts.map +0 -1
  747. package/dist/types/model/enum/CardSetVersion.d.ts +0 -11
  748. package/dist/types/model/enum/CardSetVersion.d.ts.map +0 -1
  749. package/dist/types/model/enum/Count.d.ts +0 -7
  750. package/dist/types/model/enum/Count.d.ts.map +0 -1
  751. package/dist/types/model/enum/DeprecatedTextFormat.d.ts +0 -7
  752. package/dist/types/model/enum/DeprecatedTextFormat.d.ts.map +0 -1
  753. package/dist/types/model/enum/ExampleType.d.ts +0 -13
  754. package/dist/types/model/enum/ExampleType.d.ts.map +0 -1
  755. package/dist/types/model/enum/PropertyAstKey.d.ts +0 -22
  756. package/dist/types/model/enum/PropertyAstKey.d.ts.map +0 -1
  757. package/dist/types/model/enum/PropertyFormat.d.ts +0 -19
  758. package/dist/types/model/enum/PropertyFormat.d.ts.map +0 -1
  759. package/dist/types/model/enum/PropertyJsonKey.d.ts +0 -10
  760. package/dist/types/model/enum/PropertyJsonKey.d.ts.map +0 -1
  761. package/dist/types/model/enum/PropertyTag.d.ts +0 -419
  762. package/dist/types/model/enum/PropertyTag.d.ts.map +0 -1
  763. package/dist/types/model/enum/ResourceJsonKey.d.ts +0 -45
  764. package/dist/types/model/enum/ResourceJsonKey.d.ts.map +0 -1
  765. package/dist/types/model/enum/ResourceTag.d.ts +0 -63
  766. package/dist/types/model/enum/ResourceTag.d.ts.map +0 -1
  767. package/dist/types/model/enum/Tag.d.ts +0 -33
  768. package/dist/types/model/enum/Tag.d.ts.map +0 -1
  769. package/dist/types/model/enum/TextFormat.d.ts +0 -17
  770. package/dist/types/model/enum/TextFormat.d.ts.map +0 -1
  771. package/dist/types/model/enum/TextLocation.d.ts +0 -16
  772. package/dist/types/model/enum/TextLocation.d.ts.map +0 -1
  773. package/dist/types/model/enum/TextMarkType.d.ts +0 -93
  774. package/dist/types/model/enum/TextMarkType.d.ts.map +0 -1
  775. package/dist/types/model/enum/TextNodeType.d.ts +0 -53
  776. package/dist/types/model/enum/TextNodeType.d.ts.map +0 -1
  777. package/dist/types/model/enum/TextSection.d.ts +0 -27
  778. package/dist/types/model/enum/TextSection.d.ts.map +0 -1
  779. package/dist/types/model/info/enum/InfoFormat.d.ts +0 -13
  780. package/dist/types/model/info/enum/InfoFormat.d.ts.map +0 -1
  781. package/dist/types/model/info/enum/InfoType.d.ts +0 -15
  782. package/dist/types/model/info/enum/InfoType.d.ts.map +0 -1
  783. package/dist/types/model/json/BitJson.d.ts +0 -479
  784. package/dist/types/model/json/BitJson.d.ts.map +0 -1
  785. package/dist/types/model/json/BitWrapperJson.d.ts +0 -8
  786. package/dist/types/model/json/BitWrapperJson.d.ts.map +0 -1
  787. package/dist/types/model/json/BodyBitJson.d.ts +0 -81
  788. package/dist/types/model/json/BodyBitJson.d.ts.map +0 -1
  789. package/dist/types/model/json/ParserJson.d.ts +0 -12
  790. package/dist/types/model/json/ParserJson.d.ts.map +0 -1
  791. package/dist/types/model/json/ResourceJson.d.ts +0 -244
  792. package/dist/types/model/json/ResourceJson.d.ts.map +0 -1
  793. package/dist/types/model/parser/ParserData.d.ts +0 -11
  794. package/dist/types/model/parser/ParserData.d.ts.map +0 -1
  795. package/dist/types/model/parser/ParserError.d.ts +0 -17
  796. package/dist/types/model/parser/ParserError.d.ts.map +0 -1
  797. package/dist/types/model/parser/ParserInfo.d.ts +0 -10
  798. package/dist/types/model/parser/ParserInfo.d.ts.map +0 -1
  799. package/dist/types/model/parser/ParserLocation.d.ts +0 -6
  800. package/dist/types/model/parser/ParserLocation.d.ts.map +0 -1
  801. package/dist/types/model/parser/ParserLocationRange.d.ts +0 -10
  802. package/dist/types/model/parser/ParserLocationRange.d.ts.map +0 -1
  803. package/dist/types/model/parser/TagValidationData.d.ts +0 -24
  804. package/dist/types/model/parser/TagValidationData.d.ts.map +0 -1
  805. package/dist/types/parser/bitmark/BitmarkParser.d.ts +0 -21
  806. package/dist/types/parser/bitmark/BitmarkParser.d.ts.map +0 -1
  807. package/dist/types/parser/bitmark/peg/BitmarkPegParser.d.ts +0 -8
  808. package/dist/types/parser/bitmark/peg/BitmarkPegParser.d.ts.map +0 -1
  809. package/dist/types/parser/bitmark/peg/BitmarkPegParserHelper.d.ts +0 -108
  810. package/dist/types/parser/bitmark/peg/BitmarkPegParserHelper.d.ts.map +0 -1
  811. package/dist/types/parser/bitmark/peg/BitmarkPegParserProcessor.d.ts +0 -137
  812. package/dist/types/parser/bitmark/peg/BitmarkPegParserProcessor.d.ts.map +0 -1
  813. package/dist/types/parser/bitmark/peg/BitmarkPegParserTypes.d.ts +0 -333
  814. package/dist/types/parser/bitmark/peg/BitmarkPegParserTypes.d.ts.map +0 -1
  815. package/dist/types/parser/bitmark/peg/BitmarkPegParserValidator.d.ts +0 -186
  816. package/dist/types/parser/bitmark/peg/BitmarkPegParserValidator.d.ts.map +0 -1
  817. package/dist/types/parser/bitmark/peg/PeggyGrammarLocation.d.ts +0 -61
  818. package/dist/types/parser/bitmark/peg/PeggyGrammarLocation.d.ts.map +0 -1
  819. package/dist/types/parser/bitmark/peg/contentProcessors/BodyContentProcessor.d.ts +0 -37
  820. package/dist/types/parser/bitmark/peg/contentProcessors/BodyContentProcessor.d.ts.map +0 -1
  821. package/dist/types/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.d.ts +0 -5
  822. package/dist/types/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.d.ts.map +0 -1
  823. package/dist/types/parser/bitmark/peg/contentProcessors/CardContentProcessor.d.ts +0 -7
  824. package/dist/types/parser/bitmark/peg/contentProcessors/CardContentProcessor.d.ts.map +0 -1
  825. package/dist/types/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.d.ts +0 -5
  826. package/dist/types/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.d.ts.map +0 -1
  827. package/dist/types/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.d.ts +0 -15
  828. package/dist/types/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.d.ts.map +0 -1
  829. package/dist/types/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.d.ts +0 -5
  830. package/dist/types/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.d.ts.map +0 -1
  831. package/dist/types/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.d.ts +0 -4
  832. package/dist/types/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.d.ts.map +0 -1
  833. package/dist/types/parser/bitmark/peg/contentProcessors/FooterContentProcessor.d.ts +0 -14
  834. package/dist/types/parser/bitmark/peg/contentProcessors/FooterContentProcessor.d.ts.map +0 -1
  835. package/dist/types/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.d.ts +0 -6
  836. package/dist/types/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.d.ts.map +0 -1
  837. package/dist/types/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.d.ts +0 -5
  838. package/dist/types/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.d.ts.map +0 -1
  839. package/dist/types/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.d.ts +0 -4
  840. package/dist/types/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.d.ts.map +0 -1
  841. package/dist/types/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.d.ts +0 -5
  842. package/dist/types/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.d.ts.map +0 -1
  843. package/dist/types/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.d.ts +0 -5
  844. package/dist/types/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.d.ts.map +0 -1
  845. package/dist/types/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.d.ts +0 -6
  846. package/dist/types/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.d.ts.map +0 -1
  847. package/dist/types/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.d.ts +0 -5
  848. package/dist/types/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.d.ts.map +0 -1
  849. package/dist/types/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.d.ts +0 -4
  850. package/dist/types/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.d.ts.map +0 -1
  851. package/dist/types/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.d.ts +0 -5
  852. package/dist/types/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.d.ts.map +0 -1
  853. package/dist/types/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.d.ts +0 -5
  854. package/dist/types/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.d.ts.map +0 -1
  855. package/dist/types/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.d.ts +0 -5
  856. package/dist/types/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.d.ts.map +0 -1
  857. package/dist/types/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.d.ts +0 -5
  858. package/dist/types/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.d.ts.map +0 -1
  859. package/dist/types/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.d.ts +0 -14
  860. package/dist/types/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.d.ts.map +0 -1
  861. package/dist/types/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.d.ts +0 -5
  862. package/dist/types/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.d.ts.map +0 -1
  863. package/dist/types/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.d.ts +0 -5
  864. package/dist/types/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.d.ts.map +0 -1
  865. package/dist/types/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.d.ts +0 -11
  866. package/dist/types/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.d.ts.map +0 -1
  867. package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.d.ts +0 -6
  868. package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.d.ts.map +0 -1
  869. package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.d.ts +0 -4
  870. package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.d.ts.map +0 -1
  871. package/dist/types/parser/json/JsonParser.d.ts +0 -59
  872. package/dist/types/parser/json/JsonParser.d.ts.map +0 -1
  873. package/dist/types/parser/text/TextParser.d.ts +0 -55
  874. package/dist/types/parser/text/TextParser.d.ts.map +0 -1
  875. package/dist/types/parser/text/peg/TextPegParser.d.ts +0 -8
  876. package/dist/types/parser/text/peg/TextPegParser.d.ts.map +0 -1
  877. package/dist/types/utils/ArrayUtils.d.ts +0 -25
  878. package/dist/types/utils/ArrayUtils.d.ts.map +0 -1
  879. package/dist/types/utils/BitUtils.d.ts +0 -30
  880. package/dist/types/utils/BitUtils.d.ts.map +0 -1
  881. package/dist/types/utils/BooleanUtils.d.ts +0 -30
  882. package/dist/types/utils/BooleanUtils.d.ts.map +0 -1
  883. package/dist/types/utils/FileUtils.d.ts +0 -12
  884. package/dist/types/utils/FileUtils.d.ts.map +0 -1
  885. package/dist/types/utils/NumberUtils.d.ts +0 -47
  886. package/dist/types/utils/NumberUtils.d.ts.map +0 -1
  887. package/dist/types/utils/ObjectUtils.d.ts +0 -197
  888. package/dist/types/utils/ObjectUtils.d.ts.map +0 -1
  889. package/dist/types/utils/StringUtils.d.ts +0 -77
  890. package/dist/types/utils/StringUtils.d.ts.map +0 -1
  891. package/dist/types/utils/UrlUtils.d.ts +0 -7
  892. package/dist/types/utils/UrlUtils.d.ts.map +0 -1
  893. package/dist/types/utils/env/Env.d.ts +0 -39
  894. package/dist/types/utils/env/Env.d.ts.map +0 -1
  895. package/dist/types/utils/env/Environment.d.ts +0 -21
  896. package/dist/types/utils/env/Environment.d.ts.map +0 -1
  897. package/dist/types/utils/env/Os.d.ts +0 -19
  898. package/dist/types/utils/env/Os.d.ts.map +0 -1
  899. package/dist/types/utils/env/Version.d.ts +0 -10
  900. package/dist/types/utils/env/Version.d.ts.map +0 -1
  901. package/dist/types/utils/env/userAgent.d.ts +0 -11
  902. package/dist/types/utils/env/userAgent.d.ts.map +0 -1
  903. package/dist/types/utils/polyfill/fs.d.ts +0 -6
  904. package/dist/types/utils/polyfill/fs.d.ts.map +0 -1
@@ -1,1788 +0,0 @@
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
- exports.Builder = void 0;
7
- const structured_clone_1 = __importDefault(require("@ungap/structured-clone"));
8
- const Breakscape_1 = require("../breakscaping/Breakscape");
9
- const Config_1 = require("../config/Config");
10
- const PropertyConfigKey_1 = require("../model/config/enum/PropertyConfigKey");
11
- const BitType_1 = require("../model/enum/BitType");
12
- const BodyBitType_1 = require("../model/enum/BodyBitType");
13
- const DeprecatedTextFormat_1 = require("../model/enum/DeprecatedTextFormat");
14
- const ResourceTag_1 = require("../model/enum/ResourceTag");
15
- const TextFormat_1 = require("../model/enum/TextFormat");
16
- const TextLocation_1 = require("../model/enum/TextLocation");
17
- const ArrayUtils_1 = require("../utils/ArrayUtils");
18
- const BitUtils_1 = require("../utils/BitUtils");
19
- const BooleanUtils_1 = require("../utils/BooleanUtils");
20
- const NumberUtils_1 = require("../utils/NumberUtils");
21
- const ObjectUtils_1 = require("../utils/ObjectUtils");
22
- const StringUtils_1 = require("../utils/StringUtils");
23
- const Env_1 = require("../utils/env/Env");
24
- const BaseBuilder_1 = require("./BaseBuilder");
25
- const ResourceBuilder_1 = require("./ResourceBuilder");
26
- const NodeValidator_1 = require("./rules/NodeValidator");
27
- /**
28
- * Builder to build bitmark AST node programmatically
29
- */
30
- class Builder extends BaseBuilder_1.BaseBuilder {
31
- constructor() {
32
- super(...arguments);
33
- this.resourceBuilder = new ResourceBuilder_1.ResourceBuilder();
34
- }
35
- /**
36
- * Build bitmark node
37
- *
38
- * @param data - data for the node
39
- * @returns
40
- */
41
- buildBitmark(data) {
42
- const { bits, errors } = data;
43
- const node = {
44
- bits,
45
- errors,
46
- };
47
- // Remove Unset Optionals
48
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node);
49
- return node;
50
- }
51
- /**
52
- * Build bit node
53
- *
54
- * @param data - data for the node
55
- * @returns
56
- */
57
- buildBit(data) {
58
- var _a, _b, _c, _d, _e, _f, _g;
59
- const bitConfig = Config_1.Config.getBitConfig(data.bitType);
60
- const bitType = data.bitType;
61
- // Text Format (accepts deprecated values, and converts them to the new format)
62
- const deprecatedTextFormat = DeprecatedTextFormat_1.DeprecatedTextFormat.fromValue(data.textFormat);
63
- let textFormat = (_a = TextFormat_1.TextFormat.fromValue(data.textFormat)) !== null && _a !== void 0 ? _a : bitConfig.textFormatDefault;
64
- if (deprecatedTextFormat === DeprecatedTextFormat_1.DeprecatedTextFormat.bitmarkMinusMinus) {
65
- textFormat = TextFormat_1.TextFormat.bitmarkText;
66
- }
67
- const context = {
68
- bitConfig,
69
- bitType,
70
- textFormat,
71
- };
72
- // Validate and convert resources, and ensure it is an array
73
- // const resources = ArrayUtils.asArray(resourcesIn);
74
- // Set the card node data
75
- const cardNode = this.buildCardNode(context, data);
76
- // Add reasonableNumOfChars to the bit only for essay bits (in other cases it will be pushed down the tree)
77
- const reasonableNumOfCharsProperty = Config_1.Config.isOfBitType(data.bitType, BitType_1.BitType.essay)
78
- ? this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.reasonableNumOfChars, data.reasonableNumOfChars)
79
- : undefined;
80
- const convertedExample = Object.assign({}, this.toExample(data.__isDefaultExample, data.example));
81
- // NOTE: Node order is important and is defined here
82
- const node = Object.assign(Object.assign({ bitType, bitLevel: data.bitLevel, textFormat, resourceType: ResourceTag_1.ResourceTag.fromValue(data.resourceType), isCommented: data.isCommented,
83
- // Properties
84
- id: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.id, data.id), internalComment: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.internalComment, data.internalComment), customerId: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.customerId, data.customerId), customerExternalId: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.customerExternalId, data.customerExternalId), externalId: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.externalId, data.externalId), spaceId: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.spaceId, data.spaceId), padletId: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.padletId, data.padletId), jupyterId: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.jupyterId, data.jupyterId), jupyterExecutionCount: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.jupyterExecutionCount, data.jupyterExecutionCount), isPublic: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.isPublic, data.isPublic), isTemplate: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.isTemplate, data.isTemplate), isTemplateStripTheme: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.isTemplateStripTheme, data.isTemplateStripTheme), aiGenerated: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.aiGenerated, data.aiGenerated), machineTranslated: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.machineTranslated, data.machineTranslated), searchIndex: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.searchIndex, data.searchIndex), analyticsTag: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.analyticsTag, data.analyticsTag), categoryTag: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.categoryTag, data.categoryTag), topicTag: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.topicTag, data.topicTag), altLangTag: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.altLangTag, data.altLangTag), feedbackEngine: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.feedbackEngine, data.feedbackEngine), feedbackType: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.feedbackType, data.feedbackType), disableFeedback: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.disableFeedback, data.disableFeedback), diffTo: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.diffTo, data.diffTo), diffOp: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.diffOp, data.diffOp), diffRef: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.diffRef, data.diffRef), diffContext: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.diffContext, data.diffContext), diffTime: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.diffTime, data.diffTime), path: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.path, data.path), releaseVersion: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.releaseVersion, data.releaseVersion), releaseKind: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.releaseKind, data.releaseKind), releaseDate: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.releaseDate, data.releaseDate), book: this.buildBooks(context, data.book), ageRange: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.ageRange, data.ageRange), lang: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.lang, data.lang), language: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.language, data.language), publisher: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.publisher, data.publisher), publisherName: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.publisherName, data.publisherName), theme: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.theme, data.theme), computerLanguage: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.computerLanguage, data.computerLanguage), target: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.target, data.target), slug: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.slug, data.slug), tag: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.tag, data.tag), reductionTag: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.reductionTag, data.reductionTag), bubbleTag: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.bubbleTag, data.bubbleTag), levelCEFRp: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.levelCEFRp, data.levelCEFRp), levelCEFR: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.levelCEFR, data.levelCEFR), levelILR: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.levelILR, data.levelILR), levelACTFL: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.levelACTFL, data.levelACTFL), icon: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.icon, data.icon), iconTag: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.iconTag, data.iconTag), colorTag: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.colorTag, data.colorTag), flashcardSet: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.flashcardSet, data.flashcardSet), subtype: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.subtype, data.subtype), bookAlias: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.bookAlias, data.bookAlias), bookDiff: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.bookDiff, data.bookDiff), coverImage: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.coverImage, data.coverImage), coverColor: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.coverColor, data.coverColor), publications: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.publications, data.publications), author: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.author, data.author), subject: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.subject, data.subject), date: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.date, data.date), dateEnd: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.dateEnd, data.dateEnd), location: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.location, data.location), kind: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.kind, data.kind), hasMarkAsDone: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.hasMarkAsDone, data.hasMarkAsDone), processHandIn: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.processHandIn, data.processHandIn), processHandInLocation: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.processHandInLocation, data.processHandInLocation), chatWithBook: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.chatWithBook, data.chatWithBook), chatWithBookBrainKey: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.chatWithBookBrainKey, data.chatWithBookBrainKey), action: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.action, data.action), showInIndex: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.showInIndex, data.showInIndex), refAuthor: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.refAuthor, data.refAuthor), refBookTitle: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.refBookTitle, data.refBookTitle), refPublisher: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.refPublisher, data.refPublisher), refPublicationYear: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.refPublicationYear, data.refPublicationYear), citationStyle: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.citationStyle, data.citationStyle), blockId: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.blockId, data.blockId), pageNo: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.pageNo, data.pageNo), x: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.x, data.x), y: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.y, data.y), width: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.width, data.width), height: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.height, data.height), index: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.index, data.index), classification: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.classification, data.classification), availableClassifications: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.availableClassifications, data.availableClassifications), allowedBit: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.allowedBit, data.allowedBit), tableFixedHeader: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.tableFixedHeader, data.tableFixedHeader), tableHeaderWhitespaceNoWrap: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.tableHeaderWhitespaceNoWrap, data.tableHeaderWhitespaceNoWrap), tableSearch: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.tableSearch, data.tableSearch), tableSort: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.tableSort, data.tableSort), tablePagination: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.tablePagination, data.tablePagination), tablePaginationLimit: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.tablePaginationLimit, data.tablePaginationLimit), tableHeight: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.tableHeight, data.tableHeight), tableWhitespaceNoWrap: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.tableWhitespaceNoWrap, data.tableWhitespaceNoWrap), tableAutoWidth: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.tableAutoWidth, data.tableAutoWidth), tableResizableColumns: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.tableResizableColumns, data.tableResizableColumns), tableColumnMinWidth: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.tableColumnMinWidth, data.tableColumnMinWidth), quizCountItems: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.quizCountItems, data.quizCountItems), quizStrikethroughSolutions: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.quizStrikethroughSolutions, data.quizStrikethroughSolutions), codeLineNumbers: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.codeLineNumbers, data.codeLineNumbers), codeMinimap: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.codeMinimap, data.codeMinimap), stripePricingTableId: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.stripePricingTableId, data.stripePricingTableId), stripePublishableKey: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.stripePublishableKey, data.stripePublishableKey), thumbImage: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.thumbImage, data.thumbImage), scormSource: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.scormSource, data.scormSource), posterImage: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.posterImage, data.posterImage), focusX: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.focusX, data.focusX), focusY: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.focusY, data.focusY), pointerLeft: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.pointerLeft, data.pointerLeft), pointerTop: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.pointerTop, data.pointerTop), listItemIndent: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.listItemIndent, data.listItemIndent), backgroundWallpaper: this.toImageResource(context, data.backgroundWallpaper), hasBookNavigation: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.hasBookNavigation, data.hasBookNavigation), duration: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.duration, data.duration), deeplink: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.deeplink, data.deeplink), externalLink: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.externalLink, data.externalLink), externalLinkText: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.externalLinkText, data.externalLinkText), videoCallLink: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.videoCallLink, data.videoCallLink), vendorDashboardId: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.vendorDashboardId, data.vendorDashboardId), vendorSurveyId: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.vendorSurveyId, data.vendorSurveyId), vendorUrl: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.vendorUrl, data.vendorUrl), search: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.search, data.search), list: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.list, data.list), layer: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.layer, data.layer), layerRole: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.layerRole, data.layerRole), textReference: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.textReference, data.textReference), isTracked: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.isTracked, data.isTracked), isInfoOnly: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.isInfoOnly, data.isInfoOnly), imageFirst: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.imageFirst, data.imageFirst), activityType: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.activityType, data.activityType), labelTrue: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.labelTrue, data.labelTrue), labelFalse: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.labelFalse, data.labelFalse), content2Buy: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.content2Buy, data.content2Buy), mailingList: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.mailingList, data.mailingList), buttonCaption: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.buttonCaption, data.buttonCaption), callToActionUrl: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.callToActionUrl, data.callToActionUrl), caption: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.caption), quotedPerson: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.quotedPerson, data.quotedPerson), reasonableNumOfChars: reasonableNumOfCharsProperty, resolved: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.resolved, data.resolved), resolvedDate: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.resolvedDate, data.resolvedDate), resolvedBy: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.resolvedBy, data.resolvedBy), handInAcceptFileType: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.handInAcceptFileType, data.handInAcceptFileType), handInRequirement: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.handInRequirement, data.handInRequirement), handInInstruction: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.handInInstruction, data.handInInstruction), maxCreatedBits: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.maxCreatedBits, data.maxCreatedBits), maxDisplayLevel: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.maxDisplayLevel, data.maxDisplayLevel), maxTocChapterLevel: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.maxTocChapterLevel, data.maxTocChapterLevel), tocResource: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.tocResource, data.tocResource), tocContent: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.tocContent, data.tocContent), page: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.page, data.page), productId: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.productId, data.productId), product: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.product, data.product), productList: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.productList, data.productList), productVideo: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.productVideo, data.productVideo), productVideoList: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.productVideoList, data.productVideoList), productFolder: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.productFolder, data.productFolder), technicalTerm: this.buildTechnicalTerm(context, data.technicalTerm), servings: this.buildServings(context, data.servings), ratingLevelStart: this.buildRatingLevelStartEnd(context, data.ratingLevelStart), ratingLevelEnd: this.buildRatingLevelStartEnd(context, data.ratingLevelEnd), ratingLevelSelected: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.ratingLevelSelected, data.ratingLevelSelected), markConfig: this.buildMarkConfigs(context, data.markConfig), imageSource: this.buildImageSource(context, data.imageSource), person: this.buildPerson(context, data.person), bot: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.bot, data.bot), referenceProperty: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.property_reference, data.referenceProperty),
85
- // Book data
86
- title: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.title), subtitle: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.subtitle), level: NumberUtils_1.NumberUtils.asNumber(data.level), toc: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.toc, data.toc), progress: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.progress, data.progress), anchor: data.anchor, reference: data.reference, referenceEnd: data.referenceEnd, revealSolutions: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.revealSolutions, data.revealSolutions),
87
- // Item, Lead, Hint, Instruction
88
- item: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.item), lead: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.lead), pageNumber: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.pageNumber), marginNumber: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.marginNumber), hint: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.hint), instruction: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.instruction), partialAnswer: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.partialAnswer, data.partialAnswer), sampleSolution: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.property_sampleSolution, data.sampleSolution), additionalSolutions: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.additionalSolutions, data.additionalSolutions) }, this.toExample(data.__isDefaultExample, data.example)), {
89
- // Person
90
- imagePlaceholder: this.toImageResource(context, data.imagePlaceholder), resources: ArrayUtils_1.ArrayUtils.asArray(this.resourceBuilder.resourceFromResourceJson(context, data.resources)),
91
- // Body, Card, Footer, must be after all other properties except the extraProperties and markup / parser
92
- body: this.buildBody(context, data.body), cardNode, footer: this.buildFooter(context, data.footer),
93
- // Must be after other properties/tags in the AST so key clashes are avoided correctly
94
- extraProperties: this.parseExtraProperties(data.extraProperties), markup: data.markup, parser: data.parser,
95
- // Private properties
96
- __isDefaultExample: (_b = data.__isDefaultExample) !== null && _b !== void 0 ? _b : false });
97
- // Push reasonableNumOfChars down the tree for the interview bits
98
- if (Config_1.Config.isOfBitType(node.bitType, BitType_1.BitType.interview)) {
99
- this.pushDownTree(context, undefined, undefined, cardNode, 'questions', PropertyConfigKey_1.PropertyConfigKey.reasonableNumOfChars, data.reasonableNumOfChars);
100
- }
101
- // Push reasonableNumOfChars down the tree for the feedback bits
102
- if (Config_1.Config.isOfBitType(node.bitType, BitType_1.BitType.feedback)) {
103
- this.pushDownTree(context, undefined, undefined, cardNode, ['feedbacks', 'reason'], PropertyConfigKey_1.PropertyConfigKey.reasonableNumOfChars, data.reasonableNumOfChars);
104
- }
105
- // Push isCaseSensitive down the tree for the cloze, match and match-matrix bits
106
- this.pushDownTree(context, [node.body, ...((_d = (_c = cardNode === null || cardNode === void 0 ? void 0 : cardNode.cardBits) === null || _c === void 0 ? void 0 : _c.map((cardBit) => cardBit.body)) !== null && _d !== void 0 ? _d : [])], [BodyBitType_1.BodyBitType.gap], undefined, undefined, //'isCaseSensitive',
107
- PropertyConfigKey_1.PropertyConfigKey.isCaseSensitive, (_e = data.isCaseSensitive) !== null && _e !== void 0 ? _e : true);
108
- this.pushDownTree(context, undefined, undefined, cardNode, 'pairs', PropertyConfigKey_1.PropertyConfigKey.isCaseSensitive, (_f = data.isCaseSensitive) !== null && _f !== void 0 ? _f : true);
109
- this.pushDownTree(context, undefined, undefined, cardNode, ['matrix', 'cells'], PropertyConfigKey_1.PropertyConfigKey.isCaseSensitive, (_g = data.isCaseSensitive) !== null && _g !== void 0 ? _g : true);
110
- // If __isDefaultExample is set at the bit level, push the default example down the tree to the relevant nodes
111
- this.pushExampleDownTree(context, node.body, cardNode, node.__isDefaultExample, convertedExample.example);
112
- // Set default values
113
- this.setDefaultBitValues(node);
114
- // Set the 'isExample' flags
115
- this.setIsExampleFlags(node);
116
- // Add the version to the parser info
117
- this.addVersionToParserInfo(node);
118
- // Remove Unset Optionals
119
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
120
- ignoreAllFalse: true,
121
- ignoreUndefined: ['example'],
122
- ignoreEmptyArrays: ['item', 'lead', 'pageNumber', 'marginNumber', 'hint', 'instruction'],
123
- });
124
- // Validate and correct invalid bits as much as possible
125
- return NodeValidator_1.NodeValidator.validateBit(node);
126
- }
127
- /**
128
- * Build books[] node
129
- *
130
- * @param data - data for the node
131
- * @returns
132
- */
133
- buildBooks(context, data) {
134
- if (StringUtils_1.StringUtils.isString(data))
135
- return data;
136
- if (!Array.isArray(data))
137
- return undefined;
138
- const nodes = data.map((d) => this.buildBook(context, d)).filter((d) => d != null);
139
- return nodes.length > 0 ? nodes : undefined;
140
- }
141
- /**
142
- * Build choice node
143
- *
144
- * @param data - data for the node
145
- * @returns
146
- */
147
- buildBook(_context, data) {
148
- var _a, _b, _c;
149
- if (!data)
150
- return undefined;
151
- // NOTE: Node order is important and is defined here
152
- const node = {
153
- book: (_a = data.book) !== null && _a !== void 0 ? _a : '',
154
- reference: (_b = data.reference) !== null && _b !== void 0 ? _b : '',
155
- referenceEnd: ((_c = data.referenceEnd) !== null && _c !== void 0 ? _c : undefined),
156
- };
157
- // Remove Unset Optionals
158
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
159
- ignoreAllFalse: true,
160
- ignoreEmptyString: ['book', 'reference'],
161
- });
162
- return node;
163
- }
164
- /**
165
- * Build feedbackChoices[] node
166
- *
167
- * @param data - data for the node
168
- * @returns
169
- */
170
- buildFeedbackChoices(context, data) {
171
- if (!Array.isArray(data))
172
- return undefined;
173
- const nodes = data.map((d) => this.buildFeedbackChoice(context, d)).filter((d) => d != null);
174
- return nodes.length > 0 ? nodes : undefined;
175
- }
176
- /**
177
- * Build feedbackChoice node
178
- *
179
- * @param data - data for the node
180
- * @returns
181
- */
182
- buildFeedbackChoice(context, data) {
183
- var _a;
184
- if (!data)
185
- return undefined;
186
- // NOTE: Node order is important and is defined here
187
- const node = Object.assign({ choice: (_a = data.choice) !== null && _a !== void 0 ? _a : '', requireReason: !!data.requireReason, item: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.item), lead: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.lead), hint: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.hint), instruction: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.instruction) }, this.toExample(data.__isDefaultExample, data.example, true));
188
- // Remove Unset Optionals
189
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
190
- ignoreAllFalse: true,
191
- ignoreEmptyArrays: ['item', 'hint', 'instruction'],
192
- ignoreUndefined: ['example'],
193
- });
194
- return node;
195
- }
196
- /**
197
- * Build feedbackReason node
198
- *
199
- * @param data - data for the node
200
- * @returns
201
- */
202
- buildFeedbackReason(context, data) {
203
- var _a, _b;
204
- if (!data)
205
- return undefined;
206
- // Set default example
207
- // Not __testAst - there is no default example
208
- const defaultExample = this.handleJsonText(context, TextLocation_1.TextLocation.tag, 'true');
209
- // NOTE: Node order is important and is defined here
210
- const node = Object.assign(Object.assign({ text: (_a = data.text) !== null && _a !== void 0 ? _a : '', reasonableNumOfChars: ((_b = data.reasonableNumOfChars) !== null && _b !== void 0 ? _b : undefined), item: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.item), lead: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.lead), hint: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.hint), instruction: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.instruction) }, this.toExample(data.__isDefaultExample, data.example, defaultExample)), { __textAst: data.__textAst });
211
- // Remove Unset Optionals
212
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
213
- ignoreAllFalse: true,
214
- ignoreEmptyArrays: ['item', 'hint', 'instruction'],
215
- ignoreUndefined: ['example', 'reasonableNumOfChars'],
216
- });
217
- return node;
218
- }
219
- /**
220
- * Build choice[] node
221
- *
222
- * @param data - data for the node
223
- * @returns
224
- */
225
- buildChoices(context, data) {
226
- if (!Array.isArray(data))
227
- return undefined;
228
- const nodes = data.map((d) => this.buildChoice(context, d)).filter((d) => d != null);
229
- return nodes.length > 0 ? nodes : undefined;
230
- }
231
- /**
232
- * Build choice node
233
- *
234
- * @param data - data for the node
235
- * @returns
236
- */
237
- buildChoice(context, data) {
238
- var _a;
239
- if (!data)
240
- return undefined;
241
- // NOTE: Node order is important and is defined here
242
- const node = Object.assign({ choice: (_a = data.choice) !== null && _a !== void 0 ? _a : '', isCorrect: !!data.isCorrect, item: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.item), lead: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.lead), hint: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.hint), instruction: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.instruction) }, this.toExample(data.__isDefaultExample, data.example, !!data.isCorrect));
243
- // Remove Unset Optionals
244
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
245
- ignoreAllFalse: true,
246
- ignoreEmptyArrays: ['item', 'hint', 'instruction'],
247
- ignoreUndefined: ['example'],
248
- });
249
- return node;
250
- }
251
- /**
252
- * Build response[] node
253
- *
254
- * @param data - data for the node
255
- * @returns
256
- */
257
- buildResponses(context, data) {
258
- if (!Array.isArray(data))
259
- return undefined;
260
- const nodes = data.map((d) => this.buildResponse(context, d)).filter((d) => d != null);
261
- return nodes.length > 0 ? nodes : undefined;
262
- }
263
- /**
264
- * Build response node
265
- *
266
- * @param data - data for the node
267
- * @returns
268
- */
269
- buildResponse(context, data) {
270
- var _a;
271
- if (!data)
272
- return undefined;
273
- // NOTE: Node order is important and is defined here
274
- const node = Object.assign({ response: (_a = data.response) !== null && _a !== void 0 ? _a : '', isCorrect: !!data.isCorrect, item: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.item), lead: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.lead), hint: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.hint), instruction: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.instruction) }, this.toExample(data.__isDefaultExample, data.example, !!data.isCorrect));
275
- // Remove Unset Optionals
276
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
277
- ignoreAllFalse: true,
278
- ignoreEmptyArrays: ['item', 'hint', 'instruction'],
279
- ignoreUndefined: ['example'],
280
- });
281
- return node;
282
- }
283
- /**
284
- * Build bot response[] node
285
- *
286
- * @param data - data for the node
287
- * @returns
288
- */
289
- buildBotResponses(context, data) {
290
- if (!Array.isArray(data))
291
- return undefined;
292
- const nodes = data.map((d) => this.botResponse(context, d)).filter((d) => d != null);
293
- return nodes.length > 0 ? nodes : undefined;
294
- }
295
- /**
296
- * Build bot response node
297
- *
298
- * @param data - data for the node
299
- * @returns
300
- */
301
- botResponse(context, data) {
302
- var _a, _b, _c;
303
- if (!data)
304
- return undefined;
305
- // NOTE: Node order is important and is defined here
306
- const node = {
307
- response: (_a = data.response) !== null && _a !== void 0 ? _a : '',
308
- reaction: (_b = data.reaction) !== null && _b !== void 0 ? _b : '',
309
- feedback: (_c = data.feedback) !== null && _c !== void 0 ? _c : '',
310
- item: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.item),
311
- lead: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.lead),
312
- hint: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.hint),
313
- };
314
- // Remove Unset Optionals
315
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
316
- ignoreEmptyString: ['response', 'reaction', 'feedback'],
317
- ignoreAllFalse: true,
318
- ignoreEmptyArrays: ['item'],
319
- ignoreUndefined: ['example'],
320
- });
321
- return node;
322
- }
323
- /**
324
- * Build feedbacks[] node
325
- *
326
- * @param data - data for the node
327
- * @returns
328
- */
329
- buildFeedbacks(context, data) {
330
- if (!Array.isArray(data))
331
- return undefined;
332
- const nodes = data.map((d) => this.buildFeedback(context, d)).filter((d) => d != null);
333
- return nodes.length > 0 ? nodes : undefined;
334
- }
335
- /**
336
- * Build feedback node
337
- *
338
- * @param data - data for the node
339
- * @returns
340
- */
341
- buildFeedback(context, data) {
342
- if (!data)
343
- return undefined;
344
- let choices;
345
- let reason;
346
- if (data.choices) {
347
- choices = this.buildFeedbackChoices(context, data.choices);
348
- // Push __isDefaultExample down the tree
349
- // this.pushExampleDownTreeBoolean(context, data.__isDefaultExample, convertedExample.example, true, choices);
350
- }
351
- else {
352
- // No choices, not a valid feedback
353
- return undefined;
354
- }
355
- if (data.reason) {
356
- reason = this.buildFeedbackReason(context, data.reason);
357
- }
358
- // NOTE: Node order is important and is defined here
359
- const node = {
360
- item: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.item),
361
- lead: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.lead),
362
- hint: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.hint),
363
- instruction: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.instruction),
364
- // isExample: !!data.__defaultExample,
365
- choices: choices,
366
- reason: reason, // Might be undefined
367
- };
368
- // Remove Unset Optionals
369
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
370
- ignoreAllFalse: true,
371
- ignoreEmptyArrays: ['item', 'hint', 'instruction'],
372
- });
373
- return node;
374
- }
375
- /**
376
- * Build quizzes[] node
377
- *
378
- * @param data - data for the node
379
- * @returns
380
- */
381
- buildQuizzes(context, data) {
382
- if (!Array.isArray(data))
383
- return undefined;
384
- const nodes = data.map((d) => this.buildQuiz(context, d)).filter((d) => d != null);
385
- return nodes.length > 0 ? nodes : undefined;
386
- }
387
- /**
388
- * Build quiz node
389
- *
390
- * @param data - data for the node
391
- * @returns
392
- */
393
- buildQuiz(context, data) {
394
- if (!data)
395
- return undefined;
396
- const convertedExample = Object.assign({}, this.toExample(data.__isDefaultExample, data.__defaultExample));
397
- let choices;
398
- let responses;
399
- if (data.choices) {
400
- choices = this.buildChoices(context, data.choices);
401
- // Push __isDefaultExample down the tree
402
- this.pushExampleDownTreeBoolean(context, data.__isDefaultExample, convertedExample.example, true, choices);
403
- }
404
- else if (data.responses) {
405
- responses = this.buildResponses(context, data.responses);
406
- // Push __isDefaultExample down the tree
407
- this.pushExampleDownTreeBoolean(context, data.__isDefaultExample, convertedExample.example, false, responses);
408
- }
409
- else {
410
- // No choices or responses, not a valid quiz
411
- return undefined;
412
- }
413
- // NOTE: Node order is important and is defined here
414
- const node = {
415
- item: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.item),
416
- lead: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.lead),
417
- hint: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.hint),
418
- instruction: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.instruction),
419
- isExample: !!data.__defaultExample,
420
- choices: choices,
421
- responses: responses,
422
- };
423
- // Remove Unset Optionals
424
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
425
- ignoreAllFalse: true,
426
- ignoreEmptyArrays: ['item', 'hint', 'instruction'],
427
- });
428
- return node;
429
- }
430
- /**
431
- * Build heading node
432
- *
433
- * @param data - data for the node
434
- * @returns
435
- */
436
- buildHeading(_context, data) {
437
- var _a, _b, _c;
438
- if (!data)
439
- return undefined;
440
- if (data.forKeys == null)
441
- return undefined;
442
- // NOTE: Node order is important and is defined here
443
- const node = {
444
- forKeys: (_a = data.forKeys) !== null && _a !== void 0 ? _a : '',
445
- forValues: (_c = (_b = data.forValues) !== null && _b !== void 0 ? _b : data.__forValuesDefault) !== null && _c !== void 0 ? _c : '',
446
- };
447
- // Remove Unset Optionals
448
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
449
- ignoreAllFalse: true,
450
- ignoreEmptyString: ['forKeys', 'forValues'],
451
- ignoreEmptyArrays: ['forValues'],
452
- });
453
- return node;
454
- }
455
- /**
456
- * Build pair[] node
457
- *
458
- * @param data - data for the node
459
- * @returns
460
- */
461
- buildPairs(context, data) {
462
- if (!Array.isArray(data))
463
- return undefined;
464
- const nodes = data.map((d) => this.buildPair(context, d)).filter((d) => d != null);
465
- return nodes.length > 0 ? nodes : undefined;
466
- }
467
- /**
468
- * Build pair node
469
- *
470
- * @param data - data for the node
471
- * @returns
472
- */
473
- buildPair(context, data) {
474
- var _a, _b;
475
- if (!data)
476
- return undefined;
477
- // Set default example
478
- const defaultExample = Array.isArray(data.__valuesAst) && data.__valuesAst.length > 0 ? data.__valuesAst[0] : null;
479
- // Process the keyAudio and keyImage resources
480
- const keyAudio = this.resourceBuilder.resourceFromResourceJson(context, data.keyAudio);
481
- const keyImage = this.resourceBuilder.resourceFromResourceJson(context, data.keyImage);
482
- // NOTE: Node order is important and is defined here
483
- const node = Object.assign(Object.assign({ key: (_a = data.key) !== null && _a !== void 0 ? _a : '', keyAudio,
484
- keyImage, item: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.item), lead: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.lead), hint: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.hint), instruction: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.instruction), isCaseSensitive: data.isCaseSensitive }, this.toExample(data.__isDefaultExample, data.example, defaultExample)), { values: (_b = data.values) !== null && _b !== void 0 ? _b : [], __valuesAst: data.__valuesAst });
485
- // Remove Unset Optionals
486
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
487
- ignoreAllFalse: true,
488
- ignoreEmptyArrays: ['item', 'hint', 'instruction', 'values'],
489
- ignoreUndefined: ['example', 'isCaseSensitive'],
490
- });
491
- // if (node.key) {
492
- // delete node.keyAudio;
493
- // delete node.keyImage;
494
- // }
495
- // if (node.keyAudio != null) {
496
- // delete node.key;
497
- // delete node.keyImage;
498
- // }
499
- // if (node.keyImage != null) {
500
- // delete node.key;
501
- // delete node.keyAudio;
502
- // }
503
- return node;
504
- }
505
- /**
506
- * Build matrix[] node
507
- *
508
- * @param data - data for the node
509
- * @returns
510
- */
511
- buildMatricies(context, data) {
512
- if (!Array.isArray(data))
513
- return undefined;
514
- const nodes = data.map((d) => this.buildMatrix(context, d)).filter((d) => d != null);
515
- return nodes.length > 0 ? nodes : undefined;
516
- }
517
- /**
518
- * Build matrix node
519
- *
520
- * @param data - data for the node
521
- * @returns
522
- */
523
- buildMatrix(context, data) {
524
- var _a, _b, _c;
525
- if (!data)
526
- return undefined;
527
- // const convertedExample = {
528
- // ...this.toExample(__isDefaultExample, example),
529
- // };
530
- // // Push __isDefaultExample down the tree
531
- // this.pushExampleDownTreeBoolean(__isDefaultExample, convertedExample.example, true, choices);
532
- // this.pushExampleDownTreeBoolean(__isDefaultExample, convertedExample.example, false, responses);
533
- let isExample = false;
534
- // Set isExample for matrix based on isExample for cells
535
- for (const c of (_a = data.cells) !== null && _a !== void 0 ? _a : []) {
536
- if (data.__isDefaultExample && !c.isExample) {
537
- c.isExample = true;
538
- }
539
- isExample = c.isExample ? true : isExample;
540
- }
541
- // NOTE: Node order is important and is defined here
542
- const node = {
543
- key: (_b = data.key) !== null && _b !== void 0 ? _b : '',
544
- item: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.item),
545
- lead: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.lead),
546
- hint: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.hint),
547
- instruction: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.instruction),
548
- isExample,
549
- cells: ((_c = data.cells) !== null && _c !== void 0 ? _c : []).map((c) => this.buildMatrixCell(context, c)).filter((c) => c != null),
550
- };
551
- // Remove Unset Optionals
552
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
553
- ignoreAllFalse: true,
554
- ignoreEmptyArrays: ['hint', 'item', 'cells'],
555
- ignoreUndefined: ['isCaseSensitive'],
556
- });
557
- return node;
558
- }
559
- /**
560
- * Build matrixCell node
561
- *
562
- * @param data - data for the node
563
- * @returns
564
- */
565
- buildMatrixCell(context, data) {
566
- var _a;
567
- if (!data)
568
- return undefined;
569
- // Set default example
570
- const defaultExample = Array.isArray(data.__valuesAst) && data.__valuesAst.length > 0 ? data.__valuesAst[0] : null;
571
- // NOTE: Node order is important and is defined here
572
- const node = Object.assign(Object.assign({ values: (_a = data.values) !== null && _a !== void 0 ? _a : [], item: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.item), lead: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.lead), hint: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.hint), instruction: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.instruction), isCaseSensitive: data.isCaseSensitive }, this.toExample(data.__isDefaultExample, data.example, defaultExample)), { __valuesAst: data.__valuesAst });
573
- // Remove Unset Optionals
574
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
575
- ignoreAllFalse: true,
576
- ignoreEmptyArrays: ['instruction', 'item', 'values'],
577
- ignoreUndefined: ['example', 'isCaseSensitive'],
578
- });
579
- return node;
580
- }
581
- /**
582
- * Build pronunciation table node
583
- *
584
- * @param data - data for the node
585
- * @returns
586
- */
587
- buildPronunciationTable(context, dataIn) {
588
- var _a;
589
- if (!dataIn)
590
- return undefined;
591
- // NOTE: Node order is important and is defined here
592
- const node = {
593
- data: ((_a = dataIn.data) !== null && _a !== void 0 ? _a : []).map((row) => (row !== null && row !== void 0 ? row : []).map((cell) => {
594
- // Process the audio resource
595
- const audio = this.resourceBuilder.resourceFromResourceJson(context, cell.audio);
596
- return {
597
- title: this.handleJsonText(context, TextLocation_1.TextLocation.tag, cell.title),
598
- body: this.handleJsonText(context, TextLocation_1.TextLocation.tag, cell.body),
599
- audio,
600
- };
601
- })),
602
- };
603
- // Remove Unset Optionals
604
- // ObjectUtils.removeUnwantedProperties(node, {
605
- // ignoreAllFalse: true,
606
- // });
607
- return node;
608
- }
609
- /**
610
- * Build table node
611
- *
612
- * @param data - data for the node
613
- * @returns
614
- */
615
- buildTable(context, dataIn) {
616
- var _a, _b;
617
- if (!dataIn)
618
- return undefined;
619
- // NOTE: Node order is important and is defined here
620
- const node = {
621
- columns: ((_a = dataIn.columns) !== null && _a !== void 0 ? _a : []).map((col) => this.handleJsonText(context, TextLocation_1.TextLocation.tag, col)),
622
- data: ((_b = dataIn.data) !== null && _b !== void 0 ? _b : []).map((row) => (row !== null && row !== void 0 ? row : []).map((cell) => this.handleJsonText(context, TextLocation_1.TextLocation.tag, cell))),
623
- };
624
- // Remove Unset Optionals
625
- // ObjectUtils.removeUnwantedProperties(node, {
626
- // ignoreAllFalse: true,
627
- // });
628
- return node;
629
- }
630
- /**
631
- * Build question[] node
632
- *
633
- * @param data - data for the node
634
- * @returns
635
- */
636
- buildQuestions(context, data) {
637
- if (!Array.isArray(data))
638
- return undefined;
639
- const nodes = data.map((d) => this.buildQuestion(context, d)).filter((d) => d != null);
640
- return nodes.length > 0 ? nodes : undefined;
641
- }
642
- /**
643
- * Build question node
644
- *
645
- * @param data - data for the node
646
- * @returns
647
- */
648
- buildQuestion(context, data) {
649
- var _a, _b, _c, _d, _e;
650
- if (!data)
651
- return undefined;
652
- // Set default example
653
- const defaultExample = data.__sampleSolutionAst;
654
- // NOTE: Node order is important and is defined here
655
- const node = Object.assign(Object.assign({ question: (_a = data.question) !== null && _a !== void 0 ? _a : '', partialAnswer: (_b = data.partialAnswer) !== null && _b !== void 0 ? _b : '', sampleSolution: (_c = data.sampleSolution) !== null && _c !== void 0 ? _c : '', additionalSolutions: ((_d = data.additionalSolutions) !== null && _d !== void 0 ? _d : undefined), reasonableNumOfChars: ((_e = data.reasonableNumOfChars) !== null && _e !== void 0 ? _e : undefined), item: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.item), lead: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.lead), hint: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.hint), instruction: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.instruction) }, this.toExample(data.__isDefaultExample, data.example, defaultExample)), { __sampleSolutionAst: data.__sampleSolutionAst });
656
- // Remove Unset Optionals
657
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
658
- ignoreAllFalse: true,
659
- ignoreEmptyArrays: ['item', 'hint', 'instruction'],
660
- ignoreUndefined: ['example'],
661
- ignoreEmptyString: ['question', 'partialAnswer', 'sampleSolution'],
662
- });
663
- return node;
664
- }
665
- /**
666
- * Build ingredient[] node
667
- *
668
- * @param data - data for the node
669
- * @returns
670
- */
671
- buildIngredients(context, data) {
672
- if (!Array.isArray(data))
673
- return undefined;
674
- const nodes = data.map((d) => this.buildIngredient(context, d)).filter((d) => d != null);
675
- return nodes.length > 0 ? nodes : undefined;
676
- }
677
- /**
678
- * Build ingredient node
679
- *
680
- * @param data - data for the node
681
- * @returns
682
- */
683
- buildIngredient(context, data) {
684
- var _a, _b, _c, _d, _e, _f;
685
- if (!data)
686
- return undefined;
687
- // NOTE: Node order is important and is defined here
688
- const node = {
689
- title: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.title),
690
- checked: (_a = data.checked) !== null && _a !== void 0 ? _a : false,
691
- ingredient: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.ingredient),
692
- quantity: (_b = data.quantity) !== null && _b !== void 0 ? _b : 0,
693
- unit: (_c = data.unit) !== null && _c !== void 0 ? _c : '',
694
- unitAbbr: (_d = data.unitAbbr) !== null && _d !== void 0 ? _d : '',
695
- decimalPlaces: (_e = data.decimalPlaces) !== null && _e !== void 0 ? _e : 1,
696
- disableCalculation: (_f = data.disableCalculation) !== null && _f !== void 0 ? _f : false,
697
- item: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.item),
698
- lead: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.lead),
699
- hint: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.hint),
700
- };
701
- // Remove Unset Optionals
702
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
703
- ignoreAllFalse: true,
704
- // ignoreAllEmptyArrays: true,
705
- // ignoreUndefined: ['example'],
706
- ignoreEmptyString: ['item', 'unit'],
707
- });
708
- return node;
709
- }
710
- /**
711
- * Build body node
712
- * - Handles JSON, Bitmark text, and plain text
713
- * - body: set to either string, TextAst, or JSON
714
- * - bodyBits: set to array of BodyBitJson (will be validated and merged into body if it is a string)
715
- * - placeholders: set to placeholders from v2 JSON when body is a v2 JSON string
716
- * - bodyString: set to the original string if body is a string (only used for card body)
717
- *
718
- * @param data - data for the node
719
- * @returns
720
- */
721
- buildBody(context, data) {
722
- if (!data)
723
- return undefined;
724
- let body;
725
- const bodyBits = [];
726
- const placeholders = data.placeholders;
727
- const bodyString = data.bodyString;
728
- const { textFormat } = context;
729
- // Handle JSON type body
730
- const handleJsonBody = () => {
731
- // Attempt to parse a string body as JSON to support the legacy format
732
- if (typeof data.body === 'string') {
733
- try {
734
- body = JSON.parse(data.body);
735
- }
736
- catch (e) {
737
- // Could not parse JSON - set body to null
738
- body = null;
739
- }
740
- }
741
- else {
742
- body = data.body;
743
- }
744
- };
745
- // Handle Bitmark text type body (both AST v3 and plain text v2)
746
- const handleBitmarkTextBody = () => {
747
- var _a;
748
- let rawBody = data.body;
749
- let bodyStr;
750
- const placeholderNodes = {};
751
- // TODO - process body bits through the correct builders.
752
- if (StringUtils_1.StringUtils.isString(data.body)) {
753
- // Body is a string (legacy bitmark v2, or not bitmarkText)
754
- bodyStr = ((_a = data.body) !== null && _a !== void 0 ? _a : '').trim();
755
- rawBody = [];
756
- }
757
- else if (Array.isArray(data.body)) {
758
- // Body is an array (prosemirror like JSON)
759
- // Already in the correct format
760
- }
761
- else {
762
- // body is invalid
763
- rawBody = [];
764
- }
765
- if (placeholders) {
766
- for (const [key, val] of Object.entries(placeholders)) {
767
- // const bit = this.bodyBitToAst(val);
768
- // placeholderNodes[key] = bit as BodyBit;
769
- placeholderNodes[key] = val;
770
- }
771
- }
772
- if (bodyStr) {
773
- // Bug #7141: Use textFormat for textParser, not always bitmarkText if it is a v2 string body
774
- // However, only use plain text breakscaping the text from the v2 JSON body
775
- // Special v2 Breakscaping
776
- bodyStr = Breakscape_1.Breakscape.breakscape(bodyStr, {
777
- format: textFormat,
778
- location: TextLocation_1.TextLocation.body,
779
- v2: true,
780
- });
781
- // Convert placeholders {1} to [!1], etc.
782
- let index = 0;
783
- const newPlaceholderNodes = [];
784
- for (const [key, val] of Object.entries(placeholderNodes)) {
785
- if (bodyStr) {
786
- const newKey = `[!${index}]`;
787
- bodyStr = bodyStr.replace(`${key}`, newKey);
788
- newPlaceholderNodes.push(val);
789
- index++;
790
- }
791
- }
792
- // Convert the body string to AST
793
- rawBody = this.textParser.toAst(bodyStr, {
794
- format: textFormat,
795
- location: TextLocation_1.TextLocation.body,
796
- });
797
- const replaceBitsRecursive = (bodyText) => {
798
- for (let i = 0, len = bodyText.length; i < len; i++) {
799
- const bodyPart = bodyText[i];
800
- if (bodyPart.type === 'bit') {
801
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
802
- const index = bodyPart.index;
803
- if (newPlaceholderNodes[index] != null) {
804
- bodyText[i] = newPlaceholderNodes[index];
805
- }
806
- }
807
- else {
808
- if (bodyPart.content)
809
- replaceBitsRecursive(bodyPart.content);
810
- }
811
- }
812
- };
813
- // Replace the placeholders with the AST
814
- replaceBitsRecursive(rawBody);
815
- }
816
- // Process the body bits to ensure they are valid
817
- // Walking the body bits will change them, so we should make a copy before processing
818
- rawBody = (0, structured_clone_1.default)(rawBody);
819
- this.textParser.walkBodyBits(rawBody, (parent, index, bodyBit) => {
820
- // Ensure the body bit is valid
821
- let parsedBit;
822
- switch (bodyBit.type) {
823
- case BodyBitType_1.BodyBitType.gap:
824
- parsedBit = this.buildGap(context, bodyBit);
825
- break;
826
- case BodyBitType_1.BodyBitType.mark:
827
- parsedBit = this.buildMark(context, bodyBit);
828
- break;
829
- case BodyBitType_1.BodyBitType.select:
830
- parsedBit = this.buildSelect(context, bodyBit);
831
- break;
832
- case BodyBitType_1.BodyBitType.highlight:
833
- parsedBit = this.buildHighlight(context, bodyBit);
834
- break;
835
- default:
836
- // TODO?? Ensure other parts are valid
837
- }
838
- if (parsedBit != undefined) {
839
- parent[index] = parsedBit;
840
- bodyBits.push(parsedBit);
841
- }
842
- });
843
- // Set the body
844
- body = rawBody;
845
- // Mark the body as text
846
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
847
- body.__tag = 'text';
848
- };
849
- const handlePlainTextBody = () => {
850
- body = data.body;
851
- };
852
- const isBitmarkText = textFormat === TextFormat_1.TextFormat.bitmarkText;
853
- if (textFormat === TextFormat_1.TextFormat.json) {
854
- // JSON
855
- handleJsonBody();
856
- }
857
- else if (isBitmarkText) {
858
- // Bitmark text (either ast or string)
859
- handleBitmarkTextBody();
860
- }
861
- else {
862
- // Text but not bitmark (plain text)
863
- handlePlainTextBody();
864
- }
865
- const node = {
866
- body,
867
- bodyBits,
868
- bodyString,
869
- // Placeholders are only ever parsed into AST, never stored directly
870
- };
871
- return node;
872
- }
873
- /**
874
- * Build footer node
875
- *
876
- * @param data - data for the node
877
- * @returns
878
- */
879
- buildFooter(context, data) {
880
- if (!data)
881
- return undefined;
882
- const node = {
883
- footer: this.handleJsonText(context, TextLocation_1.TextLocation.body, data.footer),
884
- };
885
- return node;
886
- }
887
- /**
888
- * Build gap node
889
- *
890
- * @param data - data for the node
891
- * @returns
892
- */
893
- buildGap(context, data) {
894
- var _a;
895
- if (!data)
896
- return undefined;
897
- // Set default example
898
- const defaultExample = Array.isArray(data.__solutionsAst) && data.__solutionsAst.length > 0 ? data.__solutionsAst[0] : null;
899
- // Copy any attributes from 'attrs' to the body bit (data is in 'attrs' when coming from JSON)
900
- data = this.bodyBitCopyFromAttrs(data);
901
- // NOTE: Node order is important and is defined here
902
- const node = Object.assign(Object.assign({ type: BodyBitType_1.BodyBitType.gap, solutions: (_a = data.solutions) !== null && _a !== void 0 ? _a : [], item: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.item), lead: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.lead), hint: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.hint), instruction: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.instruction), isCaseSensitive: data.isCaseSensitive }, this.toExample(data.__isDefaultExample, data.example, defaultExample)), { __solutionsAst: data.__solutionsAst, attrs: {} });
903
- // Remove Unset Optionals
904
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
905
- ignoreAllFalse: true,
906
- ignoreAllEmptyArrays: true,
907
- ignoreUndefined: ['example', 'isCaseSensitive'],
908
- });
909
- return node;
910
- }
911
- /**
912
- * Build mark configs node
913
- *
914
- * @param data - data for the node
915
- * @returns
916
- */
917
- buildMarkConfigs(context, data) {
918
- if (!Array.isArray(data))
919
- return undefined;
920
- const nodes = data.map((d) => this.buildMarkConfig(context, d)).filter((d) => d != null);
921
- return nodes.length > 0 ? nodes : undefined;
922
- }
923
- /**
924
- * Build mark config node
925
- *
926
- * @param data - data for the node
927
- * @returns
928
- */
929
- buildMarkConfig(_context, data) {
930
- var _a, _b, _c;
931
- if (!data)
932
- return undefined;
933
- // NOTE: Node order is important and is defined here
934
- const node = {
935
- mark: (_a = data.mark) !== null && _a !== void 0 ? _a : 'unknown',
936
- color: (_b = data.color) !== null && _b !== void 0 ? _b : '',
937
- emphasis: (_c = data.emphasis) !== null && _c !== void 0 ? _c : '',
938
- };
939
- // Remove Unset Optionals
940
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
941
- ignoreAllEmptyString: true,
942
- });
943
- return node;
944
- }
945
- /**
946
- * Build mark node
947
- *
948
- * @param data - data for the node
949
- * @returns
950
- */
951
- buildMark(context, data) {
952
- var _a, _b;
953
- if (!data)
954
- return undefined;
955
- // Copy any attributes from 'attrs' to the body bit (data is in 'attrs' when coming from JSON)
956
- data = this.bodyBitCopyFromAttrs(data);
957
- // NOTE: Node order is important and is defined here
958
- const node = Object.assign(Object.assign({ type: BodyBitType_1.BodyBitType.mark, solution: (_a = data.solution) !== null && _a !== void 0 ? _a : '', mark: (_b = data.mark) !== null && _b !== void 0 ? _b : '', item: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.item), lead: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.lead), hint: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.hint), instruction: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.instruction) }, this.toExample(data.__isDefaultExample, data.example, true)), { attrs: {} });
959
- // Remove Unset Optionals
960
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
961
- ignoreAllFalse: true,
962
- ignoreAllEmptyArrays: true,
963
- ignoreUndefined: ['example'],
964
- ignoreEmptyString: ['solution', 'mark'],
965
- });
966
- return node;
967
- }
968
- /**
969
- * Build select node
970
- *
971
- * @param data - data for the node
972
- * @returns
973
- */
974
- buildSelect(context, data) {
975
- var _a, _b, _c;
976
- if (!data)
977
- return undefined;
978
- // Copy any attributes from 'attrs' to the body bit (data is in 'attrs' when coming from JSON)
979
- data = this.bodyBitCopyFromAttrs(data);
980
- // NOTE: Node order is important and is defined here
981
- const node = Object.assign(Object.assign({ type: BodyBitType_1.BodyBitType.select, options: (_a = this.buildSelectOptions(context, data.options)) !== null && _a !== void 0 ? _a : [], prefix: (_b = data.prefix) !== null && _b !== void 0 ? _b : '', postfix: (_c = data.postfix) !== null && _c !== void 0 ? _c : '', item: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.item), lead: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.lead), hint: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.hint), instruction: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.instruction) }, this.toExample(false, undefined, undefined)), { __hintString: data.__hintString, __instructionString: data.__instructionString, attrs: {} });
982
- // Remove Unset Optionals
983
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
984
- ignoreAllFalse: true,
985
- ignoreAllEmptyArrays: true,
986
- ignoreEmptyString: ['prefix', 'postfix'],
987
- });
988
- return node;
989
- }
990
- /**
991
- * Build selectOption[] node
992
- *
993
- * @param data - data for the node
994
- * @returns
995
- */
996
- buildSelectOptions(context, data) {
997
- if (!Array.isArray(data))
998
- return undefined;
999
- const nodes = data.map((d) => this.buildSelectOption(context, d)).filter((d) => d != null);
1000
- return nodes.length > 0 ? nodes : undefined;
1001
- }
1002
- /**
1003
- * Build selectOption node
1004
- *
1005
- * @param data - data for the node
1006
- * @returns
1007
- */
1008
- buildSelectOption(context, data) {
1009
- var _a;
1010
- if (!data)
1011
- return undefined;
1012
- // NOTE: Node order is important and is defined here
1013
- const node = Object.assign({ text: (_a = data.text) !== null && _a !== void 0 ? _a : '', isCorrect: !!data.isCorrect, item: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.item), lead: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.lead), hint: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.hint), instruction: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.instruction) }, this.toExample(data.__isDefaultExample, data.example, !!data.isCorrect));
1014
- // Remove Unset Optionals
1015
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
1016
- ignoreAllFalse: true,
1017
- ignoreAllEmptyArrays: true,
1018
- ignoreUndefined: ['example'],
1019
- });
1020
- return node;
1021
- }
1022
- /**
1023
- * Build highlight node
1024
- *
1025
- * @param data - data for the node
1026
- * @returns
1027
- */
1028
- buildHighlight(context, data) {
1029
- var _a, _b, _c;
1030
- if (!data)
1031
- return undefined;
1032
- // Copy any attributes from 'attrs' to the body bit (data is in 'attrs' when coming from JSON)
1033
- data = this.bodyBitCopyFromAttrs(data);
1034
- // NOTE: Node order is important and is defined here
1035
- const node = Object.assign(Object.assign({ type: BodyBitType_1.BodyBitType.highlight, texts: (_a = this.buildHighlightTexts(context, data.texts)) !== null && _a !== void 0 ? _a : [], prefix: (_b = data.prefix) !== null && _b !== void 0 ? _b : '', postfix: (_c = data.postfix) !== null && _c !== void 0 ? _c : '', item: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.item), lead: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.lead), hint: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.hint), instruction: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.instruction) }, this.toExample(false, undefined, undefined)), { attrs: {} });
1036
- // Remove Unset Optionals
1037
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
1038
- ignoreAllFalse: true,
1039
- ignoreAllEmptyArrays: true,
1040
- ignoreEmptyString: ['prefix', 'postfix'],
1041
- });
1042
- return node;
1043
- }
1044
- /**
1045
- * Build highlightText[] node
1046
- *
1047
- * @param data - data for the node
1048
- * @returns
1049
- */
1050
- buildHighlightTexts(context, data) {
1051
- if (!Array.isArray(data))
1052
- return undefined;
1053
- const nodes = data.map((d) => this.buildHighlightText(context, d)).filter((d) => d != null);
1054
- return nodes.length > 0 ? nodes : undefined;
1055
- }
1056
- /**
1057
- * Build highlightText node
1058
- *
1059
- * @param data - data for the node
1060
- * @returns
1061
- */
1062
- buildHighlightText(context, data) {
1063
- var _a;
1064
- if (!data)
1065
- return undefined;
1066
- // NOTE: Node order is important and is defined here
1067
- const node = Object.assign({ text: (_a = data.text) !== null && _a !== void 0 ? _a : '', isCorrect: !!data.isCorrect, isHighlighted: !!data.isHighlighted, item: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.item), lead: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.lead), hint: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.hint), instruction: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.instruction) }, this.toExample(data.__isDefaultExample, data.example, !!data.isCorrect));
1068
- // Remove Unset Optionals
1069
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
1070
- ignoreAllFalse: true,
1071
- ignoreAllEmptyArrays: true,
1072
- ignoreUndefined: ['example'],
1073
- });
1074
- return node;
1075
- }
1076
- /**
1077
- * Build flashcards node
1078
- *
1079
- * @param data - data for the node
1080
- * @returns
1081
- */
1082
- buildFlashcards(context, data) {
1083
- if (!Array.isArray(data))
1084
- return undefined;
1085
- const nodes = data.map((d) => this.buildFlashcard(context, d)).filter((d) => d != null);
1086
- return nodes.length > 0 ? nodes : undefined;
1087
- }
1088
- /**
1089
- * Build flashcard node
1090
- *
1091
- * @param data - data for the node
1092
- * @returns
1093
- */
1094
- buildFlashcard(context, data) {
1095
- var _a;
1096
- if (!data)
1097
- return undefined;
1098
- // NOTE: Node order is important and is defined here
1099
- const node = Object.assign({ question: this.buildTextAndIcon(context, data.question), answer: this.buildTextAndIcon(context, data.answer), alternativeAnswers: ((_a = data.alternativeAnswers) !== null && _a !== void 0 ? _a : [])
1100
- .map((d) => this.buildTextAndIcon(context, d))
1101
- .filter((d) => d != null), item: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.item), lead: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.lead), hint: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.hint), instruction: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.instruction) }, this.toExample(data.__isDefaultExample, data.example, true));
1102
- // Remove Unset Optionals
1103
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
1104
- ignoreAllFalse: true,
1105
- ignoreEmptyArrays: ['question', 'answer', 'alternativeAnswers', 'item', 'hint', 'instruction'],
1106
- ignoreUndefined: ['example'],
1107
- });
1108
- return node;
1109
- }
1110
- /**
1111
- * Build definitionListItem[] node
1112
- *
1113
- * @param data - data for the node
1114
- * @returns
1115
- */
1116
- buildDefinitionList(context, data) {
1117
- if (!Array.isArray(data))
1118
- return undefined;
1119
- const nodes = data.map((d) => this.buildDefinitionListItem(context, d)).filter((d) => d != null);
1120
- return nodes.length > 0 ? nodes : undefined;
1121
- }
1122
- /**
1123
- * Build definitionListItem node
1124
- *
1125
- * @param data - data for the node
1126
- * @returns
1127
- */
1128
- buildDefinitionListItem(context, data) {
1129
- var _a;
1130
- if (!data)
1131
- return undefined;
1132
- const { bitType } = context;
1133
- const textAsStrings = Config_1.Config.isOfBitType(bitType, [BitType_1.BitType.metaSearchDefaultTerms]);
1134
- // NOTE: Node order is important and is defined here
1135
- const node = Object.assign({ term: this.buildTextAndIcon(context, data.term, textAsStrings), definition: this.buildTextAndIcon(context, data.definition, textAsStrings), alternativeDefinitions: ((_a = data.alternativeDefinitions) !== null && _a !== void 0 ? _a : [])
1136
- .map((d) => this.buildTextAndIcon(context, d, textAsStrings))
1137
- .filter((d) => d != null), item: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.item), lead: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.lead), hint: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.hint), instruction: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.instruction) }, this.toExample(data.__isDefaultExample, data.example, true));
1138
- // Remove Unset Optionals
1139
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
1140
- ignoreAllFalse: true,
1141
- ignoreEmptyArrays: ['question', 'answer', 'alternativeDefinitions', 'item', 'hint', 'instruction'],
1142
- ignoreUndefined: ['example'],
1143
- });
1144
- return node;
1145
- }
1146
- buildTextAndIcon(context, data, textAsStrings = false) {
1147
- const icon = this.resourceBuilder.resourceFromResourceJson(context, data === null || data === void 0 ? void 0 : data.icon);
1148
- // Ensure text is bitmark text
1149
- let text = this.handleJsonText(context, TextLocation_1.TextLocation.tag, data === null || data === void 0 ? void 0 : data.text);
1150
- if (textAsStrings) {
1151
- // Convert the bitmark text to plain text (without breakscaping, as that will happen in the Bitmark Generator)
1152
- text = this.textGenerator
1153
- .generateSync(text, TextFormat_1.TextFormat.plainText, TextLocation_1.TextLocation.body, {
1154
- noBreakscaping: true,
1155
- })
1156
- .trim();
1157
- }
1158
- // NOTE: Node order is important and is defined here
1159
- const node = {
1160
- text,
1161
- icon,
1162
- };
1163
- // Remove Unset Optionals
1164
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
1165
- ignoreEmptyArrays: ['text'],
1166
- ignoreUndefined: ['icon'],
1167
- });
1168
- return node;
1169
- }
1170
- /**
1171
- * Build statement[] node
1172
- *
1173
- * @param data - data for the node
1174
- * @returns
1175
- */
1176
- buildStatements(context, data) {
1177
- if (!Array.isArray(data))
1178
- return undefined;
1179
- const nodes = data.map((d) => this.buildStatement(context, d)).filter((d) => d != null);
1180
- return nodes.length > 0 ? nodes : undefined;
1181
- }
1182
- /**
1183
- * Build statement node
1184
- *
1185
- * @param data - data for the node
1186
- * @returns
1187
- */
1188
- buildStatement(context, data) {
1189
- var _a;
1190
- if (!data)
1191
- return undefined;
1192
- // NOTE: Node order is important and is defined here
1193
- const node = Object.assign({ statement: (_a = data.statement) !== null && _a !== void 0 ? _a : '', isCorrect: !!data.isCorrect, item: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.item), lead: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.lead), hint: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.hint), instruction: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.instruction) }, this.toExample(data.__isDefaultExample, data.example, !!data.isCorrect));
1194
- // Remove Unset Optionals
1195
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
1196
- ignoreAllFalse: true,
1197
- // ignoreAllEmptyArrays: true,
1198
- ignoreUndefined: ['example'],
1199
- });
1200
- return node;
1201
- }
1202
- /**
1203
- * Build (image-on-device) imageSource node
1204
- *
1205
- * @param data - data for the node
1206
- * @returns
1207
- */
1208
- buildImageSource(_context, data) {
1209
- if (!data)
1210
- return undefined;
1211
- const { url, mockupId, size, format, trim } = data;
1212
- // NOTE: Node order is important and is defined here
1213
- const node = {
1214
- url: url !== null && url !== void 0 ? url : '',
1215
- mockupId: mockupId !== null && mockupId !== void 0 ? mockupId : '',
1216
- size: (size !== null && size !== void 0 ? size : null),
1217
- format: (format !== null && format !== void 0 ? format : null),
1218
- trim: (BooleanUtils_1.BooleanUtils.isBoolean(trim) ? trim : null),
1219
- };
1220
- // Remove Unset Optionals
1221
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
1222
- ignoreFalse: ['trim'],
1223
- ignoreEmptyString: ['url', 'mockupId'],
1224
- ignoreAllUndefined: true,
1225
- });
1226
- return node;
1227
- }
1228
- /**
1229
- * Build (chat) person node
1230
- *
1231
- * @param data - data for the node
1232
- * @returns
1233
- */
1234
- buildPerson(context, data) {
1235
- if (!data)
1236
- return undefined;
1237
- const { name, title, avatarImage } = data;
1238
- // { name: string; title?: string; avatarImage?: ImageResourceJson }
1239
- // NOTE: Node order is important and is defined here
1240
- const node = {
1241
- name: name !== null && name !== void 0 ? name : '',
1242
- title: (title !== null && title !== void 0 ? title : undefined),
1243
- avatarImage: this.resourceBuilder.resourceFromResourceJson(context, avatarImage),
1244
- };
1245
- // Remove Unset Optionals
1246
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
1247
- ignoreEmptyString: ['name'],
1248
- ignoreAllUndefined: true,
1249
- });
1250
- return node;
1251
- }
1252
- /**
1253
- * Build (cook-ingredients) technicalTerm node
1254
- *
1255
- * @param data - data for the node
1256
- * @returns
1257
- */
1258
- buildTechnicalTerm(_context, data) {
1259
- if (!data)
1260
- return undefined;
1261
- const { technicalTerm, lang } = data;
1262
- // NOTE: Node order is important and is defined here
1263
- const node = {
1264
- technicalTerm: technicalTerm !== null && technicalTerm !== void 0 ? technicalTerm : '',
1265
- lang: lang !== null && lang !== void 0 ? lang : '',
1266
- };
1267
- // Remove Unset Optionals
1268
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
1269
- ignoreEmptyString: ['technicalTerm'],
1270
- // ignoreAllUndefined: true,
1271
- });
1272
- return node;
1273
- }
1274
- /**
1275
- * Build (cook-ingredients) servings node
1276
- *
1277
- * @param data - data for the node
1278
- * @returns
1279
- */
1280
- buildServings(_context, data) {
1281
- if (!data)
1282
- return undefined;
1283
- const { servings, unit, unitAbbr, decimalPlaces, disableCalculation, hint } = data;
1284
- // NOTE: Node order is important and is defined here
1285
- const node = {
1286
- servings: servings !== null && servings !== void 0 ? servings : 0,
1287
- unit: unit !== null && unit !== void 0 ? unit : '',
1288
- unitAbbr: unitAbbr !== null && unitAbbr !== void 0 ? unitAbbr : '',
1289
- decimalPlaces: decimalPlaces !== null && decimalPlaces !== void 0 ? decimalPlaces : 1,
1290
- disableCalculation: disableCalculation !== null && disableCalculation !== void 0 ? disableCalculation : false,
1291
- hint: hint !== null && hint !== void 0 ? hint : '',
1292
- };
1293
- // Remove Unset Optionals
1294
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
1295
- ignoreEmptyString: ['servings', 'unit'],
1296
- // ignoreAllUndefined: true,
1297
- });
1298
- return node;
1299
- }
1300
- /**
1301
- * Build (survey-rating) ratingLevelStart / ratingLevelEnd node
1302
- *
1303
- * @param data - data for the node
1304
- * @returns
1305
- */
1306
- buildRatingLevelStartEnd(context, data) {
1307
- if (!data)
1308
- return undefined;
1309
- const { level, label } = data;
1310
- // NOTE: Node order is important and is defined here
1311
- const node = {
1312
- level: level !== null && level !== void 0 ? level : 0,
1313
- label: this.handleJsonText(context, TextLocation_1.TextLocation.tag, label),
1314
- };
1315
- // Remove Unset Optionals
1316
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
1317
- // ignoreEmptyArrays: ['servings', 'unit'],
1318
- // ignoreAllUndefined: true,
1319
- });
1320
- return node;
1321
- }
1322
- // DEPRECATED - TO BE REMOVED IN FUTURE
1323
- // /**
1324
- // * Build captionDefinition node
1325
- // *
1326
- // * @param data - data for the node
1327
- // * @returns
1328
- // */
1329
- // protected buildCaptionDefinition(
1330
- // _context: BuildContext,
1331
- // data: Partial<CaptionDefinitionJson> | undefined,
1332
- // ): CaptionDefinitionJson | undefined {
1333
- // if (!data) return undefined;
1334
- // // NOTE: Node order is important and is defined here
1335
- // const node: CaptionDefinitionJson = {
1336
- // // term: this.convertJsonTextToAstText(data.term),
1337
- // // description: this.convertJsonTextToAstText(data.description),
1338
- // term: data.term ?? '',
1339
- // definition: data.definition ?? '',
1340
- // };
1341
- // // Remove Unset Optionals
1342
- // ObjectUtils.removeUnwantedProperties(node, {
1343
- // ignoreEmptyString: ['term', 'description'],
1344
- // // ignoreAllUndefined: true,
1345
- // });
1346
- // return node;
1347
- // }
1348
- // /**
1349
- // * Build captionDefinitionList node
1350
- // *
1351
- // * @param data - data for the node
1352
- // * @returns
1353
- // */
1354
- // protected buildCaptionDefinitionList(
1355
- // context: BuildContext,
1356
- // data: Partial<CaptionDefinitionListJson> | undefined,
1357
- // ): CaptionDefinitionListJson | undefined {
1358
- // if (!data) return undefined;
1359
- // // NOTE: Node order is important and is defined here
1360
- // const node: CaptionDefinitionListJson = {
1361
- // columns: data.columns ?? [],
1362
- // definitions: (data.definitions ?? [])
1363
- // .map((d) => {
1364
- // return this.buildCaptionDefinition(context, {
1365
- // term: d.term,
1366
- // definition: d.definition,
1367
- // });
1368
- // })
1369
- // .filter((d) => d != null),
1370
- // };
1371
- // // Remove Unset Optionals
1372
- // ObjectUtils.removeUnwantedProperties(node, {
1373
- // ignoreAllEmptyArrays: true,
1374
- // });
1375
- // return node;
1376
- // }
1377
- /**
1378
- * Build card bit[] node
1379
- *
1380
- * @param data - data for the node
1381
- * @returns
1382
- */
1383
- buildCardBits(context, data) {
1384
- if (!Array.isArray(data))
1385
- return undefined;
1386
- const nodes = data.map((d) => this.buildCardBit(context, d)).filter((d) => d != null);
1387
- return nodes.length > 0 ? nodes : undefined;
1388
- }
1389
- /**
1390
- * Build card bit node
1391
- *
1392
- * @param data - data for the node
1393
- * @returns
1394
- */
1395
- buildCardBit(context, data) {
1396
- if (!data)
1397
- return undefined;
1398
- const { bitType, textFormat } = context;
1399
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1400
- const node = this.buildBit(Object.assign(Object.assign({}, data), { bitType, textFormat }));
1401
- // // NOTE: Node order is important and is defined here
1402
- // const node: CardBit = {
1403
- // item: this.handleJsonText(data.item),
1404
- // lead: this.handleJsonText(data.lead),
1405
- // hint: this.handleJsonText(data.hint),
1406
- // instruction: this.handleJsonText(data.instruction),
1407
- // ...this.toExample(data.__isDefaultExample, data.example),
1408
- // __isDefaultExample: data.__isDefaultExample ?? false,
1409
- // body: this.buildBody(textFormat, data.body),
1410
- // // Must always be last in the AST so key clashes are avoided correctly with other properties
1411
- // extraProperties: this.parseExtraProperties(data.extraProperties),
1412
- // };
1413
- // Remove Unset Optionals
1414
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
1415
- ignoreAllFalse: true,
1416
- // ignoreEmptyArrays: ['example'],
1417
- ignoreUndefined: ['example'],
1418
- });
1419
- // Validate and correct invalid bits as much as possible
1420
- return NodeValidator_1.NodeValidator.validateCardBit(node);
1421
- }
1422
- toImageResource(context, data) {
1423
- return ArrayUtils_1.ArrayUtils.asSingle(this.resourceBuilder.resourceFromResourceDataJson(context, ResourceTag_1.ResourceTag.image, data === null || data === void 0 ? void 0 : data.image));
1424
- }
1425
- //
1426
- // Private
1427
- //
1428
- buildCardNode(context, data) {
1429
- var _a;
1430
- const node = {
1431
- heading: this.buildHeading(context, data.heading),
1432
- questions: this.buildQuestions(context, data.questions),
1433
- elements: data.elements,
1434
- flashcards: this.buildFlashcards(context, data.flashcards),
1435
- definitions: this.buildDefinitionList(context, (_a = data.definitions) !== null && _a !== void 0 ? _a : data.legend),
1436
- statement: this.buildStatement(context, data.statement),
1437
- statements: this.buildStatements(context, data.statements),
1438
- choices: this.buildChoices(context, data.choices),
1439
- responses: this.buildResponses(context, data.responses),
1440
- feedbacks: this.buildFeedbacks(context, data.feedbacks),
1441
- quizzes: this.buildQuizzes(context, data.quizzes),
1442
- pairs: this.buildPairs(context, data.pairs),
1443
- matrix: this.buildMatricies(context, data.matrix),
1444
- pronunciationTable: this.buildPronunciationTable(context, data.pronunciationTable),
1445
- table: this.buildTable(context, data.table),
1446
- botResponses: this.buildBotResponses(context, data.botResponses),
1447
- ingredients: this.buildIngredients(context, data.ingredients),
1448
- // DEPRECATED - TO BE REMOVED IN FUTURE
1449
- // captionDefinitionList: this.buildCaptionDefinitionList(context, data.captionDefinitionList),
1450
- cardBits: this.buildCardBits(context, data.cardBits),
1451
- };
1452
- // Remove Unset Optionals
1453
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node);
1454
- return Object.keys(node).length > 0 ? node : undefined;
1455
- }
1456
- /**
1457
- * Copy any attributes from 'attrs' property to the root node (necessary when the input if from JSON)
1458
- * The values in 'attrs' will overwrite any existing values in the node
1459
- *
1460
- * The original object is not modified, a new object is returned
1461
- *
1462
- * @param data
1463
- */
1464
- bodyBitCopyFromAttrs(data) {
1465
- const copy = Object.assign({}, data);
1466
- // Copy any attributes from 'attrs' to the node (necessary when the input if from JSON)
1467
- if (data.attrs) {
1468
- for (const [key, value] of Object.entries(data.attrs)) {
1469
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1470
- copy[key] = value;
1471
- }
1472
- }
1473
- return copy;
1474
- }
1475
- /**
1476
- * Set examples down the tree
1477
- *
1478
- * @param body
1479
- * @param cardNode
1480
- * @param __isDefaultExample
1481
- * @param example
1482
- * @returns true if any of the answers has an example, otherwise undefined
1483
- */
1484
- pushExampleDownTree(context, body, cardNode, __isDefaultExample, example) {
1485
- if (__isDefaultExample || example != null) {
1486
- if (cardNode) {
1487
- this.pushExampleDownTreeString(context, __isDefaultExample, example, cardNode.pairs);
1488
- this.pushExampleDownTreeBoolean(context, __isDefaultExample, example, false, cardNode.flashcards);
1489
- this.pushExampleDownTreeBoolean(context, __isDefaultExample, example, false, cardNode.definitions);
1490
- this.pushExampleDownTreeBoolean(context, __isDefaultExample, example, true, cardNode.choices);
1491
- this.pushExampleDownTreeBoolean(context, __isDefaultExample, example, false, cardNode.responses, cardNode.statements, cardNode.statement);
1492
- if (cardNode.quizzes) {
1493
- for (const quiz of cardNode.quizzes) {
1494
- this.pushExampleDownTreeBoolean(context, __isDefaultExample, example, true, quiz.choices);
1495
- this.pushExampleDownTreeBoolean(context, __isDefaultExample, example, false, quiz.responses);
1496
- }
1497
- }
1498
- if (cardNode.matrix) {
1499
- for (const m of cardNode.matrix) {
1500
- this.pushExampleDownTreeString(context, __isDefaultExample, example, m.cells);
1501
- }
1502
- }
1503
- }
1504
- if (body) {
1505
- this.pushExampleDownTreeBodyBits(context, __isDefaultExample, example, body);
1506
- }
1507
- }
1508
- }
1509
- /**
1510
- * Set examples for boolean nodes
1511
- *
1512
- * @param __isDefaultExample
1513
- * @param example
1514
- * @param onlyCorrect
1515
- * @param nodes
1516
- * @returns true if any of the answers has an example, otherwise undefined
1517
- */
1518
- pushExampleDownTreeBoolean(_context, __isDefaultExample, example, onlyCorrect, ...nodes) {
1519
- if (!__isDefaultExample && example == null)
1520
- return;
1521
- if (Array.isArray(nodes)) {
1522
- for (const ds of nodes) {
1523
- if (ds) {
1524
- const exampleNodes = Array.isArray(ds) ? ds : [ds];
1525
- BitUtils_1.BitUtils.fillBooleanExample(exampleNodes, __isDefaultExample, example, onlyCorrect);
1526
- }
1527
- }
1528
- }
1529
- }
1530
- /**
1531
- * Set examples for string nodes
1532
- *
1533
- * @param __isDefaultExample
1534
- * @param example
1535
- * @param nodes
1536
- * @returns true if any of the answers has an example, otherwise undefined
1537
- */
1538
- pushExampleDownTreeString(context, __isDefaultExample, example, ...nodes) {
1539
- if (!__isDefaultExample && !example)
1540
- return;
1541
- if (Array.isArray(nodes)) {
1542
- for (const ds of nodes) {
1543
- if (ds) {
1544
- const exampleNodes = Array.isArray(ds) ? ds : [ds];
1545
- BitUtils_1.BitUtils.fillStringExample(context.textFormat, exampleNodes, __isDefaultExample, example, false);
1546
- }
1547
- }
1548
- }
1549
- }
1550
- pushExampleDownTreeBodyBits(context, __isDefaultExample, example, body) {
1551
- if (!__isDefaultExample && !example)
1552
- return;
1553
- const bodyBitsJson = this.textParser.extractBodyBits(body === null || body === void 0 ? void 0 : body.body);
1554
- for (const part of bodyBitsJson) {
1555
- if (part) {
1556
- switch (part.type) {
1557
- case BodyBitType_1.BodyBitType.gap: {
1558
- const gap = part;
1559
- BitUtils_1.BitUtils.fillStringExample(context.textFormat, [gap], __isDefaultExample, example, false);
1560
- break;
1561
- }
1562
- case BodyBitType_1.BodyBitType.mark: {
1563
- const mark = part;
1564
- BitUtils_1.BitUtils.fillBooleanExample([mark], __isDefaultExample, example, false);
1565
- break;
1566
- }
1567
- case BodyBitType_1.BodyBitType.select: {
1568
- const select = part;
1569
- BitUtils_1.BitUtils.fillBooleanExample(select.options, __isDefaultExample, example, true);
1570
- break;
1571
- }
1572
- case BodyBitType_1.BodyBitType.highlight: {
1573
- const highlight = part;
1574
- BitUtils_1.BitUtils.fillBooleanExample(highlight.texts, __isDefaultExample, example, true);
1575
- break;
1576
- }
1577
- }
1578
- }
1579
- }
1580
- }
1581
- /**
1582
- * Push a value down the tree, without overriding existing values
1583
- *
1584
- * This function is not type safe and should be used with care
1585
- *
1586
- * @param body/body[] set if the value should be passed down the body to the body bits / card body bits
1587
- * @param bodyBitTypes body bit types to push the value down to
1588
- * @param cardNode set if the value should be passed down the card node
1589
- * @param path path for the value
1590
- * @param value the value to push down
1591
- */
1592
- pushDownTree(_context, body, bodyBitTypes, cardNode, cardNodePath, path, value) {
1593
- if (value === undefined)
1594
- return;
1595
- // Add value to card nodes if required
1596
- if (cardNode && cardNodePath) {
1597
- if (!Array.isArray(cardNodePath))
1598
- cardNodePath = [cardNodePath];
1599
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1600
- const data = ObjectUtils_1.ObjectUtils.flatMapPath(cardNode, cardNodePath);
1601
- for (const d of data) {
1602
- if (d[path] == null) {
1603
- d[path] = value;
1604
- }
1605
- }
1606
- }
1607
- // Add value to body bit types if required
1608
- if (body) {
1609
- const bodyArray = (Array.isArray(body) ? body : [body]);
1610
- for (const b of bodyArray) {
1611
- if (b && b.body && bodyBitTypes) {
1612
- const bodyBitsJson = this.textParser.extractBodyBits(b.body);
1613
- if (bodyBitTypes && bodyBitsJson && bodyBitsJson.length > 0) {
1614
- for (const part of bodyBitsJson) {
1615
- if (part) {
1616
- if (bodyBitTypes.indexOf(part.type) !== -1) {
1617
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1618
- const data = part;
1619
- if (data[path] == null) {
1620
- data[path] = value;
1621
- }
1622
- }
1623
- }
1624
- }
1625
- }
1626
- }
1627
- }
1628
- }
1629
- }
1630
- parseExtraProperties(extraProperties) {
1631
- if (!extraProperties)
1632
- return undefined;
1633
- const entries = Object.entries(extraProperties);
1634
- if (entries.length === 0)
1635
- return undefined;
1636
- const res = {};
1637
- for (const [key, value] of entries) {
1638
- res[key] = ArrayUtils_1.ArrayUtils.asArray(value) || [value];
1639
- }
1640
- return res;
1641
- }
1642
- /**
1643
- * Set the 'isExample' flags on the bit
1644
- *
1645
- * The flag is set if the bit has an example. The flag is set at each branch level up the tree from
1646
- * where the 'example' exists.
1647
- *
1648
- * @param bit
1649
- */
1650
- setIsExampleFlags(bit) {
1651
- // bit.isExample = false;
1652
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
1653
- const checkIsExample = (example) => {
1654
- if (!example)
1655
- return false;
1656
- if ( /*example.__isDefaultExample ||*/example.isExample || example.example != undefined) {
1657
- example.isExample = true;
1658
- bit.isExample = true;
1659
- }
1660
- else {
1661
- if (example === bit) {
1662
- example.isExample = !!bit.isExample;
1663
- }
1664
- else {
1665
- example.isExample = false;
1666
- }
1667
- }
1668
- return example.isExample;
1669
- };
1670
- const { body, cardNode } = bit;
1671
- // Body bit level
1672
- const bodyBitsJson = this.textParser.extractBodyBits(body === null || body === void 0 ? void 0 : body.body);
1673
- for (const bodyPart of bodyBitsJson) {
1674
- switch (bodyPart.type) {
1675
- case BodyBitType_1.BodyBitType.gap:
1676
- case BodyBitType_1.BodyBitType.mark: {
1677
- checkIsExample(bodyPart);
1678
- break;
1679
- }
1680
- case BodyBitType_1.BodyBitType.select: {
1681
- const select = bodyPart;
1682
- let hasExample = false;
1683
- for (const option of select.options) {
1684
- hasExample = checkIsExample(option) ? true : hasExample;
1685
- }
1686
- select.isExample = hasExample;
1687
- break;
1688
- }
1689
- case BodyBitType_1.BodyBitType.highlight: {
1690
- const highlight = bodyPart;
1691
- let hasExample = false;
1692
- for (const text of highlight.texts) {
1693
- hasExample = checkIsExample(text) ? true : hasExample;
1694
- }
1695
- highlight.isExample = hasExample;
1696
- break;
1697
- }
1698
- }
1699
- }
1700
- // Card level
1701
- if (cardNode) {
1702
- // flashcards
1703
- for (const v of (_a = cardNode.flashcards) !== null && _a !== void 0 ? _a : []) {
1704
- checkIsExample(v);
1705
- }
1706
- // definitions
1707
- for (const v of (_b = cardNode.definitions) !== null && _b !== void 0 ? _b : []) {
1708
- checkIsExample(v);
1709
- }
1710
- // pairs
1711
- for (const v of (_c = cardNode.pairs) !== null && _c !== void 0 ? _c : []) {
1712
- checkIsExample(v);
1713
- }
1714
- // matrix
1715
- for (const mx of (_d = cardNode.matrix) !== null && _d !== void 0 ? _d : []) {
1716
- let hasExample = false;
1717
- // matrix cell
1718
- for (const v of (_e = mx.cells) !== null && _e !== void 0 ? _e : []) {
1719
- hasExample = checkIsExample(v) ? true : hasExample;
1720
- }
1721
- mx.isExample = hasExample;
1722
- }
1723
- // quizzes
1724
- for (const quiz of (_f = cardNode.quizzes) !== null && _f !== void 0 ? _f : []) {
1725
- let hasExample = false;
1726
- // responses
1727
- for (const v of (_g = quiz.responses) !== null && _g !== void 0 ? _g : []) {
1728
- hasExample = checkIsExample(v) ? true : hasExample;
1729
- }
1730
- // choices
1731
- for (const v of (_h = quiz.choices) !== null && _h !== void 0 ? _h : []) {
1732
- hasExample = checkIsExample(v) ? true : hasExample;
1733
- }
1734
- quiz.isExample = hasExample;
1735
- }
1736
- // responses
1737
- for (const v of (_j = cardNode.responses) !== null && _j !== void 0 ? _j : []) {
1738
- checkIsExample(v);
1739
- }
1740
- // choices
1741
- for (const v of (_k = cardNode.choices) !== null && _k !== void 0 ? _k : []) {
1742
- checkIsExample(v);
1743
- }
1744
- // statements
1745
- for (const v of (_l = cardNode.statements) !== null && _l !== void 0 ? _l : []) {
1746
- checkIsExample(v);
1747
- }
1748
- // statement
1749
- checkIsExample(cardNode.statement);
1750
- // NO: elements
1751
- // questions
1752
- for (const v of (_m = cardNode.questions) !== null && _m !== void 0 ? _m : []) {
1753
- checkIsExample(v);
1754
- }
1755
- }
1756
- // Bit level
1757
- // statement
1758
- checkIsExample(bit.statement);
1759
- // responses
1760
- for (const v of (_o = bit.responses) !== null && _o !== void 0 ? _o : []) {
1761
- checkIsExample(v);
1762
- }
1763
- // choices
1764
- for (const v of (_p = bit.choices) !== null && _p !== void 0 ? _p : []) {
1765
- checkIsExample(v);
1766
- }
1767
- // Bit itself
1768
- checkIsExample(bit);
1769
- }
1770
- setDefaultBitValues(bit) {
1771
- // Set aiGenerated == true for all AI generated bits
1772
- switch (bit.bitType) {
1773
- case BitType_1.BitType.articleAi:
1774
- case BitType_1.BitType.noteAi:
1775
- case BitType_1.BitType.summaryAi:
1776
- bit.aiGenerated = this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.aiGenerated, true);
1777
- break;
1778
- }
1779
- }
1780
- addVersionToParserInfo(bit) {
1781
- var _a;
1782
- const parser = (_a = bit.parser) !== null && _a !== void 0 ? _a : {};
1783
- parser.version = Env_1.env.appVersion.full;
1784
- bit.parser = parser;
1785
- }
1786
- }
1787
- exports.Builder = Builder;
1788
- //# sourceMappingURL=Builder.js.map