@marimo-team/islands 0.18.0 → 0.18.1

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 (578) hide show
  1. package/dist/Combination-DN9sfYvo.js +2569 -0
  2. package/dist/{ConnectedDataExplorerComponent-BUgUSo2B.js → ConnectedDataExplorerComponent-Dhlx78se.js} +53 -53
  3. package/dist/angular-html-BQrFNFXr.js +7 -0
  4. package/dist/{angular-html-DOnHLneR.js → angular-html-NuAgzn7W.js} +1 -1
  5. package/dist/{angular-ts-ClZ_D57Q.js → angular-ts-DqCVY0oX.js} +5 -5
  6. package/dist/{any-language-editor-BS-Z5AY5.js → any-language-editor-C8uMYHwj.js} +16 -16
  7. package/dist/{apl-BQW_2HeZ.js → apl-CqAdrzTc.js} +6 -6
  8. package/dist/{arc-DqQgmHse.js → arc-JJltOFJh.js} +2 -2
  9. package/dist/{architecture-O4VJ6CD3-BAmYZukJ.js → architecture-O4VJ6CD3-D7BH29FP.js} +3 -3
  10. package/dist/{architectureDiagram-W76B3OCA-6PSfeg_h.js → architectureDiagram-W76B3OCA-BXXl3wYv.js} +22 -22
  11. package/dist/{astro-B_6-YJyf.js → astro-BhYIwlT9.js} +6 -6
  12. package/dist/{blade-J--jW6Qd.js → blade-C_4Ocghp.js} +8 -8
  13. package/dist/{blockDiagram-QIGZ2CNN-BBAMkEiZ.js → blockDiagram-QIGZ2CNN-BEJ-ovZ-.js} +16 -16
  14. package/dist/{bsl-DwRO_vPO.js → bsl-Cam9acj0.js} +1 -1
  15. package/dist/{button-Hye6-2X8.js → button-Css_i-3R.js} +73 -71
  16. package/dist/c-DYGEdS-r.js +4 -0
  17. package/dist/{c4Diagram-FPNF74CW-H3kajU-4.js → c4Diagram-FPNF74CW-Bec_XtUS.js} +8 -8
  18. package/dist/{cairo-C5YwJoRd.js → cairo-DzTxWLx8.js} +1 -1
  19. package/dist/{channel-DO61Dn1s.js → channel-SHZ3pH5W.js} +1 -1
  20. package/dist/{chunk-3AY6CYHV-PGaWKUmM.js → chunk-3AY6CYHV-CY56r15D.js} +10 -10
  21. package/dist/{chunk-4BX2VUAB-C2wFBih6.js → chunk-4BX2VUAB-DakkmKa6.js} +1 -1
  22. package/dist/{chunk-4KMFLZZN-BLk4DGEy.js → chunk-4KMFLZZN-PjonQa4P.js} +1 -1
  23. package/dist/{chunk-55IACEB6-DQd6AZ1u.js → chunk-55IACEB6-lM9AcPFI.js} +1 -1
  24. package/dist/{chunk-6OXUPJBA-KTKvUtax.js → chunk-6OXUPJBA-CtytfqPH.js} +7 -7
  25. package/dist/{chunk-7GE3RBXV-2QiFkaHl.js → chunk-7GE3RBXV-Ch2VFfx5.js} +1 -1
  26. package/dist/{chunk-ABZYJK2D-plHo87kc.js → chunk-ABZYJK2D-ChhHEVnH.js} +2 -2
  27. package/dist/{chunk-BN7GFLIU-D4EEpMya.js → chunk-BN7GFLIU-4gH4skZE.js} +1 -1
  28. package/dist/{chunk-CVBHYZKI-nBM-9qrT.js → chunk-CVBHYZKI-CvLGu9Zl.js} +1 -1
  29. package/dist/{chunk-CXMOBAN2-DQYc62lB.js → chunk-CXMOBAN2-DmuTyIC5.js} +6 -6
  30. package/dist/{chunk-EXTU4WIE-CzYdpCHC.js → chunk-EXTU4WIE-5gY1kHy6.js} +2 -2
  31. package/dist/{chunk-FMBD7UC4-5CTTj0Jv.js → chunk-FMBD7UC4-CktmbpHj.js} +1 -1
  32. package/dist/{chunk-JA3XYJ7Z-iN-ePWJa.js → chunk-JA3XYJ7Z-DoOh1zwr.js} +4 -4
  33. package/dist/{chunk-JEIROHC2-DJN5-Qfh.js → chunk-JEIROHC2-BxiaYL-E.js} +1 -1
  34. package/dist/{chunk-K7UQS3LO-BFLlfdsi.js → chunk-K7UQS3LO-jAauQP9f.js} +7 -7
  35. package/dist/{chunk-KMC2YHZD-BvIjRiOn.js → chunk-KMC2YHZD-DStgMcLU.js} +1 -1
  36. package/dist/{chunk-QN33PNHL-Brd7yTp3.js → chunk-QN33PNHL-a6Utqqtp.js} +2 -2
  37. package/dist/{chunk-QYVHNE3D-2JcHbPf-.js → chunk-QYVHNE3D-Di-okNtj.js} +2 -2
  38. package/dist/{chunk-QZHKN3VN-uMYxkooq.js → chunk-QZHKN3VN-uG0W9XCn.js} +1 -1
  39. package/dist/{chunk-S3R3BYOJ-F8AD9lHs.js → chunk-S3R3BYOJ-D8svDLcB.js} +4 -4
  40. package/dist/{chunk-T44TD3VJ-BuOpBf-m.js → chunk-T44TD3VJ-C5NCytxJ.js} +1 -1
  41. package/dist/{chunk-TVAH2DTR-CnMJAbv2.js → chunk-TVAH2DTR-CXLr85J9.js} +6 -6
  42. package/dist/{chunk-TZMSLE5B-FgoUBce3.js → chunk-TZMSLE5B-1E_YfHMJ.js} +3 -3
  43. package/dist/{chunk-WFRQ32O7-XYO_3xAi.js → chunk-WFRQ32O7-BKSf4yCO.js} +1 -1
  44. package/dist/{chunk-WFWHJNB7-CO2PO-xj.js → chunk-WFWHJNB7-B1Zzkj_f.js} +1 -1
  45. package/dist/{chunk-XRWGC2XP-NEUwjXBT.js → chunk-XRWGC2XP-Bo8DlVQO.js} +1 -1
  46. package/dist/{chunk-ZPAFE4SF-CyeNhdPx.js → chunk-ZPAFE4SF-CmteRP75.js} +1 -1
  47. package/dist/classDiagram-KNZD7YFC-ZbE61oE0.js +40 -0
  48. package/dist/classDiagram-v2-RKCZMP56-BqhgFvho.js +40 -0
  49. package/dist/cmake-l0t4JJ7s.js +4 -0
  50. package/dist/{cobol-lK28EtZf.js → cobol-DJP1EK1j.js} +4 -4
  51. package/dist/{coffee-BSXLyDD2.js → coffee-CC5nEIi9.js} +1 -1
  52. package/dist/{cose-bilkent-S5V4N54A-Cj0MgFkf.js → cose-bilkent-S5V4N54A-DKXAkYs4.js} +3 -3
  53. package/dist/cpp-ANCO5onE.js +8 -0
  54. package/dist/{cpp-BChLOGjC.js → cpp-D9LYqqPp.js} +3 -3
  55. package/dist/{crystal-CO99xfcp.js → crystal-BRqcx7ej.js} +6 -6
  56. package/dist/csharp-Bz76NQ_J.js +4 -0
  57. package/dist/css-DAuWdYvT.js +4 -0
  58. package/dist/{dagre-5GWH7T2D-CfnBQe48.js → dagre-5GWH7T2D-NKT9rsKF.js} +17 -17
  59. package/dist/{data-grid-overlay-editor-Bcf9kFFc.js → data-grid-overlay-editor-awitGObA.js} +2 -2
  60. package/dist/{diagram-N5W7TBWH-04TOCf2a.js → diagram-N5W7TBWH-D7Lb6iTv.js} +24 -24
  61. package/dist/{diagram-QEK2KX5R-CUipzemR.js → diagram-QEK2KX5R-BGNlTTAr.js} +19 -19
  62. package/dist/{diagram-S2PKOQOG-ei2iw-oI.js → diagram-S2PKOQOG-DArsBfLb.js} +19 -19
  63. package/dist/diff-C7LSwbp8.js +4 -0
  64. package/dist/{dist-cqkd3NiL.js → dist-6NgnwCMd.js} +3 -3
  65. package/dist/{dist-CqazJcfk.js → dist-BDVas7u0.js} +1 -1
  66. package/dist/{dist-CGt0X2sV.js → dist-BeL8NYBI.js} +2 -2
  67. package/dist/dist-BhEY2Z_n.js +14 -0
  68. package/dist/{dist-R4ZaAXGr.js → dist-BkgFFOsz.js} +2 -2
  69. package/dist/{dist-v-r4jaY5.js → dist-BoehQujB.js} +1 -1
  70. package/dist/{dist-D7XZ_tXQ.js → dist-C2nw9RHE.js} +1 -1
  71. package/dist/{dist-BGDtO7aZ.js → dist-CAS8F-hC.js} +1 -1
  72. package/dist/{dist-s1LnJ5PG.js → dist-CS4N5B_G.js} +1 -1
  73. package/dist/{dist-B4S8pyFo.js → dist-Cc9Qz-U4.js} +3 -3
  74. package/dist/{dist-4FDGlo3i.js → dist-CljL8T10.js} +4 -4
  75. package/dist/dist-Cud0QD8Y.js +10 -0
  76. package/dist/{dist-Bi6qs7up.js → dist-D9rISDoI.js} +1 -1
  77. package/dist/dist-D9t6fT6i.js +10 -0
  78. package/dist/{dist-CTSMnLwu.js → dist-DC47GA46.js} +805 -643
  79. package/dist/{dist-D0KS-m2t.js → dist-Dh6pWjSH.js} +2 -2
  80. package/dist/{dist-DtSssmhN.js → dist-DlI9v2Hh.js} +2 -2
  81. package/dist/{dist-CSq74zEj.js → dist-DyXVT1vy.js} +1 -1
  82. package/dist/{dist-DO00gdpV.js → dist-TdQLXZKo.js} +3 -3
  83. package/dist/{dist-B9WB0SFB.js → dist-WvPZl2Sl.js} +1 -1
  84. package/dist/{dist-B4jO5BUT.js → dist-q94GwumS.js} +1 -1
  85. package/dist/{dist-CmEIe_wJ.js → dist-qGG7RM7P.js} +4 -4
  86. package/dist/{edge-BTCHQnL0.js → edge-DeFsqb1i.js} +5 -5
  87. package/dist/{elixir-CCIwO0SA.js → elixir-BGD3Ym80.js} +3 -3
  88. package/dist/{elm-Bd8GMb2w.js → elm-sXxjAPfa.js} +2 -2
  89. package/dist/{erDiagram-AWTI2OKA-DOO75nhy.js → erDiagram-AWTI2OKA-Dd30FpUG.js} +21 -21
  90. package/dist/{erb-C2XKicEJ.js → erb-CVVq1SHo.js} +19 -19
  91. package/dist/{erlang-BWIWBPfK.js → erlang-CoJZUhS4.js} +1 -1
  92. package/dist/{error-banner-CPLhCPHA.js → error-banner-DDDPnVZA.js} +106 -104
  93. package/dist/esm-BC9Qw9UQ.js +4056 -0
  94. package/dist/{esm-DxgKy8Wv.js → esm-DDjaZl5x.js} +14 -14
  95. package/dist/{flowDiagram-PVAE7QVJ-AUJeRwR9.js → flowDiagram-PVAE7QVJ-Dfo2-D8K.js} +23 -23
  96. package/dist/{formats-oddMfm9_.js → formats-DClgE90A.js} +15 -15
  97. package/dist/{fortran-fixed-form-DOH2AovA.js → fortran-fixed-form-DUVqo01t.js} +1 -1
  98. package/dist/{fortran-free-form-DWQ7SFTN.js → fortran-free-form-e6UrnOjF.js} +1 -1
  99. package/dist/{fsharp-GbWUX1wo.js → fsharp-8cm272ry.js} +1 -1
  100. package/dist/{ganttDiagram-OWAHRB6G-d9HlXS4A.js → ganttDiagram-OWAHRB6G-CE9rMeMb.js} +10 -10
  101. package/dist/{gdresource-DJQ1WGjU.js → gdresource-ClFnPq3a.js} +2 -2
  102. package/dist/gdscript-B0LZbOIR.js +4 -0
  103. package/dist/gdshader-DFrJP5ei.js +4 -0
  104. package/dist/{git-commit-73gQ2jal.js → git-commit-BYaLl5ls.js} +1 -1
  105. package/dist/{git-rebase-tezkvplk.js → git-rebase-8n1RW6UD.js} +1 -1
  106. package/dist/{gitGraph-ZV4HHKMB-4c_I6adP.js → gitGraph-ZV4HHKMB-DGIos9rl.js} +3 -3
  107. package/dist/{gitGraphDiagram-NY62KEGX-BdOzqIF7.js → gitGraphDiagram-NY62KEGX-DJjzf0dH.js} +19 -19
  108. package/dist/{glide-data-editor-BFv4VQnc.js → glide-data-editor-CdlLXwb-.js} +94 -94
  109. package/dist/{glimmer-js-B4yN_cyX.js → glimmer-js-Dai0PeIS.js} +4 -4
  110. package/dist/{glimmer-ts-BFwzJYHf.js → glimmer-ts-D_TjaTpy.js} +4 -4
  111. package/dist/glsl-CxEuvrWH.js +5 -0
  112. package/dist/{glsl-Da3zbemV.js → glsl-CyGXCGI2.js} +1 -1
  113. package/dist/go-DdqSEUJy.js +4 -0
  114. package/dist/{graphql-DHCTQXG8.js → graphql-B1Dx1rcM.js} +4 -4
  115. package/dist/graphql-cxjxtpev.js +8 -0
  116. package/dist/{hack-Bq2SPMdZ.js → hack-DaQhTJ_x.js} +4 -4
  117. package/dist/{haml-DKOqVKa_.js → haml-Bp5GoYpB.js} +2 -2
  118. package/dist/haml-CiyF8Brn.js +6 -0
  119. package/dist/{handlebars-lWgxxMwE.js → handlebars-ChGgzSRK.js} +4 -4
  120. package/dist/haxe-DCTL_FCo.js +4 -0
  121. package/dist/hlsl-Bfx4Ir_v.js +4 -0
  122. package/dist/{html-CHICwrWt.js → html-C4wWoZph.js} +2 -2
  123. package/dist/html-CEOIAVhY.js +6 -0
  124. package/dist/{html-derivative-BvtUczEO.js → html-derivative-BBqlL-a4.js} +1 -1
  125. package/dist/{html-derivative-PpMnWy1w.js → html-derivative-COo0pM2g.js} +4 -4
  126. package/dist/{http-CL7ORkDb.js → http-BBZ3n4Nc.js} +9 -9
  127. package/dist/{hxml-dX0MdapH.js → hxml-B3WEmVIR.js} +1 -1
  128. package/dist/{info-63CPKGFF-Bz8ia4ds.js → info-63CPKGFF-BJRf7NSB.js} +3 -3
  129. package/dist/{infoDiagram-STP46IZ2-2N5rOSVf.js → infoDiagram-STP46IZ2-wRiL7RAF.js} +15 -15
  130. package/dist/java-Dg_uLDO2.js +4 -0
  131. package/dist/javascript-UdF6t51O.js +4 -0
  132. package/dist/{jinja-DsZfQ7_N.js → jinja-DIY5F3JL.js} +3 -3
  133. package/dist/{jison-BspgGSu_.js → jison-NvMl7ZRB.js} +1 -1
  134. package/dist/{journeyDiagram-BIP6EPQ6-AkLtiVmB.js → journeyDiagram-BIP6EPQ6-xE-QKfW3.js} +9 -9
  135. package/dist/json-DhGO17Us.js +4 -0
  136. package/dist/jsx-BnWl0sfU.js +4 -0
  137. package/dist/{julia-B_C4JiTM.js → julia-B99Wf6ks.js} +8 -8
  138. package/dist/{kanban-definition-6OIFK2YF-Crxg_HOg.js → kanban-definition-6OIFK2YF-xTM_lSKu.js} +15 -15
  139. package/dist/{katex-CTMLv-Xd.js → katex-_B79i9h_.js} +1 -1
  140. package/dist/{label-Dsm6T1fr.js → label-DboGLjGa.js} +193 -162
  141. package/dist/{latex-DoiWAlAQ.js → latex-CZecqbCK.js} +2 -2
  142. package/dist/less-DZgWnAzP.js +4 -0
  143. package/dist/{line-DBxDZ2GZ.js → line-Bm50ongk.js} +3 -3
  144. package/dist/{linear-B8XR-NVr.js → linear-CUCOukde.js} +2 -2
  145. package/dist/{liquid-Bv5Ox8yg.js → liquid-CBTCQ-BA.js} +4 -4
  146. package/dist/{lua-BKJ_BAEH.js → lua-BAo0xbXr.js} +1 -1
  147. package/dist/lua-C4LdLFQB.js +5 -0
  148. package/dist/main.js +12652 -12194
  149. package/dist/markdown-DmoiORob.js +4 -0
  150. package/dist/{marko-DEzr-2oj.js → marko-aJY3NB2u.js} +4 -4
  151. package/dist/{mdc-GC7qNQda.js → mdc-DUOD_AOa.js} +6 -6
  152. package/dist/{mermaid-BeGlg1JH.js → mermaid-DKh-bxRG.js} +24 -24
  153. package/dist/{mermaid-parser.core-C5kJ8cMb.js → mermaid-parser.core-BkBK5D-D.js} +8 -8
  154. package/dist/mermaid.core-BlYN1aB0.js +31 -0
  155. package/dist/{mermaid.core-2hDUD3tS.js → mermaid.core-DhviAB-E.js} +35 -35
  156. package/dist/{mhchem-ydsvRuzJ.js → mhchem-BLvV19Q1.js} +1 -1
  157. package/dist/{mindmap-definition-Q6HEUPPD-u3xALYXy.js → mindmap-definition-Q6HEUPPD-DhGkxCFl.js} +20 -20
  158. package/dist/{nginx-WYx0kjQD.js → nginx-C4wBmtSL.js} +2 -2
  159. package/dist/{nim-B59jjkdb.js → nim-7HUrH4-G.js} +8 -8
  160. package/dist/{number-overlay-editor-BJoc-iTp.js → number-overlay-editor-B7JKtSXW.js} +1 -1
  161. package/dist/{ordinal-DncHRC0c.js → ordinal-CgAjEHLv.js} +1 -1
  162. package/dist/{packet-HUATNLJX-DZeFAkmI.js → packet-HUATNLJX-COt0WQbt.js} +3 -3
  163. package/dist/{perl-BWXWNd9p.js → perl-DcIsham4.js} +6 -6
  164. package/dist/{php-B2IAnMDw.js → php-BMhhkMnI.js} +6 -6
  165. package/dist/php-BgNggqvM.js +11 -0
  166. package/dist/{pie-WTHONI2E-CcN2FpmZ.js → pie-WTHONI2E-7VABasD6.js} +3 -3
  167. package/dist/{pieDiagram-ADFJNKIX-B40sMFEq.js → pieDiagram-ADFJNKIX-CV46TPgr.js} +24 -24
  168. package/dist/postcss-BV0gPaAN.js +4 -0
  169. package/dist/{pug-jCrWgXoo.js → pug-C7hWP9pb.js} +3 -3
  170. package/dist/python-DrIYjHcK.js +4 -0
  171. package/dist/{qml-BvryPJl6.js → qml-4wNHxISd.js} +1 -1
  172. package/dist/{quadrantDiagram-LMRXKWRM-C-qFDzwP.js → quadrantDiagram-LMRXKWRM-0ohBNHBM.js} +5 -5
  173. package/dist/r-bWdZZY4p.js +4 -0
  174. package/dist/{radar-NJJJXTRR-DgOJ0Ctc.js → radar-NJJJXTRR-DEeA59xM.js} +3 -3
  175. package/dist/{razor-BsW9JZIF.js → razor-kE6VSkUw.js} +4 -4
  176. package/dist/react-vega-BFAvc6S7.js +25 -0
  177. package/dist/{react-vega-DDXWt_PN.js → react-vega-L8_x6Wjr.js} +1564 -845
  178. package/dist/regexp-Du19WMsH.js +4 -0
  179. package/dist/{requirementDiagram-4UW4RH46-Cl_mIh_y.js → requirementDiagram-4UW4RH46-DSnND54_.js} +20 -20
  180. package/dist/{rst-CRU76Z1W.js → rst-CjWaqJB3.js} +22 -22
  181. package/dist/{ruby-9gRRZYzM.js → ruby-CX211_l4.js} +12 -12
  182. package/dist/ruby-Dsch-4qr.js +22 -0
  183. package/dist/{sankeyDiagram-GR3RE2ED-Dm9k3dHY.js → sankeyDiagram-GR3RE2ED-C4jd7w5x.js} +6 -6
  184. package/dist/{sas-BDTaEI61.js → sas-Bso79j2d.js} +1 -1
  185. package/dist/{scss-B1u4Hrbb.js → scss-B2x0kI7c.js} +1 -1
  186. package/dist/scss-BHcIhkao.js +5 -0
  187. package/dist/sdbl-CiVVvobW.js +4 -0
  188. package/dist/{sequenceDiagram-C3RYC4MD-DmU9oc42.js → sequenceDiagram-C3RYC4MD-4cYnu6yf.js} +10 -10
  189. package/dist/{shaderlab-Bm5WmYK9.js → shaderlab-B4l4__9m.js} +1 -1
  190. package/dist/shellscript-Carvxcyf.js +4 -0
  191. package/dist/{shellsession-CN-wC7WL.js → shellsession-D-krdWsh.js} +1 -1
  192. package/dist/{slides-component-CZksIptv.js → slides-component-Cm9g-y7F.js} +1 -1
  193. package/dist/{soy-CeMP2PMh.js → soy-wFhS-Vjb.js} +3 -3
  194. package/dist/{sparql-M76X2Hg1.js → sparql-D6Kv-L3I.js} +1 -1
  195. package/dist/{spec-BotzCMo3.js → spec-B7BWIiD8.js} +3 -3
  196. package/dist/sql-CVP77J2a.js +4 -0
  197. package/dist/{src-CePha-_O.js → src-DopHipf8.js} +1 -1
  198. package/dist/{stata-BH7l4VD7.js → stata-1fehkWpU.js} +1 -1
  199. package/dist/{stateDiagram-KXAO66HF-D_SUaMYR.js → stateDiagram-KXAO66HF-Cq-ezNe-.js} +21 -21
  200. package/dist/stateDiagram-v2-UMBNRL4Z-QxkaR8xk.js +39 -0
  201. package/dist/{step-zYP-E-fB.js → step-Bixovd6W.js} +1 -1
  202. package/dist/stex-IzMc-wiJ.js +5 -0
  203. package/dist/style.css +1 -2
  204. package/dist/stylus-BTQe34gF.js +4 -0
  205. package/dist/{svelte-TwcowgfT.js → svelte-DZNFxgw8.js} +4 -4
  206. package/dist/{templ-BpG-MhQv.js → templ-unaxtPDu.js} +3 -3
  207. package/dist/tex-B02KkJuq.js +5 -0
  208. package/dist/{tex-CBM64lBG.js → tex-WcClzGDl.js} +1 -1
  209. package/dist/{time-DRnNkqSS.js → time-D5kvxFYj.js} +2 -2
  210. package/dist/{timeline-definition-XQNQX7LJ-BgkB1JzD.js → timeline-definition-XQNQX7LJ-HouMBLkR.js} +6 -6
  211. package/dist/{treemap-75Q7IDZK-CGM2jb5Y.js → treemap-75Q7IDZK-rIabFN59.js} +3 -3
  212. package/dist/{ts-tags-CywVDBFD.js → ts-tags-Dw16jybl.js} +9 -9
  213. package/dist/tsx-2o7mnE6q.js +4 -0
  214. package/dist/turtle-CDidgplC.js +4 -0
  215. package/dist/{twig-DKvQCGZl.js → twig-CTY0fjwf.js} +23 -23
  216. package/dist/{types-IRrkdH-H.js → types-8-7JTTaW.js} +167 -166
  217. package/dist/typescript-Z3djoets.js +4 -0
  218. package/dist/{useAsyncData-CsSW6_Zh.js → useAsyncData-_ejUTnFA.js} +1 -1
  219. package/dist/{useTheme-D56Xlrez.js → useTheme-Cpx27F7Z.js} +4 -2
  220. package/dist/{vega-component-CLjz4see.js → vega-component-r6NkLfxM.js} +213 -212
  221. package/dist/{vue-CUZawI_b.js → vue-BjZgU5Nz.js} +6 -6
  222. package/dist/vue-DhUZPDmo.js +10 -0
  223. package/dist/{vue-html-Bx7_HmU0.js → vue-html-C4EmFqJx.js} +7 -7
  224. package/dist/{vue-vine-9w78JPDc.js → vue-vine-DrjIj56i.js} +11 -11
  225. package/dist/{xml-CEIIhUsl.js → xml-BgKyT7dU.js} +1 -1
  226. package/dist/xml-C7KksLEJ.js +5 -0
  227. package/dist/{xsl-BynZr4Sw.js → xsl-9daNus4h.js} +2 -2
  228. package/dist/{xychartDiagram-6GGTOJPD-u5660hzT.js → xychartDiagram-6GGTOJPD-DkDWjoGr.js} +16 -16
  229. package/dist/yaml-zmBXofFy.js +4 -0
  230. package/package.json +8 -8
  231. package/src/components/chat/acp/blocks.tsx +1 -1
  232. package/src/components/chat/chat-panel.tsx +1 -1
  233. package/src/components/chat/reasoning-accordion.tsx +1 -1
  234. package/src/components/data-table/__tests__/columns.test.tsx +143 -1
  235. package/src/components/data-table/__tests__/url-detector.test.tsx +92 -1
  236. package/src/components/data-table/columns.tsx +34 -17
  237. package/src/components/data-table/download-actions.tsx +16 -8
  238. package/src/components/data-table/row-viewer-panel/row-viewer.tsx +5 -5
  239. package/src/components/data-table/url-detector.tsx +43 -0
  240. package/src/components/datasources/utils.ts +7 -0
  241. package/src/components/editor/ai/ai-completion-editor.tsx +6 -3
  242. package/src/components/editor/cell/CreateCellButton.tsx +98 -88
  243. package/src/components/editor/chrome/panels/packages-panel.tsx +1 -1
  244. package/src/components/editor/chrome/types.ts +7 -0
  245. package/src/components/editor/file-tree/__tests__/file-expolorer.test.ts +1 -0
  246. package/src/components/editor/file-tree/file-explorer.tsx +6 -5
  247. package/src/components/editor/notebook-cell.tsx +27 -25
  248. package/src/components/editor/output/__tests__/ansi-reduce.test.ts +8 -0
  249. package/src/components/editor/output/ansi-reduce.ts +7 -4
  250. package/src/components/editor/renderers/grid-layout/grid-layout.tsx +35 -3
  251. package/src/components/ui/table.tsx +1 -1
  252. package/src/core/ai/tools/__tests__/edit-notebook-tool.test.ts +156 -10
  253. package/src/core/ai/tools/__tests__/registry.test.ts +35 -1
  254. package/src/core/ai/tools/edit-notebook-tool.ts +86 -45
  255. package/src/core/cells/__tests__/logs.test.ts +371 -0
  256. package/src/core/cells/logs.ts +16 -5
  257. package/src/core/codemirror/__tests__/format.test.ts +28 -2
  258. package/src/core/codemirror/copilot/copilot-config.tsx +1 -1
  259. package/src/core/codemirror/editing/commands.ts +4 -3
  260. package/src/core/codemirror/format.ts +105 -7
  261. package/src/core/codemirror/language/languages/sql/completion-store.ts +1 -1
  262. package/src/core/codemirror/language/languages/sql/sql.ts +8 -1
  263. package/src/core/codemirror/language/languages/sql/utils.ts +15 -0
  264. package/src/core/codemirror/language/panel/panel.tsx +1 -1
  265. package/src/core/config/config-schema.ts +3 -3
  266. package/src/core/websocket/useMarimoWebSocket.tsx +1 -1
  267. package/src/css/app/Cell.css +6 -1
  268. package/src/plugins/impl/DateTimePickerPlugin.tsx +3 -1
  269. package/src/plugins/impl/__tests__/DateTimePickerPlugin.test.tsx +3 -0
  270. package/src/plugins/impl/common/error-banner.tsx +7 -3
  271. package/src/plugins/impl/vega/VegaPlugin.tsx +1 -0
  272. package/src/plugins/impl/vega/vega-component.tsx +26 -5
  273. package/src/plugins/layout/__test__/ProgressPlugin.test.ts +1 -1
  274. package/dist/Combination-D68fi0fY.js +0 -2504
  275. package/dist/angular-html-BcsYKZNy.js +0 -7
  276. package/dist/c-RhvfrIXd.js +0 -4
  277. package/dist/classDiagram-KNZD7YFC-BwfV2ECJ.js +0 -40
  278. package/dist/classDiagram-v2-RKCZMP56-CdtBTwGN.js +0 -40
  279. package/dist/cmake-Dv9WBQ8F.js +0 -4
  280. package/dist/cpp-De3HlDQp.js +0 -8
  281. package/dist/csharp-DONDYcLD.js +0 -4
  282. package/dist/css-KrVDDZJI.js +0 -4
  283. package/dist/diff-C_xoFltE.js +0 -4
  284. package/dist/dist-C_ywAD_6.js +0 -10
  285. package/dist/dist-Umyw8yf9.js +0 -10
  286. package/dist/download-Bb5BCMXq.js +0 -145
  287. package/dist/esm-Cjo4c4Vw.js +0 -2188
  288. package/dist/gdscript-CCtCxlxC.js +0 -4
  289. package/dist/gdshader-DRsZz2Lo.js +0 -4
  290. package/dist/glsl-Bpd55IJK.js +0 -5
  291. package/dist/go-BZbX8CmG.js +0 -4
  292. package/dist/graphql-C3W9lZa9.js +0 -8
  293. package/dist/haml-0dNTXdjh.js +0 -6
  294. package/dist/haxe-D67WIBdi.js +0 -4
  295. package/dist/hlsl-A_Yq2Muj.js +0 -4
  296. package/dist/html-C6ObPTU5.js +0 -6
  297. package/dist/java-BFakZb2S.js +0 -4
  298. package/dist/javascript-B8ZNE_3R.js +0 -4
  299. package/dist/json-CVwA-VKM.js +0 -4
  300. package/dist/jsx-TsEBgZMR.js +0 -4
  301. package/dist/less-R7I1oHvn.js +0 -4
  302. package/dist/lua-CdOJTa1m.js +0 -5
  303. package/dist/markdown-Czm489_C.js +0 -4
  304. package/dist/mermaid.core-D5NqLRbX.js +0 -31
  305. package/dist/php-B2RrCM5T.js +0 -11
  306. package/dist/postcss-CK8yd697.js +0 -4
  307. package/dist/python-BAyuw8wl.js +0 -4
  308. package/dist/r-CMKGyVVD.js +0 -4
  309. package/dist/react-vega-DV2IwPx_.js +0 -25
  310. package/dist/regexp-C-NGZx14.js +0 -4
  311. package/dist/ruby-DC1LiM9o.js +0 -22
  312. package/dist/scss-9LDy_1oh.js +0 -5
  313. package/dist/sdbl-Cauk10zS.js +0 -4
  314. package/dist/shellscript-DPV_oGnY.js +0 -4
  315. package/dist/sql-BuUisnb3.js +0 -4
  316. package/dist/stateDiagram-v2-UMBNRL4Z-DdAPrjTz.js +0 -39
  317. package/dist/stex-BPCIi6ix.js +0 -5
  318. package/dist/stylus-BzfQ5p6U.js +0 -4
  319. package/dist/tex-DKaqHjWi.js +0 -5
  320. package/dist/tsx-CAS2Oalp.js +0 -4
  321. package/dist/turtle-Dqog6asB.js +0 -4
  322. package/dist/typescript-DHHJAsKz.js +0 -4
  323. package/dist/vue-DiyvUvuo.js +0 -10
  324. package/dist/xml-wE_-A0vH.js +0 -5
  325. package/dist/yaml-5htSumZI.js +0 -4
  326. /package/dist/{ImageComparisonComponent-DTO3nRq-.js → ImageComparisonComponent-CXBJ7S4z.js} +0 -0
  327. /package/dist/{abap-Cnc1m8d-.js → abap-I2cGjSH1.js} +0 -0
  328. /package/dist/{actionscript-3-g8zBgLKw.js → actionscript-3-DL1yGs6S.js} +0 -0
  329. /package/dist/{ada-MlSLvfsc.js → ada-BkGUMHAC.js} +0 -0
  330. /package/dist/{andromeeda-CkQePh6_.js → andromeeda-BWSHGuDt.js} +0 -0
  331. /package/dist/{apache-Cp-BBvQI.js → apache-DRnLyMnR.js} +0 -0
  332. /package/dist/{apex-CID9_iW1.js → apex-CA0TS4zn.js} +0 -0
  333. /package/dist/{applescript-Bv6vEFim.js → applescript-B8vB3y-q.js} +0 -0
  334. /package/dist/{ara-l5FvBxcT.js → ara-C0et56O5.js} +0 -0
  335. /package/dist/{array-lX94FrxB.js → array-vD2Vw0bk.js} +0 -0
  336. /package/dist/{asciidoc-BpLzRCLD.js → asciidoc-a6FHzc0d.js} +0 -0
  337. /package/dist/{asm-CxMfzk9G.js → asm-3DPfbryP.js} +0 -0
  338. /package/dist/{asterisk-Cbdk9I7-.js → asterisk-CbqErmo8.js} +0 -0
  339. /package/dist/{aurora-x-BmJfZyvk.js → aurora-x-Cq0GoPAm.js} +0 -0
  340. /package/dist/{awk-DZbdMF01.js → awk-GgrsjT7w.js} +0 -0
  341. /package/dist/{ayu-dark-Ce21p_3j.js → ayu-dark-BOgp0yX0.js} +0 -0
  342. /package/dist/{ballerina-6WMbs5Nh.js → ballerina-DErPOQth.js} +0 -0
  343. /package/dist/{bat-D70SunD8.js → bat-CkhnPpIS.js} +0 -0
  344. /package/dist/{beancount-DtkuCj7H.js → beancount-Rkl6N3Po.js} +0 -0
  345. /package/dist/{berry-DbfHEJGk.js → berry-C0cFa9Eb.js} +0 -0
  346. /package/dist/{bibtex-Cl9qlt9d.js → bibtex-PErECouH.js} +0 -0
  347. /package/dist/{bicep-0zpjixSE.js → bicep-B9tJFYg8.js} +0 -0
  348. /package/dist/{c-0VtUNZe8.js → c-xZK3SMJX.js} +0 -0
  349. /package/dist/{cadence-D2-Gq0t7.js → cadence-D2lNr2F0.js} +0 -0
  350. /package/dist/{catppuccin-frappe-DFz6L_QP.js → catppuccin-frappe-CEY1tx7K.js} +0 -0
  351. /package/dist/{catppuccin-latte-DSTm5iMg.js → catppuccin-latte-BjeOZATb.js} +0 -0
  352. /package/dist/{catppuccin-macchiato-D5cPlFDN.js → catppuccin-macchiato-HTrdL1Py.js} +0 -0
  353. /package/dist/{catppuccin-mocha-BBVxciDI.js → catppuccin-mocha-DaNBfKBN.js} +0 -0
  354. /package/dist/{chunk-57QY23SG-B6p-8LKm.js → chunk-57QY23SG-CtPsoWDn.js} +0 -0
  355. /package/dist/{clarity-CTtLMvQr.js → clarity-Di3YnyD4.js} +0 -0
  356. /package/dist/{click-outside-container-CR-VHaIe.js → click-outside-container-DnKND-Y5.js} +0 -0
  357. /package/dist/{clojure-CQ_s11PN.js → clojure-BaI1cLwf.js} +0 -0
  358. /package/dist/{cmake-DF99YgK0.js → cmake-Ct5KlIlx.js} +0 -0
  359. /package/dist/{codeowners-CRbICvXw.js → codeowners-B47SmYv4.js} +0 -0
  360. /package/dist/{codeql-DzUBsQZ9.js → codeql-C-RyBs2A.js} +0 -0
  361. /package/dist/{colors-C2w3uhVQ.js → colors-c_1kHhMM.js} +0 -0
  362. /package/dist/{common-keywords-D7noiVjl.js → common-keywords-qG52oQhe.js} +0 -0
  363. /package/dist/{common-lisp-CkedN1Bk.js → common-lisp-BEkqGRVt.js} +0 -0
  364. /package/dist/{coq-B7OBnzDw.js → coq-BMELwi0x.js} +0 -0
  365. /package/dist/{csharp-nXluFhrZ.js → csharp-D8kGQl5L.js} +0 -0
  366. /package/dist/{css-CPr1yM7G.js → css-D91D9ZFJ.js} +0 -0
  367. /package/dist/{csv-BTyvW9Dm.js → csv-DsiEeqZB.js} +0 -0
  368. /package/dist/{cue-CtcusocM.js → cue-Bd4pPCrb.js} +0 -0
  369. /package/dist/{cypher-BCo9_Gxf.js → cypher-CY6X1_fR.js} +0 -0
  370. /package/dist/{cytoscape.esm-CeO110wc.js → cytoscape.esm-D3qnLru1.js} +0 -0
  371. /package/dist/{d-qe1Yx8Pk.js → d-Dq3ZvYXH.js} +0 -0
  372. /package/dist/{dark-plus-COhL9N0K.js → dark-plus-DAkssByr.js} +0 -0
  373. /package/dist/{dart-C-zwBpkD.js → dart-CRwsUVcK.js} +0 -0
  374. /package/dist/{dax-9HVn3jKI.js → dax-yCcjIsFY.js} +0 -0
  375. /package/dist/{desktop-DcOWBslk.js → desktop-F3trsLZp.js} +0 -0
  376. /package/dist/{diff-0HrJYevs.js → diff-oSoYkmE6.js} +0 -0
  377. /package/dist/{dist-Ck_uei4a.js → dist-BEBl1fVc.js} +0 -0
  378. /package/dist/{dist-BOoOMWpw.js → dist-L1A29jng.js} +0 -0
  379. /package/dist/{dist-CFOn9U6a.js → dist-RsSoJ-Ow.js} +0 -0
  380. /package/dist/{dist-BLj2WRAk.js → dist-WgdRzo73.js} +0 -0
  381. /package/dist/{dist-Dndqm_ya.js → dist-_HymStvo.js} +0 -0
  382. /package/dist/{dist-B9BklWGT.js → dist-zlCh7zB9.js} +0 -0
  383. /package/dist/{docker-oHtI3hEB.js → docker-CzW3fUnV.js} +0 -0
  384. /package/dist/{dockerfile-DSCH583m.js → dockerfile-TsgC6Bmm.js} +0 -0
  385. /package/dist/{dotenv-sY_xnKYe.js → dotenv-C5RAv6mV.js} +0 -0
  386. /package/dist/{dracula-Bh9RLqOx.js → dracula-0J2lfdjD.js} +0 -0
  387. /package/dist/{dracula-soft-Cvp6b01Z.js → dracula-soft-CZX9ZgRW.js} +0 -0
  388. /package/dist/{dream-maker-6snTsD3J.js → dream-maker-D668Dv7O.js} +0 -0
  389. /package/dist/{duckdb-keywords-BCq77yXm.js → duckdb-keywords-DHIKlX_6.js} +0 -0
  390. /package/dist/{ebnf-BnX_o_Yq.js → ebnf-spWsoNeW.js} +0 -0
  391. /package/dist/{emacs-lisp-C6oq3DLk.js → emacs-lisp-9r6Oy_vR.js} +0 -0
  392. /package/dist/{everforest-dark-BYBypIqM.js → everforest-dark-BV3p6ZTT.js} +0 -0
  393. /package/dist/{everforest-light-D4mfI1FM.js → everforest-light-D4viDjQH.js} +0 -0
  394. /package/dist/{fcl-DDKjgNry.js → fcl-DOHQxani.js} +0 -0
  395. /package/dist/{fennel-C4o5c4mv.js → fennel-DdgItcQL.js} +0 -0
  396. /package/dist/{fish-BD9AkN7o.js → fish-Dah-0_yV.js} +0 -0
  397. /package/dist/{fluent-eCvhADRq.js → fluent-Dkmhuwpv.js} +0 -0
  398. /package/dist/{fortran-free-form-CuTQJQMN.js → fortran-free-form-DNLybXh-.js} +0 -0
  399. /package/dist/{gdscript-B40Spm2S.js → gdscript-DtYBhJ1b.js} +0 -0
  400. /package/dist/{gdshader-BZSmNWVa.js → gdshader-BV2VMgVk.js} +0 -0
  401. /package/dist/{genie-Cy_D8EWg.js → genie-BFMUrkvN.js} +0 -0
  402. /package/dist/{gherkin-ct-w1STV.js → gherkin-DppeDWDv.js} +0 -0
  403. /package/dist/{github-dark-CbIY86Wd.js → github-dark-D29L3HCC.js} +0 -0
  404. /package/dist/{github-dark-default-BlPRzuGs.js → github-dark-default-n3il8rgM.js} +0 -0
  405. /package/dist/{github-dark-dimmed-CwyHPTp3.js → github-dark-dimmed-oz4y0Wki.js} +0 -0
  406. /package/dist/{github-dark-high-contrast-Ch3E28Ga.js → github-dark-high-contrast-By7F7Fv0.js} +0 -0
  407. /package/dist/{github-light-BM3RayZ2.js → github-light-CWUlQb3u.js} +0 -0
  408. /package/dist/{github-light-default-BWhIdJf6.js → github-light-default-BffED7Ak.js} +0 -0
  409. /package/dist/{github-light-high-contrast-CKsJGAYi.js → github-light-high-contrast-Pu6OZUhP.js} +0 -0
  410. /package/dist/{gleam-Cwu_dIV7.js → gleam-BUcDYi_k.js} +0 -0
  411. /package/dist/{gnuplot-W2uzVV04.js → gnuplot-C1MgslgQ.js} +0 -0
  412. /package/dist/{go-C0N7iCwo.js → go-CYZiZRxy.js} +0 -0
  413. /package/dist/{groovy-BCFsp4zc.js → groovy-ClTIQGUH.js} +0 -0
  414. /package/dist/{gruvbox-dark-hard-DMFH1kAD.js → gruvbox-dark-hard-Bp86g2V_.js} +0 -0
  415. /package/dist/{gruvbox-dark-medium-DiHZEQva.js → gruvbox-dark-medium-BK2iIEfy.js} +0 -0
  416. /package/dist/{gruvbox-dark-soft-De9URWso.js → gruvbox-dark-soft-B_0xgXvI.js} +0 -0
  417. /package/dist/{gruvbox-light-hard-DzokvGK_.js → gruvbox-light-hard-DBlpi77o.js} +0 -0
  418. /package/dist/{gruvbox-light-medium-C4psEnS5.js → gruvbox-light-medium-CAccdTaF.js} +0 -0
  419. /package/dist/{gruvbox-light-soft-DL0f_6un.js → gruvbox-light-soft-DcO-EcR5.js} +0 -0
  420. /package/dist/{haskell-CDLvQWXZ.js → haskell-A1vUYtej.js} +0 -0
  421. /package/dist/{haxe-CLjmCvGB.js → haxe-DnHFv-TV.js} +0 -0
  422. /package/dist/{hcl-COL_PBAE.js → hcl-CU6j-Xhf.js} +0 -0
  423. /package/dist/{hjson-DkR4GFDO.js → hjson-ClOjKSoB.js} +0 -0
  424. /package/dist/{hlsl-BJKnqnDQ.js → hlsl-Q52_rKUP.js} +0 -0
  425. /package/dist/{houston-DYwZabvW.js → houston-DGG5Ln2h.js} +0 -0
  426. /package/dist/{http-2MVb-dsB.js → http-BgHOhKz2.js} +0 -0
  427. /package/dist/{hy-OsbjMwY0.js → hy-Bja9Numd.js} +0 -0
  428. /package/dist/{imba-Ddkaio98.js → imba-HOr9EX5j.js} +0 -0
  429. /package/dist/{ini-CNrkD-OZ.js → ini-EvmYJ-83.js} +0 -0
  430. /package/dist/{init-BU4YGOOg.js → init-BsH2JjGd.js} +0 -0
  431. /package/dist/{java-Ci6qXyg1.js → java-91iGU5ap.js} +0 -0
  432. /package/dist/{javascript-URuDoMWW.js → javascript-CPeJGbMe.js} +0 -0
  433. /package/dist/{json-DX7TV6Gi.js → json-N0VDmGwx.js} +0 -0
  434. /package/dist/{json5-Djp3uvi3.js → json5-BC1TPZZb.js} +0 -0
  435. /package/dist/{jsonc-XlYTIqzR.js → jsonc-B88-mC9I.js} +0 -0
  436. /package/dist/{jsonl-GwfHzMab.js → jsonl-CXu8ax4T.js} +0 -0
  437. /package/dist/{jsonnet-CPv7P6JN.js → jsonnet-0HtPQpiV.js} +0 -0
  438. /package/dist/{jssm-DdbAawAp.js → jssm-Bk3koTsK.js} +0 -0
  439. /package/dist/{jsx-DkGuBjr4.js → jsx-Cbdt0xgS.js} +0 -0
  440. /package/dist/{kanagawa-dragon-Vs6U6z1S.js → kanagawa-dragon-6wkRCL1O.js} +0 -0
  441. /package/dist/{kanagawa-lotus-Buvs3lt0.js → kanagawa-lotus-21R5pwns.js} +0 -0
  442. /package/dist/{kanagawa-wave-Bj2TElAo.js → kanagawa-wave-DvIMpnk3.js} +0 -0
  443. /package/dist/{katex-DHhoxnpM.js → katex-Cymo3Ugt.js} +0 -0
  444. /package/dist/{kotlin-Cpc_0A7a.js → kotlin-Brxn_vmg.js} +0 -0
  445. /package/dist/{kusto-Co9wVBCz.js → kusto-CLSwwyw9.js} +0 -0
  446. /package/dist/{laserwave-Ca61-FAH.js → laserwave-D2HyGZu4.js} +0 -0
  447. /package/dist/{lean-C0Aa7Fsj.js → lean-C7cjnnxn.js} +0 -0
  448. /package/dist/{less-_PXFbiQM.js → less-Db3q8KJ4.js} +0 -0
  449. /package/dist/{light-plus-5ex0bkO5.js → light-plus-C2C7fw4Z.js} +0 -0
  450. /package/dist/{llvm-BbKHoWwP.js → llvm-DAIyCtJL.js} +0 -0
  451. /package/dist/{log-CAfpKA3d.js → log-vTaTH8PJ.js} +0 -0
  452. /package/dist/{logo-_JZv2_m7.js → logo-D9tY6FNo.js} +0 -0
  453. /package/dist/{luau-By4kXsmQ.js → luau-IjR5-Ywl.js} +0 -0
  454. /package/dist/{main-BeKMoTBP.js → main-CRpnHr48.js} +0 -0
  455. /package/dist/{make-BRzozWYB.js → make-Cu-cnuA_.js} +0 -0
  456. /package/dist/{markdown-DBlXv3d9.js → markdown-C5F3cvct.js} +0 -0
  457. /package/dist/{marked.esm-CqJtK50L.js → marked.esm-DpOvkPbZ.js} +0 -0
  458. /package/dist/{material-theme-UdvytYzK.js → material-theme-DC62_X77.js} +0 -0
  459. /package/dist/{material-theme-darker-ifWxjE_M.js → material-theme-darker-ZdvrV-zE.js} +0 -0
  460. /package/dist/{material-theme-lighter-BJMt_hpe.js → material-theme-lighter-CjF6eqam.js} +0 -0
  461. /package/dist/{material-theme-ocean-DBLAtuvq.js → material-theme-ocean-B1OEP8g-.js} +0 -0
  462. /package/dist/{material-theme-palenight-D_bLdV4c.js → material-theme-palenight-DG7XKA0s.js} +0 -0
  463. /package/dist/{math-B9kWnSVt.js → math-kvEWD7RZ.js} +0 -0
  464. /package/dist/{matlab-SZvC4TdD.js → matlab-Bkgl6cmi.js} +0 -0
  465. /package/dist/{mdx-FGsuIggU.js → mdx-B3dxoxO_.js} +0 -0
  466. /package/dist/{mermaid-Bq_9A0K_.js → mermaid-Vk73zc_P.js} +0 -0
  467. /package/dist/{min-dark-CXAX-ZXK.js → min-dark-BXnwqHsA.js} +0 -0
  468. /package/dist/{min-light-BCnp1thB.js → min-light-t8HWsGPD.js} +0 -0
  469. /package/dist/{mipsasm-B5qmQK6W.js → mipsasm-DM3DsUwR.js} +0 -0
  470. /package/dist/{mojo-GIDM7_y7.js → mojo-CgJHtiXY.js} +0 -0
  471. /package/dist/{monokai-DL7jaPcf.js → monokai-CRI7M-ed.js} +0 -0
  472. /package/dist/{move-DRJvkv3E.js → move-DQHQ0ily.js} +0 -0
  473. /package/dist/{narrat-v6fb47Is.js → narrat-UVO3rS1B.js} +0 -0
  474. /package/dist/{nextflow-C602gAKa.js → nextflow-DrtHoX7E.js} +0 -0
  475. /package/dist/{nginx-xAcu9XCN.js → nginx-DJ7UgEOR.js} +0 -0
  476. /package/dist/{night-owl-Q-U_lEu6.js → night-owl-Ci5d2mya.js} +0 -0
  477. /package/dist/{nix-BRjH373I.js → nix-Cgk0qZB-.js} +0 -0
  478. /package/dist/{nord-CRIAyay1.js → nord-D3dA8PCc.js} +0 -0
  479. /package/dist/{nushell-5Ddvrppp.js → nushell-smo4Ehcx.js} +0 -0
  480. /package/dist/{objective-c-zrea_Ajz.js → objective-c-CVuojEvS.js} +0 -0
  481. /package/dist/{objective-cpp-BMgGRJTH.js → objective-cpp-Bpp59CkK.js} +0 -0
  482. /package/dist/{ocaml-Cc5CTR8t.js → ocaml-DYQwODYU.js} +0 -0
  483. /package/dist/{one-dark-pro-cEF3x_tc.js → one-dark-pro-CdYrsWA6.js} +0 -0
  484. /package/dist/{one-light-B0buW1FQ.js → one-light-B0fXewxa.js} +0 -0
  485. /package/dist/{pascal-C5MhYtdx.js → pascal-G_r9auPk.js} +0 -0
  486. /package/dist/{path-B-wCTTNY.js → path-DIzMdTua.js} +0 -0
  487. /package/dist/{plastic-4xY83A97.js → plastic-CC7C-r0m.js} +0 -0
  488. /package/dist/{plsql-DiS5vMuw.js → plsql-DmZBDDMQ.js} +0 -0
  489. /package/dist/{po-CE5EllyY.js → po-Bdl0SmZa.js} +0 -0
  490. /package/dist/{poimandres-C02cLu8D.js → poimandres-BPoRyzO_.js} +0 -0
  491. /package/dist/{polar-NxJPG_A1.js → polar-DdEuU550.js} +0 -0
  492. /package/dist/{postcss-BKFdDTSc.js → postcss-DgtXUb_w.js} +0 -0
  493. /package/dist/{powerquery-ClOwEHrw.js → powerquery-D5rcV1b7.js} +0 -0
  494. /package/dist/{powershell-DtnsETbd.js → powershell-CreFd35r.js} +0 -0
  495. /package/dist/{prisma-DQRqqd02.js → prisma-BSSS_9KD.js} +0 -0
  496. /package/dist/{prolog-BXwR1iEr.js → prolog-Cxq7ex3-.js} +0 -0
  497. /package/dist/{proto-DbdCTNJQ.js → proto-Di89JUpw.js} +0 -0
  498. /package/dist/{puppet-C0fmEeZ8.js → puppet-D-8yt0A2.js} +0 -0
  499. /package/dist/{purescript-DCzClV2L.js → purescript-Dsyys8lw.js} +0 -0
  500. /package/dist/{python-C9XsBnIS.js → python-DyJn0gY6.js} +0 -0
  501. /package/dist/{qmldir-BgPLvM_B.js → qmldir-Djlda7Cs.js} +0 -0
  502. /package/dist/{qss-DH_QKtyV.js → qss-DtDj95Ib.js} +0 -0
  503. /package/dist/{r-CE7tet3U.js → r-9vHvMbjq.js} +0 -0
  504. /package/dist/{racket-BXFuJ8S4.js → racket-BQnOONmJ.js} +0 -0
  505. /package/dist/{raku-BV2f5Bfp.js → raku-DZArQH1C.js} +0 -0
  506. /package/dist/{react-plotly-BSDG5040.js → react-plotly-B8bzf42j.js} +0 -0
  507. /package/dist/{red-NReit8D_.js → red-DdIrZaxO.js} +0 -0
  508. /package/dist/{reg-y78MnffL.js → reg-CM_FOY35.js} +0 -0
  509. /package/dist/{regexp-BkaqnlX1.js → regexp-Dh_KbmYB.js} +0 -0
  510. /package/dist/{rel-ChUSBGxs.js → rel-Cf8vFh7G.js} +0 -0
  511. /package/dist/{riscv-Cw3bJM3f.js → riscv-DFLesDmH.js} +0 -0
  512. /package/dist/{rose-pine-C_LOz2fx.js → rose-pine-C6TQipgc.js} +0 -0
  513. /package/dist/{rose-pine-dawn-DAyopyJp.js → rose-pine-dawn-DUw8_6c0.js} +0 -0
  514. /package/dist/{rose-pine-moon-D65s7ycF.js → rose-pine-moon-5rpZhuOi.js} +0 -0
  515. /package/dist/{rust-CNYdgIe2.js → rust-CLaTh4j5.js} +0 -0
  516. /package/dist/{sass-CTLsc-He.js → sass-DXaowKfb.js} +0 -0
  517. /package/dist/{scala-DAvnmlLT.js → scala-BwYNCkHH.js} +0 -0
  518. /package/dist/{scheme-BQ8akAiY.js → scheme-Cwv1j_5J.js} +0 -0
  519. /package/dist/{sdbl-BqdEdxub.js → sdbl-ZWGgjiIv.js} +0 -0
  520. /package/dist/{shellscript-SX0nv4lc.js → shellscript-CHtXIYYk.js} +0 -0
  521. /package/dist/{slack-dark-DP48wn3J.js → slack-dark-CEL96wwz.js} +0 -0
  522. /package/dist/{slack-ochin-JvZjQMr4.js → slack-ochin-Ih8BUTjo.js} +0 -0
  523. /package/dist/{smalltalk-Cd_zoqRt.js → smalltalk-Bz_Wq6O1.js} +0 -0
  524. /package/dist/{snazzy-light-Dn5RlLOZ.js → snazzy-light-BtCbn8qt.js} +0 -0
  525. /package/dist/{solarized-dark-juR81_fw.js → solarized-dark-2ncbM9MD.js} +0 -0
  526. /package/dist/{solarized-light-U1mjAkaE.js → solarized-light-Bw0RlZC7.js} +0 -0
  527. /package/dist/{solidity-DfzZ5d-O.js → solidity-Dl1Szhqk.js} +0 -0
  528. /package/dist/{solr-CNZE5yrI.js → solr-Kwz1kGU1.js} +0 -0
  529. /package/dist/{splunk-K8fn70fG.js → splunk-D_aQa7Wj.js} +0 -0
  530. /package/dist/{spreadsheet-DQPJGjZQ.js → spreadsheet-D6FABxcn.js} +0 -0
  531. /package/dist/{sql-CAF6o9lq.js → sql-Bl2dBUIk.js} +0 -0
  532. /package/dist/{sql-DRtPaiem.js → sql-ZN4U_4B1.js} +0 -0
  533. /package/dist/{ssh-config-BXqbrXDi.js → ssh-config-BZDNWhA1.js} +0 -0
  534. /package/dist/{stex-D1sWhacG.js → stex-B5cVJDuZ.js} +0 -0
  535. /package/dist/{stylus-C_YQrfMD.js → stylus-ByL4A079.js} +0 -0
  536. /package/dist/{swift-Ceo6tYUp.js → swift-scoJKQVi.js} +0 -0
  537. /package/dist/{synthwave-84-CHXFapSW.js → synthwave-84-DKtuD_wy.js} +0 -0
  538. /package/dist/{system-verilog-D4CJAYbc.js → system-verilog-Bv-1IX35.js} +0 -0
  539. /package/dist/{systemd-CHq8PvwE.js → systemd-BzGxwp-W.js} +0 -0
  540. /package/dist/{talonscript-D6aZJv_Q.js → talonscript-BSbePVqO.js} +0 -0
  541. /package/dist/{tasl-BWmlUeU7.js → tasl-BA3aDFU3.js} +0 -0
  542. /package/dist/{tcl-C3YCHzLh.js → tcl-BAw9Lg69.js} +0 -0
  543. /package/dist/{terraform-y7dSvHa7.js → terraform-D50En-Co.js} +0 -0
  544. /package/dist/{tiddlywiki-DotFbxlj.js → tiddlywiki-Bl1_jWGY.js} +0 -0
  545. /package/dist/{tiki-cZC65BMY.js → tiki-BDy2Aqau.js} +0 -0
  546. /package/dist/{timer--XD4eQXe.js → timer-Dde4NBPL.js} +0 -0
  547. /package/dist/{tokyo-night-A0-IVocs.js → tokyo-night-DXO9qP_t.js} +0 -0
  548. /package/dist/{toml-OrfgdRYt.js → toml-Cubg1uUB.js} +0 -0
  549. /package/dist/{treemap-BjIqNFzX.js → treemap-BLQ6nYXt.js} +0 -0
  550. /package/dist/{tsv-B2Hf1H8S.js → tsv-vZzoqqJp.js} +0 -0
  551. /package/dist/{tsx-DGPbtVdN.js → tsx-LnCcyy2E.js} +0 -0
  552. /package/dist/{turtle-DsNtk6IM.js → turtle-CMwgyTdm.js} +0 -0
  553. /package/dist/{typescript-CCzz7yCV.js → typescript-B5rt_l9e.js} +0 -0
  554. /package/dist/{typespec-DUIO3iAy.js → typespec-CkLBOALm.js} +0 -0
  555. /package/dist/{typst-CzQn6sYd.js → typst-C-inGA8y.js} +0 -0
  556. /package/dist/{v-DDSEES9z.js → v-CFTQQNNR.js} +0 -0
  557. /package/dist/{vala-Cbu40xKX.js → vala-CEP8R4Sr.js} +0 -0
  558. /package/dist/{vb-DtlqoV5V.js → vb-LCy_gAYP.js} +0 -0
  559. /package/dist/{verilog-CCzhlD5Z.js → verilog-CjetHjeY.js} +0 -0
  560. /package/dist/{vesper-DJTKEjYY.js → vesper-C1ptU1oI.js} +0 -0
  561. /package/dist/{vhdl-DDdF26gx.js → vhdl-BwoGC9LM.js} +0 -0
  562. /package/dist/{viml-Csgqqvxa.js → viml-CydZIHfP.js} +0 -0
  563. /package/dist/{vitesse-black-B_9_MY9n.js → vitesse-black-C-p75DbZ.js} +0 -0
  564. /package/dist/{vitesse-dark-5oLbBBDP.js → vitesse-dark-Ai-v_ovz.js} +0 -0
  565. /package/dist/{vitesse-light-DY7aCeME.js → vitesse-light-DQ9NGEHC.js} +0 -0
  566. /package/dist/{vyper-CJCjsleu.js → vyper-BF3ELXiG.js} +0 -0
  567. /package/dist/{wasm-DtNse08w.js → wasm-OjKRvUGa.js} +0 -0
  568. /package/dist/{wasm-BSZ3My3r.js → wasm-sMdbPauS.js} +0 -0
  569. /package/dist/{wenyan-BvPQ-H9y.js → wenyan-jAkt3eQa.js} +0 -0
  570. /package/dist/{wgsl-B65N7iDC.js → wgsl-C164tHZL.js} +0 -0
  571. /package/dist/{wikitext-BIFkMlQo.js → wikitext-DVNWOcXh.js} +0 -0
  572. /package/dist/{wit-DP8045yv.js → wit-BiebwFst.js} +0 -0
  573. /package/dist/{wolfram-DHmulSSf.js → wolfram-Dej0TMYQ.js} +0 -0
  574. /package/dist/{yaml-BW6YUxU4.js → yaml-D1dcMKz3.js} +0 -0
  575. /package/dist/{zenscript-CkfsSip8.js → zenscript-DR8tpung.js} +0 -0
  576. /package/dist/{zig-DxQnpavN.js → zig-DqxNCCzt.js} +0 -0
  577. /package/src/components/{chat → markdown}/markdown-renderer.css +0 -0
  578. /package/src/components/{chat → markdown}/markdown-renderer.tsx +0 -0
