@loopstack/loopstack-studio 0.25.0 → 0.25.2

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 (196) hide show
  1. package/dist/components/ai-elements/message.js +2 -2
  2. package/dist/components/ai-elements/reasoning.js +9 -9
  3. package/dist/loopstack-studio.css +1 -1
  4. package/dist/node_modules/@chevrotain/gast/lib/src/helpers.js +2 -5
  5. package/dist/node_modules/@chevrotain/gast/lib/src/model.js +69 -72
  6. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{architecture-7HQA4BMR.js → architecture-YZFGNWBL.js} +2 -2
  7. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-TQ3KTPDO.js → chunk-2KRD3SAO.js} +1 -1
  8. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-4F5CHEZ2.js → chunk-67CJDMHE.js} +1 -1
  9. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-UMXZTB3W.js → chunk-7N4EOEYR.js} +5 -2
  10. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-PL6DKKU2.js → chunk-AA7GKIK3.js} +1 -1
  11. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-CIAEETIT.js +23 -0
  12. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-SJTYNZTY.js → chunk-FOC6F5B3.js} +1 -1
  13. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-K5T4RW27.js +1197 -0
  14. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-FRFDVMJY.js → chunk-KGLVRYIC.js} +1 -1
  15. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-B2363JML.js → chunk-LIHQZDEY.js} +1 -1
  16. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-ORNJ4GCN.js +29 -0
  17. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{gitGraph-G5XIXVHT.js → gitGraph-7Q5UKJZL.js} +2 -2
  18. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/info-OMHHGYJF.js +3 -0
  19. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/packet-4T2RLAQJ.js +3 -0
  20. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/pie-ZZUOXDRM.js +3 -0
  21. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/radar-PYXPWWZC.js +3 -0
  22. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/treeView-SZITEDCU.js +3 -0
  23. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/treemap-W4RFUUIX.js +3 -0
  24. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/wardley-RL74JXVD.js +3 -0
  25. package/dist/node_modules/@mermaid-js/parser/dist/mermaid-parser.core.js +27 -17
  26. package/dist/node_modules/@upsetjs/venn.js/build/venn.esm.js +903 -0
  27. package/dist/node_modules/@xyflow/react/dist/esm/index.js +76 -75
  28. package/dist/node_modules/@xyflow/system/dist/esm/index.js +30 -28
  29. package/dist/node_modules/chevrotain/lib/src/parse/cst/cst_visitor.js +31 -40
  30. package/dist/node_modules/chevrotain/lib/src/parse/errors_public.js +23 -26
  31. package/dist/node_modules/chevrotain/lib/src/parse/exceptions_public.js +12 -13
  32. package/dist/node_modules/chevrotain/lib/src/parse/grammar/checks.js +181 -205
  33. package/dist/node_modules/chevrotain/lib/src/parse/grammar/first.js +11 -13
  34. package/dist/node_modules/chevrotain/lib/src/parse/grammar/follow.js +12 -13
  35. package/dist/node_modules/chevrotain/lib/src/parse/grammar/gast/gast_resolver_public.js +8 -9
  36. package/dist/node_modules/chevrotain/lib/src/parse/grammar/interpreter.js +176 -183
  37. package/dist/node_modules/chevrotain/lib/src/parse/grammar/llk_lookahead.js +17 -19
  38. package/dist/node_modules/chevrotain/lib/src/parse/grammar/lookahead.js +153 -160
  39. package/dist/node_modules/chevrotain/lib/src/parse/grammar/resolver.js +10 -12
  40. package/dist/node_modules/chevrotain/lib/src/parse/grammar/rest.js +36 -38
  41. package/dist/node_modules/chevrotain/lib/src/parse/parser/parser.js +37 -45
  42. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/error_handler.js +12 -14
  43. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/gast_recorder.js +80 -86
  44. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/lexer_adapter.js +6 -2
  45. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/looksahead.js +39 -41
  46. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/perf_tracer.js +7 -8
  47. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_api.js +69 -70
  48. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_engine.js +215 -205
  49. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/recoverable.js +76 -76
  50. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/tree_builder.js +29 -39
  51. package/dist/node_modules/chevrotain/lib/src/scan/lexer.js +252 -274
  52. package/dist/node_modules/chevrotain/lib/src/scan/lexer_public.js +93 -106
  53. package/dist/node_modules/chevrotain/lib/src/scan/reg_exp.js +61 -61
  54. package/dist/node_modules/chevrotain/lib/src/scan/tokens.js +31 -41
  55. package/dist/node_modules/chevrotain/lib/src/scan/tokens_public.js +15 -18
  56. package/dist/node_modules/chevrotain-allstar/lib/all-star-lookahead.js +226 -226
  57. package/dist/node_modules/chevrotain-allstar/lib/atn.js +17 -17
  58. package/dist/node_modules/cytoscape/dist/cytoscape.esm.js +17 -14
  59. package/dist/node_modules/dagre-d3-es/src/dagre/greedy-fas.js +19 -19
  60. package/dist/node_modules/dagre-d3-es/src/dagre/layout.js +48 -48
  61. package/dist/node_modules/dagre-d3-es/src/dagre/nesting-graph.js +9 -9
  62. package/dist/node_modules/dagre-d3-es/src/dagre/order/cross-count.js +3 -3
  63. package/dist/node_modules/dagre-d3-es/src/dagre/order/index.js +11 -11
  64. package/dist/node_modules/dagre-d3-es/src/dagre/order/init-order.js +4 -4
  65. package/dist/node_modules/dagre-d3-es/src/dagre/order/resolve-conflicts.js +4 -4
  66. package/dist/node_modules/dagre-d3-es/src/dagre/order/sort-subgraph.js +8 -8
  67. package/dist/node_modules/dagre-d3-es/src/dagre/order/sort.js +5 -5
  68. package/dist/node_modules/dagre-d3-es/src/dagre/position/bk.js +61 -61
  69. package/dist/node_modules/dagre-d3-es/src/dagre/position/index.js +1 -1
  70. package/dist/node_modules/dagre-d3-es/src/dagre/rank/network-simplex.js +25 -25
  71. package/dist/node_modules/dagre-d3-es/src/dagre/rank/util.js +8 -8
  72. package/dist/node_modules/dagre-d3-es/src/dagre/util.js +48 -48
  73. package/dist/node_modules/dagre-d3-es/src/graphlib/graph.js +109 -109
  74. package/dist/node_modules/dagre-d3-es/src/graphlib/json.js +17 -17
  75. package/dist/node_modules/dompurify/dist/purify.es.js +67 -67
  76. package/dist/node_modules/katex/dist/katex.js +1256 -1209
  77. package/dist/node_modules/khroma/dist/methods/transparentize.js +3 -0
  78. package/dist/node_modules/lodash-es/_baseClone.js +2 -2
  79. package/dist/node_modules/lodash-es/_baseMatchesProperty.js +6 -6
  80. package/dist/node_modules/lodash-es/_baseToString.js +1 -1
  81. package/dist/node_modules/lodash-es/_baseUniq.js +1 -1
  82. package/dist/node_modules/lodash-es/_createSet.js +1 -1
  83. package/dist/node_modules/lodash-es/_getAllKeys.js +2 -2
  84. package/dist/node_modules/lodash-es/_getAllKeysIn.js +1 -1
  85. package/dist/node_modules/lodash-es/findIndex.js +2 -2
  86. package/dist/node_modules/lodash-es/flatMap.js +1 -1
  87. package/dist/node_modules/lodash-es/forEach.js +1 -1
  88. package/dist/node_modules/lodash-es/max.js +1 -1
  89. package/dist/node_modules/lodash-es/min.js +1 -1
  90. package/dist/node_modules/lodash-es/minBy.js +1 -1
  91. package/dist/node_modules/lodash-es/reduce.js +1 -1
  92. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/architectureDiagram-Q4EWVU46.js +691 -0
  93. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{blockDiagram-VD42YOAC.js → blockDiagram-DXYQGD6D.js} +183 -157
  94. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{c4Diagram-YG6GDRKO.js → c4Diagram-AHTNJAMY.js} +65 -63
  95. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-336JU56O.js +47 -0
  96. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-EXTU4WIE.js → chunk-426QAEUC.js} +1 -1
  97. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-B4BG7PRW.js → chunk-4TB4RGXK.js} +533 -393
  98. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-5FUZZQ4R.js +3638 -0
  99. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-S3R3BYOJ.js → chunk-5PVQY5BW.js} +1 -1
  100. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-HN2XXSSU.js → chunk-BSJP7CBP.js} +20 -14
  101. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-QN33PNHL.js → chunk-EDXVE4YY.js} +1 -1
  102. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ENJZ2VHE.js +568 -0
  103. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ICPOFSXX.js +2320 -0
  104. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-DI55MBZ5.js → chunk-OYMX7WX6.js} +35 -21
  105. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-U2HBQHQK.js +272 -0
  106. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-ATLVNIR6.js → chunk-X2U36JSP.js} +1 -1
  107. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-MI3HLSF2.js → chunk-XPW4576I.js} +11 -7
  108. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-YZCP3GAM.js +60 -0
  109. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ZZ45TVLE.js +30 -0
  110. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{classDiagram-2ON5EDUG.js → classDiagram-6PBFFD2Q.js} +12 -11
  111. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{classDiagram-v2-WZHVMYZB.js → classDiagram-v2-HSJHXN6E.js} +12 -11
  112. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{dagre-6UL2VRFP.js → dagre-KV5264BT.js} +8 -8
  113. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-5BDNPKRD.js +99 -0
  114. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{diagram-PSM6KHXK.js → diagram-G4DWMVQ6.js} +20 -23
  115. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-MMDJMWI5.js +211 -0
  116. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{diagram-S2PKOQOG.js → diagram-TYMM5635.js} +4 -4
  117. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{erDiagram-Q2GNP2WA.js → erDiagram-SMLLAGMA.js} +486 -386
  118. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{flowDiagram-NV44I4VS.js → flowDiagram-DWJPFMVM.js} +915 -898
  119. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{ganttDiagram-JELNMOA3.js → ganttDiagram-T4ZO3ILL.js} +59 -29
  120. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/gitGraphDiagram-UUTBAWPF.js +728 -0
  121. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/infoDiagram-42DDH7IO.js +17 -0
  122. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/ishikawaDiagram-UXIWVN3A.js +714 -0
  123. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{journeyDiagram-XKPGCS4Q.js → journeyDiagram-VCZTEJTY.js} +32 -32
  124. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{kanban-definition-3W4ZIXB7.js → kanban-definition-6JOO6SKY.js} +13 -9
  125. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{mindmap-definition-VGOIOE7T.js → mindmap-definition-QFDTVHPH.js} +105 -59
  126. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/pieDiagram-DEJITSTG.js +117 -0
  127. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{quadrantDiagram-AYHSOK5B.js → quadrantDiagram-34T5L4WZ.js} +1 -1
  128. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{requirementDiagram-UZGBJVZJ.js → requirementDiagram-MS252O5E.js} +49 -19
  129. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{sankeyDiagram-TZEHDZUN.js → sankeyDiagram-XADWPNL6.js} +1 -1
  130. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-FGHM5R23.js +4155 -0
  131. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{stateDiagram-FKZM4ZOC.js → stateDiagram-FHFEXIEX.js} +12 -12
  132. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{stateDiagram-v2-4FDKWEC3.js → stateDiagram-v2-QKLJ7IA2.js} +11 -11
  133. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/timeline-definition-GMOUNBTQ.js +1071 -0
  134. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/vennDiagram-DHZGUBPP.js +959 -0
  135. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/wardleyDiagram-NUSXRM2D.js +574 -0
  136. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{xychartDiagram-PRI3JC2R.js → xychartDiagram-5P7HB3ND.js} +38 -35
  137. package/dist/node_modules/mermaid/dist/mermaid.core.js +235 -192
  138. package/dist/node_modules/nanoid/url-alphabet/index.js +1 -1
  139. package/dist/node_modules/remend/dist/index.js +333 -264
  140. package/dist/node_modules/streamdown/dist/chunk-BO2N2NFS.js +2498 -0
  141. package/dist/node_modules/streamdown/dist/highlighted-body-OFNGDK62.js +35 -0
  142. package/dist/node_modules/streamdown/dist/index.js +1 -1
  143. package/dist/node_modules/streamdown/dist/mermaid-GHXKKRXX.js +3 -0
  144. package/dist/node_modules/streamdown/node_modules/marked/lib/marked.esm.js +672 -667
  145. package/dist/pages/DashboardPage.js +3 -3
  146. package/package.json +2 -2
  147. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-TCCFYFTB.js +0 -787
  148. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/info-VBDWY6EO.js +0 -3
  149. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/packet-DYOGHKS2.js +0 -3
  150. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/pie-VRWISCQL.js +0 -3
  151. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/radar-ZZBFDIW7.js +0 -3
  152. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/treemap-GDKQZRPO.js +0 -3
  153. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/context_assist.js +0 -16
  154. package/dist/node_modules/lodash-es/_arrayAggregator.js +0 -9
  155. package/dist/node_modules/lodash-es/_arrayEvery.js +0 -6
  156. package/dist/node_modules/lodash-es/_baseAggregator.js +0 -8
  157. package/dist/node_modules/lodash-es/_baseDifference.js +0 -22
  158. package/dist/node_modules/lodash-es/_baseEvery.js +0 -9
  159. package/dist/node_modules/lodash-es/_baseIsRegExp.js +0 -8
  160. package/dist/node_modules/lodash-es/_baseSlice.js +0 -8
  161. package/dist/node_modules/lodash-es/_baseSome.js +0 -9
  162. package/dist/node_modules/lodash-es/_createAggregator.js +0 -12
  163. package/dist/node_modules/lodash-es/assign.js +0 -14
  164. package/dist/node_modules/lodash-es/compact.js +0 -9
  165. package/dist/node_modules/lodash-es/difference.js +0 -8
  166. package/dist/node_modules/lodash-es/drop.js +0 -8
  167. package/dist/node_modules/lodash-es/dropRight.js +0 -8
  168. package/dist/node_modules/lodash-es/every.js +0 -11
  169. package/dist/node_modules/lodash-es/groupBy.js +0 -6
  170. package/dist/node_modules/lodash-es/head.js +0 -5
  171. package/dist/node_modules/lodash-es/includes.js +0 -13
  172. package/dist/node_modules/lodash-es/indexOf.js +0 -11
  173. package/dist/node_modules/lodash-es/isRegExp.js +0 -5
  174. package/dist/node_modules/lodash-es/negate.js +0 -16
  175. package/dist/node_modules/lodash-es/pickBy.js +0 -15
  176. package/dist/node_modules/lodash-es/reject.js +0 -10
  177. package/dist/node_modules/lodash-es/some.js +0 -11
  178. package/dist/node_modules/lodash-es/uniq.js +0 -6
  179. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/architectureDiagram-VXUJARFQ.js +0 -673
  180. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ABZYJK2D.js +0 -1547
  181. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-CVBHYZKI.js +0 -10
  182. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-DR5Q36YT.js +0 -135
  183. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-JA3XYJ7Z.js +0 -247
  184. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-JZLCHNYA.js +0 -3516
  185. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-N4CR4FBY.js +0 -39
  186. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-QXUST7PY.js +0 -497
  187. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-TZMSLE5B.js +0 -55
  188. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-QEK2KX5R.js +0 -211
  189. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/gitGraphDiagram-V2S2FVAM.js +0 -621
  190. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/infoDiagram-HS3SLOUP.js +0 -18
  191. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/pieDiagram-ADFJNKIX.js +0 -117
  192. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-WL72ISMW.js +0 -3560
  193. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/timeline-definition-IT6M3QCI.js +0 -833
  194. package/dist/node_modules/streamdown/dist/chunk-RLXIAIE6.js +0 -2189
  195. package/dist/node_modules/streamdown/dist/highlighted-body-B3W2YXNL.js +0 -33
  196. package/dist/node_modules/streamdown/dist/mermaid-3ZIDBTTL.js +0 -3
