@gmb/bitmark-parser-generator 3.34.0 → 3.36.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 +4 -4
  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 +33650 -0
  5. package/dist/index.cjs.map +1 -0
  6. package/dist/index.d.cts +7733 -0
  7. package/dist/index.d.ts +7733 -0
  8. package/dist/index.js +33590 -0
  9. package/dist/index.js.map +1 -0
  10. package/package.json +106 -90
  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 -1781
  18. package/dist/cjs/ast/Builder.js.map +0 -1
  19. package/dist/cjs/ast/ResourceBuilder.js +0 -963
  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 -9659
  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 -1199
  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 -1775
  316. package/dist/esm/ast/Builder.js.map +0 -1
  317. package/dist/esm/ast/ResourceBuilder.js +0 -960
  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 -9654
  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 -1196
  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,1781 +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;
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, ...(((_c = cardNode === null || cardNode === void 0 ? void 0 : cardNode.cardBits) === null || _c === void 0 ? void 0 : _c.map((cardBit) => cardBit.body)) || [])], [BodyBitType_1.BodyBitType.gap], undefined, undefined, //'isCaseSensitive',
107
- PropertyConfigKey_1.PropertyConfigKey.isCaseSensitive, (_d = data.isCaseSensitive) !== null && _d !== void 0 ? _d : true);
108
- this.pushDownTree(context, undefined, undefined, cardNode, 'pairs', PropertyConfigKey_1.PropertyConfigKey.isCaseSensitive, (_e = data.isCaseSensitive) !== null && _e !== void 0 ? _e : true);
109
- this.pushDownTree(context, undefined, undefined, cardNode, ['matrix', 'cells'], PropertyConfigKey_1.PropertyConfigKey.isCaseSensitive, (_f = data.isCaseSensitive) !== null && _f !== void 0 ? _f : 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;
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: data.values || [], __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;
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 data.cells || []) {
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: (_a = data.key) !== null && _a !== void 0 ? _a : '',
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: (data.cells || []).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
- if (!data)
567
- return undefined;
568
- // Set default example
569
- const defaultExample = Array.isArray(data.__valuesAst) && data.__valuesAst.length > 0 ? data.__valuesAst[0] : null;
570
- // NOTE: Node order is important and is defined here
571
- const node = Object.assign(Object.assign({ values: data.values || [], 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 });
572
- // Remove Unset Optionals
573
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
574
- ignoreAllFalse: true,
575
- ignoreEmptyArrays: ['instruction', 'item', 'values'],
576
- ignoreUndefined: ['example', 'isCaseSensitive'],
577
- });
578
- return node;
579
- }
580
- /**
581
- * Build pronunciation table node
582
- *
583
- * @param data - data for the node
584
- * @returns
585
- */
586
- buildPronunciationTable(context, dataIn) {
587
- if (!dataIn)
588
- return undefined;
589
- // NOTE: Node order is important and is defined here
590
- const node = {
591
- data: (dataIn.data || []).map((row) => (row || []).map((cell) => {
592
- // Process the audio resource
593
- const audio = this.resourceBuilder.resourceFromResourceJson(context, cell.audio);
594
- return {
595
- title: this.handleJsonText(context, TextLocation_1.TextLocation.tag, cell.title),
596
- body: this.handleJsonText(context, TextLocation_1.TextLocation.tag, cell.body),
597
- audio,
598
- };
599
- })),
600
- };
601
- // Remove Unset Optionals
602
- // ObjectUtils.removeUnwantedProperties(node, {
603
- // ignoreAllFalse: true,
604
- // });
605
- return node;
606
- }
607
- /**
608
- * Build table node
609
- *
610
- * @param data - data for the node
611
- * @returns
612
- */
613
- buildTable(context, dataIn) {
614
- if (!dataIn)
615
- return undefined;
616
- // NOTE: Node order is important and is defined here
617
- const node = {
618
- columns: (dataIn.columns || []).map((col) => this.handleJsonText(context, TextLocation_1.TextLocation.tag, col)),
619
- data: (dataIn.data || []).map((row) => (row || []).map((cell) => this.handleJsonText(context, TextLocation_1.TextLocation.tag, cell))),
620
- };
621
- // Remove Unset Optionals
622
- // ObjectUtils.removeUnwantedProperties(node, {
623
- // ignoreAllFalse: true,
624
- // });
625
- return node;
626
- }
627
- /**
628
- * Build question[] node
629
- *
630
- * @param data - data for the node
631
- * @returns
632
- */
633
- buildQuestions(context, data) {
634
- if (!Array.isArray(data))
635
- return undefined;
636
- const nodes = data.map((d) => this.buildQuestion(context, d)).filter((d) => d != null);
637
- return nodes.length > 0 ? nodes : undefined;
638
- }
639
- /**
640
- * Build question node
641
- *
642
- * @param data - data for the node
643
- * @returns
644
- */
645
- buildQuestion(context, data) {
646
- var _a, _b, _c, _d, _e;
647
- if (!data)
648
- return undefined;
649
- // Set default example
650
- const defaultExample = data.__sampleSolutionAst;
651
- // NOTE: Node order is important and is defined here
652
- 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 });
653
- // Remove Unset Optionals
654
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
655
- ignoreAllFalse: true,
656
- ignoreEmptyArrays: ['item', 'hint', 'instruction'],
657
- ignoreUndefined: ['example'],
658
- ignoreEmptyString: ['question', 'partialAnswer', 'sampleSolution'],
659
- });
660
- return node;
661
- }
662
- /**
663
- * Build ingredient[] node
664
- *
665
- * @param data - data for the node
666
- * @returns
667
- */
668
- buildIngredients(context, data) {
669
- if (!Array.isArray(data))
670
- return undefined;
671
- const nodes = data.map((d) => this.buildIngredient(context, d)).filter((d) => d != null);
672
- return nodes.length > 0 ? nodes : undefined;
673
- }
674
- /**
675
- * Build ingredient node
676
- *
677
- * @param data - data for the node
678
- * @returns
679
- */
680
- buildIngredient(context, data) {
681
- var _a, _b, _c, _d, _e, _f;
682
- if (!data)
683
- return undefined;
684
- // NOTE: Node order is important and is defined here
685
- const node = {
686
- title: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.title),
687
- checked: (_a = data.checked) !== null && _a !== void 0 ? _a : false,
688
- ingredient: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.ingredient),
689
- quantity: (_b = data.quantity) !== null && _b !== void 0 ? _b : 0,
690
- unit: (_c = data.unit) !== null && _c !== void 0 ? _c : '',
691
- unitAbbr: (_d = data.unitAbbr) !== null && _d !== void 0 ? _d : '',
692
- decimalPlaces: (_e = data.decimalPlaces) !== null && _e !== void 0 ? _e : 1,
693
- disableCalculation: (_f = data.disableCalculation) !== null && _f !== void 0 ? _f : false,
694
- item: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.item),
695
- lead: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.lead),
696
- hint: this.handleJsonText(context, TextLocation_1.TextLocation.tag, data.hint),
697
- };
698
- // Remove Unset Optionals
699
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
700
- ignoreAllFalse: true,
701
- // ignoreAllEmptyArrays: true,
702
- // ignoreUndefined: ['example'],
703
- ignoreEmptyString: ['item', 'unit'],
704
- });
705
- return node;
706
- }
707
- /**
708
- * Build body node
709
- * - Handles JSON, Bitmark text, and plain text
710
- * - body: set to either string, TextAst, or JSON
711
- * - bodyBits: set to array of BodyBitJson (will be validated and merged into body if it is a string)
712
- * - placeholders: set to placeholders from v2 JSON when body is a v2 JSON string
713
- * - bodyString: set to the original string if body is a string (only used for card body)
714
- *
715
- * @param data - data for the node
716
- * @returns
717
- */
718
- buildBody(context, data) {
719
- if (!data)
720
- return undefined;
721
- let body;
722
- const bodyBits = [];
723
- const placeholders = data.placeholders;
724
- const bodyString = data.bodyString;
725
- const { textFormat } = context;
726
- // Handle JSON type body
727
- const handleJsonBody = () => {
728
- // Attempt to parse a string body as JSON to support the legacy format
729
- if (typeof data.body === 'string') {
730
- try {
731
- body = JSON.parse(data.body);
732
- }
733
- catch (e) {
734
- // Could not parse JSON - set body to null
735
- body = null;
736
- }
737
- }
738
- else {
739
- body = data.body;
740
- }
741
- };
742
- // Handle Bitmark text type body (both AST v3 and plain text v2)
743
- const handleBitmarkTextBody = () => {
744
- var _a;
745
- let rawBody = data.body;
746
- let bodyStr;
747
- const placeholderNodes = {};
748
- // TODO - process body bits through the correct builders.
749
- if (StringUtils_1.StringUtils.isString(data.body)) {
750
- // Body is a string (legacy bitmark v2, or not bitmarkText)
751
- bodyStr = ((_a = data.body) !== null && _a !== void 0 ? _a : '').trim();
752
- rawBody = [];
753
- }
754
- else if (Array.isArray(data.body)) {
755
- // Body is an array (prosemirror like JSON)
756
- // Already in the correct format
757
- }
758
- else {
759
- // body is invalid
760
- rawBody = [];
761
- }
762
- if (placeholders) {
763
- for (const [key, val] of Object.entries(placeholders)) {
764
- // const bit = this.bodyBitToAst(val);
765
- // placeholderNodes[key] = bit as BodyBit;
766
- placeholderNodes[key] = val;
767
- }
768
- }
769
- if (bodyStr) {
770
- // Bug #7141: Use textFormat for textParser, not always bitmarkText if it is a v2 string body
771
- // However, only use plain text breakscaping the text from the v2 JSON body
772
- // Special v2 Breakscaping
773
- bodyStr = Breakscape_1.Breakscape.breakscape(bodyStr, {
774
- format: textFormat,
775
- location: TextLocation_1.TextLocation.body,
776
- v2: true,
777
- });
778
- // Convert placeholders {1} to [!1], etc.
779
- let index = 0;
780
- const newPlaceholderNodes = [];
781
- for (const [key, val] of Object.entries(placeholderNodes)) {
782
- if (bodyStr) {
783
- const newKey = `[!${index}]`;
784
- bodyStr = bodyStr.replace(`${key}`, newKey);
785
- newPlaceholderNodes.push(val);
786
- index++;
787
- }
788
- }
789
- // Convert the body string to AST
790
- rawBody = this.textParser.toAst(bodyStr, {
791
- format: textFormat,
792
- location: TextLocation_1.TextLocation.body,
793
- });
794
- const replaceBitsRecursive = (bodyText) => {
795
- for (let i = 0, len = bodyText.length; i < len; i++) {
796
- const bodyPart = bodyText[i];
797
- if (bodyPart.type === 'bit') {
798
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
799
- const index = bodyPart.index;
800
- if (newPlaceholderNodes[index] != null) {
801
- bodyText[i] = newPlaceholderNodes[index];
802
- }
803
- }
804
- else {
805
- if (bodyPart.content)
806
- replaceBitsRecursive(bodyPart.content);
807
- }
808
- }
809
- };
810
- // Replace the placeholders with the AST
811
- replaceBitsRecursive(rawBody);
812
- }
813
- // Process the body bits to ensure they are valid
814
- // Walking the body bits will change them, so we should make a copy before processing
815
- rawBody = (0, structured_clone_1.default)(rawBody);
816
- this.textParser.walkBodyBits(rawBody, (parent, index, bodyBit) => {
817
- // Ensure the body bit is valid
818
- let parsedBit;
819
- switch (bodyBit.type) {
820
- case BodyBitType_1.BodyBitType.gap:
821
- parsedBit = this.buildGap(context, bodyBit);
822
- break;
823
- case BodyBitType_1.BodyBitType.mark:
824
- parsedBit = this.buildMark(context, bodyBit);
825
- break;
826
- case BodyBitType_1.BodyBitType.select:
827
- parsedBit = this.buildSelect(context, bodyBit);
828
- break;
829
- case BodyBitType_1.BodyBitType.highlight:
830
- parsedBit = this.buildHighlight(context, bodyBit);
831
- break;
832
- default:
833
- // TODO?? Ensure other parts are valid
834
- }
835
- if (parsedBit != undefined) {
836
- parent[index] = parsedBit;
837
- bodyBits.push(parsedBit);
838
- }
839
- });
840
- // Set the body
841
- body = rawBody;
842
- // Mark the body as text
843
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
844
- body.__tag = 'text';
845
- };
846
- const handlePlainTextBody = () => {
847
- body = data.body;
848
- };
849
- const isBitmarkText = textFormat === TextFormat_1.TextFormat.bitmarkText;
850
- if (textFormat === TextFormat_1.TextFormat.json) {
851
- // JSON
852
- handleJsonBody();
853
- }
854
- else if (isBitmarkText) {
855
- // Bitmark text (either ast or string)
856
- handleBitmarkTextBody();
857
- }
858
- else {
859
- // Text but not bitmark (plain text)
860
- handlePlainTextBody();
861
- }
862
- const node = {
863
- body,
864
- bodyBits,
865
- bodyString,
866
- // Placeholders are only ever parsed into AST, never stored directly
867
- };
868
- return node;
869
- }
870
- /**
871
- * Build footer node
872
- *
873
- * @param data - data for the node
874
- * @returns
875
- */
876
- buildFooter(context, data) {
877
- if (!data)
878
- return undefined;
879
- const node = {
880
- footer: this.handleJsonText(context, TextLocation_1.TextLocation.body, data.footer),
881
- };
882
- return node;
883
- }
884
- /**
885
- * Build gap node
886
- *
887
- * @param data - data for the node
888
- * @returns
889
- */
890
- buildGap(context, data) {
891
- if (!data)
892
- return undefined;
893
- // Set default example
894
- const defaultExample = Array.isArray(data.__solutionsAst) && data.__solutionsAst.length > 0 ? data.__solutionsAst[0] : null;
895
- // Copy any attributes from 'attrs' to the body bit (data is in 'attrs' when coming from JSON)
896
- data = this.bodyBitCopyFromAttrs(data);
897
- // NOTE: Node order is important and is defined here
898
- const node = Object.assign(Object.assign({ type: BodyBitType_1.BodyBitType.gap, solutions: data.solutions || [], 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: {} });
899
- // Remove Unset Optionals
900
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
901
- ignoreAllFalse: true,
902
- ignoreAllEmptyArrays: true,
903
- ignoreUndefined: ['example', 'isCaseSensitive'],
904
- });
905
- return node;
906
- }
907
- /**
908
- * Build mark configs node
909
- *
910
- * @param data - data for the node
911
- * @returns
912
- */
913
- buildMarkConfigs(context, data) {
914
- if (!Array.isArray(data))
915
- return undefined;
916
- const nodes = data.map((d) => this.buildMarkConfig(context, d)).filter((d) => d != null);
917
- return nodes.length > 0 ? nodes : undefined;
918
- }
919
- /**
920
- * Build mark config node
921
- *
922
- * @param data - data for the node
923
- * @returns
924
- */
925
- buildMarkConfig(_context, data) {
926
- var _a, _b, _c;
927
- if (!data)
928
- return undefined;
929
- // NOTE: Node order is important and is defined here
930
- const node = {
931
- mark: (_a = data.mark) !== null && _a !== void 0 ? _a : 'unknown',
932
- color: (_b = data.color) !== null && _b !== void 0 ? _b : '',
933
- emphasis: (_c = data.emphasis) !== null && _c !== void 0 ? _c : '',
934
- };
935
- // Remove Unset Optionals
936
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
937
- ignoreAllEmptyString: true,
938
- });
939
- return node;
940
- }
941
- /**
942
- * Build mark node
943
- *
944
- * @param data - data for the node
945
- * @returns
946
- */
947
- buildMark(context, data) {
948
- var _a, _b;
949
- if (!data)
950
- return undefined;
951
- // Copy any attributes from 'attrs' to the body bit (data is in 'attrs' when coming from JSON)
952
- data = this.bodyBitCopyFromAttrs(data);
953
- // NOTE: Node order is important and is defined here
954
- 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: {} });
955
- // Remove Unset Optionals
956
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
957
- ignoreAllFalse: true,
958
- ignoreAllEmptyArrays: true,
959
- ignoreUndefined: ['example'],
960
- ignoreEmptyString: ['solution', 'mark'],
961
- });
962
- return node;
963
- }
964
- /**
965
- * Build select node
966
- *
967
- * @param data - data for the node
968
- * @returns
969
- */
970
- buildSelect(context, data) {
971
- var _a, _b;
972
- if (!data)
973
- return undefined;
974
- // Copy any attributes from 'attrs' to the body bit (data is in 'attrs' when coming from JSON)
975
- data = this.bodyBitCopyFromAttrs(data);
976
- // NOTE: Node order is important and is defined here
977
- const node = Object.assign(Object.assign({ type: BodyBitType_1.BodyBitType.select, options: this.buildSelectOptions(context, data.options) || [], prefix: (_a = data.prefix) !== null && _a !== void 0 ? _a : '', postfix: (_b = data.postfix) !== 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(false, undefined, undefined)), { __hintString: data.__hintString, __instructionString: data.__instructionString, attrs: {} });
978
- // Remove Unset Optionals
979
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
980
- ignoreAllFalse: true,
981
- ignoreAllEmptyArrays: true,
982
- ignoreEmptyString: ['prefix', 'postfix'],
983
- });
984
- return node;
985
- }
986
- /**
987
- * Build selectOption[] node
988
- *
989
- * @param data - data for the node
990
- * @returns
991
- */
992
- buildSelectOptions(context, data) {
993
- if (!Array.isArray(data))
994
- return undefined;
995
- const nodes = data.map((d) => this.buildSelectOption(context, d)).filter((d) => d != null);
996
- return nodes.length > 0 ? nodes : undefined;
997
- }
998
- /**
999
- * Build selectOption node
1000
- *
1001
- * @param data - data for the node
1002
- * @returns
1003
- */
1004
- buildSelectOption(context, data) {
1005
- var _a;
1006
- if (!data)
1007
- return undefined;
1008
- // NOTE: Node order is important and is defined here
1009
- 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));
1010
- // Remove Unset Optionals
1011
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
1012
- ignoreAllFalse: true,
1013
- ignoreAllEmptyArrays: true,
1014
- ignoreUndefined: ['example'],
1015
- });
1016
- return node;
1017
- }
1018
- /**
1019
- * Build highlight node
1020
- *
1021
- * @param data - data for the node
1022
- * @returns
1023
- */
1024
- buildHighlight(context, data) {
1025
- var _a, _b;
1026
- if (!data)
1027
- return undefined;
1028
- // Copy any attributes from 'attrs' to the body bit (data is in 'attrs' when coming from JSON)
1029
- data = this.bodyBitCopyFromAttrs(data);
1030
- // NOTE: Node order is important and is defined here
1031
- const node = Object.assign(Object.assign({ type: BodyBitType_1.BodyBitType.highlight, texts: this.buildHighlightTexts(context, data.texts) || [], prefix: (_a = data.prefix) !== null && _a !== void 0 ? _a : '', postfix: (_b = data.postfix) !== 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(false, undefined, undefined)), { attrs: {} });
1032
- // Remove Unset Optionals
1033
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
1034
- ignoreAllFalse: true,
1035
- ignoreAllEmptyArrays: true,
1036
- ignoreEmptyString: ['prefix', 'postfix'],
1037
- });
1038
- return node;
1039
- }
1040
- /**
1041
- * Build highlightText[] node
1042
- *
1043
- * @param data - data for the node
1044
- * @returns
1045
- */
1046
- buildHighlightTexts(context, data) {
1047
- if (!Array.isArray(data))
1048
- return undefined;
1049
- const nodes = data.map((d) => this.buildHighlightText(context, d)).filter((d) => d != null);
1050
- return nodes.length > 0 ? nodes : undefined;
1051
- }
1052
- /**
1053
- * Build highlightText node
1054
- *
1055
- * @param data - data for the node
1056
- * @returns
1057
- */
1058
- buildHighlightText(context, data) {
1059
- var _a;
1060
- if (!data)
1061
- return undefined;
1062
- // NOTE: Node order is important and is defined here
1063
- 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));
1064
- // Remove Unset Optionals
1065
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
1066
- ignoreAllFalse: true,
1067
- ignoreAllEmptyArrays: true,
1068
- ignoreUndefined: ['example'],
1069
- });
1070
- return node;
1071
- }
1072
- /**
1073
- * Build flashcards node
1074
- *
1075
- * @param data - data for the node
1076
- * @returns
1077
- */
1078
- buildFlashcards(context, data) {
1079
- if (!Array.isArray(data))
1080
- return undefined;
1081
- const nodes = data.map((d) => this.buildFlashcard(context, d)).filter((d) => d != null);
1082
- return nodes.length > 0 ? nodes : undefined;
1083
- }
1084
- /**
1085
- * Build flashcard node
1086
- *
1087
- * @param data - data for the node
1088
- * @returns
1089
- */
1090
- buildFlashcard(context, data) {
1091
- if (!data)
1092
- return undefined;
1093
- // NOTE: Node order is important and is defined here
1094
- const node = Object.assign({ question: this.buildTextAndIcon(context, data.question), answer: this.buildTextAndIcon(context, data.answer), alternativeAnswers: (data.alternativeAnswers || [])
1095
- .map((d) => this.buildTextAndIcon(context, d))
1096
- .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));
1097
- // Remove Unset Optionals
1098
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
1099
- ignoreAllFalse: true,
1100
- ignoreEmptyArrays: ['question', 'answer', 'alternativeAnswers', 'item', 'hint', 'instruction'],
1101
- ignoreUndefined: ['example'],
1102
- });
1103
- return node;
1104
- }
1105
- /**
1106
- * Build definitionListItem[] node
1107
- *
1108
- * @param data - data for the node
1109
- * @returns
1110
- */
1111
- buildDefinitionList(context, data) {
1112
- if (!Array.isArray(data))
1113
- return undefined;
1114
- const nodes = data.map((d) => this.buildDefinitionListItem(context, d)).filter((d) => d != null);
1115
- return nodes.length > 0 ? nodes : undefined;
1116
- }
1117
- /**
1118
- * Build definitionListItem node
1119
- *
1120
- * @param data - data for the node
1121
- * @returns
1122
- */
1123
- buildDefinitionListItem(context, data) {
1124
- if (!data)
1125
- return undefined;
1126
- const { bitType } = context;
1127
- const textAsStrings = Config_1.Config.isOfBitType(bitType, [BitType_1.BitType.metaSearchDefaultTerms]);
1128
- // NOTE: Node order is important and is defined here
1129
- const node = Object.assign({ term: this.buildTextAndIcon(context, data.term, textAsStrings), definition: this.buildTextAndIcon(context, data.definition, textAsStrings), alternativeDefinitions: (data.alternativeDefinitions || [])
1130
- .map((d) => this.buildTextAndIcon(context, d, textAsStrings))
1131
- .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));
1132
- // Remove Unset Optionals
1133
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
1134
- ignoreAllFalse: true,
1135
- ignoreEmptyArrays: ['question', 'answer', 'alternativeDefinitions', 'item', 'hint', 'instruction'],
1136
- ignoreUndefined: ['example'],
1137
- });
1138
- return node;
1139
- }
1140
- buildTextAndIcon(context, data, textAsStrings = false) {
1141
- const icon = this.resourceBuilder.resourceFromResourceJson(context, data === null || data === void 0 ? void 0 : data.icon);
1142
- // Ensure text is bitmark text
1143
- let text = this.handleJsonText(context, TextLocation_1.TextLocation.tag, (data === null || data === void 0 ? void 0 : data.text) || data);
1144
- if (textAsStrings) {
1145
- // Convert the bitmark text to plain text (without breakscaping, as that will happen in the Bitmark Generator)
1146
- text = this.textGenerator
1147
- .generateSync(text, TextFormat_1.TextFormat.plainText, TextLocation_1.TextLocation.body, {
1148
- noBreakscaping: true,
1149
- })
1150
- .trim();
1151
- }
1152
- // NOTE: Node order is important and is defined here
1153
- const node = {
1154
- text,
1155
- icon,
1156
- };
1157
- // Remove Unset Optionals
1158
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
1159
- ignoreEmptyArrays: ['text'],
1160
- ignoreUndefined: ['icon'],
1161
- });
1162
- return node;
1163
- }
1164
- /**
1165
- * Build statement[] node
1166
- *
1167
- * @param data - data for the node
1168
- * @returns
1169
- */
1170
- buildStatements(context, data) {
1171
- if (!Array.isArray(data))
1172
- return undefined;
1173
- const nodes = data.map((d) => this.buildStatement(context, d)).filter((d) => d != null);
1174
- return nodes.length > 0 ? nodes : undefined;
1175
- }
1176
- /**
1177
- * Build statement node
1178
- *
1179
- * @param data - data for the node
1180
- * @returns
1181
- */
1182
- buildStatement(context, data) {
1183
- var _a;
1184
- if (!data)
1185
- return undefined;
1186
- // NOTE: Node order is important and is defined here
1187
- 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));
1188
- // Remove Unset Optionals
1189
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
1190
- ignoreAllFalse: true,
1191
- // ignoreAllEmptyArrays: true,
1192
- ignoreUndefined: ['example'],
1193
- });
1194
- return node;
1195
- }
1196
- /**
1197
- * Build (image-on-device) imageSource node
1198
- *
1199
- * @param data - data for the node
1200
- * @returns
1201
- */
1202
- buildImageSource(_context, data) {
1203
- if (!data)
1204
- return undefined;
1205
- const { url, mockupId, size, format, trim } = data;
1206
- // NOTE: Node order is important and is defined here
1207
- const node = {
1208
- url: url !== null && url !== void 0 ? url : '',
1209
- mockupId: mockupId !== null && mockupId !== void 0 ? mockupId : '',
1210
- size: (size !== null && size !== void 0 ? size : null),
1211
- format: (format !== null && format !== void 0 ? format : null),
1212
- trim: (BooleanUtils_1.BooleanUtils.isBoolean(trim) ? trim : null),
1213
- };
1214
- // Remove Unset Optionals
1215
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
1216
- ignoreFalse: ['trim'],
1217
- ignoreEmptyString: ['url', 'mockupId'],
1218
- ignoreAllUndefined: true,
1219
- });
1220
- return node;
1221
- }
1222
- /**
1223
- * Build (chat) person node
1224
- *
1225
- * @param data - data for the node
1226
- * @returns
1227
- */
1228
- buildPerson(context, data) {
1229
- if (!data)
1230
- return undefined;
1231
- const { name, title, avatarImage } = data;
1232
- // { name: string; title?: string; avatarImage?: ImageResourceJson }
1233
- // NOTE: Node order is important and is defined here
1234
- const node = {
1235
- name: name !== null && name !== void 0 ? name : '',
1236
- title: (title !== null && title !== void 0 ? title : undefined),
1237
- avatarImage: this.resourceBuilder.resourceFromResourceJson(context, avatarImage),
1238
- };
1239
- // Remove Unset Optionals
1240
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
1241
- ignoreEmptyString: ['name'],
1242
- ignoreAllUndefined: true,
1243
- });
1244
- return node;
1245
- }
1246
- /**
1247
- * Build (cook-ingredients) technicalTerm node
1248
- *
1249
- * @param data - data for the node
1250
- * @returns
1251
- */
1252
- buildTechnicalTerm(_context, data) {
1253
- if (!data)
1254
- return undefined;
1255
- const { technicalTerm, lang } = data;
1256
- // NOTE: Node order is important and is defined here
1257
- const node = {
1258
- technicalTerm: technicalTerm !== null && technicalTerm !== void 0 ? technicalTerm : '',
1259
- lang: lang !== null && lang !== void 0 ? lang : '',
1260
- };
1261
- // Remove Unset Optionals
1262
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
1263
- ignoreEmptyString: ['technicalTerm'],
1264
- // ignoreAllUndefined: true,
1265
- });
1266
- return node;
1267
- }
1268
- /**
1269
- * Build (cook-ingredients) servings node
1270
- *
1271
- * @param data - data for the node
1272
- * @returns
1273
- */
1274
- buildServings(_context, data) {
1275
- if (!data)
1276
- return undefined;
1277
- const { servings, unit, unitAbbr, decimalPlaces, disableCalculation, hint } = data;
1278
- // NOTE: Node order is important and is defined here
1279
- const node = {
1280
- servings: servings !== null && servings !== void 0 ? servings : 0,
1281
- unit: unit !== null && unit !== void 0 ? unit : '',
1282
- unitAbbr: unitAbbr !== null && unitAbbr !== void 0 ? unitAbbr : '',
1283
- decimalPlaces: decimalPlaces !== null && decimalPlaces !== void 0 ? decimalPlaces : 1,
1284
- disableCalculation: disableCalculation !== null && disableCalculation !== void 0 ? disableCalculation : false,
1285
- hint: hint !== null && hint !== void 0 ? hint : '',
1286
- };
1287
- // Remove Unset Optionals
1288
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
1289
- ignoreEmptyString: ['servings', 'unit'],
1290
- // ignoreAllUndefined: true,
1291
- });
1292
- return node;
1293
- }
1294
- /**
1295
- * Build (survey-rating) ratingLevelStart / ratingLevelEnd node
1296
- *
1297
- * @param data - data for the node
1298
- * @returns
1299
- */
1300
- buildRatingLevelStartEnd(context, data) {
1301
- if (!data)
1302
- return undefined;
1303
- const { level, label } = data;
1304
- // NOTE: Node order is important and is defined here
1305
- const node = {
1306
- level: level !== null && level !== void 0 ? level : 0,
1307
- label: this.handleJsonText(context, TextLocation_1.TextLocation.tag, label),
1308
- };
1309
- // Remove Unset Optionals
1310
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
1311
- // ignoreEmptyArrays: ['servings', 'unit'],
1312
- // ignoreAllUndefined: true,
1313
- });
1314
- return node;
1315
- }
1316
- // DEPRECATED - TO BE REMOVED IN FUTURE
1317
- // /**
1318
- // * Build captionDefinition node
1319
- // *
1320
- // * @param data - data for the node
1321
- // * @returns
1322
- // */
1323
- // protected buildCaptionDefinition(
1324
- // _context: BuildContext,
1325
- // data: Partial<CaptionDefinitionJson> | undefined,
1326
- // ): CaptionDefinitionJson | undefined {
1327
- // if (!data) return undefined;
1328
- // // NOTE: Node order is important and is defined here
1329
- // const node: CaptionDefinitionJson = {
1330
- // // term: this.convertJsonTextToAstText(data.term),
1331
- // // description: this.convertJsonTextToAstText(data.description),
1332
- // term: data.term ?? '',
1333
- // definition: data.definition ?? '',
1334
- // };
1335
- // // Remove Unset Optionals
1336
- // ObjectUtils.removeUnwantedProperties(node, {
1337
- // ignoreEmptyString: ['term', 'description'],
1338
- // // ignoreAllUndefined: true,
1339
- // });
1340
- // return node;
1341
- // }
1342
- // /**
1343
- // * Build captionDefinitionList node
1344
- // *
1345
- // * @param data - data for the node
1346
- // * @returns
1347
- // */
1348
- // protected buildCaptionDefinitionList(
1349
- // context: BuildContext,
1350
- // data: Partial<CaptionDefinitionListJson> | undefined,
1351
- // ): CaptionDefinitionListJson | undefined {
1352
- // if (!data) return undefined;
1353
- // // NOTE: Node order is important and is defined here
1354
- // const node: CaptionDefinitionListJson = {
1355
- // columns: data.columns || [],
1356
- // definitions: (data.definitions || [])
1357
- // .map((d) => {
1358
- // return this.buildCaptionDefinition(context, {
1359
- // term: d.term,
1360
- // definition: d.definition,
1361
- // });
1362
- // })
1363
- // .filter((d) => d != null),
1364
- // };
1365
- // // Remove Unset Optionals
1366
- // ObjectUtils.removeUnwantedProperties(node, {
1367
- // ignoreAllEmptyArrays: true,
1368
- // });
1369
- // return node;
1370
- // }
1371
- /**
1372
- * Build card bit[] node
1373
- *
1374
- * @param data - data for the node
1375
- * @returns
1376
- */
1377
- buildCardBits(context, data) {
1378
- if (!Array.isArray(data))
1379
- return undefined;
1380
- const nodes = data.map((d) => this.buildCardBit(context, d)).filter((d) => d != null);
1381
- return nodes.length > 0 ? nodes : undefined;
1382
- }
1383
- /**
1384
- * Build card bit node
1385
- *
1386
- * @param data - data for the node
1387
- * @returns
1388
- */
1389
- buildCardBit(context, data) {
1390
- if (!data)
1391
- return undefined;
1392
- const { bitType, textFormat } = context;
1393
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1394
- const node = this.buildBit(Object.assign(Object.assign({}, data), { bitType, textFormat }));
1395
- // // NOTE: Node order is important and is defined here
1396
- // const node: CardBit = {
1397
- // item: this.handleJsonText(data.item),
1398
- // lead: this.handleJsonText(data.lead),
1399
- // hint: this.handleJsonText(data.hint),
1400
- // instruction: this.handleJsonText(data.instruction),
1401
- // ...this.toExample(data.__isDefaultExample, data.example),
1402
- // __isDefaultExample: data.__isDefaultExample ?? false,
1403
- // body: this.buildBody(textFormat, data.body),
1404
- // // Must always be last in the AST so key clashes are avoided correctly with other properties
1405
- // extraProperties: this.parseExtraProperties(data.extraProperties),
1406
- // };
1407
- // Remove Unset Optionals
1408
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
1409
- ignoreAllFalse: true,
1410
- // ignoreEmptyArrays: ['example'],
1411
- ignoreUndefined: ['example'],
1412
- });
1413
- // Validate and correct invalid bits as much as possible
1414
- return NodeValidator_1.NodeValidator.validateCardBit(node);
1415
- }
1416
- toImageResource(context, data) {
1417
- return ArrayUtils_1.ArrayUtils.asSingle(this.resourceBuilder.resourceFromResourceDataJson(context, ResourceTag_1.ResourceTag.image, data === null || data === void 0 ? void 0 : data.image));
1418
- }
1419
- //
1420
- // Private
1421
- //
1422
- buildCardNode(context, data) {
1423
- var _a;
1424
- const node = {
1425
- heading: this.buildHeading(context, data.heading),
1426
- questions: this.buildQuestions(context, data.questions),
1427
- elements: data.elements,
1428
- flashcards: this.buildFlashcards(context, data.flashcards),
1429
- definitions: this.buildDefinitionList(context, (_a = data.definitions) !== null && _a !== void 0 ? _a : data.legend),
1430
- statement: this.buildStatement(context, data.statement),
1431
- statements: this.buildStatements(context, data.statements),
1432
- choices: this.buildChoices(context, data.choices),
1433
- responses: this.buildResponses(context, data.responses),
1434
- feedbacks: this.buildFeedbacks(context, data.feedbacks),
1435
- quizzes: this.buildQuizzes(context, data.quizzes),
1436
- pairs: this.buildPairs(context, data.pairs),
1437
- matrix: this.buildMatricies(context, data.matrix),
1438
- pronunciationTable: this.buildPronunciationTable(context, data.pronunciationTable),
1439
- table: this.buildTable(context, data.table),
1440
- botResponses: this.buildBotResponses(context, data.botResponses),
1441
- ingredients: this.buildIngredients(context, data.ingredients),
1442
- // DEPRECATED - TO BE REMOVED IN FUTURE
1443
- // captionDefinitionList: this.buildCaptionDefinitionList(context, data.captionDefinitionList),
1444
- cardBits: this.buildCardBits(context, data.cardBits),
1445
- };
1446
- // Remove Unset Optionals
1447
- ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node);
1448
- return Object.keys(node).length > 0 ? node : undefined;
1449
- }
1450
- /**
1451
- * Copy any attributes from 'attrs' property to the root node (necessary when the input if from JSON)
1452
- * The values in 'attrs' will overwrite any existing values in the node
1453
- *
1454
- * The original object is not modified, a new object is returned
1455
- *
1456
- * @param data
1457
- */
1458
- bodyBitCopyFromAttrs(data) {
1459
- const copy = Object.assign({}, data);
1460
- // Copy any attributes from 'attrs' to the node (necessary when the input if from JSON)
1461
- if (data.attrs) {
1462
- for (const [key, value] of Object.entries(data.attrs)) {
1463
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1464
- copy[key] = value;
1465
- }
1466
- }
1467
- return copy;
1468
- }
1469
- /**
1470
- * Set examples down the tree
1471
- *
1472
- * @param body
1473
- * @param cardNode
1474
- * @param __isDefaultExample
1475
- * @param example
1476
- * @returns true if any of the answers has an example, otherwise undefined
1477
- */
1478
- pushExampleDownTree(context, body, cardNode, __isDefaultExample, example) {
1479
- if (__isDefaultExample || example != null) {
1480
- if (cardNode) {
1481
- this.pushExampleDownTreeString(context, __isDefaultExample, example, cardNode.pairs);
1482
- this.pushExampleDownTreeBoolean(context, __isDefaultExample, example, false, cardNode.flashcards);
1483
- this.pushExampleDownTreeBoolean(context, __isDefaultExample, example, false, cardNode.definitions);
1484
- this.pushExampleDownTreeBoolean(context, __isDefaultExample, example, true, cardNode.choices);
1485
- this.pushExampleDownTreeBoolean(context, __isDefaultExample, example, false, cardNode.responses, cardNode.statements, cardNode.statement);
1486
- if (cardNode.quizzes) {
1487
- for (const quiz of cardNode.quizzes) {
1488
- this.pushExampleDownTreeBoolean(context, __isDefaultExample, example, true, quiz.choices);
1489
- this.pushExampleDownTreeBoolean(context, __isDefaultExample, example, false, quiz.responses);
1490
- }
1491
- }
1492
- if (cardNode.matrix) {
1493
- for (const m of cardNode.matrix) {
1494
- this.pushExampleDownTreeString(context, __isDefaultExample, example, m.cells);
1495
- }
1496
- }
1497
- }
1498
- if (body) {
1499
- this.pushExampleDownTreeBodyBits(context, __isDefaultExample, example, body);
1500
- }
1501
- }
1502
- }
1503
- /**
1504
- * Set examples for boolean nodes
1505
- *
1506
- * @param __isDefaultExample
1507
- * @param example
1508
- * @param onlyCorrect
1509
- * @param nodes
1510
- * @returns true if any of the answers has an example, otherwise undefined
1511
- */
1512
- pushExampleDownTreeBoolean(_context, __isDefaultExample, example, onlyCorrect, ...nodes) {
1513
- if (!__isDefaultExample && example == null)
1514
- return;
1515
- if (Array.isArray(nodes)) {
1516
- for (const ds of nodes) {
1517
- if (ds) {
1518
- const exampleNodes = Array.isArray(ds) ? ds : [ds];
1519
- BitUtils_1.BitUtils.fillBooleanExample(exampleNodes, __isDefaultExample, example, onlyCorrect);
1520
- }
1521
- }
1522
- }
1523
- }
1524
- /**
1525
- * Set examples for string nodes
1526
- *
1527
- * @param __isDefaultExample
1528
- * @param example
1529
- * @param nodes
1530
- * @returns true if any of the answers has an example, otherwise undefined
1531
- */
1532
- pushExampleDownTreeString(context, __isDefaultExample, example, ...nodes) {
1533
- if (!__isDefaultExample && !example)
1534
- return;
1535
- if (Array.isArray(nodes)) {
1536
- for (const ds of nodes) {
1537
- if (ds) {
1538
- const exampleNodes = Array.isArray(ds) ? ds : [ds];
1539
- BitUtils_1.BitUtils.fillStringExample(context.textFormat, exampleNodes, __isDefaultExample, example, false);
1540
- }
1541
- }
1542
- }
1543
- }
1544
- pushExampleDownTreeBodyBits(context, __isDefaultExample, example, body) {
1545
- if (!__isDefaultExample && !example)
1546
- return;
1547
- const bodyBitsJson = this.textParser.extractBodyBits(body === null || body === void 0 ? void 0 : body.body);
1548
- for (const part of bodyBitsJson) {
1549
- if (part) {
1550
- switch (part.type) {
1551
- case BodyBitType_1.BodyBitType.gap: {
1552
- const gap = part;
1553
- BitUtils_1.BitUtils.fillStringExample(context.textFormat, [gap], __isDefaultExample, example, false);
1554
- break;
1555
- }
1556
- case BodyBitType_1.BodyBitType.mark: {
1557
- const mark = part;
1558
- BitUtils_1.BitUtils.fillBooleanExample([mark], __isDefaultExample, example, false);
1559
- break;
1560
- }
1561
- case BodyBitType_1.BodyBitType.select: {
1562
- const select = part;
1563
- BitUtils_1.BitUtils.fillBooleanExample(select.options, __isDefaultExample, example, true);
1564
- break;
1565
- }
1566
- case BodyBitType_1.BodyBitType.highlight: {
1567
- const highlight = part;
1568
- BitUtils_1.BitUtils.fillBooleanExample(highlight.texts, __isDefaultExample, example, true);
1569
- break;
1570
- }
1571
- }
1572
- }
1573
- }
1574
- }
1575
- /**
1576
- * Push a value down the tree, without overriding existing values
1577
- *
1578
- * This function is not type safe and should be used with care
1579
- *
1580
- * @param body/body[] set if the value should be passed down the body to the body bits / card body bits
1581
- * @param bodyBitTypes body bit types to push the value down to
1582
- * @param cardNode set if the value should be passed down the card node
1583
- * @param path path for the value
1584
- * @param value the value to push down
1585
- */
1586
- pushDownTree(_context, body, bodyBitTypes, cardNode, cardNodePath, path, value) {
1587
- if (value === undefined)
1588
- return;
1589
- // Add value to card nodes if required
1590
- if (cardNode && cardNodePath) {
1591
- if (!Array.isArray(cardNodePath))
1592
- cardNodePath = [cardNodePath];
1593
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1594
- const data = ObjectUtils_1.ObjectUtils.flatMapPath(cardNode, cardNodePath);
1595
- for (const d of data) {
1596
- if (d[path] == null) {
1597
- d[path] = value;
1598
- }
1599
- }
1600
- }
1601
- // Add value to body bit types if required
1602
- if (body) {
1603
- const bodyArray = (Array.isArray(body) ? body : [body]);
1604
- for (const b of bodyArray) {
1605
- if (b && b.body && bodyBitTypes) {
1606
- const bodyBitsJson = this.textParser.extractBodyBits(b.body);
1607
- if (bodyBitTypes && bodyBitsJson && bodyBitsJson.length > 0) {
1608
- for (const part of bodyBitsJson) {
1609
- if (part) {
1610
- if (bodyBitTypes.indexOf(part.type) !== -1) {
1611
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1612
- const data = part;
1613
- if (data[path] == null) {
1614
- data[path] = value;
1615
- }
1616
- }
1617
- }
1618
- }
1619
- }
1620
- }
1621
- }
1622
- }
1623
- }
1624
- parseExtraProperties(extraProperties) {
1625
- if (!extraProperties)
1626
- return undefined;
1627
- const entries = Object.entries(extraProperties);
1628
- if (entries.length === 0)
1629
- return undefined;
1630
- const res = {};
1631
- for (const [key, value] of entries) {
1632
- res[key] = ArrayUtils_1.ArrayUtils.asArray(value) || [value];
1633
- }
1634
- return res;
1635
- }
1636
- /**
1637
- * Set the 'isExample' flags on the bit
1638
- *
1639
- * The flag is set if the bit has an example. The flag is set at each branch level up the tree from
1640
- * where the 'example' exists.
1641
- *
1642
- * @param bit
1643
- */
1644
- setIsExampleFlags(bit) {
1645
- // bit.isExample = false;
1646
- const checkIsExample = (example) => {
1647
- if (!example)
1648
- return false;
1649
- if ( /*example.__isDefaultExample ||*/example.isExample || example.example != undefined) {
1650
- example.isExample = true;
1651
- bit.isExample = true;
1652
- }
1653
- else {
1654
- if (example === bit) {
1655
- example.isExample = !!bit.isExample;
1656
- }
1657
- else {
1658
- example.isExample = false;
1659
- }
1660
- }
1661
- return example.isExample;
1662
- };
1663
- const { body, cardNode } = bit;
1664
- // Body bit level
1665
- const bodyBitsJson = this.textParser.extractBodyBits(body === null || body === void 0 ? void 0 : body.body);
1666
- for (const bodyPart of bodyBitsJson) {
1667
- switch (bodyPart.type) {
1668
- case BodyBitType_1.BodyBitType.gap:
1669
- case BodyBitType_1.BodyBitType.mark: {
1670
- checkIsExample(bodyPart);
1671
- break;
1672
- }
1673
- case BodyBitType_1.BodyBitType.select: {
1674
- const select = bodyPart;
1675
- let hasExample = false;
1676
- for (const option of select.options) {
1677
- hasExample = checkIsExample(option) ? true : hasExample;
1678
- }
1679
- select.isExample = hasExample;
1680
- break;
1681
- }
1682
- case BodyBitType_1.BodyBitType.highlight: {
1683
- const highlight = bodyPart;
1684
- let hasExample = false;
1685
- for (const text of highlight.texts) {
1686
- hasExample = checkIsExample(text) ? true : hasExample;
1687
- }
1688
- highlight.isExample = hasExample;
1689
- break;
1690
- }
1691
- }
1692
- }
1693
- // Card level
1694
- if (cardNode) {
1695
- // flashcards
1696
- for (const v of cardNode.flashcards || []) {
1697
- checkIsExample(v);
1698
- }
1699
- // definitions
1700
- for (const v of cardNode.definitions || []) {
1701
- checkIsExample(v);
1702
- }
1703
- // pairs
1704
- for (const v of cardNode.pairs || []) {
1705
- checkIsExample(v);
1706
- }
1707
- // matrix
1708
- for (const mx of cardNode.matrix || []) {
1709
- let hasExample = false;
1710
- // matrix cell
1711
- for (const v of mx.cells || []) {
1712
- hasExample = checkIsExample(v) ? true : hasExample;
1713
- }
1714
- mx.isExample = hasExample;
1715
- }
1716
- // quizzes
1717
- for (const quiz of cardNode.quizzes || []) {
1718
- let hasExample = false;
1719
- // responses
1720
- for (const v of quiz.responses || []) {
1721
- hasExample = checkIsExample(v) ? true : hasExample;
1722
- }
1723
- // choices
1724
- for (const v of quiz.choices || []) {
1725
- hasExample = checkIsExample(v) ? true : hasExample;
1726
- }
1727
- quiz.isExample = hasExample;
1728
- }
1729
- // responses
1730
- for (const v of cardNode.responses || []) {
1731
- checkIsExample(v);
1732
- }
1733
- // choices
1734
- for (const v of cardNode.choices || []) {
1735
- checkIsExample(v);
1736
- }
1737
- // statements
1738
- for (const v of cardNode.statements || []) {
1739
- checkIsExample(v);
1740
- }
1741
- // statement
1742
- checkIsExample(cardNode.statement);
1743
- // NO: elements
1744
- // questions
1745
- for (const v of cardNode.questions || []) {
1746
- checkIsExample(v);
1747
- }
1748
- }
1749
- // Bit level
1750
- // statement
1751
- checkIsExample(bit.statement);
1752
- // responses
1753
- for (const v of bit.responses || []) {
1754
- checkIsExample(v);
1755
- }
1756
- // choices
1757
- for (const v of bit.choices || []) {
1758
- checkIsExample(v);
1759
- }
1760
- // Bit itself
1761
- checkIsExample(bit);
1762
- }
1763
- setDefaultBitValues(bit) {
1764
- // Set aiGenerated == true for all AI generated bits
1765
- switch (bit.bitType) {
1766
- case BitType_1.BitType.articleAi:
1767
- case BitType_1.BitType.noteAi:
1768
- case BitType_1.BitType.summaryAi:
1769
- bit.aiGenerated = this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.aiGenerated, true);
1770
- break;
1771
- }
1772
- }
1773
- addVersionToParserInfo(bit) {
1774
- var _a;
1775
- const parser = (_a = bit.parser) !== null && _a !== void 0 ? _a : {};
1776
- parser.version = Env_1.env.appVersion.full;
1777
- bit.parser = parser;
1778
- }
1779
- }
1780
- exports.Builder = Builder;
1781
- //# sourceMappingURL=Builder.js.map