@kabmo-labs/kabmo 0.32.1 → 0.33.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 +542 -535
- package/dist/client/static/js/{CsvGrid-4gx0jevc.js → CsvGrid-fncjbg6j.js} +2 -2
- package/dist/client/static/js/{DocxView-0667nr8h.js → DocxView-c9v2vr3r.js} +2 -2
- package/dist/client/static/js/{DrawioView-522v0d0r.js → DrawioView-vxjksm12.js} +2 -2
- package/dist/client/static/js/{ImageView-t8xp60hm.js → ImageView-a3g5k226.js} +1 -1
- package/dist/client/static/js/LayoutWrapper-hnjfwsjh.js +2 -0
- package/dist/client/static/js/Modal-qtftcp2t.js +38 -0
- package/dist/client/static/js/{PdfView-3fx172xh.js → PdfView-ksaes53y.js} +1 -1
- package/dist/client/static/js/{SessionsView-n3agmf5t.js → SessionsView-30vcr95v.js} +1 -1
- package/dist/client/static/js/{SheetView-nmrdb1b8.js → SheetView-vc484scg.js} +6 -6
- package/dist/client/static/js/{SvgPreview-0xsc6xam.js → SvgPreview-tph89jet.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-jj31rs62.js → abnfDiagram-O67JEVCF-xbar278c.js} +1 -1
- package/dist/client/static/js/architecture-7GRP2DOG-tavtgb8a.js +1 -0
- package/dist/client/static/js/{architectureDiagram-NJMV4G6O-ay3yr7pf.js → architectureDiagram-NJMV4G6O-s171n2z6.js} +3 -3
- package/dist/client/static/js/{astro-qgx1r159.js → astro-80bs6hvg.js} +1 -1
- package/dist/client/static/js/bash-b3rwyg5p.js +1 -0
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-4x33e16k.js → blockDiagram-BEXU5L5S-gzx6rv9n.js} +2 -2
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-dtb81cgz.js → c4Diagram-YGBWAQC7-7f00skch.js} +2 -2
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-vk5a2n9w.js → classDiagram-v2-NBCMYWYE-j79v95nc.js} +4 -4
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-6rbjbe19.js → cose-bilkent-JH36ORCC-5fkn7ee5.js} +1 -1
- package/dist/client/static/js/css-6vj0d308.js +1 -0
- package/dist/client/static/js/cynefin-OW5HDTMX-cdh3n2z2.js +1 -0
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-vyjksedr.js → cynefinDiagram-VND7K2PF-cfs1yvrd.js} +2 -2
- package/dist/client/static/js/{dagre-6A5THRUB-7hey38z5.js → dagre-6A5THRUB-44bgc48p.js} +2 -2
- package/dist/client/static/js/{diagram-22UHCM2B-aes06jde.js → diagram-22UHCM2B-a4g4x83k.js} +14 -14
- package/dist/client/static/js/{diagram-3UASUU5V-3cfkgm3x.js → diagram-3UASUU5V-gm4rg5na.js} +1 -1
- package/dist/client/static/js/{diagram-ATOU4E4O-z8mfhwpy.js → diagram-ATOU4E4O-a95y41vk.js} +3 -3
- package/dist/client/static/js/{diagram-CDSNMT55-t4821ctz.js → diagram-CDSNMT55-t3j93mmc.js} +5 -5
- package/dist/client/static/js/{diagram-MLGK6HIB-23yxbfrx.js → diagram-MLGK6HIB-c2wdez02.js} +1 -1
- package/dist/client/static/js/{diagram-MPIPVDR6-chhtf7v0.js → diagram-MPIPVDR6-gya9jhs5.js} +2 -2
- package/dist/client/static/js/{dockerfile-5b87ghm7.js → dockerfile-a7q6174s.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-9jejcvfr.js → ebnfDiagram-ZINNZB2B-jjhkza6t.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-xhhtkf58.js → elk-276RUBZZ-f7re45mw.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-mt2apjjb.js → erDiagram-OPXOYQCR-tpm9g5te.js} +6 -6
- package/dist/client/static/js/{erlang-6m6tpt72.js → erlang-qt876zrq.js} +1 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-as97tpyp.js +1 -0
- package/dist/client/static/js/flowDiagram-KWPJA3E3-ggm06d12.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-8cm7a29w.js → ganttDiagram-FUAMR5RP-fz43n12d.js} +3 -3
- package/dist/client/static/js/gitGraph-4MIJSDKK-eqz7p9ng.js +1 -0
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-5s0gbnx2.js → gitGraphDiagram-X574FWY7-f61hgbn6.js} +9 -9
- package/dist/client/static/js/graphql-n43pd5fs.js +1 -0
- package/dist/client/static/js/{index-z5s27s26.js → index-03h3bkcf.js} +1 -1
- package/dist/client/static/js/{index-360d7j0d.js → index-0e40xskg.js} +1 -1
- package/dist/client/static/js/{index-z4v1xmh1.js → index-0n5wwe60.js} +2 -2
- package/dist/client/static/js/{index-pf7syd7t.js → index-0tf0arsp.js} +3 -3
- package/dist/client/static/js/{index-fdbfzshx.js → index-14vndmcr.js} +2 -2
- package/dist/client/static/js/{index-7n68yx6m.js → index-1a0zkj8h.js} +2 -2
- package/dist/client/static/js/{index-p7btwjvj.js → index-1xqs14fr.js} +3 -3
- package/dist/client/static/js/{index-brj8qwa6.js → index-1y9r4frb.js} +2 -2
- package/dist/client/static/js/{index-6q80csr0.js → index-2svnq5gg.js} +1 -1
- package/dist/client/static/js/{index-9sd0vjmh.js → index-2x5f66t6.js} +2 -2
- package/dist/client/static/js/{index-dt7e1328.js → index-354mqqra.js} +2 -2
- package/dist/client/static/js/{index-5x95n3hx.js → index-3rcjx70v.js} +1 -1
- package/dist/client/static/js/{index-532btjmp.js → index-3zc1b0dv.js} +2 -2
- package/dist/client/static/js/{index-wzma5n54.js → index-5tgq7aqx.js} +1 -1
- package/dist/client/static/js/{index-xya34x4v.js → index-76zb4m0n.js} +2 -2
- package/dist/client/static/js/{index-2xj14800.js → index-7y6rpsrp.js} +2 -2
- package/dist/client/static/js/{index-h06bcfds.js → index-8239j2v1.js} +1 -1
- package/dist/client/static/js/{index-dq1kdt03.js → index-9fjt5anh.js} +1 -1
- package/dist/client/static/js/{index-ehcpzk5b.js → index-9y3gjdj7.js} +1 -1
- package/dist/client/static/js/{index-sa9cp6km.js → index-ahv9y42z.js} +2 -2
- package/dist/client/static/js/{index-vd0e25p0.js → index-ajs3jj6j.js} +1 -1
- package/dist/client/static/js/{index-qnwqaczk.js → index-apvkd37e.js} +3 -3
- package/dist/client/static/js/index-at6bhjyf.js +1 -0
- package/dist/client/static/js/index-bkye8mz4.js +2 -0
- package/dist/client/static/js/{index-dnp07j57.js → index-d495kfm0.js} +1 -1
- package/dist/client/static/js/{index-gbfg0anm.js → index-dbe6afkf.js} +2 -2
- package/dist/client/static/js/{index-g33knza2.js → index-djmg1d7h.js} +1 -1
- package/dist/client/static/js/{index-629kfbcb.js → index-e4p4cd3r.js} +2 -2
- package/dist/client/static/js/{index-5y7c62sm.js → index-eyzeya95.js} +5 -5
- package/dist/client/static/js/{index-3vhznzgr.js → index-gcs49f3p.js} +1 -1
- package/dist/client/static/js/{index-59jb53v3.js → index-gs6f0qwa.js} +2 -2
- package/dist/client/static/js/{index-7fdp9c7m.js → index-hf52f59k.js} +2 -2
- package/dist/client/static/js/{index-qkscve6n.js → index-j0r5hj0j.js} +2 -2
- package/dist/client/static/js/{index-ay34b398.js → index-js7t1vb1.js} +17 -17
- package/dist/client/static/js/{index-a0bdavdr.js → index-km2zb6wk.js} +2 -2
- package/dist/client/static/js/{index-ye3sr7db.js → index-m73za75e.js} +2 -2
- package/dist/client/static/js/{index-kpspnztv.js → index-pbe4yed4.js} +2 -2
- package/dist/client/static/js/{index-a6k2hqke.js → index-pxv2nw9w.js} +1 -1
- package/dist/client/static/js/{index-jz9fpznk.js → index-q2w6s8n7.js} +5 -5
- package/dist/client/static/js/{index-h7pn9qw6.js → index-qckv9nte.js} +2 -2
- package/dist/client/static/js/{index-a733k69t.js → index-qsm2z36d.js} +2 -2
- package/dist/client/static/js/{index-pf5sbesf.js → index-rytaa8ca.js} +2 -2
- package/dist/client/static/js/{index-c0x6s6f7.js → index-sdtye3jy.js} +2 -2
- package/dist/client/static/js/index-sffjtm5w.js +12 -0
- package/dist/client/static/js/{index-ejgd8w3s.js → index-trm9x02n.js} +28 -28
- package/dist/client/static/js/{index-c93sp4yh.js → index-vw4brsdx.js} +1 -1
- package/dist/client/static/js/{index-hc2jmzpx.js → index-vw5k8csz.js} +46 -46
- package/dist/client/static/js/{index-2gfc25tq.js → index-w0fwb80e.js} +1 -1
- package/dist/client/static/js/{index-bbggh3f8.js → index-ypx3qmhq.js} +2 -2
- package/dist/client/static/js/{index-4s8ttfxj.js → index-zt75xpq0.js} +193 -193
- package/dist/client/static/js/{index-jppt5mgc.js → index-zvfvqvn9.js} +2 -2
- package/dist/client/static/js/info-A6RAGUB7-4pkzh1qx.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-3w1yz32c.js → infoDiagram-VRGFBTTK-1qj804sn.js} +1 -1
- package/dist/client/static/js/ini-j5dyq6gm.js +1 -0
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-ckt471dy.js → ishikawaDiagram-OU5B5YK6-4j4qsnzw.js} +3 -3
- package/dist/client/static/js/java-g4dgwbfd.js +1 -0
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-kfvn4w7e.js → journeyDiagram-ZHPQQLJL-j0brnfft.js} +4 -4
- package/dist/client/static/js/jsx-7t5ecz9s.js +1 -0
- package/dist/client/static/js/{julia-0j0gsjvc.js → julia-4ghmfy3e.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-0q36cm83.js → kanban-definition-PNTS6WVX-qqc22br0.js} +2 -2
- package/dist/client/static/js/lua-1g6w30de.js +1 -0
- package/dist/client/static/js/markdown-afx21x8c.js +1 -0
- package/dist/client/static/js/{mermaid.core-b1ssa824.js → mermaid.core-vv3wbe65.js} +6 -6
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-e2ym5en8.js → mindmap-definition-NLK3R4M7-y5b2z8zp.js} +2 -2
- package/dist/client/static/js/one-dark-pro-hm3f56n1.js +1 -0
- package/dist/client/static/js/one-light-xrz49rct.js +1 -0
- package/dist/client/static/js/packet-AYTQ26CC-yg71sp88.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-t8bbdyhe.js → pegDiagram-GJSIUBJH-0be07mqs.js} +1 -1
- package/dist/client/static/js/{perl-7n7e9ncg.js → perl-sd00t4b4.js} +1 -1
- package/dist/client/static/js/{php-32vy69vd.js → php-2zfyqa61.js} +1 -1
- package/dist/client/static/js/pie-WAS4IAKB-89wd6np0.js +1 -0
- package/dist/client/static/js/{pieDiagram-5QR66LMP-envv4brj.js → pieDiagram-5QR66LMP-544w86jk.js} +2 -2
- package/dist/client/static/js/properties-thd83wey.js +1 -0
- package/dist/client/static/js/python-264ns4xw.js +1 -0
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-72rk137a.js → quadrantDiagram-O4NWA36T-p09e7z5s.js} +4 -4
- package/dist/client/static/js/r-qw82kkv9.js +1 -0
- package/dist/client/static/js/radar-RG4KPBEZ-avn0b8r9.js +1 -0
- package/dist/client/static/js/railroad-74A4TZTK-de27xv5w.js +1 -0
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-rg4zzj7x.js +1 -0
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-d84fhj8v.js +1 -0
- package/dist/client/static/js/railroad-peg-WCYAUIDC-dvf8xrmc.js +1 -0
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-1ej0f5hr.js → railroadDiagram-XR7U4H2S-de830ed2.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-rvdaknpd.js → requirementDiagram-PLB6GJNP-b47d74p1.js} +4 -4
- package/dist/client/static/js/{ruby-5ty7fys7.js → ruby-v9qaqhby.js} +1 -1
- package/dist/client/static/js/{rust-2geezrcs.js → rust-fkt0qyrs.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-nxvhtdaw.js → sankeyDiagram-IPEJSGJF-6ezc2fpj.js} +5 -5
- package/dist/client/static/js/{sass-mey5150f.js → sass-9bxped7y.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-n5cn5qrt.js → sequenceDiagram-PO4LG4MO-by5zqj6w.js} +18 -18
- package/dist/client/static/js/{sizeCapture-INFHLROL-r074kj7s.js → sizeCapture-INFHLROL-q85r06j6.js} +1 -1
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-vxghxdb0.js → stateDiagram-v2-GCMORJYK-ep5pyexs.js} +3 -3
- package/dist/client/static/js/{svelte-3ewx0hzx.js → svelte-mwtx07d9.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-qkkv894p.js → swimlanes-2SLR337P-95fcqkh8.js} +1 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-xs2en5dv.js +8 -0
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-5tbq4ex2.js → timeline-definition-EJHVYXUP-461e615g.js} +2 -2
- package/dist/client/static/js/treeView-Q6P3EWNA-mham0bh6.js +1 -0
- package/dist/client/static/js/treemap-WGGIJYW6-mxrxax86.js +1 -0
- package/dist/client/static/js/tsx-nm94hed6.js +1 -0
- package/dist/client/static/js/typescript-0s2t05jj.js +1 -0
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-6p8hf0b7.js → usecaseDiagram-POWQR4AR-ftqfnvhg.js} +37 -37
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-7k5jsxf9.js → vennDiagram-UO4OBE2U-7t96h6ez.js} +7 -7
- package/dist/client/static/js/{vue-06rdf4wh.js → vue-j8vb9d7r.js} +1 -1
- package/dist/client/static/js/wardley-WFR3VGLG-8vrvh9p3.js +1 -0
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-km2x4er8.js → wardleyDiagram-VNRHLVJA-0de8w8c6.js} +4 -4
- package/dist/client/static/js/xml-dz51p1m3.js +1 -0
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-kr3sgr4m.js → xychartDiagram-PMCCYNJV-dez9phkf.js} +5 -5
- package/dist/client/static/js/yaml-2cfkd30t.js +1 -0
- package/package.json +1 -1
- package/src/client/components/common/context-usage-button/McpSection.test.tsx +98 -0
- package/src/client/components/common/context-usage-button/McpSection.tsx +12 -5
- package/src/client/components/common/context-usage-button/SessionStats.tsx +80 -0
- package/src/client/components/common/context-usage-button/index.test.tsx +26 -0
- package/src/client/components/common/context-usage-button/index.tsx +36 -28
- package/src/client/components/common/harness-glyph/brands.ts +8 -0
- package/src/client/components/mobile/LayoutWrapper.tsx +12 -3
- package/src/client/components/mobile/mobile-right-sidebar/FullDiff.tsx +9 -2
- package/src/client/components/settings/apply-side-effects.test.ts +11 -0
- package/src/client/components/settings/apply-side-effects.ts +7 -0
- package/src/client/components/settings/categories/ChatSettings.test.tsx +1 -1
- package/src/client/components/settings/categories/ChatSettings.tsx +2 -0
- package/src/client/components/settings/categories/NotificationSettings.tsx +1 -1
- package/src/client/components/settings/categories/chat-settings/ChangedFilesSection.tsx +79 -0
- package/src/client/components/settings/categories/chat-settings/groups.ts +4 -3
- package/src/client/components/workspace/chat-timeline/ChangedFilesSummary.tsx +101 -0
- package/src/client/components/workspace/chat-timeline/MessageList.tsx +33 -1
- package/src/client/components/workspace/chat-timeline/RunFooter.tsx +21 -1
- package/src/client/components/workspace/chat-timeline/TimelineBody.tsx +13 -0
- package/src/client/components/workspace/chat-timeline/index.tsx +1 -1
- package/src/client/components/workspace/diff-panel/Toolbar.tsx +17 -51
- package/src/client/components/workspace/diff-panel/index.tsx +23 -4
- package/src/client/components/workspace/diff-panel/toolbar-git-actions.tsx +94 -0
- package/src/client/components/workspace/editor/Body.tsx +2 -0
- package/src/client/data/settings/omp-schema.json +73 -3
- package/src/client/hooks/chat/timeline/changed-files-setting.test.ts +31 -0
- package/src/client/hooks/chat/timeline/changed-files-setting.ts +60 -0
- package/src/client/hooks/chat/timeline/session-changes.ts +51 -0
- package/src/client/hooks/ui/notification-events.test.ts +3 -0
- package/src/client/hooks/ui/notification-events.ts +3 -1
- package/src/client/hooks/ui/notification-sound.ts +13 -6
- package/src/client/hooks/ui/ui-sounds.test.ts +15 -0
- package/src/client/hooks/workspace/diff-file.ts +11 -4
- package/src/client/hooks/workspace/file-tabs.ts +13 -4
- package/src/client/hooks/workspace/journal-diff.ts +97 -0
- package/src/client/lib/notifications/native-banner-sound.test.ts +93 -0
- package/src/client/lib/notifications/native-banner-sound.ts +46 -0
- package/src/client/lib/notifications/os.test.ts +14 -5
- package/src/client/lib/notifications/os.ts +8 -0
- package/src/server/lib/harness/launch-table.ts +10 -0
- package/src/server/lib/omp/session/changes.test.ts +138 -0
- package/src/server/lib/omp/session/changes.ts +220 -0
- package/src/server/lib/omp/session/session-discovery.test.ts +4 -4
- package/src/server/lib/omp/session/sidebar-activity.server.test.ts +6 -2
- package/src/server/lib/omp/session/subagent-presence-scan.ts +54 -0
- package/src/server/lib/omp/session/subagent-presence-store.test.ts +1 -1
- package/src/server/lib/omp/session/subagent-presence.test.ts +115 -0
- package/src/server/lib/omp/session/subagent-presence.ts +12 -3
- package/src/server/lib/omp/session/telemetry/compute.ts +68 -0
- package/src/server/lib/omp/session/telemetry.test.ts +81 -0
- package/src/server/routes/sessions/changes.test.ts +90 -0
- package/src/server/routes/sessions/changes.ts +55 -0
- package/src/server/routes/sessions/index.ts +6 -0
- package/src/shared/lib/chat/duration.ts +34 -0
- package/src/shared/lib/chat/timeline/changed-files.test.ts +121 -0
- package/src/shared/lib/chat/timeline/changed-files.ts +71 -0
- package/src/shared/lib/chat/timeline/fork-anchor.test.ts +3 -0
- package/src/shared/lib/format/duration.test.ts +31 -0
- package/src/shared/lib/format/duration.ts +27 -0
- package/src/shared/lib/fs/unified-diff.test.ts +53 -0
- package/src/shared/lib/fs/unified-diff.ts +127 -0
- package/src/shared/lib/harness/brand-color.ts +3 -0
- package/src/shared/lib/harness/catalog.test.ts +13 -0
- package/src/shared/lib/harness/catalog.ts +8 -1
- package/src/shared/lib/harness/fork.ts +4 -2
- package/src/shared/lib/harness/mcp-facts.ts +3 -0
- package/src/shared/lib/harness/provider-facts.ts +14 -0
- package/src/shared/lib/harness/updates.ts +5 -0
- package/src/shared/lib/icons/tint-hues.generated.ts +27 -27
- package/src/shared/lib/omp/config/schema.test.ts +4 -2
- package/src/shared/lib/settings/defaults.ts +1 -0
- package/src/shared/lib/workspace/file-tab-id.ts +9 -0
- package/src/shared/types/context.ts +18 -0
- package/src/shared/types/fs.ts +21 -0
- package/src/shared/types/index.ts +1 -0
- package/src/shared/types/omp/session.ts +6 -0
- package/src/shared/types/session-changes.ts +58 -0
- package/src/shared/types/settings/state.ts +8 -0
- package/dist/client/static/js/LayoutWrapper-xjnveecv.js +0 -2
- package/dist/client/static/js/Modal-k2jr9hc4.js +0 -38
- package/dist/client/static/js/architecture-7GRP2DOG-1y9zvsyt.js +0 -1
- package/dist/client/static/js/bash-m0qjsyy0.js +0 -1
- package/dist/client/static/js/css-t4ngafan.js +0 -1
- package/dist/client/static/js/cynefin-OW5HDTMX-k2188qcq.js +0 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-pdr0qn0n.js +0 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-zvz0mxne.js +0 -1
- package/dist/client/static/js/gitGraph-4MIJSDKK-wmqf046s.js +0 -1
- package/dist/client/static/js/graphql-692h0n2x.js +0 -1
- package/dist/client/static/js/index-61tm0v57.js +0 -1
- package/dist/client/static/js/index-kg86e3sy.js +0 -12
- package/dist/client/static/js/index-nmmxb4va.js +0 -2
- package/dist/client/static/js/info-A6RAGUB7-zg3twte6.js +0 -1
- package/dist/client/static/js/ini-cg0a5wm3.js +0 -1
- package/dist/client/static/js/java-vcck089n.js +0 -1
- package/dist/client/static/js/jsx-ht9zyzwa.js +0 -1
- package/dist/client/static/js/lua-ke895s2q.js +0 -1
- package/dist/client/static/js/markdown-gwmsh53r.js +0 -1
- package/dist/client/static/js/one-dark-pro-4geyzhjj.js +0 -1
- package/dist/client/static/js/one-light-tqssjm9t.js +0 -1
- package/dist/client/static/js/packet-AYTQ26CC-3pav51g0.js +0 -1
- package/dist/client/static/js/pie-WAS4IAKB-wqfh7zdk.js +0 -1
- package/dist/client/static/js/properties-mzvvbqg5.js +0 -1
- package/dist/client/static/js/python-3w64wsyd.js +0 -1
- package/dist/client/static/js/r-32re2zwb.js +0 -1
- package/dist/client/static/js/radar-RG4KPBEZ-w7qjdr2g.js +0 -1
- package/dist/client/static/js/railroad-74A4TZTK-rhr99kkj.js +0 -1
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-c4jeea3m.js +0 -1
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-x2ee66ex.js +0 -1
- package/dist/client/static/js/railroad-peg-WCYAUIDC-yw8wjfwg.js +0 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-y81h9n27.js +0 -8
- package/dist/client/static/js/treeView-Q6P3EWNA-ekz05ccs.js +0 -1
- package/dist/client/static/js/treemap-WGGIJYW6-aq6qymjr.js +0 -1
- package/dist/client/static/js/tsx-0p183w2f.js +0 -1
- package/dist/client/static/js/typescript-t9a5jyvv.js +0 -1
- package/dist/client/static/js/wardley-WFR3VGLG-z34tj4y3.js +0 -1
- package/dist/client/static/js/xml-81hxjjt4.js +0 -1
- package/dist/client/static/js/yaml-yssayv8a.js +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{t,l,K,E,X,R,M,O,P,z,j,G,p,h,H,cp,st,Ye,Je,Mr,_t,St,Tt,lt}from"./index-hc2jmzpx.js";import{dn}from"./index-c0x6s6f7.js";var ks={};dn(ks,{default:()=>pt});var Ms={};dn(Ms,{default:()=>He});var Bs={};dn(Bs,{default:()=>ri});var df=typeof global=="object"&&global&&global.Object===Object&&global,bs=df;var pf=typeof self=="object"&&self&&self.Object===Object&&self,mf=bs||pf||Function("return this")(),pe=mf;var gf=pe.Symbol,Oe=gf;var to=Object.prototype,{hasOwnProperty:Tf,toString:Ef}=to,es=Oe?Oe.toStringTag:void 0;function yf(e){var r=Tf.call(e,es),s=e[es];try{e[es]=void 0;var n=!0}catch(o){}var i=Ef.call(e);if(n)if(r)e[es]=s;else delete e[es];return i}var ro=yf;var Af=Object.prototype,xf=Af.toString;function Sf(e){return xf.call(e)}var so=Sf;var Rf="[object Null]",Of="[object Undefined]",no=Oe?Oe.toStringTag:void 0;function Lf(e){if(e==null)return e===void 0?Of:Rf;return no&&no in Object(e)?ro(e):so(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__"],Cs=_f;var io=function(){var e=/[^.]+$/.exec(Cs&&Cs.keys&&Cs.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Mf(e){return!!io&&io in e}var oo=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 It=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)||oo(e))return!1;var r=Ue(e)?jf:Ff;return r.test(It(e))}var ao=Kf;function zf(e,r){return e==null?void 0:e[r]}var lo=zf;function Vf(e,r){var s=lo(e,r);return ao(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 ft=Xf;var qf=Object.prototype,Jf=qf.hasOwnProperty;function Zf(e,r,s){var n=e[r];if(!(Jf.call(e,r)&&ft(n,s))||s===void 0&&!(r in e))dr(e,r,s)}var Ut=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 Ut(s,u,a)}return s}var ht=Qf;function eh(e){return e}var nt=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 co=th;var uo=Math.max;function rh(e,r,s){return r=uo(r===void 0?e.length-1:r,0),function(){var n=arguments,i=-1,o=uo(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),co(e,this,u)}}var fo=rh;function sh(e){return function(){return e}}var ho=sh;var nh=!hr?nt:function(e,r){return hr(e,"toString",{configurable:!0,enumerable:!1,value:ho(r),writable:!0})},po=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 mo=lh;var ch=mo(po),go=ch;function uh(e,r){return go(fo(e,r,nt),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 Dt=gh;function Th(e,r,s){if(!ne(s))return!1;var n=typeof r;if(n=="number"?me(s)&&Dt(r,s.length):n=="string"&&(r in s))return ft(s[r],e);return!1}var Ft=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&&Ft(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 To=Eh;var yh=Object.prototype;function Ah(e){var r=e&&e.constructor,s=typeof r=="function"&&r.prototype||yh;return e===s}var dt=Ah;function xh(e,r){var s=-1,n=Array(e);while(++s<e)n[s]=r(s);return n}var Eo=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 Qn=Oh;var yo=Object.prototype,{hasOwnProperty:Lh,propertyIsEnumerable:Ih}=yo,Nh=Qn(function(){return arguments}())?Qn:function(e){return ue(e)&&Lh.call(e,"callee")&&!Ih.call(e,"callee")},Bt=Nh;var bh=Array.isArray,N=bh;function Ch(){return!1}var Ao=Ch;var Ro=typeof ks=="object"&&ks&&!ks.nodeType&&ks,xo=Ro&&typeof vs=="object"&&vs&&!vs.nodeType&&vs,vh=xo&&xo.exports===Ro,So=vh?pe.Buffer:void 0,kh=So?So.isBuffer:void 0,_h=kh||Ao,pt=_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]",J={};J[Yh]=J[Xh]=J[qh]=J[Jh]=J[Zh]=J[Qh]=J[ed]=J[td]=J[rd]=!0;J[Mh]=J[wh]=J[Vh]=J[Ph]=J[Hh]=J[Uh]=J[Dh]=J[Fh]=J[Bh]=J[$h]=J[Gh]=J[Wh]=J[jh]=J[Kh]=J[zh]=!1;function sd(e){return ue(e)&&mr(e.length)&&!!J[Pe(e)]}var Oo=sd;function nd(e){return function(r){return e(r)}}var mt=nd;var Lo=typeof Ms=="object"&&Ms&&!Ms.nodeType&&Ms,ts=Lo&&typeof _s=="object"&&_s&&!_s.nodeType&&_s,id=ts&&ts.exports===Lo,ei=id&&bs.process,od=function(){try{var e=ts&&ts.require&&ts.require("util").types;if(e)return e;return ei&&ei.binding&&ei.binding("util")}catch(r){}}(),He=od;var Io=He&&He.isTypedArray,ad=Io?mt(Io):Oo,gr=ad;var ld=Object.prototype,cd=ld.hasOwnProperty;function ud(e,r){var s=N(e),n=!s&&Bt(e),i=!s&&!n&&pt(e),o=!s&&!n&&!i&&gr(e),c=s||n||i||o,u=c?Eo(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")||Dt(f,a))))u.push(f);return u}var ws=ud;function fd(e,r){return function(s){return e(r(s))}}var Ps=fd;var hd=Ps(Object.keys,Object),No=hd;var dd=Object.prototype,pd=dd.hasOwnProperty;function md(e){if(!dt(e))return No(e);var r=[];for(var s in Object(e))if(pd.call(e,s)&&s!="constructor")r.push(s);return r}var Us=md;function gd(e){return me(e)?ws(e):Us(e)}var V=gd;var Td=Object.prototype,Ed=Td.hasOwnProperty,yd=To(function(e,r){if(dt(r)||me(r)){ht(r,V(r),e);return}for(var s in r)if(Ed.call(r,s))Ut(e,s,r[s])}),Ne=yd;function Ad(){this.__data__=[],this.size=0}var bo=Ad;function xd(e,r){var s=e.length;while(s--)if(ft(e[s][0],r))return s;return-1}var $t=xd;var Sd=Array.prototype,Rd=Sd.splice;function Od(e){var r=this.__data__,s=$t(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 Co=Od;function Ld(e){var r=this.__data__,s=$t(r,e);return s<0?void 0:r[s][1]}var vo=Ld;function Id(e){return $t(this.__data__,e)>-1}var ko=Id;function Nd(e,r){var s=this.__data__,n=$t(s,e);if(n<0)++this.size,s.push([e,r]);else s[n][1]=r;return this}var _o=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=bo;Tr.prototype.delete=Co;Tr.prototype.get=vo;Tr.prototype.has=ko;Tr.prototype.set=_o;var Gt=Tr;function bd(){this.__data__=new Gt,this.size=0}var Mo=bd;function Cd(e){var r=this.__data__,s=r.delete(e);return this.size=r.size,s}var wo=Cd;function vd(e){return this.__data__.get(e)}var Po=vd;function kd(e){return this.__data__.has(e)}var Uo=kd;var _d=$e(pe,"Map"),Wt=_d;var Md=$e(Object,"create"),Nt=Md;function wd(){this.__data__=Nt?Nt(null):{},this.size=0}var Do=wd;function Pd(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}var Fo=Pd;var Ud="__lodash_hash_undefined__",Dd=Object.prototype,Fd=Dd.hasOwnProperty;function Bd(e){var r=this.__data__;if(Nt){var s=r[e];return s===Ud?void 0:s}return Fd.call(r,e)?r[e]:void 0}var Bo=Bd;var $d=Object.prototype,Gd=$d.hasOwnProperty;function Wd(e){var r=this.__data__;return Nt?r[e]!==void 0:Gd.call(r,e)}var $o=Wd;var jd="__lodash_hash_undefined__";function Kd(e,r){var s=this.__data__;return this.size+=this.has(e)?0:1,s[e]=Nt&&r===void 0?jd:r,this}var Go=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=Do;Er.prototype.delete=Fo;Er.prototype.get=Bo;Er.prototype.has=$o;Er.prototype.set=Go;var ti=Er;function zd(){this.size=0,this.__data__={hash:new ti,map:new(Wt||Gt),string:new ti}}var Wo=zd;function Vd(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}var jo=Vd;function Hd(e,r){var s=e.__data__;return jo(r)?s[typeof r=="string"?"string":"hash"]:s.map}var jt=Hd;function Yd(e){var r=jt(this,e).delete(e);return this.size-=r?1:0,r}var Ko=Yd;function Xd(e){return jt(this,e).get(e)}var zo=Xd;function qd(e){return jt(this,e).has(e)}var Vo=qd;function Jd(e,r){var s=jt(this,e),n=s.size;return s.set(e,r),this.size+=s.size==n?0:1,this}var Ho=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=Wo;yr.prototype.delete=Ko;yr.prototype.get=zo;yr.prototype.has=Vo;yr.prototype.set=Ho;var er=yr;var Zd=200;function Qd(e,r){var s=this.__data__;if(s instanceof Gt){var n=s.__data__;if(!Wt||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 Yo=Qd;function Ar(e){var r=this.__data__=new Gt(e);this.size=r.size}Ar.prototype.clear=Mo;Ar.prototype.delete=wo;Ar.prototype.get=Po;Ar.prototype.has=Uo;Ar.prototype.set=Yo;var Kt=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 Ds=ep;function tp(e,r){return e&&ht(r,V(r),e)}var Xo=tp;function rp(e){var r=[];if(e!=null)for(var s in Object(e))r.push(s);return r}var qo=rp;var sp=Object.prototype,np=sp.hasOwnProperty;function ip(e){if(!ne(e))return qo(e);var r=dt(e),s=[];for(var n in e)if(!(n=="constructor"&&(r||!np.call(e,n))))s.push(n);return s}var Jo=ip;function op(e){return me(e)?ws(e,!0):Jo(e)}var zt=op;function ap(e,r){return e&&ht(r,zt(r),e)}var Zo=ap;var ra=typeof Bs=="object"&&Bs&&!Bs.nodeType&&Bs,Qo=ra&&typeof Fs=="object"&&Fs&&!Fs.nodeType&&Fs,lp=Qo&&Qo.exports===ra,ea=lp?pe.Buffer:void 0,ta=ea?ea.allocUnsafe:void 0;function up(e,r){if(r)return e.slice();var s=e.length,n=ta?ta(s):new e.constructor(s);return e.copy(n),n}var ri=up;function fp(e,r){var s=-1,n=e.length;r||(r=Array(n));while(++s<n)r[s]=e[s];return r}var sa=fp;function hp(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=hp;function dp(){return[]}var $s=dp;var pp=Object.prototype,mp=pp.propertyIsEnumerable,na=Object.getOwnPropertySymbols,gp=!na?$s:function(e){if(e==null)return[];return e=Object(e),xr(na(e),function(r){return mp.call(e,r)})},Sr=gp;function Tp(e,r){return ht(e,Sr(e),r)}var ia=Tp;function Ep(e,r){var s=-1,n=r.length,i=e.length;while(++s<n)e[i+s]=r[s];return e}var Rr=Ep;var yp=Ps(Object.getPrototypeOf,Object),Gs=yp;var Ap=Object.getOwnPropertySymbols,xp=!Ap?$s:function(e){var r=[];while(e)Rr(r,Sr(e)),e=Gs(e);return r},Ws=xp;function Sp(e,r){return ht(e,Ws(e),r)}var oa=Sp;function Rp(e,r,s){var n=r(e);return N(e)?n:Rr(n,s(e))}var js=Rp;function Op(e){return js(e,V,Sr)}var rs=Op;function Lp(e){return js(e,zt,Ws)}var Ks=Lp;var Ip=$e(pe,"DataView"),zs=Ip;var Np=$e(pe,"Promise"),Vs=Np;var bp=$e(pe,"Set"),Vt=bp;var Cp=$e(pe,"WeakMap"),Hs=Cp;var aa="[object Map]",vp="[object Object]",la="[object Promise]",ca="[object Set]",ua="[object WeakMap]",fa="[object DataView]",kp=It(zs),_p=It(Wt),Mp=It(Vs),wp=It(Vt),Pp=It(Hs),tr=Pe;if(zs&&tr(new zs(new ArrayBuffer(1)))!=fa||Wt&&tr(new Wt)!=aa||Vs&&tr(Vs.resolve())!=la||Vt&&tr(new Vt)!=ca||Hs&&tr(new Hs)!=ua)tr=function(e){var r=Pe(e),s=r==vp?e.constructor:void 0,n=s?It(s):"";if(n)switch(n){case kp:return fa;case _p:return aa;case Mp:return la;case wp:return ca;case Pp:return ua}return r};var it=tr;var Up=Object.prototype,Dp=Up.hasOwnProperty;function Fp(e){var r=e.length,s=new e.constructor(r);if(r&&typeof e[0]=="string"&&Dp.call(e,"index"))s.index=e.index,s.input=e.input;return s}var ha=Fp;var Bp=pe.Uint8Array,Or=Bp;function $p(e){var r=new e.constructor(e.byteLength);return new Or(r).set(new Or(e)),r}var Lr=$p;function Gp(e,r){var s=r?Lr(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.byteLength)}var da=Gp;var Wp=/\w*$/;function jp(e){var r=new e.constructor(e.source,Wp.exec(e));return r.lastIndex=e.lastIndex,r}var pa=jp;var ma=Oe?Oe.prototype:void 0,ga=ma?ma.valueOf:void 0;function Kp(e){return ga?Object(ga.call(e)):{}}var Ta=Kp;function zp(e,r){var s=r?Lr(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.length)}var Ea=zp;var Vp="[object Boolean]",Hp="[object Date]",Yp="[object Map]",Xp="[object Number]",qp="[object RegExp]",Jp="[object Set]",Zp="[object String]",Qp="[object Symbol]",em="[object ArrayBuffer]",tm="[object DataView]",rm="[object Float32Array]",sm="[object Float64Array]",nm="[object Int8Array]",im="[object Int16Array]",om="[object Int32Array]",am="[object Uint8Array]",lm="[object Uint8ClampedArray]",cm="[object Uint16Array]",um="[object Uint32Array]";function fm(e,r,s){var n=e.constructor;switch(r){case em:return Lr(e);case Vp:case Hp:return new n(+e);case tm:return da(e,s);case rm:case sm:case nm:case im:case om:case am:case lm:case cm:case um:return Ea(e,s);case Yp:return new n;case Xp:case Zp:return new n(e);case qp:return pa(e);case Jp:return new n;case Qp:return Ta(e)}}var ya=fm;var Aa=Object.create,hm=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=hm;function dm(e){return typeof e.constructor=="function"&&!dt(e)?xa(Gs(e)):{}}var Sa=dm;var pm="[object Map]";function mm(e){return ue(e)&&it(e)==pm}var Ra=mm;var Oa=He&&He.isMap,gm=Oa?mt(Oa):Ra,La=gm;var Tm="[object Set]";function Em(e){return ue(e)&&it(e)==Tm}var Ia=Em;var Na=He&&He.isSet,ym=Na?mt(Na):Ia,ba=ym;var Am=1,xm=2,Sm=4,Ca="[object Arguments]",Rm="[object Array]",Om="[object Boolean]",Lm="[object Date]",Im="[object Error]",va="[object Function]",Nm="[object GeneratorFunction]",bm="[object Map]",Cm="[object Number]",ka="[object Object]",vm="[object RegExp]",km="[object Set]",_m="[object String]",Mm="[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]",Y={};Y[Ca]=Y[Rm]=Y[Pm]=Y[Um]=Y[Om]=Y[Lm]=Y[Dm]=Y[Fm]=Y[Bm]=Y[$m]=Y[Gm]=Y[bm]=Y[Cm]=Y[ka]=Y[vm]=Y[km]=Y[_m]=Y[Mm]=Y[Wm]=Y[jm]=Y[Km]=Y[zm]=!0;Y[Im]=Y[va]=Y[wm]=!1;function Ys(e,r,s,n,i,o){var c,u=r&Am,a=r&xm,f=r&Sm;if(s)c=i?s(e,n,i,o):s(e);if(c!==void 0)return c;if(!ne(e))return e;var d=N(e);if(d){if(c=ha(e),!u)return sa(e,c)}else{var m=it(e),g=m==va||m==Nm;if(pt(e))return ri(e,u);if(m==ka||m==Ca||g&&!i){if(c=a||g?{}:Sa(e),!u)return a?oa(e,Zo(c,e)):ia(e,Xo(c,e))}else{if(!Y[m])return i?e:{};c=ya(e,m,u)}}o||(o=new Kt);var y=o.get(e);if(y)return y;if(o.set(e,c),ba(e))e.forEach(function(b){c.add(Ys(b,r,s,b,e,o))});else if(La(e))e.forEach(function(b,x){c.set(x,Ys(b,r,s,x,e,o))});var v=f?a?Ks:rs:a?zt:V,k=d?void 0:v(e);return Ds(k||e,function(b,x){if(k)x=b,b=e[x];Ut(c,x,Ys(b,r,s,x,e,o))}),c}var _a=Ys;var Vm=4;function Hm(e){return _a(e,Vm)}var q=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 gt=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&&Ft(r[0],r[1],i))n=1;while(++s<n){var o=r[s],c=zt(o),u=-1,a=c.length;while(++u<a){var f=c[u],d=e[f];if(d===void 0||ft(d,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 Xs(e){var r=-1,s=e==null?0:e.length;this.__data__=new er;while(++r<s)this.add(e[r])}Xs.prototype.add=Xs.prototype.push=wa;Xs.prototype.has=Pa;var Nr=Xs;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 qs=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):qs(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 Js=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 Zs=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 Et=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=Js,c=!0,u=e.length,a=[],f=r.length;if(!u)return a;if(s)r=Et(r,mt(s));if(n)o=Zs,c=!1;else if(r.length>=lg)o=Cr,c=!1,r=new Nr(r);e:while(++i<u){var d=e[i],m=s==null?d:s(d);if(d=n||d!==0?d:0,c&&m===m){var g=f;while(g--)if(r[g]===m)continue e;a.push(d)}else if(!o(r,m,n))a.push(d)}return a}var Fa=cg;var Ba=Oe?Oe.isConcatSpreadable:void 0;function ug(e){return N(e)||Bt(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 si=fg;var hg=pr(function(e,r){return si(e)?Fa(e,vr(r,1,si,!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 Qs=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 yt=Ng;function bg(e,r,s){var n=e==null?0:e.length;if(!n)return[];return r=s||r===void 0?1:yt(r),Qs(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:yt(r),r=n-r,Qs(e,0,r<0?0:r)}var bt=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,V)}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 en=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),d=o.get(r);if(f&&d)return f==r&&d==e;var m=-1,g=!0,y=s&Bg?new Nr:void 0;o.set(e,r),o.set(r,e);while(++m<u){var v=e[m],k=r[m];if(n)var b=c?n(k,v,m,r,e,o):n(v,k,m,e,r,o);if(b!==void 0){if(b)continue;g=!1;break}if(y){if(!en(r,function(x,I){if(!Cr(y,I)&&(v===x||i(v,x,s,n,o)))return y.push(I)})){g=!1;break}}else if(!(v===k||i(v,k,s,n,o))){g=!1;break}}return o.delete(e),o.delete(r),g}var tn=$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,ni=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 ft(+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 d=tn(u(e),u(r),n,i,o,c);return c.delete(e),d;case Qg:if(ni)return ni.call(e)==ni.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=rs(e),a=u.length,f=rs(r),d=f.length;if(a!=d&&!c)return!1;var m=a;while(m--){var g=u[m];if(!(c?g in r:iT.call(r,g)))return!1}var y=o.get(e),v=o.get(r);if(y&&v)return y==r&&v==e;var k=!0;o.set(e,r),o.set(r,e);var b=c;while(++m<a){g=u[m];var x=e[g],I=r[g];if(n)var T=c?n(I,x,g,r,e,o):n(x,I,g,e,r,o);if(!(T===void 0?x===I||i(x,I,s,n,o):T)){k=!1;break}b||(b=g=="constructor")}if(k&&!b){var w=e.constructor,ee=r.constructor;if(w!=ee&&(("constructor"in e)&&("constructor"in r))&&!(typeof w=="function"&&w instanceof w&&typeof ee=="function"&&ee instanceof ee))k=!1}return o.delete(e),o.delete(r),k}var sl=oT;var aT=1,nl="[object Arguments]",il="[object Array]",rn="[object Object]",lT=Object.prototype,ol=lT.hasOwnProperty;function cT(e,r,s,n,i,o){var c=N(e),u=N(r),a=c?il:it(e),f=u?il:it(r);a=a==nl?rn:a,f=f==nl?rn:f;var d=a==rn,m=f==rn,g=a==f;if(g&&pt(e)){if(!pt(r))return!1;c=!0,d=!1}if(g&&!d)return o||(o=new Kt),c||gr(e)?tn(e,r,s,n,i,o):rl(e,r,a,s,n,i,o);if(!(s&aT)){var y=d&&ol.call(e,"__wrapped__"),v=m&&ol.call(r,"__wrapped__");if(y||v){var k=y?e.value():e,b=v?r.value():r;return o||(o=new Kt),i(k,b,s,n,o)}}if(!g)return!1;return o||(o=new Kt),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 sn=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],d=u[1];if(c&&u[2]){if(f===void 0&&!(a in e))return!1}else{var m=new Kt;if(n)var g=n(f,d,a,e,r,m);if(!(g===void 0?sn(d,f,uT|fT,n,m):g))return!1}}return!0}var cl=hT;function dT(e){return e===e&&!ne(e)}var nn=dT;function pT(e){var r=V(e),s=r.length;while(s--){var n=r[s],i=e[n];r[s]=[n,i,nn(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 on=mT;function gT(e){var r=ul(e);if(r.length==1&&r[0][2])return on(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(N(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 ii(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(ii.Cache||er),s}ii.Cache=er;var hl=ii;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(N(e))return Et(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(N(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 At=vT;function kT(e,r){r=Xt(r,e);var s=0,n=r.length;while(e!=null&&s<n)e=e[At(r[s++])];return s&&s==n?e:void 0}var wr=kT;function _T(e,r,s){var n=e==null?void 0:wr(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=At(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)&&Dt(c,i)&&(N(e)||Bt(e))}var an=wT;function PT(e,r){return e!=null&&an(e,r,xl)}var Sl=PT;var UT=1,DT=2;function FT(e,r){if(_r(e)&&nn(r))return on(At(e),r);return function(s){var n=Al(s,e);return n===void 0&&n===r?Sl(s,e):sn(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 wr(r,e)}}var Ll=$T;function GT(e){return _r(e)?Ol(At(e)):Ll(e)}var Il=GT;function WT(e){if(typeof e=="function")return e;if(e==null)return nt;if(typeof e=="object")return N(e)?Rl(e[0],e[1]):fl(e);return Il(e)}var ge=WT;function jT(e,r,s){var n=N(e)?Ya:Qa;if(s&&Ft(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 ln=KT;function zT(e,r){var s=N(e)?xr:ln;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=V(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:yt(s);if(i<0)i=HT(n+i,0);return qs(e,ge(r,3),i)}var bl=YT;var XT=Nl(bl),xt=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=N(e)?Et:Cl;return s(e,ge(r,3))}var A=ZT;function QT(e,r){return vr(A(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:nt}var vl=tE;function rE(e,r){var s=N(e)?Ds:Ge;return s(e,vl(r))}var S=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=N(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])}),oi=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&&an(e,r,wl)}var L=hE;var dE="[object String]";function pE(e){return typeof e=="string"||!N(e)&&ue(e)&&Pe(e)==dE}var Se=pE;function mE(e,r){return Et(r,function(s){return e[s]})}var Pl=mE;function gE(e){return e==null?[]:Pl(e,V(e))}var W=gE;var TE=Math.max;function EE(e,r,s,n){e=me(e)?e:W(e),s=s&&!n?yt(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 te=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:yt(s);if(i<0)i=yE(n+i,0);return br(e,r,i)}var cn=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)&&(N(e)||typeof e=="string"||typeof e.splice=="function"||pt(e)||gr(e)||Bt(e)))return!e.length;var r=it(e);if(r==xE||r==SE)return!e.size;if(dt(e))return!Us(e).length;for(var s in e)if(OE.call(e,s))return!1;return!0}var U=LE;var IE="[object RegExp]";function NE(e){return ue(e)&&Pe(e)==IE}var Ul=NE;var Dl=He&&He.isRegExp,bE=Dl?mt(Dl):Ul,Ze=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 ot=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=At(r[i]),f=s;if(a==="__proto__"||a==="constructor"||a==="prototype")return e;if(i!=c){var d=u[a];if(f=n?n(d,a,u):void 0,f===void 0)f=ne(d)?d:Dt(r[i+1])?[]:{}}Ut(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=wr(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=Et(Ks(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=N(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=N(e)?xr:ln;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=N(e)?en:jl;if(s&&Ft(e,r,s))r=void 0;return n(e,ge(r,3))}var ss=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=Js,o=e.length,c=!0,u=[],a=u;if(s)c=!1,i=Zs;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 d=e[n],m=r?r(d):d;if(d=s||d!==0?d:0,c&&m===m){var g=a.length;while(g--)if(a[g]===m)continue e;if(r)a.push(m);u.push(d)}else if(!i(a,m,s)){if(a!==u)a.push(m);u.push(d)}}return u}var zl=VE;function HE(e){return e&&e.length?zl(e):[]}var Pr=HE;function Ur(e){if(console&&console.error)console.error(`Error: ${e}`)}function ns(e){if(console&&console.warn)console.warn(`Warning: ${e}`)}function is(e){let r=new Date().getTime(),s=e();return{time:new Date().getTime()-r,value:s}}function os(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 Qe{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),S(this.definition,(r)=>{r.accept(e)})}}class Z extends Qe{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 Qe{constructor(e){super(e.definition);this.orgText="",Ne(this,We(e,(r)=>r!==void 0))}}class Q extends Qe{constructor(e){super(e.definition);this.ignoreAmbiguities=!1,Ne(this,We(e,(r)=>r!==void 0))}}class re extends Qe{constructor(e){super(e.definition);this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}}class Ee extends Qe{constructor(e){super(e.definition);this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}}class ye extends Qe{constructor(e){super(e.definition);this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}}class B extends Qe{constructor(e){super(e.definition);this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}}class he extends Qe{constructor(e){super(e.definition);this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}}class de extends Qe{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 D{constructor(e){this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}accept(e){e.visit(this)}}function un(e){return A(e,Dr)}function Dr(e){function r(s){return A(s,Dr)}if(e instanceof Z){let s={type:"NonTerminal",name:e.nonTerminalName,idx:e.idx};if(Se(e.label))s.label=e.label;return s}else if(e instanceof Q)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:Dr(new D({terminalType:e.separator})),definition:r(e.definition)};else if(e instanceof he)return{type:"RepetitionWithSeparator",idx:e.idx,separator:Dr(new D({terminalType:e.separator})),definition:r(e.definition)};else if(e instanceof B)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 D){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=Ze(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 Z:return this.visitNonTerminal(r);case Q: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 B:return this.visitRepetition(r);case de:return this.visitAlternation(r);case D: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 ai(e){return e instanceof Q||e instanceof re||e instanceof B||e instanceof Ee||e instanceof ye||e instanceof he||e instanceof D||e instanceof je}function rr(e,r=[]){if(e instanceof re||e instanceof B||e instanceof he)return!0;if(e instanceof de)return ss(e.definition,(n)=>rr(n,r));else if(e instanceof Z&&te(r,e))return!1;else if(e instanceof Qe){if(e instanceof Z)r.push(e);return ve(e.definition,(n)=>rr(n,r))}else return!1}function li(e){return e instanceof de}function ze(e){if(e instanceof Z)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 B)return"MANY";else if(e instanceof D)return"CONSUME";else throw Error("non exhaustive match")}class Jt{walk(e,r=[]){S(e.definition,(s,n)=>{let i=fe(e.definition,n+1);if(s instanceof Z)this.walkProdRef(s,i,r);else if(s instanceof D)this.walkTerminal(s,i,r);else if(s instanceof Q)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 B)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);S(e.definition,(i)=>{let o=new Q({definition:[i]});this.walk(o,n)})}}function Vl(e,r,s){return[new re({definition:[new D({terminalType:e.separator})].concat(e.definition)})].concat(r,s)}function sr(e){if(e instanceof Z)return sr(e.referencedRule);else if(e instanceof D)return ZE(e);else if(ai(e))return qE(e);else if(li(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 Pr(r)}function JE(e){let r=A(e.definition,(s)=>sr(s));return Pr(xe(r))}function ZE(e){return[e.terminalType]}var fn="_~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 Q({definition:i}),c=sr(o);this.follows[n]=c}}function Yl(e){let r={};return S(e,(s)=>{let n=new Hl(s).startWalking();Ne(r,n)}),r}function QE(e,r){return e.name+r+fn}function _(e){return e.charCodeAt(0)}function hn(e,r){if(Array.isArray(e))e.forEach(function(s){r.push(s)});else r.push(e)}function Fr(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 as(){throw Error("Internal Error - Should never get here!")}function ci(e){return e.type==="Character"}var ls=[];for(let e=_("0");e<=_("9");e++)ls.push(e);var cs=[_("_")].concat(ls);for(let e=_("a");e<=_("z");e++)cs.push(e);for(let e=_("A");e<=_("Z");e++)cs.push(e);var ui=[_(" "),_("\f"),_(`
|
|
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,K,E,X,R,L,O,P,z,j,G,p,h,W,up,st,Ye,Je,Lr,_t,St,Tt,lt}from"./index-vw5k8csz.js";import{dn}from"./index-sdtye3jy.js";var ks={};dn(ks,{default:()=>pt});var Ms={};dn(Ms,{default:()=>He});var Bs={};dn(Bs,{default:()=>ri});var df=typeof global=="object"&&global&&global.Object===Object&&global,bs=df;var pf=typeof self=="object"&&self&&self.Object===Object&&self,mf=bs||pf||Function("return this")(),pe=mf;var gf=pe.Symbol,Oe=gf;var to=Object.prototype,{hasOwnProperty:Tf,toString:Ef}=to,es=Oe?Oe.toStringTag:void 0;function yf(e){var r=Tf.call(e,es),s=e[es];try{e[es]=void 0;var n=!0}catch(o){}var i=Ef.call(e);if(n)if(r)e[es]=s;else delete e[es];return i}var ro=yf;var Af=Object.prototype,xf=Af.toString;function Sf(e){return xf.call(e)}var so=Sf;var Rf="[object Null]",Of="[object Undefined]",no=Oe?Oe.toStringTag:void 0;function Lf(e){if(e==null)return e===void 0?Of:Rf;return no&&no in Object(e)?ro(e):so(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__"],Cs=_f;var io=function(){var e=/[^.]+$/.exec(Cs&&Cs.keys&&Cs.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Mf(e){return!!io&&io in e}var oo=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 It=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)||oo(e))return!1;var r=Ue(e)?jf:Ff;return r.test(It(e))}var ao=Kf;function zf(e,r){return e==null?void 0:e[r]}var lo=zf;function Vf(e,r){var s=lo(e,r);return ao(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 ft=Xf;var qf=Object.prototype,Jf=qf.hasOwnProperty;function Zf(e,r,s){var n=e[r];if(!(Jf.call(e,r)&&ft(n,s))||s===void 0&&!(r in e))dr(e,r,s)}var Ut=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 Ut(s,u,a)}return s}var ht=Qf;function eh(e){return e}var nt=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 co=th;var uo=Math.max;function rh(e,r,s){return r=uo(r===void 0?e.length-1:r,0),function(){var n=arguments,i=-1,o=uo(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),co(e,this,u)}}var fo=rh;function sh(e){return function(){return e}}var ho=sh;var nh=!hr?nt:function(e,r){return hr(e,"toString",{configurable:!0,enumerable:!1,value:ho(r),writable:!0})},po=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 mo=lh;var ch=mo(po),go=ch;function uh(e,r){return go(fo(e,r,nt),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 Dt=gh;function Th(e,r,s){if(!ne(s))return!1;var n=typeof r;if(n=="number"?me(s)&&Dt(r,s.length):n=="string"&&(r in s))return ft(s[r],e);return!1}var Ft=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&&Ft(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 To=Eh;var yh=Object.prototype;function Ah(e){var r=e&&e.constructor,s=typeof r=="function"&&r.prototype||yh;return e===s}var dt=Ah;function xh(e,r){var s=-1,n=Array(e);while(++s<e)n[s]=r(s);return n}var Eo=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 Qn=Oh;var yo=Object.prototype,{hasOwnProperty:Lh,propertyIsEnumerable:Ih}=yo,Nh=Qn(function(){return arguments}())?Qn:function(e){return ue(e)&&Lh.call(e,"callee")&&!Ih.call(e,"callee")},Bt=Nh;var bh=Array.isArray,b=bh;function Ch(){return!1}var Ao=Ch;var Ro=typeof ks=="object"&&ks&&!ks.nodeType&&ks,xo=Ro&&typeof vs=="object"&&vs&&!vs.nodeType&&vs,vh=xo&&xo.exports===Ro,So=vh?pe.Buffer:void 0,kh=So?So.isBuffer:void 0,_h=kh||Ao,pt=_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]",J={};J[Yh]=J[Xh]=J[qh]=J[Jh]=J[Zh]=J[Qh]=J[ed]=J[td]=J[rd]=!0;J[Mh]=J[wh]=J[Vh]=J[Ph]=J[Hh]=J[Uh]=J[Dh]=J[Fh]=J[Bh]=J[$h]=J[Gh]=J[Wh]=J[jh]=J[Kh]=J[zh]=!1;function sd(e){return ue(e)&&mr(e.length)&&!!J[Pe(e)]}var Oo=sd;function nd(e){return function(r){return e(r)}}var mt=nd;var Lo=typeof Ms=="object"&&Ms&&!Ms.nodeType&&Ms,ts=Lo&&typeof _s=="object"&&_s&&!_s.nodeType&&_s,id=ts&&ts.exports===Lo,ei=id&&bs.process,od=function(){try{var e=ts&&ts.require&&ts.require("util").types;if(e)return e;return ei&&ei.binding&&ei.binding("util")}catch(r){}}(),He=od;var Io=He&&He.isTypedArray,ad=Io?mt(Io):Oo,gr=ad;var ld=Object.prototype,cd=ld.hasOwnProperty;function ud(e,r){var s=b(e),n=!s&&Bt(e),i=!s&&!n&&pt(e),o=!s&&!n&&!i&&gr(e),c=s||n||i||o,u=c?Eo(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")||Dt(f,a))))u.push(f);return u}var ws=ud;function fd(e,r){return function(s){return e(r(s))}}var Ps=fd;var hd=Ps(Object.keys,Object),No=hd;var dd=Object.prototype,pd=dd.hasOwnProperty;function md(e){if(!dt(e))return No(e);var r=[];for(var s in Object(e))if(pd.call(e,s)&&s!="constructor")r.push(s);return r}var Us=md;function gd(e){return me(e)?ws(e):Us(e)}var H=gd;var Td=Object.prototype,Ed=Td.hasOwnProperty,yd=To(function(e,r){if(dt(r)||me(r)){ht(r,H(r),e);return}for(var s in r)if(Ed.call(r,s))Ut(e,s,r[s])}),Ne=yd;function Ad(){this.__data__=[],this.size=0}var bo=Ad;function xd(e,r){var s=e.length;while(s--)if(ft(e[s][0],r))return s;return-1}var $t=xd;var Sd=Array.prototype,Rd=Sd.splice;function Od(e){var r=this.__data__,s=$t(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 Co=Od;function Ld(e){var r=this.__data__,s=$t(r,e);return s<0?void 0:r[s][1]}var vo=Ld;function Id(e){return $t(this.__data__,e)>-1}var ko=Id;function Nd(e,r){var s=this.__data__,n=$t(s,e);if(n<0)++this.size,s.push([e,r]);else s[n][1]=r;return this}var _o=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=bo;Tr.prototype.delete=Co;Tr.prototype.get=vo;Tr.prototype.has=ko;Tr.prototype.set=_o;var Gt=Tr;function bd(){this.__data__=new Gt,this.size=0}var Mo=bd;function Cd(e){var r=this.__data__,s=r.delete(e);return this.size=r.size,s}var wo=Cd;function vd(e){return this.__data__.get(e)}var Po=vd;function kd(e){return this.__data__.has(e)}var Uo=kd;var _d=$e(pe,"Map"),Wt=_d;var Md=$e(Object,"create"),Nt=Md;function wd(){this.__data__=Nt?Nt(null):{},this.size=0}var Do=wd;function Pd(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}var Fo=Pd;var Ud="__lodash_hash_undefined__",Dd=Object.prototype,Fd=Dd.hasOwnProperty;function Bd(e){var r=this.__data__;if(Nt){var s=r[e];return s===Ud?void 0:s}return Fd.call(r,e)?r[e]:void 0}var Bo=Bd;var $d=Object.prototype,Gd=$d.hasOwnProperty;function Wd(e){var r=this.__data__;return Nt?r[e]!==void 0:Gd.call(r,e)}var $o=Wd;var jd="__lodash_hash_undefined__";function Kd(e,r){var s=this.__data__;return this.size+=this.has(e)?0:1,s[e]=Nt&&r===void 0?jd:r,this}var Go=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=Do;Er.prototype.delete=Fo;Er.prototype.get=Bo;Er.prototype.has=$o;Er.prototype.set=Go;var ti=Er;function zd(){this.size=0,this.__data__={hash:new ti,map:new(Wt||Gt),string:new ti}}var Wo=zd;function Vd(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}var jo=Vd;function Hd(e,r){var s=e.__data__;return jo(r)?s[typeof r=="string"?"string":"hash"]:s.map}var jt=Hd;function Yd(e){var r=jt(this,e).delete(e);return this.size-=r?1:0,r}var Ko=Yd;function Xd(e){return jt(this,e).get(e)}var zo=Xd;function qd(e){return jt(this,e).has(e)}var Vo=qd;function Jd(e,r){var s=jt(this,e),n=s.size;return s.set(e,r),this.size+=s.size==n?0:1,this}var Ho=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=Wo;yr.prototype.delete=Ko;yr.prototype.get=zo;yr.prototype.has=Vo;yr.prototype.set=Ho;var er=yr;var Zd=200;function Qd(e,r){var s=this.__data__;if(s instanceof Gt){var n=s.__data__;if(!Wt||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 Yo=Qd;function Ar(e){var r=this.__data__=new Gt(e);this.size=r.size}Ar.prototype.clear=Mo;Ar.prototype.delete=wo;Ar.prototype.get=Po;Ar.prototype.has=Uo;Ar.prototype.set=Yo;var Kt=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 Ds=ep;function tp(e,r){return e&&ht(r,H(r),e)}var Xo=tp;function rp(e){var r=[];if(e!=null)for(var s in Object(e))r.push(s);return r}var qo=rp;var sp=Object.prototype,np=sp.hasOwnProperty;function ip(e){if(!ne(e))return qo(e);var r=dt(e),s=[];for(var n in e)if(!(n=="constructor"&&(r||!np.call(e,n))))s.push(n);return s}var Jo=ip;function op(e){return me(e)?ws(e,!0):Jo(e)}var zt=op;function ap(e,r){return e&&ht(r,zt(r),e)}var Zo=ap;var ra=typeof Bs=="object"&&Bs&&!Bs.nodeType&&Bs,Qo=ra&&typeof Fs=="object"&&Fs&&!Fs.nodeType&&Fs,lp=Qo&&Qo.exports===ra,ea=lp?pe.Buffer:void 0,ta=ea?ea.allocUnsafe:void 0;function cp(e,r){if(r)return e.slice();var s=e.length,n=ta?ta(s):new e.constructor(s);return e.copy(n),n}var ri=cp;function fp(e,r){var s=-1,n=e.length;r||(r=Array(n));while(++s<n)r[s]=e[s];return r}var sa=fp;function hp(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=hp;function dp(){return[]}var $s=dp;var pp=Object.prototype,mp=pp.propertyIsEnumerable,na=Object.getOwnPropertySymbols,gp=!na?$s:function(e){if(e==null)return[];return e=Object(e),xr(na(e),function(r){return mp.call(e,r)})},Sr=gp;function Tp(e,r){return ht(e,Sr(e),r)}var ia=Tp;function Ep(e,r){var s=-1,n=r.length,i=e.length;while(++s<n)e[i+s]=r[s];return e}var Rr=Ep;var yp=Ps(Object.getPrototypeOf,Object),Gs=yp;var Ap=Object.getOwnPropertySymbols,xp=!Ap?$s:function(e){var r=[];while(e)Rr(r,Sr(e)),e=Gs(e);return r},Ws=xp;function Sp(e,r){return ht(e,Ws(e),r)}var oa=Sp;function Rp(e,r,s){var n=r(e);return b(e)?n:Rr(n,s(e))}var js=Rp;function Op(e){return js(e,H,Sr)}var rs=Op;function Lp(e){return js(e,zt,Ws)}var Ks=Lp;var Ip=$e(pe,"DataView"),zs=Ip;var Np=$e(pe,"Promise"),Vs=Np;var bp=$e(pe,"Set"),Vt=bp;var Cp=$e(pe,"WeakMap"),Hs=Cp;var aa="[object Map]",vp="[object Object]",la="[object Promise]",ca="[object Set]",ua="[object WeakMap]",fa="[object DataView]",kp=It(zs),_p=It(Wt),Mp=It(Vs),wp=It(Vt),Pp=It(Hs),tr=Pe;if(zs&&tr(new zs(new ArrayBuffer(1)))!=fa||Wt&&tr(new Wt)!=aa||Vs&&tr(Vs.resolve())!=la||Vt&&tr(new Vt)!=ca||Hs&&tr(new Hs)!=ua)tr=function(e){var r=Pe(e),s=r==vp?e.constructor:void 0,n=s?It(s):"";if(n)switch(n){case kp:return fa;case _p:return aa;case Mp:return la;case wp:return ca;case Pp:return ua}return r};var it=tr;var Up=Object.prototype,Dp=Up.hasOwnProperty;function Fp(e){var r=e.length,s=new e.constructor(r);if(r&&typeof e[0]=="string"&&Dp.call(e,"index"))s.index=e.index,s.input=e.input;return s}var ha=Fp;var Bp=pe.Uint8Array,Or=Bp;function $p(e){var r=new e.constructor(e.byteLength);return new Or(r).set(new Or(e)),r}var Ir=$p;function Gp(e,r){var s=r?Ir(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.byteLength)}var da=Gp;var Wp=/\w*$/;function jp(e){var r=new e.constructor(e.source,Wp.exec(e));return r.lastIndex=e.lastIndex,r}var pa=jp;var ma=Oe?Oe.prototype:void 0,ga=ma?ma.valueOf:void 0;function Kp(e){return ga?Object(ga.call(e)):{}}var Ta=Kp;function zp(e,r){var s=r?Ir(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.length)}var Ea=zp;var Vp="[object Boolean]",Hp="[object Date]",Yp="[object Map]",Xp="[object Number]",qp="[object RegExp]",Jp="[object Set]",Zp="[object String]",Qp="[object Symbol]",em="[object ArrayBuffer]",tm="[object DataView]",rm="[object Float32Array]",sm="[object Float64Array]",nm="[object Int8Array]",im="[object Int16Array]",om="[object Int32Array]",am="[object Uint8Array]",lm="[object Uint8ClampedArray]",cm="[object Uint16Array]",um="[object Uint32Array]";function fm(e,r,s){var n=e.constructor;switch(r){case em:return Ir(e);case Vp:case Hp:return new n(+e);case tm:return da(e,s);case rm:case sm:case nm:case im:case om:case am:case lm:case cm:case um:return Ea(e,s);case Yp:return new n;case Xp:case Zp:return new n(e);case qp:return pa(e);case Jp:return new n;case Qp:return Ta(e)}}var ya=fm;var Aa=Object.create,hm=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=hm;function dm(e){return typeof e.constructor=="function"&&!dt(e)?xa(Gs(e)):{}}var Sa=dm;var pm="[object Map]";function mm(e){return ue(e)&&it(e)==pm}var Ra=mm;var Oa=He&&He.isMap,gm=Oa?mt(Oa):Ra,La=gm;var Tm="[object Set]";function Em(e){return ue(e)&&it(e)==Tm}var Ia=Em;var Na=He&&He.isSet,ym=Na?mt(Na):Ia,ba=ym;var Am=1,xm=2,Sm=4,Ca="[object Arguments]",Rm="[object Array]",Om="[object Boolean]",Lm="[object Date]",Im="[object Error]",va="[object Function]",Nm="[object GeneratorFunction]",bm="[object Map]",Cm="[object Number]",ka="[object Object]",vm="[object RegExp]",km="[object Set]",_m="[object String]",Mm="[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]",Y={};Y[Ca]=Y[Rm]=Y[Pm]=Y[Um]=Y[Om]=Y[Lm]=Y[Dm]=Y[Fm]=Y[Bm]=Y[$m]=Y[Gm]=Y[bm]=Y[Cm]=Y[ka]=Y[vm]=Y[km]=Y[_m]=Y[Mm]=Y[Wm]=Y[jm]=Y[Km]=Y[zm]=!0;Y[Im]=Y[va]=Y[wm]=!1;function Ys(e,r,s,n,i,o){var c,u=r&Am,a=r&xm,f=r&Sm;if(s)c=i?s(e,n,i,o):s(e);if(c!==void 0)return c;if(!ne(e))return e;var d=b(e);if(d){if(c=ha(e),!u)return sa(e,c)}else{var m=it(e),g=m==va||m==Nm;if(pt(e))return ri(e,u);if(m==ka||m==Ca||g&&!i){if(c=a||g?{}:Sa(e),!u)return a?oa(e,Zo(c,e)):ia(e,Xo(c,e))}else{if(!Y[m])return i?e:{};c=ya(e,m,u)}}o||(o=new Kt);var y=o.get(e);if(y)return y;if(o.set(e,c),ba(e))e.forEach(function(C){c.add(Ys(C,r,s,C,e,o))});else if(La(e))e.forEach(function(C,x){c.set(x,Ys(C,r,s,x,e,o))});var k=f?a?Ks:rs:a?zt:H,_=d?void 0:k(e);return Ds(_||e,function(C,x){if(_)x=C,C=e[x];Ut(c,x,Ys(C,r,s,x,e,o))}),c}var _a=Ys;var Vm=4;function Hm(e){return _a(e,Vm)}var q=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 gt=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&&Ft(r[0],r[1],i))n=1;while(++s<n){var o=r[s],c=zt(o),u=-1,a=c.length;while(++u<a){var f=c[u],d=e[f];if(d===void 0||ft(d,Ma[f])&&!Xm.call(e,f))e[f]=o[f]}}return e}),Nr=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 Xs(e){var r=-1,s=e==null?0:e.length;this.__data__=new er;while(++r<s)this.add(e[r])}Xs.prototype.add=Xs.prototype.push=wa;Xs.prototype.has=Pa;var br=Xs;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 qs=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):qs(e,Ua,s)}var Cr=sg;function ng(e,r){var s=e==null?0:e.length;return!!s&&Cr(e,r,0)>-1}var Js=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 Zs=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 Et=og;function ag(e,r){return e.has(r)}var vr=ag;var lg=200;function cg(e,r,s,n){var i=-1,o=Js,c=!0,u=e.length,a=[],f=r.length;if(!u)return a;if(s)r=Et(r,mt(s));if(n)o=Zs,c=!1;else if(r.length>=lg)o=vr,c=!1,r=new br(r);e:while(++i<u){var d=e[i],m=s==null?d:s(d);if(d=n||d!==0?d:0,c&&m===m){var g=f;while(g--)if(r[g]===m)continue e;a.push(d)}else if(!o(r,m,n))a.push(d)}return a}var Fa=cg;var Ba=Oe?Oe.isConcatSpreadable:void 0;function ug(e){return b(e)||Bt(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 kr=Ga;function fg(e){return ue(e)&&me(e)}var si=fg;var hg=pr(function(e,r){return si(e)?Fa(e,kr(r,1,si,!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 Qs=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 yt=Ng;function bg(e,r,s){var n=e==null?0:e.length;if(!n)return[];return r=s||r===void 0?1:yt(r),Qs(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:yt(r),r=n-r,Qs(e,0,r<0?0:r)}var bt=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,H)}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 en=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),d=o.get(r);if(f&&d)return f==r&&d==e;var m=-1,g=!0,y=s&Bg?new br:void 0;o.set(e,r),o.set(r,e);while(++m<u){var k=e[m],_=r[m];if(n)var C=c?n(_,k,m,r,e,o):n(k,_,m,e,r,o);if(C!==void 0){if(C)continue;g=!1;break}if(y){if(!en(r,function(x,N){if(!vr(y,N)&&(k===x||i(k,x,s,n,o)))return y.push(N)})){g=!1;break}}else if(!(k===_||i(k,_,s,n,o))){g=!1;break}}return o.delete(e),o.delete(r),g}var tn=$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 _r=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,ni=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 ft(+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=_r),e.size!=r.size&&!a)return!1;var f=c.get(e);if(f)return f==r;n|=Kg,c.set(e,r);var d=tn(u(e),u(r),n,i,o,c);return c.delete(e),d;case Qg:if(ni)return ni.call(e)==ni.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=rs(e),a=u.length,f=rs(r),d=f.length;if(a!=d&&!c)return!1;var m=a;while(m--){var g=u[m];if(!(c?g in r:iT.call(r,g)))return!1}var y=o.get(e),k=o.get(r);if(y&&k)return y==r&&k==e;var _=!0;o.set(e,r),o.set(r,e);var C=c;while(++m<a){g=u[m];var x=e[g],N=r[g];if(n)var T=c?n(N,x,g,r,e,o):n(x,N,g,e,r,o);if(!(T===void 0?x===N||i(x,N,s,n,o):T)){_=!1;break}C||(C=g=="constructor")}if(_&&!C){var w=e.constructor,ee=r.constructor;if(w!=ee&&(("constructor"in e)&&("constructor"in r))&&!(typeof w=="function"&&w instanceof w&&typeof ee=="function"&&ee instanceof ee))_=!1}return o.delete(e),o.delete(r),_}var sl=oT;var aT=1,nl="[object Arguments]",il="[object Array]",rn="[object Object]",lT=Object.prototype,ol=lT.hasOwnProperty;function cT(e,r,s,n,i,o){var c=b(e),u=b(r),a=c?il:it(e),f=u?il:it(r);a=a==nl?rn:a,f=f==nl?rn:f;var d=a==rn,m=f==rn,g=a==f;if(g&&pt(e)){if(!pt(r))return!1;c=!0,d=!1}if(g&&!d)return o||(o=new Kt),c||gr(e)?tn(e,r,s,n,i,o):rl(e,r,a,s,n,i,o);if(!(s&aT)){var y=d&&ol.call(e,"__wrapped__"),k=m&&ol.call(r,"__wrapped__");if(y||k){var _=y?e.value():e,C=k?r.value():r;return o||(o=new Kt),i(_,C,s,n,o)}}if(!g)return!1;return o||(o=new Kt),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 sn=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],d=u[1];if(c&&u[2]){if(f===void 0&&!(a in e))return!1}else{var m=new Kt;if(n)var g=n(f,d,a,e,r,m);if(!(g===void 0?sn(d,f,uT|fT,n,m):g))return!1}}return!0}var cl=hT;function dT(e){return e===e&&!ne(e)}var nn=dT;function pT(e){var r=H(e),s=r.length;while(s--){var n=r[s],i=e[n];r[s]=[n,i,nn(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 on=mT;function gT(e){var r=ul(e);if(r.length==1&&r[0][2])return on(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(b(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 Mr=yT;var AT="Expected a function";function ii(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(ii.Cache||er),s}ii.Cache=er;var hl=ii;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(b(e))return Et(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(b(e))return e;return Mr(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 At=vT;function kT(e,r){r=Xt(r,e);var s=0,n=r.length;while(e!=null&&s<n)e=e[At(r[s++])];return s&&s==n?e:void 0}var wr=kT;function _T(e,r,s){var n=e==null?void 0:wr(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=At(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)&&Dt(c,i)&&(b(e)||Bt(e))}var an=wT;function PT(e,r){return e!=null&&an(e,r,xl)}var Sl=PT;var UT=1,DT=2;function FT(e,r){if(Mr(e)&&nn(r))return on(At(e),r);return function(s){var n=Al(s,e);return n===void 0&&n===r?Sl(s,e):sn(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 wr(r,e)}}var Ll=$T;function GT(e){return Mr(e)?Ol(At(e)):Ll(e)}var Il=GT;function WT(e){if(typeof e=="function")return e;if(e==null)return nt;if(typeof e=="object")return b(e)?Rl(e[0],e[1]):fl(e);return Il(e)}var ge=WT;function jT(e,r,s){var n=b(e)?Ya:Qa;if(s&&Ft(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 ln=KT;function zT(e,r){var s=b(e)?xr:ln;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=H(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:yt(s);if(i<0)i=HT(n+i,0);return qs(e,ge(r,3),i)}var bl=YT;var XT=Nl(bl),xt=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=b(e)?Et:Cl;return s(e,ge(r,3))}var A=ZT;function QT(e,r){return kr(A(e,r),1)}var De=QT;function eE(e){var r=e==null?0:e.length;return r?kr(e,1):[]}var xe=eE;function tE(e){return typeof e=="function"?e:nt}var vl=tE;function rE(e,r){var s=b(e)?Ds:Ge;return s(e,vl(r))}var S=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=b(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])}),oi=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&&an(e,r,wl)}var I=hE;var dE="[object String]";function pE(e){return typeof e=="string"||!b(e)&&ue(e)&&Pe(e)==dE}var Se=pE;function mE(e,r){return Et(r,function(s){return e[s]})}var Pl=mE;function gE(e){return e==null?[]:Pl(e,H(e))}var V=gE;var TE=Math.max;function EE(e,r,s,n){e=me(e)?e:V(e),s=s&&!n?yt(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&&Cr(e,r,s)>-1}var te=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:yt(s);if(i<0)i=yE(n+i,0);return Cr(e,r,i)}var cn=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)&&(b(e)||typeof e=="string"||typeof e.splice=="function"||pt(e)||gr(e)||Bt(e)))return!e.length;var r=it(e);if(r==xE||r==SE)return!e.size;if(dt(e))return!Us(e).length;for(var s in e)if(OE.call(e,s))return!1;return!0}var U=LE;var IE="[object RegExp]";function NE(e){return ue(e)&&Pe(e)==IE}var Ul=NE;var Dl=He&&He.isRegExp,bE=Dl?mt(Dl):Ul,Ze=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 ot=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=At(r[i]),f=s;if(a==="__proto__"||a==="constructor"||a==="prototype")return e;if(i!=c){var d=u[a];if(f=n?n(d,a,u):void 0,f===void 0)f=ne(d)?d:Dt(r[i+1])?[]:{}}Ut(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=wr(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=Et(Ks(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=b(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=b(e)?xr:ln;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=b(e)?en:jl;if(s&&Ft(e,r,s))r=void 0;return n(e,ge(r,3))}var ss=WE;var jE=1/0,KE=!(Vt&&1/_r(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=Js,o=e.length,c=!0,u=[],a=u;if(s)c=!1,i=Zs;else if(o>=zE){var f=r?null:Kl(e);if(f)return _r(f);c=!1,i=vr,a=new br}else a=r?[]:u;e:while(++n<o){var d=e[n],m=r?r(d):d;if(d=s||d!==0?d:0,c&&m===m){var g=a.length;while(g--)if(a[g]===m)continue e;if(r)a.push(m);u.push(d)}else if(!i(a,m,s)){if(a!==u)a.push(m);u.push(d)}}return u}var zl=VE;function HE(e){return e&&e.length?zl(e):[]}var Pr=HE;function Ur(e){if(console&&console.error)console.error(`Error: ${e}`)}function ns(e){if(console&&console.warn)console.warn(`Warning: ${e}`)}function is(e){let r=new Date().getTime(),s=e();return{time:new Date().getTime()-r,value:s}}function os(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 Qe{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),S(this.definition,(r)=>{r.accept(e)})}}class Z extends Qe{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 Qe{constructor(e){super(e.definition);this.orgText="",Ne(this,We(e,(r)=>r!==void 0))}}class Q extends Qe{constructor(e){super(e.definition);this.ignoreAmbiguities=!1,Ne(this,We(e,(r)=>r!==void 0))}}class re extends Qe{constructor(e){super(e.definition);this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}}class Ee extends Qe{constructor(e){super(e.definition);this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}}class ye extends Qe{constructor(e){super(e.definition);this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}}class B extends Qe{constructor(e){super(e.definition);this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}}class he extends Qe{constructor(e){super(e.definition);this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}}class de extends Qe{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 D{constructor(e){this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}accept(e){e.visit(this)}}function un(e){return A(e,Dr)}function Dr(e){function r(s){return A(s,Dr)}if(e instanceof Z){let s={type:"NonTerminal",name:e.nonTerminalName,idx:e.idx};if(Se(e.label))s.label=e.label;return s}else if(e instanceof Q)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:Dr(new D({terminalType:e.separator})),definition:r(e.definition)};else if(e instanceof he)return{type:"RepetitionWithSeparator",idx:e.idx,separator:Dr(new D({terminalType:e.separator})),definition:r(e.definition)};else if(e instanceof B)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 D){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=Ze(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 Z:return this.visitNonTerminal(r);case Q: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 B:return this.visitRepetition(r);case de:return this.visitAlternation(r);case D: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 ai(e){return e instanceof Q||e instanceof re||e instanceof B||e instanceof Ee||e instanceof ye||e instanceof he||e instanceof D||e instanceof je}function rr(e,r=[]){if(e instanceof re||e instanceof B||e instanceof he)return!0;if(e instanceof de)return ss(e.definition,(n)=>rr(n,r));else if(e instanceof Z&&te(r,e))return!1;else if(e instanceof Qe){if(e instanceof Z)r.push(e);return ve(e.definition,(n)=>rr(n,r))}else return!1}function li(e){return e instanceof de}function ze(e){if(e instanceof Z)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 B)return"MANY";else if(e instanceof D)return"CONSUME";else throw Error("non exhaustive match")}class Jt{walk(e,r=[]){S(e.definition,(s,n)=>{let i=fe(e.definition,n+1);if(s instanceof Z)this.walkProdRef(s,i,r);else if(s instanceof D)this.walkTerminal(s,i,r);else if(s instanceof Q)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 B)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);S(e.definition,(i)=>{let o=new Q({definition:[i]});this.walk(o,n)})}}function Vl(e,r,s){return[new re({definition:[new D({terminalType:e.separator})].concat(e.definition)})].concat(r,s)}function sr(e){if(e instanceof Z)return sr(e.referencedRule);else if(e instanceof D)return ZE(e);else if(ai(e))return qE(e);else if(li(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 Pr(r)}function JE(e){let r=A(e.definition,(s)=>sr(s));return Pr(xe(r))}function ZE(e){return[e.terminalType]}var fn="_~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 Q({definition:i}),c=sr(o);this.follows[n]=c}}function Yl(e){let r={};return S(e,(s)=>{let n=new Hl(s).startWalking();Ne(r,n)}),r}function QE(e,r){return e.name+r+fn}function M(e){return e.charCodeAt(0)}function hn(e,r){if(Array.isArray(e))e.forEach(function(s){r.push(s)});else r.push(e)}function Fr(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 as(){throw Error("Internal Error - Should never get here!")}function ci(e){return e.type==="Character"}var ls=[];for(let e=M("0");e<=M("9");e++)ls.push(e);var cs=[M("_")].concat(ls);for(let e=M("a");e<=M("z");e++)cs.push(e);for(let e=M("A");e<=M("Z");e++)cs.push(e);var ui=[M(" "),M("\f"),M(`
|
|
2
|
+
`),M("\r"),M("\t"),M("\v"),M("\t"),M(" "),M(" "),M(" "),M(" "),M(" "),M(" "),M(" "),M(" "),M(" "),M(" "),M(" "),M(" "),M(" "),M("\u2028"),M("\u2029"),M(" "),M(" "),M(" "),M("\uFEFF")];var ey=/[0-9a-fA-F]/,pn=/[0-9]/,ty=/[1-9]/;class mn{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":Fr(s,"global");break;case"i":Fr(s,"ignoreCase");break;case"m":Fr(s,"multiLine");break;case"u":Fr(s,"unicode");break;case"y":Fr(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 as()}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 as()}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[M(`
|
|
3
|
+
`),M("\r"),M("\u2028"),M("\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=ls;break;case"D":e=ls,r=!0;break;case"s":e=ui;break;case"S":e=ui,r=!0;break;case"w":e=cs;break;case"W":e=cs,r=!0;break}if(nr(e))return{type:"Set",value:e,complement:r};return as()}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=M("\f");break;case"n":e=M(`
|
|
4
|
+
`);break;case"r":e=M("\r");break;case"t":e=M("\t");break;case"v":e=M("\v");break}if(nr(e))return{type:"Character",value:e};return as()}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:M("\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:M(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:M(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(ci(s)&&this.isRangeDash()){this.consumeChar("-");let i=this.classAtom(),o=i.type==="Character";if(ci(i)){if(i.value<s.value)throw Error("Range out of order in character class");e.push({from:s.value,to:i.value})}else hn(s.value,e),e.push(M("-")),hn(i.value,e)}else hn(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:M("\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(pn.test(this.peekChar(0)))e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(pn.test(e)===!1)throw Error("Expecting an integer");while(pn.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:M(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 pn.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 gn={},ry=new mn;function Br(e){let r=e.toString();if(gn.hasOwnProperty(r))return gn[r];else{let s=ry.pattern(r);return gn[r]=s,s}}function Xl(){gn={}}var Jl="Complement Sets are not supported for first char optimization",us=`Unable to use "first char" lexer optimizations:
|
|
10
10
|
`;function Zl(e,r=!1){try{let s=Br(e);return fi(s.value,{},s.flags.ignoreCase)}catch(s){if(s.message===Jl){if(r)ns(`${us} Unable to optimize: < ${e.toString()} >
|
|
@@ -15,43 +15,43 @@ import{t,l,K,E,X,R,M,O,P,z,j,G,p,h,H,cp,st,Ye,Je,Mr,_t,St,Tt,lt}from"./index-hc2
|
|
|
15
15
|
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`;Ur(`${us}
|
|
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 fi(e,r,s){switch(e.type){case"Disjunction":for(let i=0;i<e.value.length;i++)fi(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":Tn(c.value,r,s);break;case"Set":if(c.complement===!0)throw Error(Jl);S(c.value,(a)=>{if(typeof a==="number")Tn(a,r,s);else{let f=a;if(s===!0)for(let d=f.from;d<=f.to;d++)Tn(d,r,s);else{for(let d=f.from;d<=f.to&&d<$r;d++)Tn(d,r,s);if(f.to>=$r){let d=f.from>=$r?f.from:$r,m=f.to,g=Rt(d),y=Rt(m);for(let
|
|
19
|
-
`],tracer:(
|
|
18
|
+
Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+n)}}return[]}function fi(e,r,s){switch(e.type){case"Disjunction":for(let i=0;i<e.value.length;i++)fi(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":Tn(c.value,r,s);break;case"Set":if(c.complement===!0)throw Error(Jl);S(c.value,(a)=>{if(typeof a==="number")Tn(a,r,s);else{let f=a;if(s===!0)for(let d=f.from;d<=f.to;d++)Tn(d,r,s);else{for(let d=f.from;d<=f.to&&d<$r;d++)Tn(d,r,s);if(f.to>=$r){let d=f.from>=$r?f.from:$r,m=f.to,g=Rt(d),y=Rt(m);for(let k=g;k<=y;k++)r[k]=k}}}});break;case"Group":fi(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"&&hi(c)===!1||c.type!=="Group"&&u===!1)break}break;default:throw Error("non exhaustive match!")}return V(r)}function Tn(e,r,s){let n=Rt(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=Rt(n.charCodeAt(0));r[i]=i}else{let i=s.toLowerCase();if(i!==s){let o=Rt(i.charCodeAt(0));r[o]=o}}}function ql(e,r){return xt(e.value,(s)=>{if(typeof s==="number")return te(r,s);else{let n=s;return xt(r,(i)=>n.from<=i&&i<=n.to)!==void 0}})}function hi(e){let r=e.quantifier;if(r&&r.atLeast===0)return!0;if(!e.value)return!1;return b(e.value)?ve(e.value,hi):hi(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(te(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 En(e,r){if(r instanceof RegExp){let s=Br(r),n=new Ql(e);return n.visit(s),n.found}else return xt(r,(s)=>te(e,s.charCodeAt(0)))!==void 0}var or="PATTERN",Gr="defaultMode",yn="modes";function tc(e,r){r=Nr(r,{debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
|
|
19
|
+
`],tracer:(N,T)=>T()});let s=r.tracer;s("initCharCodeToOptimizedIndexMap",()=>{Sy()});let n;s("Reject Lexer.NA",()=>{n=qt(e,(N)=>N[or]===ie.NA)});let i=!1,o;s("Transform Patterns",()=>{i=!1,o=A(n,(N)=>{let T=N[or];if(Ze(T)){let w=T.source;if(w.length===1&&w!=="^"&&w!=="$"&&w!=="."&&!T.ignoreCase)return w;else if(w.length===2&&w[0]==="\\"&&!te(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],w[1]))return w[1];else return ec(T)}else if(Ue(T))return i=!0,{exec:T};else if(typeof T==="object")return i=!0,T;else if(typeof T==="string")if(T.length===1)return T;else{let w=T.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),ee=new RegExp(w);return ec(ee)}else throw Error("non exhaustive match")})});let c,u,a,f,d;s("misc mapping",()=>{c=A(n,(N)=>N.tokenTypeIdx),u=A(n,(N)=>{let T=N.GROUP;if(T===ie.SKIPPED)return;else if(Se(T))return T;else if(_e(T))return!1;else throw Error("non exhaustive match")}),a=A(n,(N)=>{let T=N.LONGER_ALT;if(T)return b(T)?A(T,(ee)=>cn(n,ee)):[cn(n,T)]}),f=A(n,(N)=>N.PUSH_MODE),d=A(n,(N)=>I(N,"POP_MODE"))});let m;s("Line Terminator Handling",()=>{let N=cc(r.lineTerminatorCharacters);if(m=A(n,(T)=>!1),r.positionTracking!=="onlyOffset")m=A(n,(T)=>{if(I(T,"LINE_BREAKS"))return!!T.LINE_BREAKS;else return lc(T,N)===!1&&En(N,T.PATTERN)})});let g,y,k,_;s("Misc Mapping #2",()=>{g=A(n,oc),y=A(o,Ay),k=Te(n,(N,T)=>{let w=T.GROUP;if(Se(w)&&w!==ie.SKIPPED)N[w]=[];return N},{}),_=A(o,(N,T)=>({pattern:o[T],longerAlt:a[T],canLineTerminator:m[T],isCustom:g[T],short:y[T],group:u[T],push:f[T],pop:d[T],tokenTypeIdx:c[T],tokenType:n[T]}))});let C=!0,x=[];if(!r.safeMode)s("First Char Optimization",()=>{x=Te(n,(N,T,w)=>{if(typeof T.PATTERN==="string"){let ee=T.PATTERN.charCodeAt(0),Ce=Rt(ee);di(N,Ce,_[w])}else if(b(T.START_CHARS_HINT)){let ee;S(T.START_CHARS_HINT,(Ce)=>{let Xr=typeof Ce==="string"?Ce.charCodeAt(0):Ce,Ot=Rt(Xr);if(ee!==Ot)ee=Ot,di(N,Ot,_[w])})}else if(Ze(T.PATTERN))if(T.PATTERN.unicode){if(C=!1,r.ensureOptimizations)Ur(`${us} Unable to analyze < ${T.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 ee=Zl(T.PATTERN,r.ensureOptimizations);if(U(ee))
|
|
22
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`)}else{let ee=Zl(T.PATTERN,r.ensureOptimizations);if(U(ee))C=!1;S(ee,(Ce)=>{di(N,Ce,_[w])})}else{if(r.ensureOptimizations)Ur(`${us} TokenType: <${T.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`);C=!1}return N},[])});return{emptyGroups:k,patternIdxToConfig:_,charCodeToPatternIdxToConfig:x,hasCustom:i,canBeOptimized:C}}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)=>Ze(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)=>!I(i,or)),s=A(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!Ze(o)&&!Ue(o)&&!I(o,"exec")&&!Se(o)}),s=A(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=Br(o),u=new r;return u.visit(c),u.found}catch(c){return ay.test(o.source)}});return A(s,(i)=>({message:`Unexpected RegExp Anchor Error:
|
|
25
25
|
Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
|
|
26
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 A(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=Br(o),u=new r;return u.visit(c),u.found}catch(c){return uy.test(o.source)}});return A(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 A(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=A(e,(o)=>Te(e,(c,u)=>{if(o.PATTERN.source===u.PATTERN.source&&!te(r,u)&&u.PATTERN!==ie.NA)return r.push(u),c.push(u),c;return c},[]));s=gt(s);let n=ke(s,(o)=>o.length>1);return A(n,(o)=>{let c=A(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(!
|
|
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 A(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=A(e,(o)=>Te(e,(c,u)=>{if(o.PATTERN.source===u.PATTERN.source&&!te(r,u)&&u.PATTERN!==ie.NA)return r.push(u),c.push(u),c;return c},[]));s=gt(s);let n=ke(s,(o)=>o.length>1);return A(n,(o)=>{let c=A(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(!I(n,"GROUP"))return!1;let i=n.GROUP;return i!==ie.SKIPPED&&i!==ie.NA&&!Se(i)});return A(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&&!te(r,i.PUSH_MODE));return A(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(Ze(c)&&Ey(c))n.push({str:c.source,idx:o,tokenType:i});return n},[]);return S(e,(n,i)=>{S(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(Ze(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=gt(xe(
|
|
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(Ze(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(I(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 xt([".","\\","[","]","|","^","$","(",")","?","*","+","{"],(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(!I(e,Gr))n.push({message:"A MultiMode Lexer cannot be initialized without a <"+Gr+`> property in its definition
|
|
31
|
+
`,type:se.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE});if(!I(e,yn))n.push({message:"A MultiMode Lexer cannot be initialized without a <"+yn+`> property in its definition
|
|
32
|
+
`,type:se.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY});if(I(e,yn)&&I(e,Gr)&&!I(e.modes,e.defaultMode))n.push({message:`A MultiMode Lexer cannot be initialized with a ${Gr}: <${e.defaultMode}>which does not exist
|
|
33
|
+
`,type:se.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST});if(I(e,yn))S(e.modes,(i,o)=>{S(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(I(c,"LONGER_ALT")){let a=b(c.LONGER_ALT)?c.LONGER_ALT:[c.LONGER_ALT];S(a,(f)=>{if(!_e(f)&&!te(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=gt(xe(V(e.modes))),c=qt(o,(a)=>a[or]===ie.NA),u=cc(s);if(r)S(c,(a)=>{let f=lc(a,u);if(f!==!1){let m={message:xy(a,f),type:f.issue,tokenType:a};n.push(m)}else if(I(a,"LINE_BREAKS")){if(a.LINE_BREAKS===!0)i=!0}else if(En(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=
|
|
39
|
+
for details.`,type:se.NO_LINE_BREAKS_FLAGS});return n}function ic(e){let r={},s=H(e);return S(s,(n)=>{let i=e[n];if(b(i))r[n]=[];else throw Error("non exhaustive match")}),r}function oc(e){let r=e.PATTERN;if(Ze(r))return!1;else if(Ue(r))return!0;else if(I(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(I(e,"LINE_BREAKS"))return!1;else if(Ze(e.PATTERN)){try{En(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 A(e,(s)=>{if(Se(s))return s.charCodeAt(0);else return s})}function di(e,r,s){if(e[r]===void 0)e[r]=[s];else e[r].push(s)}var $r=256,An=[];function Rt(e){return e<$r?e:An[e]}function Sy(){if(U(An)){An=Array(65536);for(let e=0;e<65536;e++)An[e]=e>255?255+~~(e/255):e}}function Ct(e,r){let s=e.tokenTypeIdx;if(s===r.tokenTypeIdx)return!0;else return r.isParent===!0&&r.categoryMatchesMap[s]===!0}function Wr(e,r){return e.tokenTypeIdx===r.tokenTypeIdx}var uc=1,hc={};function vt(e){let r=Ry(e);Oy(r),Iy(r),Ly(r),S(r,(s)=>{s.isParent=s.categoryMatches.length>0})}function Ry(e){let r=q(e),s=e,n=!0;while(n){s=gt(xe(A(s,(o)=>o.CATEGORIES)));let i=Ht(s,r);if(r=r.concat(i),U(i))n=!1;else s=i}return r}function Oy(e){S(e,(r)=>{if(!pi(r))hc[uc]=r,r.tokenTypeIdx=uc++;if(fc(r)&&!
|
|
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 A(e,(s)=>{if(Se(s))return s.charCodeAt(0);else return s})}function di(e,r,s){if(e[r]===void 0)e[r]=[s];else e[r].push(s)}var $r=256,An=[];function Rt(e){return e<$r?e:An[e]}function Sy(){if(U(An)){An=Array(65536);for(let e=0;e<65536;e++)An[e]=e>255?255+~~(e/255):e}}function Ct(e,r){let s=e.tokenTypeIdx;if(s===r.tokenTypeIdx)return!0;else return r.isParent===!0&&r.categoryMatchesMap[s]===!0}function Wr(e,r){return e.tokenTypeIdx===r.tokenTypeIdx}var uc=1,hc={};function vt(e){let r=Ry(e);Oy(r),Iy(r),Ly(r),S(r,(s)=>{s.isParent=s.categoryMatches.length>0})}function Ry(e){let r=q(e),s=e,n=!0;while(n){s=gt(xe(A(s,(o)=>o.CATEGORIES)));let i=Ht(s,r);if(r=r.concat(i),U(i))n=!1;else s=i}return r}function Oy(e){S(e,(r)=>{if(!pi(r))hc[uc]=r,r.tokenTypeIdx=uc++;if(fc(r)&&!b(r.CATEGORIES))r.CATEGORIES=[r.CATEGORIES];if(!fc(r))r.CATEGORIES=[];if(!Ny(r))r.categoryMatches=[];if(!by(r))r.categoryMatchesMap={}})}function Ly(e){S(e,(r)=>{r.categoryMatches=[],S(r.categoryMatchesMap,(s,n)=>{r.categoryMatches.push(hc[n].tokenTypeIdx)})})}function Iy(e){S(e,(r)=>{dc([],r)})}function dc(e,r){S(e,(s)=>{r.categoryMatchesMap[s.tokenTypeIdx]=!0}),S(r.CATEGORIES,(s)=>{let n=e.concat(r);if(!te(n,s))dc(n,s)})}function pi(e){return I(e,"tokenTypeIdx")}function fc(e){return I(e,"CATEGORIES")}function Ny(e){return I(e,"categoryMatches")}function by(e){return I(e,"categoryMatchesMap")}function pc(e){return I(e,"tokenTypeIdx")}var mi={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 fs={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
|
|
45
45
|
`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:mi,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(fs);class ie{constructor(e,r=fs){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}=is(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({},fs,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===fs.lineTerminatorsPattern)this.config.lineTerminatorsPattern=ac;else if(this.config.lineTerminatorCharacters===fs.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),b(e))n={modes:{defaultMode:q(e)},defaultMode:Gr};else i=!1,n=q(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:{},S(n.modes,(c,u)=>{n.modes[u]=qt(c,(a)=>_e(a))});let o=H(n.modes);if(S(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(U(this.lexerDefinitionErrors)){vt(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,!U(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){let u=A(this.lexerDefinitionErrors,(a)=>a.message).join(`-----------------------
|
|
48
48
|
`);throw Error(`Errors detected in definition of Lexer:
|
|
49
49
|
`+u)}S(this.lexerDefinitionWarning,(c)=>{ns(c.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(i)this.handleModes=le;if(this.trackStartLines===!1)this.computeNewColumn=nt;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&&!U(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
51
|
Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{Xl()}),this.TRACE_INIT("toFastProperties",()=>{os(this)})})}tokenize(e,r=this.defaultMode){if(!U(this.lexerDefinitionErrors)){let n=A(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,d,m,g,y,
|
|
54
|
-
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;if(
|
|
53
|
+
`+n)}return this.tokenizeInternal(e,r)}tokenizeInternal(e,r){let s,n,i,o,c,u,a,f,d,m,g,y,k,_,C,x=e,N=x.length,T=0,w=0,ee=this.hasCustom?0:Math.floor(e.length/10),Ce=Array(ee),Xr=[],Ot=this.trackStartLines?1:void 0,ut=this.trackStartLines?1:void 0,qr=ic(this.emptyGroups),ff=this.trackStartLines,qn=this.config.lineTerminatorsPattern,Ns=0,wt=[],Jr=[],Zr=[],Ji=[];Object.freeze(Ji);let Qr=!1,hf=(Be)=>{if(Zr.length===1&&Be.tokenType.PUSH_MODE===void 0){let Xe=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(Be);Xr.push({offset:Be.startOffset,line:Be.startLine,column:Be.startColumn,length:Be.image.length,message:Xe})}else{Zr.pop();let Xe=ot(Zr);wt=this.patternIdxToConfig[Xe],Jr=this.charCodeToPatternIdxToConfig[Xe],Ns=wt.length;let Jn=this.canModeBeOptimized[Xe]&&this.config.safeMode===!1;if(Jr&&Jn)Qr=!0;else Qr=!1}};function Zi(Be){Zr.push(Be),Jr=this.charCodeToPatternIdxToConfig[Be],wt=this.patternIdxToConfig[Be],Ns=wt.length,Ns=wt.length;let Xe=this.canModeBeOptimized[Be]&&this.config.safeMode===!1;if(Jr&&Xe)Qr=!0;else Qr=!1}Zi.call(this,r);let rt,Qi=this.config.recoveryEnabled;while(T<N){u=null,d=-1;let Be=x.charCodeAt(T),Xe;if(Qr){let we=Rt(Be),qe=Jr[we];Xe=qe!==void 0?qe:Ji}else Xe=wt;let Jn=Xe.length;for(s=0;s<Jn;s++){rt=Xe[s];let we=rt.pattern;a=null;let qe=rt.short;if(qe!==!1){if(Be===qe)d=1,u=we}else if(rt.isCustom===!0)if(C=we.exec(x,T,Ce,qr),C!==null){if(u=C[0],d=u.length,C.payload!==void 0)a=C.payload}else u=null;else we.lastIndex=T,d=this.matchLength(we,e,T);if(d!==-1){if(c=rt.longerAlt,c!==void 0){u=e.substring(T,T+d);let Pt=c.length;for(i=0;i<Pt;i++){let Lt=wt[c[i]],Qt=Lt.pattern;if(f=null,Lt.isCustom===!0)if(C=Qt.exec(x,T,Ce,qr),C!==null){if(o=C[0],C.payload!==void 0)f=C.payload}else o=null;else Qt.lastIndex=T,o=this.match(Qt,e,T);if(o&&o.length>u.length){u=o,d=o.length,a=f,rt=Lt;break}}}break}}if(d!==-1){if(m=rt.group,m!==void 0)if(u=u!==null?u:e.substring(T,T+d),g=rt.tokenTypeIdx,y=this.createTokenInstance(u,T,g,rt.tokenType,Ot,ut,d),this.handlePayload(y,a),m===!1)w=this.addToken(Ce,w,y);else qr[m].push(y);if(ff===!0&&rt.canLineTerminator===!0){let we=0,qe,Pt;qn.lastIndex=0;do if(u=u!==null?u:e.substring(T,T+d),qe=qn.test(u),qe===!0)Pt=qn.lastIndex-1,we++;while(qe===!0);if(we!==0)Ot=Ot+we,ut=d-Pt,this.updateTokenEndLineColumnLocation(y,m,Pt,we,Ot,ut,d);else ut=this.computeNewColumn(ut,d)}else ut=this.computeNewColumn(ut,d);T=T+d,this.handleModes(rt,hf,Zi,y)}else{let we=T,qe=Ot,Pt=ut,Lt=Qi===!1;while(Lt===!1&&T<N){T++;for(n=0;n<Ns;n++){let Qt=wt[n],{pattern:Zn,short:eo}=Qt;if(eo!==!1){if(x.charCodeAt(T)===eo)Lt=!0}else if(Qt.isCustom===!0)Lt=Zn.exec(x,T,Ce,qr)!==null;else Zn.lastIndex=T,Lt=Zn.exec(e)!==null;if(Lt===!0)break}}if(k=T-we,ut=this.computeNewColumn(ut,k),_=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(x,we,k,qe,Pt,ot(Zr)),Xr.push({offset:we,line:qe,column:Pt,length:k,message:_}),Qi===!1)break}}if(!this.hasCustom)Ce.length=w;return{tokens:Ce,groups:qr,errors:Xr}}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(gi(e))return e.LABEL;else return e.name}function gi(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 v(e){return vy(e)}function vy(e){let r=e.pattern,s={};if(s.name=e.name,!_e(r))s.PATTERN=r;if(I(e,Cy))throw`The parent property is no longer supported.
|
|
54
|
+
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;if(I(e,mc))s.CATEGORIES=e[mc];if(vt([s]),I(e,gc))s.LABEL=e[gc];if(I(e,Tc))s.GROUP=e[Tc];if(I(e,yc))s.POP_MODE=e[yc];if(I(e,Ec))s.PUSH_MODE=e[Ec];if(I(e,Ac))s.LONGER_ALT=e[Ac];if(I(e,xc))s.LINE_BREAKS=e[xc];if(I(e,Sc))s.START_CHARS_HINT=e[Sc];return s}var Ve=v({name:"EOF",pattern:ie.NA});vt([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 hs(e,r){return Ct(e,r)}var xn={buildMismatchTokenMessage({expected:e,actual:r,previous:s,ruleName:n}){return`Expecting ${gi(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
55
|
but found: '`+Le(r).image+"'";if(n)return"Expecting: "+n+u;else{let a=Te(e,(g,y)=>g.concat(y),[]),f=A(a,(g)=>`[${A(g,(y)=>ar(y)).join(", ")}]`);return`Expecting: one of these possible Token sequences:
|
|
56
56
|
${A(f,(g,y)=>` ${y+1}. ${g}`).join(`
|
|
57
57
|
`)}`+u}},buildEarlyExitMessage({expectedIterationPaths:e,actual:r,customUserDescription:s,ruleName:n}){let c=`
|
|
@@ -83,39 +83,39 @@ 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(){S(W(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=q(this.path.ruleStack).reverse(),this.occurrenceStack=q(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(U(this.ruleStack))this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0;else this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop()}}class Ti 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 Q({definition:n});this.possibleTokTypes=sr(i),this.found=!0}}}class ds 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 Ei extends ds{walkMany(e,r,s){if(e.idx===this.occurrence){let n=Le(r.concat(s));if(this.result.isEndOfRule=n===void 0,n instanceof D)this.result.token=n.terminalType,this.result.occurrence=n.idx}else super.walkMany(e,r,s)}}class Sn extends ds{walkManySep(e,r,s){if(e.idx===this.occurrence){let n=Le(r.concat(s));if(this.result.isEndOfRule=n===void 0,n instanceof D)this.result.token=n.terminalType,this.result.occurrence=n.idx}else super.walkManySep(e,r,s)}}class yi extends ds{walkAtLeastOne(e,r,s){if(e.idx===this.occurrence){let n=Le(r.concat(s));if(this.result.isEndOfRule=n===void 0,n instanceof D)this.result.token=n.terminalType,this.result.occurrence=n.idx}else super.walkAtLeastOne(e,r,s)}}class Rn extends ds{walkAtLeastOneSep(e,r,s){if(e.idx===this.occurrence){let n=Le(r.concat(s));if(this.result.isEndOfRule=n===void 0,n instanceof D)this.result.token=n.terminalType,this.result.occurrence=n.idx}else super.walkAtLeastOneSep(e,r,s)}}function On(e,r,s=[]){s=q(s);let n=[],i=0;function o(u){return u.concat(fe(e,i+1))}function c(u){let a=On(o(u),r,s);return n.concat(a)}while(s.length<r&&i<e.length){let u=e[i];if(u instanceof Q)return c(u.definition);else if(u instanceof Z)return c(u.definition);else if(u instanceof re)n=c(u.definition);else if(u instanceof Ee){let a=u.definition.concat([new B({definition:u.definition})]);return c(a)}else if(u instanceof ye){let a=[new Q({definition:u.definition}),new B({definition:[new D({terminalType:u.separator})].concat(u.definition)})];return c(a)}else if(u instanceof he){let a=u.definition.concat([new B({definition:[new D({terminalType:u.separator})].concat(u.definition)})]);n=c(a)}else if(u instanceof B){let a=u.definition.concat([new B({definition:u.definition})]);n=c(a)}else if(u instanceof de)return S(u.definition,(a)=>{if(U(a.definition)===!1)n=c(a.definition)}),n;else if(u instanceof D)s.push(u.terminalType);else throw Error("non exhaustive match");i++}return n.push({partialPath:s,suffixDef:fe(e,i)}),n}function Ln(e,r,s,n){let o=["EXIT_NONE_TERMINAL"],c="EXIT_ALTERNATIVE",u=!1,a=r.length,f=a-n-1,d=[],m=[];m.push({idx:-1,def:e,ruleStack:[],occurrenceStack:[]});while(!U(m)){let g=m.pop();if(g==="EXIT_ALTERNATIVE"){if(u&&ot(m).idx<=f)m.pop();continue}let{def:y,idx:v,ruleStack:k,occurrenceStack:b}=g;if(U(y))continue;let x=y[0];if(x==="EXIT_NONE_TERMINAL"){let I={idx:v,def:fe(y),ruleStack:bt(k),occurrenceStack:bt(b)};m.push(I)}else if(x instanceof D)if(v<a-1){let I=v+1,T=r[I];if(s(T,x.terminalType)){let w={idx:I,def:fe(y),ruleStack:k,occurrenceStack:b};m.push(w)}}else if(v===a-1)d.push({nextTokenType:x.terminalType,nextTokenOccurrence:x.idx,ruleStack:k,occurrenceStack:b}),u=!0;else throw Error("non exhaustive match");else if(x instanceof Z){let I=q(k);I.push(x.nonTerminalName);let T=q(b);T.push(x.idx);let w={idx:v,def:x.definition.concat(o,fe(y)),ruleStack:I,occurrenceStack:T};m.push(w)}else if(x instanceof re){let I={idx:v,def:fe(y),ruleStack:k,occurrenceStack:b};m.push(I),m.push("EXIT_ALTERNATIVE");let T={idx:v,def:x.definition.concat(fe(y)),ruleStack:k,occurrenceStack:b};m.push(T)}else if(x instanceof Ee){let I=new B({definition:x.definition,idx:x.idx}),T=x.definition.concat([I],fe(y)),w={idx:v,def:T,ruleStack:k,occurrenceStack:b};m.push(w)}else if(x instanceof ye){let I=new D({terminalType:x.separator}),T=new B({definition:[I].concat(x.definition),idx:x.idx}),w=x.definition.concat([T],fe(y)),ee={idx:v,def:w,ruleStack:k,occurrenceStack:b};m.push(ee)}else if(x instanceof he){let I={idx:v,def:fe(y),ruleStack:k,occurrenceStack:b};m.push(I),m.push("EXIT_ALTERNATIVE");let T=new D({terminalType:x.separator}),w=new B({definition:[T].concat(x.definition),idx:x.idx}),ee=x.definition.concat([w],fe(y)),Ce={idx:v,def:ee,ruleStack:k,occurrenceStack:b};m.push(Ce)}else if(x instanceof B){let I={idx:v,def:fe(y),ruleStack:k,occurrenceStack:b};m.push(I),m.push("EXIT_ALTERNATIVE");let T=new B({definition:x.definition,idx:x.idx}),w=x.definition.concat([T],fe(y)),ee={idx:v,def:w,ruleStack:k,occurrenceStack:b};m.push(ee)}else if(x instanceof de)for(let I=x.definition.length-1;I>=0;I--){let T=x.definition[I],w={idx:v,def:T.definition.concat(fe(y)),ruleStack:k,occurrenceStack:b};m.push(w),m.push("EXIT_ALTERNATIVE")}else if(x instanceof Q)m.push({idx:v,def:x.definition.concat(fe(y)),ruleStack:k,occurrenceStack:b});else if(x instanceof je)m.push(ky(x,v,k,b));else throw Error("non exhaustive match")}return d}function ky(e,r,s,n){let i=q(s);i.push(e.name);let o=q(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 In(e){if(e instanceof re||e==="Option")return oe.OPTION;else if(e instanceof B||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=ps(e,r,s),u=Pc(c)?Wr:Ct;return o(c,n,u,i)}function Cc(e,r,s,n,i,o){let c=ms(e,r,i,s),u=Pc(c)?Wr:Ct;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=A(c,(a)=>a.GATE);for(let a=0;a<i;a++){let f=e[a],d=f.length,m=u[a];if(m!==void 0&&m.call(this)===!1)continue;e:for(let g=0;g<d;g++){let y=f[g],v=y.length;for(let k=0;k<v;k++){let b=this.LA(k+1);if(s(b,y[k])===!1)continue e}return a}}return};else if(o&&!n){let c=A(e,(a)=>xe(a)),u=Te(c,(a,f,d)=>(S(f,(m)=>{if(!L(a,m.tokenTypeIdx))a[m.tokenTypeIdx]=d;S(m.categoryMatches,(g)=>{if(!L(a,g))a[g]=d})}),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 d=u[f],m=d.length;for(let g=0;g<m;g++){let y=this.LA(g+1);if(s(y,d[g])===!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&&U(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,S(a.categoryMatches,(d)=>{u[d]=!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 xi 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 Ai(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=A(e,(c)=>On([c],1)),n=Nc(s.length),i=A(s,(c)=>{let u={};return S(c,(a)=>{let f=Ai(a.partialPath);S(f,(d)=>{u[d]=!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 d=0;d<f.length;d++){let m=f[d].partialPath,g=f[d].suffixDef,y=Ai(m);if(_y(i,y,a)||U(g)||m.length===r){let k=n[a];if(Nn(k,m)===!1){k.push(m);for(let b=0;b<y.length;b++){let x=y[b];i[a][x]=!0}}}else{let k=On(g,c+1,m);o[a]=o[a].concat(k),S(k,(b)=>{let x=Ai(b.partialPath);S(x,(I)=>{i[a][I]=!0})})}}}}return n}function ps(e,r,s,n){let i=new xi(e,oe.ALTERNATION,n);return r.accept(i),Mc(i.result,s)}function ms(e,r,s,n){let i=new xi(e,s);r.accept(i);let o=i.result,u=new _c(r,e,s).startWalking(),a=new Q({definition:o}),f=new Q({definition:u});return Mc([a,f],n)}function Nn(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)=>U(n.categoryMatches))))}function Uc(e){let r=e.lookaheadStrategy.validate({rules:e.rules,tokenTypes:e.tokenTypes,grammarName:e.grammarName});return A(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=oi(n,wy),o=We(i,(u)=>u.length>1);return A(W(o),(u)=>{let a=Le(u),f=r.buildDuplicateFoundError(e,u),d=ze(a),m={message:f,type:Re.DUPLICATE_PRODUCTIONS,ruleName:e.name,dslName:d,occurrence:a.idx},g=Fc(a);if(g)m.parameter=g;return m})}function wy(e){return`${ze(e)}_#_${e.idx}_#_${Fc(e)}`}function Fc(e){if(e instanceof D)return e.terminalType.name;else if(e instanceof Z)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(!te(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 Si(e,r,s,n=[]){let i=[],o=bn(r.definition);if(U(o))return[];else{let c=e.name;if(te(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,(d)=>{let m=q(n);return m.push(d),Si(e,d,s,m)});return i.concat(f)}}function bn(e){let r=[];if(U(e))return r;let s=Le(e);if(s instanceof Z)r.push(s.referencedRule);else if(s instanceof Q||s instanceof re||s instanceof Ee||s instanceof ye||s instanceof he||s instanceof B)r=r.concat(bn(s.definition));else if(s instanceof de)r=xe(A(s.definition,(o)=>bn(o.definition)));else if(s instanceof D);else throw Error("non exhaustive match");let n=rr(s),i=e.length>1;if(n&&i){let o=fe(e);return r.concat(bn(o))}else return r}class Cn extends Ke{constructor(){super(...arguments);this.alternations=[]}visitAlternation(e){this.alternations.push(e)}}function Gc(e,r){let s=new Cn;e.accept(s);let n=s.alternations;return De(n,(o)=>{let c=bt(o.definition);return De(c,(u,a)=>{let f=Ln([u],[],Ct,1);if(U(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 Cn;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=ps(u,e,a,c),d=Dy(f,c,e,s),m=Fy(f,c,e,s);return d.concat(m)})}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 Cn;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 S(e,(i)=>{let o=new jc;i.accept(o);let c=o.allProductions;S(c,(u)=>{let a=In(u),f=u.maxLookahead||r,d=u.idx,g=ms(d,i,a,f)[0];if(U(xe(g))){let y=s.buildEmptyRepetitionError({topLevelRule:i,repetition:u});n.push({message:y,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 S(a,(d)=>{let m=[f];if(S(e,(g,y)=>{if(f!==y&&Nn(g,d)&&r.definition[y].ignoreAmbiguities!==!0)m.push(y)}),m.length>1&&!Nn(i,d))i.push(d),u.push({alts:m,path:d})}),u},[]);return A(o,(u)=>{let a=A(u.alts,(d)=>d+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=A(u,(d)=>({idx:a,path:d}));return c.concat(f)},[]);return gt(De(i,(c)=>{if(r.definition[c.idx].ignoreAmbiguities===!0)return[];let{idx:a,path:f}=c,d=ke(i,(g)=>r.definition[g.idx].ignoreAmbiguities!==!0&&g.idx<a&&wc(g.path,f));return A(d,(g)=>{let y=[g.idx+1,a+1],v=r.idx===0?"":r.idx;return{message:n.buildAlternationPrefixAmbiguityError({topLevelRule:s,alternation:r,ambiguityIndices:y,prefixPath:g.path}),type:Re.AMBIGUOUS_PREFIX_ALTS,ruleName:s.name,occurrence:v,alternatives:y}})}))}function By(e,r,s){let n=[],i=A(r,(o)=>o.name);return S(e,(o)=>{let c=o.name;if(te(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 S(e.rules,(n)=>{s[n.name]=n}),Oc(s,r.errMsgProvider)}function Vc(e){return e=Ir(e,{errMsgProvider:at}),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 te(Jc,e.name)}class gs 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 jr extends gs{constructor(e,r,s){super(e,r);this.previousToken=s,this.name=Hc}}class vn extends gs{constructor(e,r,s){super(e,r);this.previousToken=s,this.name=Yc}}class kn extends gs{constructor(e,r){super(e,r);this.name=qc}}class _n extends gs{constructor(e,r,s){super(e,r);this.previousToken=s,this.name=Xc}}var Ri={},Oi="InRuleRecoveryException";class Zc extends Error{constructor(e){super(e);this.name=Oi}}class Li{initRecoverable(e){if(this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=L(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),d=()=>{let m=this.LA(0),g=this.errorMessageProvider.buildMismatchTokenMessage({expected:n,actual:a,previous:m,ruleName:this.getCurrRuleFullName()}),y=new jr(g,a,this.LA(0));y.resyncedTokens=bt(c),this.SAVE_ERROR(y)};while(!u)if(this.tokenMatcher(f,n)){d();return}else if(s.call(this)){d(),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(U(r))return!1;let s=this.LA(1);return xt(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 te(s,e)}findReSyncTokenType(){let e=this.flattenFollowSet(),r=this.LA(1),s=2;while(!0){let n=xt(e,(i)=>hs(r,i));if(n!==void 0)return n;r=this.LA(s),s++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return Ri;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 A(e,(s,n)=>{if(n===0)return Ri;return{ruleName:this.shortRuleNameToFullName(s),idxInCallingRule:r[n],inRule:this.shortRuleNameToFullName(e[n-1])}})}flattenFollowSet(){let e=A(this.buildFullFollowKeyStack(),(r)=>this.getFollowSetFromFollowKey(r));return xe(e)}getFollowSetFromFollowKey(e){if(e===Ri)return[Ve];let r=e.ruleName+e.idxInCallingRule+fn+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 bt(r)}attemptInRepetitionRecovery(e,r,s,n,i,o,c){}getCurrentGrammarPath(e,r){let s=this.getHumanReadableRuleStack(),n=q(this.RULE_OCCURRENCE_STACK);return{ruleStack:s,occurrenceStack:n,lastTok:e,lastTokOccurrence:r}}getHumanReadableRuleStack(){return A(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 g=this.getCurrRuleFullName(),y=this.getGAstProductions()[g];a=new o(y,i).startWalking(),this.firstAfterRepMap[u]=a}let f=a.token,d=a.occurrence,m=a.isEndOfRule;if(this.RULE_STACK.length===1&&m&&f===void 0)f=Ve,d=1;if(f===void 0||d===void 0)return;if(this.shouldInRepetitionRecoveryBeTried(f,d,c))this.tryInRepetitionRecovery(e,r,s,f)}var Qc=4,Mn=8;var wn=256,Pn=512,Ts=768,Es=1024,ys=1280,Kr=1536;function Un(e,r,s){return s|r|e}class Dn{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(U(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)=>Si(r,r,at))}validateEmptyOrAlternatives(e){return De(e,(r)=>Gc(r,at))}validateAmbiguousAlternationAlternatives(e,r){return De(e,(s)=>Wc(s,r,at))}validateSomeNonEmptyLookaheadPath(e,r){return Kc(e,r,at)}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,In(e.prodType),kc)}}class Ii{initLooksAhead(e){this.dynamicTokensEnabled=L(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:Fe.dynamicTokensEnabled,this.maxLookahead=L(e,"maxLookahead")?e.maxLookahead:Fe.maxLookahead,this.lookaheadStrategy=L(e,"lookaheadStrategy")?e.lookaheadStrategy:new Dn({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){S(e,(r)=>{this.TRACE_INIT(`${r.name} Rule Lookahead`,()=>{let{alternation:s,repetition:n,option:i,repetitionMandatory:o,repetitionMandatoryWithSeparator:c,repetitionWithSeparator:u}=Gy(r);S(s,(a)=>{let f=a.idx===0?"":a.idx;this.TRACE_INIT(`${ze(a)}${f}`,()=>{let d=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:a.idx,rule:r,maxLookahead:a.maxLookahead||this.maxLookahead,hasPredicates:a.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),m=Un(this.fullRuleNameToShort[r.name],wn,a.idx);this.setLaFuncCache(m,d)})}),S(n,(a)=>{this.computeLookaheadFunc(r,a.idx,Ts,"Repetition",a.maxLookahead,ze(a))}),S(i,(a)=>{this.computeLookaheadFunc(r,a.idx,Pn,"Option",a.maxLookahead,ze(a))}),S(o,(a)=>{this.computeLookaheadFunc(r,a.idx,Es,"RepetitionMandatory",a.maxLookahead,ze(a))}),S(c,(a)=>{this.computeLookaheadFunc(r,a.idx,Kr,"RepetitionMandatoryWithSeparator",a.maxLookahead,ze(a))}),S(u,(a)=>{this.computeLookaheadFunc(r,a.idx,ys,"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=Un(this.fullRuleNameToShort[e.name],s,r);this.setLaFuncCache(u,c)})}getKeyForAutomaticLookahead(e,r){let s=this.getLastExplicitRuleShortName();return Un(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 Fn=new eu;function Gy(e){Fn.reset(),e.accept(Fn);let r=Fn.dslMethods;return Fn.reset(),r}function Ni(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 bi(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 Ci(e,r){Object.defineProperty(e,"name",{enumerable:!1,configurable:!0,writable:!1,value:r})}function Wy(e,r){let s=V(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(){};Ci(s,e+"BaseSemantics");let n={visit:function(i,o){if(N(i))i=i[0];if(_e(i))return;return this[i.name](i.children,o)},validateVisitor:function(){let i=jy(this,r);if(!U(i)){let o=A(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(){S(V(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=q(this.path.ruleStack).reverse(),this.occurrenceStack=q(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(U(this.ruleStack))this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0;else this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop()}}class Ti 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 Q({definition:n});this.possibleTokTypes=sr(i),this.found=!0}}}class ds 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 Ei extends ds{walkMany(e,r,s){if(e.idx===this.occurrence){let n=Le(r.concat(s));if(this.result.isEndOfRule=n===void 0,n instanceof D)this.result.token=n.terminalType,this.result.occurrence=n.idx}else super.walkMany(e,r,s)}}class Sn extends ds{walkManySep(e,r,s){if(e.idx===this.occurrence){let n=Le(r.concat(s));if(this.result.isEndOfRule=n===void 0,n instanceof D)this.result.token=n.terminalType,this.result.occurrence=n.idx}else super.walkManySep(e,r,s)}}class yi extends ds{walkAtLeastOne(e,r,s){if(e.idx===this.occurrence){let n=Le(r.concat(s));if(this.result.isEndOfRule=n===void 0,n instanceof D)this.result.token=n.terminalType,this.result.occurrence=n.idx}else super.walkAtLeastOne(e,r,s)}}class Rn extends ds{walkAtLeastOneSep(e,r,s){if(e.idx===this.occurrence){let n=Le(r.concat(s));if(this.result.isEndOfRule=n===void 0,n instanceof D)this.result.token=n.terminalType,this.result.occurrence=n.idx}else super.walkAtLeastOneSep(e,r,s)}}function On(e,r,s=[]){s=q(s);let n=[],i=0;function o(u){return u.concat(fe(e,i+1))}function c(u){let a=On(o(u),r,s);return n.concat(a)}while(s.length<r&&i<e.length){let u=e[i];if(u instanceof Q)return c(u.definition);else if(u instanceof Z)return c(u.definition);else if(u instanceof re)n=c(u.definition);else if(u instanceof Ee){let a=u.definition.concat([new B({definition:u.definition})]);return c(a)}else if(u instanceof ye){let a=[new Q({definition:u.definition}),new B({definition:[new D({terminalType:u.separator})].concat(u.definition)})];return c(a)}else if(u instanceof he){let a=u.definition.concat([new B({definition:[new D({terminalType:u.separator})].concat(u.definition)})]);n=c(a)}else if(u instanceof B){let a=u.definition.concat([new B({definition:u.definition})]);n=c(a)}else if(u instanceof de)return S(u.definition,(a)=>{if(U(a.definition)===!1)n=c(a.definition)}),n;else if(u instanceof D)s.push(u.terminalType);else throw Error("non exhaustive match");i++}return n.push({partialPath:s,suffixDef:fe(e,i)}),n}function Ln(e,r,s,n){let o=["EXIT_NONE_TERMINAL"],c="EXIT_ALTERNATIVE",u=!1,a=r.length,f=a-n-1,d=[],m=[];m.push({idx:-1,def:e,ruleStack:[],occurrenceStack:[]});while(!U(m)){let g=m.pop();if(g==="EXIT_ALTERNATIVE"){if(u&&ot(m).idx<=f)m.pop();continue}let{def:y,idx:k,ruleStack:_,occurrenceStack:C}=g;if(U(y))continue;let x=y[0];if(x==="EXIT_NONE_TERMINAL"){let N={idx:k,def:fe(y),ruleStack:bt(_),occurrenceStack:bt(C)};m.push(N)}else if(x instanceof D)if(k<a-1){let N=k+1,T=r[N];if(s(T,x.terminalType)){let w={idx:N,def:fe(y),ruleStack:_,occurrenceStack:C};m.push(w)}}else if(k===a-1)d.push({nextTokenType:x.terminalType,nextTokenOccurrence:x.idx,ruleStack:_,occurrenceStack:C}),u=!0;else throw Error("non exhaustive match");else if(x instanceof Z){let N=q(_);N.push(x.nonTerminalName);let T=q(C);T.push(x.idx);let w={idx:k,def:x.definition.concat(o,fe(y)),ruleStack:N,occurrenceStack:T};m.push(w)}else if(x instanceof re){let N={idx:k,def:fe(y),ruleStack:_,occurrenceStack:C};m.push(N),m.push("EXIT_ALTERNATIVE");let T={idx:k,def:x.definition.concat(fe(y)),ruleStack:_,occurrenceStack:C};m.push(T)}else if(x instanceof Ee){let N=new B({definition:x.definition,idx:x.idx}),T=x.definition.concat([N],fe(y)),w={idx:k,def:T,ruleStack:_,occurrenceStack:C};m.push(w)}else if(x instanceof ye){let N=new D({terminalType:x.separator}),T=new B({definition:[N].concat(x.definition),idx:x.idx}),w=x.definition.concat([T],fe(y)),ee={idx:k,def:w,ruleStack:_,occurrenceStack:C};m.push(ee)}else if(x instanceof he){let N={idx:k,def:fe(y),ruleStack:_,occurrenceStack:C};m.push(N),m.push("EXIT_ALTERNATIVE");let T=new D({terminalType:x.separator}),w=new B({definition:[T].concat(x.definition),idx:x.idx}),ee=x.definition.concat([w],fe(y)),Ce={idx:k,def:ee,ruleStack:_,occurrenceStack:C};m.push(Ce)}else if(x instanceof B){let N={idx:k,def:fe(y),ruleStack:_,occurrenceStack:C};m.push(N),m.push("EXIT_ALTERNATIVE");let T=new B({definition:x.definition,idx:x.idx}),w=x.definition.concat([T],fe(y)),ee={idx:k,def:w,ruleStack:_,occurrenceStack:C};m.push(ee)}else if(x instanceof de)for(let N=x.definition.length-1;N>=0;N--){let T=x.definition[N],w={idx:k,def:T.definition.concat(fe(y)),ruleStack:_,occurrenceStack:C};m.push(w),m.push("EXIT_ALTERNATIVE")}else if(x instanceof Q)m.push({idx:k,def:x.definition.concat(fe(y)),ruleStack:_,occurrenceStack:C});else if(x instanceof je)m.push(ky(x,k,_,C));else throw Error("non exhaustive match")}return d}function ky(e,r,s,n){let i=q(s);i.push(e.name);let o=q(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 In(e){if(e instanceof re||e==="Option")return oe.OPTION;else if(e instanceof B||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=ps(e,r,s),u=Pc(c)?Wr:Ct;return o(c,n,u,i)}function Cc(e,r,s,n,i,o){let c=ms(e,r,i,s),u=Pc(c)?Wr:Ct;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=A(c,(a)=>a.GATE);for(let a=0;a<i;a++){let f=e[a],d=f.length,m=u[a];if(m!==void 0&&m.call(this)===!1)continue;e:for(let g=0;g<d;g++){let y=f[g],k=y.length;for(let _=0;_<k;_++){let C=this.LA(_+1);if(s(C,y[_])===!1)continue e}return a}}return};else if(o&&!n){let c=A(e,(a)=>xe(a)),u=Te(c,(a,f,d)=>(S(f,(m)=>{if(!I(a,m.tokenTypeIdx))a[m.tokenTypeIdx]=d;S(m.categoryMatches,(g)=>{if(!I(a,g))a[g]=d})}),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 d=u[f],m=d.length;for(let g=0;g<m;g++){let y=this.LA(g+1);if(s(y,d[g])===!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&&U(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,S(a.categoryMatches,(d)=>{u[d]=!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 xi 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 Ai(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=A(e,(c)=>On([c],1)),n=Nc(s.length),i=A(s,(c)=>{let u={};return S(c,(a)=>{let f=Ai(a.partialPath);S(f,(d)=>{u[d]=!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 d=0;d<f.length;d++){let m=f[d].partialPath,g=f[d].suffixDef,y=Ai(m);if(_y(i,y,a)||U(g)||m.length===r){let _=n[a];if(Nn(_,m)===!1){_.push(m);for(let C=0;C<y.length;C++){let x=y[C];i[a][x]=!0}}}else{let _=On(g,c+1,m);o[a]=o[a].concat(_),S(_,(C)=>{let x=Ai(C.partialPath);S(x,(N)=>{i[a][N]=!0})})}}}}return n}function ps(e,r,s,n){let i=new xi(e,oe.ALTERNATION,n);return r.accept(i),Mc(i.result,s)}function ms(e,r,s,n){let i=new xi(e,s);r.accept(i);let o=i.result,u=new _c(r,e,s).startWalking(),a=new Q({definition:o}),f=new Q({definition:u});return Mc([a,f],n)}function Nn(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)=>U(n.categoryMatches))))}function Uc(e){let r=e.lookaheadStrategy.validate({rules:e.rules,tokenTypes:e.tokenTypes,grammarName:e.grammarName});return A(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=oi(n,wy),o=We(i,(u)=>u.length>1);return A(V(o),(u)=>{let a=Le(u),f=r.buildDuplicateFoundError(e,u),d=ze(a),m={message:f,type:Re.DUPLICATE_PRODUCTIONS,ruleName:e.name,dslName:d,occurrence:a.idx},g=Fc(a);if(g)m.parameter=g;return m})}function wy(e){return`${ze(e)}_#_${e.idx}_#_${Fc(e)}`}function Fc(e){if(e instanceof D)return e.terminalType.name;else if(e instanceof Z)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(!te(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 Si(e,r,s,n=[]){let i=[],o=bn(r.definition);if(U(o))return[];else{let c=e.name;if(te(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,(d)=>{let m=q(n);return m.push(d),Si(e,d,s,m)});return i.concat(f)}}function bn(e){let r=[];if(U(e))return r;let s=Le(e);if(s instanceof Z)r.push(s.referencedRule);else if(s instanceof Q||s instanceof re||s instanceof Ee||s instanceof ye||s instanceof he||s instanceof B)r=r.concat(bn(s.definition));else if(s instanceof de)r=xe(A(s.definition,(o)=>bn(o.definition)));else if(s instanceof D);else throw Error("non exhaustive match");let n=rr(s),i=e.length>1;if(n&&i){let o=fe(e);return r.concat(bn(o))}else return r}class Cn extends Ke{constructor(){super(...arguments);this.alternations=[]}visitAlternation(e){this.alternations.push(e)}}function Gc(e,r){let s=new Cn;e.accept(s);let n=s.alternations;return De(n,(o)=>{let c=bt(o.definition);return De(c,(u,a)=>{let f=Ln([u],[],Ct,1);if(U(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 Cn;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=ps(u,e,a,c),d=Dy(f,c,e,s),m=Fy(f,c,e,s);return d.concat(m)})}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 Cn;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 S(e,(i)=>{let o=new jc;i.accept(o);let c=o.allProductions;S(c,(u)=>{let a=In(u),f=u.maxLookahead||r,d=u.idx,g=ms(d,i,a,f)[0];if(U(xe(g))){let y=s.buildEmptyRepetitionError({topLevelRule:i,repetition:u});n.push({message:y,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 S(a,(d)=>{let m=[f];if(S(e,(g,y)=>{if(f!==y&&Nn(g,d)&&r.definition[y].ignoreAmbiguities!==!0)m.push(y)}),m.length>1&&!Nn(i,d))i.push(d),u.push({alts:m,path:d})}),u},[]);return A(o,(u)=>{let a=A(u.alts,(d)=>d+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=A(u,(d)=>({idx:a,path:d}));return c.concat(f)},[]);return gt(De(i,(c)=>{if(r.definition[c.idx].ignoreAmbiguities===!0)return[];let{idx:a,path:f}=c,d=ke(i,(g)=>r.definition[g.idx].ignoreAmbiguities!==!0&&g.idx<a&&wc(g.path,f));return A(d,(g)=>{let y=[g.idx+1,a+1],k=r.idx===0?"":r.idx;return{message:n.buildAlternationPrefixAmbiguityError({topLevelRule:s,alternation:r,ambiguityIndices:y,prefixPath:g.path}),type:Re.AMBIGUOUS_PREFIX_ALTS,ruleName:s.name,occurrence:k,alternatives:y}})}))}function By(e,r,s){let n=[],i=A(r,(o)=>o.name);return S(e,(o)=>{let c=o.name;if(te(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=Nr(e,{errMsgProvider:Rc}),s={};return S(e.rules,(n)=>{s[n.name]=n}),Oc(s,r.errMsgProvider)}function Vc(e){return e=Nr(e,{errMsgProvider:at}),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 te(Jc,e.name)}class gs 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 jr extends gs{constructor(e,r,s){super(e,r);this.previousToken=s,this.name=Hc}}class vn extends gs{constructor(e,r,s){super(e,r);this.previousToken=s,this.name=Yc}}class kn extends gs{constructor(e,r){super(e,r);this.name=qc}}class _n extends gs{constructor(e,r,s){super(e,r);this.previousToken=s,this.name=Xc}}var Ri={},Oi="InRuleRecoveryException";class Zc extends Error{constructor(e){super(e);this.name=Oi}}class Li{initRecoverable(e){if(this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=I(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),d=()=>{let m=this.LA(0),g=this.errorMessageProvider.buildMismatchTokenMessage({expected:n,actual:a,previous:m,ruleName:this.getCurrRuleFullName()}),y=new jr(g,a,this.LA(0));y.resyncedTokens=bt(c),this.SAVE_ERROR(y)};while(!u)if(this.tokenMatcher(f,n)){d();return}else if(s.call(this)){d(),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(U(r))return!1;let s=this.LA(1);return xt(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 te(s,e)}findReSyncTokenType(){let e=this.flattenFollowSet(),r=this.LA(1),s=2;while(!0){let n=xt(e,(i)=>hs(r,i));if(n!==void 0)return n;r=this.LA(s),s++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return Ri;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 A(e,(s,n)=>{if(n===0)return Ri;return{ruleName:this.shortRuleNameToFullName(s),idxInCallingRule:r[n],inRule:this.shortRuleNameToFullName(e[n-1])}})}flattenFollowSet(){let e=A(this.buildFullFollowKeyStack(),(r)=>this.getFollowSetFromFollowKey(r));return xe(e)}getFollowSetFromFollowKey(e){if(e===Ri)return[Ve];let r=e.ruleName+e.idxInCallingRule+fn+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 bt(r)}attemptInRepetitionRecovery(e,r,s,n,i,o,c){}getCurrentGrammarPath(e,r){let s=this.getHumanReadableRuleStack(),n=q(this.RULE_OCCURRENCE_STACK);return{ruleStack:s,occurrenceStack:n,lastTok:e,lastTokOccurrence:r}}getHumanReadableRuleStack(){return A(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 g=this.getCurrRuleFullName(),y=this.getGAstProductions()[g];a=new o(y,i).startWalking(),this.firstAfterRepMap[u]=a}let f=a.token,d=a.occurrence,m=a.isEndOfRule;if(this.RULE_STACK.length===1&&m&&f===void 0)f=Ve,d=1;if(f===void 0||d===void 0)return;if(this.shouldInRepetitionRecoveryBeTried(f,d,c))this.tryInRepetitionRecovery(e,r,s,f)}var Qc=4,Mn=8;var wn=256,Pn=512,Ts=768,Es=1024,ys=1280,Kr=1536;function Un(e,r,s){return s|r|e}class Dn{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(U(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)=>Si(r,r,at))}validateEmptyOrAlternatives(e){return De(e,(r)=>Gc(r,at))}validateAmbiguousAlternationAlternatives(e,r){return De(e,(s)=>Wc(s,r,at))}validateSomeNonEmptyLookaheadPath(e,r){return Kc(e,r,at)}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,In(e.prodType),kc)}}class Ii{initLooksAhead(e){this.dynamicTokensEnabled=I(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:Fe.dynamicTokensEnabled,this.maxLookahead=I(e,"maxLookahead")?e.maxLookahead:Fe.maxLookahead,this.lookaheadStrategy=I(e,"lookaheadStrategy")?e.lookaheadStrategy:new Dn({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){S(e,(r)=>{this.TRACE_INIT(`${r.name} Rule Lookahead`,()=>{let{alternation:s,repetition:n,option:i,repetitionMandatory:o,repetitionMandatoryWithSeparator:c,repetitionWithSeparator:u}=Gy(r);S(s,(a)=>{let f=a.idx===0?"":a.idx;this.TRACE_INIT(`${ze(a)}${f}`,()=>{let d=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:a.idx,rule:r,maxLookahead:a.maxLookahead||this.maxLookahead,hasPredicates:a.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),m=Un(this.fullRuleNameToShort[r.name],wn,a.idx);this.setLaFuncCache(m,d)})}),S(n,(a)=>{this.computeLookaheadFunc(r,a.idx,Ts,"Repetition",a.maxLookahead,ze(a))}),S(i,(a)=>{this.computeLookaheadFunc(r,a.idx,Pn,"Option",a.maxLookahead,ze(a))}),S(o,(a)=>{this.computeLookaheadFunc(r,a.idx,Es,"RepetitionMandatory",a.maxLookahead,ze(a))}),S(c,(a)=>{this.computeLookaheadFunc(r,a.idx,Kr,"RepetitionMandatoryWithSeparator",a.maxLookahead,ze(a))}),S(u,(a)=>{this.computeLookaheadFunc(r,a.idx,ys,"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=Un(this.fullRuleNameToShort[e.name],s,r);this.setLaFuncCache(u,c)})}getKeyForAutomaticLookahead(e,r){let s=this.getLastExplicitRuleShortName();return Un(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 Fn=new eu;function Gy(e){Fn.reset(),e.accept(Fn);let r=Fn.dslMethods;return Fn.reset(),r}function Ni(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 bi(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 Ci(e,r){Object.defineProperty(e,"name",{enumerable:!1,configurable:!0,writable:!1,value:r})}function Wy(e,r){let s=H(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(){};Ci(s,e+"BaseSemantics");let n={visit:function(i,o){if(b(i))i=i[0];if(_e(i))return;return this[i.name](i.children,o)},validateVisitor:function(){let i=jy(this,r);if(!U(i)){let o=A(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(){};Ci(n,e+"BaseSemanticsWithDefaults");let i=Object.create(s.prototype);return S(r,(o)=>{i[o]=Wy}),n.prototype=i,n.prototype.constructor=n,n}var vi;(function(e){e[e.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",e[e.MISSING_METHOD=1]="MISSING_METHOD"})(vi||(vi={}));function jy(e,r){return Ky(e,r)}function Ky(e,r){let s=ke(r,(i)=>Ue(e[i])===!1),n=A(s,(i)=>({msg:`Missing visitor method: <${i}> on ${e.constructor.name} CST Visitor.`,type:vi.MISSING_METHOD,methodName:i}));return gt(n)}class ki{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=
|
|
90
|
+
`)}`)}}};return s.prototype=n,s.prototype.constructor=s,s._RULE_NAMES=r,s}function nu(e,r,s){let n=function(){};Ci(n,e+"BaseSemanticsWithDefaults");let i=Object.create(s.prototype);return S(r,(o)=>{i[o]=Wy}),n.prototype=i,n.prototype.constructor=n,n}var vi;(function(e){e[e.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",e[e.MISSING_METHOD=1]="MISSING_METHOD"})(vi||(vi={}));function jy(e,r){return Ky(e,r)}function Ky(e,r){let s=ke(r,(i)=>Ue(e[i])===!1),n=A(s,(i)=>({msg:`Missing visitor method: <${i}> on ${e.constructor.name} CST Visitor.`,type:vi.MISSING_METHOD,methodName:i}));return gt(n)}class ki{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=I(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=bi,this.setNodeLocationFromNode=bi,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=Ni,this.setNodeLocationFromNode=Ni,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,H(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(_e(this.baseCstVisitorWithDefaultsConstructor)){let e=nu(this.className,H(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 _i{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 zr}LA(e){let r=this.currIdx+e;if(r<0||this.tokVectorLength<=r)return zr;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 Mi{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=Vr){if(te(this.definedRulesNames,e)){let o={message:at.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=Vr){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 un(V(this.gastProductionsCache))}}class wi{initRecognizerEngine(e,r){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=Wr,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},I(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(b(e)){if(U(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(b(e))this.tokensMap=Te(e,(i,o)=>(i[o.name]=o,i),{});else if(I(e,"modes")&&ve(xe(V(e.modes)),pc)){let i=xe(V(e.modes)),o=Pr(i);this.tokensMap=Te(o,(c,u)=>(c[u.name]=u,c),{})}else if(ne(e))this.tokensMap=q(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=I(e,"modes")?xe(V(e.modes)):V(e),n=ve(s,(i)=>U(i.categoryMatches));this.tokenMatcher=n?Wr:Ct,vt(V(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=I(s,"resyncEnabled")?s.resyncEnabled:Vr.resyncEnabled,i=I(s,"recoveryValueFunc")?s.recoveryValueFunc:Vr.recoveryValueFunc,o=this.ruleShortNameIdx<<Qc+Mn;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 d=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(d),d}catch(d){return this.invokeRuleCatch(d,n,i)}finally{this.ruleFinallyStateUpdate()}};else c=function(...f){try{return this.ruleInvocationStateUpdate(o,e,this.subruleIdx),r.apply(this,f)}catch(d){return this.invokeRuleCatch(d,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(Pn,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(Es,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,Es,e,yi)}atLeastOneSepFirstInternal(e,r){let s=this.getKeyForAutomaticLookahead(Kr,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,Rn],c,Kr,e,Rn)}else throw this.raiseEarlyExitException(e,oe.REPETITION_MANDATORY_WITH_SEPARATOR,r.ERR_MSG)}manyInternal(e,r){let s=this.getKeyForAutomaticLookahead(Ts,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,Ts,e,Ei,o)}manySepFirstInternal(e,r){let s=this.getKeyForAutomaticLookahead(ys,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,Sn],c,ys,e,Sn)}}repetitionSepSecondInternal(e,r,s,n,i){while(s())this.CONSUME(r),n.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,r,s,n,i],s,Kr,e,i)}doSingleRepetition(e){let r=this.getLexerPosition();return e.call(this),this.getLexerPosition()>r}orInternal(e,r){let s=this.getKeyForAutomaticLookahead(wn,r),n=b(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 kn(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 jr(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===Oi)throw s;else throw i}}else throw s}saveRecogState(){let e=this.errors,r=q(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 Pi{initErrorHandler(e){this._errors=[],this.errorMessageProvider=I(e,"errorMessageProvider")?e.errorMessageProvider:Fe.errorMessageProvider}SAVE_ERROR(e){if(Zt(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:q(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 q(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,r,s){let n=this.getCurrRuleFullName(),i=this.getGAstProductions()[n],c=ms(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 _n(a,this.LA(1),this.LA(0)))}raiseNoAltException(e,r){let s=this.getCurrRuleFullName(),n=this.getGAstProductions()[s],i=ps(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 vn(u,this.LA(1),c))}}class Ui{initContentAssist(){}computeContentAssist(e,r){let s=this.gastProductionsCache[e];if(_e(s))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return Ln([s],r,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){let r=Le(e.ruleStack),n=this.getGAstProductions()[r];return new Ti(n,e).startWalking()}}var $n={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze($n);var iu=!0,ou=Math.pow(2,Mn)-1,lu=v({name:"RECORDING_PHASE_TOKEN",pattern:ie.NA});vt([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 Di{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 zr}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 As.call(this,re,e,r)}atLeastOneInternalRecord(e,r){As.call(this,Ee,r,e)}atLeastOneSepFirstInternalRecord(e,r){As.call(this,ye,r,e,iu)}manyInternalRecord(e,r){As.call(this,B,r,e)}manySepFirstInternalRecord(e,r){As.call(this,he,r,e,iu)}orInternalRecord(e,r){return Vy.call(this,e,r)}subruleInternalRecord(e,r,s){if(Bn(r),!e||
|
|
101
|
+
https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch(n){throw s}throw s}}optionInternalRecord(e,r){return As.call(this,re,e,r)}atLeastOneInternalRecord(e,r){As.call(this,Ee,r,e)}atLeastOneSepFirstInternalRecord(e,r){As.call(this,ye,r,e,iu)}manyInternalRecord(e,r){As.call(this,B,r,e)}manySepFirstInternalRecord(e,r){As.call(this,he,r,e,iu)}orInternalRecord(e,r){return Vy.call(this,e,r)}subruleInternalRecord(e,r,s){if(Bn(r),!e||I(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=ot(this.recordingProdStack),i=e.ruleName,o=new Z({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:$n}consumeInternalRecord(e,r,s){if(Bn(r),!pi(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=ot(this.recordingProdStack),i=new D({idx:r,terminalType:e,label:s===null||s===void 0?void 0:s.LABEL});return n.definition.push(i),cu}}function As(e,r,s,n=!1){Bn(s);let i=ot(this.recordingProdStack),o=Ue(r)?r:r.DEF,c=new e({definition:[],idx:s});if(n)c.separator=r.SEP;if(
|
|
104
|
-
Idx value must be a none negative value smaller than ${ou+1}`);throw r.KNOWN_RECORDER_ERROR=!0,r}}class Fi{initPerformanceTracer(e){if(
|
|
103
|
+
inside top level rule: <${this.recordingProdStack[0].name}>`);throw o.KNOWN_RECORDER_ERROR=!0,o}let n=ot(this.recordingProdStack),i=new D({idx:r,terminalType:e,label:s===null||s===void 0?void 0:s.LABEL});return n.definition.push(i),cu}}function As(e,r,s,n=!1){Bn(s);let i=ot(this.recordingProdStack),o=Ue(r)?r:r.DEF,c=new e({definition:[],idx:s});if(n)c.separator=r.SEP;if(I(r,"MAX_LOOKAHEAD"))c.maxLookahead=r.MAX_LOOKAHEAD;return this.recordingProdStack.push(c),o.call(this),i.definition.push(c),this.recordingProdStack.pop(),$n}function Vy(e,r){Bn(r);let s=ot(this.recordingProdStack),n=b(e)===!1,i=n===!1?e:e.DEF,o=new de({definition:[],idx:r,ignoreAmbiguities:n&&e.IGNORE_AMBIGUITIES===!0});if(I(e,"MAX_LOOKAHEAD"))o.maxLookahead=e.MAX_LOOKAHEAD;let c=ss(i,(u)=>Ue(u.GATE));return o.hasPredicates=c,s.definition.push(o),S(i,(u)=>{let a=new Q({definition:[]});if(o.definition.push(a),I(u,"IGNORE_AMBIGUITIES"))a.ignoreAmbiguities=u.IGNORE_AMBIGUITIES;else if(I(u,"GATE"))a.ignoreAmbiguities=!0;this.recordingProdStack.push(a),u.ALT.call(this),this.recordingProdStack.pop()}),$n}function au(e){return e===0?"":`${e}`}function Bn(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 Fi{initPerformanceTracer(e){if(I(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}=is(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 zr=lr(Ve,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(zr);var Fe=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:xn,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),Vr=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 xs{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",()=>{os(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),S(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:V(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(s)}),this.TRACE_INIT("Grammar Validations",()=>{if(U(s)&&this.skipValidations===!1){let n=Vc({rules:V(this.gastProductionsCache),tokenTypes:V(this.tokensMap),errMsgProvider:at,grammarName:r}),i=Uc({lookaheadStrategy:this.lookaheadStrategy,rules:V(this.gastProductionsCache),tokenTypes:V(this.tokensMap),grammarName:r});this.definitionErrors=this.definitionErrors.concat(n,i)}}),U(this.definitionErrors)){if(this.recoveryEnabled)this.TRACE_INIT("computeAllProdsFollows",()=>{let n=Yl(V(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:V(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(V(this.gastProductionsCache))})}if(!xs.DEFER_DEFINITION_ERRORS_HANDLING&&!U(this.definitionErrors))throw e=A(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),I(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=I(r,"skipValidations")?r.skipValidations:Fe.skipValidations}}xs.DEFER_DEFINITION_ERRORS_HANDLING=!1;uu(xs,[Li,Ii,ki,_i,wi,Mi,Pi,Ui,Di,Fi]);class Gn extends xs{constructor(e,r=Fe){let s=q(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=K.usecase,Vi=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"),F=Vi(),Jy=t(()=>structuredClone(F.config),"getConfig"),Zy=t(()=>F.ast,"getAST"),Qy=t((e)=>{let r=structuredClone(e);qy(r);let s=O(),n=z();try{L(r.accTitle),P(r.accDescription),F=r}catch(i){throw L(s),P(n),i}},"commit"),eA=t(()=>{F=Vi(),R()},"clear"),tA=t(()=>F.actors,"getActors"),rA=t((e)=>F.actors.get(e),"getActor"),sA=t(()=>F.useCases,"getUseCases"),nA=t((e)=>F.useCases.get(e),"getUseCase"),iA=t(()=>F.systemBoundaries,"getSystemBoundaries"),oA=t((e)=>F.systemBoundaries.get(e),"getSystemBoundary"),aA=t(()=>F.relationships,"getRelationships"),lA=t(()=>F.notes,"getNotes"),cA=t((e)=>F.notes.get(e),"getNote"),uA=t(()=>F.jsonNodes,"getJsonNodes"),fA=t((e)=>F.jsonNodes.get(e),"getJsonNode"),hA=t(()=>F.classDefs,"getClassDefs"),dA=t((e)=>F.classDefs.get(e),"getClassDef"),Au=t(()=>F.direction,"getDirection"),cr=t((e)=>{let r=new Map;for(let s of["default",...e]){let n=F.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((d)=>d===null||["string","number","boolean"].includes(typeof d))){for(let[d,m]of c.entries())i(d===0?u:"",u,fu(m));return}for(let[d,m]of c.entries())o(m,`${u}[${d}]`,`${a}/${d}`);return}if(c!==null&&typeof c==="object"){let f=c,d=r[a]??Object.keys(f);if(d.length===0){i(u,u,"{}");return}for(let m of d){let g=u?`${u}.${m}`:m;o(f[m],g,`${a}/${pA(m)}`)}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"),Ss=t((...e)=>e.filter((r)=>Boolean(r)).join(" "),"classNames"),xA=t(()=>{let e=p(),r={...F.config,...e.usecase},s=t((a)=>X(a,e),"sanitize"),n=t((a)=>s(F.actors.get(a)?.label??F.useCases.get(a)?.label??F.jsonNodes.get(a)?.id??F.notes.get(a)?.label??a),"endpointLabel"),i=[],o=[],c=0,u=0;for(let a of F.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:Ss("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 F.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:Ss("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 F.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(F.actors.get(a.target)?.label??F.useCases.get(a.target)?.label??F.jsonNodes.get(a.target)?.id??a.target)});for(let a of F.jsonNodes.values())i.push({id:a.id,label:s(a.id),labelType:"text",shape:"usecaseJsonTable",isGroup:!1,padding:10,look:e.look,cssClasses:Ss("default","usecase-json-table",...a.classes),cssStyles:[...a.styles],cssCompiledStyles:cr(a.classes),jsonRows:mA(a.value,a.propertyOrder,s)});for(let a of F.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:Ss("default","system-boundary",`system-boundary-${a.type}`,...a.classes),cssStyles:[...a.styles],cssCompiledStyles:cr(a.classes),boundaryType:a.type});for(let a of F.relationships){let{label:f,...d}=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,...d,...f!==void 0?{label:s(f)}:{},labelpos:"c",classes:Ss("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 F.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"),Yn={getConfig:Jy,createModel:Vi,commit:Qy,getAST:Zy,clear:eA,setDiagramTitle:j,getDiagramTitle:G,setAccTitle:L,getAccTitle:O,setAccDescription:P,getAccDescription:z,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=C({name:"LABEL_TEXT",pattern:ie.NA}),Yr=C({name:"WORD",pattern:ie.NA,categories:Ie}),Hi=C({name:"NUMBER",pattern:/(?:\d+\.\d+|\d+|\.\d+)(?:[A-Za-z]+)?/,categories:Ie}),ce=C({name:"IDENTIFIER",pattern:/\w+/,longer_alt:Hi,categories:Yr}),NA=C({name:"HWS",pattern:/[\t ]+/,group:ie.SKIPPED}),Mt=C({name:"MARKDOWN_STRING",pattern:SA,start_chars_hint:['"'],line_breaks:!0}),bA=C({name:"UNCLOSED_MARKDOWN_STRING",pattern:/"`[^]*/,line_breaks:!0}),$i=C({name:"COMMENT",pattern:RA,start_chars_hint:["%"],line_breaks:!1}),kt=C({name:"NEWLINE",pattern:/\r\n|\n|\r/,line_breaks:!0}),Ru=C({name:"ACC_DESCR_BLOCK",pattern:OA,start_chars_hint:["a"],line_breaks:!0}),CA=/^accTitle[\t ]*:[^\n\r]*/,vA=/^accDescr[\t ]*:[^\n\r]*/,Ou=C({name:"ACC_TITLE_LINE",pattern:t((e,r)=>Su(e,r,CA),"pattern"),start_chars_hint:["a"],line_breaks:!1}),Lu=C({name:"ACC_DESCR_LINE",pattern:t((e,r)=>Su(e,r,vA),"pattern"),start_chars_hint:["a"],line_breaks:!1}),Iu=C({name:"JSON_DECLARATION_START",pattern:/json[\t ]+\w+[\t ]*@[\t ]*(?={)/,push_mode:"jsonBody"}),Yi=C({name:"JSON_OBJECT_LITERAL",pattern:LA,start_chars_hint:["{"],line_breaks:!0,pop_mode:!0}),Nu=C({name:"UNCLOSED_JSON_OBJECT_LITERAL",pattern:/{[^]*/,line_breaks:!0,pop_mode:!0}),Ae=t((e,r)=>C({name:e,pattern:r,longer_alt:ce,categories:Yr}),"keyword"),bu=Ae("USECASE",/usecase-beta/),Gi=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=C({name:"GENERALIZATION",pattern:/--\|>/}),Hu=C({name:"DEPENDENCY_ARROW",pattern:/\.\.>/}),Yu=C({name:"STEREOTYPE_START",pattern:/<</,push_mode:"stereotype"}),Xi=C({name:"STEREOTYPE_END",pattern:/>>/,pop_mode:!0}),qi=C({name:"STEREOTYPE_TEXT",pattern:IA,line_breaks:!1}),Xu=C({name:"UNCLOSED_STEREOTYPE_TEXT",pattern:/[^\n\r]+/,line_breaks:!1,pop_mode:!0}),qu=C({name:"CLASS_SEPARATOR",pattern:/:::/}),Wn=C({name:"FORWARD_SOLID",pattern:/--+>/}),Ju=C({name:"BACKWARD_SOLID",pattern:/<--+/}),jn=C({name:"FORWARD_CIRCLE",pattern:/--o/}),Zu=C({name:"BACKWARD_CIRCLE",pattern:/o--/}),Kn=C({name:"FORWARD_CROSS",pattern:/--x/}),Qu=C({name:"BACKWARD_CROSS",pattern:/x--/}),et=C({name:"MARKERLESS_SOLID",pattern:/--+/}),Wi=C({name:"METADATA_START",pattern:/@{/}),zn=C({name:"AT",pattern:/@/,categories:Ie}),ef=C({name:"LBRACE",pattern:/{/}),ji=C({name:"RBRACE",pattern:/}/}),Vn=C({name:"LBRACKET",pattern:/\[/}),Hn=C({name:"RBRACKET",pattern:/]/}),Rs=C({name:"LPAREN",pattern:/\(/}),Os=C({name:"RPAREN",pattern:/\)/}),ct=C({name:"COMMA",pattern:/,/,categories:Ie}),Ls=C({name:"COLON",pattern:/:/,categories:Ie}),tf=C({name:"HASH_COLOR",pattern:/#[\dA-Fa-f]+/,categories:Ie}),tt=C({name:"PLAIN_STRING",pattern:/"[^\n\r"]*"|'[^\n\r']*'/}),Ki=C({name:"CSS_IDENTIFIER",pattern:/--[A-Z_a-z][\w-]*|[A-Z_a-z]\w*(?:-\w+)+/,categories:Ie}),rf=C({name:"CSS_ESCAPED_COMMA",pattern:/\\,/,categories:Ie}),sf=C({name:"DASH",pattern:/-/,categories:Ie}),nf=C({name:"DOT",pattern:/\./,categories:Ie}),of=C({name:"PERCENT",pattern:/%/,categories:Ie}),af=C({name:"CSS_PUNCTUATION",pattern:/[!#$&*+/=?^_|~]/,categories:Ie}),_A=C({name:"LABEL_PUNCTUATION",pattern:/[;<>\\`]/,categories:Ie}),MA=C({name:"LABEL_SYMBOL",pattern:/[^\t\n\r !-~]+/,categories:Ie}),lf=[Ie,Yr,NA,Mt,bA,$i,kt,Ru,Ou,Lu,Iu,bu,Gi,Cu,vu,ku,_u,Mu,wu,Pu,Uu,Du,Fu,kA,Bu,$u,Gu,Wu,ju,Ku,zu,Vu,Hu,Yu,qu,Wn,Ju,jn,Zu,Kn,Qu,et,Wi,zn,ef,ji,Vn,Hn,Rs,Os,ct,Ls,tf,tt,Ki,ce,Hi,rf,sf,nf,of,af,_A,MA],wA={defaultMode:"defaultMode",modes:{defaultMode:[...lf],jsonBody:[Yi,Nu],stereotype:[Xi,qi,Xu]}},PA=[...lf,Yi,Nu,Xi,qi,Xu],UA=new ie(wA),hu=t((e)=>hs(e,Ie)||e.tokenType===tt||e.tokenType===Mt,"isLabelToken"),DA={allowmixing:!0,newpage:!0,package:!0,rectangle:!0,skinparam:!0},FA=class extends Gn{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(kt),"ALT")},{ALT:t(()=>this.CONSUME(Ve),"ALT")}])}),this.RULE("blankLine",()=>{this.CONSUME(kt)}),this.RULE("commentLine",()=>{this.CONSUME($i),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(Gi),this.SUBRULE(this.actorItem),this.OPTION(()=>{this.OR([{ALT:t(()=>this.AT_LEAST_ONE(()=>{this.CONSUME(ct),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(Rs),this.SUBRULE(this.nodeLabel),this.CONSUME(Os)})},"ALT")},{ALT:t(()=>this.CONSUME(tt),"ALT")},{ALT:t(()=>this.CONSUME(Mt),"ALT")}])}),this.RULE("actorDeclarationOnly",()=>{this.CONSUME(Gi),this.SUBRULE(this.actorItem),this.MANY(()=>{this.CONSUME(ct),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(Rs),this.SUBRULE(this.nodeLabel),this.CONSUME(Os)},"ALT")},{ALT:t(()=>{this.CONSUME(Vn),this.SUBRULE2(this.nodeLabel),this.CONSUME(Hn)},"ALT")}])})},"ALT")},{ALT:t(()=>this.CONSUME(tt),"ALT")},{ALT:t(()=>this.CONSUME(Mt),"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(tt),"ALT")},{ALT:t(()=>this.CONSUME(Mt),"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===zn,"GATE"),DEF:t(()=>{this.CONSUME(ce),this.CONSUME(zn)},"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(Wn)}),this.RULE("backwardSolidOperator",()=>{this.CONSUME(Ju),this.OPTION({GATE:t(()=>this.LA(0).image==="<--"&&this.hasLabeledRight([et]),"GATE"),DEF:t(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(et)},"DEF")})}),this.RULE("markerlessSolidOperator",()=>{this.CONSUME(et),this.OPTION({GATE:t(()=>this.LA(0).image==="--"&&this.hasLabeledRight([Wn,et,jn,Kn]),"GATE"),DEF:t(()=>{this.SUBRULE(this.edgeLabel),this.OR([{ALT:t(()=>this.CONSUME(Wn),"ALT")},{ALT:t(()=>this.CONSUME2(et),"ALT")},{ALT:t(()=>this.CONSUME(jn),"ALT")},{ALT:t(()=>this.CONSUME(Kn),"ALT")}])},"DEF")})}),this.RULE("forwardCircleOperator",()=>{this.CONSUME(jn)}),this.RULE("backwardCircleOperator",()=>{this.CONSUME(Zu),this.OPTION({GATE:t(()=>this.hasLabeledRight([et]),"GATE"),DEF:t(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(et)},"DEF")})}),this.RULE("forwardCrossOperator",()=>{this.CONSUME(Kn)}),this.RULE("backwardCrossOperator",()=>{this.CONSUME(Qu),this.OPTION({GATE:t(()=>this.hasLabeledRight([et]),"GATE"),DEF:t(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(et)},"DEF")})}),this.RULE("edgeLabel",()=>{this.OR([{ALT:t(()=>this.CONSUME(tt),"ALT")},{ALT:t(()=>this.CONSUME(Mt),"ALT")},{ALT:t(()=>this.AT_LEAST_ONE(()=>this.CONSUME(Ie)),"ALT")}])}),this.RULE("semanticRelation",()=>{this.OR([{ALT:t(()=>{this.CONSUME(Hu),this.CONSUME(Ls),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(Wi),this.MANY(()=>this.CONSUME(kt)),this.OPTION(()=>{this.SUBRULE(this.metadataProperty),this.MANY2(()=>{this.SUBRULE(this.metadataSeparator),this.SUBRULE2(this.metadataProperty)}),this.OPTION2(()=>this.CONSUME(ct)),this.MANY3(()=>this.CONSUME2(kt))}),this.CONSUME(ji)}),this.RULE("metadataProperty",()=>{this.OR([{ALT:t(()=>this.CONSUME(ce),"ALT")},{ALT:t(()=>this.CONSUME(tt),"ALT")}]),this.CONSUME(Ls),this.OR2([{ALT:t(()=>this.CONSUME2(ce),"ALT")},{ALT:t(()=>this.CONSUME2(tt),"ALT")},{ALT:t(()=>this.CONSUME(Ku),"ALT")},{ALT:t(()=>this.CONSUME(zu),"ALT")}])}),this.RULE("metadataSeparator",()=>{this.OR([{ALT:t(()=>{this.CONSUME(ct),this.MANY(()=>this.CONSUME(kt))},"ALT")},{ALT:t(()=>{this.AT_LEAST_ONE(()=>this.CONSUME2(kt)),this.OPTION(()=>this.CONSUME2(ct)),this.MANY2(()=>this.CONSUME3(kt))},"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(Rs),this.SUBRULE(this.nodeLabel),this.CONSUME(Os)},"ALT")},{ALT:t(()=>{this.CONSUME(Vn),this.SUBRULE2(this.nodeLabel),this.CONSUME(Hn)},"ALT")}])})},"ALT")},{ALT:t(()=>this.CONSUME(tt),"ALT")},{ALT:t(()=>this.CONSUME(Mt),"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(tt),"ALT")},{ALT:t(()=>this.CONSUME(Mt),"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(qi),this.CONSUME(Xi)}),this.RULE("classSuffix",()=>{this.CONSUME(qu),this.CONSUME(ce),this.MANY(()=>{this.CONSUME(ct),this.CONSUME2(ce)})}),this.RULE("jsonStatement",()=>{this.CONSUME(Iu),this.CONSUME(Yi),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(ct),this.CONSUME2(ce)}),this.SUBRULE(this.styles),this.SUBRULE(this.lineEnd)}),this.RULE("classStatement",()=>{this.CONSUME($u),this.CONSUME(ce),this.MANY(()=>{this.CONSUME(ct),this.CONSUME2(ce)}),this.CONSUME3(ce),this.MANY2(()=>{this.CONSUME2(ct),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(ct),this.SUBRULE2(this.styleValue)})}),this.RULE("styleValue",()=>{this.OR([{ALT:t(()=>this.CONSUME(Yr),"ALT")},{ALT:t(()=>this.CONSUME(Ki),"ALT")},{ALT:t(()=>{this.CONSUME(et),this.CONSUME2(Yr)},"ALT")}]),this.CONSUME(Ls),this.AT_LEAST_ONE(()=>this.SUBRULE(this.styleComponent))}),this.RULE("styleComponent",()=>{this.OR([{ALT:t(()=>this.CONSUME(Yr),"ALT")},{ALT:t(()=>this.CONSUME(tt),"ALT")},{ALT:t(()=>this.CONSUME(Hi),"ALT")},{ALT:t(()=>this.CONSUME(tf),"ALT")},{ALT:t(()=>this.CONSUME(Ki),"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(Ls),"ALT")},{ALT:t(()=>this.CONSUME(Rs),"ALT")},{ALT:t(()=>this.CONSUME(Os),"ALT")},{ALT:t(()=>this.CONSUME(Vn),"ALT")},{ALT:t(()=>this.CONSUME(Hn),"ALT")},{ALT:t(()=>this.CONSUME(ef),"ALT")},{ALT:t(()=>this.CONSUME(ji),"ALT")},{ALT:t(()=>this.CONSUME(zn),"ALT")},{ALT:t(()=>this.CONSUME(et),"ALT")}])}),this.performSelfAnalysis()}isMetadataAssignment(){let e=this.LA(1).tokenType;return(e===ce||e===tt||e===Mt)&&this.LA(2).tokenType===Wi}isStatementStart(){let e=this.LA(1).tokenType;return e!==Ve&&e!==kt&&e!==$i}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}}},Is=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")}},zi=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=v({name:"LABEL_TEXT",pattern:ie.NA}),Yr=v({name:"WORD",pattern:ie.NA,categories:Ie}),Hi=v({name:"NUMBER",pattern:/(?:\d+\.\d+|\d+|\.\d+)(?:[A-Za-z]+)?/,categories:Ie}),ce=v({name:"IDENTIFIER",pattern:/\w+/,longer_alt:Hi,categories:Yr}),NA=v({name:"HWS",pattern:/[\t ]+/,group:ie.SKIPPED}),Mt=v({name:"MARKDOWN_STRING",pattern:SA,start_chars_hint:['"'],line_breaks:!0}),bA=v({name:"UNCLOSED_MARKDOWN_STRING",pattern:/"`[^]*/,line_breaks:!0}),$i=v({name:"COMMENT",pattern:RA,start_chars_hint:["%"],line_breaks:!1}),kt=v({name:"NEWLINE",pattern:/\r\n|\n|\r/,line_breaks:!0}),Ru=v({name:"ACC_DESCR_BLOCK",pattern:OA,start_chars_hint:["a"],line_breaks:!0}),CA=/^accTitle[\t ]*:[^\n\r]*/,vA=/^accDescr[\t ]*:[^\n\r]*/,Ou=v({name:"ACC_TITLE_LINE",pattern:t((e,r)=>Su(e,r,CA),"pattern"),start_chars_hint:["a"],line_breaks:!1}),Lu=v({name:"ACC_DESCR_LINE",pattern:t((e,r)=>Su(e,r,vA),"pattern"),start_chars_hint:["a"],line_breaks:!1}),Iu=v({name:"JSON_DECLARATION_START",pattern:/json[\t ]+\w+[\t ]*@[\t ]*(?={)/,push_mode:"jsonBody"}),Yi=v({name:"JSON_OBJECT_LITERAL",pattern:LA,start_chars_hint:["{"],line_breaks:!0,pop_mode:!0}),Nu=v({name:"UNCLOSED_JSON_OBJECT_LITERAL",pattern:/{[^]*/,line_breaks:!0,pop_mode:!0}),Ae=t((e,r)=>v({name:e,pattern:r,longer_alt:ce,categories:Yr}),"keyword"),bu=Ae("USECASE",/usecase-beta/),Gi=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=v({name:"GENERALIZATION",pattern:/--\|>/}),Hu=v({name:"DEPENDENCY_ARROW",pattern:/\.\.>/}),Yu=v({name:"STEREOTYPE_START",pattern:/<</,push_mode:"stereotype"}),Xi=v({name:"STEREOTYPE_END",pattern:/>>/,pop_mode:!0}),qi=v({name:"STEREOTYPE_TEXT",pattern:IA,line_breaks:!1}),Xu=v({name:"UNCLOSED_STEREOTYPE_TEXT",pattern:/[^\n\r]+/,line_breaks:!1,pop_mode:!0}),qu=v({name:"CLASS_SEPARATOR",pattern:/:::/}),Wn=v({name:"FORWARD_SOLID",pattern:/--+>/}),Ju=v({name:"BACKWARD_SOLID",pattern:/<--+/}),jn=v({name:"FORWARD_CIRCLE",pattern:/--o/}),Zu=v({name:"BACKWARD_CIRCLE",pattern:/o--/}),Kn=v({name:"FORWARD_CROSS",pattern:/--x/}),Qu=v({name:"BACKWARD_CROSS",pattern:/x--/}),et=v({name:"MARKERLESS_SOLID",pattern:/--+/}),Wi=v({name:"METADATA_START",pattern:/@{/}),zn=v({name:"AT",pattern:/@/,categories:Ie}),ef=v({name:"LBRACE",pattern:/{/}),ji=v({name:"RBRACE",pattern:/}/}),Vn=v({name:"LBRACKET",pattern:/\[/}),Hn=v({name:"RBRACKET",pattern:/]/}),Rs=v({name:"LPAREN",pattern:/\(/}),Os=v({name:"RPAREN",pattern:/\)/}),ct=v({name:"COMMA",pattern:/,/,categories:Ie}),Ls=v({name:"COLON",pattern:/:/,categories:Ie}),tf=v({name:"HASH_COLOR",pattern:/#[\dA-Fa-f]+/,categories:Ie}),tt=v({name:"PLAIN_STRING",pattern:/"[^\n\r"]*"|'[^\n\r']*'/}),Ki=v({name:"CSS_IDENTIFIER",pattern:/--[A-Z_a-z][\w-]*|[A-Z_a-z]\w*(?:-\w+)+/,categories:Ie}),rf=v({name:"CSS_ESCAPED_COMMA",pattern:/\\,/,categories:Ie}),sf=v({name:"DASH",pattern:/-/,categories:Ie}),nf=v({name:"DOT",pattern:/\./,categories:Ie}),of=v({name:"PERCENT",pattern:/%/,categories:Ie}),af=v({name:"CSS_PUNCTUATION",pattern:/[!#$&*+/=?^_|~]/,categories:Ie}),_A=v({name:"LABEL_PUNCTUATION",pattern:/[;<>\\`]/,categories:Ie}),MA=v({name:"LABEL_SYMBOL",pattern:/[^\t\n\r !-~]+/,categories:Ie}),lf=[Ie,Yr,NA,Mt,bA,$i,kt,Ru,Ou,Lu,Iu,bu,Gi,Cu,vu,ku,_u,Mu,wu,Pu,Uu,Du,Fu,kA,Bu,$u,Gu,Wu,ju,Ku,zu,Vu,Hu,Yu,qu,Wn,Ju,jn,Zu,Kn,Qu,et,Wi,zn,ef,ji,Vn,Hn,Rs,Os,ct,Ls,tf,tt,Ki,ce,Hi,rf,sf,nf,of,af,_A,MA],wA={defaultMode:"defaultMode",modes:{defaultMode:[...lf],jsonBody:[Yi,Nu],stereotype:[Xi,qi,Xu]}},PA=[...lf,Yi,Nu,Xi,qi,Xu],UA=new ie(wA),hu=t((e)=>hs(e,Ie)||e.tokenType===tt||e.tokenType===Mt,"isLabelToken"),DA={allowmixing:!0,newpage:!0,package:!0,rectangle:!0,skinparam:!0},FA=class extends Gn{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(kt),"ALT")},{ALT:t(()=>this.CONSUME(Ve),"ALT")}])}),this.RULE("blankLine",()=>{this.CONSUME(kt)}),this.RULE("commentLine",()=>{this.CONSUME($i),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(Gi),this.SUBRULE(this.actorItem),this.OPTION(()=>{this.OR([{ALT:t(()=>this.AT_LEAST_ONE(()=>{this.CONSUME(ct),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(Rs),this.SUBRULE(this.nodeLabel),this.CONSUME(Os)})},"ALT")},{ALT:t(()=>this.CONSUME(tt),"ALT")},{ALT:t(()=>this.CONSUME(Mt),"ALT")}])}),this.RULE("actorDeclarationOnly",()=>{this.CONSUME(Gi),this.SUBRULE(this.actorItem),this.MANY(()=>{this.CONSUME(ct),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(Rs),this.SUBRULE(this.nodeLabel),this.CONSUME(Os)},"ALT")},{ALT:t(()=>{this.CONSUME(Vn),this.SUBRULE2(this.nodeLabel),this.CONSUME(Hn)},"ALT")}])})},"ALT")},{ALT:t(()=>this.CONSUME(tt),"ALT")},{ALT:t(()=>this.CONSUME(Mt),"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(tt),"ALT")},{ALT:t(()=>this.CONSUME(Mt),"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===zn,"GATE"),DEF:t(()=>{this.CONSUME(ce),this.CONSUME(zn)},"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(Wn)}),this.RULE("backwardSolidOperator",()=>{this.CONSUME(Ju),this.OPTION({GATE:t(()=>this.LA(0).image==="<--"&&this.hasLabeledRight([et]),"GATE"),DEF:t(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(et)},"DEF")})}),this.RULE("markerlessSolidOperator",()=>{this.CONSUME(et),this.OPTION({GATE:t(()=>this.LA(0).image==="--"&&this.hasLabeledRight([Wn,et,jn,Kn]),"GATE"),DEF:t(()=>{this.SUBRULE(this.edgeLabel),this.OR([{ALT:t(()=>this.CONSUME(Wn),"ALT")},{ALT:t(()=>this.CONSUME2(et),"ALT")},{ALT:t(()=>this.CONSUME(jn),"ALT")},{ALT:t(()=>this.CONSUME(Kn),"ALT")}])},"DEF")})}),this.RULE("forwardCircleOperator",()=>{this.CONSUME(jn)}),this.RULE("backwardCircleOperator",()=>{this.CONSUME(Zu),this.OPTION({GATE:t(()=>this.hasLabeledRight([et]),"GATE"),DEF:t(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(et)},"DEF")})}),this.RULE("forwardCrossOperator",()=>{this.CONSUME(Kn)}),this.RULE("backwardCrossOperator",()=>{this.CONSUME(Qu),this.OPTION({GATE:t(()=>this.hasLabeledRight([et]),"GATE"),DEF:t(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(et)},"DEF")})}),this.RULE("edgeLabel",()=>{this.OR([{ALT:t(()=>this.CONSUME(tt),"ALT")},{ALT:t(()=>this.CONSUME(Mt),"ALT")},{ALT:t(()=>this.AT_LEAST_ONE(()=>this.CONSUME(Ie)),"ALT")}])}),this.RULE("semanticRelation",()=>{this.OR([{ALT:t(()=>{this.CONSUME(Hu),this.CONSUME(Ls),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(Wi),this.MANY(()=>this.CONSUME(kt)),this.OPTION(()=>{this.SUBRULE(this.metadataProperty),this.MANY2(()=>{this.SUBRULE(this.metadataSeparator),this.SUBRULE2(this.metadataProperty)}),this.OPTION2(()=>this.CONSUME(ct)),this.MANY3(()=>this.CONSUME2(kt))}),this.CONSUME(ji)}),this.RULE("metadataProperty",()=>{this.OR([{ALT:t(()=>this.CONSUME(ce),"ALT")},{ALT:t(()=>this.CONSUME(tt),"ALT")}]),this.CONSUME(Ls),this.OR2([{ALT:t(()=>this.CONSUME2(ce),"ALT")},{ALT:t(()=>this.CONSUME2(tt),"ALT")},{ALT:t(()=>this.CONSUME(Ku),"ALT")},{ALT:t(()=>this.CONSUME(zu),"ALT")}])}),this.RULE("metadataSeparator",()=>{this.OR([{ALT:t(()=>{this.CONSUME(ct),this.MANY(()=>this.CONSUME(kt))},"ALT")},{ALT:t(()=>{this.AT_LEAST_ONE(()=>this.CONSUME2(kt)),this.OPTION(()=>this.CONSUME2(ct)),this.MANY2(()=>this.CONSUME3(kt))},"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(Rs),this.SUBRULE(this.nodeLabel),this.CONSUME(Os)},"ALT")},{ALT:t(()=>{this.CONSUME(Vn),this.SUBRULE2(this.nodeLabel),this.CONSUME(Hn)},"ALT")}])})},"ALT")},{ALT:t(()=>this.CONSUME(tt),"ALT")},{ALT:t(()=>this.CONSUME(Mt),"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(tt),"ALT")},{ALT:t(()=>this.CONSUME(Mt),"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(qi),this.CONSUME(Xi)}),this.RULE("classSuffix",()=>{this.CONSUME(qu),this.CONSUME(ce),this.MANY(()=>{this.CONSUME(ct),this.CONSUME2(ce)})}),this.RULE("jsonStatement",()=>{this.CONSUME(Iu),this.CONSUME(Yi),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(ct),this.CONSUME2(ce)}),this.SUBRULE(this.styles),this.SUBRULE(this.lineEnd)}),this.RULE("classStatement",()=>{this.CONSUME($u),this.CONSUME(ce),this.MANY(()=>{this.CONSUME(ct),this.CONSUME2(ce)}),this.CONSUME3(ce),this.MANY2(()=>{this.CONSUME2(ct),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(ct),this.SUBRULE2(this.styleValue)})}),this.RULE("styleValue",()=>{this.OR([{ALT:t(()=>this.CONSUME(Yr),"ALT")},{ALT:t(()=>this.CONSUME(Ki),"ALT")},{ALT:t(()=>{this.CONSUME(et),this.CONSUME2(Yr)},"ALT")}]),this.CONSUME(Ls),this.AT_LEAST_ONE(()=>this.SUBRULE(this.styleComponent))}),this.RULE("styleComponent",()=>{this.OR([{ALT:t(()=>this.CONSUME(Yr),"ALT")},{ALT:t(()=>this.CONSUME(tt),"ALT")},{ALT:t(()=>this.CONSUME(Hi),"ALT")},{ALT:t(()=>this.CONSUME(tf),"ALT")},{ALT:t(()=>this.CONSUME(Ki),"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(Ls),"ALT")},{ALT:t(()=>this.CONSUME(Rs),"ALT")},{ALT:t(()=>this.CONSUME(Os),"ALT")},{ALT:t(()=>this.CONSUME(Vn),"ALT")},{ALT:t(()=>this.CONSUME(Hn),"ALT")},{ALT:t(()=>this.CONSUME(ef),"ALT")},{ALT:t(()=>this.CONSUME(ji),"ALT")},{ALT:t(()=>this.CONSUME(zn),"ALT")},{ALT:t(()=>this.CONSUME(et),"ALT")}])}),this.performSelfAnalysis()}isMetadataAssignment(){let e=this.LA(1).tokenType;return(e===ce||e===tt||e===Mt)&&this.LA(2).tokenType===Wi}isStatementStart(){let e=this.LA(1).tokenType;return e!==Ve&&e!==kt&&e!==$i}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}}},Is=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")}},zi=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 zi(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 zi(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=zi(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"),Bi=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,Bi(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);Bi(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)Bi(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=Is.getBaseCstVisitorConstructor(),XA=class extends YA{constructor(){super();this.builder=new HA(Yn),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),d=n?this.tokens(e,"LBRACKET").length?"rect":"ellipse":void 0;return{id:r.image,label:f,location:this.tokenLocation(r),generated:!1,...d?{shape:d}:{},...i?{metadata:this.visit(i)}:{},...o?{stereotype:this.visit(o)}:{},classes:u.classes,classSpans:u.spans,explicitDeclaration:Boolean(d||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,d={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:m,span:g,keySpan:y,valueSpan:v})=>({key:m,span:g,keySpan:y,valueSpan:v}))}:{},...c.length?{children:c}:{}};if(f)this.builder.addMetadataAssignment(r.id,r.location,f,d);return d}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:[]},d={id:i,value:u.value,propertyOrder:u.propertyOrder,location:c,classes:f.classes};return this.builder.addJson(d),{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)=>{Yn.clear(),Is.input=[];try{yu({diagramType:"usecase",lexer:UA,parser:Is,entry:t(()=>Is.start(),"entry"),visit:t((r)=>qA.build(r,e),"visit")},e)}catch(r){Yn.clear();let s=Is.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"),Xn=t((e,r)=>{if(r!=="markdown")return e;return
|
|
118
|
-
`)},"getAccessibleLabel"),ex=t((e)=>{let r=Xn(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 ${Xn(e.label??e.id,e.labelType)}`,"getUsecaseBoundaryAccessibleName"),rx=t((e)=>{if(e.relationshipType==="note")return"";return`${e.relationshipType==="association"&&e.label?`association ${Xn(e.label,e.labelType)}`:e.relationshipType} from ${e.sourceLabel} to ${e.targetLabel}`},"getUsecaseEdgeAccessibleName"),Hr=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=Hr(s.label);if(s.stereotype)s.stereotype=Hr(s.stereotype);if(!s.isGroup&&s.shape==="usecaseJsonTable")s.jsonRows=s.jsonRows?.map((i)=>({...i,key:Hr(i.key),value:Hr(i.value)}));if(!s.isGroup&&(s.shape==="usecaseEllipse"||s.shape==="rect")&&s.stereotype){let i=s.label??Hr(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=Hr(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(),d=f?.querySelector(".nodeLabel"),m=d?.querySelector("p")??d,g=m?.firstChild;if(m&&g?.nodeType===3){let y=m.ownerDocument.createElement("span");y.className="usecase-stereotype",m.insertBefore(y,g),y.appendChild(g)}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=h(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}=p(),o=n.db,c=o.getData(),u=new Map(c.nodes.map((m)=>[m.id,Xn(m.label??m.id,m.labelType)])),a={nodes:new Map(c.nodes.map((m)=>[m.id,m.isGroup?tx(m):ex(m.shape==="note"?{...m,noteTargetLabel:u.get(m.noteTarget??"")}:m)])),edges:new Map(c.edges.map((m)=>[m.id,rx({...m,sourceLabel:u.get(m.source)??m.sourceLabel,targetLabel:u.get(m.target)??m.targetLabel})]))},f=Tt(r,c.config.securityLevel);c.layoutAlgorithm=St(i),sx(c,r),Eu(f,c),await _t(c,f),nx(f,c,a);let d=c.diagramPadding;
|
|
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=zi(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"),Bi=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,Bi(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);Bi(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)Bi(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=Is.getBaseCstVisitorConstructor(),XA=class extends YA{constructor(){super();this.builder=new HA(Yn),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),d=n?this.tokens(e,"LBRACKET").length?"rect":"ellipse":void 0;return{id:r.image,label:f,location:this.tokenLocation(r),generated:!1,...d?{shape:d}:{},...i?{metadata:this.visit(i)}:{},...o?{stereotype:this.visit(o)}:{},classes:u.classes,classSpans:u.spans,explicitDeclaration:Boolean(d||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,d={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:m,span:g,keySpan:y,valueSpan:k})=>({key:m,span:g,keySpan:y,valueSpan:k}))}:{},...c.length?{children:c}:{}};if(f)this.builder.addMetadataAssignment(r.id,r.location,f,d);return d}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:[]},d={id:i,value:u.value,propertyOrder:u.propertyOrder,location:c,classes:f.classes};return this.builder.addJson(d),{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)=>{Yn.clear(),Is.input=[];try{yu({diagramType:"usecase",lexer:UA,parser:Is,entry:t(()=>Is.start(),"entry"),visit:t((r)=>qA.build(r,e),"visit")},e)}catch(r){Yn.clear();let s=Is.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"),Xn=t((e,r)=>{if(r!=="markdown")return e;return up(e).map((s)=>s.map((n)=>n.content).join(" ")).join(`
|
|
118
|
+
`)},"getAccessibleLabel"),ex=t((e)=>{let r=Xn(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 ${Xn(e.label??e.id,e.labelType)}`,"getUsecaseBoundaryAccessibleName"),rx=t((e)=>{if(e.relationshipType==="note")return"";return`${e.relationshipType==="association"&&e.label?`association ${Xn(e.label,e.labelType)}`:e.relationshipType} from ${e.sourceLabel} to ${e.targetLabel}`},"getUsecaseEdgeAccessibleName"),Hr=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=Hr(s.label);if(s.stereotype)s.stereotype=Hr(s.stereotype);if(!s.isGroup&&s.shape==="usecaseJsonTable")s.jsonRows=s.jsonRows?.map((i)=>({...i,key:Hr(i.key),value:Hr(i.value)}));if(!s.isGroup&&(s.shape==="usecaseEllipse"||s.shape==="rect")&&s.stereotype){let i=s.label??Hr(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=Hr(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(),d=f?.querySelector(".nodeLabel"),m=d?.querySelector("p")??d,g=m?.firstChild;if(m&&g?.nodeType===3){let y=m.ownerDocument.createElement("span");y.className="usecase-stereotype",m.insertBefore(y,g),y.appendChild(g)}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=h(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}=p(),o=n.db,c=o.getData(),u=new Map(c.nodes.map((m)=>[m.id,Xn(m.label??m.id,m.labelType)])),a={nodes:new Map(c.nodes.map((m)=>[m.id,m.isGroup?tx(m):ex(m.shape==="note"?{...m,noteTargetLabel:u.get(m.noteTarget??"")}:m)])),edges:new Map(c.edges.map((m)=>[m.id,rx({...m,sourceLabel:u.get(m.source)??m.sourceLabel,targetLabel:u.get(m.target)??m.targetLabel})]))},f=Tt(r,c.config.securityLevel);c.layoutAlgorithm=St(i),sx(c,r),Eu(f,c),await _t(c,f),nx(f,c,a);let d=c.diagramPadding;W.insertTitle(f,"usecaseDiagramTitleText",0,o.getDiagramTitle?.()??""),lt(f,d,"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(!Ye(r,n))return"";let i=E().usecase?.colorScheme==="rotate",o=Je(e.look),c=o==="handDrawn",u=st(s),a="";for(let f=0;f<Lr(n);f++){let d=n[f],m=u?`fill: ${s[f%s.length]};`:"",g=`[data-look="${o}"][data-color-id="color-${f}"]`;if(a+=`
|
|
119
119
|
|
|
120
120
|
& ${g}.system-boundary rect.boundary-body,
|
|
121
121
|
& ${g}.system-boundary rect.boundary-tab,
|