@kabmo-labs/kabmo 0.59.1 → 0.61.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +397 -397
- package/dist/client/static/js/{Body-5yedtmnk.js → Body-ab8wswhm.js} +3 -3
- package/dist/client/static/js/{CsvGrid-39m8pp1c.js → CsvGrid-czssywvz.js} +2 -2
- package/dist/client/static/js/{DocxView-vd99cv12.js → DocxView-ke0dwdmt.js} +3 -3
- package/dist/client/static/js/{DrawioView-6nq4412n.js → DrawioView-a1whhy84.js} +2 -2
- package/dist/client/static/js/{HtmlPreview-cs51gszy.js → HtmlPreview-dr32dwjy.js} +1 -1
- package/dist/client/static/js/ImageView-zf4kh5wp.js +1 -0
- package/dist/client/static/js/LayoutWrapper-dncbzcea.js +2 -0
- package/dist/client/static/js/MergeDiffView-btdx9yb9.js +1 -0
- package/dist/client/static/js/Modal-5cxfw2rv.js +60 -0
- package/dist/client/static/js/{PdfView-0zab721q.js → PdfView-2kdn91f9.js} +1 -1
- package/dist/client/static/js/SessionsView-vbn0nvx4.js +1 -0
- package/dist/client/static/js/{SheetView-2wdn5hkd.js → SheetView-ettr9pdw.js} +9 -9
- package/dist/client/static/js/{SvgPreview-fmrfxd7z.js → SvgPreview-hzcejjry.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-41scfh9v.js → abnfDiagram-O67JEVCF-kdmv4y72.js} +1 -1
- package/dist/client/static/js/architecture-7GRP2DOG-sxrkxwbq.js +1 -0
- package/dist/client/static/js/{architectureDiagram-NJMV4G6O-fp6etjvt.js → architectureDiagram-NJMV4G6O-qyrwaq0x.js} +11 -11
- package/dist/client/static/js/{astro-ryr2ajmg.js → astro-yphdvdty.js} +1 -1
- package/dist/client/static/js/bash-bcbct9gc.js +1 -0
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-pespk9mt.js → blockDiagram-BEXU5L5S-tszxy2g7.js} +8 -8
- package/dist/client/static/js/c-fn9jz26e.js +1 -0
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-rt4z91dx.js → c4Diagram-YGBWAQC7-0ye36hhv.js} +5 -5
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-6bzaq8sd.js → classDiagram-v2-NBCMYWYE-szgk1shv.js} +6 -6
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-z3fhgcba.js → cose-bilkent-JH36ORCC-0s9s4mmv.js} +1 -1
- package/dist/client/static/js/cpp-a1q64mke.js +1 -0
- package/dist/client/static/js/css-b92azee8.js +1 -0
- package/dist/client/static/js/cynefin-OW5HDTMX-g1xwa8b9.js +1 -0
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-8endeh4p.js → cynefinDiagram-VND7K2PF-664g28ze.js} +2 -2
- package/dist/client/static/js/{dagre-6A5THRUB-2a2f32dv.js → dagre-6A5THRUB-ga4rp1jx.js} +2 -2
- package/dist/client/static/js/{diagram-22UHCM2B-wgbyr6b7.js → diagram-22UHCM2B-aagj46ty.js} +15 -15
- package/dist/client/static/js/{diagram-3UASUU5V-5122b41x.js → diagram-3UASUU5V-20qk6whk.js} +2 -2
- package/dist/client/static/js/{diagram-ATOU4E4O-1gt9fr7e.js → diagram-ATOU4E4O-1vg1tfca.js} +2 -2
- package/dist/client/static/js/{diagram-CDSNMT55-v6hs59jb.js → diagram-CDSNMT55-90d6jrqs.js} +4 -4
- package/dist/client/static/js/{diagram-MLGK6HIB-yey2m5nm.js → diagram-MLGK6HIB-8je4z8m1.js} +2 -2
- package/dist/client/static/js/{diagram-MPIPVDR6-hg4f3q4d.js → diagram-MPIPVDR6-0kzpexsj.js} +2 -2
- package/dist/client/static/js/{dockerfile-56tfnp5r.js → dockerfile-5nrbr0ef.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-2mhc9aar.js → ebnfDiagram-ZINNZB2B-47yg36zx.js} +1 -1
- package/dist/client/static/js/{elixir-fyxw6d70.js → elixir-3nwnd9yw.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-wedtvz9y.js → elk-276RUBZZ-5hqp6r2d.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-1kysnby9.js → erDiagram-OPXOYQCR-bt9te7r0.js} +3 -3
- package/dist/client/static/js/{erlang-97ayje6m.js → erlang-p5c4n3t0.js} +1 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-05p61bka.js +1 -0
- package/dist/client/static/js/flowDiagram-KWPJA3E3-500fcx2a.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-j4g65rpm.js → ganttDiagram-FUAMR5RP-kzc13swm.js} +5 -5
- package/dist/client/static/js/gitGraph-4MIJSDKK-z1yehwys.js +1 -0
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-vcwmj4b3.js → gitGraphDiagram-X574FWY7-bjf8aa3j.js} +14 -14
- package/dist/client/static/js/graphql-8d8bn59j.js +1 -0
- package/dist/client/static/js/html-6hdrwtz2.js +1 -0
- package/dist/client/static/js/{index-5e4e18tg.js → index-025s3fp8.js} +2 -2
- package/dist/client/static/js/{index-jaf968hx.js → index-0kcnghxn.js} +4 -4
- package/dist/client/static/js/{index-8tzt0dek.js → index-11qn05g9.js} +2 -2
- package/dist/client/static/js/{index-sqyvj03y.js → index-1fmjhm2d.js} +9 -9
- package/dist/client/static/js/{index-42q5gg7t.js → index-24a40rw8.js} +1 -1
- package/dist/client/static/js/{index-np2rfq06.js → index-2dmew334.js} +2 -2
- package/dist/client/static/js/{index-wkxsypj1.js → index-2zhmmtye.js} +2 -2
- package/dist/client/static/js/{index-m62sf9wn.js → index-3x7cbxwq.js} +1 -1
- package/dist/client/static/js/{index-fg0ne74z.js → index-475dc6h9.js} +2 -2
- package/dist/client/static/js/{index-1mkn5fbf.js → index-4vtc4xct.js} +197 -197
- package/dist/client/static/js/{index-spnrx2c0.js → index-5srvxsht.js} +1 -1
- package/dist/client/static/js/{index-tz5ewsza.js → index-653x8zdq.js} +9 -9
- package/dist/client/static/js/index-6c1s0v4b.js +1 -0
- package/dist/client/static/js/{index-hgzf4ask.js → index-776n5n29.js} +5 -5
- package/dist/client/static/js/{index-a70sk36c.js → index-85jfn1fz.js} +2 -2
- package/dist/client/static/js/{index-yrwm437g.js → index-97sw4d9n.js} +2 -2
- package/dist/client/static/js/{index-csxnqgzw.js → index-9g2nzgpx.js} +6 -6
- package/dist/client/static/js/{index-y4cx8cqf.js → index-a145x0w2.js} +2 -2
- package/dist/client/static/js/{index-mhrkjbjq.js → index-bdtftrym.js} +2 -2
- package/dist/client/static/js/{index-db6s66jr.js → index-bkn6jtn1.js} +2 -2
- package/dist/client/static/js/{index-kt77dwsg.js → index-bq9f0mxp.js} +7 -7
- package/dist/client/static/js/{index-ndqtff48.js → index-ca6tmamh.js} +2 -2
- package/dist/client/static/js/index-cvm2ha01.js +1 -0
- package/dist/client/static/js/index-d11mbz2q.js +4 -0
- package/dist/client/static/js/{index-3kedv94b.js → index-dabnbvbc.js} +2 -2
- package/dist/client/static/js/{index-sg65xdey.js → index-enm77k5z.js} +2 -2
- package/dist/client/static/js/{index-nf4hq5tg.js → index-excgtjhx.js} +14 -14
- package/dist/client/static/js/{index-51rbgeh9.js → index-fb2fjndj.js} +5 -5
- package/dist/client/static/js/index-fen0x3qh.js +1 -0
- package/dist/client/static/js/{index-vs2y8gxr.js → index-fr6wsqk8.js} +2 -2
- package/dist/client/static/js/{index-xqz7bqcn.js → index-gwgh27h3.js} +87 -87
- package/dist/client/static/js/{index-2h7xh93h.js → index-h7agc069.js} +1 -1
- package/dist/client/static/js/{index-69mnn71v.js → index-hwv7bfxc.js} +2 -2
- package/dist/client/static/js/{index-461ga40v.js → index-hxy1sadd.js} +2 -2
- package/dist/client/static/js/{index-s7p2wdr1.js → index-jz4012t5.js} +1 -1
- package/dist/client/static/js/{index-gajpd90b.js → index-k9yf2txw.js} +2 -2
- package/dist/client/static/js/{index-dw9epydj.js → index-kj70d2q9.js} +2 -2
- package/dist/client/static/js/{index-7enfdvh0.js → index-krdz5vby.js} +2 -2
- package/dist/client/static/js/{index-42k78whj.js → index-kyr612aa.js} +1 -1
- package/dist/client/static/js/{index-fvphmwkf.js → index-m24sebb0.js} +2 -2
- package/dist/client/static/js/{index-d9sfavx1.js → index-mtav0rpf.js} +2 -2
- package/dist/client/static/js/{index-58z2hatp.js → index-n8r7r86r.js} +1 -1
- package/dist/client/static/js/index-pg87cgpy.js +2 -0
- package/dist/client/static/js/{index-r42f3r1p.js → index-q1a40v20.js} +2 -2
- package/dist/client/static/js/{index-jct0jryd.js → index-qccydkze.js} +2 -2
- package/dist/client/static/js/index-qmvstmvh.js +1 -0
- package/dist/client/static/js/{index-pn0ja904.js → index-r38e0rya.js} +2 -2
- package/dist/client/static/js/{index-92h38pwg.js → index-s4j2ghmx.js} +2 -2
- package/dist/client/static/js/index-sr14vwn5.js +2 -0
- package/dist/client/static/js/{index-z82nd2bd.js → index-sx83ans2.js} +2 -2
- package/dist/client/static/js/index-t6nqy2n5.css +1 -0
- package/dist/client/static/js/{index-fsa18ns9.js → index-twwsn91p.js} +2 -2
- package/dist/client/static/js/{index-nwbr15b3.js → index-v88m5sva.js} +2 -2
- package/dist/client/static/js/{index-qc3de995.js → index-vgcw01yk.js} +1 -1
- package/dist/client/static/js/{index-pr8wsq24.js → index-vn59zz0k.js} +2 -2
- package/dist/client/static/js/{index-hrez92pw.js → index-wf5j0009.js} +7 -7
- package/dist/client/static/js/{index-q3k8r0ms.js → index-wsy6y5em.js} +9 -9
- package/dist/client/static/js/{index-d201jvs9.js → index-xy0m8te9.js} +1 -1
- package/dist/client/static/js/index-y6zbkh4p.js +2 -0
- package/dist/client/static/js/{index-h1xbx74w.js → index-yfcy4cf6.js} +2 -2
- package/dist/client/static/js/{index-y5pkqrga.js → index-z5s9tmj8.js} +2 -2
- package/dist/client/static/js/{index-vs3g6njv.js → index-zr3965k9.js} +1 -1
- package/dist/client/static/js/info-A6RAGUB7-dqyaxjc1.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-7craq9x2.js → infoDiagram-VRGFBTTK-jy5zvvj8.js} +1 -1
- package/dist/client/static/js/ini-g6a5xsaw.js +1 -0
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-ncjty2re.js → ishikawaDiagram-OU5B5YK6-pfky1nnf.js} +3 -3
- package/dist/client/static/js/java-n596am4c.js +1 -0
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-yx222bzt.js → journeyDiagram-ZHPQQLJL-mvaf7rfh.js} +4 -4
- package/dist/client/static/js/json-7k70qbkj.js +1 -0
- package/dist/client/static/js/jsx-sndenqrc.js +1 -0
- package/dist/client/static/js/{julia-agc5kfvg.js → julia-rpd1y9vh.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-a2f84qmn.js → kanban-definition-PNTS6WVX-hw2xwe6e.js} +5 -5
- package/dist/client/static/js/lua-djd3g9q5.js +1 -0
- package/dist/client/static/js/markdown-r2tpvxpn.js +1 -0
- package/dist/client/static/js/{mermaid.core-9vfwthw3.js → mermaid.core-hsw87hmq.js} +6 -6
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-fsxysg6f.js → mindmap-definition-NLK3R4M7-wfe4d846.js} +7 -7
- package/dist/client/static/js/one-dark-pro-ckq5capv.js +1 -0
- package/dist/client/static/js/one-light-a908z398.js +1 -0
- package/dist/client/static/js/packet-AYTQ26CC-7jxzax4z.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-77wxmp9g.js → pegDiagram-GJSIUBJH-cvnmxgst.js} +1 -1
- package/dist/client/static/js/{perl-v5vbtzgf.js → perl-kmtz9dnv.js} +1 -1
- package/dist/client/static/js/{php-83qwy98t.js → php-bttrsbxy.js} +1 -1
- package/dist/client/static/js/pie-WAS4IAKB-wc9wxr7f.js +1 -0
- package/dist/client/static/js/{pieDiagram-5QR66LMP-gvgfhez0.js → pieDiagram-5QR66LMP-0n3gz7sv.js} +2 -2
- package/dist/client/static/js/properties-brn72zdk.js +1 -0
- package/dist/client/static/js/python-g9mghwgm.js +1 -0
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-9zkbt5h8.js → quadrantDiagram-O4NWA36T-9qqh6xvv.js} +4 -4
- package/dist/client/static/js/r-e247x4mw.js +1 -0
- package/dist/client/static/js/radar-RG4KPBEZ-kwj5padj.js +1 -0
- package/dist/client/static/js/railroad-74A4TZTK-h8sdx3w5.js +1 -0
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-2wmwx246.js +1 -0
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-h4cdgw3y.js +1 -0
- package/dist/client/static/js/railroad-peg-WCYAUIDC-q7m0tfd0.js +1 -0
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-w55bsyw6.js → railroadDiagram-XR7U4H2S-5f3x3762.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-828s1e5g.js → requirementDiagram-PLB6GJNP-a68bv6kh.js} +12 -12
- package/dist/client/static/js/{ruby-994n5j6e.js → ruby-dve3y59w.js} +1 -1
- package/dist/client/static/js/{rust-csv5f258.js → rust-qjhdt4b0.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-34f3fyvg.js → sankeyDiagram-IPEJSGJF-ry7xcphh.js} +4 -4
- package/dist/client/static/js/{sass-p6g7qdv2.js → sass-emxqt5p2.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-nnta2hn0.js → sequenceDiagram-PO4LG4MO-mekzzhet.js} +21 -21
- package/dist/client/static/js/{sizeCapture-INFHLROL-gpcramga.js → sizeCapture-INFHLROL-pvc16ame.js} +1 -1
- package/dist/client/static/js/sql-0kar81jy.js +1 -0
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-3f2en220.js → stateDiagram-v2-GCMORJYK-3ytxby83.js} +3 -3
- package/dist/client/static/js/{svelte-bek3h1sz.js → svelte-dbsx1ehx.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-jgqt12z9.js → swimlanes-2SLR337P-c2zfp416.js} +1 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-9gm67sq4.js +8 -0
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-sgchcs11.js → timeline-definition-EJHVYXUP-xtvv4za2.js} +6 -6
- package/dist/client/static/js/treeView-Q6P3EWNA-yv9640h3.js +1 -0
- package/dist/client/static/js/treemap-WGGIJYW6-7kpzjg21.js +1 -0
- package/dist/client/static/js/typescript-bm89v3gk.js +1 -0
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-znkg9pkq.js → usecaseDiagram-POWQR4AR-sz6b7bnv.js} +51 -51
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-dncg96ej.js → vennDiagram-UO4OBE2U-56q0qs51.js} +5 -5
- package/dist/client/static/js/{vue-y44m889c.js → vue-hyr58df9.js} +1 -1
- package/dist/client/static/js/wardley-WFR3VGLG-mggay64p.js +1 -0
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-77xz2d49.js → wardleyDiagram-VNRHLVJA-xvtyvde9.js} +5 -5
- package/dist/client/static/js/xml-b7824nx0.js +1 -0
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-40j1aqyf.js → xychartDiagram-PMCCYNJV-jcs20s84.js} +6 -6
- package/dist/client/static/js/yaml-kqqktdv1.js +1 -0
- package/package.json +4 -4
- package/src/client/borders.css +28 -15
- package/src/client/components/common/Modal.tsx +10 -2
- package/src/client/components/common/Toast.tsx +8 -3
- package/src/client/components/common/anchored-menu/index.tsx +10 -3
- package/src/client/components/common/command-palette/index.tsx +9 -3
- package/src/client/components/common/fullscreen-viewer/index.tsx +1 -1
- package/src/client/components/common/header-controls/index.test.tsx +40 -3
- package/src/client/components/common/header-controls/index.tsx +106 -56
- package/src/client/components/common/search-select/search-select.test.tsx +10 -1
- package/src/client/components/common/workspace-mark/index.test.tsx +67 -0
- package/src/client/components/common/workspace-mark/index.tsx +48 -0
- package/src/client/components/layout/ActivityBar.test.ts +1 -1
- package/src/client/components/layout/ActivityBarDrag.test.ts +1 -1
- package/src/client/components/layout/LeftActivityBar.test.ts +48 -3
- package/src/client/components/layout/LeftDock.tsx +33 -14
- package/src/client/components/layout/PanelButton.test.tsx +119 -0
- package/src/client/components/layout/PanelButton.tsx +2 -4
- package/src/client/components/layout/activity-bar/Row.tsx +125 -0
- package/src/client/components/layout/{ActivityBar.tsx → activity-bar/index.tsx} +81 -20
- package/src/client/components/layout/controls-bar/index.tsx +183 -0
- package/src/client/components/layout/desktop-layout/BarSlot.tsx +18 -0
- package/src/client/components/layout/desktop-layout/LeftColumn.test.tsx +187 -0
- package/src/client/components/layout/desktop-layout/LeftColumn.tsx +81 -64
- package/src/client/components/layout/desktop-layout/LeftRail.tsx +60 -0
- package/src/client/components/layout/desktop-layout/LeftTabsColumn.tsx +91 -0
- package/src/client/components/layout/desktop-layout/ResizeHandle.tsx +19 -3
- package/src/client/components/layout/desktop-layout/RightColumn.test.tsx +60 -0
- package/src/client/components/layout/desktop-layout/RightColumn.tsx +77 -28
- package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +114 -104
- package/src/client/components/layout/desktop-layout/index.tsx +48 -45
- package/src/client/components/layout/desktop-layout/resizer/index.tsx +25 -83
- package/src/client/components/layout/desktop-layout/resizer/panel-motion.ts +61 -0
- package/src/client/components/layout/desktop-layout/resizer/panel.test.ts +40 -2
- package/src/client/components/layout/desktop-layout/resizer/separator.tsx +89 -0
- package/src/client/components/layout/left-bar/index.tsx +88 -0
- package/src/client/components/layout/session-sidebar/CategoryHeader.tsx +5 -2
- package/src/client/components/layout/session-sidebar/Footer.tsx +28 -11
- package/src/client/components/layout/session-sidebar/FooterHost.tsx +167 -0
- package/src/client/components/layout/session-sidebar/SessionItem.tsx +2 -2
- package/src/client/components/layout/session-sidebar/about-modal/index.tsx +8 -3
- package/src/client/components/layout/session-sidebar/footer-host.test.tsx +133 -0
- package/src/client/components/layout/session-sidebar/modern/WorkspaceHeader.tsx +5 -2
- package/src/client/components/layout/session-title-bar/index.tsx +199 -0
- package/src/client/components/layout/top-bars.test.tsx +338 -0
- package/src/client/components/mobile/LayoutWrapper.tsx +13 -2
- package/src/client/components/mobile/SessionSidebar.tsx +10 -8
- package/src/client/components/mobile/drawer-layout.test.tsx +67 -0
- package/src/client/components/mobile/drawer-strip.tsx +37 -14
- package/src/client/components/mobile/left-drawer-nav.test.tsx +19 -127
- package/src/client/components/settings/LazyModal.tsx +8 -2
- package/src/client/components/settings/Modal.tsx +6 -2
- package/src/client/components/settings/apply-side-effects.ts +5 -0
- package/src/client/components/settings/categories/AppearanceSettings.test.tsx +1 -0
- package/src/client/components/settings/categories/AppearanceSettings.tsx +2 -0
- package/src/client/components/settings/categories/appearance-settings/BorderStyleSection.test.tsx +6 -5
- package/src/client/components/settings/categories/appearance-settings/BorderStyleSection.tsx +2 -2
- package/src/client/components/settings/categories/appearance-settings/ChromeStyleSection.tsx +105 -0
- package/src/client/components/settings/categories/appearance-settings/groups.ts +3 -2
- package/src/client/components/settings/categories/mcp-settings/ImportModal.tsx +1 -1
- package/src/client/components/settings/categories/voice-settings/SpeechSettings.test.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/AiMessageFooter.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/AiMessageFooterSheet.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/GeneratingIndicator.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/NewChatModal.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/UndoConfirmModal.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.test.ts +8 -1
- package/src/client/components/workspace/chat-timeline/chat-input/SessionModeDropdown.test.tsx +8 -1
- package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.test.tsx +9 -2
- package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.tsx +1 -25
- package/src/client/components/workspace/editor/SaveDeletedFileModal.tsx +1 -1
- package/src/client/components/workspace/editor/Tab.tsx +160 -0
- package/src/client/components/workspace/editor/Tabs.test.ts +40 -0
- package/src/client/components/workspace/editor/Tabs.tsx +52 -102
- package/src/client/components/workspace/editor/index.tsx +2 -0
- package/src/client/components/workspace/editor/props.ts +6 -0
- package/src/client/components/workspace/file-explorer/OutlineResize.test.tsx +225 -0
- package/src/client/components/workspace/file-explorer/OutlineSection.tsx +43 -3
- package/src/client/components/workspace/file-explorer/index.tsx +1 -1
- package/src/client/components/workspace/model-dropdown/Panel.tsx +1 -1
- package/src/client/components/workspace/model-dropdown/SpecsTooltip.tsx +1 -1
- package/src/client/components/workspace/panel-tabs/TabChip.tsx +50 -20
- package/src/client/components/workspace/panel-tabs/TabStrip.connected.test.tsx +172 -0
- package/src/client/components/workspace/panel-tabs/TabStrip.tsx +18 -9
- package/src/client/components/workspace/search-panel/Body.tsx +3 -3
- package/src/client/components/workspace/terminal-panel/RealtimeTerminalView.tsx +1 -1
- package/src/client/data/settings/omp-schema.json +205 -9
- package/src/client/floating.css +276 -0
- package/src/client/floating.test.ts +151 -0
- package/src/client/hooks/chat/timeline/session-pagination.ts +13 -9
- package/src/client/hooks/editor/use-outline-resize.ts +145 -0
- package/src/client/hooks/ui/border-style.test.ts +19 -7
- package/src/client/hooks/ui/border-style.ts +2 -3
- package/src/client/hooks/ui/chrome-style.test.ts +140 -0
- package/src/client/hooks/ui/chrome-style.ts +75 -0
- package/src/client/hooks/ui/media-query.ts +29 -0
- package/src/client/hooks/ui/presence.test.ts +104 -0
- package/src/client/hooks/ui/presence.ts +62 -0
- package/src/client/hooks/ui/style-attributes.test.ts +7 -6
- package/src/client/hooks/ui/surface-style.ts +2 -2
- package/src/client/hooks/ui/titlebar-inset.test.ts +56 -0
- package/src/client/hooks/ui/titlebar-inset.ts +31 -0
- package/src/client/hooks/workspace/available-width.ts +25 -1
- package/src/client/hooks/workspace/panel-peek.test.ts +124 -0
- package/src/client/hooks/workspace/panel-peek.ts +151 -0
- package/src/client/hooks/workspace/panel-rail.test.ts +86 -0
- package/src/client/hooks/workspace/panel-rail.ts +108 -0
- package/src/client/hooks/workspace/panel-resize.ts +8 -2
- package/src/client/hooks/workspace/rail-peek.test.ts +119 -0
- package/src/client/hooks/workspace/rail-peek.ts +68 -0
- package/src/client/hooks/workspace/right-panel-card.test.ts +71 -0
- package/src/client/hooks/workspace/right-panel-card.ts +69 -0
- package/src/client/hooks/workspace/right-panel-geometry.ts +172 -0
- package/src/client/hooks/workspace/right-side.ts +7 -0
- package/src/client/lib/desktop/titlebar.test.ts +6 -0
- package/src/client/lib/desktop/titlebar.ts +16 -0
- package/src/client/main.tsx +11 -0
- package/src/client/motion.test.ts +36 -0
- package/src/client/tailwind.css +67 -0
- package/src/server/lib/assets/shell-attributes.server.ts +14 -4
- package/src/server/lib/assets/shell-attributes.test.ts +35 -21
- package/src/server/lib/bundler/titlebar-css.test.ts +3 -2
- package/src/server/lib/realtime/topics/peer-relay.server.test.ts +19 -3
- package/src/server/lib/updates/omp.test.ts +40 -1
- package/src/server/lib/updates/omp.ts +29 -2
- package/src/server/plugins/ssr.ts +2 -0
- package/src/server/routes/settings/mcp.test.ts +16 -0
- package/src/server/routes/settings/mcp.ts +4 -0
- package/src/shared/lib/code/outline/resize.test.ts +57 -0
- package/src/shared/lib/code/outline/resize.ts +67 -0
- package/src/shared/lib/models/provider/glyph.test.ts +3 -1
- package/src/shared/lib/models/provider/glyph.ts +1 -0
- package/src/shared/lib/omp/config/schema-releases-19-4.test.ts +103 -3
- package/src/shared/lib/omp/config/schema.test.ts +9 -0
- package/src/shared/lib/omp/config/schema.ts +8 -0
- package/src/shared/lib/settings/defaults.ts +2 -0
- package/src/shared/lib/theme/border-style.test.ts +12 -14
- package/src/shared/lib/theme/border-style.ts +25 -18
- package/src/shared/lib/theme/chrome-style.test.ts +31 -0
- package/src/shared/lib/theme/chrome-style.ts +74 -0
- package/src/shared/lib/theme/surface-style.test.ts +4 -5
- package/src/shared/lib/theme/surface-style.ts +6 -5
- package/src/shared/lib/ui/motion.ts +29 -0
- package/src/shared/lib/workspace/floating-chrome.ts +23 -0
- package/src/shared/lib/workspace/session-state/store.ts +3 -0
- package/src/shared/lib/workspace/workspace-panel-widths.test.ts +73 -0
- package/src/shared/lib/workspace/workspace-panel-widths.ts +79 -17
- package/src/shared/types/settings/state.ts +10 -9
- package/src/test-support/left-drawer-harness.test-util.ts +169 -0
- package/src/test-support/peer-harness.ts +44 -36
- package/dist/client/static/js/ImageView-nc2n0w6s.js +0 -1
- package/dist/client/static/js/LayoutWrapper-j7786frq.js +0 -2
- package/dist/client/static/js/MergeDiffView-0rn5zsy5.js +0 -1
- package/dist/client/static/js/Modal-7ag7a9qq.js +0 -60
- package/dist/client/static/js/SessionsView-t9rhx472.js +0 -1
- package/dist/client/static/js/architecture-7GRP2DOG-bwn1drdz.js +0 -1
- package/dist/client/static/js/bash-zknkkwkw.js +0 -1
- package/dist/client/static/js/c-0w02jkxb.js +0 -1
- package/dist/client/static/js/cpp-p5b4vean.js +0 -1
- package/dist/client/static/js/css-9jzbvdyz.js +0 -1
- package/dist/client/static/js/cynefin-OW5HDTMX-jbc50ks8.js +0 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-b37ey01t.js +0 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-vd4z6bvy.js +0 -1
- package/dist/client/static/js/gitGraph-4MIJSDKK-mvqq7tcs.js +0 -1
- package/dist/client/static/js/graphql-xzykn0ba.js +0 -1
- package/dist/client/static/js/html-2zc3shky.js +0 -1
- package/dist/client/static/js/index-6vbra7p9.js +0 -1
- package/dist/client/static/js/index-9mgpbwfr.js +0 -1
- package/dist/client/static/js/index-c5401dqs.js +0 -4
- package/dist/client/static/js/index-dbsy29gn.js +0 -2
- package/dist/client/static/js/index-e39m185a.js +0 -2
- package/dist/client/static/js/index-fnaq8baz.js +0 -1
- package/dist/client/static/js/index-mttx9327.css +0 -1
- package/dist/client/static/js/index-n7bmqeqz.js +0 -1
- package/dist/client/static/js/index-skp6991n.js +0 -2
- package/dist/client/static/js/info-A6RAGUB7-zkv4crz7.js +0 -1
- package/dist/client/static/js/ini-62r3vxaf.js +0 -1
- package/dist/client/static/js/java-kacycary.js +0 -1
- package/dist/client/static/js/json-yrwpn6bd.js +0 -1
- package/dist/client/static/js/jsx-b40ag8q1.js +0 -1
- package/dist/client/static/js/lua-bk961f37.js +0 -1
- package/dist/client/static/js/markdown-b7rgzgd6.js +0 -1
- package/dist/client/static/js/one-dark-pro-7v4by00h.js +0 -1
- package/dist/client/static/js/one-light-5rfzh8p4.js +0 -1
- package/dist/client/static/js/packet-AYTQ26CC-dgpge627.js +0 -1
- package/dist/client/static/js/pie-WAS4IAKB-b8pgsqrd.js +0 -1
- package/dist/client/static/js/properties-k8gbzggp.js +0 -1
- package/dist/client/static/js/python-343tspad.js +0 -1
- package/dist/client/static/js/r-ycdwmv8g.js +0 -1
- package/dist/client/static/js/radar-RG4KPBEZ-fmfe5y27.js +0 -1
- package/dist/client/static/js/railroad-74A4TZTK-b5tks4ce.js +0 -1
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-0sf4m0ze.js +0 -1
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-pjfy3pt7.js +0 -1
- package/dist/client/static/js/railroad-peg-WCYAUIDC-nr8ngt42.js +0 -1
- package/dist/client/static/js/sql-kwpd5w07.js +0 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-xx1z57df.js +0 -8
- package/dist/client/static/js/treeView-Q6P3EWNA-23r9fa68.js +0 -1
- package/dist/client/static/js/treemap-WGGIJYW6-mxxzdrj6.js +0 -1
- package/dist/client/static/js/typescript-4dchbnya.js +0 -1
- package/dist/client/static/js/wardley-WFR3VGLG-cbqtax1x.js +0 -1
- package/dist/client/static/js/xml-xs6qz3ya.js +0 -1
- package/dist/client/static/js/yaml-174nk5bn.js +0 -1
- package/src/client/components/layout/desktop-layout/TopNavbar.tsx +0 -238
- package/src/client/components/layout/session-sidebar/Header.test.ts +0 -98
- package/src/client/components/layout/session-sidebar/Header.tsx +0 -60
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{t,l,Y,E,te,F,O,G,z,j,q,H,m,b,V,Qm,wt,pt,mt,aa,$t,zt,Ut,Ct}from"./index-xqz7bqcn.js";import{Sn}from"./index-nwbr15b3.js";var vs={};Sn(vs,{default:()=>ut});var _s={};Sn(_s,{default:()=>He});var Fs={};Sn(Fs,{default:()=>ti});var df=typeof global=="object"&&global&&global.Object===Object&&global,Ns=df;var pf=typeof self=="object"&&self&&self.Object===Object&&self,mf=Ns||pf||Function("return this")(),pe=mf;var gf=pe.Symbol,Oe=gf;var eo=Object.prototype,{hasOwnProperty:Tf,toString:Ef}=eo,Qr=Oe?Oe.toStringTag:void 0;function yf(e){var r=Tf.call(e,Qr),s=e[Qr];try{e[Qr]=void 0;var n=!0}catch(o){}var i=Ef.call(e);if(n)if(r)e[Qr]=s;else delete e[Qr];return i}var to=yf;var Af=Object.prototype,xf=Af.toString;function Sf(e){return xf.call(e)}var ro=Sf;var Rf="[object Null]",Of="[object Undefined]",so=Oe?Oe.toStringTag:void 0;function Lf(e){if(e==null)return e===void 0?Of:Rf;return so&&so in Object(e)?to(e):ro(e)}var Pe=Lf;function If(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}var ne=If;var Nf="[object AsyncFunction]",bf="[object Function]",Cf="[object GeneratorFunction]",vf="[object Proxy]";function kf(e){if(!ne(e))return!1;var r=Pe(e);return r==bf||r==Cf||r==Nf||r==vf}var Ue=kf;var _f=pe["__core-js_shared__"],bs=_f;var no=function(){var e=/[^.]+$/.exec(bs&&bs.keys&&bs.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Mf(e){return!!no&&no in e}var io=Mf;var wf=Function.prototype,Pf=wf.toString;function Uf(e){if(e!=null){try{return Pf.call(e)}catch(r){}try{return e+""}catch(r){}}return""}var St=Uf;var Df=/[\\^$.*+?()[\]{}|]/g,Ff=/^\[object .+?Constructor\]$/,Bf=Function.prototype,$f=Object.prototype,Gf=Bf.toString,Wf=$f.hasOwnProperty,jf=RegExp("^"+Gf.call(Wf).replace(Df,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Kf(e){if(!ne(e)||io(e))return!1;var r=Ue(e)?jf:Ff;return r.test(St(e))}var oo=Kf;function zf(e,r){return e==null?void 0:e[r]}var ao=zf;function Vf(e,r){var s=ao(e,r);return oo(s)?s:void 0}var $e=Vf;var Hf=function(){try{var e=$e(Object,"defineProperty");return e({},"",{}),e}catch(r){}}(),hr=Hf;function Yf(e,r,s){if(r=="__proto__"&&hr)hr(e,r,{configurable:!0,enumerable:!0,value:s,writable:!0});else e[r]=s}var dr=Yf;function Xf(e,r){return e===r||e!==e&&r!==r}var at=Xf;var qf=Object.prototype,Jf=qf.hasOwnProperty;function Zf(e,r,s){var n=e[r];if(!(Jf.call(e,r)&&at(n,s))||s===void 0&&!(r in e))dr(e,r,s)}var _t=Zf;function Qf(e,r,s,n){var i=!s;s||(s={});var o=-1,c=r.length;while(++o<c){var u=r[o],a=n?n(s[u],e[u],u,s,e):void 0;if(a===void 0)a=e[u];if(i)dr(s,u,a);else _t(s,u,a)}return s}var lt=Qf;function eh(e){return e}var tt=eh;function th(e,r,s){switch(s.length){case 0:return e.call(r);case 1:return e.call(r,s[0]);case 2:return e.call(r,s[0],s[1]);case 3:return e.call(r,s[0],s[1],s[2])}return e.apply(r,s)}var lo=th;var co=Math.max;function rh(e,r,s){return r=co(r===void 0?e.length-1:r,0),function(){var n=arguments,i=-1,o=co(n.length-r,0),c=Array(o);while(++i<o)c[i]=n[r+i];i=-1;var u=Array(r+1);while(++i<r)u[i]=n[i];return u[r]=s(c),lo(e,this,u)}}var uo=rh;function sh(e){return function(){return e}}var fo=sh;var nh=!hr?tt:function(e,r){return hr(e,"toString",{configurable:!0,enumerable:!1,value:fo(r),writable:!0})},ho=nh;var ih=800,oh=16,ah=Date.now;function lh(e){var r=0,s=0;return function(){var n=ah(),i=oh-(n-s);if(s=n,i>0){if(++r>=ih)return arguments[0]}else r=0;return e.apply(void 0,arguments)}}var po=lh;var ch=po(ho),mo=ch;function uh(e,r){return mo(uo(e,r,tt),e+"")}var pr=uh;var fh=9007199254740991;function hh(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=fh}var mr=hh;function dh(e){return e!=null&&mr(e.length)&&!Ue(e)}var me=dh;var ph=9007199254740991,mh=/^(?:0|[1-9]\d*)$/;function gh(e,r){var s=typeof e;return r=r==null?ph:r,!!r&&(s=="number"||s!="symbol"&&mh.test(e))&&(e>-1&&e%1==0&&e<r)}var Mt=gh;function Th(e,r,s){if(!ne(s))return!1;var n=typeof r;if(n=="number"?me(s)&&Mt(r,s.length):n=="string"&&(r in s))return at(s[r],e);return!1}var Pt=Th;function Eh(e){return pr(function(r,s){var n=-1,i=s.length,o=i>1?s[i-1]:void 0,c=i>2?s[2]:void 0;if(o=e.length>3&&typeof o=="function"?(i--,o):void 0,c&&Pt(s[0],s[1],c))o=i<3?void 0:o,i=1;r=Object(r);while(++n<i){var u=s[n];if(u)e(r,u,n,o)}return r})}var go=Eh;var yh=Object.prototype;function Ah(e){var r=e&&e.constructor,s=typeof r=="function"&&r.prototype||yh;return e===s}var ct=Ah;function xh(e,r){var s=-1,n=Array(e);while(++s<e)n[s]=r(s);return n}var To=xh;function Sh(e){return e!=null&&typeof e=="object"}var ue=Sh;var Rh="[object Arguments]";function Oh(e){return ue(e)&&Pe(e)==Rh}var Zn=Oh;var Eo=Object.prototype,{hasOwnProperty:Lh,propertyIsEnumerable:Ih}=Eo,Nh=Zn(function(){return arguments}())?Zn:function(e){return ue(e)&&Lh.call(e,"callee")&&!Ih.call(e,"callee")},Dt=Nh;var bh=Array.isArray,L=bh;function Ch(){return!1}var yo=Ch;var So=typeof vs=="object"&&vs&&!vs.nodeType&&vs,Ao=So&&typeof Cs=="object"&&Cs&&!Cs.nodeType&&Cs,vh=Ao&&Ao.exports===So,xo=vh?pe.Buffer:void 0,kh=xo?xo.isBuffer:void 0,_h=kh||yo,ut=_h;var Mh="[object Arguments]",wh="[object Array]",Ph="[object Boolean]",Uh="[object Date]",Dh="[object Error]",Fh="[object Function]",Bh="[object Map]",$h="[object Number]",Gh="[object Object]",Wh="[object RegExp]",jh="[object Set]",Kh="[object String]",zh="[object WeakMap]",Vh="[object ArrayBuffer]",Hh="[object DataView]",Yh="[object Float32Array]",Xh="[object Float64Array]",qh="[object Int8Array]",Jh="[object Int16Array]",Zh="[object Int32Array]",Qh="[object Uint8Array]",ed="[object Uint8ClampedArray]",td="[object Uint16Array]",rd="[object Uint32Array]",X={};X[Yh]=X[Xh]=X[qh]=X[Jh]=X[Zh]=X[Qh]=X[ed]=X[td]=X[rd]=!0;X[Mh]=X[wh]=X[Vh]=X[Ph]=X[Hh]=X[Uh]=X[Dh]=X[Fh]=X[Bh]=X[$h]=X[Gh]=X[Wh]=X[jh]=X[Kh]=X[zh]=!1;function sd(e){return ue(e)&&mr(e.length)&&!!X[Pe(e)]}var Ro=sd;function nd(e){return function(r){return e(r)}}var ft=nd;var Oo=typeof _s=="object"&&_s&&!_s.nodeType&&_s,es=Oo&&typeof ks=="object"&&ks&&!ks.nodeType&&ks,id=es&&es.exports===Oo,Qn=id&&Ns.process,od=function(){try{var e=es&&es.require&&es.require("util").types;if(e)return e;return Qn&&Qn.binding&&Qn.binding("util")}catch(r){}}(),He=od;var Lo=He&&He.isTypedArray,ad=Lo?ft(Lo):Ro,gr=ad;var ld=Object.prototype,cd=ld.hasOwnProperty;function ud(e,r){var s=L(e),n=!s&&Dt(e),i=!s&&!n&&ut(e),o=!s&&!n&&!i&&gr(e),c=s||n||i||o,u=c?To(e.length,String):[],a=u.length;for(var f in e)if((r||cd.call(e,f))&&!(c&&(f=="length"||i&&(f=="offset"||f=="parent")||o&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||Mt(f,a))))u.push(f);return u}var Ms=ud;function fd(e,r){return function(s){return e(r(s))}}var ws=fd;var hd=ws(Object.keys,Object),Io=hd;var dd=Object.prototype,pd=dd.hasOwnProperty;function md(e){if(!ct(e))return Io(e);var r=[];for(var s in Object(e))if(pd.call(e,s)&&s!="constructor")r.push(s);return r}var Ps=md;function gd(e){return me(e)?Ms(e):Ps(e)}var B=gd;var Td=Object.prototype,Ed=Td.hasOwnProperty,yd=go(function(e,r){if(ct(r)||me(r)){lt(r,B(r),e);return}for(var s in r)if(Ed.call(r,s))_t(e,s,r[s])}),Ne=yd;function Ad(){this.__data__=[],this.size=0}var No=Ad;function xd(e,r){var s=e.length;while(s--)if(at(e[s][0],r))return s;return-1}var Ft=xd;var Sd=Array.prototype,Rd=Sd.splice;function Od(e){var r=this.__data__,s=Ft(r,e);if(s<0)return!1;var n=r.length-1;if(s==n)r.pop();else Rd.call(r,s,1);return--this.size,!0}var bo=Od;function Ld(e){var r=this.__data__,s=Ft(r,e);return s<0?void 0:r[s][1]}var Co=Ld;function Id(e){return Ft(this.__data__,e)>-1}var vo=Id;function Nd(e,r){var s=this.__data__,n=Ft(s,e);if(n<0)++this.size,s.push([e,r]);else s[n][1]=r;return this}var ko=Nd;function Tr(e){var r=-1,s=e==null?0:e.length;this.clear();while(++r<s){var n=e[r];this.set(n[0],n[1])}}Tr.prototype.clear=No;Tr.prototype.delete=bo;Tr.prototype.get=Co;Tr.prototype.has=vo;Tr.prototype.set=ko;var Bt=Tr;function bd(){this.__data__=new Bt,this.size=0}var _o=bd;function Cd(e){var r=this.__data__,s=r.delete(e);return this.size=r.size,s}var Mo=Cd;function vd(e){return this.__data__.get(e)}var wo=vd;function kd(e){return this.__data__.has(e)}var Po=kd;var _d=$e(pe,"Map"),Gt=_d;var Md=$e(Object,"create"),Rt=Md;function wd(){this.__data__=Rt?Rt(null):{},this.size=0}var Uo=wd;function Pd(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}var Do=Pd;var Ud="__lodash_hash_undefined__",Dd=Object.prototype,Fd=Dd.hasOwnProperty;function Bd(e){var r=this.__data__;if(Rt){var s=r[e];return s===Ud?void 0:s}return Fd.call(r,e)?r[e]:void 0}var Fo=Bd;var $d=Object.prototype,Gd=$d.hasOwnProperty;function Wd(e){var r=this.__data__;return Rt?r[e]!==void 0:Gd.call(r,e)}var Bo=Wd;var jd="__lodash_hash_undefined__";function Kd(e,r){var s=this.__data__;return this.size+=this.has(e)?0:1,s[e]=Rt&&r===void 0?jd:r,this}var $o=Kd;function Er(e){var r=-1,s=e==null?0:e.length;this.clear();while(++r<s){var n=e[r];this.set(n[0],n[1])}}Er.prototype.clear=Uo;Er.prototype.delete=Do;Er.prototype.get=Fo;Er.prototype.has=Bo;Er.prototype.set=$o;var ei=Er;function zd(){this.size=0,this.__data__={hash:new ei,map:new(Gt||Bt),string:new ei}}var Go=zd;function Vd(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}var Wo=Vd;function Hd(e,r){var s=e.__data__;return Wo(r)?s[typeof r=="string"?"string":"hash"]:s.map}var Wt=Hd;function Yd(e){var r=Wt(this,e).delete(e);return this.size-=r?1:0,r}var jo=Yd;function Xd(e){return Wt(this,e).get(e)}var Ko=Xd;function qd(e){return Wt(this,e).has(e)}var zo=qd;function Jd(e,r){var s=Wt(this,e),n=s.size;return s.set(e,r),this.size+=s.size==n?0:1,this}var Vo=Jd;function yr(e){var r=-1,s=e==null?0:e.length;this.clear();while(++r<s){var n=e[r];this.set(n[0],n[1])}}yr.prototype.clear=Go;yr.prototype.delete=jo;yr.prototype.get=Ko;yr.prototype.has=zo;yr.prototype.set=Vo;var er=yr;var Zd=200;function Qd(e,r){var s=this.__data__;if(s instanceof Bt){var n=s.__data__;if(!Gt||n.length<Zd-1)return n.push([e,r]),this.size=++s.size,this;s=this.__data__=new er(n)}return s.set(e,r),this.size=s.size,this}var Ho=Qd;function Ar(e){var r=this.__data__=new Bt(e);this.size=r.size}Ar.prototype.clear=_o;Ar.prototype.delete=Mo;Ar.prototype.get=wo;Ar.prototype.has=Po;Ar.prototype.set=Ho;var jt=Ar;function ep(e,r){var s=-1,n=e==null?0:e.length;while(++s<n)if(r(e[s],s,e)===!1)break;return e}var Us=ep;function tp(e,r){return e&<(r,B(r),e)}var Yo=tp;function rp(e){var r=[];if(e!=null)for(var s in Object(e))r.push(s);return r}var Xo=rp;var sp=Object.prototype,np=sp.hasOwnProperty;function ip(e){if(!ne(e))return Xo(e);var r=ct(e),s=[];for(var n in e)if(!(n=="constructor"&&(r||!np.call(e,n))))s.push(n);return s}var qo=ip;function op(e){return me(e)?Ms(e,!0):qo(e)}var Kt=op;function ap(e,r){return e&<(r,Kt(r),e)}var Jo=ap;var ta=typeof Fs=="object"&&Fs&&!Fs.nodeType&&Fs,Zo=ta&&typeof Ds=="object"&&Ds&&!Ds.nodeType&&Ds,lp=Zo&&Zo.exports===ta,Qo=lp?pe.Buffer:void 0,ea=Qo?Qo.allocUnsafe:void 0;function cp(e,r){if(r)return e.slice();var s=e.length,n=ea?ea(s):new e.constructor(s);return e.copy(n),n}var ti=cp;function up(e,r){var s=-1,n=e.length;r||(r=Array(n));while(++s<n)r[s]=e[s];return r}var ra=up;function fp(e,r){var s=-1,n=e==null?0:e.length,i=0,o=[];while(++s<n){var c=e[s];if(r(c,s,e))o[i++]=c}return o}var xr=fp;function hp(){return[]}var Bs=hp;var dp=Object.prototype,pp=dp.propertyIsEnumerable,sa=Object.getOwnPropertySymbols,mp=!sa?Bs:function(e){if(e==null)return[];return e=Object(e),xr(sa(e),function(r){return pp.call(e,r)})},Sr=mp;function gp(e,r){return lt(e,Sr(e),r)}var na=gp;function Tp(e,r){var s=-1,n=r.length,i=e.length;while(++s<n)e[i+s]=r[s];return e}var Rr=Tp;var Ep=ws(Object.getPrototypeOf,Object),$s=Ep;var yp=Object.getOwnPropertySymbols,Ap=!yp?Bs:function(e){var r=[];while(e)Rr(r,Sr(e)),e=$s(e);return r},Gs=Ap;function xp(e,r){return lt(e,Gs(e),r)}var ia=xp;function Sp(e,r,s){var n=r(e);return L(e)?n:Rr(n,s(e))}var Ws=Sp;function Rp(e){return Ws(e,B,Sr)}var ts=Rp;function Op(e){return Ws(e,Kt,Gs)}var js=Op;var Lp=$e(pe,"DataView"),Ks=Lp;var Ip=$e(pe,"Promise"),zs=Ip;var Np=$e(pe,"Set"),Vt=Np;var bp=$e(pe,"WeakMap"),Vs=bp;var oa="[object Map]",Cp="[object Object]",la="[object Promise]",ca="[object Set]",ua="[object WeakMap]",fa="[object DataView]",vp=St(Ks),kp=St(Gt),_p=St(zs),Mp=St(Vt),wp=St(Vs),tr=Pe;if(Ks&&tr(new Ks(new ArrayBuffer(1)))!=fa||Gt&&tr(new Gt)!=oa||zs&&tr(zs.resolve())!=la||Vt&&tr(new Vt)!=ca||Vs&&tr(new Vs)!=ua)tr=function(e){var r=Pe(e),s=r==Cp?e.constructor:void 0,n=s?St(s):"";if(n)switch(n){case vp:return fa;case kp:return oa;case _p:return la;case Mp:return ca;case wp:return ua}return r};var rt=tr;var Pp=Object.prototype,Up=Pp.hasOwnProperty;function Dp(e){var r=e.length,s=new e.constructor(r);if(r&&typeof e[0]=="string"&&Up.call(e,"index"))s.index=e.index,s.input=e.input;return s}var ha=Dp;var Fp=pe.Uint8Array,Or=Fp;function Bp(e){var r=new e.constructor(e.byteLength);return new Or(r).set(new Or(e)),r}var Lr=Bp;function $p(e,r){var s=r?Lr(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.byteLength)}var da=$p;var Gp=/\w*$/;function Wp(e){var r=new e.constructor(e.source,Gp.exec(e));return r.lastIndex=e.lastIndex,r}var pa=Wp;var ma=Oe?Oe.prototype:void 0,ga=ma?ma.valueOf:void 0;function jp(e){return ga?Object(ga.call(e)):{}}var Ta=jp;function Kp(e,r){var s=r?Lr(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.length)}var Ea=Kp;var zp="[object Boolean]",Vp="[object Date]",Hp="[object Map]",Yp="[object Number]",Xp="[object RegExp]",qp="[object Set]",Jp="[object String]",Zp="[object Symbol]",Qp="[object ArrayBuffer]",em="[object DataView]",tm="[object Float32Array]",rm="[object Float64Array]",sm="[object Int8Array]",nm="[object Int16Array]",im="[object Int32Array]",om="[object Uint8Array]",am="[object Uint8ClampedArray]",lm="[object Uint16Array]",cm="[object Uint32Array]";function um(e,r,s){var n=e.constructor;switch(r){case Qp:return Lr(e);case zp:case Vp:return new n(+e);case em:return da(e,s);case tm:case rm:case sm:case nm:case im:case om:case am:case lm:case cm:return Ea(e,s);case Hp:return new n;case Yp:case Jp:return new n(e);case Xp:return pa(e);case qp:return new n;case Zp:return Ta(e)}}var ya=um;var Aa=Object.create,fm=function(){function e(){}return function(r){if(!ne(r))return{};if(Aa)return Aa(r);e.prototype=r;var s=new e;return e.prototype=void 0,s}}(),xa=fm;function hm(e){return typeof e.constructor=="function"&&!ct(e)?xa($s(e)):{}}var Sa=hm;var dm="[object Map]";function pm(e){return ue(e)&&rt(e)==dm}var Ra=pm;var Oa=He&&He.isMap,mm=Oa?ft(Oa):Ra,La=mm;var gm="[object Set]";function Tm(e){return ue(e)&&rt(e)==gm}var Ia=Tm;var Na=He&&He.isSet,Em=Na?ft(Na):Ia,ba=Em;var ym=1,Am=2,xm=4,Ca="[object Arguments]",Sm="[object Array]",Rm="[object Boolean]",Om="[object Date]",Lm="[object Error]",va="[object Function]",Im="[object GeneratorFunction]",Nm="[object Map]",bm="[object Number]",ka="[object Object]",Cm="[object RegExp]",vm="[object Set]",km="[object String]",_m="[object Symbol]",Mm="[object WeakMap]",wm="[object ArrayBuffer]",Pm="[object DataView]",Um="[object Float32Array]",Dm="[object Float64Array]",Fm="[object Int8Array]",Bm="[object Int16Array]",$m="[object Int32Array]",Gm="[object Uint8Array]",Wm="[object Uint8ClampedArray]",jm="[object Uint16Array]",Km="[object Uint32Array]",W={};W[Ca]=W[Sm]=W[wm]=W[Pm]=W[Rm]=W[Om]=W[Um]=W[Dm]=W[Fm]=W[Bm]=W[$m]=W[Nm]=W[bm]=W[ka]=W[Cm]=W[vm]=W[km]=W[_m]=W[Gm]=W[Wm]=W[jm]=W[Km]=!0;W[Lm]=W[va]=W[Mm]=!1;function Hs(e,r,s,n,i,o){var c,u=r&ym,a=r&Am,f=r&xm;if(s)c=i?s(e,n,i,o):s(e);if(c!==void 0)return c;if(!ne(e))return e;var h=L(e);if(h){if(c=ha(e),!u)return ra(e,c)}else{var d=rt(e),p=d==va||d==Im;if(ut(e))return ti(e,u);if(d==ka||d==Ca||p&&!i){if(c=a||p?{}:Sa(e),!u)return a?ia(e,Jo(c,e)):na(e,Yo(c,e))}else{if(!W[d])return i?e:{};c=ya(e,d,u)}}o||(o=new jt);var T=o.get(e);if(T)return T;if(o.set(e,c),ba(e))e.forEach(function(I){c.add(Hs(I,r,s,I,e,o))});else if(La(e))e.forEach(function(I,A){c.set(A,Hs(I,r,s,A,e,o))});var C=f?a?js:ts:a?Kt:B,v=h?void 0:C(e);return Us(v||e,function(I,A){if(v)A=I,I=e[A];_t(c,A,Hs(I,r,s,A,e,o))}),c}var _a=Hs;var zm=4;function Vm(e){return _a(e,zm)}var K=Vm;function Hm(e){var r=-1,s=e==null?0:e.length,n=0,i=[];while(++r<s){var o=e[r];if(o)i[n++]=o}return i}var ht=Hm;var Ma=Object.prototype,Ym=Ma.hasOwnProperty,Xm=pr(function(e,r){e=Object(e);var s=-1,n=r.length,i=n>2?r[2]:void 0;if(i&&Pt(r[0],r[1],i))n=1;while(++s<n){var o=r[s],c=Kt(o),u=-1,a=c.length;while(++u<a){var f=c[u],h=e[f];if(h===void 0||at(h,Ma[f])&&!Ym.call(e,f))e[f]=o[f]}}return e}),Ir=Xm;var qm="__lodash_hash_undefined__";function Jm(e){return this.__data__.set(e,qm),this}var wa=Jm;function Zm(e){return this.__data__.has(e)}var Pa=Zm;function Ys(e){var r=-1,s=e==null?0:e.length;this.__data__=new er;while(++r<s)this.add(e[r])}Ys.prototype.add=Ys.prototype.push=wa;Ys.prototype.has=Pa;var Nr=Ys;function eg(e,r,s,n){var i=e.length,o=s+(n?1:-1);while(n?o--:++o<i)if(r(e[o],o,e))return o;return-1}var Xs=eg;function tg(e){return e!==e}var Ua=tg;function rg(e,r,s){var n=s-1,i=e.length;while(++n<i)if(e[n]===r)return n;return-1}var Da=rg;function sg(e,r,s){return r===r?Da(e,r,s):Xs(e,Ua,s)}var br=sg;function ng(e,r){var s=e==null?0:e.length;return!!s&&br(e,r,0)>-1}var qs=ng;function ig(e,r,s){var n=-1,i=e==null?0:e.length;while(++n<i)if(s(r,e[n]))return!0;return!1}var Js=ig;function og(e,r){var s=-1,n=e==null?0:e.length,i=Array(n);while(++s<n)i[s]=r(e[s],s,e);return i}var dt=og;function ag(e,r){return e.has(r)}var Cr=ag;var lg=200;function cg(e,r,s,n){var i=-1,o=qs,c=!0,u=e.length,a=[],f=r.length;if(!u)return a;if(s)r=dt(r,ft(s));if(n)o=Js,c=!1;else if(r.length>=lg)o=Cr,c=!1,r=new Nr(r);e:while(++i<u){var h=e[i],d=s==null?h:s(h);if(h=n||h!==0?h:0,c&&d===d){var p=f;while(p--)if(r[p]===d)continue e;a.push(h)}else if(!o(r,d,n))a.push(h)}return a}var Fa=cg;var Ba=Oe?Oe.isConcatSpreadable:void 0;function ug(e){return L(e)||Dt(e)||!!(Ba&&e&&e[Ba])}var $a=ug;function Ga(e,r,s,n,i){var o=-1,c=e.length;s||(s=$a),i||(i=[]);while(++o<c){var u=e[o];if(r>0&&s(u))if(r>1)Ga(u,r-1,s,n,i);else Rr(i,u);else if(!n)i[i.length]=u}return i}var vr=Ga;function fg(e){return ue(e)&&me(e)}var ri=fg;var hg=pr(function(e,r){return ri(e)?Fa(e,vr(r,1,ri,!0)):[]}),Ht=hg;function dg(e,r,s){var n=-1,i=e.length;if(r<0)r=-r>i?0:i+r;if(s=s>i?i:s,s<0)s+=i;i=r>s?0:s-r>>>0,r>>>=0;var o=Array(i);while(++n<i)o[n]=e[n+r];return o}var Zs=dg;var pg=/\s/;function mg(e){var r=e.length;while(r--&&pg.test(e.charAt(r)));return r}var Wa=mg;var gg=/^\s+/;function Tg(e){return e?e.slice(0,Wa(e)+1).replace(gg,""):e}var ja=Tg;var Eg="[object Symbol]";function yg(e){return typeof e=="symbol"||ue(e)&&Pe(e)==Eg}var Yt=yg;var Ka=NaN,Ag=/^[-+]0x[0-9a-f]+$/i,xg=/^0b[01]+$/i,Sg=/^0o[0-7]+$/i,Rg=parseInt;function Og(e){if(typeof e=="number")return e;if(Yt(e))return Ka;if(ne(e)){var r=typeof e.valueOf=="function"?e.valueOf():e;e=ne(r)?r+"":r}if(typeof e!="string")return e===0?e:+e;e=ja(e);var s=xg.test(e);return s||Sg.test(e)?Rg(e.slice(2),s?2:8):Ag.test(e)?Ka:+e}var za=Og;var Va=1/0,Lg=179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000;function Ig(e){if(!e)return e===0?e:0;if(e=za(e),e===Va||e===-Va){var r=e<0?-1:1;return r*Lg}return e===e?e:0}var Ha=Ig;function Ng(e){var r=Ha(e),s=r%1;return r===r?s?r-s:r:0}var gt=Ng;function bg(e,r,s){var n=e==null?0:e.length;if(!n)return[];return r=s||r===void 0?1:gt(r),Zs(e,r<0?0:r,n)}var fe=bg;function Cg(e,r,s){var n=e==null?0:e.length;if(!n)return[];return r=s||r===void 0?1:gt(r),r=n-r,Zs(e,0,r<0?0:r)}var Ot=Cg;function vg(e,r){var s=-1,n=e==null?0:e.length;while(++s<n)if(!r(e[s],s,e))return!1;return!0}var Ya=vg;function kg(e){return function(r,s,n){var i=-1,o=Object(r),c=n(r),u=c.length;while(u--){var a=c[e?u:++i];if(s(o[a],a,o)===!1)break}return r}}var Xa=kg;var _g=Xa(),qa=_g;function Mg(e,r){return e&&qa(e,r,B)}var Ja=Mg;function wg(e,r){return function(s,n){if(s==null)return s;if(!me(s))return e(s,n);var i=s.length,o=r?i:-1,c=Object(s);while(r?o--:++o<i)if(n(c[o],o,c)===!1)break;return s}}var Za=wg;var Pg=Za(Ja),Ge=Pg;function Ug(e,r){var s=!0;return Ge(e,function(n,i,o){return s=!!r(n,i,o),s}),s}var Qa=Ug;function Dg(e,r){var s=-1,n=e==null?0:e.length;while(++s<n)if(r(e[s],s,e))return!0;return!1}var Qs=Dg;var Fg=1,Bg=2;function $g(e,r,s,n,i,o){var c=s&Fg,u=e.length,a=r.length;if(u!=a&&!(c&&a>u))return!1;var f=o.get(e),h=o.get(r);if(f&&h)return f==r&&h==e;var d=-1,p=!0,T=s&Bg?new Nr:void 0;o.set(e,r),o.set(r,e);while(++d<u){var C=e[d],v=r[d];if(n)var I=c?n(v,C,d,r,e,o):n(C,v,d,e,r,o);if(I!==void 0){if(I)continue;p=!1;break}if(T){if(!Qs(r,function(A,R){if(!Cr(T,R)&&(C===A||i(C,A,s,n,o)))return T.push(R)})){p=!1;break}}else if(!(C===v||i(C,v,s,n,o))){p=!1;break}}return o.delete(e),o.delete(r),p}var en=$g;function Gg(e){var r=-1,s=Array(e.size);return e.forEach(function(n,i){s[++r]=[i,n]}),s}var el=Gg;function Wg(e){var r=-1,s=Array(e.size);return e.forEach(function(n){s[++r]=n}),s}var kr=Wg;var jg=1,Kg=2,zg="[object Boolean]",Vg="[object Date]",Hg="[object Error]",Yg="[object Map]",Xg="[object Number]",qg="[object RegExp]",Jg="[object Set]",Zg="[object String]",Qg="[object Symbol]",eT="[object ArrayBuffer]",tT="[object DataView]",tl=Oe?Oe.prototype:void 0,si=tl?tl.valueOf:void 0;function rT(e,r,s,n,i,o,c){switch(s){case tT:if(e.byteLength!=r.byteLength||e.byteOffset!=r.byteOffset)return!1;e=e.buffer,r=r.buffer;case eT:if(e.byteLength!=r.byteLength||!o(new Or(e),new Or(r)))return!1;return!0;case zg:case Vg:case Xg:return at(+e,+r);case Hg:return e.name==r.name&&e.message==r.message;case qg:case Zg:return e==r+"";case Yg:var u=el;case Jg:var a=n&jg;if(u||(u=kr),e.size!=r.size&&!a)return!1;var f=c.get(e);if(f)return f==r;n|=Kg,c.set(e,r);var h=en(u(e),u(r),n,i,o,c);return c.delete(e),h;case Qg:if(si)return si.call(e)==si.call(r)}return!1}var rl=rT;var sT=1,nT=Object.prototype,iT=nT.hasOwnProperty;function oT(e,r,s,n,i,o){var c=s&sT,u=ts(e),a=u.length,f=ts(r),h=f.length;if(a!=h&&!c)return!1;var d=a;while(d--){var p=u[d];if(!(c?p in r:iT.call(r,p)))return!1}var T=o.get(e),C=o.get(r);if(T&&C)return T==r&&C==e;var v=!0;o.set(e,r),o.set(r,e);var I=c;while(++d<a){p=u[d];var A=e[p],R=r[p];if(n)var g=c?n(R,A,p,r,e,o):n(A,R,p,e,r,o);if(!(g===void 0?A===R||i(A,R,s,n,o):g)){v=!1;break}I||(I=p=="constructor")}if(v&&!I){var _=e.constructor,Q=r.constructor;if(_!=Q&&(("constructor"in e)&&("constructor"in r))&&!(typeof _=="function"&&_ instanceof _&&typeof Q=="function"&&Q instanceof Q))v=!1}return o.delete(e),o.delete(r),v}var sl=oT;var aT=1,nl="[object Arguments]",il="[object Array]",tn="[object Object]",lT=Object.prototype,ol=lT.hasOwnProperty;function cT(e,r,s,n,i,o){var c=L(e),u=L(r),a=c?il:rt(e),f=u?il:rt(r);a=a==nl?tn:a,f=f==nl?tn:f;var h=a==tn,d=f==tn,p=a==f;if(p&&ut(e)){if(!ut(r))return!1;c=!0,h=!1}if(p&&!h)return o||(o=new jt),c||gr(e)?en(e,r,s,n,i,o):rl(e,r,a,s,n,i,o);if(!(s&aT)){var T=h&&ol.call(e,"__wrapped__"),C=d&&ol.call(r,"__wrapped__");if(T||C){var v=T?e.value():e,I=C?r.value():r;return o||(o=new jt),i(v,I,s,n,o)}}if(!p)return!1;return o||(o=new jt),sl(e,r,s,n,i,o)}var al=cT;function ll(e,r,s,n,i){if(e===r)return!0;if(e==null||r==null||!ue(e)&&!ue(r))return e!==e&&r!==r;return al(e,r,s,n,ll,i)}var rn=ll;var uT=1,fT=2;function hT(e,r,s,n){var i=s.length,o=i,c=!n;if(e==null)return!o;e=Object(e);while(i--){var u=s[i];if(c&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}while(++i<o){u=s[i];var a=u[0],f=e[a],h=u[1];if(c&&u[2]){if(f===void 0&&!(a in e))return!1}else{var d=new jt;if(n)var p=n(f,h,a,e,r,d);if(!(p===void 0?rn(h,f,uT|fT,n,d):p))return!1}}return!0}var cl=hT;function dT(e){return e===e&&!ne(e)}var sn=dT;function pT(e){var r=B(e),s=r.length;while(s--){var n=r[s],i=e[n];r[s]=[n,i,sn(i)]}return r}var ul=pT;function mT(e,r){return function(s){if(s==null)return!1;return s[e]===r&&(r!==void 0||(e in Object(s)))}}var nn=mT;function gT(e){var r=ul(e);if(r.length==1&&r[0][2])return nn(r[0][0],r[0][1]);return function(s){return s===e||cl(s,e,r)}}var fl=gT;var TT=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ET=/^\w*$/;function yT(e,r){if(L(e))return!1;var s=typeof e;if(s=="number"||s=="symbol"||s=="boolean"||e==null||Yt(e))return!0;return ET.test(e)||!TT.test(e)||r!=null&&e in Object(r)}var _r=yT;var AT="Expected a function";function ni(e,r){if(typeof e!="function"||r!=null&&typeof r!="function")throw TypeError(AT);var s=function(){var n=arguments,i=r?r.apply(this,n):n[0],o=s.cache;if(o.has(i))return o.get(i);var c=e.apply(this,n);return s.cache=o.set(i,c)||o,c};return s.cache=new(ni.Cache||er),s}ni.Cache=er;var hl=ni;var xT=500;function ST(e){var r=hl(e,function(n){if(s.size===xT)s.clear();return n}),s=r.cache;return r}var dl=ST;var RT=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,OT=/\\(\\)?/g,LT=dl(function(e){var r=[];if(e.charCodeAt(0)===46)r.push("");return e.replace(RT,function(s,n,i,o){r.push(i?o.replace(OT,"$1"):n||s)}),r}),pl=LT;var IT=1/0,ml=Oe?Oe.prototype:void 0,gl=ml?ml.toString:void 0;function Tl(e){if(typeof e=="string")return e;if(L(e))return dt(e,Tl)+"";if(Yt(e))return gl?gl.call(e):"";var r=e+"";return r=="0"&&1/e==-IT?"-0":r}var El=Tl;function NT(e){return e==null?"":El(e)}var yl=NT;function bT(e,r){if(L(e))return e;return _r(e,r)?[e]:pl(yl(e))}var Xt=bT;var CT=1/0;function vT(e){if(typeof e=="string"||Yt(e))return e;var r=e+"";return r=="0"&&1/e==-CT?"-0":r}var Tt=vT;function kT(e,r){r=Xt(r,e);var s=0,n=r.length;while(e!=null&&s<n)e=e[Tt(r[s++])];return s&&s==n?e:void 0}var Mr=kT;function _T(e,r,s){var n=e==null?void 0:Mr(e,r);return n===void 0?s:n}var Al=_T;function MT(e,r){return e!=null&&r in Object(e)}var xl=MT;function wT(e,r,s){r=Xt(r,e);var n=-1,i=r.length,o=!1;while(++n<i){var c=Tt(r[n]);if(!(o=e!=null&&s(e,c)))break;e=e[c]}if(o||++n!=i)return o;return i=e==null?0:e.length,!!i&&mr(i)&&Mt(c,i)&&(L(e)||Dt(e))}var on=wT;function PT(e,r){return e!=null&&on(e,r,xl)}var Sl=PT;var UT=1,DT=2;function FT(e,r){if(_r(e)&&sn(r))return nn(Tt(e),r);return function(s){var n=Al(s,e);return n===void 0&&n===r?Sl(s,e):rn(r,n,UT|DT)}}var Rl=FT;function BT(e){return function(r){return r==null?void 0:r[e]}}var Ol=BT;function $T(e){return function(r){return Mr(r,e)}}var Ll=$T;function GT(e){return _r(e)?Ol(Tt(e)):Ll(e)}var Il=GT;function WT(e){if(typeof e=="function")return e;if(e==null)return tt;if(typeof e=="object")return L(e)?Rl(e[0],e[1]):fl(e);return Il(e)}var ge=WT;function jT(e,r,s){var n=L(e)?Ya:Qa;if(s&&Pt(e,r,s))r=void 0;return n(e,ge(r,3))}var ve=jT;function KT(e,r){var s=[];return Ge(e,function(n,i,o){if(r(n,i,o))s.push(n)}),s}var an=KT;function zT(e,r){var s=L(e)?xr:an;return s(e,ge(r,3))}var ke=zT;function VT(e){return function(r,s,n){var i=Object(r);if(!me(r)){var o=ge(s,3);r=B(r),s=function(u){return o(i[u],u,i)}}var c=e(r,s,n);return c>-1?i[o?r[c]:c]:void 0}}var Nl=VT;var HT=Math.max;function YT(e,r,s){var n=e==null?0:e.length;if(!n)return-1;var i=s==null?0:gt(s);if(i<0)i=HT(n+i,0);return Xs(e,ge(r,3),i)}var bl=YT;var XT=Nl(bl),Et=XT;function qT(e){return e&&e.length?e[0]:void 0}var Le=qT;function JT(e,r){var s=-1,n=me(e)?Array(e.length):[];return Ge(e,function(i,o,c){n[++s]=r(i,o,c)}),n}var Cl=JT;function ZT(e,r){var s=L(e)?dt:Cl;return s(e,ge(r,3))}var y=ZT;function QT(e,r){return vr(y(e,r),1)}var De=QT;function eE(e){var r=e==null?0:e.length;return r?vr(e,1):[]}var xe=eE;function tE(e){return typeof e=="function"?e:tt}var vl=tE;function rE(e,r){var s=L(e)?Us:Ge;return s(e,vl(r))}var x=rE;function sE(e,r,s,n){var i=-1,o=e==null?0:e.length;while(++i<o){var c=e[i];r(n,c,s(c),e)}return n}var kl=sE;function nE(e,r,s,n){return Ge(e,function(i,o,c){r(n,i,s(i),c)}),n}var _l=nE;function iE(e,r){return function(s,n){var i=L(s)?kl:_l,o=r?r():{};return i(s,e,ge(n,2),o)}}var Ml=iE;var oE=Object.prototype,aE=oE.hasOwnProperty,lE=Ml(function(e,r,s){if(aE.call(e,s))e[s].push(r);else dr(e,s,[r])}),ii=lE;var cE=Object.prototype,uE=cE.hasOwnProperty;function fE(e,r){return e!=null&&uE.call(e,r)}var wl=fE;function hE(e,r){return e!=null&&on(e,r,wl)}var S=hE;var dE="[object String]";function pE(e){return typeof e=="string"||!L(e)&&ue(e)&&Pe(e)==dE}var Se=pE;function mE(e,r){return dt(r,function(s){return e[s]})}var Pl=mE;function gE(e){return e==null?[]:Pl(e,B(e))}var D=gE;var TE=Math.max;function EE(e,r,s,n){e=me(e)?e:D(e),s=s&&!n?gt(s):0;var i=e.length;if(s<0)s=TE(i+s,0);return Se(e)?s<=i&&e.indexOf(r,s)>-1:!!i&&br(e,r,s)>-1}var ee=EE;var yE=Math.max;function AE(e,r,s){var n=e==null?0:e.length;if(!n)return-1;var i=s==null?0:gt(s);if(i<0)i=yE(n+i,0);return br(e,r,i)}var ln=AE;var xE="[object Map]",SE="[object Set]",RE=Object.prototype,OE=RE.hasOwnProperty;function LE(e){if(e==null)return!0;if(me(e)&&(L(e)||typeof e=="string"||typeof e.splice=="function"||ut(e)||gr(e)||Dt(e)))return!e.length;var r=rt(e);if(r==xE||r==SE)return!e.size;if(ct(e))return!Ps(e).length;for(var s in e)if(OE.call(e,s))return!1;return!0}var M=LE;var IE="[object RegExp]";function NE(e){return ue(e)&&Pe(e)==IE}var Ul=NE;var Dl=He&&He.isRegExp,bE=Dl?ft(Dl):Ul,qe=bE;function CE(e){return e===void 0}var _e=CE;function vE(e){var r=e==null?0:e.length;return r?e[r-1]:void 0}var st=vE;function kE(){}var le=kE;function _E(e,r,s,n){if(!ne(e))return e;r=Xt(r,e);var i=-1,o=r.length,c=o-1,u=e;while(u!=null&&++i<o){var a=Tt(r[i]),f=s;if(a==="__proto__"||a==="constructor"||a==="prototype")return e;if(i!=c){var h=u[a];if(f=n?n(h,a,u):void 0,f===void 0)f=ne(h)?h:Mt(r[i+1])?[]:{}}_t(u,a,f),u=u[a]}return e}var Fl=_E;function ME(e,r,s){var n=-1,i=r.length,o={};while(++n<i){var c=r[n],u=Mr(e,c);if(s(u,c))Fl(o,Xt(c,e),u)}return o}var Bl=ME;function wE(e,r){if(e==null)return{};var s=dt(js(e),function(n){return[n]});return r=ge(r),Bl(e,s,function(n,i){return r(n,i[0])})}var We=wE;function PE(e,r,s,n){var i=-1,o=e==null?0:e.length;if(n&&o)s=e[++i];while(++i<o)s=r(s,e[i],i,e);return s}var $l=PE;function UE(e,r,s,n,i){return i(e,function(o,c,u){s=n?(n=!1,o):r(s,o,c,u)}),s}var Gl=UE;function DE(e,r,s){var n=L(e)?$l:Gl,i=arguments.length<3;return n(e,ge(r,4),s,i,Ge)}var Te=DE;var FE="Expected a function";function BE(e){if(typeof e!="function")throw TypeError(FE);return function(){var r=arguments;switch(r.length){case 0:return!e.call(this);case 1:return!e.call(this,r[0]);case 2:return!e.call(this,r[0],r[1]);case 3:return!e.call(this,r[0],r[1],r[2])}return!e.apply(this,r)}}var Wl=BE;function $E(e,r){var s=L(e)?xr:an;return s(e,Wl(ge(r,3)))}var qt=$E;function GE(e,r){var s;return Ge(e,function(n,i,o){return s=r(n,i,o),!s}),!!s}var jl=GE;function WE(e,r,s){var n=L(e)?Qs:jl;if(s&&Pt(e,r,s))r=void 0;return n(e,ge(r,3))}var rs=WE;var jE=1/0,KE=!(Vt&&1/kr(new Vt([,-0]))[1]==jE)?le:function(e){return new Vt(e)},Kl=KE;var zE=200;function VE(e,r,s){var n=-1,i=qs,o=e.length,c=!0,u=[],a=u;if(s)c=!1,i=Js;else if(o>=zE){var f=r?null:Kl(e);if(f)return kr(f);c=!1,i=Cr,a=new Nr}else a=r?[]:u;e:while(++n<o){var h=e[n],d=r?r(h):h;if(h=s||h!==0?h:0,c&&d===d){var p=a.length;while(p--)if(a[p]===d)continue e;if(r)a.push(d);u.push(h)}else if(!i(a,d,s)){if(a!==u)a.push(d);u.push(h)}}return u}var zl=VE;function HE(e){return e&&e.length?zl(e):[]}var wr=HE;function Pr(e){if(console&&console.error)console.error(`Error: ${e}`)}function ss(e){if(console&&console.warn)console.warn(`Warning: ${e}`)}function ns(e){let r=new Date().getTime(),s=e();return{time:new Date().getTime()-r,value:s}}function is(e){function r(){}r.prototype=e;let s=new r;function n(){return typeof s.bar}return n(),n(),e;(0,eval)(e)}function YE(e){if(XE(e))return e.LABEL;else return e.name}function XE(e){return Se(e.LABEL)&&e.LABEL!==""}class Je{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),x(this.definition,(r)=>{r.accept(e)})}}class J extends Je{constructor(e){super([]);this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}set definition(e){}get definition(){if(this.referencedRule!==void 0)return this.referencedRule.definition;return[]}accept(e){e.visit(this)}}class je extends Je{constructor(e){super(e.definition);this.orgText="",Ne(this,We(e,(r)=>r!==void 0))}}class Z extends Je{constructor(e){super(e.definition);this.ignoreAmbiguities=!1,Ne(this,We(e,(r)=>r!==void 0))}}class re extends Je{constructor(e){super(e.definition);this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}}class Ee extends Je{constructor(e){super(e.definition);this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}}class ye extends Je{constructor(e){super(e.definition);this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}}class U extends Je{constructor(e){super(e.definition);this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}}class he extends Je{constructor(e){super(e.definition);this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}}class de extends Je{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition);this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,Ne(this,We(e,(r)=>r!==void 0))}}class w{constructor(e){this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}accept(e){e.visit(this)}}function cn(e){return y(e,Ur)}function Ur(e){function r(s){return y(s,Ur)}if(e instanceof J){let s={type:"NonTerminal",name:e.nonTerminalName,idx:e.idx};if(Se(e.label))s.label=e.label;return s}else if(e instanceof Z)return{type:"Alternative",definition:r(e.definition)};else if(e instanceof re)return{type:"Option",idx:e.idx,definition:r(e.definition)};else if(e instanceof Ee)return{type:"RepetitionMandatory",idx:e.idx,definition:r(e.definition)};else if(e instanceof ye)return{type:"RepetitionMandatoryWithSeparator",idx:e.idx,separator:Ur(new w({terminalType:e.separator})),definition:r(e.definition)};else if(e instanceof he)return{type:"RepetitionWithSeparator",idx:e.idx,separator:Ur(new w({terminalType:e.separator})),definition:r(e.definition)};else if(e instanceof U)return{type:"Repetition",idx:e.idx,definition:r(e.definition)};else if(e instanceof de)return{type:"Alternation",idx:e.idx,definition:r(e.definition)};else if(e instanceof w){let s={type:"Terminal",name:e.terminalType.name,label:YE(e.terminalType),idx:e.idx};if(Se(e.label))s.terminalLabel=e.label;let n=e.terminalType.PATTERN;if(e.terminalType.PATTERN)s.pattern=qe(n)?n.source:n;return s}else if(e instanceof je)return{type:"Rule",name:e.name,orgText:e.orgText,definition:r(e.definition)};else throw Error("non exhaustive match")}class Ke{visit(e){let r=e;switch(r.constructor){case J:return this.visitNonTerminal(r);case Z:return this.visitAlternative(r);case re:return this.visitOption(r);case Ee:return this.visitRepetitionMandatory(r);case ye:return this.visitRepetitionMandatoryWithSeparator(r);case he:return this.visitRepetitionWithSeparator(r);case U:return this.visitRepetition(r);case de:return this.visitAlternation(r);case w:return this.visitTerminal(r);case je:return this.visitRule(r);default:throw Error("non exhaustive match")}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}}function oi(e){return e instanceof Z||e instanceof re||e instanceof U||e instanceof Ee||e instanceof ye||e instanceof he||e instanceof w||e instanceof je}function rr(e,r=[]){if(e instanceof re||e instanceof U||e instanceof he)return!0;if(e instanceof de)return rs(e.definition,(n)=>rr(n,r));else if(e instanceof J&&ee(r,e))return!1;else if(e instanceof Je){if(e instanceof J)r.push(e);return ve(e.definition,(n)=>rr(n,r))}else return!1}function ai(e){return e instanceof de}function ze(e){if(e instanceof J)return"SUBRULE";else if(e instanceof re)return"OPTION";else if(e instanceof de)return"OR";else if(e instanceof Ee)return"AT_LEAST_ONE";else if(e instanceof ye)return"AT_LEAST_ONE_SEP";else if(e instanceof he)return"MANY_SEP";else if(e instanceof U)return"MANY";else if(e instanceof w)return"CONSUME";else throw Error("non exhaustive match")}class Jt{walk(e,r=[]){x(e.definition,(s,n)=>{let i=fe(e.definition,n+1);if(s instanceof J)this.walkProdRef(s,i,r);else if(s instanceof w)this.walkTerminal(s,i,r);else if(s instanceof Z)this.walkFlat(s,i,r);else if(s instanceof re)this.walkOption(s,i,r);else if(s instanceof Ee)this.walkAtLeastOne(s,i,r);else if(s instanceof ye)this.walkAtLeastOneSep(s,i,r);else if(s instanceof he)this.walkManySep(s,i,r);else if(s instanceof U)this.walkMany(s,i,r);else if(s instanceof de)this.walkOr(s,i,r);else throw Error("non exhaustive match")})}walkTerminal(e,r,s){}walkProdRef(e,r,s){}walkFlat(e,r,s){let n=r.concat(s);this.walk(e,n)}walkOption(e,r,s){let n=r.concat(s);this.walk(e,n)}walkAtLeastOne(e,r,s){let n=[new re({definition:e.definition})].concat(r,s);this.walk(e,n)}walkAtLeastOneSep(e,r,s){let n=Vl(e,r,s);this.walk(e,n)}walkMany(e,r,s){let n=[new re({definition:e.definition})].concat(r,s);this.walk(e,n)}walkManySep(e,r,s){let n=Vl(e,r,s);this.walk(e,n)}walkOr(e,r,s){let n=r.concat(s);x(e.definition,(i)=>{let o=new Z({definition:[i]});this.walk(o,n)})}}function Vl(e,r,s){return[new re({definition:[new w({terminalType:e.separator})].concat(e.definition)})].concat(r,s)}function sr(e){if(e instanceof J)return sr(e.referencedRule);else if(e instanceof w)return ZE(e);else if(oi(e))return qE(e);else if(ai(e))return JE(e);else throw Error("non exhaustive match")}function qE(e){let r=[],s=e.definition,n=0,i=s.length>n,o,c=!0;while(i&&c)o=s[n],c=rr(o),r=r.concat(sr(o)),n=n+1,i=s.length>n;return wr(r)}function JE(e){let r=y(e.definition,(s)=>sr(s));return wr(xe(r))}function ZE(e){return[e.terminalType]}var un="_~IN~_";class Hl extends Jt{constructor(e){super();this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,r,s){}walkProdRef(e,r,s){let n=QE(e.referencedRule,e.idx)+this.topProd.name,i=r.concat(s),o=new Z({definition:i}),c=sr(o);this.follows[n]=c}}function Yl(e){let r={};return x(e,(s)=>{let n=new Hl(s).startWalking();Ne(r,n)}),r}function QE(e,r){return e.name+r+un}function k(e){return e.charCodeAt(0)}function fn(e,r){if(Array.isArray(e))e.forEach(function(s){r.push(s)});else r.push(e)}function Dr(e,r){if(e[r]===!0)throw"duplicate flag "+r;let s=e[r];e[r]=!0}function nr(e){if(e===void 0)throw Error("Internal Error - Should never get here!");return!0}function os(){throw Error("Internal Error - Should never get here!")}function li(e){return e.type==="Character"}var as=[];for(let e=k("0");e<=k("9");e++)as.push(e);var ls=[k("_")].concat(as);for(let e=k("a");e<=k("z");e++)ls.push(e);for(let e=k("A");e<=k("Z");e++)ls.push(e);var ci=[k(" "),k("\f"),k(`
|
|
2
|
-
`),
|
|
3
|
-
`),
|
|
4
|
-
`);break;case"r":e=
|
|
5
|
-
`:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:let e=this.popChar();return{type:"Character",value:
|
|
6
|
-
`:case"\r":case"\u2028":case"\u2029":throw Error("TBD");case"\\":return this.classEscape();default:return this.classPatternCharacterAtom()}}classEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"b":return this.consumeChar("b"),{type:"Character",value:
|
|
7
|
-
`:case"\r":case"\u2028":case"\u2029":case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":throw Error("TBD");default:return{type:"Character",value:
|
|
1
|
+
import{t,l,Y,C,te,F,z,j,U,H,W,q,m,b,V,Mm,wt,mt,ft,sa,zt,Ut,Gt,Ct}from"./index-gwgh27h3.js";import{Sn}from"./index-v88m5sva.js";var vs={};Sn(vs,{default:()=>ut});var _s={};Sn(_s,{default:()=>He});var Fs={};Sn(Fs,{default:()=>ti});var df=typeof global=="object"&&global&&global.Object===Object&&global,Ns=df;var pf=typeof self=="object"&&self&&self.Object===Object&&self,mf=Ns||pf||Function("return this")(),pe=mf;var gf=pe.Symbol,Oe=gf;var eo=Object.prototype,{hasOwnProperty:Tf,toString:Ef}=eo,Qr=Oe?Oe.toStringTag:void 0;function yf(e){var r=Tf.call(e,Qr),s=e[Qr];try{e[Qr]=void 0;var n=!0}catch(o){}var i=Ef.call(e);if(n)if(r)e[Qr]=s;else delete e[Qr];return i}var to=yf;var Af=Object.prototype,xf=Af.toString;function Sf(e){return xf.call(e)}var ro=Sf;var Rf="[object Null]",Of="[object Undefined]",so=Oe?Oe.toStringTag:void 0;function Lf(e){if(e==null)return e===void 0?Of:Rf;return so&&so in Object(e)?to(e):ro(e)}var Pe=Lf;function If(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}var ne=If;var Nf="[object AsyncFunction]",bf="[object Function]",Cf="[object GeneratorFunction]",vf="[object Proxy]";function kf(e){if(!ne(e))return!1;var r=Pe(e);return r==bf||r==Cf||r==Nf||r==vf}var Ue=kf;var _f=pe["__core-js_shared__"],bs=_f;var no=function(){var e=/[^.]+$/.exec(bs&&bs.keys&&bs.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Mf(e){return!!no&&no in e}var io=Mf;var wf=Function.prototype,Pf=wf.toString;function Uf(e){if(e!=null){try{return Pf.call(e)}catch(r){}try{return e+""}catch(r){}}return""}var St=Uf;var Df=/[\\^$.*+?()[\]{}|]/g,Ff=/^\[object .+?Constructor\]$/,Bf=Function.prototype,$f=Object.prototype,Gf=Bf.toString,Wf=$f.hasOwnProperty,jf=RegExp("^"+Gf.call(Wf).replace(Df,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Kf(e){if(!ne(e)||io(e))return!1;var r=Ue(e)?jf:Ff;return r.test(St(e))}var oo=Kf;function zf(e,r){return e==null?void 0:e[r]}var ao=zf;function Vf(e,r){var s=ao(e,r);return oo(s)?s:void 0}var $e=Vf;var Hf=function(){try{var e=$e(Object,"defineProperty");return e({},"",{}),e}catch(r){}}(),hr=Hf;function Yf(e,r,s){if(r=="__proto__"&&hr)hr(e,r,{configurable:!0,enumerable:!0,value:s,writable:!0});else e[r]=s}var dr=Yf;function Xf(e,r){return e===r||e!==e&&r!==r}var at=Xf;var qf=Object.prototype,Jf=qf.hasOwnProperty;function Zf(e,r,s){var n=e[r];if(!(Jf.call(e,r)&&at(n,s))||s===void 0&&!(r in e))dr(e,r,s)}var _t=Zf;function Qf(e,r,s,n){var i=!s;s||(s={});var o=-1,c=r.length;while(++o<c){var u=r[o],a=n?n(s[u],e[u],u,s,e):void 0;if(a===void 0)a=e[u];if(i)dr(s,u,a);else _t(s,u,a)}return s}var lt=Qf;function eh(e){return e}var tt=eh;function th(e,r,s){switch(s.length){case 0:return e.call(r);case 1:return e.call(r,s[0]);case 2:return e.call(r,s[0],s[1]);case 3:return e.call(r,s[0],s[1],s[2])}return e.apply(r,s)}var lo=th;var co=Math.max;function rh(e,r,s){return r=co(r===void 0?e.length-1:r,0),function(){var n=arguments,i=-1,o=co(n.length-r,0),c=Array(o);while(++i<o)c[i]=n[r+i];i=-1;var u=Array(r+1);while(++i<r)u[i]=n[i];return u[r]=s(c),lo(e,this,u)}}var uo=rh;function sh(e){return function(){return e}}var fo=sh;var nh=!hr?tt:function(e,r){return hr(e,"toString",{configurable:!0,enumerable:!1,value:fo(r),writable:!0})},ho=nh;var ih=800,oh=16,ah=Date.now;function lh(e){var r=0,s=0;return function(){var n=ah(),i=oh-(n-s);if(s=n,i>0){if(++r>=ih)return arguments[0]}else r=0;return e.apply(void 0,arguments)}}var po=lh;var ch=po(ho),mo=ch;function uh(e,r){return mo(uo(e,r,tt),e+"")}var pr=uh;var fh=9007199254740991;function hh(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=fh}var mr=hh;function dh(e){return e!=null&&mr(e.length)&&!Ue(e)}var me=dh;var ph=9007199254740991,mh=/^(?:0|[1-9]\d*)$/;function gh(e,r){var s=typeof e;return r=r==null?ph:r,!!r&&(s=="number"||s!="symbol"&&mh.test(e))&&(e>-1&&e%1==0&&e<r)}var Mt=gh;function Th(e,r,s){if(!ne(s))return!1;var n=typeof r;if(n=="number"?me(s)&&Mt(r,s.length):n=="string"&&(r in s))return at(s[r],e);return!1}var Pt=Th;function Eh(e){return pr(function(r,s){var n=-1,i=s.length,o=i>1?s[i-1]:void 0,c=i>2?s[2]:void 0;if(o=e.length>3&&typeof o=="function"?(i--,o):void 0,c&&Pt(s[0],s[1],c))o=i<3?void 0:o,i=1;r=Object(r);while(++n<i){var u=s[n];if(u)e(r,u,n,o)}return r})}var go=Eh;var yh=Object.prototype;function Ah(e){var r=e&&e.constructor,s=typeof r=="function"&&r.prototype||yh;return e===s}var ct=Ah;function xh(e,r){var s=-1,n=Array(e);while(++s<e)n[s]=r(s);return n}var To=xh;function Sh(e){return e!=null&&typeof e=="object"}var ue=Sh;var Rh="[object Arguments]";function Oh(e){return ue(e)&&Pe(e)==Rh}var Zn=Oh;var Eo=Object.prototype,{hasOwnProperty:Lh,propertyIsEnumerable:Ih}=Eo,Nh=Zn(function(){return arguments}())?Zn:function(e){return ue(e)&&Lh.call(e,"callee")&&!Ih.call(e,"callee")},Dt=Nh;var bh=Array.isArray,R=bh;function Ch(){return!1}var yo=Ch;var So=typeof vs=="object"&&vs&&!vs.nodeType&&vs,Ao=So&&typeof Cs=="object"&&Cs&&!Cs.nodeType&&Cs,vh=Ao&&Ao.exports===So,xo=vh?pe.Buffer:void 0,kh=xo?xo.isBuffer:void 0,_h=kh||yo,ut=_h;var Mh="[object Arguments]",wh="[object Array]",Ph="[object Boolean]",Uh="[object Date]",Dh="[object Error]",Fh="[object Function]",Bh="[object Map]",$h="[object Number]",Gh="[object Object]",Wh="[object RegExp]",jh="[object Set]",Kh="[object String]",zh="[object WeakMap]",Vh="[object ArrayBuffer]",Hh="[object DataView]",Yh="[object Float32Array]",Xh="[object Float64Array]",qh="[object Int8Array]",Jh="[object Int16Array]",Zh="[object Int32Array]",Qh="[object Uint8Array]",ed="[object Uint8ClampedArray]",td="[object Uint16Array]",rd="[object Uint32Array]",X={};X[Yh]=X[Xh]=X[qh]=X[Jh]=X[Zh]=X[Qh]=X[ed]=X[td]=X[rd]=!0;X[Mh]=X[wh]=X[Vh]=X[Ph]=X[Hh]=X[Uh]=X[Dh]=X[Fh]=X[Bh]=X[$h]=X[Gh]=X[Wh]=X[jh]=X[Kh]=X[zh]=!1;function sd(e){return ue(e)&&mr(e.length)&&!!X[Pe(e)]}var Ro=sd;function nd(e){return function(r){return e(r)}}var ht=nd;var Oo=typeof _s=="object"&&_s&&!_s.nodeType&&_s,es=Oo&&typeof ks=="object"&&ks&&!ks.nodeType&&ks,id=es&&es.exports===Oo,Qn=id&&Ns.process,od=function(){try{var e=es&&es.require&&es.require("util").types;if(e)return e;return Qn&&Qn.binding&&Qn.binding("util")}catch(r){}}(),He=od;var Lo=He&&He.isTypedArray,ad=Lo?ht(Lo):Ro,gr=ad;var ld=Object.prototype,cd=ld.hasOwnProperty;function ud(e,r){var s=R(e),n=!s&&Dt(e),i=!s&&!n&&ut(e),o=!s&&!n&&!i&&gr(e),c=s||n||i||o,u=c?To(e.length,String):[],a=u.length;for(var f in e)if((r||cd.call(e,f))&&!(c&&(f=="length"||i&&(f=="offset"||f=="parent")||o&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||Mt(f,a))))u.push(f);return u}var Ms=ud;function fd(e,r){return function(s){return e(r(s))}}var ws=fd;var hd=ws(Object.keys,Object),Io=hd;var dd=Object.prototype,pd=dd.hasOwnProperty;function md(e){if(!ct(e))return Io(e);var r=[];for(var s in Object(e))if(pd.call(e,s)&&s!="constructor")r.push(s);return r}var Ps=md;function gd(e){return me(e)?Ms(e):Ps(e)}var B=gd;var Td=Object.prototype,Ed=Td.hasOwnProperty,yd=go(function(e,r){if(ct(r)||me(r)){lt(r,B(r),e);return}for(var s in r)if(Ed.call(r,s))_t(e,s,r[s])}),Ne=yd;function Ad(){this.__data__=[],this.size=0}var No=Ad;function xd(e,r){var s=e.length;while(s--)if(at(e[s][0],r))return s;return-1}var Ft=xd;var Sd=Array.prototype,Rd=Sd.splice;function Od(e){var r=this.__data__,s=Ft(r,e);if(s<0)return!1;var n=r.length-1;if(s==n)r.pop();else Rd.call(r,s,1);return--this.size,!0}var bo=Od;function Ld(e){var r=this.__data__,s=Ft(r,e);return s<0?void 0:r[s][1]}var Co=Ld;function Id(e){return Ft(this.__data__,e)>-1}var vo=Id;function Nd(e,r){var s=this.__data__,n=Ft(s,e);if(n<0)++this.size,s.push([e,r]);else s[n][1]=r;return this}var ko=Nd;function Tr(e){var r=-1,s=e==null?0:e.length;this.clear();while(++r<s){var n=e[r];this.set(n[0],n[1])}}Tr.prototype.clear=No;Tr.prototype.delete=bo;Tr.prototype.get=Co;Tr.prototype.has=vo;Tr.prototype.set=ko;var Bt=Tr;function bd(){this.__data__=new Bt,this.size=0}var _o=bd;function Cd(e){var r=this.__data__,s=r.delete(e);return this.size=r.size,s}var Mo=Cd;function vd(e){return this.__data__.get(e)}var wo=vd;function kd(e){return this.__data__.has(e)}var Po=kd;var _d=$e(pe,"Map"),$t=_d;var Md=$e(Object,"create"),Rt=Md;function wd(){this.__data__=Rt?Rt(null):{},this.size=0}var Uo=wd;function Pd(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}var Do=Pd;var Ud="__lodash_hash_undefined__",Dd=Object.prototype,Fd=Dd.hasOwnProperty;function Bd(e){var r=this.__data__;if(Rt){var s=r[e];return s===Ud?void 0:s}return Fd.call(r,e)?r[e]:void 0}var Fo=Bd;var $d=Object.prototype,Gd=$d.hasOwnProperty;function Wd(e){var r=this.__data__;return Rt?r[e]!==void 0:Gd.call(r,e)}var Bo=Wd;var jd="__lodash_hash_undefined__";function Kd(e,r){var s=this.__data__;return this.size+=this.has(e)?0:1,s[e]=Rt&&r===void 0?jd:r,this}var $o=Kd;function Er(e){var r=-1,s=e==null?0:e.length;this.clear();while(++r<s){var n=e[r];this.set(n[0],n[1])}}Er.prototype.clear=Uo;Er.prototype.delete=Do;Er.prototype.get=Fo;Er.prototype.has=Bo;Er.prototype.set=$o;var ei=Er;function zd(){this.size=0,this.__data__={hash:new ei,map:new($t||Bt),string:new ei}}var Go=zd;function Vd(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}var Wo=Vd;function Hd(e,r){var s=e.__data__;return Wo(r)?s[typeof r=="string"?"string":"hash"]:s.map}var Wt=Hd;function Yd(e){var r=Wt(this,e).delete(e);return this.size-=r?1:0,r}var jo=Yd;function Xd(e){return Wt(this,e).get(e)}var Ko=Xd;function qd(e){return Wt(this,e).has(e)}var zo=qd;function Jd(e,r){var s=Wt(this,e),n=s.size;return s.set(e,r),this.size+=s.size==n?0:1,this}var Vo=Jd;function yr(e){var r=-1,s=e==null?0:e.length;this.clear();while(++r<s){var n=e[r];this.set(n[0],n[1])}}yr.prototype.clear=Go;yr.prototype.delete=jo;yr.prototype.get=Ko;yr.prototype.has=zo;yr.prototype.set=Vo;var er=yr;var Zd=200;function Qd(e,r){var s=this.__data__;if(s instanceof Bt){var n=s.__data__;if(!$t||n.length<Zd-1)return n.push([e,r]),this.size=++s.size,this;s=this.__data__=new er(n)}return s.set(e,r),this.size=s.size,this}var Ho=Qd;function Ar(e){var r=this.__data__=new Bt(e);this.size=r.size}Ar.prototype.clear=_o;Ar.prototype.delete=Mo;Ar.prototype.get=wo;Ar.prototype.has=Po;Ar.prototype.set=Ho;var jt=Ar;function ep(e,r){var s=-1,n=e==null?0:e.length;while(++s<n)if(r(e[s],s,e)===!1)break;return e}var Us=ep;function tp(e,r){return e&<(r,B(r),e)}var Yo=tp;function rp(e){var r=[];if(e!=null)for(var s in Object(e))r.push(s);return r}var Xo=rp;var sp=Object.prototype,np=sp.hasOwnProperty;function ip(e){if(!ne(e))return Xo(e);var r=ct(e),s=[];for(var n in e)if(!(n=="constructor"&&(r||!np.call(e,n))))s.push(n);return s}var qo=ip;function op(e){return me(e)?Ms(e,!0):qo(e)}var Kt=op;function ap(e,r){return e&<(r,Kt(r),e)}var Jo=ap;var ta=typeof Fs=="object"&&Fs&&!Fs.nodeType&&Fs,Zo=ta&&typeof Ds=="object"&&Ds&&!Ds.nodeType&&Ds,lp=Zo&&Zo.exports===ta,Qo=lp?pe.Buffer:void 0,ea=Qo?Qo.allocUnsafe:void 0;function cp(e,r){if(r)return e.slice();var s=e.length,n=ea?ea(s):new e.constructor(s);return e.copy(n),n}var ti=cp;function up(e,r){var s=-1,n=e.length;r||(r=Array(n));while(++s<n)r[s]=e[s];return r}var ra=up;function fp(e,r){var s=-1,n=e==null?0:e.length,i=0,o=[];while(++s<n){var c=e[s];if(r(c,s,e))o[i++]=c}return o}var xr=fp;function hp(){return[]}var Bs=hp;var dp=Object.prototype,pp=dp.propertyIsEnumerable,na=Object.getOwnPropertySymbols,mp=!na?Bs:function(e){if(e==null)return[];return e=Object(e),xr(na(e),function(r){return pp.call(e,r)})},Sr=mp;function gp(e,r){return lt(e,Sr(e),r)}var ia=gp;function Tp(e,r){var s=-1,n=r.length,i=e.length;while(++s<n)e[i+s]=r[s];return e}var Rr=Tp;var Ep=ws(Object.getPrototypeOf,Object),$s=Ep;var yp=Object.getOwnPropertySymbols,Ap=!yp?Bs:function(e){var r=[];while(e)Rr(r,Sr(e)),e=$s(e);return r},Gs=Ap;function xp(e,r){return lt(e,Gs(e),r)}var oa=xp;function Sp(e,r,s){var n=r(e);return R(e)?n:Rr(n,s(e))}var Ws=Sp;function Rp(e){return Ws(e,B,Sr)}var ts=Rp;function Op(e){return Ws(e,Kt,Gs)}var js=Op;var Lp=$e(pe,"DataView"),Ks=Lp;var Ip=$e(pe,"Promise"),zs=Ip;var Np=$e(pe,"Set"),Vt=Np;var bp=$e(pe,"WeakMap"),Vs=bp;var aa="[object Map]",Cp="[object Object]",la="[object Promise]",ca="[object Set]",ua="[object WeakMap]",fa="[object DataView]",vp=St(Ks),kp=St($t),_p=St(zs),Mp=St(Vt),wp=St(Vs),tr=Pe;if(Ks&&tr(new Ks(new ArrayBuffer(1)))!=fa||$t&&tr(new $t)!=aa||zs&&tr(zs.resolve())!=la||Vt&&tr(new Vt)!=ca||Vs&&tr(new Vs)!=ua)tr=function(e){var r=Pe(e),s=r==Cp?e.constructor:void 0,n=s?St(s):"";if(n)switch(n){case vp:return fa;case kp:return aa;case _p:return la;case Mp:return ca;case wp:return ua}return r};var rt=tr;var Pp=Object.prototype,Up=Pp.hasOwnProperty;function Dp(e){var r=e.length,s=new e.constructor(r);if(r&&typeof e[0]=="string"&&Up.call(e,"index"))s.index=e.index,s.input=e.input;return s}var ha=Dp;var Fp=pe.Uint8Array,Or=Fp;function Bp(e){var r=new e.constructor(e.byteLength);return new Or(r).set(new Or(e)),r}var Lr=Bp;function $p(e,r){var s=r?Lr(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.byteLength)}var da=$p;var Gp=/\w*$/;function Wp(e){var r=new e.constructor(e.source,Gp.exec(e));return r.lastIndex=e.lastIndex,r}var pa=Wp;var ma=Oe?Oe.prototype:void 0,ga=ma?ma.valueOf:void 0;function jp(e){return ga?Object(ga.call(e)):{}}var Ta=jp;function Kp(e,r){var s=r?Lr(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.length)}var Ea=Kp;var zp="[object Boolean]",Vp="[object Date]",Hp="[object Map]",Yp="[object Number]",Xp="[object RegExp]",qp="[object Set]",Jp="[object String]",Zp="[object Symbol]",Qp="[object ArrayBuffer]",em="[object DataView]",tm="[object Float32Array]",rm="[object Float64Array]",sm="[object Int8Array]",nm="[object Int16Array]",im="[object Int32Array]",om="[object Uint8Array]",am="[object Uint8ClampedArray]",lm="[object Uint16Array]",cm="[object Uint32Array]";function um(e,r,s){var n=e.constructor;switch(r){case Qp:return Lr(e);case zp:case Vp:return new n(+e);case em:return da(e,s);case tm:case rm:case sm:case nm:case im:case om:case am:case lm:case cm:return Ea(e,s);case Hp:return new n;case Yp:case Jp:return new n(e);case Xp:return pa(e);case qp:return new n;case Zp:return Ta(e)}}var ya=um;var Aa=Object.create,fm=function(){function e(){}return function(r){if(!ne(r))return{};if(Aa)return Aa(r);e.prototype=r;var s=new e;return e.prototype=void 0,s}}(),xa=fm;function hm(e){return typeof e.constructor=="function"&&!ct(e)?xa($s(e)):{}}var Sa=hm;var dm="[object Map]";function pm(e){return ue(e)&&rt(e)==dm}var Ra=pm;var Oa=He&&He.isMap,mm=Oa?ht(Oa):Ra,La=mm;var gm="[object Set]";function Tm(e){return ue(e)&&rt(e)==gm}var Ia=Tm;var Na=He&&He.isSet,Em=Na?ht(Na):Ia,ba=Em;var ym=1,Am=2,xm=4,Ca="[object Arguments]",Sm="[object Array]",Rm="[object Boolean]",Om="[object Date]",Lm="[object Error]",va="[object Function]",Im="[object GeneratorFunction]",Nm="[object Map]",bm="[object Number]",ka="[object Object]",Cm="[object RegExp]",vm="[object Set]",km="[object String]",_m="[object Symbol]",wm="[object WeakMap]",Pm="[object ArrayBuffer]",Um="[object DataView]",Dm="[object Float32Array]",Fm="[object Float64Array]",Bm="[object Int8Array]",$m="[object Int16Array]",Gm="[object Int32Array]",Wm="[object Uint8Array]",jm="[object Uint8ClampedArray]",Km="[object Uint16Array]",zm="[object Uint32Array]",G={};G[Ca]=G[Sm]=G[Pm]=G[Um]=G[Rm]=G[Om]=G[Dm]=G[Fm]=G[Bm]=G[$m]=G[Gm]=G[Nm]=G[bm]=G[ka]=G[Cm]=G[vm]=G[km]=G[_m]=G[Wm]=G[jm]=G[Km]=G[zm]=!0;G[Lm]=G[va]=G[wm]=!1;function Hs(e,r,s,n,i,o){var c,u=r&ym,a=r&Am,f=r&xm;if(s)c=i?s(e,n,i,o):s(e);if(c!==void 0)return c;if(!ne(e))return e;var h=R(e);if(h){if(c=ha(e),!u)return ra(e,c)}else{var d=rt(e),p=d==va||d==Im;if(ut(e))return ti(e,u);if(d==ka||d==Ca||p&&!i){if(c=a||p?{}:Sa(e),!u)return a?oa(e,Jo(c,e)):ia(e,Yo(c,e))}else{if(!G[d])return i?e:{};c=ya(e,d,u)}}o||(o=new jt);var T=o.get(e);if(T)return T;if(o.set(e,c),ba(e))e.forEach(function(O){c.add(Hs(O,r,s,O,e,o))});else if(La(e))e.forEach(function(O,y){c.set(y,Hs(O,r,s,y,e,o))});var I=f?a?js:ts:a?Kt:B,N=h?void 0:I(e);return Us(N||e,function(O,y){if(N)y=O,O=e[y];_t(c,y,Hs(O,r,s,y,e,o))}),c}var _a=Hs;var Vm=4;function Hm(e){return _a(e,Vm)}var K=Hm;function Ym(e){var r=-1,s=e==null?0:e.length,n=0,i=[];while(++r<s){var o=e[r];if(o)i[n++]=o}return i}var dt=Ym;var Ma=Object.prototype,Xm=Ma.hasOwnProperty,qm=pr(function(e,r){e=Object(e);var s=-1,n=r.length,i=n>2?r[2]:void 0;if(i&&Pt(r[0],r[1],i))n=1;while(++s<n){var o=r[s],c=Kt(o),u=-1,a=c.length;while(++u<a){var f=c[u],h=e[f];if(h===void 0||at(h,Ma[f])&&!Xm.call(e,f))e[f]=o[f]}}return e}),Ir=qm;var Jm="__lodash_hash_undefined__";function Zm(e){return this.__data__.set(e,Jm),this}var wa=Zm;function Qm(e){return this.__data__.has(e)}var Pa=Qm;function Ys(e){var r=-1,s=e==null?0:e.length;this.__data__=new er;while(++r<s)this.add(e[r])}Ys.prototype.add=Ys.prototype.push=wa;Ys.prototype.has=Pa;var Nr=Ys;function eg(e,r,s,n){var i=e.length,o=s+(n?1:-1);while(n?o--:++o<i)if(r(e[o],o,e))return o;return-1}var Xs=eg;function tg(e){return e!==e}var Ua=tg;function rg(e,r,s){var n=s-1,i=e.length;while(++n<i)if(e[n]===r)return n;return-1}var Da=rg;function sg(e,r,s){return r===r?Da(e,r,s):Xs(e,Ua,s)}var br=sg;function ng(e,r){var s=e==null?0:e.length;return!!s&&br(e,r,0)>-1}var qs=ng;function ig(e,r,s){var n=-1,i=e==null?0:e.length;while(++n<i)if(s(r,e[n]))return!0;return!1}var Js=ig;function og(e,r){var s=-1,n=e==null?0:e.length,i=Array(n);while(++s<n)i[s]=r(e[s],s,e);return i}var pt=og;function ag(e,r){return e.has(r)}var Cr=ag;var lg=200;function cg(e,r,s,n){var i=-1,o=qs,c=!0,u=e.length,a=[],f=r.length;if(!u)return a;if(s)r=pt(r,ht(s));if(n)o=Js,c=!1;else if(r.length>=lg)o=Cr,c=!1,r=new Nr(r);e:while(++i<u){var h=e[i],d=s==null?h:s(h);if(h=n||h!==0?h:0,c&&d===d){var p=f;while(p--)if(r[p]===d)continue e;a.push(h)}else if(!o(r,d,n))a.push(h)}return a}var Fa=cg;var Ba=Oe?Oe.isConcatSpreadable:void 0;function ug(e){return R(e)||Dt(e)||!!(Ba&&e&&e[Ba])}var $a=ug;function Ga(e,r,s,n,i){var o=-1,c=e.length;s||(s=$a),i||(i=[]);while(++o<c){var u=e[o];if(r>0&&s(u))if(r>1)Ga(u,r-1,s,n,i);else Rr(i,u);else if(!n)i[i.length]=u}return i}var vr=Ga;function fg(e){return ue(e)&&me(e)}var ri=fg;var hg=pr(function(e,r){return ri(e)?Fa(e,vr(r,1,ri,!0)):[]}),Ht=hg;function dg(e,r,s){var n=-1,i=e.length;if(r<0)r=-r>i?0:i+r;if(s=s>i?i:s,s<0)s+=i;i=r>s?0:s-r>>>0,r>>>=0;var o=Array(i);while(++n<i)o[n]=e[n+r];return o}var Zs=dg;var pg=/\s/;function mg(e){var r=e.length;while(r--&&pg.test(e.charAt(r)));return r}var Wa=mg;var gg=/^\s+/;function Tg(e){return e?e.slice(0,Wa(e)+1).replace(gg,""):e}var ja=Tg;var Eg="[object Symbol]";function yg(e){return typeof e=="symbol"||ue(e)&&Pe(e)==Eg}var Yt=yg;var Ka=NaN,Ag=/^[-+]0x[0-9a-f]+$/i,xg=/^0b[01]+$/i,Sg=/^0o[0-7]+$/i,Rg=parseInt;function Og(e){if(typeof e=="number")return e;if(Yt(e))return Ka;if(ne(e)){var r=typeof e.valueOf=="function"?e.valueOf():e;e=ne(r)?r+"":r}if(typeof e!="string")return e===0?e:+e;e=ja(e);var s=xg.test(e);return s||Sg.test(e)?Rg(e.slice(2),s?2:8):Ag.test(e)?Ka:+e}var za=Og;var Va=1/0,Lg=179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000;function Ig(e){if(!e)return e===0?e:0;if(e=za(e),e===Va||e===-Va){var r=e<0?-1:1;return r*Lg}return e===e?e:0}var Ha=Ig;function Ng(e){var r=Ha(e),s=r%1;return r===r?s?r-s:r:0}var gt=Ng;function bg(e,r,s){var n=e==null?0:e.length;if(!n)return[];return r=s||r===void 0?1:gt(r),Zs(e,r<0?0:r,n)}var fe=bg;function Cg(e,r,s){var n=e==null?0:e.length;if(!n)return[];return r=s||r===void 0?1:gt(r),r=n-r,Zs(e,0,r<0?0:r)}var Ot=Cg;function vg(e,r){var s=-1,n=e==null?0:e.length;while(++s<n)if(!r(e[s],s,e))return!1;return!0}var Ya=vg;function kg(e){return function(r,s,n){var i=-1,o=Object(r),c=n(r),u=c.length;while(u--){var a=c[e?u:++i];if(s(o[a],a,o)===!1)break}return r}}var Xa=kg;var _g=Xa(),qa=_g;function Mg(e,r){return e&&qa(e,r,B)}var Ja=Mg;function wg(e,r){return function(s,n){if(s==null)return s;if(!me(s))return e(s,n);var i=s.length,o=r?i:-1,c=Object(s);while(r?o--:++o<i)if(n(c[o],o,c)===!1)break;return s}}var Za=wg;var Pg=Za(Ja),Ge=Pg;function Ug(e,r){var s=!0;return Ge(e,function(n,i,o){return s=!!r(n,i,o),s}),s}var Qa=Ug;function Dg(e,r){var s=-1,n=e==null?0:e.length;while(++s<n)if(r(e[s],s,e))return!0;return!1}var Qs=Dg;var Fg=1,Bg=2;function $g(e,r,s,n,i,o){var c=s&Fg,u=e.length,a=r.length;if(u!=a&&!(c&&a>u))return!1;var f=o.get(e),h=o.get(r);if(f&&h)return f==r&&h==e;var d=-1,p=!0,T=s&Bg?new Nr:void 0;o.set(e,r),o.set(r,e);while(++d<u){var I=e[d],N=r[d];if(n)var O=c?n(N,I,d,r,e,o):n(I,N,d,e,r,o);if(O!==void 0){if(O)continue;p=!1;break}if(T){if(!Qs(r,function(y,S){if(!Cr(T,S)&&(I===y||i(I,y,s,n,o)))return T.push(S)})){p=!1;break}}else if(!(I===N||i(I,N,s,n,o))){p=!1;break}}return o.delete(e),o.delete(r),p}var en=$g;function Gg(e){var r=-1,s=Array(e.size);return e.forEach(function(n,i){s[++r]=[i,n]}),s}var el=Gg;function Wg(e){var r=-1,s=Array(e.size);return e.forEach(function(n){s[++r]=n}),s}var kr=Wg;var jg=1,Kg=2,zg="[object Boolean]",Vg="[object Date]",Hg="[object Error]",Yg="[object Map]",Xg="[object Number]",qg="[object RegExp]",Jg="[object Set]",Zg="[object String]",Qg="[object Symbol]",eT="[object ArrayBuffer]",tT="[object DataView]",tl=Oe?Oe.prototype:void 0,si=tl?tl.valueOf:void 0;function rT(e,r,s,n,i,o,c){switch(s){case tT:if(e.byteLength!=r.byteLength||e.byteOffset!=r.byteOffset)return!1;e=e.buffer,r=r.buffer;case eT:if(e.byteLength!=r.byteLength||!o(new Or(e),new Or(r)))return!1;return!0;case zg:case Vg:case Xg:return at(+e,+r);case Hg:return e.name==r.name&&e.message==r.message;case qg:case Zg:return e==r+"";case Yg:var u=el;case Jg:var a=n&jg;if(u||(u=kr),e.size!=r.size&&!a)return!1;var f=c.get(e);if(f)return f==r;n|=Kg,c.set(e,r);var h=en(u(e),u(r),n,i,o,c);return c.delete(e),h;case Qg:if(si)return si.call(e)==si.call(r)}return!1}var rl=rT;var sT=1,nT=Object.prototype,iT=nT.hasOwnProperty;function oT(e,r,s,n,i,o){var c=s&sT,u=ts(e),a=u.length,f=ts(r),h=f.length;if(a!=h&&!c)return!1;var d=a;while(d--){var p=u[d];if(!(c?p in r:iT.call(r,p)))return!1}var T=o.get(e),I=o.get(r);if(T&&I)return T==r&&I==e;var N=!0;o.set(e,r),o.set(r,e);var O=c;while(++d<a){p=u[d];var y=e[p],S=r[p];if(n)var g=c?n(S,y,p,r,e,o):n(y,S,p,e,r,o);if(!(g===void 0?y===S||i(y,S,s,n,o):g)){N=!1;break}O||(O=p=="constructor")}if(N&&!O){var k=e.constructor,Q=r.constructor;if(k!=Q&&(("constructor"in e)&&("constructor"in r))&&!(typeof k=="function"&&k instanceof k&&typeof Q=="function"&&Q instanceof Q))N=!1}return o.delete(e),o.delete(r),N}var sl=oT;var aT=1,nl="[object Arguments]",il="[object Array]",tn="[object Object]",lT=Object.prototype,ol=lT.hasOwnProperty;function cT(e,r,s,n,i,o){var c=R(e),u=R(r),a=c?il:rt(e),f=u?il:rt(r);a=a==nl?tn:a,f=f==nl?tn:f;var h=a==tn,d=f==tn,p=a==f;if(p&&ut(e)){if(!ut(r))return!1;c=!0,h=!1}if(p&&!h)return o||(o=new jt),c||gr(e)?en(e,r,s,n,i,o):rl(e,r,a,s,n,i,o);if(!(s&aT)){var T=h&&ol.call(e,"__wrapped__"),I=d&&ol.call(r,"__wrapped__");if(T||I){var N=T?e.value():e,O=I?r.value():r;return o||(o=new jt),i(N,O,s,n,o)}}if(!p)return!1;return o||(o=new jt),sl(e,r,s,n,i,o)}var al=cT;function ll(e,r,s,n,i){if(e===r)return!0;if(e==null||r==null||!ue(e)&&!ue(r))return e!==e&&r!==r;return al(e,r,s,n,ll,i)}var rn=ll;var uT=1,fT=2;function hT(e,r,s,n){var i=s.length,o=i,c=!n;if(e==null)return!o;e=Object(e);while(i--){var u=s[i];if(c&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}while(++i<o){u=s[i];var a=u[0],f=e[a],h=u[1];if(c&&u[2]){if(f===void 0&&!(a in e))return!1}else{var d=new jt;if(n)var p=n(f,h,a,e,r,d);if(!(p===void 0?rn(h,f,uT|fT,n,d):p))return!1}}return!0}var cl=hT;function dT(e){return e===e&&!ne(e)}var sn=dT;function pT(e){var r=B(e),s=r.length;while(s--){var n=r[s],i=e[n];r[s]=[n,i,sn(i)]}return r}var ul=pT;function mT(e,r){return function(s){if(s==null)return!1;return s[e]===r&&(r!==void 0||(e in Object(s)))}}var nn=mT;function gT(e){var r=ul(e);if(r.length==1&&r[0][2])return nn(r[0][0],r[0][1]);return function(s){return s===e||cl(s,e,r)}}var fl=gT;var TT=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ET=/^\w*$/;function yT(e,r){if(R(e))return!1;var s=typeof e;if(s=="number"||s=="symbol"||s=="boolean"||e==null||Yt(e))return!0;return ET.test(e)||!TT.test(e)||r!=null&&e in Object(r)}var _r=yT;var AT="Expected a function";function ni(e,r){if(typeof e!="function"||r!=null&&typeof r!="function")throw TypeError(AT);var s=function(){var n=arguments,i=r?r.apply(this,n):n[0],o=s.cache;if(o.has(i))return o.get(i);var c=e.apply(this,n);return s.cache=o.set(i,c)||o,c};return s.cache=new(ni.Cache||er),s}ni.Cache=er;var hl=ni;var xT=500;function ST(e){var r=hl(e,function(n){if(s.size===xT)s.clear();return n}),s=r.cache;return r}var dl=ST;var RT=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,OT=/\\(\\)?/g,LT=dl(function(e){var r=[];if(e.charCodeAt(0)===46)r.push("");return e.replace(RT,function(s,n,i,o){r.push(i?o.replace(OT,"$1"):n||s)}),r}),pl=LT;var IT=1/0,ml=Oe?Oe.prototype:void 0,gl=ml?ml.toString:void 0;function Tl(e){if(typeof e=="string")return e;if(R(e))return pt(e,Tl)+"";if(Yt(e))return gl?gl.call(e):"";var r=e+"";return r=="0"&&1/e==-IT?"-0":r}var El=Tl;function NT(e){return e==null?"":El(e)}var yl=NT;function bT(e,r){if(R(e))return e;return _r(e,r)?[e]:pl(yl(e))}var Xt=bT;var CT=1/0;function vT(e){if(typeof e=="string"||Yt(e))return e;var r=e+"";return r=="0"&&1/e==-CT?"-0":r}var Tt=vT;function kT(e,r){r=Xt(r,e);var s=0,n=r.length;while(e!=null&&s<n)e=e[Tt(r[s++])];return s&&s==n?e:void 0}var Mr=kT;function _T(e,r,s){var n=e==null?void 0:Mr(e,r);return n===void 0?s:n}var Al=_T;function MT(e,r){return e!=null&&r in Object(e)}var xl=MT;function wT(e,r,s){r=Xt(r,e);var n=-1,i=r.length,o=!1;while(++n<i){var c=Tt(r[n]);if(!(o=e!=null&&s(e,c)))break;e=e[c]}if(o||++n!=i)return o;return i=e==null?0:e.length,!!i&&mr(i)&&Mt(c,i)&&(R(e)||Dt(e))}var on=wT;function PT(e,r){return e!=null&&on(e,r,xl)}var Sl=PT;var UT=1,DT=2;function FT(e,r){if(_r(e)&&sn(r))return nn(Tt(e),r);return function(s){var n=Al(s,e);return n===void 0&&n===r?Sl(s,e):rn(r,n,UT|DT)}}var Rl=FT;function BT(e){return function(r){return r==null?void 0:r[e]}}var Ol=BT;function $T(e){return function(r){return Mr(r,e)}}var Ll=$T;function GT(e){return _r(e)?Ol(Tt(e)):Ll(e)}var Il=GT;function WT(e){if(typeof e=="function")return e;if(e==null)return tt;if(typeof e=="object")return R(e)?Rl(e[0],e[1]):fl(e);return Il(e)}var ge=WT;function jT(e,r,s){var n=R(e)?Ya:Qa;if(s&&Pt(e,r,s))r=void 0;return n(e,ge(r,3))}var ve=jT;function KT(e,r){var s=[];return Ge(e,function(n,i,o){if(r(n,i,o))s.push(n)}),s}var an=KT;function zT(e,r){var s=R(e)?xr:an;return s(e,ge(r,3))}var ke=zT;function VT(e){return function(r,s,n){var i=Object(r);if(!me(r)){var o=ge(s,3);r=B(r),s=function(u){return o(i[u],u,i)}}var c=e(r,s,n);return c>-1?i[o?r[c]:c]:void 0}}var Nl=VT;var HT=Math.max;function YT(e,r,s){var n=e==null?0:e.length;if(!n)return-1;var i=s==null?0:gt(s);if(i<0)i=HT(n+i,0);return Xs(e,ge(r,3),i)}var bl=YT;var XT=Nl(bl),Et=XT;function qT(e){return e&&e.length?e[0]:void 0}var Le=qT;function JT(e,r){var s=-1,n=me(e)?Array(e.length):[];return Ge(e,function(i,o,c){n[++s]=r(i,o,c)}),n}var Cl=JT;function ZT(e,r){var s=R(e)?pt:Cl;return s(e,ge(r,3))}var E=ZT;function QT(e,r){return vr(E(e,r),1)}var De=QT;function eE(e){var r=e==null?0:e.length;return r?vr(e,1):[]}var xe=eE;function tE(e){return typeof e=="function"?e:tt}var vl=tE;function rE(e,r){var s=R(e)?Us:Ge;return s(e,vl(r))}var A=rE;function sE(e,r,s,n){var i=-1,o=e==null?0:e.length;while(++i<o){var c=e[i];r(n,c,s(c),e)}return n}var kl=sE;function nE(e,r,s,n){return Ge(e,function(i,o,c){r(n,i,s(i),c)}),n}var _l=nE;function iE(e,r){return function(s,n){var i=R(s)?kl:_l,o=r?r():{};return i(s,e,ge(n,2),o)}}var Ml=iE;var oE=Object.prototype,aE=oE.hasOwnProperty,lE=Ml(function(e,r,s){if(aE.call(e,s))e[s].push(r);else dr(e,s,[r])}),ii=lE;var cE=Object.prototype,uE=cE.hasOwnProperty;function fE(e,r){return e!=null&&uE.call(e,r)}var wl=fE;function hE(e,r){return e!=null&&on(e,r,wl)}var x=hE;var dE="[object String]";function pE(e){return typeof e=="string"||!R(e)&&ue(e)&&Pe(e)==dE}var Se=pE;function mE(e,r){return pt(r,function(s){return e[s]})}var Pl=mE;function gE(e){return e==null?[]:Pl(e,B(e))}var D=gE;var TE=Math.max;function EE(e,r,s,n){e=me(e)?e:D(e),s=s&&!n?gt(s):0;var i=e.length;if(s<0)s=TE(i+s,0);return Se(e)?s<=i&&e.indexOf(r,s)>-1:!!i&&br(e,r,s)>-1}var ee=EE;var yE=Math.max;function AE(e,r,s){var n=e==null?0:e.length;if(!n)return-1;var i=s==null?0:gt(s);if(i<0)i=yE(n+i,0);return br(e,r,i)}var ln=AE;var xE="[object Map]",SE="[object Set]",RE=Object.prototype,OE=RE.hasOwnProperty;function LE(e){if(e==null)return!0;if(me(e)&&(R(e)||typeof e=="string"||typeof e.splice=="function"||ut(e)||gr(e)||Dt(e)))return!e.length;var r=rt(e);if(r==xE||r==SE)return!e.size;if(ct(e))return!Ps(e).length;for(var s in e)if(OE.call(e,s))return!1;return!0}var _=LE;var IE="[object RegExp]";function NE(e){return ue(e)&&Pe(e)==IE}var Ul=NE;var Dl=He&&He.isRegExp,bE=Dl?ht(Dl):Ul,qe=bE;function CE(e){return e===void 0}var _e=CE;function vE(e){var r=e==null?0:e.length;return r?e[r-1]:void 0}var st=vE;function kE(){}var le=kE;function _E(e,r,s,n){if(!ne(e))return e;r=Xt(r,e);var i=-1,o=r.length,c=o-1,u=e;while(u!=null&&++i<o){var a=Tt(r[i]),f=s;if(a==="__proto__"||a==="constructor"||a==="prototype")return e;if(i!=c){var h=u[a];if(f=n?n(h,a,u):void 0,f===void 0)f=ne(h)?h:Mt(r[i+1])?[]:{}}_t(u,a,f),u=u[a]}return e}var Fl=_E;function ME(e,r,s){var n=-1,i=r.length,o={};while(++n<i){var c=r[n],u=Mr(e,c);if(s(u,c))Fl(o,Xt(c,e),u)}return o}var Bl=ME;function wE(e,r){if(e==null)return{};var s=pt(js(e),function(n){return[n]});return r=ge(r),Bl(e,s,function(n,i){return r(n,i[0])})}var We=wE;function PE(e,r,s,n){var i=-1,o=e==null?0:e.length;if(n&&o)s=e[++i];while(++i<o)s=r(s,e[i],i,e);return s}var $l=PE;function UE(e,r,s,n,i){return i(e,function(o,c,u){s=n?(n=!1,o):r(s,o,c,u)}),s}var Gl=UE;function DE(e,r,s){var n=R(e)?$l:Gl,i=arguments.length<3;return n(e,ge(r,4),s,i,Ge)}var Te=DE;var FE="Expected a function";function BE(e){if(typeof e!="function")throw TypeError(FE);return function(){var r=arguments;switch(r.length){case 0:return!e.call(this);case 1:return!e.call(this,r[0]);case 2:return!e.call(this,r[0],r[1]);case 3:return!e.call(this,r[0],r[1],r[2])}return!e.apply(this,r)}}var Wl=BE;function $E(e,r){var s=R(e)?xr:an;return s(e,Wl(ge(r,3)))}var qt=$E;function GE(e,r){var s;return Ge(e,function(n,i,o){return s=r(n,i,o),!s}),!!s}var jl=GE;function WE(e,r,s){var n=R(e)?Qs:jl;if(s&&Pt(e,r,s))r=void 0;return n(e,ge(r,3))}var rs=WE;var jE=1/0,KE=!(Vt&&1/kr(new Vt([,-0]))[1]==jE)?le:function(e){return new Vt(e)},Kl=KE;var zE=200;function VE(e,r,s){var n=-1,i=qs,o=e.length,c=!0,u=[],a=u;if(s)c=!1,i=Js;else if(o>=zE){var f=r?null:Kl(e);if(f)return kr(f);c=!1,i=Cr,a=new Nr}else a=r?[]:u;e:while(++n<o){var h=e[n],d=r?r(h):h;if(h=s||h!==0?h:0,c&&d===d){var p=a.length;while(p--)if(a[p]===d)continue e;if(r)a.push(d);u.push(h)}else if(!i(a,d,s)){if(a!==u)a.push(d);u.push(h)}}return u}var zl=VE;function HE(e){return e&&e.length?zl(e):[]}var wr=HE;function Pr(e){if(console&&console.error)console.error(`Error: ${e}`)}function ss(e){if(console&&console.warn)console.warn(`Warning: ${e}`)}function ns(e){let r=new Date().getTime(),s=e();return{time:new Date().getTime()-r,value:s}}function is(e){function r(){}r.prototype=e;let s=new r;function n(){return typeof s.bar}return n(),n(),e;(0,eval)(e)}function YE(e){if(XE(e))return e.LABEL;else return e.name}function XE(e){return Se(e.LABEL)&&e.LABEL!==""}class Je{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),A(this.definition,(r)=>{r.accept(e)})}}class J extends Je{constructor(e){super([]);this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}set definition(e){}get definition(){if(this.referencedRule!==void 0)return this.referencedRule.definition;return[]}accept(e){e.visit(this)}}class je extends Je{constructor(e){super(e.definition);this.orgText="",Ne(this,We(e,(r)=>r!==void 0))}}class Z extends Je{constructor(e){super(e.definition);this.ignoreAmbiguities=!1,Ne(this,We(e,(r)=>r!==void 0))}}class re extends Je{constructor(e){super(e.definition);this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}}class Ee extends Je{constructor(e){super(e.definition);this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}}class ye extends Je{constructor(e){super(e.definition);this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}}class P extends Je{constructor(e){super(e.definition);this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}}class he extends Je{constructor(e){super(e.definition);this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}}class de extends Je{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition);this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,Ne(this,We(e,(r)=>r!==void 0))}}class M{constructor(e){this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}accept(e){e.visit(this)}}function cn(e){return E(e,Ur)}function Ur(e){function r(s){return E(s,Ur)}if(e instanceof J){let s={type:"NonTerminal",name:e.nonTerminalName,idx:e.idx};if(Se(e.label))s.label=e.label;return s}else if(e instanceof Z)return{type:"Alternative",definition:r(e.definition)};else if(e instanceof re)return{type:"Option",idx:e.idx,definition:r(e.definition)};else if(e instanceof Ee)return{type:"RepetitionMandatory",idx:e.idx,definition:r(e.definition)};else if(e instanceof ye)return{type:"RepetitionMandatoryWithSeparator",idx:e.idx,separator:Ur(new M({terminalType:e.separator})),definition:r(e.definition)};else if(e instanceof he)return{type:"RepetitionWithSeparator",idx:e.idx,separator:Ur(new M({terminalType:e.separator})),definition:r(e.definition)};else if(e instanceof P)return{type:"Repetition",idx:e.idx,definition:r(e.definition)};else if(e instanceof de)return{type:"Alternation",idx:e.idx,definition:r(e.definition)};else if(e instanceof M){let s={type:"Terminal",name:e.terminalType.name,label:YE(e.terminalType),idx:e.idx};if(Se(e.label))s.terminalLabel=e.label;let n=e.terminalType.PATTERN;if(e.terminalType.PATTERN)s.pattern=qe(n)?n.source:n;return s}else if(e instanceof je)return{type:"Rule",name:e.name,orgText:e.orgText,definition:r(e.definition)};else throw Error("non exhaustive match")}class Ke{visit(e){let r=e;switch(r.constructor){case J:return this.visitNonTerminal(r);case Z:return this.visitAlternative(r);case re:return this.visitOption(r);case Ee:return this.visitRepetitionMandatory(r);case ye:return this.visitRepetitionMandatoryWithSeparator(r);case he:return this.visitRepetitionWithSeparator(r);case P:return this.visitRepetition(r);case de:return this.visitAlternation(r);case M:return this.visitTerminal(r);case je:return this.visitRule(r);default:throw Error("non exhaustive match")}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}}function oi(e){return e instanceof Z||e instanceof re||e instanceof P||e instanceof Ee||e instanceof ye||e instanceof he||e instanceof M||e instanceof je}function rr(e,r=[]){if(e instanceof re||e instanceof P||e instanceof he)return!0;if(e instanceof de)return rs(e.definition,(n)=>rr(n,r));else if(e instanceof J&&ee(r,e))return!1;else if(e instanceof Je){if(e instanceof J)r.push(e);return ve(e.definition,(n)=>rr(n,r))}else return!1}function ai(e){return e instanceof de}function ze(e){if(e instanceof J)return"SUBRULE";else if(e instanceof re)return"OPTION";else if(e instanceof de)return"OR";else if(e instanceof Ee)return"AT_LEAST_ONE";else if(e instanceof ye)return"AT_LEAST_ONE_SEP";else if(e instanceof he)return"MANY_SEP";else if(e instanceof P)return"MANY";else if(e instanceof M)return"CONSUME";else throw Error("non exhaustive match")}class Jt{walk(e,r=[]){A(e.definition,(s,n)=>{let i=fe(e.definition,n+1);if(s instanceof J)this.walkProdRef(s,i,r);else if(s instanceof M)this.walkTerminal(s,i,r);else if(s instanceof Z)this.walkFlat(s,i,r);else if(s instanceof re)this.walkOption(s,i,r);else if(s instanceof Ee)this.walkAtLeastOne(s,i,r);else if(s instanceof ye)this.walkAtLeastOneSep(s,i,r);else if(s instanceof he)this.walkManySep(s,i,r);else if(s instanceof P)this.walkMany(s,i,r);else if(s instanceof de)this.walkOr(s,i,r);else throw Error("non exhaustive match")})}walkTerminal(e,r,s){}walkProdRef(e,r,s){}walkFlat(e,r,s){let n=r.concat(s);this.walk(e,n)}walkOption(e,r,s){let n=r.concat(s);this.walk(e,n)}walkAtLeastOne(e,r,s){let n=[new re({definition:e.definition})].concat(r,s);this.walk(e,n)}walkAtLeastOneSep(e,r,s){let n=Vl(e,r,s);this.walk(e,n)}walkMany(e,r,s){let n=[new re({definition:e.definition})].concat(r,s);this.walk(e,n)}walkManySep(e,r,s){let n=Vl(e,r,s);this.walk(e,n)}walkOr(e,r,s){let n=r.concat(s);A(e.definition,(i)=>{let o=new Z({definition:[i]});this.walk(o,n)})}}function Vl(e,r,s){return[new re({definition:[new M({terminalType:e.separator})].concat(e.definition)})].concat(r,s)}function sr(e){if(e instanceof J)return sr(e.referencedRule);else if(e instanceof M)return ZE(e);else if(oi(e))return qE(e);else if(ai(e))return JE(e);else throw Error("non exhaustive match")}function qE(e){let r=[],s=e.definition,n=0,i=s.length>n,o,c=!0;while(i&&c)o=s[n],c=rr(o),r=r.concat(sr(o)),n=n+1,i=s.length>n;return wr(r)}function JE(e){let r=E(e.definition,(s)=>sr(s));return wr(xe(r))}function ZE(e){return[e.terminalType]}var un="_~IN~_";class Hl extends Jt{constructor(e){super();this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,r,s){}walkProdRef(e,r,s){let n=QE(e.referencedRule,e.idx)+this.topProd.name,i=r.concat(s),o=new Z({definition:i}),c=sr(o);this.follows[n]=c}}function Yl(e){let r={};return A(e,(s)=>{let n=new Hl(s).startWalking();Ne(r,n)}),r}function QE(e,r){return e.name+r+un}function v(e){return e.charCodeAt(0)}function fn(e,r){if(Array.isArray(e))e.forEach(function(s){r.push(s)});else r.push(e)}function Dr(e,r){if(e[r]===!0)throw"duplicate flag "+r;let s=e[r];e[r]=!0}function nr(e){if(e===void 0)throw Error("Internal Error - Should never get here!");return!0}function os(){throw Error("Internal Error - Should never get here!")}function li(e){return e.type==="Character"}var as=[];for(let e=v("0");e<=v("9");e++)as.push(e);var ls=[v("_")].concat(as);for(let e=v("a");e<=v("z");e++)ls.push(e);for(let e=v("A");e<=v("Z");e++)ls.push(e);var ci=[v(" "),v("\f"),v(`
|
|
2
|
+
`),v("\r"),v("\t"),v("\v"),v("\t"),v(" "),v(" "),v(" "),v(" "),v(" "),v(" "),v(" "),v(" "),v(" "),v(" "),v(" "),v(" "),v(" "),v("\u2028"),v("\u2029"),v(" "),v(" "),v(" "),v("\uFEFF")];var ey=/[0-9a-fA-F]/,hn=/[0-9]/,ty=/[1-9]/;class dn{constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar("/");let r=this.disjunction();this.consumeChar("/");let s={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};while(this.isRegExpFlag())switch(this.popChar()){case"g":Dr(s,"global");break;case"i":Dr(s,"ignoreCase");break;case"m":Dr(s,"multiLine");break;case"u":Dr(s,"unicode");break;case"y":Dr(s,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:s,value:r,loc:this.loc(0)}}disjunction(){let e=[],r=this.idx;e.push(this.alternative());while(this.peekChar()==="|")this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(r)}}alternative(){let e=[],r=this.idx;while(this.isTerm())e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(r)}}term(){if(this.isAssertion())return this.assertion();else return this.atom()}assertion(){let e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");let r;switch(this.popChar()){case"=":r="Lookahead";break;case"!":r="NegativeLookahead";break;case"<":{switch(this.popChar()){case"=":r="Lookbehind";break;case"!":r="NegativeLookbehind"}break}}nr(r);let s=this.disjunction();return this.consumeChar(")"),{type:r,value:s,loc:this.loc(e)}}return os()}quantifier(e=!1){let r=void 0,s=this.idx;switch(this.popChar()){case"*":r={atLeast:0,atMost:1/0};break;case"+":r={atLeast:1,atMost:1/0};break;case"?":r={atLeast:0,atMost:1};break;case"{":let n=this.integerIncludingZero();switch(this.popChar()){case"}":r={atLeast:n,atMost:n};break;case",":let i;if(this.isDigit())i=this.integerIncludingZero(),r={atLeast:n,atMost:i};else r={atLeast:n,atMost:1/0};this.consumeChar("}");break}if(e===!0&&r===void 0)return;nr(r);break}if(e===!0&&r===void 0)return;if(nr(r)){if(this.peekChar(0)==="?")this.consumeChar("?"),r.greedy=!1;else r.greedy=!0;return r.type="Quantifier",r.loc=this.loc(s),r}}atom(){let e,r=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group();break}if(e===void 0&&this.isPatternCharacter())e=this.patternCharacter();if(nr(e)){if(e.loc=this.loc(r),this.isQuantifier())e.quantifier=this.quantifier();return e}return os()}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[v(`
|
|
3
|
+
`),v("\r"),v("\u2028"),v("\u2029")]}}atomEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:"GroupBackReference",value:this.positiveInteger()}}characterClassEscape(){let e,r=!1;switch(this.popChar()){case"d":e=as;break;case"D":e=as,r=!0;break;case"s":e=ci;break;case"S":e=ci,r=!0;break;case"w":e=ls;break;case"W":e=ls,r=!0;break}if(nr(e))return{type:"Set",value:e,complement:r};return os()}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=v("\f");break;case"n":e=v(`
|
|
4
|
+
`);break;case"r":e=v("\r");break;case"t":e=v("\t");break;case"v":e=v("\v");break}if(nr(e))return{type:"Character",value:e};return os()}controlLetterEscapeAtom(){this.consumeChar("c");let e=this.popChar();if(/[a-zA-Z]/.test(e)===!1)throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:v("\x00")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){let e=this.popChar();return{type:"Character",value:v(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case`
|
|
5
|
+
`:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:let e=this.popChar();return{type:"Character",value:v(e)}}}characterClass(){let e=[],r=!1;if(this.consumeChar("["),this.peekChar(0)==="^")this.consumeChar("^"),r=!0;while(this.isClassAtom()){let s=this.classAtom(),n=s.type==="Character";if(li(s)&&this.isRangeDash()){this.consumeChar("-");let i=this.classAtom(),o=i.type==="Character";if(li(i)){if(i.value<s.value)throw Error("Range out of order in character class");e.push({from:s.value,to:i.value})}else fn(s.value,e),e.push(v("-")),fn(i.value,e)}else fn(s.value,e)}return this.consumeChar("]"),{type:"Set",complement:r,value:e}}classAtom(){switch(this.peekChar()){case"]":case`
|
|
6
|
+
`:case"\r":case"\u2028":case"\u2029":throw Error("TBD");case"\\":return this.classEscape();default:return this.classPatternCharacterAtom()}}classEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"b":return this.consumeChar("b"),{type:"Character",value:v("\b")};case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}group(){let e=!0;switch(this.consumeChar("("),this.peekChar(0)){case"?":this.consumeChar("?"),this.consumeChar(":"),e=!1;break;default:this.groupIdx++;break}let r=this.disjunction();this.consumeChar(")");let s={type:"Group",capturing:e,value:r};if(e)s.idx=this.groupIdx;return s}positiveInteger(){let e=this.popChar();if(ty.test(e)===!1)throw Error("Expecting a positive integer");while(hn.test(this.peekChar(0)))e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(hn.test(e)===!1)throw Error("Expecting an integer");while(hn.test(this.peekChar(0)))e+=this.popChar();return parseInt(e,10)}patternCharacter(){let e=this.popChar();switch(e){case`
|
|
7
|
+
`:case"\r":case"\u2028":case"\u2029":case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":throw Error("TBD");default:return{type:"Character",value:v(e)}}}isRegExpFlag(){switch(this.peekChar(0)){case"g":case"i":case"m":case"u":case"y":return!0;default:return!1}}isRangeDash(){return this.peekChar()==="-"&&this.isClassAtom(1)}isDigit(){return hn.test(this.peekChar(0))}isClassAtom(e=0){switch(this.peekChar(e)){case"]":case`
|
|
8
8
|
`:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}isTerm(){return this.isAtom()||this.isAssertion()}isAtom(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case".":case"\\":case"[":case"(":return!0;default:return!1}}isAssertion(){switch(this.peekChar(0)){case"^":case"$":return!0;case"\\":switch(this.peekChar(1)){case"b":case"B":return!0;default:return!1}case"(":return this.peekChar(1)==="?"&&(this.peekChar(2)==="="||this.peekChar(2)==="!"||this.peekChar(2)==="<"&&(this.peekChar(3)==="="||this.peekChar(3)==="!"));default:return!1}}isQuantifier(){let e=this.saveState();try{return this.quantifier(!0)!==void 0}catch(r){return!1}finally{this.restoreState(e)}}isPatternCharacter(){switch(this.peekChar()){case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":case"/":case`
|
|
9
9
|
`:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}parseHexDigits(e){let r="";for(let n=0;n<e;n++){let i=this.popChar();if(ey.test(i)===!1)throw Error("Expecting a HexDecimal digits");r+=i}return{type:"Character",value:parseInt(r,16)}}peekChar(e=0){return this.input[this.idx+e]}popChar(){let e=this.peekChar(0);return this.consumeChar(void 0),e}consumeChar(e){if(e!==void 0&&this.input[this.idx]!==e)throw Error("Expected: '"+e+"' but found: '"+this.input[this.idx]+"' at offset: "+this.idx);if(this.idx>=this.input.length)throw Error("Unexpected end of input");this.idx++}loc(e){return{begin:e,end:this.idx}}}class ir{visitChildren(e){for(let r in e){let s=e[r];if(e.hasOwnProperty(r)){if(s.type!==void 0)this.visit(s);else if(Array.isArray(s))s.forEach((n)=>{this.visit(n)},this)}}}visit(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"Lookbehind":this.visitLookbehind(e);break;case"NegativeLookbehind":this.visitNegativeLookbehind(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e);break}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitLookbehind(e){}visitNegativeLookbehind(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}}var pn={},ry=new dn;function Fr(e){let r=e.toString();if(pn.hasOwnProperty(r))return pn[r];else{let s=ry.pattern(r);return pn[r]=s,s}}function Xl(){pn={}}var Jl="Complement Sets are not supported for first char optimization",cs=`Unable to use "first char" lexer optimizations:
|
|
10
10
|
`;function Zl(e,r=!1){try{let s=Fr(e);return ui(s.value,{},s.flags.ignoreCase)}catch(s){if(s.message===Jl){if(r)ss(`${cs} Unable to optimize: < ${e.toString()} >
|
|
@@ -15,49 +15,49 @@ import{t,l,Y,E,te,F,O,G,z,j,q,H,m,b,V,Qm,wt,pt,mt,aa,$t,zt,Ut,Ct}from"./index-xq
|
|
|
15
15
|
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`;Pr(`${cs}
|
|
16
16
|
Failed parsing: < ${e.toString()} >
|
|
17
17
|
Using the @chevrotain/regexp-to-ast library
|
|
18
|
-
Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+n)}}return[]}function ui(e,r,s){switch(e.type){case"Disjunction":for(let i=0;i<e.value.length;i++)ui(e.value[i],r,s);break;case"Alternative":let n=e.value;for(let i=0;i<n.length;i++){let o=n[i];switch(o.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"Lookbehind":case"NegativeLookbehind":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}let c=o;switch(c.type){case"Character":mn(c.value,r,s);break;case"Set":if(c.complement===!0)throw Error(Jl);
|
|
19
|
-
`],tracer:(
|
|
18
|
+
Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+n)}}return[]}function ui(e,r,s){switch(e.type){case"Disjunction":for(let i=0;i<e.value.length;i++)ui(e.value[i],r,s);break;case"Alternative":let n=e.value;for(let i=0;i<n.length;i++){let o=n[i];switch(o.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"Lookbehind":case"NegativeLookbehind":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}let c=o;switch(c.type){case"Character":mn(c.value,r,s);break;case"Set":if(c.complement===!0)throw Error(Jl);A(c.value,(a)=>{if(typeof a==="number")mn(a,r,s);else{let f=a;if(s===!0)for(let h=f.from;h<=f.to;h++)mn(h,r,s);else{for(let h=f.from;h<=f.to&&h<Br;h++)mn(h,r,s);if(f.to>=Br){let h=f.from>=Br?f.from:Br,d=f.to,p=yt(h),T=yt(d);for(let I=p;I<=T;I++)r[I]=I}}}});break;case"Group":ui(c.value,r,s);break;default:throw Error("Non Exhaustive Match")}let u=c.quantifier!==void 0&&c.quantifier.atLeast===0;if(c.type==="Group"&&fi(c)===!1||c.type!=="Group"&&u===!1)break}break;default:throw Error("non exhaustive match!")}return D(r)}function mn(e,r,s){let n=yt(e);if(r[n]=n,s===!0)sy(e,r)}function sy(e,r){let s=String.fromCharCode(e),n=s.toUpperCase();if(n!==s){let i=yt(n.charCodeAt(0));r[i]=i}else{let i=s.toLowerCase();if(i!==s){let o=yt(i.charCodeAt(0));r[o]=o}}}function ql(e,r){return Et(e.value,(s)=>{if(typeof s==="number")return ee(r,s);else{let n=s;return Et(r,(i)=>n.from<=i&&i<=n.to)!==void 0}})}function fi(e){let r=e.quantifier;if(r&&r.atLeast===0)return!0;if(!e.value)return!1;return R(e.value)?ve(e.value,fi):fi(e.value)}class Ql extends ir{constructor(e){super();this.targetCharCodes=e,this.found=!1}visitChildren(e){if(this.found===!0)return;switch(e.type){case"Lookahead":this.visitLookahead(e);return;case"NegativeLookahead":this.visitNegativeLookahead(e);return;case"Lookbehind":this.visitLookbehind(e);return;case"NegativeLookbehind":this.visitNegativeLookbehind(e);return}super.visitChildren(e)}visitCharacter(e){if(ee(this.targetCharCodes,e.value))this.found=!0}visitSet(e){if(e.complement){if(ql(e,this.targetCharCodes)===void 0)this.found=!0}else if(ql(e,this.targetCharCodes)!==void 0)this.found=!0}}function gn(e,r){if(r instanceof RegExp){let s=Fr(r),n=new Ql(e);return n.visit(s),n.found}else return Et(r,(s)=>ee(e,s.charCodeAt(0)))!==void 0}var or="PATTERN",$r="defaultMode",Tn="modes";function tc(e,r){r=Ir(r,{debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
|
|
19
|
+
`],tracer:(S,g)=>g()});let s=r.tracer;s("initCharCodeToOptimizedIndexMap",()=>{Sy()});let n;s("Reject Lexer.NA",()=>{n=qt(e,(S)=>S[or]===ie.NA)});let i=!1,o;s("Transform Patterns",()=>{i=!1,o=E(n,(S)=>{let g=S[or];if(qe(g)){let k=g.source;if(k.length===1&&k!=="^"&&k!=="$"&&k!=="."&&!g.ignoreCase)return k;else if(k.length===2&&k[0]==="\\"&&!ee(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],k[1]))return k[1];else return ec(g)}else if(Ue(g))return i=!0,{exec:g};else if(typeof g==="object")return i=!0,g;else if(typeof g==="string")if(g.length===1)return g;else{let k=g.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),Q=new RegExp(k);return ec(Q)}else throw Error("non exhaustive match")})});let c,u,a,f,h;s("misc mapping",()=>{c=E(n,(S)=>S.tokenTypeIdx),u=E(n,(S)=>{let g=S.GROUP;if(g===ie.SKIPPED)return;else if(Se(g))return g;else if(_e(g))return!1;else throw Error("non exhaustive match")}),a=E(n,(S)=>{let g=S.LONGER_ALT;if(g)return R(g)?E(g,(Q)=>ln(n,Q)):[ln(n,g)]}),f=E(n,(S)=>S.PUSH_MODE),h=E(n,(S)=>x(S,"POP_MODE"))});let d;s("Line Terminator Handling",()=>{let S=cc(r.lineTerminatorCharacters);if(d=E(n,(g)=>!1),r.positionTracking!=="onlyOffset")d=E(n,(g)=>{if(x(g,"LINE_BREAKS"))return!!g.LINE_BREAKS;else return lc(g,S)===!1&&gn(S,g.PATTERN)})});let p,T,I,N;s("Misc Mapping #2",()=>{p=E(n,oc),T=E(o,Ay),I=Te(n,(S,g)=>{let k=g.GROUP;if(Se(k)&&k!==ie.SKIPPED)S[k]=[];return S},{}),N=E(o,(S,g)=>({pattern:o[g],longerAlt:a[g],canLineTerminator:d[g],isCustom:p[g],short:T[g],group:u[g],push:f[g],pop:h[g],tokenTypeIdx:c[g],tokenType:n[g]}))});let O=!0,y=[];if(!r.safeMode)s("First Char Optimization",()=>{y=Te(n,(S,g,k)=>{if(typeof g.PATTERN==="string"){let Q=g.PATTERN.charCodeAt(0),Ce=yt(Q);hi(S,Ce,N[k])}else if(R(g.START_CHARS_HINT)){let Q;A(g.START_CHARS_HINT,(Ce)=>{let Yr=typeof Ce==="string"?Ce.charCodeAt(0):Ce,At=yt(Yr);if(Q!==At)Q=At,hi(S,At,N[k])})}else if(qe(g.PATTERN))if(g.PATTERN.unicode){if(O=!1,r.ensureOptimizations)Pr(`${cs} Unable to analyze < ${g.PATTERN.toString()} > pattern.
|
|
20
20
|
The regexp unicode flag is not currently supported by the regexp-to-ast library.
|
|
21
21
|
This will disable the lexer's first char optimizations.
|
|
22
|
-
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`)}else{let Q=Zl(g.PATTERN,r.ensureOptimizations);if(
|
|
22
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`)}else{let Q=Zl(g.PATTERN,r.ensureOptimizations);if(_(Q))O=!1;A(Q,(Ce)=>{hi(S,Ce,N[k])})}else{if(r.ensureOptimizations)Pr(`${cs} TokenType: <${g.name}> is using a custom token pattern without providing <start_chars_hint> parameter.
|
|
23
23
|
This will disable the lexer's first char optimizations.
|
|
24
|
-
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`);
|
|
24
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`);O=!1}return S},[])});return{emptyGroups:I,patternIdxToConfig:N,charCodeToPatternIdxToConfig:y,hasCustom:i,canBeOptimized:O}}function rc(e,r){let s=[],n=iy(e);s=s.concat(n.errors);let i=oy(n.valid),o=i.valid;return s=s.concat(i.errors),s=s.concat(ny(o)),s=s.concat(py(o)),s=s.concat(my(o,r)),s=s.concat(gy(o)),s}function ny(e){let r=[],s=ke(e,(n)=>qe(n[or]));return r=r.concat(ly(s)),r=r.concat(fy(s)),r=r.concat(hy(s)),r=r.concat(dy(s)),r=r.concat(cy(s)),r}function iy(e){let r=ke(e,(i)=>!x(i,or)),s=E(r,(i)=>({message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:se.MISSING_PATTERN,tokenTypes:[i]})),n=Ht(e,r);return{errors:s,valid:n}}function oy(e){let r=ke(e,(i)=>{let o=i[or];return!qe(o)&&!Ue(o)&&!x(o,"exec")&&!Se(o)}),s=E(r,(i)=>({message:"Token Type: ->"+i.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:se.INVALID_PATTERN,tokenTypes:[i]})),n=Ht(e,r);return{errors:s,valid:n}}var ay=/[^\\][$]/;function ly(e){class r extends ir{constructor(){super(...arguments);this.found=!1}visitEndAnchor(i){this.found=!0}}let s=ke(e,(i)=>{let o=i.PATTERN;try{let c=Fr(o),u=new r;return u.visit(c),u.found}catch(c){return ay.test(o.source)}});return E(s,(i)=>({message:`Unexpected RegExp Anchor Error:
|
|
25
25
|
Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
|
|
26
|
-
See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:se.EOI_ANCHOR_FOUND,tokenTypes:[i]}))}function cy(e){let r=ke(e,(n)=>n.PATTERN.test(""));return
|
|
26
|
+
See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:se.EOI_ANCHOR_FOUND,tokenTypes:[i]}))}function cy(e){let r=ke(e,(n)=>n.PATTERN.test(""));return E(r,(n)=>({message:"Token Type: ->"+n.name+"<- static 'PATTERN' must not match an empty string",type:se.EMPTY_MATCH_PATTERN,tokenTypes:[n]}))}var uy=/[^\\[][\^]|^\^/;function fy(e){class r extends ir{constructor(){super(...arguments);this.found=!1}visitStartAnchor(i){this.found=!0}}let s=ke(e,(i)=>{let o=i.PATTERN;try{let c=Fr(o),u=new r;return u.visit(c),u.found}catch(c){return uy.test(o.source)}});return E(s,(i)=>({message:`Unexpected RegExp Anchor Error:
|
|
27
27
|
Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
|
|
28
|
-
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:se.SOI_ANCHOR_FOUND,tokenTypes:[i]}))}function hy(e){let r=ke(e,(n)=>{let i=n[or];return i instanceof RegExp&&(i.multiline||i.global)});return
|
|
28
|
+
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:se.SOI_ANCHOR_FOUND,tokenTypes:[i]}))}function hy(e){let r=ke(e,(n)=>{let i=n[or];return i instanceof RegExp&&(i.multiline||i.global)});return E(r,(n)=>({message:"Token Type: ->"+n.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:se.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[n]}))}function dy(e){let r=[],s=E(e,(o)=>Te(e,(c,u)=>{if(o.PATTERN.source===u.PATTERN.source&&!ee(r,u)&&u.PATTERN!==ie.NA)return r.push(u),c.push(u),c;return c},[]));s=dt(s);let n=ke(s,(o)=>o.length>1);return E(n,(o)=>{let c=E(o,(a)=>a.name);return{message:`The same RegExp pattern ->${Le(o).PATTERN}<-has been used in all of the following Token Types: ${c.join(", ")} <-`,type:se.DUPLICATE_PATTERNS_FOUND,tokenTypes:o}})}function py(e){let r=ke(e,(n)=>{if(!x(n,"GROUP"))return!1;let i=n.GROUP;return i!==ie.SKIPPED&&i!==ie.NA&&!Se(i)});return E(r,(n)=>({message:"Token Type: ->"+n.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:se.INVALID_GROUP_TYPE_FOUND,tokenTypes:[n]}))}function my(e,r){let s=ke(e,(i)=>i.PUSH_MODE!==void 0&&!ee(r,i.PUSH_MODE));return E(s,(i)=>({message:`Token Type: ->${i.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${i.PUSH_MODE}<-which does not exist`,type:se.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[i]}))}function gy(e){let r=[],s=Te(e,(n,i,o)=>{let c=i.PATTERN;if(c===ie.NA)return n;if(Se(c))n.push({str:c,idx:o,tokenType:i});else if(qe(c)&&Ey(c))n.push({str:c.source,idx:o,tokenType:i});return n},[]);return A(e,(n,i)=>{A(s,({str:o,idx:c,tokenType:u})=>{if(i<c&&Ty(o,n.PATTERN)){let a=`Token: ->${u.name}<- can never be matched.
|
|
29
29
|
Because it appears AFTER the Token Type ->${n.name}<-in the lexer's definition.
|
|
30
|
-
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;r.push({message:a,type:se.UNREACHABLE_PATTERN,tokenTypes:[n,u]})}})}),r}function Ty(e,r){if(qe(r)){if(yy(r))return!1;let s=r.exec(e);return s!==null&&s.index===0}else if(Ue(r))return r(e,0,[],{});else if(
|
|
31
|
-
`,type:se.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE});if(!
|
|
32
|
-
`,type:se.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY});if(
|
|
33
|
-
`,type:se.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST});if(
|
|
34
|
-
`,type:se.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(
|
|
35
|
-
`,type:se.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})});return n}function nc(e,r,s){let n=[],i=!1,o=
|
|
30
|
+
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;r.push({message:a,type:se.UNREACHABLE_PATTERN,tokenTypes:[n,u]})}})}),r}function Ty(e,r){if(qe(r)){if(yy(r))return!1;let s=r.exec(e);return s!==null&&s.index===0}else if(Ue(r))return r(e,0,[],{});else if(x(r,"exec"))return r.exec(e,0,[],{});else if(typeof r==="string")return r===e;else throw Error("non exhaustive match")}function Ey(e){return Et([".","\\","[","]","|","^","$","(",")","?","*","+","{"],(s)=>e.source.indexOf(s)!==-1)===void 0}function yy(e){return/(\(\?=)|(\(\?!)|(\(\?<=)|(\(\?<!)/.test(e.source)}function ec(e){let r=e.ignoreCase?"iy":"y";return new RegExp(`${e.source}`,r)}function sc(e,r,s){let n=[];if(!x(e,$r))n.push({message:"A MultiMode Lexer cannot be initialized without a <"+$r+`> property in its definition
|
|
31
|
+
`,type:se.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE});if(!x(e,Tn))n.push({message:"A MultiMode Lexer cannot be initialized without a <"+Tn+`> property in its definition
|
|
32
|
+
`,type:se.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY});if(x(e,Tn)&&x(e,$r)&&!x(e.modes,e.defaultMode))n.push({message:`A MultiMode Lexer cannot be initialized with a ${$r}: <${e.defaultMode}>which does not exist
|
|
33
|
+
`,type:se.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST});if(x(e,Tn))A(e.modes,(i,o)=>{A(i,(c,u)=>{if(_e(c))n.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${o}> at index: <${u}>
|
|
34
|
+
`,type:se.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(x(c,"LONGER_ALT")){let a=R(c.LONGER_ALT)?c.LONGER_ALT:[c.LONGER_ALT];A(a,(f)=>{if(!_e(f)&&!ee(i,f))n.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${f.name}> on token <${c.name}> outside of mode <${o}>
|
|
35
|
+
`,type:se.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})});return n}function nc(e,r,s){let n=[],i=!1,o=dt(xe(D(e.modes))),c=qt(o,(a)=>a[or]===ie.NA),u=cc(s);if(r)A(c,(a)=>{let f=lc(a,u);if(f!==!1){let d={message:xy(a,f),type:f.issue,tokenType:a};n.push(d)}else if(x(a,"LINE_BREAKS")){if(a.LINE_BREAKS===!0)i=!0}else if(gn(u,a.PATTERN))i=!0});if(r&&!i)n.push({message:`Warning: No LINE_BREAKS Found.
|
|
36
36
|
This Lexer has been defined to track line and column information,
|
|
37
37
|
But none of the Token Types can be identified as matching a line terminator.
|
|
38
38
|
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
|
|
39
|
-
for details.`,type:se.NO_LINE_BREAKS_FLAGS});return n}function ic(e){let r={},s=B(e);return
|
|
39
|
+
for details.`,type:se.NO_LINE_BREAKS_FLAGS});return n}function ic(e){let r={},s=B(e);return A(s,(n)=>{let i=e[n];if(R(i))r[n]=[];else throw Error("non exhaustive match")}),r}function oc(e){let r=e.PATTERN;if(qe(r))return!1;else if(Ue(r))return!0;else if(x(r,"exec"))return!0;else if(Se(r))return!1;else throw Error("non exhaustive match")}function Ay(e){if(Se(e)&&e.length===1)return e.charCodeAt(0);else return!1}var ac={test:function(e){let r=e.length;for(let s=this.lastIndex;s<r;s++){let n=e.charCodeAt(s);if(n===10)return this.lastIndex=s+1,!0;else if(n===13){if(e.charCodeAt(s+1)===10)this.lastIndex=s+2;else this.lastIndex=s+1;return!0}}return!1},lastIndex:0};function lc(e,r){if(x(e,"LINE_BREAKS"))return!1;else if(qe(e.PATTERN)){try{gn(r,e.PATTERN)}catch(s){return{issue:se.IDENTIFY_TERMINATOR,errMsg:s.message}}return!1}else if(Se(e.PATTERN))return!1;else if(oc(e))return{issue:se.CUSTOM_LINE_BREAK};else throw Error("non exhaustive match")}function xy(e,r){if(r.issue===se.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
|
|
40
40
|
The problem is in the <${e.name}> Token Type
|
|
41
41
|
Root cause: ${r.errMsg}.
|
|
42
42
|
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;else if(r.issue===se.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
|
|
43
43
|
The problem is in the <${e.name}> Token Type
|
|
44
|
-
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;else throw Error("non exhaustive match")}function cc(e){return
|
|
44
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;else throw Error("non exhaustive match")}function cc(e){return E(e,(s)=>{if(Se(s))return s.charCodeAt(0);else return s})}function hi(e,r,s){if(e[r]===void 0)e[r]=[s];else e[r].push(s)}var Br=256,En=[];function yt(e){return e<Br?e:En[e]}function Sy(){if(_(En)){En=Array(65536);for(let e=0;e<65536;e++)En[e]=e>255?255+~~(e/255):e}}function Lt(e,r){let s=e.tokenTypeIdx;if(s===r.tokenTypeIdx)return!0;else return r.isParent===!0&&r.categoryMatchesMap[s]===!0}function Gr(e,r){return e.tokenTypeIdx===r.tokenTypeIdx}var uc=1,hc={};function It(e){let r=Ry(e);Oy(r),Iy(r),Ly(r),A(r,(s)=>{s.isParent=s.categoryMatches.length>0})}function Ry(e){let r=K(e),s=e,n=!0;while(n){s=dt(xe(E(s,(o)=>o.CATEGORIES)));let i=Ht(s,r);if(r=r.concat(i),_(i))n=!1;else s=i}return r}function Oy(e){A(e,(r)=>{if(!di(r))hc[uc]=r,r.tokenTypeIdx=uc++;if(fc(r)&&!R(r.CATEGORIES))r.CATEGORIES=[r.CATEGORIES];if(!fc(r))r.CATEGORIES=[];if(!Ny(r))r.categoryMatches=[];if(!by(r))r.categoryMatchesMap={}})}function Ly(e){A(e,(r)=>{r.categoryMatches=[],A(r.categoryMatchesMap,(s,n)=>{r.categoryMatches.push(hc[n].tokenTypeIdx)})})}function Iy(e){A(e,(r)=>{dc([],r)})}function dc(e,r){A(e,(s)=>{r.categoryMatchesMap[s.tokenTypeIdx]=!0}),A(r.CATEGORIES,(s)=>{let n=e.concat(r);if(!ee(n,s))dc(n,s)})}function di(e){return x(e,"tokenTypeIdx")}function fc(e){return x(e,"CATEGORIES")}function Ny(e){return x(e,"categoryMatches")}function by(e){return x(e,"categoryMatchesMap")}function pc(e){return x(e,"tokenTypeIdx")}var pi={buildUnableToPopLexerModeMessage(e){return`Unable to pop Lexer Mode after encountering Token ->${e.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(e,r,s,n,i,o){return`unexpected character: ->${e.charAt(r)}<- at offset: ${r}, skipped ${s} characters.`}};var se;(function(e){e[e.MISSING_PATTERN=0]="MISSING_PATTERN",e[e.INVALID_PATTERN=1]="INVALID_PATTERN",e[e.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",e[e.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",e[e.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",e[e.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",e[e.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",e[e.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",e[e.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",e[e.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",e[e.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",e[e.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",e[e.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",e[e.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",e[e.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",e[e.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",e[e.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",e[e.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"})(se||(se={}));var us={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
|
|
45
45
|
`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:pi,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(us);class ie{constructor(e,r=us){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(n,i)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;let o=Array(this.traceInitIndent+1).join("\t");if(this.traceInitIndent<this.traceInitMaxIdent)console.log(`${o}--> <${n}>`);let{time:c,value:u}=ns(i),a=c>10?console.warn:console.log;if(this.traceInitIndent<this.traceInitMaxIdent)a(`${o}<-- <${n}> time: ${c}ms`);return this.traceInitIndent--,u}else return i()},typeof r==="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
|
|
46
46
|
a boolean 2nd argument is no longer supported`);this.config=Ne({},us,r);let s=this.config.traceInitPerf;if(s===!0)this.traceInitMaxIdent=1/0,this.traceInitPerf=!0;else if(typeof s==="number")this.traceInitMaxIdent=s,this.traceInitPerf=!0;this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let n,i=!0;if(this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===us.lineTerminatorsPattern)this.config.lineTerminatorsPattern=ac;else if(this.config.lineTerminatorCharacters===us.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
|
|
47
|
-
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(r.safeMode&&r.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');if(this.trackStartLines=/full|onlyStart/i.test(this.config.positionTracking),this.trackEndLines=/full/i.test(this.config.positionTracking),
|
|
47
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(r.safeMode&&r.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');if(this.trackStartLines=/full|onlyStart/i.test(this.config.positionTracking),this.trackEndLines=/full/i.test(this.config.positionTracking),R(e))n={modes:{defaultMode:K(e)},defaultMode:$r};else i=!1,n=K(e)}),this.config.skipValidations===!1)this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(sc(n,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(nc(n,this.trackStartLines,this.config.lineTerminatorCharacters))});n.modes=n.modes?n.modes:{},A(n.modes,(c,u)=>{n.modes[u]=qt(c,(a)=>_e(a))});let o=B(n.modes);if(A(n.modes,(c,u)=>{this.TRACE_INIT(`Mode: <${u}> processing`,()=>{if(this.modes.push(u),this.config.skipValidations===!1)this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(rc(c,o))});if(_(this.lexerDefinitionErrors)){It(c);let a;this.TRACE_INIT("analyzeTokenTypes",()=>{a=tc(c,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:r.positionTracking,ensureOptimizations:r.ensureOptimizations,safeMode:r.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[u]=a.patternIdxToConfig,this.charCodeToPatternIdxToConfig[u]=a.charCodeToPatternIdxToConfig,this.emptyGroups=Ne({},this.emptyGroups,a.emptyGroups),this.hasCustom=a.hasCustom||this.hasCustom,this.canModeBeOptimized[u]=a.canBeOptimized}})}),this.defaultMode=n.defaultMode,!_(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){let u=E(this.lexerDefinitionErrors,(a)=>a.message).join(`-----------------------
|
|
48
48
|
`);throw Error(`Errors detected in definition of Lexer:
|
|
49
|
-
`+u)}
|
|
49
|
+
`+u)}A(this.lexerDefinitionWarning,(c)=>{ss(c.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(i)this.handleModes=le;if(this.trackStartLines===!1)this.computeNewColumn=tt;if(this.trackEndLines===!1)this.updateTokenEndLineColumnLocation=le;if(/full/i.test(this.config.positionTracking))this.createTokenInstance=this.createFullToken;else if(/onlyStart/i.test(this.config.positionTracking))this.createTokenInstance=this.createStartOnlyToken;else if(/onlyOffset/i.test(this.config.positionTracking))this.createTokenInstance=this.createOffsetOnlyToken;else throw Error(`Invalid <positionTracking> config option: "${this.config.positionTracking}"`);if(this.hasCustom)this.addToken=this.addTokenUsingPush,this.handlePayload=this.handlePayloadWithCustom;else this.addToken=this.addTokenUsingMemberAccess,this.handlePayload=this.handlePayloadNoCustom}),this.TRACE_INIT("Failed Optimization Warnings",()=>{let c=Te(this.canModeBeOptimized,(u,a,f)=>{if(a===!1)u.push(f);return u},[]);if(r.ensureOptimizations&&!_(c))throw Error(`Lexer Modes: < ${c.join(", ")} > cannot be optimized.
|
|
50
50
|
Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
|
|
51
|
-
Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{Xl()}),this.TRACE_INIT("toFastProperties",()=>{is(this)})})}tokenize(e,r=this.defaultMode){if(!
|
|
51
|
+
Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{Xl()}),this.TRACE_INIT("toFastProperties",()=>{is(this)})})}tokenize(e,r=this.defaultMode){if(!_(this.lexerDefinitionErrors)){let n=E(this.lexerDefinitionErrors,(i)=>i.message).join(`-----------------------
|
|
52
52
|
`);throw Error(`Unable to Tokenize because Errors detected in definition of Lexer:
|
|
53
|
-
`+n)}return this.tokenizeInternal(e,r)}tokenizeInternal(e,r){let s,n,i,o,c,u,a,f,h,d,p,T,
|
|
54
|
-
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;if(
|
|
55
|
-
but found: '`+Le(r).image+"'";if(n)return"Expecting: "+n+u;else{let a=Te(e,(p,T)=>p.concat(T),[]),f=
|
|
56
|
-
${
|
|
53
|
+
`+n)}return this.tokenizeInternal(e,r)}tokenizeInternal(e,r){let s,n,i,o,c,u,a,f,h,d,p,T,I,N,O,y=e,S=y.length,g=0,k=0,Q=this.hasCustom?0:Math.floor(e.length/10),Ce=Array(Q),Yr=[],At=this.trackStartLines?1:void 0,ot=this.trackStartLines?1:void 0,Xr=ic(this.emptyGroups),ff=this.trackStartLines,Xn=this.config.lineTerminatorsPattern,Is=0,vt=[],qr=[],Jr=[],qi=[];Object.freeze(qi);let Zr=!1,hf=(Be)=>{if(Jr.length===1&&Be.tokenType.PUSH_MODE===void 0){let Ye=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(Be);Yr.push({offset:Be.startOffset,line:Be.startLine,column:Be.startColumn,length:Be.image.length,message:Ye})}else{Jr.pop();let Ye=st(Jr);vt=this.patternIdxToConfig[Ye],qr=this.charCodeToPatternIdxToConfig[Ye],Is=vt.length;let qn=this.canModeBeOptimized[Ye]&&this.config.safeMode===!1;if(qr&&qn)Zr=!0;else Zr=!1}};function Ji(Be){Jr.push(Be),qr=this.charCodeToPatternIdxToConfig[Be],vt=this.patternIdxToConfig[Be],Is=vt.length,Is=vt.length;let Ye=this.canModeBeOptimized[Be]&&this.config.safeMode===!1;if(qr&&Ye)Zr=!0;else Zr=!1}Ji.call(this,r);let et,Zi=this.config.recoveryEnabled;while(g<S){u=null,h=-1;let Be=y.charCodeAt(g),Ye;if(Zr){let we=yt(Be),Xe=qr[we];Ye=Xe!==void 0?Xe:qi}else Ye=vt;let qn=Ye.length;for(s=0;s<qn;s++){et=Ye[s];let we=et.pattern;a=null;let Xe=et.short;if(Xe!==!1){if(Be===Xe)h=1,u=we}else if(et.isCustom===!0)if(O=we.exec(y,g,Ce,Xr),O!==null){if(u=O[0],h=u.length,O.payload!==void 0)a=O.payload}else u=null;else we.lastIndex=g,h=this.matchLength(we,e,g);if(h!==-1){if(c=et.longerAlt,c!==void 0){u=e.substring(g,g+h);let kt=c.length;for(i=0;i<kt;i++){let xt=vt[c[i]],Qt=xt.pattern;if(f=null,xt.isCustom===!0)if(O=Qt.exec(y,g,Ce,Xr),O!==null){if(o=O[0],O.payload!==void 0)f=O.payload}else o=null;else Qt.lastIndex=g,o=this.match(Qt,e,g);if(o&&o.length>u.length){u=o,h=o.length,a=f,et=xt;break}}}break}}if(h!==-1){if(d=et.group,d!==void 0)if(u=u!==null?u:e.substring(g,g+h),p=et.tokenTypeIdx,T=this.createTokenInstance(u,g,p,et.tokenType,At,ot,h),this.handlePayload(T,a),d===!1)k=this.addToken(Ce,k,T);else Xr[d].push(T);if(ff===!0&&et.canLineTerminator===!0){let we=0,Xe,kt;Xn.lastIndex=0;do if(u=u!==null?u:e.substring(g,g+h),Xe=Xn.test(u),Xe===!0)kt=Xn.lastIndex-1,we++;while(Xe===!0);if(we!==0)At=At+we,ot=h-kt,this.updateTokenEndLineColumnLocation(T,d,kt,we,At,ot,h);else ot=this.computeNewColumn(ot,h)}else ot=this.computeNewColumn(ot,h);g=g+h,this.handleModes(et,hf,Ji,T)}else{let we=g,Xe=At,kt=ot,xt=Zi===!1;while(xt===!1&&g<S){g++;for(n=0;n<Is;n++){let Qt=vt[n],{pattern:Jn,short:Qi}=Qt;if(Qi!==!1){if(y.charCodeAt(g)===Qi)xt=!0}else if(Qt.isCustom===!0)xt=Jn.exec(y,g,Ce,Xr)!==null;else Jn.lastIndex=g,xt=Jn.exec(e)!==null;if(xt===!0)break}}if(I=g-we,ot=this.computeNewColumn(ot,I),N=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(y,we,I,Xe,kt,st(Jr)),Yr.push({offset:we,line:Xe,column:kt,length:I,message:N}),Zi===!1)break}}if(!this.hasCustom)Ce.length=k;return{tokens:Ce,groups:Xr,errors:Yr}}handleModes(e,r,s,n){if(e.pop===!0){let i=e.push;if(r(n),i!==void 0)s.call(this,i)}else if(e.push!==void 0)s.call(this,e.push)}updateTokenEndLineColumnLocation(e,r,s,n,i,o,c){let u,a;if(r!==void 0){if(u=s===c-1,a=u?-1:0,!(n===1&&u===!0))e.endLine=i+a,e.endColumn=o-1+-a}}computeNewColumn(e,r){return e+r}createOffsetOnlyToken(e,r,s,n){return{image:e,startOffset:r,tokenTypeIdx:s,tokenType:n}}createStartOnlyToken(e,r,s,n,i,o){return{image:e,startOffset:r,startLine:i,startColumn:o,tokenTypeIdx:s,tokenType:n}}createFullToken(e,r,s,n,i,o,c){return{image:e,startOffset:r,endOffset:r+c-1,startLine:i,endLine:i,startColumn:o,endColumn:o+c-1,tokenTypeIdx:s,tokenType:n}}addTokenUsingPush(e,r,s){return e.push(s),r}addTokenUsingMemberAccess(e,r,s){return e[r]=s,r++,r}handlePayloadNoCustom(e,r){}handlePayloadWithCustom(e,r){if(r!==null)e.payload=r}match(e,r,s){if(e.test(r)===!0)return r.substring(s,e.lastIndex);return null}matchLength(e,r,s){if(e.test(r)===!0)return e.lastIndex-s;return-1}}ie.SKIPPED="This marks a skipped Token pattern, this means each token identified by it will be consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.";ie.NA=/NOT_APPLICABLE/;function ar(e){if(mi(e))return e.LABEL;else return e.name}function mi(e){return Se(e.LABEL)&&e.LABEL!==""}var Cy="parent",mc="categories",gc="label",Tc="group",Ec="push_mode",yc="pop_mode",Ac="longer_alt",xc="line_breaks",Sc="start_chars_hint";function L(e){return vy(e)}function vy(e){let r=e.pattern,s={};if(s.name=e.name,!_e(r))s.PATTERN=r;if(x(e,Cy))throw`The parent property is no longer supported.
|
|
54
|
+
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;if(x(e,mc))s.CATEGORIES=e[mc];if(It([s]),x(e,gc))s.LABEL=e[gc];if(x(e,Tc))s.GROUP=e[Tc];if(x(e,yc))s.POP_MODE=e[yc];if(x(e,Ec))s.PUSH_MODE=e[Ec];if(x(e,Ac))s.LONGER_ALT=e[Ac];if(x(e,xc))s.LINE_BREAKS=e[xc];if(x(e,Sc))s.START_CHARS_HINT=e[Sc];return s}var Ve=L({name:"EOF",pattern:ie.NA});It([Ve]);function lr(e,r,s,n,i,o,c,u){return{image:r,startOffset:s,endOffset:n,startLine:i,endLine:o,startColumn:c,endColumn:u,tokenTypeIdx:e.tokenTypeIdx,tokenType:e}}function fs(e,r){return Lt(e,r)}var yn={buildMismatchTokenMessage({expected:e,actual:r,previous:s,ruleName:n}){return`Expecting ${mi(e)?`--> ${ar(e)} <--`:`token of type --> ${e.name} <--`} but found --> '${r.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:e,ruleName:r}){return"Redundant input, expecting EOF but found: "+e.image},buildNoViableAltMessage({expectedPathsPerAlt:e,actual:r,previous:s,customUserDescription:n,ruleName:i}){let u=`
|
|
55
|
+
but found: '`+Le(r).image+"'";if(n)return"Expecting: "+n+u;else{let a=Te(e,(p,T)=>p.concat(T),[]),f=E(a,(p)=>`[${E(p,(T)=>ar(T)).join(", ")}]`);return`Expecting: one of these possible Token sequences:
|
|
56
|
+
${E(f,(p,T)=>` ${T+1}. ${p}`).join(`
|
|
57
57
|
`)}`+u}},buildEarlyExitMessage({expectedIterationPaths:e,actual:r,customUserDescription:s,ruleName:n}){let c=`
|
|
58
58
|
but found: '`+Le(r).image+"'";if(s)return"Expecting: "+s+c;else return`Expecting: expecting at least one iteration which starts with one of these possible Token sequences::
|
|
59
|
-
<${
|
|
60
|
-
inside top level rule: ->`+e.name+"<-"}},nt={buildDuplicateFoundError(e,r){function s(h){if(h instanceof
|
|
59
|
+
<${E(e,(f)=>`[${E(f,(h)=>ar(h)).join(",")}]`).join(" ,")}>`+c}};Object.freeze(yn);var Rc={buildRuleNotFoundError(e,r){return"Invalid grammar, reference to a rule which is not defined: ->"+r.nonTerminalName+`<-
|
|
60
|
+
inside top level rule: ->`+e.name+"<-"}},nt={buildDuplicateFoundError(e,r){function s(h){if(h instanceof M)return h.terminalType.name;else if(h instanceof J)return h.nonTerminalName;else return""}let n=e.name,i=Le(r),o=i.idx,c=ze(i),u=s(i),a=o>0,f=`->${c}${a?o:""}<- ${u?`with argument: ->${u}<-`:""}
|
|
61
61
|
appears more than once (${r.length} times) in the top level rule: ->${n}<-.
|
|
62
62
|
For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES
|
|
63
63
|
`;return f=f.replace(/[ \t]+/g," "),f=f.replace(/\s\s+/g,`
|
|
@@ -65,57 +65,57 @@ inside top level rule: ->`+e.name+"<-"}},nt={buildDuplicateFoundError(e,r){funct
|
|
|
65
65
|
The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${e.name}>.
|
|
66
66
|
To resolve this make sure each Terminal and Non-Terminal names are unique
|
|
67
67
|
This is easy to accomplish by using the convention that Terminal names start with an uppercase letter
|
|
68
|
-
and Non-Terminal names start with a lower case letter.`},buildAlternationPrefixAmbiguityError(e){let r=
|
|
68
|
+
and Non-Terminal names start with a lower case letter.`},buildAlternationPrefixAmbiguityError(e){let r=E(e.prefixPath,(i)=>ar(i)).join(", "),s=e.alternation.idx===0?"":e.alternation.idx;return`Ambiguous alternatives: <${e.ambiguityIndices.join(" ,")}> due to common lookahead prefix
|
|
69
69
|
in <OR${s}> inside <${e.topLevelRule.name}> Rule,
|
|
70
70
|
<${r}> may appears as a prefix path in all these alternatives.
|
|
71
71
|
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX
|
|
72
72
|
For Further details.`},buildAlternationAmbiguityError(e){let r=e.alternation.idx===0?"":e.alternation.idx,s=e.prefixPath.length===0,n=`Ambiguous Alternatives Detected: <${e.ambiguityIndices.join(" ,")}> in <OR${r}> inside <${e.topLevelRule.name}> Rule,
|
|
73
73
|
`;if(s)n+=`These alternatives are all empty (match no tokens), making them indistinguishable.
|
|
74
74
|
Only the last alternative may be empty.
|
|
75
|
-
`;else{let i=
|
|
75
|
+
`;else{let i=E(e.prefixPath,(o)=>ar(o)).join(", ");n+=`<${i}> may appears as a prefix path in all these alternatives.
|
|
76
76
|
`}return n+=`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
|
|
77
77
|
For Further details.`,n},buildEmptyRepetitionError(e){let r=ze(e.repetition);if(e.repetition.idx!==0)r+=e.repetition.idx;return`The repetition <${r}> within Rule <${e.topLevelRule.name}> can never consume any tokens.
|
|
78
78
|
This could lead to an infinite loop.`},buildTokenNameError(e){return"deprecated"},buildEmptyAlternationError(e){return`Ambiguous empty alternative: <${e.emptyChoiceIdx+1}> in <OR${e.alternation.idx}> inside <${e.topLevelRule.name}> Rule.
|
|
79
79
|
Only the last alternative may be an empty alternative.`},buildTooManyAlternativesError(e){return`An Alternation cannot have more than 256 alternatives:
|
|
80
80
|
<OR${e.alternation.idx}> inside <${e.topLevelRule.name}> Rule.
|
|
81
|
-
has ${e.alternation.definition.length+1} alternatives.`},buildLeftRecursionError(e){let r=e.topLevelRule.name,s=
|
|
81
|
+
has ${e.alternation.definition.length+1} alternatives.`},buildLeftRecursionError(e){let r=e.topLevelRule.name,s=E(e.leftRecursionPath,(o)=>o.name),n=`${r} --> ${s.concat([r]).join(" --> ")}`;return`Left Recursion found in grammar.
|
|
82
82
|
rule: <${r}> can be invoked from itself (directly or indirectly)
|
|
83
83
|
without consuming any Tokens. The grammar path that causes this is:
|
|
84
84
|
${n}
|
|
85
85
|
To fix this refactor your grammar to remove the left recursion.
|
|
86
|
-
see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(e){return"deprecated"},buildDuplicateRuleNameError(e){let r;if(e.topLevelRule instanceof je)r=e.topLevelRule.name;else r=e.topLevelRule;return`Duplicate definition, rule: ->${r}<- is already defined in the grammar: ->${e.grammarName}<-`}};function Oc(e,r){let s=new Lc(e,r);return s.resolveRefs(),s.errors}class Lc extends Ke{constructor(e,r){super();this.nameToTopRule=e,this.errMsgProvider=r,this.errors=[]}resolveRefs(){x(D(this.nameToTopRule),(e)=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){let r=this.nameToTopRule[e.nonTerminalName];if(!r){let s=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:s,type:Re.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}else e.referencedRule=r}}class Ic extends Jt{constructor(e,r){super();this.topProd=e,this.path=r,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=K(this.path.ruleStack).reverse(),this.occurrenceStack=K(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,r=[]){if(!this.found)super.walk(e,r)}walkProdRef(e,r,s){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){let n=r.concat(s);this.updateExpectedNext(),this.walk(e.referencedRule,n)}}updateExpectedNext(){if(M(this.ruleStack))this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0;else this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop()}}class gi extends Ic{constructor(e,r){super(e,r);this.path=r,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,r,s){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){let n=r.concat(s),i=new Z({definition:n});this.possibleTokTypes=sr(i),this.found=!0}}}class hs extends Jt{constructor(e,r){super();this.topRule=e,this.occurrence=r,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}}class Ti extends hs{walkMany(e,r,s){if(e.idx===this.occurrence){let n=Le(r.concat(s));if(this.result.isEndOfRule=n===void 0,n instanceof w)this.result.token=n.terminalType,this.result.occurrence=n.idx}else super.walkMany(e,r,s)}}class An extends hs{walkManySep(e,r,s){if(e.idx===this.occurrence){let n=Le(r.concat(s));if(this.result.isEndOfRule=n===void 0,n instanceof w)this.result.token=n.terminalType,this.result.occurrence=n.idx}else super.walkManySep(e,r,s)}}class Ei extends hs{walkAtLeastOne(e,r,s){if(e.idx===this.occurrence){let n=Le(r.concat(s));if(this.result.isEndOfRule=n===void 0,n instanceof w)this.result.token=n.terminalType,this.result.occurrence=n.idx}else super.walkAtLeastOne(e,r,s)}}class xn extends hs{walkAtLeastOneSep(e,r,s){if(e.idx===this.occurrence){let n=Le(r.concat(s));if(this.result.isEndOfRule=n===void 0,n instanceof w)this.result.token=n.terminalType,this.result.occurrence=n.idx}else super.walkAtLeastOneSep(e,r,s)}}function Rn(e,r,s=[]){s=K(s);let n=[],i=0;function o(u){return u.concat(fe(e,i+1))}function c(u){let a=Rn(o(u),r,s);return n.concat(a)}while(s.length<r&&i<e.length){let u=e[i];if(u instanceof Z)return c(u.definition);else if(u instanceof J)return c(u.definition);else if(u instanceof re)n=c(u.definition);else if(u instanceof Ee){let a=u.definition.concat([new U({definition:u.definition})]);return c(a)}else if(u instanceof ye){let a=[new Z({definition:u.definition}),new U({definition:[new w({terminalType:u.separator})].concat(u.definition)})];return c(a)}else if(u instanceof he){let a=u.definition.concat([new U({definition:[new w({terminalType:u.separator})].concat(u.definition)})]);n=c(a)}else if(u instanceof U){let a=u.definition.concat([new U({definition:u.definition})]);n=c(a)}else if(u instanceof de)return x(u.definition,(a)=>{if(M(a.definition)===!1)n=c(a.definition)}),n;else if(u instanceof w)s.push(u.terminalType);else throw Error("non exhaustive match");i++}return n.push({partialPath:s,suffixDef:fe(e,i)}),n}function On(e,r,s,n){let o=["EXIT_NONE_TERMINAL"],c="EXIT_ALTERNATIVE",u=!1,a=r.length,f=a-n-1,h=[],d=[];d.push({idx:-1,def:e,ruleStack:[],occurrenceStack:[]});while(!M(d)){let p=d.pop();if(p==="EXIT_ALTERNATIVE"){if(u&&st(d).idx<=f)d.pop();continue}let{def:T,idx:C,ruleStack:v,occurrenceStack:I}=p;if(M(T))continue;let A=T[0];if(A==="EXIT_NONE_TERMINAL"){let R={idx:C,def:fe(T),ruleStack:Ot(v),occurrenceStack:Ot(I)};d.push(R)}else if(A instanceof w)if(C<a-1){let R=C+1,g=r[R];if(s(g,A.terminalType)){let _={idx:R,def:fe(T),ruleStack:v,occurrenceStack:I};d.push(_)}}else if(C===a-1)h.push({nextTokenType:A.terminalType,nextTokenOccurrence:A.idx,ruleStack:v,occurrenceStack:I}),u=!0;else throw Error("non exhaustive match");else if(A instanceof J){let R=K(v);R.push(A.nonTerminalName);let g=K(I);g.push(A.idx);let _={idx:C,def:A.definition.concat(o,fe(T)),ruleStack:R,occurrenceStack:g};d.push(_)}else if(A instanceof re){let R={idx:C,def:fe(T),ruleStack:v,occurrenceStack:I};d.push(R),d.push("EXIT_ALTERNATIVE");let g={idx:C,def:A.definition.concat(fe(T)),ruleStack:v,occurrenceStack:I};d.push(g)}else if(A instanceof Ee){let R=new U({definition:A.definition,idx:A.idx}),g=A.definition.concat([R],fe(T)),_={idx:C,def:g,ruleStack:v,occurrenceStack:I};d.push(_)}else if(A instanceof ye){let R=new w({terminalType:A.separator}),g=new U({definition:[R].concat(A.definition),idx:A.idx}),_=A.definition.concat([g],fe(T)),Q={idx:C,def:_,ruleStack:v,occurrenceStack:I};d.push(Q)}else if(A instanceof he){let R={idx:C,def:fe(T),ruleStack:v,occurrenceStack:I};d.push(R),d.push("EXIT_ALTERNATIVE");let g=new w({terminalType:A.separator}),_=new U({definition:[g].concat(A.definition),idx:A.idx}),Q=A.definition.concat([_],fe(T)),Ce={idx:C,def:Q,ruleStack:v,occurrenceStack:I};d.push(Ce)}else if(A instanceof U){let R={idx:C,def:fe(T),ruleStack:v,occurrenceStack:I};d.push(R),d.push("EXIT_ALTERNATIVE");let g=new U({definition:A.definition,idx:A.idx}),_=A.definition.concat([g],fe(T)),Q={idx:C,def:_,ruleStack:v,occurrenceStack:I};d.push(Q)}else if(A instanceof de)for(let R=A.definition.length-1;R>=0;R--){let g=A.definition[R],_={idx:C,def:g.definition.concat(fe(T)),ruleStack:v,occurrenceStack:I};d.push(_),d.push("EXIT_ALTERNATIVE")}else if(A instanceof Z)d.push({idx:C,def:A.definition.concat(fe(T)),ruleStack:v,occurrenceStack:I});else if(A instanceof je)d.push(ky(A,C,v,I));else throw Error("non exhaustive match")}return h}function ky(e,r,s,n){let i=K(s);i.push(e.name);let o=K(n);return o.push(1),{idx:r,def:e.definition,ruleStack:i,occurrenceStack:o}}var oe;(function(e){e[e.OPTION=0]="OPTION",e[e.REPETITION=1]="REPETITION",e[e.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",e[e.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",e[e.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",e[e.ALTERNATION=5]="ALTERNATION"})(oe||(oe={}));function Ln(e){if(e instanceof re||e==="Option")return oe.OPTION;else if(e instanceof U||e==="Repetition")return oe.REPETITION;else if(e instanceof Ee||e==="RepetitionMandatory")return oe.REPETITION_MANDATORY;else if(e instanceof ye||e==="RepetitionMandatoryWithSeparator")return oe.REPETITION_MANDATORY_WITH_SEPARATOR;else if(e instanceof he||e==="RepetitionWithSeparator")return oe.REPETITION_WITH_SEPARATOR;else if(e instanceof de||e==="Alternation")return oe.ALTERNATION;else throw Error("non exhaustive match")}function bc(e,r,s,n,i,o){let c=ds(e,r,s),u=Pc(c)?Gr:Lt;return o(c,n,u,i)}function Cc(e,r,s,n,i,o){let c=ps(e,r,i,s),u=Pc(c)?Gr:Lt;return o(c[0],u,n)}function vc(e,r,s,n){let i=e.length,o=ve(e,(c)=>ve(c,(u)=>u.length===1));if(r)return function(c){let u=y(c,(a)=>a.GATE);for(let a=0;a<i;a++){let f=e[a],h=f.length,d=u[a];if(d!==void 0&&d.call(this)===!1)continue;e:for(let p=0;p<h;p++){let T=f[p],C=T.length;for(let v=0;v<C;v++){let I=this.LA(v+1);if(s(I,T[v])===!1)continue e}return a}}return};else if(o&&!n){let c=y(e,(a)=>xe(a)),u=Te(c,(a,f,h)=>(x(f,(d)=>{if(!S(a,d.tokenTypeIdx))a[d.tokenTypeIdx]=h;x(d.categoryMatches,(p)=>{if(!S(a,p))a[p]=h})}),a),{});return function(){let a=this.LA(1);return u[a.tokenTypeIdx]}}else return function(){for(let c=0;c<i;c++){let u=e[c],a=u.length;e:for(let f=0;f<a;f++){let h=u[f],d=h.length;for(let p=0;p<d;p++){let T=this.LA(p+1);if(s(T,h[p])===!1)continue e}return c}}return}}function kc(e,r,s){let n=ve(e,(o)=>o.length===1),i=e.length;if(n&&!s){let o=xe(e);if(o.length===1&&M(o[0].categoryMatches)){let u=o[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===u}}else{let c=Te(o,(u,a,f)=>(u[a.tokenTypeIdx]=!0,x(a.categoryMatches,(h)=>{u[h]=!0}),u),[]);return function(){let u=this.LA(1);return c[u.tokenTypeIdx]===!0}}}else return function(){e:for(let o=0;o<i;o++){let c=e[o],u=c.length;for(let a=0;a<u;a++){let f=this.LA(a+1);if(r(f,c[a])===!1)continue e}return!0}return!1}}class _c extends Jt{constructor(e,r,s){super();this.topProd=e,this.targetOccurrence=r,this.targetProdType=s}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,r,s,n){if(e.idx===this.targetOccurrence&&this.targetProdType===r)return this.restDef=s.concat(n),!0;return!1}walkOption(e,r,s){if(!this.checkIsTarget(e,oe.OPTION,r,s))super.walkOption(e,r,s)}walkAtLeastOne(e,r,s){if(!this.checkIsTarget(e,oe.REPETITION_MANDATORY,r,s))super.walkOption(e,r,s)}walkAtLeastOneSep(e,r,s){if(!this.checkIsTarget(e,oe.REPETITION_MANDATORY_WITH_SEPARATOR,r,s))super.walkOption(e,r,s)}walkMany(e,r,s){if(!this.checkIsTarget(e,oe.REPETITION,r,s))super.walkOption(e,r,s)}walkManySep(e,r,s){if(!this.checkIsTarget(e,oe.REPETITION_WITH_SEPARATOR,r,s))super.walkOption(e,r,s)}}class Ai extends Ke{constructor(e,r,s){super();this.targetOccurrence=e,this.targetProdType=r,this.targetRef=s,this.result=[]}checkIsTarget(e,r){if(e.idx===this.targetOccurrence&&this.targetProdType===r&&(this.targetRef===void 0||e===this.targetRef))this.result=e.definition}visitOption(e){this.checkIsTarget(e,oe.OPTION)}visitRepetition(e){this.checkIsTarget(e,oe.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,oe.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,oe.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,oe.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,oe.ALTERNATION)}}function Nc(e){let r=Array(e);for(let s=0;s<e;s++)r[s]=[];return r}function yi(e){let r=[""];for(let s=0;s<e.length;s++){let n=e[s],i=[];for(let o=0;o<r.length;o++){let c=r[o];i.push(c+"_"+n.tokenTypeIdx);for(let u=0;u<n.categoryMatches.length;u++){let a="_"+n.categoryMatches[u];i.push(c+a)}}r=i}return r}function _y(e,r,s){for(let n=0;n<e.length;n++){if(n===s)continue;let i=e[n];for(let o=0;o<r.length;o++){let c=r[o];if(i[c]===!0)return!1}}return!0}function Mc(e,r){let s=y(e,(c)=>Rn([c],1)),n=Nc(s.length),i=y(s,(c)=>{let u={};return x(c,(a)=>{let f=yi(a.partialPath);x(f,(h)=>{u[h]=!0})}),u}),o=s;for(let c=1;c<=r;c++){let u=o;o=Nc(u.length);for(let a=0;a<u.length;a++){let f=u[a];for(let h=0;h<f.length;h++){let d=f[h].partialPath,p=f[h].suffixDef,T=yi(d);if(_y(i,T,a)||M(p)||d.length===r){let v=n[a];if(In(v,d)===!1){v.push(d);for(let I=0;I<T.length;I++){let A=T[I];i[a][A]=!0}}}else{let v=Rn(p,c+1,d);o[a]=o[a].concat(v),x(v,(I)=>{let A=yi(I.partialPath);x(A,(R)=>{i[a][R]=!0})})}}}}return n}function ds(e,r,s,n){let i=new Ai(e,oe.ALTERNATION,n);return r.accept(i),Mc(i.result,s)}function ps(e,r,s,n){let i=new Ai(e,s);r.accept(i);let o=i.result,u=new _c(r,e,s).startWalking(),a=new Z({definition:o}),f=new Z({definition:u});return Mc([a,f],n)}function In(e,r){e:for(let s=0;s<e.length;s++){let n=e[s];if(n.length!==r.length)continue;for(let i=0;i<n.length;i++){let o=r[i],c=n[i];if((o===c||c.categoryMatchesMap[o.tokenTypeIdx]!==void 0)===!1)continue e}return!0}return!1}function wc(e,r){return e.length<r.length&&ve(e,(s,n)=>{let i=r[n];return s===i||i.categoryMatchesMap[s.tokenTypeIdx]})}function Pc(e){return ve(e,(r)=>ve(r,(s)=>ve(s,(n)=>M(n.categoryMatches))))}function Uc(e){let r=e.lookaheadStrategy.validate({rules:e.rules,tokenTypes:e.tokenTypes,grammarName:e.grammarName});return y(r,(s)=>Object.assign({type:Re.CUSTOM_LOOKAHEAD_VALIDATION},s))}function Dc(e,r,s,n){let i=De(e,(a)=>My(a,s)),o=By(e,r,s),c=De(e,(a)=>Uy(a,s)),u=De(e,(a)=>Py(a,e,n,s));return i.concat(o,c,u)}function My(e,r){let s=new Bc;e.accept(s);let n=s.allProductions,i=ii(n,wy),o=We(i,(u)=>u.length>1);return y(D(o),(u)=>{let a=Le(u),f=r.buildDuplicateFoundError(e,u),h=ze(a),d={message:f,type:Re.DUPLICATE_PRODUCTIONS,ruleName:e.name,dslName:h,occurrence:a.idx},p=Fc(a);if(p)d.parameter=p;return d})}function wy(e){return`${ze(e)}_#_${e.idx}_#_${Fc(e)}`}function Fc(e){if(e instanceof w)return e.terminalType.name;else if(e instanceof J)return e.nonTerminalName;else return""}class Bc extends Ke{constructor(){super(...arguments);this.allProductions=[]}visitNonTerminal(e){this.allProductions.push(e)}visitOption(e){this.allProductions.push(e)}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}visitAlternation(e){this.allProductions.push(e)}visitTerminal(e){this.allProductions.push(e)}}function Py(e,r,s,n){let i=[];if(Te(r,(c,u)=>{if(u.name===e.name)return c+1;return c},0)>1){let c=n.buildDuplicateRuleNameError({topLevelRule:e,grammarName:s});i.push({message:c,type:Re.DUPLICATE_RULE_NAME,ruleName:e.name})}return i}function $c(e,r,s){let n=[],i;if(!ee(r,e))i=`Invalid rule override, rule: ->${e}<- cannot be overridden in the grammar: ->${s}<-as it is not defined in any of the super grammars `,n.push({message:i,type:Re.INVALID_RULE_OVERRIDE,ruleName:e});return n}function xi(e,r,s,n=[]){let i=[],o=Nn(r.definition);if(M(o))return[];else{let c=e.name;if(ee(o,e))i.push({message:s.buildLeftRecursionError({topLevelRule:e,leftRecursionPath:n}),type:Re.LEFT_RECURSION,ruleName:c});let a=Ht(o,n.concat([e])),f=De(a,(h)=>{let d=K(n);return d.push(h),xi(e,h,s,d)});return i.concat(f)}}function Nn(e){let r=[];if(M(e))return r;let s=Le(e);if(s instanceof J)r.push(s.referencedRule);else if(s instanceof Z||s instanceof re||s instanceof Ee||s instanceof ye||s instanceof he||s instanceof U)r=r.concat(Nn(s.definition));else if(s instanceof de)r=xe(y(s.definition,(o)=>Nn(o.definition)));else if(s instanceof w);else throw Error("non exhaustive match");let n=rr(s),i=e.length>1;if(n&&i){let o=fe(e);return r.concat(Nn(o))}else return r}class bn extends Ke{constructor(){super(...arguments);this.alternations=[]}visitAlternation(e){this.alternations.push(e)}}function Gc(e,r){let s=new bn;e.accept(s);let n=s.alternations;return De(n,(o)=>{let c=Ot(o.definition);return De(c,(u,a)=>{let f=On([u],[],Lt,1);if(M(f))return[{message:r.buildEmptyAlternationError({topLevelRule:e,alternation:o,emptyChoiceIdx:a}),type:Re.NONE_LAST_EMPTY_ALT,ruleName:e.name,occurrence:o.idx,alternative:a+1}];else return[]})})}function Wc(e,r,s){let n=new bn;e.accept(n);let i=n.alternations;return i=qt(i,(c)=>c.ignoreAmbiguities===!0),De(i,(c)=>{let u=c.idx,a=c.maxLookahead||r,f=ds(u,e,a,c),h=Dy(f,c,e,s),d=Fy(f,c,e,s);return h.concat(d)})}class jc extends Ke{constructor(){super(...arguments);this.allProductions=[]}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}}function Uy(e,r){let s=new bn;e.accept(s);let n=s.alternations;return De(n,(o)=>{if(o.definition.length>255)return[{message:r.buildTooManyAlternativesError({topLevelRule:e,alternation:o}),type:Re.TOO_MANY_ALTS,ruleName:e.name,occurrence:o.idx}];else return[]})}function Kc(e,r,s){let n=[];return x(e,(i)=>{let o=new jc;i.accept(o);let c=o.allProductions;x(c,(u)=>{let a=Ln(u),f=u.maxLookahead||r,h=u.idx,p=ps(h,i,a,f)[0];if(M(xe(p))){let T=s.buildEmptyRepetitionError({topLevelRule:i,repetition:u});n.push({message:T,type:Re.NO_NON_EMPTY_LOOKAHEAD,ruleName:i.name})}})}),n}function Dy(e,r,s,n){let i=[],o=Te(e,(u,a,f)=>{if(r.definition[f].ignoreAmbiguities===!0)return u;return x(a,(h)=>{let d=[f];if(x(e,(p,T)=>{if(f!==T&&In(p,h)&&r.definition[T].ignoreAmbiguities!==!0)d.push(T)}),d.length>1&&!In(i,h))i.push(h),u.push({alts:d,path:h})}),u},[]);return y(o,(u)=>{let a=y(u.alts,(h)=>h+1);return{message:n.buildAlternationAmbiguityError({topLevelRule:s,alternation:r,ambiguityIndices:a,prefixPath:u.path}),type:Re.AMBIGUOUS_ALTS,ruleName:s.name,occurrence:r.idx,alternatives:u.alts}})}function Fy(e,r,s,n){let i=Te(e,(c,u,a)=>{let f=y(u,(h)=>({idx:a,path:h}));return c.concat(f)},[]);return ht(De(i,(c)=>{if(r.definition[c.idx].ignoreAmbiguities===!0)return[];let{idx:a,path:f}=c,h=ke(i,(p)=>r.definition[p.idx].ignoreAmbiguities!==!0&&p.idx<a&&wc(p.path,f));return y(h,(p)=>{let T=[p.idx+1,a+1],C=r.idx===0?"":r.idx;return{message:n.buildAlternationPrefixAmbiguityError({topLevelRule:s,alternation:r,ambiguityIndices:T,prefixPath:p.path}),type:Re.AMBIGUOUS_PREFIX_ALTS,ruleName:s.name,occurrence:C,alternatives:T}})}))}function By(e,r,s){let n=[],i=y(r,(o)=>o.name);return x(e,(o)=>{let c=o.name;if(ee(i,c)){let u=s.buildNamespaceConflictError(o);n.push({message:u,type:Re.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:c})}}),n}function zc(e){let r=Ir(e,{errMsgProvider:Rc}),s={};return x(e.rules,(n)=>{s[n.name]=n}),Oc(s,r.errMsgProvider)}function Vc(e){return e=Ir(e,{errMsgProvider:nt}),Dc(e.rules,e.tokenTypes,e.errMsgProvider,e.grammarName)}var Hc="MismatchedTokenException",Yc="NoViableAltException",Xc="EarlyExitException",qc="NotAllInputParsedException",Jc=[Hc,Yc,Xc,qc];Object.freeze(Jc);function Zt(e){return ee(Jc,e.name)}class ms extends Error{constructor(e,r){super(e);if(this.token=r,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}}class Wr extends ms{constructor(e,r,s){super(e,r);this.previousToken=s,this.name=Hc}}class Cn extends ms{constructor(e,r,s){super(e,r);this.previousToken=s,this.name=Yc}}class vn extends ms{constructor(e,r){super(e,r);this.name=qc}}class kn extends ms{constructor(e,r,s){super(e,r);this.previousToken=s,this.name=Xc}}var Si={},Ri="InRuleRecoveryException";class Zc extends Error{constructor(e){super(e);this.name=Ri}}class Oi{initRecoverable(e){if(this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=S(e,"recoveryEnabled")?e.recoveryEnabled:Fe.recoveryEnabled,this.recoveryEnabled)this.attemptInRepetitionRecovery=$y}getTokenToInsert(e){let r=lr(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return r.isInsertedInRecovery=!0,r}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,r,s,n){let i=this.findReSyncTokenType(),o=this.exportLexerState(),c=[],u=!1,a=this.LA(1),f=this.LA(1),h=()=>{let d=this.LA(0),p=this.errorMessageProvider.buildMismatchTokenMessage({expected:n,actual:a,previous:d,ruleName:this.getCurrRuleFullName()}),T=new Wr(p,a,this.LA(0));T.resyncedTokens=Ot(c),this.SAVE_ERROR(T)};while(!u)if(this.tokenMatcher(f,n)){h();return}else if(s.call(this)){h(),e.apply(this,r);return}else if(this.tokenMatcher(f,i))u=!0;else f=this.SKIP_TOKEN(),this.addToResyncTokens(f,c);this.importLexerState(o)}shouldInRepetitionRecoveryBeTried(e,r,s){if(s===!1)return!1;if(this.tokenMatcher(this.LA(1),e))return!1;if(this.isBackTracking())return!1;if(this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,r)))return!1;return!0}getFollowsForInRuleRecovery(e,r){let s=this.getCurrentGrammarPath(e,r);return this.getNextPossibleTokenTypes(s)}tryInRuleRecovery(e,r){if(this.canRecoverWithSingleTokenInsertion(e,r))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){let s=this.SKIP_TOKEN();return this.consumeToken(),s}throw new Zc("sad sad panda")}canPerformInRuleRecovery(e,r){return this.canRecoverWithSingleTokenInsertion(e,r)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,r){if(!this.canTokenTypeBeInsertedInRecovery(e))return!1;if(M(r))return!1;let s=this.LA(1);return Et(r,(i)=>this.tokenMatcher(s,i))!==void 0}canRecoverWithSingleTokenDeletion(e){if(!this.canTokenTypeBeDeletedInRecovery(e))return!1;return this.tokenMatcher(this.LA(2),e)}isInCurrentRuleReSyncSet(e){let r=this.getCurrFollowKey(),s=this.getFollowSetFromFollowKey(r);return ee(s,e)}findReSyncTokenType(){let e=this.flattenFollowSet(),r=this.LA(1),s=2;while(!0){let n=Et(e,(i)=>fs(r,i));if(n!==void 0)return n;r=this.LA(s),s++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return Si;let e=this.getLastExplicitRuleShortName(),r=this.getLastExplicitRuleOccurrenceIndex(),s=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:r,inRule:this.shortRuleNameToFullName(s)}}buildFullFollowKeyStack(){let e=this.RULE_STACK,r=this.RULE_OCCURRENCE_STACK;return y(e,(s,n)=>{if(n===0)return Si;return{ruleName:this.shortRuleNameToFullName(s),idxInCallingRule:r[n],inRule:this.shortRuleNameToFullName(e[n-1])}})}flattenFollowSet(){let e=y(this.buildFullFollowKeyStack(),(r)=>this.getFollowSetFromFollowKey(r));return xe(e)}getFollowSetFromFollowKey(e){if(e===Si)return[Ve];let r=e.ruleName+e.idxInCallingRule+un+e.inRule;return this.resyncFollows[r]}addToResyncTokens(e,r){if(!this.tokenMatcher(e,Ve))r.push(e);return r}reSyncTo(e){let r=[],s=this.LA(1);while(this.tokenMatcher(s,e)===!1)s=this.SKIP_TOKEN(),this.addToResyncTokens(s,r);return Ot(r)}attemptInRepetitionRecovery(e,r,s,n,i,o,c){}getCurrentGrammarPath(e,r){let s=this.getHumanReadableRuleStack(),n=K(this.RULE_OCCURRENCE_STACK);return{ruleStack:s,occurrenceStack:n,lastTok:e,lastTokOccurrence:r}}getHumanReadableRuleStack(){return y(this.RULE_STACK,(e)=>this.shortRuleNameToFullName(e))}}function $y(e,r,s,n,i,o,c){let u=this.getKeyForAutomaticLookahead(n,i),a=this.firstAfterRepMap[u];if(a===void 0){let p=this.getCurrRuleFullName(),T=this.getGAstProductions()[p];a=new o(T,i).startWalking(),this.firstAfterRepMap[u]=a}let f=a.token,h=a.occurrence,d=a.isEndOfRule;if(this.RULE_STACK.length===1&&d&&f===void 0)f=Ve,h=1;if(f===void 0||h===void 0)return;if(this.shouldInRepetitionRecoveryBeTried(f,h,c))this.tryInRepetitionRecovery(e,r,s,f)}var Qc=4,_n=8;var Mn=256,wn=512,gs=768,Ts=1024,Es=1280,jr=1536;function Pn(e,r,s){return s|r|e}class Un{constructor(e){var r;this.maxLookahead=(r=e===null||e===void 0?void 0:e.maxLookahead)!==null&&r!==void 0?r:Fe.maxLookahead}validate(e){let r=this.validateNoLeftRecursion(e.rules);if(M(r)){let s=this.validateEmptyOrAlternatives(e.rules),n=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),i=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...r,...s,...n,...i]}return r}validateNoLeftRecursion(e){return De(e,(r)=>xi(r,r,nt))}validateEmptyOrAlternatives(e){return De(e,(r)=>Gc(r,nt))}validateAmbiguousAlternationAlternatives(e,r){return De(e,(s)=>Wc(s,r,nt))}validateSomeNonEmptyLookaheadPath(e,r){return Kc(e,r,nt)}buildLookaheadForAlternation(e){return bc(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,vc)}buildLookaheadForOptional(e){return Cc(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,Ln(e.prodType),kc)}}class Li{initLooksAhead(e){this.dynamicTokensEnabled=S(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:Fe.dynamicTokensEnabled,this.maxLookahead=S(e,"maxLookahead")?e.maxLookahead:Fe.maxLookahead,this.lookaheadStrategy=S(e,"lookaheadStrategy")?e.lookaheadStrategy:new Un({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){x(e,(r)=>{this.TRACE_INIT(`${r.name} Rule Lookahead`,()=>{let{alternation:s,repetition:n,option:i,repetitionMandatory:o,repetitionMandatoryWithSeparator:c,repetitionWithSeparator:u}=Gy(r);x(s,(a)=>{let f=a.idx===0?"":a.idx;this.TRACE_INIT(`${ze(a)}${f}`,()=>{let h=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:a.idx,rule:r,maxLookahead:a.maxLookahead||this.maxLookahead,hasPredicates:a.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),d=Pn(this.fullRuleNameToShort[r.name],Mn,a.idx);this.setLaFuncCache(d,h)})}),x(n,(a)=>{this.computeLookaheadFunc(r,a.idx,gs,"Repetition",a.maxLookahead,ze(a))}),x(i,(a)=>{this.computeLookaheadFunc(r,a.idx,wn,"Option",a.maxLookahead,ze(a))}),x(o,(a)=>{this.computeLookaheadFunc(r,a.idx,Ts,"RepetitionMandatory",a.maxLookahead,ze(a))}),x(c,(a)=>{this.computeLookaheadFunc(r,a.idx,jr,"RepetitionMandatoryWithSeparator",a.maxLookahead,ze(a))}),x(u,(a)=>{this.computeLookaheadFunc(r,a.idx,Es,"RepetitionWithSeparator",a.maxLookahead,ze(a))})})})}computeLookaheadFunc(e,r,s,n,i,o){this.TRACE_INIT(`${o}${r===0?"":r}`,()=>{let c=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:r,rule:e,maxLookahead:i||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:n}),u=Pn(this.fullRuleNameToShort[e.name],s,r);this.setLaFuncCache(u,c)})}getKeyForAutomaticLookahead(e,r){let s=this.getLastExplicitRuleShortName();return Pn(s,e,r)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,r){this.lookAheadFuncsCache.set(e,r)}}class eu extends Ke{constructor(){super(...arguments);this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(e){this.dslMethods.option.push(e)}visitRepetitionWithSeparator(e){this.dslMethods.repetitionWithSeparator.push(e)}visitRepetitionMandatory(e){this.dslMethods.repetitionMandatory.push(e)}visitRepetitionMandatoryWithSeparator(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)}visitRepetition(e){this.dslMethods.repetition.push(e)}visitAlternation(e){this.dslMethods.alternation.push(e)}}var Dn=new eu;function Gy(e){Dn.reset(),e.accept(Dn);let r=Dn.dslMethods;return Dn.reset(),r}function Ii(e,r){if(isNaN(e.startOffset)===!0)e.startOffset=r.startOffset,e.endOffset=r.endOffset;else if(e.endOffset<r.endOffset===!0)e.endOffset=r.endOffset}function Ni(e,r){if(isNaN(e.startOffset)===!0)e.startOffset=r.startOffset,e.startColumn=r.startColumn,e.startLine=r.startLine,e.endOffset=r.endOffset,e.endColumn=r.endColumn,e.endLine=r.endLine;else if(e.endOffset<r.endOffset===!0)e.endOffset=r.endOffset,e.endColumn=r.endColumn,e.endLine=r.endLine}function tu(e,r,s){if(e.children[s]===void 0)e.children[s]=[r];else e.children[s].push(r)}function ru(e,r,s){if(e.children[r]===void 0)e.children[r]=[s];else e.children[r].push(s)}function bi(e,r){Object.defineProperty(e,"name",{enumerable:!1,configurable:!0,writable:!1,value:r})}function Wy(e,r){let s=B(e),n=s.length;for(let i=0;i<n;i++){let o=s[i],c=e[o],u=c.length;for(let a=0;a<u;a++){let f=c[a];if(f.tokenTypeIdx===void 0)this[f.name](f.children,r)}}}function su(e,r){let s=function(){};bi(s,e+"BaseSemantics");let n={visit:function(i,o){if(L(i))i=i[0];if(_e(i))return;return this[i.name](i.children,o)},validateVisitor:function(){let i=jy(this,r);if(!M(i)){let o=y(i,(c)=>c.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
|
|
86
|
+
see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(e){return"deprecated"},buildDuplicateRuleNameError(e){let r;if(e.topLevelRule instanceof je)r=e.topLevelRule.name;else r=e.topLevelRule;return`Duplicate definition, rule: ->${r}<- is already defined in the grammar: ->${e.grammarName}<-`}};function Oc(e,r){let s=new Lc(e,r);return s.resolveRefs(),s.errors}class Lc extends Ke{constructor(e,r){super();this.nameToTopRule=e,this.errMsgProvider=r,this.errors=[]}resolveRefs(){A(D(this.nameToTopRule),(e)=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){let r=this.nameToTopRule[e.nonTerminalName];if(!r){let s=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:s,type:Re.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}else e.referencedRule=r}}class Ic extends Jt{constructor(e,r){super();this.topProd=e,this.path=r,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=K(this.path.ruleStack).reverse(),this.occurrenceStack=K(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,r=[]){if(!this.found)super.walk(e,r)}walkProdRef(e,r,s){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){let n=r.concat(s);this.updateExpectedNext(),this.walk(e.referencedRule,n)}}updateExpectedNext(){if(_(this.ruleStack))this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0;else this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop()}}class gi extends Ic{constructor(e,r){super(e,r);this.path=r,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,r,s){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){let n=r.concat(s),i=new Z({definition:n});this.possibleTokTypes=sr(i),this.found=!0}}}class hs extends Jt{constructor(e,r){super();this.topRule=e,this.occurrence=r,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}}class Ti extends hs{walkMany(e,r,s){if(e.idx===this.occurrence){let n=Le(r.concat(s));if(this.result.isEndOfRule=n===void 0,n instanceof M)this.result.token=n.terminalType,this.result.occurrence=n.idx}else super.walkMany(e,r,s)}}class An extends hs{walkManySep(e,r,s){if(e.idx===this.occurrence){let n=Le(r.concat(s));if(this.result.isEndOfRule=n===void 0,n instanceof M)this.result.token=n.terminalType,this.result.occurrence=n.idx}else super.walkManySep(e,r,s)}}class Ei extends hs{walkAtLeastOne(e,r,s){if(e.idx===this.occurrence){let n=Le(r.concat(s));if(this.result.isEndOfRule=n===void 0,n instanceof M)this.result.token=n.terminalType,this.result.occurrence=n.idx}else super.walkAtLeastOne(e,r,s)}}class xn extends hs{walkAtLeastOneSep(e,r,s){if(e.idx===this.occurrence){let n=Le(r.concat(s));if(this.result.isEndOfRule=n===void 0,n instanceof M)this.result.token=n.terminalType,this.result.occurrence=n.idx}else super.walkAtLeastOneSep(e,r,s)}}function Rn(e,r,s=[]){s=K(s);let n=[],i=0;function o(u){return u.concat(fe(e,i+1))}function c(u){let a=Rn(o(u),r,s);return n.concat(a)}while(s.length<r&&i<e.length){let u=e[i];if(u instanceof Z)return c(u.definition);else if(u instanceof J)return c(u.definition);else if(u instanceof re)n=c(u.definition);else if(u instanceof Ee){let a=u.definition.concat([new P({definition:u.definition})]);return c(a)}else if(u instanceof ye){let a=[new Z({definition:u.definition}),new P({definition:[new M({terminalType:u.separator})].concat(u.definition)})];return c(a)}else if(u instanceof he){let a=u.definition.concat([new P({definition:[new M({terminalType:u.separator})].concat(u.definition)})]);n=c(a)}else if(u instanceof P){let a=u.definition.concat([new P({definition:u.definition})]);n=c(a)}else if(u instanceof de)return A(u.definition,(a)=>{if(_(a.definition)===!1)n=c(a.definition)}),n;else if(u instanceof M)s.push(u.terminalType);else throw Error("non exhaustive match");i++}return n.push({partialPath:s,suffixDef:fe(e,i)}),n}function On(e,r,s,n){let o=["EXIT_NONE_TERMINAL"],c="EXIT_ALTERNATIVE",u=!1,a=r.length,f=a-n-1,h=[],d=[];d.push({idx:-1,def:e,ruleStack:[],occurrenceStack:[]});while(!_(d)){let p=d.pop();if(p==="EXIT_ALTERNATIVE"){if(u&&st(d).idx<=f)d.pop();continue}let{def:T,idx:I,ruleStack:N,occurrenceStack:O}=p;if(_(T))continue;let y=T[0];if(y==="EXIT_NONE_TERMINAL"){let S={idx:I,def:fe(T),ruleStack:Ot(N),occurrenceStack:Ot(O)};d.push(S)}else if(y instanceof M)if(I<a-1){let S=I+1,g=r[S];if(s(g,y.terminalType)){let k={idx:S,def:fe(T),ruleStack:N,occurrenceStack:O};d.push(k)}}else if(I===a-1)h.push({nextTokenType:y.terminalType,nextTokenOccurrence:y.idx,ruleStack:N,occurrenceStack:O}),u=!0;else throw Error("non exhaustive match");else if(y instanceof J){let S=K(N);S.push(y.nonTerminalName);let g=K(O);g.push(y.idx);let k={idx:I,def:y.definition.concat(o,fe(T)),ruleStack:S,occurrenceStack:g};d.push(k)}else if(y instanceof re){let S={idx:I,def:fe(T),ruleStack:N,occurrenceStack:O};d.push(S),d.push("EXIT_ALTERNATIVE");let g={idx:I,def:y.definition.concat(fe(T)),ruleStack:N,occurrenceStack:O};d.push(g)}else if(y instanceof Ee){let S=new P({definition:y.definition,idx:y.idx}),g=y.definition.concat([S],fe(T)),k={idx:I,def:g,ruleStack:N,occurrenceStack:O};d.push(k)}else if(y instanceof ye){let S=new M({terminalType:y.separator}),g=new P({definition:[S].concat(y.definition),idx:y.idx}),k=y.definition.concat([g],fe(T)),Q={idx:I,def:k,ruleStack:N,occurrenceStack:O};d.push(Q)}else if(y instanceof he){let S={idx:I,def:fe(T),ruleStack:N,occurrenceStack:O};d.push(S),d.push("EXIT_ALTERNATIVE");let g=new M({terminalType:y.separator}),k=new P({definition:[g].concat(y.definition),idx:y.idx}),Q=y.definition.concat([k],fe(T)),Ce={idx:I,def:Q,ruleStack:N,occurrenceStack:O};d.push(Ce)}else if(y instanceof P){let S={idx:I,def:fe(T),ruleStack:N,occurrenceStack:O};d.push(S),d.push("EXIT_ALTERNATIVE");let g=new P({definition:y.definition,idx:y.idx}),k=y.definition.concat([g],fe(T)),Q={idx:I,def:k,ruleStack:N,occurrenceStack:O};d.push(Q)}else if(y instanceof de)for(let S=y.definition.length-1;S>=0;S--){let g=y.definition[S],k={idx:I,def:g.definition.concat(fe(T)),ruleStack:N,occurrenceStack:O};d.push(k),d.push("EXIT_ALTERNATIVE")}else if(y instanceof Z)d.push({idx:I,def:y.definition.concat(fe(T)),ruleStack:N,occurrenceStack:O});else if(y instanceof je)d.push(ky(y,I,N,O));else throw Error("non exhaustive match")}return h}function ky(e,r,s,n){let i=K(s);i.push(e.name);let o=K(n);return o.push(1),{idx:r,def:e.definition,ruleStack:i,occurrenceStack:o}}var oe;(function(e){e[e.OPTION=0]="OPTION",e[e.REPETITION=1]="REPETITION",e[e.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",e[e.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",e[e.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",e[e.ALTERNATION=5]="ALTERNATION"})(oe||(oe={}));function Ln(e){if(e instanceof re||e==="Option")return oe.OPTION;else if(e instanceof P||e==="Repetition")return oe.REPETITION;else if(e instanceof Ee||e==="RepetitionMandatory")return oe.REPETITION_MANDATORY;else if(e instanceof ye||e==="RepetitionMandatoryWithSeparator")return oe.REPETITION_MANDATORY_WITH_SEPARATOR;else if(e instanceof he||e==="RepetitionWithSeparator")return oe.REPETITION_WITH_SEPARATOR;else if(e instanceof de||e==="Alternation")return oe.ALTERNATION;else throw Error("non exhaustive match")}function bc(e,r,s,n,i,o){let c=ds(e,r,s),u=Pc(c)?Gr:Lt;return o(c,n,u,i)}function Cc(e,r,s,n,i,o){let c=ps(e,r,i,s),u=Pc(c)?Gr:Lt;return o(c[0],u,n)}function vc(e,r,s,n){let i=e.length,o=ve(e,(c)=>ve(c,(u)=>u.length===1));if(r)return function(c){let u=E(c,(a)=>a.GATE);for(let a=0;a<i;a++){let f=e[a],h=f.length,d=u[a];if(d!==void 0&&d.call(this)===!1)continue;e:for(let p=0;p<h;p++){let T=f[p],I=T.length;for(let N=0;N<I;N++){let O=this.LA(N+1);if(s(O,T[N])===!1)continue e}return a}}return};else if(o&&!n){let c=E(e,(a)=>xe(a)),u=Te(c,(a,f,h)=>(A(f,(d)=>{if(!x(a,d.tokenTypeIdx))a[d.tokenTypeIdx]=h;A(d.categoryMatches,(p)=>{if(!x(a,p))a[p]=h})}),a),{});return function(){let a=this.LA(1);return u[a.tokenTypeIdx]}}else return function(){for(let c=0;c<i;c++){let u=e[c],a=u.length;e:for(let f=0;f<a;f++){let h=u[f],d=h.length;for(let p=0;p<d;p++){let T=this.LA(p+1);if(s(T,h[p])===!1)continue e}return c}}return}}function kc(e,r,s){let n=ve(e,(o)=>o.length===1),i=e.length;if(n&&!s){let o=xe(e);if(o.length===1&&_(o[0].categoryMatches)){let u=o[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===u}}else{let c=Te(o,(u,a,f)=>(u[a.tokenTypeIdx]=!0,A(a.categoryMatches,(h)=>{u[h]=!0}),u),[]);return function(){let u=this.LA(1);return c[u.tokenTypeIdx]===!0}}}else return function(){e:for(let o=0;o<i;o++){let c=e[o],u=c.length;for(let a=0;a<u;a++){let f=this.LA(a+1);if(r(f,c[a])===!1)continue e}return!0}return!1}}class _c extends Jt{constructor(e,r,s){super();this.topProd=e,this.targetOccurrence=r,this.targetProdType=s}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,r,s,n){if(e.idx===this.targetOccurrence&&this.targetProdType===r)return this.restDef=s.concat(n),!0;return!1}walkOption(e,r,s){if(!this.checkIsTarget(e,oe.OPTION,r,s))super.walkOption(e,r,s)}walkAtLeastOne(e,r,s){if(!this.checkIsTarget(e,oe.REPETITION_MANDATORY,r,s))super.walkOption(e,r,s)}walkAtLeastOneSep(e,r,s){if(!this.checkIsTarget(e,oe.REPETITION_MANDATORY_WITH_SEPARATOR,r,s))super.walkOption(e,r,s)}walkMany(e,r,s){if(!this.checkIsTarget(e,oe.REPETITION,r,s))super.walkOption(e,r,s)}walkManySep(e,r,s){if(!this.checkIsTarget(e,oe.REPETITION_WITH_SEPARATOR,r,s))super.walkOption(e,r,s)}}class Ai extends Ke{constructor(e,r,s){super();this.targetOccurrence=e,this.targetProdType=r,this.targetRef=s,this.result=[]}checkIsTarget(e,r){if(e.idx===this.targetOccurrence&&this.targetProdType===r&&(this.targetRef===void 0||e===this.targetRef))this.result=e.definition}visitOption(e){this.checkIsTarget(e,oe.OPTION)}visitRepetition(e){this.checkIsTarget(e,oe.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,oe.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,oe.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,oe.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,oe.ALTERNATION)}}function Nc(e){let r=Array(e);for(let s=0;s<e;s++)r[s]=[];return r}function yi(e){let r=[""];for(let s=0;s<e.length;s++){let n=e[s],i=[];for(let o=0;o<r.length;o++){let c=r[o];i.push(c+"_"+n.tokenTypeIdx);for(let u=0;u<n.categoryMatches.length;u++){let a="_"+n.categoryMatches[u];i.push(c+a)}}r=i}return r}function _y(e,r,s){for(let n=0;n<e.length;n++){if(n===s)continue;let i=e[n];for(let o=0;o<r.length;o++){let c=r[o];if(i[c]===!0)return!1}}return!0}function Mc(e,r){let s=E(e,(c)=>Rn([c],1)),n=Nc(s.length),i=E(s,(c)=>{let u={};return A(c,(a)=>{let f=yi(a.partialPath);A(f,(h)=>{u[h]=!0})}),u}),o=s;for(let c=1;c<=r;c++){let u=o;o=Nc(u.length);for(let a=0;a<u.length;a++){let f=u[a];for(let h=0;h<f.length;h++){let d=f[h].partialPath,p=f[h].suffixDef,T=yi(d);if(_y(i,T,a)||_(p)||d.length===r){let N=n[a];if(In(N,d)===!1){N.push(d);for(let O=0;O<T.length;O++){let y=T[O];i[a][y]=!0}}}else{let N=Rn(p,c+1,d);o[a]=o[a].concat(N),A(N,(O)=>{let y=yi(O.partialPath);A(y,(S)=>{i[a][S]=!0})})}}}}return n}function ds(e,r,s,n){let i=new Ai(e,oe.ALTERNATION,n);return r.accept(i),Mc(i.result,s)}function ps(e,r,s,n){let i=new Ai(e,s);r.accept(i);let o=i.result,u=new _c(r,e,s).startWalking(),a=new Z({definition:o}),f=new Z({definition:u});return Mc([a,f],n)}function In(e,r){e:for(let s=0;s<e.length;s++){let n=e[s];if(n.length!==r.length)continue;for(let i=0;i<n.length;i++){let o=r[i],c=n[i];if((o===c||c.categoryMatchesMap[o.tokenTypeIdx]!==void 0)===!1)continue e}return!0}return!1}function wc(e,r){return e.length<r.length&&ve(e,(s,n)=>{let i=r[n];return s===i||i.categoryMatchesMap[s.tokenTypeIdx]})}function Pc(e){return ve(e,(r)=>ve(r,(s)=>ve(s,(n)=>_(n.categoryMatches))))}function Uc(e){let r=e.lookaheadStrategy.validate({rules:e.rules,tokenTypes:e.tokenTypes,grammarName:e.grammarName});return E(r,(s)=>Object.assign({type:Re.CUSTOM_LOOKAHEAD_VALIDATION},s))}function Dc(e,r,s,n){let i=De(e,(a)=>My(a,s)),o=By(e,r,s),c=De(e,(a)=>Uy(a,s)),u=De(e,(a)=>Py(a,e,n,s));return i.concat(o,c,u)}function My(e,r){let s=new Bc;e.accept(s);let n=s.allProductions,i=ii(n,wy),o=We(i,(u)=>u.length>1);return E(D(o),(u)=>{let a=Le(u),f=r.buildDuplicateFoundError(e,u),h=ze(a),d={message:f,type:Re.DUPLICATE_PRODUCTIONS,ruleName:e.name,dslName:h,occurrence:a.idx},p=Fc(a);if(p)d.parameter=p;return d})}function wy(e){return`${ze(e)}_#_${e.idx}_#_${Fc(e)}`}function Fc(e){if(e instanceof M)return e.terminalType.name;else if(e instanceof J)return e.nonTerminalName;else return""}class Bc extends Ke{constructor(){super(...arguments);this.allProductions=[]}visitNonTerminal(e){this.allProductions.push(e)}visitOption(e){this.allProductions.push(e)}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}visitAlternation(e){this.allProductions.push(e)}visitTerminal(e){this.allProductions.push(e)}}function Py(e,r,s,n){let i=[];if(Te(r,(c,u)=>{if(u.name===e.name)return c+1;return c},0)>1){let c=n.buildDuplicateRuleNameError({topLevelRule:e,grammarName:s});i.push({message:c,type:Re.DUPLICATE_RULE_NAME,ruleName:e.name})}return i}function $c(e,r,s){let n=[],i;if(!ee(r,e))i=`Invalid rule override, rule: ->${e}<- cannot be overridden in the grammar: ->${s}<-as it is not defined in any of the super grammars `,n.push({message:i,type:Re.INVALID_RULE_OVERRIDE,ruleName:e});return n}function xi(e,r,s,n=[]){let i=[],o=Nn(r.definition);if(_(o))return[];else{let c=e.name;if(ee(o,e))i.push({message:s.buildLeftRecursionError({topLevelRule:e,leftRecursionPath:n}),type:Re.LEFT_RECURSION,ruleName:c});let a=Ht(o,n.concat([e])),f=De(a,(h)=>{let d=K(n);return d.push(h),xi(e,h,s,d)});return i.concat(f)}}function Nn(e){let r=[];if(_(e))return r;let s=Le(e);if(s instanceof J)r.push(s.referencedRule);else if(s instanceof Z||s instanceof re||s instanceof Ee||s instanceof ye||s instanceof he||s instanceof P)r=r.concat(Nn(s.definition));else if(s instanceof de)r=xe(E(s.definition,(o)=>Nn(o.definition)));else if(s instanceof M);else throw Error("non exhaustive match");let n=rr(s),i=e.length>1;if(n&&i){let o=fe(e);return r.concat(Nn(o))}else return r}class bn extends Ke{constructor(){super(...arguments);this.alternations=[]}visitAlternation(e){this.alternations.push(e)}}function Gc(e,r){let s=new bn;e.accept(s);let n=s.alternations;return De(n,(o)=>{let c=Ot(o.definition);return De(c,(u,a)=>{let f=On([u],[],Lt,1);if(_(f))return[{message:r.buildEmptyAlternationError({topLevelRule:e,alternation:o,emptyChoiceIdx:a}),type:Re.NONE_LAST_EMPTY_ALT,ruleName:e.name,occurrence:o.idx,alternative:a+1}];else return[]})})}function Wc(e,r,s){let n=new bn;e.accept(n);let i=n.alternations;return i=qt(i,(c)=>c.ignoreAmbiguities===!0),De(i,(c)=>{let u=c.idx,a=c.maxLookahead||r,f=ds(u,e,a,c),h=Dy(f,c,e,s),d=Fy(f,c,e,s);return h.concat(d)})}class jc extends Ke{constructor(){super(...arguments);this.allProductions=[]}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}}function Uy(e,r){let s=new bn;e.accept(s);let n=s.alternations;return De(n,(o)=>{if(o.definition.length>255)return[{message:r.buildTooManyAlternativesError({topLevelRule:e,alternation:o}),type:Re.TOO_MANY_ALTS,ruleName:e.name,occurrence:o.idx}];else return[]})}function Kc(e,r,s){let n=[];return A(e,(i)=>{let o=new jc;i.accept(o);let c=o.allProductions;A(c,(u)=>{let a=Ln(u),f=u.maxLookahead||r,h=u.idx,p=ps(h,i,a,f)[0];if(_(xe(p))){let T=s.buildEmptyRepetitionError({topLevelRule:i,repetition:u});n.push({message:T,type:Re.NO_NON_EMPTY_LOOKAHEAD,ruleName:i.name})}})}),n}function Dy(e,r,s,n){let i=[],o=Te(e,(u,a,f)=>{if(r.definition[f].ignoreAmbiguities===!0)return u;return A(a,(h)=>{let d=[f];if(A(e,(p,T)=>{if(f!==T&&In(p,h)&&r.definition[T].ignoreAmbiguities!==!0)d.push(T)}),d.length>1&&!In(i,h))i.push(h),u.push({alts:d,path:h})}),u},[]);return E(o,(u)=>{let a=E(u.alts,(h)=>h+1);return{message:n.buildAlternationAmbiguityError({topLevelRule:s,alternation:r,ambiguityIndices:a,prefixPath:u.path}),type:Re.AMBIGUOUS_ALTS,ruleName:s.name,occurrence:r.idx,alternatives:u.alts}})}function Fy(e,r,s,n){let i=Te(e,(c,u,a)=>{let f=E(u,(h)=>({idx:a,path:h}));return c.concat(f)},[]);return dt(De(i,(c)=>{if(r.definition[c.idx].ignoreAmbiguities===!0)return[];let{idx:a,path:f}=c,h=ke(i,(p)=>r.definition[p.idx].ignoreAmbiguities!==!0&&p.idx<a&&wc(p.path,f));return E(h,(p)=>{let T=[p.idx+1,a+1],I=r.idx===0?"":r.idx;return{message:n.buildAlternationPrefixAmbiguityError({topLevelRule:s,alternation:r,ambiguityIndices:T,prefixPath:p.path}),type:Re.AMBIGUOUS_PREFIX_ALTS,ruleName:s.name,occurrence:I,alternatives:T}})}))}function By(e,r,s){let n=[],i=E(r,(o)=>o.name);return A(e,(o)=>{let c=o.name;if(ee(i,c)){let u=s.buildNamespaceConflictError(o);n.push({message:u,type:Re.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:c})}}),n}function zc(e){let r=Ir(e,{errMsgProvider:Rc}),s={};return A(e.rules,(n)=>{s[n.name]=n}),Oc(s,r.errMsgProvider)}function Vc(e){return e=Ir(e,{errMsgProvider:nt}),Dc(e.rules,e.tokenTypes,e.errMsgProvider,e.grammarName)}var Hc="MismatchedTokenException",Yc="NoViableAltException",Xc="EarlyExitException",qc="NotAllInputParsedException",Jc=[Hc,Yc,Xc,qc];Object.freeze(Jc);function Zt(e){return ee(Jc,e.name)}class ms extends Error{constructor(e,r){super(e);if(this.token=r,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}}class Wr extends ms{constructor(e,r,s){super(e,r);this.previousToken=s,this.name=Hc}}class Cn extends ms{constructor(e,r,s){super(e,r);this.previousToken=s,this.name=Yc}}class vn extends ms{constructor(e,r){super(e,r);this.name=qc}}class kn extends ms{constructor(e,r,s){super(e,r);this.previousToken=s,this.name=Xc}}var Si={},Ri="InRuleRecoveryException";class Zc extends Error{constructor(e){super(e);this.name=Ri}}class Oi{initRecoverable(e){if(this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=x(e,"recoveryEnabled")?e.recoveryEnabled:Fe.recoveryEnabled,this.recoveryEnabled)this.attemptInRepetitionRecovery=$y}getTokenToInsert(e){let r=lr(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return r.isInsertedInRecovery=!0,r}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,r,s,n){let i=this.findReSyncTokenType(),o=this.exportLexerState(),c=[],u=!1,a=this.LA(1),f=this.LA(1),h=()=>{let d=this.LA(0),p=this.errorMessageProvider.buildMismatchTokenMessage({expected:n,actual:a,previous:d,ruleName:this.getCurrRuleFullName()}),T=new Wr(p,a,this.LA(0));T.resyncedTokens=Ot(c),this.SAVE_ERROR(T)};while(!u)if(this.tokenMatcher(f,n)){h();return}else if(s.call(this)){h(),e.apply(this,r);return}else if(this.tokenMatcher(f,i))u=!0;else f=this.SKIP_TOKEN(),this.addToResyncTokens(f,c);this.importLexerState(o)}shouldInRepetitionRecoveryBeTried(e,r,s){if(s===!1)return!1;if(this.tokenMatcher(this.LA(1),e))return!1;if(this.isBackTracking())return!1;if(this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,r)))return!1;return!0}getFollowsForInRuleRecovery(e,r){let s=this.getCurrentGrammarPath(e,r);return this.getNextPossibleTokenTypes(s)}tryInRuleRecovery(e,r){if(this.canRecoverWithSingleTokenInsertion(e,r))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){let s=this.SKIP_TOKEN();return this.consumeToken(),s}throw new Zc("sad sad panda")}canPerformInRuleRecovery(e,r){return this.canRecoverWithSingleTokenInsertion(e,r)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,r){if(!this.canTokenTypeBeInsertedInRecovery(e))return!1;if(_(r))return!1;let s=this.LA(1);return Et(r,(i)=>this.tokenMatcher(s,i))!==void 0}canRecoverWithSingleTokenDeletion(e){if(!this.canTokenTypeBeDeletedInRecovery(e))return!1;return this.tokenMatcher(this.LA(2),e)}isInCurrentRuleReSyncSet(e){let r=this.getCurrFollowKey(),s=this.getFollowSetFromFollowKey(r);return ee(s,e)}findReSyncTokenType(){let e=this.flattenFollowSet(),r=this.LA(1),s=2;while(!0){let n=Et(e,(i)=>fs(r,i));if(n!==void 0)return n;r=this.LA(s),s++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return Si;let e=this.getLastExplicitRuleShortName(),r=this.getLastExplicitRuleOccurrenceIndex(),s=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:r,inRule:this.shortRuleNameToFullName(s)}}buildFullFollowKeyStack(){let e=this.RULE_STACK,r=this.RULE_OCCURRENCE_STACK;return E(e,(s,n)=>{if(n===0)return Si;return{ruleName:this.shortRuleNameToFullName(s),idxInCallingRule:r[n],inRule:this.shortRuleNameToFullName(e[n-1])}})}flattenFollowSet(){let e=E(this.buildFullFollowKeyStack(),(r)=>this.getFollowSetFromFollowKey(r));return xe(e)}getFollowSetFromFollowKey(e){if(e===Si)return[Ve];let r=e.ruleName+e.idxInCallingRule+un+e.inRule;return this.resyncFollows[r]}addToResyncTokens(e,r){if(!this.tokenMatcher(e,Ve))r.push(e);return r}reSyncTo(e){let r=[],s=this.LA(1);while(this.tokenMatcher(s,e)===!1)s=this.SKIP_TOKEN(),this.addToResyncTokens(s,r);return Ot(r)}attemptInRepetitionRecovery(e,r,s,n,i,o,c){}getCurrentGrammarPath(e,r){let s=this.getHumanReadableRuleStack(),n=K(this.RULE_OCCURRENCE_STACK);return{ruleStack:s,occurrenceStack:n,lastTok:e,lastTokOccurrence:r}}getHumanReadableRuleStack(){return E(this.RULE_STACK,(e)=>this.shortRuleNameToFullName(e))}}function $y(e,r,s,n,i,o,c){let u=this.getKeyForAutomaticLookahead(n,i),a=this.firstAfterRepMap[u];if(a===void 0){let p=this.getCurrRuleFullName(),T=this.getGAstProductions()[p];a=new o(T,i).startWalking(),this.firstAfterRepMap[u]=a}let f=a.token,h=a.occurrence,d=a.isEndOfRule;if(this.RULE_STACK.length===1&&d&&f===void 0)f=Ve,h=1;if(f===void 0||h===void 0)return;if(this.shouldInRepetitionRecoveryBeTried(f,h,c))this.tryInRepetitionRecovery(e,r,s,f)}var Qc=4,_n=8;var Mn=256,wn=512,gs=768,Ts=1024,Es=1280,jr=1536;function Pn(e,r,s){return s|r|e}class Un{constructor(e){var r;this.maxLookahead=(r=e===null||e===void 0?void 0:e.maxLookahead)!==null&&r!==void 0?r:Fe.maxLookahead}validate(e){let r=this.validateNoLeftRecursion(e.rules);if(_(r)){let s=this.validateEmptyOrAlternatives(e.rules),n=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),i=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...r,...s,...n,...i]}return r}validateNoLeftRecursion(e){return De(e,(r)=>xi(r,r,nt))}validateEmptyOrAlternatives(e){return De(e,(r)=>Gc(r,nt))}validateAmbiguousAlternationAlternatives(e,r){return De(e,(s)=>Wc(s,r,nt))}validateSomeNonEmptyLookaheadPath(e,r){return Kc(e,r,nt)}buildLookaheadForAlternation(e){return bc(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,vc)}buildLookaheadForOptional(e){return Cc(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,Ln(e.prodType),kc)}}class Li{initLooksAhead(e){this.dynamicTokensEnabled=x(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:Fe.dynamicTokensEnabled,this.maxLookahead=x(e,"maxLookahead")?e.maxLookahead:Fe.maxLookahead,this.lookaheadStrategy=x(e,"lookaheadStrategy")?e.lookaheadStrategy:new Un({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){A(e,(r)=>{this.TRACE_INIT(`${r.name} Rule Lookahead`,()=>{let{alternation:s,repetition:n,option:i,repetitionMandatory:o,repetitionMandatoryWithSeparator:c,repetitionWithSeparator:u}=Gy(r);A(s,(a)=>{let f=a.idx===0?"":a.idx;this.TRACE_INIT(`${ze(a)}${f}`,()=>{let h=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:a.idx,rule:r,maxLookahead:a.maxLookahead||this.maxLookahead,hasPredicates:a.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),d=Pn(this.fullRuleNameToShort[r.name],Mn,a.idx);this.setLaFuncCache(d,h)})}),A(n,(a)=>{this.computeLookaheadFunc(r,a.idx,gs,"Repetition",a.maxLookahead,ze(a))}),A(i,(a)=>{this.computeLookaheadFunc(r,a.idx,wn,"Option",a.maxLookahead,ze(a))}),A(o,(a)=>{this.computeLookaheadFunc(r,a.idx,Ts,"RepetitionMandatory",a.maxLookahead,ze(a))}),A(c,(a)=>{this.computeLookaheadFunc(r,a.idx,jr,"RepetitionMandatoryWithSeparator",a.maxLookahead,ze(a))}),A(u,(a)=>{this.computeLookaheadFunc(r,a.idx,Es,"RepetitionWithSeparator",a.maxLookahead,ze(a))})})})}computeLookaheadFunc(e,r,s,n,i,o){this.TRACE_INIT(`${o}${r===0?"":r}`,()=>{let c=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:r,rule:e,maxLookahead:i||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:n}),u=Pn(this.fullRuleNameToShort[e.name],s,r);this.setLaFuncCache(u,c)})}getKeyForAutomaticLookahead(e,r){let s=this.getLastExplicitRuleShortName();return Pn(s,e,r)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,r){this.lookAheadFuncsCache.set(e,r)}}class eu extends Ke{constructor(){super(...arguments);this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(e){this.dslMethods.option.push(e)}visitRepetitionWithSeparator(e){this.dslMethods.repetitionWithSeparator.push(e)}visitRepetitionMandatory(e){this.dslMethods.repetitionMandatory.push(e)}visitRepetitionMandatoryWithSeparator(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)}visitRepetition(e){this.dslMethods.repetition.push(e)}visitAlternation(e){this.dslMethods.alternation.push(e)}}var Dn=new eu;function Gy(e){Dn.reset(),e.accept(Dn);let r=Dn.dslMethods;return Dn.reset(),r}function Ii(e,r){if(isNaN(e.startOffset)===!0)e.startOffset=r.startOffset,e.endOffset=r.endOffset;else if(e.endOffset<r.endOffset===!0)e.endOffset=r.endOffset}function Ni(e,r){if(isNaN(e.startOffset)===!0)e.startOffset=r.startOffset,e.startColumn=r.startColumn,e.startLine=r.startLine,e.endOffset=r.endOffset,e.endColumn=r.endColumn,e.endLine=r.endLine;else if(e.endOffset<r.endOffset===!0)e.endOffset=r.endOffset,e.endColumn=r.endColumn,e.endLine=r.endLine}function tu(e,r,s){if(e.children[s]===void 0)e.children[s]=[r];else e.children[s].push(r)}function ru(e,r,s){if(e.children[r]===void 0)e.children[r]=[s];else e.children[r].push(s)}function bi(e,r){Object.defineProperty(e,"name",{enumerable:!1,configurable:!0,writable:!1,value:r})}function Wy(e,r){let s=B(e),n=s.length;for(let i=0;i<n;i++){let o=s[i],c=e[o],u=c.length;for(let a=0;a<u;a++){let f=c[a];if(f.tokenTypeIdx===void 0)this[f.name](f.children,r)}}}function su(e,r){let s=function(){};bi(s,e+"BaseSemantics");let n={visit:function(i,o){if(R(i))i=i[0];if(_e(i))return;return this[i.name](i.children,o)},validateVisitor:function(){let i=jy(this,r);if(!_(i)){let o=E(i,(c)=>c.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
|
|
87
87
|
${o.join(`
|
|
88
88
|
|
|
89
89
|
`).replace(/\n/g,`
|
|
90
|
-
`)}`)}}};return s.prototype=n,s.prototype.constructor=s,s._RULE_NAMES=r,s}function nu(e,r,s){let n=function(){};bi(n,e+"BaseSemanticsWithDefaults");let i=Object.create(s.prototype);return
|
|
90
|
+
`)}`)}}};return s.prototype=n,s.prototype.constructor=s,s._RULE_NAMES=r,s}function nu(e,r,s){let n=function(){};bi(n,e+"BaseSemanticsWithDefaults");let i=Object.create(s.prototype);return A(r,(o)=>{i[o]=Wy}),n.prototype=i,n.prototype.constructor=n,n}var Ci;(function(e){e[e.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",e[e.MISSING_METHOD=1]="MISSING_METHOD"})(Ci||(Ci={}));function jy(e,r){return Ky(e,r)}function Ky(e,r){let s=ke(r,(i)=>Ue(e[i])===!1),n=E(s,(i)=>({msg:`Missing visitor method: <${i}> on ${e.constructor.name} CST Visitor.`,type:Ci.MISSING_METHOD,methodName:i}));return dt(n)}class vi{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=x(e,"nodeLocationTracking")?e.nodeLocationTracking:Fe.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=le,this.cstFinallyStateUpdate=le,this.cstPostTerminal=le,this.cstPostNonTerminal=le,this.cstPostRule=le;else if(/full/i.test(this.nodeLocationTracking))if(this.recoveryEnabled)this.setNodeLocationFromToken=Ni,this.setNodeLocationFromNode=Ni,this.cstPostRule=le,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery;else this.setNodeLocationFromToken=le,this.setNodeLocationFromNode=le,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular;else if(/onlyOffset/i.test(this.nodeLocationTracking))if(this.recoveryEnabled)this.setNodeLocationFromToken=Ii,this.setNodeLocationFromNode=Ii,this.cstPostRule=le,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery;else this.setNodeLocationFromToken=le,this.setNodeLocationFromNode=le,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular;else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=le,this.setNodeLocationFromNode=le,this.cstPostRule=le,this.setInitialNodeLocation=le;else throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`)}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:NaN,endOffset:NaN}}setInitialNodeLocationOnlyOffsetRegular(e){e.location={startOffset:this.LA(1).startOffset,endOffset:NaN}}setInitialNodeLocationFullRecovery(e){e.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}}setInitialNodeLocationFullRegular(e){let r=this.LA(1);e.location={startOffset:r.startOffset,startLine:r.startLine,startColumn:r.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(e){let r={name:e,children:Object.create(null)};this.setInitialNodeLocation(r),this.CST_STACK.push(r)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){let r=this.LA(0),s=e.location;if(s.startOffset<=r.startOffset===!0)s.endOffset=r.endOffset,s.endLine=r.endLine,s.endColumn=r.endColumn;else s.startOffset=NaN,s.startLine=NaN,s.startColumn=NaN}cstPostRuleOnlyOffset(e){let r=this.LA(0),s=e.location;if(s.startOffset<=r.startOffset===!0)s.endOffset=r.endOffset;else s.startOffset=NaN}cstPostTerminal(e,r){let s=this.CST_STACK[this.CST_STACK.length-1];tu(s,r,e),this.setNodeLocationFromToken(s.location,r)}cstPostNonTerminal(e,r){let s=this.CST_STACK[this.CST_STACK.length-1];ru(s,r,e),this.setNodeLocationFromNode(s.location,e.location)}getBaseCstVisitorConstructor(){if(_e(this.baseCstVisitorConstructor)){let e=su(this.className,B(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(_e(this.baseCstVisitorWithDefaultsConstructor)){let e=nu(this.className,B(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getLastExplicitRuleShortName(){let e=this.RULE_STACK;return e[e.length-1]}getPreviousExplicitRuleShortName(){let e=this.RULE_STACK;return e[e.length-2]}getLastExplicitRuleOccurrenceIndex(){let e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]}}class ki{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(e){if(this.selfAnalysisDone!==!0)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=e,this.tokVectorLength=e.length}get input(){return this.tokVector}SKIP_TOKEN(){if(this.currIdx<=this.tokVector.length-2)return this.consumeToken(),this.LA(1);else return Kr}LA(e){let r=this.currIdx+e;if(r<0||this.tokVectorLength<=r)return Kr;else return this.tokVector[r]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(e){this.currIdx=e}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVector.length-1}getLexerPosition(){return this.exportLexerState()}}class _i{ACTION(e){return e.call(this)}consume(e,r,s){return this.consumeInternal(r,e,s)}subrule(e,r,s){return this.subruleInternal(r,e,s)}option(e,r){return this.optionInternal(r,e)}or(e,r){return this.orInternal(r,e)}many(e,r){return this.manyInternal(e,r)}atLeastOne(e,r){return this.atLeastOneInternal(e,r)}CONSUME(e,r){return this.consumeInternal(e,0,r)}CONSUME1(e,r){return this.consumeInternal(e,1,r)}CONSUME2(e,r){return this.consumeInternal(e,2,r)}CONSUME3(e,r){return this.consumeInternal(e,3,r)}CONSUME4(e,r){return this.consumeInternal(e,4,r)}CONSUME5(e,r){return this.consumeInternal(e,5,r)}CONSUME6(e,r){return this.consumeInternal(e,6,r)}CONSUME7(e,r){return this.consumeInternal(e,7,r)}CONSUME8(e,r){return this.consumeInternal(e,8,r)}CONSUME9(e,r){return this.consumeInternal(e,9,r)}SUBRULE(e,r){return this.subruleInternal(e,0,r)}SUBRULE1(e,r){return this.subruleInternal(e,1,r)}SUBRULE2(e,r){return this.subruleInternal(e,2,r)}SUBRULE3(e,r){return this.subruleInternal(e,3,r)}SUBRULE4(e,r){return this.subruleInternal(e,4,r)}SUBRULE5(e,r){return this.subruleInternal(e,5,r)}SUBRULE6(e,r){return this.subruleInternal(e,6,r)}SUBRULE7(e,r){return this.subruleInternal(e,7,r)}SUBRULE8(e,r){return this.subruleInternal(e,8,r)}SUBRULE9(e,r){return this.subruleInternal(e,9,r)}OPTION(e){return this.optionInternal(e,0)}OPTION1(e){return this.optionInternal(e,1)}OPTION2(e){return this.optionInternal(e,2)}OPTION3(e){return this.optionInternal(e,3)}OPTION4(e){return this.optionInternal(e,4)}OPTION5(e){return this.optionInternal(e,5)}OPTION6(e){return this.optionInternal(e,6)}OPTION7(e){return this.optionInternal(e,7)}OPTION8(e){return this.optionInternal(e,8)}OPTION9(e){return this.optionInternal(e,9)}OR(e){return this.orInternal(e,0)}OR1(e){return this.orInternal(e,1)}OR2(e){return this.orInternal(e,2)}OR3(e){return this.orInternal(e,3)}OR4(e){return this.orInternal(e,4)}OR5(e){return this.orInternal(e,5)}OR6(e){return this.orInternal(e,6)}OR7(e){return this.orInternal(e,7)}OR8(e){return this.orInternal(e,8)}OR9(e){return this.orInternal(e,9)}MANY(e){this.manyInternal(0,e)}MANY1(e){this.manyInternal(1,e)}MANY2(e){this.manyInternal(2,e)}MANY3(e){this.manyInternal(3,e)}MANY4(e){this.manyInternal(4,e)}MANY5(e){this.manyInternal(5,e)}MANY6(e){this.manyInternal(6,e)}MANY7(e){this.manyInternal(7,e)}MANY8(e){this.manyInternal(8,e)}MANY9(e){this.manyInternal(9,e)}MANY_SEP(e){this.manySepFirstInternal(0,e)}MANY_SEP1(e){this.manySepFirstInternal(1,e)}MANY_SEP2(e){this.manySepFirstInternal(2,e)}MANY_SEP3(e){this.manySepFirstInternal(3,e)}MANY_SEP4(e){this.manySepFirstInternal(4,e)}MANY_SEP5(e){this.manySepFirstInternal(5,e)}MANY_SEP6(e){this.manySepFirstInternal(6,e)}MANY_SEP7(e){this.manySepFirstInternal(7,e)}MANY_SEP8(e){this.manySepFirstInternal(8,e)}MANY_SEP9(e){this.manySepFirstInternal(9,e)}AT_LEAST_ONE(e){this.atLeastOneInternal(0,e)}AT_LEAST_ONE1(e){return this.atLeastOneInternal(1,e)}AT_LEAST_ONE2(e){this.atLeastOneInternal(2,e)}AT_LEAST_ONE3(e){this.atLeastOneInternal(3,e)}AT_LEAST_ONE4(e){this.atLeastOneInternal(4,e)}AT_LEAST_ONE5(e){this.atLeastOneInternal(5,e)}AT_LEAST_ONE6(e){this.atLeastOneInternal(6,e)}AT_LEAST_ONE7(e){this.atLeastOneInternal(7,e)}AT_LEAST_ONE8(e){this.atLeastOneInternal(8,e)}AT_LEAST_ONE9(e){this.atLeastOneInternal(9,e)}AT_LEAST_ONE_SEP(e){this.atLeastOneSepFirstInternal(0,e)}AT_LEAST_ONE_SEP1(e){this.atLeastOneSepFirstInternal(1,e)}AT_LEAST_ONE_SEP2(e){this.atLeastOneSepFirstInternal(2,e)}AT_LEAST_ONE_SEP3(e){this.atLeastOneSepFirstInternal(3,e)}AT_LEAST_ONE_SEP4(e){this.atLeastOneSepFirstInternal(4,e)}AT_LEAST_ONE_SEP5(e){this.atLeastOneSepFirstInternal(5,e)}AT_LEAST_ONE_SEP6(e){this.atLeastOneSepFirstInternal(6,e)}AT_LEAST_ONE_SEP7(e){this.atLeastOneSepFirstInternal(7,e)}AT_LEAST_ONE_SEP8(e){this.atLeastOneSepFirstInternal(8,e)}AT_LEAST_ONE_SEP9(e){this.atLeastOneSepFirstInternal(9,e)}RULE(e,r,s=zr){if(ee(this.definedRulesNames,e)){let o={message:nt.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:Re.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(o)}this.definedRulesNames.push(e);let n=this.defineRule(e,r,s);return this[e]=n,n}OVERRIDE_RULE(e,r,s=zr){let n=$c(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(n);let i=this.defineRule(e,r,s);return this[e]=i,i}BACKTRACK(e,r){return function(){this.isBackTrackingStack.push(1);let s=this.saveRecogState();try{return e.apply(this,r),!0}catch(n){if(Zt(n))return!1;else throw n}finally{this.reloadRecogState(s),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return cn(D(this.gastProductionsCache))}}class Mi{initRecognizerEngine(e,r){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=Gr,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},x(r,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
|
|
91
91
|
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
|
|
92
|
-
For Further details.`);if(
|
|
92
|
+
For Further details.`);if(R(e)){if(_(e))throw Error(`A Token Vocabulary cannot be empty.
|
|
93
93
|
Note that the first argument for the parser constructor
|
|
94
94
|
is no longer a Token vector (since v4.0).`);if(typeof e[0].startOffset==="number")throw Error(`The Parser constructor no longer accepts a token vector as the first argument.
|
|
95
95
|
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
|
|
96
|
-
For Further details.`)}if(
|
|
97
|
-
Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);let n=
|
|
96
|
+
For Further details.`)}if(R(e))this.tokensMap=Te(e,(i,o)=>(i[o.name]=o,i),{});else if(x(e,"modes")&&ve(xe(D(e.modes)),pc)){let i=xe(D(e.modes)),o=wr(i);this.tokensMap=Te(o,(c,u)=>(c[u.name]=u,c),{})}else if(ne(e))this.tokensMap=K(e);else throw Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=Ve;let s=x(e,"modes")?xe(D(e.modes)):D(e),n=ve(s,(i)=>_(i.categoryMatches));this.tokenMatcher=n?Gr:Lt,It(D(this.tokensMap))}defineRule(e,r,s){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'
|
|
97
|
+
Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);let n=x(s,"resyncEnabled")?s.resyncEnabled:zr.resyncEnabled,i=x(s,"recoveryValueFunc")?s.recoveryValueFunc:zr.recoveryValueFunc,o=this.ruleShortNameIdx<<Qc+_n;this.ruleShortNameIdx++,this.shortRuleNameToFull[o]=e,this.fullRuleNameToShort[e]=o;let c;if(this.outputCst===!0)c=function(...f){try{this.ruleInvocationStateUpdate(o,e,this.subruleIdx),r.apply(this,f);let h=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(h),h}catch(h){return this.invokeRuleCatch(h,n,i)}finally{this.ruleFinallyStateUpdate()}};else c=function(...f){try{return this.ruleInvocationStateUpdate(o,e,this.subruleIdx),r.apply(this,f)}catch(h){return this.invokeRuleCatch(h,n,i)}finally{this.ruleFinallyStateUpdate()}};return Object.assign(c,{ruleName:e,originalGrammarAction:r})}invokeRuleCatch(e,r,s){let n=this.RULE_STACK.length===1,i=r&&!this.isBackTracking()&&this.recoveryEnabled;if(Zt(e)){let o=e;if(i){let c=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(c))if(o.resyncedTokens=this.reSyncTo(c),this.outputCst){let u=this.CST_STACK[this.CST_STACK.length-1];return u.recoveredNode=!0,u}else return s(e);else{if(this.outputCst){let u=this.CST_STACK[this.CST_STACK.length-1];u.recoveredNode=!0,o.partialCstResult=u}throw o}}else if(n)return this.moveToTerminatedState(),s(e);else throw o}else throw e}optionInternal(e,r){let s=this.getKeyForAutomaticLookahead(wn,r);return this.optionInternalLogic(e,r,s)}optionInternalLogic(e,r,s){let n=this.getLaFuncFromCache(s),i;if(typeof e!=="function"){i=e.DEF;let o=e.GATE;if(o!==void 0){let c=n;n=()=>o.call(this)&&c.call(this)}}else i=e;if(n.call(this)===!0)return i.call(this);return}atLeastOneInternal(e,r){let s=this.getKeyForAutomaticLookahead(Ts,e);return this.atLeastOneInternalLogic(e,r,s)}atLeastOneInternalLogic(e,r,s){let n=this.getLaFuncFromCache(s),i;if(typeof r!=="function"){i=r.DEF;let o=r.GATE;if(o!==void 0){let c=n;n=()=>o.call(this)&&c.call(this)}}else i=r;if(n.call(this)===!0){let o=this.doSingleRepetition(i);while(n.call(this)===!0&&o===!0)o=this.doSingleRepetition(i)}else throw this.raiseEarlyExitException(e,oe.REPETITION_MANDATORY,r.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,r],n,Ts,e,Ei)}atLeastOneSepFirstInternal(e,r){let s=this.getKeyForAutomaticLookahead(jr,e);this.atLeastOneSepFirstInternalLogic(e,r,s)}atLeastOneSepFirstInternalLogic(e,r,s){let{DEF:n,SEP:i}=r;if(this.getLaFuncFromCache(s).call(this)===!0){n.call(this);let c=()=>this.tokenMatcher(this.LA(1),i);while(this.tokenMatcher(this.LA(1),i)===!0)this.CONSUME(i),n.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,c,n,xn],c,jr,e,xn)}else throw this.raiseEarlyExitException(e,oe.REPETITION_MANDATORY_WITH_SEPARATOR,r.ERR_MSG)}manyInternal(e,r){let s=this.getKeyForAutomaticLookahead(gs,e);return this.manyInternalLogic(e,r,s)}manyInternalLogic(e,r,s){let n=this.getLaFuncFromCache(s),i;if(typeof r!=="function"){i=r.DEF;let c=r.GATE;if(c!==void 0){let u=n;n=()=>c.call(this)&&u.call(this)}}else i=r;let o=!0;while(n.call(this)===!0&&o===!0)o=this.doSingleRepetition(i);this.attemptInRepetitionRecovery(this.manyInternal,[e,r],n,gs,e,Ti,o)}manySepFirstInternal(e,r){let s=this.getKeyForAutomaticLookahead(Es,e);this.manySepFirstInternalLogic(e,r,s)}manySepFirstInternalLogic(e,r,s){let{DEF:n,SEP:i}=r;if(this.getLaFuncFromCache(s).call(this)===!0){n.call(this);let c=()=>this.tokenMatcher(this.LA(1),i);while(this.tokenMatcher(this.LA(1),i)===!0)this.CONSUME(i),n.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,c,n,An],c,Es,e,An)}}repetitionSepSecondInternal(e,r,s,n,i){while(s())this.CONSUME(r),n.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,r,s,n,i],s,jr,e,i)}doSingleRepetition(e){let r=this.getLexerPosition();return e.call(this),this.getLexerPosition()>r}orInternal(e,r){let s=this.getKeyForAutomaticLookahead(Mn,r),n=R(e)?e:e.DEF,o=this.getLaFuncFromCache(s).call(this,n);if(o!==void 0)return n[o].ALT.call(this);this.raiseNoAltException(r,e.ERR_MSG)}ruleFinallyStateUpdate(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){let e=this.LA(1),r=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new vn(r,e))}}subruleInternal(e,r,s){let n;try{let i=s!==void 0?s.ARGS:void 0;return this.subruleIdx=r,n=e.apply(this,i),this.cstPostNonTerminal(n,s!==void 0&&s.LABEL!==void 0?s.LABEL:e.ruleName),n}catch(i){throw this.subruleInternalError(i,s,e.ruleName)}}subruleInternalError(e,r,s){if(Zt(e)&&e.partialCstResult!==void 0)this.cstPostNonTerminal(e.partialCstResult,r!==void 0&&r.LABEL!==void 0?r.LABEL:s),delete e.partialCstResult;throw e}consumeInternal(e,r,s){let n;try{let i=this.LA(1);if(this.tokenMatcher(i,e)===!0)this.consumeToken(),n=i;else this.consumeInternalError(e,i,s)}catch(i){n=this.consumeInternalRecovery(e,r,i)}return this.cstPostTerminal(s!==void 0&&s.LABEL!==void 0?s.LABEL:e.name,n),n}consumeInternalError(e,r,s){let n,i=this.LA(0);if(s!==void 0&&s.ERR_MSG)n=s.ERR_MSG;else n=this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:r,previous:i,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new Wr(n,r,i))}consumeInternalRecovery(e,r,s){if(this.recoveryEnabled&&s.name==="MismatchedTokenException"&&!this.isBackTracking()){let n=this.getFollowsForInRuleRecovery(e,r);try{return this.tryInRuleRecovery(e,n)}catch(i){if(i.name===Ri)throw s;else throw i}}else throw s}saveRecogState(){let e=this.errors,r=K(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:r,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK}ruleInvocationStateUpdate(e,r,s){this.RULE_OCCURRENCE_STACK.push(s),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(r)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){let e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),Ve)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}}class wi{initErrorHandler(e){this._errors=[],this.errorMessageProvider=x(e,"errorMessageProvider")?e.errorMessageProvider:Fe.errorMessageProvider}SAVE_ERROR(e){if(Zt(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:K(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;else throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return K(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,r,s){let n=this.getCurrRuleFullName(),i=this.getGAstProductions()[n],c=ps(e,i,r,this.maxLookahead)[0],u=[];for(let f=1;f<=this.maxLookahead;f++)u.push(this.LA(f));let a=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:c,actual:u,previous:this.LA(0),customUserDescription:s,ruleName:n});throw this.SAVE_ERROR(new kn(a,this.LA(1),this.LA(0)))}raiseNoAltException(e,r){let s=this.getCurrRuleFullName(),n=this.getGAstProductions()[s],i=ds(e,n,this.maxLookahead),o=[];for(let a=1;a<=this.maxLookahead;a++)o.push(this.LA(a));let c=this.LA(0),u=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:i,actual:o,previous:c,customUserDescription:r,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new Cn(u,this.LA(1),c))}}class Pi{initContentAssist(){}computeContentAssist(e,r){let s=this.gastProductionsCache[e];if(_e(s))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return On([s],r,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){let r=Le(e.ruleStack),n=this.getGAstProductions()[r];return new gi(n,e).startWalking()}}var Bn={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(Bn);var iu=!0,ou=Math.pow(2,_n)-1,lu=L({name:"RECORDING_PHASE_TOKEN",pattern:ie.NA});It([lu]);var cu=lr(lu,`This IToken indicates the Parser is in Recording Phase
|
|
98
98
|
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(cu);var zy={name:`This CSTNode indicates the Parser is in Recording Phase
|
|
99
99
|
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}};class Ui{initGastRecorder(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",()=>{for(let e=0;e<10;e++){let r=e>0?e:"";this[`CONSUME${r}`]=function(s,n){return this.consumeInternalRecord(s,e,n)},this[`SUBRULE${r}`]=function(s,n){return this.subruleInternalRecord(s,e,n)},this[`OPTION${r}`]=function(s){return this.optionInternalRecord(s,e)},this[`OR${r}`]=function(s){return this.orInternalRecord(s,e)},this[`MANY${r}`]=function(s){this.manyInternalRecord(e,s)},this[`MANY_SEP${r}`]=function(s){this.manySepFirstInternalRecord(e,s)},this[`AT_LEAST_ONE${r}`]=function(s){this.atLeastOneInternalRecord(e,s)},this[`AT_LEAST_ONE_SEP${r}`]=function(s){this.atLeastOneSepFirstInternalRecord(e,s)}}this.consume=function(e,r,s){return this.consumeInternalRecord(r,e,s)},this.subrule=function(e,r,s){return this.subruleInternalRecord(r,e,s)},this.option=function(e,r){return this.optionInternalRecord(r,e)},this.or=function(e,r){return this.orInternalRecord(r,e)},this.many=function(e,r){this.manyInternalRecord(e,r)},this.atLeastOne=function(e,r){this.atLeastOneInternalRecord(e,r)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",()=>{let e=this;for(let r=0;r<10;r++){let s=r>0?r:"";delete e[`CONSUME${s}`],delete e[`SUBRULE${s}`],delete e[`OPTION${s}`],delete e[`OR${s}`],delete e[`MANY${s}`],delete e[`MANY_SEP${s}`],delete e[`AT_LEAST_ONE${s}`],delete e[`AT_LEAST_ONE_SEP${s}`]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,r){return()=>!0}LA_RECORD(e){return Kr}topLevelRuleRecord(e,r){try{let s=new je({definition:[],name:e});return s.name=e,this.recordingProdStack.push(s),r.call(this),this.recordingProdStack.pop(),s}catch(s){if(s.KNOWN_RECORDER_ERROR!==!0)try{s.message=s.message+`
|
|
100
100
|
This error was thrown during the "grammar recording phase" For more info see:
|
|
101
|
-
https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch(n){throw s}throw s}}optionInternalRecord(e,r){return ys.call(this,re,e,r)}atLeastOneInternalRecord(e,r){ys.call(this,Ee,r,e)}atLeastOneSepFirstInternalRecord(e,r){ys.call(this,ye,r,e,iu)}manyInternalRecord(e,r){ys.call(this,
|
|
101
|
+
https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch(n){throw s}throw s}}optionInternalRecord(e,r){return ys.call(this,re,e,r)}atLeastOneInternalRecord(e,r){ys.call(this,Ee,r,e)}atLeastOneSepFirstInternalRecord(e,r){ys.call(this,ye,r,e,iu)}manyInternalRecord(e,r){ys.call(this,P,r,e)}manySepFirstInternalRecord(e,r){ys.call(this,he,r,e,iu)}orInternalRecord(e,r){return Vy.call(this,e,r)}subruleInternalRecord(e,r,s){if(Fn(r),!e||x(e,"ruleName")===!1){let c=Error(`<SUBRULE${au(r)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>
|
|
102
102
|
inside top level rule: <${this.recordingProdStack[0].name}>`);throw c.KNOWN_RECORDER_ERROR=!0,c}let n=st(this.recordingProdStack),i=e.ruleName,o=new J({idx:r,nonTerminalName:i,label:s===null||s===void 0?void 0:s.LABEL,referencedRule:void 0});return n.definition.push(o),this.outputCst?zy:Bn}consumeInternalRecord(e,r,s){if(Fn(r),!di(e)){let o=Error(`<CONSUME${au(r)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>
|
|
103
|
-
inside top level rule: <${this.recordingProdStack[0].name}>`);throw o.KNOWN_RECORDER_ERROR=!0,o}let n=st(this.recordingProdStack),i=new
|
|
104
|
-
Idx value must be a none negative value smaller than ${ou+1}`);throw r.KNOWN_RECORDER_ERROR=!0,r}}class Di{initPerformanceTracer(e){if(
|
|
103
|
+
inside top level rule: <${this.recordingProdStack[0].name}>`);throw o.KNOWN_RECORDER_ERROR=!0,o}let n=st(this.recordingProdStack),i=new M({idx:r,terminalType:e,label:s===null||s===void 0?void 0:s.LABEL});return n.definition.push(i),cu}}function ys(e,r,s,n=!1){Fn(s);let i=st(this.recordingProdStack),o=Ue(r)?r:r.DEF,c=new e({definition:[],idx:s});if(n)c.separator=r.SEP;if(x(r,"MAX_LOOKAHEAD"))c.maxLookahead=r.MAX_LOOKAHEAD;return this.recordingProdStack.push(c),o.call(this),i.definition.push(c),this.recordingProdStack.pop(),Bn}function Vy(e,r){Fn(r);let s=st(this.recordingProdStack),n=R(e)===!1,i=n===!1?e:e.DEF,o=new de({definition:[],idx:r,ignoreAmbiguities:n&&e.IGNORE_AMBIGUITIES===!0});if(x(e,"MAX_LOOKAHEAD"))o.maxLookahead=e.MAX_LOOKAHEAD;let c=rs(i,(u)=>Ue(u.GATE));return o.hasPredicates=c,s.definition.push(o),A(i,(u)=>{let a=new Z({definition:[]});if(o.definition.push(a),x(u,"IGNORE_AMBIGUITIES"))a.ignoreAmbiguities=u.IGNORE_AMBIGUITIES;else if(x(u,"GATE"))a.ignoreAmbiguities=!0;this.recordingProdStack.push(a),u.ALT.call(this),this.recordingProdStack.pop()}),Bn}function au(e){return e===0?"":`${e}`}function Fn(e){if(e<0||e>ou){let r=Error(`Invalid DSL Method idx value: <${e}>
|
|
104
|
+
Idx value must be a none negative value smaller than ${ou+1}`);throw r.KNOWN_RECORDER_ERROR=!0,r}}class Di{initPerformanceTracer(e){if(x(e,"traceInitPerf")){let r=e.traceInitPerf,s=typeof r==="number";this.traceInitMaxIdent=s?r:1/0,this.traceInitPerf=s?r>0:r}else this.traceInitMaxIdent=0,this.traceInitPerf=Fe.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,r){if(this.traceInitPerf===!0){this.traceInitIndent++;let s=Array(this.traceInitIndent+1).join("\t");if(this.traceInitIndent<this.traceInitMaxIdent)console.log(`${s}--> <${e}>`);let{time:n,value:i}=ns(r),o=n>10?console.warn:console.log;if(this.traceInitIndent<this.traceInitMaxIdent)o(`${s}<-- <${e}> time: ${n}ms`);return this.traceInitIndent--,i}else return r()}}function uu(e,r){r.forEach((s)=>{let n=s.prototype;Object.getOwnPropertyNames(n).forEach((i)=>{if(i==="constructor")return;let o=Object.getOwnPropertyDescriptor(n,i);if(o&&(o.get||o.set))Object.defineProperty(e.prototype,i,o);else e.prototype[i]=s.prototype[i]})})}var Kr=lr(Ve,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(Kr);var Fe=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:yn,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),zr=Object.freeze({recoveryValueFunc:()=>{return},resyncEnabled:!0}),Re;(function(e){e[e.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",e[e.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",e[e.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",e[e.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",e[e.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",e[e.LEFT_RECURSION=5]="LEFT_RECURSION",e[e.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",e[e.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",e[e.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",e[e.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",e[e.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",e[e.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",e[e.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",e[e.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION"})(Re||(Re={}));class As{static performSelfAnalysis(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated.\t\nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT("performSelfAnalysis",()=>{let e;this.selfAnalysisDone=!0;let r=this.className;this.TRACE_INIT("toFastProps",()=>{is(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),A(this.definedRulesNames,(n)=>{let o=this[n].originalGrammarAction,c;this.TRACE_INIT(`${n} Rule`,()=>{c=this.topLevelRuleRecord(n,o)}),this.gastProductionsCache[n]=c})}finally{this.disableRecording()}});let s=[];if(this.TRACE_INIT("Grammar Resolving",()=>{s=zc({rules:D(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(s)}),this.TRACE_INIT("Grammar Validations",()=>{if(_(s)&&this.skipValidations===!1){let n=Vc({rules:D(this.gastProductionsCache),tokenTypes:D(this.tokensMap),errMsgProvider:nt,grammarName:r}),i=Uc({lookaheadStrategy:this.lookaheadStrategy,rules:D(this.gastProductionsCache),tokenTypes:D(this.tokensMap),grammarName:r});this.definitionErrors=this.definitionErrors.concat(n,i)}}),_(this.definitionErrors)){if(this.recoveryEnabled)this.TRACE_INIT("computeAllProdsFollows",()=>{let n=Yl(D(this.gastProductionsCache));this.resyncFollows=n});this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var n,i;(i=(n=this.lookaheadStrategy).initialize)===null||i===void 0||i.call(n,{rules:D(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(D(this.gastProductionsCache))})}if(!As.DEFER_DEFINITION_ERRORS_HANDLING&&!_(this.definitionErrors))throw e=E(this.definitionErrors,(n)=>n.message),Error(`Parser Definition Errors detected:
|
|
105
105
|
${e.join(`
|
|
106
106
|
-------------------------------
|
|
107
|
-
`)}`)})}constructor(e,r){this.definitionErrors=[],this.selfAnalysisDone=!1;let s=this;if(s.initErrorHandler(r),s.initLexerAdapter(),s.initLooksAhead(r),s.initRecognizerEngine(e,r),s.initRecoverable(r),s.initTreeBuilder(r),s.initContentAssist(),s.initGastRecorder(r),s.initPerformanceTracer(r),
|
|
107
|
+
`)}`)})}constructor(e,r){this.definitionErrors=[],this.selfAnalysisDone=!1;let s=this;if(s.initErrorHandler(r),s.initLexerAdapter(),s.initLooksAhead(r),s.initRecognizerEngine(e,r),s.initRecoverable(r),s.initTreeBuilder(r),s.initContentAssist(),s.initGastRecorder(r),s.initPerformanceTracer(r),x(r,"ignoredIssues"))throw Error(`The <ignoredIssues> IParserConfig property has been deprecated.
|
|
108
108
|
Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
|
|
109
109
|
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
|
|
110
|
-
For further details.`);this.skipValidations=
|
|
110
|
+
For further details.`);this.skipValidations=x(r,"skipValidations")?r.skipValidations:Fe.skipValidations}}As.DEFER_DEFINITION_ERRORS_HANDLING=!1;uu(As,[Oi,Li,vi,ki,Mi,_i,wi,Pi,Ui,Di]);class $n extends As{constructor(e,r=Fe){let s=K(r);s.outputCst=!0;super(e,s)}}function yu(e,r){let s=e.lexer.tokenize(r);if(s.errors.length>0){let i=s.errors[0],o=Number.isFinite(i.offset)?i.offset:r.length,c=o+(Number.isFinite(i.length)?i.length:0);throw Error(`Error lexing ${e.diagramType} diagram: ${i.message} at line ${i.line??1}, column ${i.column??1} [${o},${c})`)}e.parser.input=s.tokens;let n=e.entry();if(e.parser.errors.length>0)throw Error(`Error parsing ${e.diagramType} diagram: ${e.parser.errors[0].message}`);e.visit(n)}t(yu,"runChevrotainParse");var ae={SOLID_ARROW:0,BACK_ARROW:1,LINE_SOLID:2,CIRCLE_ARROW:3,CROSS_ARROW:4,CIRCLE_ARROW_REVERSED:5,CROSS_ARROW_REVERSED:6},Yy="LR",Xy=Y.usecase,zi=t(()=>({actors:new Map,useCases:new Map,systemBoundaries:new Map,relationships:[],notes:new Map,jsonNodes:new Map,classDefs:new Map,symbols:new Map,direction:Yy,relationshipCounter:0,noteCounter:0,accTitle:"",accDescription:"",ast:void 0,config:structuredClone(Xy)}),"createModel"),qy=t((e)=>{if(!(e.actors instanceof Map)||!(e.useCases instanceof Map)||!(e.systemBoundaries instanceof Map)||!Array.isArray(e.relationships)||!(e.notes instanceof Map)||!(e.jsonNodes instanceof Map)||!(e.classDefs instanceof Map)||!(e.symbols instanceof Map)||!["TB","TD","BT","RL","LR"].includes(e.direction)||!Number.isSafeInteger(e.relationshipCounter)||e.relationshipCounter<0||!Number.isSafeInteger(e.noteCounter)||e.noteCounter<0||typeof e.accTitle!=="string"||typeof e.accDescription!=="string"||!e.config)throw Error("Cannot commit an incomplete usecase model")},"assertCompleteModel"),w=zi(),Jy=t(()=>structuredClone(w.config),"getConfig"),Zy=t(()=>w.ast,"getAST"),Qy=t((e)=>{let r=structuredClone(e);qy(r);let s=j(),n=H();try{z(r.accTitle),U(r.accDescription),w=r}catch(i){throw z(s),U(n),i}},"commit"),eA=t(()=>{w=zi(),F()},"clear"),tA=t(()=>w.actors,"getActors"),rA=t((e)=>w.actors.get(e),"getActor"),sA=t(()=>w.useCases,"getUseCases"),nA=t((e)=>w.useCases.get(e),"getUseCase"),iA=t(()=>w.systemBoundaries,"getSystemBoundaries"),oA=t((e)=>w.systemBoundaries.get(e),"getSystemBoundary"),aA=t(()=>w.relationships,"getRelationships"),lA=t(()=>w.notes,"getNotes"),cA=t((e)=>w.notes.get(e),"getNote"),uA=t(()=>w.jsonNodes,"getJsonNodes"),fA=t((e)=>w.jsonNodes.get(e),"getJsonNode"),hA=t(()=>w.classDefs,"getClassDefs"),dA=t((e)=>w.classDefs.get(e),"getClassDef"),Au=t(()=>w.direction,"getDirection"),cr=t((e)=>{let r=new Map;for(let s of["default",...e]){let n=w.classDefs.get(s);if(!n)continue;for(let i of n.styles){let o=i.trim(),c=o.indexOf(":"),u=(c===-1?o:o.slice(0,c)).trim();if(u)r.set(u,o)}}return[...r.values()]},"getCompiledStyles"),pA=t((e)=>e.replaceAll("~","~0").replaceAll("/","~1"),"escapeJsonPointerPart"),fu=t((e)=>typeof e==="string"?e:e===null?"null":String(e),"displayJsonScalar"),mA=t((e,r,s=(n)=>n)=>{let n=[],i=t((c,u,a)=>{n.push({key:s(c),accessibleKey:s(u),value:s(a)})},"append"),o=t((c,u,a)=>{if(Array.isArray(c)){if(c.length===0){i(u,u,"[]");return}if(c.every((h)=>h===null||["string","number","boolean"].includes(typeof h))){for(let[h,d]of c.entries())i(h===0?u:"",u,fu(d));return}for(let[h,d]of c.entries())o(d,`${u}[${h}]`,`${a}/${h}`);return}if(c!==null&&typeof c==="object"){let f=c,h=r[a]??Object.keys(f);if(h.length===0){i(u,u,"{}");return}for(let d of h){let p=u?`${u}.${d}`:d;o(f[d],p,`${a}/${pA(d)}`)}return}i(u,u,fu(c))},"visit");return o(e,"",""),n},"flattenJsonRows"),gA=t((e)=>{switch(e.type){case"hollow":return"usecaseActorHollow";case"awesome":return"usecaseActorAwesome";case"icon":return"usecaseActorIcon";case"normal":return"usecaseActor"}},"actorShape"),TA=t((e)=>{if(e.shape==="ellipse")return e.business?"usecaseBusiness":"usecaseEllipse";return e.shape},"useCaseShape"),EA=t((e)=>{switch(e){case ae.SOLID_ARROW:return{arrowTypeStart:"none",arrowTypeEnd:"arrow_point"};case ae.BACK_ARROW:return{arrowTypeStart:"arrow_point",arrowTypeEnd:"none"};case ae.CIRCLE_ARROW:return{arrowTypeStart:"none",arrowTypeEnd:"arrow_circle"};case ae.CROSS_ARROW:return{arrowTypeStart:"none",arrowTypeEnd:"arrow_cross"};case ae.CIRCLE_ARROW_REVERSED:return{arrowTypeStart:"arrow_circle",arrowTypeEnd:"none"};case ae.CROSS_ARROW_REVERSED:return{arrowTypeStart:"arrow_cross",arrowTypeEnd:"none"};case ae.LINE_SOLID:return{arrowTypeStart:"none",arrowTypeEnd:"none"}}},"associationMarkers"),yA=t((e)=>{switch(e.type){case"include":case"extend":return{arrowTypeStart:"none",arrowTypeEnd:"arrow_point",pattern:"dotted",label:e.type,labelType:"text"};case"generalization":return{arrowTypeStart:"none",arrowTypeEnd:"extension",pattern:"solid"};case"association":return{...EA(e.arrowType),pattern:"solid",...e.label?{label:e.label}:{},...e.labelType?{labelType:e.labelType}:{}}}},"relationshipVisuals"),AA=t((e)=>e.animate||e.animation?[`edge-animation-${e.animation??"fast"}`]:[],"animationClasses"),xs=t((...e)=>e.filter((r)=>Boolean(r)).join(" "),"classNames"),xA=t(()=>{let e=m(),r={...w.config,...e.usecase},s=t((a)=>te(a,e),"sanitize"),n=t((a)=>s(w.actors.get(a)?.label??w.useCases.get(a)?.label??w.jsonNodes.get(a)?.id??w.notes.get(a)?.label??a),"endpointLabel"),i=[],o=[],c=0,u=0;for(let a of w.actors.values())i.push({id:a.id,label:s(a.label),labelType:a.labelType,shape:gA(a),isGroup:!1,padding:10,look:e.look,colorIndex:c++,cssClasses:xs("default","usecase-actor",`usecase-actor-${a.type}`,a.business&&"usecase-business",...a.classes),cssStyles:[...a.styles],cssCompiledStyles:cr(a.classes),actorType:a.type,business:a.business,...a.icon?{icon:a.icon}:{},...a.stereotype?{stereotype:s(a.stereotype)}:{},...a.parentId?{parentId:a.parentId}:{}});for(let a of w.useCases.values())i.push({id:a.id,label:s(a.label),labelType:a.labelType,shape:TA(a),isGroup:!1,padding:a.shape==="ellipse"?20:10,look:e.look,colorIndex:c++,cssClasses:xs("default","usecase-element",`usecase-${a.shape}`,a.business&&"usecase-business",...a.classes),cssStyles:[...a.styles],cssCompiledStyles:cr(a.classes),business:a.business,...a.stereotype?{stereotype:s(a.stereotype)}:{},...a.parentId?{parentId:a.parentId}:{}});for(let a of w.notes.values())i.push({id:a.id,label:s(a.label),labelType:a.labelType,shape:"note",isGroup:!1,padding:10,look:e.look,cssClasses:"default usecase-note",cssStyles:[],cssCompiledStyles:cr([]),noteTarget:a.target,noteTargetLabel:s(w.actors.get(a.target)?.label??w.useCases.get(a.target)?.label??w.jsonNodes.get(a.target)?.id??a.target)});for(let a of w.jsonNodes.values())i.push({id:a.id,label:s(a.id),labelType:"text",shape:"usecaseJsonTable",isGroup:!1,padding:10,look:e.look,cssClasses:xs("default","usecase-json-table",...a.classes),cssStyles:[...a.styles],cssCompiledStyles:cr(a.classes),jsonRows:mA(a.value,a.propertyOrder,s)});for(let a of w.systemBoundaries.values())i.push({id:a.id,label:s(a.label),labelType:a.labelType,shape:"usecaseSystemBoundary",isGroup:!0,padding:20,look:e.look,colorIndex:u++,cssClasses:xs("default","system-boundary",`system-boundary-${a.type}`,...a.classes),cssStyles:[...a.styles],cssCompiledStyles:cr(a.classes),boundaryType:a.type});for(let a of w.relationships){let{label:f,...h}=yA(a);o.push({id:a.id,start:a.source,end:a.target,source:a.source,target:a.target,sourceLabel:n(a.source),targetLabel:n(a.target),type:"edge",relationshipType:a.type,internal:!1,...h,...f!==void 0?{label:s(f)}:{},labelpos:"c",classes:xs("default","relationship",`relationship-${a.type}`,...a.classes,...AA(a)),style:[...a.styles],cssCompiledStyles:cr(a.classes),animate:a.animate,...a.animation?{animation:a.animation}:{},look:e.look,thickness:"normal",minlen:a.minlen,isUserDefinedId:a.explicitId})}for(let a of w.notes.values())o.push({id:`${a.id}-edge`,start:a.id,end:a.target,source:a.id,target:a.target,type:"edge",relationshipType:"note",sourceLabel:n(a.id),targetLabel:n(a.target),internal:!0,pattern:"dotted",arrowTypeStart:"none",arrowTypeEnd:"none",labelpos:"c",classes:"default relationship relationship-note",style:[],cssCompiledStyles:cr([]),animate:!1,look:e.look,thickness:"normal",minlen:1,isUserDefinedId:!1});for(let a of i){if(a.wrappingWidth??=r.wrappingWidth,!a.isGroup&&!a.shape.startsWith("usecaseActor"))a.minWidth??=r.minNodeWidth;if(a.shape==="usecaseEllipse"||a.shape==="usecaseBusiness")a.spreadPorts=!0}return{nodes:i,edges:o,config:e,type:"usecase",layoutAlgorithm:"dagre",direction:Au(),nodeSpacing:r.nodeSpacing,rankSpacing:r.rankSpacing,actorFontSize:r.actorFontSize,actorFontFamily:r.actorFontFamily,actorFontWeight:r.actorFontWeight,usecaseFontSize:r.usecaseFontSize,usecaseFontFamily:r.usecaseFontFamily,usecaseFontWeight:r.usecaseFontWeight,diagramPadding:r.diagramPadding,useMaxWidth:r.useMaxWidth,markers:["point","circle","cross","extension"]}},"getData"),Hn={getConfig:Jy,createModel:zi,commit:Qy,getAST:Zy,clear:eA,setDiagramTitle:W,getDiagramTitle:q,setAccTitle:z,getAccTitle:j,setAccDescription:U,getAccDescription:H,getActors:tA,getActor:rA,getUseCases:sA,getUseCase:nA,getSystemBoundaries:iA,getSystemBoundary:oA,getRelationships:aA,getNotes:lA,getNote:cA,getJsonNodes:uA,getJsonNode:fA,getClassDefs:hA,getClassDef:dA,getDirection:Au,getData:xA};function fr(e,r,s){let n=[s];return n.index=r,n.input=e,n}t(fr,"customMatch");var SA=t((e,r)=>{if(e[r]!=='"'||e[r+1]!=="`")return null;for(let s=r+2;s<e.length-1;s++)if(e[s]==="`"&&e[s+1]==='"')return fr(e,r,e.slice(r,s+2));return null},"matchMarkdownString"),RA=t((e,r)=>{if(e[r]!=="%"||e[r+1]!=="%")return null;for(let n=r-1;n>=0;n--){let i=e[n];if(i===`
|
|
111
111
|
`||i==="\r")break;if(i!==" "&&i!=="\t")return null}let s=r+2;while(s<e.length&&e[s]!==`
|
|
112
112
|
`&&e[s]!=="\r")s++;return fr(e,r,e.slice(r,s))},"matchComment"),xu=t((e,r)=>{for(let s=r-1;s>=0;s--){let n=e[s];if(n===`
|
|
113
|
-
`||n==="\r")return!0;if(n!==" "&&n!=="\t")return!1}return!0},"isIndentedLineStart"),Su=t((e,r,s)=>{if(!xu(e,r))return null;let n=s.exec(e.slice(r));return n?fr(e,r,n[0]):null},"matchAccessibilityLine"),OA=t((e,r)=>{if(!xu(e,r))return null;let s=/^accDescr[\t ]*{/.exec(e.slice(r));if(!s)return null;let n=e.indexOf("}",r+s[0].length);return n===-1?null:fr(e,r,e.slice(r,n+1))},"matchAccDescrBlock"),LA=t((e,r)=>{if(e[r]!=="{")return null;let s=0,n=!1,i=!1;for(let o=r;o<e.length;o++){let c=e[o];if(n){if(i)i=!1;else if(c==="\\")i=!0;else if(c==='"')n=!1;continue}if(c==='"')n=!0;else if(c==="{")s++;else if(c==="}"&&--s===0)return fr(e,r,e.slice(r,o+1))}return null},"matchJsonObject"),IA=t((e,r)=>{let s=e.indexOf(">>",r);if(s===-1||/[\n\r]/.test(e.slice(r,s)))return null;let n=e.slice(r,s);return n.trim()?fr(e,r,n):null},"matchStereotypeText"),Ie=N({name:"LABEL_TEXT",pattern:ie.NA}),Hr=N({name:"WORD",pattern:ie.NA,categories:Ie}),Vi=N({name:"NUMBER",pattern:/(?:\d+\.\d+|\d+|\.\d+)(?:[A-Za-z]+)?/,categories:Ie}),ce=N({name:"IDENTIFIER",pattern:/\w+/,longer_alt:Vi,categories:Hr}),NA=N({name:"HWS",pattern:/[\t ]+/,group:ie.SKIPPED}),bt=N({name:"MARKDOWN_STRING",pattern:SA,start_chars_hint:['"'],line_breaks:!0}),bA=N({name:"UNCLOSED_MARKDOWN_STRING",pattern:/"`[^]*/,line_breaks:!0}),Bi=N({name:"COMMENT",pattern:RA,start_chars_hint:["%"],line_breaks:!1}),Nt=N({name:"NEWLINE",pattern:/\r\n|\n|\r/,line_breaks:!0}),Ru=N({name:"ACC_DESCR_BLOCK",pattern:OA,start_chars_hint:["a"],line_breaks:!0}),CA=/^accTitle[\t ]*:[^\n\r]*/,vA=/^accDescr[\t ]*:[^\n\r]*/,Ou=N({name:"ACC_TITLE_LINE",pattern:t((e,r)=>Su(e,r,CA),"pattern"),start_chars_hint:["a"],line_breaks:!1}),Lu=N({name:"ACC_DESCR_LINE",pattern:t((e,r)=>Su(e,r,vA),"pattern"),start_chars_hint:["a"],line_breaks:!1}),Iu=N({name:"JSON_DECLARATION_START",pattern:/json[\t ]+\w+[\t ]*@[\t ]*(?={)/,push_mode:"jsonBody"}),Hi=N({name:"JSON_OBJECT_LITERAL",pattern:LA,start_chars_hint:["{"],line_breaks:!0,pop_mode:!0}),Nu=N({name:"UNCLOSED_JSON_OBJECT_LITERAL",pattern:/{[^]*/,line_breaks:!0,pop_mode:!0}),Ae=t((e,r)=>N({name:e,pattern:r,longer_alt:ce,categories:Hr}),"keyword"),bu=Ae("USECASE",/usecase-beta/),$i=Ae("ACTOR",/actor/),Cu=Ae("SYSTEM_BOUNDARY",/systemBoundary/),vu=Ae("END",/end/),ku=Ae("DIRECTION",/direction/),_u=Ae("TD",/TD/),Mu=Ae("TB",/TB/),wu=Ae("BT",/BT/),Pu=Ae("LR",/LR/),Uu=Ae("RL",/RL/),Du=Ae("NOTE",/note/),Fu=Ae("FOR",/for/),kA=Ae("JSON",/json/),Bu=Ae("CLASS_DEF",/classDef/),$u=Ae("CLASS",/class/),Gu=Ae("STYLE",/style/),Wu=Ae("INCLUDE",/include/i),ju=Ae("EXTEND",/extend/i),Ku=Ae("TRUE",/true/),zu=Ae("FALSE",/false/),Vu=N({name:"GENERALIZATION",pattern:/--\|>/}),Hu=N({name:"DEPENDENCY_ARROW",pattern:/\.\.>/}),Yu=N({name:"STEREOTYPE_START",pattern:/<</,push_mode:"stereotype"}),Yi=N({name:"STEREOTYPE_END",pattern:/>>/,pop_mode:!0}),Xi=N({name:"STEREOTYPE_TEXT",pattern:IA,line_breaks:!1}),Xu=N({name:"UNCLOSED_STEREOTYPE_TEXT",pattern:/[^\n\r]+/,line_breaks:!1,pop_mode:!0}),qu=N({name:"CLASS_SEPARATOR",pattern:/:::/}),Gn=N({name:"FORWARD_SOLID",pattern:/--+>/}),Ju=N({name:"BACKWARD_SOLID",pattern:/<--+/}),Wn=N({name:"FORWARD_CIRCLE",pattern:/--o/}),Zu=N({name:"BACKWARD_CIRCLE",pattern:/o--/}),jn=N({name:"FORWARD_CROSS",pattern:/--x/}),Qu=N({name:"BACKWARD_CROSS",pattern:/x--/}),Ze=N({name:"MARKERLESS_SOLID",pattern:/--+/}),Gi=N({name:"METADATA_START",pattern:/@{/}),Kn=N({name:"AT",pattern:/@/,categories:Ie}),ef=N({name:"LBRACE",pattern:/{/}),Wi=N({name:"RBRACE",pattern:/}/}),zn=N({name:"LBRACKET",pattern:/\[/}),Vn=N({name:"RBRACKET",pattern:/]/}),Ss=N({name:"LPAREN",pattern:/\(/}),Rs=N({name:"RPAREN",pattern:/\)/}),it=N({name:"COMMA",pattern:/,/,categories:Ie}),Os=N({name:"COLON",pattern:/:/,categories:Ie}),tf=N({name:"HASH_COLOR",pattern:/#[\dA-Fa-f]+/,categories:Ie}),Qe=N({name:"PLAIN_STRING",pattern:/"[^\n\r"]*"|'[^\n\r']*'/}),ji=N({name:"CSS_IDENTIFIER",pattern:/--[A-Z_a-z][\w-]*|[A-Z_a-z]\w*(?:-\w+)+/,categories:Ie}),rf=N({name:"CSS_ESCAPED_COMMA",pattern:/\\,/,categories:Ie}),sf=N({name:"DASH",pattern:/-/,categories:Ie}),nf=N({name:"DOT",pattern:/\./,categories:Ie}),of=N({name:"PERCENT",pattern:/%/,categories:Ie}),af=N({name:"CSS_PUNCTUATION",pattern:/[!#$&*+/=?^_|~]/,categories:Ie}),_A=N({name:"LABEL_PUNCTUATION",pattern:/[;<>\\`]/,categories:Ie}),MA=N({name:"LABEL_SYMBOL",pattern:/[^\t\n\r !-~]+/,categories:Ie}),lf=[Ie,Hr,NA,bt,bA,Bi,Nt,Ru,Ou,Lu,Iu,bu,$i,Cu,vu,ku,_u,Mu,wu,Pu,Uu,Du,Fu,kA,Bu,$u,Gu,Wu,ju,Ku,zu,Vu,Hu,Yu,qu,Gn,Ju,Wn,Zu,jn,Qu,Ze,Gi,Kn,ef,Wi,zn,Vn,Ss,Rs,it,Os,tf,Qe,ji,ce,Vi,rf,sf,nf,of,af,_A,MA],wA={defaultMode:"defaultMode",modes:{defaultMode:[...lf],jsonBody:[Hi,Nu],stereotype:[Yi,Xi,Xu]}},PA=[...lf,Hi,Nu,Yi,Xi,Xu],UA=new ie(wA),hu=t((e)=>fs(e,Ie)||e.tokenType===Qe||e.tokenType===bt,"isLabelToken"),DA={allowmixing:!0,newpage:!0,package:!0,rectangle:!0,skinparam:!0},FA=class extends $n{static{t(this,"UsecaseParser")}constructor(){super(PA,{nodeLocationTracking:"full"});this.RULE("start",()=>{this.CONSUME(bu),this.SUBRULE(this.lineEnd),this.MANY(()=>this.SUBRULE(this.line))}),this.RULE("line",()=>{this.OR([{ALT:t(()=>this.SUBRULE(this.blankLine),"ALT")},{ALT:t(()=>this.SUBRULE(this.commentLine),"ALT")},{GATE:t(()=>this.isStatementStart(),"GATE"),ALT:t(()=>this.SUBRULE(this.statement),"ALT")}])}),this.RULE("statement",()=>{this.OR([{ALT:t(()=>this.SUBRULE(this.accTitleStatement),"ALT")},{ALT:t(()=>this.SUBRULE(this.accDescrStatement),"ALT")},{ALT:t(()=>this.SUBRULE(this.directionStatement),"ALT")},{ALT:t(()=>this.SUBRULE(this.actorStatement),"ALT")},{ALT:t(()=>this.SUBRULE(this.systemBoundaryStatement),"ALT")},{ALT:t(()=>this.SUBRULE(this.noteStatement),"ALT")},{ALT:t(()=>this.SUBRULE(this.jsonStatement),"ALT")},{ALT:t(()=>this.SUBRULE(this.classDefStatement),"ALT")},{ALT:t(()=>this.SUBRULE(this.classStatement),"ALT")},{ALT:t(()=>this.SUBRULE(this.styleStatement),"ALT")},{GATE:t(()=>this.isMetadataAssignment(),"GATE"),ALT:t(()=>this.SUBRULE(this.metadataAssignmentStatement),"ALT")},{GATE:t(()=>!this.isForbiddenPlantUmlStatement(),"GATE"),ALT:t(()=>this.SUBRULE(this.entityStatement),"ALT")}])}),this.RULE("lineEnd",()=>{this.OR([{ALT:t(()=>this.CONSUME(Nt),"ALT")},{ALT:t(()=>this.CONSUME(Ve),"ALT")}])}),this.RULE("blankLine",()=>{this.CONSUME(Nt)}),this.RULE("commentLine",()=>{this.CONSUME(Bi),this.SUBRULE(this.lineEnd)}),this.RULE("accTitleStatement",()=>{this.CONSUME(Ou),this.SUBRULE(this.lineEnd)}),this.RULE("accDescrStatement",()=>{this.OR([{ALT:t(()=>this.CONSUME(Lu),"ALT")},{ALT:t(()=>this.CONSUME(Ru),"ALT")}]),this.SUBRULE(this.lineEnd)}),this.RULE("actorStatement",()=>{this.CONSUME($i),this.SUBRULE(this.actorItem),this.OPTION(()=>{this.OR([{ALT:t(()=>this.AT_LEAST_ONE(()=>{this.CONSUME(it),this.SUBRULE2(this.actorItem)}),"ALT")},{ALT:t(()=>this.SUBRULE(this.relationTail),"ALT")}])}),this.SUBRULE(this.lineEnd)}),this.RULE("actorItem",()=>{this.SUBRULE(this.actorName),this.OPTION(()=>this.SUBRULE(this.metadata)),this.OPTION2(()=>this.SUBRULE(this.stereotype)),this.OPTION3(()=>this.SUBRULE(this.classSuffix))}),this.RULE("actorName",()=>{this.OR([{ALT:t(()=>{this.CONSUME(ce),this.OPTION(()=>{this.CONSUME(Ss),this.SUBRULE(this.nodeLabel),this.CONSUME(Rs)})},"ALT")},{ALT:t(()=>this.CONSUME(Qe),"ALT")},{ALT:t(()=>this.CONSUME(bt),"ALT")}])}),this.RULE("actorDeclarationOnly",()=>{this.CONSUME($i),this.SUBRULE(this.actorItem),this.MANY(()=>{this.CONSUME(it),this.SUBRULE2(this.actorItem)}),this.SUBRULE(this.lineEnd)}),this.RULE("entityStatement",()=>{this.SUBRULE(this.entityName),this.OPTION(()=>this.SUBRULE(this.relationTail)),this.SUBRULE(this.lineEnd)}),this.RULE("entityName",()=>{this.OR([{ALT:t(()=>{this.CONSUME(ce),this.OPTION(()=>{this.OR2([{ALT:t(()=>{this.CONSUME(Ss),this.SUBRULE(this.nodeLabel),this.CONSUME(Rs)},"ALT")},{ALT:t(()=>{this.CONSUME(zn),this.SUBRULE2(this.nodeLabel),this.CONSUME(Vn)},"ALT")}])})},"ALT")},{ALT:t(()=>this.CONSUME(Qe),"ALT")},{ALT:t(()=>this.CONSUME(bt),"ALT")}]),this.OPTION2(()=>this.SUBRULE(this.useCaseMetadata)),this.OPTION3(()=>this.SUBRULE(this.stereotype)),this.OPTION4(()=>this.SUBRULE(this.classSuffix))}),this.RULE("nodeLabel",()=>{this.OR([{ALT:t(()=>this.CONSUME(Qe),"ALT")},{ALT:t(()=>this.CONSUME(bt),"ALT")},{ALT:t(()=>this.AT_LEAST_ONE(()=>this.CONSUME(Ie)),"ALT")}])}),this.RULE("useCaseMetadata",()=>{this.SUBRULE(this.metadata)}),this.RULE("relationTail",()=>{this.OPTION({GATE:t(()=>this.LA(1).tokenType===ce&&this.LA(2).tokenType===Kn,"GATE"),DEF:t(()=>{this.CONSUME(ce),this.CONSUME(Kn)},"DEF")}),this.SUBRULE(this.arrow),this.SUBRULE(this.entityName)}),this.RULE("arrow",()=>{this.OR([{ALT:t(()=>this.SUBRULE(this.semanticRelation),"ALT")},{ALT:t(()=>this.SUBRULE(this.forwardSolidOperator),"ALT")},{ALT:t(()=>this.SUBRULE(this.backwardSolidOperator),"ALT")},{ALT:t(()=>this.SUBRULE(this.markerlessSolidOperator),"ALT")},{ALT:t(()=>this.SUBRULE(this.forwardCircleOperator),"ALT")},{ALT:t(()=>this.SUBRULE(this.backwardCircleOperator),"ALT")},{ALT:t(()=>this.SUBRULE(this.forwardCrossOperator),"ALT")},{ALT:t(()=>this.SUBRULE(this.backwardCrossOperator),"ALT")}])}),this.RULE("forwardSolidOperator",()=>{this.CONSUME(Gn)}),this.RULE("backwardSolidOperator",()=>{this.CONSUME(Ju),this.OPTION({GATE:t(()=>this.LA(0).image==="<--"&&this.hasLabeledRight([Ze]),"GATE"),DEF:t(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(Ze)},"DEF")})}),this.RULE("markerlessSolidOperator",()=>{this.CONSUME(Ze),this.OPTION({GATE:t(()=>this.LA(0).image==="--"&&this.hasLabeledRight([Gn,Ze,Wn,jn]),"GATE"),DEF:t(()=>{this.SUBRULE(this.edgeLabel),this.OR([{ALT:t(()=>this.CONSUME(Gn),"ALT")},{ALT:t(()=>this.CONSUME2(Ze),"ALT")},{ALT:t(()=>this.CONSUME(Wn),"ALT")},{ALT:t(()=>this.CONSUME(jn),"ALT")}])},"DEF")})}),this.RULE("forwardCircleOperator",()=>{this.CONSUME(Wn)}),this.RULE("backwardCircleOperator",()=>{this.CONSUME(Zu),this.OPTION({GATE:t(()=>this.hasLabeledRight([Ze]),"GATE"),DEF:t(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(Ze)},"DEF")})}),this.RULE("forwardCrossOperator",()=>{this.CONSUME(jn)}),this.RULE("backwardCrossOperator",()=>{this.CONSUME(Qu),this.OPTION({GATE:t(()=>this.hasLabeledRight([Ze]),"GATE"),DEF:t(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(Ze)},"DEF")})}),this.RULE("edgeLabel",()=>{this.OR([{ALT:t(()=>this.CONSUME(Qe),"ALT")},{ALT:t(()=>this.CONSUME(bt),"ALT")},{ALT:t(()=>this.AT_LEAST_ONE(()=>this.CONSUME(Ie)),"ALT")}])}),this.RULE("semanticRelation",()=>{this.OR([{ALT:t(()=>{this.CONSUME(Hu),this.CONSUME(Os),this.OR2([{ALT:t(()=>this.CONSUME(Wu),"ALT")},{ALT:t(()=>this.CONSUME(ju),"ALT")}])},"ALT")},{ALT:t(()=>this.CONSUME(Vu),"ALT")}])}),this.RULE("metadata",()=>{this.CONSUME(Gi),this.MANY(()=>this.CONSUME(Nt)),this.OPTION(()=>{this.SUBRULE(this.metadataProperty),this.MANY2(()=>{this.SUBRULE(this.metadataSeparator),this.SUBRULE2(this.metadataProperty)}),this.OPTION2(()=>this.CONSUME(it)),this.MANY3(()=>this.CONSUME2(Nt))}),this.CONSUME(Wi)}),this.RULE("metadataProperty",()=>{this.OR([{ALT:t(()=>this.CONSUME(ce),"ALT")},{ALT:t(()=>this.CONSUME(Qe),"ALT")}]),this.CONSUME(Os),this.OR2([{ALT:t(()=>this.CONSUME2(ce),"ALT")},{ALT:t(()=>this.CONSUME2(Qe),"ALT")},{ALT:t(()=>this.CONSUME(Ku),"ALT")},{ALT:t(()=>this.CONSUME(zu),"ALT")}])}),this.RULE("metadataSeparator",()=>{this.OR([{ALT:t(()=>{this.CONSUME(it),this.MANY(()=>this.CONSUME(Nt))},"ALT")},{ALT:t(()=>{this.AT_LEAST_ONE(()=>this.CONSUME2(Nt)),this.OPTION(()=>this.CONSUME2(it)),this.MANY2(()=>this.CONSUME3(Nt))},"ALT")}])}),this.RULE("systemBoundaryStatement",()=>{this.CONSUME(Cu),this.SUBRULE(this.systemBoundaryName),this.OPTION(()=>this.SUBRULE(this.metadata)),this.OPTION2(()=>this.SUBRULE(this.classSuffix)),this.SUBRULE(this.lineEnd),this.SUBRULE(this.systemBoundaryContent),this.CONSUME(vu),this.SUBRULE2(this.lineEnd)}),this.RULE("systemBoundaryName",()=>{this.OR([{ALT:t(()=>{this.CONSUME(ce),this.OPTION(()=>{this.OR2([{ALT:t(()=>{this.CONSUME(Ss),this.SUBRULE(this.nodeLabel),this.CONSUME(Rs)},"ALT")},{ALT:t(()=>{this.CONSUME(zn),this.SUBRULE2(this.nodeLabel),this.CONSUME(Vn)},"ALT")}])})},"ALT")},{ALT:t(()=>this.CONSUME(Qe),"ALT")},{ALT:t(()=>this.CONSUME(bt),"ALT")}])}),this.RULE("systemBoundaryContent",()=>{this.MANY(()=>{this.OR([{ALT:t(()=>this.SUBRULE(this.blankLine),"ALT")},{ALT:t(()=>this.SUBRULE(this.commentLine),"ALT")},{ALT:t(()=>this.SUBRULE(this.boundaryElement),"ALT")}])})}),this.RULE("boundaryElement",()=>{this.OR([{ALT:t(()=>this.SUBRULE(this.actorDeclarationOnly),"ALT")},{ALT:t(()=>{this.SUBRULE(this.entityName),this.SUBRULE(this.lineEnd)},"ALT")}])}),this.RULE("metadataAssignmentStatement",()=>{this.SUBRULE(this.metadataAssignmentTarget),this.SUBRULE(this.metadata),this.SUBRULE(this.lineEnd)}),this.RULE("metadataAssignmentTarget",()=>{this.OR([{ALT:t(()=>this.CONSUME(ce),"ALT")},{ALT:t(()=>this.CONSUME(Qe),"ALT")},{ALT:t(()=>this.CONSUME(bt),"ALT")}])}),this.RULE("noteStatement",()=>{this.CONSUME(Du),this.CONSUME(Fu),this.CONSUME(ce),this.SUBRULE(this.nodeLabel),this.SUBRULE(this.lineEnd)}),this.RULE("stereotype",()=>{this.CONSUME(Yu),this.CONSUME(Xi),this.CONSUME(Yi)}),this.RULE("classSuffix",()=>{this.CONSUME(qu),this.CONSUME(ce),this.MANY(()=>{this.CONSUME(it),this.CONSUME2(ce)})}),this.RULE("jsonStatement",()=>{this.CONSUME(Iu),this.CONSUME(Hi),this.OPTION(()=>this.SUBRULE(this.classSuffix)),this.SUBRULE(this.lineEnd)}),this.RULE("directionStatement",()=>{this.CONSUME(ku),this.OR([{ALT:t(()=>this.CONSUME(_u),"ALT")},{ALT:t(()=>this.CONSUME(Mu),"ALT")},{ALT:t(()=>this.CONSUME(wu),"ALT")},{ALT:t(()=>this.CONSUME(Pu),"ALT")},{ALT:t(()=>this.CONSUME(Uu),"ALT")}]),this.SUBRULE(this.lineEnd)}),this.RULE("classDefStatement",()=>{this.CONSUME(Bu),this.CONSUME(ce),this.MANY(()=>{this.CONSUME(it),this.CONSUME2(ce)}),this.SUBRULE(this.styles),this.SUBRULE(this.lineEnd)}),this.RULE("classStatement",()=>{this.CONSUME($u),this.CONSUME(ce),this.MANY(()=>{this.CONSUME(it),this.CONSUME2(ce)}),this.CONSUME3(ce),this.MANY2(()=>{this.CONSUME2(it),this.CONSUME4(ce)}),this.SUBRULE(this.lineEnd)}),this.RULE("styleStatement",()=>{this.CONSUME(Gu),this.CONSUME(ce),this.SUBRULE(this.styles),this.SUBRULE(this.lineEnd)}),this.RULE("styles",()=>{this.SUBRULE(this.styleValue),this.MANY(()=>{this.CONSUME(it),this.SUBRULE2(this.styleValue)})}),this.RULE("styleValue",()=>{this.OR([{ALT:t(()=>this.CONSUME(Hr),"ALT")},{ALT:t(()=>this.CONSUME(ji),"ALT")},{ALT:t(()=>{this.CONSUME(Ze),this.CONSUME2(Hr)},"ALT")}]),this.CONSUME(Os),this.AT_LEAST_ONE(()=>this.SUBRULE(this.styleComponent))}),this.RULE("styleComponent",()=>{this.OR([{ALT:t(()=>this.CONSUME(Hr),"ALT")},{ALT:t(()=>this.CONSUME(Qe),"ALT")},{ALT:t(()=>this.CONSUME(Vi),"ALT")},{ALT:t(()=>this.CONSUME(tf),"ALT")},{ALT:t(()=>this.CONSUME(ji),"ALT")},{ALT:t(()=>this.CONSUME(rf),"ALT")},{ALT:t(()=>this.CONSUME(sf),"ALT")},{ALT:t(()=>this.CONSUME(nf),"ALT")},{ALT:t(()=>this.CONSUME(of),"ALT")},{ALT:t(()=>this.CONSUME(af),"ALT")},{ALT:t(()=>this.CONSUME(Os),"ALT")},{ALT:t(()=>this.CONSUME(Ss),"ALT")},{ALT:t(()=>this.CONSUME(Rs),"ALT")},{ALT:t(()=>this.CONSUME(zn),"ALT")},{ALT:t(()=>this.CONSUME(Vn),"ALT")},{ALT:t(()=>this.CONSUME(ef),"ALT")},{ALT:t(()=>this.CONSUME(Wi),"ALT")},{ALT:t(()=>this.CONSUME(Kn),"ALT")},{ALT:t(()=>this.CONSUME(Ze),"ALT")}])}),this.performSelfAnalysis()}isMetadataAssignment(){let e=this.LA(1).tokenType;return(e===ce||e===Qe||e===bt)&&this.LA(2).tokenType===Gi}isStatementStart(){let e=this.LA(1).tokenType;return e!==Ve&&e!==Nt&&e!==Bi}isForbiddenPlantUmlStatement(){return this.LA(1).tokenType===ce&&DA[this.LA(1).image.toLowerCase()]===!0}hasLabeledRight(e){if(!hu(this.LA(1)))return!1;for(let r=2;;r++){let s=this.LA(r);if(e.includes(s.tokenType))return!0;if(!hu(s))return!1}}},Ls=new FA,du=class extends Error{constructor(e,r,s){super(`${e} (line ${r}, column ${s})`);this.line=r,this.column=s,this.name="UsecaseJsonError"}static{t(this,"UsecaseJsonError")}},Ki=t((e,r,s,n)=>{let i=s,o=n,c=Math.min(Math.max(r,0),e.length);for(let u=0;u<c;u++){let a=e[u];if(a==="\r")i++,o=1;else if(a===`
|
|
113
|
+
`||n==="\r")return!0;if(n!==" "&&n!=="\t")return!1}return!0},"isIndentedLineStart"),Su=t((e,r,s)=>{if(!xu(e,r))return null;let n=s.exec(e.slice(r));return n?fr(e,r,n[0]):null},"matchAccessibilityLine"),OA=t((e,r)=>{if(!xu(e,r))return null;let s=/^accDescr[\t ]*{/.exec(e.slice(r));if(!s)return null;let n=e.indexOf("}",r+s[0].length);return n===-1?null:fr(e,r,e.slice(r,n+1))},"matchAccDescrBlock"),LA=t((e,r)=>{if(e[r]!=="{")return null;let s=0,n=!1,i=!1;for(let o=r;o<e.length;o++){let c=e[o];if(n){if(i)i=!1;else if(c==="\\")i=!0;else if(c==='"')n=!1;continue}if(c==='"')n=!0;else if(c==="{")s++;else if(c==="}"&&--s===0)return fr(e,r,e.slice(r,o+1))}return null},"matchJsonObject"),IA=t((e,r)=>{let s=e.indexOf(">>",r);if(s===-1||/[\n\r]/.test(e.slice(r,s)))return null;let n=e.slice(r,s);return n.trim()?fr(e,r,n):null},"matchStereotypeText"),Ie=L({name:"LABEL_TEXT",pattern:ie.NA}),Hr=L({name:"WORD",pattern:ie.NA,categories:Ie}),Vi=L({name:"NUMBER",pattern:/(?:\d+\.\d+|\d+|\.\d+)(?:[A-Za-z]+)?/,categories:Ie}),ce=L({name:"IDENTIFIER",pattern:/\w+/,longer_alt:Vi,categories:Hr}),NA=L({name:"HWS",pattern:/[\t ]+/,group:ie.SKIPPED}),bt=L({name:"MARKDOWN_STRING",pattern:SA,start_chars_hint:['"'],line_breaks:!0}),bA=L({name:"UNCLOSED_MARKDOWN_STRING",pattern:/"`[^]*/,line_breaks:!0}),Bi=L({name:"COMMENT",pattern:RA,start_chars_hint:["%"],line_breaks:!1}),Nt=L({name:"NEWLINE",pattern:/\r\n|\n|\r/,line_breaks:!0}),Ru=L({name:"ACC_DESCR_BLOCK",pattern:OA,start_chars_hint:["a"],line_breaks:!0}),CA=/^accTitle[\t ]*:[^\n\r]*/,vA=/^accDescr[\t ]*:[^\n\r]*/,Ou=L({name:"ACC_TITLE_LINE",pattern:t((e,r)=>Su(e,r,CA),"pattern"),start_chars_hint:["a"],line_breaks:!1}),Lu=L({name:"ACC_DESCR_LINE",pattern:t((e,r)=>Su(e,r,vA),"pattern"),start_chars_hint:["a"],line_breaks:!1}),Iu=L({name:"JSON_DECLARATION_START",pattern:/json[\t ]+\w+[\t ]*@[\t ]*(?={)/,push_mode:"jsonBody"}),Hi=L({name:"JSON_OBJECT_LITERAL",pattern:LA,start_chars_hint:["{"],line_breaks:!0,pop_mode:!0}),Nu=L({name:"UNCLOSED_JSON_OBJECT_LITERAL",pattern:/{[^]*/,line_breaks:!0,pop_mode:!0}),Ae=t((e,r)=>L({name:e,pattern:r,longer_alt:ce,categories:Hr}),"keyword"),bu=Ae("USECASE",/usecase-beta/),$i=Ae("ACTOR",/actor/),Cu=Ae("SYSTEM_BOUNDARY",/systemBoundary/),vu=Ae("END",/end/),ku=Ae("DIRECTION",/direction/),_u=Ae("TD",/TD/),Mu=Ae("TB",/TB/),wu=Ae("BT",/BT/),Pu=Ae("LR",/LR/),Uu=Ae("RL",/RL/),Du=Ae("NOTE",/note/),Fu=Ae("FOR",/for/),kA=Ae("JSON",/json/),Bu=Ae("CLASS_DEF",/classDef/),$u=Ae("CLASS",/class/),Gu=Ae("STYLE",/style/),Wu=Ae("INCLUDE",/include/i),ju=Ae("EXTEND",/extend/i),Ku=Ae("TRUE",/true/),zu=Ae("FALSE",/false/),Vu=L({name:"GENERALIZATION",pattern:/--\|>/}),Hu=L({name:"DEPENDENCY_ARROW",pattern:/\.\.>/}),Yu=L({name:"STEREOTYPE_START",pattern:/<</,push_mode:"stereotype"}),Yi=L({name:"STEREOTYPE_END",pattern:/>>/,pop_mode:!0}),Xi=L({name:"STEREOTYPE_TEXT",pattern:IA,line_breaks:!1}),Xu=L({name:"UNCLOSED_STEREOTYPE_TEXT",pattern:/[^\n\r]+/,line_breaks:!1,pop_mode:!0}),qu=L({name:"CLASS_SEPARATOR",pattern:/:::/}),Gn=L({name:"FORWARD_SOLID",pattern:/--+>/}),Ju=L({name:"BACKWARD_SOLID",pattern:/<--+/}),Wn=L({name:"FORWARD_CIRCLE",pattern:/--o/}),Zu=L({name:"BACKWARD_CIRCLE",pattern:/o--/}),jn=L({name:"FORWARD_CROSS",pattern:/--x/}),Qu=L({name:"BACKWARD_CROSS",pattern:/x--/}),Ze=L({name:"MARKERLESS_SOLID",pattern:/--+/}),Gi=L({name:"METADATA_START",pattern:/@{/}),Kn=L({name:"AT",pattern:/@/,categories:Ie}),ef=L({name:"LBRACE",pattern:/{/}),Wi=L({name:"RBRACE",pattern:/}/}),zn=L({name:"LBRACKET",pattern:/\[/}),Vn=L({name:"RBRACKET",pattern:/]/}),Ss=L({name:"LPAREN",pattern:/\(/}),Rs=L({name:"RPAREN",pattern:/\)/}),it=L({name:"COMMA",pattern:/,/,categories:Ie}),Os=L({name:"COLON",pattern:/:/,categories:Ie}),tf=L({name:"HASH_COLOR",pattern:/#[\dA-Fa-f]+/,categories:Ie}),Qe=L({name:"PLAIN_STRING",pattern:/"[^\n\r"]*"|'[^\n\r']*'/}),ji=L({name:"CSS_IDENTIFIER",pattern:/--[A-Z_a-z][\w-]*|[A-Z_a-z]\w*(?:-\w+)+/,categories:Ie}),rf=L({name:"CSS_ESCAPED_COMMA",pattern:/\\,/,categories:Ie}),sf=L({name:"DASH",pattern:/-/,categories:Ie}),nf=L({name:"DOT",pattern:/\./,categories:Ie}),of=L({name:"PERCENT",pattern:/%/,categories:Ie}),af=L({name:"CSS_PUNCTUATION",pattern:/[!#$&*+/=?^_|~]/,categories:Ie}),_A=L({name:"LABEL_PUNCTUATION",pattern:/[;<>\\`]/,categories:Ie}),MA=L({name:"LABEL_SYMBOL",pattern:/[^\t\n\r !-~]+/,categories:Ie}),lf=[Ie,Hr,NA,bt,bA,Bi,Nt,Ru,Ou,Lu,Iu,bu,$i,Cu,vu,ku,_u,Mu,wu,Pu,Uu,Du,Fu,kA,Bu,$u,Gu,Wu,ju,Ku,zu,Vu,Hu,Yu,qu,Gn,Ju,Wn,Zu,jn,Qu,Ze,Gi,Kn,ef,Wi,zn,Vn,Ss,Rs,it,Os,tf,Qe,ji,ce,Vi,rf,sf,nf,of,af,_A,MA],wA={defaultMode:"defaultMode",modes:{defaultMode:[...lf],jsonBody:[Hi,Nu],stereotype:[Yi,Xi,Xu]}},PA=[...lf,Hi,Nu,Yi,Xi,Xu],UA=new ie(wA),hu=t((e)=>fs(e,Ie)||e.tokenType===Qe||e.tokenType===bt,"isLabelToken"),DA={allowmixing:!0,newpage:!0,package:!0,rectangle:!0,skinparam:!0},FA=class extends $n{static{t(this,"UsecaseParser")}constructor(){super(PA,{nodeLocationTracking:"full"});this.RULE("start",()=>{this.CONSUME(bu),this.SUBRULE(this.lineEnd),this.MANY(()=>this.SUBRULE(this.line))}),this.RULE("line",()=>{this.OR([{ALT:t(()=>this.SUBRULE(this.blankLine),"ALT")},{ALT:t(()=>this.SUBRULE(this.commentLine),"ALT")},{GATE:t(()=>this.isStatementStart(),"GATE"),ALT:t(()=>this.SUBRULE(this.statement),"ALT")}])}),this.RULE("statement",()=>{this.OR([{ALT:t(()=>this.SUBRULE(this.accTitleStatement),"ALT")},{ALT:t(()=>this.SUBRULE(this.accDescrStatement),"ALT")},{ALT:t(()=>this.SUBRULE(this.directionStatement),"ALT")},{ALT:t(()=>this.SUBRULE(this.actorStatement),"ALT")},{ALT:t(()=>this.SUBRULE(this.systemBoundaryStatement),"ALT")},{ALT:t(()=>this.SUBRULE(this.noteStatement),"ALT")},{ALT:t(()=>this.SUBRULE(this.jsonStatement),"ALT")},{ALT:t(()=>this.SUBRULE(this.classDefStatement),"ALT")},{ALT:t(()=>this.SUBRULE(this.classStatement),"ALT")},{ALT:t(()=>this.SUBRULE(this.styleStatement),"ALT")},{GATE:t(()=>this.isMetadataAssignment(),"GATE"),ALT:t(()=>this.SUBRULE(this.metadataAssignmentStatement),"ALT")},{GATE:t(()=>!this.isForbiddenPlantUmlStatement(),"GATE"),ALT:t(()=>this.SUBRULE(this.entityStatement),"ALT")}])}),this.RULE("lineEnd",()=>{this.OR([{ALT:t(()=>this.CONSUME(Nt),"ALT")},{ALT:t(()=>this.CONSUME(Ve),"ALT")}])}),this.RULE("blankLine",()=>{this.CONSUME(Nt)}),this.RULE("commentLine",()=>{this.CONSUME(Bi),this.SUBRULE(this.lineEnd)}),this.RULE("accTitleStatement",()=>{this.CONSUME(Ou),this.SUBRULE(this.lineEnd)}),this.RULE("accDescrStatement",()=>{this.OR([{ALT:t(()=>this.CONSUME(Lu),"ALT")},{ALT:t(()=>this.CONSUME(Ru),"ALT")}]),this.SUBRULE(this.lineEnd)}),this.RULE("actorStatement",()=>{this.CONSUME($i),this.SUBRULE(this.actorItem),this.OPTION(()=>{this.OR([{ALT:t(()=>this.AT_LEAST_ONE(()=>{this.CONSUME(it),this.SUBRULE2(this.actorItem)}),"ALT")},{ALT:t(()=>this.SUBRULE(this.relationTail),"ALT")}])}),this.SUBRULE(this.lineEnd)}),this.RULE("actorItem",()=>{this.SUBRULE(this.actorName),this.OPTION(()=>this.SUBRULE(this.metadata)),this.OPTION2(()=>this.SUBRULE(this.stereotype)),this.OPTION3(()=>this.SUBRULE(this.classSuffix))}),this.RULE("actorName",()=>{this.OR([{ALT:t(()=>{this.CONSUME(ce),this.OPTION(()=>{this.CONSUME(Ss),this.SUBRULE(this.nodeLabel),this.CONSUME(Rs)})},"ALT")},{ALT:t(()=>this.CONSUME(Qe),"ALT")},{ALT:t(()=>this.CONSUME(bt),"ALT")}])}),this.RULE("actorDeclarationOnly",()=>{this.CONSUME($i),this.SUBRULE(this.actorItem),this.MANY(()=>{this.CONSUME(it),this.SUBRULE2(this.actorItem)}),this.SUBRULE(this.lineEnd)}),this.RULE("entityStatement",()=>{this.SUBRULE(this.entityName),this.OPTION(()=>this.SUBRULE(this.relationTail)),this.SUBRULE(this.lineEnd)}),this.RULE("entityName",()=>{this.OR([{ALT:t(()=>{this.CONSUME(ce),this.OPTION(()=>{this.OR2([{ALT:t(()=>{this.CONSUME(Ss),this.SUBRULE(this.nodeLabel),this.CONSUME(Rs)},"ALT")},{ALT:t(()=>{this.CONSUME(zn),this.SUBRULE2(this.nodeLabel),this.CONSUME(Vn)},"ALT")}])})},"ALT")},{ALT:t(()=>this.CONSUME(Qe),"ALT")},{ALT:t(()=>this.CONSUME(bt),"ALT")}]),this.OPTION2(()=>this.SUBRULE(this.useCaseMetadata)),this.OPTION3(()=>this.SUBRULE(this.stereotype)),this.OPTION4(()=>this.SUBRULE(this.classSuffix))}),this.RULE("nodeLabel",()=>{this.OR([{ALT:t(()=>this.CONSUME(Qe),"ALT")},{ALT:t(()=>this.CONSUME(bt),"ALT")},{ALT:t(()=>this.AT_LEAST_ONE(()=>this.CONSUME(Ie)),"ALT")}])}),this.RULE("useCaseMetadata",()=>{this.SUBRULE(this.metadata)}),this.RULE("relationTail",()=>{this.OPTION({GATE:t(()=>this.LA(1).tokenType===ce&&this.LA(2).tokenType===Kn,"GATE"),DEF:t(()=>{this.CONSUME(ce),this.CONSUME(Kn)},"DEF")}),this.SUBRULE(this.arrow),this.SUBRULE(this.entityName)}),this.RULE("arrow",()=>{this.OR([{ALT:t(()=>this.SUBRULE(this.semanticRelation),"ALT")},{ALT:t(()=>this.SUBRULE(this.forwardSolidOperator),"ALT")},{ALT:t(()=>this.SUBRULE(this.backwardSolidOperator),"ALT")},{ALT:t(()=>this.SUBRULE(this.markerlessSolidOperator),"ALT")},{ALT:t(()=>this.SUBRULE(this.forwardCircleOperator),"ALT")},{ALT:t(()=>this.SUBRULE(this.backwardCircleOperator),"ALT")},{ALT:t(()=>this.SUBRULE(this.forwardCrossOperator),"ALT")},{ALT:t(()=>this.SUBRULE(this.backwardCrossOperator),"ALT")}])}),this.RULE("forwardSolidOperator",()=>{this.CONSUME(Gn)}),this.RULE("backwardSolidOperator",()=>{this.CONSUME(Ju),this.OPTION({GATE:t(()=>this.LA(0).image==="<--"&&this.hasLabeledRight([Ze]),"GATE"),DEF:t(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(Ze)},"DEF")})}),this.RULE("markerlessSolidOperator",()=>{this.CONSUME(Ze),this.OPTION({GATE:t(()=>this.LA(0).image==="--"&&this.hasLabeledRight([Gn,Ze,Wn,jn]),"GATE"),DEF:t(()=>{this.SUBRULE(this.edgeLabel),this.OR([{ALT:t(()=>this.CONSUME(Gn),"ALT")},{ALT:t(()=>this.CONSUME2(Ze),"ALT")},{ALT:t(()=>this.CONSUME(Wn),"ALT")},{ALT:t(()=>this.CONSUME(jn),"ALT")}])},"DEF")})}),this.RULE("forwardCircleOperator",()=>{this.CONSUME(Wn)}),this.RULE("backwardCircleOperator",()=>{this.CONSUME(Zu),this.OPTION({GATE:t(()=>this.hasLabeledRight([Ze]),"GATE"),DEF:t(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(Ze)},"DEF")})}),this.RULE("forwardCrossOperator",()=>{this.CONSUME(jn)}),this.RULE("backwardCrossOperator",()=>{this.CONSUME(Qu),this.OPTION({GATE:t(()=>this.hasLabeledRight([Ze]),"GATE"),DEF:t(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(Ze)},"DEF")})}),this.RULE("edgeLabel",()=>{this.OR([{ALT:t(()=>this.CONSUME(Qe),"ALT")},{ALT:t(()=>this.CONSUME(bt),"ALT")},{ALT:t(()=>this.AT_LEAST_ONE(()=>this.CONSUME(Ie)),"ALT")}])}),this.RULE("semanticRelation",()=>{this.OR([{ALT:t(()=>{this.CONSUME(Hu),this.CONSUME(Os),this.OR2([{ALT:t(()=>this.CONSUME(Wu),"ALT")},{ALT:t(()=>this.CONSUME(ju),"ALT")}])},"ALT")},{ALT:t(()=>this.CONSUME(Vu),"ALT")}])}),this.RULE("metadata",()=>{this.CONSUME(Gi),this.MANY(()=>this.CONSUME(Nt)),this.OPTION(()=>{this.SUBRULE(this.metadataProperty),this.MANY2(()=>{this.SUBRULE(this.metadataSeparator),this.SUBRULE2(this.metadataProperty)}),this.OPTION2(()=>this.CONSUME(it)),this.MANY3(()=>this.CONSUME2(Nt))}),this.CONSUME(Wi)}),this.RULE("metadataProperty",()=>{this.OR([{ALT:t(()=>this.CONSUME(ce),"ALT")},{ALT:t(()=>this.CONSUME(Qe),"ALT")}]),this.CONSUME(Os),this.OR2([{ALT:t(()=>this.CONSUME2(ce),"ALT")},{ALT:t(()=>this.CONSUME2(Qe),"ALT")},{ALT:t(()=>this.CONSUME(Ku),"ALT")},{ALT:t(()=>this.CONSUME(zu),"ALT")}])}),this.RULE("metadataSeparator",()=>{this.OR([{ALT:t(()=>{this.CONSUME(it),this.MANY(()=>this.CONSUME(Nt))},"ALT")},{ALT:t(()=>{this.AT_LEAST_ONE(()=>this.CONSUME2(Nt)),this.OPTION(()=>this.CONSUME2(it)),this.MANY2(()=>this.CONSUME3(Nt))},"ALT")}])}),this.RULE("systemBoundaryStatement",()=>{this.CONSUME(Cu),this.SUBRULE(this.systemBoundaryName),this.OPTION(()=>this.SUBRULE(this.metadata)),this.OPTION2(()=>this.SUBRULE(this.classSuffix)),this.SUBRULE(this.lineEnd),this.SUBRULE(this.systemBoundaryContent),this.CONSUME(vu),this.SUBRULE2(this.lineEnd)}),this.RULE("systemBoundaryName",()=>{this.OR([{ALT:t(()=>{this.CONSUME(ce),this.OPTION(()=>{this.OR2([{ALT:t(()=>{this.CONSUME(Ss),this.SUBRULE(this.nodeLabel),this.CONSUME(Rs)},"ALT")},{ALT:t(()=>{this.CONSUME(zn),this.SUBRULE2(this.nodeLabel),this.CONSUME(Vn)},"ALT")}])})},"ALT")},{ALT:t(()=>this.CONSUME(Qe),"ALT")},{ALT:t(()=>this.CONSUME(bt),"ALT")}])}),this.RULE("systemBoundaryContent",()=>{this.MANY(()=>{this.OR([{ALT:t(()=>this.SUBRULE(this.blankLine),"ALT")},{ALT:t(()=>this.SUBRULE(this.commentLine),"ALT")},{ALT:t(()=>this.SUBRULE(this.boundaryElement),"ALT")}])})}),this.RULE("boundaryElement",()=>{this.OR([{ALT:t(()=>this.SUBRULE(this.actorDeclarationOnly),"ALT")},{ALT:t(()=>{this.SUBRULE(this.entityName),this.SUBRULE(this.lineEnd)},"ALT")}])}),this.RULE("metadataAssignmentStatement",()=>{this.SUBRULE(this.metadataAssignmentTarget),this.SUBRULE(this.metadata),this.SUBRULE(this.lineEnd)}),this.RULE("metadataAssignmentTarget",()=>{this.OR([{ALT:t(()=>this.CONSUME(ce),"ALT")},{ALT:t(()=>this.CONSUME(Qe),"ALT")},{ALT:t(()=>this.CONSUME(bt),"ALT")}])}),this.RULE("noteStatement",()=>{this.CONSUME(Du),this.CONSUME(Fu),this.CONSUME(ce),this.SUBRULE(this.nodeLabel),this.SUBRULE(this.lineEnd)}),this.RULE("stereotype",()=>{this.CONSUME(Yu),this.CONSUME(Xi),this.CONSUME(Yi)}),this.RULE("classSuffix",()=>{this.CONSUME(qu),this.CONSUME(ce),this.MANY(()=>{this.CONSUME(it),this.CONSUME2(ce)})}),this.RULE("jsonStatement",()=>{this.CONSUME(Iu),this.CONSUME(Hi),this.OPTION(()=>this.SUBRULE(this.classSuffix)),this.SUBRULE(this.lineEnd)}),this.RULE("directionStatement",()=>{this.CONSUME(ku),this.OR([{ALT:t(()=>this.CONSUME(_u),"ALT")},{ALT:t(()=>this.CONSUME(Mu),"ALT")},{ALT:t(()=>this.CONSUME(wu),"ALT")},{ALT:t(()=>this.CONSUME(Pu),"ALT")},{ALT:t(()=>this.CONSUME(Uu),"ALT")}]),this.SUBRULE(this.lineEnd)}),this.RULE("classDefStatement",()=>{this.CONSUME(Bu),this.CONSUME(ce),this.MANY(()=>{this.CONSUME(it),this.CONSUME2(ce)}),this.SUBRULE(this.styles),this.SUBRULE(this.lineEnd)}),this.RULE("classStatement",()=>{this.CONSUME($u),this.CONSUME(ce),this.MANY(()=>{this.CONSUME(it),this.CONSUME2(ce)}),this.CONSUME3(ce),this.MANY2(()=>{this.CONSUME2(it),this.CONSUME4(ce)}),this.SUBRULE(this.lineEnd)}),this.RULE("styleStatement",()=>{this.CONSUME(Gu),this.CONSUME(ce),this.SUBRULE(this.styles),this.SUBRULE(this.lineEnd)}),this.RULE("styles",()=>{this.SUBRULE(this.styleValue),this.MANY(()=>{this.CONSUME(it),this.SUBRULE2(this.styleValue)})}),this.RULE("styleValue",()=>{this.OR([{ALT:t(()=>this.CONSUME(Hr),"ALT")},{ALT:t(()=>this.CONSUME(ji),"ALT")},{ALT:t(()=>{this.CONSUME(Ze),this.CONSUME2(Hr)},"ALT")}]),this.CONSUME(Os),this.AT_LEAST_ONE(()=>this.SUBRULE(this.styleComponent))}),this.RULE("styleComponent",()=>{this.OR([{ALT:t(()=>this.CONSUME(Hr),"ALT")},{ALT:t(()=>this.CONSUME(Qe),"ALT")},{ALT:t(()=>this.CONSUME(Vi),"ALT")},{ALT:t(()=>this.CONSUME(tf),"ALT")},{ALT:t(()=>this.CONSUME(ji),"ALT")},{ALT:t(()=>this.CONSUME(rf),"ALT")},{ALT:t(()=>this.CONSUME(sf),"ALT")},{ALT:t(()=>this.CONSUME(nf),"ALT")},{ALT:t(()=>this.CONSUME(of),"ALT")},{ALT:t(()=>this.CONSUME(af),"ALT")},{ALT:t(()=>this.CONSUME(Os),"ALT")},{ALT:t(()=>this.CONSUME(Ss),"ALT")},{ALT:t(()=>this.CONSUME(Rs),"ALT")},{ALT:t(()=>this.CONSUME(zn),"ALT")},{ALT:t(()=>this.CONSUME(Vn),"ALT")},{ALT:t(()=>this.CONSUME(ef),"ALT")},{ALT:t(()=>this.CONSUME(Wi),"ALT")},{ALT:t(()=>this.CONSUME(Kn),"ALT")},{ALT:t(()=>this.CONSUME(Ze),"ALT")}])}),this.performSelfAnalysis()}isMetadataAssignment(){let e=this.LA(1).tokenType;return(e===ce||e===Qe||e===bt)&&this.LA(2).tokenType===Gi}isStatementStart(){let e=this.LA(1).tokenType;return e!==Ve&&e!==Nt&&e!==Bi}isForbiddenPlantUmlStatement(){return this.LA(1).tokenType===ce&&DA[this.LA(1).image.toLowerCase()]===!0}hasLabeledRight(e){if(!hu(this.LA(1)))return!1;for(let r=2;;r++){let s=this.LA(r);if(e.includes(s.tokenType))return!0;if(!hu(s))return!1}}},Ls=new FA,du=class extends Error{constructor(e,r,s){super(`${e} (line ${r}, column ${s})`);this.line=r,this.column=s,this.name="UsecaseJsonError"}static{t(this,"UsecaseJsonError")}},Ki=t((e,r,s,n)=>{let i=s,o=n,c=Math.min(Math.max(r,0),e.length);for(let u=0;u<c;u++){let a=e[u];if(a==="\r")i++,o=1;else if(a===`
|
|
114
114
|
`){if(u===0||e[u-1]!=="\r")i++,o=1}else o++}return{line:i,column:o}},"locationAtOffset"),BA=t((e,r,s,n)=>{let i=/\bposition (\d+)\b/u.exec(e);if(i)return Ki(r,Number.parseInt(i[1],10),s,n);let o=/\bline (\d+) column (\d+)\b/u.exec(e);if(o){let c=Number.parseInt(o[1],10),u=Number.parseInt(o[2],10);return{line:s+c-1,column:c===1?n+u-1:u}}if(/unexpected end|end of json input/iu.test(e))return Ki(r,r.length,s,n);return},"locationFromErrorMessage"),be=class extends Error{constructor(e){super("Invalid JSON token");this.offset=e}static{t(this,"JsonWalkError")}},pu=class{constructor(e){this.text=e,this.offset=0,this.propertyOrder={}}static{t(this,"PropertyOrderCollector")}collect(){if(this.skipWhitespace(),this.collectValue(""),this.skipWhitespace(),this.offset!==this.text.length)throw new be(this.offset);return this.propertyOrder}collectValue(e){this.skipWhitespace();let r=this.text[this.offset];if(r==="{")this.collectObject(e);else if(r==="[")this.collectArray(e);else if(r==='"')this.readString(!1);else if(r==="t")this.consumeLiteral("true");else if(r==="f")this.consumeLiteral("false");else if(r==="n")this.consumeLiteral("null");else if(r==="-"||r>="0"&&r<="9")this.consumeNumber();else throw new be(this.offset)}collectObject(e){this.offset++;let r=[],s=new Set;if(this.propertyOrder[e]=r,this.skipWhitespace(),this.text[this.offset]==="}"){this.offset++;return}while(this.offset<this.text.length){if(this.text[this.offset]!=='"')throw new be(this.offset);let n=this.readString(!0),i=`${e}/${n.replaceAll("~","~0").replaceAll("/","~1")}`;if(s.has(n))this.deletePointerSubtree(i);else s.add(n),r.push(n);if(this.skipWhitespace(),this.text[this.offset]!==":")throw new be(this.offset);if(this.offset++,this.collectValue(i),this.skipWhitespace(),this.text[this.offset]==="}"){this.offset++;return}if(this.text[this.offset]!==",")throw new be(this.offset);this.offset++,this.skipWhitespace()}throw new be(this.offset)}collectArray(e){if(this.offset++,this.skipWhitespace(),this.text[this.offset]==="]"){this.offset++;return}let r=0;while(this.offset<this.text.length){if(this.collectValue(`${e}/${r}`),r++,this.skipWhitespace(),this.text[this.offset]==="]"){this.offset++;return}if(this.text[this.offset]!==",")throw new be(this.offset);this.offset++,this.skipWhitespace()}throw new be(this.offset)}readString(e){this.offset++;let r="";while(this.offset<this.text.length){let s=this.offset,n=this.text[this.offset++];if(n==='"')return r;if(n.charCodeAt(0)<32)throw new be(s);if(n!=="\\"){if(e)r+=n;continue}let i=this.offset,o=this.text[this.offset++];switch(o){case'"':case"\\":case"/":if(e)r+=o;break;case"b":if(e)r+="\b";break;case"f":if(e)r+="\f";break;case"n":if(e)r+=`
|
|
115
115
|
`;break;case"r":if(e)r+="\r";break;case"t":if(e)r+="\t";break;case"u":{let c=this.text.slice(this.offset,this.offset+4);if(!/^[\dA-Fa-f]{4}$/u.test(c))throw new be(this.offset);if(e)r+=String.fromCharCode(Number.parseInt(c,16));this.offset+=4;break}default:throw new be(i)}}throw new be(this.offset)}consumeLiteral(e){let r=0;for(let s of e){if(this.text[this.offset+r]!==s)throw new be(this.offset+r);r++}this.offset+=e.length}consumeNumber(){if(this.text[this.offset]==="-")this.offset++;if(this.text[this.offset]==="0")this.offset++;else if(this.text[this.offset]>="1"&&this.text[this.offset]<="9")while(this.text[this.offset]>="0"&&this.text[this.offset]<="9")this.offset++;else throw new be(this.offset);if(this.text[this.offset]==="."){if(this.offset++,this.text[this.offset]<"0"||this.text[this.offset]>"9")throw new be(this.offset);while(this.text[this.offset]>="0"&&this.text[this.offset]<="9")this.offset++}if(this.text[this.offset]==="e"||this.text[this.offset]==="E"){if(this.offset++,this.text[this.offset]==="+"||this.text[this.offset]==="-")this.offset++;if(this.text[this.offset]<"0"||this.text[this.offset]>"9")throw new be(this.offset);while(this.text[this.offset]>="0"&&this.text[this.offset]<="9")this.offset++}}skipWhitespace(){while(this.offset<this.text.length){let e=this.text[this.offset];if(e!==" "&&e!=="\t"&&e!==`
|
|
116
|
-
`&&e!=="\r")return;this.offset++}}deletePointerSubtree(e){let r=`${e}/`;for(let s of Object.keys(this.propertyOrder))if(s===e||s.startsWith(r))delete this.propertyOrder[s]}};function cf(e,r,s){let n;try{n=JSON.parse(e)}catch(i){let o=i instanceof Error?i.message:String(i),c=BA(o,e,r,s);if(!c){let u=0;try{new pu(e).collect()}catch(a){if(a instanceof be)u=a.offset}c=Ki(e,u,r,s)}throw new du(`Invalid JSON: ${o}`,c.line,c.column)}if(typeof n!=="object"||n===null||Array.isArray(n))throw new du("JSON value must have an object root",r,s);return{value:n,propertyOrder:new pu(e).collect()}}t(cf,"parseOrderedJsonObject");var $A=t((e)=>({shape:e.type==="normal"?"actor":e.type==="hollow"?"actor-hollow":e.type==="awesome"?"actor-awesome":"actor-icon",...e.label===e.id?{}:{label:e.label},...e.classes.length?{classes:[...e.classes]}:{},...e.styles.length?{styles:[...e.styles]}:{},attrs:{kind:"actor",actorType:e.type,business:e.business,labelType:e.labelType,...e.icon?{icon:e.icon}:{},...e.stereotype?{stereotype:e.stereotype}:{},...e.parentId?{parentId:e.parentId}:{}}}),"actorNode"),GA=t((e)=>({shape:e.shape,...e.label===e.id?{}:{label:e.label},...e.classes.length?{classes:[...e.classes]}:{},...e.styles.length?{styles:[...e.styles]}:{},attrs:{kind:"usecase",useCaseShape:e.shape,business:e.business,labelType:e.labelType,...e.stereotype?{stereotype:e.stereotype}:{},...e.parentId?{parentId:e.parentId}:{}}}),"useCaseNode"),WA=t((e)=>({label:e.label,shape:"note",attrs:{kind:"note",target:e.target,labelType:e.labelType}}),"noteNode"),jA=t((e)=>({label:e.id,shape:"json-table",...e.classes.length?{classes:[...e.classes]}:{},...e.styles.length?{styles:[...e.styles]}:{},attrs:{kind:"json",value:e.value,propertyOrder:e.propertyOrder,labelType:"text"}}),"jsonNode"),KA=t((e)=>({id:e.id,source:e.source,target:e.target,...e.label?{label:e.label}:{},...e.classes.length?{classes:[...e.classes]}:{},...e.styles.length?{styles:[...e.styles]}:{},attrs:{relationshipType:e.type,arrowType:e.arrowType,minlen:e.minlen,explicitId:e.explicitId,animate:e.animate,...e.animation?{animation:e.animation}:{},...e.labelType?{labelType:e.labelType}:{}}}),"relationshipEdge"),zA=t((e)=>({id:`${e.id}-edge`,source:e.id,target:e.target,attrs:{relationshipType:"note",arrowType:ae.LINE_SOLID,pattern:"dotted",minlen:1,explicitId:!1,animate:!1,internal:!0}}),"noteEdge"),VA=t((e,r,s,n)=>{let i={};for(let a of e.getActors().values())i[a.id]=$A(a);for(let a of e.getUseCases().values())i[a.id]=GA(a);for(let a of e.getNotes().values())i[a.id]=WA(a);for(let a of e.getJsonNodes().values())i[a.id]=jA(a);let o={};for(let a of e.getSystemBoundaries().values())o[a.id]={...a.label===a.id?{}:{title:a.label},nodes:[...a.members],...a.classes.length?{classes:[...a.classes]}:{},...a.styles.length?{styles:[...a.styles]}:{},attrs:{kind:"systemBoundary",boundaryType:a.type,labelType:a.labelType}};let c={};for(let a of e.getClassDefs().values())c[a.id]={styles:[...a.styles]};let u=e.getDirection();return{version:1,diagramType:"usecase",source:r,header:{keyword:"usecase",direction:u==="TD"?"TB":u,span:s},...e.getAccTitle()?{accTitle:e.getAccTitle()}:{},...e.getAccDescription()?{accDescr:e.getAccDescription()}:{},nodes:i,edges:[...e.getRelationships().map(KA),...[...e.getNotes().values()].map(zA)],groups:o,classDefs:c,statements:n}},"buildUsecaseGraphAST"),Me=t((e)=>`line ${e.line}, column ${e.column} [${e.span[0]},${e.span[1]})`,"locationText"),mu=t((e)=>e===void 0?"":` (label "${e}")`,"labelSuffix"),ur=t((e)=>e.generated?e.label:void 0,"generatedFrom"),Fi=t((e,r)=>{for(let s of r)if(!e.includes(s))e.push(s)},"pushUnique"),HA=class{constructor(e){this.db=e,this.source="",this.statements=[],this.elements=[],this.boundaries=[],this.jsonDrafts=[],this.relationshipDrafts=[],this.noteDrafts=[],this.metadataAssignments=[],this.classAssignments=[],this.styleAssignments=[],this.classDefinitions=[],this.directions=[],this.model=e.createModel()}static{t(this,"UsecaseModelBuilder")}reset(e){this.model=this.db.createModel(),this.source=e,this.statements=[],this.elements.length=0,this.boundaries.length=0,this.jsonDrafts.length=0,this.relationshipDrafts.length=0,this.noteDrafts.length=0,this.metadataAssignments.length=0,this.classAssignments.length=0,this.styleAssignments.length=0,this.classDefinitions.length=0,this.directions.length=0}addElement(e){this.elements.push(e)}addBoundary(e){this.boundaries.push(e)}addJson(e){this.jsonDrafts.push(e)}addRelationship(e){this.relationshipDrafts.push(e)}addNote(e){this.noteDrafts.push(e)}addMetadataAssignment(e,r,s,n){this.metadataAssignments.push({target:e,targetLocation:r,metadata:s,statement:n})}addClassDef(e,r){this.classDefinitions.push({ids:e,styles:r})}addClassAssignment(e,r){this.classAssignments.push({targets:e,classes:r})}addStyleAssignment(e,r,s){this.styleAssignments.push({target:e,location:r,styles:s})}setDirection(e){this.directions.push(e==="TD"?"TB":e)}setAccTitle(e){this.model.accTitle=e}setAccDescription(e){this.model.accDescription=e}setStatements(e){this.statements=e}getActors(){return this.model.actors}getUseCases(){return this.model.useCases}getSystemBoundaries(){return this.model.systemBoundaries}getRelationships(){return this.model.relationships}getNotes(){return this.model.notes}getJsonNodes(){return this.model.jsonNodes}getClassDefs(){return this.model.classDefs}getDirection(){return this.model.direction}getAccTitle(){return this.model.accTitle}getAccDescription(){return this.model.accDescription}finalize(e){let r=new Map,s=new Map,n=new Map,i=new Map;for(let a of this.relationshipDrafts)this.recordFirst(i,a.source.id,a.source.location.span[0]),this.recordFirst(i,a.target.id,a.target.location.span[0]);for(let a of this.elements)this.recordFirst(i,a.id,a.location.span[0]);for(let a of this.boundaries)this.recordFirst(i,a.id,a.location.span[0]);for(let a of this.jsonDrafts)this.recordFirst(i,a.id,a.location.span[0]);let o=[...this.elements.map((a)=>({offset:a.location.span[0],type:"element",value:a})),...this.boundaries.map((a)=>({offset:a.location.span[0],type:"boundary",value:a})),...this.jsonDrafts.map((a)=>({offset:a.location.span[0],type:"json",value:a})),...this.relationshipDrafts.filter((a)=>a.explicitId).map((a)=>({offset:a.explicitIdLocation.span[0],type:"edge",value:a}))].sort((a,f)=>a.offset-f.offset);for(let a of o)if(a.type==="element")this.collectElement(a.value,r,s);else if(a.type==="boundary")this.collectBoundary(a.value,r,n);else if(a.type==="json")this.registerUnique(r,a.value.id,"json",a.value.location,!1);else this.registerUnique(r,a.value.explicitId,"edge",a.value.explicitIdLocation,!1);this.materializeElements(s,i),this.materializeBoundaries(n,i),this.materializeJson(i);let c=this.materializeRelationships(r,s,i);this.reorderElements(s,i),this.applyMetadataAssignments(r,s,n,c),this.validateAndRefreshElements(s),this.refreshBoundaries(n,s),this.materializeNotes(r),this.applyClassDefinitions(),this.applyClassesAndStyles(r,c),this.model.direction=this.directions.at(-1)??this.model.direction,this.model.symbols=new Map([...r].map(([a,f])=>[a,f.kind]));let u=VA(this,this.source,e,this.statements);return this.model.ast=u,this.db.commit(this.model),u}collectElement(e,r,s){let n=r.get(e.id),i=ur({generated:e.generated,label:e.label.text});if(n&&n.kind!==e.kind)this.conflict(`ID '${e.id}' is declared as both ${n.kind} and ${e.kind}`,e.location,n.location,i,ur(n));if(n&&(n.generated||e.generated))this.conflict(`Generated ID '${e.id}' collides with another declaration`,e.location,n.location,i,ur(n));let o=s.get(e.id);if(!o){let c={kind:e.kind,id:e.id,label:e.label,location:e.location,generated:e.generated,classes:[...e.classes],...e.parentId?{parentId:e.parentId,parentLocation:e.parentLocation}:{},...e.shape?{shape:e.shape}:{},...e.stereotype?{stereotype:e.stereotype,stereotypeLocation:e.location}:{}};this.applyDeclarationMetadata(c,e.metadata),s.set(e.id,c),r.set(e.id,{kind:e.kind,location:e.location,generated:e.generated,label:e.label.text});return}if(o.label.text!==e.label.text||o.label.type!==e.label.type)this.conflict(`ID '${e.id}' has conflicting labels`,e.location,o.location);if(e.shape&&o.shape&&e.shape!==o.shape)this.conflict(`Use case '${e.id}' has conflicting shapes`,e.location,o.location);if(e.parentId&&o.parentId&&e.parentId!==o.parentId)this.conflict(`Element '${e.id}' belongs to more than one system boundary`,e.parentLocation??e.location,o.parentLocation??o.location);if(e.stereotype&&o.stereotype&&e.stereotype!==o.stereotype)this.conflict(`Element '${e.id}' has conflicting stereotypes`,e.location,o.stereotypeLocation??o.location);o.shape??=e.shape,o.parentId??=e.parentId,o.parentLocation??=e.parentLocation,o.stereotype??=e.stereotype,o.stereotypeLocation??=e.stereotype?e.location:void 0,Fi(o.classes,e.classes),this.applyDeclarationMetadata(o,e.metadata)}collectBoundary(e,r,s){let n=r.get(e.id),i=ur({generated:e.generated,label:e.label.text});if(n&&n.kind!=="boundary")this.conflict(`ID '${e.id}' is declared as both ${n.kind} and boundary`,e.location,n.location,i,ur(n));if(n&&(n.generated||e.generated))this.conflict(`Generated ID '${e.id}' collides with another declaration`,e.location,n.location,i,ur(n));let o=s.get(e.id);if(o){if(o.label.text!==e.label.text||o.label.type!==e.label.type)this.conflict(`Boundary '${e.id}' has conflicting titles`,e.location,o.location);Fi(o.classes,e.classes);return}s.set(e.id,{id:e.id,label:e.label,location:e.location,generated:e.generated,classes:[...e.classes],styles:[],members:[]}),r.set(e.id,{kind:"boundary",location:e.location,generated:e.generated,label:e.label.text})}materializeElements(e,r){for(let s of[...e.values()].sort((n,i)=>(r.get(n.id)??0)-(r.get(i.id)??0)))this.setElementModel(s)}materializeBoundaries(e,r){for(let s of[...e.values()].sort((n,i)=>(r.get(n.id)??0)-(r.get(i.id)??0)))this.model.systemBoundaries.set(s.id,{id:s.id,label:s.label.text,labelType:s.label.type,type:s.type??"rect",members:[],classes:[...s.classes],styles:[...s.styles]})}materializeJson(e){for(let r of[...this.jsonDrafts].sort((s,n)=>(e.get(s.id)??0)-(e.get(n.id)??0)))this.model.jsonNodes.set(r.id,{id:r.id,value:r.value,propertyOrder:r.propertyOrder,classes:[...r.classes],styles:[]})}materializeRelationships(e,r,s){let n=new Map,i=0;for(let o of this.relationshipDrafts){let c=this.resolveEndpoint(o.source,e,r,s),u=this.resolveEndpoint(o.target,e,r,s);this.validateRelationship(o,c,u,e);let a=o.explicitId??`edge-${i++}`,f={id:a,explicitId:Boolean(o.explicitId),source:o.source.id,target:o.target.id,type:o.type,arrowType:o.arrowType,...o.label?{label:o.label.text,labelType:o.label.type}:{},minlen:o.minlen,classes:[],styles:[],animate:!1};this.model.relationships.push(f),n.set(a,{draft:o,relationship:f})}return this.model.relationshipCounter=i,n}resolveEndpoint(e,r,s,n){if(e.classesOnReference&&!e.declaration)throw Error(`Relationship endpoint '${e.id}' uses ::: without declaring the node at ${Me(e.location)}`);let i=r.get(e.id);if(i)return i.kind;return s.set(e.id,{kind:"usecase",id:e.id,label:e.label,location:e.location,generated:e.generated,shape:"ellipse",classes:[]}),r.set(e.id,{kind:"usecase",location:e.location,generated:e.generated,label:e.label.text}),this.recordFirst(n,e.id,e.location.span[0]),"usecase"}reorderElements(e,r){let s=new Map(this.model.actors),n=new Map(this.model.useCases);this.model.actors.clear(),this.model.useCases.clear();for(let i of[...e.values()].sort((o,c)=>(r.get(o.id)??0)-(r.get(c.id)??0))){if(!s.has(i.id)&&!n.has(i.id))this.setElementModel(i);let o=s.get(i.id)??this.model.actors.get(i.id),c=n.get(i.id)??this.model.useCases.get(i.id);if(o)this.model.actors.set(i.id,o);else if(c)this.model.useCases.set(i.id,c)}}applyMetadataAssignments(e,r,s,n){for(let i of this.metadataAssignments){let o=e.get(i.target);if(!o){let c=this.inferMetadataKind(i.metadata);throw Error(`Metadata target '${i.target}' is unresolved${c?` (metadata implies ${c})`:""} at ${Me(i.targetLocation)}`)}if(o.kind==="actor"||o.kind==="usecase")this.applyStandaloneElementMetadata(r.get(i.target),i.metadata);else if(o.kind==="boundary"){let c=s.get(i.target);for(let u of i.metadata.properties){if(u.key!=="type"||u.value!=="rect"&&u.value!=="package")this.invalidMetadata(i.target,o.kind,u);c.type=u.value}}else if(o.kind==="edge"){let c=n.get(i.target);if(!c)throw Error(`Metadata target '${i.target}' is not an explicit edge at ${Me(i.targetLocation)}`);i.statement.kind="edgeMetadata",i.statement.edges=[{id:i.target,span:i.statement.span,idSpan:i.targetLocation.span,...i.statement.metadata?{metadata:i.statement.metadata}:{}}],delete i.statement.nodes;for(let u of i.metadata.properties)if(u.key==="animate"&&typeof u.value==="boolean")c.relationship.animate=u.value;else if(u.key==="animation"&&(u.value==="fast"||u.value==="slow"))c.relationship.animation=u.value,c.relationship.animate=!0;else this.invalidMetadata(i.target,o.kind,u)}else for(let c of i.metadata.properties)this.invalidMetadata(i.target,o.kind,c)}for(let{relationship:i}of n.values())if(i.animation)i.animate=!0}applyStandaloneElementMetadata(e,r){for(let s of r.properties)if(e.kind==="actor")this.applyActorProperty(e,s,!0);else if(s.key==="business"&&typeof s.value==="boolean")e.business=s.value;else this.invalidMetadata(e.id,e.kind,s)}applyDeclarationMetadata(e,r){if(!r)return;for(let s of r.properties)if(e.kind==="actor")this.applyActorProperty(e,s,!1);else if(s.key==="business"&&typeof s.value==="boolean"){if(e.business!==void 0&&e.business!==s.value)this.conflict(`Use case '${e.id}' has conflicting business metadata`,s.location,e.location);e.business=s.value}else this.invalidMetadata(e.id,e.kind,s)}applyActorProperty(e,r,s){if(r.key==="type"&&(r.value==="normal"||r.value==="hollow"||r.value==="awesome")){if(!s&&e.actorType!==void 0&&e.actorType!==r.value)this.conflict(`Actor '${e.id}' has conflicting type metadata`,r.location,e.location);e.actorType=r.value}else if(r.key==="icon"&&typeof r.value==="string"){if(!s&&e.icon!==void 0&&e.icon!==r.value)this.conflict(`Actor '${e.id}' has conflicting icon metadata`,r.location,e.location);e.icon=r.value}else if(r.key==="business"&&typeof r.value==="boolean"){if(!s&&e.business!==void 0&&e.business!==r.value)this.conflict(`Actor '${e.id}' has conflicting business metadata`,r.location,e.location);e.business=r.value}else this.invalidMetadata(e.id,e.kind,r)}validateAndRefreshElements(e){for(let r of e.values()){let s=r.icon?"icon":r.actorType??"normal";if(r.kind==="actor"){if(r.icon&&r.actorType&&r.actorType!=="normal")throw Error(`Actor '${r.id}' cannot combine icon with type '${r.actorType}' at ${Me(r.location)}`);if(r.business&&(s==="icon"||s==="awesome"))throw Error(`Business actor '${r.id}' must use normal or hollow geometry at ${Me(r.location)}`)}else if((r.shape??"ellipse")==="rect"&&r.business)throw Error(`Rectangular use case '${r.id}' cannot be a business use case at ${Me(r.location)}`);this.setElementModel(r)}}refreshBoundaries(e,r){for(let s of e.values())s.members.length=0;for(let s of[...this.elements].sort((n,i)=>n.location.span[0]-i.location.span[0])){if(!s.parentId)continue;let n=e.get(s.parentId);if(!n)throw Error(`Parent boundary '${s.parentId}' for '${s.id}' is unresolved at ${Me(s.parentLocation??s.location)}`);if(!n.members.includes(s.id))n.members.push(s.id)}for(let s of r.values())if(s.parentId&&!e.has(s.parentId))throw Error(`Parent boundary '${s.parentId}' for '${s.id}' is unresolved at ${Me(s.parentLocation??s.location)}`);for(let s of e.values()){let n=this.model.systemBoundaries.get(s.id);n.type=s.type??"rect",n.members=[...s.members],n.classes=[...s.classes],n.styles=[...s.styles]}}materializeNotes(e){let r=0;for(let s of this.noteDrafts){let n=e.get(s.target);if(!n)throw Error(`Note target '${s.target}' is unresolved at ${Me(s.targetLocation)}`);if(n.kind!=="actor"&&n.kind!=="usecase")this.conflict(`Note target '${s.target}' must be an actor or use case, not ${n.kind}`,s.targetLocation,n.location);let i=`note-${r++}`;this.model.notes.set(i,{id:i,target:s.target,label:s.label.text,labelType:s.label.type})}this.model.noteCounter=r}applyClassDefinitions(){for(let e of this.classDefinitions)for(let r of e.ids)this.model.classDefs.set(r,{id:r,styles:[...e.styles]})}applyClassesAndStyles(e,r){for(let s of this.classAssignments)for(let n of s.targets)Fi(this.getStylable(n.id,e,r,n.location).classes,s.classes);for(let s of this.styleAssignments)this.getStylable(s.target,e,r,s.location).styles.push(...s.styles)}getStylable(e,r,s,n){let i=r.get(e)?.kind,o=i==="actor"?this.model.actors.get(e):i==="usecase"?this.model.useCases.get(e):i==="boundary"?this.model.systemBoundaries.get(e):i==="json"?this.model.jsonNodes.get(e):i==="edge"?s.get(e)?.relationship:void 0;if(!o)throw Error(`Class/style target '${e}' is unresolved or anonymous at ${Me(n)}`);return o}validateRelationship(e,r,s,n){let i=t((o)=>o==="actor"||o==="usecase"||o==="json","allowed");if(!i(r))this.conflict(`Relationship source '${e.source.id}' cannot be ${r}`,e.source.location,n.get(e.source.id).location);if(!i(s))this.conflict(`Relationship target '${e.target.id}' cannot be ${s}`,e.target.location,n.get(e.target.id).location);if((e.type==="include"||e.type==="extend")&&(r!=="usecase"||s!=="usecase"))throw Error(`${e.type} relationship requires use-case endpoints at ${Me(e.location)}`);if(e.type==="generalization"&&(r!=="actor"&&r!=="usecase"||r!==s))throw Error(`Generalization requires actor-to-actor or use-case-to-use-case endpoints at ${Me(e.location)}`);if(e.type==="association"&&(r==="json"||s==="json")&&![0,1,2].includes(e.arrowType))throw Error(`JSON relationship '${e.source.id}' to '${e.target.id}' permits only point, reversed-point, or markerless solid association at ${Me(e.location)}`)}setElementModel(e){if(e.kind==="actor"){let r=e.icon?"icon":e.actorType??"normal";this.model.useCases.delete(e.id),this.model.actors.set(e.id,{id:e.id,label:e.label.text,labelType:e.label.type,type:r,...e.icon?{icon:e.icon}:{},business:e.business??!1,...e.stereotype?{stereotype:e.stereotype}:{},...e.parentId?{parentId:e.parentId}:{},classes:[...e.classes],styles:this.model.actors.get(e.id)?.styles??[]})}else this.model.actors.delete(e.id),this.model.useCases.set(e.id,{id:e.id,label:e.label.text,labelType:e.label.type,shape:e.shape??"ellipse",business:e.business??!1,...e.stereotype?{stereotype:e.stereotype}:{},...e.parentId?{parentId:e.parentId}:{},classes:[...e.classes],styles:this.model.useCases.get(e.id)?.styles??[]})}inferMetadataKind(e){let r=new Set(["actor","usecase","boundary","edge"]);for(let s of e.properties)if(s.key==="icon")r.clear(),r.add("actor");else if(s.key==="animate"||s.key==="animation")r.clear(),r.add("edge");else if(s.key==="type"){if(r.clear(),s.value==="rect"||s.value==="package")r.add("boundary");else if(s.value==="normal"||s.value==="hollow"||s.value==="awesome")r.add("actor")}else if(s.key==="business")r.delete("boundary"),r.delete("edge");else return;return r.size===1?[...r][0]:void 0}invalidMetadata(e,r,s){throw Error(`Metadata property '${s.key}' is invalid for ${r} '${e}' at ${Me(s.location)}`)}registerUnique(e,r,s,n,i){let o=e.get(r);if(o)this.conflict(`ID '${r}' is declared more than once (${o.kind} and ${s})`,n,o.location,void 0,ur(o));e.set(r,{kind:s,location:n,generated:i})}recordFirst(e,r,s){let n=e.get(r);if(n===void 0||s<n)e.set(r,s)}conflict(e,r,s,n,i){throw Error(`${e} at ${Me(r)}${mu(n)}; previous declaration at ${Me(s)}${mu(i)}`)}},YA=Ls.getBaseCstVisitorConstructor(),XA=class extends YA{constructor(){super();this.builder=new HA(Hn),this.source="",this.anonymousEdge=0,this.anonymousNote=0,this.validateVisitor()}static{t(this,"UsecaseVisitor")}build(e,r){this.source=r,this.parentBoundary=void 0,this.anonymousEdge=0,this.anonymousNote=0,this.builder.reset(r),this.visit(e)}start(e){let r=this.tokens(e,"USECASE")[0],s=[];for(let n of this.nodes(e,"line"))s.push(this.visit(n));this.builder.setStatements(s),this.builder.finalize(this.tokenSpan(r))}line(e){let r=this.firstNode(e,"blankLine","commentLine","statement");return this.wrap(r,this.visit(r))}statement(e){return this.visit(this.firstNode(e,"accTitleStatement","accDescrStatement","directionStatement","actorStatement","systemBoundaryStatement","noteStatement","jsonStatement","classDefStatement","classStatement","styleStatement","metadataAssignmentStatement","entityStatement"))}lineEnd(e){return}blankLine(e){return{kind:"blank",span:this.tokenSpan(this.tokens(e,"NEWLINE")[0])}}commentLine(e){return{kind:"comment",span:this.tokenSpan(this.tokens(e,"COMMENT")[0])}}accTitleStatement(e){let r=this.tokens(e,"ACC_TITLE_LINE")[0].image;return this.builder.setAccTitle(r.slice(r.indexOf(":")+1).trim()),{kind:"accTitle",span:[0,0]}}accDescrStatement(e){let r=this.tokens(e,"ACC_DESCR_LINE")[0],s=this.tokens(e,"ACC_DESCR_BLOCK")[0],n=r?r.image.slice(r.image.indexOf(":")+1).trim():s.image.slice(s.image.indexOf("{")+1,s.image.lastIndexOf("}")).trim();return this.builder.setAccDescription(n),{kind:"accDescr",span:[0,0]}}actorStatement(e){let r=this.nodes(e,"actorItem"),s=r.map((a)=>this.visit(a)),n=this.nodes(e,"relationTail")[0],i=s.map((a,f)=>this.actorOccurrence(r[f],a,!0));for(let a of s)this.builder.addElement(this.actorDraft(a));if(!n)return{kind:"node",span:[0,0],nodes:i};let o=this.visit(n);if(o.target.explicitDeclaration)this.builder.addElement(this.entityDraft(o.target));let c=this.relationshipDraft(s[0],o,this.nodeLocation(n));this.builder.addRelationship(c);let u=c.explicitId??`edge-${this.anonymousEdge++}`;return i.push(this.entityOccurrence(this.nodes(n.children,"entityName")[0],o.target,o.target.explicitDeclaration)),{kind:"edge",span:[0,0],nodes:i,edges:[{id:u,span:[0,0],...c.explicitIdLocation?{idSpan:c.explicitIdLocation.span}:{},...c.label?{labelSpan:c.label.span}:{}}]}}actorItem(e){let r=this.visit(this.nodes(e,"actorName")[0]),s=this.nodes(e,"metadata")[0],n=this.nodes(e,"stereotype")[0],i=this.nodes(e,"classSuffix")[0],o=i?this.visit(i):{classes:[],spans:[]};return{...r,...s?{metadata:this.visit(s)}:{},...n?{stereotype:this.visit(n)}:{},classes:o.classes,classSpans:o.spans}}actorName(e){let r=this.tokens(e,"IDENTIFIER")[0],s=this.tokens(e,"PLAIN_STRING")[0]??this.tokens(e,"MARKDOWN_STRING")[0];if(r){let i=this.nodes(e,"nodeLabel")[0],o=i?this.visit(i):this.tokenLabel(r);return{id:r.image,label:o,location:this.tokenLocation(r),generated:!1,classes:[],classSpans:[]}}let n=this.tokenLabel(s);return{id:this.generateId(n.text),label:n,location:this.tokenLocation(s),generated:!0,classes:[],classSpans:[]}}actorDeclarationOnly(e){let r=this.nodes(e,"actorItem"),s=r.map((n)=>this.visit(n));for(let n of s)this.builder.addElement(this.actorDraft(n));return{kind:"node",span:[0,0],nodes:s.map((n,i)=>this.actorOccurrence(r[i],n,!0))}}entityStatement(e){let r=this.nodes(e,"entityName"),s=this.visit(r[0]),n=this.nodes(e,"relationTail")[0];if(!n)return s.explicitDeclaration=!0,s.shape??="ellipse",this.builder.addElement(this.entityDraft(s)),{kind:"node",span:[0,0],nodes:[this.entityOccurrence(r[0],s,!0)]};if(s.explicitDeclaration)this.builder.addElement(this.entityDraft(s));let i=this.visit(n);if(i.target.explicitDeclaration)this.builder.addElement(this.entityDraft(i.target));let o={source:this.endpoint(s),target:this.endpoint(i.target),location:this.nodeLocation(n),...i.explicitId?{explicitId:i.explicitId,explicitIdLocation:i.explicitIdLocation}:{},...i.arrow};this.builder.addRelationship(o);let c=o.explicitId??`edge-${this.anonymousEdge++}`;return{kind:"edge",span:[0,0],nodes:[this.entityOccurrence(r[0],s,s.explicitDeclaration),this.entityOccurrence(this.nodes(n.children,"entityName")[0],i.target,i.target.explicitDeclaration)],edges:[{id:c,span:[0,0],...o.explicitIdLocation?{idSpan:o.explicitIdLocation.span}:{},...o.label?{labelSpan:o.label.span}:{}}]}}entityName(e){let r=this.tokens(e,"IDENTIFIER")[0],s=this.tokens(e,"PLAIN_STRING")[0]??this.tokens(e,"MARKDOWN_STRING")[0],n=this.nodes(e,"nodeLabel")[0],i=this.nodes(e,"useCaseMetadata")[0],o=this.nodes(e,"stereotype")[0],c=this.nodes(e,"classSuffix")[0],u=c?this.visit(c):{classes:[],spans:[]};if(r){let f=n?this.visit(n):this.tokenLabel(r),h=n?this.tokens(e,"LBRACKET").length?"rect":"ellipse":void 0;return{id:r.image,label:f,location:this.tokenLocation(r),generated:!1,...h?{shape:h}:{},...i?{metadata:this.visit(i)}:{},...o?{stereotype:this.visit(o)}:{},classes:u.classes,classSpans:u.spans,explicitDeclaration:Boolean(h||i||o)}}let a=this.tokenLabel(s);return{id:this.generateId(a.text),label:a,location:this.tokenLocation(s),generated:!0,...i?{metadata:this.visit(i)}:{},...o?{stereotype:this.visit(o)}:{},classes:u.classes,classSpans:u.spans,explicitDeclaration:Boolean(i||o)}}nodeLabel(e){let r=this.allTokens(e);if(r.length===1&&(r[0].tokenType.name==="PLAIN_STRING"||r[0].tokenType.name==="MARKDOWN_STRING"))return this.tokenLabel(r[0]);let s=[r[0].startOffset,(r.at(-1).endOffset??r.at(-1).startOffset)+1];return{text:this.source.slice(s[0],s[1]),type:"text",span:s}}useCaseMetadata(e){return this.visit(this.nodes(e,"metadata")[0])}relationTail(e){let r=this.tokens(e,"IDENTIFIER")[0];return{...r?{explicitId:r.image,explicitIdLocation:this.tokenLocation(r)}:{},arrow:this.visit(this.nodes(e,"arrow")[0]),target:this.visit(this.nodes(e,"entityName")[0])}}arrow(e){return this.visit(this.firstNode(e,"semanticRelation","forwardSolidOperator","backwardSolidOperator","markerlessSolidOperator","forwardCircleOperator","backwardCircleOperator","forwardCrossOperator","backwardCrossOperator"))}edgeLabel(e){return this.nodeLabel(e)}semanticRelation(e){if(this.tokens(e,"GENERALIZATION").length)return{type:"generalization",arrowType:ae.SOLID_ARROW,minlen:1};let r=this.tokens(e,"INCLUDE").length?"include":"extend",s=this.tokens(e,r==="include"?"INCLUDE":"EXTEND")[0];return{type:r,arrowType:ae.SOLID_ARROW,label:{text:r,type:"text",span:this.tokenSpan(s)},minlen:1}}metadata(e){return{properties:this.nodes(e,"metadataProperty").map((r)=>this.visit(r)),location:this.ctxLocation(e)}}metadataProperty(e){let r=this.allTokens(e).filter((c)=>c.tokenType.name!=="COLON"),s=r[0],n=r[1],i=n.tokenType.name==="TRUE"?!0:n.tokenType.name==="FALSE"?!1:this.decodePlain(n),o=[s.startOffset,(n.endOffset??n.startOffset)+1];return{key:this.decodePlain(s),value:i,span:o,keySpan:this.contentSpan(s),valueSpan:this.contentSpan(n),location:this.tokenLocation(s)}}metadataSeparator(e){return}systemBoundaryStatement(e){let r=this.visit(this.nodes(e,"systemBoundaryName")[0]),s=this.nodes(e,"classSuffix")[0],n=s?this.visit(s):{classes:[],spans:[]};r.classes=n.classes,this.builder.addBoundary(r);let i=this.parentBoundary;this.parentBoundary={id:r.id,location:r.location};let o=this.nodes(e,"systemBoundaryContent")[0],c=o?this.visit(o):[];this.parentBoundary=i;let u=this.tokens(e,"END")[0],a=this.nodes(e,"metadata")[0],f=a?this.visit(a):void 0,h={kind:"group",span:[0,0],group:r.id,idSpan:r.location.span,titleSpan:r.label.span,endSpan:this.tokenSpan(u),classSpans:n.spans,...f?{metadata:f.properties.map(({key:d,span:p,keySpan:T,valueSpan:C})=>({key:d,span:p,keySpan:T,valueSpan:C}))}:{},...c.length?{children:c}:{}};if(f)this.builder.addMetadataAssignment(r.id,r.location,f,h);return h}systemBoundaryName(e){let r=this.tokens(e,"IDENTIFIER")[0];if(r){let i=this.nodes(e,"nodeLabel")[0];return{id:r.image,label:i?this.visit(i):this.tokenLabel(r),location:this.tokenLocation(r),generated:!1,classes:[]}}let s=this.tokens(e,"PLAIN_STRING")[0]??this.tokens(e,"MARKDOWN_STRING")[0],n=this.tokenLabel(s);return{id:this.generateId(n.text),label:n,location:this.tokenLocation(s),generated:!0,classes:[]}}systemBoundaryContent(e){return[...this.nodes(e,"blankLine"),...this.nodes(e,"commentLine"),...this.nodes(e,"boundaryElement")].sort((s,n)=>(s.location?.startOffset??0)-(n.location?.startOffset??0)).map((s)=>this.wrap(s,this.visit(s)))}boundaryElement(e){let r=this.nodes(e,"actorDeclarationOnly")[0];if(r)return this.visit(r);let s=this.nodes(e,"entityName")[0],n=this.visit(s);return n.explicitDeclaration=!0,n.shape??="ellipse",this.builder.addElement(this.entityDraft(n)),{kind:"node",span:[0,0],nodes:[this.entityOccurrence(s,n,!0)]}}metadataAssignmentStatement(e){let r=this.visit(this.nodes(e,"metadataAssignmentTarget")[0]),s=this.visit(this.nodes(e,"metadata")[0]),n={kind:"metadata",span:[0,0],nodes:[{id:r.id,span:r.location.span,idSpan:r.location.span}],metadata:s.properties.map(({key:i,span:o,keySpan:c,valueSpan:u})=>({key:i,span:o,keySpan:c,valueSpan:u}))};return this.builder.addMetadataAssignment(r.id,r.location,s,n),n}metadataAssignmentTarget(e){let r=this.allTokens(e)[0],s=this.tokenLabel(r);return{id:r.tokenType.name==="IDENTIFIER"?r.image:this.generateId(s.text),location:this.tokenLocation(r)}}noteStatement(e){let r=this.tokens(e,"IDENTIFIER")[0],s=this.visit(this.nodes(e,"nodeLabel")[0]);return this.builder.addNote({target:r.image,targetLocation:this.tokenLocation(r),label:s,location:this.ctxLocation(e)}),{kind:"note",span:[0,0],ref:`note-${this.anonymousNote++}`,refSpan:s.span,nodes:[{id:r.image,span:this.tokenSpan(r),idSpan:this.tokenSpan(r)}]}}stereotype(e){let r=this.tokens(e,"STEREOTYPE_TEXT")[0];return{value:r.image.trim(),span:this.tokenSpan(r)}}classSuffix(e){let r=this.tokens(e,"IDENTIFIER");return{classes:r.map((s)=>s.image),spans:r.map((s)=>this.tokenSpan(s))}}jsonStatement(e){let r=this.tokens(e,"JSON_DECLARATION_START")[0],s=this.tokens(e,"JSON_OBJECT_LITERAL")[0],n=/^json[\t ]+(\w+)/.exec(r.image),i=n[1],o=n[0].length-i.length,c={span:[r.startOffset+o,r.startOffset+o+i.length],line:r.startLine??1,column:(r.startColumn??1)+o},u=cf(s.image,s.startLine??1,s.startColumn??1),a=this.nodes(e,"classSuffix")[0],f=a?this.visit(a):{classes:[],spans:[]},h={id:i,value:u.value,propertyOrder:u.propertyOrder,location:c,classes:f.classes};return this.builder.addJson(h),{kind:"json",span:[0,0],nodes:[{id:i,span:c.span,idSpan:c.span,defines:!0,classSpans:f.spans}],classSpans:f.spans}}directionStatement(e){let r=this.allTokens(e).find((s)=>["TD","TB","BT","RL","LR"].includes(s.tokenType.name));return this.builder.setDirection(r.image),{kind:"direction",span:[0,0]}}classDefStatement(e){let r=this.tokens(e,"IDENTIFIER"),s=this.visit(this.nodes(e,"styles")[0]);return this.builder.addClassDef(r.map((n)=>n.image),s),{kind:"classDef",span:[0,0],ref:r[0].image,refSpan:this.tokenSpan(r[0])}}classStatement(e){let r=this.tokens(e,"IDENTIFIER"),s=1;for(;s<r.length;s++)if(!this.source.slice((r[s-1].endOffset??r[s-1].startOffset)+1,r[s].startOffset).includes(","))break;let n=r.slice(0,s).map((o)=>({id:o.image,location:this.tokenLocation(o)})),i=r.slice(s).map((o)=>o.image);return this.builder.addClassAssignment(n,i),{kind:"classAssign",span:[0,0],ref:i[0],refSpan:this.tokenSpan(r[s]),nodes:n.map(({id:o,location:c})=>({id:o,span:c.span,idSpan:c.span}))}}styleStatement(e){let r=this.tokens(e,"IDENTIFIER")[0],s=this.visit(this.nodes(e,"styles")[0]);return this.builder.addStyleAssignment(r.image,this.tokenLocation(r),s),{kind:"style",span:[0,0],nodes:[{id:r.image,span:this.tokenSpan(r),idSpan:this.tokenSpan(r)}]}}styles(e){return this.nodes(e,"styleValue").map((r)=>this.visit(r))}styleValue(e){let r=this.allTokens(e),s=[r[0].startOffset,(r.at(-1).endOffset??r.at(-1).startOffset)+1];return this.source.slice(s[0],s[1]).replaceAll("\\,",",")}styleComponent(e){return this.allTokens(e).map((r)=>r.image).join("")}forwardSolidOperator(e){let r=this.tokens(e,"FORWARD_SOLID")[0];return{type:"association",arrowType:ae.SOLID_ARROW,minlen:this.solidMinlen(r)}}backwardSolidOperator(e){let r=this.tokens(e,"BACKWARD_SOLID")[0],s=this.nodes(e,"edgeLabel")[0],n=s?this.tokens(e,"MARKERLESS_SOLID").at(-1):r;return{type:"association",arrowType:ae.BACK_ARROW,minlen:this.solidMinlen(n),...s?{label:this.visit(s)}:{}}}markerlessSolidOperator(e){let r=this.nodes(e,"edgeLabel")[0],s=this.allTokens(e);if(!r)return{type:"association",arrowType:ae.LINE_SOLID,minlen:this.solidMinlen(this.tokens(e,"MARKERLESS_SOLID")[0])};let n=s.at(-1),i=n.tokenType.name==="FORWARD_SOLID"?ae.SOLID_ARROW:n.tokenType.name==="FORWARD_CIRCLE"?ae.CIRCLE_ARROW:n.tokenType.name==="FORWARD_CROSS"?ae.CROSS_ARROW:ae.LINE_SOLID;return{type:"association",arrowType:i,label:this.visit(r),minlen:i===ae.SOLID_ARROW||i===ae.LINE_SOLID?this.solidMinlen(n):1}}forwardCircleOperator(e){return{type:"association",arrowType:ae.CIRCLE_ARROW,minlen:1}}backwardCircleOperator(e){let r=this.nodes(e,"edgeLabel")[0];return{type:"association",arrowType:ae.CIRCLE_ARROW_REVERSED,minlen:1,...r?{label:this.visit(r)}:{}}}forwardCrossOperator(e){return{type:"association",arrowType:ae.CROSS_ARROW,minlen:1}}backwardCrossOperator(e){let r=this.nodes(e,"edgeLabel")[0];return{type:"association",arrowType:ae.CROSS_ARROW_REVERSED,minlen:1,...r?{label:this.visit(r)}:{}}}actorDraft(e){return{id:e.id,kind:"actor",label:e.label,location:e.location,generated:e.generated,...this.parentBoundary?{parentId:this.parentBoundary.id,parentLocation:this.parentBoundary.location}:{},...e.metadata?{metadata:e.metadata}:{},...e.stereotype?{stereotype:e.stereotype.value,stereotypeSpan:e.stereotype.span}:{},classes:e.classes}}entityDraft(e){return{id:e.id,kind:"usecase",label:e.label,location:e.location,generated:e.generated,...this.parentBoundary?{parentId:this.parentBoundary.id,parentLocation:this.parentBoundary.location}:{},...e.shape?{shape:e.shape}:{},...e.metadata?{metadata:e.metadata}:{},...e.stereotype?{stereotype:e.stereotype.value,stereotypeSpan:e.stereotype.span}:{},classes:e.classes}}endpoint(e,r=e.explicitDeclaration??!0){return{id:e.id,label:e.label,location:e.location,generated:e.generated,declaration:r,classesOnReference:e.classes.length>0}}relationshipDraft(e,r,s){return{source:this.endpoint(e,!0),target:this.endpoint(r.target),location:s,...r.explicitId?{explicitId:r.explicitId,explicitIdLocation:r.explicitIdLocation}:{},...r.arrow}}actorOccurrence(e,r,s){return{id:r.id,span:this.nodeSpan(e),idSpan:r.location.span,labelSpan:r.label.span,...s?{defines:!0}:{},...r.stereotype?{stereotypeSpan:r.stereotype.span}:{},...r.metadata?{metadata:r.metadata.properties.map(({key:n,span:i,keySpan:o,valueSpan:c})=>({key:n,span:i,keySpan:o,valueSpan:c}))}:{},...r.classSpans.length?{classSpans:r.classSpans}:{}}}entityOccurrence(e,r,s){return this.actorOccurrence(e,r,s)}wrap(e,r){if(r.kind==="blank"||r.kind==="comment")return r;r.span=this.nodeSpan(e);for(let s of r.edges??[])s.span=r.span;return r}tokenLabel(e){let r=e.tokenType.name==="MARKDOWN_STRING"?"markdown":"text",s=r==="markdown"?2:e.tokenType.name==="PLAIN_STRING"?1:0,n=this.tokenSpan(e,s);return{text:this.source.slice(n[0],n[1]),type:r,span:n}}decodePlain(e){return e.tokenType.name==="PLAIN_STRING"?e.image.slice(1,-1):e.image}contentSpan(e){return this.tokenSpan(e,e.tokenType.name==="PLAIN_STRING"?1:e.tokenType.name==="MARKDOWN_STRING"?2:0)}generateId(e){return e.replace(/\W/g,"_")}solidMinlen(e){return Math.max(1,(e.image.match(/-/g)?.length??2)-1)}nodeLocation(e){let r=this.allTokens(e.children)[0];return{span:this.nodeSpan(e),line:r.startLine??1,column:r.startColumn??1}}ctxLocation(e){let r=this.allTokens(e).filter((i)=>i.tokenType.name!=="NEWLINE"&&i.tokenType.name!=="EOF"),s=r[0],n=r.at(-1);return{span:[s.startOffset,Math.min(this.source.length,(n.endOffset??n.startOffset+n.image.length-1)+1)],line:s.startLine??1,column:s.startColumn??1}}tokenLocation(e){let r=e.tokenType.name==="PLAIN_STRING"?1:e.tokenType.name==="MARKDOWN_STRING"?2:0;return{span:this.tokenSpan(e,r),line:e.startLine??1,column:(e.startColumn??1)+r}}nodeSpan(e){let r=this.allTokens(e.children).filter((i)=>i.tokenType.name!=="NEWLINE"&&i.tokenType.name!=="EOF"),s=r[0],n=r.at(-1);if(!s||!n)throw Error("Usecase CST node has no source token");return[s.startOffset,Math.min(this.source.length,(n.endOffset??n.startOffset+n.image.length-1)+1)]}tokenSpan(e,r=0){return[e.startOffset+r,Math.min(this.source.length,(e.endOffset??e.startOffset+e.image.length-1)+1-r)]}nodes(e,r){return(e[r]??[]).filter((s)=>("children"in s))}tokens(e,r){return(e[r]??[]).filter((s)=>("tokenTypeIdx"in s))}firstNode(e,...r){for(let s of r){let n=this.nodes(e,s)[0];if(n)return n}throw Error(`Usecase CST is missing one of: ${r.join(", ")}`)}allTokens(e){let r=[];for(let s of Object.values(e))for(let n of s)if("tokenTypeIdx"in n)r.push(n);else r.push(...this.allTokens(n.children));return r.sort((s,n)=>s.startOffset-n.startOffset)}},qA=new XA,JA={parse:t(async(e)=>{Hn.clear(),Ls.input=[];try{yu({diagramType:"usecase",lexer:UA,parser:Ls,entry:t(()=>Ls.start(),"entry"),visit:t((r)=>qA.build(r,e),"visit")},e)}catch(r){Hn.clear();let s=Ls.errors[0];if(s){let{token:n}=s,i=Number.isFinite(n.startOffset)?n.startOffset:e.length,o=typeof n.endOffset==="number"&&Number.isFinite(n.endOffset)?n.endOffset+1:i,c=n.startLine??e.slice(0,i).split(/\r\n|\r|\n/).length,u=Math.max(e.lastIndexOf(`
|
|
117
|
-
`,i-1),e.lastIndexOf("\r",i-1)),a=n.startColumn??i-u,f=r instanceof Error?r.message:String(r);throw Error(`${f} at line ${c}, column ${a} [${i},${o})`)}throw r}},"parse")},ZA=["point","circle","cross","extension"],uf={usecaseActor:!0,usecaseActorHollow:!0,usecaseActorAwesome:!0,usecaseActorIcon:!0},gu=t((e,r)=>{let[s,n]=[e,r].map((i)=>i.replace(/[^\w-]+/g,"_").replace(/^_+|_+$/g,"")||"element");return`usecase-${s}-${n}`},"usecaseDomId"),QA=t((e)=>`usecase-${e.replace(/[^\w-]+/g,"_").replace(/^_+|_+$/g,"")||"element"}`,"usecaseNodeDomId"),Yn=t((e,r)=>{if(r!=="markdown")return e;return
|
|
118
|
-
`)},"getAccessibleLabel"),ex=t((e)=>{let r=Yn(e.label??e.id,e.labelType);if(uf[e.shape]){let n=e.actorType&&e.actorType!=="normal"?`${e.actorType} `:"",i=e.business?"business ":"",o=e.stereotype?`, stereotype ${e.stereotype}`:"";return`${i}${n}actor ${r}${o}`}if(e.shape==="note")return`Note for ${e.noteTargetLabel??e.noteTarget??""}: ${r}`;if(e.shape==="usecaseJsonTable"){let n=(e.jsonRows??[]).map((i)=>`${i.accessibleKey}: ${i.value}`).join("; ");return n?`${r}: ${n}`:r}let s=e.stereotype?`, stereotype ${e.stereotype}`:"";return`${e.business?"business ":""}use case ${r}${s}`},"getUsecaseNodeAccessibleName"),tx=t((e)=>`${e.boundaryType} system boundary ${Yn(e.label??e.id,e.labelType)}`,"getUsecaseBoundaryAccessibleName"),rx=t((e)=>{if(e.relationshipType==="note")return"";return`${e.relationshipType==="association"&&e.label?`association ${Yn(e.label,e.labelType)}`:e.relationshipType} from ${e.sourceLabel} to ${e.targetLabel}`},"getUsecaseEdgeAccessibleName"),Vr=t((e)=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),"escapePlainLabel"),Tu=t((e)=>e.replace(/([*[\\\]_`])/g,"\\$1"),"escapeMarkdownMarkers"),sx=t((e,r)=>{e.diagramId=r,e.markers=[...ZA];for(let s of e.nodes){let n=s;if(n.domId=QA(s.id),s.label!==void 0&&s.labelType==="text")s.label=Vr(s.label);if(s.stereotype)s.stereotype=Vr(s.stereotype);if(!s.isGroup&&s.shape==="usecaseJsonTable")s.jsonRows=s.jsonRows?.map((i)=>({...i,key:Vr(i.key),value:Vr(i.value)}));if(!s.isGroup&&(s.shape==="usecaseEllipse"||s.shape==="rect")&&s.stereotype){let i=s.label??Vr(s.id);s.label=`«${Tu(s.stereotype)}»<br/>${s.labelType==="text"?Tu(i):i}`,s.labelType="markdown",n.hasFoldedStereotype=!0,delete s.stereotype}}for(let s of e.edges)if(s.label!==void 0&&s.labelType==="text")s.label=Vr(s.label);return e},"prepareUsecaseLayoutData"),nx=t((e,r,s)=>{for(let i of r.nodes){let o=typeof i.domId==="string"?i.domId:gu(r.diagramId,i.id),c=e.select(`#${o}`),u=i.isGroup?"boundary":uf[i.shape]?"actor":i.shape==="note"?"note":i.shape==="usecaseJsonTable"?"json":"usecase",a=s.nodes.get(i.id)??i.id;if(c.attr("data-usecase-id",i.id).attr("data-usecase-kind",u).attr("role","img").attr("aria-label",a),!i.isGroup&&(i.shape==="usecaseEllipse"||i.shape==="rect")&&"hasFoldedStereotype"in i&&i.hasFoldedStereotype===!0){let f=c.node(),h=f?.querySelector(".nodeLabel"),d=h?.querySelector("p")??h,p=d?.firstChild;if(d&&p?.nodeType===3){let T=d.ownerDocument.createElement("span");T.className="usecase-stereotype",d.insertBefore(T,p),T.appendChild(p)}else f?.querySelector(".label tspan tspan, .label tspan")?.classList.add("usecase-stereotype")}}let n=new Map(r.edges.map((i)=>[i.id,i]));e.selectAll('path[data-et="edge"]').each(function(){let i=n.get(this.getAttribute("data-id")??"");if(!i)return;let o=b(this);if(o.attr("id",gu(r.diagramId,i.id)).attr("data-usecase-id",i.id).attr("data-usecase-kind",i.internal?"note-connector":"relationship"),i.internal)o.attr("aria-hidden","true");else o.attr("role","img").attr("aria-label",s.edges.get(i.id)??i.id)})},"annotateUsecaseElements"),Eu=t((e,r)=>{e.style("--mermaid-usecase-actor-font-size",`${r.actorFontSize}px`).style("--mermaid-usecase-actor-font-family",r.actorFontFamily).style("--mermaid-usecase-actor-font-weight",r.actorFontWeight).style("--mermaid-usecase-font-size",`${r.usecaseFontSize}px`).style("--mermaid-usecase-font-family",r.usecaseFontFamily).style("--mermaid-usecase-font-weight",r.usecaseFontWeight)},"applyUsecaseFonts"),ix=t(async(e,r,s,n)=>{l.info("Drawing usecase diagram (unified)",r);let{layout:i}=m(),o=n.db,c=o.getData(),u=new Map(c.nodes.map((d)=>[d.id,Yn(d.label??d.id,d.labelType)])),a={nodes:new Map(c.nodes.map((d)=>[d.id,d.isGroup?tx(d):ex(d.shape==="note"?{...d,noteTargetLabel:u.get(d.noteTarget??"")}:d)])),edges:new Map(c.edges.map((d)=>[d.id,rx({...d,sourceLabel:u.get(d.source)??d.sourceLabel,targetLabel:u.get(d.target)??d.targetLabel})]))},f=
|
|
116
|
+
`&&e!=="\r")return;this.offset++}}deletePointerSubtree(e){let r=`${e}/`;for(let s of Object.keys(this.propertyOrder))if(s===e||s.startsWith(r))delete this.propertyOrder[s]}};function cf(e,r,s){let n;try{n=JSON.parse(e)}catch(i){let o=i instanceof Error?i.message:String(i),c=BA(o,e,r,s);if(!c){let u=0;try{new pu(e).collect()}catch(a){if(a instanceof be)u=a.offset}c=Ki(e,u,r,s)}throw new du(`Invalid JSON: ${o}`,c.line,c.column)}if(typeof n!=="object"||n===null||Array.isArray(n))throw new du("JSON value must have an object root",r,s);return{value:n,propertyOrder:new pu(e).collect()}}t(cf,"parseOrderedJsonObject");var $A=t((e)=>({shape:e.type==="normal"?"actor":e.type==="hollow"?"actor-hollow":e.type==="awesome"?"actor-awesome":"actor-icon",...e.label===e.id?{}:{label:e.label},...e.classes.length?{classes:[...e.classes]}:{},...e.styles.length?{styles:[...e.styles]}:{},attrs:{kind:"actor",actorType:e.type,business:e.business,labelType:e.labelType,...e.icon?{icon:e.icon}:{},...e.stereotype?{stereotype:e.stereotype}:{},...e.parentId?{parentId:e.parentId}:{}}}),"actorNode"),GA=t((e)=>({shape:e.shape,...e.label===e.id?{}:{label:e.label},...e.classes.length?{classes:[...e.classes]}:{},...e.styles.length?{styles:[...e.styles]}:{},attrs:{kind:"usecase",useCaseShape:e.shape,business:e.business,labelType:e.labelType,...e.stereotype?{stereotype:e.stereotype}:{},...e.parentId?{parentId:e.parentId}:{}}}),"useCaseNode"),WA=t((e)=>({label:e.label,shape:"note",attrs:{kind:"note",target:e.target,labelType:e.labelType}}),"noteNode"),jA=t((e)=>({label:e.id,shape:"json-table",...e.classes.length?{classes:[...e.classes]}:{},...e.styles.length?{styles:[...e.styles]}:{},attrs:{kind:"json",value:e.value,propertyOrder:e.propertyOrder,labelType:"text"}}),"jsonNode"),KA=t((e)=>({id:e.id,source:e.source,target:e.target,...e.label?{label:e.label}:{},...e.classes.length?{classes:[...e.classes]}:{},...e.styles.length?{styles:[...e.styles]}:{},attrs:{relationshipType:e.type,arrowType:e.arrowType,minlen:e.minlen,explicitId:e.explicitId,animate:e.animate,...e.animation?{animation:e.animation}:{},...e.labelType?{labelType:e.labelType}:{}}}),"relationshipEdge"),zA=t((e)=>({id:`${e.id}-edge`,source:e.id,target:e.target,attrs:{relationshipType:"note",arrowType:ae.LINE_SOLID,pattern:"dotted",minlen:1,explicitId:!1,animate:!1,internal:!0}}),"noteEdge"),VA=t((e,r,s,n)=>{let i={};for(let a of e.getActors().values())i[a.id]=$A(a);for(let a of e.getUseCases().values())i[a.id]=GA(a);for(let a of e.getNotes().values())i[a.id]=WA(a);for(let a of e.getJsonNodes().values())i[a.id]=jA(a);let o={};for(let a of e.getSystemBoundaries().values())o[a.id]={...a.label===a.id?{}:{title:a.label},nodes:[...a.members],...a.classes.length?{classes:[...a.classes]}:{},...a.styles.length?{styles:[...a.styles]}:{},attrs:{kind:"systemBoundary",boundaryType:a.type,labelType:a.labelType}};let c={};for(let a of e.getClassDefs().values())c[a.id]={styles:[...a.styles]};let u=e.getDirection();return{version:1,diagramType:"usecase",source:r,header:{keyword:"usecase",direction:u==="TD"?"TB":u,span:s},...e.getAccTitle()?{accTitle:e.getAccTitle()}:{},...e.getAccDescription()?{accDescr:e.getAccDescription()}:{},nodes:i,edges:[...e.getRelationships().map(KA),...[...e.getNotes().values()].map(zA)],groups:o,classDefs:c,statements:n}},"buildUsecaseGraphAST"),Me=t((e)=>`line ${e.line}, column ${e.column} [${e.span[0]},${e.span[1]})`,"locationText"),mu=t((e)=>e===void 0?"":` (label "${e}")`,"labelSuffix"),ur=t((e)=>e.generated?e.label:void 0,"generatedFrom"),Fi=t((e,r)=>{for(let s of r)if(!e.includes(s))e.push(s)},"pushUnique"),HA=class{constructor(e){this.db=e,this.source="",this.statements=[],this.elements=[],this.boundaries=[],this.jsonDrafts=[],this.relationshipDrafts=[],this.noteDrafts=[],this.metadataAssignments=[],this.classAssignments=[],this.styleAssignments=[],this.classDefinitions=[],this.directions=[],this.model=e.createModel()}static{t(this,"UsecaseModelBuilder")}reset(e){this.model=this.db.createModel(),this.source=e,this.statements=[],this.elements.length=0,this.boundaries.length=0,this.jsonDrafts.length=0,this.relationshipDrafts.length=0,this.noteDrafts.length=0,this.metadataAssignments.length=0,this.classAssignments.length=0,this.styleAssignments.length=0,this.classDefinitions.length=0,this.directions.length=0}addElement(e){this.elements.push(e)}addBoundary(e){this.boundaries.push(e)}addJson(e){this.jsonDrafts.push(e)}addRelationship(e){this.relationshipDrafts.push(e)}addNote(e){this.noteDrafts.push(e)}addMetadataAssignment(e,r,s,n){this.metadataAssignments.push({target:e,targetLocation:r,metadata:s,statement:n})}addClassDef(e,r){this.classDefinitions.push({ids:e,styles:r})}addClassAssignment(e,r){this.classAssignments.push({targets:e,classes:r})}addStyleAssignment(e,r,s){this.styleAssignments.push({target:e,location:r,styles:s})}setDirection(e){this.directions.push(e==="TD"?"TB":e)}setAccTitle(e){this.model.accTitle=e}setAccDescription(e){this.model.accDescription=e}setStatements(e){this.statements=e}getActors(){return this.model.actors}getUseCases(){return this.model.useCases}getSystemBoundaries(){return this.model.systemBoundaries}getRelationships(){return this.model.relationships}getNotes(){return this.model.notes}getJsonNodes(){return this.model.jsonNodes}getClassDefs(){return this.model.classDefs}getDirection(){return this.model.direction}getAccTitle(){return this.model.accTitle}getAccDescription(){return this.model.accDescription}finalize(e){let r=new Map,s=new Map,n=new Map,i=new Map;for(let a of this.relationshipDrafts)this.recordFirst(i,a.source.id,a.source.location.span[0]),this.recordFirst(i,a.target.id,a.target.location.span[0]);for(let a of this.elements)this.recordFirst(i,a.id,a.location.span[0]);for(let a of this.boundaries)this.recordFirst(i,a.id,a.location.span[0]);for(let a of this.jsonDrafts)this.recordFirst(i,a.id,a.location.span[0]);let o=[...this.elements.map((a)=>({offset:a.location.span[0],type:"element",value:a})),...this.boundaries.map((a)=>({offset:a.location.span[0],type:"boundary",value:a})),...this.jsonDrafts.map((a)=>({offset:a.location.span[0],type:"json",value:a})),...this.relationshipDrafts.filter((a)=>a.explicitId).map((a)=>({offset:a.explicitIdLocation.span[0],type:"edge",value:a}))].sort((a,f)=>a.offset-f.offset);for(let a of o)if(a.type==="element")this.collectElement(a.value,r,s);else if(a.type==="boundary")this.collectBoundary(a.value,r,n);else if(a.type==="json")this.registerUnique(r,a.value.id,"json",a.value.location,!1);else this.registerUnique(r,a.value.explicitId,"edge",a.value.explicitIdLocation,!1);this.materializeElements(s,i),this.materializeBoundaries(n,i),this.materializeJson(i);let c=this.materializeRelationships(r,s,i);this.reorderElements(s,i),this.applyMetadataAssignments(r,s,n,c),this.validateAndRefreshElements(s),this.refreshBoundaries(n,s),this.materializeNotes(r),this.applyClassDefinitions(),this.applyClassesAndStyles(r,c),this.model.direction=this.directions.at(-1)??this.model.direction,this.model.symbols=new Map([...r].map(([a,f])=>[a,f.kind]));let u=VA(this,this.source,e,this.statements);return this.model.ast=u,this.db.commit(this.model),u}collectElement(e,r,s){let n=r.get(e.id),i=ur({generated:e.generated,label:e.label.text});if(n&&n.kind!==e.kind)this.conflict(`ID '${e.id}' is declared as both ${n.kind} and ${e.kind}`,e.location,n.location,i,ur(n));if(n&&(n.generated||e.generated))this.conflict(`Generated ID '${e.id}' collides with another declaration`,e.location,n.location,i,ur(n));let o=s.get(e.id);if(!o){let c={kind:e.kind,id:e.id,label:e.label,location:e.location,generated:e.generated,classes:[...e.classes],...e.parentId?{parentId:e.parentId,parentLocation:e.parentLocation}:{},...e.shape?{shape:e.shape}:{},...e.stereotype?{stereotype:e.stereotype,stereotypeLocation:e.location}:{}};this.applyDeclarationMetadata(c,e.metadata),s.set(e.id,c),r.set(e.id,{kind:e.kind,location:e.location,generated:e.generated,label:e.label.text});return}if(o.label.text!==e.label.text||o.label.type!==e.label.type)this.conflict(`ID '${e.id}' has conflicting labels`,e.location,o.location);if(e.shape&&o.shape&&e.shape!==o.shape)this.conflict(`Use case '${e.id}' has conflicting shapes`,e.location,o.location);if(e.parentId&&o.parentId&&e.parentId!==o.parentId)this.conflict(`Element '${e.id}' belongs to more than one system boundary`,e.parentLocation??e.location,o.parentLocation??o.location);if(e.stereotype&&o.stereotype&&e.stereotype!==o.stereotype)this.conflict(`Element '${e.id}' has conflicting stereotypes`,e.location,o.stereotypeLocation??o.location);o.shape??=e.shape,o.parentId??=e.parentId,o.parentLocation??=e.parentLocation,o.stereotype??=e.stereotype,o.stereotypeLocation??=e.stereotype?e.location:void 0,Fi(o.classes,e.classes),this.applyDeclarationMetadata(o,e.metadata)}collectBoundary(e,r,s){let n=r.get(e.id),i=ur({generated:e.generated,label:e.label.text});if(n&&n.kind!=="boundary")this.conflict(`ID '${e.id}' is declared as both ${n.kind} and boundary`,e.location,n.location,i,ur(n));if(n&&(n.generated||e.generated))this.conflict(`Generated ID '${e.id}' collides with another declaration`,e.location,n.location,i,ur(n));let o=s.get(e.id);if(o){if(o.label.text!==e.label.text||o.label.type!==e.label.type)this.conflict(`Boundary '${e.id}' has conflicting titles`,e.location,o.location);Fi(o.classes,e.classes);return}s.set(e.id,{id:e.id,label:e.label,location:e.location,generated:e.generated,classes:[...e.classes],styles:[],members:[]}),r.set(e.id,{kind:"boundary",location:e.location,generated:e.generated,label:e.label.text})}materializeElements(e,r){for(let s of[...e.values()].sort((n,i)=>(r.get(n.id)??0)-(r.get(i.id)??0)))this.setElementModel(s)}materializeBoundaries(e,r){for(let s of[...e.values()].sort((n,i)=>(r.get(n.id)??0)-(r.get(i.id)??0)))this.model.systemBoundaries.set(s.id,{id:s.id,label:s.label.text,labelType:s.label.type,type:s.type??"rect",members:[],classes:[...s.classes],styles:[...s.styles]})}materializeJson(e){for(let r of[...this.jsonDrafts].sort((s,n)=>(e.get(s.id)??0)-(e.get(n.id)??0)))this.model.jsonNodes.set(r.id,{id:r.id,value:r.value,propertyOrder:r.propertyOrder,classes:[...r.classes],styles:[]})}materializeRelationships(e,r,s){let n=new Map,i=0;for(let o of this.relationshipDrafts){let c=this.resolveEndpoint(o.source,e,r,s),u=this.resolveEndpoint(o.target,e,r,s);this.validateRelationship(o,c,u,e);let a=o.explicitId??`edge-${i++}`,f={id:a,explicitId:Boolean(o.explicitId),source:o.source.id,target:o.target.id,type:o.type,arrowType:o.arrowType,...o.label?{label:o.label.text,labelType:o.label.type}:{},minlen:o.minlen,classes:[],styles:[],animate:!1};this.model.relationships.push(f),n.set(a,{draft:o,relationship:f})}return this.model.relationshipCounter=i,n}resolveEndpoint(e,r,s,n){if(e.classesOnReference&&!e.declaration)throw Error(`Relationship endpoint '${e.id}' uses ::: without declaring the node at ${Me(e.location)}`);let i=r.get(e.id);if(i)return i.kind;return s.set(e.id,{kind:"usecase",id:e.id,label:e.label,location:e.location,generated:e.generated,shape:"ellipse",classes:[]}),r.set(e.id,{kind:"usecase",location:e.location,generated:e.generated,label:e.label.text}),this.recordFirst(n,e.id,e.location.span[0]),"usecase"}reorderElements(e,r){let s=new Map(this.model.actors),n=new Map(this.model.useCases);this.model.actors.clear(),this.model.useCases.clear();for(let i of[...e.values()].sort((o,c)=>(r.get(o.id)??0)-(r.get(c.id)??0))){if(!s.has(i.id)&&!n.has(i.id))this.setElementModel(i);let o=s.get(i.id)??this.model.actors.get(i.id),c=n.get(i.id)??this.model.useCases.get(i.id);if(o)this.model.actors.set(i.id,o);else if(c)this.model.useCases.set(i.id,c)}}applyMetadataAssignments(e,r,s,n){for(let i of this.metadataAssignments){let o=e.get(i.target);if(!o){let c=this.inferMetadataKind(i.metadata);throw Error(`Metadata target '${i.target}' is unresolved${c?` (metadata implies ${c})`:""} at ${Me(i.targetLocation)}`)}if(o.kind==="actor"||o.kind==="usecase")this.applyStandaloneElementMetadata(r.get(i.target),i.metadata);else if(o.kind==="boundary"){let c=s.get(i.target);for(let u of i.metadata.properties){if(u.key!=="type"||u.value!=="rect"&&u.value!=="package")this.invalidMetadata(i.target,o.kind,u);c.type=u.value}}else if(o.kind==="edge"){let c=n.get(i.target);if(!c)throw Error(`Metadata target '${i.target}' is not an explicit edge at ${Me(i.targetLocation)}`);i.statement.kind="edgeMetadata",i.statement.edges=[{id:i.target,span:i.statement.span,idSpan:i.targetLocation.span,...i.statement.metadata?{metadata:i.statement.metadata}:{}}],delete i.statement.nodes;for(let u of i.metadata.properties)if(u.key==="animate"&&typeof u.value==="boolean")c.relationship.animate=u.value;else if(u.key==="animation"&&(u.value==="fast"||u.value==="slow"))c.relationship.animation=u.value,c.relationship.animate=!0;else this.invalidMetadata(i.target,o.kind,u)}else for(let c of i.metadata.properties)this.invalidMetadata(i.target,o.kind,c)}for(let{relationship:i}of n.values())if(i.animation)i.animate=!0}applyStandaloneElementMetadata(e,r){for(let s of r.properties)if(e.kind==="actor")this.applyActorProperty(e,s,!0);else if(s.key==="business"&&typeof s.value==="boolean")e.business=s.value;else this.invalidMetadata(e.id,e.kind,s)}applyDeclarationMetadata(e,r){if(!r)return;for(let s of r.properties)if(e.kind==="actor")this.applyActorProperty(e,s,!1);else if(s.key==="business"&&typeof s.value==="boolean"){if(e.business!==void 0&&e.business!==s.value)this.conflict(`Use case '${e.id}' has conflicting business metadata`,s.location,e.location);e.business=s.value}else this.invalidMetadata(e.id,e.kind,s)}applyActorProperty(e,r,s){if(r.key==="type"&&(r.value==="normal"||r.value==="hollow"||r.value==="awesome")){if(!s&&e.actorType!==void 0&&e.actorType!==r.value)this.conflict(`Actor '${e.id}' has conflicting type metadata`,r.location,e.location);e.actorType=r.value}else if(r.key==="icon"&&typeof r.value==="string"){if(!s&&e.icon!==void 0&&e.icon!==r.value)this.conflict(`Actor '${e.id}' has conflicting icon metadata`,r.location,e.location);e.icon=r.value}else if(r.key==="business"&&typeof r.value==="boolean"){if(!s&&e.business!==void 0&&e.business!==r.value)this.conflict(`Actor '${e.id}' has conflicting business metadata`,r.location,e.location);e.business=r.value}else this.invalidMetadata(e.id,e.kind,r)}validateAndRefreshElements(e){for(let r of e.values()){let s=r.icon?"icon":r.actorType??"normal";if(r.kind==="actor"){if(r.icon&&r.actorType&&r.actorType!=="normal")throw Error(`Actor '${r.id}' cannot combine icon with type '${r.actorType}' at ${Me(r.location)}`);if(r.business&&(s==="icon"||s==="awesome"))throw Error(`Business actor '${r.id}' must use normal or hollow geometry at ${Me(r.location)}`)}else if((r.shape??"ellipse")==="rect"&&r.business)throw Error(`Rectangular use case '${r.id}' cannot be a business use case at ${Me(r.location)}`);this.setElementModel(r)}}refreshBoundaries(e,r){for(let s of e.values())s.members.length=0;for(let s of[...this.elements].sort((n,i)=>n.location.span[0]-i.location.span[0])){if(!s.parentId)continue;let n=e.get(s.parentId);if(!n)throw Error(`Parent boundary '${s.parentId}' for '${s.id}' is unresolved at ${Me(s.parentLocation??s.location)}`);if(!n.members.includes(s.id))n.members.push(s.id)}for(let s of r.values())if(s.parentId&&!e.has(s.parentId))throw Error(`Parent boundary '${s.parentId}' for '${s.id}' is unresolved at ${Me(s.parentLocation??s.location)}`);for(let s of e.values()){let n=this.model.systemBoundaries.get(s.id);n.type=s.type??"rect",n.members=[...s.members],n.classes=[...s.classes],n.styles=[...s.styles]}}materializeNotes(e){let r=0;for(let s of this.noteDrafts){let n=e.get(s.target);if(!n)throw Error(`Note target '${s.target}' is unresolved at ${Me(s.targetLocation)}`);if(n.kind!=="actor"&&n.kind!=="usecase")this.conflict(`Note target '${s.target}' must be an actor or use case, not ${n.kind}`,s.targetLocation,n.location);let i=`note-${r++}`;this.model.notes.set(i,{id:i,target:s.target,label:s.label.text,labelType:s.label.type})}this.model.noteCounter=r}applyClassDefinitions(){for(let e of this.classDefinitions)for(let r of e.ids)this.model.classDefs.set(r,{id:r,styles:[...e.styles]})}applyClassesAndStyles(e,r){for(let s of this.classAssignments)for(let n of s.targets)Fi(this.getStylable(n.id,e,r,n.location).classes,s.classes);for(let s of this.styleAssignments)this.getStylable(s.target,e,r,s.location).styles.push(...s.styles)}getStylable(e,r,s,n){let i=r.get(e)?.kind,o=i==="actor"?this.model.actors.get(e):i==="usecase"?this.model.useCases.get(e):i==="boundary"?this.model.systemBoundaries.get(e):i==="json"?this.model.jsonNodes.get(e):i==="edge"?s.get(e)?.relationship:void 0;if(!o)throw Error(`Class/style target '${e}' is unresolved or anonymous at ${Me(n)}`);return o}validateRelationship(e,r,s,n){let i=t((o)=>o==="actor"||o==="usecase"||o==="json","allowed");if(!i(r))this.conflict(`Relationship source '${e.source.id}' cannot be ${r}`,e.source.location,n.get(e.source.id).location);if(!i(s))this.conflict(`Relationship target '${e.target.id}' cannot be ${s}`,e.target.location,n.get(e.target.id).location);if((e.type==="include"||e.type==="extend")&&(r!=="usecase"||s!=="usecase"))throw Error(`${e.type} relationship requires use-case endpoints at ${Me(e.location)}`);if(e.type==="generalization"&&(r!=="actor"&&r!=="usecase"||r!==s))throw Error(`Generalization requires actor-to-actor or use-case-to-use-case endpoints at ${Me(e.location)}`);if(e.type==="association"&&(r==="json"||s==="json")&&![0,1,2].includes(e.arrowType))throw Error(`JSON relationship '${e.source.id}' to '${e.target.id}' permits only point, reversed-point, or markerless solid association at ${Me(e.location)}`)}setElementModel(e){if(e.kind==="actor"){let r=e.icon?"icon":e.actorType??"normal";this.model.useCases.delete(e.id),this.model.actors.set(e.id,{id:e.id,label:e.label.text,labelType:e.label.type,type:r,...e.icon?{icon:e.icon}:{},business:e.business??!1,...e.stereotype?{stereotype:e.stereotype}:{},...e.parentId?{parentId:e.parentId}:{},classes:[...e.classes],styles:this.model.actors.get(e.id)?.styles??[]})}else this.model.actors.delete(e.id),this.model.useCases.set(e.id,{id:e.id,label:e.label.text,labelType:e.label.type,shape:e.shape??"ellipse",business:e.business??!1,...e.stereotype?{stereotype:e.stereotype}:{},...e.parentId?{parentId:e.parentId}:{},classes:[...e.classes],styles:this.model.useCases.get(e.id)?.styles??[]})}inferMetadataKind(e){let r=new Set(["actor","usecase","boundary","edge"]);for(let s of e.properties)if(s.key==="icon")r.clear(),r.add("actor");else if(s.key==="animate"||s.key==="animation")r.clear(),r.add("edge");else if(s.key==="type"){if(r.clear(),s.value==="rect"||s.value==="package")r.add("boundary");else if(s.value==="normal"||s.value==="hollow"||s.value==="awesome")r.add("actor")}else if(s.key==="business")r.delete("boundary"),r.delete("edge");else return;return r.size===1?[...r][0]:void 0}invalidMetadata(e,r,s){throw Error(`Metadata property '${s.key}' is invalid for ${r} '${e}' at ${Me(s.location)}`)}registerUnique(e,r,s,n,i){let o=e.get(r);if(o)this.conflict(`ID '${r}' is declared more than once (${o.kind} and ${s})`,n,o.location,void 0,ur(o));e.set(r,{kind:s,location:n,generated:i})}recordFirst(e,r,s){let n=e.get(r);if(n===void 0||s<n)e.set(r,s)}conflict(e,r,s,n,i){throw Error(`${e} at ${Me(r)}${mu(n)}; previous declaration at ${Me(s)}${mu(i)}`)}},YA=Ls.getBaseCstVisitorConstructor(),XA=class extends YA{constructor(){super();this.builder=new HA(Hn),this.source="",this.anonymousEdge=0,this.anonymousNote=0,this.validateVisitor()}static{t(this,"UsecaseVisitor")}build(e,r){this.source=r,this.parentBoundary=void 0,this.anonymousEdge=0,this.anonymousNote=0,this.builder.reset(r),this.visit(e)}start(e){let r=this.tokens(e,"USECASE")[0],s=[];for(let n of this.nodes(e,"line"))s.push(this.visit(n));this.builder.setStatements(s),this.builder.finalize(this.tokenSpan(r))}line(e){let r=this.firstNode(e,"blankLine","commentLine","statement");return this.wrap(r,this.visit(r))}statement(e){return this.visit(this.firstNode(e,"accTitleStatement","accDescrStatement","directionStatement","actorStatement","systemBoundaryStatement","noteStatement","jsonStatement","classDefStatement","classStatement","styleStatement","metadataAssignmentStatement","entityStatement"))}lineEnd(e){return}blankLine(e){return{kind:"blank",span:this.tokenSpan(this.tokens(e,"NEWLINE")[0])}}commentLine(e){return{kind:"comment",span:this.tokenSpan(this.tokens(e,"COMMENT")[0])}}accTitleStatement(e){let r=this.tokens(e,"ACC_TITLE_LINE")[0].image;return this.builder.setAccTitle(r.slice(r.indexOf(":")+1).trim()),{kind:"accTitle",span:[0,0]}}accDescrStatement(e){let r=this.tokens(e,"ACC_DESCR_LINE")[0],s=this.tokens(e,"ACC_DESCR_BLOCK")[0],n=r?r.image.slice(r.image.indexOf(":")+1).trim():s.image.slice(s.image.indexOf("{")+1,s.image.lastIndexOf("}")).trim();return this.builder.setAccDescription(n),{kind:"accDescr",span:[0,0]}}actorStatement(e){let r=this.nodes(e,"actorItem"),s=r.map((a)=>this.visit(a)),n=this.nodes(e,"relationTail")[0],i=s.map((a,f)=>this.actorOccurrence(r[f],a,!0));for(let a of s)this.builder.addElement(this.actorDraft(a));if(!n)return{kind:"node",span:[0,0],nodes:i};let o=this.visit(n);if(o.target.explicitDeclaration)this.builder.addElement(this.entityDraft(o.target));let c=this.relationshipDraft(s[0],o,this.nodeLocation(n));this.builder.addRelationship(c);let u=c.explicitId??`edge-${this.anonymousEdge++}`;return i.push(this.entityOccurrence(this.nodes(n.children,"entityName")[0],o.target,o.target.explicitDeclaration)),{kind:"edge",span:[0,0],nodes:i,edges:[{id:u,span:[0,0],...c.explicitIdLocation?{idSpan:c.explicitIdLocation.span}:{},...c.label?{labelSpan:c.label.span}:{}}]}}actorItem(e){let r=this.visit(this.nodes(e,"actorName")[0]),s=this.nodes(e,"metadata")[0],n=this.nodes(e,"stereotype")[0],i=this.nodes(e,"classSuffix")[0],o=i?this.visit(i):{classes:[],spans:[]};return{...r,...s?{metadata:this.visit(s)}:{},...n?{stereotype:this.visit(n)}:{},classes:o.classes,classSpans:o.spans}}actorName(e){let r=this.tokens(e,"IDENTIFIER")[0],s=this.tokens(e,"PLAIN_STRING")[0]??this.tokens(e,"MARKDOWN_STRING")[0];if(r){let i=this.nodes(e,"nodeLabel")[0],o=i?this.visit(i):this.tokenLabel(r);return{id:r.image,label:o,location:this.tokenLocation(r),generated:!1,classes:[],classSpans:[]}}let n=this.tokenLabel(s);return{id:this.generateId(n.text),label:n,location:this.tokenLocation(s),generated:!0,classes:[],classSpans:[]}}actorDeclarationOnly(e){let r=this.nodes(e,"actorItem"),s=r.map((n)=>this.visit(n));for(let n of s)this.builder.addElement(this.actorDraft(n));return{kind:"node",span:[0,0],nodes:s.map((n,i)=>this.actorOccurrence(r[i],n,!0))}}entityStatement(e){let r=this.nodes(e,"entityName"),s=this.visit(r[0]),n=this.nodes(e,"relationTail")[0];if(!n)return s.explicitDeclaration=!0,s.shape??="ellipse",this.builder.addElement(this.entityDraft(s)),{kind:"node",span:[0,0],nodes:[this.entityOccurrence(r[0],s,!0)]};if(s.explicitDeclaration)this.builder.addElement(this.entityDraft(s));let i=this.visit(n);if(i.target.explicitDeclaration)this.builder.addElement(this.entityDraft(i.target));let o={source:this.endpoint(s),target:this.endpoint(i.target),location:this.nodeLocation(n),...i.explicitId?{explicitId:i.explicitId,explicitIdLocation:i.explicitIdLocation}:{},...i.arrow};this.builder.addRelationship(o);let c=o.explicitId??`edge-${this.anonymousEdge++}`;return{kind:"edge",span:[0,0],nodes:[this.entityOccurrence(r[0],s,s.explicitDeclaration),this.entityOccurrence(this.nodes(n.children,"entityName")[0],i.target,i.target.explicitDeclaration)],edges:[{id:c,span:[0,0],...o.explicitIdLocation?{idSpan:o.explicitIdLocation.span}:{},...o.label?{labelSpan:o.label.span}:{}}]}}entityName(e){let r=this.tokens(e,"IDENTIFIER")[0],s=this.tokens(e,"PLAIN_STRING")[0]??this.tokens(e,"MARKDOWN_STRING")[0],n=this.nodes(e,"nodeLabel")[0],i=this.nodes(e,"useCaseMetadata")[0],o=this.nodes(e,"stereotype")[0],c=this.nodes(e,"classSuffix")[0],u=c?this.visit(c):{classes:[],spans:[]};if(r){let f=n?this.visit(n):this.tokenLabel(r),h=n?this.tokens(e,"LBRACKET").length?"rect":"ellipse":void 0;return{id:r.image,label:f,location:this.tokenLocation(r),generated:!1,...h?{shape:h}:{},...i?{metadata:this.visit(i)}:{},...o?{stereotype:this.visit(o)}:{},classes:u.classes,classSpans:u.spans,explicitDeclaration:Boolean(h||i||o)}}let a=this.tokenLabel(s);return{id:this.generateId(a.text),label:a,location:this.tokenLocation(s),generated:!0,...i?{metadata:this.visit(i)}:{},...o?{stereotype:this.visit(o)}:{},classes:u.classes,classSpans:u.spans,explicitDeclaration:Boolean(i||o)}}nodeLabel(e){let r=this.allTokens(e);if(r.length===1&&(r[0].tokenType.name==="PLAIN_STRING"||r[0].tokenType.name==="MARKDOWN_STRING"))return this.tokenLabel(r[0]);let s=[r[0].startOffset,(r.at(-1).endOffset??r.at(-1).startOffset)+1];return{text:this.source.slice(s[0],s[1]),type:"text",span:s}}useCaseMetadata(e){return this.visit(this.nodes(e,"metadata")[0])}relationTail(e){let r=this.tokens(e,"IDENTIFIER")[0];return{...r?{explicitId:r.image,explicitIdLocation:this.tokenLocation(r)}:{},arrow:this.visit(this.nodes(e,"arrow")[0]),target:this.visit(this.nodes(e,"entityName")[0])}}arrow(e){return this.visit(this.firstNode(e,"semanticRelation","forwardSolidOperator","backwardSolidOperator","markerlessSolidOperator","forwardCircleOperator","backwardCircleOperator","forwardCrossOperator","backwardCrossOperator"))}edgeLabel(e){return this.nodeLabel(e)}semanticRelation(e){if(this.tokens(e,"GENERALIZATION").length)return{type:"generalization",arrowType:ae.SOLID_ARROW,minlen:1};let r=this.tokens(e,"INCLUDE").length?"include":"extend",s=this.tokens(e,r==="include"?"INCLUDE":"EXTEND")[0];return{type:r,arrowType:ae.SOLID_ARROW,label:{text:r,type:"text",span:this.tokenSpan(s)},minlen:1}}metadata(e){return{properties:this.nodes(e,"metadataProperty").map((r)=>this.visit(r)),location:this.ctxLocation(e)}}metadataProperty(e){let r=this.allTokens(e).filter((c)=>c.tokenType.name!=="COLON"),s=r[0],n=r[1],i=n.tokenType.name==="TRUE"?!0:n.tokenType.name==="FALSE"?!1:this.decodePlain(n),o=[s.startOffset,(n.endOffset??n.startOffset)+1];return{key:this.decodePlain(s),value:i,span:o,keySpan:this.contentSpan(s),valueSpan:this.contentSpan(n),location:this.tokenLocation(s)}}metadataSeparator(e){return}systemBoundaryStatement(e){let r=this.visit(this.nodes(e,"systemBoundaryName")[0]),s=this.nodes(e,"classSuffix")[0],n=s?this.visit(s):{classes:[],spans:[]};r.classes=n.classes,this.builder.addBoundary(r);let i=this.parentBoundary;this.parentBoundary={id:r.id,location:r.location};let o=this.nodes(e,"systemBoundaryContent")[0],c=o?this.visit(o):[];this.parentBoundary=i;let u=this.tokens(e,"END")[0],a=this.nodes(e,"metadata")[0],f=a?this.visit(a):void 0,h={kind:"group",span:[0,0],group:r.id,idSpan:r.location.span,titleSpan:r.label.span,endSpan:this.tokenSpan(u),classSpans:n.spans,...f?{metadata:f.properties.map(({key:d,span:p,keySpan:T,valueSpan:I})=>({key:d,span:p,keySpan:T,valueSpan:I}))}:{},...c.length?{children:c}:{}};if(f)this.builder.addMetadataAssignment(r.id,r.location,f,h);return h}systemBoundaryName(e){let r=this.tokens(e,"IDENTIFIER")[0];if(r){let i=this.nodes(e,"nodeLabel")[0];return{id:r.image,label:i?this.visit(i):this.tokenLabel(r),location:this.tokenLocation(r),generated:!1,classes:[]}}let s=this.tokens(e,"PLAIN_STRING")[0]??this.tokens(e,"MARKDOWN_STRING")[0],n=this.tokenLabel(s);return{id:this.generateId(n.text),label:n,location:this.tokenLocation(s),generated:!0,classes:[]}}systemBoundaryContent(e){return[...this.nodes(e,"blankLine"),...this.nodes(e,"commentLine"),...this.nodes(e,"boundaryElement")].sort((s,n)=>(s.location?.startOffset??0)-(n.location?.startOffset??0)).map((s)=>this.wrap(s,this.visit(s)))}boundaryElement(e){let r=this.nodes(e,"actorDeclarationOnly")[0];if(r)return this.visit(r);let s=this.nodes(e,"entityName")[0],n=this.visit(s);return n.explicitDeclaration=!0,n.shape??="ellipse",this.builder.addElement(this.entityDraft(n)),{kind:"node",span:[0,0],nodes:[this.entityOccurrence(s,n,!0)]}}metadataAssignmentStatement(e){let r=this.visit(this.nodes(e,"metadataAssignmentTarget")[0]),s=this.visit(this.nodes(e,"metadata")[0]),n={kind:"metadata",span:[0,0],nodes:[{id:r.id,span:r.location.span,idSpan:r.location.span}],metadata:s.properties.map(({key:i,span:o,keySpan:c,valueSpan:u})=>({key:i,span:o,keySpan:c,valueSpan:u}))};return this.builder.addMetadataAssignment(r.id,r.location,s,n),n}metadataAssignmentTarget(e){let r=this.allTokens(e)[0],s=this.tokenLabel(r);return{id:r.tokenType.name==="IDENTIFIER"?r.image:this.generateId(s.text),location:this.tokenLocation(r)}}noteStatement(e){let r=this.tokens(e,"IDENTIFIER")[0],s=this.visit(this.nodes(e,"nodeLabel")[0]);return this.builder.addNote({target:r.image,targetLocation:this.tokenLocation(r),label:s,location:this.ctxLocation(e)}),{kind:"note",span:[0,0],ref:`note-${this.anonymousNote++}`,refSpan:s.span,nodes:[{id:r.image,span:this.tokenSpan(r),idSpan:this.tokenSpan(r)}]}}stereotype(e){let r=this.tokens(e,"STEREOTYPE_TEXT")[0];return{value:r.image.trim(),span:this.tokenSpan(r)}}classSuffix(e){let r=this.tokens(e,"IDENTIFIER");return{classes:r.map((s)=>s.image),spans:r.map((s)=>this.tokenSpan(s))}}jsonStatement(e){let r=this.tokens(e,"JSON_DECLARATION_START")[0],s=this.tokens(e,"JSON_OBJECT_LITERAL")[0],n=/^json[\t ]+(\w+)/.exec(r.image),i=n[1],o=n[0].length-i.length,c={span:[r.startOffset+o,r.startOffset+o+i.length],line:r.startLine??1,column:(r.startColumn??1)+o},u=cf(s.image,s.startLine??1,s.startColumn??1),a=this.nodes(e,"classSuffix")[0],f=a?this.visit(a):{classes:[],spans:[]},h={id:i,value:u.value,propertyOrder:u.propertyOrder,location:c,classes:f.classes};return this.builder.addJson(h),{kind:"json",span:[0,0],nodes:[{id:i,span:c.span,idSpan:c.span,defines:!0,classSpans:f.spans}],classSpans:f.spans}}directionStatement(e){let r=this.allTokens(e).find((s)=>["TD","TB","BT","RL","LR"].includes(s.tokenType.name));return this.builder.setDirection(r.image),{kind:"direction",span:[0,0]}}classDefStatement(e){let r=this.tokens(e,"IDENTIFIER"),s=this.visit(this.nodes(e,"styles")[0]);return this.builder.addClassDef(r.map((n)=>n.image),s),{kind:"classDef",span:[0,0],ref:r[0].image,refSpan:this.tokenSpan(r[0])}}classStatement(e){let r=this.tokens(e,"IDENTIFIER"),s=1;for(;s<r.length;s++)if(!this.source.slice((r[s-1].endOffset??r[s-1].startOffset)+1,r[s].startOffset).includes(","))break;let n=r.slice(0,s).map((o)=>({id:o.image,location:this.tokenLocation(o)})),i=r.slice(s).map((o)=>o.image);return this.builder.addClassAssignment(n,i),{kind:"classAssign",span:[0,0],ref:i[0],refSpan:this.tokenSpan(r[s]),nodes:n.map(({id:o,location:c})=>({id:o,span:c.span,idSpan:c.span}))}}styleStatement(e){let r=this.tokens(e,"IDENTIFIER")[0],s=this.visit(this.nodes(e,"styles")[0]);return this.builder.addStyleAssignment(r.image,this.tokenLocation(r),s),{kind:"style",span:[0,0],nodes:[{id:r.image,span:this.tokenSpan(r),idSpan:this.tokenSpan(r)}]}}styles(e){return this.nodes(e,"styleValue").map((r)=>this.visit(r))}styleValue(e){let r=this.allTokens(e),s=[r[0].startOffset,(r.at(-1).endOffset??r.at(-1).startOffset)+1];return this.source.slice(s[0],s[1]).replaceAll("\\,",",")}styleComponent(e){return this.allTokens(e).map((r)=>r.image).join("")}forwardSolidOperator(e){let r=this.tokens(e,"FORWARD_SOLID")[0];return{type:"association",arrowType:ae.SOLID_ARROW,minlen:this.solidMinlen(r)}}backwardSolidOperator(e){let r=this.tokens(e,"BACKWARD_SOLID")[0],s=this.nodes(e,"edgeLabel")[0],n=s?this.tokens(e,"MARKERLESS_SOLID").at(-1):r;return{type:"association",arrowType:ae.BACK_ARROW,minlen:this.solidMinlen(n),...s?{label:this.visit(s)}:{}}}markerlessSolidOperator(e){let r=this.nodes(e,"edgeLabel")[0],s=this.allTokens(e);if(!r)return{type:"association",arrowType:ae.LINE_SOLID,minlen:this.solidMinlen(this.tokens(e,"MARKERLESS_SOLID")[0])};let n=s.at(-1),i=n.tokenType.name==="FORWARD_SOLID"?ae.SOLID_ARROW:n.tokenType.name==="FORWARD_CIRCLE"?ae.CIRCLE_ARROW:n.tokenType.name==="FORWARD_CROSS"?ae.CROSS_ARROW:ae.LINE_SOLID;return{type:"association",arrowType:i,label:this.visit(r),minlen:i===ae.SOLID_ARROW||i===ae.LINE_SOLID?this.solidMinlen(n):1}}forwardCircleOperator(e){return{type:"association",arrowType:ae.CIRCLE_ARROW,minlen:1}}backwardCircleOperator(e){let r=this.nodes(e,"edgeLabel")[0];return{type:"association",arrowType:ae.CIRCLE_ARROW_REVERSED,minlen:1,...r?{label:this.visit(r)}:{}}}forwardCrossOperator(e){return{type:"association",arrowType:ae.CROSS_ARROW,minlen:1}}backwardCrossOperator(e){let r=this.nodes(e,"edgeLabel")[0];return{type:"association",arrowType:ae.CROSS_ARROW_REVERSED,minlen:1,...r?{label:this.visit(r)}:{}}}actorDraft(e){return{id:e.id,kind:"actor",label:e.label,location:e.location,generated:e.generated,...this.parentBoundary?{parentId:this.parentBoundary.id,parentLocation:this.parentBoundary.location}:{},...e.metadata?{metadata:e.metadata}:{},...e.stereotype?{stereotype:e.stereotype.value,stereotypeSpan:e.stereotype.span}:{},classes:e.classes}}entityDraft(e){return{id:e.id,kind:"usecase",label:e.label,location:e.location,generated:e.generated,...this.parentBoundary?{parentId:this.parentBoundary.id,parentLocation:this.parentBoundary.location}:{},...e.shape?{shape:e.shape}:{},...e.metadata?{metadata:e.metadata}:{},...e.stereotype?{stereotype:e.stereotype.value,stereotypeSpan:e.stereotype.span}:{},classes:e.classes}}endpoint(e,r=e.explicitDeclaration??!0){return{id:e.id,label:e.label,location:e.location,generated:e.generated,declaration:r,classesOnReference:e.classes.length>0}}relationshipDraft(e,r,s){return{source:this.endpoint(e,!0),target:this.endpoint(r.target),location:s,...r.explicitId?{explicitId:r.explicitId,explicitIdLocation:r.explicitIdLocation}:{},...r.arrow}}actorOccurrence(e,r,s){return{id:r.id,span:this.nodeSpan(e),idSpan:r.location.span,labelSpan:r.label.span,...s?{defines:!0}:{},...r.stereotype?{stereotypeSpan:r.stereotype.span}:{},...r.metadata?{metadata:r.metadata.properties.map(({key:n,span:i,keySpan:o,valueSpan:c})=>({key:n,span:i,keySpan:o,valueSpan:c}))}:{},...r.classSpans.length?{classSpans:r.classSpans}:{}}}entityOccurrence(e,r,s){return this.actorOccurrence(e,r,s)}wrap(e,r){if(r.kind==="blank"||r.kind==="comment")return r;r.span=this.nodeSpan(e);for(let s of r.edges??[])s.span=r.span;return r}tokenLabel(e){let r=e.tokenType.name==="MARKDOWN_STRING"?"markdown":"text",s=r==="markdown"?2:e.tokenType.name==="PLAIN_STRING"?1:0,n=this.tokenSpan(e,s);return{text:this.source.slice(n[0],n[1]),type:r,span:n}}decodePlain(e){return e.tokenType.name==="PLAIN_STRING"?e.image.slice(1,-1):e.image}contentSpan(e){return this.tokenSpan(e,e.tokenType.name==="PLAIN_STRING"?1:e.tokenType.name==="MARKDOWN_STRING"?2:0)}generateId(e){return e.replace(/\W/g,"_")}solidMinlen(e){return Math.max(1,(e.image.match(/-/g)?.length??2)-1)}nodeLocation(e){let r=this.allTokens(e.children)[0];return{span:this.nodeSpan(e),line:r.startLine??1,column:r.startColumn??1}}ctxLocation(e){let r=this.allTokens(e).filter((i)=>i.tokenType.name!=="NEWLINE"&&i.tokenType.name!=="EOF"),s=r[0],n=r.at(-1);return{span:[s.startOffset,Math.min(this.source.length,(n.endOffset??n.startOffset+n.image.length-1)+1)],line:s.startLine??1,column:s.startColumn??1}}tokenLocation(e){let r=e.tokenType.name==="PLAIN_STRING"?1:e.tokenType.name==="MARKDOWN_STRING"?2:0;return{span:this.tokenSpan(e,r),line:e.startLine??1,column:(e.startColumn??1)+r}}nodeSpan(e){let r=this.allTokens(e.children).filter((i)=>i.tokenType.name!=="NEWLINE"&&i.tokenType.name!=="EOF"),s=r[0],n=r.at(-1);if(!s||!n)throw Error("Usecase CST node has no source token");return[s.startOffset,Math.min(this.source.length,(n.endOffset??n.startOffset+n.image.length-1)+1)]}tokenSpan(e,r=0){return[e.startOffset+r,Math.min(this.source.length,(e.endOffset??e.startOffset+e.image.length-1)+1-r)]}nodes(e,r){return(e[r]??[]).filter((s)=>("children"in s))}tokens(e,r){return(e[r]??[]).filter((s)=>("tokenTypeIdx"in s))}firstNode(e,...r){for(let s of r){let n=this.nodes(e,s)[0];if(n)return n}throw Error(`Usecase CST is missing one of: ${r.join(", ")}`)}allTokens(e){let r=[];for(let s of Object.values(e))for(let n of s)if("tokenTypeIdx"in n)r.push(n);else r.push(...this.allTokens(n.children));return r.sort((s,n)=>s.startOffset-n.startOffset)}},qA=new XA,JA={parse:t(async(e)=>{Hn.clear(),Ls.input=[];try{yu({diagramType:"usecase",lexer:UA,parser:Ls,entry:t(()=>Ls.start(),"entry"),visit:t((r)=>qA.build(r,e),"visit")},e)}catch(r){Hn.clear();let s=Ls.errors[0];if(s){let{token:n}=s,i=Number.isFinite(n.startOffset)?n.startOffset:e.length,o=typeof n.endOffset==="number"&&Number.isFinite(n.endOffset)?n.endOffset+1:i,c=n.startLine??e.slice(0,i).split(/\r\n|\r|\n/).length,u=Math.max(e.lastIndexOf(`
|
|
117
|
+
`,i-1),e.lastIndexOf("\r",i-1)),a=n.startColumn??i-u,f=r instanceof Error?r.message:String(r);throw Error(`${f} at line ${c}, column ${a} [${i},${o})`)}throw r}},"parse")},ZA=["point","circle","cross","extension"],uf={usecaseActor:!0,usecaseActorHollow:!0,usecaseActorAwesome:!0,usecaseActorIcon:!0},gu=t((e,r)=>{let[s,n]=[e,r].map((i)=>i.replace(/[^\w-]+/g,"_").replace(/^_+|_+$/g,"")||"element");return`usecase-${s}-${n}`},"usecaseDomId"),QA=t((e)=>`usecase-${e.replace(/[^\w-]+/g,"_").replace(/^_+|_+$/g,"")||"element"}`,"usecaseNodeDomId"),Yn=t((e,r)=>{if(r!=="markdown")return e;return Mm(e).map((s)=>s.map((n)=>n.content).join(" ")).join(`
|
|
118
|
+
`)},"getAccessibleLabel"),ex=t((e)=>{let r=Yn(e.label??e.id,e.labelType);if(uf[e.shape]){let n=e.actorType&&e.actorType!=="normal"?`${e.actorType} `:"",i=e.business?"business ":"",o=e.stereotype?`, stereotype ${e.stereotype}`:"";return`${i}${n}actor ${r}${o}`}if(e.shape==="note")return`Note for ${e.noteTargetLabel??e.noteTarget??""}: ${r}`;if(e.shape==="usecaseJsonTable"){let n=(e.jsonRows??[]).map((i)=>`${i.accessibleKey}: ${i.value}`).join("; ");return n?`${r}: ${n}`:r}let s=e.stereotype?`, stereotype ${e.stereotype}`:"";return`${e.business?"business ":""}use case ${r}${s}`},"getUsecaseNodeAccessibleName"),tx=t((e)=>`${e.boundaryType} system boundary ${Yn(e.label??e.id,e.labelType)}`,"getUsecaseBoundaryAccessibleName"),rx=t((e)=>{if(e.relationshipType==="note")return"";return`${e.relationshipType==="association"&&e.label?`association ${Yn(e.label,e.labelType)}`:e.relationshipType} from ${e.sourceLabel} to ${e.targetLabel}`},"getUsecaseEdgeAccessibleName"),Vr=t((e)=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),"escapePlainLabel"),Tu=t((e)=>e.replace(/([*[\\\]_`])/g,"\\$1"),"escapeMarkdownMarkers"),sx=t((e,r)=>{e.diagramId=r,e.markers=[...ZA];for(let s of e.nodes){let n=s;if(n.domId=QA(s.id),s.label!==void 0&&s.labelType==="text")s.label=Vr(s.label);if(s.stereotype)s.stereotype=Vr(s.stereotype);if(!s.isGroup&&s.shape==="usecaseJsonTable")s.jsonRows=s.jsonRows?.map((i)=>({...i,key:Vr(i.key),value:Vr(i.value)}));if(!s.isGroup&&(s.shape==="usecaseEllipse"||s.shape==="rect")&&s.stereotype){let i=s.label??Vr(s.id);s.label=`«${Tu(s.stereotype)}»<br/>${s.labelType==="text"?Tu(i):i}`,s.labelType="markdown",n.hasFoldedStereotype=!0,delete s.stereotype}}for(let s of e.edges)if(s.label!==void 0&&s.labelType==="text")s.label=Vr(s.label);return e},"prepareUsecaseLayoutData"),nx=t((e,r,s)=>{for(let i of r.nodes){let o=typeof i.domId==="string"?i.domId:gu(r.diagramId,i.id),c=e.select(`#${o}`),u=i.isGroup?"boundary":uf[i.shape]?"actor":i.shape==="note"?"note":i.shape==="usecaseJsonTable"?"json":"usecase",a=s.nodes.get(i.id)??i.id;if(c.attr("data-usecase-id",i.id).attr("data-usecase-kind",u).attr("role","img").attr("aria-label",a),!i.isGroup&&(i.shape==="usecaseEllipse"||i.shape==="rect")&&"hasFoldedStereotype"in i&&i.hasFoldedStereotype===!0){let f=c.node(),h=f?.querySelector(".nodeLabel"),d=h?.querySelector("p")??h,p=d?.firstChild;if(d&&p?.nodeType===3){let T=d.ownerDocument.createElement("span");T.className="usecase-stereotype",d.insertBefore(T,p),T.appendChild(p)}else f?.querySelector(".label tspan tspan, .label tspan")?.classList.add("usecase-stereotype")}}let n=new Map(r.edges.map((i)=>[i.id,i]));e.selectAll('path[data-et="edge"]').each(function(){let i=n.get(this.getAttribute("data-id")??"");if(!i)return;let o=b(this);if(o.attr("id",gu(r.diagramId,i.id)).attr("data-usecase-id",i.id).attr("data-usecase-kind",i.internal?"note-connector":"relationship"),i.internal)o.attr("aria-hidden","true");else o.attr("role","img").attr("aria-label",s.edges.get(i.id)??i.id)})},"annotateUsecaseElements"),Eu=t((e,r)=>{e.style("--mermaid-usecase-actor-font-size",`${r.actorFontSize}px`).style("--mermaid-usecase-actor-font-family",r.actorFontFamily).style("--mermaid-usecase-actor-font-weight",r.actorFontWeight).style("--mermaid-usecase-font-size",`${r.usecaseFontSize}px`).style("--mermaid-usecase-font-family",r.usecaseFontFamily).style("--mermaid-usecase-font-weight",r.usecaseFontWeight)},"applyUsecaseFonts"),ix=t(async(e,r,s,n)=>{l.info("Drawing usecase diagram (unified)",r);let{layout:i}=m(),o=n.db,c=o.getData(),u=new Map(c.nodes.map((d)=>[d.id,Yn(d.label??d.id,d.labelType)])),a={nodes:new Map(c.nodes.map((d)=>[d.id,d.isGroup?tx(d):ex(d.shape==="note"?{...d,noteTargetLabel:u.get(d.noteTarget??"")}:d)])),edges:new Map(c.edges.map((d)=>[d.id,rx({...d,sourceLabel:u.get(d.source)??d.sourceLabel,targetLabel:u.get(d.target)??d.targetLabel})]))},f=Gt(r,c.config.securityLevel);c.layoutAlgorithm=Ut(i),sx(c,r),Eu(f,c),await zt(c,f),nx(f,c,a);let h=c.diagramPadding;V.insertTitle(f,"usecaseDiagramTitleText",0,o.getDiagramTitle?.()??""),Ct(f,h,"usecaseDiagram",c.useMaxWidth),Eu(f,c)},"draw"),ox={draw:ix},ax=t((e)=>({actorBkg:e.usecaseActorBkg??e.actorBkg??e.mainBkg,actorBorder:e.usecaseActorBorder??e.actorBorder??e.primaryColor,bkg:e.usecaseBkg??e.mainBkg,border:e.usecaseBorder??e.nodeBorder??e.primaryColor,boundaryBkg:e.usecaseBoundaryBkg??e.clusterBkg,boundaryBorder:e.usecaseBoundaryBorder??e.clusterBorder,includeLine:e.usecaseIncludeLine??e.lineColor,extendLine:e.usecaseExtendLine??e.lineColor}),"roleColors"),lx=t((e)=>{let{theme:r,bkgColorArray:s,borderColorArray:n}=e;if(!mt(r,n))return"";let i=C().usecase?.colorScheme==="rotate",o=ft(e.look),c=o==="handDrawn",u=wt(s),a="";for(let f=0;f<sa(n);f++){let h=n[f],d=u?`fill: ${s[f%s.length]};`:"",p=`[data-look="${o}"][data-color-id="color-${f}"]`;if(a+=`
|
|
119
119
|
|
|
120
120
|
& ${p}.system-boundary rect.boundary-body,
|
|
121
121
|
& ${p}.system-boundary rect.boundary-tab,
|
|
@@ -174,7 +174,7 @@ ${c?"":`
|
|
|
174
174
|
stroke: ${h};
|
|
175
175
|
}
|
|
176
176
|
`}
|
|
177
|
-
`}return a},"genColor");var cx=t((e)=>{let r=ax(e),s=
|
|
177
|
+
`}return a},"genColor");var cx=t((e)=>{let r=ax(e),s=ft(e.look)==="handDrawn";return`
|
|
178
178
|
${lx(e)}
|
|
179
179
|
& .usecase-actor {
|
|
180
180
|
color: ${e.actorTextColor??e.primaryTextColor};
|
|
@@ -235,15 +235,15 @@ ${s?"":`
|
|
|
235
235
|
tie with it -- on a tie the later stylesheet would win, which is how neo took this in
|
|
236
236
|
the first place. Skipped under handDrawn, where roughjs draws paths and neither element
|
|
237
237
|
exists. */
|
|
238
|
-
& [data-look="${
|
|
239
|
-
& [data-look="${
|
|
238
|
+
& [data-look="${ft(e.look)}"].node.usecase-element ellipse,
|
|
239
|
+
& [data-look="${ft(e.look)}"].node.usecase-element rect {
|
|
240
240
|
fill: ${r.bkg};
|
|
241
241
|
stroke: ${r.border};
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
/* The business marker is a \`<path>\`, so it loses to \`[data-look="neo"].node path\` the same
|
|
245
245
|
way. No \`fill\`: the marker is drawn with \`fill="none"\` and has to stay that way. */
|
|
246
|
-
& [data-look="${
|
|
246
|
+
& [data-look="${ft(e.look)}"].node.usecase-element .usecase-business-marker {
|
|
247
247
|
stroke: ${r.border};
|
|
248
248
|
}
|
|
249
249
|
`}
|