@@ -1,16 +1,3 @@
1
- import isArray_default from "../../../../lodash-es/isArray.js";
2
- import identity_default from "../../../../lodash-es/identity.js";
3
- import isEmpty_default from "../../../../lodash-es/isEmpty.js";
4
- import noop_default from "../../../../lodash-es/noop.js";
5
- import keys_default from "../../../../lodash-es/keys.js";
6
- import assign_default from "../../../../lodash-es/assign.js";
7
- import clone_default from "../../../../lodash-es/clone.js";
8
- import last_default from "../../../../lodash-es/last.js";
9
- import forEach_default from "../../../../lodash-es/forEach.js";
10
- import map_default from "../../../../lodash-es/map.js";
11
- import isUndefined_default from "../../../../lodash-es/isUndefined.js";
12
- import reduce_default from "../../../../lodash-es/reduce.js";
13
- import reject_default from "../../../../lodash-es/reject.js";
14
1
  import { PRINT_WARNING } from "../../../../@chevrotain/utils/lib/src/print.js";
15
2
  import { timer } from "../../../../@chevrotain/utils/lib/src/timer.js";
16
3
  import { toFastProperties } from "../../../../@chevrotain/utils/lib/src/to-fast-properties.js";
@@ -36,69 +23,69 @@ var DEFAULT_LEXER_CONFIG = {
36
23
  };
