@pi-outpost/embed 0.32.4 → 0.34.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/{abnfDiagram-VCTEODGH-SjZtzoAs.cjs → abnfDiagram-YUKMZFIV-CgM8_qF6.cjs} +1 -1
- package/dist/{abnfDiagram-VCTEODGH-BX4P82Y6.js → abnfDiagram-YUKMZFIV-dNHR2FX4.js} +5 -5
- package/dist/architecture-WOLXFQ4H-DupyKILn.cjs +1 -0
- package/dist/architecture-WOLXFQ4H-X4ZWxzi-.js +3 -0
- package/dist/{architectureDiagram-5GKGNRK7-BRdxCCja.js → architectureDiagram-47P4ROYG-C_rUoWaO.js} +31 -31
- package/dist/{architectureDiagram-5GKGNRK7-wrDPdf3y.cjs → architectureDiagram-47P4ROYG-bflaQP1L.cjs} +3 -3
- package/dist/{blockDiagram-OSKFZWR5-Boo8WJyt.cjs → blockDiagram-E7TT5TSB-BKw9FE2U.cjs} +19 -8
- package/dist/{blockDiagram-OSKFZWR5-B1pU8Z2f.js → blockDiagram-E7TT5TSB-CEa2A5E9.js} +217 -193
- package/dist/c4Diagram-CRA5TL53-C-PuMGA5.cjs +38 -0
- package/dist/{c4Diagram-7LVT6UL2-WfERxhw2.js → c4Diagram-CRA5TL53-CtJh9DsO.js} +283 -273
- package/dist/channel-BjC1TKrU.cjs +1 -0
- package/dist/{channel-Cf_XiG-0.js → channel-DCXZw5aW.js} +1 -1
- package/dist/{chunk-OSK3NFVY-BUXOUgUl.js → chunk-2BW5OAIV-DWtmlmt_.js} +178 -154
- package/dist/chunk-2BW5OAIV-FkhgcL6B.cjs +10 -0
- package/dist/{chunk-75Z2AOVW-DoA8rENV.js → chunk-3YJQHVM4-BNbfg-7y.js} +235 -231
- package/dist/chunk-3YJQHVM4-ChvNe1M8.cjs +2 -0
- package/dist/chunk-4EA7E6EY-3OELTJ93.cjs +1 -0
- package/dist/{chunk-P2QGCYS3-BoMkrMIF.js → chunk-4EA7E6EY-B5P7n2an.js} +6 -6
- package/dist/{chunk-F27PBJKO-s9M3oGHp.js → chunk-7TKQ45FW-CD1KuemG.js} +2 -2
- package/dist/{chunk-F27PBJKO-3UPgzIlN.cjs → chunk-7TKQ45FW-Djscho_M.cjs} +1 -1
- package/dist/{chunk-SVP7TREG-CTKSOFlx.cjs → chunk-AW2ZBBNX-C4uNh90t.cjs} +3 -3
- package/dist/{chunk-SVP7TREG-weNUySou.js → chunk-AW2ZBBNX-CVsDDdv5.js} +33 -33
- package/dist/{chunk-GVQU2GXP-iZT_vNLp.cjs → chunk-DBDB3WZW-DSRcln4l.cjs} +1 -1
- package/dist/{chunk-GVQU2GXP-BhLneNgJ.js → chunk-DBDB3WZW-DpEOsLsQ.js} +3 -3
- package/dist/chunk-DUW6YSOI-2RXTEh_8.cjs +1 -0
- package/dist/chunk-DUW6YSOI-CVhxvrBO.js +10 -0
- package/dist/{chunk-GMAD6QVW-DZ2r0pLj.js → chunk-E2ZNV5FY-Bu796yUY.js} +354 -361
- package/dist/chunk-E2ZNV5FY-DIRTchKA.cjs +72 -0
- package/dist/chunk-EU5HNXII-DNBbmfcI.cjs +213 -0
- package/dist/{chunk-3NF5O7KM-DQV4G__C.js → chunk-EU5HNXII-DW-QTb0f.js} +426 -357
- package/dist/chunk-FVRAUYC3-Crqd-lTD.cjs +1 -0
- package/dist/chunk-FVRAUYC3-tiT7dtx-.js +356 -0
- package/dist/{chunk-PWAF6VOD-9dCi1q-p.js → chunk-HJ2JQQFS-CgYTXthn.js} +2 -2
- package/dist/{chunk-PWAF6VOD-CZZKCekP.cjs → chunk-HJ2JQQFS-DnrogIdt.cjs} +1 -1
- package/dist/chunk-HTAEGDNF-D4u24-lD.js +236 -0
- package/dist/chunk-HTAEGDNF-I4JlqwMr.cjs +1 -0
- package/dist/chunk-J5ZVWO5B-CK5HGA-t.cjs +1 -0
- package/dist/chunk-J5ZVWO5B-DEP-pB-1.js +12 -0
- package/dist/{chunk-POPQ4Y6H-BRQPB1-9.cjs → chunk-KQW6MTUR-C_XQxsme.cjs} +1 -1
- package/dist/{chunk-POPQ4Y6H-vLTNjxsT.js → chunk-KQW6MTUR-c0XOjr_c.js} +2 -2
- package/dist/chunk-NGNAAXSQ-DM0DL2MX.js +19836 -0
- package/dist/chunk-NGNAAXSQ-kHtfTQLE.cjs +136 -0
- package/dist/chunk-NTY3LDVX-CvRtOCpm.js +363 -0
- package/dist/chunk-NTY3LDVX-DBVRlnMJ.cjs +1 -0
- package/dist/chunk-VPRB5NB3-CT204jN6.cjs +129 -0
- package/dist/{chunk-DU6HZSFF-BW30DVuW.js → chunk-VPRB5NB3-DJh7spRO.js} +791 -611
- package/dist/chunk-XC4XBNZT-BTUjiQhE.cjs +62 -0
- package/dist/{chunk-4HAMMTFA-C2YXJpQw.js → chunk-XC4XBNZT-CSiWBPH9.js} +1378 -1079
- package/dist/classDiagram-v2-K4WV4PDN-BndXIwai.cjs +217 -0
- package/dist/{chunk-HLEWEB6X-BrzeadBj.js → classDiagram-v2-K4WV4PDN-C39xKke0.js} +254 -214
- package/dist/{conversationExport-QWEGKkKB.js → conversationExport-0aa7tXBv.js} +2 -2
- package/dist/{conversationExport-D2ekPeYe.cjs → conversationExport-BVHvnvh5.cjs} +1 -1
- package/dist/conversationHistory-CNfOwM8H.cjs +287 -0
- package/dist/{conversationHistory-BylZCAb1.js → conversationHistory-D-hT7EvD.js} +9066 -6513
- package/dist/cynefin-EF2NZ3EQ-BB_WO8YQ.js +3 -0
- package/dist/cynefin-EF2NZ3EQ-Du3-s5Z7.cjs +1 -0
- package/dist/{cynefinDiagram-5FMLGOSQ-GvGZco52.cjs → cynefinDiagram-3GCD6N5R-Bmvj-sQO.cjs} +1 -1
- package/dist/{cynefinDiagram-5FMLGOSQ-BEFzUfsd.js → cynefinDiagram-3GCD6N5R-C2CRSeJl.js} +14 -14
- package/dist/dagre-W4DXFKR2-ECmxkO0T.js +2356 -0
- package/dist/dagre-W4DXFKR2-aPKdYPEj.cjs +4 -0
- package/dist/diagram-2UJZ2QOL-B1JKtFHG.cjs +200 -0
- package/dist/diagram-2UJZ2QOL-CJRsGDwn.js +5081 -0
- package/dist/{diagram-VX7I27RA-Bx9fEhR0.cjs → diagram-OVF4WLC6-CwZeVpHT.cjs} +1 -1
- package/dist/{diagram-VX7I27RA-BK8jsKkD.js → diagram-OVF4WLC6-D6r6aTeO.js} +61 -61
- package/dist/{diagram-S7CK7UJ4-BH8mrGrv.js → diagram-PFPMY2P6-BpOJbdZ5.js} +15 -15
- package/dist/{diagram-S7CK7UJ4-BA67ZpiO.cjs → diagram-PFPMY2P6-DlLbGc_k.cjs} +3 -3
- package/dist/{diagram-Z3DM3KII-jy895UiZ.cjs → diagram-UMYRVEAY-BE-t_ZdV.cjs} +1 -1
- package/dist/{diagram-Z3DM3KII-CqouFf3D.js → diagram-UMYRVEAY-blW7NpUU.js} +14 -14
- package/dist/{diagram-UQ7AKVKN-Bvz7faiB.js → diagram-YEKJPTXX-BOgf87BN.js} +15 -15
- package/dist/{diagram-UQ7AKVKN-OteiyKD9.cjs → diagram-YEKJPTXX-CeQjir5H.cjs} +2 -2
- package/dist/diagram-ZIFT7M5P-BHePHmHl.cjs +3 -0
- package/dist/{diagram-VSXAHHWV-l9f6spkp.js → diagram-ZIFT7M5P-CZOnEYez.js} +40 -25
- package/dist/{docxExport-DK8uhXvT.js → docxExport-Cyk5ToUi.js} +1 -1
- package/dist/{docxExport-Dt55TJ2h.cjs → docxExport-DF-PXilo.cjs} +1 -1
- package/dist/{ebnfDiagram-PWID7BFC-Bwmmg23f.js → ebnfDiagram-VR2GEFS7-Cr0a3Ho_.js} +5 -5
- package/dist/{ebnfDiagram-PWID7BFC-BQZKHpUr.cjs → ebnfDiagram-VR2GEFS7-cgyTJ-Xs.cjs} +1 -1
- package/dist/elk-IJKZMXRS-NO3xNT-V.cjs +27 -0
- package/dist/elk-IJKZMXRS-V31is6hS.js +47984 -0
- package/dist/{erDiagram-2YWLMYGG-RTHTTqyH.js → erDiagram-O2IAPWRE-CP06GjjM.js} +60 -56
- package/dist/{erDiagram-2YWLMYGG-CuEEIv1I.cjs → erDiagram-O2IAPWRE-CnkFrABC.cjs} +13 -13
- package/dist/eventmodeling-K75KTNOO-CMoz0K5S.js +3 -0
- package/dist/eventmodeling-K75KTNOO-DZdZrgwl.cjs +1 -0
- package/dist/flowDiagram-OXPTDLAJ-BdYr7Idm.cjs +1 -0
- package/dist/flowDiagram-OXPTDLAJ-R_xf7pNW.js +16 -0
- package/dist/{ganttDiagram-EL5Y4UJY-PTWIufq8.cjs → ganttDiagram-R7TSEDQI-Jhax10tw.cjs} +3 -3
- package/dist/{ganttDiagram-EL5Y4UJY-BTvevd1z.js → ganttDiagram-R7TSEDQI-y1bDU8Ba.js} +103 -92
- package/dist/gitGraph-VSP46ZUC-DoTshgkY.js +3 -0
- package/dist/gitGraph-VSP46ZUC-lawIO6K6.cjs +1 -0
- package/dist/{gitGraphDiagram-WWUBYQGX-D5yozoaq.cjs → gitGraphDiagram-XJZIOB7I-CLZLQcPk.cjs} +5 -5
- package/dist/{gitGraphDiagram-WWUBYQGX-Bh9F7wif.js → gitGraphDiagram-XJZIOB7I-CYZa0-Ct.js} +45 -45
- package/dist/info-OHQRW6UA-DPTZOb30.js +3 -0
- package/dist/info-OHQRW6UA-deop1PPz.cjs +1 -0
- package/dist/infoDiagram-5W2HQ5XZ-D8fJK3ph.cjs +2 -0
- package/dist/{infoDiagram-FKFFQAWI-D6en39j4.js → infoDiagram-5W2HQ5XZ-Dw_D4zI1.js} +5 -5
- package/dist/{ishikawaDiagram-5VMMS53U-CvVqTWku.js → ishikawaDiagram-K3B6WC7H-BeLiZFVY.js} +25 -25
- package/dist/{ishikawaDiagram-5VMMS53U-DN23jmFw.cjs → ishikawaDiagram-K3B6WC7H-DtjgiZAB.cjs} +2 -2
- package/dist/{journeyDiagram-EYS64GPL-CqhBN0KZ.js → journeyDiagram-COXZFDF6-B-qvdudB.js} +31 -31
- package/dist/{journeyDiagram-EYS64GPL-Co9rp-Q1.cjs → journeyDiagram-COXZFDF6-Dge2AV0B.cjs} +4 -4
- package/dist/{kanban-definition-UXKFOSKX-DzKPVjAq.cjs → kanban-definition-P3RFRI5V-C02YfFZv.cjs} +4 -4
- package/dist/{kanban-definition-UXKFOSKX-CWx_Y40t.js → kanban-definition-P3RFRI5V-D0XAXDl8.js} +42 -42
- package/dist/{line-D6gR53Af.cjs → line-5eGinYgh.cjs} +1 -1
- package/dist/{line-CwYnx9Ke.js → line-BTenwQwq.js} +1 -1
- package/dist/loadReferencedImage-C60bzMNm.cjs +1 -0
- package/dist/{loadReferencedImage-BKEDAhWQ.js → loadReferencedImage-XQS67fhR.js} +3 -1
- package/dist/mermaid-parser.core-BHBS1DqP.cjs +6 -0
- package/dist/{mermaid-parser.core-DLNlSmfj.js → mermaid-parser.core-CI12FMcX.js} +163 -163
- package/dist/mermaid.core-4MZ-Iwu7.cjs +43 -0
- package/dist/{mermaid.core-DI1iFk6G.js → mermaid.core-BJkDCzqA.js} +875 -1150
- package/dist/{mindmap-definition-THT77NOG-Bo3D8RRT.cjs → mindmap-definition-LZFPQGKD-CXV1hV3a.cjs} +3 -3
- package/dist/{mindmap-definition-THT77NOG-B9hdpQgy.js → mindmap-definition-LZFPQGKD-gYumvdwo.js} +78 -78
- package/dist/packet-JDAUHWVQ-Bcik24Kz.js +3 -0
- package/dist/packet-JDAUHWVQ-CrY7ylWJ.cjs +1 -0
- package/dist/{pegDiagram-XKGWAZYB-Cx-wZf4B.cjs → pegDiagram-BGZESJAR-BICf3jMN.cjs} +1 -1
- package/dist/{pegDiagram-XKGWAZYB-CIBfY2Ob.js → pegDiagram-BGZESJAR-Dw9pRv5d.js} +5 -5
- package/dist/pi-outpost-embed.cjs +9 -10
- package/dist/pi-outpost-embed.js +2833 -2786
- package/dist/pie-XZMESJXO-BYQC-ufi.js +3 -0
- package/dist/pie-XZMESJXO-WjCBboSE.cjs +1 -0
- package/dist/{pieDiagram-E7YTZNPT-BC-pW4cK.cjs → pieDiagram-CAPJLFHJ-CF8cTQpC.cjs} +2 -2
- package/dist/{pieDiagram-E7YTZNPT-SG9oy_nV.js → pieDiagram-CAPJLFHJ-uz37FR9I.js} +18 -18
- package/dist/{quadrantDiagram-AXDQQJYC-C65HQ6gT.js → quadrantDiagram-GDMTTRAM-C4rt8LIh.js} +40 -40
- package/dist/{quadrantDiagram-AXDQQJYC-zPfqM9Q4.cjs → quadrantDiagram-GDMTTRAM-D9SYFJ_P.cjs} +2 -2
- package/dist/radar-ABXABTNO-BoQ7hH7Z.cjs +1 -0
- package/dist/radar-ABXABTNO-MxbyaZja.js +3 -0
- package/dist/railroad-I3PHUGI6-DckUArT-.js +3 -0
- package/dist/railroad-I3PHUGI6-DuGTlHry.cjs +1 -0
- package/dist/railroad-abnf-LNEFI6M7-DmAJaMEu.js +3 -0
- package/dist/railroad-abnf-LNEFI6M7-DoWf9u55.cjs +1 -0
- package/dist/railroad-ebnf-DWYD2UWJ-Bf05ZyW1.cjs +1 -0
- package/dist/railroad-ebnf-DWYD2UWJ-CS2AUYSv.js +3 -0
- package/dist/railroad-peg-JR7BVNR7-B-nctVbV.js +3 -0
- package/dist/railroad-peg-JR7BVNR7-CcV5KH4m.cjs +1 -0
- package/dist/{railroadDiagram-O6MQD6OU-3JsgWyLe.cjs → railroadDiagram-SM67HX2B-GgesxX7v.cjs} +1 -1
- package/dist/{railroadDiagram-O6MQD6OU-DLBEWyaH.js → railroadDiagram-SM67HX2B-T5SG0kEf.js} +5 -5
- package/dist/{requirementDiagram-IS5BZ75X-DwrHgMzq.js → requirementDiagram-X7JNWC4A-BEeCszC1.js} +49 -45
- package/dist/{requirementDiagram-IS5BZ75X-D1BMLxZg.cjs → requirementDiagram-X7JNWC4A-BVzf-VRr.cjs} +11 -11
- package/dist/{sankeyDiagram-P5KCCOFB-D5BHxcxB.cjs → sankeyDiagram-UM26HJRW-CdBXqklJ.cjs} +3 -3
- package/dist/{sankeyDiagram-P5KCCOFB-CcT0ZbW6.js → sankeyDiagram-UM26HJRW-DLDVzhPm.js} +16 -16
- package/dist/{sequenceDiagram-WJ2MYXX4-DM6BpXMT.js → sequenceDiagram-ZO4K6R2Y-B8wM6a-A.js} +704 -619
- package/dist/sequenceDiagram-ZO4K6R2Y-ytX57BES.cjs +169 -0
- package/dist/stateDiagram-v2-TBUQTH76-BTuAbG28.cjs +291 -0
- package/dist/{chunk-ZLD2IHE6-CqnVd2rq.js → stateDiagram-v2-TBUQTH76-PRnBJSrY.js} +271 -174
- package/dist/swimlanes-N4OXWK64-41SBE_L2.cjs +1 -0
- package/dist/{swimlanes-V6O3JKXN-BR7rwPmC.js → swimlanes-N4OXWK64-DipLcZla.js} +1006 -1219
- package/dist/swimlanesDiagram-K3J5GTZL-D6tIMgkj.cjs +8 -0
- package/dist/swimlanesDiagram-K3J5GTZL-_MehEHMi.js +27 -0
- package/dist/timeline-definition-YOQAKGHF-D_LWHCSA.cjs +120 -0
- package/dist/{timeline-definition-24CTP7MA-BQmq-H07.js → timeline-definition-YOQAKGHF-h8_spxIb.js} +210 -206
- package/dist/treeView-D4JQ5SDB-C3ticT1s.cjs +1 -0
- package/dist/treeView-D4JQ5SDB-CEuRf8gK.js +3 -0
- package/dist/treemap-SAJKECNS-BwIfwvl-.cjs +1 -0
- package/dist/treemap-SAJKECNS-DiC0668-.js +3 -0
- package/dist/usecaseDiagram-VIAY4XPW-DCfwvERR.js +7187 -0
- package/dist/usecaseDiagram-VIAY4XPW-PJHZiyJN.cjs +328 -0
- package/dist/{vennDiagram-4TSXK5OY-BdzbrV6i.js → vennDiagram-BLWOH2XV-_zHkfDVB.js} +43 -43
- package/dist/{vennDiagram-4TSXK5OY-D5MMYyff.cjs → vennDiagram-BLWOH2XV-niExkaFk.cjs} +3 -3
- package/dist/wardley-7MLQ67FV-BoIyQQ0E.cjs +1 -0
- package/dist/wardley-7MLQ67FV-CFF6IT1d.js +3 -0
- package/dist/{wardleyDiagram-VM6X3IG4-Ccz1enMd.js → wardleyDiagram-YMQ3BMBF-BKvQkiZP.js} +17 -17
- package/dist/{wardleyDiagram-VM6X3IG4-DzZNzmB8.cjs → wardleyDiagram-YMQ3BMBF-btlDrKA6.cjs} +3 -3
- package/dist/xychartDiagram-TAQBALBS-CkNZcyIi.cjs +7 -0
- package/dist/{xychartDiagram-S5SC5T6Z-B-sQkN_B.js → xychartDiagram-TAQBALBS-DlfKpBG9.js} +34 -30
- package/package.json +2 -2
- package/dist/architecture-7GRP2DOG-BtgYGXkq.cjs +0 -1
- package/dist/architecture-7GRP2DOG-DBQ9eYgM.js +0 -3
- package/dist/c4Diagram-7LVT6UL2-BCrC0RQo.cjs +0 -38
- package/dist/channel-DcrLLvcO.cjs +0 -1
- package/dist/chunk-3NF5O7KM-B-DpUW2r.cjs +0 -168
- package/dist/chunk-4HAMMTFA-CtkrBT7X.cjs +0 -62
- package/dist/chunk-75Z2AOVW-DOXS9ORa.cjs +0 -2
- package/dist/chunk-DU6HZSFF-3Hhp3Fo5.cjs +0 -127
- package/dist/chunk-FOHPRMQF-BNNbqxGX.js +0 -21456
- package/dist/chunk-FOHPRMQF-tmTlwTeH.cjs +0 -161
- package/dist/chunk-GMAD6QVW-B6uvB_wz.cjs +0 -72
- package/dist/chunk-HLEWEB6X-aqFoPl02.cjs +0 -206
- package/dist/chunk-L3NEJ4N5-BaR_9rF3.js +0 -245
- package/dist/chunk-L3NEJ4N5-vW3qRjIb.cjs +0 -1
- package/dist/chunk-OSK3NFVY-DU2FGOlI.cjs +0 -10
- package/dist/chunk-P2QGCYS3-DWeL9spl.cjs +0 -1
- package/dist/chunk-ZLD2IHE6-BZxKwfuv.cjs +0 -231
- package/dist/classDiagram-CYGNFDIV-CQLOfBmz.cjs +0 -1
- package/dist/classDiagram-CYGNFDIV-DsnY_WNO.js +0 -30
- package/dist/classDiagram-v2-TLXNO2FR-CQLOfBmz.cjs +0 -1
- package/dist/classDiagram-v2-TLXNO2FR-DeNpu9ZP.js +0 -30
- package/dist/conversationHistory-BmpdU77I.cjs +0 -286
- package/dist/cynefin-OW5HDTMX-BmLJra-4.cjs +0 -1
- package/dist/cynefin-OW5HDTMX-CfYr_cVN.js +0 -3
- package/dist/dagre-BMKbPnPh.js +0 -1934
- package/dist/dagre-EEW2OxRU.cjs +0 -1
- package/dist/dagre-OS7QT2EB-BtJ6v_Nc.js +0 -425
- package/dist/dagre-OS7QT2EB-DFi6nnZc.cjs +0 -4
- package/dist/diagram-VSXAHHWV-BjsZz1JJ.cjs +0 -3
- package/dist/eventmodeling-NTZA5JFV-D57pc07U.cjs +0 -1
- package/dist/eventmodeling-NTZA5JFV-DUbGOrrF.js +0 -3
- package/dist/flowDiagram-T62WH6J4-YyzE7N5Z.cjs +0 -1
- package/dist/flowDiagram-T62WH6J4-ptBWC6KI.js +0 -16
- package/dist/gitGraph-4MIJSDKK-CY4IuhXZ.js +0 -3
- package/dist/gitGraph-4MIJSDKK-D97vaDci.cjs +0 -1
- package/dist/info-A6RAGUB7-Cx39sHYM.js +0 -3
- package/dist/info-A6RAGUB7-DT06-FB3.cjs +0 -1
- package/dist/infoDiagram-FKFFQAWI-NPtQF4vB.cjs +0 -2
- package/dist/loadReferencedImage-DlRgJ4vm.cjs +0 -1
- package/dist/mermaid-parser.core-CBiDgMLi.cjs +0 -6
- package/dist/mermaid.core-B3QcBB1O.cjs +0 -43
- package/dist/packet-AYTQ26CC-BGX2McoE.cjs +0 -1
- package/dist/packet-AYTQ26CC-IgkU2VYK.js +0 -3
- package/dist/pie-WAS4IAKB-CEyPj3UJ.cjs +0 -1
- package/dist/pie-WAS4IAKB-odE0A7fM.js +0 -3
- package/dist/radar-RG4KPBEZ-ClYJNseM.cjs +0 -1
- package/dist/radar-RG4KPBEZ-DqbNqlJH.js +0 -3
- package/dist/railroad-74A4TZTK-Dzt4afqg.js +0 -3
- package/dist/railroad-74A4TZTK-hSKcr2y6.cjs +0 -1
- package/dist/railroad-abnf-HS5TGJTU-gq2RybTO.js +0 -3
- package/dist/railroad-abnf-HS5TGJTU-irEXz0eI.cjs +0 -1
- package/dist/railroad-ebnf-LZEXJU2U-CG19A1Xj.cjs +0 -1
- package/dist/railroad-ebnf-LZEXJU2U-D-pNpFrj.js +0 -3
- package/dist/railroad-peg-WCYAUIDC-BLdK3QCV.cjs +0 -1
- package/dist/railroad-peg-WCYAUIDC-Bo7wfe--.js +0 -3
- package/dist/sequenceDiagram-WJ2MYXX4-DlVJIIIl.cjs +0 -162
- package/dist/stateDiagram-XQSTLZYL-BhzcW44q.js +0 -220
- package/dist/stateDiagram-XQSTLZYL-mSOJx_Wv.cjs +0 -1
- package/dist/stateDiagram-v2-IH3M54BS-BE5CXOTu.js +0 -30
- package/dist/stateDiagram-v2-IH3M54BS-DAa6SuH4.cjs +0 -1
- package/dist/swimlanes-V6O3JKXN-BooYLGtP.cjs +0 -1
- package/dist/swimlanesDiagram-JKAHXJPX-BaMCBEUQ.cjs +0 -8
- package/dist/swimlanesDiagram-JKAHXJPX-lIPwQ8Mc.js +0 -30
- package/dist/timeline-definition-24CTP7MA-D6sSmprF.cjs +0 -120
- package/dist/treeView-Q6P3EWNA-BmkQxkVU.cjs +0 -1
- package/dist/treeView-Q6P3EWNA-CPEEGmNv.js +0 -3
- package/dist/treemap-WGGIJYW6-CGULpntJ.js +0 -3
- package/dist/treemap-WGGIJYW6-Dmi9HAR8.cjs +0 -1
- package/dist/wardley-WFR3VGLG-9zHZLKh9.js +0 -3
- package/dist/wardley-WFR3VGLG-B6YvLPJA.cjs +0 -1
- package/dist/xychartDiagram-S5SC5T6Z-BOsjfYJh.cjs +0 -7
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
const e=require("./chunk-Y2CYZVJY-CnmLqFtv.cjs"),t=require("./src-D9o9TOtH.cjs"),n=require("./chunk-VPRB5NB3-CT204jN6.cjs"),r=require("./chunk-3YJQHVM4-ChvNe1M8.cjs");require("./chunk-HJ2JQQFS-DnrogIdt.cjs");const i=require("./chunk-E2ZNV5FY-DIRTchKA.cjs");require("./chunk-4EA7E6EY-3OELTJ93.cjs");const a=require("./chunk-J5ZVWO5B-CK5HGA-t.cjs");require("./chunk-XC4XBNZT-BTUjiQhE.cjs"),require("./chunk-DBDB3WZW-DSRcln4l.cjs"),require("./chunk-2BW5OAIV-FkhgcL6B.cjs");const o=require("./chunk-XXDRQBXY-yMT3rT5Y.cjs"),s=require("./chunk-KQW6MTUR-C_XQxsme.cjs");require("./chunk-NTY3LDVX-DBVRlnMJ.cjs");const c=require("./mermaid.core-4MZ-Iwu7.cjs");function l(e){console&&console.error&&console.error(`Error: ${e}`)}function u(e){console&&console.warn&&console.warn(`Warning: ${e}`)}function d(e){let t=new Date().getTime(),n=e();return{time:new Date().getTime()-t,value:n}}function f(e){function t(){}t.prototype=e;let n=new t;function r(){return typeof n.bar}return r(),r(),e}function p(e){return m(e)?e.LABEL:e.name}function m(e){return typeof e.LABEL==`string`&&e.LABEL!==``}var h=class{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),this.definition.forEach(t=>{t.accept(e)})}},g=class extends h{constructor(e){super([]),this.idx=1,Object.assign(this,E(e))}set definition(e){}get definition(){return this.referencedRule===void 0?[]:this.referencedRule.definition}accept(e){e.visit(this)}},_=class extends h{constructor(e){super(e.definition),this.orgText=``,Object.assign(this,E(e))}},v=class extends h{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,Object.assign(this,E(e))}},y=class extends h{constructor(e){super(e.definition),this.idx=1,Object.assign(this,E(e))}},b=class extends h{constructor(e){super(e.definition),this.idx=1,Object.assign(this,E(e))}},x=class extends h{constructor(e){super(e.definition),this.idx=1,Object.assign(this,E(e))}},S=class extends h{constructor(e){super(e.definition),this.idx=1,Object.assign(this,E(e))}},C=class extends h{constructor(e){super(e.definition),this.idx=1,Object.assign(this,E(e))}},w=class extends h{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,Object.assign(this,E(e))}},T=class{constructor(e){this.idx=1,Object.assign(this,E(e))}accept(e){e.visit(this)}};function ee(e){return e.map(te)}function te(e){function t(e){return e.map(te)}if(e instanceof g){let t={type:`NonTerminal`,name:e.nonTerminalName,idx:e.idx};return typeof e.label==`string`&&(t.label=e.label),t}if(e instanceof v)return{type:`Alternative`,definition:t(e.definition)};if(e instanceof y)return{type:`Option`,idx:e.idx,definition:t(e.definition)};if(e instanceof b)return{type:`RepetitionMandatory`,idx:e.idx,definition:t(e.definition)};if(e instanceof x)return{type:`RepetitionMandatoryWithSeparator`,idx:e.idx,separator:te(new T({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof C)return{type:`RepetitionWithSeparator`,idx:e.idx,separator:te(new T({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof S)return{type:`Repetition`,idx:e.idx,definition:t(e.definition)};if(e instanceof w)return{type:`Alternation`,idx:e.idx,definition:t(e.definition)};if(e instanceof T){let t={type:`Terminal`,name:e.terminalType.name,label:p(e.terminalType),idx:e.idx};typeof e.label==`string`&&(t.terminalLabel=e.label);let n=e.terminalType.PATTERN;return e.terminalType.PATTERN&&(t.pattern=n instanceof RegExp?n.source:n),t}if(e instanceof _)return{type:`Rule`,name:e.name,orgText:e.orgText,definition:t(e.definition)};throw Error(`non exhaustive match`)}function E(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0))}var D=class{visit(e){let t=e;switch(t.constructor){case g:return this.visitNonTerminal(t);case v:return this.visitAlternative(t);case y:return this.visitOption(t);case b:return this.visitRepetitionMandatory(t);case x:return this.visitRepetitionMandatoryWithSeparator(t);case C:return this.visitRepetitionWithSeparator(t);case S:return this.visitRepetition(t);case w:return this.visitAlternation(t);case T:return this.visitTerminal(t);case _:return this.visitRule(t);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 O(e){return e instanceof v||e instanceof y||e instanceof S||e instanceof b||e instanceof x||e instanceof C||e instanceof T||e instanceof _}function k(e,t=[]){return e instanceof y||e instanceof S||e instanceof C?!0:e instanceof w?e.definition.some(e=>k(e,t)):e instanceof g&&t.includes(e)?!1:e instanceof h&&(e instanceof g&&t.push(e),e.definition.every(e=>k(e,t)))}function ne(e){return e instanceof w}function A(e){if(e instanceof g)return`SUBRULE`;if(e instanceof y)return`OPTION`;if(e instanceof w)return`OR`;if(e instanceof b)return`AT_LEAST_ONE`;if(e instanceof x)return`AT_LEAST_ONE_SEP`;if(e instanceof C)return`MANY_SEP`;if(e instanceof S)return`MANY`;if(e instanceof T)return`CONSUME`;throw Error(`non exhaustive match`)}var re=class{walk(e,t=[]){e.definition.forEach((n,r)=>{let i=e.definition.slice(r+1);if(n instanceof g)this.walkProdRef(n,i,t);else if(n instanceof T)this.walkTerminal(n,i,t);else if(n instanceof v)this.walkFlat(n,i,t);else if(n instanceof y)this.walkOption(n,i,t);else if(n instanceof b)this.walkAtLeastOne(n,i,t);else if(n instanceof x)this.walkAtLeastOneSep(n,i,t);else if(n instanceof C)this.walkManySep(n,i,t);else if(n instanceof S)this.walkMany(n,i,t);else if(n instanceof w)this.walkOr(n,i,t);else throw Error(`non exhaustive match`)})}walkTerminal(e,t,n){}walkProdRef(e,t,n){}walkFlat(e,t,n){let r=t.concat(n);this.walk(e,r)}walkOption(e,t,n){let r=t.concat(n);this.walk(e,r)}walkAtLeastOne(e,t,n){let r=[new y({definition:e.definition})].concat(t,n);this.walk(e,r)}walkAtLeastOneSep(e,t,n){let r=ie(e,t,n);this.walk(e,r)}walkMany(e,t,n){let r=[new y({definition:e.definition})].concat(t,n);this.walk(e,r)}walkManySep(e,t,n){let r=ie(e,t,n);this.walk(e,r)}walkOr(e,t,n){let r=t.concat(n);e.definition.forEach(e=>{let t=new v({definition:[e]});this.walk(t,r)})}};function ie(e,t,n){return[new y({definition:[new T({terminalType:e.separator})].concat(e.definition)})].concat(t,n)}function j(e){if(e instanceof g)return j(e.referencedRule);if(e instanceof T)return oe(e);if(O(e))return M(e);if(ne(e))return ae(e);throw Error(`non exhaustive match`)}function M(e){let t=[],n=e.definition,r=0,i=n.length>r,a,o=!0;for(;i&&o;)a=n[r],o=k(a),t=t.concat(j(a)),r+=1,i=n.length>r;return[...new Set(t)]}function ae(e){let t=e.definition.map(e=>j(e));return[...new Set(t.flat())]}function oe(e){return[e.terminalType]}var se=`_~IN~_`,ce=class extends re{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,t,n){}walkProdRef(e,t,n){let r=ue(e.referencedRule,e.idx)+this.topProd.name,i=j(new v({definition:t.concat(n)}));this.follows[r]=i}};function le(e){let t={};return e.forEach(e=>{let n=new ce(e).startWalking();Object.assign(t,n)}),t}function ue(e,t){return e.name+t+se}function N(e){return e.charCodeAt(0)}function de(e,t){Array.isArray(e)?e.forEach(function(e){t.push(e)}):t.push(e)}function fe(e,t){if(e[t]===!0)throw`duplicate flag `+t;e[t],e[t]=!0}function pe(e){if(e===void 0)throw Error(`Internal Error - Should never get here!`);return!0}function me(){throw Error(`Internal Error - Should never get here!`)}function he(e){return e.type===`Character`}var ge=[];for(let e=N(`0`);e<=N(`9`);e++)ge.push(e);var _e=[N(`_`)].concat(ge);for(let e=N(`a`);e<=N(`z`);e++)_e.push(e);for(let e=N(`A`);e<=N(`Z`);e++)_e.push(e);var ve=[N(` `),N(`\f`),N(`
|
|
2
|
+
`),N(`\r`),N(` `),N(`\v`),N(` `),N(`\xA0`),N(` `),N(` `),N(` `),N(` `),N(` `),N(` `),N(` `),N(` `),N(` `),N(` `),N(` `),N(` `),N(`\u2028`),N(`\u2029`),N(` `),N(` `),N(` `),N(``)],ye=/[0-9a-fA-F]/,be=/[0-9]/,xe=/[1-9]/,Se=class{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 t=this.disjunction();this.consumeChar(`/`);let n={type:`Flags`,loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case`g`:fe(n,`global`);break;case`i`:fe(n,`ignoreCase`);break;case`m`:fe(n,`multiLine`);break;case`u`:fe(n,`unicode`);break;case`y`:fe(n,`sticky`)}if(this.idx!==this.input.length)throw Error(`Redundant input: `+this.input.substring(this.idx));return{type:`Pattern`,flags:n,value:t,loc:this.loc(0)}}disjunction(){let e=[],t=this.idx;for(e.push(this.alternative());this.peekChar()===`|`;)this.consumeChar(`|`),e.push(this.alternative());return{type:`Disjunction`,value:e,loc:this.loc(t)}}alternative(){let e=[],t=this.idx;for(;this.isTerm();)e.push(this.term());return{type:`Alternative`,value:e,loc:this.loc(t)}}term(){return this.isAssertion()?this.assertion():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 t;switch(this.popChar()){case`=`:t=`Lookahead`;break;case`!`:t=`NegativeLookahead`;break;case`<`:switch(this.popChar()){case`=`:t=`Lookbehind`;break;case`!`:t=`NegativeLookbehind`}}pe(t);let n=this.disjunction();return this.consumeChar(`)`),{type:t,value:n,loc:this.loc(e)}}return me()}quantifier(e=!1){let t,n=this.idx;switch(this.popChar()){case`*`:t={atLeast:0,atMost:1/0};break;case`+`:t={atLeast:1,atMost:1/0};break;case`?`:t={atLeast:0,atMost:1};break;case`{`:let n=this.integerIncludingZero();switch(this.popChar()){case`}`:t={atLeast:n,atMost:n};break;case`,`:let e;this.isDigit()?(e=this.integerIncludingZero(),t={atLeast:n,atMost:e}):t={atLeast:n,atMost:1/0},this.consumeChar(`}`)}if(e===!0&&t===void 0)return;pe(t)}if((e!==!0||t!==void 0)&&pe(t))return this.peekChar(0)===`?`?(this.consumeChar(`?`),t.greedy=!1):t.greedy=!0,t.type=`Quantifier`,t.loc=this.loc(n),t}atom(){let e,t=this.idx;switch(this.peekChar()){case`.`:e=this.dotAll();break;case`\\`:e=this.atomEscape();break;case`[`:e=this.characterClass();break;case`(`:e=this.group()}return e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),pe(e)?(e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e):me()}dotAll(){return this.consumeChar(`.`),{type:`Set`,complement:!0,value:[N(`
|
|
3
|
+
`),N(`\r`),N(`\u2028`),N(`\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,t=!1;switch(this.popChar()){case`d`:e=ge;break;case`D`:e=ge,t=!0;break;case`s`:e=ve;break;case`S`:e=ve,t=!0;break;case`w`:e=_e;break;case`W`:e=_e,t=!0}return pe(e)?{type:`Set`,value:e,complement:t}:me()}controlEscapeAtom(){let e;switch(this.popChar()){case`f`:e=N(`\f`);break;case`n`:e=N(`
|
|
4
|
+
`);break;case`r`:e=N(`\r`);break;case`t`:e=N(` `);break;case`v`:e=N(`\v`)}return pe(e)?{type:`Character`,value:e}:me()}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:N(`\0`)}}hexEscapeSequenceAtom(){return this.consumeChar(`x`),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar(`u`),this.parseHexDigits(4)}identityEscapeAtom(){return{type:`Character`,value:N(this.popChar())}}classPatternCharacterAtom(){switch(this.peekChar()){case`
|
|
5
|
+
`:case`\r`:case`\u2028`:case`\u2029`:case`\\`:case`]`:throw Error(`TBD`);default:return{type:`Character`,value:N(this.popChar())}}}characterClass(){let e=[],t=!1;for(this.consumeChar(`[`),this.peekChar(0)===`^`&&(this.consumeChar(`^`),t=!0);this.isClassAtom();){let t=this.classAtom();if(t.type,he(t)&&this.isRangeDash()){this.consumeChar(`-`);let n=this.classAtom();if(n.type,he(n)){if(n.value<t.value)throw Error(`Range out of order in character class`);e.push({from:t.value,to:n.value})}else de(t.value,e),e.push(N(`-`)),de(n.value,e)}else de(t.value,e)}return this.consumeChar(`]`),{type:`Set`,complement:t,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:N(`\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++}let t=this.disjunction();this.consumeChar(`)`);let n={type:`Group`,capturing:e,value:t};return e&&(n.idx=this.groupIdx),n}positiveInteger(){let e=this.popChar();if(xe.test(e)===!1)throw Error(`Expecting a positive integer`);for(;be.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(be.test(e)===!1)throw Error(`Expecting an integer`);for(;be.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:N(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 be.test(this.peekChar(0))}isClassAtom(e=0){switch(this.peekChar(e)){case`]`:case`
|
|
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{return!1}finally{this.restoreState(e)}}isPatternCharacter(){switch(this.peekChar()){case`^`:case`$`:case`\\`:case`.`:case`*`:case`+`:case`?`:case`(`:case`)`:case`[`:case`|`:case`/`:case`
|
|
9
|
+
`:case`\r`:case`\u2028`:case`\u2029`:return!1;default:return!0}}parseHexDigits(e){let t=``;for(let n=0;n<e;n++){let e=this.popChar();if(ye.test(e)===!1)throw Error(`Expecting a HexDecimal digits`);t+=e}return{type:`Character`,value:parseInt(t,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}}},Ce=class{visitChildren(e){for(let t in e){let n=e[t];e.hasOwnProperty(t)&&(n.type===void 0?Array.isArray(n)&&n.forEach(e=>{this.visit(e)},this):this.visit(n))}}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)}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){}},we={},Te=new Se;function Ee(e){let t=e.toString();if(we.hasOwnProperty(t))return we[t];{let e=Te.pattern(t);return we[t]=e,e}}function De(){we={}}var Oe=`Complement Sets are not supported for first char optimization`,ke=`Unable to use "first char" lexer optimizations:
|
|
10
|
+
`;function Ae(e,t=!1){try{let t=Ee(e);return je(t.value,{},t.flags.ignoreCase)}catch(n){if(n.message===Oe)t&&u(`${ke}\tUnable to optimize: < ${e.toString()} >\n Complement Sets cannot be automatically optimized.
|
|
11
|
+
This will disable the lexer's first char optimizations.
|
|
12
|
+
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let n=``;t&&(n=`
|
|
13
|
+
This will disable the lexer's first char optimizations.
|
|
14
|
+
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),l(`${ke}\n\tFailed parsing: < ${e.toString()} >\n\tUsing the @chevrotain/regexp-to-ast library\n Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+n)}}return[]}function je(e,t,n){switch(e.type){case`Disjunction`:for(let r=0;r<e.value.length;r++)je(e.value[r],t,n);break;case`Alternative`:let r=e.value;for(let e=0;e<r.length;e++){let i=r[e];switch(i.type){case`EndAnchor`:case`GroupBackReference`:case`Lookahead`:case`NegativeLookahead`:case`Lookbehind`:case`NegativeLookbehind`:case`StartAnchor`:case`WordBoundary`:case`NonWordBoundary`:continue}let a=i;switch(a.type){case`Character`:Me(a.value,t,n);break;case`Set`:if(a.complement===!0)throw Error(Oe);a.value.forEach(e=>{if(typeof e==`number`)Me(e,t,n);else{let r=e;if(n===!0)for(let e=r.from;e<=r.to;e++)Me(e,t,n);else{for(let e=r.from;e<=r.to&&e<256;e++)Me(e,t,n);if(r.to>=256){let e=r.from>=256?r.from:256,n=r.to,i=P(e),a=P(n);for(let e=i;e<=a;e++)t[e]=e}}}});break;case`Group`:je(a.value,t,n);break;default:throw Error(`Non Exhaustive Match`)}let o=a.quantifier!==void 0&&a.quantifier.atLeast===0;if(a.type===`Group`&&Fe(a)===!1||a.type!==`Group`&&o===!1)break}break;default:throw Error(`non exhaustive match!`)}return Object.values(t)}function Me(e,t,n){let r=P(e);t[r]=r,n===!0&&Ne(e,t)}function Ne(e,t){let n=String.fromCharCode(e),r=n.toUpperCase();if(r!==n){let e=P(r.charCodeAt(0));t[e]=e}else{let e=n.toLowerCase();if(e!==n){let n=P(e.charCodeAt(0));t[n]=n}}}function Pe(e,t){return e.value.find(e=>{if(typeof e==`number`)return t.includes(e);{let n=e;return t.find(e=>n.from<=e&&e<=n.to)!==void 0}})}function Fe(e){let t=e.quantifier;return t&&t.atLeast===0?!0:e.value?Array.isArray(e.value)?e.value.every(Fe):Fe(e.value):!1}var Ie=class extends Ce{constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(this.found!==!0){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){this.targetCharCodes.includes(e.value)&&(this.found=!0)}visitSet(e){e.complement?Pe(e,this.targetCharCodes)===void 0&&(this.found=!0):Pe(e,this.targetCharCodes)!==void 0&&(this.found=!0)}};function Le(e,t){if(t instanceof RegExp){let n=Ee(t),r=new Ie(e);return r.visit(n),r.found}for(let n of t){let t=n.charCodeAt(0);if(e.includes(t))return!0}return!1}var Re=`PATTERN`,ze=`defaultMode`;function Be(e,t){t=Object.assign({safeMode:!1,positionTracking:`full`,lineTerminatorCharacters:[`\r`,`
|
|
15
|
+
`],tracer:(e,t)=>t()},t);let n=t.tracer;n(`initCharCodeToOptimizedIndexMap`,()=>{gt()});let r;n(`Reject Lexer.NA`,()=>{r=e.filter(e=>e[Re]!==I.NA)});let i=!1,a;n(`Transform Patterns`,()=>{i=!1,a=r.map(e=>{let t=e[Re];if(t instanceof RegExp){let e=t.source;return e.length===1&&e!==`^`&&e!==`$`&&e!==`.`&&!t.ignoreCase?e:e.length===2&&e[0]===`\\`&&![`d`,`D`,`s`,`S`,`t`,`r`,`n`,`t`,`0`,`c`,`b`,`B`,`f`,`v`,`w`,`W`].includes(e[1])?e[1]:at(t)}if(typeof t==`function`)return i=!0,{exec:t};if(typeof t==`object`)return i=!0,t;if(typeof t==`string`){if(t.length===1)return t;{let e=t.replace(/[\\^$.*+?()[\]{}|]/g,`\\$&`);return at(new RegExp(e))}}throw Error(`non exhaustive match`)})});let o,s,c,u,d;n(`misc mapping`,()=>{o=r.map(e=>e.tokenTypeIdx),s=r.map(e=>{let t=e.GROUP;if(t!==I.SKIPPED){if(typeof t==`string`)return t;if(t===void 0)return!1;throw Error(`non exhaustive match`)}}),c=r.map(e=>{let t=e.LONGER_ALT;if(t)return Array.isArray(t)?t.map(e=>r.indexOf(e)):[r.indexOf(t)]}),u=r.map(e=>e.PUSH_MODE),d=r.map(e=>Object.hasOwn(e,`POP_MODE`))});let f;n(`Line Terminator Handling`,()=>{let e=pt(t.lineTerminatorCharacters);f=r.map(e=>!1),t.positionTracking!==`onlyOffset`&&(f=r.map(t=>Object.hasOwn(t,`LINE_BREAKS`)?!!t.LINE_BREAKS:dt(t,e)===!1&&Le(e,t.PATTERN)))});let p,m,h,g;n(`Misc Mapping #2`,()=>{p=r.map(ct),m=a.map(lt),h=r.reduce((e,t)=>{let n=t.GROUP;return typeof n==`string`&&n!==I.SKIPPED&&(e[n]=[]),e},{}),g=a.map((e,t)=>{let n=s[t]===void 0&&c[t]===void 0?Ve(r[t].PATTERN):void 0;return{pattern:a[t],asciiClass:n,longerAlt:c[t],canLineTerminator:f[t],matchType:n===void 0?m[t]===!1?p[t]?1:2:0:3,short:m[t],group:s[t],push:u[t],pop:d[t],tokenTypeIdx:o[t],tokenType:r[t]}})});let _=!0,v=[];return t.safeMode||n(`First Char Optimization`,()=>{v=r.reduce((e,n,r)=>{if(typeof n.PATTERN==`string`)mt(e,P(n.PATTERN.charCodeAt(0)),g[r]);else if(Array.isArray(n.START_CHARS_HINT)){let t;n.START_CHARS_HINT.forEach(n=>{let i=P(typeof n==`string`?n.charCodeAt(0):n);t!==i&&(t=i,mt(e,i,g[r]))})}else if(n.PATTERN instanceof RegExp){if(n.PATTERN.unicode)_=!1,t.ensureOptimizations&&l(`${ke}\tUnable to analyze < ${n.PATTERN.toString()} > pattern.\n The regexp unicode flag is not currently supported by the regexp-to-ast library.
|
|
16
|
+
This will disable the lexer's first char optimizations.
|
|
17
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{let i=Ae(n.PATTERN,t.ensureOptimizations);i.length===0&&(_=!1),i.forEach(t=>{mt(e,t,g[r])})}}else t.ensureOptimizations&&l(`${ke}\tTokenType: <${n.name}> is using a custom token pattern without providing <start_chars_hint> parameter.\n This will disable the lexer's first char optimizations.
|
|
18
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),_=!1;return e},[])}),{emptyGroups:h,patternIdxToConfig:g,charCodeToPatternIdxToConfig:v,hasCustom:i,canBeOptimized:_}}function Ve(e){if(!(e instanceof RegExp)||e.flags!==``)return;let t;try{t=Ee(e)}catch{return}if(t.value.value.length!==1||t.value.value[0].value.length!==1)return;let n=t.value.value[0].value[0],r;for(;n.type===`Group`;){if(n.capturing||n.quantifier!==void 0&&r!==void 0||n.value.value.length!==1||n.value.value[0].value.length!==1)return;r=n.quantifier??r,n=n.value.value[0].value[0]}if(n.type!==`Set`||n.complement||n.quantifier!==void 0&&r!==void 0||(r=n.quantifier??r,r?.atLeast!==1||r.atMost!==1/0||!r.greedy))return;let i=new Uint8Array(128);for(let e of n.value){let t=typeof e==`number`?e:e.from,n=typeof e==`number`?e:e.to;if(t<0||n>=i.length)return;i.fill(1,t,n+1)}return i}function He(e,t){let n=[],r=We(e);n=n.concat(r.errors);let i=Ge(r.valid),a=i.valid;return n=n.concat(i.errors),n=n.concat(Ue(a)),n=n.concat($e(a)),n=n.concat(et(a,t)),n=n.concat(tt(a)),n}function Ue(e){let t=[],n=e.filter(e=>e[Re]instanceof RegExp);return t=t.concat(qe(n)),t=t.concat(Xe(n)),t=t.concat(Ze(n)),t=t.concat(Qe(n)),t=t.concat(Je(n)),t}function We(e){let t=e.filter(e=>!Object.hasOwn(e,Re));return{errors:t.map(e=>({message:`Token Type: ->`+e.name+`<- missing static 'PATTERN' property`,type:F.MISSING_PATTERN,tokenTypes:[e]})),valid:e.filter(e=>!t.includes(e))}}function Ge(e){let t=e.filter(e=>{let t=e[Re];return!(t instanceof RegExp)&&typeof t!=`function`&&!Object.hasOwn(t,`exec`)&&typeof t!=`string`});return{errors:t.map(e=>({message:`Token Type: ->`+e.name+`<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.`,type:F.INVALID_PATTERN,tokenTypes:[e]})),valid:e.filter(e=>!t.includes(e))}}var Ke=/[^\\][$]/;function qe(e){class t extends Ce{constructor(){super(...arguments),this.found=!1}visitEndAnchor(e){this.found=!0}}return e.filter(e=>{let n=e.PATTERN;try{let e=Ee(n),r=new t;return r.visit(e),r.found}catch{return Ke.test(n.source)}}).map(e=>({message:`Unexpected RegExp Anchor Error:
|
|
19
|
+
Token Type: ->`+e.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
|
|
20
|
+
See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:F.EOI_ANCHOR_FOUND,tokenTypes:[e]}))}function Je(e){return e.filter(e=>e.PATTERN.test(``)).map(e=>({message:`Token Type: ->`+e.name+`<- static 'PATTERN' must not match an empty string`,type:F.EMPTY_MATCH_PATTERN,tokenTypes:[e]}))}var Ye=/[^\\[][\^]|^\^/;function Xe(e){class t extends Ce{constructor(){super(...arguments),this.found=!1}visitStartAnchor(e){this.found=!0}}return e.filter(e=>{let n=e.PATTERN;try{let e=Ee(n),r=new t;return r.visit(e),r.found}catch{return Ye.test(n.source)}}).map(e=>({message:`Unexpected RegExp Anchor Error:
|
|
21
|
+
Token Type: ->`+e.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
|
|
22
|
+
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:F.SOI_ANCHOR_FOUND,tokenTypes:[e]}))}function Ze(e){return e.filter(e=>{let t=e[Re];return t instanceof RegExp&&(t.multiline||t.global)}).map(e=>({message:`Token Type: ->`+e.name+`<- static 'PATTERN' may NOT contain global('g') or multiline('m')`,type:F.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[e]}))}function Qe(e){let t=[],n=e.map(n=>e.reduce((e,r)=>n.PATTERN.source===r.PATTERN.source&&!t.includes(r)&&r.PATTERN!==I.NA?(t.push(r),e.push(r),e):e,[]));return n=n.filter(Boolean),n.filter(e=>e.length>1).map(e=>{let t=e.map(e=>e.name);return{message:`The same RegExp pattern ->${e[0].PATTERN}<-has been used in all of the following Token Types: ${t.join(`, `)} <-`,type:F.DUPLICATE_PATTERNS_FOUND,tokenTypes:e}})}function $e(e){return e.filter(e=>{if(!Object.hasOwn(e,`GROUP`))return!1;let t=e.GROUP;return t!==I.SKIPPED&&t!==I.NA&&typeof t!=`string`}).map(e=>({message:`Token Type: ->`+e.name+`<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String`,type:F.INVALID_GROUP_TYPE_FOUND,tokenTypes:[e]}))}function et(e,t){return e.filter(e=>e.PUSH_MODE!==void 0&&!t.includes(e.PUSH_MODE)).map(e=>({message:`Token Type: ->${e.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${e.PUSH_MODE}<-which does not exist`,type:F.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[e]}))}function tt(e){let t=[],n=e.reduce((e,t,n)=>{let r=t.PATTERN;return r===I.NA||(typeof r==`string`?e.push({str:r,idx:n,tokenType:t}):r instanceof RegExp&&rt(r)&&e.push({str:r.source,idx:n,tokenType:t})),e},[]);return e.forEach((e,r)=>{n.forEach(({str:n,idx:i,tokenType:a})=>{if(r<i&&nt(n,e.PATTERN)){let n=`Token: ->${a.name}<- can never be matched.\nBecause it appears AFTER the Token Type ->${e.name}<-in the lexer's definition.\nSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;t.push({message:n,type:F.UNREACHABLE_PATTERN,tokenTypes:[e,a]})}})}),t}function nt(e,t){if(t instanceof RegExp){if(it(t))return!1;let n=t.exec(e);return n!==null&&n.index===0}if(typeof t==`function`)return t(e,0,[],{});if(Object.hasOwn(t,`exec`))return t.exec(e,0,[],{});if(typeof t==`string`)return t===e;throw Error(`non exhaustive match`)}function rt(e){return[`.`,`\\`,`[`,`]`,`|`,`^`,`$`,`(`,`)`,`?`,`*`,`+`,`{`].find(t=>e.source.indexOf(t)!==-1)===void 0}function it(e){return/(\(\?=)|(\(\?!)|(\(\?<=)|(\(\?<!)/.test(e.source)}function at(e){let t=e.ignoreCase?`iy`:`y`;return RegExp(`${e.source}`,t)}function ot(e,t,n){let r=[];return Object.hasOwn(e,`defaultMode`)||r.push({message:`A MultiMode Lexer cannot be initialized without a <defaultMode> property in its definition
|
|
23
|
+
`,type:F.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),Object.hasOwn(e,`modes`)||r.push({message:`A MultiMode Lexer cannot be initialized without a <modes> property in its definition
|
|
24
|
+
`,type:F.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),Object.hasOwn(e,`modes`)&&Object.hasOwn(e,`defaultMode`)&&!Object.hasOwn(e.modes,e.defaultMode)&&r.push({message:`A MultiMode Lexer cannot be initialized with a ${ze}: <${e.defaultMode}>which does not exist\n`,type:F.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),Object.hasOwn(e,`modes`)&&Object.keys(e.modes).forEach(t=>{let n=e.modes[t];n.forEach((e,i)=>{e===void 0?r.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${t}> at index: <${i}>\n`,type:F.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED}):Object.hasOwn(e,`LONGER_ALT`)&&(Array.isArray(e.LONGER_ALT)?e.LONGER_ALT:[e.LONGER_ALT]).forEach(i=>{i!==void 0&&!n.includes(i)&&r.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${i.name}> on token <${e.name}> outside of mode <${t}>\n`,type:F.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})})}),r}function st(e,t,n){let r=[],i=!1,a=Object.values(e.modes||{}).flat().filter(Boolean).filter(e=>e[Re]!==I.NA),o=pt(n);return t&&a.forEach(e=>{let t=dt(e,o);if(t!==!1){let n={message:ft(e,t),type:t.issue,tokenType:e};r.push(n)}else Object.hasOwn(e,`LINE_BREAKS`)?e.LINE_BREAKS===!0&&(i=!0):Le(o,e.PATTERN)&&(i=!0)}),t&&!i&&r.push({message:`Warning: No LINE_BREAKS Found.
|
|
25
|
+
This Lexer has been defined to track line and column information,
|
|
26
|
+
But none of the Token Types can be identified as matching a line terminator.
|
|
27
|
+
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
|
|
28
|
+
for details.`,type:F.NO_LINE_BREAKS_FLAGS}),r}function ct(e){let t=e.PATTERN;if(t instanceof RegExp)return!1;if(typeof t==`function`||Object.hasOwn(t,`exec`))return!0;if(typeof t==`string`)return!1;throw Error(`non exhaustive match`)}function lt(e){return typeof e==`string`&&e.length===1&&e.charCodeAt(0)}var ut={test:function(e){let t=e.length;for(let n=this.lastIndex;n<t;n++){let t=e.charCodeAt(n);if(t===10)return this.lastIndex=n+1,!0;if(t===13)return this.lastIndex=e.charCodeAt(n+1)===10?n+2:n+1,!0}return!1},lastIndex:0};function dt(e,t){if(Object.hasOwn(e,`LINE_BREAKS`))return!1;if(e.PATTERN instanceof RegExp){try{Le(t,e.PATTERN)}catch(e){return{issue:F.IDENTIFY_TERMINATOR,errMsg:e.message}}return!1}if(typeof e.PATTERN==`string`)return!1;if(ct(e))return{issue:F.CUSTOM_LINE_BREAK};throw Error(`non exhaustive match`)}function ft(e,t){if(t.issue===F.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
|
|
29
|
+
\tThe problem is in the <${e.name}> Token Type\n\t Root cause: ${t.errMsg}.\n For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(t.issue===F.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
|
|
30
|
+
\tThe problem is in the <${e.name}> Token Type\n For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error(`non exhaustive match`)}function pt(e){return e.map(e=>typeof e==`string`?e.charCodeAt(0):e)}function mt(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}var ht=[];function P(e){return e<256?e:ht[e]}function gt(){if(ht.length===0){ht=Array(65536);for(let e=0;e<65536;e++)ht[e]=e>255?255+~~(e/255):e}}function _t(e,t){let n=e.tokenTypeIdx;return n===t.tokenTypeIdx||t.isParent===!0&&t.categoryMatchesMap[n]===!0}function vt(e,t){return e.tokenTypeIdx===t.tokenTypeIdx}var yt=1,bt={};function xt(e){let t=St(e);Ct(t),Tt(t),wt(t),t.forEach(e=>{e.isParent=e.categoryMatches.length>0})}function St(e){let t=[...e],n=e,r=!0;for(;r;){n=n.map(e=>e.CATEGORIES).flat().filter(Boolean);let e=n.filter(e=>!t.includes(e));t=t.concat(e),e.length===0?r=!1:n=e}return t}function Ct(e){e.forEach(e=>{Dt(e)||(bt[yt]=e,e.tokenTypeIdx=yt++),Ot(e)&&!Array.isArray(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),Ot(e)||(e.CATEGORIES=[]),kt(e)||(e.categoryMatches=[]),At(e)||(e.categoryMatchesMap={})})}function wt(e){e.forEach(e=>{e.categoryMatches=[],Object.keys(e.categoryMatchesMap).forEach(t=>{e.categoryMatches.push(bt[t].tokenTypeIdx)})})}function Tt(e){e.forEach(e=>{Et([],e)})}function Et(e,t){e.forEach(e=>{t.categoryMatchesMap[e.tokenTypeIdx]=!0}),t.CATEGORIES.forEach(n=>{let r=e.concat(t);r.includes(n)||Et(r,n)})}function Dt(e){return Object.hasOwn(e??{},`tokenTypeIdx`)}function Ot(e){return Object.hasOwn(e??{},`CATEGORIES`)}function kt(e){return Object.hasOwn(e??{},`categoryMatches`)}function At(e){return Object.hasOwn(e??{},`categoryMatchesMap`)}function jt(e){return Object.hasOwn(e??{},`tokenTypeIdx`)}var Mt={buildUnableToPopLexerModeMessage(e){return`Unable to pop Lexer Mode after encountering Token ->${e.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(e,t,n,r,i,a){return`unexpected character: ->${e.charAt(t)}<- at offset: ${t}, skipped ${n} characters.`}},F;(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`})(F||={});var Nt={deferDefinitionErrorsHandling:!1,positionTracking:`full`,lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
|
|
31
|
+
`,`\r`],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:Mt,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(Nt);var I=class{constructor(e,t=Nt){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.cachedGroupKeys=[],this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(e,t)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;let n=Array(this.traceInitIndent+1).join(` `);this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--> <${e}>`);let{time:r,value:i}=d(t),a=r>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(`${n}<-- <${e}> time: ${r}ms`),this.traceInitIndent--,i}return t()},typeof t==`boolean`)throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
|
|
32
|
+
a boolean 2nd argument is no longer supported`);this.config=Object.assign({},Nt,t);let n=this.config.traceInitPerf;n===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof n==`number`&&(this.traceInitMaxIdent=n,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT(`Lexer Constructor`,()=>{let n,r=!0;this.TRACE_INIT(`Lexer Config handling`,()=>{if(this.config.lineTerminatorsPattern===Nt.lineTerminatorsPattern)this.config.lineTerminatorsPattern=ut;else if(this.config.lineTerminatorCharacters===Nt.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
|
|
33
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(t.safeMode&&t.ensureOptimizations)throw Error(`"safeMode" and "ensureOptimizations" flags are mutually exclusive.`);this.trackStartLines=/full|onlyStart/i.test(this.config.positionTracking),this.trackEndLines=/full/i.test(this.config.positionTracking),Array.isArray(e)?n={modes:{defaultMode:[...e]},defaultMode:ze}:(r=!1,n=Object.assign({},e))}),this.config.skipValidations===!1&&(this.TRACE_INIT(`performRuntimeChecks`,()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(ot(n,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT(`performWarningRuntimeChecks`,()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(st(n,this.trackStartLines,this.config.lineTerminatorCharacters))})),n.modes=n.modes?n.modes:{},Object.entries(n.modes).forEach(([e,t])=>{n.modes[e]=t.filter(e=>e!==void 0)});let i=Object.keys(n.modes);if(Object.entries(n.modes).forEach(([e,n])=>{this.TRACE_INIT(`Mode: <${e}> processing`,()=>{if(this.modes.push(e),this.config.skipValidations===!1&&this.TRACE_INIT(`validatePatterns`,()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(He(n,i))}),this.lexerDefinitionErrors.length===0){xt(n);let r;this.TRACE_INIT(`analyzeTokenTypes`,()=>{r=Be(n,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[e]=r.patternIdxToConfig,this.charCodeToPatternIdxToConfig[e]=r.charCodeToPatternIdxToConfig,this.emptyGroups=Object.assign({},this.emptyGroups,r.emptyGroups),this.hasCustom=r.hasCustom||this.hasCustom,this.canModeBeOptimized[e]=r.canBeOptimized}})}),this.defaultMode=n.defaultMode,this.cachedGroupKeys=Object.keys(this.emptyGroups),this.lexerDefinitionErrors.length>0&&!this.config.deferDefinitionErrorsHandling){let e=this.lexerDefinitionErrors.map(e=>e.message).join(`-----------------------
|
|
34
|
+
`);throw Error(`Errors detected in definition of Lexer:
|
|
35
|
+
`+e)}this.lexerDefinitionWarning.forEach(e=>{u(e.message)}),this.TRACE_INIT(`Choosing sub-methods implementations`,()=>{if(r&&(this.handleModes=()=>{}),this.trackStartLines===!1&&(this.computeNewColumn=e=>e),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=()=>{}),/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}"`);this.hasCustom?(this.addToken=this.addTokenUsingPush,this.handlePayload=this.handlePayloadWithCustom):(this.addToken=this.addTokenUsingMemberAccess,this.handlePayload=this.handlePayloadNoCustom)}),this.TRACE_INIT(`Failed Optimization Warnings`,()=>{let e=Object.entries(this.canModeBeOptimized).reduce((e,[t,n])=>(n===!1&&e.push(t),e),[]);if(t.ensureOptimizations&&e.length>0)throw Error(`Lexer Modes: < ${e.join(`, `)} > cannot be optimized.\n Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
|
|
36
|
+
Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT(`clearRegExpParserCache`,()=>{De()}),this.TRACE_INIT(`toFastProperties`,()=>{f(this)})})}tokenize(e,t=this.defaultMode){if(this.lexerDefinitionErrors.length>0){let e=this.lexerDefinitionErrors.map(e=>e.message).join(`-----------------------
|
|
37
|
+
`);throw Error(`Unable to Tokenize because Errors detected in definition of Lexer:
|
|
38
|
+
`+e)}return this.tokenizeInternal(e,t)}tokenizeInternal(e,t){let n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_=e,v=_.length,y=0,b=0,x=this.hasCustom?0:Math.floor(e.length/10),S=Array(x),C=[],w=this.trackStartLines?1:void 0,T=this.trackStartLines?1:void 0,ee={};for(let e=0;e<this.cachedGroupKeys.length;e++)ee[this.cachedGroupKeys[e]]=[];let te=this.trackStartLines,E=this.config.lineTerminatorsPattern,D=0,O=[],k=[],ne=[],A=[];Object.freeze(A);let re=!1,ie=e=>{if(ne.length===1&&e.tokenType.PUSH_MODE===void 0){let t=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(e);C.push({offset:e.startOffset,line:e.startLine,column:e.startColumn,length:e.image.length,message:t})}else{ne.pop();let e=ne.at(-1);O=this.patternIdxToConfig[e],k=this.charCodeToPatternIdxToConfig[e],D=O.length;let t=this.canModeBeOptimized[e]&&this.config.safeMode===!1;re=!!(k&&t)}};function j(e){ne.push(e),k=this.charCodeToPatternIdxToConfig[e],O=this.patternIdxToConfig[e],D=O.length;let t=this.canModeBeOptimized[e]&&this.config.safeMode===!1;re=!!(k&&t)}j.call(this,t);let M,ae=this.config.recoveryEnabled;for(;y<v;){s=null,u=-1;let t=_.charCodeAt(y),x;if(re){let e=P(t),n=k[e];x=n===void 0?A:n}else x=O;let oe=x.length;for(n=0;n<oe;n++){M=x[n];let r=M.pattern;switch(c=null,M.matchType){case 0:t===M.short&&(u=1,s=r);break;case 1:g=r.exec(_,y,S,ee),g===null?s=null:(s=g[0],u=s.length,g.payload!==void 0&&(c=g.payload));break;case 3:{let e=M.asciiClass;if(e[t]!==1){r.lastIndex=0;break}let n=y+1;for(;e[_.charCodeAt(n)]===1;)n++;u=n-y,r.lastIndex=n;break}case 2:r.lastIndex=y,u=this.matchLength(r,e,y)}if(u!==-1){if(o=M.longerAlt,o!==void 0){s=e.substring(y,y+u);let t=o.length;for(i=0;i<t;i++){let t=O[o[i]],n=t.pattern;if(l=null,t.matchType===1?(g=n.exec(_,y,S,ee),g===null?a=null:(a=g[0],g.payload!==void 0&&(l=g.payload))):(n.lastIndex=y,a=this.match(n,e,y)),a&&a.length>s.length){s=a,u=a.length,c=l,M=t;break}}}break}}if(u!==-1){if(d=M.group,d!==void 0&&(s=s===null?e.substring(y,y+u):s,f=M.tokenTypeIdx,p=this.createTokenInstance(s,y,f,M.tokenType,w,T,u),this.handlePayload(p,c),d===!1?b=this.addToken(S,b,p):ee[d].push(p)),te===!0&&M.canLineTerminator===!0){let t=0,n,r;E.lastIndex=0;do s=s===null?e.substring(y,y+u):s,n=E.test(s),n===!0&&(r=E.lastIndex-1,t++);while(n===!0);t===0?T=this.computeNewColumn(T,u):(w+=t,T=u-r,this.updateTokenEndLineColumnLocation(p,d,r,t,w,T,u))}else T=this.computeNewColumn(T,u);y+=u,this.handleModes(M,ie,j,p)}else{let t=y,n=w,i=T,a=ae===!1;for(;a===!1&&y<v;)for(y++,r=0;r<D;r++){let t=O[r],n=t.pattern;switch(t.matchType){case 0:_.charCodeAt(y)===t.short&&(a=!0);break;case 1:a=n.exec(_,y,S,ee)!==null;break;case 3:case 2:n.lastIndex=y,a=n.exec(e)!==null}if(a===!0)break}if(m=y-t,T=this.computeNewColumn(T,m),h=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(_,t,m,n,i,ne.at(-1)),C.push({offset:t,line:n,column:i,length:m,message:h}),ae===!1)break}}return this.hasCustom||(S.length=b),{tokens:S,groups:ee,errors:C}}handleModes(e,t,n,r){if(e.pop===!0){let i=e.push;t(r),i!==void 0&&n.call(this,i)}else e.push!==void 0&&n.call(this,e.push)}updateTokenEndLineColumnLocation(e,t,n,r,i,a,o){let s,c;t!==void 0&&(s=n===o-1,c=s?-1:0,(r!==1||s!==!0)&&(e.endLine=i+c,e.endColumn=a-1+-c))}computeNewColumn(e,t){return e+t}createOffsetOnlyToken(e,t,n,r){return{image:e,startOffset:t,tokenTypeIdx:n,tokenType:r}}createStartOnlyToken(e,t,n,r,i,a){return{image:e,startOffset:t,startLine:i,startColumn:a,tokenTypeIdx:n,tokenType:r}}createFullToken(e,t,n,r,i,a,o){return{image:e,startOffset:t,endOffset:t+o-1,startLine:i,endLine:i,startColumn:a,endColumn:a+o-1,tokenTypeIdx:n,tokenType:r}}addTokenUsingPush(e,t,n){return e.push(n),t}addTokenUsingMemberAccess(e,t,n){return e[t]=n,t++,t}handlePayloadNoCustom(e,t){}handlePayloadWithCustom(e,t){t!==null&&(e.payload=t)}match(e,t,n){return e.test(t)===!0?t.substring(n,e.lastIndex):null}matchLength(e,t,n){return e.test(t)===!0?e.lastIndex-n:-1}};I.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.`,I.NA=/NOT_APPLICABLE/;function Pt(e){return Ft(e)?e.LABEL:e.name}function Ft(e){return typeof e.LABEL==`string`&&e.LABEL!==``}var It=`parent`,Lt=`categories`,Rt=`label`,zt=`group`,Bt=`push_mode`,Vt=`pop_mode`,Ht=`longer_alt`,Ut=`line_breaks`,Wt=`start_chars_hint`;function L(e){return Gt(e)}function Gt(e){let t=e.pattern,n={};if(n.name=e.name,t!==void 0&&(n.PATTERN=t),Object.hasOwn(e,It))throw`The parent property is no longer supported.
|
|
39
|
+
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return Object.hasOwn(e,Lt)&&(n.CATEGORIES=e[Lt]),xt([n]),Object.hasOwn(e,Rt)&&(n.LABEL=e[Rt]),Object.hasOwn(e,zt)&&(n.GROUP=e[zt]),Object.hasOwn(e,Vt)&&(n.POP_MODE=e[Vt]),Object.hasOwn(e,Bt)&&(n.PUSH_MODE=e[Bt]),Object.hasOwn(e,Ht)&&(n.LONGER_ALT=e[Ht]),Object.hasOwn(e,Ut)&&(n.LINE_BREAKS=e[Ut]),Object.hasOwn(e,Wt)&&(n.START_CHARS_HINT=e[Wt]),n}var R=L({name:`EOF`,pattern:I.NA});xt([R]);function Kt(e,t,n,r,i,a,o,s){return{image:t,startOffset:n,endOffset:r,startLine:i,endLine:a,startColumn:o,endColumn:s,tokenTypeIdx:e.tokenTypeIdx,tokenType:e}}function qt(e,t){return _t(e,t)}var Jt={buildMismatchTokenMessage({expected:e,actual:t,previous:n,ruleName:r}){return`Expecting ${Ft(e)?`--> ${Pt(e)} <--`:`token of type --> ${e.name} <--`} but found --> '${t.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:e,ruleName:t}){return`Redundant input, expecting EOF but found: `+e.image},buildNoViableAltMessage({expectedPathsPerAlt:e,actual:t,previous:n,customUserDescription:r,ruleName:i}){let a=`
|
|
40
|
+
but found: '`+t[0].image+`'`;return r?`Expecting: `+r+a:`Expecting: one of these possible Token sequences:\n${e.reduce((e,t)=>e.concat(t),[]).map(e=>`[${e.map(e=>Pt(e)).join(`, `)}]`).map((e,t)=>` ${t+1}. ${e}`).join(`
|
|
41
|
+
`)}`+a},buildEarlyExitMessage({expectedIterationPaths:e,actual:t,customUserDescription:n,ruleName:r}){let i=`
|
|
42
|
+
but found: '`+t[0].image+`'`;return n?`Expecting: `+n+i:`Expecting: expecting at least one iteration which starts with one of these possible Token sequences::\n <${e.map(e=>`[${e.map(e=>Pt(e)).join(`,`)}]`).join(` ,`)}>`+i}};Object.freeze(Jt);var Yt={buildRuleNotFoundError(e,t){return`Invalid grammar, reference to a rule which is not defined: ->`+t.nonTerminalName+`<-
|
|
43
|
+
inside top level rule: ->`+e.name+`<-`}},Xt={buildDuplicateFoundError(e,t){function n(e){return e instanceof T?e.terminalType.name:e instanceof g?e.nonTerminalName:``}let r=e.name,i=t[0],a=i.idx,o=A(i),s=n(i),c=`->${o}${a>0?a:``}<- ${s?`with argument: ->${s}<-`:``}
|
|
44
|
+
appears more than once (${t.length} times) in the top level rule: ->${r}<-.
|
|
45
|
+
For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES
|
|
46
|
+
`;return c=c.replace(/[ \t]+/g,` `),c=c.replace(/\s\s+/g,`
|
|
47
|
+
`),c},buildNamespaceConflictError(e){return`Namespace conflict found in grammar.\nThe grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${e.name}>.\nTo resolve this make sure each Terminal and Non-Terminal names are unique\nThis is easy to accomplish by using the convention that Terminal names start with an uppercase letter\nand Non-Terminal names start with a lower case letter.`},buildAlternationPrefixAmbiguityError(e){let t=e.prefixPath.map(e=>Pt(e)).join(`, `),n=e.alternation.idx===0?``:e.alternation.idx;return`Ambiguous alternatives: <${e.ambiguityIndices.join(` ,`)}> due to common lookahead prefix\nin <OR${n}> inside <${e.topLevelRule.name}> Rule,\n<${t}> may appears as a prefix path in all these alternatives.\nSee: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX\nFor Further details.`},buildAlternationAmbiguityError(e){let t=e.alternation.idx===0?``:e.alternation.idx,n=e.prefixPath.length===0,r=`Ambiguous Alternatives Detected: <${e.ambiguityIndices.join(` ,`)}> in <OR${t}> inside <${e.topLevelRule.name}> Rule,\n`;if(n)r+=`These alternatives are all empty (match no tokens), making them indistinguishable.
|
|
48
|
+
Only the last alternative may be empty.
|
|
49
|
+
`;else{let t=e.prefixPath.map(e=>Pt(e)).join(`, `);r+=`<${t}> may appears as a prefix path in all these alternatives.\n`}return r+=`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
|
|
50
|
+
For Further details.`,r},buildEmptyRepetitionError(e){let t=A(e.repetition);return e.repetition.idx!==0&&(t+=e.repetition.idx),`The repetition <${t}> within Rule <${e.topLevelRule.name}> can never consume any tokens.\nThis could lead to an infinite loop.`},buildTokenNameError(e){return`deprecated`},buildEmptyAlternationError(e){return`Ambiguous empty alternative: <${e.emptyChoiceIdx+1}> in <OR${e.alternation.idx}> inside <${e.topLevelRule.name}> Rule.\nOnly the last alternative may be an empty alternative.`},buildTooManyAlternativesError(e){return`An Alternation cannot have more than 256 alternatives:\n<OR${e.alternation.idx}> inside <${e.topLevelRule.name}> Rule.\n has ${e.alternation.definition.length+1} alternatives.`},buildLeftRecursionError(e){let t=e.topLevelRule.name;return`Left Recursion found in grammar.\nrule: <${t}> can be invoked from itself (directly or indirectly)\nwithout consuming any Tokens. The grammar path that causes this is: \n ${`${t} --> ${e.leftRecursionPath.map(e=>e.name).concat([t]).join(` --> `)}`}\n To fix this refactor your grammar to remove the left recursion.\nsee: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(e){return`deprecated`},buildDuplicateRuleNameError(e){let t;return t=e.topLevelRule instanceof _?e.topLevelRule.name:e.topLevelRule,`Duplicate definition, rule: ->${t}<- is already defined in the grammar: ->${e.grammarName}<-`}};function Zt(e,t){let n=new Qt(e,t);return n.resolveRefs(),n.errors}var Qt=class extends D{constructor(e,t){super(),this.nameToTopRule=e,this.errMsgProvider=t,this.errors=[]}resolveRefs(){Object.values(this.nameToTopRule).forEach(e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){let t=this.nameToTopRule[e.nonTerminalName];if(t)e.referencedRule=t;else{let t=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:t,type:V.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}},$t=class extends re{constructor(e,t){super(),this.topProd=e,this.path=t,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=[...this.path.ruleStack].reverse(),this.occurrenceStack=[...this.path.occurrenceStack].reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,t=[]){this.found||super.walk(e,t)}walkProdRef(e,t,n){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){let r=t.concat(n);this.updateExpectedNext(),this.walk(e.referencedRule,r)}}updateExpectedNext(){this.ruleStack.length===0?(this.nextProductionName=``,this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}},en=class extends $t{constructor(e,t){super(e,t),this.path=t,this.nextTerminalName=``,this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,t,n){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){let e=new v({definition:t.concat(n)});this.possibleTokTypes=j(e),this.found=!0}}},tn=class extends re{constructor(e,t){super(),this.topRule=e,this.occurrence=t,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}},nn=class extends tn{walkMany(e,t,n){if(e.idx===this.occurrence){let e=t.concat(n)[0];this.result.isEndOfRule=e===void 0,e instanceof T&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkMany(e,t,n)}},rn=class extends tn{walkManySep(e,t,n){if(e.idx===this.occurrence){let e=t.concat(n)[0];this.result.isEndOfRule=e===void 0,e instanceof T&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkManySep(e,t,n)}},an=class extends tn{walkAtLeastOne(e,t,n){if(e.idx===this.occurrence){let e=t.concat(n)[0];this.result.isEndOfRule=e===void 0,e instanceof T&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkAtLeastOne(e,t,n)}},on=class extends tn{walkAtLeastOneSep(e,t,n){if(e.idx===this.occurrence){let e=t.concat(n)[0];this.result.isEndOfRule=e===void 0,e instanceof T&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkAtLeastOneSep(e,t,n)}};function sn(e,t,n=[]){n=[...n];let r=[],i=0;function a(t){return t.concat(e.slice(i+1))}function o(e){let i=sn(a(e),t,n);return r.concat(i)}for(;n.length<t&&i<e.length;){let t=e[i];if(t instanceof v||t instanceof g)return o(t.definition);if(t instanceof y)r=o(t.definition);else if(t instanceof b)return o(t.definition.concat([new S({definition:t.definition})]));else if(t instanceof x)return o([new v({definition:t.definition}),new S({definition:[new T({terminalType:t.separator})].concat(t.definition)})]);else if(t instanceof C)r=o(t.definition.concat([new S({definition:[new T({terminalType:t.separator})].concat(t.definition)})]));else if(t instanceof S)r=o(t.definition.concat([new S({definition:t.definition})]));else if(t instanceof w)return t.definition.forEach(e=>{e.definition.length!==0&&(r=o(e.definition))}),r;else if(t instanceof T)n.push(t.terminalType);else throw Error(`non exhaustive match`);i++}return r.push({partialPath:n,suffixDef:e.slice(i)}),r}function cn(e,t,n,r){let i=`EXIT_NONE_TERMINAL`,a=[i],o=`EXIT_ALTERNATIVE`,s=!1,c=t.length,l=c-r-1,u=[],d=[];for(d.push({idx:-1,def:e,ruleStack:[],occurrenceStack:[]});d.length!==0;){let e=d.pop();if(e===o){s&&d.at(-1).idx<=l&&d.pop();continue}let r=e.def,f=e.idx,p=e.ruleStack,m=e.occurrenceStack;if(r.length===0)continue;let h=r[0];if(h===i){let e={idx:f,def:r.slice(1),ruleStack:p.slice(0,-1),occurrenceStack:m.slice(0,-1)};d.push(e)}else if(h instanceof T){if(f<c-1){let e=f+1,i=t[e];if(n(i,h.terminalType)){let t={idx:e,def:r.slice(1),ruleStack:p,occurrenceStack:m};d.push(t)}}else if(f===c-1)u.push({nextTokenType:h.terminalType,nextTokenOccurrence:h.idx,ruleStack:p,occurrenceStack:m}),s=!0;else throw Error(`non exhaustive match`)}else if(h instanceof g){let e=[...p];e.push(h.nonTerminalName);let t=[...m];t.push(h.idx);let n={idx:f,def:h.definition.concat(a,r.slice(1)),ruleStack:e,occurrenceStack:t};d.push(n)}else if(h instanceof y){let e={idx:f,def:r.slice(1),ruleStack:p,occurrenceStack:m};d.push(e),d.push(o);let t={idx:f,def:h.definition.concat(r.slice(1)),ruleStack:p,occurrenceStack:m};d.push(t)}else if(h instanceof b){let e=new S({definition:h.definition,idx:h.idx}),t={idx:f,def:h.definition.concat([e],r.slice(1)),ruleStack:p,occurrenceStack:m};d.push(t)}else if(h instanceof x){let e=new S({definition:[new T({terminalType:h.separator})].concat(h.definition),idx:h.idx}),t={idx:f,def:h.definition.concat([e],r.slice(1)),ruleStack:p,occurrenceStack:m};d.push(t)}else if(h instanceof C){let e={idx:f,def:r.slice(1),ruleStack:p,occurrenceStack:m};d.push(e),d.push(o);let t=new S({definition:[new T({terminalType:h.separator})].concat(h.definition),idx:h.idx}),n={idx:f,def:h.definition.concat([t],r.slice(1)),ruleStack:p,occurrenceStack:m};d.push(n)}else if(h instanceof S){let e={idx:f,def:r.slice(1),ruleStack:p,occurrenceStack:m};d.push(e),d.push(o);let t=new S({definition:h.definition,idx:h.idx}),n={idx:f,def:h.definition.concat([t],r.slice(1)),ruleStack:p,occurrenceStack:m};d.push(n)}else if(h instanceof w)for(let e=h.definition.length-1;e>=0;e--){let t={idx:f,def:h.definition[e].definition.concat(r.slice(1)),ruleStack:p,occurrenceStack:m};d.push(t),d.push(o)}else if(h instanceof v)d.push({idx:f,def:h.definition.concat(r.slice(1)),ruleStack:p,occurrenceStack:m});else if(h instanceof _)d.push(ln(h,f,p,m));else throw Error(`non exhaustive match`)}return u}function ln(e,t,n,r){let i=[...n];i.push(e.name);let a=[...r];return a.push(1),{idx:t,def:e.definition,ruleStack:i,occurrenceStack:a}}var z;(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`})(z||={});function un(e){if(e instanceof y||e===`Option`)return z.OPTION;if(e instanceof S||e===`Repetition`)return z.REPETITION;if(e instanceof b||e===`RepetitionMandatory`)return z.REPETITION_MANDATORY;if(e instanceof x||e===`RepetitionMandatoryWithSeparator`)return z.REPETITION_MANDATORY_WITH_SEPARATOR;if(e instanceof C||e===`RepetitionWithSeparator`)return z.REPETITION_WITH_SEPARATOR;if(e instanceof w||e===`Alternation`)return z.ALTERNATION;throw Error(`non exhaustive match`)}function dn(e,t,n,r,i,a){let o=xn(e,t,n);return a(o,r,Tn(o)?vt:_t,i)}function fn(e,t,n,r,i,a){let o=Sn(e,t,i,n),s=Tn(o)?vt:_t;return a(o[0],s,r)}function pn(e,t,n,r){let i=e.length,a=e.every(e=>e.every(e=>e.length===1));if(t)return function(t){let r=t.map(e=>e.GATE);for(let t=0;t<i;t++){let i=e[t],a=i.length,o=r[t];if(o===void 0||o.call(this)!==!1)nextPath:for(let e=0;e<a;e++){let r=i[e],a=r.length;for(let e=0;e<a;e++)if(n(this.LA_FAST(e+1),r[e])===!1)continue nextPath;return t}}};if(a&&!r){let t=e.map(e=>e.flat()).reduce((e,t,n)=>(t.forEach(t=>{t.tokenTypeIdx in e||(e[t.tokenTypeIdx]=n),t.categoryMatches.forEach(t=>{Object.hasOwn(e,t)||(e[t]=n)})}),e),{});return function(){let e=this.LA_FAST(1);return t[e.tokenTypeIdx]}}return function(){for(let t=0;t<i;t++){let r=e[t],i=r.length;nextPath:for(let e=0;e<i;e++){let i=r[e],a=i.length;for(let e=0;e<a;e++)if(n(this.LA_FAST(e+1),i[e])===!1)continue nextPath;return t}}}}function mn(e,t,n){let r=e.every(e=>e.length===1),i=e.length;if(r&&!n){let t=e.flat();if(t.length===1&&t[0].categoryMatches.length===0){let e=t[0].tokenTypeIdx;return function(){return this.LA_FAST(1).tokenTypeIdx===e}}{let e=t.reduce((e,t,n)=>(e[t.tokenTypeIdx]=!0,t.categoryMatches.forEach(t=>{e[t]=!0}),e),[]);return function(){let t=this.LA_FAST(1);return e[t.tokenTypeIdx]===!0}}}return function(){nextPath:for(let n=0;n<i;n++){let r=e[n],i=r.length;for(let e=0;e<i;e++)if(t(this.LA_FAST(e+1),r[e])===!1)continue nextPath;return!0}return!1}}var hn=class extends re{constructor(e,t,n){super(),this.topProd=e,this.targetOccurrence=t,this.targetProdType=n}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,t,n,r){return e.idx===this.targetOccurrence&&this.targetProdType===t&&(this.restDef=n.concat(r),!0)}walkOption(e,t,n){this.checkIsTarget(e,z.OPTION,t,n)||super.walkOption(e,t,n)}walkAtLeastOne(e,t,n){this.checkIsTarget(e,z.REPETITION_MANDATORY,t,n)||super.walkOption(e,t,n)}walkAtLeastOneSep(e,t,n){this.checkIsTarget(e,z.REPETITION_MANDATORY_WITH_SEPARATOR,t,n)||super.walkOption(e,t,n)}walkMany(e,t,n){this.checkIsTarget(e,z.REPETITION,t,n)||super.walkOption(e,t,n)}walkManySep(e,t,n){this.checkIsTarget(e,z.REPETITION_WITH_SEPARATOR,t,n)||super.walkOption(e,t,n)}},gn=class extends D{constructor(e,t,n){super(),this.targetOccurrence=e,this.targetProdType=t,this.targetRef=n,this.result=[]}checkIsTarget(e,t){e.idx===this.targetOccurrence&&this.targetProdType===t&&(this.targetRef===void 0||e===this.targetRef)&&(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,z.OPTION)}visitRepetition(e){this.checkIsTarget(e,z.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,z.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,z.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,z.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,z.ALTERNATION)}};function _n(e){let t=Array(e);for(let n=0;n<e;n++)t[n]=[];return t}function vn(e){let t=[``];for(let n=0;n<e.length;n++){let r=e[n],i=[];for(let e=0;e<t.length;e++){let n=t[e];i.push(n+`_`+r.tokenTypeIdx);for(let e=0;e<r.categoryMatches.length;e++){let t=`_`+r.categoryMatches[e];i.push(n+t)}}t=i}return t}function yn(e,t,n){for(let r=0;r<e.length;r++){if(r===n)continue;let i=e[r];for(let e=0;e<t.length;e++)if(i[t[e]]===!0)return!1}return!0}function bn(e,t){let n=e.map(e=>sn([e],1)),r=_n(n.length),i=n.map(e=>{let t={};return e.forEach(e=>{vn(e.partialPath).forEach(e=>{t[e]=!0})}),t}),a=n;for(let e=1;e<=t;e++){let n=a;a=_n(n.length);for(let o=0;o<n.length;o++){let s=n[o];for(let n=0;n<s.length;n++){let c=s[n].partialPath,l=s[n].suffixDef,u=vn(c);if(yn(i,u,o)||l.length===0||c.length===t){let e=r[o];if(Cn(e,c)===!1){e.push(c);for(let e=0;e<u.length;e++){let t=u[e];i[o][t]=!0}}}else{let t=sn(l,e+1,c);a[o]=a[o].concat(t),t.forEach(e=>{vn(e.partialPath).forEach(e=>{i[o][e]=!0})})}}}}return r}function xn(e,t,n,r){let i=new gn(e,z.ALTERNATION,r);return t.accept(i),bn(i.result,n)}function Sn(e,t,n,r){let i=new gn(e,n);t.accept(i);let a=i.result,o=new hn(t,e,n).startWalking();return bn([new v({definition:a}),new v({definition:o})],r)}function Cn(e,t){compareOtherPath:for(let n=0;n<e.length;n++){let r=e[n];if(r.length===t.length){for(let e=0;e<r.length;e++){let n=t[e],i=r[e];if(n!==i&&i.categoryMatchesMap[n.tokenTypeIdx]===void 0)continue compareOtherPath}return!0}}return!1}function wn(e,t){return e.length<t.length&&e.every((e,n)=>{let r=t[n];return e===r||r.categoryMatchesMap[e.tokenTypeIdx]})}function Tn(e){return e.every(e=>e.every(e=>e.every(e=>e.categoryMatches.length===0)))}function En(e){return e.lookaheadStrategy.validate({rules:e.rules,tokenTypes:e.tokenTypes,grammarName:e.grammarName}).map(e=>Object.assign({type:V.CUSTOM_LOOKAHEAD_VALIDATION},e))}function Dn(e,t,n,r){let i=e.flatMap(e=>On(e,n)),a=Wn(e,t,n),o=e.flatMap(e=>Bn(e,n)),s=e.flatMap(t=>Mn(t,e,r,n));return i.concat(a,o,s)}function On(e,t){let n=new jn;e.accept(n);let r=n.allProductions,i=Object.groupBy(r,kn),a=Object.fromEntries(Object.entries(i).filter(([e,t])=>t.length>1));return Object.values(a).map(n=>{let r=n[0],i=t.buildDuplicateFoundError(e,n),a=A(r),o={message:i,type:V.DUPLICATE_PRODUCTIONS,ruleName:e.name,dslName:a,occurrence:r.idx},s=An(r);return s&&(o.parameter=s),o})}function kn(e){return`${A(e)}_#_${e.idx}_#_${An(e)}`}function An(e){return e instanceof T?e.terminalType.name:e instanceof g?e.nonTerminalName:``}var jn=class extends D{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 Mn(e,t,n,r){let i=[];if(t.reduce((t,n)=>n.name===e.name?t+1:t,0)>1){let t=r.buildDuplicateRuleNameError({topLevelRule:e,grammarName:n});i.push({message:t,type:V.DUPLICATE_RULE_NAME,ruleName:e.name})}return i}function Nn(e,t,n){let r=[],i;return t.includes(e)||(i=`Invalid rule override, rule: ->${e}<- cannot be overridden in the grammar: ->${n}<-as it is not defined in any of the super grammars `,r.push({message:i,type:V.INVALID_RULE_OVERRIDE,ruleName:e})),r}function Pn(e,t,n,r=[]){let i=[],a=Fn(t.definition);if(a.length===0)return[];{let t=e.name;a.includes(e)&&i.push({message:n.buildLeftRecursionError({topLevelRule:e,leftRecursionPath:r}),type:V.LEFT_RECURSION,ruleName:t});let o=r.concat([e]),s=a.filter(e=>!o.includes(e)).flatMap(t=>{let i=[...r];return i.push(t),Pn(e,t,n,i)});return i.concat(s)}}function Fn(e){let t=[];if(e.length===0)return t;let n=e[0];if(n instanceof g)t.push(n.referencedRule);else if(n instanceof v||n instanceof y||n instanceof b||n instanceof x||n instanceof C||n instanceof S)t=t.concat(Fn(n.definition));else if(n instanceof w)t=n.definition.map(e=>Fn(e.definition)).flat();else if(!(n instanceof T))throw Error(`non exhaustive match`);let r=k(n),i=e.length>1;if(r&&i){let n=e.slice(1);return t.concat(Fn(n))}return t}var In=class extends D{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}};function Ln(e,t){let n=new In;return e.accept(n),n.alternations.flatMap(n=>n.definition.slice(0,-1).flatMap((r,i)=>cn([r],[],_t,1).length===0?[{message:t.buildEmptyAlternationError({topLevelRule:e,alternation:n,emptyChoiceIdx:i}),type:V.NONE_LAST_EMPTY_ALT,ruleName:e.name,occurrence:n.idx,alternative:i+1}]:[]))}function Rn(e,t,n){let r=new In;e.accept(r);let i=r.alternations;return i=i.filter(e=>e.ignoreAmbiguities!==!0),i.flatMap(r=>{let i=r.idx,a=xn(i,e,r.maxLookahead||t,r),o=Hn(a,r,e,n),s=Un(a,r,e,n);return o.concat(s)})}var zn=class extends D{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 Bn(e,t){let n=new In;return e.accept(n),n.alternations.flatMap(n=>n.definition.length>255?[{message:t.buildTooManyAlternativesError({topLevelRule:e,alternation:n}),type:V.TOO_MANY_ALTS,ruleName:e.name,occurrence:n.idx}]:[])}function Vn(e,t,n){let r=[];return e.forEach(e=>{let i=new zn;e.accept(i),i.allProductions.forEach(i=>{let a=un(i),o=i.maxLookahead||t,s=i.idx;if(Sn(s,e,a,o)[0].flat().length===0){let t=n.buildEmptyRepetitionError({topLevelRule:e,repetition:i});r.push({message:t,type:V.NO_NON_EMPTY_LOOKAHEAD,ruleName:e.name})}})}),r}function Hn(e,t,n,r){let i=[];return e.reduce((n,r,a)=>(t.definition[a].ignoreAmbiguities===!0||r.forEach(r=>{let o=[a];e.forEach((e,n)=>{a!==n&&Cn(e,r)&&t.definition[n].ignoreAmbiguities!==!0&&o.push(n)}),o.length>1&&!Cn(i,r)&&(i.push(r),n.push({alts:o,path:r}))}),n),[]).map(e=>{let i=e.alts.map(e=>e+1);return{message:r.buildAlternationAmbiguityError({topLevelRule:n,alternation:t,ambiguityIndices:i,prefixPath:e.path}),type:V.AMBIGUOUS_ALTS,ruleName:n.name,occurrence:t.idx,alternatives:e.alts}})}function Un(e,t,n,r){let i=e.reduce((e,t,n)=>{let r=t.map(e=>({idx:n,path:e}));return e.concat(r)},[]);return i.flatMap(e=>{if(t.definition[e.idx].ignoreAmbiguities===!0)return[];let a=e.idx,o=e.path;return i.filter(e=>t.definition[e.idx].ignoreAmbiguities!==!0&&e.idx<a&&wn(e.path,o)).map(e=>{let i=[e.idx+1,a+1],o=t.idx===0?``:t.idx;return{message:r.buildAlternationPrefixAmbiguityError({topLevelRule:n,alternation:t,ambiguityIndices:i,prefixPath:e.path}),type:V.AMBIGUOUS_PREFIX_ALTS,ruleName:n.name,occurrence:o,alternatives:i}})})}function Wn(e,t,n){let r=[],i=t.map(e=>e.name);return e.forEach(e=>{let t=e.name;if(i.includes(t)){let i=n.buildNamespaceConflictError(e);r.push({message:i,type:V.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:t})}}),r}function Gn(e){let t=Object.assign({errMsgProvider:Yt},e),n={};return e.rules.forEach(e=>{n[e.name]=e}),Zt(n,t.errMsgProvider)}function Kn(e){let t=e.errMsgProvider??Xt;return Dn(e.rules,e.tokenTypes,t,e.grammarName)}var qn=`MismatchedTokenException`,Jn=`NoViableAltException`,Yn=`EarlyExitException`,Xn=`NotAllInputParsedException`,Zn=[qn,Jn,Yn,Xn];Object.freeze(Zn);function Qn(e){return Zn.includes(e.name)}var $n=class extends Error{constructor(e,t){super(e),this.token=t,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},er=class extends $n{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=qn}},tr=class extends $n{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=Jn}},nr=class extends $n{constructor(e,t){super(e,t),this.name=Xn}},rr=class extends $n{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=Yn}},ir={},ar=`InRuleRecoveryException`,or=class extends Error{constructor(e){super(e),this.name=ar}},sr=class{initRecoverable(e){this.firstAfterRepMap=[],this.resyncFollows={},this.recoveryEnabled=Object.hasOwn(e,`recoveryEnabled`)?e.recoveryEnabled:B.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=cr)}getTokenToInsert(e){let t=Kt(e,``,-1,-1,-1,-1,-1,-1);return t.isInsertedInRecovery=!0,t}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,t,n,r){let i=this.findReSyncTokenType(),a=this.exportLexerState(),o=[],s=!1,c=this.LA_FAST(1),l=this.LA_FAST(1),u=()=>{let e=this.LA(0),t=new er(this.errorMessageProvider.buildMismatchTokenMessage({expected:r,actual:c,previous:e,ruleName:this.getCurrRuleFullName()}),c,this.LA(0));t.resyncedTokens=o.slice(0,-1),this.SAVE_ERROR(t)};for(;!s;)if(this.tokenMatcher(l,r)){u();return}else if(n.call(this)){u(),e.apply(this,t);return}else this.tokenMatcher(l,i)?s=!0:(l=this.SKIP_TOKEN(),this.addToResyncTokens(l,o));this.importLexerState(a)}shouldInRepetitionRecoveryBeTried(e,t,n){return!(n===!1||this.tokenMatcher(this.LA_FAST(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,t)))}getNextPossibleTokenTypes(e){let t=e.ruleStack[0],n=this.getGAstProductions()[t];return new en(n,e).startWalking()}getFollowsForInRuleRecovery(e,t){let n=this.getCurrentGrammarPath(e,t);return this.getNextPossibleTokenTypes(n)}tryInRuleRecovery(e,t){if(this.canRecoverWithSingleTokenInsertion(e,t))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){let e=this.SKIP_TOKEN();return this.consumeToken(),e}throw new or(`sad sad panda`)}canPerformInRuleRecovery(e,t){return this.canRecoverWithSingleTokenInsertion(e,t)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,t){if(!this.canTokenTypeBeInsertedInRecovery(e)||t.length===0)return!1;let n=this.LA_FAST(1);return t.find(e=>this.tokenMatcher(n,e))!==void 0}canRecoverWithSingleTokenDeletion(e){return this.canTokenTypeBeDeletedInRecovery(e)?this.tokenMatcher(this.LA(2),e):!1}isInCurrentRuleReSyncSet(e){let t=this.getCurrFollowKey();return this.getFollowSetFromFollowKey(t).includes(e)}findReSyncTokenType(){let e=this.flattenFollowSet(),t=this.LA_FAST(1),n=2;for(;;){let r=e.find(e=>qt(t,e));if(r!==void 0)return r;t=this.LA(n),n++}}getCurrFollowKey(){if(this.RULE_STACK_IDX===0)return ir;let e=this.currRuleShortName,t=this.getLastExplicitRuleOccurrenceIndex(),n=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:t,inRule:this.shortRuleNameToFullName(n)}}buildFullFollowKeyStack(){let e=this.RULE_STACK,t=this.RULE_OCCURRENCE_STACK,n=this.RULE_STACK_IDX+1,r=Array(n);for(let i=0;i<n;i++)i===0?r[i]=ir:r[i]={ruleName:this.shortRuleNameToFullName(e[i]),idxInCallingRule:t[i],inRule:this.shortRuleNameToFullName(e[i-1])};return r}flattenFollowSet(){return this.buildFullFollowKeyStack().map(e=>this.getFollowSetFromFollowKey(e)).flat()}getFollowSetFromFollowKey(e){if(e===ir)return[R];let t=e.ruleName+e.idxInCallingRule+se+e.inRule;return this.resyncFollows[t]}addToResyncTokens(e,t){return this.tokenMatcher(e,R)||t.push(e),t}reSyncTo(e){let t=[],n=this.LA_FAST(1);for(;this.tokenMatcher(n,e)===!1;)n=this.SKIP_TOKEN(),this.addToResyncTokens(n,t);return t.slice(0,-1)}attemptInRepetitionRecovery(e,t,n,r,i,a,o){}getCurrentGrammarPath(e,t){return{ruleStack:this.getHumanReadableRuleStack(),occurrenceStack:this.RULE_OCCURRENCE_STACK.slice(0,this.RULE_OCCURRENCE_STACK_IDX+1),lastTok:e,lastTokOccurrence:t}}getHumanReadableRuleStack(){let e=this.RULE_STACK_IDX+1,t=Array(e);for(let n=0;n<e;n++)t[n]=this.shortRuleNameToFullName(this.RULE_STACK[n]);return t}};function cr(e,t,n,r,i,a,o){var s,c;let l=r|i,u=(s=this.firstAfterRepMap)[c=this.currRuleShortName]??(s[c]=[]),d=u[l];if(d===void 0){let e=this.getCurrRuleFullName(),t=this.getGAstProductions()[e];d=new a(t,i).startWalking(),u[l]=d}let f=d.token,p=d.occurrence,m=d.isEndOfRule;this.RULE_STACK_IDX===0&&m&&f===void 0&&(f=R,p=1),f!==void 0&&p!==void 0&&this.shouldInRepetitionRecoveryBeTried(f,p,o)&&this.tryInRepetitionRecovery(e,t,n,f)}var lr=1024,ur=1280,dr=1536,fr=class{constructor(e){this.maxLookahead=e?.maxLookahead??B.maxLookahead}validate(e){let t=this.validateNoLeftRecursion(e.rules);if(t.length===0){let n=this.validateEmptyOrAlternatives(e.rules),r=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),i=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...t,...n,...r,...i]}return t}validateNoLeftRecursion(e){return e.flatMap(e=>Pn(e,e,Xt))}validateEmptyOrAlternatives(e){return e.flatMap(e=>Ln(e,Xt))}validateAmbiguousAlternationAlternatives(e,t){return e.flatMap(e=>Rn(e,t,Xt))}validateSomeNonEmptyLookaheadPath(e,t){return Vn(e,t,Xt)}buildLookaheadForAlternation(e){return dn(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,pn)}buildLookaheadForOptional(e){return fn(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,un(e.prodType),mn)}},pr=class{initLooksAhead(e){this.dynamicTokensEnabled=Object.hasOwn(e,`dynamicTokensEnabled`)?e.dynamicTokensEnabled:B.dynamicTokensEnabled,this.maxLookahead=Object.hasOwn(e,`maxLookahead`)?e.maxLookahead:B.maxLookahead,this.lookaheadStrategy=Object.hasOwn(e,`lookaheadStrategy`)?e.lookaheadStrategy:new fr({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=[],this.currRuleLookaheadFuncs=[]}preComputeLookaheadFunctions(e){e.forEach(e=>{this.TRACE_INIT(`${e.name} Rule Lookahead`,()=>{let{alternation:t,repetition:n,option:r,repetitionMandatory:i,repetitionMandatoryWithSeparator:a,repetitionWithSeparator:o}=hr(e);t.forEach(t=>{let n=t.idx===0?``:t.idx;this.TRACE_INIT(`${A(t)}${n}`,()=>{let n=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:t.idx,rule:e,maxLookahead:t.maxLookahead||this.maxLookahead,hasPredicates:t.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled});this.setLaFuncCache(this.fullRuleNameToShort[e.name],256|t.idx,n)})}),n.forEach(t=>{this.computeLookaheadFunc(e,t.idx,768,`Repetition`,t.maxLookahead,A(t))}),r.forEach(t=>{this.computeLookaheadFunc(e,t.idx,512,`Option`,t.maxLookahead,A(t))}),i.forEach(t=>{this.computeLookaheadFunc(e,t.idx,lr,`RepetitionMandatory`,t.maxLookahead,A(t))}),a.forEach(t=>{this.computeLookaheadFunc(e,t.idx,dr,`RepetitionMandatoryWithSeparator`,t.maxLookahead,A(t))}),o.forEach(t=>{this.computeLookaheadFunc(e,t.idx,ur,`RepetitionWithSeparator`,t.maxLookahead,A(t))})})})}computeLookaheadFunc(e,t,n,r,i,a){this.TRACE_INIT(`${a}${t===0?``:t}`,()=>{let a=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:t,rule:e,maxLookahead:i||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:r});this.setLaFuncCache(this.fullRuleNameToShort[e.name],n|t,a)})}setLaFuncCache(e,t,n){let r=this.lookAheadFuncsCache[e];r===void 0&&(r=[],this.lookAheadFuncsCache[e]=r),r[t]=n}},mr=new class extends D{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)}};function hr(e){mr.reset(),e.accept(mr);let t=mr.dslMethods;return mr.reset(),t}function gr(e,t){e.startOffset===-1?(e.startOffset=t.startOffset,e.endOffset=t.endOffset):e.endOffset<t.endOffset&&(e.endOffset=t.endOffset)}function _r(e,t){e.startOffset===-1?(e.startOffset=t.startOffset,e.startColumn=t.startColumn,e.startLine=t.startLine,e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine):e.endOffset<t.endOffset&&(e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine)}function vr(e,t,n){e.children[n]===void 0?e.children[n]=[t]:e.children[n].push(t)}function yr(e,t,n){e.children[t]===void 0?e.children[t]=[n]:e.children[t].push(n)}var br=`name`;function xr(e,t){Object.defineProperty(e,br,{enumerable:!1,configurable:!0,writable:!1,value:t})}function Sr(e,t){let n=Object.keys(e),r=n.length;for(let i=0;i<r;i++){let r=e[n[i]],a=r.length;for(let e=0;e<a;e++){let n=r[e];n.tokenTypeIdx===void 0&&this[n.name](n.children,t)}}}function Cr(e,t){let n=function(){};return xr(n,e+`BaseSemantics`),n.prototype={visit:function(e,t){if(Array.isArray(e)&&(e=e[0]),e!==void 0)return this[e.name](e.children,t)},validateVisitor:function(){let e=Er(this,t);if(e.length!==0){let t=e.map(e=>e.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:\n\t${t.join(`
|
|
51
|
+
|
|
52
|
+
`).replace(/\n/g,`
|
|
53
|
+
`)}`)}}},n.prototype.constructor=n,n._RULE_NAMES=t,n}function wr(e,t,n){let r=function(){};xr(r,e+`BaseSemanticsWithDefaults`);let i=Object.create(n.prototype);return t.forEach(e=>{i[e]=Sr}),r.prototype=i,r.prototype.constructor=r,r}var Tr;(function(e){e[e.REDUNDANT_METHOD=0]=`REDUNDANT_METHOD`,e[e.MISSING_METHOD=1]=`MISSING_METHOD`})(Tr||={});function Er(e,t){return Dr(e,t)}function Dr(e,t){return t.filter(t=>typeof e[t]!=`function`).map(t=>({msg:`Missing visitor method: <${t}> on ${e.constructor.name} CST Visitor.`,type:Tr.MISSING_METHOD,methodName:t})).filter(Boolean)}var Or=class{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=Object.hasOwn(e,`nodeLocationTracking`)?e.nodeLocationTracking:B.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=()=>{},this.cstFinallyStateUpdate=()=>{},this.cstPostTerminal=()=>{},this.cstPostNonTerminal=()=>{},this.cstPostRule=()=>{};else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=_r,this.setNodeLocationFromNode=_r,this.cstPostRule=()=>{},this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=gr,this.setNodeLocationFromNode=gr,this.cstPostRule=()=>{},this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=()=>{},this.setInitialNodeLocation=()=>{};else throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`)}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:-1,endOffset:-1}}setInitialNodeLocationOnlyOffsetRegular(e){e.location={startOffset:this.LA_FAST(1).startOffset,endOffset:-1}}setInitialNodeLocationFullRecovery(e){e.location={startOffset:-1,startLine:-1,startColumn:-1,endOffset:-1,endLine:-1,endColumn:-1}}setInitialNodeLocationFullRegular(e){let t=this.LA_FAST(1);e.location={startOffset:t.startOffset,startLine:t.startLine,startColumn:t.startColumn,endOffset:-1,endLine:-1,endColumn:-1}}cstInvocationStateUpdate(e){let t={name:e,children:Object.create(null)};this.setInitialNodeLocation(t),this.CST_STACK.push(t)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){let t=this.LA(0),n=e.location;n.startOffset!==-1&&n.startOffset<=t.startOffset?(n.endOffset=t.endOffset,n.endLine=t.endLine,n.endColumn=t.endColumn):(n.startOffset=-1,n.startLine=-1,n.startColumn=-1)}cstPostRuleOnlyOffset(e){let t=this.LA(0),n=e.location;n.startOffset!==-1&&n.startOffset<=t.startOffset?n.endOffset=t.endOffset:n.startOffset=-1}cstPostTerminal(e,t){let n=this.CST_STACK[this.CST_STACK.length-1];vr(n,t,e),this.setNodeLocationFromToken(n.location,t)}cstPostNonTerminal(e,t){let n=this.CST_STACK[this.CST_STACK.length-1];yr(n,t,e),this.setNodeLocationFromNode(n.location,e.location)}get currCSTNode(){let e=this;return e.CST_STACK[e.CST_STACK.length-1]}getBaseCstVisitorConstructor(){if(this.baseCstVisitorConstructor===void 0){let e=Cr(this.className,Object.keys(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(this.baseCstVisitorWithDefaultsConstructor===void 0){let e=wr(this.className,Object.keys(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getPreviousExplicitRuleShortName(){return this.RULE_STACK[this.RULE_STACK_IDX-1]}getLastExplicitRuleOccurrenceIndex(){return this.RULE_OCCURRENCE_STACK[this.RULE_OCCURRENCE_STACK_IDX]}},kr=class{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(){return this.currIdx<=this.tokVectorLength-2?(this.consumeToken(),this.LA_FAST(1)):Kr}LA_FAST(e){let t=this.currIdx+e;return this.tokVector[t]}LA(e){let t=this.currIdx+e;return t<0||this.tokVectorLength<=t?Kr:this.tokVector[t]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(e){this.currIdx=e}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVectorLength-1}getLexerPosition(){return this.exportLexerState()}},Ar=class{ACTION(e){return e.call(this)}consume(e,t,n){return this.consumeInternal(t,e,n)}subrule(e,t,n){return this.subruleInternal(t,e,n)}option(e,t){return this.optionInternal(t,e)}or(e,t){return this.orInternal(t,e)}many(e,t){return this.manyInternal(e,t)}atLeastOne(e,t){return this.atLeastOneInternal(e,t)}CONSUME(e,t){return this.consumeInternal(e,0,t)}CONSUME1(e,t){return this.consumeInternal(e,1,t)}CONSUME2(e,t){return this.consumeInternal(e,2,t)}CONSUME3(e,t){return this.consumeInternal(e,3,t)}CONSUME4(e,t){return this.consumeInternal(e,4,t)}CONSUME5(e,t){return this.consumeInternal(e,5,t)}CONSUME6(e,t){return this.consumeInternal(e,6,t)}CONSUME7(e,t){return this.consumeInternal(e,7,t)}CONSUME8(e,t){return this.consumeInternal(e,8,t)}CONSUME9(e,t){return this.consumeInternal(e,9,t)}SUBRULE(e,t){return this.subruleInternal(e,0,t)}SUBRULE1(e,t){return this.subruleInternal(e,1,t)}SUBRULE2(e,t){return this.subruleInternal(e,2,t)}SUBRULE3(e,t){return this.subruleInternal(e,3,t)}SUBRULE4(e,t){return this.subruleInternal(e,4,t)}SUBRULE5(e,t){return this.subruleInternal(e,5,t)}SUBRULE6(e,t){return this.subruleInternal(e,6,t)}SUBRULE7(e,t){return this.subruleInternal(e,7,t)}SUBRULE8(e,t){return this.subruleInternal(e,8,t)}SUBRULE9(e,t){return this.subruleInternal(e,9,t)}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,t,n=qr){if(this.definedRulesNames.includes(e)){let t={message:Xt.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:V.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(t)}this.definedRulesNames.push(e);let r=this.defineRule(e,t,n);return this[e]=r,r}OVERRIDE_RULE(e,t,n=qr){let r=Nn(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(r);let i=this.defineRule(e,t,n);return this[e]=i,i}BACKTRACK(e,t){let n=e.coreRule??e;return function(){this.isBackTrackingStack.push(1);let e=this.saveRecogState();try{return n.apply(this,t),!0}catch(e){if(Qn(e))return!1;throw e}finally{this.reloadRecogState(e),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return ee(Object.values(this.gastProductionsCache))}},jr=class{initRecognizerEngine(e,t){if(this.className=this.constructor.name,this.shortRuleNameToFull=[],this.fullRuleNameToShort={},this.ruleShortNameIdx=0,this.tokenMatcher=vt,this.subruleIdx=0,this.currRuleShortName=-1,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_STACK_IDX=-1,this.RULE_OCCURRENCE_STACK=[],this.RULE_OCCURRENCE_STACK_IDX=-1,this.gastProductionsCache={},Object.hasOwn(t,`serializedGrammar`))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
|
|
54
|
+
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
|
|
55
|
+
For Further details.`);if(Array.isArray(e)){if(e.length===0)throw Error(`A Token Vocabulary cannot be empty.
|
|
56
|
+
Note that the first argument for the parser constructor
|
|
57
|
+
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.
|
|
58
|
+
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
|
|
59
|
+
For Further details.`)}if(Array.isArray(e))this.tokensMap=e.reduce((e,t)=>(e[t.name]=t,e),{});else if(Object.hasOwn(e,`modes`)&&Object.values(e.modes).flat().every(jt)){let t=Object.values(e.modes).flat(),n=[...new Set(t)];this.tokensMap=n.reduce((e,t)=>(e[t.name]=t,e),{})}else if(typeof e==`object`&&e)this.tokensMap=Object.assign({},e);else throw Error(`<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition`);this.tokensMap.EOF=R;let n=(Object.hasOwn(e,`modes`)?Object.values(e.modes).flat():Object.values(e)).every(e=>e.categoryMatches?.length==0);this.tokenMatcher=n?vt:_t,xt(Object.values(this.tokensMap))}defineRule(e,t,n){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'\nMake sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);let r=Object.hasOwn(n,`resyncEnabled`)?n.resyncEnabled:qr.resyncEnabled,i=Object.hasOwn(n,`recoveryValueFunc`)?n.recoveryValueFunc:qr.recoveryValueFunc,a=this.ruleShortNameIdx++;this.shortRuleNameToFull[a]=e,this.fullRuleNameToShort[e]=a;let o;return o=this.outputCst===!0?function(...n){try{this.ruleInvocationStateUpdate(a,e,this.subruleIdx),t.apply(this,n);let r=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(r),r}catch(e){return this.invokeRuleCatch(e,r,i)}finally{this.ruleFinallyStateUpdate()}}:function(...n){try{return this.ruleInvocationStateUpdate(a,e,this.subruleIdx),t.apply(this,n)}catch(e){return this.invokeRuleCatch(e,r,i)}finally{this.ruleFinallyStateUpdate()}},Object.assign(function(...t){this.onBeforeParse(e);try{return o.apply(this,t)}finally{this.onAfterParse(e)}},{ruleName:e,originalGrammarAction:t,coreRule:o})}invokeRuleCatch(e,t,n){let r=this.RULE_STACK_IDX===0,i=t&&!this.isBackTracking()&&this.recoveryEnabled;if(Qn(e)){let t=e;if(i){let r=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(r)){if(t.resyncedTokens=this.reSyncTo(r),this.outputCst){let e=this.CST_STACK[this.CST_STACK.length-1];return e.recoveredNode=!0,e}return n(e)}if(this.outputCst){let e=this.CST_STACK[this.CST_STACK.length-1];e.recoveredNode=!0,t.partialCstResult=e}throw t}if(r)return this.moveToTerminatedState(),n(e);throw t}throw e}optionInternal(e,t){let n=512|t;return this.optionInternalLogic(e,t,n)}optionInternalLogic(e,t,n){let r=this.currRuleLookaheadFuncs[n],i;if(typeof e!=`function`){i=e.DEF;let t=e.GATE;if(t!==void 0){let e=r;r=()=>t.call(this)&&e.call(this)}}else i=e;if(r.call(this)===!0)return i.call(this)}atLeastOneInternal(e,t){let n=lr|e;return this.atLeastOneInternalLogic(e,t,n)}atLeastOneInternalLogic(e,t,n){let r=this.currRuleLookaheadFuncs[n],i;if(typeof t!=`function`){i=t.DEF;let e=t.GATE;if(e!==void 0){let t=r;r=()=>e.call(this)&&t.call(this)}}else i=t;if(r.call(this)===!0){let e=this.doSingleRepetition(i);for(;r.call(this)===!0&&e===!0;)e=this.doSingleRepetition(i)}else throw this.raiseEarlyExitException(e,z.REPETITION_MANDATORY,t.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],r,lr,e,an)}atLeastOneSepFirstInternal(e,t){let n=dr|e;this.atLeastOneSepFirstInternalLogic(e,t,n)}atLeastOneSepFirstInternalLogic(e,t,n){let r=t.DEF,i=t.SEP;if(this.currRuleLookaheadFuncs[n].call(this)===!0){r.call(this);let t=()=>this.tokenMatcher(this.LA_FAST(1),i);for(;this.tokenMatcher(this.LA_FAST(1),i)===!0;)this.CONSUME(i),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,t,r,on],t,dr,e,on)}else throw this.raiseEarlyExitException(e,z.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG)}manyInternal(e,t){let n=768|e;return this.manyInternalLogic(e,t,n)}manyInternalLogic(e,t,n){let r=this.currRuleLookaheadFuncs[n],i;if(typeof t!=`function`){i=t.DEF;let e=t.GATE;if(e!==void 0){let t=r;r=()=>e.call(this)&&t.call(this)}}else i=t;let a=!0;for(;r.call(this)===!0&&a===!0;)a=this.doSingleRepetition(i);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],r,768,e,nn,a)}manySepFirstInternal(e,t){let n=ur|e;this.manySepFirstInternalLogic(e,t,n)}manySepFirstInternalLogic(e,t,n){let r=t.DEF,i=t.SEP;if(this.currRuleLookaheadFuncs[n].call(this)===!0){r.call(this);let t=()=>this.tokenMatcher(this.LA_FAST(1),i);for(;this.tokenMatcher(this.LA_FAST(1),i)===!0;)this.CONSUME(i),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,t,r,rn],t,ur,e,rn)}}repetitionSepSecondInternal(e,t,n,r,i){for(;n();)this.CONSUME(t),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,n,r,i],n,dr,e,i)}doSingleRepetition(e){let t=this.getLexerPosition();return e.call(this),this.getLexerPosition()>t}orInternal(e,t){let n=256|t,r=Array.isArray(e)?e:e.DEF,i=this.currRuleLookaheadFuncs[n].call(this,r);if(i!==void 0)return r[i].ALT.call(this);this.raiseNoAltException(t,e.ERR_MSG)}ruleFinallyStateUpdate(){this.RULE_STACK_IDX--,this.RULE_OCCURRENCE_STACK_IDX--,this.RULE_STACK_IDX>=0&&(this.currRuleShortName=this.RULE_STACK[this.RULE_STACK_IDX],this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[this.currRuleShortName]),this.cstFinallyStateUpdate()}subruleInternal(e,t,n){let r;try{let i=n===void 0?void 0:n.ARGS;return this.subruleIdx=t,r=e.coreRule.apply(this,i),this.cstPostNonTerminal(r,n!==void 0&&n.LABEL!==void 0?n.LABEL:e.ruleName),r}catch(t){throw this.subruleInternalError(t,n,e.ruleName)}}subruleInternalError(e,t,n){throw Qn(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,t!==void 0&&t.LABEL!==void 0?t.LABEL:n),delete e.partialCstResult),e}consumeInternal(e,t,n){let r;try{let t=this.LA_FAST(1);this.tokenMatcher(t,e)===!0?(this.consumeToken(),r=t):this.consumeInternalError(e,t,n)}catch(n){r=this.consumeInternalRecovery(e,t,n)}return this.cstPostTerminal(n!==void 0&&n.LABEL!==void 0?n.LABEL:e.name,r),r}consumeInternalError(e,t,n){let r,i=this.LA(0);throw r=n!==void 0&&n.ERR_MSG?n.ERR_MSG:this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:t,previous:i,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new er(r,t,i))}consumeInternalRecovery(e,t,n){if(this.recoveryEnabled&&n.name===`MismatchedTokenException`&&!this.isBackTracking()){let r=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,r)}catch(e){throw e.name===`InRuleRecoveryException`?n:e}}throw n}saveRecogState(){let e=this.errors,t=this.RULE_STACK.slice(0,this.RULE_STACK_IDX+1);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:t,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState);let t=e.RULE_STACK;for(let e=0;e<t.length;e++)this.RULE_STACK[e]=t[e];this.RULE_STACK_IDX=t.length-1,this.RULE_STACK_IDX>=0&&(this.currRuleShortName=this.RULE_STACK[this.RULE_STACK_IDX],this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[this.currRuleShortName])}ruleInvocationStateUpdate(e,t,n){this.RULE_OCCURRENCE_STACK[++this.RULE_OCCURRENCE_STACK_IDX]=n,this.RULE_STACK[++this.RULE_STACK_IDX]=e,this.currRuleShortName=e,this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[e],this.cstInvocationStateUpdate(t)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){let e=this.currRuleShortName;return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),R)}reset(){this.resetLexerState(),this.subruleIdx=0,this.currRuleShortName=-1,this.currRuleLookaheadFuncs=[],this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK_IDX=-1,this.RULE_OCCURRENCE_STACK_IDX=-1,this.CST_STACK=[]}onBeforeParse(e){for(let e=0;e<this.maxLookahead+1;e++)this.tokVector.push(Kr)}onAfterParse(e){if(this.isAtEndOfInput()===!1){let e=this.LA(1),t=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new nr(t,e))}for(;this.tokVector.at(-1)===Kr;)this.tokVector.pop()}},Mr=class{initErrorHandler(e){this._errors=[],this.errorMessageProvider=Object.hasOwn(e,`errorMessageProvider`)?e.errorMessageProvider:B.errorMessageProvider}SAVE_ERROR(e){if(Qn(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:this.RULE_OCCURRENCE_STACK.slice(0,this.RULE_OCCURRENCE_STACK_IDX+1)},this._errors.push(e),e;throw Error(`Trying to save an Error which is not a RecognitionException`)}get errors(){return[...this._errors]}set errors(e){this._errors=e}raiseEarlyExitException(e,t,n){let r=this.getCurrRuleFullName(),i=this.getGAstProductions()[r],a=Sn(e,i,t,this.maxLookahead)[0],o=[];for(let e=1;e<=this.maxLookahead;e++)o.push(this.LA(e));let s=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:a,actual:o,previous:this.LA(0),customUserDescription:n,ruleName:r});throw this.SAVE_ERROR(new rr(s,this.LA(1),this.LA(0)))}raiseNoAltException(e,t){let n=this.getCurrRuleFullName(),r=this.getGAstProductions()[n],i=xn(e,r,this.maxLookahead),a=[];for(let e=1;e<=this.maxLookahead;e++)a.push(this.LA(e));let o=this.LA(0),s=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:i,actual:a,previous:o,customUserDescription:t,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new tr(s,this.LA(1),o))}},Nr={description:`This Object indicates the Parser is during Recording Phase`};Object.freeze(Nr);var Pr=!0,Fr=255,Ir=L({name:`RECORDING_PHASE_TOKEN`,pattern:I.NA});xt([Ir]);var Lr=Kt(Ir,`This IToken indicates the Parser is in Recording Phase
|
|
60
|
+
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(Lr);var Rr={name:`This CSTNode indicates the Parser is in Recording Phase
|
|
61
|
+
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}},zr=class{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 t=e>0?e:``;this[`CONSUME${t}`]=function(t,n){return this.consumeInternalRecord(t,e,n)},this[`SUBRULE${t}`]=function(t,n){return this.subruleInternalRecord(t,e,n)},this[`OPTION${t}`]=function(t){return this.optionInternalRecord(t,e)},this[`OR${t}`]=function(t){return this.orInternalRecord(t,e)},this[`MANY${t}`]=function(t){this.manyInternalRecord(e,t)},this[`MANY_SEP${t}`]=function(t){this.manySepFirstInternalRecord(e,t)},this[`AT_LEAST_ONE${t}`]=function(t){this.atLeastOneInternalRecord(e,t)},this[`AT_LEAST_ONE_SEP${t}`]=function(t){this.atLeastOneSepFirstInternalRecord(e,t)}}this.consume=function(e,t,n){return this.consumeInternalRecord(t,e,n)},this.subrule=function(e,t,n){return this.subruleInternalRecord(t,e,n)},this.option=function(e,t){return this.optionInternalRecord(t,e)},this.or=function(e,t){return this.orInternalRecord(t,e)},this.many=function(e,t){this.manyInternalRecord(e,t)},this.atLeastOne=function(e,t){this.atLeastOneInternalRecord(e,t)},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 t=0;t<10;t++){let n=t>0?t:``;delete e[`CONSUME${n}`],delete e[`SUBRULE${n}`],delete e[`OPTION${n}`],delete e[`OR${n}`],delete e[`MANY${n}`],delete e[`MANY_SEP${n}`],delete e[`AT_LEAST_ONE${n}`],delete e[`AT_LEAST_ONE_SEP${n}`]}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,t){return()=>!0}LA_RECORD(e){return Kr}topLevelRuleRecord(e,t){try{let n=new _({definition:[],name:e});return n.name=e,this.recordingProdStack.push(n),t.call(this),this.recordingProdStack.pop(),n}catch(e){if(e.KNOWN_RECORDER_ERROR!==!0)try{e.message+=`
|
|
62
|
+
This error was thrown during the "grammar recording phase" For more info see:
|
|
63
|
+
https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw e}throw e}}optionInternalRecord(e,t){return Br.call(this,y,e,t)}atLeastOneInternalRecord(e,t){Br.call(this,b,t,e)}atLeastOneSepFirstInternalRecord(e,t){Br.call(this,x,t,e,Pr)}manyInternalRecord(e,t){Br.call(this,S,t,e)}manySepFirstInternalRecord(e,t){Br.call(this,C,t,e,Pr)}orInternalRecord(e,t){return Vr.call(this,e,t)}subruleInternalRecord(e,t,n){if(Ur(t),!e||!Object.hasOwn(e,`ruleName`)){let n=Error(`<SUBRULE${Hr(t)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>\n inside top level rule: <${this.recordingProdStack[0].name}>`);throw n.KNOWN_RECORDER_ERROR=!0,n}let r=this.recordingProdStack.at(-1),i=e.ruleName,a=new g({idx:t,nonTerminalName:i,label:n?.LABEL,referencedRule:void 0});return r.definition.push(a),this.outputCst?Rr:Nr}consumeInternalRecord(e,t,n){if(Ur(t),!Dt(e)){let n=Error(`<CONSUME${Hr(t)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>\n inside top level rule: <${this.recordingProdStack[0].name}>`);throw n.KNOWN_RECORDER_ERROR=!0,n}let r=this.recordingProdStack.at(-1),i=new T({idx:t,terminalType:e,label:n?.LABEL});return r.definition.push(i),Lr}};function Br(e,t,n,r=!1){Ur(n);let i=this.recordingProdStack.at(-1),a=typeof t==`function`?t:t.DEF,o=new e({definition:[],idx:n});return r&&(o.separator=t.SEP),Object.hasOwn(t,`MAX_LOOKAHEAD`)&&(o.maxLookahead=t.MAX_LOOKAHEAD),this.recordingProdStack.push(o),a.call(this),i.definition.push(o),this.recordingProdStack.pop(),Nr}function Vr(e,t){Ur(t);let n=this.recordingProdStack.at(-1),r=Array.isArray(e)===!1,i=r===!1?e:e.DEF,a=new w({definition:[],idx:t,ignoreAmbiguities:r&&e.IGNORE_AMBIGUITIES===!0});return Object.hasOwn(e,`MAX_LOOKAHEAD`)&&(a.maxLookahead=e.MAX_LOOKAHEAD),a.hasPredicates=i.some(e=>typeof e.GATE==`function`),n.definition.push(a),i.forEach(e=>{let t=new v({definition:[]});a.definition.push(t),Object.hasOwn(e,`IGNORE_AMBIGUITIES`)?t.ignoreAmbiguities=e.IGNORE_AMBIGUITIES:Object.hasOwn(e,`GATE`)&&(t.ignoreAmbiguities=!0),this.recordingProdStack.push(t),e.ALT.call(this),this.recordingProdStack.pop()}),Nr}function Hr(e){return e===0?``:`${e}`}function Ur(e){if(e<0||e>Fr){let t=Error(`Invalid DSL Method idx value: <${e}>\n\tIdx value must be a none negative value smaller than 256`);throw t.KNOWN_RECORDER_ERROR=!0,t}}var Wr=class{initPerformanceTracer(e){if(Object.hasOwn(e,`traceInitPerf`)){let t=e.traceInitPerf,n=typeof t==`number`;this.traceInitMaxIdent=n?t:1/0,this.traceInitPerf=n?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=B.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,t){if(this.traceInitPerf===!0){this.traceInitIndent++;let n=Array(this.traceInitIndent+1).join(` `);this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--> <${e}>`);let{time:r,value:i}=d(t),a=r>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(`${n}<-- <${e}> time: ${r}ms`),this.traceInitIndent--,i}return t()}};function Gr(e,t){t.forEach(t=>{let n=t.prototype;Object.getOwnPropertyNames(n).forEach(r=>{if(r===`constructor`)return;let i=Object.getOwnPropertyDescriptor(n,r);i&&(i.get||i.set)?Object.defineProperty(e.prototype,r,i):e.prototype[r]=t.prototype[r]})})}var Kr=Kt(R,``,-1,-1,-1,-1,-1,-1);Object.freeze(Kr);var B=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:Jt,nodeLocationTracking:`none`,traceInitPerf:!1,skipValidations:!1}),qr=Object.freeze({recoveryValueFunc:()=>void 0,resyncEnabled:!0}),V;(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`})(V||={});var Jr=class e{static performSelfAnalysis(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT(`performSelfAnalysis`,()=>{let t;this.selfAnalysisDone=!0;let n=this.className;this.TRACE_INIT(`toFastProps`,()=>{f(this)}),this.TRACE_INIT(`Grammar Recording`,()=>{try{this.enableRecording(),this.definedRulesNames.forEach(e=>{let t=this[e].originalGrammarAction,n;this.TRACE_INIT(`${e} Rule`,()=>{n=this.topLevelRuleRecord(e,t)}),this.gastProductionsCache[e]=n})}finally{this.disableRecording()}});let r=[];if(this.TRACE_INIT(`Grammar Resolving`,()=>{r=Gn({rules:Object.values(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(r)}),this.TRACE_INIT(`Grammar Validations`,()=>{if(r.length===0&&this.skipValidations===!1){let e=Kn({rules:Object.values(this.gastProductionsCache),tokenTypes:Object.values(this.tokensMap),errMsgProvider:Xt,grammarName:n}),t=En({lookaheadStrategy:this.lookaheadStrategy,rules:Object.values(this.gastProductionsCache),tokenTypes:Object.values(this.tokensMap),grammarName:n});this.definitionErrors=this.definitionErrors.concat(e,t)}}),this.definitionErrors.length===0&&(this.recoveryEnabled&&this.TRACE_INIT(`computeAllProdsFollows`,()=>{let e=le(Object.values(this.gastProductionsCache));this.resyncFollows=e}),this.TRACE_INIT(`ComputeLookaheadFunctions`,()=>{var e,t;(t=(e=this.lookaheadStrategy).initialize)==null||t.call(e,{rules:Object.values(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(Object.values(this.gastProductionsCache))})),!e.DEFER_DEFINITION_ERRORS_HANDLING&&this.definitionErrors.length!==0)throw t=this.definitionErrors.map(e=>e.message),Error(`Parser Definition Errors detected:\n ${t.join(`
|
|
64
|
+
-------------------------------
|
|
65
|
+
`)}`)})}constructor(e,t){this.definitionErrors=[],this.selfAnalysisDone=!1;let n=this;if(n.initErrorHandler(t),n.initLexerAdapter(),n.initLooksAhead(t),n.initRecognizerEngine(e,t),n.initRecoverable(t),n.initTreeBuilder(t),n.initGastRecorder(t),n.initPerformanceTracer(t),Object.hasOwn(t,`ignoredIssues`))throw Error(`The <ignoredIssues> IParserConfig property has been deprecated.
|
|
66
|
+
Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
|
|
67
|
+
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
|
|
68
|
+
For further details.`);this.skipValidations=Object.hasOwn(t,`skipValidations`)?t.skipValidations:B.skipValidations}};Jr.DEFER_DEFINITION_ERRORS_HANDLING=!1,Gr(Jr,[sr,pr,Or,kr,jr,Ar,Mr,zr,Wr]);var Yr=class extends Jr{constructor(e,t=B){let n=Object.assign({},t);n.outputCst=!0,super(e,n)}},Xr=e.n(e=>e!==void 0&&e>=0,`isKnownLocation`);function Zr(e,t){let n=e.lexer.tokenize(t);if(n.errors.length>0){let r=n.errors[0],i=Xr(r.offset)?r.offset:t.length,a=i+(Xr(r.length)?r.length:0);throw Error(`Error lexing ${e.diagramType} diagram: ${r.message} at line ${r.line??1}, column ${r.column??1} [${i},${a})`)}e.parser.input=n.tokens;let r=e.entry();if(e.parser.errors.length>0)throw Error(`Error parsing ${e.diagramType} diagram: ${e.parser.errors[0].message}`);e.visit(r)}e.n(Zr,`runChevrotainParse`);var H={SOLID_ARROW:0,BACK_ARROW:1,LINE_SOLID:2,CIRCLE_ARROW:3,CROSS_ARROW:4,CIRCLE_ARROW_REVERSED:5,CROSS_ARROW_REVERSED:6},Qr=`LR`,$r=n.f.usecase,ei=e.n(()=>({actors:new Map,useCases:new Map,systemBoundaries:new Map,relationships:[],notes:new Map,jsonNodes:new Map,classDefs:new Map,symbols:new Map,direction:Qr,relationshipCounter:0,noteCounter:0,accTitle:``,accDescription:``,ast:void 0,config:structuredClone($r)}),`createModel`),ti=e.n(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`),U=ei(),ni=e.n(()=>structuredClone(U.config),`getConfig`),ri=e.n(()=>U.ast,`getAST`),ii=e.n(e=>{let t=structuredClone(e);ti(t);let r=n.v(),i=n._();try{n.U(t.accTitle),n.H(t.accDescription),U=t}catch(e){throw n.U(r),n.H(i),e}},`commit`),ai=e.n(()=>{U=ei(),n.a()},`clear`),oi=e.n(()=>U.actors,`getActors`),si=e.n(e=>U.actors.get(e),`getActor`),ci=e.n(()=>U.useCases,`getUseCases`),li=e.n(e=>U.useCases.get(e),`getUseCase`),ui=e.n(()=>U.systemBoundaries,`getSystemBoundaries`),di=e.n(e=>U.systemBoundaries.get(e),`getSystemBoundary`),fi=e.n(()=>U.relationships,`getRelationships`),pi=e.n(()=>U.notes,`getNotes`),mi=e.n(e=>U.notes.get(e),`getNote`),hi=e.n(()=>U.jsonNodes,`getJsonNodes`),gi=e.n(e=>U.jsonNodes.get(e),`getJsonNode`),_i=e.n(()=>U.classDefs,`getClassDefs`),vi=e.n(e=>U.classDefs.get(e),`getClassDef`),yi=e.n(()=>U.direction,`getDirection`),bi=e.n(e=>{let t=new Map;for(let n of[`default`,...e]){let e=U.classDefs.get(n);if(e)for(let n of e.styles){let e=n.trim(),r=e.indexOf(`:`),i=(r===-1?e:e.slice(0,r)).trim();i&&t.set(i,e)}}return[...t.values()]},`getCompiledStyles`),xi=e.n(e=>e.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`),`escapeJsonPointerPart`),Si=e.n(e=>typeof e==`string`?e:e===null?`null`:String(e),`displayJsonScalar`),Ci=e.n((t,n,r=e=>e)=>{let i=[],a=e.n((e,t,n)=>{i.push({key:r(e),accessibleKey:r(t),value:r(n)})},`append`),o=e.n((e,t,r)=>{if(Array.isArray(e)){if(e.length===0){a(t,t,`[]`);return}if(e.every(e=>e===null||[`string`,`number`,`boolean`].includes(typeof e))){for(let[n,r]of e.entries())a(n===0?t:``,t,Si(r));return}for(let[n,i]of e.entries())o(i,`${t}[${n}]`,`${r}/${n}`);return}if(typeof e==`object`&&e){let i=e,s=n[r]??Object.keys(i);if(s.length===0){a(t,t,`{}`);return}for(let e of s){let n=t?`${t}.${e}`:e;o(i[e],n,`${r}/${xi(e)}`)}return}a(t,t,Si(e))},`visit`);return o(t,``,``),i},`flattenJsonRows`),wi=e.n(e=>{switch(e.type){case`hollow`:return`usecaseActorHollow`;case`awesome`:return`usecaseActorAwesome`;case`icon`:return`usecaseActorIcon`;case`normal`:return`usecaseActor`}},`actorShape`),Ti=e.n(e=>e.shape===`ellipse`?e.business?`usecaseBusiness`:`usecaseEllipse`:e.shape,`useCaseShape`),Ei=e.n(e=>{switch(e){case H.SOLID_ARROW:return{arrowTypeStart:`none`,arrowTypeEnd:`arrow_point`};case H.BACK_ARROW:return{arrowTypeStart:`arrow_point`,arrowTypeEnd:`none`};case H.CIRCLE_ARROW:return{arrowTypeStart:`none`,arrowTypeEnd:`arrow_circle`};case H.CROSS_ARROW:return{arrowTypeStart:`none`,arrowTypeEnd:`arrow_cross`};case H.CIRCLE_ARROW_REVERSED:return{arrowTypeStart:`arrow_circle`,arrowTypeEnd:`none`};case H.CROSS_ARROW_REVERSED:return{arrowTypeStart:`arrow_cross`,arrowTypeEnd:`none`};case H.LINE_SOLID:return{arrowTypeStart:`none`,arrowTypeEnd:`none`}}},`associationMarkers`),Di=e.n(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{...Ei(e.arrowType),pattern:`solid`,...e.label?{label:e.label}:{},...e.labelType?{labelType:e.labelType}:{}}}},`relationshipVisuals`),Oi=e.n(e=>e.animate||e.animation?[`edge-animation-${e.animation??`fast`}`]:[],`animationClasses`),ki=e.n((...e)=>e.filter(e=>!!e).join(` `),`classNames`),Ai={getConfig:ni,createModel:ei,commit:ii,getAST:ri,clear:ai,setDiagramTitle:n.q,getDiagramTitle:n.C,setAccTitle:n.U,getAccTitle:n.v,setAccDescription:n.H,getAccDescription:n._,getActors:oi,getActor:si,getUseCases:ci,getUseCase:li,getSystemBoundaries:ui,getSystemBoundary:di,getRelationships:fi,getNotes:pi,getNote:mi,getJsonNodes:hi,getJsonNode:gi,getClassDefs:_i,getClassDef:vi,getDirection:yi,getData:e.n(()=>{let t=n.b(),r={...U.config,...t.usecase},i=e.n(e=>n.z(e,t),`sanitize`),a=e.n(e=>i(U.actors.get(e)?.label??U.useCases.get(e)?.label??U.jsonNodes.get(e)?.id??U.notes.get(e)?.label??e),`endpointLabel`),o=[],s=[],c=0,l=0;for(let e of U.actors.values())o.push({id:e.id,label:i(e.label),labelType:e.labelType,shape:wi(e),isGroup:!1,padding:10,look:t.look,colorIndex:c++,cssClasses:ki(`default`,`usecase-actor`,`usecase-actor-${e.type}`,e.business&&`usecase-business`,...e.classes),cssStyles:[...e.styles],cssCompiledStyles:bi(e.classes),actorType:e.type,business:e.business,...e.icon?{icon:e.icon}:{},...e.stereotype?{stereotype:i(e.stereotype)}:{},...e.parentId?{parentId:e.parentId}:{}});for(let e of U.useCases.values())o.push({id:e.id,label:i(e.label),labelType:e.labelType,shape:Ti(e),isGroup:!1,padding:e.shape===`ellipse`?20:10,look:t.look,colorIndex:c++,cssClasses:ki(`default`,`usecase-element`,`usecase-${e.shape}`,e.business&&`usecase-business`,...e.classes),cssStyles:[...e.styles],cssCompiledStyles:bi(e.classes),business:e.business,...e.stereotype?{stereotype:i(e.stereotype)}:{},...e.parentId?{parentId:e.parentId}:{}});for(let e of U.notes.values())o.push({id:e.id,label:i(e.label),labelType:e.labelType,shape:`note`,isGroup:!1,padding:10,look:t.look,cssClasses:`default usecase-note`,cssStyles:[],cssCompiledStyles:bi([]),noteTarget:e.target,noteTargetLabel:i(U.actors.get(e.target)?.label??U.useCases.get(e.target)?.label??U.jsonNodes.get(e.target)?.id??e.target)});for(let e of U.jsonNodes.values())o.push({id:e.id,label:i(e.id),labelType:`text`,shape:`usecaseJsonTable`,isGroup:!1,padding:10,look:t.look,cssClasses:ki(`default`,`usecase-json-table`,...e.classes),cssStyles:[...e.styles],cssCompiledStyles:bi(e.classes),jsonRows:Ci(e.value,e.propertyOrder,i)});for(let e of U.systemBoundaries.values())o.push({id:e.id,label:i(e.label),labelType:e.labelType,shape:`usecaseSystemBoundary`,isGroup:!0,padding:20,look:t.look,colorIndex:l++,cssClasses:ki(`default`,`system-boundary`,`system-boundary-${e.type}`,...e.classes),cssStyles:[...e.styles],cssCompiledStyles:bi(e.classes),boundaryType:e.type});for(let e of U.relationships){let{label:n,...r}=Di(e);s.push({id:e.id,start:e.source,end:e.target,source:e.source,target:e.target,sourceLabel:a(e.source),targetLabel:a(e.target),type:`edge`,relationshipType:e.type,internal:!1,...r,...n===void 0?{}:{label:i(n)},labelpos:`c`,classes:ki(`default`,`relationship`,`relationship-${e.type}`,...e.classes,...Oi(e)),style:[...e.styles],cssCompiledStyles:bi(e.classes),animate:e.animate,...e.animation?{animation:e.animation}:{},look:t.look,thickness:`normal`,minlen:e.minlen,isUserDefinedId:e.explicitId})}for(let e of U.notes.values())s.push({id:`${e.id}-edge`,start:e.id,end:e.target,source:e.id,target:e.target,type:`edge`,relationshipType:`note`,sourceLabel:a(e.id),targetLabel:a(e.target),internal:!0,pattern:`dotted`,arrowTypeStart:`none`,arrowTypeEnd:`none`,labelpos:`c`,classes:`default relationship relationship-note`,style:[],cssCompiledStyles:bi([]),animate:!1,look:t.look,thickness:`normal`,minlen:1,isUserDefinedId:!1});for(let e of o)e.wrappingWidth??=r.wrappingWidth,!e.isGroup&&!e.shape.startsWith(`usecaseActor`)&&(e.minWidth??=r.minNodeWidth),(e.shape===`usecaseEllipse`||e.shape===`usecaseBusiness`)&&(e.spreadPorts=!0);return{nodes:o,edges:s,config:t,type:`usecase`,layoutAlgorithm:`dagre`,direction:yi(),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`)};function ji(e,t,n){let r=[n];return r.index=t,r.input=e,r}e.n(ji,`customMatch`);var Mi=e.n((e,t)=>{if(e[t]!==`"`||e[t+1]!=="`")return null;for(let n=t+2;n<e.length-1;n++)if(e[n]==="`"&&e[n+1]===`"`)return ji(e,t,e.slice(t,n+2));return null},`matchMarkdownString`),Ni=e.n((e,t)=>{if(e[t]!==`%`||e[t+1]!==`%`)return null;for(let n=t-1;n>=0;n--){let t=e[n];if(t===`
|
|
69
|
+
`||t===`\r`)break;if(t!==` `&&t!==` `)return null}let n=t+2;for(;n<e.length&&e[n]!==`
|
|
70
|
+
`&&e[n]!==`\r`;)n++;return ji(e,t,e.slice(t,n))},`matchComment`),Pi=e.n((e,t)=>{for(let n=t-1;n>=0;n--){let t=e[n];if(t===`
|
|
71
|
+
`||t===`\r`)return!0;if(t!==` `&&t!==` `)return!1}return!0},`isIndentedLineStart`),Fi=e.n((e,t,n)=>{if(!Pi(e,t))return null;let r=n.exec(e.slice(t));return r?ji(e,t,r[0]):null},`matchAccessibilityLine`),Ii=e.n((e,t)=>{if(!Pi(e,t))return null;let n=/^accDescr[\t ]*{/.exec(e.slice(t));if(!n)return null;let r=e.indexOf(`}`,t+n[0].length);return r===-1?null:ji(e,t,e.slice(t,r+1))},`matchAccDescrBlock`),Li=e.n((e,t)=>{if(e[t]!==`{`)return null;let n=0,r=!1,i=!1;for(let a=t;a<e.length;a++){let o=e[a];if(r){i?i=!1:o===`\\`?i=!0:o===`"`&&(r=!1);continue}if(o===`"`)r=!0;else if(o===`{`)n++;else if(o===`}`&&--n===0)return ji(e,t,e.slice(t,a+1))}return null},`matchJsonObject`),Ri=e.n((e,t)=>{let n=e.indexOf(`>>`,t);if(n===-1||/[\n\r]/.test(e.slice(t,n)))return null;let r=e.slice(t,n);return r.trim()?ji(e,t,r):null},`matchStereotypeText`),W=L({name:`LABEL_TEXT`,pattern:I.NA}),zi=L({name:`WORD`,pattern:I.NA,categories:W}),Bi=L({name:`NUMBER`,pattern:/(?:\d+\.\d+|\d+|\.\d+)(?:[A-Za-z]+)?/,categories:W}),G=L({name:`IDENTIFIER`,pattern:/\w+/,longer_alt:Bi,categories:zi}),Vi=L({name:`HWS`,pattern:/[\t ]+/,group:I.SKIPPED}),K=L({name:`MARKDOWN_STRING`,pattern:Mi,start_chars_hint:[`"`],line_breaks:!0}),Hi=L({name:`UNCLOSED_MARKDOWN_STRING`,pattern:/"`[^]*/,line_breaks:!0}),Ui=L({name:`COMMENT`,pattern:Ni,start_chars_hint:[`%`],line_breaks:!1}),q=L({name:`NEWLINE`,pattern:/\r\n|\n|\r/,line_breaks:!0}),Wi=L({name:`ACC_DESCR_BLOCK`,pattern:Ii,start_chars_hint:[`a`],line_breaks:!0}),Gi=/^accTitle[\t ]*:[^\n\r]*/,Ki=/^accDescr[\t ]*:[^\n\r]*/,qi=L({name:`ACC_TITLE_LINE`,pattern:e.n((e,t)=>Fi(e,t,Gi),`pattern`),start_chars_hint:[`a`],line_breaks:!1}),Ji=L({name:`ACC_DESCR_LINE`,pattern:e.n((e,t)=>Fi(e,t,Ki),`pattern`),start_chars_hint:[`a`],line_breaks:!1}),Yi=L({name:`JSON_DECLARATION_START`,pattern:/json[\t ]+\w+[\t ]*@[\t ]*(?={)/,push_mode:`jsonBody`}),Xi=L({name:`JSON_OBJECT_LITERAL`,pattern:Li,start_chars_hint:[`{`],line_breaks:!0,pop_mode:!0}),Zi=L({name:`UNCLOSED_JSON_OBJECT_LITERAL`,pattern:/{[^]*/,line_breaks:!0,pop_mode:!0}),J=e.n((e,t)=>L({name:e,pattern:t,longer_alt:G,categories:zi}),`keyword`),Qi=J(`USECASE`,/usecase-beta/),$i=J(`ACTOR`,/actor/),ea=J(`SYSTEM_BOUNDARY`,/systemBoundary/),ta=J(`END`,/end/),na=J(`DIRECTION`,/direction/),ra=J(`TD`,/TD/),ia=J(`TB`,/TB/),aa=J(`BT`,/BT/),oa=J(`LR`,/LR/),sa=J(`RL`,/RL/),ca=J(`NOTE`,/note/),la=J(`FOR`,/for/),ua=J(`JSON`,/json/),da=J(`CLASS_DEF`,/classDef/),fa=J(`CLASS`,/class/),pa=J(`STYLE`,/style/),ma=J(`INCLUDE`,/include/i),ha=J(`EXTEND`,/extend/i),ga=J(`TRUE`,/true/),_a=J(`FALSE`,/false/),va=L({name:`GENERALIZATION`,pattern:/--\|>/}),ya=L({name:`DEPENDENCY_ARROW`,pattern:/\.\.>/}),ba=L({name:`STEREOTYPE_START`,pattern:/<</,push_mode:`stereotype`}),xa=L({name:`STEREOTYPE_END`,pattern:/>>/,pop_mode:!0}),Sa=L({name:`STEREOTYPE_TEXT`,pattern:Ri,line_breaks:!1}),Ca=L({name:`UNCLOSED_STEREOTYPE_TEXT`,pattern:/[^\n\r]+/,line_breaks:!1,pop_mode:!0}),wa=L({name:`CLASS_SEPARATOR`,pattern:/:::/}),Ta=L({name:`FORWARD_SOLID`,pattern:/--+>/}),Ea=L({name:`BACKWARD_SOLID`,pattern:/<--+/}),Da=L({name:`FORWARD_CIRCLE`,pattern:/--o/}),Oa=L({name:`BACKWARD_CIRCLE`,pattern:/o--/}),ka=L({name:`FORWARD_CROSS`,pattern:/--x/}),Aa=L({name:`BACKWARD_CROSS`,pattern:/x--/}),Y=L({name:`MARKERLESS_SOLID`,pattern:/--+/}),ja=L({name:`METADATA_START`,pattern:/@{/}),Ma=L({name:`AT`,pattern:/@/,categories:W}),Na=L({name:`LBRACE`,pattern:/{/}),Pa=L({name:`RBRACE`,pattern:/}/}),Fa=L({name:`LBRACKET`,pattern:/\[/}),Ia=L({name:`RBRACKET`,pattern:/]/}),La=L({name:`LPAREN`,pattern:/\(/}),Ra=L({name:`RPAREN`,pattern:/\)/}),X=L({name:`COMMA`,pattern:/,/,categories:W}),za=L({name:`COLON`,pattern:/:/,categories:W}),Ba=L({name:`HASH_COLOR`,pattern:/#[\dA-Fa-f]+/,categories:W}),Z=L({name:`PLAIN_STRING`,pattern:/"[^\n\r"]*"|'[^\n\r']*'/}),Va=L({name:`CSS_IDENTIFIER`,pattern:/--[A-Z_a-z][\w-]*|[A-Z_a-z]\w*(?:-\w+)+/,categories:W}),Ha=L({name:`CSS_ESCAPED_COMMA`,pattern:/\\,/,categories:W}),Ua=L({name:`DASH`,pattern:/-/,categories:W}),Wa=L({name:`DOT`,pattern:/\./,categories:W}),Ga=L({name:`PERCENT`,pattern:/%/,categories:W}),Ka=L({name:`CSS_PUNCTUATION`,pattern:/[!#$&*+/=?^_|~]/,categories:W}),qa=[W,zi,Vi,K,Hi,Ui,q,Wi,qi,Ji,Yi,Qi,$i,ea,ta,na,ra,ia,aa,oa,sa,ca,la,ua,da,fa,pa,ma,ha,ga,_a,va,ya,ba,wa,Ta,Ea,Da,Oa,ka,Aa,Y,ja,Ma,Na,Pa,Fa,Ia,La,Ra,X,za,Ba,Z,Va,G,Bi,Ha,Ua,Wa,Ga,Ka,L({name:`LABEL_PUNCTUATION`,pattern:/[;<>\\`]/,categories:W}),L({name:`LABEL_SYMBOL`,pattern:/[^\t\n\r !-~]+/,categories:W})],Ja={defaultMode:`defaultMode`,modes:{defaultMode:[...qa],jsonBody:[Xi,Zi],stereotype:[xa,Sa,Ca]}},Ya=[...qa,Xi,Zi,xa,Sa,Ca],Xa=new I(Ja),Za=e.n(e=>qt(e,W)||e.tokenType===Z||e.tokenType===K,`isLabelToken`),Qa={allowmixing:!0,newpage:!0,package:!0,rectangle:!0,skinparam:!0},$a=new class extends Yr{static{e.n(this,`UsecaseParser`)}constructor(){super(Ya,{nodeLocationTracking:`full`}),this.RULE(`start`,()=>{this.CONSUME(Qi),this.SUBRULE(this.lineEnd),this.MANY(()=>this.SUBRULE(this.line))}),this.RULE(`line`,()=>{this.OR([{ALT:e.n(()=>this.SUBRULE(this.blankLine),`ALT`)},{ALT:e.n(()=>this.SUBRULE(this.commentLine),`ALT`)},{GATE:e.n(()=>this.isStatementStart(),`GATE`),ALT:e.n(()=>this.SUBRULE(this.statement),`ALT`)}])}),this.RULE(`statement`,()=>{this.OR([{ALT:e.n(()=>this.SUBRULE(this.accTitleStatement),`ALT`)},{ALT:e.n(()=>this.SUBRULE(this.accDescrStatement),`ALT`)},{ALT:e.n(()=>this.SUBRULE(this.directionStatement),`ALT`)},{ALT:e.n(()=>this.SUBRULE(this.actorStatement),`ALT`)},{ALT:e.n(()=>this.SUBRULE(this.systemBoundaryStatement),`ALT`)},{ALT:e.n(()=>this.SUBRULE(this.noteStatement),`ALT`)},{ALT:e.n(()=>this.SUBRULE(this.jsonStatement),`ALT`)},{ALT:e.n(()=>this.SUBRULE(this.classDefStatement),`ALT`)},{ALT:e.n(()=>this.SUBRULE(this.classStatement),`ALT`)},{ALT:e.n(()=>this.SUBRULE(this.styleStatement),`ALT`)},{GATE:e.n(()=>this.isMetadataAssignment(),`GATE`),ALT:e.n(()=>this.SUBRULE(this.metadataAssignmentStatement),`ALT`)},{GATE:e.n(()=>!this.isForbiddenPlantUmlStatement(),`GATE`),ALT:e.n(()=>this.SUBRULE(this.entityStatement),`ALT`)}])}),this.RULE(`lineEnd`,()=>{this.OR([{ALT:e.n(()=>this.CONSUME(q),`ALT`)},{ALT:e.n(()=>this.CONSUME(R),`ALT`)}])}),this.RULE(`blankLine`,()=>{this.CONSUME(q)}),this.RULE(`commentLine`,()=>{this.CONSUME(Ui),this.SUBRULE(this.lineEnd)}),this.RULE(`accTitleStatement`,()=>{this.CONSUME(qi),this.SUBRULE(this.lineEnd)}),this.RULE(`accDescrStatement`,()=>{this.OR([{ALT:e.n(()=>this.CONSUME(Ji),`ALT`)},{ALT:e.n(()=>this.CONSUME(Wi),`ALT`)}]),this.SUBRULE(this.lineEnd)}),this.RULE(`actorStatement`,()=>{this.CONSUME($i),this.SUBRULE(this.actorItem),this.OPTION(()=>{this.OR([{ALT:e.n(()=>this.AT_LEAST_ONE(()=>{this.CONSUME(X),this.SUBRULE2(this.actorItem)}),`ALT`)},{ALT:e.n(()=>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:e.n(()=>{this.CONSUME(G),this.OPTION(()=>{this.CONSUME(La),this.SUBRULE(this.nodeLabel),this.CONSUME(Ra)})},`ALT`)},{ALT:e.n(()=>this.CONSUME(Z),`ALT`)},{ALT:e.n(()=>this.CONSUME(K),`ALT`)}])}),this.RULE(`actorDeclarationOnly`,()=>{this.CONSUME($i),this.SUBRULE(this.actorItem),this.MANY(()=>{this.CONSUME(X),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:e.n(()=>{this.CONSUME(G),this.OPTION(()=>{this.OR2([{ALT:e.n(()=>{this.CONSUME(La),this.SUBRULE(this.nodeLabel),this.CONSUME(Ra)},`ALT`)},{ALT:e.n(()=>{this.CONSUME(Fa),this.SUBRULE2(this.nodeLabel),this.CONSUME(Ia)},`ALT`)}])})},`ALT`)},{ALT:e.n(()=>this.CONSUME(Z),`ALT`)},{ALT:e.n(()=>this.CONSUME(K),`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:e.n(()=>this.CONSUME(Z),`ALT`)},{ALT:e.n(()=>this.CONSUME(K),`ALT`)},{ALT:e.n(()=>this.AT_LEAST_ONE(()=>this.CONSUME(W)),`ALT`)}])}),this.RULE(`useCaseMetadata`,()=>{this.SUBRULE(this.metadata)}),this.RULE(`relationTail`,()=>{this.OPTION({GATE:e.n(()=>this.LA(1).tokenType===G&&this.LA(2).tokenType===Ma,`GATE`),DEF:e.n(()=>{this.CONSUME(G),this.CONSUME(Ma)},`DEF`)}),this.SUBRULE(this.arrow),this.SUBRULE(this.entityName)}),this.RULE(`arrow`,()=>{this.OR([{ALT:e.n(()=>this.SUBRULE(this.semanticRelation),`ALT`)},{ALT:e.n(()=>this.SUBRULE(this.forwardSolidOperator),`ALT`)},{ALT:e.n(()=>this.SUBRULE(this.backwardSolidOperator),`ALT`)},{ALT:e.n(()=>this.SUBRULE(this.markerlessSolidOperator),`ALT`)},{ALT:e.n(()=>this.SUBRULE(this.forwardCircleOperator),`ALT`)},{ALT:e.n(()=>this.SUBRULE(this.backwardCircleOperator),`ALT`)},{ALT:e.n(()=>this.SUBRULE(this.forwardCrossOperator),`ALT`)},{ALT:e.n(()=>this.SUBRULE(this.backwardCrossOperator),`ALT`)}])}),this.RULE(`forwardSolidOperator`,()=>{this.CONSUME(Ta)}),this.RULE(`backwardSolidOperator`,()=>{this.CONSUME(Ea),this.OPTION({GATE:e.n(()=>this.LA(0).image===`<--`&&this.hasLabeledRight([Y]),`GATE`),DEF:e.n(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(Y)},`DEF`)})}),this.RULE(`markerlessSolidOperator`,()=>{this.CONSUME(Y),this.OPTION({GATE:e.n(()=>this.LA(0).image===`--`&&this.hasLabeledRight([Ta,Y,Da,ka]),`GATE`),DEF:e.n(()=>{this.SUBRULE(this.edgeLabel),this.OR([{ALT:e.n(()=>this.CONSUME(Ta),`ALT`)},{ALT:e.n(()=>this.CONSUME2(Y),`ALT`)},{ALT:e.n(()=>this.CONSUME(Da),`ALT`)},{ALT:e.n(()=>this.CONSUME(ka),`ALT`)}])},`DEF`)})}),this.RULE(`forwardCircleOperator`,()=>{this.CONSUME(Da)}),this.RULE(`backwardCircleOperator`,()=>{this.CONSUME(Oa),this.OPTION({GATE:e.n(()=>this.hasLabeledRight([Y]),`GATE`),DEF:e.n(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(Y)},`DEF`)})}),this.RULE(`forwardCrossOperator`,()=>{this.CONSUME(ka)}),this.RULE(`backwardCrossOperator`,()=>{this.CONSUME(Aa),this.OPTION({GATE:e.n(()=>this.hasLabeledRight([Y]),`GATE`),DEF:e.n(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(Y)},`DEF`)})}),this.RULE(`edgeLabel`,()=>{this.OR([{ALT:e.n(()=>this.CONSUME(Z),`ALT`)},{ALT:e.n(()=>this.CONSUME(K),`ALT`)},{ALT:e.n(()=>this.AT_LEAST_ONE(()=>this.CONSUME(W)),`ALT`)}])}),this.RULE(`semanticRelation`,()=>{this.OR([{ALT:e.n(()=>{this.CONSUME(ya),this.CONSUME(za),this.OR2([{ALT:e.n(()=>this.CONSUME(ma),`ALT`)},{ALT:e.n(()=>this.CONSUME(ha),`ALT`)}])},`ALT`)},{ALT:e.n(()=>this.CONSUME(va),`ALT`)}])}),this.RULE(`metadata`,()=>{this.CONSUME(ja),this.MANY(()=>this.CONSUME(q)),this.OPTION(()=>{this.SUBRULE(this.metadataProperty),this.MANY2(()=>{this.SUBRULE(this.metadataSeparator),this.SUBRULE2(this.metadataProperty)}),this.OPTION2(()=>this.CONSUME(X)),this.MANY3(()=>this.CONSUME2(q))}),this.CONSUME(Pa)}),this.RULE(`metadataProperty`,()=>{this.OR([{ALT:e.n(()=>this.CONSUME(G),`ALT`)},{ALT:e.n(()=>this.CONSUME(Z),`ALT`)}]),this.CONSUME(za),this.OR2([{ALT:e.n(()=>this.CONSUME2(G),`ALT`)},{ALT:e.n(()=>this.CONSUME2(Z),`ALT`)},{ALT:e.n(()=>this.CONSUME(ga),`ALT`)},{ALT:e.n(()=>this.CONSUME(_a),`ALT`)}])}),this.RULE(`metadataSeparator`,()=>{this.OR([{ALT:e.n(()=>{this.CONSUME(X),this.MANY(()=>this.CONSUME(q))},`ALT`)},{ALT:e.n(()=>{this.AT_LEAST_ONE(()=>this.CONSUME2(q)),this.OPTION(()=>this.CONSUME2(X)),this.MANY2(()=>this.CONSUME3(q))},`ALT`)}])}),this.RULE(`systemBoundaryStatement`,()=>{this.CONSUME(ea),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(ta),this.SUBRULE2(this.lineEnd)}),this.RULE(`systemBoundaryName`,()=>{this.OR([{ALT:e.n(()=>{this.CONSUME(G),this.OPTION(()=>{this.OR2([{ALT:e.n(()=>{this.CONSUME(La),this.SUBRULE(this.nodeLabel),this.CONSUME(Ra)},`ALT`)},{ALT:e.n(()=>{this.CONSUME(Fa),this.SUBRULE2(this.nodeLabel),this.CONSUME(Ia)},`ALT`)}])})},`ALT`)},{ALT:e.n(()=>this.CONSUME(Z),`ALT`)},{ALT:e.n(()=>this.CONSUME(K),`ALT`)}])}),this.RULE(`systemBoundaryContent`,()=>{this.MANY(()=>{this.OR([{ALT:e.n(()=>this.SUBRULE(this.blankLine),`ALT`)},{ALT:e.n(()=>this.SUBRULE(this.commentLine),`ALT`)},{ALT:e.n(()=>this.SUBRULE(this.boundaryElement),`ALT`)}])})}),this.RULE(`boundaryElement`,()=>{this.OR([{ALT:e.n(()=>this.SUBRULE(this.actorDeclarationOnly),`ALT`)},{ALT:e.n(()=>{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:e.n(()=>this.CONSUME(G),`ALT`)},{ALT:e.n(()=>this.CONSUME(Z),`ALT`)},{ALT:e.n(()=>this.CONSUME(K),`ALT`)}])}),this.RULE(`noteStatement`,()=>{this.CONSUME(ca),this.CONSUME(la),this.CONSUME(G),this.SUBRULE(this.nodeLabel),this.SUBRULE(this.lineEnd)}),this.RULE(`stereotype`,()=>{this.CONSUME(ba),this.CONSUME(Sa),this.CONSUME(xa)}),this.RULE(`classSuffix`,()=>{this.CONSUME(wa),this.CONSUME(G),this.MANY(()=>{this.CONSUME(X),this.CONSUME2(G)})}),this.RULE(`jsonStatement`,()=>{this.CONSUME(Yi),this.CONSUME(Xi),this.OPTION(()=>this.SUBRULE(this.classSuffix)),this.SUBRULE(this.lineEnd)}),this.RULE(`directionStatement`,()=>{this.CONSUME(na),this.OR([{ALT:e.n(()=>this.CONSUME(ra),`ALT`)},{ALT:e.n(()=>this.CONSUME(ia),`ALT`)},{ALT:e.n(()=>this.CONSUME(aa),`ALT`)},{ALT:e.n(()=>this.CONSUME(oa),`ALT`)},{ALT:e.n(()=>this.CONSUME(sa),`ALT`)}]),this.SUBRULE(this.lineEnd)}),this.RULE(`classDefStatement`,()=>{this.CONSUME(da),this.CONSUME(G),this.MANY(()=>{this.CONSUME(X),this.CONSUME2(G)}),this.SUBRULE(this.styles),this.SUBRULE(this.lineEnd)}),this.RULE(`classStatement`,()=>{this.CONSUME(fa),this.CONSUME(G),this.MANY(()=>{this.CONSUME(X),this.CONSUME2(G)}),this.CONSUME3(G),this.MANY2(()=>{this.CONSUME2(X),this.CONSUME4(G)}),this.SUBRULE(this.lineEnd)}),this.RULE(`styleStatement`,()=>{this.CONSUME(pa),this.CONSUME(G),this.SUBRULE(this.styles),this.SUBRULE(this.lineEnd)}),this.RULE(`styles`,()=>{this.SUBRULE(this.styleValue),this.MANY(()=>{this.CONSUME(X),this.SUBRULE2(this.styleValue)})}),this.RULE(`styleValue`,()=>{this.OR([{ALT:e.n(()=>this.CONSUME(zi),`ALT`)},{ALT:e.n(()=>this.CONSUME(Va),`ALT`)},{ALT:e.n(()=>{this.CONSUME(Y),this.CONSUME2(zi)},`ALT`)}]),this.CONSUME(za),this.AT_LEAST_ONE(()=>this.SUBRULE(this.styleComponent))}),this.RULE(`styleComponent`,()=>{this.OR([{ALT:e.n(()=>this.CONSUME(zi),`ALT`)},{ALT:e.n(()=>this.CONSUME(Z),`ALT`)},{ALT:e.n(()=>this.CONSUME(Bi),`ALT`)},{ALT:e.n(()=>this.CONSUME(Ba),`ALT`)},{ALT:e.n(()=>this.CONSUME(Va),`ALT`)},{ALT:e.n(()=>this.CONSUME(Ha),`ALT`)},{ALT:e.n(()=>this.CONSUME(Ua),`ALT`)},{ALT:e.n(()=>this.CONSUME(Wa),`ALT`)},{ALT:e.n(()=>this.CONSUME(Ga),`ALT`)},{ALT:e.n(()=>this.CONSUME(Ka),`ALT`)},{ALT:e.n(()=>this.CONSUME(za),`ALT`)},{ALT:e.n(()=>this.CONSUME(La),`ALT`)},{ALT:e.n(()=>this.CONSUME(Ra),`ALT`)},{ALT:e.n(()=>this.CONSUME(Fa),`ALT`)},{ALT:e.n(()=>this.CONSUME(Ia),`ALT`)},{ALT:e.n(()=>this.CONSUME(Na),`ALT`)},{ALT:e.n(()=>this.CONSUME(Pa),`ALT`)},{ALT:e.n(()=>this.CONSUME(Ma),`ALT`)},{ALT:e.n(()=>this.CONSUME(Y),`ALT`)}])}),this.performSelfAnalysis()}isMetadataAssignment(){let e=this.LA(1).tokenType;return(e===G||e===Z||e===K)&&this.LA(2).tokenType===ja}isStatementStart(){let e=this.LA(1).tokenType;return e!==R&&e!==q&&e!==Ui}isForbiddenPlantUmlStatement(){return this.LA(1).tokenType===G&&Qa[this.LA(1).image.toLowerCase()]===!0}hasLabeledRight(e){if(!Za(this.LA(1)))return!1;for(let t=2;;t++){let n=this.LA(t);if(e.includes(n.tokenType))return!0;if(!Za(n))return!1}}},eo=class extends Error{constructor(e,t,n){super(`${e} (line ${t}, column ${n})`),this.line=t,this.column=n,this.name=`UsecaseJsonError`}static{e.n(this,`UsecaseJsonError`)}},to=e.n((e,t,n,r)=>{let i=n,a=r,o=Math.min(Math.max(t,0),e.length);for(let t=0;t<o;t++){let n=e[t];n===`\r`?(i++,a=1):n===`
|
|
72
|
+
`?(t===0||e[t-1]!==`\r`)&&(i++,a=1):a++}return{line:i,column:a}},`locationAtOffset`),no=e.n((e,t,n,r)=>{let i=/\bposition (\d+)\b/u.exec(e);if(i)return to(t,Number.parseInt(i[1],10),n,r);let a=/\bline (\d+) column (\d+)\b/u.exec(e);if(a){let e=Number.parseInt(a[1],10),t=Number.parseInt(a[2],10);return{line:n+e-1,column:e===1?r+t-1:t}}if(/unexpected end|end of json input/iu.test(e))return to(t,t.length,n,r)},`locationFromErrorMessage`),Q=class extends Error{constructor(e){super(`Invalid JSON token`),this.offset=e}static{e.n(this,`JsonWalkError`)}},ro=class{constructor(e){this.text=e,this.offset=0,this.propertyOrder={}}static{e.n(this,`PropertyOrderCollector`)}collect(){if(this.skipWhitespace(),this.collectValue(``),this.skipWhitespace(),this.offset!==this.text.length)throw new Q(this.offset);return this.propertyOrder}collectValue(e){this.skipWhitespace();let t=this.text[this.offset];if(t===`{`)this.collectObject(e);else if(t===`[`)this.collectArray(e);else if(t===`"`)this.readString(!1);else if(t===`t`)this.consumeLiteral(`true`);else if(t===`f`)this.consumeLiteral(`false`);else if(t===`n`)this.consumeLiteral(`null`);else if(t===`-`||t>=`0`&&t<=`9`)this.consumeNumber();else throw new Q(this.offset)}collectObject(e){this.offset++;let t=[],n=new Set;if(this.propertyOrder[e]=t,this.skipWhitespace(),this.text[this.offset]===`}`){this.offset++;return}for(;this.offset<this.text.length;){if(this.text[this.offset]!==`"`)throw new Q(this.offset);let r=this.readString(!0),i=`${e}/${r.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)}`;if(n.has(r)?this.deletePointerSubtree(i):(n.add(r),t.push(r)),this.skipWhitespace(),this.text[this.offset]!==`:`)throw new Q(this.offset);if(this.offset++,this.collectValue(i),this.skipWhitespace(),this.text[this.offset]===`}`){this.offset++;return}if(this.text[this.offset]!==`,`)throw new Q(this.offset);this.offset++,this.skipWhitespace()}throw new Q(this.offset)}collectArray(e){if(this.offset++,this.skipWhitespace(),this.text[this.offset]===`]`){this.offset++;return}let t=0;for(;this.offset<this.text.length;){if(this.collectValue(`${e}/${t}`),t++,this.skipWhitespace(),this.text[this.offset]===`]`){this.offset++;return}if(this.text[this.offset]!==`,`)throw new Q(this.offset);this.offset++,this.skipWhitespace()}throw new Q(this.offset)}readString(e){this.offset++;let t=``;for(;this.offset<this.text.length;){let n=this.offset,r=this.text[this.offset++];if(r===`"`)return t;if(r.charCodeAt(0)<32)throw new Q(n);if(r!==`\\`){e&&(t+=r);continue}let i=this.offset,a=this.text[this.offset++];switch(a){case`"`:case`\\`:case`/`:e&&(t+=a);break;case`b`:e&&(t+=`\b`);break;case`f`:e&&(t+=`\f`);break;case`n`:e&&(t+=`
|
|
73
|
+
`);break;case`r`:e&&(t+=`\r`);break;case`t`:e&&(t+=` `);break;case`u`:{let n=this.text.slice(this.offset,this.offset+4);if(!/^[\dA-Fa-f]{4}$/u.test(n))throw new Q(this.offset);e&&(t+=String.fromCharCode(Number.parseInt(n,16))),this.offset+=4;break}default:throw new Q(i)}}throw new Q(this.offset)}consumeLiteral(e){let t=0;for(let n of e){if(this.text[this.offset+t]!==n)throw new Q(this.offset+t);t++}this.offset+=e.length}consumeNumber(){if(this.text[this.offset]===`-`&&this.offset++,this.text[this.offset]===`0`)this.offset++;else if(this.text[this.offset]>=`1`&&this.text[this.offset]<=`9`)for(;this.text[this.offset]>=`0`&&this.text[this.offset]<=`9`;)this.offset++;else throw new Q(this.offset);if(this.text[this.offset]===`.`){if(this.offset++,this.text[this.offset]<`0`||this.text[this.offset]>`9`)throw new Q(this.offset);for(;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++,this.text[this.offset]<`0`||this.text[this.offset]>`9`)throw new Q(this.offset);for(;this.text[this.offset]>=`0`&&this.text[this.offset]<=`9`;)this.offset++}}skipWhitespace(){for(;this.offset<this.text.length;){let e=this.text[this.offset];if(e!==` `&&e!==` `&&e!==`
|
|
74
|
+
`&&e!==`\r`)return;this.offset++}}deletePointerSubtree(e){let t=`${e}/`;for(let n of Object.keys(this.propertyOrder))(n===e||n.startsWith(t))&&delete this.propertyOrder[n]}};function io(e,t,n){let r;try{r=JSON.parse(e)}catch(r){let i=r instanceof Error?r.message:String(r),a=no(i,e,t,n);if(!a){let r=0;try{new ro(e).collect()}catch(e){e instanceof Q&&(r=e.offset)}a=to(e,r,t,n)}throw new eo(`Invalid JSON: ${i}`,a.line,a.column)}if(typeof r!=`object`||!r||Array.isArray(r))throw new eo(`JSON value must have an object root`,t,n);return{value:r,propertyOrder:new ro(e).collect()}}e.n(io,`parseOrderedJsonObject`);var ao=e.n(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`),oo=e.n(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`),so=e.n(e=>({label:e.label,shape:`note`,attrs:{kind:`note`,target:e.target,labelType:e.labelType}}),`noteNode`),co=e.n(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`),lo=e.n(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`),uo=e.n(e=>({id:`${e.id}-edge`,source:e.id,target:e.target,attrs:{relationshipType:`note`,arrowType:H.LINE_SOLID,pattern:`dotted`,minlen:1,explicitId:!1,animate:!1,internal:!0}}),`noteEdge`),fo=e.n((e,t,n,r)=>{let i={};for(let t of e.getActors().values())i[t.id]=ao(t);for(let t of e.getUseCases().values())i[t.id]=oo(t);for(let t of e.getNotes().values())i[t.id]=so(t);for(let t of e.getJsonNodes().values())i[t.id]=co(t);let a={};for(let t of e.getSystemBoundaries().values())a[t.id]={...t.label===t.id?{}:{title:t.label},nodes:[...t.members],...t.classes.length?{classes:[...t.classes]}:{},...t.styles.length?{styles:[...t.styles]}:{},attrs:{kind:`systemBoundary`,boundaryType:t.type,labelType:t.labelType}};let o={};for(let t of e.getClassDefs().values())o[t.id]={styles:[...t.styles]};let s=e.getDirection();return{version:1,diagramType:`usecase`,source:t,header:{keyword:`usecase`,direction:s===`TD`?`TB`:s,span:n},...e.getAccTitle()?{accTitle:e.getAccTitle()}:{},...e.getAccDescription()?{accDescr:e.getAccDescription()}:{},nodes:i,edges:[...e.getRelationships().map(lo),...[...e.getNotes().values()].map(uo)],groups:a,classDefs:o,statements:r}},`buildUsecaseGraphAST`),$=e.n(e=>`line ${e.line}, column ${e.column} [${e.span[0]},${e.span[1]})`,`locationText`),po=e.n(e=>e===void 0?``:` (label "${e}")`,`labelSuffix`),mo=e.n(e=>e.generated?e.label:void 0,`generatedFrom`),ho=e.n((e,t)=>{for(let n of t)e.includes(n)||e.push(n)},`pushUnique`),go=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{e.n(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,t,n,r){this.metadataAssignments.push({target:e,targetLocation:t,metadata:n,statement:r})}addClassDef(e,t){this.classDefinitions.push({ids:e,styles:t})}addClassAssignment(e,t){this.classAssignments.push({targets:e,classes:t})}addStyleAssignment(e,t,n){this.styleAssignments.push({target:e,location:t,styles:n})}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 t=new Map,n=new Map,r=new Map,i=new Map;for(let e of this.relationshipDrafts)this.recordFirst(i,e.source.id,e.source.location.span[0]),this.recordFirst(i,e.target.id,e.target.location.span[0]);for(let e of this.elements)this.recordFirst(i,e.id,e.location.span[0]);for(let e of this.boundaries)this.recordFirst(i,e.id,e.location.span[0]);for(let e of this.jsonDrafts)this.recordFirst(i,e.id,e.location.span[0]);let a=[...this.elements.map(e=>({offset:e.location.span[0],type:`element`,value:e})),...this.boundaries.map(e=>({offset:e.location.span[0],type:`boundary`,value:e})),...this.jsonDrafts.map(e=>({offset:e.location.span[0],type:`json`,value:e})),...this.relationshipDrafts.filter(e=>e.explicitId).map(e=>({offset:e.explicitIdLocation.span[0],type:`edge`,value:e}))].sort((e,t)=>e.offset-t.offset);for(let e of a)e.type===`element`?this.collectElement(e.value,t,n):e.type===`boundary`?this.collectBoundary(e.value,t,r):e.type===`json`?this.registerUnique(t,e.value.id,`json`,e.value.location,!1):this.registerUnique(t,e.value.explicitId,`edge`,e.value.explicitIdLocation,!1);this.materializeElements(n,i),this.materializeBoundaries(r,i),this.materializeJson(i);let o=this.materializeRelationships(t,n,i);this.reorderElements(n,i),this.applyMetadataAssignments(t,n,r,o),this.validateAndRefreshElements(n),this.refreshBoundaries(r,n),this.materializeNotes(t),this.applyClassDefinitions(),this.applyClassesAndStyles(t,o),this.model.direction=this.directions.at(-1)??this.model.direction,this.model.symbols=new Map([...t].map(([e,t])=>[e,t.kind]));let s=fo(this,this.source,e,this.statements);return this.model.ast=s,this.db.commit(this.model),s}collectElement(e,t,n){let r=t.get(e.id),i=mo({generated:e.generated,label:e.label.text});r&&r.kind!==e.kind&&this.conflict(`ID '${e.id}' is declared as both ${r.kind} and ${e.kind}`,e.location,r.location,i,mo(r)),r&&(r.generated||e.generated)&&this.conflict(`Generated ID '${e.id}' collides with another declaration`,e.location,r.location,i,mo(r));let a=n.get(e.id);if(!a){let r={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(r,e.metadata),n.set(e.id,r),t.set(e.id,{kind:e.kind,location:e.location,generated:e.generated,label:e.label.text});return}(a.label.text!==e.label.text||a.label.type!==e.label.type)&&this.conflict(`ID '${e.id}' has conflicting labels`,e.location,a.location),e.shape&&a.shape&&e.shape!==a.shape&&this.conflict(`Use case '${e.id}' has conflicting shapes`,e.location,a.location),e.parentId&&a.parentId&&e.parentId!==a.parentId&&this.conflict(`Element '${e.id}' belongs to more than one system boundary`,e.parentLocation??e.location,a.parentLocation??a.location),e.stereotype&&a.stereotype&&e.stereotype!==a.stereotype&&this.conflict(`Element '${e.id}' has conflicting stereotypes`,e.location,a.stereotypeLocation??a.location),a.shape??=e.shape,a.parentId??=e.parentId,a.parentLocation??=e.parentLocation,a.stereotype??=e.stereotype,a.stereotypeLocation??=e.stereotype?e.location:void 0,ho(a.classes,e.classes),this.applyDeclarationMetadata(a,e.metadata)}collectBoundary(e,t,n){let r=t.get(e.id),i=mo({generated:e.generated,label:e.label.text});r&&r.kind!==`boundary`&&this.conflict(`ID '${e.id}' is declared as both ${r.kind} and boundary`,e.location,r.location,i,mo(r)),r&&(r.generated||e.generated)&&this.conflict(`Generated ID '${e.id}' collides with another declaration`,e.location,r.location,i,mo(r));let a=n.get(e.id);if(a){(a.label.text!==e.label.text||a.label.type!==e.label.type)&&this.conflict(`Boundary '${e.id}' has conflicting titles`,e.location,a.location),ho(a.classes,e.classes);return}n.set(e.id,{id:e.id,label:e.label,location:e.location,generated:e.generated,classes:[...e.classes],styles:[],members:[]}),t.set(e.id,{kind:`boundary`,location:e.location,generated:e.generated,label:e.label.text})}materializeElements(e,t){for(let n of[...e.values()].sort((e,n)=>(t.get(e.id)??0)-(t.get(n.id)??0)))this.setElementModel(n)}materializeBoundaries(e,t){for(let n of[...e.values()].sort((e,n)=>(t.get(e.id)??0)-(t.get(n.id)??0)))this.model.systemBoundaries.set(n.id,{id:n.id,label:n.label.text,labelType:n.label.type,type:n.type??`rect`,members:[],classes:[...n.classes],styles:[...n.styles]})}materializeJson(e){for(let t of[...this.jsonDrafts].sort((t,n)=>(e.get(t.id)??0)-(e.get(n.id)??0)))this.model.jsonNodes.set(t.id,{id:t.id,value:t.value,propertyOrder:t.propertyOrder,classes:[...t.classes],styles:[]})}materializeRelationships(e,t,n){let r=new Map,i=0;for(let a of this.relationshipDrafts){let o=this.resolveEndpoint(a.source,e,t,n),s=this.resolveEndpoint(a.target,e,t,n);this.validateRelationship(a,o,s,e);let c=a.explicitId??`edge-${i++}`,l={id:c,explicitId:!!a.explicitId,source:a.source.id,target:a.target.id,type:a.type,arrowType:a.arrowType,...a.label?{label:a.label.text,labelType:a.label.type}:{},minlen:a.minlen,classes:[],styles:[],animate:!1};this.model.relationships.push(l),r.set(c,{draft:a,relationship:l})}return this.model.relationshipCounter=i,r}resolveEndpoint(e,t,n,r){if(e.classesOnReference&&!e.declaration)throw Error(`Relationship endpoint '${e.id}' uses ::: without declaring the node at ${$(e.location)}`);let i=t.get(e.id);return i?i.kind:(n.set(e.id,{kind:`usecase`,id:e.id,label:e.label,location:e.location,generated:e.generated,shape:`ellipse`,classes:[]}),t.set(e.id,{kind:`usecase`,location:e.location,generated:e.generated,label:e.label.text}),this.recordFirst(r,e.id,e.location.span[0]),`usecase`)}reorderElements(e,t){let n=new Map(this.model.actors),r=new Map(this.model.useCases);this.model.actors.clear(),this.model.useCases.clear();for(let i of[...e.values()].sort((e,n)=>(t.get(e.id)??0)-(t.get(n.id)??0))){!n.has(i.id)&&!r.has(i.id)&&this.setElementModel(i);let e=n.get(i.id)??this.model.actors.get(i.id),t=r.get(i.id)??this.model.useCases.get(i.id);e?this.model.actors.set(i.id,e):t&&this.model.useCases.set(i.id,t)}}applyMetadataAssignments(e,t,n,r){for(let i of this.metadataAssignments){let a=e.get(i.target);if(!a){let e=this.inferMetadataKind(i.metadata);throw Error(`Metadata target '${i.target}' is unresolved${e?` (metadata implies ${e})`:``} at ${$(i.targetLocation)}`)}if(a.kind===`actor`||a.kind===`usecase`)this.applyStandaloneElementMetadata(t.get(i.target),i.metadata);else if(a.kind===`boundary`){let e=n.get(i.target);for(let t of i.metadata.properties)(t.key!==`type`||t.value!==`rect`&&t.value!==`package`)&&this.invalidMetadata(i.target,a.kind,t),e.type=t.value}else if(a.kind===`edge`){let e=r.get(i.target);if(!e)throw Error(`Metadata target '${i.target}' is not an explicit edge at ${$(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 t of i.metadata.properties)t.key===`animate`&&typeof t.value==`boolean`?e.relationship.animate=t.value:t.key===`animation`&&(t.value===`fast`||t.value===`slow`)?(e.relationship.animation=t.value,e.relationship.animate=!0):this.invalidMetadata(i.target,a.kind,t)}else for(let e of i.metadata.properties)this.invalidMetadata(i.target,a.kind,e)}for(let{relationship:e}of r.values())e.animation&&(e.animate=!0)}applyStandaloneElementMetadata(e,t){for(let n of t.properties)e.kind===`actor`?this.applyActorProperty(e,n,!0):n.key===`business`&&typeof n.value==`boolean`?e.business=n.value:this.invalidMetadata(e.id,e.kind,n)}applyDeclarationMetadata(e,t){if(t)for(let n of t.properties)e.kind===`actor`?this.applyActorProperty(e,n,!1):n.key===`business`&&typeof n.value==`boolean`?(e.business!==void 0&&e.business!==n.value&&this.conflict(`Use case '${e.id}' has conflicting business metadata`,n.location,e.location),e.business=n.value):this.invalidMetadata(e.id,e.kind,n)}applyActorProperty(e,t,n){t.key===`type`&&(t.value===`normal`||t.value===`hollow`||t.value===`awesome`)?(!n&&e.actorType!==void 0&&e.actorType!==t.value&&this.conflict(`Actor '${e.id}' has conflicting type metadata`,t.location,e.location),e.actorType=t.value):t.key===`icon`&&typeof t.value==`string`?(!n&&e.icon!==void 0&&e.icon!==t.value&&this.conflict(`Actor '${e.id}' has conflicting icon metadata`,t.location,e.location),e.icon=t.value):t.key===`business`&&typeof t.value==`boolean`?(!n&&e.business!==void 0&&e.business!==t.value&&this.conflict(`Actor '${e.id}' has conflicting business metadata`,t.location,e.location),e.business=t.value):this.invalidMetadata(e.id,e.kind,t)}validateAndRefreshElements(e){for(let t of e.values()){let e=t.icon?`icon`:t.actorType??`normal`;if(t.kind===`actor`){if(t.icon&&t.actorType&&t.actorType!==`normal`)throw Error(`Actor '${t.id}' cannot combine icon with type '${t.actorType}' at ${$(t.location)}`);if(t.business&&(e===`icon`||e===`awesome`))throw Error(`Business actor '${t.id}' must use normal or hollow geometry at ${$(t.location)}`)}else if((t.shape??`ellipse`)===`rect`&&t.business)throw Error(`Rectangular use case '${t.id}' cannot be a business use case at ${$(t.location)}`);this.setElementModel(t)}}refreshBoundaries(e,t){for(let t of e.values())t.members.length=0;for(let t of[...this.elements].sort((e,t)=>e.location.span[0]-t.location.span[0])){if(!t.parentId)continue;let n=e.get(t.parentId);if(!n)throw Error(`Parent boundary '${t.parentId}' for '${t.id}' is unresolved at ${$(t.parentLocation??t.location)}`);n.members.includes(t.id)||n.members.push(t.id)}for(let n of t.values())if(n.parentId&&!e.has(n.parentId))throw Error(`Parent boundary '${n.parentId}' for '${n.id}' is unresolved at ${$(n.parentLocation??n.location)}`);for(let t of e.values()){let e=this.model.systemBoundaries.get(t.id);e.type=t.type??`rect`,e.members=[...t.members],e.classes=[...t.classes],e.styles=[...t.styles]}}materializeNotes(e){let t=0;for(let n of this.noteDrafts){let r=e.get(n.target);if(!r)throw Error(`Note target '${n.target}' is unresolved at ${$(n.targetLocation)}`);r.kind!==`actor`&&r.kind!==`usecase`&&this.conflict(`Note target '${n.target}' must be an actor or use case, not ${r.kind}`,n.targetLocation,r.location);let i=`note-${t++}`;this.model.notes.set(i,{id:i,target:n.target,label:n.label.text,labelType:n.label.type})}this.model.noteCounter=t}applyClassDefinitions(){for(let e of this.classDefinitions)for(let t of e.ids)this.model.classDefs.set(t,{id:t,styles:[...e.styles]})}applyClassesAndStyles(e,t){for(let n of this.classAssignments)for(let r of n.targets)ho(this.getStylable(r.id,e,t,r.location).classes,n.classes);for(let n of this.styleAssignments)this.getStylable(n.target,e,t,n.location).styles.push(...n.styles)}getStylable(e,t,n,r){let i=t.get(e)?.kind,a=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`?n.get(e)?.relationship:void 0;if(!a)throw Error(`Class/style target '${e}' is unresolved or anonymous at ${$(r)}`);return a}validateRelationship(t,n,r,i){let a=e.n(e=>e===`actor`||e===`usecase`||e===`json`,`allowed`);if(a(n)||this.conflict(`Relationship source '${t.source.id}' cannot be ${n}`,t.source.location,i.get(t.source.id).location),a(r)||this.conflict(`Relationship target '${t.target.id}' cannot be ${r}`,t.target.location,i.get(t.target.id).location),(t.type===`include`||t.type===`extend`)&&(n!==`usecase`||r!==`usecase`))throw Error(`${t.type} relationship requires use-case endpoints at ${$(t.location)}`);if(t.type===`generalization`&&(n!==`actor`&&n!==`usecase`||n!==r))throw Error(`Generalization requires actor-to-actor or use-case-to-use-case endpoints at ${$(t.location)}`);if(t.type===`association`&&(n===`json`||r===`json`)&&![0,1,2].includes(t.arrowType))throw Error(`JSON relationship '${t.source.id}' to '${t.target.id}' permits only point, reversed-point, or markerless solid association at ${$(t.location)}`)}setElementModel(e){if(e.kind===`actor`){let t=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:t,...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 t=new Set([`actor`,`usecase`,`boundary`,`edge`]);for(let n of e.properties)if(n.key===`icon`)t.clear(),t.add(`actor`);else if(n.key===`animate`||n.key===`animation`)t.clear(),t.add(`edge`);else if(n.key===`type`)t.clear(),n.value===`rect`||n.value===`package`?t.add(`boundary`):(n.value===`normal`||n.value===`hollow`||n.value===`awesome`)&&t.add(`actor`);else if(n.key===`business`)t.delete(`boundary`),t.delete(`edge`);else return;return t.size===1?[...t][0]:void 0}invalidMetadata(e,t,n){throw Error(`Metadata property '${n.key}' is invalid for ${t} '${e}' at ${$(n.location)}`)}registerUnique(e,t,n,r,i){let a=e.get(t);a&&this.conflict(`ID '${t}' is declared more than once (${a.kind} and ${n})`,r,a.location,void 0,mo(a)),e.set(t,{kind:n,location:r,generated:i})}recordFirst(e,t,n){let r=e.get(t);(r===void 0||n<r)&&e.set(t,n)}conflict(e,t,n,r,i){throw Error(`${e} at ${$(t)}${po(r)}; previous declaration at ${$(n)}${po(i)}`)}},_o=$a.getBaseCstVisitorConstructor(),vo=new class extends _o{constructor(){super(),this.builder=new go(Ai),this.source=``,this.anonymousEdge=0,this.anonymousNote=0,this.validateVisitor()}static{e.n(this,`UsecaseVisitor`)}build(e,t){this.source=t,this.parentBoundary=void 0,this.anonymousEdge=0,this.anonymousNote=0,this.builder.reset(t),this.visit(e)}start(e){let t=this.tokens(e,`USECASE`)[0],n=[];for(let t of this.nodes(e,`line`))n.push(this.visit(t));this.builder.setStatements(n),this.builder.finalize(this.tokenSpan(t))}line(e){let t=this.firstNode(e,`blankLine`,`commentLine`,`statement`);return this.wrap(t,this.visit(t))}statement(e){return this.visit(this.firstNode(e,`accTitleStatement`,`accDescrStatement`,`directionStatement`,`actorStatement`,`systemBoundaryStatement`,`noteStatement`,`jsonStatement`,`classDefStatement`,`classStatement`,`styleStatement`,`metadataAssignmentStatement`,`entityStatement`))}lineEnd(e){}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 t=this.tokens(e,`ACC_TITLE_LINE`)[0].image;return this.builder.setAccTitle(t.slice(t.indexOf(`:`)+1).trim()),{kind:`accTitle`,span:[0,0]}}accDescrStatement(e){let t=this.tokens(e,`ACC_DESCR_LINE`)[0],n=this.tokens(e,`ACC_DESCR_BLOCK`)[0],r=t?t.image.slice(t.image.indexOf(`:`)+1).trim():n.image.slice(n.image.indexOf(`{`)+1,n.image.lastIndexOf(`}`)).trim();return this.builder.setAccDescription(r),{kind:`accDescr`,span:[0,0]}}actorStatement(e){let t=this.nodes(e,`actorItem`),n=t.map(e=>this.visit(e)),r=this.nodes(e,`relationTail`)[0],i=n.map((e,n)=>this.actorOccurrence(t[n],e,!0));for(let e of n)this.builder.addElement(this.actorDraft(e));if(!r)return{kind:`node`,span:[0,0],nodes:i};let a=this.visit(r);a.target.explicitDeclaration&&this.builder.addElement(this.entityDraft(a.target));let o=this.relationshipDraft(n[0],a,this.nodeLocation(r));this.builder.addRelationship(o);let s=o.explicitId??`edge-${this.anonymousEdge++}`;return i.push(this.entityOccurrence(this.nodes(r.children,`entityName`)[0],a.target,a.target.explicitDeclaration)),{kind:`edge`,span:[0,0],nodes:i,edges:[{id:s,span:[0,0],...o.explicitIdLocation?{idSpan:o.explicitIdLocation.span}:{},...o.label?{labelSpan:o.label.span}:{}}]}}actorItem(e){let t=this.visit(this.nodes(e,`actorName`)[0]),n=this.nodes(e,`metadata`)[0],r=this.nodes(e,`stereotype`)[0],i=this.nodes(e,`classSuffix`)[0],a=i?this.visit(i):{classes:[],spans:[]};return{...t,...n?{metadata:this.visit(n)}:{},...r?{stereotype:this.visit(r)}:{},classes:a.classes,classSpans:a.spans}}actorName(e){let t=this.tokens(e,`IDENTIFIER`)[0],n=this.tokens(e,`PLAIN_STRING`)[0]??this.tokens(e,`MARKDOWN_STRING`)[0];if(t){let n=this.nodes(e,`nodeLabel`)[0],r=n?this.visit(n):this.tokenLabel(t);return{id:t.image,label:r,location:this.tokenLocation(t),generated:!1,classes:[],classSpans:[]}}let r=this.tokenLabel(n);return{id:this.generateId(r.text),label:r,location:this.tokenLocation(n),generated:!0,classes:[],classSpans:[]}}actorDeclarationOnly(e){let t=this.nodes(e,`actorItem`),n=t.map(e=>this.visit(e));for(let e of n)this.builder.addElement(this.actorDraft(e));return{kind:`node`,span:[0,0],nodes:n.map((e,n)=>this.actorOccurrence(t[n],e,!0))}}entityStatement(e){let t=this.nodes(e,`entityName`),n=this.visit(t[0]),r=this.nodes(e,`relationTail`)[0];if(!r)return n.explicitDeclaration=!0,n.shape??=`ellipse`,this.builder.addElement(this.entityDraft(n)),{kind:`node`,span:[0,0],nodes:[this.entityOccurrence(t[0],n,!0)]};n.explicitDeclaration&&this.builder.addElement(this.entityDraft(n));let i=this.visit(r);i.target.explicitDeclaration&&this.builder.addElement(this.entityDraft(i.target));let a={source:this.endpoint(n),target:this.endpoint(i.target),location:this.nodeLocation(r),...i.explicitId?{explicitId:i.explicitId,explicitIdLocation:i.explicitIdLocation}:{},...i.arrow};this.builder.addRelationship(a);let o=a.explicitId??`edge-${this.anonymousEdge++}`;return{kind:`edge`,span:[0,0],nodes:[this.entityOccurrence(t[0],n,n.explicitDeclaration),this.entityOccurrence(this.nodes(r.children,`entityName`)[0],i.target,i.target.explicitDeclaration)],edges:[{id:o,span:[0,0],...a.explicitIdLocation?{idSpan:a.explicitIdLocation.span}:{},...a.label?{labelSpan:a.label.span}:{}}]}}entityName(e){let t=this.tokens(e,`IDENTIFIER`)[0],n=this.tokens(e,`PLAIN_STRING`)[0]??this.tokens(e,`MARKDOWN_STRING`)[0],r=this.nodes(e,`nodeLabel`)[0],i=this.nodes(e,`useCaseMetadata`)[0],a=this.nodes(e,`stereotype`)[0],o=this.nodes(e,`classSuffix`)[0],s=o?this.visit(o):{classes:[],spans:[]};if(t){let n=r?this.visit(r):this.tokenLabel(t),o=r?this.tokens(e,`LBRACKET`).length?`rect`:`ellipse`:void 0;return{id:t.image,label:n,location:this.tokenLocation(t),generated:!1,...o?{shape:o}:{},...i?{metadata:this.visit(i)}:{},...a?{stereotype:this.visit(a)}:{},classes:s.classes,classSpans:s.spans,explicitDeclaration:!!(o||i||a)}}let c=this.tokenLabel(n);return{id:this.generateId(c.text),label:c,location:this.tokenLocation(n),generated:!0,...i?{metadata:this.visit(i)}:{},...a?{stereotype:this.visit(a)}:{},classes:s.classes,classSpans:s.spans,explicitDeclaration:!!(i||a)}}nodeLabel(e){let t=this.allTokens(e);if(t.length===1&&(t[0].tokenType.name===`PLAIN_STRING`||t[0].tokenType.name===`MARKDOWN_STRING`))return this.tokenLabel(t[0]);let n=[t[0].startOffset,(t.at(-1).endOffset??t.at(-1).startOffset)+1];return{text:this.source.slice(n[0],n[1]),type:`text`,span:n}}useCaseMetadata(e){return this.visit(this.nodes(e,`metadata`)[0])}relationTail(e){let t=this.tokens(e,`IDENTIFIER`)[0];return{...t?{explicitId:t.image,explicitIdLocation:this.tokenLocation(t)}:{},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:H.SOLID_ARROW,minlen:1};let t=this.tokens(e,`INCLUDE`).length?`include`:`extend`,n=this.tokens(e,t===`include`?`INCLUDE`:`EXTEND`)[0];return{type:t,arrowType:H.SOLID_ARROW,label:{text:t,type:`text`,span:this.tokenSpan(n)},minlen:1}}metadata(e){return{properties:this.nodes(e,`metadataProperty`).map(e=>this.visit(e)),location:this.ctxLocation(e)}}metadataProperty(e){let t=this.allTokens(e).filter(e=>e.tokenType.name!==`COLON`),n=t[0],r=t[1],i=r.tokenType.name===`TRUE`||r.tokenType.name!==`FALSE`&&this.decodePlain(r),a=[n.startOffset,(r.endOffset??r.startOffset)+1];return{key:this.decodePlain(n),value:i,span:a,keySpan:this.contentSpan(n),valueSpan:this.contentSpan(r),location:this.tokenLocation(n)}}metadataSeparator(e){}systemBoundaryStatement(e){let t=this.visit(this.nodes(e,`systemBoundaryName`)[0]),n=this.nodes(e,`classSuffix`)[0],r=n?this.visit(n):{classes:[],spans:[]};t.classes=r.classes,this.builder.addBoundary(t);let i=this.parentBoundary;this.parentBoundary={id:t.id,location:t.location};let a=this.nodes(e,`systemBoundaryContent`)[0],o=a?this.visit(a):[];this.parentBoundary=i;let s=this.tokens(e,`END`)[0],c=this.nodes(e,`metadata`)[0],l=c?this.visit(c):void 0,u={kind:`group`,span:[0,0],group:t.id,idSpan:t.location.span,titleSpan:t.label.span,endSpan:this.tokenSpan(s),classSpans:r.spans,...l?{metadata:l.properties.map(({key:e,span:t,keySpan:n,valueSpan:r})=>({key:e,span:t,keySpan:n,valueSpan:r}))}:{},...o.length?{children:o}:{}};return l&&this.builder.addMetadataAssignment(t.id,t.location,l,u),u}systemBoundaryName(e){let t=this.tokens(e,`IDENTIFIER`)[0];if(t){let n=this.nodes(e,`nodeLabel`)[0];return{id:t.image,label:n?this.visit(n):this.tokenLabel(t),location:this.tokenLocation(t),generated:!1,classes:[]}}let n=this.tokens(e,`PLAIN_STRING`)[0]??this.tokens(e,`MARKDOWN_STRING`)[0],r=this.tokenLabel(n);return{id:this.generateId(r.text),label:r,location:this.tokenLocation(n),generated:!0,classes:[]}}systemBoundaryContent(e){return[...this.nodes(e,`blankLine`),...this.nodes(e,`commentLine`),...this.nodes(e,`boundaryElement`)].sort((e,t)=>(e.location?.startOffset??0)-(t.location?.startOffset??0)).map(e=>this.wrap(e,this.visit(e)))}boundaryElement(e){let t=this.nodes(e,`actorDeclarationOnly`)[0];if(t)return this.visit(t);let n=this.nodes(e,`entityName`)[0],r=this.visit(n);return r.explicitDeclaration=!0,r.shape??=`ellipse`,this.builder.addElement(this.entityDraft(r)),{kind:`node`,span:[0,0],nodes:[this.entityOccurrence(n,r,!0)]}}metadataAssignmentStatement(e){let t=this.visit(this.nodes(e,`metadataAssignmentTarget`)[0]),n=this.visit(this.nodes(e,`metadata`)[0]),r={kind:`metadata`,span:[0,0],nodes:[{id:t.id,span:t.location.span,idSpan:t.location.span}],metadata:n.properties.map(({key:e,span:t,keySpan:n,valueSpan:r})=>({key:e,span:t,keySpan:n,valueSpan:r}))};return this.builder.addMetadataAssignment(t.id,t.location,n,r),r}metadataAssignmentTarget(e){let t=this.allTokens(e)[0],n=this.tokenLabel(t);return{id:t.tokenType.name===`IDENTIFIER`?t.image:this.generateId(n.text),location:this.tokenLocation(t)}}noteStatement(e){let t=this.tokens(e,`IDENTIFIER`)[0],n=this.visit(this.nodes(e,`nodeLabel`)[0]);return this.builder.addNote({target:t.image,targetLocation:this.tokenLocation(t),label:n,location:this.ctxLocation(e)}),{kind:`note`,span:[0,0],ref:`note-${this.anonymousNote++}`,refSpan:n.span,nodes:[{id:t.image,span:this.tokenSpan(t),idSpan:this.tokenSpan(t)}]}}stereotype(e){let t=this.tokens(e,`STEREOTYPE_TEXT`)[0];return{value:t.image.trim(),span:this.tokenSpan(t)}}classSuffix(e){let t=this.tokens(e,`IDENTIFIER`);return{classes:t.map(e=>e.image),spans:t.map(e=>this.tokenSpan(e))}}jsonStatement(e){let t=this.tokens(e,`JSON_DECLARATION_START`)[0],n=this.tokens(e,`JSON_OBJECT_LITERAL`)[0],r=/^json[\t ]+(\w+)/.exec(t.image),i=r[1],a=r[0].length-i.length,o={span:[t.startOffset+a,t.startOffset+a+i.length],line:t.startLine??1,column:(t.startColumn??1)+a},s=io(n.image,n.startLine??1,n.startColumn??1),c=this.nodes(e,`classSuffix`)[0],l=c?this.visit(c):{classes:[],spans:[]},u={id:i,value:s.value,propertyOrder:s.propertyOrder,location:o,classes:l.classes};return this.builder.addJson(u),{kind:`json`,span:[0,0],nodes:[{id:i,span:o.span,idSpan:o.span,defines:!0,classSpans:l.spans}],classSpans:l.spans}}directionStatement(e){let t=this.allTokens(e).find(e=>[`TD`,`TB`,`BT`,`RL`,`LR`].includes(e.tokenType.name));return this.builder.setDirection(t.image),{kind:`direction`,span:[0,0]}}classDefStatement(e){let t=this.tokens(e,`IDENTIFIER`),n=this.visit(this.nodes(e,`styles`)[0]);return this.builder.addClassDef(t.map(e=>e.image),n),{kind:`classDef`,span:[0,0],ref:t[0].image,refSpan:this.tokenSpan(t[0])}}classStatement(e){let t=this.tokens(e,`IDENTIFIER`),n=1;for(;n<t.length&&this.source.slice((t[n-1].endOffset??t[n-1].startOffset)+1,t[n].startOffset).includes(`,`);n++);let r=t.slice(0,n).map(e=>({id:e.image,location:this.tokenLocation(e)})),i=t.slice(n).map(e=>e.image);return this.builder.addClassAssignment(r,i),{kind:`classAssign`,span:[0,0],ref:i[0],refSpan:this.tokenSpan(t[n]),nodes:r.map(({id:e,location:t})=>({id:e,span:t.span,idSpan:t.span}))}}styleStatement(e){let t=this.tokens(e,`IDENTIFIER`)[0],n=this.visit(this.nodes(e,`styles`)[0]);return this.builder.addStyleAssignment(t.image,this.tokenLocation(t),n),{kind:`style`,span:[0,0],nodes:[{id:t.image,span:this.tokenSpan(t),idSpan:this.tokenSpan(t)}]}}styles(e){return this.nodes(e,`styleValue`).map(e=>this.visit(e))}styleValue(e){let t=this.allTokens(e),n=[t[0].startOffset,(t.at(-1).endOffset??t.at(-1).startOffset)+1];return this.source.slice(n[0],n[1]).replaceAll(`\\,`,`,`)}styleComponent(e){return this.allTokens(e).map(e=>e.image).join(``)}forwardSolidOperator(e){let t=this.tokens(e,`FORWARD_SOLID`)[0];return{type:`association`,arrowType:H.SOLID_ARROW,minlen:this.solidMinlen(t)}}backwardSolidOperator(e){let t=this.tokens(e,`BACKWARD_SOLID`)[0],n=this.nodes(e,`edgeLabel`)[0],r=n?this.tokens(e,`MARKERLESS_SOLID`).at(-1):t;return{type:`association`,arrowType:H.BACK_ARROW,minlen:this.solidMinlen(r),...n?{label:this.visit(n)}:{}}}markerlessSolidOperator(e){let t=this.nodes(e,`edgeLabel`)[0],n=this.allTokens(e);if(!t)return{type:`association`,arrowType:H.LINE_SOLID,minlen:this.solidMinlen(this.tokens(e,`MARKERLESS_SOLID`)[0])};let r=n.at(-1),i=r.tokenType.name===`FORWARD_SOLID`?H.SOLID_ARROW:r.tokenType.name===`FORWARD_CIRCLE`?H.CIRCLE_ARROW:r.tokenType.name===`FORWARD_CROSS`?H.CROSS_ARROW:H.LINE_SOLID;return{type:`association`,arrowType:i,label:this.visit(t),minlen:i===H.SOLID_ARROW||i===H.LINE_SOLID?this.solidMinlen(r):1}}forwardCircleOperator(e){return{type:`association`,arrowType:H.CIRCLE_ARROW,minlen:1}}backwardCircleOperator(e){let t=this.nodes(e,`edgeLabel`)[0];return{type:`association`,arrowType:H.CIRCLE_ARROW_REVERSED,minlen:1,...t?{label:this.visit(t)}:{}}}forwardCrossOperator(e){return{type:`association`,arrowType:H.CROSS_ARROW,minlen:1}}backwardCrossOperator(e){let t=this.nodes(e,`edgeLabel`)[0];return{type:`association`,arrowType:H.CROSS_ARROW_REVERSED,minlen:1,...t?{label:this.visit(t)}:{}}}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,t=e.explicitDeclaration??!0){return{id:e.id,label:e.label,location:e.location,generated:e.generated,declaration:t,classesOnReference:e.classes.length>0}}relationshipDraft(e,t,n){return{source:this.endpoint(e,!0),target:this.endpoint(t.target),location:n,...t.explicitId?{explicitId:t.explicitId,explicitIdLocation:t.explicitIdLocation}:{},...t.arrow}}actorOccurrence(e,t,n){return{id:t.id,span:this.nodeSpan(e),idSpan:t.location.span,labelSpan:t.label.span,...n?{defines:!0}:{},...t.stereotype?{stereotypeSpan:t.stereotype.span}:{},...t.metadata?{metadata:t.metadata.properties.map(({key:e,span:t,keySpan:n,valueSpan:r})=>({key:e,span:t,keySpan:n,valueSpan:r}))}:{},...t.classSpans.length?{classSpans:t.classSpans}:{}}}entityOccurrence(e,t,n){return this.actorOccurrence(e,t,n)}wrap(e,t){if(t.kind===`blank`||t.kind===`comment`)return t;t.span=this.nodeSpan(e);for(let e of t.edges??[])e.span=t.span;return t}tokenLabel(e){let t=e.tokenType.name===`MARKDOWN_STRING`?`markdown`:`text`,n=t===`markdown`?2:+(e.tokenType.name===`PLAIN_STRING`),r=this.tokenSpan(e,n);return{text:this.source.slice(r[0],r[1]),type:t,span:r}}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 t=this.allTokens(e.children)[0];return{span:this.nodeSpan(e),line:t.startLine??1,column:t.startColumn??1}}ctxLocation(e){let t=this.allTokens(e).filter(e=>e.tokenType.name!==`NEWLINE`&&e.tokenType.name!==`EOF`),n=t[0],r=t.at(-1);return{span:[n.startOffset,Math.min(this.source.length,(r.endOffset??r.startOffset+r.image.length-1)+1)],line:n.startLine??1,column:n.startColumn??1}}tokenLocation(e){let t=e.tokenType.name===`PLAIN_STRING`?1:e.tokenType.name===`MARKDOWN_STRING`?2:0;return{span:this.tokenSpan(e,t),line:e.startLine??1,column:(e.startColumn??1)+t}}nodeSpan(e){let t=this.allTokens(e.children).filter(e=>e.tokenType.name!==`NEWLINE`&&e.tokenType.name!==`EOF`),n=t[0],r=t.at(-1);if(!n||!r)throw Error(`Usecase CST node has no source token`);return[n.startOffset,Math.min(this.source.length,(r.endOffset??r.startOffset+r.image.length-1)+1)]}tokenSpan(e,t=0){return[e.startOffset+t,Math.min(this.source.length,(e.endOffset??e.startOffset+e.image.length-1)+1-t)]}nodes(e,t){return(e[t]??[]).filter(e=>`children`in e)}tokens(e,t){return(e[t]??[]).filter(e=>`tokenTypeIdx`in e)}firstNode(e,...t){for(let n of t){let t=this.nodes(e,n)[0];if(t)return t}throw Error(`Usecase CST is missing one of: ${t.join(`, `)}`)}allTokens(e){let t=[];for(let n of Object.values(e))for(let e of n)`tokenTypeIdx`in e?t.push(e):t.push(...this.allTokens(e.children));return t.sort((e,t)=>e.startOffset-t.startOffset)}},yo={parse:e.n(async t=>{Ai.clear(),$a.input=[];try{Zr({diagramType:`usecase`,lexer:Xa,parser:$a,entry:e.n(()=>$a.start(),`entry`),visit:e.n(e=>vo.build(e,t),`visit`)},t)}catch(e){Ai.clear();let n=$a.errors[0];if(n){let{token:r}=n,i=Xr(r.startOffset)?r.startOffset:t.length,a=Xr(r.endOffset)?r.endOffset+1:i,o=Xr(r.startLine)?r.startLine:t.slice(0,i).split(/\r\n|\r|\n/).length,s=Math.max(t.lastIndexOf(`
|
|
75
|
+
`,i-1),t.lastIndexOf(`\r`,i-1)),c=Xr(r.startColumn)?r.startColumn:i-s,l=e instanceof Error?e.message:String(e);throw Error(`${l} at line ${o}, column ${c} [${i},${a})`)}throw e}},`parse`)},bo=[`point`,`circle`,`cross`,`extension`],xo={usecaseActor:!0,usecaseActorHollow:!0,usecaseActorAwesome:!0,usecaseActorIcon:!0},So=e.n((e,t)=>{let[n,r]=[e,t].map(e=>e.replace(/[^\w-]+/g,`_`).replace(/^_+|_+$/g,``)||`element`);return`usecase-${n}-${r}`},`usecaseDomId`),Co=e.n(e=>`usecase-${e.replace(/[^\w-]+/g,`_`).replace(/^_+|_+$/g,``)||`element`}`,`usecaseNodeDomId`),wo=e.n((e,t)=>t===`markdown`?i.i(e).map(e=>e.map(e=>e.content).join(` `)).join(`
|
|
76
|
+
`):e,`getAccessibleLabel`),To=e.n(e=>{let t=wo(e.label??e.id,e.labelType);if(xo[e.shape]){let n=e.actorType&&e.actorType!==`normal`?`${e.actorType} `:``;return`${e.business?`business `:``}${n}actor ${t}${e.stereotype?`, stereotype ${e.stereotype}`:``}`}if(e.shape===`note`)return`Note for ${e.noteTargetLabel??e.noteTarget??``}: ${t}`;if(e.shape===`usecaseJsonTable`){let n=(e.jsonRows??[]).map(e=>`${e.accessibleKey}: ${e.value}`).join(`; `);return n?`${t}: ${n}`:t}let n=e.stereotype?`, stereotype ${e.stereotype}`:``;return`${e.business?`business `:``}use case ${t}${n}`},`getUsecaseNodeAccessibleName`),Eo=e.n(e=>`${e.boundaryType} system boundary ${wo(e.label??e.id,e.labelType)}`,`getUsecaseBoundaryAccessibleName`),Do=e.n(e=>e.relationshipType===`note`?``:`${e.relationshipType===`association`&&e.label?`association ${wo(e.label,e.labelType)}`:e.relationshipType} from ${e.sourceLabel} to ${e.targetLabel}`,`getUsecaseEdgeAccessibleName`),Oo=e.n(e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`),`escapePlainLabel`),ko=e.n(e=>e.replace(/([*[\\\]_`])/g,`\\$1`),`escapeMarkdownMarkers`),Ao=e.n((e,t)=>{e.diagramId=t,e.markers=[...bo];for(let t of e.nodes){let e=t;if(e.domId=Co(t.id),t.label!==void 0&&t.labelType===`text`&&(t.label=Oo(t.label)),t.stereotype&&=Oo(t.stereotype),!t.isGroup&&t.shape===`usecaseJsonTable`&&(t.jsonRows=t.jsonRows?.map(e=>({...e,key:Oo(e.key),value:Oo(e.value)}))),!t.isGroup&&(t.shape===`usecaseEllipse`||t.shape===`rect`)&&t.stereotype){let n=t.label??Oo(t.id);t.label=`\xAB${ko(t.stereotype)}\xBB<br/>${t.labelType===`text`?ko(n):n}`,t.labelType=`markdown`,e.hasFoldedStereotype=!0,delete t.stereotype}}for(let t of e.edges)t.label!==void 0&&t.labelType===`text`&&(t.label=Oo(t.label));return e},`prepareUsecaseLayoutData`),jo=e.n((e,n,r)=>{for(let t of n.nodes){let i=typeof t.domId==`string`?t.domId:So(n.diagramId,t.id),a=e.select(`#${i}`),o=t.isGroup?`boundary`:xo[t.shape]?`actor`:t.shape===`note`?`note`:t.shape===`usecaseJsonTable`?`json`:`usecase`,s=r.nodes.get(t.id)??t.id;if(a.attr(`data-usecase-id`,t.id).attr(`data-usecase-kind`,o).attr(`role`,`img`).attr(`aria-label`,s),!t.isGroup&&(t.shape===`usecaseEllipse`||t.shape===`rect`)&&`hasFoldedStereotype`in t&&t.hasFoldedStereotype===!0){let e=a.node(),t=e?.querySelector(`.nodeLabel`),n=t?.querySelector(`p`)??t,r=n?.firstChild;if(n&&r?.nodeType===3){let e=n.ownerDocument.createElement(`span`);e.className=`usecase-stereotype`,n.insertBefore(e,r),e.appendChild(r)}else e?.querySelector(`.label tspan tspan, .label tspan`)?.classList.add(`usecase-stereotype`)}}let i=new Map(n.edges.map(e=>[e.id,e]));e.selectAll(`path[data-et="edge"]`).each(function(){let e=i.get(this.getAttribute(`data-id`)??``);if(!e)return;let a=t.p(this);a.attr(`id`,So(n.diagramId,e.id)).attr(`data-usecase-id`,e.id).attr(`data-usecase-kind`,e.internal?`note-connector`:`relationship`),e.internal?a.attr(`aria-hidden`,`true`):a.attr(`role`,`img`).attr(`aria-label`,r.edges.get(e.id)??e.id)})},`annotateUsecaseElements`),Mo=e.n((e,t)=>{e.style(`--mermaid-usecase-actor-font-size`,`${t.actorFontSize}px`).style(`--mermaid-usecase-actor-font-family`,t.actorFontFamily).style(`--mermaid-usecase-actor-font-weight`,t.actorFontWeight).style(`--mermaid-usecase-font-size`,`${t.usecaseFontSize}px`).style(`--mermaid-usecase-font-family`,t.usecaseFontFamily).style(`--mermaid-usecase-font-weight`,t.usecaseFontWeight)},`applyUsecaseFonts`),No={draw:e.n(async(e,i,a,l)=>{t.m.info(`Drawing usecase diagram (unified)`,i);let{layout:u}=n.b(),d=l.db,f=d.getData(),p=new Map(f.nodes.map(e=>[e.id,wo(e.label??e.id,e.labelType)])),m={nodes:new Map(f.nodes.map(e=>[e.id,e.isGroup?Eo(e):To(e.shape===`note`?{...e,noteTargetLabel:p.get(e.noteTarget??``)}:e)])),edges:new Map(f.edges.map(e=>[e.id,Do({...e,sourceLabel:p.get(e.source)??e.sourceLabel,targetLabel:p.get(e.target)??e.targetLabel})]))},h=o.t(i,f.config.securityLevel);f.layoutAlgorithm=c.i(u),Ao(f,i),Mo(h,f),await c.a(f,h),jo(h,f,m);let g=f.diagramPadding;r._.insertTitle(h,`usecaseDiagramTitleText`,0,d.getDiagramTitle?.()??``),s.t(h,g,`usecaseDiagram`,f.useMaxWidth),Mo(h,f)},`draw`)},Po=e.n(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`),Fo=e.n(e=>{let{theme:t,bkgColorArray:r,borderColorArray:i}=e;if(!a.i(t,i))return``;let o=n.y().usecase?.colorScheme===`rotate`,s=a.o(e.look),c=s===`handDrawn`,l=a.r(r),u=``;for(let e=0;e<a.a(i);e++){let t=i[e],n=l?`fill: ${r[e%r.length]};`:``,a=`[data-look="${s}"][data-color-id="color-${e}"]`;u+=`
|
|
77
|
+
|
|
78
|
+
& ${a}.system-boundary rect.boundary-body,
|
|
79
|
+
& ${a}.system-boundary rect.boundary-tab,
|
|
80
|
+
& ${a}.system-boundary .boundary-body path,
|
|
81
|
+
& ${a}.system-boundary .boundary-tab path {
|
|
82
|
+
stroke: ${t};
|
|
83
|
+
${n}
|
|
84
|
+
}
|
|
85
|
+
`,o&&(u+=`
|
|
86
|
+
|
|
87
|
+
/* Use case bodies -- \`.usecase-element\` covers the ellipse form, the \`[Rect]\` form and
|
|
88
|
+
the business variant.
|
|
89
|
+
|
|
90
|
+
Element selectors only, never a bare \`path\`. Under the handDrawn look roughjs draws
|
|
91
|
+
the body as a *pair* of paths, an outline stroked in the border colour and a hachure
|
|
92
|
+
fill stroked in the background colour, with no class to tell them apart. Stroking
|
|
93
|
+
both repaints the fill lines as border colour and the shape collapses into a solid
|
|
94
|
+
block -- which is what \`.usecase-element path\` did. So handDrawn bodies keep the
|
|
95
|
+
theme's uniform colours, exactly as handDrawn flowchart nodes do. */
|
|
96
|
+
& ${a}.usecase-element ellipse,
|
|
97
|
+
& ${a}.usecase-element rect {
|
|
98
|
+
stroke: ${t};
|
|
99
|
+
${n}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/* The business marker is a single classed path, so it can be reached safely by name --
|
|
103
|
+
without it the marker keeps the uniform border beside a palette-coloured body. No
|
|
104
|
+
\`fill\`: the marker is drawn with \`fill="none"\` and has to stay that way. */
|
|
105
|
+
& ${a}.usecase-element .usecase-business-marker {
|
|
106
|
+
stroke: ${t};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/* Actor glyphs, mirroring the uniform rule further down. The fill goes on the glyph
|
|
110
|
+
group, never on its children, so the hollow variant's own \`fill="none"\` keeps
|
|
111
|
+
winning and a hollow actor stays hollow. Same reason as above for not descending
|
|
112
|
+
into the handDrawn paths. */
|
|
113
|
+
& ${a}.usecase-actor .usecase-actor-shape,
|
|
114
|
+
& ${a}.usecase-actor .usecase-actor-hollow,
|
|
115
|
+
& ${a}.usecase-actor .usecase-actor-awesome,
|
|
116
|
+
& ${a}.usecase-actor .usecase-actor-icon {
|
|
117
|
+
stroke: ${t};
|
|
118
|
+
${n}
|
|
119
|
+
}
|
|
120
|
+
${c?``:`
|
|
121
|
+
/* The group rule above reaches the glyph by inheritance, which the neo look breaks: it
|
|
122
|
+
ships a \`[data-look="neo"].node path { stroke }\` rule that hits the glyph's own paths,
|
|
123
|
+
and a value set directly on the child always beats one inherited from the parent,
|
|
124
|
+
whatever the parent rule's specificity. So name the children too.
|
|
125
|
+
|
|
126
|
+
Emitted for every look *except* handDrawn, where roughjs draws the glyph as an
|
|
127
|
+
outline path plus a hachure fill path stroked in the fill colour, indistinguishable
|
|
128
|
+
in CSS -- stroking both turns a hollow actor into a solid disc. Deliberately no
|
|
129
|
+
\`fill\` either way, so the hollow variant's own \`fill="none"\` keeps winning. */
|
|
130
|
+
& ${a}.usecase-actor .usecase-actor-glyph path,
|
|
131
|
+
& ${a}.usecase-actor .usecase-actor-glyph circle {
|
|
132
|
+
stroke: ${t};
|
|
133
|
+
}
|
|
134
|
+
`}
|
|
135
|
+
`)}return u},`genColor`),Io={parser:yo,db:Ai,renderer:No,styles:e.n(e=>{let t=Po(e),n=a.o(e.look)===`handDrawn`;return`
|
|
136
|
+
${Fo(e)}
|
|
137
|
+
& .usecase-actor {
|
|
138
|
+
color: ${e.actorTextColor??e.primaryTextColor};
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
& .usecase-actor-shape,
|
|
142
|
+
& .usecase-actor-hollow,
|
|
143
|
+
& .usecase-actor-awesome,
|
|
144
|
+
& .usecase-actor-icon {
|
|
145
|
+
fill: ${t.actorBkg};
|
|
146
|
+
stroke: ${t.actorBorder};
|
|
147
|
+
stroke-width: 2px;
|
|
148
|
+
}
|
|
149
|
+
${n?``:`
|
|
150
|
+
/* The rule above colours the glyph group and lets its children inherit, which the neo
|
|
151
|
+
look breaks: it ships a \`[data-look="neo"].node path { stroke }\` rule that lands on
|
|
152
|
+
the glyph's own paths, and a value set directly on a child always beats one inherited
|
|
153
|
+
from its parent, whatever the parent rule's specificity. Since neo is the default look,
|
|
154
|
+
without this every actor renders in the node border colour rather than the actor
|
|
155
|
+
colour the rule above asks for.
|
|
156
|
+
|
|
157
|
+
\`.node\` is in the selector to outrank that neo rule rather than tie with it: both
|
|
158
|
+
would otherwise be one attribute plus one class plus one element, leaving the winner to
|
|
159
|
+
depend on which stylesheet is concatenated last.
|
|
160
|
+
|
|
161
|
+
Stroke only: the hollow variant's own \`fill="none"\` has to keep winning. */
|
|
162
|
+
& .node.usecase-actor .usecase-actor-glyph path,
|
|
163
|
+
& .node.usecase-actor .usecase-actor-glyph circle {
|
|
164
|
+
stroke: ${t.actorBorder};
|
|
165
|
+
}
|
|
166
|
+
`}
|
|
167
|
+
& .usecase-actor .nodeLabel,
|
|
168
|
+
& .actor-label {
|
|
169
|
+
color: ${e.actorTextColor??e.primaryTextColor};
|
|
170
|
+
fill: ${e.actorTextColor??e.primaryTextColor};
|
|
171
|
+
font-family: var(--mermaid-usecase-actor-font-family, ${e.fontFamily});
|
|
172
|
+
font-size: var(--mermaid-usecase-actor-font-size, 14px);
|
|
173
|
+
font-weight: var(--mermaid-usecase-actor-font-weight, normal);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
& .usecase-element ellipse,
|
|
177
|
+
& .usecase-element rect,
|
|
178
|
+
& .usecase-business ellipse,
|
|
179
|
+
& .usecase-business rect {
|
|
180
|
+
fill: ${t.bkg};
|
|
181
|
+
stroke: ${t.border};
|
|
182
|
+
stroke-width: 2px;
|
|
183
|
+
}
|
|
184
|
+
${n?``:`
|
|
185
|
+
/* The same interception the actor glyph hits, one element down: neo ships
|
|
186
|
+
\`[data-look="neo"].node rect { stroke: nodeBorder }\`, which outranks the plain
|
|
187
|
+
\`.usecase-element rect\` above, so a use case written in the \`[Rect]\` form kept the node
|
|
188
|
+
border colour while its ellipse siblings took the role colour. An \`<ellipse>\` has no
|
|
189
|
+
equivalent neo rule and is already correct; restating it here costs nothing and means
|
|
190
|
+
the two forms cannot drift apart again.
|
|
191
|
+
|
|
192
|
+
Qualified with \`[data-look]\` *and* \`.node\` to land strictly above that rule rather than
|
|
193
|
+
tie with it -- on a tie the later stylesheet would win, which is how neo took this in
|
|
194
|
+
the first place. Skipped under handDrawn, where roughjs draws paths and neither element
|
|
195
|
+
exists. */
|
|
196
|
+
& [data-look="${a.o(e.look)}"].node.usecase-element ellipse,
|
|
197
|
+
& [data-look="${a.o(e.look)}"].node.usecase-element rect {
|
|
198
|
+
fill: ${t.bkg};
|
|
199
|
+
stroke: ${t.border};
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/* The business marker is a \`<path>\`, so it loses to \`[data-look="neo"].node path\` the same
|
|
203
|
+
way. No \`fill\`: the marker is drawn with \`fill="none"\` and has to stay that way. */
|
|
204
|
+
& [data-look="${a.o(e.look)}"].node.usecase-element .usecase-business-marker {
|
|
205
|
+
stroke: ${t.border};
|
|
206
|
+
}
|
|
207
|
+
`}
|
|
208
|
+
& .usecase-element .nodeLabel,
|
|
209
|
+
& .usecase-label {
|
|
210
|
+
color: ${e.primaryTextColor};
|
|
211
|
+
fill: ${e.primaryTextColor};
|
|
212
|
+
font-family: var(--mermaid-usecase-font-family, ${e.fontFamily});
|
|
213
|
+
font-size: var(--mermaid-usecase-font-size, 12px);
|
|
214
|
+
font-weight: var(--mermaid-usecase-font-weight, normal);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
& .usecase-stereotype,
|
|
218
|
+
& .usecase-business-marker {
|
|
219
|
+
color: ${e.primaryTextColor};
|
|
220
|
+
fill: ${e.primaryTextColor};
|
|
221
|
+
stroke: ${t.border};
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
& .system-boundary rect.boundary-body,
|
|
225
|
+
& .system-boundary rect.boundary-tab,
|
|
226
|
+
& .system-boundary-package-tab {
|
|
227
|
+
fill: ${t.boundaryBkg};
|
|
228
|
+
stroke: ${t.boundaryBorder};
|
|
229
|
+
stroke-width: 1px;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
& .system-boundary-title text {
|
|
233
|
+
fill: ${e.titleColor??e.primaryTextColor};
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/* Only the span, never the <p> inside it: the renderer puts a user-supplied
|
|
237
|
+
'color' on the span, and that has to stay inheritable by its children. */
|
|
238
|
+
& .system-boundary-title span {
|
|
239
|
+
color: ${e.titleColor??e.primaryTextColor};
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
& .usecase-note {
|
|
243
|
+
fill: ${e.noteBkgColor};
|
|
244
|
+
stroke: ${e.noteBorderColor};
|
|
245
|
+
color: ${e.noteTextColor};
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
& .usecase-note .nodeLabel {
|
|
249
|
+
color: ${e.noteTextColor};
|
|
250
|
+
fill: ${e.noteTextColor};
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
& .usecase-json-table,
|
|
254
|
+
& .usecase-json-table rect,
|
|
255
|
+
& .usecase-json-cell {
|
|
256
|
+
fill: ${e.mainBkg};
|
|
257
|
+
stroke: ${e.nodeBorder??e.primaryColor};
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
& .usecase-json-title,
|
|
261
|
+
& .usecase-json-key,
|
|
262
|
+
& .usecase-json-value {
|
|
263
|
+
color: ${e.primaryTextColor};
|
|
264
|
+
fill: ${e.primaryTextColor};
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
& .relationship {
|
|
268
|
+
fill: none;
|
|
269
|
+
stroke: ${e.lineColor};
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
& .relationship-include,
|
|
273
|
+
& .relationship-extend,
|
|
274
|
+
& .relationship-note {
|
|
275
|
+
stroke-dasharray: 3;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/* Include and extend are both dashed, which is a weak distinction at small sizes. The
|
|
279
|
+
tokens default to \`lineColor\`, so a theme that does not set them is unchanged. */
|
|
280
|
+
& .relationship-include {
|
|
281
|
+
stroke: ${t.includeLine};
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
& .relationship-extend {
|
|
285
|
+
stroke: ${t.extendLine};
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
& .relationship.edge-animation-fast,
|
|
289
|
+
& .relationship.edge-animation-slow {
|
|
290
|
+
stroke-linecap: round;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
& .edgeLabel,
|
|
294
|
+
& .edgeLabel p {
|
|
295
|
+
background-color: ${e.edgeLabelBackground};
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
& .labelBkg {
|
|
299
|
+
background-color: ${e.edgeLabelBackground};
|
|
300
|
+
padding: 0 2px;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
& .edgeLabel .label rect {
|
|
304
|
+
fill: ${e.edgeLabelBackground};
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
& .relationship-label,
|
|
308
|
+
& .edgeLabel {
|
|
309
|
+
color: ${e.primaryTextColor};
|
|
310
|
+
fill: ${e.primaryTextColor};
|
|
311
|
+
font-family: ${e.fontFamily};
|
|
312
|
+
font-size: 10px;
|
|
313
|
+
font-weight: normal;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
& .marker,
|
|
317
|
+
& .marker.point,
|
|
318
|
+
& .marker.circle,
|
|
319
|
+
& .marker.cross {
|
|
320
|
+
fill: ${e.lineColor};
|
|
321
|
+
stroke: ${e.lineColor};
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
& .marker.extension {
|
|
325
|
+
fill: ${e.mainBkg};
|
|
326
|
+
stroke: ${e.lineColor};
|
|
327
|
+
}
|
|
328
|
+
`},`getStyles`)};exports.diagram=Io;
|