@@ -1,2188 +0,0 @@
1
- import { s as __toESM, t as __commonJSMin } from "./chunk-DgPTj83v.js";
2
- const expandPhrases = (u2) => u2.flatMap(expandSinglePhrase), expandSinglePhrase = (u2) => buildCombinations(parsePhrase(u2)).map(stripExtraWhitespace);
3
- var stripExtraWhitespace = (u2) => u2.replace(/ +/g, " ").trim(), parsePhrase = (u2) => ({
4
- type: "mandatory_block",
5
- items: parseAlteration(u2, 0)[0]
6
- }), parseAlteration = (u2, z, B) => {
7
- let V = [];
8
- for (; u2[z]; ) {
9
- let [H, U] = parseConcatenation(u2, z);
10
- if (V.push(H), z = U, u2[z] === "|") z++;
11
- else if (u2[z] === "}" || u2[z] === "]") {
12
- if (B !== u2[z]) throw Error(`Unbalanced parenthesis in: ${u2}`);
13
- return z++, [V, z];
14
- } else if (z === u2.length) {
15
- if (B) throw Error(`Unbalanced parenthesis in: ${u2}`);
16
- return [V, z];
17
- } else throw Error(`Unexpected "${u2[z]}"`);
18
- }
19
- return [V, z];
20
- }, parseConcatenation = (u2, z) => {
21
- let B = [];
22
- for (; ; ) {
23
- let [V, H] = parseTerm(u2, z);
24
- if (V) B.push(V), z = H;
25
- else break;
26
- }
27
- return B.length === 1 ? [B[0], z] : [{
28
- type: "concatenation",
29
- items: B
30
- }, z];
31
- }, parseTerm = (u2, z) => {
32
- if (u2[z] === "{") return parseMandatoryBlock(u2, z + 1);
33
- if (u2[z] === "[") return parseOptionalBlock(u2, z + 1);
34
- {
35
- let B = "";
36
- for (; u2[z] && /[A-Za-z0-9_ ]/.test(u2[z]); ) B += u2[z], z++;
37
- return [B, z];
38
- }
39
- }, parseMandatoryBlock = (u2, z) => {
40
- let [B, V] = parseAlteration(u2, z, "}");
41
- return [{
42
- type: "mandatory_block",
43
- items: B
44
- }, V];
45
- }, parseOptionalBlock = (u2, z) => {
46
- let [B, V] = parseAlteration(u2, z, "]");
47
- return [{
48
- type: "optional_block",
49
- items: B
50
- }, V];
51
- }, buildCombinations = (u2) => {
52
- if (typeof u2 == "string") return [u2];
53
- if (u2.type === "concatenation") return u2.items.map(buildCombinations).reduce(stringCombinations, [""]);
54
- if (u2.type === "mandatory_block") return u2.items.flatMap(buildCombinations);
55
- if (u2.type === "optional_block") return ["", ...u2.items.flatMap(buildCombinations)];
56
- throw Error(`Unknown node type: ${u2}`);
57
- }, stringCombinations = (u2, z) => {
58
- let B = [];
59
- for (let V of u2) for (let u3 of z) B.push(V + u3);
60
- return B;
61
- }, TokenType;
62
- (function(u2) {
63
- u2.QUOTED_IDENTIFIER = "QUOTED_IDENTIFIER", u2.IDENTIFIER = "IDENTIFIER", u2.STRING = "STRING", u2.VARIABLE = "VARIABLE", u2.RESERVED_DATA_TYPE = "RESERVED_DATA_TYPE", u2.RESERVED_PARAMETERIZED_DATA_TYPE = "RESERVED_PARAMETERIZED_DATA_TYPE", u2.RESERVED_KEYWORD = "RESERVED_KEYWORD", u2.RESERVED_FUNCTION_NAME = "RESERVED_FUNCTION_NAME", u2.RESERVED_PHRASE = "RESERVED_PHRASE", u2.RESERVED_SET_OPERATION = "RESERVED_SET_OPERATION", u2.RESERVED_CLAUSE = "RESERVED_CLAUSE", u2.RESERVED_SELECT = "RESERVED_SELECT", u2.RESERVED_JOIN = "RESERVED_JOIN", u2.ARRAY_IDENTIFIER = "ARRAY_IDENTIFIER", u2.ARRAY_KEYWORD = "ARRAY_KEYWORD", u2.CASE = "CASE", u2.END = "END", u2.WHEN = "WHEN", u2.ELSE = "ELSE", u2.THEN = "THEN", u2.LIMIT = "LIMIT", u2.BETWEEN = "BETWEEN", u2.AND = "AND", u2.OR = "OR", u2.XOR = "XOR", u2.OPERATOR = "OPERATOR", u2.COMMA = "COMMA", u2.ASTERISK = "ASTERISK", u2.PROPERTY_ACCESS_OPERATOR = "PROPERTY_ACCESS_OPERATOR", u2.OPEN_PAREN = "OPEN_PAREN", u2.CLOSE_PAREN = "CLOSE_PAREN", u2.LINE_COMMENT = "LINE_COMMENT", u2.BLOCK_COMMENT = "BLOCK_COMMENT", u2.DISABLE_COMMENT = "DISABLE_COMMENT", u2.NUMBER = "NUMBER", u2.NAMED_PARAMETER = "NAMED_PARAMETER", u2.QUOTED_PARAMETER = "QUOTED_PARAMETER", u2.NUMBERED_PARAMETER = "NUMBERED_PARAMETER", u2.POSITIONAL_PARAMETER = "POSITIONAL_PARAMETER", u2.CUSTOM_PARAMETER = "CUSTOM_PARAMETER", u2.DELIMITER = "DELIMITER", u2.EOF = "EOF";
64
- })(TokenType = TokenType || (TokenType = {}));
65
- const createEofToken = (u2) => ({
66
- type: TokenType.EOF,
67
- raw: "\xABEOF\xBB",
68
- text: "\xABEOF\xBB",
69
- start: u2
70
- });
71
- createEofToken(Infinity), TokenType.RESERVED_DATA_TYPE, TokenType.RESERVED_KEYWORD, TokenType.RESERVED_CLAUSE, TokenType.RESERVED_DATA_TYPE, TokenType.RESERVED_CLAUSE, TokenType.RESERVED_CLAUSE;
72
- const isReserved = (u2) => u2 === TokenType.RESERVED_DATA_TYPE || u2 === TokenType.RESERVED_KEYWORD || u2 === TokenType.RESERVED_FUNCTION_NAME || u2 === TokenType.RESERVED_PHRASE || u2 === TokenType.RESERVED_CLAUSE || u2 === TokenType.RESERVED_SELECT || u2 === TokenType.RESERVED_SET_OPERATION || u2 === TokenType.RESERVED_JOIN || u2 === TokenType.ARRAY_KEYWORD || u2 === TokenType.CASE || u2 === TokenType.END || u2 === TokenType.WHEN || u2 === TokenType.ELSE || u2 === TokenType.THEN || u2 === TokenType.LIMIT || u2 === TokenType.BETWEEN || u2 === TokenType.AND || u2 === TokenType.OR || u2 === TokenType.XOR, isLogicalOperator = (u2) => u2 === TokenType.AND || u2 === TokenType.OR || u2 === TokenType.XOR, functions = /* @__PURE__ */ "ABS.ACOS.ADD.ADD_PARQUET_KEY.AGE.AGGREGATE.ALIAS.ALL_PROFILING_OUTPUT.ANY_VALUE.APPLY.APPROX_COUNT_DISTINCT.APPROX_QUANTILE.ARBITRARY.ARGMAX.ARGMIN.ARG_MAX.ARG_MAX_NULL.ARG_MIN.ARG_MIN_NULL.ARRAY_AGG.ARRAY_AGGR.ARRAY_AGGREGATE.ARRAY_APPEND.ARRAY_APPLY.ARRAY_CAT.ARRAY_CONCAT.ARRAY_CONTAINS.ARRAY_COSINE_SIMILARITY.ARRAY_CROSS_PRODUCT.ARRAY_DISTANCE.ARRAY_DISTINCT.ARRAY_DOT_PRODUCT.ARRAY_EXTRACT.ARRAY_FILTER.ARRAY_GRADE_UP.ARRAY_HAS.ARRAY_HAS_ALL.ARRAY_HAS_ANY.ARRAY_INDEXOF.ARRAY_INNER_PRODUCT.ARRAY_INTERSECT.ARRAY_LENGTH.ARRAY_POP_BACK.ARRAY_POP_FRONT.ARRAY_POSITION.ARRAY_PREPEND.ARRAY_PUSH_BACK.ARRAY_PUSH_FRONT.ARRAY_REDUCE.ARRAY_RESIZE.ARRAY_REVERSE.ARRAY_REVERSE_SORT.ARRAY_SELECT.ARRAY_SLICE.ARRAY_SORT.ARRAY_TO_JSON.ARRAY_TO_STRING.ARRAY_TRANSFORM.ARRAY_UNIQUE.ARRAY_VALUE.ARRAY_WHERE.ARRAY_ZIP.ARROW_SCAN.ARROW_SCAN_DUMB.ASCII.ASIN.ATAN.ATAN2.AVG.BASE64.BIN.BITSTRING.BITSTRING_AGG.BIT_AND.BIT_COUNT.BIT_LENGTH.BIT_OR.BIT_POSITION.BIT_XOR.BOOL_AND.BOOL_OR.CARDINALITY.CBRT.CEIL.CEILING.CENTURY.CHECKPOINT.CHR.COLLATIONS.COL_DESCRIPTION.COMBINE.CONCAT.CONCAT_WS.CONSTANT_OR_NULL.CONTAINS.COPY_DATABASE.CORR.COS.COT.COUNT.COUNT_IF.COUNT_STAR.COVAR_POP.COVAR_SAMP.CREATE_SORT_KEY.CURRENT_CATALOG.CURRENT_DATABASE.CURRENT_DATE.CURRENT_LOCALTIME.CURRENT_LOCALTIMESTAMP.CURRENT_QUERY.CURRENT_ROLE.CURRENT_SCHEMA.CURRENT_SCHEMAS.CURRENT_SETTING.CURRENT_USER.CURRVAL.DAMERAU_LEVENSHTEIN.DATABASE_LIST.DATABASE_SIZE.DATEDIFF.DATEPART.DATESUB.DATETRUNC.DATE_ADD.DATE_DIFF.DATE_PART.DATE_SUB.DATE_TRUNC.DAY.DAYNAME.DAYOFMONTH.DAYOFWEEK.DAYOFYEAR.DECADE.DECODE.DEGREES.DISABLE_CHECKPOINT_ON_SHUTDOWN.DISABLE_OBJECT_CACHE.DISABLE_OPTIMIZER.DISABLE_PRINT_PROGRESS_BAR.DISABLE_PROFILE.DISABLE_PROFILING.DISABLE_PROGRESS_BAR.DISABLE_VERIFICATION.DISABLE_VERIFY_EXTERNAL.DISABLE_VERIFY_FETCH_ROW.DISABLE_VERIFY_PARALLELISM.DISABLE_VERIFY_SERIALIZER.DIVIDE.DUCKDB_COLUMNS.DUCKDB_CONSTRAINTS.DUCKDB_DATABASES.DUCKDB_DEPENDENCIES.DUCKDB_EXTENSIONS.DUCKDB_FUNCTIONS.DUCKDB_INDEXES.DUCKDB_KEYWORDS.DUCKDB_MEMORY.DUCKDB_OPTIMIZERS.DUCKDB_SCHEMAS.DUCKDB_SECRETS.DUCKDB_SEQUENCES.DUCKDB_SETTINGS.DUCKDB_TABLES.DUCKDB_TEMPORARY_FILES.DUCKDB_TYPES.DUCKDB_VIEWS.EDIT.EDITDIST3.ELEMENT_AT.ENABLE_CHECKPOINT_ON_SHUTDOWN.ENABLE_OBJECT_CACHE.ENABLE_OPTIMIZER.ENABLE_PRINT_PROGRESS_BAR.ENABLE_PROFILE.ENABLE_PROFILING.ENABLE_PROGRESS_BAR.ENABLE_VERIFICATION.ENCODE.ENDS_WITH.ENTROPY.ENUM_CODE.ENUM_FIRST.ENUM_LAST.ENUM_RANGE.ENUM_RANGE_BOUNDARY.EPOCH.EPOCH_MS.EPOCH_NS.EPOCH_US.ERA.ERROR.EVEN.EXP.FACTORIAL.FAVG.FDIV.FILTER.FINALIZE.FIRST.FLATTEN.FLOOR.FMOD.FORCE_CHECKPOINT.FORMAT.FORMATREADABLEDECIMALSIZE.FORMATREADABLESIZE.FORMAT_BYTES.FORMAT_PG_TYPE.FORMAT_TYPE.FROM_BASE64.FROM_BINARY.FROM_HEX.FROM_JSON.FROM_JSON_STRICT.FSUM.FUNCTIONS.GAMMA.GCD.GENERATE_SERIES.GENERATE_SUBSCRIPTS.GEN_RANDOM_UUID.GEOMEAN.GEOMETRIC_MEAN.GETENV.GET_BIT.GET_BLOCK_SIZE.GET_CURRENT_TIME.GET_CURRENT_TIMESTAMP.GLOB.GRADE_UP.GREATEST.GREATEST_COMMON_DIVISOR.GROUP_CONCAT.HAMMING.HASH.HAS_ANY_COLUMN_PRIVILEGE.HAS_COLUMN_PRIVILEGE.HAS_DATABASE_PRIVILEGE.HAS_FOREIGN_DATA_WRAPPER_PRIVILEGE.HAS_FUNCTION_PRIVILEGE.HAS_LANGUAGE_PRIVILEGE.HAS_SCHEMA_PRIVILEGE.HAS_SEQUENCE_PRIVILEGE.HAS_SERVER_PRIVILEGE.HAS_TABLESPACE_PRIVILEGE.HAS_TABLE_PRIVILEGE.HEX.HISTOGRAM.HOUR.ICU_CALENDAR_NAMES.ICU_SORT_KEY.ILIKE_ESCAPE.IMPORT_DATABASE.INDEX_SCAN.INET_CLIENT_ADDR.INET_CLIENT_PORT.INET_SERVER_ADDR.INET_SERVER_PORT.INSTR.IN_SEARCH_PATH.ISFINITE.ISINF.ISNAN.ISODOW.ISOYEAR.JACCARD.JARO_SIMILARITY.JARO_WINKLER_SIMILARITY.JSON_ARRAY.JSON_ARRAY_LENGTH.JSON_CONTAINS.JSON_DESERIALIZE_SQL.JSON_EXECUTE_SERIALIZED_SQL.JSON_EXTRACT.JSON_EXTRACT_PATH.JSON_EXTRACT_PATH_TEXT.JSON_EXTRACT_STRING.JSON_GROUP_ARRAY.JSON_GROUP_OBJECT.JSON_GROUP_STRUCTURE.JSON_KEYS.JSON_MERGE_PATCH.JSON_OBJECT.JSON_QUOTE.JSON_SERIALIZE_PLAN.JSON_SERIALIZE_SQL.JSON_STRUCTURE.JSON_TRANSFORM.JSON_TRANSFORM_STRICT.JSON_TYPE.JSON_VALID.JULIAN.KAHAN_SUM.KURTOSIS.KURTOSIS_POP.LAST.LAST_DAY.LCASE.LCM.LEAST.LEAST_COMMON_MULTIPLE.LEFT.LEFT_GRAPHEME.LEN.LENGTH.LENGTH_GRAPHEME.LEVENSHTEIN.LGAMMA.LIKE_ESCAPE.LIST.LISTAGG.LIST_AGGR.LIST_AGGREGATE.LIST_ANY_VALUE.LIST_APPEND.LIST_APPLY.LIST_APPROX_COUNT_DISTINCT.LIST_AVG.LIST_BIT_AND.LIST_BIT_OR.LIST_BIT_XOR.LIST_BOOL_AND.LIST_BOOL_OR.LIST_CAT.LIST_CONCAT.LIST_CONTAINS.LIST_COSINE_SIMILARITY.LIST_COUNT.LIST_DISTANCE.LIST_DISTINCT.LIST_DOT_PRODUCT.LIST_ELEMENT.LIST_ENTROPY.LIST_EXTRACT.LIST_FILTER.LIST_FIRST.LIST_GRADE_UP.LIST_HAS.LIST_HAS_ALL.LIST_HAS_ANY.LIST_HISTOGRAM.LIST_INDEXOF.LIST_INNER_PRODUCT.LIST_INTERSECT.LIST_KURTOSIS.LIST_KURTOSIS_POP.LIST_LAST.LIST_MAD.LIST_MAX.LIST_MEDIAN.LIST_MIN.LIST_MODE.LIST_PACK.LIST_POSITION.LIST_PREPEND.LIST_PRODUCT.LIST_REDUCE.LIST_RESIZE.LIST_REVERSE.LIST_REVERSE_SORT.LIST_SELECT.LIST_SEM.LIST_SKEWNESS.LIST_SLICE.LIST_SORT.LIST_STDDEV_POP.LIST_STDDEV_SAMP.LIST_STRING_AGG.LIST_SUM.LIST_TRANSFORM.LIST_UNIQUE.LIST_VALUE.LIST_VAR_POP.LIST_VAR_SAMP.LIST_WHERE.LIST_ZIP.LN.LOG.LOG10.LOG2.LOWER.LPAD.LSMODE.LTRIM.MAD.MAKE_DATE.MAKE_TIME.MAKE_TIMESTAMP.MAKE_TIMESTAMPTZ.MAP.MAP_CONCAT.MAP_ENTRIES.MAP_EXTRACT.MAP_FROM_ENTRIES.MAP_KEYS.MAP_VALUES.MAX.MAX_BY.MD5.MD5_NUMBER.MD5_NUMBER_LOWER.MD5_NUMBER_UPPER.MEAN.MEDIAN.METADATA_INFO.MICROSECOND.MILLENNIUM.MILLISECOND.MIN.MINUTE.MIN_BY.MISMATCHES.MOD.MODE.MONTH.MONTHNAME.MULTIPLY.NEXTAFTER.NEXTVAL.NFC_NORMALIZE.NOT_ILIKE_ESCAPE.NOT_LIKE_ESCAPE.NOW.NULLIF.OBJ_DESCRIPTION.OCTET_LENGTH.ORD.PARQUET_FILE_METADATA.PARQUET_KV_METADATA.PARQUET_METADATA.PARQUET_SCAN.PARQUET_SCHEMA.PARSE_DIRNAME.PARSE_DIRPATH.PARSE_FILENAME.PARSE_PATH.PG_COLLATION_IS_VISIBLE.PG_CONF_LOAD_TIME.PG_CONVERSION_IS_VISIBLE.PG_FUNCTION_IS_VISIBLE.PG_GET_CONSTRAINTDEF.PG_GET_EXPR.PG_GET_VIEWDEF.PG_HAS_ROLE.PG_IS_OTHER_TEMP_SCHEMA.PG_MY_TEMP_SCHEMA.PG_OPCLASS_IS_VISIBLE.PG_OPERATOR_IS_VISIBLE.PG_OPFAMILY_IS_VISIBLE.PG_POSTMASTER_START_TIME.PG_SIZE_PRETTY.PG_TABLE_IS_VISIBLE.PG_TIMEZONE_NAMES.PG_TS_CONFIG_IS_VISIBLE.PG_TS_DICT_IS_VISIBLE.PG_TS_PARSER_IS_VISIBLE.PG_TS_TEMPLATE_IS_VISIBLE.PG_TYPEOF.PG_TYPE_IS_VISIBLE.PI.PLATFORM.POSITION.POW.POWER.PRAGMA_COLLATIONS.PRAGMA_DATABASE_SIZE.PRAGMA_METADATA_INFO.PRAGMA_PLATFORM.PRAGMA_SHOW.PRAGMA_STORAGE_INFO.PRAGMA_TABLE_INFO.PRAGMA_USER_AGENT.PRAGMA_VERSION.PREFIX.PRINTF.PRODUCT.QUANTILE.QUANTILE_CONT.QUANTILE_DISC.QUARTER.RADIANS.RANDOM.RANGE.READFILE.READ_BLOB.READ_CSV.READ_CSV_AUTO.READ_JSON.READ_JSON_AUTO.READ_JSON_OBJECTS.READ_JSON_OBJECTS_AUTO.READ_NDJSON.READ_NDJSON_AUTO.READ_NDJSON_OBJECTS.READ_PARQUET.READ_TEXT.REDUCE.REGEXP_ESCAPE.REGEXP_EXTRACT.REGEXP_EXTRACT_ALL.REGEXP_FULL_MATCH.REGEXP_MATCHES.REGEXP_REPLACE.REGEXP_SPLIT_TO_ARRAY.REGEXP_SPLIT_TO_TABLE.REGR_AVGX.REGR_AVGY.REGR_COUNT.REGR_INTERCEPT.REGR_R2.REGR_SLOPE.REGR_SXX.REGR_SXY.REGR_SYY.REPEAT.REPEAT_ROW.REPLACE.RESERVOIR_QUANTILE.REVERSE.RIGHT.RIGHT_GRAPHEME.ROUND.ROUNDBANKERS.ROUND_EVEN.ROW.ROW_TO_JSON.RPAD.RTRIM.SECOND.SEM.SEQ_SCAN.SESSION_USER.SETSEED.SET_BIT.SHA256.SHA3.SHELL_ADD_SCHEMA.SHELL_ESCAPE_CRNL.SHELL_IDQUOTE.SHELL_MODULE_SCHEMA.SHELL_PUTSNL.SHOBJ_DESCRIPTION.SHOW.SHOW_DATABASES.SHOW_TABLES.SHOW_TABLES_EXPANDED.SIGN.SIGNBIT.SIN.SKEWNESS.SNIFF_CSV.SPLIT.SPLIT_PART.SQL_AUTO_COMPLETE.SQRT.STARTS_WITH.STATS.STDDEV.STDDEV_POP.STDDEV_SAMP.STORAGE_INFO.STRFTIME.STRING_AGG.STRING_SPLIT.STRING_SPLIT_REGEX.STRING_TO_ARRAY.STRIP_ACCENTS.STRLEN.STRPOS.STRPTIME.STRUCT_EXTRACT.STRUCT_INSERT.STRUCT_PACK.STR_SPLIT.STR_SPLIT_REGEX.SUBSTR.SUBSTRING.SUBSTRING_GRAPHEME.SUBTRACT.SUFFIX.SUM.SUMKAHAN.SUMMARY.SUM_NO_OVERFLOW.TABLE_INFO.TAN.TEST_ALL_TYPES.TEST_VECTOR_TYPES.TIMEZONE.TIMEZONE_HOUR.TIMEZONE_MINUTE.TIME_BUCKET.TODAY.TO_BASE.TO_BASE64.TO_BINARY.TO_CENTURIES.TO_DAYS.TO_DECADES.TO_HEX.TO_HOURS.TO_JSON.TO_MICROSECONDS.TO_MILLENNIA.TO_MILLISECONDS.TO_MINUTES.TO_MONTHS.TO_SECONDS.TO_TIMESTAMP.TO_WEEKS.TO_YEARS.TRANSACTION_TIMESTAMP.TRANSLATE.TRIM.TRUNC.TRY_STRPTIME.TXID_CURRENT.TYPEOF.UCASE.UNBIN.UNHEX.UNICODE.UNION_EXTRACT.UNION_TAG.UNION_VALUE.UNNEST.UNPIVOT_LIST.UPPER.USER.USER_AGENT.UUID.VARIANCE.VAR_POP.VAR_SAMP.VECTOR_TYPE.VERIFY_EXTERNAL.VERIFY_FETCH_ROW.VERIFY_PARALLELISM.VERIFY_SERIALIZER.VERSION.WEEK.WEEKDAY.WEEKOFYEAR.WHICH_SECRET.WRITEFILE.XOR.YEAR.YEARWEEK.CAST.COALESCE.RANK.ROW_NUMBER".split("."), keywords = /* @__PURE__ */ "ALL.ANALYSE.ANALYZE.AND.ANY.AS.ASC.ATTACH.ASYMMETRIC.BOTH.CASE.CAST.CHECK.COLLATE.COLUMN.CONSTRAINT.CREATE.DEFAULT.DEFERRABLE.DESC.DESCRIBE.DETACH.DISTINCT.DO.ELSE.END.EXCEPT.FALSE.FETCH.FOR.FOREIGN.FROM.GRANT.GROUP.HAVING.IN.INITIALLY.INTERSECT.INTO.IS.LATERAL.LEADING.LIMIT.NOT.NULL.OFFSET.ON.ONLY.OR.ORDER.PIVOT.PIVOT_LONGER.PIVOT_WIDER.PLACING.PRIMARY.REFERENCES.RETURNING.SELECT.SHOW.SOME.SUMMARIZE.SYMMETRIC.TABLE.THEN.TO.TRAILING.TRUE.UNION.UNIQUE.UNPIVOT.USING.VARIADIC.WHEN.WHERE.WINDOW.WITH".split("."), dataTypes = /* @__PURE__ */ "ARRAY.BIGINT.BINARY.BIT.BITSTRING.BLOB.BOOL.BOOLEAN.BPCHAR.BYTEA.CHAR.DATE.DATETIME.DEC.DECIMAL.DOUBLE.ENUM.FLOAT.FLOAT4.FLOAT8.GUID.HUGEINT.INET.INT.INT1.INT128.INT16.INT2.INT32.INT4.INT64.INT8.INTEGER.INTEGRAL.INTERVAL.JSON.LIST.LOGICAL.LONG.MAP.NUMERIC.NVARCHAR.OID.REAL.ROW.SHORT.SIGNED.SMALLINT.STRING.STRUCT.TEXT.TIME.TIMESTAMP_MS.TIMESTAMP_NS.TIMESTAMP_S.TIMESTAMP_US.TIMESTAMP.TIMESTAMPTZ.TIMETZ.TINYINT.UBIGINT.UHUGEINT.UINT128.UINT16.UINT32.UINT64.UINT8.UINTEGER.UNION.USMALLINT.UTINYINT.UUID.VARBINARY.VARCHAR".split(".");
73
- var reservedSelect = expandPhrases(["SELECT [ALL | DISTINCT]"]), reservedClauses = expandPhrases([
74
- "WITH [RECURSIVE]",
75
- "FROM",
76
- "WHERE",
77
- "GROUP BY [ALL]",
78
- "HAVING",
79
- "WINDOW",
80
- "PARTITION BY",
81
- "ORDER BY [ALL]",
82
- "LIMIT",
83
- "OFFSET",
84
- "USING SAMPLE",
85
- "QUALIFY",
86
- "INSERT [OR REPLACE] INTO",
87
- "VALUES",
88
- "DEFAULT VALUES",
89
- "SET",
90
- "RETURNING"
91
- ]), standardOnelineClauses = expandPhrases(["CREATE [OR REPLACE] [TEMPORARY | TEMP] TABLE [IF NOT EXISTS]"]), tabularOnelineClauses = expandPhrases(/* @__PURE__ */ "UPDATE.ON CONFLICT.DELETE FROM.DROP TABLE [IF EXISTS].TRUNCATE.ALTER TABLE.ADD [COLUMN] [IF NOT EXISTS].ADD PRIMARY KEY.DROP [COLUMN] [IF EXISTS].ALTER [COLUMN].RENAME [COLUMN].RENAME TO.SET [DATA] TYPE.{SET | DROP} DEFAULT.{SET | DROP} NOT NULL.CREATE [OR REPLACE] [TEMPORARY | TEMP] {MACRO | FUNCTION}.DROP MACRO [TABLE] [IF EXISTS].DROP FUNCTION [IF EXISTS].CREATE [UNIQUE] INDEX [IF NOT EXISTS].DROP INDEX [IF EXISTS].CREATE [OR REPLACE] SCHEMA [IF NOT EXISTS].DROP SCHEMA [IF EXISTS].CREATE [OR REPLACE] [PERSISTENT | TEMPORARY] SECRET [IF NOT EXISTS].DROP [PERSISTENT | TEMPORARY] SECRET [IF EXISTS].CREATE [OR REPLACE] [TEMPORARY | TEMP] SEQUENCE.DROP SEQUENCE [IF EXISTS].CREATE [OR REPLACE] [TEMPORARY | TEMP] VIEW [IF NOT EXISTS].DROP VIEW [IF EXISTS].ALTER VIEW.CREATE TYPE.DROP TYPE [IF EXISTS].ANALYZE.ATTACH [DATABASE] [IF NOT EXISTS].DETACH [DATABASE] [IF EXISTS].CALL.[FORCE] CHECKPOINT.COMMENT ON [TABLE | COLUMN | VIEW | INDEX | SEQUENCE | TYPE | MACRO | MACRO TABLE].COPY [FROM DATABASE].DESCRIBE.EXPORT DATABASE.IMPORT DATABASE.INSTALL.LOAD.PIVOT.PIVOT_WIDER.UNPIVOT.EXPLAIN [ANALYZE].SET {LOCAL | SESSION | GLOBAL}.RESET [LOCAL | SESSION | GLOBAL].{SET | RESET} VARIABLE.SUMMARIZE.BEGIN TRANSACTION.ROLLBACK.COMMIT.ABORT.USE.VACUUM [ANALYZE].PREPARE.EXECUTE.DEALLOCATE [PREPARE]".split(".")), reservedSetOperations = expandPhrases([
92
- "UNION [ALL | BY NAME]",
93
- "EXCEPT [ALL]",
94
- "INTERSECT [ALL]"
95
- ]), reservedJoins = expandPhrases([
96
- "JOIN",
97
- "{LEFT | RIGHT | FULL} [OUTER] JOIN",
98
- "{INNER | CROSS} JOIN",
99
- "{NATURAL | ASOF} [INNER] JOIN",
100
- "{NATURAL | ASOF} {LEFT | RIGHT | FULL} [OUTER] JOIN",
101
- "POSITIONAL JOIN",
102
- "ANTI JOIN",
103
- "SEMI JOIN"
104
- ]), reservedPhrases = expandPhrases([
105
- "{ROWS | RANGE | GROUPS} BETWEEN",
106
- "SIMILAR TO",
107
- "IS [NOT] DISTINCT FROM",
108
- "TIMESTAMP WITH TIME ZONE"
109
- ]);
110
- const duckdb = {
111
- name: "duckdb",
112
- tokenizerOptions: {
113
- reservedSelect,
114
- reservedClauses: [
115
- ...reservedClauses,
116
- ...standardOnelineClauses,
117
- ...tabularOnelineClauses
118
- ],
119
- reservedSetOperations,
120
- reservedJoins,
121
- reservedPhrases,
122
- supportsXor: true,
123
- reservedKeywords: keywords,
124
- reservedDataTypes: dataTypes,
125
- reservedFunctionNames: functions,
126
- nestedBlockComments: true,
127
- extraParens: ["[]", "{}"],
128
- stringTypes: [
129
- "$$",
130
- "''-qq",
131
- {
132
- quote: "''-qq-bs",
133
- prefixes: ["E"],
134
- requirePrefix: true
135
- },
136
- {
137
- quote: "''-raw",
138
- prefixes: ["B", "X"],
139
- requirePrefix: true
140
- }
141
- ],
142
- identTypes: ['""-qq'],
143
- identChars: { rest: "$" },
144
- paramTypes: {
145
- positional: true,
146
- numbered: ["$"],
147
- quoted: ["$"]
148
- },
149
- operators: /* @__PURE__ */ "//.%.**.^.!.&.|.~.<<.>>.::.==.->.->>.:.:=.=>.~~.!~~.~~*.!~~*.~~~.~.!~.~*.!~*.^@.||.>>=.<<=".split(".")
150
- },
151
- formatOptions: {
152
- alwaysDenseOperators: ["::"],
153
- onelineClauses: [...standardOnelineClauses, ...tabularOnelineClauses],
154
- tabularOnelineClauses
155
- }
156
- }, last = (u2) => u2[u2.length - 1], sortByLengthDesc = (u2) => u2.sort((u3, z) => z.length - u3.length || u3.localeCompare(z)), equalizeWhitespace = (u2) => u2.replace(/\s+/gu, " "), isMultiline = (u2) => /\n/.test(u2), escapeRegExp = (u2) => u2.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&"), WHITESPACE_REGEX = /\s+/uy, patternToRegex = (u2) => RegExp(`(?:${u2})`, "uy"), toCaseInsensitivePattern = (u2) => u2.split("").map((u3) => / /gu.test(u3) ? "\\s+" : `[${u3.toUpperCase()}${u3.toLowerCase()}]`).join(""), withDashes = (u2) => u2 + "(?:-" + u2 + ")*", prefixesPattern = ({ prefixes: u2, requirePrefix: z }) => `(?:${u2.map(toCaseInsensitivePattern).join("|")}${z ? "" : "|"})`, lineComment = (u2) => RegExp(`(?:${u2.map(escapeRegExp).join("|")}).*?(?=\r
157
- |\r|
158
- |$)`, "uy"), parenthesis = (u2, z = []) => {
159
- let B = u2 === "open" ? 0 : 1;
160
- return patternToRegex(["()", ...z].map((u3) => u3[B]).map(escapeRegExp).join("|"));
161
- }, operator = (u2) => patternToRegex(`${sortByLengthDesc(u2).map(escapeRegExp).join("|")}`);
162
- var rejectIdentCharsPattern = ({ rest: u2, dashes: z }) => u2 || z ? `(?![${u2 || ""}${z ? "-" : ""}])` : "";
163
- const reservedWord = (u2, z = {}) => {
164
- if (u2.length === 0) return /^\b$/u;
165
- let B = rejectIdentCharsPattern(z), V = sortByLengthDesc(u2).map(escapeRegExp).join("|").replace(/ /gu, "\\s+");
166
- return RegExp(`(?:${V})${B}\\b`, "iuy");
167
- }, parameter = (u2, z) => {
168
- if (u2.length) return patternToRegex(`(?:${u2.map(escapeRegExp).join("|")})(?:${z})`);
169
- };
170
- var buildQStringPatterns = () => {
171
- let u2 = {
172
- "<": ">",
173
- "[": "]",
174
- "(": ")",
175
- "{": "}"
176
- }, z = Object.entries(u2).map(([u3, z2]) => "{left}(?:(?!{right}').)*?{right}".replace(/{left}/g, escapeRegExp(u3)).replace(/{right}/g, escapeRegExp(z2))), B = escapeRegExp(Object.keys(u2).join(""));
177
- return `[Qq]'(?:${String.raw`(?<tag>[^\s${B}])(?:(?!\k<tag>').)*?\k<tag>`}|${z.join("|")})'`;
178
- };
179
- const quotePatterns = {
180
- "``": "(?:`[^`]*`)+",
181
- "[]": String.raw`(?:\[[^\]]*\])(?:\][^\]]*\])*`,
182
- '""-qq': String.raw`(?:"[^"]*")+`,
183
- '""-bs': String.raw`(?:"[^"\\]*(?:\\.[^"\\]*)*")`,
184
- '""-qq-bs': String.raw`(?:"[^"\\]*(?:\\.[^"\\]*)*")+`,
185
- '""-raw': String.raw`(?:"[^"]*")`,
186
- "''-qq": String.raw`(?:'[^']*')+`,
187
- "''-bs": String.raw`(?:'[^'\\]*(?:\\.[^'\\]*)*')`,
188
- "''-qq-bs": String.raw`(?:'[^'\\]*(?:\\.[^'\\]*)*')+`,
189
- "''-raw": String.raw`(?:'[^']*')`,
190
- $$: String.raw`(?<tag>\$\w*\$)[\s\S]*?\k<tag>`,
191
- "'''..'''": String.raw`'''[^\\]*?(?:\\.[^\\]*?)*?'''`,
192
- '""".."""': String.raw`"""[^\\]*?(?:\\.[^\\]*?)*?"""`,
193
- "{}": String.raw`(?:\{[^\}]*\})`,
194
- "q''": buildQStringPatterns()
195
- };
196
- var singleQuotePattern = (u2) => typeof u2 == "string" ? quotePatterns[u2] : "regex" in u2 ? u2.regex : prefixesPattern(u2) + quotePatterns[u2.quote];
197
- const variable = (u2) => patternToRegex(u2.map((u3) => "regex" in u3 ? u3.regex : singleQuotePattern(u3)).join("|")), stringPattern = (u2) => u2.map(singleQuotePattern).join("|"), string = (u2) => patternToRegex(stringPattern(u2)), identifier = (u2 = {}) => patternToRegex(identifierPattern(u2)), identifierPattern = ({ first: u2, rest: z, dashes: B, allowFirstCharNumber: V } = {}) => {
198
- let H = "\\p{Alphabetic}\\p{Mark}_", U = "\\p{Decimal_Number}", W = escapeRegExp(u2 ?? ""), G = escapeRegExp(z ?? ""), K = V ? `[${H}${U}${W}][${H}${U}${G}]*` : `[${H}${W}][${H}${U}${G}]*`;
199
- return B ? withDashes(K) : K;
200
- };
201
- function lineColFromIndex(u2, z) {
202
- let B = u2.slice(0, z).split(/\n/);
203
- return {
204
- line: B.length,
205
- col: B[B.length - 1].length + 1
206
- };
207
- }
208
- var TokenizerEngine = class {
209
- constructor(u2, z) {
210
- this.rules = u2, this.dialectName = z, this.input = "", this.index = 0;
211
- }
212
- tokenize(u2) {
213
- this.input = u2, this.index = 0;
214
- let z = [], B;
215
- for (; this.index < this.input.length; ) {
216
- let u3 = this.getWhitespace();
217
- if (this.index < this.input.length) {
218
- if (B = this.getNextToken(), !B) throw this.createParseError();
219
- z.push(Object.assign(Object.assign({}, B), { precedingWhitespace: u3 }));
220
- }
221
- }
222
- return z;
223
- }
224
- createParseError() {
225
- let u2 = this.input.slice(this.index, this.index + 10), { line: z, col: B } = lineColFromIndex(this.input, this.index);
226
- return /* @__PURE__ */ Error(`Parse error: Unexpected "${u2}" at line ${z} column ${B}.
227
- ${this.dialectInfo()}`);
228
- }
229
- dialectInfo() {
230
- return this.dialectName === "sql" ? `This likely happens because you're using the default "sql" dialect.
231
- If possible, please select a more specific dialect (like sqlite, postgresql, etc).` : `SQL dialect used: "${this.dialectName}".`;
232
- }
233
- getWhitespace() {
234
- WHITESPACE_REGEX.lastIndex = this.index;
235
- let u2 = WHITESPACE_REGEX.exec(this.input);
236
- if (u2) return this.index += u2[0].length, u2[0];
237
- }
238
- getNextToken() {
239
- for (let u2 of this.rules) {
240
- let z = this.match(u2);
241
- if (z) return z;
242
- }
243
- }
244
- match(u2) {
245
- u2.regex.lastIndex = this.index;
246
- let z = u2.regex.exec(this.input);
247
- if (z) {
248
- let B = z[0], V = {
249
- type: u2.type,
250
- raw: B,
251
- text: u2.text ? u2.text(B) : B,
252
- start: this.index
253
- };
254
- return u2.key && (V.key = u2.key(B)), this.index += B.length, V;
255
- }
256
- }
257
- }, START = /\/\*/uy, ANY_CHAR = /[\s\S]/uy, END$1 = /\*\//uy, NestedComment = class {
258
- constructor() {
259
- this.lastIndex = 0;
260
- }
261
- exec(u2) {
262
- let z = "", B, V = 0;
263
- if (B = this.matchSection(START, u2)) z += B, V++;
264
- else return null;
265
- for (; V > 0; ) if (B = this.matchSection(START, u2)) z += B, V++;
266
- else if (B = this.matchSection(END$1, u2)) z += B, V--;
267
- else if (B = this.matchSection(ANY_CHAR, u2)) z += B;
268
- else return null;
269
- return [z];
270
- }
271
- matchSection(u2, z) {
272
- u2.lastIndex = this.lastIndex;
273
- let B = u2.exec(z);
274
- return B && (this.lastIndex += B[0].length), B ? B[0] : null;
275
- }
276
- }, Tokenizer = class {
277
- constructor(u2, z) {
278
- this.cfg = u2, this.dialectName = z, this.rulesBeforeParams = this.buildRulesBeforeParams(u2), this.rulesAfterParams = this.buildRulesAfterParams(u2);
279
- }
280
- tokenize(u2, z) {
281
- let B = new TokenizerEngine([
282
- ...this.rulesBeforeParams,
283
- ...this.buildParamRules(this.cfg, z),
284
- ...this.rulesAfterParams
285
- ], this.dialectName).tokenize(u2);
286
- return this.cfg.postProcess ? this.cfg.postProcess(B) : B;
287
- }
288
- buildRulesBeforeParams(u2) {
289
- return this.validRules([
290
- {
291
- type: TokenType.BLOCK_COMMENT,
292
- regex: /(\/\* *sql-formatter-disable *\*\/[\s\S]*?(?:\/\* *sql-formatter-enable *\*\/|$))/uy
293
- },
294
- {
295
- type: TokenType.BLOCK_COMMENT,
296
- regex: u2.nestedBlockComments ? new NestedComment() : /(\/\*[^]*?\*\/)/uy
297
- },
298
- {
299
- type: TokenType.LINE_COMMENT,
300
- regex: lineComment(u2.lineCommentTypes ?? ["--"])
301
- },
302
- {
303
- type: TokenType.QUOTED_IDENTIFIER,
304
- regex: string(u2.identTypes)
305
- },
306
- {
307
- type: TokenType.NUMBER,
308
- regex: /(?:0x[0-9a-fA-F]+|0b[01]+|(?:-\s*)?(?:[0-9]*\.[0-9]+|[0-9]+(?:\.[0-9]*)?)(?:[eE][-+]?[0-9]+(?:\.[0-9]+)?)?)(?![\w\p{Alphabetic}])/uy
309
- },
310
- {
311
- type: TokenType.RESERVED_PHRASE,
312
- regex: reservedWord(u2.reservedPhrases ?? [], u2.identChars),
313
- text: toCanonical
314
- },
315
- {
316
- type: TokenType.CASE,
317
- regex: /CASE\b/iuy,
318
- text: toCanonical
319
- },
320
- {
321
- type: TokenType.END,
322
- regex: /END\b/iuy,
323
- text: toCanonical
324
- },
325
- {
326
- type: TokenType.BETWEEN,
327
- regex: /BETWEEN\b/iuy,
328
- text: toCanonical
329
- },
330
- {
331
- type: TokenType.LIMIT,
332
- regex: u2.reservedClauses.includes("LIMIT") ? /LIMIT\b/iuy : void 0,
333
- text: toCanonical
334
- },
335
- {
336
- type: TokenType.RESERVED_CLAUSE,
337
- regex: reservedWord(u2.reservedClauses, u2.identChars),
338
- text: toCanonical
339
- },
340
- {
341
- type: TokenType.RESERVED_SELECT,
342
- regex: reservedWord(u2.reservedSelect, u2.identChars),
343
- text: toCanonical
344
- },
345
- {
346
- type: TokenType.RESERVED_SET_OPERATION,
347
- regex: reservedWord(u2.reservedSetOperations, u2.identChars),
348
- text: toCanonical
349
- },
350
- {
351
- type: TokenType.WHEN,
352
- regex: /WHEN\b/iuy,
353
- text: toCanonical
354
- },
355
- {
356
- type: TokenType.ELSE,
357
- regex: /ELSE\b/iuy,
358
- text: toCanonical
359
- },
360
- {
361
- type: TokenType.THEN,
362
- regex: /THEN\b/iuy,
363
- text: toCanonical
364
- },
365
- {
366
- type: TokenType.RESERVED_JOIN,
367
- regex: reservedWord(u2.reservedJoins, u2.identChars),
368
- text: toCanonical
369
- },
370
- {
371
- type: TokenType.AND,
372
- regex: /AND\b/iuy,
373
- text: toCanonical
374
- },
375
- {
376
- type: TokenType.OR,
377
- regex: /OR\b/iuy,
378
- text: toCanonical
379
- },
380
- {
381
- type: TokenType.XOR,
382
- regex: u2.supportsXor ? /XOR\b/iuy : void 0,
383
- text: toCanonical
384
- },
385
- ...u2.operatorKeyword ? [{
386
- type: TokenType.OPERATOR,
387
- regex: /OPERATOR *\([^)]+\)/iuy
388
- }] : [],
389
- {
390
- type: TokenType.RESERVED_FUNCTION_NAME,
391
- regex: reservedWord(u2.reservedFunctionNames, u2.identChars),
392
- text: toCanonical
393
- },
394
- {
395
- type: TokenType.RESERVED_DATA_TYPE,
396
- regex: reservedWord(u2.reservedDataTypes, u2.identChars),
397
- text: toCanonical
398
- },
399
- {
400
- type: TokenType.RESERVED_KEYWORD,
401
- regex: reservedWord(u2.reservedKeywords, u2.identChars),
402
- text: toCanonical
403
- }
404
- ]);
405
- }
406
- buildRulesAfterParams(u2) {
407
- return this.validRules([
408
- {
409
- type: TokenType.VARIABLE,
410
- regex: u2.variableTypes ? variable(u2.variableTypes) : void 0
411
- },
412
- {
413
- type: TokenType.STRING,
414
- regex: string(u2.stringTypes)
415
- },
416
- {
417
- type: TokenType.IDENTIFIER,
418
- regex: identifier(u2.identChars)
419
- },
420
- {
421
- type: TokenType.DELIMITER,
422
- regex: /[;]/uy
423
- },
424
- {
425
- type: TokenType.COMMA,
426
- regex: /[,]/y
427
- },
428
- {
429
- type: TokenType.OPEN_PAREN,
430
- regex: parenthesis("open", u2.extraParens)
431
- },
432
- {
433
- type: TokenType.CLOSE_PAREN,
434
- regex: parenthesis("close", u2.extraParens)
435
- },
436
- {
437
- type: TokenType.OPERATOR,
438
- regex: operator([
439
- "+",
440
- "-",
441
- "/",
442
- ">",
443
- "<",
444
- "=",
445
- "<>",
446
- "<=",
447
- ">=",
448
- "!=",
449
- ...u2.operators ?? []
450
- ])
451
- },
452
- {
453
- type: TokenType.ASTERISK,
454
- regex: /[*]/uy
455
- },
456
- {
457
- type: TokenType.PROPERTY_ACCESS_OPERATOR,
458
- regex: operator([".", ...u2.propertyAccessOperators ?? []])
459
- }
460
- ]);
461
- }
462
- buildParamRules(u2, z) {
463
- var _a, _b, _c, _d, _e;
464
- let B = {
465
- named: (z == null ? void 0 : z.named) || ((_a = u2.paramTypes) == null ? void 0 : _a.named) || [],
466
- quoted: (z == null ? void 0 : z.quoted) || ((_b = u2.paramTypes) == null ? void 0 : _b.quoted) || [],
467
- numbered: (z == null ? void 0 : z.numbered) || ((_c = u2.paramTypes) == null ? void 0 : _c.numbered) || [],
468
- positional: typeof (z == null ? void 0 : z.positional) == "boolean" ? z.positional : (_d = u2.paramTypes) == null ? void 0 : _d.positional,
469
- custom: (z == null ? void 0 : z.custom) || ((_e = u2.paramTypes) == null ? void 0 : _e.custom) || []
470
- };
471
- return this.validRules([
472
- {
473
- type: TokenType.NAMED_PARAMETER,
474
- regex: parameter(B.named, identifierPattern(u2.paramChars || u2.identChars)),
475
- key: (u3) => u3.slice(1)
476
- },
477
- {
478
- type: TokenType.QUOTED_PARAMETER,
479
- regex: parameter(B.quoted, stringPattern(u2.identTypes)),
480
- key: (u3) => (({ tokenKey: u4, quoteChar: z2 }) => u4.replace(new RegExp(escapeRegExp("\\" + z2), "gu"), z2))({
481
- tokenKey: u3.slice(2, -1),
482
- quoteChar: u3.slice(-1)
483
- })
484
- },
485
- {
486
- type: TokenType.NUMBERED_PARAMETER,
487
- regex: parameter(B.numbered, "[0-9]+"),
488
- key: (u3) => u3.slice(1)
489
- },
490
- {
491
- type: TokenType.POSITIONAL_PARAMETER,
492
- regex: B.positional ? /[?]/y : void 0
493
- },
494
- ...B.custom.map((u3) => ({
495
- type: TokenType.CUSTOM_PARAMETER,
496
- regex: patternToRegex(u3.regex),
497
- key: u3.key ?? ((u4) => u4)
498
- }))
499
- ]);
500
- }
501
- validRules(u2) {
502
- return u2.filter((u3) => !!u3.regex);
503
- }
504
- }, toCanonical = (u2) => equalizeWhitespace(u2.toUpperCase()), cache = /* @__PURE__ */ new Map();
505
- const createDialect = (u2) => {
506
- let z = cache.get(u2);
507
- return z || (z = dialectFromOptions(u2), cache.set(u2, z)), z;
508
- };
509
- var dialectFromOptions = (u2) => ({
510
- tokenizer: new Tokenizer(u2.tokenizerOptions, u2.name),
511
- formatOptions: processDialectFormatOptions(u2.formatOptions)
512
- }), processDialectFormatOptions = (u2) => ({
513
- alwaysDenseOperators: u2.alwaysDenseOperators || [],
514
- onelineClauses: Object.fromEntries(u2.onelineClauses.map((u3) => [u3, true])),
515
- tabularOnelineClauses: Object.fromEntries((u2.tabularOnelineClauses ?? u2.onelineClauses).map((u3) => [u3, true]))
516
- });
517
- function indentString(u2) {
518
- return u2.indentStyle === "tabularLeft" || u2.indentStyle === "tabularRight" ? " ".repeat(10) : u2.useTabs ? " " : " ".repeat(u2.tabWidth);
519
- }
520
- function isTabularStyle(u2) {
521
- return u2.indentStyle === "tabularLeft" || u2.indentStyle === "tabularRight";
522
- }
523
- var Params = class {
524
- constructor(u2) {
525
- this.params = u2, this.index = 0;
526
- }
527
- get({ key: u2, text: z }) {
528
- return this.params ? u2 ? this.params[u2] : this.params[this.index++] : z;
529
- }
530
- getPositionalParameterIndex() {
531
- return this.index;
532
- }
533
- setPositionalParameterIndex(u2) {
534
- this.index = u2;
535
- }
536
- }, import_nearley = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((u2, z) => {
537
- (function(u3, B) {
538
- typeof z == "object" && z.exports ? z.exports = B() : u3.nearley = B();
539
- })(u2, function() {
540
- function u3(z3, B2, V2) {
541
- return this.id = ++u3.highestId, this.name = z3, this.symbols = B2, this.postprocess = V2, this;
542
- }
543
- u3.highestId = 0, u3.prototype.toString = function(u4) {
544
- var z3 = u4 === void 0 ? this.symbols.map(G).join(" ") : this.symbols.slice(0, u4).map(G).join(" ") + " \u25CF " + this.symbols.slice(u4).map(G).join(" ");
545
- return this.name + " \u2192 " + z3;
546
- };
547
- function z2(u4, z3, B2, V2) {
548
- this.rule = u4, this.dot = z3, this.reference = B2, this.data = [], this.wantedBy = V2, this.isComplete = this.dot === u4.symbols.length;
549
- }
550
- z2.prototype.toString = function() {
551
- return "{" + this.rule.toString(this.dot) + "}, from: " + (this.reference || 0);
552
- }, z2.prototype.nextState = function(u4) {
553
- var B2 = new z2(this.rule, this.dot + 1, this.reference, this.wantedBy);
554
- return B2.left = this, B2.right = u4, B2.isComplete && (B2.data = B2.build(), B2.right = void 0), B2;
555
- }, z2.prototype.build = function() {
556
- var u4 = [], z3 = this;
557
- do
558
- u4.push(z3.right.data), z3 = z3.left;
559
- while (z3.left);
560
- return u4.reverse(), u4;
561
- }, z2.prototype.finish = function() {
562
- this.rule.postprocess && (this.data = this.rule.postprocess(this.data, this.reference, U.fail));
563
- };
564
- function B(u4, z3) {
565
- this.grammar = u4, this.index = z3, this.states = [], this.wants = {}, this.scannable = [], this.completed = {};
566
- }
567
- B.prototype.process = function(u4) {
568
- for (var z3 = this.states, B2 = this.wants, V2 = this.completed, H2 = 0; H2 < z3.length; H2++) {
569
- var W2 = z3[H2];
570
- if (W2.isComplete) {
571
- if (W2.finish(), W2.data !== U.fail) {
572
- for (var G2 = W2.wantedBy, K = G2.length; K--; ) {
573
- var q = G2[K];
574
- this.complete(q, W2);
575
- }
576
- if (W2.reference === this.index) {
577
- var J = W2.rule.name;
578
- (this.completed[J] = this.completed[J] || []).push(W2);
579
- }
580
- }
581
- } else {
582
- var J = W2.rule.symbols[W2.dot];
583
- if (typeof J != "string") {
584
- this.scannable.push(W2);
585
- continue;
586
- }
587
- if (B2[J]) {
588
- if (B2[J].push(W2), V2.hasOwnProperty(J)) for (var Y = V2[J], K = 0; K < Y.length; K++) {
589
- var X = Y[K];
590
- this.complete(W2, X);
591
- }
592
- } else B2[J] = [W2], this.predict(J);
593
- }
594
- }
595
- }, B.prototype.predict = function(u4) {
596
- for (var B2 = this.grammar.byName[u4] || [], V2 = 0; V2 < B2.length; V2++) {
597
- var H2 = B2[V2], U2 = this.wants[u4], W2 = new z2(H2, 0, this.index, U2);
598
- this.states.push(W2);
599
- }
600
- }, B.prototype.complete = function(u4, z3) {
601
- var B2 = u4.nextState(z3);
602
- this.states.push(B2);
603
- };
604
- function V(u4, z3) {
605
- this.rules = u4, this.start = z3 || this.rules[0].name;
606
- var B2 = this.byName = {};
607
- this.rules.forEach(function(u5) {
608
- B2.hasOwnProperty(u5.name) || (B2[u5.name] = []), B2[u5.name].push(u5);
609
- });
610
- }
611
- V.fromCompiled = function(z3, B2) {
612
- var H2 = z3.Lexer;
613
- z3.ParserStart && (B2 = z3.ParserStart, z3 = z3.ParserRules);
614
- var z3 = z3.map(function(z4) {
615
- return new u3(z4.name, z4.symbols, z4.postprocess);
616
- }), U2 = new V(z3, B2);
617
- return U2.lexer = H2, U2;
618
- };
619
- function H() {
620
- this.reset("");
621
- }
622
- H.prototype.reset = function(u4, z3) {
623
- this.buffer = u4, this.index = 0, this.line = z3 ? z3.line : 1, this.lastLineBreak = z3 ? -z3.col : 0;
624
- }, H.prototype.next = function() {
625
- if (this.index < this.buffer.length) {
626
- var u4 = this.buffer[this.index++];
627
- return u4 === "\n" && (this.line += 1, this.lastLineBreak = this.index), { value: u4 };
628
- }
629
- }, H.prototype.save = function() {
630
- return {
631
- line: this.line,
632
- col: this.index - this.lastLineBreak
633
- };
634
- }, H.prototype.formatError = function(u4, z3) {
635
- var B2 = this.buffer;
636
- if (typeof B2 == "string") {
637
- var V2 = B2.split("\n").slice(Math.max(0, this.line - 5), this.line), H2 = B2.indexOf("\n", this.index);
638
- H2 === -1 && (H2 = B2.length);
639
- var U2 = this.index - this.lastLineBreak, W2 = String(this.line).length;
640
- return z3 += " at line " + this.line + " col " + U2 + ":\n\n", z3 += V2.map(function(u5, z4) {
641
- return G2(this.line - V2.length + z4 + 1, W2) + " " + u5;
642
- }, this).join("\n"), z3 += "\n" + G2("", W2 + U2) + "^\n", z3;
643
- } else return z3 + " at index " + (this.index - 1);
644
- function G2(u5, z4) {
645
- var B3 = String(u5);
646
- return Array(z4 - B3.length + 1).join(" ") + B3;
647
- }
648
- };
649
- function U(u4, z3, U2) {
650
- if (u4 instanceof V) var W2 = u4, U2 = z3;
651
- else var W2 = V.fromCompiled(u4, z3);
652
- for (var G2 in this.grammar = W2, this.options = {
653
- keepHistory: false,
654
- lexer: W2.lexer || new H()
655
- }, U2 || {}) this.options[G2] = U2[G2];
656
- this.lexer = this.options.lexer, this.lexerState = void 0;
657
- var K = new B(W2, 0);
658
- this.table = [K], K.wants[W2.start] = [], K.predict(W2.start), K.process(), this.current = 0;
659
- }
660
- U.fail = {}, U.prototype.feed = function(u4) {
661
- var z3 = this.lexer;
662
- z3.reset(u4, this.lexerState);
663
- for (var V2; ; ) {
664
- try {
665
- if (V2 = z3.next(), !V2) break;
666
- } catch (u5) {
667
- var U2 = new B(this.grammar, this.current + 1);
668
- this.table.push(U2);
669
- var W2 = Error(this.reportLexerError(u5));
670
- throw W2.offset = this.current, W2.token = u5.token, W2;
671
- }
672
- var G2 = this.table[this.current];
673
- this.options.keepHistory || delete this.table[this.current - 1];
674
- var K = this.current + 1, U2 = new B(this.grammar, K);
675
- this.table.push(U2);
676
- for (var q = V2.text === void 0 ? V2.value : V2.text, J = z3.constructor === H ? V2.value : V2, Y = G2.scannable, X = Y.length; X--; ) {
677
- var Z = Y[X], Q = Z.rule.symbols[Z.dot];
678
- if (Q.test ? Q.test(J) : Q.type ? Q.type === V2.type : Q.literal === q) {
679
- var $ = Z.nextState({
680
- data: J,
681
- token: V2,
682
- isToken: true,
683
- reference: K - 1
684
- });
685
- U2.states.push($);
686
- }
687
- }
688
- if (U2.process(), U2.states.length === 0) {
689
- var W2 = Error(this.reportError(V2));
690
- throw W2.offset = this.current, W2.token = V2, W2;
691
- }
692
- this.options.keepHistory && (G2.lexerState = z3.save()), this.current++;
693
- }
694
- return G2 && (this.lexerState = z3.save()), this.results = this.finish(), this;
695
- }, U.prototype.reportLexerError = function(u4) {
696
- var z3, B2, V2 = u4.token;
697
- return V2 ? (z3 = "input " + JSON.stringify(V2.text[0]) + " (lexer error)", B2 = this.lexer.formatError(V2, "Syntax error")) : (z3 = "input (lexer error)", B2 = u4.message), this.reportErrorCommon(B2, z3);
698
- }, U.prototype.reportError = function(u4) {
699
- var z3 = (u4.type ? u4.type + " token: " : "") + JSON.stringify(u4.value === void 0 ? u4 : u4.value), B2 = this.lexer.formatError(u4, "Syntax error");
700
- return this.reportErrorCommon(B2, z3);
701
- }, U.prototype.reportErrorCommon = function(u4, z3) {
702
- var B2 = [];
703
- B2.push(u4);
704
- var V2 = this.table.length - 2, H2 = this.table[V2], U2 = H2.states.filter(function(u5) {
705
- var z4 = u5.rule.symbols[u5.dot];
706
- return z4 && typeof z4 != "string";
707
- });
708
- return U2.length === 0 ? (B2.push("Unexpected " + z3 + ". I did not expect any more input. Here is the state of my parse table:\n"), this.displayStateStack(H2.states, B2)) : (B2.push("Unexpected " + z3 + ". Instead, I was expecting to see one of the following:\n"), U2.map(function(u5) {
709
- return this.buildFirstStateStack(u5, []) || [u5];
710
- }, this).forEach(function(u5) {
711
- var z4 = u5[0], V3 = z4.rule.symbols[z4.dot], H3 = this.getSymbolDisplay(V3);
712
- B2.push("A " + H3 + " based on:"), this.displayStateStack(u5, B2);
713
- }, this)), B2.push(""), B2.join("\n");
714
- }, U.prototype.displayStateStack = function(u4, z3) {
715
- for (var B2, V2 = 0, H2 = 0; H2 < u4.length; H2++) {
716
- var U2 = u4[H2], W2 = U2.rule.toString(U2.dot);
717
- W2 === B2 ? V2++ : (V2 > 0 && z3.push(" ^ " + V2 + " more lines identical to this"), V2 = 0, z3.push(" " + W2)), B2 = W2;
718
- }
719
- }, U.prototype.getSymbolDisplay = function(u4) {
720
- return W(u4);
721
- }, U.prototype.buildFirstStateStack = function(u4, z3) {
722
- if (z3.indexOf(u4) !== -1) return null;
723
- if (u4.wantedBy.length === 0) return [u4];
724
- var B2 = u4.wantedBy[0], V2 = [u4].concat(z3), H2 = this.buildFirstStateStack(B2, V2);
725
- return H2 === null ? null : [u4].concat(H2);
726
- }, U.prototype.save = function() {
727
- var u4 = this.table[this.current];
728
- return u4.lexerState = this.lexerState, u4;
729
- }, U.prototype.restore = function(u4) {
730
- var z3 = u4.index;
731
- this.current = z3, this.table[z3] = u4, this.table.splice(z3 + 1), this.lexerState = u4.lexerState, this.results = this.finish();
732
- }, U.prototype.rewind = function(u4) {
733
- if (!this.options.keepHistory) throw Error("set option `keepHistory` to enable rewinding");
734
- this.restore(this.table[u4]);
735
- }, U.prototype.finish = function() {
736
- var u4 = [], z3 = this.grammar.start;
737
- return this.table[this.table.length - 1].states.forEach(function(B2) {
738
- B2.rule.name === z3 && B2.dot === B2.rule.symbols.length && B2.reference === 0 && B2.data !== U.fail && u4.push(B2);
739
- }), u4.map(function(u5) {
740
- return u5.data;
741
- });
742
- };
743
- function W(u4) {
744
- var z3 = typeof u4;
745
- if (z3 === "string") return u4;
746
- if (z3 === "object") {
747
- if (u4.literal) return JSON.stringify(u4.literal);
748
- if (u4 instanceof RegExp) return "character matching " + u4;
749
- if (u4.type) return u4.type + " token";
750
- if (u4.test) return "token matching " + String(u4.test);
751
- throw Error("Unknown symbol type: " + u4);
752
- }
753
- }
754
- function G(u4) {
755
- var z3 = typeof u4;
756
- if (z3 === "string") return u4;
757
- if (z3 === "object") {
758
- if (u4.literal) return JSON.stringify(u4.literal);
759
- if (u4 instanceof RegExp) return u4.toString();
760
- if (u4.type) return "%" + u4.type;
761
- if (u4.test) return "<" + String(u4.test) + ">";
762
- throw Error("Unknown symbol type: " + u4);
763
- }
764
- }
765
- return {
766
- Parser: U,
767
- Grammar: V,
768
- Rule: u3
769
- };
770
- });
771
- })))(), 1);
772
- function disambiguateTokens(u2) {
773
- return u2.map(propertyNameKeywordToIdent).map(funcNameToIdent).map(dataTypeToParameterizedDataType).map(identToArrayIdent).map(dataTypeToArrayKeyword);
774
- }
775
- var propertyNameKeywordToIdent = (u2, z, B) => {
776
- if (isReserved(u2.type)) {
777
- let V = prevNonCommentToken(B, z);
778
- if (V && V.type === TokenType.PROPERTY_ACCESS_OPERATOR) return Object.assign(Object.assign({}, u2), {
779
- type: TokenType.IDENTIFIER,
780
- text: u2.raw
781
- });
782
- let H = nextNonCommentToken(B, z);
783
- if (H && H.type === TokenType.PROPERTY_ACCESS_OPERATOR) return Object.assign(Object.assign({}, u2), {
784
- type: TokenType.IDENTIFIER,
785
- text: u2.raw
786
- });
787
- }
788
- return u2;
789
- }, funcNameToIdent = (u2, z, B) => {
790
- if (u2.type === TokenType.RESERVED_FUNCTION_NAME) {
791
- let V = nextNonCommentToken(B, z);
792
- if (!V || !isOpenParen(V)) return Object.assign(Object.assign({}, u2), {
793
- type: TokenType.IDENTIFIER,
794
- text: u2.raw
795
- });
796
- }
797
- return u2;
798
- }, dataTypeToParameterizedDataType = (u2, z, B) => {
799
- if (u2.type === TokenType.RESERVED_DATA_TYPE) {
800
- let V = nextNonCommentToken(B, z);
801
- if (V && isOpenParen(V)) return Object.assign(Object.assign({}, u2), { type: TokenType.RESERVED_PARAMETERIZED_DATA_TYPE });
802
- }
803
- return u2;
804
- }, identToArrayIdent = (u2, z, B) => {
805
- if (u2.type === TokenType.IDENTIFIER) {
806
- let V = nextNonCommentToken(B, z);
807
- if (V && isOpenBracket(V)) return Object.assign(Object.assign({}, u2), { type: TokenType.ARRAY_IDENTIFIER });
808
- }
809
- return u2;
810
- }, dataTypeToArrayKeyword = (u2, z, B) => {
811
- if (u2.type === TokenType.RESERVED_DATA_TYPE) {
812
- let V = nextNonCommentToken(B, z);
813
- if (V && isOpenBracket(V)) return Object.assign(Object.assign({}, u2), { type: TokenType.ARRAY_KEYWORD });
814
- }
815
- return u2;
816
- }, prevNonCommentToken = (u2, z) => nextNonCommentToken(u2, z, -1), nextNonCommentToken = (u2, z, B = 1) => {
817
- let V = 1;
818
- for (; u2[z + V * B] && isComment(u2[z + V * B]); ) V++;
819
- return u2[z + V * B];
820
- }, isOpenParen = (u2) => u2.type === TokenType.OPEN_PAREN && u2.text === "(", isOpenBracket = (u2) => u2.type === TokenType.OPEN_PAREN && u2.text === "[", isComment = (u2) => u2.type === TokenType.BLOCK_COMMENT || u2.type === TokenType.LINE_COMMENT, LexerAdapter = class {
821
- constructor(u2) {
822
- this.tokenize = u2, this.index = 0, this.tokens = [], this.input = "";
823
- }
824
- reset(u2, z) {
825
- this.input = u2, this.index = 0, this.tokens = this.tokenize(u2);
826
- }
827
- next() {
828
- return this.tokens[this.index++];
829
- }
830
- save() {
831
- }
832
- formatError(u2) {
833
- let { line: z, col: B } = lineColFromIndex(this.input, u2.start);
834
- return `Parse error at token: ${u2.text} at line ${z} column ${B}`;
835
- }
836
- has(u2) {
837
- return u2 in TokenType;
838
- }
839
- }, NodeType;
840
- (function(u2) {
841
- u2.statement = "statement", u2.clause = "clause", u2.set_operation = "set_operation", u2.function_call = "function_call", u2.parameterized_data_type = "parameterized_data_type", u2.array_subscript = "array_subscript", u2.property_access = "property_access", u2.parenthesis = "parenthesis", u2.between_predicate = "between_predicate", u2.case_expression = "case_expression", u2.case_when = "case_when", u2.case_else = "case_else", u2.limit_clause = "limit_clause", u2.all_columns_asterisk = "all_columns_asterisk", u2.literal = "literal", u2.identifier = "identifier", u2.keyword = "keyword", u2.data_type = "data_type", u2.parameter = "parameter", u2.operator = "operator", u2.comma = "comma", u2.line_comment = "line_comment", u2.block_comment = "block_comment", u2.disable_comment = "disable_comment";
842
- })(NodeType = NodeType || (NodeType = {}));
843
- function id(u2) {
844
- return u2[0];
845
- }
846
- var lexer = new LexerAdapter((u2) => []), unwrap = ([[u2]]) => u2, toKeywordNode = (u2) => ({
847
- type: NodeType.keyword,
848
- tokenType: u2.type,
849
- text: u2.text,
850
- raw: u2.raw
851
- }), toDataTypeNode = (u2) => ({
852
- type: NodeType.data_type,
853
- text: u2.text,
854
- raw: u2.raw
855
- }), addComments = (u2, { leading: z, trailing: B }) => ((z == null ? void 0 : z.length) && (u2 = Object.assign(Object.assign({}, u2), { leadingComments: z })), (B == null ? void 0 : B.length) && (u2 = Object.assign(Object.assign({}, u2), { trailingComments: B })), u2), addCommentsToArray = (u2, { leading: z, trailing: B }) => {
856
- if (z == null ? void 0 : z.length) {
857
- let [B2, ...V] = u2;
858
- u2 = [addComments(B2, { leading: z }), ...V];
859
- }
860
- if (B == null ? void 0 : B.length) {
861
- let z2 = u2.slice(0, -1), V = u2[u2.length - 1];
862
- u2 = [...z2, addComments(V, { trailing: B })];
863
- }
864
- return u2;
865
- }, grammar_default = {
866
- Lexer: lexer,
867
- ParserRules: [
868
- {
869
- name: "main$ebnf$1",
870
- symbols: []
871
- },
872
- {
873
- name: "main$ebnf$1",
874
- symbols: ["main$ebnf$1", "statement"],
875
- postprocess: (u2) => u2[0].concat([u2[1]])
876
- },
877
- {
878
- name: "main",
879
- symbols: ["main$ebnf$1"],
880
- postprocess: ([u2]) => {
881
- let z = u2[u2.length - 1];
882
- return z && !z.hasSemicolon ? z.children.length > 0 ? u2 : u2.slice(0, -1) : u2;
883
- }
884
- },
885
- {
886
- name: "statement$subexpression$1",
887
- symbols: [lexer.has("DELIMITER") ? { type: "DELIMITER" } : DELIMITER]
888
- },
889
- {
890
- name: "statement$subexpression$1",
891
- symbols: [lexer.has("EOF") ? { type: "EOF" } : EOF]
892
- },
893
- {
894
- name: "statement",
895
- symbols: ["expressions_or_clauses", "statement$subexpression$1"],
896
- postprocess: ([u2, [z]]) => ({
897
- type: NodeType.statement,
898
- children: u2,
899
- hasSemicolon: z.type === TokenType.DELIMITER
900
- })
901
- },
902
- {
903
- name: "expressions_or_clauses$ebnf$1",
904
- symbols: []
905
- },
906
- {
907
- name: "expressions_or_clauses$ebnf$1",
908
- symbols: ["expressions_or_clauses$ebnf$1", "free_form_sql"],
909
- postprocess: (u2) => u2[0].concat([u2[1]])
910
- },
911
- {
912
- name: "expressions_or_clauses$ebnf$2",
913
- symbols: []
914
- },
915
- {
916
- name: "expressions_or_clauses$ebnf$2",
917
- symbols: ["expressions_or_clauses$ebnf$2", "clause"],
918
- postprocess: (u2) => u2[0].concat([u2[1]])
919
- },
920
- {
921
- name: "expressions_or_clauses",
922
- symbols: ["expressions_or_clauses$ebnf$1", "expressions_or_clauses$ebnf$2"],
923
- postprocess: ([u2, z]) => [...u2, ...z]
924
- },
925
- {
926
- name: "clause$subexpression$1",
927
- symbols: ["limit_clause"]
928
- },
929
- {
930
- name: "clause$subexpression$1",
931
- symbols: ["select_clause"]
932
- },
933
- {
934
- name: "clause$subexpression$1",
935
- symbols: ["other_clause"]
936
- },
937
- {
938
- name: "clause$subexpression$1",
939
- symbols: ["set_operation"]
940
- },
941
- {
942
- name: "clause",
943
- symbols: ["clause$subexpression$1"],
944
- postprocess: unwrap
945
- },
946
- {
947
- name: "limit_clause$ebnf$1$subexpression$1$ebnf$1",
948
- symbols: ["free_form_sql"]
949
- },
950
- {
951
- name: "limit_clause$ebnf$1$subexpression$1$ebnf$1",
952
- symbols: ["limit_clause$ebnf$1$subexpression$1$ebnf$1", "free_form_sql"],
953
- postprocess: (u2) => u2[0].concat([u2[1]])
954
- },
955
- {
956
- name: "limit_clause$ebnf$1$subexpression$1",
957
- symbols: [lexer.has("COMMA") ? { type: "COMMA" } : COMMA, "limit_clause$ebnf$1$subexpression$1$ebnf$1"]
958
- },
959
- {
960
- name: "limit_clause$ebnf$1",
961
- symbols: ["limit_clause$ebnf$1$subexpression$1"],
962
- postprocess: id
963
- },
964
- {
965
- name: "limit_clause$ebnf$1",
966
- symbols: [],
967
- postprocess: () => null
968
- },
969
- {
970
- name: "limit_clause",
971
- symbols: [
972
- lexer.has("LIMIT") ? { type: "LIMIT" } : LIMIT,
973
- "_",
974
- "expression_chain_",
975
- "limit_clause$ebnf$1"
976
- ],
977
- postprocess: ([u2, z, B, V]) => {
978
- if (V) {
979
- let [H, U] = V;
980
- return {
981
- type: NodeType.limit_clause,
982
- limitKw: addComments(toKeywordNode(u2), { trailing: z }),
983
- offset: B,
984
- count: U
985
- };
986
- } else return {
987
- type: NodeType.limit_clause,
988
- limitKw: addComments(toKeywordNode(u2), { trailing: z }),
989
- count: B
990
- };
991
- }
992
- },
993
- {
994
- name: "select_clause$subexpression$1$ebnf$1",
995
- symbols: []
996
- },
997
- {
998
- name: "select_clause$subexpression$1$ebnf$1",
999
- symbols: ["select_clause$subexpression$1$ebnf$1", "free_form_sql"],
1000
- postprocess: (u2) => u2[0].concat([u2[1]])
1001
- },
1002
- {
1003
- name: "select_clause$subexpression$1",
1004
- symbols: ["all_columns_asterisk", "select_clause$subexpression$1$ebnf$1"]
1005
- },
1006
- {
1007
- name: "select_clause$subexpression$1$ebnf$2",
1008
- symbols: []
1009
- },
1010
- {
1011
- name: "select_clause$subexpression$1$ebnf$2",
1012
- symbols: ["select_clause$subexpression$1$ebnf$2", "free_form_sql"],
1013
- postprocess: (u2) => u2[0].concat([u2[1]])
1014
- },
1015
- {
1016
- name: "select_clause$subexpression$1",
1017
- symbols: ["asteriskless_free_form_sql", "select_clause$subexpression$1$ebnf$2"]
1018
- },
1019
- {
1020
- name: "select_clause",
1021
- symbols: [lexer.has("RESERVED_SELECT") ? { type: "RESERVED_SELECT" } : RESERVED_SELECT, "select_clause$subexpression$1"],
1022
- postprocess: ([u2, [z, B]]) => ({
1023
- type: NodeType.clause,
1024
- nameKw: toKeywordNode(u2),
1025
- children: [z, ...B]
1026
- })
1027
- },
1028
- {
1029
- name: "select_clause",
1030
- symbols: [lexer.has("RESERVED_SELECT") ? { type: "RESERVED_SELECT" } : RESERVED_SELECT],
1031
- postprocess: ([u2]) => ({
1032
- type: NodeType.clause,
1033
- nameKw: toKeywordNode(u2),
1034
- children: []
1035
- })
1036
- },
1037
- {
1038
- name: "all_columns_asterisk",
1039
- symbols: [lexer.has("ASTERISK") ? { type: "ASTERISK" } : ASTERISK],
1040
- postprocess: () => ({ type: NodeType.all_columns_asterisk })
1041
- },
1042
- {
1043
- name: "other_clause$ebnf$1",
1044
- symbols: []
1045
- },
1046
- {
1047
- name: "other_clause$ebnf$1",
1048
- symbols: ["other_clause$ebnf$1", "free_form_sql"],
1049
- postprocess: (u2) => u2[0].concat([u2[1]])
1050
- },
1051
- {
1052
- name: "other_clause",
1053
- symbols: [lexer.has("RESERVED_CLAUSE") ? { type: "RESERVED_CLAUSE" } : RESERVED_CLAUSE, "other_clause$ebnf$1"],
1054
- postprocess: ([u2, z]) => ({
1055
- type: NodeType.clause,
1056
- nameKw: toKeywordNode(u2),
1057
- children: z
1058
- })
1059
- },
1060
- {
1061
- name: "set_operation$ebnf$1",
1062
- symbols: []
1063
- },
1064
- {
1065
- name: "set_operation$ebnf$1",
1066
- symbols: ["set_operation$ebnf$1", "free_form_sql"],
1067
- postprocess: (u2) => u2[0].concat([u2[1]])
1068
- },
1069
- {
1070
- name: "set_operation",
1071
- symbols: [lexer.has("RESERVED_SET_OPERATION") ? { type: "RESERVED_SET_OPERATION" } : RESERVED_SET_OPERATION, "set_operation$ebnf$1"],
1072
- postprocess: ([u2, z]) => ({
1073
- type: NodeType.set_operation,
1074
- nameKw: toKeywordNode(u2),
1075
- children: z
1076
- })
1077
- },
1078
- {
1079
- name: "expression_chain_$ebnf$1",
1080
- symbols: ["expression_with_comments_"]
1081
- },
1082
- {
1083
- name: "expression_chain_$ebnf$1",
1084
- symbols: ["expression_chain_$ebnf$1", "expression_with_comments_"],
1085
- postprocess: (u2) => u2[0].concat([u2[1]])
1086
- },
1087
- {
1088
- name: "expression_chain_",
1089
- symbols: ["expression_chain_$ebnf$1"],
1090
- postprocess: id
1091
- },
1092
- {
1093
- name: "expression_chain$ebnf$1",
1094
- symbols: []
1095
- },
1096
- {
1097
- name: "expression_chain$ebnf$1",
1098
- symbols: ["expression_chain$ebnf$1", "_expression_with_comments"],
1099
- postprocess: (u2) => u2[0].concat([u2[1]])
1100
- },
1101
- {
1102
- name: "expression_chain",
1103
- symbols: ["expression", "expression_chain$ebnf$1"],
1104
- postprocess: ([u2, z]) => [u2, ...z]
1105
- },
1106
- {
1107
- name: "andless_expression_chain$ebnf$1",
1108
- symbols: []
1109
- },
1110
- {
1111
- name: "andless_expression_chain$ebnf$1",
1112
- symbols: ["andless_expression_chain$ebnf$1", "_andless_expression_with_comments"],
1113
- postprocess: (u2) => u2[0].concat([u2[1]])
1114
- },
1115
- {
1116
- name: "andless_expression_chain",
1117
- symbols: ["andless_expression", "andless_expression_chain$ebnf$1"],
1118
- postprocess: ([u2, z]) => [u2, ...z]
1119
- },
1120
- {
1121
- name: "expression_with_comments_",
1122
- symbols: ["expression", "_"],
1123
- postprocess: ([u2, z]) => addComments(u2, { trailing: z })
1124
- },
1125
- {
1126
- name: "_expression_with_comments",
1127
- symbols: ["_", "expression"],
1128
- postprocess: ([u2, z]) => addComments(z, { leading: u2 })
1129
- },
1130
- {
1131
- name: "_andless_expression_with_comments",
1132
- symbols: ["_", "andless_expression"],
1133
- postprocess: ([u2, z]) => addComments(z, { leading: u2 })
1134
- },
1135
- {
1136
- name: "free_form_sql$subexpression$1",
1137
- symbols: ["asteriskless_free_form_sql"]
1138
- },
1139
- {
1140
- name: "free_form_sql$subexpression$1",
1141
- symbols: ["asterisk"]
1142
- },
1143
- {
1144
- name: "free_form_sql",
1145
- symbols: ["free_form_sql$subexpression$1"],
1146
- postprocess: unwrap
1147
- },
1148
- {
1149
- name: "asteriskless_free_form_sql$subexpression$1",
1150
- symbols: ["asteriskless_andless_expression"]
1151
- },
1152
- {
1153
- name: "asteriskless_free_form_sql$subexpression$1",
1154
- symbols: ["logic_operator"]
1155
- },
1156
- {
1157
- name: "asteriskless_free_form_sql$subexpression$1",
1158
- symbols: ["comma"]
1159
- },
1160
- {
1161
- name: "asteriskless_free_form_sql$subexpression$1",
1162
- symbols: ["comment"]
1163
- },
1164
- {
1165
- name: "asteriskless_free_form_sql$subexpression$1",
1166
- symbols: ["other_keyword"]
1167
- },
1168
- {
1169
- name: "asteriskless_free_form_sql",
1170
- symbols: ["asteriskless_free_form_sql$subexpression$1"],
1171
- postprocess: unwrap
1172
- },
1173
- {
1174
- name: "expression$subexpression$1",
1175
- symbols: ["andless_expression"]
1176
- },
1177
- {
1178
- name: "expression$subexpression$1",
1179
- symbols: ["logic_operator"]
1180
- },
1181
- {
1182
- name: "expression",
1183
- symbols: ["expression$subexpression$1"],
1184
- postprocess: unwrap
1185
- },
1186
- {
1187
- name: "andless_expression$subexpression$1",
1188
- symbols: ["asteriskless_andless_expression"]
1189
- },
1190
- {
1191
- name: "andless_expression$subexpression$1",
1192
- symbols: ["asterisk"]
1193
- },
1194
- {
1195
- name: "andless_expression",
1196
- symbols: ["andless_expression$subexpression$1"],
1197
- postprocess: unwrap
1198
- },
1199
- {
1200
- name: "asteriskless_andless_expression$subexpression$1",
1201
- symbols: ["atomic_expression"]
1202
- },
1203
- {
1204
- name: "asteriskless_andless_expression$subexpression$1",
1205
- symbols: ["between_predicate"]
1206
- },
1207
- {
1208
- name: "asteriskless_andless_expression$subexpression$1",
1209
- symbols: ["case_expression"]
1210
- },
1211
- {
1212
- name: "asteriskless_andless_expression",
1213
- symbols: ["asteriskless_andless_expression$subexpression$1"],
1214
- postprocess: unwrap
1215
- },
1216
- {
1217
- name: "atomic_expression$subexpression$1",
1218
- symbols: ["array_subscript"]
1219
- },
1220
- {
1221
- name: "atomic_expression$subexpression$1",
1222
- symbols: ["function_call"]
1223
- },
1224
- {
1225
- name: "atomic_expression$subexpression$1",
1226
- symbols: ["property_access"]
1227
- },
1228
- {
1229
- name: "atomic_expression$subexpression$1",
1230
- symbols: ["parenthesis"]
1231
- },
1232
- {
1233
- name: "atomic_expression$subexpression$1",
1234
- symbols: ["curly_braces"]
1235
- },
1236
- {
1237
- name: "atomic_expression$subexpression$1",
1238
- symbols: ["square_brackets"]
1239
- },
1240
- {
1241
- name: "atomic_expression$subexpression$1",
1242
- symbols: ["operator"]
1243
- },
1244
- {
1245
- name: "atomic_expression$subexpression$1",
1246
- symbols: ["identifier"]
1247
- },
1248
- {
1249
- name: "atomic_expression$subexpression$1",
1250
- symbols: ["parameter"]
1251
- },
1252
- {
1253
- name: "atomic_expression$subexpression$1",
1254
- symbols: ["literal"]
1255
- },
1256
- {
1257
- name: "atomic_expression$subexpression$1",
1258
- symbols: ["data_type"]
1259
- },
1260
- {
1261
- name: "atomic_expression$subexpression$1",
1262
- symbols: ["keyword"]
1263
- },
1264
- {
1265
- name: "atomic_expression",
1266
- symbols: ["atomic_expression$subexpression$1"],
1267
- postprocess: unwrap
1268
- },
1269
- {
1270
- name: "array_subscript",
1271
- symbols: [
1272
- lexer.has("ARRAY_IDENTIFIER") ? { type: "ARRAY_IDENTIFIER" } : ARRAY_IDENTIFIER,
1273
- "_",
1274
- "square_brackets"
1275
- ],
1276
- postprocess: ([u2, z, B]) => ({
1277
- type: NodeType.array_subscript,
1278
- array: addComments({
1279
- type: NodeType.identifier,
1280
- quoted: false,
1281
- text: u2.text
1282
- }, { trailing: z }),
1283
- parenthesis: B
1284
- })
1285
- },
1286
- {
1287
- name: "array_subscript",
1288
- symbols: [
1289
- lexer.has("ARRAY_KEYWORD") ? { type: "ARRAY_KEYWORD" } : ARRAY_KEYWORD,
1290
- "_",
1291
- "square_brackets"
1292
- ],
1293
- postprocess: ([u2, z, B]) => ({
1294
- type: NodeType.array_subscript,
1295
- array: addComments(toKeywordNode(u2), { trailing: z }),
1296
- parenthesis: B
1297
- })
1298
- },
1299
- {
1300
- name: "function_call",
1301
- symbols: [
1302
- lexer.has("RESERVED_FUNCTION_NAME") ? { type: "RESERVED_FUNCTION_NAME" } : RESERVED_FUNCTION_NAME,
1303
- "_",
1304
- "parenthesis"
1305
- ],
1306
- postprocess: ([u2, z, B]) => ({
1307
- type: NodeType.function_call,
1308
- nameKw: addComments(toKeywordNode(u2), { trailing: z }),
1309
- parenthesis: B
1310
- })
1311
- },
1312
- {
1313
- name: "parenthesis",
1314
- symbols: [
1315
- { literal: "(" },
1316
- "expressions_or_clauses",
1317
- { literal: ")" }
1318
- ],
1319
- postprocess: ([u2, z, B]) => ({
1320
- type: NodeType.parenthesis,
1321
- children: z,
1322
- openParen: "(",
1323
- closeParen: ")"
1324
- })
1325
- },
1326
- {
1327
- name: "curly_braces$ebnf$1",
1328
- symbols: []
1329
- },
1330
- {
1331
- name: "curly_braces$ebnf$1",
1332
- symbols: ["curly_braces$ebnf$1", "free_form_sql"],
1333
- postprocess: (u2) => u2[0].concat([u2[1]])
1334
- },
1335
- {
1336
- name: "curly_braces",
1337
- symbols: [
1338
- { literal: "{" },
1339
- "curly_braces$ebnf$1",
1340
- { literal: "}" }
1341
- ],
1342
- postprocess: ([u2, z, B]) => ({
1343
- type: NodeType.parenthesis,
1344
- children: z,
1345
- openParen: "{",
1346
- closeParen: "}"
1347
- })
1348
- },
1349
- {
1350
- name: "square_brackets$ebnf$1",
1351
- symbols: []
1352
- },
1353
- {
1354
- name: "square_brackets$ebnf$1",
1355
- symbols: ["square_brackets$ebnf$1", "free_form_sql"],
1356
- postprocess: (u2) => u2[0].concat([u2[1]])
1357
- },
1358
- {
1359
- name: "square_brackets",
1360
- symbols: [
1361
- { literal: "[" },
1362
- "square_brackets$ebnf$1",
1363
- { literal: "]" }
1364
- ],
1365
- postprocess: ([u2, z, B]) => ({
1366
- type: NodeType.parenthesis,
1367
- children: z,
1368
- openParen: "[",
1369
- closeParen: "]"
1370
- })
1371
- },
1372
- {
1373
- name: "property_access$subexpression$1",
1374
- symbols: ["identifier"]
1375
- },
1376
- {
1377
- name: "property_access$subexpression$1",
1378
- symbols: ["array_subscript"]
1379
- },
1380
- {
1381
- name: "property_access$subexpression$1",
1382
- symbols: ["all_columns_asterisk"]
1383
- },
1384
- {
1385
- name: "property_access$subexpression$1",
1386
- symbols: ["parameter"]
1387
- },
1388
- {
1389
- name: "property_access",
1390
- symbols: [
1391
- "atomic_expression",
1392
- "_",
1393
- lexer.has("PROPERTY_ACCESS_OPERATOR") ? { type: "PROPERTY_ACCESS_OPERATOR" } : PROPERTY_ACCESS_OPERATOR,
1394
- "_",
1395
- "property_access$subexpression$1"
1396
- ],
1397
- postprocess: ([u2, z, B, V, [H]]) => ({
1398
- type: NodeType.property_access,
1399
- object: addComments(u2, { trailing: z }),
1400
- operator: B.text,
1401
- property: addComments(H, { leading: V })
1402
- })
1403
- },
1404
- {
1405
- name: "between_predicate",
1406
- symbols: [
1407
- lexer.has("BETWEEN") ? { type: "BETWEEN" } : BETWEEN,
1408
- "_",
1409
- "andless_expression_chain",
1410
- "_",
1411
- lexer.has("AND") ? { type: "AND" } : AND,
1412
- "_",
1413
- "andless_expression"
1414
- ],
1415
- postprocess: ([u2, z, B, V, H, U, W]) => ({
1416
- type: NodeType.between_predicate,
1417
- betweenKw: toKeywordNode(u2),
1418
- expr1: addCommentsToArray(B, {
1419
- leading: z,
1420
- trailing: V
1421
- }),
1422
- andKw: toKeywordNode(H),
1423
- expr2: [addComments(W, { leading: U })]
1424
- })
1425
- },
1426
- {
1427
- name: "case_expression$ebnf$1",
1428
- symbols: ["expression_chain_"],
1429
- postprocess: id
1430
- },
1431
- {
1432
- name: "case_expression$ebnf$1",
1433
- symbols: [],
1434
- postprocess: () => null
1435
- },
1436
- {
1437
- name: "case_expression$ebnf$2",
1438
- symbols: []
1439
- },
1440
- {
1441
- name: "case_expression$ebnf$2",
1442
- symbols: ["case_expression$ebnf$2", "case_clause"],
1443
- postprocess: (u2) => u2[0].concat([u2[1]])
1444
- },
1445
- {
1446
- name: "case_expression",
1447
- symbols: [
1448
- lexer.has("CASE") ? { type: "CASE" } : CASE,
1449
- "_",
1450
- "case_expression$ebnf$1",
1451
- "case_expression$ebnf$2",
1452
- lexer.has("END") ? { type: "END" } : END
1453
- ],
1454
- postprocess: ([u2, z, B, V, H]) => ({
1455
- type: NodeType.case_expression,
1456
- caseKw: addComments(toKeywordNode(u2), { trailing: z }),
1457
- endKw: toKeywordNode(H),
1458
- expr: B || [],
1459
- clauses: V
1460
- })
1461
- },
1462
- {
1463
- name: "case_clause",
1464
- symbols: [
1465
- lexer.has("WHEN") ? { type: "WHEN" } : WHEN,
1466
- "_",
1467
- "expression_chain_",
1468
- lexer.has("THEN") ? { type: "THEN" } : THEN,
1469
- "_",
1470
- "expression_chain_"
1471
- ],
1472
- postprocess: ([u2, z, B, V, H, U]) => ({
1473
- type: NodeType.case_when,
1474
- whenKw: addComments(toKeywordNode(u2), { trailing: z }),
1475
- thenKw: addComments(toKeywordNode(V), { trailing: H }),
1476
- condition: B,
1477
- result: U
1478
- })
1479
- },
1480
- {
1481
- name: "case_clause",
1482
- symbols: [
1483
- lexer.has("ELSE") ? { type: "ELSE" } : ELSE,
1484
- "_",
1485
- "expression_chain_"
1486
- ],
1487
- postprocess: ([u2, z, B]) => ({
1488
- type: NodeType.case_else,
1489
- elseKw: addComments(toKeywordNode(u2), { trailing: z }),
1490
- result: B
1491
- })
1492
- },
1493
- {
1494
- name: "comma$subexpression$1",
1495
- symbols: [lexer.has("COMMA") ? { type: "COMMA" } : COMMA]
1496
- },
1497
- {
1498
- name: "comma",
1499
- symbols: ["comma$subexpression$1"],
1500
- postprocess: ([[u2]]) => ({ type: NodeType.comma })
1501
- },
1502
- {
1503
- name: "asterisk$subexpression$1",
1504
- symbols: [lexer.has("ASTERISK") ? { type: "ASTERISK" } : ASTERISK]
1505
- },
1506
- {
1507
- name: "asterisk",
1508
- symbols: ["asterisk$subexpression$1"],
1509
- postprocess: ([[u2]]) => ({
1510
- type: NodeType.operator,
1511
- text: u2.text
1512
- })
1513
- },
1514
- {
1515
- name: "operator$subexpression$1",
1516
- symbols: [lexer.has("OPERATOR") ? { type: "OPERATOR" } : OPERATOR]
1517
- },
1518
- {
1519
- name: "operator",
1520
- symbols: ["operator$subexpression$1"],
1521
- postprocess: ([[u2]]) => ({
1522
- type: NodeType.operator,
1523
- text: u2.text
1524
- })
1525
- },
1526
- {
1527
- name: "identifier$subexpression$1",
1528
- symbols: [lexer.has("IDENTIFIER") ? { type: "IDENTIFIER" } : IDENTIFIER]
1529
- },
1530
- {
1531
- name: "identifier$subexpression$1",
1532
- symbols: [lexer.has("QUOTED_IDENTIFIER") ? { type: "QUOTED_IDENTIFIER" } : QUOTED_IDENTIFIER]
1533
- },
1534
- {
1535
- name: "identifier$subexpression$1",
1536
- symbols: [lexer.has("VARIABLE") ? { type: "VARIABLE" } : VARIABLE]
1537
- },
1538
- {
1539
- name: "identifier",
1540
- symbols: ["identifier$subexpression$1"],
1541
- postprocess: ([[u2]]) => ({
1542
- type: NodeType.identifier,
1543
- quoted: u2.type !== "IDENTIFIER",
1544
- text: u2.text
1545
- })
1546
- },
1547
- {
1548
- name: "parameter$subexpression$1",
1549
- symbols: [lexer.has("NAMED_PARAMETER") ? { type: "NAMED_PARAMETER" } : NAMED_PARAMETER]
1550
- },
1551
- {
1552
- name: "parameter$subexpression$1",
1553
- symbols: [lexer.has("QUOTED_PARAMETER") ? { type: "QUOTED_PARAMETER" } : QUOTED_PARAMETER]
1554
- },
1555
- {
1556
- name: "parameter$subexpression$1",
1557
- symbols: [lexer.has("NUMBERED_PARAMETER") ? { type: "NUMBERED_PARAMETER" } : NUMBERED_PARAMETER]
1558
- },
1559
- {
1560
- name: "parameter$subexpression$1",
1561
- symbols: [lexer.has("POSITIONAL_PARAMETER") ? { type: "POSITIONAL_PARAMETER" } : POSITIONAL_PARAMETER]
1562
- },
1563
- {
1564
- name: "parameter$subexpression$1",
1565
- symbols: [lexer.has("CUSTOM_PARAMETER") ? { type: "CUSTOM_PARAMETER" } : CUSTOM_PARAMETER]
1566
- },
1567
- {
1568
- name: "parameter",
1569
- symbols: ["parameter$subexpression$1"],
1570
- postprocess: ([[u2]]) => ({
1571
- type: NodeType.parameter,
1572
- key: u2.key,
1573
- text: u2.text
1574
- })
1575
- },
1576
- {
1577
- name: "literal$subexpression$1",
1578
- symbols: [lexer.has("NUMBER") ? { type: "NUMBER" } : NUMBER]
1579
- },
1580
- {
1581
- name: "literal$subexpression$1",
1582
- symbols: [lexer.has("STRING") ? { type: "STRING" } : STRING]
1583
- },
1584
- {
1585
- name: "literal",
1586
- symbols: ["literal$subexpression$1"],
1587
- postprocess: ([[u2]]) => ({
1588
- type: NodeType.literal,
1589
- text: u2.text
1590
- })
1591
- },
1592
- {
1593
- name: "keyword$subexpression$1",
1594
- symbols: [lexer.has("RESERVED_KEYWORD") ? { type: "RESERVED_KEYWORD" } : RESERVED_KEYWORD]
1595
- },
1596
- {
1597
- name: "keyword$subexpression$1",
1598
- symbols: [lexer.has("RESERVED_PHRASE") ? { type: "RESERVED_PHRASE" } : RESERVED_PHRASE]
1599
- },
1600
- {
1601
- name: "keyword$subexpression$1",
1602
- symbols: [lexer.has("RESERVED_JOIN") ? { type: "RESERVED_JOIN" } : RESERVED_JOIN]
1603
- },
1604
- {
1605
- name: "keyword",
1606
- symbols: ["keyword$subexpression$1"],
1607
- postprocess: ([[u2]]) => toKeywordNode(u2)
1608
- },
1609
- {
1610
- name: "data_type$subexpression$1",
1611
- symbols: [lexer.has("RESERVED_DATA_TYPE") ? { type: "RESERVED_DATA_TYPE" } : RESERVED_DATA_TYPE]
1612
- },
1613
- {
1614
- name: "data_type",
1615
- symbols: ["data_type$subexpression$1"],
1616
- postprocess: ([[u2]]) => toDataTypeNode(u2)
1617
- },
1618
- {
1619
- name: "data_type",
1620
- symbols: [
1621
- lexer.has("RESERVED_PARAMETERIZED_DATA_TYPE") ? { type: "RESERVED_PARAMETERIZED_DATA_TYPE" } : RESERVED_PARAMETERIZED_DATA_TYPE,
1622
- "_",
1623
- "parenthesis"
1624
- ],
1625
- postprocess: ([u2, z, B]) => ({
1626
- type: NodeType.parameterized_data_type,
1627
- dataType: addComments(toDataTypeNode(u2), { trailing: z }),
1628
- parenthesis: B
1629
- })
1630
- },
1631
- {
1632
- name: "logic_operator$subexpression$1",
1633
- symbols: [lexer.has("AND") ? { type: "AND" } : AND]
1634
- },
1635
- {
1636
- name: "logic_operator$subexpression$1",
1637
- symbols: [lexer.has("OR") ? { type: "OR" } : OR]
1638
- },
1639
- {
1640
- name: "logic_operator$subexpression$1",
1641
- symbols: [lexer.has("XOR") ? { type: "XOR" } : XOR]
1642
- },
1643
- {
1644
- name: "logic_operator",
1645
- symbols: ["logic_operator$subexpression$1"],
1646
- postprocess: ([[u2]]) => toKeywordNode(u2)
1647
- },
1648
- {
1649
- name: "other_keyword$subexpression$1",
1650
- symbols: [lexer.has("WHEN") ? { type: "WHEN" } : WHEN]
1651
- },
1652
- {
1653
- name: "other_keyword$subexpression$1",
1654
- symbols: [lexer.has("THEN") ? { type: "THEN" } : THEN]
1655
- },
1656
- {
1657
- name: "other_keyword$subexpression$1",
1658
- symbols: [lexer.has("ELSE") ? { type: "ELSE" } : ELSE]
1659
- },
1660
- {
1661
- name: "other_keyword$subexpression$1",
1662
- symbols: [lexer.has("END") ? { type: "END" } : END]
1663
- },
1664
- {
1665
- name: "other_keyword",
1666
- symbols: ["other_keyword$subexpression$1"],
1667
- postprocess: ([[u2]]) => toKeywordNode(u2)
1668
- },
1669
- {
1670
- name: "_$ebnf$1",
1671
- symbols: []
1672
- },
1673
- {
1674
- name: "_$ebnf$1",
1675
- symbols: ["_$ebnf$1", "comment"],
1676
- postprocess: (u2) => u2[0].concat([u2[1]])
1677
- },
1678
- {
1679
- name: "_",
1680
- symbols: ["_$ebnf$1"],
1681
- postprocess: ([u2]) => u2
1682
- },
1683
- {
1684
- name: "comment",
1685
- symbols: [lexer.has("LINE_COMMENT") ? { type: "LINE_COMMENT" } : LINE_COMMENT],
1686
- postprocess: ([u2]) => ({
1687
- type: NodeType.line_comment,
1688
- text: u2.text,
1689
- precedingWhitespace: u2.precedingWhitespace
1690
- })
1691
- },
1692
- {
1693
- name: "comment",
1694
- symbols: [lexer.has("BLOCK_COMMENT") ? { type: "BLOCK_COMMENT" } : BLOCK_COMMENT],
1695
- postprocess: ([u2]) => ({
1696
- type: NodeType.block_comment,
1697
- text: u2.text,
1698
- precedingWhitespace: u2.precedingWhitespace
1699
- })
1700
- },
1701
- {
1702
- name: "comment",
1703
- symbols: [lexer.has("DISABLE_COMMENT") ? { type: "DISABLE_COMMENT" } : DISABLE_COMMENT],
1704
- postprocess: ([u2]) => ({
1705
- type: NodeType.disable_comment,
1706
- text: u2.text,
1707
- precedingWhitespace: u2.precedingWhitespace
1708
- })
1709
- }
1710
- ],
1711
- ParserStart: "main"
1712
- }, { Parser: NearleyParser, Grammar } = import_nearley.default;
1713
- function createParser(u2) {
1714
- let z = {}, B = new LexerAdapter((B2) => [...disambiguateTokens(u2.tokenize(B2, z)), createEofToken(B2.length)]), V = new NearleyParser(Grammar.fromCompiled(grammar_default), { lexer: B });
1715
- return { parse: (u3, B2) => {
1716
- z = B2;
1717
- let { results: H } = V.feed(u3);
1718
- if (H.length === 1) return H[0];
1719
- throw H.length === 0 ? Error("Parse error: Invalid SQL") : Error(`Parse error: Ambiguous grammar
1720
- ${JSON.stringify(H, void 0, 2)}`);
1721
- } };
1722
- }
1723
- var WS;
1724
- (function(u2) {
1725
- u2[u2.SPACE = 0] = "SPACE", u2[u2.NO_SPACE = 1] = "NO_SPACE", u2[u2.NO_NEWLINE = 2] = "NO_NEWLINE", u2[u2.NEWLINE = 3] = "NEWLINE", u2[u2.MANDATORY_NEWLINE = 4] = "MANDATORY_NEWLINE", u2[u2.INDENT = 5] = "INDENT", u2[u2.SINGLE_INDENT = 6] = "SINGLE_INDENT";
1726
- })(WS = WS || (WS = {}));
1727
- var Layout = class {
1728
- constructor(u2) {
1729
- this.indentation = u2, this.items = [];
1730
- }
1731
- add(...u2) {
1732
- for (let z of u2) switch (z) {
1733
- case WS.SPACE:
1734
- this.items.push(WS.SPACE);
1735
- break;
1736
- case WS.NO_SPACE:
1737
- this.trimHorizontalWhitespace();
1738
- break;
1739
- case WS.NO_NEWLINE:
1740
- this.trimWhitespace();
1741
- break;
1742
- case WS.NEWLINE:
1743
- this.trimHorizontalWhitespace(), this.addNewline(WS.NEWLINE);
1744
- break;
1745
- case WS.MANDATORY_NEWLINE:
1746
- this.trimHorizontalWhitespace(), this.addNewline(WS.MANDATORY_NEWLINE);
1747
- break;
1748
- case WS.INDENT:
1749
- this.addIndentation();
1750
- break;
1751
- case WS.SINGLE_INDENT:
1752
- this.items.push(WS.SINGLE_INDENT);
1753
- break;
1754
- default:
1755
- this.items.push(z);
1756
- }
1757
- }
1758
- trimHorizontalWhitespace() {
1759
- for (; isHorizontalWhitespace(last(this.items)); ) this.items.pop();
1760
- }
1761
- trimWhitespace() {
1762
- for (; isRemovableWhitespace(last(this.items)); ) this.items.pop();
1763
- }
1764
- addNewline(u2) {
1765
- if (this.items.length > 0) switch (last(this.items)) {
1766
- case WS.NEWLINE:
1767
- this.items.pop(), this.items.push(u2);
1768
- break;
1769
- case WS.MANDATORY_NEWLINE:
1770
- break;
1771
- default:
1772
- this.items.push(u2);
1773
- break;
1774
- }
1775
- }
1776
- addIndentation() {
1777
- for (let u2 = 0; u2 < this.indentation.getLevel(); u2++) this.items.push(WS.SINGLE_INDENT);
1778
- }
1779
- toString() {
1780
- return this.items.map((u2) => this.itemToString(u2)).join("");
1781
- }
1782
- getLayoutItems() {
1783
- return this.items;
1784
- }
1785
- itemToString(u2) {
1786
- switch (u2) {
1787
- case WS.SPACE:
1788
- return " ";
1789
- case WS.NEWLINE:
1790
- case WS.MANDATORY_NEWLINE:
1791
- return "\n";
1792
- case WS.SINGLE_INDENT:
1793
- return this.indentation.getSingleIndent();
1794
- default:
1795
- return u2;
1796
- }
1797
- }
1798
- }, isHorizontalWhitespace = (u2) => u2 === WS.SPACE || u2 === WS.SINGLE_INDENT, isRemovableWhitespace = (u2) => u2 === WS.SPACE || u2 === WS.SINGLE_INDENT || u2 === WS.NEWLINE;
1799
- function toTabularFormat(u2, z) {
1800
- if (z === "standard") return u2;
1801
- let B = [];
1802
- return u2.length >= 10 && u2.includes(" ") && ([u2, ...B] = u2.split(" ")), u2 = z === "tabularLeft" ? u2.padEnd(9, " ") : u2.padStart(9, " "), u2 + ["", ...B].join(" ");
1803
- }
1804
- function isTabularToken(u2) {
1805
- return isLogicalOperator(u2) || u2 === TokenType.RESERVED_CLAUSE || u2 === TokenType.RESERVED_SELECT || u2 === TokenType.RESERVED_SET_OPERATION || u2 === TokenType.RESERVED_JOIN || u2 === TokenType.LIMIT;
1806
- }
1807
- var INDENT_TYPE_TOP_LEVEL = "top-level", INDENT_TYPE_BLOCK_LEVEL = "block-level", Indentation = class {
1808
- constructor(u2) {
1809
- this.indent = u2, this.indentTypes = [];
1810
- }
1811
- getSingleIndent() {
1812
- return this.indent;
1813
- }
1814
- getLevel() {
1815
- return this.indentTypes.length;
1816
- }
1817
- increaseTopLevel() {
1818
- this.indentTypes.push(INDENT_TYPE_TOP_LEVEL);
1819
- }
1820
- increaseBlockLevel() {
1821
- this.indentTypes.push(INDENT_TYPE_BLOCK_LEVEL);
1822
- }
1823
- decreaseTopLevel() {
1824
- this.indentTypes.length > 0 && last(this.indentTypes) === INDENT_TYPE_TOP_LEVEL && this.indentTypes.pop();
1825
- }
1826
- decreaseBlockLevel() {
1827
- for (; this.indentTypes.length > 0 && this.indentTypes.pop() === INDENT_TYPE_TOP_LEVEL; ) ;
1828
- }
1829
- }, InlineLayout = class extends Layout {
1830
- constructor(u2) {
1831
- super(new Indentation("")), this.expressionWidth = u2, this.length = 0, this.trailingSpace = false;
1832
- }
1833
- add(...u2) {
1834
- if (u2.forEach((u3) => this.addToLength(u3)), this.length > this.expressionWidth) throw new InlineLayoutError();
1835
- super.add(...u2);
1836
- }
1837
- addToLength(u2) {
1838
- if (typeof u2 == "string") this.length += u2.length, this.trailingSpace = false;
1839
- else if (u2 === WS.MANDATORY_NEWLINE || u2 === WS.NEWLINE) throw new InlineLayoutError();
1840
- else u2 === WS.INDENT || u2 === WS.SINGLE_INDENT || u2 === WS.SPACE ? this.trailingSpace || (this.trailingSpace = (this.length++, true)) : (u2 === WS.NO_NEWLINE || u2 === WS.NO_SPACE) && this.trailingSpace && (this.trailingSpace = false, this.length--);
1841
- }
1842
- }, InlineLayoutError = class extends Error {
1843
- }, ExpressionFormatter = class u {
1844
- constructor({ cfg: u2, dialectCfg: z, params: B, layout: V, inline: H = false }) {
1845
- this.inline = false, this.nodes = [], this.index = -1, this.cfg = u2, this.dialectCfg = z, this.inline = H, this.params = B, this.layout = V;
1846
- }
1847
- format(u2) {
1848
- for (this.nodes = u2, this.index = 0; this.index < this.nodes.length; this.index++) this.formatNode(this.nodes[this.index]);
1849
- return this.layout;
1850
- }
1851
- formatNode(u2) {
1852
- this.formatComments(u2.leadingComments), this.formatNodeWithoutComments(u2), this.formatComments(u2.trailingComments);
1853
- }
1854
- formatNodeWithoutComments(u2) {
1855
- switch (u2.type) {
1856
- case NodeType.function_call:
1857
- return this.formatFunctionCall(u2);
1858
- case NodeType.parameterized_data_type:
1859
- return this.formatParameterizedDataType(u2);
1860
- case NodeType.array_subscript:
1861
- return this.formatArraySubscript(u2);
1862
- case NodeType.property_access:
1863
- return this.formatPropertyAccess(u2);
1864
- case NodeType.parenthesis:
1865
- return this.formatParenthesis(u2);
1866
- case NodeType.between_predicate:
1867
- return this.formatBetweenPredicate(u2);
1868
- case NodeType.case_expression:
1869
- return this.formatCaseExpression(u2);
1870
- case NodeType.case_when:
1871
- return this.formatCaseWhen(u2);
1872
- case NodeType.case_else:
1873
- return this.formatCaseElse(u2);
1874
- case NodeType.clause:
1875
- return this.formatClause(u2);
1876
- case NodeType.set_operation:
1877
- return this.formatSetOperation(u2);
1878
- case NodeType.limit_clause:
1879
- return this.formatLimitClause(u2);
1880
- case NodeType.all_columns_asterisk:
1881
- return this.formatAllColumnsAsterisk(u2);
1882
- case NodeType.literal:
1883
- return this.formatLiteral(u2);
1884
- case NodeType.identifier:
1885
- return this.formatIdentifier(u2);
1886
- case NodeType.parameter:
1887
- return this.formatParameter(u2);
1888
- case NodeType.operator:
1889
- return this.formatOperator(u2);
1890
- case NodeType.comma:
1891
- return this.formatComma(u2);
1892
- case NodeType.line_comment:
1893
- return this.formatLineComment(u2);
1894
- case NodeType.block_comment:
1895
- return this.formatBlockComment(u2);
1896
- case NodeType.disable_comment:
1897
- return this.formatBlockComment(u2);
1898
- case NodeType.data_type:
1899
- return this.formatDataType(u2);
1900
- case NodeType.keyword:
1901
- return this.formatKeywordNode(u2);
1902
- }
1903
- }
1904
- formatFunctionCall(u2) {
1905
- this.withComments(u2.nameKw, () => {
1906
- this.layout.add(this.showFunctionKw(u2.nameKw));
1907
- }), this.formatNode(u2.parenthesis);
1908
- }
1909
- formatParameterizedDataType(u2) {
1910
- this.withComments(u2.dataType, () => {
1911
- this.layout.add(this.showDataType(u2.dataType));
1912
- }), this.formatNode(u2.parenthesis);
1913
- }
1914
- formatArraySubscript(u2) {
1915
- let z;
1916
- switch (u2.array.type) {
1917
- case NodeType.data_type:
1918
- z = this.showDataType(u2.array);
1919
- break;
1920
- case NodeType.keyword:
1921
- z = this.showKw(u2.array);
1922
- break;
1923
- default:
1924
- z = this.showIdentifier(u2.array);
1925
- break;
1926
- }
1927
- this.withComments(u2.array, () => {
1928
- this.layout.add(z);
1929
- }), this.formatNode(u2.parenthesis);
1930
- }
1931
- formatPropertyAccess(u2) {
1932
- this.formatNode(u2.object), this.layout.add(WS.NO_SPACE, u2.operator), this.formatNode(u2.property);
1933
- }
1934
- formatParenthesis(u2) {
1935
- let z = this.formatInlineExpression(u2.children);
1936
- z ? (this.layout.add(u2.openParen), this.layout.add(...z.getLayoutItems()), this.layout.add(WS.NO_SPACE, u2.closeParen, WS.SPACE)) : (this.layout.add(u2.openParen, WS.NEWLINE), isTabularStyle(this.cfg) ? (this.layout.add(WS.INDENT), this.layout = this.formatSubExpression(u2.children)) : (this.layout.indentation.increaseBlockLevel(), this.layout.add(WS.INDENT), this.layout = this.formatSubExpression(u2.children), this.layout.indentation.decreaseBlockLevel()), this.layout.add(WS.NEWLINE, WS.INDENT, u2.closeParen, WS.SPACE));
1937
- }
1938
- formatBetweenPredicate(u2) {
1939
- this.layout.add(this.showKw(u2.betweenKw), WS.SPACE), this.layout = this.formatSubExpression(u2.expr1), this.layout.add(WS.NO_SPACE, WS.SPACE, this.showNonTabularKw(u2.andKw), WS.SPACE), this.layout = this.formatSubExpression(u2.expr2), this.layout.add(WS.SPACE);
1940
- }
1941
- formatCaseExpression(u2) {
1942
- this.formatNode(u2.caseKw), this.layout.indentation.increaseBlockLevel(), this.layout = this.formatSubExpression(u2.expr), this.layout = this.formatSubExpression(u2.clauses), this.layout.indentation.decreaseBlockLevel(), this.layout.add(WS.NEWLINE, WS.INDENT), this.formatNode(u2.endKw);
1943
- }
1944
- formatCaseWhen(u2) {
1945
- this.layout.add(WS.NEWLINE, WS.INDENT), this.formatNode(u2.whenKw), this.layout = this.formatSubExpression(u2.condition), this.formatNode(u2.thenKw), this.layout = this.formatSubExpression(u2.result);
1946
- }
1947
- formatCaseElse(u2) {
1948
- this.layout.add(WS.NEWLINE, WS.INDENT), this.formatNode(u2.elseKw), this.layout = this.formatSubExpression(u2.result);
1949
- }
1950
- formatClause(u2) {
1951
- this.isOnelineClause(u2) ? this.formatClauseInOnelineStyle(u2) : isTabularStyle(this.cfg) ? this.formatClauseInTabularStyle(u2) : this.formatClauseInIndentedStyle(u2);
1952
- }
1953
- isOnelineClause(u2) {
1954
- return isTabularStyle(this.cfg) ? this.dialectCfg.tabularOnelineClauses[u2.nameKw.text] : this.dialectCfg.onelineClauses[u2.nameKw.text];
1955
- }
1956
- formatClauseInIndentedStyle(u2) {
1957
- this.layout.add(WS.NEWLINE, WS.INDENT, this.showKw(u2.nameKw), WS.NEWLINE), this.layout.indentation.increaseTopLevel(), this.layout.add(WS.INDENT), this.layout = this.formatSubExpression(u2.children), this.layout.indentation.decreaseTopLevel();
1958
- }
1959
- formatClauseInOnelineStyle(u2) {
1960
- this.layout.add(WS.NEWLINE, WS.INDENT, this.showKw(u2.nameKw), WS.SPACE), this.layout = this.formatSubExpression(u2.children);
1961
- }
1962
- formatClauseInTabularStyle(u2) {
1963
- this.layout.add(WS.NEWLINE, WS.INDENT, this.showKw(u2.nameKw), WS.SPACE), this.layout.indentation.increaseTopLevel(), this.layout = this.formatSubExpression(u2.children), this.layout.indentation.decreaseTopLevel();
1964
- }
1965
- formatSetOperation(u2) {
1966
- this.layout.add(WS.NEWLINE, WS.INDENT, this.showKw(u2.nameKw), WS.NEWLINE), this.layout.add(WS.INDENT), this.layout = this.formatSubExpression(u2.children);
1967
- }
1968
- formatLimitClause(u2) {
1969
- this.withComments(u2.limitKw, () => {
1970
- this.layout.add(WS.NEWLINE, WS.INDENT, this.showKw(u2.limitKw));
1971
- }), this.layout.indentation.increaseTopLevel(), isTabularStyle(this.cfg) ? this.layout.add(WS.SPACE) : this.layout.add(WS.NEWLINE, WS.INDENT), u2.offset ? (this.layout = this.formatSubExpression(u2.offset), this.layout.add(WS.NO_SPACE, ",", WS.SPACE), this.layout = this.formatSubExpression(u2.count)) : this.layout = this.formatSubExpression(u2.count), this.layout.indentation.decreaseTopLevel();
1972
- }
1973
- formatAllColumnsAsterisk(u2) {
1974
- this.layout.add("*", WS.SPACE);
1975
- }
1976
- formatLiteral(u2) {
1977
- this.layout.add(u2.text, WS.SPACE);
1978
- }
1979
- formatIdentifier(u2) {
1980
- this.layout.add(this.showIdentifier(u2), WS.SPACE);
1981
- }
1982
- formatParameter(u2) {
1983
- this.layout.add(this.params.get(u2), WS.SPACE);
1984
- }
1985
- formatOperator({ text: u2 }) {
1986
- this.cfg.denseOperators || this.dialectCfg.alwaysDenseOperators.includes(u2) ? this.layout.add(WS.NO_SPACE, u2) : u2 === ":" ? this.layout.add(WS.NO_SPACE, u2, WS.SPACE) : this.layout.add(u2, WS.SPACE);
1987
- }
1988
- formatComma(u2) {
1989
- this.inline ? this.layout.add(WS.NO_SPACE, ",", WS.SPACE) : this.layout.add(WS.NO_SPACE, ",", WS.NEWLINE, WS.INDENT);
1990
- }
1991
- withComments(u2, z) {
1992
- this.formatComments(u2.leadingComments), z(), this.formatComments(u2.trailingComments);
1993
- }
1994
- formatComments(u2) {
1995
- u2 && u2.forEach((u3) => {
1996
- u3.type === NodeType.line_comment ? this.formatLineComment(u3) : this.formatBlockComment(u3);
1997
- });
1998
- }
1999
- formatLineComment(u2) {
2000
- isMultiline(u2.precedingWhitespace || "") ? this.layout.add(WS.NEWLINE, WS.INDENT, u2.text, WS.MANDATORY_NEWLINE, WS.INDENT) : this.layout.getLayoutItems().length > 0 ? this.layout.add(WS.NO_NEWLINE, WS.SPACE, u2.text, WS.MANDATORY_NEWLINE, WS.INDENT) : this.layout.add(u2.text, WS.MANDATORY_NEWLINE, WS.INDENT);
2001
- }
2002
- formatBlockComment(u2) {
2003
- u2.type === NodeType.block_comment && this.isMultilineBlockComment(u2) ? (this.splitBlockComment(u2.text).forEach((u3) => {
2004
- this.layout.add(WS.NEWLINE, WS.INDENT, u3);
2005
- }), this.layout.add(WS.NEWLINE, WS.INDENT)) : this.layout.add(u2.text, WS.SPACE);
2006
- }
2007
- isMultilineBlockComment(u2) {
2008
- return isMultiline(u2.text) || isMultiline(u2.precedingWhitespace || "");
2009
- }
2010
- isDocComment(u2) {
2011
- let z = u2.split(/\n/);
2012
- return /^\/\*\*?$/.test(z[0]) && z.slice(1, z.length - 1).every((u3) => /^\s*\*/.test(u3)) && /^\s*\*\/$/.test(last(z));
2013
- }
2014
- splitBlockComment(u2) {
2015
- return this.isDocComment(u2) ? u2.split(/\n/).map((u3) => /^\s*\*/.test(u3) ? " " + u3.replace(/^\s*/, "") : u3) : u2.split(/\n/).map((u3) => u3.replace(/^\s*/, ""));
2016
- }
2017
- formatSubExpression(z) {
2018
- return new u({
2019
- cfg: this.cfg,
2020
- dialectCfg: this.dialectCfg,
2021
- params: this.params,
2022
- layout: this.layout,
2023
- inline: this.inline
2024
- }).format(z);
2025
- }
2026
- formatInlineExpression(z) {
2027
- let B = this.params.getPositionalParameterIndex();
2028
- try {
2029
- return new u({
2030
- cfg: this.cfg,
2031
- dialectCfg: this.dialectCfg,
2032
- params: this.params,
2033
- layout: new InlineLayout(this.cfg.expressionWidth),
2034
- inline: true
2035
- }).format(z);
2036
- } catch (u2) {
2037
- if (u2 instanceof InlineLayoutError) {
2038
- this.params.setPositionalParameterIndex(B);
2039
- return;
2040
- } else throw u2;
2041
- }
2042
- }
2043
- formatKeywordNode(u2) {
2044
- switch (u2.tokenType) {
2045
- case TokenType.RESERVED_JOIN:
2046
- return this.formatJoin(u2);
2047
- case TokenType.AND:
2048
- case TokenType.OR:
2049
- case TokenType.XOR:
2050
- return this.formatLogicalOperator(u2);
2051
- default:
2052
- return this.formatKeyword(u2);
2053
- }
2054
- }
2055
- formatJoin(u2) {
2056
- isTabularStyle(this.cfg) ? (this.layout.indentation.decreaseTopLevel(), this.layout.add(WS.NEWLINE, WS.INDENT, this.showKw(u2), WS.SPACE), this.layout.indentation.increaseTopLevel()) : this.layout.add(WS.NEWLINE, WS.INDENT, this.showKw(u2), WS.SPACE);
2057
- }
2058
- formatKeyword(u2) {
2059
- this.layout.add(this.showKw(u2), WS.SPACE);
2060
- }
2061
- formatLogicalOperator(u2) {
2062
- this.cfg.logicalOperatorNewline === "before" ? isTabularStyle(this.cfg) ? (this.layout.indentation.decreaseTopLevel(), this.layout.add(WS.NEWLINE, WS.INDENT, this.showKw(u2), WS.SPACE), this.layout.indentation.increaseTopLevel()) : this.layout.add(WS.NEWLINE, WS.INDENT, this.showKw(u2), WS.SPACE) : this.layout.add(this.showKw(u2), WS.NEWLINE, WS.INDENT);
2063
- }
2064
- formatDataType(u2) {
2065
- this.layout.add(this.showDataType(u2), WS.SPACE);
2066
- }
2067
- showKw(u2) {
2068
- return isTabularToken(u2.tokenType) ? toTabularFormat(this.showNonTabularKw(u2), this.cfg.indentStyle) : this.showNonTabularKw(u2);
2069
- }
2070
- showNonTabularKw(u2) {
2071
- switch (this.cfg.keywordCase) {
2072
- case "preserve":
2073
- return equalizeWhitespace(u2.raw);
2074
- case "upper":
2075
- return u2.text;
2076
- case "lower":
2077
- return u2.text.toLowerCase();
2078
- }
2079
- }
2080
- showFunctionKw(u2) {
2081
- return isTabularToken(u2.tokenType) ? toTabularFormat(this.showNonTabularFunctionKw(u2), this.cfg.indentStyle) : this.showNonTabularFunctionKw(u2);
2082
- }
2083
- showNonTabularFunctionKw(u2) {
2084
- switch (this.cfg.functionCase) {
2085
- case "preserve":
2086
- return equalizeWhitespace(u2.raw);
2087
- case "upper":
2088
- return u2.text;
2089
- case "lower":
2090
- return u2.text.toLowerCase();
2091
- }
2092
- }
2093
- showIdentifier(u2) {
2094
- if (u2.quoted) return u2.text;
2095
- switch (this.cfg.identifierCase) {
2096
- case "preserve":
2097
- return u2.text;
2098
- case "upper":
2099
- return u2.text.toUpperCase();
2100
- case "lower":
2101
- return u2.text.toLowerCase();
2102
- }
2103
- }
2104
- showDataType(u2) {
2105
- switch (this.cfg.dataTypeCase) {
2106
- case "preserve":
2107
- return equalizeWhitespace(u2.raw);
2108
- case "upper":
2109
- return u2.text;
2110
- case "lower":
2111
- return u2.text.toLowerCase();
2112
- }
2113
- }
2114
- }, Formatter = class {
2115
- constructor(u2, z) {
2116
- this.dialect = u2, this.cfg = z, this.params = new Params(this.cfg.params);
2117
- }
2118
- format(u2) {
2119
- let z = this.parse(u2);
2120
- return this.formatAst(z).trimEnd();
2121
- }
2122
- parse(u2) {
2123
- return createParser(this.dialect.tokenizer).parse(u2, this.cfg.paramTypes || {});
2124
- }
2125
- formatAst(u2) {
2126
- return u2.map((u3) => this.formatStatement(u3)).join("\n".repeat(this.cfg.linesBetweenQueries + 1));
2127
- }
2128
- formatStatement(u2) {
2129
- let z = new ExpressionFormatter({
2130
- cfg: this.cfg,
2131
- dialectCfg: this.dialect.formatOptions,
2132
- params: this.params,
2133
- layout: new Layout(new Indentation(indentString(this.cfg)))
2134
- }).format(u2.children);
2135
- return u2.hasSemicolon && (this.cfg.newlineBeforeSemicolon ? z.add(WS.NEWLINE, ";") : z.add(WS.NO_NEWLINE, ";")), z.toString();
2136
- }
2137
- }, ConfigError = class extends Error {
2138
- };
2139
- function validateConfig(u2) {
2140
- for (let z of [
2141
- "multilineLists",
2142
- "newlineBeforeOpenParen",
2143
- "newlineBeforeCloseParen",
2144
- "aliasAs",
2145
- "commaPosition",
2146
- "tabulateAlias"
2147
- ]) if (z in u2) throw new ConfigError(`${z} config is no more supported.`);
2148
- if (u2.expressionWidth <= 0) throw new ConfigError(`expressionWidth config must be positive number. Received ${u2.expressionWidth} instead.`);
2149
- if (u2.params && !validateParams(u2.params) && console.warn('WARNING: All "params" option values should be strings.'), u2.paramTypes && !validateParamTypes(u2.paramTypes)) throw new ConfigError("Empty regex given in custom paramTypes. That would result in matching infinite amount of parameters.");
2150
- return u2;
2151
- }
2152
- function validateParams(u2) {
2153
- return (u2 instanceof Array ? u2 : Object.values(u2)).every((u3) => typeof u3 == "string");
2154
- }
2155
- function validateParamTypes(u2) {
2156
- return u2.custom && Array.isArray(u2.custom) ? u2.custom.every((u3) => u3.regex !== "") : true;
2157
- }
2158
- var __rest = function(u2, z) {
2159
- var B = {};
2160
- for (var V in u2) Object.prototype.hasOwnProperty.call(u2, V) && z.indexOf(V) < 0 && (B[V] = u2[V]);
2161
- if (u2 != null && typeof Object.getOwnPropertySymbols == "function") for (var H = 0, V = Object.getOwnPropertySymbols(u2); H < V.length; H++) z.indexOf(V[H]) < 0 && Object.prototype.propertyIsEnumerable.call(u2, V[H]) && (B[V[H]] = u2[V[H]]);
2162
- return B;
2163
- }, defaultOptions = {
2164
- tabWidth: 2,
2165
- useTabs: false,
2166
- keywordCase: "preserve",
2167
- identifierCase: "preserve",
2168
- dataTypeCase: "preserve",
2169
- functionCase: "preserve",
2170
- indentStyle: "standard",
2171
- logicalOperatorNewline: "before",
2172
- expressionWidth: 50,
2173
- linesBetweenQueries: 1,
2174
- denseOperators: false,
2175
- newlineBeforeSemicolon: false
2176
- };
2177
- const formatDialect = (u2, z) => {
2178
- var { dialect: B } = z, V = __rest(z, ["dialect"]);
2179
- if (typeof u2 != "string") throw Error("Invalid query argument. Expected string, instead got " + typeof u2);
2180
- let H = validateConfig(Object.assign(Object.assign({}, defaultOptions), V));
2181
- return new Formatter(createDialect(B), H).format(u2);
2182
- };
2183
- export {
2184
- ConfigError,
2185
- duckdb,
2186
- expandPhrases,
2187
- formatDialect
2188
- };