37
24
  Object.freeze(DEFAULT_LEXER_CONFIG);
38
25
  var Lexer = class {
39
- constructor(s, b = DEFAULT_LEXER_CONFIG) {
40
- if (this.lexerDefinition = s, this.lexerDefinitionErrors = [], this.lexerDefinitionWarning = [], this.patternIdxToConfig = {}, this.charCodeToPatternIdxToConfig = {}, this.modes = [], this.emptyGroups = {}, this.trackStartLines = !0, this.trackEndLines = !0, this.hasCustom = !1, this.canModeBeOptimized = {}, this.TRACE_INIT = (e, t) => {
26
+ constructor(s, c = DEFAULT_LEXER_CONFIG) {
27
+ if (this.lexerDefinition = s, this.lexerDefinitionErrors = [], this.lexerDefinitionWarning = [], this.patternIdxToConfig = {}, this.charCodeToPatternIdxToConfig = {}, this.modes = [], this.emptyGroups = {}, this.trackStartLines = !0, this.trackEndLines = !0, this.hasCustom = !1, this.canModeBeOptimized = {}, this.TRACE_INIT = (e, n) => {
41
28
  if (this.traceInitPerf === !0) {
42
29
  this.traceInitIndent++;
43
- let n = Array(this.traceInitIndent + 1).join(" ");
44
- this.traceInitIndent < this.traceInitMaxIdent && console.log(`${n}--> <${e}>`);
45
- let { time: r, value: i } = timer(t), a = r > 10 ? console.warn : console.log;
46
- return this.traceInitIndent < this.traceInitMaxIdent && a(`${n}<-- <${e}> time: ${r}ms`), this.traceInitIndent--, i;
47
- } else return t();
48
- }, typeof b == "boolean") throw Error("The second argument to the Lexer constructor is now an ILexerConfig Object.\na boolean 2nd argument is no longer supported");
49
- this.config = assign_default({}, DEFAULT_LEXER_CONFIG, b);
50
- let x = this.config.traceInitPerf;
51
- x === !0 ? (this.traceInitMaxIdent = Infinity, this.traceInitPerf = !0) : typeof x == "number" && (this.traceInitMaxIdent = x, this.traceInitPerf = !0), this.traceInitIndent = -1, this.TRACE_INIT("Lexer Constructor", () => {
52
- let m, x = !0;
30
+ let r = Array(this.traceInitIndent + 1).join(" ");
31
+ this.traceInitIndent < this.traceInitMaxIdent && console.log(`${r}--> <${e}>`);
32
+ let { time: i, value: a } = timer(n), o = i > 10 ? console.warn : console.log;
33
+ return this.traceInitIndent < this.traceInitMaxIdent && o(`${r}<-- <${e}> time: ${i}ms`), this.traceInitIndent--, a;
34
+ } else return n();
35
+ }, typeof c == "boolean") throw Error("The second argument to the Lexer constructor is now an ILexerConfig Object.\na boolean 2nd argument is no longer supported");
36
+ this.config = Object.assign({}, DEFAULT_LEXER_CONFIG, c);
37
+ let p = this.config.traceInitPerf;
38
+ p === !0 ? (this.traceInitMaxIdent = Infinity, this.traceInitPerf = !0) : typeof p == "number" && (this.traceInitMaxIdent = p, this.traceInitPerf = !0), this.traceInitIndent = -1, this.TRACE_INIT("Lexer Constructor", () => {
39
+ let t, p = !0;
53
40
  this.TRACE_INIT("Lexer Config handling", () => {
54
41
  if (this.config.lineTerminatorsPattern === DEFAULT_LEXER_CONFIG.lineTerminatorsPattern) this.config.lineTerminatorsPattern = LineTerminatorOptimizedTester;
55
42
  else if (this.config.lineTerminatorCharacters === DEFAULT_LEXER_CONFIG.lineTerminatorCharacters) throw Error("Error: Missing <lineTerminatorCharacters> property on the Lexer config.\n For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS");
56
- if (b.safeMode && b.ensureOptimizations) throw Error("\"safeMode\" and \"ensureOptimizations\" flags are mutually exclusive.");
57
- this.trackStartLines = /full|onlyStart/i.test(this.config.positionTracking), this.trackEndLines = /full/i.test(this.config.positionTracking), isArray_default(s) ? m = {
58
- modes: { defaultMode: clone_default(s) },
43
+ if (c.safeMode && c.ensureOptimizations) throw Error("\"safeMode\" and \"ensureOptimizations\" flags are mutually exclusive.");
44
+ this.trackStartLines = /full|onlyStart/i.test(this.config.positionTracking), this.trackEndLines = /full/i.test(this.config.positionTracking), Array.isArray(s) ? t = {
45
+ modes: { defaultMode: [...s] },
59
46
  defaultMode: DEFAULT_MODE
60
- } : (x = !1, m = clone_default(s));
47
+ } : (p = !1, t = Object.assign({}, s));
61
48
  }), this.config.skipValidations === !1 && (this.TRACE_INIT("performRuntimeChecks", () => {
62
- this.lexerDefinitionErrors = this.lexerDefinitionErrors.concat(performRuntimeChecks(m, this.trackStartLines, this.config.lineTerminatorCharacters));
49
+ this.lexerDefinitionErrors = this.lexerDefinitionErrors.concat(performRuntimeChecks(t, this.trackStartLines, this.config.lineTerminatorCharacters));
63
50
  }), this.TRACE_INIT("performWarningRuntimeChecks", () => {
64
- this.lexerDefinitionWarning = this.lexerDefinitionWarning.concat(performWarningRuntimeChecks(m, this.trackStartLines, this.config.lineTerminatorCharacters));
65
- })), m.modes = m.modes ? m.modes : {}, forEach_default(m.modes, (e, t) => {
66
- m.modes[t] = reject_default(e, (e) => isUndefined_default(e));
51
+ this.lexerDefinitionWarning = this.lexerDefinitionWarning.concat(performWarningRuntimeChecks(t, this.trackStartLines, this.config.lineTerminatorCharacters));
52
+ })), t.modes = t.modes ? t.modes : {}, Object.entries(t.modes).forEach(([e, n]) => {
53
+ t.modes[e] = n.filter((e) => e !== void 0);
67
54
  });
68
- let E = keys_default(m.modes);
69
- if (forEach_default(m.modes, (e, t) => {
70
- this.TRACE_INIT(`Mode: <${t}> processing`, () => {
71
- if (this.modes.push(t), this.config.skipValidations === !1 && this.TRACE_INIT("validatePatterns", () => {
72
- this.lexerDefinitionErrors = this.lexerDefinitionErrors.concat(validatePatterns(e, E));
73
- }), isEmpty_default(this.lexerDefinitionErrors)) {
74
- augmentTokenTypes(e);
55
+ let m = Object.keys(t.modes);
56
+ if (Object.entries(t.modes).forEach(([e, t]) => {
57
+ this.TRACE_INIT(`Mode: <${e}> processing`, () => {
58
+ if (this.modes.push(e), this.config.skipValidations === !1 && this.TRACE_INIT("validatePatterns", () => {
59
+ this.lexerDefinitionErrors = this.lexerDefinitionErrors.concat(validatePatterns(t, m));
60
+ }), this.lexerDefinitionErrors.length === 0) {
61
+ augmentTokenTypes(t);
75
62
  let n;
76
63
  this.TRACE_INIT("analyzeTokenTypes", () => {
77
- n = analyzeTokenTypes(e, {
64
+ n = analyzeTokenTypes(t, {
78
65
  lineTerminatorCharacters: this.config.lineTerminatorCharacters,
79
- positionTracking: b.positionTracking,
80
- ensureOptimizations: b.ensureOptimizations,
81
- safeMode: b.safeMode,
66
+ positionTracking: c.positionTracking,
67
+ ensureOptimizations: c.ensureOptimizations,
68
+ safeMode: c.safeMode,
82
69
  tracer: this.TRACE_INIT
83
70
  });
84
- }), this.patternIdxToConfig[t] = n.patternIdxToConfig, this.charCodeToPatternIdxToConfig[t] = n.charCodeToPatternIdxToConfig, this.emptyGroups = assign_default({}, this.emptyGroups, n.emptyGroups), this.hasCustom = n.hasCustom || this.hasCustom, this.canModeBeOptimized[t] = n.canBeOptimized;
71
+ }), this.patternIdxToConfig[e] = n.patternIdxToConfig, this.charCodeToPatternIdxToConfig[e] = n.charCodeToPatternIdxToConfig, this.emptyGroups = Object.assign({}, this.emptyGroups, n.emptyGroups), this.hasCustom = n.hasCustom || this.hasCustom, this.canModeBeOptimized[e] = n.canBeOptimized;
85
72
  }
86
73
  });
87
- }), this.defaultMode = m.defaultMode, !isEmpty_default(this.lexerDefinitionErrors) && !this.config.deferDefinitionErrorsHandling) {
88
- let e = map_default(this.lexerDefinitionErrors, (e) => e.message).join("-----------------------\n");
74
+ }), this.defaultMode = t.defaultMode, this.lexerDefinitionErrors.length > 0 && !this.config.deferDefinitionErrorsHandling) {
75
+ let e = this.lexerDefinitionErrors.map((e) => e.message).join("-----------------------\n");
89
76
  throw Error("Errors detected in definition of Lexer:\n" + e);
90
77
  }
91
- forEach_default(this.lexerDefinitionWarning, (e) => {
92
- PRINT_WARNING(e.message);
78
+ this.lexerDefinitionWarning.forEach((t) => {
79
+ PRINT_WARNING(t.message);
93
80
  }), this.TRACE_INIT("Choosing sub-methods implementations", () => {
94
- if (x && (this.handleModes = noop_default), this.trackStartLines === !1 && (this.computeNewColumn = identity_default), this.trackEndLines === !1 && (this.updateTokenEndLineColumnLocation = noop_default), /full/i.test(this.config.positionTracking)) this.createTokenInstance = this.createFullToken;
81
+ if (p && (this.handleModes = () => {}), this.trackStartLines === !1 && (this.computeNewColumn = (e) => e), this.trackEndLines === !1 && (this.updateTokenEndLineColumnLocation = () => {}), /full/i.test(this.config.positionTracking)) this.createTokenInstance = this.createFullToken;
95
82
  else if (/onlyStart/i.test(this.config.positionTracking)) this.createTokenInstance = this.createStartOnlyToken;
96
83
  else if (/onlyOffset/i.test(this.config.positionTracking)) this.createTokenInstance = this.createOffsetOnlyToken;
97
84
  else throw Error(`Invalid <positionTracking> config option: "${this.config.positionTracking}"`);
98
85
  this.hasCustom ? (this.addToken = this.addTokenUsingPush, this.handlePayload = this.handlePayloadWithCustom) : (this.addToken = this.addTokenUsingMemberAccess, this.handlePayload = this.handlePayloadNoCustom);
99
86
  }), this.TRACE_INIT("Failed Optimization Warnings", () => {
100
- let e = reduce_default(this.canModeBeOptimized, (e, t, n) => (t === !1 && e.push(n), e), []);
101
- if (b.ensureOptimizations && !isEmpty_default(e)) throw Error(`Lexer Modes: < ${e.join(", ")} > cannot be optimized.\n Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
87
+ let e = Object.entries(this.canModeBeOptimized).reduce((e, [t, n]) => (n === !1 && e.push(t), e), []);
88
+ if (c.ensureOptimizations && e.length > 0) throw Error(`Lexer Modes: < ${e.join(", ")} > cannot be optimized.\n Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
102
89
  Or inspect the console log for details on how to resolve these issues.`);
103
90
  }), this.TRACE_INIT("clearRegExpParserCache", () => {
104
91
  clearRegExpParserCache();
@@ -108,19 +95,19 @@ var Lexer = class {
108
95
  });
109
96
  }
110
97
  tokenize(e, t = this.defaultMode) {
111
- if (!isEmpty_default(this.lexerDefinitionErrors)) {
112
- let e = map_default(this.lexerDefinitionErrors, (e) => e.message).join("-----------------------\n");
98
+ if (this.lexerDefinitionErrors.length > 0) {
99
+ let e = this.lexerDefinitionErrors.map((e) => e.message).join("-----------------------\n");
113
100
  throw Error("Unable to Tokenize because Errors detected in definition of Lexer:\n" + e);
114
101
  }
115
102
  return this.tokenizeInternal(e, t);
116
103
  }
117
104
  tokenizeInternal(e, t) {
118
- let n, r, i, a, o, c, l, u, d, f, p, m, h, g, _, v = e, y = v.length, S = 0, C = 0, w = this.hasCustom ? 0 : Math.floor(e.length / 10), T = Array(w), E = [], D = this.trackStartLines ? 1 : void 0, O = this.trackStartLines ? 1 : void 0, k = cloneEmptyGroups(this.emptyGroups), A = this.trackStartLines, j = this.config.lineTerminatorsPattern, M = 0, N = [], P = [], F = [], I = [];
119
- Object.freeze(I);
120
- let L = !1, R = (e) => {
121
- if (F.length === 1 && e.tokenType.PUSH_MODE === void 0) {
105
+ let n, r, i, a, o, l, u, d, f, p, m, h, g, _, v, y = e, b = y.length, x = 0, S = 0, C = this.hasCustom ? 0 : Math.floor(e.length / 10), w = Array(C), T = [], E = this.trackStartLines ? 1 : void 0, D = this.trackStartLines ? 1 : void 0, O = cloneEmptyGroups(this.emptyGroups), k = this.trackStartLines, A = this.config.lineTerminatorsPattern, j = 0, M = [], N = [], P = [], F = [];
106
+ Object.freeze(F);
107
+ let I = !1, L = (e) => {
108
+ if (P.length === 1 && e.tokenType.PUSH_MODE === void 0) {
122
109
  let t = this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(e);
123
- E.push({
110
+ T.push({
124
111
  offset: e.startOffset,
125
112
  line: e.startLine,
126
113
  column: e.startColumn,
@@ -128,41 +115,41 @@ var Lexer = class {
128
115
  message: t
129
116
  });
130
117
  } else {
131
- F.pop();
132
- let e = last_default(F);
133
- N = this.patternIdxToConfig[e], P = this.charCodeToPatternIdxToConfig[e], M = N.length;
118
+ P.pop();
119
+ let e = P.at(-1);
120
+ M = this.patternIdxToConfig[e], N = this.charCodeToPatternIdxToConfig[e], j = M.length;
134
121
  let t = this.canModeBeOptimized[e] && this.config.safeMode === !1;
135
- L = !!(P && t);
122
+ I = !!(N && t);
136
123
  }
137
124
  };
138
- function z(e) {
139
- F.push(e), P = this.charCodeToPatternIdxToConfig[e], N = this.patternIdxToConfig[e], M = N.length, M = N.length;
125
+ function R(e) {
126
+ P.push(e), N = this.charCodeToPatternIdxToConfig[e], M = this.patternIdxToConfig[e], j = M.length, j = M.length;
140
127
  let t = this.canModeBeOptimized[e] && this.config.safeMode === !1;
141
- L = !!(P && t);
128
+ I = !!(N && t);
142
129
  }
143
- z.call(this, t);
144
- let B, V = this.config.recoveryEnabled;
145
- for (; S < y;) {
146
- c = null, d = -1;
147
- let t = v.charCodeAt(S), x;
148
- if (L) {
149
- let e = charCodeToOptimizedIndex(t), n = P[e];
150
- x = n === void 0 ? I : n;
151
- } else x = N;
152
- let w = x.length;
153
- for (n = 0; n < w; n++) {
154
- B = x[n];
155
- let r = B.pattern;
156
- l = null;
157
- let s = B.short;
158
- if (s === !1 ? B.isCustom === !0 ? (_ = r.exec(v, S, T, k), _ === null ? c = null : (c = _[0], d = c.length, _.payload !== void 0 && (l = _.payload))) : (r.lastIndex = S, d = this.matchLength(r, e, S)) : t === s && (d = 1, c = r), d !== -1) {
159
- if (o = B.longerAlt, o !== void 0) {
160
- c = e.substring(S, S + d);
130
+ R.call(this, t);
131
+ let z, B = this.config.recoveryEnabled;
132
+ for (; x < b;) {
133
+ l = null, f = -1;
134
+ let t = y.charCodeAt(x), c;
135
+ if (I) {
136
+ let e = charCodeToOptimizedIndex(t), n = N[e];
137
+ c = n === void 0 ? F : n;
138
+ } else c = M;
139
+ let C = c.length;
140
+ for (n = 0; n < C; n++) {
141
+ z = c[n];
142
+ let r = z.pattern;
143
+ u = null;
144
+ let s = z.short;
145
+ if (s === !1 ? z.isCustom === !0 ? (v = r.exec(y, x, w, O), v === null ? l = null : (l = v[0], f = l.length, v.payload !== void 0 && (u = v.payload))) : (r.lastIndex = x, f = this.matchLength(r, e, x)) : t === s && (f = 1, l = r), f !== -1) {
146
+ if (o = z.longerAlt, o !== void 0) {
147
+ l = e.substring(x, x + f);
161
148
  let t = o.length;
162
149
  for (i = 0; i < t; i++) {
163
- let t = N[o[i]], n = t.pattern;
164
- if (u = null, t.isCustom === !0 ? (_ = n.exec(v, S, T, k), _ === null ? a = null : (a = _[0], _.payload !== void 0 && (u = _.payload))) : (n.lastIndex = S, a = this.match(n, e, S)), a && a.length > c.length) {
165
- c = a, d = a.length, l = u, B = t;
150
+ let t = M[o[i]], n = t.pattern;
151
+ if (d = null, t.isCustom === !0 ? (v = n.exec(y, x, w, O), v === null ? a = null : (a = v[0], v.payload !== void 0 && (d = v.payload))) : (n.lastIndex = x, a = this.match(n, e, x)), a && a.length > l.length) {
152
+ l = a, f = a.length, u = d, z = t;
166
153
  break;
167
154
  }
168
155
  }
@@ -170,35 +157,35 @@ var Lexer = class {
170
157
  break;
171
158
  }
172
159
  }
173
- if (d !== -1) {
174
- if (f = B.group, f !== void 0 && (c = c === null ? e.substring(S, S + d) : c, p = B.tokenTypeIdx, m = this.createTokenInstance(c, S, p, B.tokenType, D, O, d), this.handlePayload(m, l), f === !1 ? C = this.addToken(T, C, m) : k[f].push(m)), A === !0 && B.canLineTerminator === !0) {
160
+ if (f !== -1) {
161
+ if (p = z.group, p !== void 0 && (l = l === null ? e.substring(x, x + f) : l, m = z.tokenTypeIdx, h = this.createTokenInstance(l, x, m, z.tokenType, E, D, f), this.handlePayload(h, u), p === !1 ? S = this.addToken(w, S, h) : O[p].push(h)), k === !0 && z.canLineTerminator === !0) {
175
162
  let t = 0, n, r;
176
- j.lastIndex = 0;
163
+ A.lastIndex = 0;
177
164
  do
178
- c = c === null ? e.substring(S, S + d) : c, n = j.test(c), n === !0 && (r = j.lastIndex - 1, t++);
165
+ l = l === null ? e.substring(x, x + f) : l, n = A.test(l), n === !0 && (r = A.lastIndex - 1, t++);
179
166
  while (n === !0);
180
- t === 0 ? O = this.computeNewColumn(O, d) : (D += t, O = d - r, this.updateTokenEndLineColumnLocation(m, f, r, t, D, O, d));
181
- } else O = this.computeNewColumn(O, d);
182
- S += d, this.handleModes(B, R, z, m);
167
+ t === 0 ? D = this.computeNewColumn(D, f) : (E += t, D = f - r, this.updateTokenEndLineColumnLocation(h, p, r, t, E, D, f));
168
+ } else D = this.computeNewColumn(D, f);
169
+ x += f, this.handleModes(z, L, R, h);
183
170
  } else {
184
- let t = S, n = D, i = O, a = V === !1;
185
- for (; a === !1 && S < y;) for (S++, r = 0; r < M; r++) {
186
- let t = N[r], n = t.pattern, i = t.short;
187
- if (i === !1 ? t.isCustom === !0 ? a = n.exec(v, S, T, k) !== null : (n.lastIndex = S, a = n.exec(e) !== null) : v.charCodeAt(S) === i && (a = !0), a === !0) break;
171
+ let t = x, n = E, i = D, a = B === !1;
172
+ for (; a === !1 && x < b;) for (x++, r = 0; r < j; r++) {
173
+ let t = M[r], n = t.pattern, i = t.short;
174
+ if (i === !1 ? t.isCustom === !0 ? a = n.exec(y, x, w, O) !== null : (n.lastIndex = x, a = n.exec(e) !== null) : y.charCodeAt(x) === i && (a = !0), a === !0) break;
188
175
  }
189
- if (h = S - t, O = this.computeNewColumn(O, h), g = this.config.errorMessageProvider.buildUnexpectedCharactersMessage(v, t, h, n, i, last_default(F)), E.push({
176
+ if (g = x - t, D = this.computeNewColumn(D, g), _ = this.config.errorMessageProvider.buildUnexpectedCharactersMessage(y, t, g, n, i, P.at(-1)), T.push({
190
177
  offset: t,
191
178
  line: n,
192
179
  column: i,
193
- length: h,
194
- message: g
195
- }), V === !1) break;
180
+ length: g,
181
+ message: _
182
+ }), B === !1) break;
196
183
  }
197
184
  }
198
- return this.hasCustom || (T.length = C), {
199
- tokens: T,
200
- groups: k,
201
- errors: E
185
+ return this.hasCustom || (w.length = S), {
186
+ tokens: w,
187
+ groups: O,
188
+ errors: T
202
189
  };
203
190
  }
204
191
  handleModes(e, t, n, r) {
@@ -1,42 +1,36 @@
1
- import isArray_default from "../../../../lodash-es/isArray.js";
2
1
  import { BaseRegExpVisitor } from "../../../../@chevrotain/regexp-to-ast/lib/src/base-regexp-visitor.js";
3
2
  import "../../../../@chevrotain/regexp-to-ast/lib/src/api.js";
4
- import forEach_default from "../../../../lodash-es/forEach.js";
5
- import every_default from "../../../../lodash-es/every.js";
6
- import find_default from "../../../../lodash-es/find.js";
7
- import values_default from "../../../../lodash-es/values.js";
8
- import includes_default from "../../../../lodash-es/includes.js";
9
3
  import { PRINT_ERROR, PRINT_WARNING } from "../../../../@chevrotain/utils/lib/src/print.js";
10
4
  import { getRegExpAst } from "./reg_exp_parser.js";
11
5
  import { charCodeToOptimizedIndex, minOptimizationVal } from "./lexer.js";
12
6
  var complementErrorMessage = "Complement Sets are not supported for first char optimization";
13
7
  const failedOptimizationPrefixMsg = "Unable to use \"first char\" lexer optimizations:\n";
14
- function getOptimizedStartCodesIndices(e, h = !1) {
8
+ function getOptimizedStartCodesIndices(e, d = !1) {
15
9
  try {
16
- let h = getRegExpAst(e);
17
- return firstCharOptimizedIndices(h.value, {}, h.flags.ignoreCase);
18
- } catch (g) {
10
+ let c = getRegExpAst(e);
11
+ return firstCharOptimizedIndices(c.value, {}, c.flags.ignoreCase);
12
+ } catch (u) {
19
13
  /* istanbul ignore next */
20
- if (g.message === complementErrorMessage) h && PRINT_WARNING(`${failedOptimizationPrefixMsg}\tUnable to optimize: < ${e.toString()} >\n Complement Sets cannot be automatically optimized.
14
+ if (u.message === complementErrorMessage) d && PRINT_WARNING(`${failedOptimizationPrefixMsg}\tUnable to optimize: < ${e.toString()} >\n Complement Sets cannot be automatically optimized.
21
15
  This will disable the lexer's first char optimizations.
22
16
  See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);
23
17
  else {
24
- let g = "";
25
- h && (g = "\n This will disable the lexer's first char optimizations.\n See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details."), PRINT_ERROR(`${failedOptimizationPrefixMsg}\n\tFailed parsing: < ${e.toString()} >\n\tUsing the @chevrotain/regexp-to-ast library\n Please open an issue at: https://github.com/chevrotain/chevrotain/issues` + g);
18
+ let l = "";
19
+ d && (l = "\n This will disable the lexer's first char optimizations.\n See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details."), PRINT_ERROR(`${failedOptimizationPrefixMsg}\n\tFailed parsing: < ${e.toString()} >\n\tUsing the @chevrotain/regexp-to-ast library\n Please open an issue at: https://github.com/chevrotain/chevrotain/issues` + l);
26
20
  }
27
21
  }
28
22
  return [];
29
23
  }
30
- function firstCharOptimizedIndices(e, h, _) {
24
+ function firstCharOptimizedIndices(e, c, l) {
31
25
  switch (e.type) {
32
26
  case "Disjunction":
33
- for (let g = 0; g < e.value.length; g++) firstCharOptimizedIndices(e.value[g], h, _);
27
+ for (let u = 0; u < e.value.length; u++) firstCharOptimizedIndices(e.value[u], c, l);
34
28
  break;
35
29
  case "Alternative":
36
- let v = e.value;
37
- for (let e = 0; e < v.length; e++) {
38
- let y = v[e];
39
- switch (y.type) {
30
+ let u = e.value;
31
+ for (let e = 0; e < u.length; e++) {
32
+ let f = u[e];
33
+ switch (f.type) {
40
34
  case "EndAnchor":
41
35
  case "GroupBackReference":
42
36
  case "Lookahead":
@@ -47,71 +41,71 @@ function firstCharOptimizedIndices(e, h, _) {
47
41
  case "WordBoundary":
48
42
  case "NonWordBoundary": continue;
49
43
  }
50
- let b = y;
51
- switch (b.type) {
44
+ let m = f;
45
+ switch (m.type) {
52
46
  case "Character":
53
- addOptimizedIdxToResult(b.value, h, _);
47
+ addOptimizedIdxToResult(m.value, c, l);
54
48
  break;
55
49
  case "Set":
56
- if (b.complement === !0) throw Error(complementErrorMessage);
57
- forEach_default(b.value, (e) => {
58
- if (typeof e == "number") addOptimizedIdxToResult(e, h, _);
50
+ if (m.complement === !0) throw Error(complementErrorMessage);
51
+ m.value.forEach((e) => {
52
+ if (typeof e == "number") addOptimizedIdxToResult(e, c, l);
59
53
  else {
60
- let g = e;
61
- if (_ === !0) for (let e = g.from; e <= g.to; e++) addOptimizedIdxToResult(e, h, _);
54
+ let u = e;
55
+ if (l === !0) for (let e = u.from; e <= u.to; e++) addOptimizedIdxToResult(e, c, l);
62
56
  else {
63
- for (let e = g.from; e <= g.to && e < 256; e++) addOptimizedIdxToResult(e, h, _);
64
- if (g.to >= 256) {
65
- let e = g.from >= 256 ? g.from : 256, _ = g.to, v = charCodeToOptimizedIndex(e), y = charCodeToOptimizedIndex(_);
66
- for (let e = v; e <= y; e++) h[e] = e;
57
+ for (let e = u.from; e <= u.to && e < 256; e++) addOptimizedIdxToResult(e, c, l);
58
+ if (u.to >= 256) {
59
+ let e = u.from >= 256 ? u.from : 256, l = u.to, f = charCodeToOptimizedIndex(e), p = charCodeToOptimizedIndex(l);
60
+ for (let e = f; e <= p; e++) c[e] = e;
67
61
  }
68
62
  }
69
63
  }
70
64
  });
71
65
  break;
72
66
  case "Group":
73
- firstCharOptimizedIndices(b.value, h, _);
67
+ firstCharOptimizedIndices(m.value, c, l);
74
68
  break;
75
69
  default: throw Error("Non Exhaustive Match");
76
70
  }
77
- let x = b.quantifier !== void 0 && b.quantifier.atLeast === 0;
78
- if (b.type === "Group" && isWholeOptional(b) === !1 || b.type !== "Group" && x === !1) break;
71
+ let h = m.quantifier !== void 0 && m.quantifier.atLeast === 0;
72
+ if (m.type === "Group" && isWholeOptional(m) === !1 || m.type !== "Group" && h === !1) break;
79
73
  }
80
74
  break;
81
75
  default: throw Error("non exhaustive match!");
82
76
  }
83
- return values_default(h);
77
+ return Object.values(c);
84
78
  }
85
- function addOptimizedIdxToResult(e, h, g) {
86
- let _ = charCodeToOptimizedIndex(e);
87
- h[_] = _, g === !0 && handleIgnoreCase(e, h);
79
+ function addOptimizedIdxToResult(e, c, l) {
80
+ let u = charCodeToOptimizedIndex(e);
81
+ c[u] = u, l === !0 && handleIgnoreCase(e, c);
88
82
  }
89
- function handleIgnoreCase(e, h) {
90
- let g = String.fromCharCode(e), _ = g.toUpperCase();
83
+ function handleIgnoreCase(e, c) {
84
+ let l = String.fromCharCode(e), u = l.toUpperCase();
91
85
  /* istanbul ignore else */
92
- if (_ !== g) {
93
- let e = charCodeToOptimizedIndex(_.charCodeAt(0));
94
- h[e] = e;
86
+ if (u !== l) {
87
+ let e = charCodeToOptimizedIndex(u.charCodeAt(0));
88
+ c[e] = e;
95
89
  } else {
96
- let e = g.toLowerCase();
97
- if (e !== g) {
98
- let g = charCodeToOptimizedIndex(e.charCodeAt(0));
99
- h[g] = g;
90
+ let e = l.toLowerCase();
91
+ if (e !== l) {
92
+ let l = charCodeToOptimizedIndex(e.charCodeAt(0));
93
+ c[l] = l;
100
94
  }
101
95
  }
102
96
  }
103
- function findCode(e, h) {
104
- return find_default(e.value, (e) => {
105
- if (typeof e == "number") return includes_default(h, e);
97
+ function findCode(e, c) {
98
+ return e.value.find((e) => {
99
+ if (typeof e == "number") return c.includes(e);
106
100
  {
107
- let g = e;
108
- return find_default(h, (e) => g.from <= e && e <= g.to) !== void 0;
101
+ let l = e;
102
+ return c.find((e) => l.from <= e && e <= l.to) !== void 0;
109
103
  }
110
104
  });
111
105
  }
112
- function isWholeOptional(h) {
113
- let g = h.quantifier;
114
- return g && g.atLeast === 0 ? !0 : h.value ? isArray_default(h.value) ? every_default(h.value, isWholeOptional) : isWholeOptional(h.value) : !1;
106
+ function isWholeOptional(e) {
107
+ let c = e.quantifier;
108
+ return c && c.atLeast === 0 ? !0 : e.value ? Array.isArray(e.value) ? e.value.every(isWholeOptional) : isWholeOptional(e.value) : !1;
115
109
  }
116
110
  var CharCodeFinder = class extends BaseRegExpVisitor {
117
111
  constructor(e) {
@@ -137,16 +131,22 @@ var CharCodeFinder = class extends BaseRegExpVisitor {
137
131
  }
138
132
  }
139
133
  visitCharacter(e) {
140
- includes_default(this.targetCharCodes, e.value) && (this.found = !0);
134
+ this.targetCharCodes.includes(e.value) && (this.found = !0);
141
135
  }
142
136
  visitSet(e) {
143
137
  e.complement ? findCode(e, this.targetCharCodes) === void 0 && (this.found = !0) : findCode(e, this.targetCharCodes) !== void 0 && (this.found = !0);
144
138
  }
145
139
  };
146
- function canMatchCharCode(e, h) {
147
- if (h instanceof RegExp) {
148
- let g = getRegExpAst(h), _ = new CharCodeFinder(e);
149
- return _.visit(g), _.found;
150
- } else return find_default(h, (h) => includes_default(e, h.charCodeAt(0))) !== void 0;
140
+ function canMatchCharCode(e, c) {
141
+ if (c instanceof RegExp) {
142
+ let l = getRegExpAst(c), d = new CharCodeFinder(e);
143
+ return d.visit(l), d.found;
144
+ } else {
145
+ for (let l of c) {
146
+ let c = l.charCodeAt(0);
147
+ if (e.includes(c)) return !0;
148
+ }
149
+ return !1;
150
+ }
151
151
  }
152
152
  export { canMatchCharCode, failedOptimizationPrefixMsg, getOptimizedStartCodesIndices };
@@ -1,75 +1,65 @@
1
- import isArray_default from "../../../../lodash-es/isArray.js";
2
- import isEmpty_default from "../../../../lodash-es/isEmpty.js";
3
- import flatten_default from "../../../../lodash-es/flatten.js";
4
- import clone_default from "../../../../lodash-es/clone.js";
5
- import compact_default from "../../../../lodash-es/compact.js";
6
- import difference_default from "../../../../lodash-es/difference.js";
7
- import forEach_default from "../../../../lodash-es/forEach.js";
8
- import map_default from "../../../../lodash-es/map.js";
9
- import has_default from "../../../../lodash-es/has.js";
10
- import includes_default from "../../../../lodash-es/includes.js";
11
- function tokenStructuredMatcher(e, y) {
12
- let b = e.tokenTypeIdx;
13
- return b === y.tokenTypeIdx ? !0 : y.isParent === !0 && y.categoryMatchesMap[b] === !0;
1
+ function tokenStructuredMatcher(e, f) {
2
+ let p = e.tokenTypeIdx;
3
+ return p === f.tokenTypeIdx ? !0 : f.isParent === !0 && f.categoryMatchesMap[p] === !0;
14
4
  }
15
- function tokenStructuredMatcherNoCategories(e, y) {
16
- return e.tokenTypeIdx === y.tokenTypeIdx;
5
+ function tokenStructuredMatcherNoCategories(e, f) {
6
+ return e.tokenTypeIdx === f.tokenTypeIdx;
17
7
  }
18
8
  let tokenShortNameIdx = 1;
19
9
  const tokenIdxToClass = {};
20
10
  function augmentTokenTypes(e) {
21
- let y = expandCategories(e);
22
- assignTokenDefaultProps(y), assignCategoriesMapProp(y), assignCategoriesTokensProp(y), forEach_default(y, (e) => {
11
+ let f = expandCategories(e);
12
+ assignTokenDefaultProps(f), assignCategoriesMapProp(f), assignCategoriesTokensProp(f), f.forEach((e) => {
23
13
  e.isParent = e.categoryMatches.length > 0;
24
14
  });
25
15
  }
26
16
  function expandCategories(e) {
27
- let S = clone_default(e), C = e, w = !0;
28
- for (; w;) {
29
- C = compact_default(flatten_default(map_default(C, (e) => e.CATEGORIES)));
30
- let e = difference_default(C, S);
31
- S = S.concat(e), isEmpty_default(e) ? w = !1 : C = e;
17
+ let f = [...e], p = e, m = !0;
18
+ for (; m;) {
19
+ p = p.map((e) => e.CATEGORIES).flat().filter(Boolean);
20
+ let e = p.filter((e) => !f.includes(e));
21
+ f = f.concat(e), e.length === 0 ? m = !1 : p = e;
32
22
  }
33
- return S;
23
+ return f;
34
24
  }
35
- function assignTokenDefaultProps(y) {
36
- forEach_default(y, (y) => {
37
- hasShortKeyProperty(y) || (tokenIdxToClass[tokenShortNameIdx] = y, y.tokenTypeIdx = tokenShortNameIdx++), hasCategoriesProperty(y) && !isArray_default(y.CATEGORIES) && (y.CATEGORIES = [y.CATEGORIES]), hasCategoriesProperty(y) || (y.CATEGORIES = []), hasExtendingTokensTypesProperty(y) || (y.categoryMatches = []), hasExtendingTokensTypesMapProperty(y) || (y.categoryMatchesMap = {});
25
+ function assignTokenDefaultProps(e) {
26
+ e.forEach((e) => {
27
+ hasShortKeyProperty(e) || (tokenIdxToClass[tokenShortNameIdx] = e, e.tokenTypeIdx = tokenShortNameIdx++), hasCategoriesProperty(e) && !Array.isArray(e.CATEGORIES) && (e.CATEGORIES = [e.CATEGORIES]), hasCategoriesProperty(e) || (e.CATEGORIES = []), hasExtendingTokensTypesProperty(e) || (e.categoryMatches = []), hasExtendingTokensTypesMapProperty(e) || (e.categoryMatchesMap = {});
38
28
  });
39
29
  }
40
30
  function assignCategoriesTokensProp(e) {
41
- forEach_default(e, (e) => {
42
- e.categoryMatches = [], forEach_default(e.categoryMatchesMap, (y, b) => {
43
- e.categoryMatches.push(tokenIdxToClass[b].tokenTypeIdx);
31
+ e.forEach((e) => {
32
+ e.categoryMatches = [], Object.keys(e.categoryMatchesMap).forEach((f) => {
33
+ e.categoryMatches.push(tokenIdxToClass[f].tokenTypeIdx);
44
34
  });
45
35
  });
46
36
  }
47
37
  function assignCategoriesMapProp(e) {
48
- forEach_default(e, (e) => {
38
+ e.forEach((e) => {
49
39
  singleAssignCategoriesToksMap([], e);
50
40
  });
51
41
  }
52
- function singleAssignCategoriesToksMap(e, y) {
53
- forEach_default(e, (e) => {
54
- y.categoryMatchesMap[e.tokenTypeIdx] = !0;
55
- }), forEach_default(y.CATEGORIES, (b) => {
56
- let x = e.concat(y);
57
- includes_default(x, b) || singleAssignCategoriesToksMap(x, b);
42
+ function singleAssignCategoriesToksMap(e, f) {
43
+ e.forEach((e) => {
44
+ f.categoryMatchesMap[e.tokenTypeIdx] = !0;
45
+ }), f.CATEGORIES.forEach((p) => {
46
+ let m = e.concat(f);
47
+ m.includes(p) || singleAssignCategoriesToksMap(m, p);
58
48
  });
59
49
  }
60
50
  function hasShortKeyProperty(e) {
61
- return has_default(e, "tokenTypeIdx");
51
+ return Object.hasOwn(e ?? {}, "tokenTypeIdx");
62
52
  }
63
53
  function hasCategoriesProperty(e) {
64
- return has_default(e, "CATEGORIES");
54
+ return Object.hasOwn(e ?? {}, "CATEGORIES");
65
55
  }
66
56
  function hasExtendingTokensTypesProperty(e) {
67
- return has_default(e, "categoryMatches");
57
+ return Object.hasOwn(e ?? {}, "categoryMatches");
68
58
  }
69
59
  function hasExtendingTokensTypesMapProperty(e) {
70
- return has_default(e, "categoryMatchesMap");
60
+ return Object.hasOwn(e ?? {}, "categoryMatchesMap");
71
61
  }
72
62
  function isTokenType(e) {
73
- return has_default(e, "tokenTypeIdx");
63
+ return Object.hasOwn(e ?? {}, "tokenTypeIdx");
74
64
  }
75
65
  export { augmentTokenTypes, hasShortKeyProperty, isTokenType, tokenStructuredMatcher, tokenStructuredMatcherNoCategories };