@theruansilva/omp-web 2.2.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{CodeViewer-DEVekDfo.js → CodeViewer-B61IQaP0.js} +1 -1
- package/dist/client/assets/{TerminalPanel-CLZRR8T3.js → TerminalPanel-BcxMZQKk.js} +1 -1
- package/dist/client/assets/{UnifiedDiffViewer-DkUYn4xn.js → UnifiedDiffViewer-BnFQlZDg.js} +1 -1
- package/dist/client/assets/{abnfDiagram-O67JEVCF-CN3HoUk0.js → abnfDiagram-O67JEVCF-BCWHgm_-.js} +1 -1
- package/dist/client/assets/{arc-DfCyV39Y.js → arc-BUpZciy9.js} +1 -1
- package/dist/client/assets/{architectureDiagram-NJMV4G6O-B18ZPEpX.js → architectureDiagram-NJMV4G6O-CVWCwiqh.js} +1 -1
- package/dist/client/assets/{blockDiagram-BEXU5L5S-DauyTopu.js → blockDiagram-BEXU5L5S-W5WSJa_J.js} +2 -2
- package/dist/client/assets/{c4Diagram-YGBWAQC7-BzItBhD8.js → c4Diagram-YGBWAQC7-BWpacECA.js} +1 -1
- package/dist/client/assets/channel-ChkqWR3Z.js +1 -0
- package/dist/client/assets/{chunk-2Q5K7J3B-CTeOQu6b.js → chunk-2Q5K7J3B-D0TV4T28.js} +1 -1
- package/dist/client/assets/{chunk-3FUC2YCW-OWYL0CxB.js → chunk-3FUC2YCW-BlkJ2B9v.js} +2 -2
- package/dist/client/assets/{chunk-5VM5RSS4-BPto9x5-.js → chunk-5VM5RSS4-LRh3HbZr.js} +1 -1
- package/dist/client/assets/{chunk-GTNCS2PH-DqPy7R2d.js → chunk-GTNCS2PH-CBiTovUf.js} +1 -1
- package/dist/client/assets/{chunk-GWA4HPMP-C4N-dUua.js → chunk-GWA4HPMP-Dnu3R9yI.js} +1 -1
- package/dist/client/assets/{chunk-JWPE2WC7-C4b1ijjH.js → chunk-JWPE2WC7-C2yjQs6c.js} +1 -1
- package/dist/client/assets/{chunk-NETBCI7D-Ds_9Juid.js → chunk-NETBCI7D-Dxos4L3P.js} +1 -1
- package/dist/client/assets/{chunk-WEXAMYUT-DC9hisqc.js → chunk-WEXAMYUT-DrLvxPom.js} +1 -1
- package/dist/client/assets/{chunk-XXDRQBXY-DZnUPupk.js → chunk-XXDRQBXY-Cub_nego.js} +1 -1
- package/dist/client/assets/{classDiagram-v2-NBCMYWYE-CDSg6Hoa.js → classDiagram-v2-NBCMYWYE-CIe2lhk7.js} +1 -1
- package/dist/client/assets/{cose-bilkent-JH36ORCC-B4ISJxq4.js → cose-bilkent-JH36ORCC-DOGZoTZg.js} +1 -1
- package/dist/client/assets/{cynefin-OW5HDTMX-Dk9BE-CS.js → cynefin-OW5HDTMX-DXF0a63d.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-VND7K2PF-D4LOjD3M.js → cynefinDiagram-VND7K2PF-C_Qmhc8V.js} +1 -1
- package/dist/client/assets/dagre-6A5THRUB-CEhDrD4X.js +4 -0
- package/dist/client/assets/{diagram-22UHCM2B-D_zb_SLQ.js → diagram-22UHCM2B-CgN81sDZ.js} +1 -1
- package/dist/client/assets/{diagram-3UASUU5V-D5rEpDmK.js → diagram-3UASUU5V-Dk1gOSew.js} +1 -1
- package/dist/client/assets/{diagram-ATOU4E4O-BdTFXxOS.js → diagram-ATOU4E4O-C_tcqhr3.js} +1 -1
- package/dist/client/assets/{diagram-CDSNMT55-B8gtHdg9.js → diagram-CDSNMT55-Dj-WM3vk.js} +1 -1
- package/dist/client/assets/{diagram-MLGK6HIB-C-NGINWH.js → diagram-MLGK6HIB-CDowox_d.js} +1 -1
- package/dist/client/assets/{diagram-MPIPVDR6-D3_T-c5C.js → diagram-MPIPVDR6-CaThzNCZ.js} +1 -1
- package/dist/client/assets/{ebnfDiagram-ZINNZB2B-BIASbt52.js → ebnfDiagram-ZINNZB2B-BZbLdwcz.js} +1 -1
- package/dist/client/assets/{elk-276RUBZZ-CuNF0hHg.js → elk-276RUBZZ-DGku1nk-.js} +3 -3
- package/dist/client/assets/{erDiagram-OPXOYQCR-Cmi_qmGj.js → erDiagram-OPXOYQCR-D0nJ53i7.js} +1 -1
- package/dist/client/assets/{flowDiagram-KWPJA3E3-DP-SrXc2.js → flowDiagram-KWPJA3E3-DeB8-O7Y.js} +1 -1
- package/dist/client/assets/{ganttDiagram-FUAMR5RP-olLEnoMM.js → ganttDiagram-FUAMR5RP-CBcW8sXy.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-X574FWY7-uPZ9lEq1.js → gitGraphDiagram-X574FWY7-CC-b8FLq.js} +1 -1
- package/dist/client/assets/graph-D8UmR1vK.js +1 -0
- package/dist/client/assets/{index-D-PvDSJs.js → index-CyN73uMY.js} +369 -362
- package/dist/client/assets/{infoDiagram-VRGFBTTK-D0Q5E5gc.js → infoDiagram-VRGFBTTK-DL3QMN01.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-OU5B5YK6-C21L3hk6.js → ishikawaDiagram-OU5B5YK6-Brt56LtP.js} +1 -1
- package/dist/client/assets/{journeyDiagram-ZHPQQLJL-C9o5XEso.js → journeyDiagram-ZHPQQLJL-Df8VwbDr.js} +1 -1
- package/dist/client/assets/{kanban-definition-PNTS6WVX-BioH9OyY.js → kanban-definition-PNTS6WVX-cVbdWfVg.js} +1 -1
- package/dist/client/assets/{linear-BwJ7-DLx.js → linear-DugbH7BO.js} +1 -1
- package/dist/client/assets/{mindmap-definition-NLK3R4M7-ogoKSGSi.js → mindmap-definition-NLK3R4M7-BDqwqJMJ.js} +1 -1
- package/dist/client/assets/{pegDiagram-GJSIUBJH-Ck2_wE3g.js → pegDiagram-GJSIUBJH-w6CrSKt0.js} +1 -1
- package/dist/client/assets/{pieDiagram-5QR66LMP-C5wm07EA.js → pieDiagram-5QR66LMP-D0utByOI.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-O4NWA36T-UKQ2brr3.js → quadrantDiagram-O4NWA36T-DIAIplx2.js} +1 -1
- package/dist/client/assets/{railroadDiagram-XR7U4H2S-BgY4ABv4.js → railroadDiagram-XR7U4H2S-BX9P-jy7.js} +1 -1
- package/dist/client/assets/{requirementDiagram-PLB6GJNP-B50WsncI.js → requirementDiagram-PLB6GJNP-C55JlmRI.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-IPEJSGJF-BHtyWxOk.js → sankeyDiagram-IPEJSGJF-VeHnKI-a.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-PO4LG4MO-D_kxHIBS.js → sequenceDiagram-PO4LG4MO-CTUoXviF.js} +1 -1
- package/dist/client/assets/{sizeCapture-INFHLROL-MzN60-aT.js → sizeCapture-INFHLROL-DBKjJDUZ.js} +1 -1
- package/dist/client/assets/{stateDiagram-v2-GCMORJYK-CBiPlAo0.js → stateDiagram-v2-GCMORJYK-DzonJh3D.js} +1 -1
- package/dist/client/assets/swimlanes-2SLR337P-Cnsd5mvJ.js +1 -0
- package/dist/client/assets/swimlanesDiagram-TC7HE7FX-iyBCc4Xc.js +8 -0
- package/dist/client/assets/{timeline-definition-EJHVYXUP-BemXf1bb.js → timeline-definition-EJHVYXUP-C9nhaxck.js} +1 -1
- package/dist/client/assets/usecaseDiagram-POWQR4AR-jfXBWSzR.js +370 -0
- package/dist/client/assets/vendor-editor-core-D-5q2tVX.js +49 -0
- package/dist/client/assets/{vendor-editor-languages-pDmyn-oC.js → vendor-editor-languages-B6WRt0aC.js} +1 -1
- package/dist/client/assets/{vennDiagram-UO4OBE2U-2mimeV2G.js → vennDiagram-UO4OBE2U-BigR6haV.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-VNRHLVJA-Bg2MjtpE.js → wardleyDiagram-VNRHLVJA-BXJexKTM.js} +1 -1
- package/dist/client/assets/{xychartDiagram-PMCCYNJV-7_nvdM0t.js → xychartDiagram-PMCCYNJV-HL5cuxsZ.js} +1 -1
- package/dist/client/index.html +3 -3
- package/dist/config.js +11 -12
- package/dist/config.js.map +1 -1
- package/dist/server/configRoutes.js +6 -0
- package/dist/server/configRoutes.js.map +1 -1
- package/dist/shared/apiTypes.d.ts +2 -0
- package/docs/config.md +16 -1
- package/package.json +2 -1
- package/dist/client/assets/_basePickBy-vr4256UX.js +0 -1
- package/dist/client/assets/_baseUniq-CHc60b6y.js +0 -1
- package/dist/client/assets/channel-BeMMNdGw.js +0 -1
- package/dist/client/assets/dagre-6A5THRUB-BdboVbbt.js +0 -4
- package/dist/client/assets/graph-C2De1HlQ.js +0 -1
- package/dist/client/assets/swimlanes-2SLR337P-BCdsVfp-.js +0 -1
- package/dist/client/assets/swimlanesDiagram-TC7HE7FX-Da17CLQY.js +0 -8
- package/dist/client/assets/usecaseDiagram-POWQR4AR-Vqj4Zp6V.js +0 -370
- package/dist/client/assets/vendor-editor-core-BG7M-EQ-.js +0 -10
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
import{g as Oo}from"./chunk-XXDRQBXY-Cub_nego.js";import{s as No}from"./chunk-WEXAMYUT-DrLvxPom.js";import{g as Ei,s as cs,a as Ai,b as ls,t as Io,q as bo,_ as h,D as _t,l as Co,c as yi,p as ko,r as vo,u as _o,j as xo,A as wo,O as Mo,C as Uo,L as Po,E as $o,I as Do,bN as Fo,k as Bo}from"./index-CyN73uMY.js";import"./vendor-editor-core-D-5q2tVX.js";import"./vendor-editor-languages-B6WRt0aC.js";var Si=typeof global=="object"&&global&&global.Object===Object&&global,Go=typeof self=="object"&&self&&self.Object===Object&&self,be=Si||Go||Function("return this")(),he=be.Symbol,Ri=Object.prototype,Wo=Ri.hasOwnProperty,jo=Ri.toString,bt=he?he.toStringTag:void 0;function Ko(t){var e=Wo.call(t,bt),n=t[bt];try{t[bt]=void 0;var s=!0}catch{}var r=jo.call(t);return s&&(e?t[bt]=n:delete t[bt]),r}var zo=Object.prototype,Ho=zo.toString;function Vo(t){return Ho.call(t)}var Yo="[object Null]",Xo="[object Undefined]",cr=he?he.toStringTag:void 0;function Ye(t){return t==null?t===void 0?Xo:Yo:cr&&cr in Object(t)?Ko(t):Vo(t)}function Ae(t){return t!=null&&typeof t=="object"}var Jo="[object Symbol]";function xn(t){return typeof t=="symbol"||Ae(t)&&Ye(t)==Jo}function wn(t,e){for(var n=-1,s=t==null?0:t.length,r=Array(s);++n<s;)r[n]=e(t[n],n,t);return r}var C=Array.isArray,lr=he?he.prototype:void 0,hr=lr?lr.toString:void 0;function Li(t){if(typeof t=="string")return t;if(C(t))return wn(t,Li)+"";if(xn(t))return hr?hr.call(t):"";var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}var qo=/\s/;function Zo(t){for(var e=t.length;e--&&qo.test(t.charAt(e)););return e}var Qo=/^\s+/;function ec(t){return t&&t.slice(0,Zo(t)+1).replace(Qo,"")}function ue(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var ur=NaN,tc=/^[-+]0x[0-9a-f]+$/i,nc=/^0b[01]+$/i,sc=/^0o[0-7]+$/i,rc=parseInt;function ic(t){if(typeof t=="number")return t;if(xn(t))return ur;if(ue(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=ue(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=ec(t);var n=nc.test(t);return n||sc.test(t)?rc(t.slice(2),n?2:8):tc.test(t)?ur:+t}var dr=1/0,ac=17976931348623157e292;function oc(t){if(!t)return t===0?t:0;if(t=ic(t),t===dr||t===-dr){var e=t<0?-1:1;return e*ac}return t===t?t:0}function Mn(t){var e=oc(t),n=e%1;return e===e?n?e-n:e:0}function zt(t){return t}var cc="[object AsyncFunction]",lc="[object Function]",hc="[object GeneratorFunction]",uc="[object Proxy]";function Be(t){if(!ue(t))return!1;var e=Ye(t);return e==lc||e==hc||e==cc||e==uc}var Qn=be["__core-js_shared__"],fr=(function(){var t=/[^.]+$/.exec(Qn&&Qn.keys&&Qn.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function dc(t){return!!fr&&fr in t}var fc=Function.prototype,pc=fc.toString;function rt(t){if(t!=null){try{return pc.call(t)}catch{}try{return t+""}catch{}}return""}var mc=/[\\^$.*+?()[\]{}|]/g,gc=/^\[object .+?Constructor\]$/,Tc=Function.prototype,Ec=Object.prototype,Ac=Tc.toString,yc=Ec.hasOwnProperty,Sc=RegExp("^"+Ac.call(yc).replace(mc,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Rc(t){if(!ue(t)||dc(t))return!1;var e=Be(t)?Sc:gc;return e.test(rt(t))}function Lc(t,e){return t?.[e]}function it(t,e){var n=Lc(t,e);return Rc(n)?n:void 0}var hs=it(be,"WeakMap"),pr=Object.create,Oc=(function(){function t(){}return function(e){if(!ue(e))return{};if(pr)return pr(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}})();function Nc(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function G(){}function Ic(t,e){var n=-1,s=t.length;for(e||(e=Array(s));++n<s;)e[n]=t[n];return e}var bc=800,Cc=16,kc=Date.now;function vc(t){var e=0,n=0;return function(){var s=kc(),r=Cc-(s-n);if(n=s,r>0){if(++e>=bc)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function _c(t){return function(){return t}}var yn=(function(){try{var t=it(Object,"defineProperty");return t({},"",{}),t}catch{}})(),xc=yn?function(t,e){return yn(t,"toString",{configurable:!0,enumerable:!1,value:_c(e),writable:!0})}:zt,wc=vc(xc);function Oi(t,e){for(var n=-1,s=t==null?0:t.length;++n<s&&e(t[n],n,t)!==!1;);return t}function Ni(t,e,n,s){for(var r=t.length,i=n+-1;++i<r;)if(e(t[i],i,t))return i;return-1}function Mc(t){return t!==t}function Uc(t,e,n){for(var s=n-1,r=t.length;++s<r;)if(t[s]===e)return s;return-1}function ks(t,e,n){return e===e?Uc(t,e,n):Ni(t,Mc,n)}function Ii(t,e){var n=t==null?0:t.length;return!!n&&ks(t,e,0)>-1}var Pc=9007199254740991,$c=/^(?:0|[1-9]\d*)$/;function Un(t,e){var n=typeof t;return e=e??Pc,!!e&&(n=="number"||n!="symbol"&&$c.test(t))&&t>-1&&t%1==0&&t<e}function vs(t,e,n){e=="__proto__"&&yn?yn(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function Ht(t,e){return t===e||t!==t&&e!==e}var Dc=Object.prototype,Fc=Dc.hasOwnProperty;function Pn(t,e,n){var s=t[e];(!(Fc.call(t,e)&&Ht(s,n))||n===void 0&&!(e in t))&&vs(t,e,n)}function Vt(t,e,n,s){var r=!n;n||(n={});for(var i=-1,a=e.length;++i<a;){var c=e[i],o=void 0;o===void 0&&(o=t[c]),r?vs(n,c,o):Pn(n,c,o)}return n}var mr=Math.max;function Bc(t,e,n){return e=mr(e===void 0?t.length-1:e,0),function(){for(var s=arguments,r=-1,i=mr(s.length-e,0),a=Array(i);++r<i;)a[r]=s[e+r];r=-1;for(var c=Array(e+1);++r<e;)c[r]=s[r];return c[e]=n(a),Nc(t,this,c)}}function _s(t,e){return wc(Bc(t,e,zt),t+"")}var Gc=9007199254740991;function xs(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Gc}function Ce(t){return t!=null&&xs(t.length)&&!Be(t)}function bi(t,e,n){if(!ue(n))return!1;var s=typeof e;return(s=="number"?Ce(n)&&Un(e,n.length):s=="string"&&e in n)?Ht(n[e],t):!1}function Wc(t){return _s(function(e,n){var s=-1,r=n.length,i=r>1?n[r-1]:void 0,a=r>2?n[2]:void 0;for(i=t.length>3&&typeof i=="function"?(r--,i):void 0,a&&bi(n[0],n[1],a)&&(i=r<3?void 0:i,r=1),e=Object(e);++s<r;){var c=n[s];c&&t(e,c,s,i)}return e})}var jc=Object.prototype;function Yt(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||jc;return t===n}function Kc(t,e){for(var n=-1,s=Array(t);++n<t;)s[n]=e(n);return s}var zc="[object Arguments]";function gr(t){return Ae(t)&&Ye(t)==zc}var Ci=Object.prototype,Hc=Ci.hasOwnProperty,Vc=Ci.propertyIsEnumerable,$n=gr((function(){return arguments})())?gr:function(t){return Ae(t)&&Hc.call(t,"callee")&&!Vc.call(t,"callee")};function Yc(){return!1}var ki=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Tr=ki&&typeof module=="object"&&module&&!module.nodeType&&module,Xc=Tr&&Tr.exports===ki,Er=Xc?be.Buffer:void 0,Jc=Er?Er.isBuffer:void 0,Gt=Jc||Yc,qc="[object Arguments]",Zc="[object Array]",Qc="[object Boolean]",el="[object Date]",tl="[object Error]",nl="[object Function]",sl="[object Map]",rl="[object Number]",il="[object Object]",al="[object RegExp]",ol="[object Set]",cl="[object String]",ll="[object WeakMap]",hl="[object ArrayBuffer]",ul="[object DataView]",dl="[object Float32Array]",fl="[object Float64Array]",pl="[object Int8Array]",ml="[object Int16Array]",gl="[object Int32Array]",Tl="[object Uint8Array]",El="[object Uint8ClampedArray]",Al="[object Uint16Array]",yl="[object Uint32Array]",x={};x[dl]=x[fl]=x[pl]=x[ml]=x[gl]=x[Tl]=x[El]=x[Al]=x[yl]=!0;x[qc]=x[Zc]=x[hl]=x[Qc]=x[ul]=x[el]=x[tl]=x[nl]=x[sl]=x[rl]=x[il]=x[al]=x[ol]=x[cl]=x[ll]=!1;function Sl(t){return Ae(t)&&xs(t.length)&&!!x[Ye(t)]}function Dn(t){return function(e){return t(e)}}var vi=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ft=vi&&typeof module=="object"&&module&&!module.nodeType&&module,Rl=Ft&&Ft.exports===vi,es=Rl&&Si.process,He=(function(){try{var t=Ft&&Ft.require&&Ft.require("util").types;return t||es&&es.binding&&es.binding("util")}catch{}})(),Ar=He&&He.isTypedArray,ws=Ar?Dn(Ar):Sl,Ll=Object.prototype,Ol=Ll.hasOwnProperty;function _i(t,e){var n=C(t),s=!n&&$n(t),r=!n&&!s&&Gt(t),i=!n&&!s&&!r&&ws(t),a=n||s||r||i,c=a?Kc(t.length,String):[],o=c.length;for(var l in t)(e||Ol.call(t,l))&&!(a&&(l=="length"||r&&(l=="offset"||l=="parent")||i&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||Un(l,o)))&&c.push(l);return c}function xi(t,e){return function(n){return t(e(n))}}var Nl=xi(Object.keys,Object),Il=Object.prototype,bl=Il.hasOwnProperty;function wi(t){if(!Yt(t))return Nl(t);var e=[];for(var n in Object(t))bl.call(t,n)&&n!="constructor"&&e.push(n);return e}function de(t){return Ce(t)?_i(t):wi(t)}var Cl=Object.prototype,kl=Cl.hasOwnProperty,te=Wc(function(t,e){if(Yt(e)||Ce(e)){Vt(e,de(e),t);return}for(var n in e)kl.call(e,n)&&Pn(t,n,e[n])});function vl(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}var _l=Object.prototype,xl=_l.hasOwnProperty;function wl(t){if(!ue(t))return vl(t);var e=Yt(t),n=[];for(var s in t)s=="constructor"&&(e||!xl.call(t,s))||n.push(s);return n}function Ms(t){return Ce(t)?_i(t,!0):wl(t)}var Ml=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ul=/^\w*$/;function Us(t,e){if(C(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||xn(t)?!0:Ul.test(t)||!Ml.test(t)||e!=null&&t in Object(e)}var Wt=it(Object,"create");function Pl(){this.__data__=Wt?Wt(null):{},this.size=0}function $l(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Dl="__lodash_hash_undefined__",Fl=Object.prototype,Bl=Fl.hasOwnProperty;function Gl(t){var e=this.__data__;if(Wt){var n=e[t];return n===Dl?void 0:n}return Bl.call(e,t)?e[t]:void 0}var Wl=Object.prototype,jl=Wl.hasOwnProperty;function Kl(t){var e=this.__data__;return Wt?e[t]!==void 0:jl.call(e,t)}var zl="__lodash_hash_undefined__";function Hl(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Wt&&e===void 0?zl:e,this}function tt(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var s=t[e];this.set(s[0],s[1])}}tt.prototype.clear=Pl;tt.prototype.delete=$l;tt.prototype.get=Gl;tt.prototype.has=Kl;tt.prototype.set=Hl;function Vl(){this.__data__=[],this.size=0}function Fn(t,e){for(var n=t.length;n--;)if(Ht(t[n][0],e))return n;return-1}var Yl=Array.prototype,Xl=Yl.splice;function Jl(t){var e=this.__data__,n=Fn(e,t);if(n<0)return!1;var s=e.length-1;return n==s?e.pop():Xl.call(e,n,1),--this.size,!0}function ql(t){var e=this.__data__,n=Fn(e,t);return n<0?void 0:e[n][1]}function Zl(t){return Fn(this.__data__,t)>-1}function Ql(t,e){var n=this.__data__,s=Fn(n,t);return s<0?(++this.size,n.push([t,e])):n[s][1]=e,this}function Ge(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var s=t[e];this.set(s[0],s[1])}}Ge.prototype.clear=Vl;Ge.prototype.delete=Jl;Ge.prototype.get=ql;Ge.prototype.has=Zl;Ge.prototype.set=Ql;var jt=it(be,"Map");function eh(){this.size=0,this.__data__={hash:new tt,map:new(jt||Ge),string:new tt}}function th(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function Bn(t,e){var n=t.__data__;return th(e)?n[typeof e=="string"?"string":"hash"]:n.map}function nh(t){var e=Bn(this,t).delete(t);return this.size-=e?1:0,e}function sh(t){return Bn(this,t).get(t)}function rh(t){return Bn(this,t).has(t)}function ih(t,e){var n=Bn(this,t),s=n.size;return n.set(t,e),this.size+=n.size==s?0:1,this}function We(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var s=t[e];this.set(s[0],s[1])}}We.prototype.clear=eh;We.prototype.delete=nh;We.prototype.get=sh;We.prototype.has=rh;We.prototype.set=ih;var ah="Expected a function";function Ps(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(ah);var n=function(){var s=arguments,r=e?e.apply(this,s):s[0],i=n.cache;if(i.has(r))return i.get(r);var a=t.apply(this,s);return n.cache=i.set(r,a)||i,a};return n.cache=new(Ps.Cache||We),n}Ps.Cache=We;var oh=500;function ch(t){var e=Ps(t,function(s){return n.size===oh&&n.clear(),s}),n=e.cache;return e}var lh=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,hh=/\\(\\)?/g,uh=ch(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(lh,function(n,s,r,i){e.push(r?i.replace(hh,"$1"):s||n)}),e});function dh(t){return t==null?"":Li(t)}function Gn(t,e){return C(t)?t:Us(t,e)?[t]:uh(dh(t))}function Xt(t){if(typeof t=="string"||xn(t))return t;var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function $s(t,e){e=Gn(e,t);for(var n=0,s=e.length;t!=null&&n<s;)t=t[Xt(e[n++])];return n&&n==s?t:void 0}function fh(t,e,n){var s=t==null?void 0:$s(t,e);return s===void 0?n:s}function Ds(t,e){for(var n=-1,s=e.length,r=t.length;++n<s;)t[r+n]=e[n];return t}var yr=he?he.isConcatSpreadable:void 0;function ph(t){return C(t)||$n(t)||!!(yr&&t&&t[yr])}function Fs(t,e,n,s,r){var i=-1,a=t.length;for(n||(n=ph),r||(r=[]);++i<a;){var c=t[i];n(c)?Ds(r,c):s||(r[r.length]=c)}return r}function Te(t){var e=t==null?0:t.length;return e?Fs(t):[]}var Mi=xi(Object.getPrototypeOf,Object);function Ui(t,e,n){var s=-1,r=t.length;e<0&&(e=-e>r?0:r+e),n=n>r?r:n,n<0&&(n+=r),r=e>n?0:n-e>>>0,e>>>=0;for(var i=Array(r);++s<r;)i[s]=t[s+e];return i}function mh(t,e,n,s){var r=-1,i=t==null?0:t.length;for(s&&i&&(n=t[++r]);++r<i;)n=e(n,t[r],r,t);return n}function gh(){this.__data__=new Ge,this.size=0}function Th(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}function Eh(t){return this.__data__.get(t)}function Ah(t){return this.__data__.has(t)}var yh=200;function Sh(t,e){var n=this.__data__;if(n instanceof Ge){var s=n.__data__;if(!jt||s.length<yh-1)return s.push([t,e]),this.size=++n.size,this;n=this.__data__=new We(s)}return n.set(t,e),this.size=n.size,this}function Ie(t){var e=this.__data__=new Ge(t);this.size=e.size}Ie.prototype.clear=gh;Ie.prototype.delete=Th;Ie.prototype.get=Eh;Ie.prototype.has=Ah;Ie.prototype.set=Sh;function Rh(t,e){return t&&Vt(e,de(e),t)}function Lh(t,e){return t&&Vt(e,Ms(e),t)}var Pi=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Sr=Pi&&typeof module=="object"&&module&&!module.nodeType&&module,Oh=Sr&&Sr.exports===Pi,Rr=Oh?be.Buffer:void 0,Lr=Rr?Rr.allocUnsafe:void 0;function Nh(t,e){var n=t.length,s=Lr?Lr(n):new t.constructor(n);return t.copy(s),s}function Bs(t,e){for(var n=-1,s=t==null?0:t.length,r=0,i=[];++n<s;){var a=t[n];e(a,n,t)&&(i[r++]=a)}return i}function $i(){return[]}var Ih=Object.prototype,bh=Ih.propertyIsEnumerable,Or=Object.getOwnPropertySymbols,Gs=Or?function(t){return t==null?[]:(t=Object(t),Bs(Or(t),function(e){return bh.call(t,e)}))}:$i;function Ch(t,e){return Vt(t,Gs(t),e)}var kh=Object.getOwnPropertySymbols,Di=kh?function(t){for(var e=[];t;)Ds(e,Gs(t)),t=Mi(t);return e}:$i;function vh(t,e){return Vt(t,Di(t),e)}function Fi(t,e,n){var s=e(t);return C(t)?s:Ds(s,n(t))}function us(t){return Fi(t,de,Gs)}function _h(t){return Fi(t,Ms,Di)}var ds=it(be,"DataView"),fs=it(be,"Promise"),ht=it(be,"Set"),Nr="[object Map]",xh="[object Object]",Ir="[object Promise]",br="[object Set]",Cr="[object WeakMap]",kr="[object DataView]",wh=rt(ds),Mh=rt(jt),Uh=rt(fs),Ph=rt(ht),$h=rt(hs),ce=Ye;(ds&&ce(new ds(new ArrayBuffer(1)))!=kr||jt&&ce(new jt)!=Nr||fs&&ce(fs.resolve())!=Ir||ht&&ce(new ht)!=br||hs&&ce(new hs)!=Cr)&&(ce=function(t){var e=Ye(t),n=e==xh?t.constructor:void 0,s=n?rt(n):"";if(s)switch(s){case wh:return kr;case Mh:return Nr;case Uh:return Ir;case Ph:return br;case $h:return Cr}return e});var Dh=Object.prototype,Fh=Dh.hasOwnProperty;function Bh(t){var e=t.length,n=new t.constructor(e);return e&&typeof t[0]=="string"&&Fh.call(t,"index")&&(n.index=t.index,n.input=t.input),n}var Sn=be.Uint8Array;function Gh(t){var e=new t.constructor(t.byteLength);return new Sn(e).set(new Sn(t)),e}function Wh(t,e){var n=t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}var jh=/\w*$/;function Kh(t){var e=new t.constructor(t.source,jh.exec(t));return e.lastIndex=t.lastIndex,e}var vr=he?he.prototype:void 0,_r=vr?vr.valueOf:void 0;function zh(t){return _r?Object(_r.call(t)):{}}function Hh(t,e){var n=t.buffer;return new t.constructor(n,t.byteOffset,t.length)}var Vh="[object Boolean]",Yh="[object Date]",Xh="[object Map]",Jh="[object Number]",qh="[object RegExp]",Zh="[object Set]",Qh="[object String]",eu="[object Symbol]",tu="[object ArrayBuffer]",nu="[object DataView]",su="[object Float32Array]",ru="[object Float64Array]",iu="[object Int8Array]",au="[object Int16Array]",ou="[object Int32Array]",cu="[object Uint8Array]",lu="[object Uint8ClampedArray]",hu="[object Uint16Array]",uu="[object Uint32Array]";function du(t,e,n){var s=t.constructor;switch(e){case tu:return Gh(t);case Vh:case Yh:return new s(+t);case nu:return Wh(t);case su:case ru:case iu:case au:case ou:case cu:case lu:case hu:case uu:return Hh(t);case Xh:return new s;case Jh:case Qh:return new s(t);case qh:return Kh(t);case Zh:return new s;case eu:return zh(t)}}function fu(t){return typeof t.constructor=="function"&&!Yt(t)?Oc(Mi(t)):{}}var pu="[object Map]";function mu(t){return Ae(t)&&ce(t)==pu}var xr=He&&He.isMap,gu=xr?Dn(xr):mu,Tu="[object Set]";function Eu(t){return Ae(t)&&ce(t)==Tu}var wr=He&&He.isSet,Au=wr?Dn(wr):Eu,yu=2,Bi="[object Arguments]",Su="[object Array]",Ru="[object Boolean]",Lu="[object Date]",Ou="[object Error]",Gi="[object Function]",Nu="[object GeneratorFunction]",Iu="[object Map]",bu="[object Number]",Wi="[object Object]",Cu="[object RegExp]",ku="[object Set]",vu="[object String]",_u="[object Symbol]",xu="[object WeakMap]",wu="[object ArrayBuffer]",Mu="[object DataView]",Uu="[object Float32Array]",Pu="[object Float64Array]",$u="[object Int8Array]",Du="[object Int16Array]",Fu="[object Int32Array]",Bu="[object Uint8Array]",Gu="[object Uint8ClampedArray]",Wu="[object Uint16Array]",ju="[object Uint32Array]",v={};v[Bi]=v[Su]=v[wu]=v[Mu]=v[Ru]=v[Lu]=v[Uu]=v[Pu]=v[$u]=v[Du]=v[Fu]=v[Iu]=v[bu]=v[Wi]=v[Cu]=v[ku]=v[vu]=v[_u]=v[Bu]=v[Gu]=v[Wu]=v[ju]=!0;v[Ou]=v[Gi]=v[xu]=!1;function cn(t,e,n,s,r,i){var a,c=e&yu;if(a!==void 0)return a;if(!ue(t))return t;var o=C(t);if(o)return a=Bh(t),Ic(t,a);var l=ce(t),d=l==Gi||l==Nu;if(Gt(t))return Nh(t);if(l==Wi||l==Bi||d&&!r)return a=d?{}:fu(t),c?vh(t,Lh(a,t)):Ch(t,Rh(a,t));if(!v[l])return r?t:{};a=du(t,l),i||(i=new Ie);var u=i.get(t);if(u)return u;i.set(t,a),Au(t)?t.forEach(function(T){a.add(cn(T,e,n,T,t,i))}):gu(t)&&t.forEach(function(T,y){a.set(y,cn(T,e,n,y,t,i))});var f=us,m=o?void 0:f(t);return Oi(m||t,function(T,y){m&&(y=T,T=t[y]),Pn(a,y,cn(T,e,n,y,t,i))}),a}var Ku=4;function z(t){return cn(t,Ku)}function Jt(t){for(var e=-1,n=t==null?0:t.length,s=0,r=[];++e<n;){var i=t[e];i&&(r[s++]=i)}return r}var zu="__lodash_hash_undefined__";function Hu(t){return this.__data__.set(t,zu),this}function Vu(t){return this.__data__.has(t)}function Et(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new We;++e<n;)this.add(t[e])}Et.prototype.add=Et.prototype.push=Hu;Et.prototype.has=Vu;function ji(t,e){for(var n=-1,s=t==null?0:t.length;++n<s;)if(e(t[n],n,t))return!0;return!1}function Ws(t,e){return t.has(e)}var Yu=1,Xu=2;function Ki(t,e,n,s,r,i){var a=n&Yu,c=t.length,o=e.length;if(c!=o&&!(a&&o>c))return!1;var l=i.get(t),d=i.get(e);if(l&&d)return l==e&&d==t;var u=-1,f=!0,m=n&Xu?new Et:void 0;for(i.set(t,e),i.set(e,t);++u<c;){var T=t[u],y=e[u];if(s)var I=a?s(y,T,u,e,t,i):s(T,y,u,t,e,i);if(I!==void 0){if(I)continue;f=!1;break}if(m){if(!ji(e,function(A,g){if(!Ws(m,g)&&(T===A||r(T,A,n,s,i)))return m.push(g)})){f=!1;break}}else if(!(T===y||r(T,y,n,s,i))){f=!1;break}}return i.delete(t),i.delete(e),f}function Ju(t){var e=-1,n=Array(t.size);return t.forEach(function(s,r){n[++e]=[r,s]}),n}function js(t){var e=-1,n=Array(t.size);return t.forEach(function(s){n[++e]=s}),n}var qu=1,Zu=2,Qu="[object Boolean]",ed="[object Date]",td="[object Error]",nd="[object Map]",sd="[object Number]",rd="[object RegExp]",id="[object Set]",ad="[object String]",od="[object Symbol]",cd="[object ArrayBuffer]",ld="[object DataView]",Mr=he?he.prototype:void 0,ts=Mr?Mr.valueOf:void 0;function hd(t,e,n,s,r,i,a){switch(n){case ld:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case cd:return!(t.byteLength!=e.byteLength||!i(new Sn(t),new Sn(e)));case Qu:case ed:case sd:return Ht(+t,+e);case td:return t.name==e.name&&t.message==e.message;case rd:case ad:return t==e+"";case nd:var c=Ju;case id:var o=s&qu;if(c||(c=js),t.size!=e.size&&!o)return!1;var l=a.get(t);if(l)return l==e;s|=Zu,a.set(t,e);var d=Ki(c(t),c(e),s,r,i,a);return a.delete(t),d;case od:if(ts)return ts.call(t)==ts.call(e)}return!1}var ud=1,dd=Object.prototype,fd=dd.hasOwnProperty;function pd(t,e,n,s,r,i){var a=n&ud,c=us(t),o=c.length,l=us(e),d=l.length;if(o!=d&&!a)return!1;for(var u=o;u--;){var f=c[u];if(!(a?f in e:fd.call(e,f)))return!1}var m=i.get(t),T=i.get(e);if(m&&T)return m==e&&T==t;var y=!0;i.set(t,e),i.set(e,t);for(var I=a;++u<o;){f=c[u];var A=t[f],g=e[f];if(s)var p=a?s(g,A,f,e,t,i):s(A,g,f,t,e,i);if(!(p===void 0?A===g||r(A,g,n,s,i):p)){y=!1;break}I||(I=f=="constructor")}if(y&&!I){var E=t.constructor,k=e.constructor;E!=k&&"constructor"in t&&"constructor"in e&&!(typeof E=="function"&&E instanceof E&&typeof k=="function"&&k instanceof k)&&(y=!1)}return i.delete(t),i.delete(e),y}var md=1,Ur="[object Arguments]",Pr="[object Array]",nn="[object Object]",gd=Object.prototype,$r=gd.hasOwnProperty;function Td(t,e,n,s,r,i){var a=C(t),c=C(e),o=a?Pr:ce(t),l=c?Pr:ce(e);o=o==Ur?nn:o,l=l==Ur?nn:l;var d=o==nn,u=l==nn,f=o==l;if(f&&Gt(t)){if(!Gt(e))return!1;a=!0,d=!1}if(f&&!d)return i||(i=new Ie),a||ws(t)?Ki(t,e,n,s,r,i):hd(t,e,o,n,s,r,i);if(!(n&md)){var m=d&&$r.call(t,"__wrapped__"),T=u&&$r.call(e,"__wrapped__");if(m||T){var y=m?t.value():t,I=T?e.value():e;return i||(i=new Ie),r(y,I,n,s,i)}}return f?(i||(i=new Ie),pd(t,e,n,s,r,i)):!1}function Ks(t,e,n,s,r){return t===e?!0:t==null||e==null||!Ae(t)&&!Ae(e)?t!==t&&e!==e:Td(t,e,n,s,Ks,r)}var Ed=1,Ad=2;function yd(t,e,n,s){var r=n.length,i=r;if(t==null)return!i;for(t=Object(t);r--;){var a=n[r];if(a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++r<i;){a=n[r];var c=a[0],o=t[c],l=a[1];if(a[2]){if(o===void 0&&!(c in t))return!1}else{var d=new Ie,u;if(!(u===void 0?Ks(l,o,Ed|Ad,s,d):u))return!1}}return!0}function zi(t){return t===t&&!ue(t)}function Sd(t){for(var e=de(t),n=e.length;n--;){var s=e[n],r=t[s];e[n]=[s,r,zi(r)]}return e}function Hi(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}function Rd(t){var e=Sd(t);return e.length==1&&e[0][2]?Hi(e[0][0],e[0][1]):function(n){return n===t||yd(n,t,e)}}function Ld(t,e){return t!=null&&e in Object(t)}function Vi(t,e,n){e=Gn(e,t);for(var s=-1,r=e.length,i=!1;++s<r;){var a=Xt(e[s]);if(!(i=t!=null&&n(t,a)))break;t=t[a]}return i||++s!=r?i:(r=t==null?0:t.length,!!r&&xs(r)&&Un(a,r)&&(C(t)||$n(t)))}function Od(t,e){return t!=null&&Vi(t,e,Ld)}var Nd=1,Id=2;function bd(t,e){return Us(t)&&zi(e)?Hi(Xt(t),e):function(n){var s=fh(n,t);return s===void 0&&s===e?Od(n,t):Ks(e,s,Nd|Id)}}function Cd(t){return function(e){return e?.[t]}}function kd(t){return function(e){return $s(e,t)}}function vd(t){return Us(t)?Cd(Xt(t)):kd(t)}function ke(t){return typeof t=="function"?t:t==null?zt:typeof t=="object"?C(t)?bd(t[0],t[1]):Rd(t):vd(t)}function _d(t,e,n,s){for(var r=-1,i=t==null?0:t.length;++r<i;){var a=t[r];e(s,a,n(a),t)}return s}function xd(t){return function(e,n,s){for(var r=-1,i=Object(e),a=s(e),c=a.length;c--;){var o=a[++r];if(n(i[o],o,i)===!1)break}return e}}var wd=xd();function Md(t,e){return t&&wd(t,e,de)}function Ud(t,e){return function(n,s){if(n==null)return n;if(!Ce(n))return t(n,s);for(var r=n.length,i=-1,a=Object(n);++i<r&&s(a[i],i,a)!==!1;);return n}}var at=Ud(Md);function Pd(t,e,n,s){return at(t,function(r,i,a){e(s,r,n(r),a)}),s}function $d(t,e){return function(n,s){var r=C(n)?_d:Pd,i=e?e():{};return r(n,t,ke(s),i)}}var Yi=Object.prototype,Dd=Yi.hasOwnProperty,zs=_s(function(t,e){t=Object(t);var n=-1,s=e.length,r=s>2?e[2]:void 0;for(r&&bi(e[0],e[1],r)&&(s=1);++n<s;)for(var i=e[n],a=Ms(i),c=-1,o=a.length;++c<o;){var l=a[c],d=t[l];(d===void 0||Ht(d,Yi[l])&&!Dd.call(t,l))&&(t[l]=i[l])}return t});function Dr(t){return Ae(t)&&Ce(t)}var Fd=200;function Bd(t,e,n,s){var r=-1,i=Ii,a=!0,c=t.length,o=[],l=e.length;if(!c)return o;e.length>=Fd&&(i=Ws,a=!1,e=new Et(e));e:for(;++r<c;){var d=t[r],u=d;if(d=d!==0?d:0,a&&u===u){for(var f=l;f--;)if(e[f]===u)continue e;o.push(d)}else i(e,u,s)||o.push(d)}return o}var Wn=_s(function(t,e){return Dr(t)?Bd(t,Fs(e,1,Dr,!0)):[]});function nt(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}function K(t,e,n){var s=t==null?0:t.length;return s?(e=e===void 0?1:Mn(e),Ui(t,e<0?0:e,s)):[]}function Kt(t,e,n){var s=t==null?0:t.length;return s?(e=e===void 0?1:Mn(e),e=s-e,Ui(t,0,e<0?0:e)):[]}function Gd(t){return typeof t=="function"?t:zt}function O(t,e){var n=C(t)?Oi:at;return n(t,Gd(e))}function Wd(t,e){for(var n=-1,s=t==null?0:t.length;++n<s;)if(!e(t[n],n,t))return!1;return!0}function jd(t,e){var n=!0;return at(t,function(s,r,i){return n=!!e(s,r,i),n}),n}function Ee(t,e,n){var s=C(t)?Wd:jd;return s(t,ke(e))}function Xi(t,e){var n=[];return at(t,function(s,r,i){e(s,r,i)&&n.push(s)}),n}function fe(t,e){var n=C(t)?Bs:Xi;return n(t,ke(e))}function Kd(t){return function(e,n,s){var r=Object(e);if(!Ce(e)){var i=ke(n);e=de(e),n=function(c){return i(r[c],c,r)}}var a=t(e,n,s);return a>-1?r[i?e[a]:a]:void 0}}var zd=Math.max;function Hd(t,e,n){var s=t==null?0:t.length;if(!s)return-1;var r=n==null?0:Mn(n);return r<0&&(r=zd(s+r,0)),Ni(t,ke(e),r)}var At=Kd(Hd);function ye(t){return t&&t.length?t[0]:void 0}function Vd(t,e){var n=-1,s=Ce(t)?Array(t.length):[];return at(t,function(r,i,a){s[++n]=e(r,i,a)}),s}function S(t,e){var n=C(t)?wn:Vd;return n(t,ke(e))}function le(t,e){return Fs(S(t,e))}var Yd=Object.prototype,Xd=Yd.hasOwnProperty,Jd=$d(function(t,e,n){Xd.call(t,n)?t[n].push(e):vs(t,n,[e])}),qd=Object.prototype,Zd=qd.hasOwnProperty;function Qd(t,e){return t!=null&&Zd.call(t,e)}function L(t,e){return t!=null&&Vi(t,e,Qd)}var ef="[object String]";function Q(t){return typeof t=="string"||!C(t)&&Ae(t)&&Ye(t)==ef}function tf(t,e){return wn(e,function(n){return t[n]})}function F(t){return t==null?[]:tf(t,de(t))}var nf=Math.max;function J(t,e,n,s){t=Ce(t)?t:F(t),n=n?Mn(n):0;var r=t.length;return n<0&&(n=nf(r+n,0)),Q(t)?n<=r&&t.indexOf(e,n)>-1:!!r&&ks(t,e,n)>-1}function Fr(t,e,n){var s=t==null?0:t.length;if(!s)return-1;var r=0;return ks(t,e,r)}var sf="[object Map]",rf="[object Set]",af=Object.prototype,of=af.hasOwnProperty;function _(t){if(t==null)return!0;if(Ce(t)&&(C(t)||typeof t=="string"||typeof t.splice=="function"||Gt(t)||ws(t)||$n(t)))return!t.length;var e=ce(t);if(e==sf||e==rf)return!t.size;if(Yt(t))return!wi(t).length;for(var n in t)if(of.call(t,n))return!1;return!0}var cf="[object RegExp]";function lf(t){return Ae(t)&&Ye(t)==cf}var Br=He&&He.isRegExp,Pe=Br?Dn(Br):lf;function $e(t){return t===void 0}var hf="Expected a function";function uf(t){if(typeof t!="function")throw new TypeError(hf);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}function df(t,e,n,s){if(!ue(t))return t;e=Gn(e,t);for(var r=-1,i=e.length,a=i-1,c=t;c!=null&&++r<i;){var o=Xt(e[r]),l=n;if(o==="__proto__"||o==="constructor"||o==="prototype")return t;if(r!=a){var d=c[o];l=void 0,l===void 0&&(l=ue(d)?d:Un(e[r+1])?[]:{})}Pn(c,o,l),c=c[o]}return t}function ff(t,e,n){for(var s=-1,r=e.length,i={};++s<r;){var a=e[s],c=$s(t,a);n(c,a)&&df(i,Gn(a,t),c)}return i}function Se(t,e){if(t==null)return{};var n=wn(_h(t),function(s){return[s]});return e=ke(e),ff(t,n,function(s,r){return e(s,r[0])})}function pf(t,e,n,s,r){return r(t,function(i,a,c){n=s?(s=!1,i):e(n,i,a,c)}),n}function ne(t,e,n){var s=C(t)?mh:pf,r=arguments.length<3;return s(t,ke(e),n,r,at)}function jn(t,e){var n=C(t)?Bs:Xi;return n(t,uf(ke(e)))}function mf(t,e){var n;return at(t,function(s,r,i){return n=e(s,r,i),!n}),!!n}function Ji(t,e,n){var s=C(t)?ji:mf;return s(t,ke(e))}var gf=1/0,Tf=ht&&1/js(new ht([,-0]))[1]==gf?function(t){return new ht(t)}:G,Ef=200;function Af(t,e,n){var s=-1,r=Ii,i=t.length,a=!0,c=[],o=c;if(i>=Ef){var l=Tf(t);if(l)return js(l);a=!1,r=Ws,o=new Et}else o=c;e:for(;++s<i;){var d=t[s],u=d;if(d=d!==0?d:0,a&&u===u){for(var f=o.length;f--;)if(o[f]===u)continue e;c.push(d)}else r(o,u,n)||(o!==c&&o.push(u),c.push(d))}return c}function Hs(t){return t&&t.length?Af(t):[]}function ps(t){console&&console.error&&console.error(`Error: ${t}`)}function qi(t){console&&console.warn&&console.warn(`Warning: ${t}`)}function Zi(t){const e=new Date().getTime(),n=t();return{time:new Date().getTime()-e,value:n}}function Qi(t){function e(){}e.prototype=t;const n=new e;function s(){return typeof n.bar}return s(),s(),t}function yf(t){return Sf(t)?t.LABEL:t.name}function Sf(t){return Q(t.LABEL)&&t.LABEL!==""}class ve{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),O(this.definition,n=>{n.accept(e)})}}class se extends ve{constructor(e){super([]),this.idx=1,te(this,Se(e,n=>n!==void 0))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}}class yt extends ve{constructor(e){super(e.definition),this.orgText="",te(this,Se(e,n=>n!==void 0))}}class ee extends ve{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,te(this,Se(e,n=>n!==void 0))}}class Z extends ve{constructor(e){super(e.definition),this.idx=1,te(this,Se(e,n=>n!==void 0))}}class _e extends ve{constructor(e){super(e.definition),this.idx=1,te(this,Se(e,n=>n!==void 0))}}class xe extends ve{constructor(e){super(e.definition),this.idx=1,te(this,Se(e,n=>n!==void 0))}}class B extends ve{constructor(e){super(e.definition),this.idx=1,te(this,Se(e,n=>n!==void 0))}}class Re extends ve{constructor(e){super(e.definition),this.idx=1,te(this,Se(e,n=>n!==void 0))}}class Le extends ve{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,te(this,Se(e,n=>n!==void 0))}}class M{constructor(e){this.idx=1,te(this,Se(e,n=>n!==void 0))}accept(e){e.visit(this)}}function Rf(t){return S(t,ln)}function ln(t){function e(n){return S(n,ln)}if(t instanceof se){const n={type:"NonTerminal",name:t.nonTerminalName,idx:t.idx};return Q(t.label)&&(n.label=t.label),n}else{if(t instanceof ee)return{type:"Alternative",definition:e(t.definition)};if(t instanceof Z)return{type:"Option",idx:t.idx,definition:e(t.definition)};if(t instanceof _e)return{type:"RepetitionMandatory",idx:t.idx,definition:e(t.definition)};if(t instanceof xe)return{type:"RepetitionMandatoryWithSeparator",idx:t.idx,separator:ln(new M({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof Re)return{type:"RepetitionWithSeparator",idx:t.idx,separator:ln(new M({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof B)return{type:"Repetition",idx:t.idx,definition:e(t.definition)};if(t instanceof Le)return{type:"Alternation",idx:t.idx,definition:e(t.definition)};if(t instanceof M){const n={type:"Terminal",name:t.terminalType.name,label:yf(t.terminalType),idx:t.idx};Q(t.label)&&(n.terminalLabel=t.label);const s=t.terminalType.PATTERN;return t.terminalType.PATTERN&&(n.pattern=Pe(s)?s.source:s),n}else{if(t instanceof yt)return{type:"Rule",name:t.name,orgText:t.orgText,definition:e(t.definition)};throw Error("non exhaustive match")}}}class St{visit(e){const n=e;switch(n.constructor){case se:return this.visitNonTerminal(n);case ee:return this.visitAlternative(n);case Z:return this.visitOption(n);case _e:return this.visitRepetitionMandatory(n);case xe:return this.visitRepetitionMandatoryWithSeparator(n);case Re:return this.visitRepetitionWithSeparator(n);case B:return this.visitRepetition(n);case Le:return this.visitAlternation(n);case M:return this.visitTerminal(n);case yt:return this.visitRule(n);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 Lf(t){return t instanceof ee||t instanceof Z||t instanceof B||t instanceof _e||t instanceof xe||t instanceof Re||t instanceof M||t instanceof yt}function Rn(t,e=[]){return t instanceof Z||t instanceof B||t instanceof Re?!0:t instanceof Le?Ji(t.definition,s=>Rn(s,e)):t instanceof se&&J(e,t)?!1:t instanceof ve?(t instanceof se&&e.push(t),Ee(t.definition,s=>Rn(s,e))):!1}function Of(t){return t instanceof Le}function Ne(t){if(t instanceof se)return"SUBRULE";if(t instanceof Z)return"OPTION";if(t instanceof Le)return"OR";if(t instanceof _e)return"AT_LEAST_ONE";if(t instanceof xe)return"AT_LEAST_ONE_SEP";if(t instanceof Re)return"MANY_SEP";if(t instanceof B)return"MANY";if(t instanceof M)return"CONSUME";throw Error("non exhaustive match")}class Kn{walk(e,n=[]){O(e.definition,(s,r)=>{const i=K(e.definition,r+1);if(s instanceof se)this.walkProdRef(s,i,n);else if(s instanceof M)this.walkTerminal(s,i,n);else if(s instanceof ee)this.walkFlat(s,i,n);else if(s instanceof Z)this.walkOption(s,i,n);else if(s instanceof _e)this.walkAtLeastOne(s,i,n);else if(s instanceof xe)this.walkAtLeastOneSep(s,i,n);else if(s instanceof Re)this.walkManySep(s,i,n);else if(s instanceof B)this.walkMany(s,i,n);else if(s instanceof Le)this.walkOr(s,i,n);else throw Error("non exhaustive match")})}walkTerminal(e,n,s){}walkProdRef(e,n,s){}walkFlat(e,n,s){const r=n.concat(s);this.walk(e,r)}walkOption(e,n,s){const r=n.concat(s);this.walk(e,r)}walkAtLeastOne(e,n,s){const r=[new Z({definition:e.definition})].concat(n,s);this.walk(e,r)}walkAtLeastOneSep(e,n,s){const r=Gr(e,n,s);this.walk(e,r)}walkMany(e,n,s){const r=[new Z({definition:e.definition})].concat(n,s);this.walk(e,r)}walkManySep(e,n,s){const r=Gr(e,n,s);this.walk(e,r)}walkOr(e,n,s){const r=n.concat(s);O(e.definition,i=>{const a=new ee({definition:[i]});this.walk(a,r)})}}function Gr(t,e,n){return[new Z({definition:[new M({terminalType:t.separator})].concat(t.definition)})].concat(e,n)}function qt(t){if(t instanceof se)return qt(t.referencedRule);if(t instanceof M)return bf(t);if(Lf(t))return Nf(t);if(Of(t))return If(t);throw Error("non exhaustive match")}function Nf(t){let e=[];const n=t.definition;let s=0,r=n.length>s,i,a=!0;for(;r&&a;)i=n[s],a=Rn(i),e=e.concat(qt(i)),s=s+1,r=n.length>s;return Hs(e)}function If(t){const e=S(t.definition,n=>qt(n));return Hs(Te(e))}function bf(t){return[t.terminalType]}const ea="_~IN~_";class Cf extends Kn{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,n,s){}walkProdRef(e,n,s){const r=vf(e.referencedRule,e.idx)+this.topProd.name,i=n.concat(s),a=new ee({definition:i}),c=qt(a);this.follows[r]=c}}function kf(t){const e={};return O(t,n=>{const s=new Cf(n).startWalking();te(e,s)}),e}function vf(t,e){return t.name+e+ea}function N(t){return t.charCodeAt(0)}function ns(t,e){Array.isArray(t)?t.forEach(function(n){e.push(n)}):e.push(t)}function Ct(t,e){if(t[e]===!0)throw"duplicate flag "+e;t[e],t[e]=!0}function ct(t){if(t===void 0)throw Error("Internal Error - Should never get here!");return!0}function _f(){throw Error("Internal Error - Should never get here!")}function Wr(t){return t.type==="Character"}const Ln=[];for(let t=N("0");t<=N("9");t++)Ln.push(t);const On=[N("_")].concat(Ln);for(let t=N("a");t<=N("z");t++)On.push(t);for(let t=N("A");t<=N("Z");t++)On.push(t);const jr=[N(" "),N("\f"),N(`
|
|
2
|
+
`),N("\r"),N(" "),N("\v"),N(" "),N(" "),N(" "),N(" "),N(" "),N(" "),N(" "),N(" "),N(" "),N(" "),N(" "),N(" "),N(" "),N(" "),N("\u2028"),N("\u2029"),N(" "),N(" "),N(" "),N("\uFEFF")],xf=/[0-9a-fA-F]/,sn=/[0-9]/,wf=/[1-9]/;class Mf{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("/");const n=this.disjunction();this.consumeChar("/");const s={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":Ct(s,"global");break;case"i":Ct(s,"ignoreCase");break;case"m":Ct(s,"multiLine");break;case"u":Ct(s,"unicode");break;case"y":Ct(s,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:s,value:n,loc:this.loc(0)}}disjunction(){const e=[],n=this.idx;for(e.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(n)}}alternative(){const e=[],n=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(n)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){const 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 n;switch(this.popChar()){case"=":n="Lookahead";break;case"!":n="NegativeLookahead";break;case"<":{switch(this.popChar()){case"=":n="Lookbehind";break;case"!":n="NegativeLookbehind"}break}}ct(n);const s=this.disjunction();return this.consumeChar(")"),{type:n,value:s,loc:this.loc(e)}}return _f()}quantifier(e=!1){let n;const s=this.idx;switch(this.popChar()){case"*":n={atLeast:0,atMost:1/0};break;case"+":n={atLeast:1,atMost:1/0};break;case"?":n={atLeast:0,atMost:1};break;case"{":const r=this.integerIncludingZero();switch(this.popChar()){case"}":n={atLeast:r,atMost:r};break;case",":let i;this.isDigit()?(i=this.integerIncludingZero(),n={atLeast:r,atMost:i}):n={atLeast:r,atMost:1/0},this.consumeChar("}");break}if(e===!0&&n===void 0)return;ct(n);break}if(!(e===!0&&n===void 0)&&ct(n))return this.peekChar(0)==="?"?(this.consumeChar("?"),n.greedy=!1):n.greedy=!0,n.type="Quantifier",n.loc=this.loc(s),n}atom(){let e;const n=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group();break}if(e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),ct(e))return e.loc=this.loc(n),this.isQuantifier()&&(e.quantifier=this.quantifier()),e}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,n=!1;switch(this.popChar()){case"d":e=Ln;break;case"D":e=Ln,n=!0;break;case"s":e=jr;break;case"S":e=jr,n=!0;break;case"w":e=On;break;case"W":e=On,n=!0;break}if(ct(e))return{type:"Set",value:e,complement:n}}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");break}if(ct(e))return{type:"Character",value:e}}controlLetterEscapeAtom(){this.consumeChar("c");const 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(){const e=this.popChar();return{type:"Character",value:N(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case`
|
|
5
|
+
`:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:const e=this.popChar();return{type:"Character",value:N(e)}}}characterClass(){const e=[];let n=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),n=!0);this.isClassAtom();){const s=this.classAtom();if(s.type,Wr(s)&&this.isRangeDash()){this.consumeChar("-");const r=this.classAtom();if(r.type,Wr(r)){if(r.value<s.value)throw Error("Range out of order in character class");e.push({from:s.value,to:r.value})}else ns(s.value,e),e.push(N("-")),ns(r.value,e)}else ns(s.value,e)}return this.consumeChar("]"),{type:"Set",complement:n,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;this.consumeChar("("),this.peekChar(0)==="?"?(this.consumeChar("?"),this.consumeChar(":"),e=!1):this.groupIdx++;const n=this.disjunction();this.consumeChar(")");const s={type:"Group",capturing:e,value:n};return e&&(s.idx=this.groupIdx),s}positiveInteger(){let e=this.popChar();if(wf.test(e)===!1)throw Error("Expecting a positive integer");for(;sn.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(sn.test(e)===!1)throw Error("Expecting an integer");for(;sn.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){const 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 sn.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(){const 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 n="";for(let r=0;r<e;r++){const i=this.popChar();if(xf.test(i)===!1)throw Error("Expecting a HexDecimal digits");n+=i}return{type:"Character",value:parseInt(n,16)}}peekChar(e=0){return this.input[this.idx+e]}popChar(){const e=this.peekChar(0);return this.consumeChar(void 0),e}consumeChar(e){if(e!==void 0&&this.input[this.idx]!==e)throw Error("Expected: '"+e+"' but found: '"+this.input[this.idx]+"' at offset: "+this.idx);if(this.idx>=this.input.length)throw Error("Unexpected end of input");this.idx++}loc(e){return{begin:e,end:this.idx}}}class Vs{visitChildren(e){for(const n in e){const s=e[n];e.hasOwnProperty(n)&&(s.type!==void 0?this.visit(s):Array.isArray(s)&&s.forEach(r=>{this.visit(r)},this))}}visit(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"Lookbehind":this.visitLookbehind(e);break;case"NegativeLookbehind":this.visitNegativeLookbehind(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e);break}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitLookbehind(e){}visitNegativeLookbehind(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}}let hn={};const Uf=new Mf;function zn(t){const e=t.toString();if(hn.hasOwnProperty(e))return hn[e];{const n=Uf.pattern(e);return hn[e]=n,n}}function Pf(){hn={}}const ta="Complement Sets are not supported for first char optimization",Nn=`Unable to use "first char" lexer optimizations:
|
|
10
|
+
`;function $f(t,e=!1){try{const n=zn(t);return ms(n.value,{},n.flags.ignoreCase)}catch(n){if(n.message===ta)e&&qi(`${Nn} Unable to optimize: < ${t.toString()} >
|
|
11
|
+
Complement Sets cannot be automatically optimized.
|
|
12
|
+
This will disable the lexer's first char optimizations.
|
|
13
|
+
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let s="";e&&(s=`
|
|
14
|
+
This will disable the lexer's first char optimizations.
|
|
15
|
+
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),ps(`${Nn}
|
|
16
|
+
Failed parsing: < ${t.toString()} >
|
|
17
|
+
Using the @chevrotain/regexp-to-ast library
|
|
18
|
+
Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+s)}}return[]}function ms(t,e,n){switch(t.type){case"Disjunction":for(let r=0;r<t.value.length;r++)ms(t.value[r],e,n);break;case"Alternative":const s=t.value;for(let r=0;r<s.length;r++){const i=s[r];switch(i.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"Lookbehind":case"NegativeLookbehind":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}const a=i;switch(a.type){case"Character":rn(a.value,e,n);break;case"Set":if(a.complement===!0)throw Error(ta);O(a.value,o=>{if(typeof o=="number")rn(o,e,n);else{const l=o;if(n===!0)for(let d=l.from;d<=l.to;d++)rn(d,e,n);else{for(let d=l.from;d<=l.to&&d<wt;d++)rn(d,e,n);if(l.to>=wt){const d=l.from>=wt?l.from:wt,u=l.to,f=Ve(d),m=Ve(u);for(let T=f;T<=m;T++)e[T]=T}}}});break;case"Group":ms(a.value,e,n);break;default:throw Error("Non Exhaustive Match")}const c=a.quantifier!==void 0&&a.quantifier.atLeast===0;if(a.type==="Group"&&gs(a)===!1||a.type!=="Group"&&c===!1)break}break;default:throw Error("non exhaustive match!")}return F(e)}function rn(t,e,n){const s=Ve(t);e[s]=s,n===!0&&Df(t,e)}function Df(t,e){const n=String.fromCharCode(t),s=n.toUpperCase();if(s!==n){const r=Ve(s.charCodeAt(0));e[r]=r}else{const r=n.toLowerCase();if(r!==n){const i=Ve(r.charCodeAt(0));e[i]=i}}}function Kr(t,e){return At(t.value,n=>{if(typeof n=="number")return J(e,n);{const s=n;return At(e,r=>s.from<=r&&r<=s.to)!==void 0}})}function gs(t){const e=t.quantifier;return e&&e.atLeast===0?!0:t.value?C(t.value)?Ee(t.value,gs):gs(t.value):!1}class Ff extends Vs{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){J(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?Kr(e,this.targetCharCodes)===void 0&&(this.found=!0):Kr(e,this.targetCharCodes)!==void 0&&(this.found=!0)}}function Ys(t,e){if(e instanceof RegExp){const n=zn(e),s=new Ff(t);return s.visit(n),s.found}else return At(e,n=>J(t,n.charCodeAt(0)))!==void 0}const st="PATTERN",xt="defaultMode",an="modes";function Bf(t,e){e=zs(e,{debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
|
|
19
|
+
`],tracer:(g,p)=>p()});const n=e.tracer;n("initCharCodeToOptimizedIndexMap",()=>{hp()});let s;n("Reject Lexer.NA",()=>{s=jn(t,g=>g[st]===V.NA)});let r=!1,i;n("Transform Patterns",()=>{r=!1,i=S(s,g=>{const p=g[st];if(Pe(p)){const E=p.source;return E.length===1&&E!=="^"&&E!=="$"&&E!=="."&&!p.ignoreCase?E:E.length===2&&E[0]==="\\"&&!J(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],E[1])?E[1]:zr(p)}else{if(Be(p))return r=!0,{exec:p};if(typeof p=="object")return r=!0,p;if(typeof p=="string"){if(p.length===1)return p;{const E=p.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),k=new RegExp(E);return zr(k)}}else throw Error("non exhaustive match")}})});let a,c,o,l,d;n("misc mapping",()=>{a=S(s,g=>g.tokenTypeIdx),c=S(s,g=>{const p=g.GROUP;if(p!==V.SKIPPED){if(Q(p))return p;if($e(p))return!1;throw Error("non exhaustive match")}}),o=S(s,g=>{const p=g.LONGER_ALT;if(p)return C(p)?S(p,k=>Fr(s,k)):[Fr(s,p)]}),l=S(s,g=>g.PUSH_MODE),d=S(s,g=>L(g,"POP_MODE"))});let u;n("Line Terminator Handling",()=>{const g=ra(e.lineTerminatorCharacters);u=S(s,p=>!1),e.positionTracking!=="onlyOffset"&&(u=S(s,p=>L(p,"LINE_BREAKS")?!!p.LINE_BREAKS:sa(p,g)===!1&&Ys(g,p.PATTERN)))});let f,m,T,y;n("Misc Mapping #2",()=>{f=S(s,na),m=S(i,op),T=ne(s,(g,p)=>{const E=p.GROUP;return Q(E)&&E!==V.SKIPPED&&(g[E]=[]),g},{}),y=S(i,(g,p)=>({pattern:i[p],longerAlt:o[p],canLineTerminator:u[p],isCustom:f[p],short:m[p],group:c[p],push:l[p],pop:d[p],tokenTypeIdx:a[p],tokenType:s[p]}))});let I=!0,A=[];return e.safeMode||n("First Char Optimization",()=>{A=ne(s,(g,p,E)=>{if(typeof p.PATTERN=="string"){const k=p.PATTERN.charCodeAt(0),pe=Ve(k);ss(g,pe,y[E])}else if(C(p.START_CHARS_HINT)){let k;O(p.START_CHARS_HINT,pe=>{const je=typeof pe=="string"?pe.charCodeAt(0):pe,Je=Ve(je);k!==Je&&(k=Je,ss(g,Je,y[E]))})}else if(Pe(p.PATTERN))if(p.PATTERN.unicode)I=!1,e.ensureOptimizations&&ps(`${Nn} Unable to analyze < ${p.PATTERN.toString()} > pattern.
|
|
20
|
+
The regexp unicode flag is not currently supported by the regexp-to-ast library.
|
|
21
|
+
This will disable the lexer's first char optimizations.
|
|
22
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{const k=$f(p.PATTERN,e.ensureOptimizations);_(k)&&(I=!1),O(k,pe=>{ss(g,pe,y[E])})}else e.ensureOptimizations&&ps(`${Nn} TokenType: <${p.name}> is using a custom token pattern without providing <start_chars_hint> parameter.
|
|
23
|
+
This will disable the lexer's first char optimizations.
|
|
24
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),I=!1;return g},[])}),{emptyGroups:T,patternIdxToConfig:y,charCodeToPatternIdxToConfig:A,hasCustom:r,canBeOptimized:I}}function Gf(t,e){let n=[];const s=jf(t);n=n.concat(s.errors);const r=Kf(s.valid),i=r.valid;return n=n.concat(r.errors),n=n.concat(Wf(i)),n=n.concat(Zf(i)),n=n.concat(Qf(i,e)),n=n.concat(ep(i)),n}function Wf(t){let e=[];const n=fe(t,s=>Pe(s[st]));return e=e.concat(Hf(n)),e=e.concat(Xf(n)),e=e.concat(Jf(n)),e=e.concat(qf(n)),e=e.concat(Vf(n)),e}function jf(t){const e=fe(t,r=>!L(r,st)),n=S(e,r=>({message:"Token Type: ->"+r.name+"<- missing static 'PATTERN' property",type:$.MISSING_PATTERN,tokenTypes:[r]})),s=Wn(t,e);return{errors:n,valid:s}}function Kf(t){const e=fe(t,r=>{const i=r[st];return!Pe(i)&&!Be(i)&&!L(i,"exec")&&!Q(i)}),n=S(e,r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:$.INVALID_PATTERN,tokenTypes:[r]})),s=Wn(t,e);return{errors:n,valid:s}}const zf=/[^\\][$]/;function Hf(t){class e extends Vs{constructor(){super(...arguments),this.found=!1}visitEndAnchor(i){this.found=!0}}const n=fe(t,r=>{const i=r.PATTERN;try{const a=zn(i),c=new e;return c.visit(a),c.found}catch{return zf.test(i.source)}});return S(n,r=>({message:`Unexpected RegExp Anchor Error:
|
|
25
|
+
Token Type: ->`+r.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
|
|
26
|
+
See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:$.EOI_ANCHOR_FOUND,tokenTypes:[r]}))}function Vf(t){const e=fe(t,s=>s.PATTERN.test(""));return S(e,s=>({message:"Token Type: ->"+s.name+"<- static 'PATTERN' must not match an empty string",type:$.EMPTY_MATCH_PATTERN,tokenTypes:[s]}))}const Yf=/[^\\[][\^]|^\^/;function Xf(t){class e extends Vs{constructor(){super(...arguments),this.found=!1}visitStartAnchor(i){this.found=!0}}const n=fe(t,r=>{const i=r.PATTERN;try{const a=zn(i),c=new e;return c.visit(a),c.found}catch{return Yf.test(i.source)}});return S(n,r=>({message:`Unexpected RegExp Anchor Error:
|
|
27
|
+
Token Type: ->`+r.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
|
|
28
|
+
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:$.SOI_ANCHOR_FOUND,tokenTypes:[r]}))}function Jf(t){const e=fe(t,s=>{const r=s[st];return r instanceof RegExp&&(r.multiline||r.global)});return S(e,s=>({message:"Token Type: ->"+s.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:$.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[s]}))}function qf(t){const e=[];let n=S(t,i=>ne(t,(a,c)=>(i.PATTERN.source===c.PATTERN.source&&!J(e,c)&&c.PATTERN!==V.NA&&(e.push(c),a.push(c)),a),[]));n=Jt(n);const s=fe(n,i=>i.length>1);return S(s,i=>{const a=S(i,o=>o.name);return{message:`The same RegExp pattern ->${ye(i).PATTERN}<-has been used in all of the following Token Types: ${a.join(", ")} <-`,type:$.DUPLICATE_PATTERNS_FOUND,tokenTypes:i}})}function Zf(t){const e=fe(t,s=>{if(!L(s,"GROUP"))return!1;const r=s.GROUP;return r!==V.SKIPPED&&r!==V.NA&&!Q(r)});return S(e,s=>({message:"Token Type: ->"+s.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:$.INVALID_GROUP_TYPE_FOUND,tokenTypes:[s]}))}function Qf(t,e){const n=fe(t,r=>r.PUSH_MODE!==void 0&&!J(e,r.PUSH_MODE));return S(n,r=>({message:`Token Type: ->${r.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${r.PUSH_MODE}<-which does not exist`,type:$.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[r]}))}function ep(t){const e=[],n=ne(t,(s,r,i)=>{const a=r.PATTERN;return a===V.NA||(Q(a)?s.push({str:a,idx:i,tokenType:r}):Pe(a)&&np(a)&&s.push({str:a.source,idx:i,tokenType:r})),s},[]);return O(t,(s,r)=>{O(n,({str:i,idx:a,tokenType:c})=>{if(r<a&&tp(i,s.PATTERN)){const o=`Token: ->${c.name}<- can never be matched.
|
|
29
|
+
Because it appears AFTER the Token Type ->${s.name}<-in the lexer's definition.
|
|
30
|
+
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:o,type:$.UNREACHABLE_PATTERN,tokenTypes:[s,c]})}})}),e}function tp(t,e){if(Pe(e)){if(sp(e))return!1;const n=e.exec(t);return n!==null&&n.index===0}else{if(Be(e))return e(t,0,[],{});if(L(e,"exec"))return e.exec(t,0,[],{});if(typeof e=="string")return e===t;throw Error("non exhaustive match")}}function np(t){return At([".","\\","[","]","|","^","$","(",")","?","*","+","{"],n=>t.source.indexOf(n)!==-1)===void 0}function sp(t){return/(\(\?=)|(\(\?!)|(\(\?<=)|(\(\?<!)/.test(t.source)}function zr(t){const e=t.ignoreCase?"iy":"y";return new RegExp(`${t.source}`,e)}function rp(t,e,n){const s=[];return L(t,xt)||s.push({message:"A MultiMode Lexer cannot be initialized without a <"+xt+`> property in its definition
|
|
31
|
+
`,type:$.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),L(t,an)||s.push({message:"A MultiMode Lexer cannot be initialized without a <"+an+`> property in its definition
|
|
32
|
+
`,type:$.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),L(t,an)&&L(t,xt)&&!L(t.modes,t.defaultMode)&&s.push({message:`A MultiMode Lexer cannot be initialized with a ${xt}: <${t.defaultMode}>which does not exist
|
|
33
|
+
`,type:$.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),L(t,an)&&O(t.modes,(r,i)=>{O(r,(a,c)=>{if($e(a))s.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${i}> at index: <${c}>
|
|
34
|
+
`,type:$.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(L(a,"LONGER_ALT")){const o=C(a.LONGER_ALT)?a.LONGER_ALT:[a.LONGER_ALT];O(o,l=>{!$e(l)&&!J(r,l)&&s.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${l.name}> on token <${a.name}> outside of mode <${i}>
|
|
35
|
+
`,type:$.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),s}function ip(t,e,n){const s=[];let r=!1;const i=Jt(Te(F(t.modes))),a=jn(i,o=>o[st]===V.NA),c=ra(n);return e&&O(a,o=>{const l=sa(o,c);if(l!==!1){const u={message:lp(o,l),type:l.issue,tokenType:o};s.push(u)}else L(o,"LINE_BREAKS")?o.LINE_BREAKS===!0&&(r=!0):Ys(c,o.PATTERN)&&(r=!0)}),e&&!r&&s.push({message:`Warning: No LINE_BREAKS Found.
|
|
36
|
+
This Lexer has been defined to track line and column information,
|
|
37
|
+
But none of the Token Types can be identified as matching a line terminator.
|
|
38
|
+
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
|
|
39
|
+
for details.`,type:$.NO_LINE_BREAKS_FLAGS}),s}function ap(t){const e={},n=de(t);return O(n,s=>{const r=t[s];if(C(r))e[s]=[];else throw Error("non exhaustive match")}),e}function na(t){const e=t.PATTERN;if(Pe(e))return!1;if(Be(e))return!0;if(L(e,"exec"))return!0;if(Q(e))return!1;throw Error("non exhaustive match")}function op(t){return Q(t)&&t.length===1?t.charCodeAt(0):!1}const cp={test:function(t){const e=t.length;for(let n=this.lastIndex;n<e;n++){const s=t.charCodeAt(n);if(s===10)return this.lastIndex=n+1,!0;if(s===13)return t.charCodeAt(n+1)===10?this.lastIndex=n+2:this.lastIndex=n+1,!0}return!1},lastIndex:0};function sa(t,e){if(L(t,"LINE_BREAKS"))return!1;if(Pe(t.PATTERN)){try{Ys(e,t.PATTERN)}catch(n){return{issue:$.IDENTIFY_TERMINATOR,errMsg:n.message}}return!1}else{if(Q(t.PATTERN))return!1;if(na(t))return{issue:$.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function lp(t,e){if(e.issue===$.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
|
|
40
|
+
The problem is in the <${t.name}> Token Type
|
|
41
|
+
Root cause: ${e.errMsg}.
|
|
42
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(e.issue===$.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
|
|
43
|
+
The problem is in the <${t.name}> Token Type
|
|
44
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}function ra(t){return S(t,n=>Q(n)?n.charCodeAt(0):n)}function ss(t,e,n){t[e]===void 0?t[e]=[n]:t[e].push(n)}const wt=256;let un=[];function Ve(t){return t<wt?t:un[t]}function hp(){if(_(un)){un=new Array(65536);for(let t=0;t<65536;t++)un[t]=t>255?255+~~(t/255):t}}function Zt(t,e){const n=t.tokenTypeIdx;return n===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[n]===!0}function In(t,e){return t.tokenTypeIdx===e.tokenTypeIdx}let Hr=1;const ia={};function Qt(t){const e=up(t);dp(e),pp(e),fp(e),O(e,n=>{n.isParent=n.categoryMatches.length>0})}function up(t){let e=z(t),n=t,s=!0;for(;s;){n=Jt(Te(S(n,i=>i.CATEGORIES)));const r=Wn(n,e);e=e.concat(r),_(r)?s=!1:n=r}return e}function dp(t){O(t,e=>{oa(e)||(ia[Hr]=e,e.tokenTypeIdx=Hr++),Vr(e)&&!C(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),Vr(e)||(e.CATEGORIES=[]),mp(e)||(e.categoryMatches=[]),gp(e)||(e.categoryMatchesMap={})})}function fp(t){O(t,e=>{e.categoryMatches=[],O(e.categoryMatchesMap,(n,s)=>{e.categoryMatches.push(ia[s].tokenTypeIdx)})})}function pp(t){O(t,e=>{aa([],e)})}function aa(t,e){O(t,n=>{e.categoryMatchesMap[n.tokenTypeIdx]=!0}),O(e.CATEGORIES,n=>{const s=t.concat(e);J(s,n)||aa(s,n)})}function oa(t){return L(t,"tokenTypeIdx")}function Vr(t){return L(t,"CATEGORIES")}function mp(t){return L(t,"categoryMatches")}function gp(t){return L(t,"categoryMatchesMap")}function Tp(t){return L(t,"tokenTypeIdx")}const Ep={buildUnableToPopLexerModeMessage(t){return`Unable to pop Lexer Mode after encountering Token ->${t.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(t,e,n,s,r,i){return`unexpected character: ->${t.charAt(e)}<- at offset: ${e}, skipped ${n} characters.`}};var $;(function(t){t[t.MISSING_PATTERN=0]="MISSING_PATTERN",t[t.INVALID_PATTERN=1]="INVALID_PATTERN",t[t.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",t[t.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",t[t.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",t[t.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",t[t.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",t[t.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",t[t.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",t[t.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",t[t.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",t[t.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",t[t.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",t[t.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",t[t.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",t[t.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",t[t.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",t[t.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"})($||($={}));const Mt={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
|
|
45
|
+
`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:Ep,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(Mt);class V{constructor(e,n=Mt){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(r,i)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;const a=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${a}--> <${r}>`);const{time:c,value:o}=Zi(i),l=c>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&l(`${a}<-- <${r}> time: ${c}ms`),this.traceInitIndent--,o}else return i()},typeof n=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
|
|
46
|
+
a boolean 2nd argument is no longer supported`);this.config=te({},Mt,n);const s=this.config.traceInitPerf;s===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof s=="number"&&(this.traceInitMaxIdent=s,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let r,i=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===Mt.lineTerminatorsPattern)this.config.lineTerminatorsPattern=cp;else if(this.config.lineTerminatorCharacters===Mt.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
|
|
47
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(n.safeMode&&n.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),C(e)?r={modes:{defaultMode:z(e)},defaultMode:xt}:(i=!1,r=z(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(rp(r,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(ip(r,this.trackStartLines,this.config.lineTerminatorCharacters))})),r.modes=r.modes?r.modes:{},O(r.modes,(c,o)=>{r.modes[o]=jn(c,l=>$e(l))});const a=de(r.modes);if(O(r.modes,(c,o)=>{this.TRACE_INIT(`Mode: <${o}> processing`,()=>{if(this.modes.push(o),this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(Gf(c,a))}),_(this.lexerDefinitionErrors)){Qt(c);let l;this.TRACE_INIT("analyzeTokenTypes",()=>{l=Bf(c,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:n.positionTracking,ensureOptimizations:n.ensureOptimizations,safeMode:n.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[o]=l.patternIdxToConfig,this.charCodeToPatternIdxToConfig[o]=l.charCodeToPatternIdxToConfig,this.emptyGroups=te({},this.emptyGroups,l.emptyGroups),this.hasCustom=l.hasCustom||this.hasCustom,this.canModeBeOptimized[o]=l.canBeOptimized}})}),this.defaultMode=r.defaultMode,!_(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){const o=S(this.lexerDefinitionErrors,l=>l.message).join(`-----------------------
|
|
48
|
+
`);throw new Error(`Errors detected in definition of Lexer:
|
|
49
|
+
`+o)}O(this.lexerDefinitionWarning,c=>{qi(c.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(i&&(this.handleModes=G),this.trackStartLines===!1&&(this.computeNewColumn=zt),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=G),/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",()=>{const c=ne(this.canModeBeOptimized,(o,l,d)=>(l===!1&&o.push(d),o),[]);if(n.ensureOptimizations&&!_(c))throw Error(`Lexer Modes: < ${c.join(", ")} > cannot be optimized.
|
|
50
|
+
Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
|
|
51
|
+
Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{Pf()}),this.TRACE_INIT("toFastProperties",()=>{Qi(this)})})}tokenize(e,n=this.defaultMode){if(!_(this.lexerDefinitionErrors)){const r=S(this.lexerDefinitionErrors,i=>i.message).join(`-----------------------
|
|
52
|
+
`);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer:
|
|
53
|
+
`+r)}return this.tokenizeInternal(e,n)}tokenizeInternal(e,n){let s,r,i,a,c,o,l,d,u,f,m,T,y,I,A;const g=e,p=g.length;let E=0,k=0;const pe=this.hasCustom?0:Math.floor(e.length/10),je=new Array(pe),Je=[];let Rt=this.trackStartLines?1:void 0,Oe=this.trackStartLines?1:void 0;const Lt=ap(this.emptyGroups),Ro=this.trackStartLines,Jn=this.config.lineTerminatorsPattern;let tn=0,Ke=[],Ot=[];const Nt=[],rr=[];Object.freeze(rr);let It=!1;const Lo=q=>{if(Nt.length===1&&q.tokenType.PUSH_MODE===void 0){const re=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(q);Je.push({offset:q.startOffset,line:q.startLine,column:q.startColumn,length:q.image.length,message:re})}else{Nt.pop();const re=nt(Nt);Ke=this.patternIdxToConfig[re],Ot=this.charCodeToPatternIdxToConfig[re],tn=Ke.length;const qn=this.canModeBeOptimized[re]&&this.config.safeMode===!1;Ot&&qn?It=!0:It=!1}};function ir(q){Nt.push(q),Ot=this.charCodeToPatternIdxToConfig[q],Ke=this.patternIdxToConfig[q],tn=Ke.length,tn=Ke.length;const re=this.canModeBeOptimized[q]&&this.config.safeMode===!1;Ot&&re?It=!0:It=!1}ir.call(this,n);let me;const ar=this.config.recoveryEnabled;for(;E<p;){o=null,u=-1;const q=g.charCodeAt(E);let re;if(It){const Y=Ve(q),ie=Ot[Y];re=ie!==void 0?ie:rr}else re=Ke;const qn=re.length;for(s=0;s<qn;s++){me=re[s];const Y=me.pattern;l=null;const ie=me.short;if(ie!==!1?q===ie&&(u=1,o=Y):me.isCustom===!0?(A=Y.exec(g,E,je,Lt),A!==null?(o=A[0],u=o.length,A.payload!==void 0&&(l=A.payload)):o=null):(Y.lastIndex=E,u=this.matchLength(Y,e,E)),u!==-1){if(c=me.longerAlt,c!==void 0){o=e.substring(E,E+u);const ze=c.length;for(i=0;i<ze;i++){const we=Ke[c[i]],qe=we.pattern;if(d=null,we.isCustom===!0?(A=qe.exec(g,E,je,Lt),A!==null?(a=A[0],A.payload!==void 0&&(d=A.payload)):a=null):(qe.lastIndex=E,a=this.match(qe,e,E)),a&&a.length>o.length){o=a,u=a.length,l=d,me=we;break}}}break}}if(u!==-1){if(f=me.group,f!==void 0&&(o=o!==null?o:e.substring(E,E+u),m=me.tokenTypeIdx,T=this.createTokenInstance(o,E,m,me.tokenType,Rt,Oe,u),this.handlePayload(T,l),f===!1?k=this.addToken(je,k,T):Lt[f].push(T)),Ro===!0&&me.canLineTerminator===!0){let Y=0,ie,ze;Jn.lastIndex=0;do o=o!==null?o:e.substring(E,E+u),ie=Jn.test(o),ie===!0&&(ze=Jn.lastIndex-1,Y++);while(ie===!0);Y!==0?(Rt=Rt+Y,Oe=u-ze,this.updateTokenEndLineColumnLocation(T,f,ze,Y,Rt,Oe,u)):Oe=this.computeNewColumn(Oe,u)}else Oe=this.computeNewColumn(Oe,u);E=E+u,this.handleModes(me,Lo,ir,T)}else{const Y=E,ie=Rt,ze=Oe;let we=ar===!1;for(;we===!1&&E<p;)for(E++,r=0;r<tn;r++){const qe=Ke[r],Zn=qe.pattern,or=qe.short;if(or!==!1?g.charCodeAt(E)===or&&(we=!0):qe.isCustom===!0?we=Zn.exec(g,E,je,Lt)!==null:(Zn.lastIndex=E,we=Zn.exec(e)!==null),we===!0)break}if(y=E-Y,Oe=this.computeNewColumn(Oe,y),I=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(g,Y,y,ie,ze,nt(Nt)),Je.push({offset:Y,line:ie,column:ze,length:y,message:I}),ar===!1)break}}return this.hasCustom||(je.length=k),{tokens:je,groups:Lt,errors:Je}}handleModes(e,n,s,r){if(e.pop===!0){const i=e.push;n(r),i!==void 0&&s.call(this,i)}else e.push!==void 0&&s.call(this,e.push)}updateTokenEndLineColumnLocation(e,n,s,r,i,a,c){let o,l;n!==void 0&&(o=s===c-1,l=o?-1:0,r===1&&o===!0||(e.endLine=i+l,e.endColumn=a-1+-l))}computeNewColumn(e,n){return e+n}createOffsetOnlyToken(e,n,s,r){return{image:e,startOffset:n,tokenTypeIdx:s,tokenType:r}}createStartOnlyToken(e,n,s,r,i,a){return{image:e,startOffset:n,startLine:i,startColumn:a,tokenTypeIdx:s,tokenType:r}}createFullToken(e,n,s,r,i,a,c){return{image:e,startOffset:n,endOffset:n+c-1,startLine:i,endLine:i,startColumn:a,endColumn:a+c-1,tokenTypeIdx:s,tokenType:r}}addTokenUsingPush(e,n,s){return e.push(s),n}addTokenUsingMemberAccess(e,n,s){return e[n]=s,n++,n}handlePayloadNoCustom(e,n){}handlePayloadWithCustom(e,n){n!==null&&(e.payload=n)}match(e,n,s){return e.test(n)===!0?n.substring(s,e.lastIndex):null}matchLength(e,n,s){return e.test(n)===!0?e.lastIndex-s:-1}}V.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.";V.NA=/NOT_APPLICABLE/;function Bt(t){return ca(t)?t.LABEL:t.name}function ca(t){return Q(t.LABEL)&&t.LABEL!==""}const Ap="parent",Yr="categories",Xr="label",Jr="group",qr="push_mode",Zr="pop_mode",Qr="longer_alt",ei="line_breaks",ti="start_chars_hint";function R(t){return yp(t)}function yp(t){const e=t.pattern,n={};if(n.name=t.name,$e(e)||(n.PATTERN=e),L(t,Ap))throw`The parent property is no longer supported.
|
|
54
|
+
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return L(t,Yr)&&(n.CATEGORIES=t[Yr]),Qt([n]),L(t,Xr)&&(n.LABEL=t[Xr]),L(t,Jr)&&(n.GROUP=t[Jr]),L(t,Zr)&&(n.POP_MODE=t[Zr]),L(t,qr)&&(n.PUSH_MODE=t[qr]),L(t,Qr)&&(n.LONGER_ALT=t[Qr]),L(t,ei)&&(n.LINE_BREAKS=t[ei]),L(t,ti)&&(n.START_CHARS_HINT=t[ti]),n}const De=R({name:"EOF",pattern:V.NA});Qt([De]);function Xs(t,e,n,s,r,i,a,c){return{image:e,startOffset:n,endOffset:s,startLine:r,endLine:i,startColumn:a,endColumn:c,tokenTypeIdx:t.tokenTypeIdx,tokenType:t}}function la(t,e){return Zt(t,e)}const ha={buildMismatchTokenMessage({expected:t,actual:e,previous:n,ruleName:s}){return`Expecting ${ca(t)?`--> ${Bt(t)} <--`:`token of type --> ${t.name} <--`} but found --> '${e.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:t,ruleName:e}){return"Redundant input, expecting EOF but found: "+t.image},buildNoViableAltMessage({expectedPathsPerAlt:t,actual:e,previous:n,customUserDescription:s,ruleName:r}){const i="Expecting: ",c=`
|
|
55
|
+
but found: '`+ye(e).image+"'";if(s)return i+s+c;{const o=ne(t,(f,m)=>f.concat(m),[]),l=S(o,f=>`[${S(f,m=>Bt(m)).join(", ")}]`),u=`one of these possible Token sequences:
|
|
56
|
+
${S(l,(f,m)=>` ${m+1}. ${f}`).join(`
|
|
57
|
+
`)}`;return i+u+c}},buildEarlyExitMessage({expectedIterationPaths:t,actual:e,customUserDescription:n,ruleName:s}){const r="Expecting: ",a=`
|
|
58
|
+
but found: '`+ye(e).image+"'";if(n)return r+n+a;{const o=`expecting at least one iteration which starts with one of these possible Token sequences::
|
|
59
|
+
<${S(t,l=>`[${S(l,d=>Bt(d)).join(",")}]`).join(" ,")}>`;return r+o+a}}};Object.freeze(ha);const Sp={buildRuleNotFoundError(t,e){return"Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+`<-
|
|
60
|
+
inside top level rule: ->`+t.name+"<-"}},et={buildDuplicateFoundError(t,e){function n(d){return d instanceof M?d.terminalType.name:d instanceof se?d.nonTerminalName:""}const s=t.name,r=ye(e),i=r.idx,a=Ne(r),c=n(r),o=i>0;let l=`->${a}${o?i:""}<- ${c?`with argument: ->${c}<-`:""}
|
|
61
|
+
appears more than once (${e.length} times) in the top level rule: ->${s}<-.
|
|
62
|
+
For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES
|
|
63
|
+
`;return l=l.replace(/[ \t]+/g," "),l=l.replace(/\s\s+/g,`
|
|
64
|
+
`),l},buildNamespaceConflictError(t){return`Namespace conflict found in grammar.
|
|
65
|
+
The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${t.name}>.
|
|
66
|
+
To resolve this make sure each Terminal and Non-Terminal names are unique
|
|
67
|
+
This is easy to accomplish by using the convention that Terminal names start with an uppercase letter
|
|
68
|
+
and Non-Terminal names start with a lower case letter.`},buildAlternationPrefixAmbiguityError(t){const e=S(t.prefixPath,r=>Bt(r)).join(", "),n=t.alternation.idx===0?"":t.alternation.idx;return`Ambiguous alternatives: <${t.ambiguityIndices.join(" ,")}> due to common lookahead prefix
|
|
69
|
+
in <OR${n}> inside <${t.topLevelRule.name}> Rule,
|
|
70
|
+
<${e}> may appears as a prefix path in all these alternatives.
|
|
71
|
+
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX
|
|
72
|
+
For Further details.`},buildAlternationAmbiguityError(t){const e=t.alternation.idx===0?"":t.alternation.idx,n=t.prefixPath.length===0;let s=`Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(" ,")}> in <OR${e}> inside <${t.topLevelRule.name}> Rule,
|
|
73
|
+
`;if(n)s+=`These alternatives are all empty (match no tokens), making them indistinguishable.
|
|
74
|
+
Only the last alternative may be empty.
|
|
75
|
+
`;else{const r=S(t.prefixPath,i=>Bt(i)).join(", ");s+=`<${r}> may appears as a prefix path in all these alternatives.
|
|
76
|
+
`}return s+=`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
|
|
77
|
+
For Further details.`,s},buildEmptyRepetitionError(t){let e=Ne(t.repetition);return t.repetition.idx!==0&&(e+=t.repetition.idx),`The repetition <${e}> within Rule <${t.topLevelRule.name}> can never consume any tokens.
|
|
78
|
+
This could lead to an infinite loop.`},buildTokenNameError(t){return"deprecated"},buildEmptyAlternationError(t){return`Ambiguous empty alternative: <${t.emptyChoiceIdx+1}> in <OR${t.alternation.idx}> inside <${t.topLevelRule.name}> Rule.
|
|
79
|
+
Only the last alternative may be an empty alternative.`},buildTooManyAlternativesError(t){return`An Alternation cannot have more than 256 alternatives:
|
|
80
|
+
<OR${t.alternation.idx}> inside <${t.topLevelRule.name}> Rule.
|
|
81
|
+
has ${t.alternation.definition.length+1} alternatives.`},buildLeftRecursionError(t){const e=t.topLevelRule.name,n=S(t.leftRecursionPath,i=>i.name),s=`${e} --> ${n.concat([e]).join(" --> ")}`;return`Left Recursion found in grammar.
|
|
82
|
+
rule: <${e}> can be invoked from itself (directly or indirectly)
|
|
83
|
+
without consuming any Tokens. The grammar path that causes this is:
|
|
84
|
+
${s}
|
|
85
|
+
To fix this refactor your grammar to remove the left recursion.
|
|
86
|
+
see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(t){return"deprecated"},buildDuplicateRuleNameError(t){let e;return t.topLevelRule instanceof yt?e=t.topLevelRule.name:e=t.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${t.grammarName}<-`}};function Rp(t,e){const n=new Lp(t,e);return n.resolveRefs(),n.errors}class Lp extends St{constructor(e,n){super(),this.nameToTopRule=e,this.errMsgProvider=n,this.errors=[]}resolveRefs(){O(F(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){const n=this.nameToTopRule[e.nonTerminalName];if(n)e.referencedRule=n;else{const s=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:s,type:X.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}}class Op extends Kn{constructor(e,n){super(),this.topProd=e,this.path=n,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=z(this.path.ruleStack).reverse(),this.occurrenceStack=z(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,n=[]){this.found||super.walk(e,n)}walkProdRef(e,n,s){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){const r=n.concat(s);this.updateExpectedNext(),this.walk(e.referencedRule,r)}}updateExpectedNext(){_(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}}class Np extends Op{constructor(e,n){super(e,n),this.path=n,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,n,s){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){const r=n.concat(s),i=new ee({definition:r});this.possibleTokTypes=qt(i),this.found=!0}}}class Hn extends Kn{constructor(e,n){super(),this.topRule=e,this.occurrence=n,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}}class Ip extends Hn{walkMany(e,n,s){if(e.idx===this.occurrence){const r=ye(n.concat(s));this.result.isEndOfRule=r===void 0,r instanceof M&&(this.result.token=r.terminalType,this.result.occurrence=r.idx)}else super.walkMany(e,n,s)}}class ni extends Hn{walkManySep(e,n,s){if(e.idx===this.occurrence){const r=ye(n.concat(s));this.result.isEndOfRule=r===void 0,r instanceof M&&(this.result.token=r.terminalType,this.result.occurrence=r.idx)}else super.walkManySep(e,n,s)}}class bp extends Hn{walkAtLeastOne(e,n,s){if(e.idx===this.occurrence){const r=ye(n.concat(s));this.result.isEndOfRule=r===void 0,r instanceof M&&(this.result.token=r.terminalType,this.result.occurrence=r.idx)}else super.walkAtLeastOne(e,n,s)}}class si extends Hn{walkAtLeastOneSep(e,n,s){if(e.idx===this.occurrence){const r=ye(n.concat(s));this.result.isEndOfRule=r===void 0,r instanceof M&&(this.result.token=r.terminalType,this.result.occurrence=r.idx)}else super.walkAtLeastOneSep(e,n,s)}}function Ts(t,e,n=[]){n=z(n);let s=[],r=0;function i(c){return c.concat(K(t,r+1))}function a(c){const o=Ts(i(c),e,n);return s.concat(o)}for(;n.length<e&&r<t.length;){const c=t[r];if(c instanceof ee)return a(c.definition);if(c instanceof se)return a(c.definition);if(c instanceof Z)s=a(c.definition);else if(c instanceof _e){const o=c.definition.concat([new B({definition:c.definition})]);return a(o)}else if(c instanceof xe){const o=[new ee({definition:c.definition}),new B({definition:[new M({terminalType:c.separator})].concat(c.definition)})];return a(o)}else if(c instanceof Re){const o=c.definition.concat([new B({definition:[new M({terminalType:c.separator})].concat(c.definition)})]);s=a(o)}else if(c instanceof B){const o=c.definition.concat([new B({definition:c.definition})]);s=a(o)}else{if(c instanceof Le)return O(c.definition,o=>{_(o.definition)===!1&&(s=a(o.definition))}),s;if(c instanceof M)n.push(c.terminalType);else throw Error("non exhaustive match")}r++}return s.push({partialPath:n,suffixDef:K(t,r)}),s}function ua(t,e,n,s){const r="EXIT_NONE_TERMINAL",i=[r],a="EXIT_ALTERNATIVE";let c=!1;const o=e.length,l=o-s-1,d=[],u=[];for(u.push({idx:-1,def:t,ruleStack:[],occurrenceStack:[]});!_(u);){const f=u.pop();if(f===a){c&&nt(u).idx<=l&&u.pop();continue}const m=f.def,T=f.idx,y=f.ruleStack,I=f.occurrenceStack;if(_(m))continue;const A=m[0];if(A===r){const g={idx:T,def:K(m),ruleStack:Kt(y),occurrenceStack:Kt(I)};u.push(g)}else if(A instanceof M)if(T<o-1){const g=T+1,p=e[g];if(n(p,A.terminalType)){const E={idx:g,def:K(m),ruleStack:y,occurrenceStack:I};u.push(E)}}else if(T===o-1)d.push({nextTokenType:A.terminalType,nextTokenOccurrence:A.idx,ruleStack:y,occurrenceStack:I}),c=!0;else throw Error("non exhaustive match");else if(A instanceof se){const g=z(y);g.push(A.nonTerminalName);const p=z(I);p.push(A.idx);const E={idx:T,def:A.definition.concat(i,K(m)),ruleStack:g,occurrenceStack:p};u.push(E)}else if(A instanceof Z){const g={idx:T,def:K(m),ruleStack:y,occurrenceStack:I};u.push(g),u.push(a);const p={idx:T,def:A.definition.concat(K(m)),ruleStack:y,occurrenceStack:I};u.push(p)}else if(A instanceof _e){const g=new B({definition:A.definition,idx:A.idx}),p=A.definition.concat([g],K(m)),E={idx:T,def:p,ruleStack:y,occurrenceStack:I};u.push(E)}else if(A instanceof xe){const g=new M({terminalType:A.separator}),p=new B({definition:[g].concat(A.definition),idx:A.idx}),E=A.definition.concat([p],K(m)),k={idx:T,def:E,ruleStack:y,occurrenceStack:I};u.push(k)}else if(A instanceof Re){const g={idx:T,def:K(m),ruleStack:y,occurrenceStack:I};u.push(g),u.push(a);const p=new M({terminalType:A.separator}),E=new B({definition:[p].concat(A.definition),idx:A.idx}),k=A.definition.concat([E],K(m)),pe={idx:T,def:k,ruleStack:y,occurrenceStack:I};u.push(pe)}else if(A instanceof B){const g={idx:T,def:K(m),ruleStack:y,occurrenceStack:I};u.push(g),u.push(a);const p=new B({definition:A.definition,idx:A.idx}),E=A.definition.concat([p],K(m)),k={idx:T,def:E,ruleStack:y,occurrenceStack:I};u.push(k)}else if(A instanceof Le)for(let g=A.definition.length-1;g>=0;g--){const p=A.definition[g],E={idx:T,def:p.definition.concat(K(m)),ruleStack:y,occurrenceStack:I};u.push(E),u.push(a)}else if(A instanceof ee)u.push({idx:T,def:A.definition.concat(K(m)),ruleStack:y,occurrenceStack:I});else if(A instanceof yt)u.push(Cp(A,T,y,I));else throw Error("non exhaustive match")}return d}function Cp(t,e,n,s){const r=z(n);r.push(t.name);const i=z(s);return i.push(1),{idx:e,def:t.definition,ruleStack:r,occurrenceStack:i}}var P;(function(t){t[t.OPTION=0]="OPTION",t[t.REPETITION=1]="REPETITION",t[t.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",t[t.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",t[t.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",t[t.ALTERNATION=5]="ALTERNATION"})(P||(P={}));function da(t){if(t instanceof Z||t==="Option")return P.OPTION;if(t instanceof B||t==="Repetition")return P.REPETITION;if(t instanceof _e||t==="RepetitionMandatory")return P.REPETITION_MANDATORY;if(t instanceof xe||t==="RepetitionMandatoryWithSeparator")return P.REPETITION_MANDATORY_WITH_SEPARATOR;if(t instanceof Re||t==="RepetitionWithSeparator")return P.REPETITION_WITH_SEPARATOR;if(t instanceof Le||t==="Alternation")return P.ALTERNATION;throw Error("non exhaustive match")}function kp(t,e,n,s,r,i){const a=Js(t,e,n),c=ma(a)?In:Zt;return i(a,s,c,r)}function vp(t,e,n,s,r,i){const a=qs(t,e,r,n),c=ma(a)?In:Zt;return i(a[0],c,s)}function _p(t,e,n,s){const r=t.length,i=Ee(t,a=>Ee(a,c=>c.length===1));if(e)return function(a){const c=S(a,o=>o.GATE);for(let o=0;o<r;o++){const l=t[o],d=l.length,u=c[o];if(!(u!==void 0&&u.call(this)===!1))e:for(let f=0;f<d;f++){const m=l[f],T=m.length;for(let y=0;y<T;y++){const I=this.LA(y+1);if(n(I,m[y])===!1)continue e}return o}}};if(i&&!s){const a=S(t,o=>Te(o)),c=ne(a,(o,l,d)=>(O(l,u=>{L(o,u.tokenTypeIdx)||(o[u.tokenTypeIdx]=d),O(u.categoryMatches,f=>{L(o,f)||(o[f]=d)})}),o),{});return function(){const o=this.LA(1);return c[o.tokenTypeIdx]}}else return function(){for(let a=0;a<r;a++){const c=t[a],o=c.length;e:for(let l=0;l<o;l++){const d=c[l],u=d.length;for(let f=0;f<u;f++){const m=this.LA(f+1);if(n(m,d[f])===!1)continue e}return a}}}}function xp(t,e,n){const s=Ee(t,i=>i.length===1),r=t.length;if(s&&!n){const i=Te(t);if(i.length===1&&_(i[0].categoryMatches)){const c=i[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===c}}else{const a=ne(i,(c,o,l)=>(c[o.tokenTypeIdx]=!0,O(o.categoryMatches,d=>{c[d]=!0}),c),[]);return function(){const c=this.LA(1);return a[c.tokenTypeIdx]===!0}}}else return function(){e:for(let i=0;i<r;i++){const a=t[i],c=a.length;for(let o=0;o<c;o++){const l=this.LA(o+1);if(e(l,a[o])===!1)continue e}return!0}return!1}}class wp extends Kn{constructor(e,n,s){super(),this.topProd=e,this.targetOccurrence=n,this.targetProdType=s}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,n,s,r){return e.idx===this.targetOccurrence&&this.targetProdType===n?(this.restDef=s.concat(r),!0):!1}walkOption(e,n,s){this.checkIsTarget(e,P.OPTION,n,s)||super.walkOption(e,n,s)}walkAtLeastOne(e,n,s){this.checkIsTarget(e,P.REPETITION_MANDATORY,n,s)||super.walkOption(e,n,s)}walkAtLeastOneSep(e,n,s){this.checkIsTarget(e,P.REPETITION_MANDATORY_WITH_SEPARATOR,n,s)||super.walkOption(e,n,s)}walkMany(e,n,s){this.checkIsTarget(e,P.REPETITION,n,s)||super.walkOption(e,n,s)}walkManySep(e,n,s){this.checkIsTarget(e,P.REPETITION_WITH_SEPARATOR,n,s)||super.walkOption(e,n,s)}}class fa extends St{constructor(e,n,s){super(),this.targetOccurrence=e,this.targetProdType=n,this.targetRef=s,this.result=[]}checkIsTarget(e,n){e.idx===this.targetOccurrence&&this.targetProdType===n&&(this.targetRef===void 0||e===this.targetRef)&&(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,P.OPTION)}visitRepetition(e){this.checkIsTarget(e,P.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,P.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,P.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,P.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,P.ALTERNATION)}}function ri(t){const e=new Array(t);for(let n=0;n<t;n++)e[n]=[];return e}function rs(t){let e=[""];for(let n=0;n<t.length;n++){const s=t[n],r=[];for(let i=0;i<e.length;i++){const a=e[i];r.push(a+"_"+s.tokenTypeIdx);for(let c=0;c<s.categoryMatches.length;c++){const o="_"+s.categoryMatches[c];r.push(a+o)}}e=r}return e}function Mp(t,e,n){for(let s=0;s<t.length;s++){if(s===n)continue;const r=t[s];for(let i=0;i<e.length;i++){const a=e[i];if(r[a]===!0)return!1}}return!0}function pa(t,e){const n=S(t,a=>Ts([a],1)),s=ri(n.length),r=S(n,a=>{const c={};return O(a,o=>{const l=rs(o.partialPath);O(l,d=>{c[d]=!0})}),c});let i=n;for(let a=1;a<=e;a++){const c=i;i=ri(c.length);for(let o=0;o<c.length;o++){const l=c[o];for(let d=0;d<l.length;d++){const u=l[d].partialPath,f=l[d].suffixDef,m=rs(u);if(Mp(r,m,o)||_(f)||u.length===e){const y=s[o];if(Es(y,u)===!1){y.push(u);for(let I=0;I<m.length;I++){const A=m[I];r[o][A]=!0}}}else{const y=Ts(f,a+1,u);i[o]=i[o].concat(y),O(y,I=>{const A=rs(I.partialPath);O(A,g=>{r[o][g]=!0})})}}}}return s}function Js(t,e,n,s){const r=new fa(t,P.ALTERNATION,s);return e.accept(r),pa(r.result,n)}function qs(t,e,n,s){const r=new fa(t,n);e.accept(r);const i=r.result,c=new wp(e,t,n).startWalking(),o=new ee({definition:i}),l=new ee({definition:c});return pa([o,l],s)}function Es(t,e){e:for(let n=0;n<t.length;n++){const s=t[n];if(s.length===e.length){for(let r=0;r<s.length;r++){const i=e[r],a=s[r];if((i===a||a.categoryMatchesMap[i.tokenTypeIdx]!==void 0)===!1)continue e}return!0}}return!1}function Up(t,e){return t.length<e.length&&Ee(t,(n,s)=>{const r=e[s];return n===r||r.categoryMatchesMap[n.tokenTypeIdx]})}function ma(t){return Ee(t,e=>Ee(e,n=>Ee(n,s=>_(s.categoryMatches))))}function Pp(t){const e=t.lookaheadStrategy.validate({rules:t.rules,tokenTypes:t.tokenTypes,grammarName:t.grammarName});return S(e,n=>Object.assign({type:X.CUSTOM_LOOKAHEAD_VALIDATION},n))}function $p(t,e,n,s){const r=le(t,o=>Dp(o,n)),i=Jp(t,e,n),a=le(t,o=>Hp(o,n)),c=le(t,o=>Gp(o,t,s,n));return r.concat(i,a,c)}function Dp(t,e){const n=new Bp;t.accept(n);const s=n.allProductions,r=Jd(s,Fp),i=Se(r,c=>c.length>1);return S(F(i),c=>{const o=ye(c),l=e.buildDuplicateFoundError(t,c),d=Ne(o),u={message:l,type:X.DUPLICATE_PRODUCTIONS,ruleName:t.name,dslName:d,occurrence:o.idx},f=ga(o);return f&&(u.parameter=f),u})}function Fp(t){return`${Ne(t)}_#_${t.idx}_#_${ga(t)}`}function ga(t){return t instanceof M?t.terminalType.name:t instanceof se?t.nonTerminalName:""}class Bp extends St{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 Gp(t,e,n,s){const r=[];if(ne(e,(a,c)=>c.name===t.name?a+1:a,0)>1){const a=s.buildDuplicateRuleNameError({topLevelRule:t,grammarName:n});r.push({message:a,type:X.DUPLICATE_RULE_NAME,ruleName:t.name})}return r}function Wp(t,e,n){const s=[];let r;return J(e,t)||(r=`Invalid rule override, rule: ->${t}<- cannot be overridden in the grammar: ->${n}<-as it is not defined in any of the super grammars `,s.push({message:r,type:X.INVALID_RULE_OVERRIDE,ruleName:t})),s}function Ta(t,e,n,s=[]){const r=[],i=dn(e.definition);if(_(i))return[];{const a=t.name;J(i,t)&&r.push({message:n.buildLeftRecursionError({topLevelRule:t,leftRecursionPath:s}),type:X.LEFT_RECURSION,ruleName:a});const o=Wn(i,s.concat([t])),l=le(o,d=>{const u=z(s);return u.push(d),Ta(t,d,n,u)});return r.concat(l)}}function dn(t){let e=[];if(_(t))return e;const n=ye(t);if(n instanceof se)e.push(n.referencedRule);else if(n instanceof ee||n instanceof Z||n instanceof _e||n instanceof xe||n instanceof Re||n instanceof B)e=e.concat(dn(n.definition));else if(n instanceof Le)e=Te(S(n.definition,i=>dn(i.definition)));else if(!(n instanceof M))throw Error("non exhaustive match");const s=Rn(n),r=t.length>1;if(s&&r){const i=K(t);return e.concat(dn(i))}else return e}class Zs extends St{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}}function jp(t,e){const n=new Zs;t.accept(n);const s=n.alternations;return le(s,i=>{const a=Kt(i.definition);return le(a,(c,o)=>{const l=ua([c],[],Zt,1);return _(l)?[{message:e.buildEmptyAlternationError({topLevelRule:t,alternation:i,emptyChoiceIdx:o}),type:X.NONE_LAST_EMPTY_ALT,ruleName:t.name,occurrence:i.idx,alternative:o+1}]:[]})})}function Kp(t,e,n){const s=new Zs;t.accept(s);let r=s.alternations;return r=jn(r,a=>a.ignoreAmbiguities===!0),le(r,a=>{const c=a.idx,o=a.maxLookahead||e,l=Js(c,t,o,a),d=Yp(l,a,t,n),u=Xp(l,a,t,n);return d.concat(u)})}class zp extends St{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 Hp(t,e){const n=new Zs;t.accept(n);const s=n.alternations;return le(s,i=>i.definition.length>255?[{message:e.buildTooManyAlternativesError({topLevelRule:t,alternation:i}),type:X.TOO_MANY_ALTS,ruleName:t.name,occurrence:i.idx}]:[])}function Vp(t,e,n){const s=[];return O(t,r=>{const i=new zp;r.accept(i);const a=i.allProductions;O(a,c=>{const o=da(c),l=c.maxLookahead||e,d=c.idx,f=qs(d,r,o,l)[0];if(_(Te(f))){const m=n.buildEmptyRepetitionError({topLevelRule:r,repetition:c});s.push({message:m,type:X.NO_NON_EMPTY_LOOKAHEAD,ruleName:r.name})}})}),s}function Yp(t,e,n,s){const r=[],i=ne(t,(c,o,l)=>(e.definition[l].ignoreAmbiguities===!0||O(o,d=>{const u=[l];O(t,(f,m)=>{l!==m&&Es(f,d)&&e.definition[m].ignoreAmbiguities!==!0&&u.push(m)}),u.length>1&&!Es(r,d)&&(r.push(d),c.push({alts:u,path:d}))}),c),[]);return S(i,c=>{const o=S(c.alts,d=>d+1);return{message:s.buildAlternationAmbiguityError({topLevelRule:n,alternation:e,ambiguityIndices:o,prefixPath:c.path}),type:X.AMBIGUOUS_ALTS,ruleName:n.name,occurrence:e.idx,alternatives:c.alts}})}function Xp(t,e,n,s){const r=ne(t,(a,c,o)=>{const l=S(c,d=>({idx:o,path:d}));return a.concat(l)},[]);return Jt(le(r,a=>{if(e.definition[a.idx].ignoreAmbiguities===!0)return[];const o=a.idx,l=a.path,d=fe(r,f=>e.definition[f.idx].ignoreAmbiguities!==!0&&f.idx<o&&Up(f.path,l));return S(d,f=>{const m=[f.idx+1,o+1],T=e.idx===0?"":e.idx;return{message:s.buildAlternationPrefixAmbiguityError({topLevelRule:n,alternation:e,ambiguityIndices:m,prefixPath:f.path}),type:X.AMBIGUOUS_PREFIX_ALTS,ruleName:n.name,occurrence:T,alternatives:m}})}))}function Jp(t,e,n){const s=[],r=S(e,i=>i.name);return O(t,i=>{const a=i.name;if(J(r,a)){const c=n.buildNamespaceConflictError(i);s.push({message:c,type:X.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:a})}}),s}function qp(t){const e=zs(t,{errMsgProvider:Sp}),n={};return O(t.rules,s=>{n[s.name]=s}),Rp(n,e.errMsgProvider)}function Zp(t){return t=zs(t,{errMsgProvider:et}),$p(t.rules,t.tokenTypes,t.errMsgProvider,t.grammarName)}const Ea="MismatchedTokenException",Aa="NoViableAltException",ya="EarlyExitException",Sa="NotAllInputParsedException",Ra=[Ea,Aa,ya,Sa];Object.freeze(Ra);function bn(t){return J(Ra,t.name)}class Vn extends Error{constructor(e,n){super(e),this.token=n,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}class La extends Vn{constructor(e,n,s){super(e,n),this.previousToken=s,this.name=Ea}}class Qp extends Vn{constructor(e,n,s){super(e,n),this.previousToken=s,this.name=Aa}}class em extends Vn{constructor(e,n){super(e,n),this.name=Sa}}class tm extends Vn{constructor(e,n,s){super(e,n),this.previousToken=s,this.name=ya}}const is={},Oa="InRuleRecoveryException";class nm extends Error{constructor(e){super(e),this.name=Oa}}class sm{initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=L(e,"recoveryEnabled")?e.recoveryEnabled:Fe.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=rm)}getTokenToInsert(e){const n=Xs(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return n.isInsertedInRecovery=!0,n}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,n,s,r){const i=this.findReSyncTokenType(),a=this.exportLexerState(),c=[];let o=!1;const l=this.LA(1);let d=this.LA(1);const u=()=>{const f=this.LA(0),m=this.errorMessageProvider.buildMismatchTokenMessage({expected:r,actual:l,previous:f,ruleName:this.getCurrRuleFullName()}),T=new La(m,l,this.LA(0));T.resyncedTokens=Kt(c),this.SAVE_ERROR(T)};for(;!o;)if(this.tokenMatcher(d,r)){u();return}else if(s.call(this)){u(),e.apply(this,n);return}else this.tokenMatcher(d,i)?o=!0:(d=this.SKIP_TOKEN(),this.addToResyncTokens(d,c));this.importLexerState(a)}shouldInRepetitionRecoveryBeTried(e,n,s){return!(s===!1||this.tokenMatcher(this.LA(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,n)))}getFollowsForInRuleRecovery(e,n){const s=this.getCurrentGrammarPath(e,n);return this.getNextPossibleTokenTypes(s)}tryInRuleRecovery(e,n){if(this.canRecoverWithSingleTokenInsertion(e,n))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){const s=this.SKIP_TOKEN();return this.consumeToken(),s}throw new nm("sad sad panda")}canPerformInRuleRecovery(e,n){return this.canRecoverWithSingleTokenInsertion(e,n)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,n){if(!this.canTokenTypeBeInsertedInRecovery(e)||_(n))return!1;const s=this.LA(1);return At(n,i=>this.tokenMatcher(s,i))!==void 0}canRecoverWithSingleTokenDeletion(e){return this.canTokenTypeBeDeletedInRecovery(e)?this.tokenMatcher(this.LA(2),e):!1}isInCurrentRuleReSyncSet(e){const n=this.getCurrFollowKey(),s=this.getFollowSetFromFollowKey(n);return J(s,e)}findReSyncTokenType(){const e=this.flattenFollowSet();let n=this.LA(1),s=2;for(;;){const r=At(e,i=>la(n,i));if(r!==void 0)return r;n=this.LA(s),s++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return is;const e=this.getLastExplicitRuleShortName(),n=this.getLastExplicitRuleOccurrenceIndex(),s=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:n,inRule:this.shortRuleNameToFullName(s)}}buildFullFollowKeyStack(){const e=this.RULE_STACK,n=this.RULE_OCCURRENCE_STACK;return S(e,(s,r)=>r===0?is:{ruleName:this.shortRuleNameToFullName(s),idxInCallingRule:n[r],inRule:this.shortRuleNameToFullName(e[r-1])})}flattenFollowSet(){const e=S(this.buildFullFollowKeyStack(),n=>this.getFollowSetFromFollowKey(n));return Te(e)}getFollowSetFromFollowKey(e){if(e===is)return[De];const n=e.ruleName+e.idxInCallingRule+ea+e.inRule;return this.resyncFollows[n]}addToResyncTokens(e,n){return this.tokenMatcher(e,De)||n.push(e),n}reSyncTo(e){const n=[];let s=this.LA(1);for(;this.tokenMatcher(s,e)===!1;)s=this.SKIP_TOKEN(),this.addToResyncTokens(s,n);return Kt(n)}attemptInRepetitionRecovery(e,n,s,r,i,a,c){}getCurrentGrammarPath(e,n){const s=this.getHumanReadableRuleStack(),r=z(this.RULE_OCCURRENCE_STACK);return{ruleStack:s,occurrenceStack:r,lastTok:e,lastTokOccurrence:n}}getHumanReadableRuleStack(){return S(this.RULE_STACK,e=>this.shortRuleNameToFullName(e))}}function rm(t,e,n,s,r,i,a){const c=this.getKeyForAutomaticLookahead(s,r);let o=this.firstAfterRepMap[c];if(o===void 0){const f=this.getCurrRuleFullName(),m=this.getGAstProductions()[f];o=new i(m,r).startWalking(),this.firstAfterRepMap[c]=o}let l=o.token,d=o.occurrence;const u=o.isEndOfRule;this.RULE_STACK.length===1&&u&&l===void 0&&(l=De,d=1),!(l===void 0||d===void 0)&&this.shouldInRepetitionRecoveryBeTried(l,d,a)&&this.tryInRepetitionRecovery(t,e,n,l)}const im=4,Xe=8,Na=1<<Xe,Ia=2<<Xe,As=3<<Xe,ys=4<<Xe,Ss=5<<Xe,fn=6<<Xe;function as(t,e,n){return n|e|t}class am{constructor(e){var n;this.maxLookahead=(n=e?.maxLookahead)!==null&&n!==void 0?n:Fe.maxLookahead}validate(e){const n=this.validateNoLeftRecursion(e.rules);if(_(n)){const s=this.validateEmptyOrAlternatives(e.rules),r=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),i=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...n,...s,...r,...i]}return n}validateNoLeftRecursion(e){return le(e,n=>Ta(n,n,et))}validateEmptyOrAlternatives(e){return le(e,n=>jp(n,et))}validateAmbiguousAlternationAlternatives(e,n){return le(e,s=>Kp(s,n,et))}validateSomeNonEmptyLookaheadPath(e,n){return Vp(e,n,et)}buildLookaheadForAlternation(e){return kp(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,_p)}buildLookaheadForOptional(e){return vp(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,da(e.prodType),xp)}}class om{initLooksAhead(e){this.dynamicTokensEnabled=L(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:Fe.dynamicTokensEnabled,this.maxLookahead=L(e,"maxLookahead")?e.maxLookahead:Fe.maxLookahead,this.lookaheadStrategy=L(e,"lookaheadStrategy")?e.lookaheadStrategy:new am({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){O(e,n=>{this.TRACE_INIT(`${n.name} Rule Lookahead`,()=>{const{alternation:s,repetition:r,option:i,repetitionMandatory:a,repetitionMandatoryWithSeparator:c,repetitionWithSeparator:o}=lm(n);O(s,l=>{const d=l.idx===0?"":l.idx;this.TRACE_INIT(`${Ne(l)}${d}`,()=>{const u=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:l.idx,rule:n,maxLookahead:l.maxLookahead||this.maxLookahead,hasPredicates:l.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),f=as(this.fullRuleNameToShort[n.name],Na,l.idx);this.setLaFuncCache(f,u)})}),O(r,l=>{this.computeLookaheadFunc(n,l.idx,As,"Repetition",l.maxLookahead,Ne(l))}),O(i,l=>{this.computeLookaheadFunc(n,l.idx,Ia,"Option",l.maxLookahead,Ne(l))}),O(a,l=>{this.computeLookaheadFunc(n,l.idx,ys,"RepetitionMandatory",l.maxLookahead,Ne(l))}),O(c,l=>{this.computeLookaheadFunc(n,l.idx,fn,"RepetitionMandatoryWithSeparator",l.maxLookahead,Ne(l))}),O(o,l=>{this.computeLookaheadFunc(n,l.idx,Ss,"RepetitionWithSeparator",l.maxLookahead,Ne(l))})})})}computeLookaheadFunc(e,n,s,r,i,a){this.TRACE_INIT(`${a}${n===0?"":n}`,()=>{const c=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:n,rule:e,maxLookahead:i||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:r}),o=as(this.fullRuleNameToShort[e.name],s,n);this.setLaFuncCache(o,c)})}getKeyForAutomaticLookahead(e,n){const s=this.getLastExplicitRuleShortName();return as(s,e,n)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,n){this.lookAheadFuncsCache.set(e,n)}}class cm extends St{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)}}const on=new cm;function lm(t){on.reset(),t.accept(on);const e=on.dslMethods;return on.reset(),e}function ii(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.endOffset=e.endOffset):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset)}function ai(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.startColumn=e.startColumn,t.startLine=e.startLine,t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine)}function hm(t,e,n){t.children[n]===void 0?t.children[n]=[e]:t.children[n].push(e)}function um(t,e,n){t.children[e]===void 0?t.children[e]=[n]:t.children[e].push(n)}const dm="name";function ba(t,e){Object.defineProperty(t,dm,{enumerable:!1,configurable:!0,writable:!1,value:e})}function fm(t,e){const n=de(t),s=n.length;for(let r=0;r<s;r++){const i=n[r],a=t[i],c=a.length;for(let o=0;o<c;o++){const l=a[o];l.tokenTypeIdx===void 0&&this[l.name](l.children,e)}}}function pm(t,e){const n=function(){};ba(n,t+"BaseSemantics");const s={visit:function(r,i){if(C(r)&&(r=r[0]),!$e(r))return this[r.name](r.children,i)},validateVisitor:function(){const r=gm(this,e);if(!_(r)){const i=S(r,a=>a.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
|
|
87
|
+
${i.join(`
|
|
88
|
+
|
|
89
|
+
`).replace(/\n/g,`
|
|
90
|
+
`)}`)}}};return n.prototype=s,n.prototype.constructor=n,n._RULE_NAMES=e,n}function mm(t,e,n){const s=function(){};ba(s,t+"BaseSemanticsWithDefaults");const r=Object.create(n.prototype);return O(e,i=>{r[i]=fm}),s.prototype=r,s.prototype.constructor=s,s}var Rs;(function(t){t[t.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",t[t.MISSING_METHOD=1]="MISSING_METHOD"})(Rs||(Rs={}));function gm(t,e){return Tm(t,e)}function Tm(t,e){const n=fe(e,r=>Be(t[r])===!1),s=S(n,r=>({msg:`Missing visitor method: <${r}> on ${t.constructor.name} CST Visitor.`,type:Rs.MISSING_METHOD,methodName:r}));return Jt(s)}class Em{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=L(e,"nodeLocationTracking")?e.nodeLocationTracking:Fe.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=G,this.cstFinallyStateUpdate=G,this.cstPostTerminal=G,this.cstPostNonTerminal=G,this.cstPostRule=G;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=ai,this.setNodeLocationFromNode=ai,this.cstPostRule=G,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=G,this.setNodeLocationFromNode=G,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=ii,this.setNodeLocationFromNode=ii,this.cstPostRule=G,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=G,this.setNodeLocationFromNode=G,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=G,this.setNodeLocationFromNode=G,this.cstPostRule=G,this.setInitialNodeLocation=G;else throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`)}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:NaN,endOffset:NaN}}setInitialNodeLocationOnlyOffsetRegular(e){e.location={startOffset:this.LA(1).startOffset,endOffset:NaN}}setInitialNodeLocationFullRecovery(e){e.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}}setInitialNodeLocationFullRegular(e){const n=this.LA(1);e.location={startOffset:n.startOffset,startLine:n.startLine,startColumn:n.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(e){const n={name:e,children:Object.create(null)};this.setInitialNodeLocation(n),this.CST_STACK.push(n)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){const n=this.LA(0),s=e.location;s.startOffset<=n.startOffset?(s.endOffset=n.endOffset,s.endLine=n.endLine,s.endColumn=n.endColumn):(s.startOffset=NaN,s.startLine=NaN,s.startColumn=NaN)}cstPostRuleOnlyOffset(e){const n=this.LA(0),s=e.location;s.startOffset<=n.startOffset?s.endOffset=n.endOffset:s.startOffset=NaN}cstPostTerminal(e,n){const s=this.CST_STACK[this.CST_STACK.length-1];hm(s,n,e),this.setNodeLocationFromToken(s.location,n)}cstPostNonTerminal(e,n){const s=this.CST_STACK[this.CST_STACK.length-1];um(s,n,e),this.setNodeLocationFromNode(s.location,e.location)}getBaseCstVisitorConstructor(){if($e(this.baseCstVisitorConstructor)){const e=pm(this.className,de(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if($e(this.baseCstVisitorWithDefaultsConstructor)){const e=mm(this.className,de(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getLastExplicitRuleShortName(){const e=this.RULE_STACK;return e[e.length-1]}getPreviousExplicitRuleShortName(){const e=this.RULE_STACK;return e[e.length-2]}getLastExplicitRuleOccurrenceIndex(){const e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]}}class Am{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.tokVector.length-2?(this.consumeToken(),this.LA(1)):kn}LA(e){const n=this.currIdx+e;return n<0||this.tokVectorLength<=n?kn:this.tokVector[n]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(e){this.currIdx=e}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVector.length-1}getLexerPosition(){return this.exportLexerState()}}class ym{ACTION(e){return e.call(this)}consume(e,n,s){return this.consumeInternal(n,e,s)}subrule(e,n,s){return this.subruleInternal(n,e,s)}option(e,n){return this.optionInternal(n,e)}or(e,n){return this.orInternal(n,e)}many(e,n){return this.manyInternal(e,n)}atLeastOne(e,n){return this.atLeastOneInternal(e,n)}CONSUME(e,n){return this.consumeInternal(e,0,n)}CONSUME1(e,n){return this.consumeInternal(e,1,n)}CONSUME2(e,n){return this.consumeInternal(e,2,n)}CONSUME3(e,n){return this.consumeInternal(e,3,n)}CONSUME4(e,n){return this.consumeInternal(e,4,n)}CONSUME5(e,n){return this.consumeInternal(e,5,n)}CONSUME6(e,n){return this.consumeInternal(e,6,n)}CONSUME7(e,n){return this.consumeInternal(e,7,n)}CONSUME8(e,n){return this.consumeInternal(e,8,n)}CONSUME9(e,n){return this.consumeInternal(e,9,n)}SUBRULE(e,n){return this.subruleInternal(e,0,n)}SUBRULE1(e,n){return this.subruleInternal(e,1,n)}SUBRULE2(e,n){return this.subruleInternal(e,2,n)}SUBRULE3(e,n){return this.subruleInternal(e,3,n)}SUBRULE4(e,n){return this.subruleInternal(e,4,n)}SUBRULE5(e,n){return this.subruleInternal(e,5,n)}SUBRULE6(e,n){return this.subruleInternal(e,6,n)}SUBRULE7(e,n){return this.subruleInternal(e,7,n)}SUBRULE8(e,n){return this.subruleInternal(e,8,n)}SUBRULE9(e,n){return this.subruleInternal(e,9,n)}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,n,s=vn){if(J(this.definedRulesNames,e)){const a={message:et.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:X.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(a)}this.definedRulesNames.push(e);const r=this.defineRule(e,n,s);return this[e]=r,r}OVERRIDE_RULE(e,n,s=vn){const r=Wp(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(r);const i=this.defineRule(e,n,s);return this[e]=i,i}BACKTRACK(e,n){return function(){this.isBackTrackingStack.push(1);const s=this.saveRecogState();try{return e.apply(this,n),!0}catch(r){if(bn(r))return!1;throw r}finally{this.reloadRecogState(s),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return Rf(F(this.gastProductionsCache))}}class Sm{initRecognizerEngine(e,n){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=In,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},L(n,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
|
|
91
|
+
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
|
|
92
|
+
For Further details.`);if(C(e)){if(_(e))throw Error(`A Token Vocabulary cannot be empty.
|
|
93
|
+
Note that the first argument for the parser constructor
|
|
94
|
+
is no longer a Token vector (since v4.0).`);if(typeof e[0].startOffset=="number")throw Error(`The Parser constructor no longer accepts a token vector as the first argument.
|
|
95
|
+
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
|
|
96
|
+
For Further details.`)}if(C(e))this.tokensMap=ne(e,(i,a)=>(i[a.name]=a,i),{});else if(L(e,"modes")&&Ee(Te(F(e.modes)),Tp)){const i=Te(F(e.modes)),a=Hs(i);this.tokensMap=ne(a,(c,o)=>(c[o.name]=o,c),{})}else if(ue(e))this.tokensMap=z(e);else throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=De;const s=L(e,"modes")?Te(F(e.modes)):F(e),r=Ee(s,i=>_(i.categoryMatches));this.tokenMatcher=r?In:Zt,Qt(F(this.tokensMap))}defineRule(e,n,s){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'
|
|
97
|
+
Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);const r=L(s,"resyncEnabled")?s.resyncEnabled:vn.resyncEnabled,i=L(s,"recoveryValueFunc")?s.recoveryValueFunc:vn.recoveryValueFunc,a=this.ruleShortNameIdx<<im+Xe;this.ruleShortNameIdx++,this.shortRuleNameToFull[a]=e,this.fullRuleNameToShort[e]=a;let c;return this.outputCst===!0?c=function(...d){try{this.ruleInvocationStateUpdate(a,e,this.subruleIdx),n.apply(this,d);const u=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(u),u}catch(u){return this.invokeRuleCatch(u,r,i)}finally{this.ruleFinallyStateUpdate()}}:c=function(...d){try{return this.ruleInvocationStateUpdate(a,e,this.subruleIdx),n.apply(this,d)}catch(u){return this.invokeRuleCatch(u,r,i)}finally{this.ruleFinallyStateUpdate()}},Object.assign(c,{ruleName:e,originalGrammarAction:n})}invokeRuleCatch(e,n,s){const r=this.RULE_STACK.length===1,i=n&&!this.isBackTracking()&&this.recoveryEnabled;if(bn(e)){const a=e;if(i){const c=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(c))if(a.resyncedTokens=this.reSyncTo(c),this.outputCst){const o=this.CST_STACK[this.CST_STACK.length-1];return o.recoveredNode=!0,o}else return s(e);else{if(this.outputCst){const o=this.CST_STACK[this.CST_STACK.length-1];o.recoveredNode=!0,a.partialCstResult=o}throw a}}else{if(r)return this.moveToTerminatedState(),s(e);throw a}}else throw e}optionInternal(e,n){const s=this.getKeyForAutomaticLookahead(Ia,n);return this.optionInternalLogic(e,n,s)}optionInternalLogic(e,n,s){let r=this.getLaFuncFromCache(s),i;if(typeof e!="function"){i=e.DEF;const a=e.GATE;if(a!==void 0){const c=r;r=()=>a.call(this)&&c.call(this)}}else i=e;if(r.call(this)===!0)return i.call(this)}atLeastOneInternal(e,n){const s=this.getKeyForAutomaticLookahead(ys,e);return this.atLeastOneInternalLogic(e,n,s)}atLeastOneInternalLogic(e,n,s){let r=this.getLaFuncFromCache(s),i;if(typeof n!="function"){i=n.DEF;const a=n.GATE;if(a!==void 0){const c=r;r=()=>a.call(this)&&c.call(this)}}else i=n;if(r.call(this)===!0){let a=this.doSingleRepetition(i);for(;r.call(this)===!0&&a===!0;)a=this.doSingleRepetition(i)}else throw this.raiseEarlyExitException(e,P.REPETITION_MANDATORY,n.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,n],r,ys,e,bp)}atLeastOneSepFirstInternal(e,n){const s=this.getKeyForAutomaticLookahead(fn,e);this.atLeastOneSepFirstInternalLogic(e,n,s)}atLeastOneSepFirstInternalLogic(e,n,s){const r=n.DEF,i=n.SEP;if(this.getLaFuncFromCache(s).call(this)===!0){r.call(this);const c=()=>this.tokenMatcher(this.LA(1),i);for(;this.tokenMatcher(this.LA(1),i)===!0;)this.CONSUME(i),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,c,r,si],c,fn,e,si)}else throw this.raiseEarlyExitException(e,P.REPETITION_MANDATORY_WITH_SEPARATOR,n.ERR_MSG)}manyInternal(e,n){const s=this.getKeyForAutomaticLookahead(As,e);return this.manyInternalLogic(e,n,s)}manyInternalLogic(e,n,s){let r=this.getLaFuncFromCache(s),i;if(typeof n!="function"){i=n.DEF;const c=n.GATE;if(c!==void 0){const o=r;r=()=>c.call(this)&&o.call(this)}}else i=n;let a=!0;for(;r.call(this)===!0&&a===!0;)a=this.doSingleRepetition(i);this.attemptInRepetitionRecovery(this.manyInternal,[e,n],r,As,e,Ip,a)}manySepFirstInternal(e,n){const s=this.getKeyForAutomaticLookahead(Ss,e);this.manySepFirstInternalLogic(e,n,s)}manySepFirstInternalLogic(e,n,s){const r=n.DEF,i=n.SEP;if(this.getLaFuncFromCache(s).call(this)===!0){r.call(this);const c=()=>this.tokenMatcher(this.LA(1),i);for(;this.tokenMatcher(this.LA(1),i)===!0;)this.CONSUME(i),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,c,r,ni],c,Ss,e,ni)}}repetitionSepSecondInternal(e,n,s,r,i){for(;s();)this.CONSUME(n),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,n,s,r,i],s,fn,e,i)}doSingleRepetition(e){const n=this.getLexerPosition();return e.call(this),this.getLexerPosition()>n}orInternal(e,n){const s=this.getKeyForAutomaticLookahead(Na,n),r=C(e)?e:e.DEF,a=this.getLaFuncFromCache(s).call(this,r);if(a!==void 0)return r[a].ALT.call(this);this.raiseNoAltException(n,e.ERR_MSG)}ruleFinallyStateUpdate(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){const e=this.LA(1),n=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new em(n,e))}}subruleInternal(e,n,s){let r;try{const i=s!==void 0?s.ARGS:void 0;return this.subruleIdx=n,r=e.apply(this,i),this.cstPostNonTerminal(r,s!==void 0&&s.LABEL!==void 0?s.LABEL:e.ruleName),r}catch(i){throw this.subruleInternalError(i,s,e.ruleName)}}subruleInternalError(e,n,s){throw bn(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,n!==void 0&&n.LABEL!==void 0?n.LABEL:s),delete e.partialCstResult),e}consumeInternal(e,n,s){let r;try{const i=this.LA(1);this.tokenMatcher(i,e)===!0?(this.consumeToken(),r=i):this.consumeInternalError(e,i,s)}catch(i){r=this.consumeInternalRecovery(e,n,i)}return this.cstPostTerminal(s!==void 0&&s.LABEL!==void 0?s.LABEL:e.name,r),r}consumeInternalError(e,n,s){let r;const i=this.LA(0);throw s!==void 0&&s.ERR_MSG?r=s.ERR_MSG:r=this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:n,previous:i,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new La(r,n,i))}consumeInternalRecovery(e,n,s){if(this.recoveryEnabled&&s.name==="MismatchedTokenException"&&!this.isBackTracking()){const r=this.getFollowsForInRuleRecovery(e,n);try{return this.tryInRuleRecovery(e,r)}catch(i){throw i.name===Oa?s:i}}else throw s}saveRecogState(){const e=this.errors,n=z(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:n,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK}ruleInvocationStateUpdate(e,n,s){this.RULE_OCCURRENCE_STACK.push(s),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(n)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){const e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),De)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}}class Rm{initErrorHandler(e){this._errors=[],this.errorMessageProvider=L(e,"errorMessageProvider")?e.errorMessageProvider:Fe.errorMessageProvider}SAVE_ERROR(e){if(bn(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:z(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return z(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,n,s){const r=this.getCurrRuleFullName(),i=this.getGAstProductions()[r],c=qs(e,i,n,this.maxLookahead)[0],o=[];for(let d=1;d<=this.maxLookahead;d++)o.push(this.LA(d));const l=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:c,actual:o,previous:this.LA(0),customUserDescription:s,ruleName:r});throw this.SAVE_ERROR(new tm(l,this.LA(1),this.LA(0)))}raiseNoAltException(e,n){const s=this.getCurrRuleFullName(),r=this.getGAstProductions()[s],i=Js(e,r,this.maxLookahead),a=[];for(let l=1;l<=this.maxLookahead;l++)a.push(this.LA(l));const c=this.LA(0),o=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:i,actual:a,previous:c,customUserDescription:n,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new Qp(o,this.LA(1),c))}}class Lm{initContentAssist(){}computeContentAssist(e,n){const s=this.gastProductionsCache[e];if($e(s))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return ua([s],n,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){const n=ye(e.ruleStack),r=this.getGAstProductions()[n];return new Np(r,e).startWalking()}}const Yn={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(Yn);const oi=!0,ci=Math.pow(2,Xe)-1,Ca=R({name:"RECORDING_PHASE_TOKEN",pattern:V.NA});Qt([Ca]);const ka=Xs(Ca,`This IToken indicates the Parser is in Recording Phase
|
|
98
|
+
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(ka);const Om={name:`This CSTNode indicates the Parser is in Recording Phase
|
|
99
|
+
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}};class Nm{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++){const n=e>0?e:"";this[`CONSUME${n}`]=function(s,r){return this.consumeInternalRecord(s,e,r)},this[`SUBRULE${n}`]=function(s,r){return this.subruleInternalRecord(s,e,r)},this[`OPTION${n}`]=function(s){return this.optionInternalRecord(s,e)},this[`OR${n}`]=function(s){return this.orInternalRecord(s,e)},this[`MANY${n}`]=function(s){this.manyInternalRecord(e,s)},this[`MANY_SEP${n}`]=function(s){this.manySepFirstInternalRecord(e,s)},this[`AT_LEAST_ONE${n}`]=function(s){this.atLeastOneInternalRecord(e,s)},this[`AT_LEAST_ONE_SEP${n}`]=function(s){this.atLeastOneSepFirstInternalRecord(e,s)}}this.consume=function(e,n,s){return this.consumeInternalRecord(n,e,s)},this.subrule=function(e,n,s){return this.subruleInternalRecord(n,e,s)},this.option=function(e,n){return this.optionInternalRecord(n,e)},this.or=function(e,n){return this.orInternalRecord(n,e)},this.many=function(e,n){this.manyInternalRecord(e,n)},this.atLeastOne=function(e,n){this.atLeastOneInternalRecord(e,n)},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",()=>{const e=this;for(let n=0;n<10;n++){const s=n>0?n:"";delete e[`CONSUME${s}`],delete e[`SUBRULE${s}`],delete e[`OPTION${s}`],delete e[`OR${s}`],delete e[`MANY${s}`],delete e[`MANY_SEP${s}`],delete e[`AT_LEAST_ONE${s}`],delete e[`AT_LEAST_ONE_SEP${s}`]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,n){return()=>!0}LA_RECORD(e){return kn}topLevelRuleRecord(e,n){try{const s=new yt({definition:[],name:e});return s.name=e,this.recordingProdStack.push(s),n.call(this),this.recordingProdStack.pop(),s}catch(s){if(s.KNOWN_RECORDER_ERROR!==!0)try{s.message=s.message+`
|
|
100
|
+
This error was thrown during the "grammar recording phase" For more info see:
|
|
101
|
+
https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw s}throw s}}optionInternalRecord(e,n){return kt.call(this,Z,e,n)}atLeastOneInternalRecord(e,n){kt.call(this,_e,n,e)}atLeastOneSepFirstInternalRecord(e,n){kt.call(this,xe,n,e,oi)}manyInternalRecord(e,n){kt.call(this,B,n,e)}manySepFirstInternalRecord(e,n){kt.call(this,Re,n,e,oi)}orInternalRecord(e,n){return Im.call(this,e,n)}subruleInternalRecord(e,n,s){if(Cn(n),!e||L(e,"ruleName")===!1){const c=new Error(`<SUBRULE${li(n)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>
|
|
102
|
+
inside top level rule: <${this.recordingProdStack[0].name}>`);throw c.KNOWN_RECORDER_ERROR=!0,c}const r=nt(this.recordingProdStack),i=e.ruleName,a=new se({idx:n,nonTerminalName:i,label:s?.LABEL,referencedRule:void 0});return r.definition.push(a),this.outputCst?Om:Yn}consumeInternalRecord(e,n,s){if(Cn(n),!oa(e)){const a=new Error(`<CONSUME${li(n)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>
|
|
103
|
+
inside top level rule: <${this.recordingProdStack[0].name}>`);throw a.KNOWN_RECORDER_ERROR=!0,a}const r=nt(this.recordingProdStack),i=new M({idx:n,terminalType:e,label:s?.LABEL});return r.definition.push(i),ka}}function kt(t,e,n,s=!1){Cn(n);const r=nt(this.recordingProdStack),i=Be(e)?e:e.DEF,a=new t({definition:[],idx:n});return s&&(a.separator=e.SEP),L(e,"MAX_LOOKAHEAD")&&(a.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(a),i.call(this),r.definition.push(a),this.recordingProdStack.pop(),Yn}function Im(t,e){Cn(e);const n=nt(this.recordingProdStack),s=C(t)===!1,r=s===!1?t:t.DEF,i=new Le({definition:[],idx:e,ignoreAmbiguities:s&&t.IGNORE_AMBIGUITIES===!0});L(t,"MAX_LOOKAHEAD")&&(i.maxLookahead=t.MAX_LOOKAHEAD);const a=Ji(r,c=>Be(c.GATE));return i.hasPredicates=a,n.definition.push(i),O(r,c=>{const o=new ee({definition:[]});i.definition.push(o),L(c,"IGNORE_AMBIGUITIES")?o.ignoreAmbiguities=c.IGNORE_AMBIGUITIES:L(c,"GATE")&&(o.ignoreAmbiguities=!0),this.recordingProdStack.push(o),c.ALT.call(this),this.recordingProdStack.pop()}),Yn}function li(t){return t===0?"":`${t}`}function Cn(t){if(t<0||t>ci){const e=new Error(`Invalid DSL Method idx value: <${t}>
|
|
104
|
+
Idx value must be a none negative value smaller than ${ci+1}`);throw e.KNOWN_RECORDER_ERROR=!0,e}}class bm{initPerformanceTracer(e){if(L(e,"traceInitPerf")){const n=e.traceInitPerf,s=typeof n=="number";this.traceInitMaxIdent=s?n:1/0,this.traceInitPerf=s?n>0:n}else this.traceInitMaxIdent=0,this.traceInitPerf=Fe.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,n){if(this.traceInitPerf===!0){this.traceInitIndent++;const s=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${s}--> <${e}>`);const{time:r,value:i}=Zi(n),a=r>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(`${s}<-- <${e}> time: ${r}ms`),this.traceInitIndent--,i}else return n()}}function Cm(t,e){e.forEach(n=>{const s=n.prototype;Object.getOwnPropertyNames(s).forEach(r=>{if(r==="constructor")return;const i=Object.getOwnPropertyDescriptor(s,r);i&&(i.get||i.set)?Object.defineProperty(t.prototype,r,i):t.prototype[r]=n.prototype[r]})})}const kn=Xs(De,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(kn);const Fe=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:ha,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),vn=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});var X;(function(t){t[t.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",t[t.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",t[t.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",t[t.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",t[t.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",t[t.LEFT_RECURSION=5]="LEFT_RECURSION",t[t.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",t[t.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",t[t.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",t[t.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",t[t.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",t[t.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",t[t.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",t[t.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION"})(X||(X={}));class en{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 e;this.selfAnalysisDone=!0;const n=this.className;this.TRACE_INIT("toFastProps",()=>{Qi(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),O(this.definedRulesNames,r=>{const a=this[r].originalGrammarAction;let c;this.TRACE_INIT(`${r} Rule`,()=>{c=this.topLevelRuleRecord(r,a)}),this.gastProductionsCache[r]=c})}finally{this.disableRecording()}});let s=[];if(this.TRACE_INIT("Grammar Resolving",()=>{s=qp({rules:F(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(s)}),this.TRACE_INIT("Grammar Validations",()=>{if(_(s)&&this.skipValidations===!1){const r=Zp({rules:F(this.gastProductionsCache),tokenTypes:F(this.tokensMap),errMsgProvider:et,grammarName:n}),i=Pp({lookaheadStrategy:this.lookaheadStrategy,rules:F(this.gastProductionsCache),tokenTypes:F(this.tokensMap),grammarName:n});this.definitionErrors=this.definitionErrors.concat(r,i)}}),_(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{const r=kf(F(this.gastProductionsCache));this.resyncFollows=r}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var r,i;(i=(r=this.lookaheadStrategy).initialize)===null||i===void 0||i.call(r,{rules:F(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(F(this.gastProductionsCache))})),!en.DEFER_DEFINITION_ERRORS_HANDLING&&!_(this.definitionErrors))throw e=S(this.definitionErrors,r=>r.message),new Error(`Parser Definition Errors detected:
|
|
105
|
+
${e.join(`
|
|
106
|
+
-------------------------------
|
|
107
|
+
`)}`)})}constructor(e,n){this.definitionErrors=[],this.selfAnalysisDone=!1;const s=this;if(s.initErrorHandler(n),s.initLexerAdapter(),s.initLooksAhead(n),s.initRecognizerEngine(e,n),s.initRecoverable(n),s.initTreeBuilder(n),s.initContentAssist(),s.initGastRecorder(n),s.initPerformanceTracer(n),L(n,"ignoredIssues"))throw new Error(`The <ignoredIssues> IParserConfig property has been deprecated.
|
|
108
|
+
Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
|
|
109
|
+
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
|
|
110
|
+
For further details.`);this.skipValidations=L(n,"skipValidations")?n.skipValidations:Fe.skipValidations}}en.DEFER_DEFINITION_ERRORS_HANDLING=!1;Cm(en,[sm,om,Em,Am,Sm,ym,Rm,Lm,Nm,bm]);class km extends en{constructor(e,n=Fe){const s=z(n);s.outputCst=!0,super(e,s)}}function va(t,e){const n=t.lexer.tokenize(e);if(n.errors.length>0){const r=n.errors[0],i=Number.isFinite(r.offset)?r.offset:e.length,a=i+(Number.isFinite(r.length)?r.length:0);throw new Error(`Error lexing ${t.diagramType} diagram: ${r.message} at line ${r.line??1}, column ${r.column??1} [${i},${a})`)}t.parser.input=n.tokens;const s=t.entry();if(t.parser.errors.length>0)throw new Error(`Error parsing ${t.diagramType} diagram: ${t.parser.errors[0].message}`);t.visit(s)}h(va,"runChevrotainParse");var w={SOLID_ARROW:0,BACK_ARROW:1,LINE_SOLID:2,CIRCLE_ARROW:3,CROSS_ARROW:4,CIRCLE_ARROW_REVERSED:5,CROSS_ARROW_REVERSED:6},vm="LR",_m=Mo.usecase,Qs=h(()=>({actors:new Map,useCases:new Map,systemBoundaries:new Map,relationships:[],notes:new Map,jsonNodes:new Map,classDefs:new Map,symbols:new Map,direction:vm,relationshipCounter:0,noteCounter:0,accTitle:"",accDescription:"",ast:void 0,config:structuredClone(_m)}),"createModel"),xm=h(t=>{if(!(t.actors instanceof Map)||!(t.useCases instanceof Map)||!(t.systemBoundaries instanceof Map)||!Array.isArray(t.relationships)||!(t.notes instanceof Map)||!(t.jsonNodes instanceof Map)||!(t.classDefs instanceof Map)||!(t.symbols instanceof Map)||!["TB","TD","BT","RL","LR"].includes(t.direction)||!Number.isSafeInteger(t.relationshipCounter)||t.relationshipCounter<0||!Number.isSafeInteger(t.noteCounter)||t.noteCounter<0||typeof t.accTitle!="string"||typeof t.accDescription!="string"||!t.config)throw new Error("Cannot commit an incomplete usecase model")},"assertCompleteModel"),b=Qs(),wm=h(()=>structuredClone(b.config),"getConfig"),Mm=h(()=>b.ast,"getAST"),Um=h(t=>{const e=structuredClone(t);xm(e);const n=Ai(),s=Ei();try{ls(e.accTitle),cs(e.accDescription),b=e}catch(r){throw ls(n),cs(s),r}},"commit"),Pm=h(()=>{b=Qs(),wo()},"clear"),$m=h(()=>b.actors,"getActors"),Dm=h(t=>b.actors.get(t),"getActor"),Fm=h(()=>b.useCases,"getUseCases"),Bm=h(t=>b.useCases.get(t),"getUseCase"),Gm=h(()=>b.systemBoundaries,"getSystemBoundaries"),Wm=h(t=>b.systemBoundaries.get(t),"getSystemBoundary"),jm=h(()=>b.relationships,"getRelationships"),Km=h(()=>b.notes,"getNotes"),zm=h(t=>b.notes.get(t),"getNote"),Hm=h(()=>b.jsonNodes,"getJsonNodes"),Vm=h(t=>b.jsonNodes.get(t),"getJsonNode"),Ym=h(()=>b.classDefs,"getClassDefs"),Xm=h(t=>b.classDefs.get(t),"getClassDef"),_a=h(()=>b.direction,"getDirection"),Ze=h(t=>{const e=new Map;for(const n of["default",...t]){const s=b.classDefs.get(n);if(s)for(const r of s.styles){const i=r.trim(),a=i.indexOf(":"),c=(a===-1?i:i.slice(0,a)).trim();c&&e.set(c,i)}}return[...e.values()]},"getCompiledStyles"),Jm=h(t=>t.replaceAll("~","~0").replaceAll("/","~1"),"escapeJsonPointerPart"),hi=h(t=>typeof t=="string"?t:t===null?"null":String(t),"displayJsonScalar"),qm=h((t,e,n=s=>s)=>{const s=[],r=h((a,c,o)=>{s.push({key:n(a),accessibleKey:n(c),value:n(o)})},"append"),i=h((a,c,o)=>{if(Array.isArray(a)){if(a.length===0){r(c,c,"[]");return}if(a.every(d=>d===null||["string","number","boolean"].includes(typeof d))){for(const[d,u]of a.entries())r(d===0?c:"",c,hi(u));return}for(const[d,u]of a.entries())i(u,`${c}[${d}]`,`${o}/${d}`);return}if(a!==null&&typeof a=="object"){const l=a,d=e[o]??Object.keys(l);if(d.length===0){r(c,c,"{}");return}for(const u of d){const f=c?`${c}.${u}`:u;i(l[u],f,`${o}/${Jm(u)}`)}return}r(c,c,hi(a))},"visit");return i(t,"",""),s},"flattenJsonRows"),Zm=h(t=>{switch(t.type){case"hollow":return"usecaseActorHollow";case"awesome":return"usecaseActorAwesome";case"icon":return"usecaseActorIcon";case"normal":return"usecaseActor"}},"actorShape"),Qm=h(t=>t.shape==="ellipse"?t.business?"usecaseBusiness":"usecaseEllipse":t.shape,"useCaseShape"),eg=h(t=>{switch(t){case w.SOLID_ARROW:return{arrowTypeStart:"none",arrowTypeEnd:"arrow_point"};case w.BACK_ARROW:return{arrowTypeStart:"arrow_point",arrowTypeEnd:"none"};case w.CIRCLE_ARROW:return{arrowTypeStart:"none",arrowTypeEnd:"arrow_circle"};case w.CROSS_ARROW:return{arrowTypeStart:"none",arrowTypeEnd:"arrow_cross"};case w.CIRCLE_ARROW_REVERSED:return{arrowTypeStart:"arrow_circle",arrowTypeEnd:"none"};case w.CROSS_ARROW_REVERSED:return{arrowTypeStart:"arrow_cross",arrowTypeEnd:"none"};case w.LINE_SOLID:return{arrowTypeStart:"none",arrowTypeEnd:"none"}}},"associationMarkers"),tg=h(t=>{switch(t.type){case"include":case"extend":return{arrowTypeStart:"none",arrowTypeEnd:"arrow_point",pattern:"dotted",label:t.type,labelType:"text"};case"generalization":return{arrowTypeStart:"none",arrowTypeEnd:"extension",pattern:"solid"};case"association":return{...eg(t.arrowType),pattern:"solid",...t.label?{label:t.label}:{},...t.labelType?{labelType:t.labelType}:{}}}},"relationshipVisuals"),ng=h(t=>t.animate||t.animation?[`edge-animation-${t.animation??"fast"}`]:[],"animationClasses"),vt=h((...t)=>t.filter(e=>!!e).join(" "),"classNames"),sg=h(()=>{const t=yi(),e={...b.config,...t.usecase},n=h(o=>xo(o,t),"sanitize"),s=h(o=>n(b.actors.get(o)?.label??b.useCases.get(o)?.label??b.jsonNodes.get(o)?.id??b.notes.get(o)?.label??o),"endpointLabel"),r=[],i=[];let a=0,c=0;for(const o of b.actors.values())r.push({id:o.id,label:n(o.label),labelType:o.labelType,shape:Zm(o),isGroup:!1,padding:10,look:t.look,colorIndex:a++,cssClasses:vt("default","usecase-actor",`usecase-actor-${o.type}`,o.business&&"usecase-business",...o.classes),cssStyles:[...o.styles],cssCompiledStyles:Ze(o.classes),actorType:o.type,business:o.business,...o.icon?{icon:o.icon}:{},...o.stereotype?{stereotype:n(o.stereotype)}:{},...o.parentId?{parentId:o.parentId}:{}});for(const o of b.useCases.values())r.push({id:o.id,label:n(o.label),labelType:o.labelType,shape:Qm(o),isGroup:!1,padding:o.shape==="ellipse"?20:10,look:t.look,colorIndex:a++,cssClasses:vt("default","usecase-element",`usecase-${o.shape}`,o.business&&"usecase-business",...o.classes),cssStyles:[...o.styles],cssCompiledStyles:Ze(o.classes),business:o.business,...o.stereotype?{stereotype:n(o.stereotype)}:{},...o.parentId?{parentId:o.parentId}:{}});for(const o of b.notes.values())r.push({id:o.id,label:n(o.label),labelType:o.labelType,shape:"note",isGroup:!1,padding:10,look:t.look,cssClasses:"default usecase-note",cssStyles:[],cssCompiledStyles:Ze([]),noteTarget:o.target,noteTargetLabel:n(b.actors.get(o.target)?.label??b.useCases.get(o.target)?.label??b.jsonNodes.get(o.target)?.id??o.target)});for(const o of b.jsonNodes.values())r.push({id:o.id,label:n(o.id),labelType:"text",shape:"usecaseJsonTable",isGroup:!1,padding:10,look:t.look,cssClasses:vt("default","usecase-json-table",...o.classes),cssStyles:[...o.styles],cssCompiledStyles:Ze(o.classes),jsonRows:qm(o.value,o.propertyOrder,n)});for(const o of b.systemBoundaries.values())r.push({id:o.id,label:n(o.label),labelType:o.labelType,shape:"usecaseSystemBoundary",isGroup:!0,padding:20,look:t.look,colorIndex:c++,cssClasses:vt("default","system-boundary",`system-boundary-${o.type}`,...o.classes),cssStyles:[...o.styles],cssCompiledStyles:Ze(o.classes),boundaryType:o.type});for(const o of b.relationships){const{label:l,...d}=tg(o);i.push({id:o.id,start:o.source,end:o.target,source:o.source,target:o.target,sourceLabel:s(o.source),targetLabel:s(o.target),type:"edge",relationshipType:o.type,internal:!1,...d,...l!==void 0?{label:n(l)}:{},labelpos:"c",classes:vt("default","relationship",`relationship-${o.type}`,...o.classes,...ng(o)),style:[...o.styles],cssCompiledStyles:Ze(o.classes),animate:o.animate,...o.animation?{animation:o.animation}:{},look:t.look,thickness:"normal",minlen:o.minlen,isUserDefinedId:o.explicitId})}for(const o of b.notes.values())i.push({id:`${o.id}-edge`,start:o.id,end:o.target,source:o.id,target:o.target,type:"edge",relationshipType:"note",sourceLabel:s(o.id),targetLabel:s(o.target),internal:!0,pattern:"dotted",arrowTypeStart:"none",arrowTypeEnd:"none",labelpos:"c",classes:"default relationship relationship-note",style:[],cssCompiledStyles:Ze([]),animate:!1,look:t.look,thickness:"normal",minlen:1,isUserDefinedId:!1});for(const o of r)o.wrappingWidth??=e.wrappingWidth,!o.isGroup&&!o.shape.startsWith("usecaseActor")&&(o.minWidth??=e.minNodeWidth),(o.shape==="usecaseEllipse"||o.shape==="usecaseBusiness")&&(o.spreadPorts=!0);return{nodes:r,edges:i,config:t,type:"usecase",layoutAlgorithm:"dagre",direction:_a(),nodeSpacing:e.nodeSpacing,rankSpacing:e.rankSpacing,actorFontSize:e.actorFontSize,actorFontFamily:e.actorFontFamily,actorFontWeight:e.actorFontWeight,usecaseFontSize:e.usecaseFontSize,usecaseFontFamily:e.usecaseFontFamily,usecaseFontWeight:e.usecaseFontWeight,diagramPadding:e.diagramPadding,useMaxWidth:e.useMaxWidth,markers:["point","circle","cross","extension"]}},"getData"),_n={getConfig:wm,createModel:Qs,commit:Um,getAST:Mm,clear:Pm,setDiagramTitle:bo,getDiagramTitle:Io,setAccTitle:ls,getAccTitle:Ai,setAccDescription:cs,getAccDescription:Ei,getActors:$m,getActor:Dm,getUseCases:Fm,getUseCase:Bm,getSystemBoundaries:Gm,getSystemBoundary:Wm,getRelationships:jm,getNotes:Km,getNote:zm,getJsonNodes:Hm,getJsonNode:Vm,getClassDefs:Ym,getClassDef:Xm,getDirection:_a,getData:sg};function ot(t,e,n){const s=[n];return s.index=e,s.input=t,s}h(ot,"customMatch");var rg=h((t,e)=>{if(t[e]!=='"'||t[e+1]!=="`")return null;for(let n=e+2;n<t.length-1;n++)if(t[n]==="`"&&t[n+1]==='"')return ot(t,e,t.slice(e,n+2));return null},"matchMarkdownString"),ig=h((t,e)=>{if(t[e]!=="%"||t[e+1]!=="%")return null;for(let s=e-1;s>=0;s--){const r=t[s];if(r===`
|
|
111
|
+
`||r==="\r")break;if(r!==" "&&r!==" ")return null}let n=e+2;for(;n<t.length&&t[n]!==`
|
|
112
|
+
`&&t[n]!=="\r";)n++;return ot(t,e,t.slice(e,n))},"matchComment"),xa=h((t,e)=>{for(let n=e-1;n>=0;n--){const s=t[n];if(s===`
|
|
113
|
+
`||s==="\r")return!0;if(s!==" "&&s!==" ")return!1}return!0},"isIndentedLineStart"),wa=h((t,e,n)=>{if(!xa(t,e))return null;const s=n.exec(t.slice(e));return s?ot(t,e,s[0]):null},"matchAccessibilityLine"),ag=h((t,e)=>{if(!xa(t,e))return null;const n=/^accDescr[\t ]*{/.exec(t.slice(e));if(!n)return null;const s=t.indexOf("}",e+n[0].length);return s===-1?null:ot(t,e,t.slice(e,s+1))},"matchAccDescrBlock"),og=h((t,e)=>{if(t[e]!=="{")return null;let n=0,s=!1,r=!1;for(let i=e;i<t.length;i++){const a=t[i];if(s){r?r=!1:a==="\\"?r=!0:a==='"'&&(s=!1);continue}if(a==='"')s=!0;else if(a==="{")n++;else if(a==="}"&&--n===0)return ot(t,e,t.slice(e,i+1))}return null},"matchJsonObject"),cg=h((t,e)=>{const n=t.indexOf(">>",e);if(n===-1||/[\n\r]/.test(t.slice(e,n)))return null;const s=t.slice(e,n);return s.trim()?ot(t,e,s):null},"matchStereotypeText"),W=R({name:"LABEL_TEXT",pattern:V.NA}),ut=R({name:"WORD",pattern:V.NA,categories:W}),er=R({name:"NUMBER",pattern:/(?:\d+\.\d+|\d+|\.\d+)(?:[A-Za-z]+)?/,categories:W}),U=R({name:"IDENTIFIER",pattern:/\w+/,longer_alt:er,categories:ut}),lg=R({name:"HWS",pattern:/[\t ]+/,group:V.SKIPPED}),Ue=R({name:"MARKDOWN_STRING",pattern:rg,start_chars_hint:['"'],line_breaks:!0}),hg=R({name:"UNCLOSED_MARKDOWN_STRING",pattern:/"`[^]*/,line_breaks:!0}),Ls=R({name:"COMMENT",pattern:ig,start_chars_hint:["%"],line_breaks:!1}),Me=R({name:"NEWLINE",pattern:/\r\n|\n|\r/,line_breaks:!0}),Ma=R({name:"ACC_DESCR_BLOCK",pattern:ag,start_chars_hint:["a"],line_breaks:!0}),ug=/^accTitle[\t ]*:[^\n\r]*/,dg=/^accDescr[\t ]*:[^\n\r]*/,Ua=R({name:"ACC_TITLE_LINE",pattern:h((t,e)=>wa(t,e,ug),"pattern"),start_chars_hint:["a"],line_breaks:!1}),Pa=R({name:"ACC_DESCR_LINE",pattern:h((t,e)=>wa(t,e,dg),"pattern"),start_chars_hint:["a"],line_breaks:!1}),$a=R({name:"JSON_DECLARATION_START",pattern:/json[\t ]+\w+[\t ]*@[\t ]*(?={)/,push_mode:"jsonBody"}),tr=R({name:"JSON_OBJECT_LITERAL",pattern:og,start_chars_hint:["{"],line_breaks:!0,pop_mode:!0}),Da=R({name:"UNCLOSED_JSON_OBJECT_LITERAL",pattern:/{[^]*/,line_breaks:!0,pop_mode:!0}),D=h((t,e)=>R({name:t,pattern:e,longer_alt:U,categories:ut}),"keyword"),Fa=D("USECASE",/usecase-beta/),Os=D("ACTOR",/actor/),Ba=D("SYSTEM_BOUNDARY",/systemBoundary/),Ga=D("END",/end/),Wa=D("DIRECTION",/direction/),ja=D("TD",/TD/),Ka=D("TB",/TB/),za=D("BT",/BT/),Ha=D("LR",/LR/),Va=D("RL",/RL/),Ya=D("NOTE",/note/),Xa=D("FOR",/for/),fg=D("JSON",/json/),Ja=D("CLASS_DEF",/classDef/),qa=D("CLASS",/class/),Za=D("STYLE",/style/),Qa=D("INCLUDE",/include/i),eo=D("EXTEND",/extend/i),to=D("TRUE",/true/),no=D("FALSE",/false/),so=R({name:"GENERALIZATION",pattern:/--\|>/}),ro=R({name:"DEPENDENCY_ARROW",pattern:/\.\.>/}),io=R({name:"STEREOTYPE_START",pattern:/<</,push_mode:"stereotype"}),nr=R({name:"STEREOTYPE_END",pattern:/>>/,pop_mode:!0}),sr=R({name:"STEREOTYPE_TEXT",pattern:cg,line_breaks:!1}),ao=R({name:"UNCLOSED_STEREOTYPE_TEXT",pattern:/[^\n\r]+/,line_breaks:!1,pop_mode:!0}),oo=R({name:"CLASS_SEPARATOR",pattern:/:::/}),pn=R({name:"FORWARD_SOLID",pattern:/--+>/}),co=R({name:"BACKWARD_SOLID",pattern:/<--+/}),mn=R({name:"FORWARD_CIRCLE",pattern:/--o/}),lo=R({name:"BACKWARD_CIRCLE",pattern:/o--/}),gn=R({name:"FORWARD_CROSS",pattern:/--x/}),ho=R({name:"BACKWARD_CROSS",pattern:/x--/}),ae=R({name:"MARKERLESS_SOLID",pattern:/--+/}),Ns=R({name:"METADATA_START",pattern:/@{/}),Tn=R({name:"AT",pattern:/@/,categories:W}),uo=R({name:"LBRACE",pattern:/{/}),Is=R({name:"RBRACE",pattern:/}/}),En=R({name:"LBRACKET",pattern:/\[/}),An=R({name:"RBRACKET",pattern:/]/}),Ut=R({name:"LPAREN",pattern:/\(/}),Pt=R({name:"RPAREN",pattern:/\)/}),ge=R({name:"COMMA",pattern:/,/,categories:W}),$t=R({name:"COLON",pattern:/:/,categories:W}),fo=R({name:"HASH_COLOR",pattern:/#[\dA-Fa-f]+/,categories:W}),oe=R({name:"PLAIN_STRING",pattern:/"[^\n\r"]*"|'[^\n\r']*'/}),bs=R({name:"CSS_IDENTIFIER",pattern:/--[A-Z_a-z][\w-]*|[A-Z_a-z]\w*(?:-\w+)+/,categories:W}),po=R({name:"CSS_ESCAPED_COMMA",pattern:/\\,/,categories:W}),mo=R({name:"DASH",pattern:/-/,categories:W}),go=R({name:"DOT",pattern:/\./,categories:W}),To=R({name:"PERCENT",pattern:/%/,categories:W}),Eo=R({name:"CSS_PUNCTUATION",pattern:/[!#$&*+/=?^_|~]/,categories:W}),pg=R({name:"LABEL_PUNCTUATION",pattern:/[;<>\\`]/,categories:W}),mg=R({name:"LABEL_SYMBOL",pattern:/[^\t\n\r !-~]+/,categories:W}),Ao=[W,ut,lg,Ue,hg,Ls,Me,Ma,Ua,Pa,$a,Fa,Os,Ba,Ga,Wa,ja,Ka,za,Ha,Va,Ya,Xa,fg,Ja,qa,Za,Qa,eo,to,no,so,ro,io,oo,pn,co,mn,lo,gn,ho,ae,Ns,Tn,uo,Is,En,An,Ut,Pt,ge,$t,fo,oe,bs,U,er,po,mo,go,To,Eo,pg,mg],gg={defaultMode:"defaultMode",modes:{defaultMode:[...Ao],jsonBody:[tr,Da],stereotype:[nr,sr,ao]}},Tg=[...Ao,tr,Da,nr,sr,ao],Eg=new V(gg),ui=h(t=>la(t,W)||t.tokenType===oe||t.tokenType===Ue,"isLabelToken"),Ag={allowmixing:!0,newpage:!0,package:!0,rectangle:!0,skinparam:!0},dt,yg=(dt=class extends km{constructor(){super(Tg,{nodeLocationTracking:"full"}),this.RULE("start",()=>{this.CONSUME(Fa),this.SUBRULE(this.lineEnd),this.MANY(()=>this.SUBRULE(this.line))}),this.RULE("line",()=>{this.OR([{ALT:h(()=>this.SUBRULE(this.blankLine),"ALT")},{ALT:h(()=>this.SUBRULE(this.commentLine),"ALT")},{GATE:h(()=>this.isStatementStart(),"GATE"),ALT:h(()=>this.SUBRULE(this.statement),"ALT")}])}),this.RULE("statement",()=>{this.OR([{ALT:h(()=>this.SUBRULE(this.accTitleStatement),"ALT")},{ALT:h(()=>this.SUBRULE(this.accDescrStatement),"ALT")},{ALT:h(()=>this.SUBRULE(this.directionStatement),"ALT")},{ALT:h(()=>this.SUBRULE(this.actorStatement),"ALT")},{ALT:h(()=>this.SUBRULE(this.systemBoundaryStatement),"ALT")},{ALT:h(()=>this.SUBRULE(this.noteStatement),"ALT")},{ALT:h(()=>this.SUBRULE(this.jsonStatement),"ALT")},{ALT:h(()=>this.SUBRULE(this.classDefStatement),"ALT")},{ALT:h(()=>this.SUBRULE(this.classStatement),"ALT")},{ALT:h(()=>this.SUBRULE(this.styleStatement),"ALT")},{GATE:h(()=>this.isMetadataAssignment(),"GATE"),ALT:h(()=>this.SUBRULE(this.metadataAssignmentStatement),"ALT")},{GATE:h(()=>!this.isForbiddenPlantUmlStatement(),"GATE"),ALT:h(()=>this.SUBRULE(this.entityStatement),"ALT")}])}),this.RULE("lineEnd",()=>{this.OR([{ALT:h(()=>this.CONSUME(Me),"ALT")},{ALT:h(()=>this.CONSUME(De),"ALT")}])}),this.RULE("blankLine",()=>{this.CONSUME(Me)}),this.RULE("commentLine",()=>{this.CONSUME(Ls),this.SUBRULE(this.lineEnd)}),this.RULE("accTitleStatement",()=>{this.CONSUME(Ua),this.SUBRULE(this.lineEnd)}),this.RULE("accDescrStatement",()=>{this.OR([{ALT:h(()=>this.CONSUME(Pa),"ALT")},{ALT:h(()=>this.CONSUME(Ma),"ALT")}]),this.SUBRULE(this.lineEnd)}),this.RULE("actorStatement",()=>{this.CONSUME(Os),this.SUBRULE(this.actorItem),this.OPTION(()=>{this.OR([{ALT:h(()=>this.AT_LEAST_ONE(()=>{this.CONSUME(ge),this.SUBRULE2(this.actorItem)}),"ALT")},{ALT:h(()=>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:h(()=>{this.CONSUME(U),this.OPTION(()=>{this.CONSUME(Ut),this.SUBRULE(this.nodeLabel),this.CONSUME(Pt)})},"ALT")},{ALT:h(()=>this.CONSUME(oe),"ALT")},{ALT:h(()=>this.CONSUME(Ue),"ALT")}])}),this.RULE("actorDeclarationOnly",()=>{this.CONSUME(Os),this.SUBRULE(this.actorItem),this.MANY(()=>{this.CONSUME(ge),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:h(()=>{this.CONSUME(U),this.OPTION(()=>{this.OR2([{ALT:h(()=>{this.CONSUME(Ut),this.SUBRULE(this.nodeLabel),this.CONSUME(Pt)},"ALT")},{ALT:h(()=>{this.CONSUME(En),this.SUBRULE2(this.nodeLabel),this.CONSUME(An)},"ALT")}])})},"ALT")},{ALT:h(()=>this.CONSUME(oe),"ALT")},{ALT:h(()=>this.CONSUME(Ue),"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:h(()=>this.CONSUME(oe),"ALT")},{ALT:h(()=>this.CONSUME(Ue),"ALT")},{ALT:h(()=>this.AT_LEAST_ONE(()=>this.CONSUME(W)),"ALT")}])}),this.RULE("useCaseMetadata",()=>{this.SUBRULE(this.metadata)}),this.RULE("relationTail",()=>{this.OPTION({GATE:h(()=>this.LA(1).tokenType===U&&this.LA(2).tokenType===Tn,"GATE"),DEF:h(()=>{this.CONSUME(U),this.CONSUME(Tn)},"DEF")}),this.SUBRULE(this.arrow),this.SUBRULE(this.entityName)}),this.RULE("arrow",()=>{this.OR([{ALT:h(()=>this.SUBRULE(this.semanticRelation),"ALT")},{ALT:h(()=>this.SUBRULE(this.forwardSolidOperator),"ALT")},{ALT:h(()=>this.SUBRULE(this.backwardSolidOperator),"ALT")},{ALT:h(()=>this.SUBRULE(this.markerlessSolidOperator),"ALT")},{ALT:h(()=>this.SUBRULE(this.forwardCircleOperator),"ALT")},{ALT:h(()=>this.SUBRULE(this.backwardCircleOperator),"ALT")},{ALT:h(()=>this.SUBRULE(this.forwardCrossOperator),"ALT")},{ALT:h(()=>this.SUBRULE(this.backwardCrossOperator),"ALT")}])}),this.RULE("forwardSolidOperator",()=>{this.CONSUME(pn)}),this.RULE("backwardSolidOperator",()=>{this.CONSUME(co),this.OPTION({GATE:h(()=>this.LA(0).image==="<--"&&this.hasLabeledRight([ae]),"GATE"),DEF:h(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(ae)},"DEF")})}),this.RULE("markerlessSolidOperator",()=>{this.CONSUME(ae),this.OPTION({GATE:h(()=>this.LA(0).image==="--"&&this.hasLabeledRight([pn,ae,mn,gn]),"GATE"),DEF:h(()=>{this.SUBRULE(this.edgeLabel),this.OR([{ALT:h(()=>this.CONSUME(pn),"ALT")},{ALT:h(()=>this.CONSUME2(ae),"ALT")},{ALT:h(()=>this.CONSUME(mn),"ALT")},{ALT:h(()=>this.CONSUME(gn),"ALT")}])},"DEF")})}),this.RULE("forwardCircleOperator",()=>{this.CONSUME(mn)}),this.RULE("backwardCircleOperator",()=>{this.CONSUME(lo),this.OPTION({GATE:h(()=>this.hasLabeledRight([ae]),"GATE"),DEF:h(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(ae)},"DEF")})}),this.RULE("forwardCrossOperator",()=>{this.CONSUME(gn)}),this.RULE("backwardCrossOperator",()=>{this.CONSUME(ho),this.OPTION({GATE:h(()=>this.hasLabeledRight([ae]),"GATE"),DEF:h(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(ae)},"DEF")})}),this.RULE("edgeLabel",()=>{this.OR([{ALT:h(()=>this.CONSUME(oe),"ALT")},{ALT:h(()=>this.CONSUME(Ue),"ALT")},{ALT:h(()=>this.AT_LEAST_ONE(()=>this.CONSUME(W)),"ALT")}])}),this.RULE("semanticRelation",()=>{this.OR([{ALT:h(()=>{this.CONSUME(ro),this.CONSUME($t),this.OR2([{ALT:h(()=>this.CONSUME(Qa),"ALT")},{ALT:h(()=>this.CONSUME(eo),"ALT")}])},"ALT")},{ALT:h(()=>this.CONSUME(so),"ALT")}])}),this.RULE("metadata",()=>{this.CONSUME(Ns),this.MANY(()=>this.CONSUME(Me)),this.OPTION(()=>{this.SUBRULE(this.metadataProperty),this.MANY2(()=>{this.SUBRULE(this.metadataSeparator),this.SUBRULE2(this.metadataProperty)}),this.OPTION2(()=>this.CONSUME(ge)),this.MANY3(()=>this.CONSUME2(Me))}),this.CONSUME(Is)}),this.RULE("metadataProperty",()=>{this.OR([{ALT:h(()=>this.CONSUME(U),"ALT")},{ALT:h(()=>this.CONSUME(oe),"ALT")}]),this.CONSUME($t),this.OR2([{ALT:h(()=>this.CONSUME2(U),"ALT")},{ALT:h(()=>this.CONSUME2(oe),"ALT")},{ALT:h(()=>this.CONSUME(to),"ALT")},{ALT:h(()=>this.CONSUME(no),"ALT")}])}),this.RULE("metadataSeparator",()=>{this.OR([{ALT:h(()=>{this.CONSUME(ge),this.MANY(()=>this.CONSUME(Me))},"ALT")},{ALT:h(()=>{this.AT_LEAST_ONE(()=>this.CONSUME2(Me)),this.OPTION(()=>this.CONSUME2(ge)),this.MANY2(()=>this.CONSUME3(Me))},"ALT")}])}),this.RULE("systemBoundaryStatement",()=>{this.CONSUME(Ba),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(Ga),this.SUBRULE2(this.lineEnd)}),this.RULE("systemBoundaryName",()=>{this.OR([{ALT:h(()=>{this.CONSUME(U),this.OPTION(()=>{this.OR2([{ALT:h(()=>{this.CONSUME(Ut),this.SUBRULE(this.nodeLabel),this.CONSUME(Pt)},"ALT")},{ALT:h(()=>{this.CONSUME(En),this.SUBRULE2(this.nodeLabel),this.CONSUME(An)},"ALT")}])})},"ALT")},{ALT:h(()=>this.CONSUME(oe),"ALT")},{ALT:h(()=>this.CONSUME(Ue),"ALT")}])}),this.RULE("systemBoundaryContent",()=>{this.MANY(()=>{this.OR([{ALT:h(()=>this.SUBRULE(this.blankLine),"ALT")},{ALT:h(()=>this.SUBRULE(this.commentLine),"ALT")},{ALT:h(()=>this.SUBRULE(this.boundaryElement),"ALT")}])})}),this.RULE("boundaryElement",()=>{this.OR([{ALT:h(()=>this.SUBRULE(this.actorDeclarationOnly),"ALT")},{ALT:h(()=>{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:h(()=>this.CONSUME(U),"ALT")},{ALT:h(()=>this.CONSUME(oe),"ALT")},{ALT:h(()=>this.CONSUME(Ue),"ALT")}])}),this.RULE("noteStatement",()=>{this.CONSUME(Ya),this.CONSUME(Xa),this.CONSUME(U),this.SUBRULE(this.nodeLabel),this.SUBRULE(this.lineEnd)}),this.RULE("stereotype",()=>{this.CONSUME(io),this.CONSUME(sr),this.CONSUME(nr)}),this.RULE("classSuffix",()=>{this.CONSUME(oo),this.CONSUME(U),this.MANY(()=>{this.CONSUME(ge),this.CONSUME2(U)})}),this.RULE("jsonStatement",()=>{this.CONSUME($a),this.CONSUME(tr),this.OPTION(()=>this.SUBRULE(this.classSuffix)),this.SUBRULE(this.lineEnd)}),this.RULE("directionStatement",()=>{this.CONSUME(Wa),this.OR([{ALT:h(()=>this.CONSUME(ja),"ALT")},{ALT:h(()=>this.CONSUME(Ka),"ALT")},{ALT:h(()=>this.CONSUME(za),"ALT")},{ALT:h(()=>this.CONSUME(Ha),"ALT")},{ALT:h(()=>this.CONSUME(Va),"ALT")}]),this.SUBRULE(this.lineEnd)}),this.RULE("classDefStatement",()=>{this.CONSUME(Ja),this.CONSUME(U),this.MANY(()=>{this.CONSUME(ge),this.CONSUME2(U)}),this.SUBRULE(this.styles),this.SUBRULE(this.lineEnd)}),this.RULE("classStatement",()=>{this.CONSUME(qa),this.CONSUME(U),this.MANY(()=>{this.CONSUME(ge),this.CONSUME2(U)}),this.CONSUME3(U),this.MANY2(()=>{this.CONSUME2(ge),this.CONSUME4(U)}),this.SUBRULE(this.lineEnd)}),this.RULE("styleStatement",()=>{this.CONSUME(Za),this.CONSUME(U),this.SUBRULE(this.styles),this.SUBRULE(this.lineEnd)}),this.RULE("styles",()=>{this.SUBRULE(this.styleValue),this.MANY(()=>{this.CONSUME(ge),this.SUBRULE2(this.styleValue)})}),this.RULE("styleValue",()=>{this.OR([{ALT:h(()=>this.CONSUME(ut),"ALT")},{ALT:h(()=>this.CONSUME(bs),"ALT")},{ALT:h(()=>{this.CONSUME(ae),this.CONSUME2(ut)},"ALT")}]),this.CONSUME($t),this.AT_LEAST_ONE(()=>this.SUBRULE(this.styleComponent))}),this.RULE("styleComponent",()=>{this.OR([{ALT:h(()=>this.CONSUME(ut),"ALT")},{ALT:h(()=>this.CONSUME(oe),"ALT")},{ALT:h(()=>this.CONSUME(er),"ALT")},{ALT:h(()=>this.CONSUME(fo),"ALT")},{ALT:h(()=>this.CONSUME(bs),"ALT")},{ALT:h(()=>this.CONSUME(po),"ALT")},{ALT:h(()=>this.CONSUME(mo),"ALT")},{ALT:h(()=>this.CONSUME(go),"ALT")},{ALT:h(()=>this.CONSUME(To),"ALT")},{ALT:h(()=>this.CONSUME(Eo),"ALT")},{ALT:h(()=>this.CONSUME($t),"ALT")},{ALT:h(()=>this.CONSUME(Ut),"ALT")},{ALT:h(()=>this.CONSUME(Pt),"ALT")},{ALT:h(()=>this.CONSUME(En),"ALT")},{ALT:h(()=>this.CONSUME(An),"ALT")},{ALT:h(()=>this.CONSUME(uo),"ALT")},{ALT:h(()=>this.CONSUME(Is),"ALT")},{ALT:h(()=>this.CONSUME(Tn),"ALT")},{ALT:h(()=>this.CONSUME(ae),"ALT")}])}),this.performSelfAnalysis()}isMetadataAssignment(){const e=this.LA(1).tokenType;return(e===U||e===oe||e===Ue)&&this.LA(2).tokenType===Ns}isStatementStart(){const e=this.LA(1).tokenType;return e!==De&&e!==Me&&e!==Ls}isForbiddenPlantUmlStatement(){return this.LA(1).tokenType===U&&Ag[this.LA(1).image.toLowerCase()]===!0}hasLabeledRight(e){if(!ui(this.LA(1)))return!1;for(let n=2;;n++){const s=this.LA(n);if(e.includes(s.tokenType))return!0;if(!ui(s))return!1}}},h(dt,"UsecaseParser"),dt),Dt=new yg,ft,di=(ft=class extends Error{constructor(e,n,s){super(`${e} (line ${n}, column ${s})`),this.line=n,this.column=s,this.name="UsecaseJsonError"}},h(ft,"UsecaseJsonError"),ft),Cs=h((t,e,n,s)=>{let r=n,i=s;const a=Math.min(Math.max(e,0),t.length);for(let c=0;c<a;c++){const o=t[c];o==="\r"?(r++,i=1):o===`
|
|
114
|
+
`?(c===0||t[c-1]!=="\r")&&(r++,i=1):i++}return{line:r,column:i}},"locationAtOffset"),Sg=h((t,e,n,s)=>{const r=/\bposition (\d+)\b/u.exec(t);if(r)return Cs(e,Number.parseInt(r[1],10),n,s);const i=/\bline (\d+) column (\d+)\b/u.exec(t);if(i){const a=Number.parseInt(i[1],10),c=Number.parseInt(i[2],10);return{line:n+a-1,column:a===1?s+c-1:c}}if(/unexpected end|end of json input/iu.test(t))return Cs(e,e.length,n,s)},"locationFromErrorMessage"),pt,j=(pt=class extends Error{constructor(e){super("Invalid JSON token"),this.offset=e}},h(pt,"JsonWalkError"),pt),mt,fi=(mt=class{constructor(e){this.text=e,this.offset=0,this.propertyOrder={}}collect(){if(this.skipWhitespace(),this.collectValue(""),this.skipWhitespace(),this.offset!==this.text.length)throw new j(this.offset);return this.propertyOrder}collectValue(e){this.skipWhitespace();const n=this.text[this.offset];if(n==="{")this.collectObject(e);else if(n==="[")this.collectArray(e);else if(n==='"')this.readString(!1);else if(n==="t")this.consumeLiteral("true");else if(n==="f")this.consumeLiteral("false");else if(n==="n")this.consumeLiteral("null");else if(n==="-"||n>="0"&&n<="9")this.consumeNumber();else throw new j(this.offset)}collectObject(e){this.offset++;const n=[],s=new Set;if(this.propertyOrder[e]=n,this.skipWhitespace(),this.text[this.offset]==="}"){this.offset++;return}for(;this.offset<this.text.length;){if(this.text[this.offset]!=='"')throw new j(this.offset);const r=this.readString(!0),i=`${e}/${r.replaceAll("~","~0").replaceAll("/","~1")}`;if(s.has(r)?this.deletePointerSubtree(i):(s.add(r),n.push(r)),this.skipWhitespace(),this.text[this.offset]!==":")throw new j(this.offset);if(this.offset++,this.collectValue(i),this.skipWhitespace(),this.text[this.offset]==="}"){this.offset++;return}if(this.text[this.offset]!==",")throw new j(this.offset);this.offset++,this.skipWhitespace()}throw new j(this.offset)}collectArray(e){if(this.offset++,this.skipWhitespace(),this.text[this.offset]==="]"){this.offset++;return}let n=0;for(;this.offset<this.text.length;){if(this.collectValue(`${e}/${n}`),n++,this.skipWhitespace(),this.text[this.offset]==="]"){this.offset++;return}if(this.text[this.offset]!==",")throw new j(this.offset);this.offset++,this.skipWhitespace()}throw new j(this.offset)}readString(e){this.offset++;let n="";for(;this.offset<this.text.length;){const s=this.offset,r=this.text[this.offset++];if(r==='"')return n;if(r.charCodeAt(0)<32)throw new j(s);if(r!=="\\"){e&&(n+=r);continue}const i=this.offset,a=this.text[this.offset++];switch(a){case'"':case"\\":case"/":e&&(n+=a);break;case"b":e&&(n+="\b");break;case"f":e&&(n+="\f");break;case"n":e&&(n+=`
|
|
115
|
+
`);break;case"r":e&&(n+="\r");break;case"t":e&&(n+=" ");break;case"u":{const c=this.text.slice(this.offset,this.offset+4);if(!/^[\dA-Fa-f]{4}$/u.test(c))throw new j(this.offset);e&&(n+=String.fromCharCode(Number.parseInt(c,16))),this.offset+=4;break}default:throw new j(i)}}throw new j(this.offset)}consumeLiteral(e){let n=0;for(const s of e){if(this.text[this.offset+n]!==s)throw new j(this.offset+n);n++}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 j(this.offset);if(this.text[this.offset]==="."){if(this.offset++,this.text[this.offset]<"0"||this.text[this.offset]>"9")throw new j(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 j(this.offset);for(;this.text[this.offset]>="0"&&this.text[this.offset]<="9";)this.offset++}}skipWhitespace(){for(;this.offset<this.text.length;){const e=this.text[this.offset];if(e!==" "&&e!==" "&&e!==`
|
|
116
|
+
`&&e!=="\r")return;this.offset++}}deletePointerSubtree(e){const n=`${e}/`;for(const s of Object.keys(this.propertyOrder))(s===e||s.startsWith(n))&&delete this.propertyOrder[s]}},h(mt,"PropertyOrderCollector"),mt);function yo(t,e,n){let s;try{s=JSON.parse(t)}catch(r){const i=r instanceof Error?r.message:String(r);let a=Sg(i,t,e,n);if(!a){let c=0;try{new fi(t).collect()}catch(o){o instanceof j&&(c=o.offset)}a=Cs(t,c,e,n)}throw new di(`Invalid JSON: ${i}`,a.line,a.column)}if(typeof s!="object"||s===null||Array.isArray(s))throw new di("JSON value must have an object root",e,n);return{value:s,propertyOrder:new fi(t).collect()}}h(yo,"parseOrderedJsonObject");var Rg=h(t=>({shape:t.type==="normal"?"actor":t.type==="hollow"?"actor-hollow":t.type==="awesome"?"actor-awesome":"actor-icon",...t.label===t.id?{}:{label:t.label},...t.classes.length?{classes:[...t.classes]}:{},...t.styles.length?{styles:[...t.styles]}:{},attrs:{kind:"actor",actorType:t.type,business:t.business,labelType:t.labelType,...t.icon?{icon:t.icon}:{},...t.stereotype?{stereotype:t.stereotype}:{},...t.parentId?{parentId:t.parentId}:{}}}),"actorNode"),Lg=h(t=>({shape:t.shape,...t.label===t.id?{}:{label:t.label},...t.classes.length?{classes:[...t.classes]}:{},...t.styles.length?{styles:[...t.styles]}:{},attrs:{kind:"usecase",useCaseShape:t.shape,business:t.business,labelType:t.labelType,...t.stereotype?{stereotype:t.stereotype}:{},...t.parentId?{parentId:t.parentId}:{}}}),"useCaseNode"),Og=h(t=>({label:t.label,shape:"note",attrs:{kind:"note",target:t.target,labelType:t.labelType}}),"noteNode"),Ng=h(t=>({label:t.id,shape:"json-table",...t.classes.length?{classes:[...t.classes]}:{},...t.styles.length?{styles:[...t.styles]}:{},attrs:{kind:"json",value:t.value,propertyOrder:t.propertyOrder,labelType:"text"}}),"jsonNode"),Ig=h(t=>({id:t.id,source:t.source,target:t.target,...t.label?{label:t.label}:{},...t.classes.length?{classes:[...t.classes]}:{},...t.styles.length?{styles:[...t.styles]}:{},attrs:{relationshipType:t.type,arrowType:t.arrowType,minlen:t.minlen,explicitId:t.explicitId,animate:t.animate,...t.animation?{animation:t.animation}:{},...t.labelType?{labelType:t.labelType}:{}}}),"relationshipEdge"),bg=h(t=>({id:`${t.id}-edge`,source:t.id,target:t.target,attrs:{relationshipType:"note",arrowType:w.LINE_SOLID,pattern:"dotted",minlen:1,explicitId:!1,animate:!1,internal:!0}}),"noteEdge"),Cg=h((t,e,n,s)=>{const r={};for(const o of t.getActors().values())r[o.id]=Rg(o);for(const o of t.getUseCases().values())r[o.id]=Lg(o);for(const o of t.getNotes().values())r[o.id]=Og(o);for(const o of t.getJsonNodes().values())r[o.id]=Ng(o);const i={};for(const o of t.getSystemBoundaries().values())i[o.id]={...o.label===o.id?{}:{title:o.label},nodes:[...o.members],...o.classes.length?{classes:[...o.classes]}:{},...o.styles.length?{styles:[...o.styles]}:{},attrs:{kind:"systemBoundary",boundaryType:o.type,labelType:o.labelType}};const a={};for(const o of t.getClassDefs().values())a[o.id]={styles:[...o.styles]};const c=t.getDirection();return{version:1,diagramType:"usecase",source:e,header:{keyword:"usecase",direction:c==="TD"?"TB":c,span:n},...t.getAccTitle()?{accTitle:t.getAccTitle()}:{},...t.getAccDescription()?{accDescr:t.getAccDescription()}:{},nodes:r,edges:[...t.getRelationships().map(Ig),...[...t.getNotes().values()].map(bg)],groups:i,classDefs:a,statements:s}},"buildUsecaseGraphAST"),H=h(t=>`line ${t.line}, column ${t.column} [${t.span[0]},${t.span[1]})`,"locationText"),pi=h(t=>t===void 0?"":` (label "${t}")`,"labelSuffix"),Qe=h(t=>t.generated?t.label:void 0,"generatedFrom"),os=h((t,e)=>{for(const n of e)t.includes(n)||t.push(n)},"pushUnique"),gt,kg=(gt=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()}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,n,s,r){this.metadataAssignments.push({target:e,targetLocation:n,metadata:s,statement:r})}addClassDef(e,n){this.classDefinitions.push({ids:e,styles:n})}addClassAssignment(e,n){this.classAssignments.push({targets:e,classes:n})}addStyleAssignment(e,n,s){this.styleAssignments.push({target:e,location:n,styles:s})}setDirection(e){this.directions.push(e==="TD"?"TB":e)}setAccTitle(e){this.model.accTitle=e}setAccDescription(e){this.model.accDescription=e}setStatements(e){this.statements=e}getActors(){return this.model.actors}getUseCases(){return this.model.useCases}getSystemBoundaries(){return this.model.systemBoundaries}getRelationships(){return this.model.relationships}getNotes(){return this.model.notes}getJsonNodes(){return this.model.jsonNodes}getClassDefs(){return this.model.classDefs}getDirection(){return this.model.direction}getAccTitle(){return this.model.accTitle}getAccDescription(){return this.model.accDescription}finalize(e){const n=new Map,s=new Map,r=new Map,i=new Map;for(const l of this.relationshipDrafts)this.recordFirst(i,l.source.id,l.source.location.span[0]),this.recordFirst(i,l.target.id,l.target.location.span[0]);for(const l of this.elements)this.recordFirst(i,l.id,l.location.span[0]);for(const l of this.boundaries)this.recordFirst(i,l.id,l.location.span[0]);for(const l of this.jsonDrafts)this.recordFirst(i,l.id,l.location.span[0]);const a=[...this.elements.map(l=>({offset:l.location.span[0],type:"element",value:l})),...this.boundaries.map(l=>({offset:l.location.span[0],type:"boundary",value:l})),...this.jsonDrafts.map(l=>({offset:l.location.span[0],type:"json",value:l})),...this.relationshipDrafts.filter(l=>l.explicitId).map(l=>({offset:l.explicitIdLocation.span[0],type:"edge",value:l}))].sort((l,d)=>l.offset-d.offset);for(const l of a)l.type==="element"?this.collectElement(l.value,n,s):l.type==="boundary"?this.collectBoundary(l.value,n,r):l.type==="json"?this.registerUnique(n,l.value.id,"json",l.value.location,!1):this.registerUnique(n,l.value.explicitId,"edge",l.value.explicitIdLocation,!1);this.materializeElements(s,i),this.materializeBoundaries(r,i),this.materializeJson(i);const c=this.materializeRelationships(n,s,i);this.reorderElements(s,i),this.applyMetadataAssignments(n,s,r,c),this.validateAndRefreshElements(s),this.refreshBoundaries(r,s),this.materializeNotes(n),this.applyClassDefinitions(),this.applyClassesAndStyles(n,c),this.model.direction=this.directions.at(-1)??this.model.direction,this.model.symbols=new Map([...n].map(([l,d])=>[l,d.kind]));const o=Cg(this,this.source,e,this.statements);return this.model.ast=o,this.db.commit(this.model),o}collectElement(e,n,s){const r=n.get(e.id),i=Qe({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,Qe(r)),r&&(r.generated||e.generated)&&this.conflict(`Generated ID '${e.id}' collides with another declaration`,e.location,r.location,i,Qe(r));const a=s.get(e.id);if(!a){const c={kind:e.kind,id:e.id,label:e.label,location:e.location,generated:e.generated,classes:[...e.classes],...e.parentId?{parentId:e.parentId,parentLocation:e.parentLocation}:{},...e.shape?{shape:e.shape}:{},...e.stereotype?{stereotype:e.stereotype,stereotypeLocation:e.location}:{}};this.applyDeclarationMetadata(c,e.metadata),s.set(e.id,c),n.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,os(a.classes,e.classes),this.applyDeclarationMetadata(a,e.metadata)}collectBoundary(e,n,s){const r=n.get(e.id),i=Qe({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,Qe(r)),r&&(r.generated||e.generated)&&this.conflict(`Generated ID '${e.id}' collides with another declaration`,e.location,r.location,i,Qe(r));const a=s.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),os(a.classes,e.classes);return}s.set(e.id,{id:e.id,label:e.label,location:e.location,generated:e.generated,classes:[...e.classes],styles:[],members:[]}),n.set(e.id,{kind:"boundary",location:e.location,generated:e.generated,label:e.label.text})}materializeElements(e,n){for(const s of[...e.values()].sort((r,i)=>(n.get(r.id)??0)-(n.get(i.id)??0)))this.setElementModel(s)}materializeBoundaries(e,n){for(const s of[...e.values()].sort((r,i)=>(n.get(r.id)??0)-(n.get(i.id)??0)))this.model.systemBoundaries.set(s.id,{id:s.id,label:s.label.text,labelType:s.label.type,type:s.type??"rect",members:[],classes:[...s.classes],styles:[...s.styles]})}materializeJson(e){for(const n of[...this.jsonDrafts].sort((s,r)=>(e.get(s.id)??0)-(e.get(r.id)??0)))this.model.jsonNodes.set(n.id,{id:n.id,value:n.value,propertyOrder:n.propertyOrder,classes:[...n.classes],styles:[]})}materializeRelationships(e,n,s){const r=new Map;let i=0;for(const a of this.relationshipDrafts){const c=this.resolveEndpoint(a.source,e,n,s),o=this.resolveEndpoint(a.target,e,n,s);this.validateRelationship(a,c,o,e);const l=a.explicitId??`edge-${i++}`,d={id:l,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(d),r.set(l,{draft:a,relationship:d})}return this.model.relationshipCounter=i,r}resolveEndpoint(e,n,s,r){if(e.classesOnReference&&!e.declaration)throw new Error(`Relationship endpoint '${e.id}' uses ::: without declaring the node at ${H(e.location)}`);const i=n.get(e.id);return i?i.kind:(s.set(e.id,{kind:"usecase",id:e.id,label:e.label,location:e.location,generated:e.generated,shape:"ellipse",classes:[]}),n.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,n){const s=new Map(this.model.actors),r=new Map(this.model.useCases);this.model.actors.clear(),this.model.useCases.clear();for(const i of[...e.values()].sort((a,c)=>(n.get(a.id)??0)-(n.get(c.id)??0))){!s.has(i.id)&&!r.has(i.id)&&this.setElementModel(i);const a=s.get(i.id)??this.model.actors.get(i.id),c=r.get(i.id)??this.model.useCases.get(i.id);a?this.model.actors.set(i.id,a):c&&this.model.useCases.set(i.id,c)}}applyMetadataAssignments(e,n,s,r){for(const i of this.metadataAssignments){const a=e.get(i.target);if(!a){const c=this.inferMetadataKind(i.metadata);throw new Error(`Metadata target '${i.target}' is unresolved${c?` (metadata implies ${c})`:""} at ${H(i.targetLocation)}`)}if(a.kind==="actor"||a.kind==="usecase")this.applyStandaloneElementMetadata(n.get(i.target),i.metadata);else if(a.kind==="boundary"){const c=s.get(i.target);for(const o of i.metadata.properties)(o.key!=="type"||o.value!=="rect"&&o.value!=="package")&&this.invalidMetadata(i.target,a.kind,o),c.type=o.value}else if(a.kind==="edge"){const c=r.get(i.target);if(!c)throw new Error(`Metadata target '${i.target}' is not an explicit edge at ${H(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(const o of i.metadata.properties)o.key==="animate"&&typeof o.value=="boolean"?c.relationship.animate=o.value:o.key==="animation"&&(o.value==="fast"||o.value==="slow")?(c.relationship.animation=o.value,c.relationship.animate=!0):this.invalidMetadata(i.target,a.kind,o)}else for(const c of i.metadata.properties)this.invalidMetadata(i.target,a.kind,c)}for(const{relationship:i}of r.values())i.animation&&(i.animate=!0)}applyStandaloneElementMetadata(e,n){for(const s of n.properties)e.kind==="actor"?this.applyActorProperty(e,s,!0):s.key==="business"&&typeof s.value=="boolean"?e.business=s.value:this.invalidMetadata(e.id,e.kind,s)}applyDeclarationMetadata(e,n){if(n)for(const s of n.properties)e.kind==="actor"?this.applyActorProperty(e,s,!1):s.key==="business"&&typeof s.value=="boolean"?(e.business!==void 0&&e.business!==s.value&&this.conflict(`Use case '${e.id}' has conflicting business metadata`,s.location,e.location),e.business=s.value):this.invalidMetadata(e.id,e.kind,s)}applyActorProperty(e,n,s){n.key==="type"&&(n.value==="normal"||n.value==="hollow"||n.value==="awesome")?(!s&&e.actorType!==void 0&&e.actorType!==n.value&&this.conflict(`Actor '${e.id}' has conflicting type metadata`,n.location,e.location),e.actorType=n.value):n.key==="icon"&&typeof n.value=="string"?(!s&&e.icon!==void 0&&e.icon!==n.value&&this.conflict(`Actor '${e.id}' has conflicting icon metadata`,n.location,e.location),e.icon=n.value):n.key==="business"&&typeof n.value=="boolean"?(!s&&e.business!==void 0&&e.business!==n.value&&this.conflict(`Actor '${e.id}' has conflicting business metadata`,n.location,e.location),e.business=n.value):this.invalidMetadata(e.id,e.kind,n)}validateAndRefreshElements(e){for(const n of e.values()){const s=n.icon?"icon":n.actorType??"normal";if(n.kind==="actor"){if(n.icon&&n.actorType&&n.actorType!=="normal")throw new Error(`Actor '${n.id}' cannot combine icon with type '${n.actorType}' at ${H(n.location)}`);if(n.business&&(s==="icon"||s==="awesome"))throw new Error(`Business actor '${n.id}' must use normal or hollow geometry at ${H(n.location)}`)}else if((n.shape??"ellipse")==="rect"&&n.business)throw new Error(`Rectangular use case '${n.id}' cannot be a business use case at ${H(n.location)}`);this.setElementModel(n)}}refreshBoundaries(e,n){for(const s of e.values())s.members.length=0;for(const s of[...this.elements].sort((r,i)=>r.location.span[0]-i.location.span[0])){if(!s.parentId)continue;const r=e.get(s.parentId);if(!r)throw new Error(`Parent boundary '${s.parentId}' for '${s.id}' is unresolved at ${H(s.parentLocation??s.location)}`);r.members.includes(s.id)||r.members.push(s.id)}for(const s of n.values())if(s.parentId&&!e.has(s.parentId))throw new Error(`Parent boundary '${s.parentId}' for '${s.id}' is unresolved at ${H(s.parentLocation??s.location)}`);for(const s of e.values()){const r=this.model.systemBoundaries.get(s.id);r.type=s.type??"rect",r.members=[...s.members],r.classes=[...s.classes],r.styles=[...s.styles]}}materializeNotes(e){let n=0;for(const s of this.noteDrafts){const r=e.get(s.target);if(!r)throw new Error(`Note target '${s.target}' is unresolved at ${H(s.targetLocation)}`);r.kind!=="actor"&&r.kind!=="usecase"&&this.conflict(`Note target '${s.target}' must be an actor or use case, not ${r.kind}`,s.targetLocation,r.location);const i=`note-${n++}`;this.model.notes.set(i,{id:i,target:s.target,label:s.label.text,labelType:s.label.type})}this.model.noteCounter=n}applyClassDefinitions(){for(const e of this.classDefinitions)for(const n of e.ids)this.model.classDefs.set(n,{id:n,styles:[...e.styles]})}applyClassesAndStyles(e,n){for(const s of this.classAssignments)for(const r of s.targets)os(this.getStylable(r.id,e,n,r.location).classes,s.classes);for(const s of this.styleAssignments)this.getStylable(s.target,e,n,s.location).styles.push(...s.styles)}getStylable(e,n,s,r){const i=n.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"?s.get(e)?.relationship:void 0;if(!a)throw new Error(`Class/style target '${e}' is unresolved or anonymous at ${H(r)}`);return a}validateRelationship(e,n,s,r){const i=h(a=>a==="actor"||a==="usecase"||a==="json","allowed");if(i(n)||this.conflict(`Relationship source '${e.source.id}' cannot be ${n}`,e.source.location,r.get(e.source.id).location),i(s)||this.conflict(`Relationship target '${e.target.id}' cannot be ${s}`,e.target.location,r.get(e.target.id).location),(e.type==="include"||e.type==="extend")&&(n!=="usecase"||s!=="usecase"))throw new Error(`${e.type} relationship requires use-case endpoints at ${H(e.location)}`);if(e.type==="generalization"&&(n!=="actor"&&n!=="usecase"||n!==s))throw new Error(`Generalization requires actor-to-actor or use-case-to-use-case endpoints at ${H(e.location)}`);if(e.type==="association"&&(n==="json"||s==="json")&&![0,1,2].includes(e.arrowType))throw new Error(`JSON relationship '${e.source.id}' to '${e.target.id}' permits only point, reversed-point, or markerless solid association at ${H(e.location)}`)}setElementModel(e){if(e.kind==="actor"){const n=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:n,...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){const n=new Set(["actor","usecase","boundary","edge"]);for(const s of e.properties)if(s.key==="icon")n.clear(),n.add("actor");else if(s.key==="animate"||s.key==="animation")n.clear(),n.add("edge");else if(s.key==="type")n.clear(),s.value==="rect"||s.value==="package"?n.add("boundary"):(s.value==="normal"||s.value==="hollow"||s.value==="awesome")&&n.add("actor");else if(s.key==="business")n.delete("boundary"),n.delete("edge");else return;return n.size===1?[...n][0]:void 0}invalidMetadata(e,n,s){throw new Error(`Metadata property '${s.key}' is invalid for ${n} '${e}' at ${H(s.location)}`)}registerUnique(e,n,s,r,i){const a=e.get(n);a&&this.conflict(`ID '${n}' is declared more than once (${a.kind} and ${s})`,r,a.location,void 0,Qe(a)),e.set(n,{kind:s,location:r,generated:i})}recordFirst(e,n,s){const r=e.get(n);(r===void 0||s<r)&&e.set(n,s)}conflict(e,n,s,r,i){throw new Error(`${e} at ${H(n)}${pi(r)}; previous declaration at ${H(s)}${pi(i)}`)}},h(gt,"UsecaseModelBuilder"),gt),vg=Dt.getBaseCstVisitorConstructor(),Tt,_g=(Tt=class extends vg{constructor(){super(),this.builder=new kg(_n),this.source="",this.anonymousEdge=0,this.anonymousNote=0,this.validateVisitor()}build(e,n){this.source=n,this.parentBoundary=void 0,this.anonymousEdge=0,this.anonymousNote=0,this.builder.reset(n),this.visit(e)}start(e){const n=this.tokens(e,"USECASE")[0],s=[];for(const r of this.nodes(e,"line"))s.push(this.visit(r));this.builder.setStatements(s),this.builder.finalize(this.tokenSpan(n))}line(e){const n=this.firstNode(e,"blankLine","commentLine","statement");return this.wrap(n,this.visit(n))}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){const n=this.tokens(e,"ACC_TITLE_LINE")[0].image;return this.builder.setAccTitle(n.slice(n.indexOf(":")+1).trim()),{kind:"accTitle",span:[0,0]}}accDescrStatement(e){const n=this.tokens(e,"ACC_DESCR_LINE")[0],s=this.tokens(e,"ACC_DESCR_BLOCK")[0],r=n?n.image.slice(n.image.indexOf(":")+1).trim():s.image.slice(s.image.indexOf("{")+1,s.image.lastIndexOf("}")).trim();return this.builder.setAccDescription(r),{kind:"accDescr",span:[0,0]}}actorStatement(e){const n=this.nodes(e,"actorItem"),s=n.map(l=>this.visit(l)),r=this.nodes(e,"relationTail")[0],i=s.map((l,d)=>this.actorOccurrence(n[d],l,!0));for(const l of s)this.builder.addElement(this.actorDraft(l));if(!r)return{kind:"node",span:[0,0],nodes:i};const a=this.visit(r);a.target.explicitDeclaration&&this.builder.addElement(this.entityDraft(a.target));const c=this.relationshipDraft(s[0],a,this.nodeLocation(r));this.builder.addRelationship(c);const o=c.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:o,span:[0,0],...c.explicitIdLocation?{idSpan:c.explicitIdLocation.span}:{},...c.label?{labelSpan:c.label.span}:{}}]}}actorItem(e){const n=this.visit(this.nodes(e,"actorName")[0]),s=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{...n,...s?{metadata:this.visit(s)}:{},...r?{stereotype:this.visit(r)}:{},classes:a.classes,classSpans:a.spans}}actorName(e){const n=this.tokens(e,"IDENTIFIER")[0],s=this.tokens(e,"PLAIN_STRING")[0]??this.tokens(e,"MARKDOWN_STRING")[0];if(n){const i=this.nodes(e,"nodeLabel")[0],a=i?this.visit(i):this.tokenLabel(n);return{id:n.image,label:a,location:this.tokenLocation(n),generated:!1,classes:[],classSpans:[]}}const r=this.tokenLabel(s);return{id:this.generateId(r.text),label:r,location:this.tokenLocation(s),generated:!0,classes:[],classSpans:[]}}actorDeclarationOnly(e){const n=this.nodes(e,"actorItem"),s=n.map(r=>this.visit(r));for(const r of s)this.builder.addElement(this.actorDraft(r));return{kind:"node",span:[0,0],nodes:s.map((r,i)=>this.actorOccurrence(n[i],r,!0))}}entityStatement(e){const n=this.nodes(e,"entityName"),s=this.visit(n[0]),r=this.nodes(e,"relationTail")[0];if(!r)return s.explicitDeclaration=!0,s.shape??="ellipse",this.builder.addElement(this.entityDraft(s)),{kind:"node",span:[0,0],nodes:[this.entityOccurrence(n[0],s,!0)]};s.explicitDeclaration&&this.builder.addElement(this.entityDraft(s));const i=this.visit(r);i.target.explicitDeclaration&&this.builder.addElement(this.entityDraft(i.target));const a={source:this.endpoint(s),target:this.endpoint(i.target),location:this.nodeLocation(r),...i.explicitId?{explicitId:i.explicitId,explicitIdLocation:i.explicitIdLocation}:{},...i.arrow};this.builder.addRelationship(a);const c=a.explicitId??`edge-${this.anonymousEdge++}`;return{kind:"edge",span:[0,0],nodes:[this.entityOccurrence(n[0],s,s.explicitDeclaration),this.entityOccurrence(this.nodes(r.children,"entityName")[0],i.target,i.target.explicitDeclaration)],edges:[{id:c,span:[0,0],...a.explicitIdLocation?{idSpan:a.explicitIdLocation.span}:{},...a.label?{labelSpan:a.label.span}:{}}]}}entityName(e){const n=this.tokens(e,"IDENTIFIER")[0],s=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],c=this.nodes(e,"classSuffix")[0],o=c?this.visit(c):{classes:[],spans:[]};if(n){const d=r?this.visit(r):this.tokenLabel(n),u=r?this.tokens(e,"LBRACKET").length?"rect":"ellipse":void 0;return{id:n.image,label:d,location:this.tokenLocation(n),generated:!1,...u?{shape:u}:{},...i?{metadata:this.visit(i)}:{},...a?{stereotype:this.visit(a)}:{},classes:o.classes,classSpans:o.spans,explicitDeclaration:!!(u||i||a)}}const l=this.tokenLabel(s);return{id:this.generateId(l.text),label:l,location:this.tokenLocation(s),generated:!0,...i?{metadata:this.visit(i)}:{},...a?{stereotype:this.visit(a)}:{},classes:o.classes,classSpans:o.spans,explicitDeclaration:!!(i||a)}}nodeLabel(e){const n=this.allTokens(e);if(n.length===1&&(n[0].tokenType.name==="PLAIN_STRING"||n[0].tokenType.name==="MARKDOWN_STRING"))return this.tokenLabel(n[0]);const s=[n[0].startOffset,(n.at(-1).endOffset??n.at(-1).startOffset)+1];return{text:this.source.slice(s[0],s[1]),type:"text",span:s}}useCaseMetadata(e){return this.visit(this.nodes(e,"metadata")[0])}relationTail(e){const n=this.tokens(e,"IDENTIFIER")[0];return{...n?{explicitId:n.image,explicitIdLocation:this.tokenLocation(n)}:{},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:w.SOLID_ARROW,minlen:1};const n=this.tokens(e,"INCLUDE").length?"include":"extend",s=this.tokens(e,n==="include"?"INCLUDE":"EXTEND")[0];return{type:n,arrowType:w.SOLID_ARROW,label:{text:n,type:"text",span:this.tokenSpan(s)},minlen:1}}metadata(e){return{properties:this.nodes(e,"metadataProperty").map(n=>this.visit(n)),location:this.ctxLocation(e)}}metadataProperty(e){const n=this.allTokens(e).filter(c=>c.tokenType.name!=="COLON"),s=n[0],r=n[1],i=r.tokenType.name==="TRUE"?!0:r.tokenType.name==="FALSE"?!1:this.decodePlain(r),a=[s.startOffset,(r.endOffset??r.startOffset)+1];return{key:this.decodePlain(s),value:i,span:a,keySpan:this.contentSpan(s),valueSpan:this.contentSpan(r),location:this.tokenLocation(s)}}metadataSeparator(e){}systemBoundaryStatement(e){const n=this.visit(this.nodes(e,"systemBoundaryName")[0]),s=this.nodes(e,"classSuffix")[0],r=s?this.visit(s):{classes:[],spans:[]};n.classes=r.classes,this.builder.addBoundary(n);const i=this.parentBoundary;this.parentBoundary={id:n.id,location:n.location};const a=this.nodes(e,"systemBoundaryContent")[0],c=a?this.visit(a):[];this.parentBoundary=i;const o=this.tokens(e,"END")[0],l=this.nodes(e,"metadata")[0],d=l?this.visit(l):void 0,u={kind:"group",span:[0,0],group:n.id,idSpan:n.location.span,titleSpan:n.label.span,endSpan:this.tokenSpan(o),classSpans:r.spans,...d?{metadata:d.properties.map(({key:f,span:m,keySpan:T,valueSpan:y})=>({key:f,span:m,keySpan:T,valueSpan:y}))}:{},...c.length?{children:c}:{}};return d&&this.builder.addMetadataAssignment(n.id,n.location,d,u),u}systemBoundaryName(e){const n=this.tokens(e,"IDENTIFIER")[0];if(n){const i=this.nodes(e,"nodeLabel")[0];return{id:n.image,label:i?this.visit(i):this.tokenLabel(n),location:this.tokenLocation(n),generated:!1,classes:[]}}const s=this.tokens(e,"PLAIN_STRING")[0]??this.tokens(e,"MARKDOWN_STRING")[0],r=this.tokenLabel(s);return{id:this.generateId(r.text),label:r,location:this.tokenLocation(s),generated:!0,classes:[]}}systemBoundaryContent(e){return[...this.nodes(e,"blankLine"),...this.nodes(e,"commentLine"),...this.nodes(e,"boundaryElement")].sort((s,r)=>(s.location?.startOffset??0)-(r.location?.startOffset??0)).map(s=>this.wrap(s,this.visit(s)))}boundaryElement(e){const n=this.nodes(e,"actorDeclarationOnly")[0];if(n)return this.visit(n);const s=this.nodes(e,"entityName")[0],r=this.visit(s);return r.explicitDeclaration=!0,r.shape??="ellipse",this.builder.addElement(this.entityDraft(r)),{kind:"node",span:[0,0],nodes:[this.entityOccurrence(s,r,!0)]}}metadataAssignmentStatement(e){const n=this.visit(this.nodes(e,"metadataAssignmentTarget")[0]),s=this.visit(this.nodes(e,"metadata")[0]),r={kind:"metadata",span:[0,0],nodes:[{id:n.id,span:n.location.span,idSpan:n.location.span}],metadata:s.properties.map(({key:i,span:a,keySpan:c,valueSpan:o})=>({key:i,span:a,keySpan:c,valueSpan:o}))};return this.builder.addMetadataAssignment(n.id,n.location,s,r),r}metadataAssignmentTarget(e){const n=this.allTokens(e)[0],s=this.tokenLabel(n);return{id:n.tokenType.name==="IDENTIFIER"?n.image:this.generateId(s.text),location:this.tokenLocation(n)}}noteStatement(e){const n=this.tokens(e,"IDENTIFIER")[0],s=this.visit(this.nodes(e,"nodeLabel")[0]);return this.builder.addNote({target:n.image,targetLocation:this.tokenLocation(n),label:s,location:this.ctxLocation(e)}),{kind:"note",span:[0,0],ref:`note-${this.anonymousNote++}`,refSpan:s.span,nodes:[{id:n.image,span:this.tokenSpan(n),idSpan:this.tokenSpan(n)}]}}stereotype(e){const n=this.tokens(e,"STEREOTYPE_TEXT")[0];return{value:n.image.trim(),span:this.tokenSpan(n)}}classSuffix(e){const n=this.tokens(e,"IDENTIFIER");return{classes:n.map(s=>s.image),spans:n.map(s=>this.tokenSpan(s))}}jsonStatement(e){const n=this.tokens(e,"JSON_DECLARATION_START")[0],s=this.tokens(e,"JSON_OBJECT_LITERAL")[0],r=/^json[\t ]+(\w+)/.exec(n.image),i=r[1],a=r[0].length-i.length,c={span:[n.startOffset+a,n.startOffset+a+i.length],line:n.startLine??1,column:(n.startColumn??1)+a},o=yo(s.image,s.startLine??1,s.startColumn??1),l=this.nodes(e,"classSuffix")[0],d=l?this.visit(l):{classes:[],spans:[]},u={id:i,value:o.value,propertyOrder:o.propertyOrder,location:c,classes:d.classes};return this.builder.addJson(u),{kind:"json",span:[0,0],nodes:[{id:i,span:c.span,idSpan:c.span,defines:!0,classSpans:d.spans}],classSpans:d.spans}}directionStatement(e){const n=this.allTokens(e).find(s=>["TD","TB","BT","RL","LR"].includes(s.tokenType.name));return this.builder.setDirection(n.image),{kind:"direction",span:[0,0]}}classDefStatement(e){const n=this.tokens(e,"IDENTIFIER"),s=this.visit(this.nodes(e,"styles")[0]);return this.builder.addClassDef(n.map(r=>r.image),s),{kind:"classDef",span:[0,0],ref:n[0].image,refSpan:this.tokenSpan(n[0])}}classStatement(e){const n=this.tokens(e,"IDENTIFIER");let s=1;for(;s<n.length&&this.source.slice((n[s-1].endOffset??n[s-1].startOffset)+1,n[s].startOffset).includes(",");s++);const r=n.slice(0,s).map(a=>({id:a.image,location:this.tokenLocation(a)})),i=n.slice(s).map(a=>a.image);return this.builder.addClassAssignment(r,i),{kind:"classAssign",span:[0,0],ref:i[0],refSpan:this.tokenSpan(n[s]),nodes:r.map(({id:a,location:c})=>({id:a,span:c.span,idSpan:c.span}))}}styleStatement(e){const n=this.tokens(e,"IDENTIFIER")[0],s=this.visit(this.nodes(e,"styles")[0]);return this.builder.addStyleAssignment(n.image,this.tokenLocation(n),s),{kind:"style",span:[0,0],nodes:[{id:n.image,span:this.tokenSpan(n),idSpan:this.tokenSpan(n)}]}}styles(e){return this.nodes(e,"styleValue").map(n=>this.visit(n))}styleValue(e){const n=this.allTokens(e),s=[n[0].startOffset,(n.at(-1).endOffset??n.at(-1).startOffset)+1];return this.source.slice(s[0],s[1]).replaceAll("\\,",",")}styleComponent(e){return this.allTokens(e).map(n=>n.image).join("")}forwardSolidOperator(e){const n=this.tokens(e,"FORWARD_SOLID")[0];return{type:"association",arrowType:w.SOLID_ARROW,minlen:this.solidMinlen(n)}}backwardSolidOperator(e){const n=this.tokens(e,"BACKWARD_SOLID")[0],s=this.nodes(e,"edgeLabel")[0],r=s?this.tokens(e,"MARKERLESS_SOLID").at(-1):n;return{type:"association",arrowType:w.BACK_ARROW,minlen:this.solidMinlen(r),...s?{label:this.visit(s)}:{}}}markerlessSolidOperator(e){const n=this.nodes(e,"edgeLabel")[0],s=this.allTokens(e);if(!n)return{type:"association",arrowType:w.LINE_SOLID,minlen:this.solidMinlen(this.tokens(e,"MARKERLESS_SOLID")[0])};const r=s.at(-1),i=r.tokenType.name==="FORWARD_SOLID"?w.SOLID_ARROW:r.tokenType.name==="FORWARD_CIRCLE"?w.CIRCLE_ARROW:r.tokenType.name==="FORWARD_CROSS"?w.CROSS_ARROW:w.LINE_SOLID;return{type:"association",arrowType:i,label:this.visit(n),minlen:i===w.SOLID_ARROW||i===w.LINE_SOLID?this.solidMinlen(r):1}}forwardCircleOperator(e){return{type:"association",arrowType:w.CIRCLE_ARROW,minlen:1}}backwardCircleOperator(e){const n=this.nodes(e,"edgeLabel")[0];return{type:"association",arrowType:w.CIRCLE_ARROW_REVERSED,minlen:1,...n?{label:this.visit(n)}:{}}}forwardCrossOperator(e){return{type:"association",arrowType:w.CROSS_ARROW,minlen:1}}backwardCrossOperator(e){const n=this.nodes(e,"edgeLabel")[0];return{type:"association",arrowType:w.CROSS_ARROW_REVERSED,minlen:1,...n?{label:this.visit(n)}:{}}}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,n=e.explicitDeclaration??!0){return{id:e.id,label:e.label,location:e.location,generated:e.generated,declaration:n,classesOnReference:e.classes.length>0}}relationshipDraft(e,n,s){return{source:this.endpoint(e,!0),target:this.endpoint(n.target),location:s,...n.explicitId?{explicitId:n.explicitId,explicitIdLocation:n.explicitIdLocation}:{},...n.arrow}}actorOccurrence(e,n,s){return{id:n.id,span:this.nodeSpan(e),idSpan:n.location.span,labelSpan:n.label.span,...s?{defines:!0}:{},...n.stereotype?{stereotypeSpan:n.stereotype.span}:{},...n.metadata?{metadata:n.metadata.properties.map(({key:r,span:i,keySpan:a,valueSpan:c})=>({key:r,span:i,keySpan:a,valueSpan:c}))}:{},...n.classSpans.length?{classSpans:n.classSpans}:{}}}entityOccurrence(e,n,s){return this.actorOccurrence(e,n,s)}wrap(e,n){if(n.kind==="blank"||n.kind==="comment")return n;n.span=this.nodeSpan(e);for(const s of n.edges??[])s.span=n.span;return n}tokenLabel(e){const n=e.tokenType.name==="MARKDOWN_STRING"?"markdown":"text",s=n==="markdown"?2:e.tokenType.name==="PLAIN_STRING"?1:0,r=this.tokenSpan(e,s);return{text:this.source.slice(r[0],r[1]),type:n,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){const n=this.allTokens(e.children)[0];return{span:this.nodeSpan(e),line:n.startLine??1,column:n.startColumn??1}}ctxLocation(e){const n=this.allTokens(e).filter(i=>i.tokenType.name!=="NEWLINE"&&i.tokenType.name!=="EOF"),s=n[0],r=n.at(-1);return{span:[s.startOffset,Math.min(this.source.length,(r.endOffset??r.startOffset+r.image.length-1)+1)],line:s.startLine??1,column:s.startColumn??1}}tokenLocation(e){const n=e.tokenType.name==="PLAIN_STRING"?1:e.tokenType.name==="MARKDOWN_STRING"?2:0;return{span:this.tokenSpan(e,n),line:e.startLine??1,column:(e.startColumn??1)+n}}nodeSpan(e){const n=this.allTokens(e.children).filter(i=>i.tokenType.name!=="NEWLINE"&&i.tokenType.name!=="EOF"),s=n[0],r=n.at(-1);if(!s||!r)throw new Error("Usecase CST node has no source token");return[s.startOffset,Math.min(this.source.length,(r.endOffset??r.startOffset+r.image.length-1)+1)]}tokenSpan(e,n=0){return[e.startOffset+n,Math.min(this.source.length,(e.endOffset??e.startOffset+e.image.length-1)+1-n)]}nodes(e,n){return(e[n]??[]).filter(s=>"children"in s)}tokens(e,n){return(e[n]??[]).filter(s=>"tokenTypeIdx"in s)}firstNode(e,...n){for(const s of n){const r=this.nodes(e,s)[0];if(r)return r}throw new Error(`Usecase CST is missing one of: ${n.join(", ")}`)}allTokens(e){const n=[];for(const s of Object.values(e))for(const r of s)"tokenTypeIdx"in r?n.push(r):n.push(...this.allTokens(r.children));return n.sort((s,r)=>s.startOffset-r.startOffset)}},h(Tt,"UsecaseVisitor"),Tt),xg=new _g,wg={parse:h(async t=>{_n.clear(),Dt.input=[];try{va({diagramType:"usecase",lexer:Eg,parser:Dt,entry:h(()=>Dt.start(),"entry"),visit:h(e=>xg.build(e,t),"visit")},t)}catch(e){_n.clear();const n=Dt.errors[0];if(n){const{token:s}=n,r=Number.isFinite(s.startOffset)?s.startOffset:t.length,i=typeof s.endOffset=="number"&&Number.isFinite(s.endOffset)?s.endOffset+1:r,a=s.startLine??t.slice(0,r).split(/\r\n|\r|\n/).length,c=Math.max(t.lastIndexOf(`
|
|
117
|
+
`,r-1),t.lastIndexOf("\r",r-1)),o=s.startColumn??r-c,l=e instanceof Error?e.message:String(e);throw new Error(`${l} at line ${a}, column ${o} [${r},${i})`)}throw e}},"parse")},Mg=["point","circle","cross","extension"],So={usecaseActor:!0,usecaseActorHollow:!0,usecaseActorAwesome:!0,usecaseActorIcon:!0},mi=h((t,e)=>{const[n,s]=[t,e].map(r=>r.replace(/[^\w-]+/g,"_").replace(/^_+|_+$/g,"")||"element");return`usecase-${n}-${s}`},"usecaseDomId"),Ug=h(t=>`usecase-${t.replace(/[^\w-]+/g,"_").replace(/^_+|_+$/g,"")||"element"}`,"usecaseNodeDomId"),Xn=h((t,e)=>e!=="markdown"?t:Fo(t).map(n=>n.map(s=>s.content).join(" ")).join(`
|
|
118
|
+
`),"getAccessibleLabel"),Pg=h(t=>{const e=Xn(t.label??t.id,t.labelType);if(So[t.shape]){const s=t.actorType&&t.actorType!=="normal"?`${t.actorType} `:"",r=t.business?"business ":"",i=t.stereotype?`, stereotype ${t.stereotype}`:"";return`${r}${s}actor ${e}${i}`}if(t.shape==="note")return`Note for ${t.noteTargetLabel??t.noteTarget??""}: ${e}`;if(t.shape==="usecaseJsonTable"){const s=(t.jsonRows??[]).map(r=>`${r.accessibleKey}: ${r.value}`).join("; ");return s?`${e}: ${s}`:e}const n=t.stereotype?`, stereotype ${t.stereotype}`:"";return`${t.business?"business ":""}use case ${e}${n}`},"getUsecaseNodeAccessibleName"),$g=h(t=>`${t.boundaryType} system boundary ${Xn(t.label??t.id,t.labelType)}`,"getUsecaseBoundaryAccessibleName"),Dg=h(t=>t.relationshipType==="note"?"":`${t.relationshipType==="association"&&t.label?`association ${Xn(t.label,t.labelType)}`:t.relationshipType} from ${t.sourceLabel} to ${t.targetLabel}`,"getUsecaseEdgeAccessibleName"),lt=h(t=>t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),"escapePlainLabel"),gi=h(t=>t.replace(/([*[\\\]_`])/g,"\\$1"),"escapeMarkdownMarkers"),Fg=h((t,e)=>{t.diagramId=e,t.markers=[...Mg];for(const n of t.nodes){const s=n;if(s.domId=Ug(n.id),n.label!==void 0&&n.labelType==="text"&&(n.label=lt(n.label)),n.stereotype&&(n.stereotype=lt(n.stereotype)),!n.isGroup&&n.shape==="usecaseJsonTable"&&(n.jsonRows=n.jsonRows?.map(r=>({...r,key:lt(r.key),value:lt(r.value)}))),!n.isGroup&&(n.shape==="usecaseEllipse"||n.shape==="rect")&&n.stereotype){const r=n.label??lt(n.id);n.label=`«${gi(n.stereotype)}»<br/>${n.labelType==="text"?gi(r):r}`,n.labelType="markdown",s.hasFoldedStereotype=!0,delete n.stereotype}}for(const n of t.edges)n.label!==void 0&&n.labelType==="text"&&(n.label=lt(n.label));return t},"prepareUsecaseLayoutData"),Bg=h((t,e,n)=>{for(const r of e.nodes){const i=typeof r.domId=="string"?r.domId:mi(e.diagramId,r.id),a=t.select(`#${i}`),c=r.isGroup?"boundary":So[r.shape]?"actor":r.shape==="note"?"note":r.shape==="usecaseJsonTable"?"json":"usecase",o=n.nodes.get(r.id)??r.id;if(a.attr("data-usecase-id",r.id).attr("data-usecase-kind",c).attr("role","img").attr("aria-label",o),!r.isGroup&&(r.shape==="usecaseEllipse"||r.shape==="rect")&&"hasFoldedStereotype"in r&&r.hasFoldedStereotype===!0){const l=a.node(),d=l?.querySelector(".nodeLabel"),u=d?.querySelector("p")??d,f=u?.firstChild;if(u&&f?.nodeType===3){const m=u.ownerDocument.createElement("span");m.className="usecase-stereotype",u.insertBefore(m,f),m.appendChild(f)}else l?.querySelector(".label tspan tspan, .label tspan")?.classList.add("usecase-stereotype")}}const s=new Map(e.edges.map(r=>[r.id,r]));t.selectAll('path[data-et="edge"]').each(function(){const r=s.get(this.getAttribute("data-id")??"");if(!r)return;const i=Bo(this);i.attr("id",mi(e.diagramId,r.id)).attr("data-usecase-id",r.id).attr("data-usecase-kind",r.internal?"note-connector":"relationship"),r.internal?i.attr("aria-hidden","true"):i.attr("role","img").attr("aria-label",n.edges.get(r.id)??r.id)})},"annotateUsecaseElements"),Ti=h((t,e)=>{t.style("--mermaid-usecase-actor-font-size",`${e.actorFontSize}px`).style("--mermaid-usecase-actor-font-family",e.actorFontFamily).style("--mermaid-usecase-actor-font-weight",e.actorFontWeight).style("--mermaid-usecase-font-size",`${e.usecaseFontSize}px`).style("--mermaid-usecase-font-family",e.usecaseFontFamily).style("--mermaid-usecase-font-weight",e.usecaseFontWeight)},"applyUsecaseFonts"),Gg=h(async(t,e,n,s)=>{Co.info("Drawing usecase diagram (unified)",e);const{layout:r}=yi(),i=s.db,a=i.getData(),c=new Map(a.nodes.map(u=>[u.id,Xn(u.label??u.id,u.labelType)])),o={nodes:new Map(a.nodes.map(u=>[u.id,u.isGroup?$g(u):Pg(u.shape==="note"?{...u,noteTargetLabel:c.get(u.noteTarget??"")}:u)])),edges:new Map(a.edges.map(u=>[u.id,Dg({...u,sourceLabel:c.get(u.source)??u.sourceLabel,targetLabel:c.get(u.target)??u.targetLabel})]))},l=Oo(e,a.config.securityLevel);a.layoutAlgorithm=ko(r),Fg(a,e),Ti(l,a),await vo(a,l),Bg(l,a,o);const d=a.diagramPadding;_o.insertTitle(l,"usecaseDiagramTitleText",0,i.getDiagramTitle?.()??""),No(l,d,"usecaseDiagram",a.useMaxWidth),Ti(l,a)},"draw"),Wg={draw:Gg},jg=h(t=>({actorBkg:t.usecaseActorBkg??t.actorBkg??t.mainBkg,actorBorder:t.usecaseActorBorder??t.actorBorder??t.primaryColor,bkg:t.usecaseBkg??t.mainBkg,border:t.usecaseBorder??t.nodeBorder??t.primaryColor,boundaryBkg:t.usecaseBoundaryBkg??t.clusterBkg,boundaryBorder:t.usecaseBoundaryBorder??t.clusterBorder,includeLine:t.usecaseIncludeLine??t.lineColor,extendLine:t.usecaseExtendLine??t.lineColor}),"roleColors"),Kg=h(t=>{const{theme:e,bkgColorArray:n,borderColorArray:s}=t;if(!Uo(e,s))return"";const r=Po().usecase?.colorScheme==="rotate",i=_t(t.look),a=i==="handDrawn",c=$o(n);let o="";for(let l=0;l<Do(s);l++){const d=s[l],u=c?`fill: ${n[l%n.length]};`:"",f=`[data-look="${i}"][data-color-id="color-${l}"]`;o+=`
|
|
119
|
+
|
|
120
|
+
& ${f}.system-boundary rect.boundary-body,
|
|
121
|
+
& ${f}.system-boundary rect.boundary-tab,
|
|
122
|
+
& ${f}.system-boundary .boundary-body path,
|
|
123
|
+
& ${f}.system-boundary .boundary-tab path {
|
|
124
|
+
stroke: ${d};
|
|
125
|
+
${u}
|
|
126
|
+
}
|
|
127
|
+
`,r&&(o+=`
|
|
128
|
+
|
|
129
|
+
/* Use case bodies -- \`.usecase-element\` covers the ellipse form, the \`[Rect]\` form and
|
|
130
|
+
the business variant.
|
|
131
|
+
|
|
132
|
+
Element selectors only, never a bare \`path\`. Under the handDrawn look roughjs draws
|
|
133
|
+
the body as a *pair* of paths, an outline stroked in the border colour and a hachure
|
|
134
|
+
fill stroked in the background colour, with no class to tell them apart. Stroking
|
|
135
|
+
both repaints the fill lines as border colour and the shape collapses into a solid
|
|
136
|
+
block -- which is what \`.usecase-element path\` did. So handDrawn bodies keep the
|
|
137
|
+
theme's uniform colours, exactly as handDrawn flowchart nodes do. */
|
|
138
|
+
& ${f}.usecase-element ellipse,
|
|
139
|
+
& ${f}.usecase-element rect {
|
|
140
|
+
stroke: ${d};
|
|
141
|
+
${u}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/* The business marker is a single classed path, so it can be reached safely by name --
|
|
145
|
+
without it the marker keeps the uniform border beside a palette-coloured body. No
|
|
146
|
+
\`fill\`: the marker is drawn with \`fill="none"\` and has to stay that way. */
|
|
147
|
+
& ${f}.usecase-element .usecase-business-marker {
|
|
148
|
+
stroke: ${d};
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/* Actor glyphs, mirroring the uniform rule further down. The fill goes on the glyph
|
|
152
|
+
group, never on its children, so the hollow variant's own \`fill="none"\` keeps
|
|
153
|
+
winning and a hollow actor stays hollow. Same reason as above for not descending
|
|
154
|
+
into the handDrawn paths. */
|
|
155
|
+
& ${f}.usecase-actor .usecase-actor-shape,
|
|
156
|
+
& ${f}.usecase-actor .usecase-actor-hollow,
|
|
157
|
+
& ${f}.usecase-actor .usecase-actor-awesome,
|
|
158
|
+
& ${f}.usecase-actor .usecase-actor-icon {
|
|
159
|
+
stroke: ${d};
|
|
160
|
+
${u}
|
|
161
|
+
}
|
|
162
|
+
${a?"":`
|
|
163
|
+
/* The group rule above reaches the glyph by inheritance, which the neo look breaks: it
|
|
164
|
+
ships a \`[data-look="neo"].node path { stroke }\` rule that hits the glyph's own paths,
|
|
165
|
+
and a value set directly on the child always beats one inherited from the parent,
|
|
166
|
+
whatever the parent rule's specificity. So name the children too.
|
|
167
|
+
|
|
168
|
+
Emitted for every look *except* handDrawn, where roughjs draws the glyph as an
|
|
169
|
+
outline path plus a hachure fill path stroked in the fill colour, indistinguishable
|
|
170
|
+
in CSS -- stroking both turns a hollow actor into a solid disc. Deliberately no
|
|
171
|
+
\`fill\` either way, so the hollow variant's own \`fill="none"\` keeps winning. */
|
|
172
|
+
& ${f}.usecase-actor .usecase-actor-glyph path,
|
|
173
|
+
& ${f}.usecase-actor .usecase-actor-glyph circle {
|
|
174
|
+
stroke: ${d};
|
|
175
|
+
}
|
|
176
|
+
`}
|
|
177
|
+
`)}return o},"genColor"),zg=h(t=>{const e=jg(t),n=_t(t.look)==="handDrawn";return`
|
|
178
|
+
${Kg(t)}
|
|
179
|
+
& .usecase-actor {
|
|
180
|
+
color: ${t.actorTextColor??t.primaryTextColor};
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
& .usecase-actor-shape,
|
|
184
|
+
& .usecase-actor-hollow,
|
|
185
|
+
& .usecase-actor-awesome,
|
|
186
|
+
& .usecase-actor-icon {
|
|
187
|
+
fill: ${e.actorBkg};
|
|
188
|
+
stroke: ${e.actorBorder};
|
|
189
|
+
stroke-width: 2px;
|
|
190
|
+
}
|
|
191
|
+
${n?"":`
|
|
192
|
+
/* The rule above colours the glyph group and lets its children inherit, which the neo
|
|
193
|
+
look breaks: it ships a \`[data-look="neo"].node path { stroke }\` rule that lands on
|
|
194
|
+
the glyph's own paths, and a value set directly on a child always beats one inherited
|
|
195
|
+
from its parent, whatever the parent rule's specificity. Since neo is the default look,
|
|
196
|
+
without this every actor renders in the node border colour rather than the actor
|
|
197
|
+
colour the rule above asks for.
|
|
198
|
+
|
|
199
|
+
\`.node\` is in the selector to outrank that neo rule rather than tie with it: both
|
|
200
|
+
would otherwise be one attribute plus one class plus one element, leaving the winner to
|
|
201
|
+
depend on which stylesheet is concatenated last.
|
|
202
|
+
|
|
203
|
+
Stroke only: the hollow variant's own \`fill="none"\` has to keep winning. */
|
|
204
|
+
& .node.usecase-actor .usecase-actor-glyph path,
|
|
205
|
+
& .node.usecase-actor .usecase-actor-glyph circle {
|
|
206
|
+
stroke: ${e.actorBorder};
|
|
207
|
+
}
|
|
208
|
+
`}
|
|
209
|
+
& .usecase-actor .nodeLabel,
|
|
210
|
+
& .actor-label {
|
|
211
|
+
color: ${t.actorTextColor??t.primaryTextColor};
|
|
212
|
+
fill: ${t.actorTextColor??t.primaryTextColor};
|
|
213
|
+
font-family: var(--mermaid-usecase-actor-font-family, ${t.fontFamily});
|
|
214
|
+
font-size: var(--mermaid-usecase-actor-font-size, 14px);
|
|
215
|
+
font-weight: var(--mermaid-usecase-actor-font-weight, normal);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
& .usecase-element ellipse,
|
|
219
|
+
& .usecase-element rect,
|
|
220
|
+
& .usecase-business ellipse,
|
|
221
|
+
& .usecase-business rect {
|
|
222
|
+
fill: ${e.bkg};
|
|
223
|
+
stroke: ${e.border};
|
|
224
|
+
stroke-width: 2px;
|
|
225
|
+
}
|
|
226
|
+
${n?"":`
|
|
227
|
+
/* The same interception the actor glyph hits, one element down: neo ships
|
|
228
|
+
\`[data-look="neo"].node rect { stroke: nodeBorder }\`, which outranks the plain
|
|
229
|
+
\`.usecase-element rect\` above, so a use case written in the \`[Rect]\` form kept the node
|
|
230
|
+
border colour while its ellipse siblings took the role colour. An \`<ellipse>\` has no
|
|
231
|
+
equivalent neo rule and is already correct; restating it here costs nothing and means
|
|
232
|
+
the two forms cannot drift apart again.
|
|
233
|
+
|
|
234
|
+
Qualified with \`[data-look]\` *and* \`.node\` to land strictly above that rule rather than
|
|
235
|
+
tie with it -- on a tie the later stylesheet would win, which is how neo took this in
|
|
236
|
+
the first place. Skipped under handDrawn, where roughjs draws paths and neither element
|
|
237
|
+
exists. */
|
|
238
|
+
& [data-look="${_t(t.look)}"].node.usecase-element ellipse,
|
|
239
|
+
& [data-look="${_t(t.look)}"].node.usecase-element rect {
|
|
240
|
+
fill: ${e.bkg};
|
|
241
|
+
stroke: ${e.border};
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/* The business marker is a \`<path>\`, so it loses to \`[data-look="neo"].node path\` the same
|
|
245
|
+
way. No \`fill\`: the marker is drawn with \`fill="none"\` and has to stay that way. */
|
|
246
|
+
& [data-look="${_t(t.look)}"].node.usecase-element .usecase-business-marker {
|
|
247
|
+
stroke: ${e.border};
|
|
248
|
+
}
|
|
249
|
+
`}
|
|
250
|
+
& .usecase-element .nodeLabel,
|
|
251
|
+
& .usecase-label {
|
|
252
|
+
color: ${t.primaryTextColor};
|
|
253
|
+
fill: ${t.primaryTextColor};
|
|
254
|
+
font-family: var(--mermaid-usecase-font-family, ${t.fontFamily});
|
|
255
|
+
font-size: var(--mermaid-usecase-font-size, 12px);
|
|
256
|
+
font-weight: var(--mermaid-usecase-font-weight, normal);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
& .usecase-stereotype,
|
|
260
|
+
& .usecase-business-marker {
|
|
261
|
+
color: ${t.primaryTextColor};
|
|
262
|
+
fill: ${t.primaryTextColor};
|
|
263
|
+
stroke: ${e.border};
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
& .system-boundary rect.boundary-body,
|
|
267
|
+
& .system-boundary rect.boundary-tab,
|
|
268
|
+
& .system-boundary-package-tab {
|
|
269
|
+
fill: ${e.boundaryBkg};
|
|
270
|
+
stroke: ${e.boundaryBorder};
|
|
271
|
+
stroke-width: 1px;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
& .system-boundary-title text {
|
|
275
|
+
fill: ${t.titleColor??t.primaryTextColor};
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/* Only the span, never the <p> inside it: the renderer puts a user-supplied
|
|
279
|
+
'color' on the span, and that has to stay inheritable by its children. */
|
|
280
|
+
& .system-boundary-title span {
|
|
281
|
+
color: ${t.titleColor??t.primaryTextColor};
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
& .usecase-note {
|
|
285
|
+
fill: ${t.noteBkgColor};
|
|
286
|
+
stroke: ${t.noteBorderColor};
|
|
287
|
+
color: ${t.noteTextColor};
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
& .usecase-note .nodeLabel {
|
|
291
|
+
color: ${t.noteTextColor};
|
|
292
|
+
fill: ${t.noteTextColor};
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
& .usecase-json-table,
|
|
296
|
+
& .usecase-json-table rect,
|
|
297
|
+
& .usecase-json-cell {
|
|
298
|
+
fill: ${t.mainBkg};
|
|
299
|
+
stroke: ${t.nodeBorder??t.primaryColor};
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
& .usecase-json-title,
|
|
303
|
+
& .usecase-json-key,
|
|
304
|
+
& .usecase-json-value {
|
|
305
|
+
color: ${t.primaryTextColor};
|
|
306
|
+
fill: ${t.primaryTextColor};
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
& .relationship {
|
|
310
|
+
fill: none;
|
|
311
|
+
stroke: ${t.lineColor};
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
& .relationship-include,
|
|
315
|
+
& .relationship-extend,
|
|
316
|
+
& .relationship-note {
|
|
317
|
+
stroke-dasharray: 3;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/* Include and extend are both dashed, which is a weak distinction at small sizes. The
|
|
321
|
+
tokens default to \`lineColor\`, so a theme that does not set them is unchanged. */
|
|
322
|
+
& .relationship-include {
|
|
323
|
+
stroke: ${e.includeLine};
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
& .relationship-extend {
|
|
327
|
+
stroke: ${e.extendLine};
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
& .relationship.edge-animation-fast,
|
|
331
|
+
& .relationship.edge-animation-slow {
|
|
332
|
+
stroke-linecap: round;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
& .edgeLabel,
|
|
336
|
+
& .edgeLabel p {
|
|
337
|
+
background-color: ${t.edgeLabelBackground};
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
& .labelBkg {
|
|
341
|
+
background-color: ${t.edgeLabelBackground};
|
|
342
|
+
padding: 0 2px;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
& .edgeLabel .label rect {
|
|
346
|
+
fill: ${t.edgeLabelBackground};
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
& .relationship-label,
|
|
350
|
+
& .edgeLabel {
|
|
351
|
+
color: ${t.primaryTextColor};
|
|
352
|
+
fill: ${t.primaryTextColor};
|
|
353
|
+
font-family: ${t.fontFamily};
|
|
354
|
+
font-size: 10px;
|
|
355
|
+
font-weight: normal;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
& .marker,
|
|
359
|
+
& .marker.point,
|
|
360
|
+
& .marker.circle,
|
|
361
|
+
& .marker.cross {
|
|
362
|
+
fill: ${t.lineColor};
|
|
363
|
+
stroke: ${t.lineColor};
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
& .marker.extension {
|
|
367
|
+
fill: ${t.mainBkg};
|
|
368
|
+
stroke: ${t.lineColor};
|
|
369
|
+
}
|
|
370
|
+
`},"getStyles"),Hg=zg,Zg={parser:wg,db:_n,renderer:Wg,styles:Hg};export{Zg as diagram};
|