likec4 1.36.0 → 1.36.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/__app__/src/main.js +18 -11
- package/__app__/src/style.css +1 -1
- package/dist/cli/index.mjs +2 -2
- package/dist/index.mjs +1 -1
- package/dist/shared/{likec4.D8qlxD_Y.mjs → likec4.0TN5MWXf.mjs} +1 -1
- package/dist/shared/{likec4.DWIqzE5d.mjs → likec4.C9tWFblu.mjs} +614 -613
- package/dist/vite-plugin/index.mjs +1 -1
- package/package.json +11 -11
- package/react/index.mjs +35 -35
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import*as Vw from"node:fs";import{existsSync as F_}from"node:fs";import Wi,{resolve as M_,basename as B_}from"node:path";import{fileURLToPath as q_,pathToFileURL as j_}from"node:url";import{u as at,i as Ss}from"./likec4.BeWJWU7_.mjs";import{isatty as G_}from"tty";import Xw,{stripVTControlCharacters as U_}from"node:util";import W_ from"util";import zi from"path";import z_ from"os";import H_ from"crypto";import K_ from"net";import V_ from"url";import za from"fs";import X_ from"child_process";import*as dn from"@likec4/core";
|
|
2
|
-
import{BiMap as Y_,nonNullable as xt,invariant as Ae,nonexhaustive as Oe,DefaultArrowType as _s,DefaultLineStyle as J_,DefaultRelationshipColor as Ha,hasAtLeast as Q_,stringHash as Z_,BBox as Ka,defaultTheme as en,RichText as ex,hierarchyDistance as tx,DefaultThemeColor as Bo,nameFromFqn as
|
|
3
|
-
ancestorsFqn as cx,compareNatural as
|
|
4
|
-
DefaultTextSize as Ex,DefaultPaddingSize as $x,Fqn as Rx,FqnRef as Va}from"@likec4/core/types";import{EventEmitter as Dx}from"events";import{Graphviz as Xa}from"@hpcc-js/wasm-graphviz";import{LikeC4Model as xs}from"@likec4/core/model";import{Buffer as
|
|
2
|
+
import{BiMap as Y_,nonNullable as xt,invariant as Ae,nonexhaustive as Oe,DefaultArrowType as _s,DefaultLineStyle as J_,DefaultRelationshipColor as Ha,hasAtLeast as Q_,stringHash as Z_,BBox as Ka,defaultTheme as en,RichText as ex,hierarchyDistance as tx,DefaultThemeColor as Bo,nameFromFqn as pm,compareFqnHierarchically as nx,isThemeColor as Yw,extractStep as rx,delay as ix,isElementView as hm,isDeploymentView as sx,isDynamicView as ox,promiseNextTick as mm,FqnRef as fn,ThemeColors as ax,Fqn as ux,
|
|
3
|
+
ancestorsFqn as cx,compareNatural as gm,MultiMap as lx,computeColorValues as dx,sortByFqnHierarchically as Jw,isGlobalFqn as Qw,parentFqn as Zw,isDeploymentNode as fx,isScopedElementView as px,splitGlobalFqn as hx,ifilter as mx,toArray as gx,isSameHierarchy as eb,isAncestor as ym,FqnExpr as tn,RelationExpr as Xd,GlobalFqn as yx,isNonEmptyArray as Gn,LinkedList as tb,isAutoLayoutDirection as vx,isOrOperator as nb,isAndOperator as rb,_type as wx,memoizeProp as ib}from"@likec4/core";import{DefaultShapeSize as bx,
|
|
4
|
+
DefaultTextSize as Ex,DefaultPaddingSize as $x,Fqn as Rx,FqnRef as Va}from"@likec4/core/types";import{EventEmitter as Dx}from"events";import{Graphviz as Xa}from"@hpcc-js/wasm-graphviz";import{LikeC4Model as xs}from"@likec4/core/model";import{Buffer as vm}from"buffer";import{resolveRulesExtendedViews as kx,computeView as sb}from"@likec4/core/compute-view";import{MultiMap as xn,DefaultWeakMap as ob,sortNaturalByFqn as Tx,ancestorsFqn as Cx,compareNatural as Ax,nonNullable as Sx}from"@likec4/core/utils";
|
|
5
5
|
import Hi,{hrtime as ab}from"node:process";import _x from"boxen";import{spawn as xx}from"node:child_process";import{once as ub,on as Px}from"node:events";import Nx from"node:fs/promises";import{pipeline as Ix}from"node:stream/promises";import*as Ox from"node:readline/promises";import Lx from"node:os";import cb from"fs/promises";function lb(t){return typeof t=="function"?t:Fx(t)}function Fx(t){if(t==null)return()=>!1;if(t==="fatal")return e=>e.level==="fatal";if(t==="error")return e=>e.level==="f\
|
|
6
6
|
atal"||e.level==="error";if(t==="warning")return e=>e.level==="fatal"||e.level==="error"||e.level==="warning";if(t==="info")return e=>e.level==="fatal"||e.level==="error"||e.level==="warning"||e.level==="info";if(t==="debug")return e=>e.level==="fatal"||e.level==="error"||e.level==="warning"||e.level==="info"||e.level==="debug";if(t==="trace")return()=>!0;throw new TypeError(`Invalid log level: ${t}.`)}const db=["trace","debug","info","warning","error","fatal"];function fb(t,e){const n=db.indexOf(
|
|
7
|
-
t);if(n<0)throw new TypeError(`Invalid log level: ${JSON.stringify(t)}.`);const r=db.indexOf(e);if(r<0)throw new TypeError(`Invalid log level: ${JSON.stringify(e)}.`);return n-r}function Mx(t=[]){return qo.getLogger(t)}const
|
|
7
|
+
t);if(n<0)throw new TypeError(`Invalid log level: ${JSON.stringify(t)}.`);const r=db.indexOf(e);if(r<0)throw new TypeError(`Invalid log level: ${JSON.stringify(e)}.`);return n-r}function Mx(t=[]){return qo.getLogger(t)}const wm=Symbol.for("logtape.rootLogger");var qo=class ws{parent;children;category;sinks;parentSinks="inherit";filters;lowestLevel="trace";contextLocalStorage;static getLogger(e=[]){let n=wm in globalThis?globalThis[wm]??null:null;return n==null&&(n=new ws(null,[]),globalThis[wm]=
|
|
8
8
|
n),typeof e=="string"?n.getChild(e):e.length===0?n:n.getChild(e)}constructor(e,n){this.parent=e,this.children={},this.category=n,this.sinks=[],this.filters=[]}getChild(e){const n=typeof e=="string"?e:e[0],r=this.children[n];let i=r instanceof ws?r:r?.deref();return i==null&&(i=new ws(this,[...this.category,n]),this.children[n]="WeakRef"in globalThis?new WeakRef(i):i),typeof e=="string"||e.length===1?i:i.getChild(e.slice(1))}reset(){for(;this.sinks.length>0;)this.sinks.shift();for(this.parentSinks=
|
|
9
9
|
"inherit";this.filters.length>0;)this.filters.shift();this.lowestLevel="trace"}resetDescendants(){for(const e of Object.values(this.children)){const n=e instanceof ws?e:e.deref();n?.resetDescendants()}this.reset()}with(e){return new Bx(this,{...e})}filter(e){for(const n of this.filters)if(!n(e))return!1;return this.filters.length<1?this.parent?.filter(e)??!0:!0}*getSinks(e){if(!(this.lowestLevel===null||fb(e,this.lowestLevel)<0)){if(this.parent!=null&&this.parentSinks==="inherit")for(const n of this.
|
|
10
10
|
parent.getSinks(e))yield n;for(const n of this.sinks)yield n}}emit(e,n){if(!(this.lowestLevel===null||fb(e.level,this.lowestLevel)<0||!this.filter(e))){for(const r of this.getSinks(e.level))if(!n?.has(r))try{r(e)}catch(i){const s=new Set(n);s.add(r),qx.log("fatal","Failed to emit a log record to sink {sink}: {error}",{sink:r,error:i,record:e},s)}}}log(e,n,r,i){const s=ws.getLogger().contextLocalStorage?.getStore()??{};let o;const a=typeof r=="function"?{category:this.category,level:e,timestamp:Date.
|
|
@@ -16,41 +16,41 @@ n}get category(){return this.logger.category}get parent(){return this.logger.par
|
|
|
16
16
|
e,n[0]??{}):typeof e=="function"?this.logLazily("trace",e):Array.isArray(e)?this.logTemplate("trace",e,n):this.log("trace","{*}",e)}debug(e,...n){typeof e=="string"?this.log("debug",e,n[0]??{}):typeof e=="function"?this.logLazily("debug",e):Array.isArray(e)?this.logTemplate("debug",e,n):this.log("debug","{*}",e)}info(e,...n){typeof e=="string"?this.log("info",e,n[0]??{}):typeof e=="function"?this.logLazily("info",e):Array.isArray(e)?this.logTemplate("info",e,n):this.log("info","{*}",e)}warn(e,...n){
|
|
17
17
|
typeof e=="string"?this.log("warning",e,n[0]??{}):typeof e=="function"?this.logLazily("warning",e):Array.isArray(e)?this.logTemplate("warning",e,n):this.log("warning","{*}",e)}warning(e,...n){this.warn(e,...n)}error(e,...n){typeof e=="string"?this.log("error",e,n[0]??{}):typeof e=="function"?this.logLazily("error",e):Array.isArray(e)?this.logTemplate("error",e,n):this.log("error","{*}",e)}fatal(e,...n){typeof e=="string"?this.log("fatal",e,n[0]??{}):typeof e=="function"?this.logLazily("fatal",e):
|
|
18
18
|
Array.isArray(e)?this.logTemplate("fatal",e,n):this.log("fatal","{*}",e)}};const qx=qo.getLogger(["logtape","meta"]);function pb(t,e){const n=[];let r="";for(let i=0;i<t.length;i++){const s=t.charAt(i),o=t.charAt(i+1);if(s==="{"&&o==="{")r=r+s,i++;else if(s==="}"&&o==="}")r=r+s,i++;else if(s==="{")n.push(r),r="";else if(s==="}"){let a;r.match(/^\s*\*\s*$/)?a=r in e?e[r]:"*"in e?e["*"]:e:r.match(/^\s|\s$/)?a=r in e?e[r]:e[r.trim()]:a=e[r],n.push(a),r=""}else r=r+s}return n.push(r),n}function hb(t,e){
|
|
19
|
-
const n=[];for(let r=0;r<t.length;r++)n.push(t[r]),r<e.length&&n.push(e[r]);return n}function
|
|
20
|
-
...e}):mb!=null&&"inspect"in mb&&typeof
|
|
21
|
-
o).toISOString().replace(/.*T/,"").replace("Z"," +00:00"):t.timestamp==="time-tz"?o=>new Date(o).toISOString().replace(/.*T/,"").replace("Z"," +00"):t.timestamp==="time"?o=>new Date(o).toISOString().replace(/.*T/,"").replace("Z",""):t.timestamp==="date"?o=>new Date(o).toISOString().replace(/T.*/,""):t.timestamp==="rfc3339"?o=>new Date(o).toISOString():t.timestamp==="none"||t.timestamp==="disabled"?()=>null:t.timestamp,n=t.category??"\xB7",r=t.value??gb,i=t.level==null||t.level==="ABBR"?o=>
|
|
22
|
-
t.level==="abbr"?o=>
|
|
19
|
+
const n=[];for(let r=0;r<t.length;r++)n.push(t[r]),r<e.length&&n.push(e[r]);return n}function bm(t,e){return Xw.inspect(t,e)}const mb={__proto__:null,inspect:bm},Em={trace:"TRC",debug:"DBG",info:"INF",warning:"WRN",error:"ERR",fatal:"FTL"},gb=typeof document<"u"||typeof navigator<"u"&&navigator.product==="ReactNative"?t=>JSON.stringify(t):"Deno"in globalThis&&"inspect"in globalThis.Deno&&typeof globalThis.Deno.inspect=="function"?(t,e)=>globalThis.Deno.inspect(t,{strAbbreviateSize:1/0,iterableLimit:1/0,
|
|
20
|
+
...e}):mb!=null&&"inspect"in mb&&typeof bm=="function"?(t,e)=>bm(t,{maxArrayLength:1/0,maxStringLength:1/0,...e}):t=>JSON.stringify(t);function yb(t={}){const e=t.timestamp==null||t.timestamp==="date-time-timezone"?o=>new Date(o).toISOString().replace("T"," ").replace("Z"," +00:00"):t.timestamp==="date-time-tz"?o=>new Date(o).toISOString().replace("T"," ").replace("Z"," +00"):t.timestamp==="date-time"?o=>new Date(o).toISOString().replace("T"," ").replace("Z",""):t.timestamp==="time-timezone"?o=>new Date(
|
|
21
|
+
o).toISOString().replace(/.*T/,"").replace("Z"," +00:00"):t.timestamp==="time-tz"?o=>new Date(o).toISOString().replace(/.*T/,"").replace("Z"," +00"):t.timestamp==="time"?o=>new Date(o).toISOString().replace(/.*T/,"").replace("Z",""):t.timestamp==="date"?o=>new Date(o).toISOString().replace(/T.*/,""):t.timestamp==="rfc3339"?o=>new Date(o).toISOString():t.timestamp==="none"||t.timestamp==="disabled"?()=>null:t.timestamp,n=t.category??"\xB7",r=t.value??gb,i=t.level==null||t.level==="ABBR"?o=>Em[o]:
|
|
22
|
+
t.level==="abbr"?o=>Em[o].toLowerCase():t.level==="FULL"?o=>o.toUpperCase():t.level==="full"?o=>o:t.level==="L"?o=>o.charAt(0).toUpperCase():t.level==="l"?o=>o.charAt(0):t.level,s=t.format??(({timestamp:o,level:a,category:u,message:c})=>`${o?`${o} `:""}[${a}] ${u}: ${c}`);return o=>{let a="";for(let d=0;d<o.message.length;d++)d%2===0?a+=o.message[d]:a+=r(o.message[d]);const u=e(o.timestamp),c=i(o.level),l=typeof n=="function"?n(o.category):o.category.join(n);return`${s({timestamp:u,level:c,category:l,
|
|
23
23
|
message:a,record:o})}
|
|
24
|
-
`}}yb();const
|
|
25
|
-
s=n==null&&r==null?""
|
|
24
|
+
`}}yb();const $m="\x1B[0m",Rm={black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m"},Dm={bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",strikethrough:"\x1B[9m"},jx={trace:null,debug:"blue",info:"green",warning:"yellow",error:"red",fatal:"magenta"};function vb(t={}){const e=t.format,n=typeof t.timestampStyle>"u"?"dim":t.timestampStyle,r=t.timestampColor??null,i=`${n==null?"":Dm[n]}${r==null?"":Rm[r]}`,
|
|
25
|
+
s=n==null&&r==null?"":$m,o=typeof t.levelStyle>"u"?"bold":t.levelStyle,a=t.levelColors??jx,u=typeof t.categoryStyle>"u"?"dim":t.categoryStyle,c=t.categoryColor??null,l=`${u==null?"":Dm[u]}${c==null?"":Rm[c]}`,f=u==null&&c==null?"":$m;return yb({timestamp:"date-time-tz",value(d){return gb(d,{colors:!0})},...t,format({timestamp:d,level:p,category:m,message:w,record:y}){const g=a[y.level];return d=`${i}${d}${s}`,p=`${o==null?"":Dm[o]}${g==null?"":Rm[g]}${p}${o==null&&g==null?"":$m}`,e==null?`${d} ${p}\
|
|
26
26
|
${l}${m}:${f} ${w}`:e({timestamp:d,level:p,category:`${l}${m}${f}`,message:w,record:y})}})}vb();function Gx(t={}){let e;if(typeof t.categorySeparator=="function")e=t.categorySeparator;else{const s=t.categorySeparator??".";e=o=>o.join(s)}let n;t.message==="template"?n=s=>{if(typeof s.rawMessage=="string")return s.rawMessage;let o="";for(let a=0;a<s.rawMessage.length;a++)o+=a%2<1?s.rawMessage[a]:"{}";return o}:n=s=>{let o="";for(let a=0;a<s.message.length;a++)o+=a%2<1?s.message[a]:JSON.stringify(
|
|
27
27
|
s.message[a]);return o};const r=t.properties??"nest:properties";let i;if(r==="flatten")i=s=>s;else if(r.startsWith("prepend:")){const s=r.substring(8);if(s==="")throw new TypeError(`Invalid properties option: ${JSON.stringify(r)}. It must be of the form "prepend:<prefix>" where <prefix> is a non-empty string.`);i=o=>{const a={};for(const u in o)a[`${s}${u}`]=o[u];return a}}else if(r.startsWith("nest:")){const s=r.substring(5);i=o=>({[s]:o})}else throw new TypeError(`Invalid properties option: ${JSON.
|
|
28
28
|
stringify(r)}. It must be "flatten", "prepend:<prefix>", or "nest:<key>".`);return s=>JSON.stringify({"@timestamp":new Date(s.timestamp).toISOString(),level:s.level==="warning"?"WARN":s.level.toUpperCase(),message:n(s),logger:e(s.category),...i(s.properties)})+`
|
|
29
29
|
`}Gx();const Ux={trace:"background-color: gray; color: white;",debug:"background-color: gray; color: white;",info:"background-color: white; color: black;",warning:"background-color: orange; color: black;",error:"background-color: red; color: white;",fatal:"background-color: maroon; color: white;"};function Wx(t){let e="";const n=[];for(let s=0;s<t.message.length;s++)s%2===0?e+=t.message[s]:(e+="%o",n.push(t.message[s]));const r=new Date(t.timestamp);return[`%c${`${r.getUTCHours().toString().padStart(
|
|
30
|
-
2,"0")}:${r.getUTCMinutes().toString().padStart(2,"0")}:${r.getUTCSeconds().toString().padStart(2,"0")}.${r.getUTCMilliseconds().toString().padStart(3,"0")}`} %c${
|
|
31
|
-
const s=e(i),o=n[i.level];if(o===void 0)throw new TypeError(`Invalid log level: ${i.level}.`);if(typeof s=="string"){const a=s.replace(/\r?\n$/,"");r[o](a)}else r[o](...s)}}let
|
|
32
|
-
et flag.");if(zx.size>0)throw new Ki("Previously configured async disposables are still active. Use configure() instead or explicitly dispose them using dispose().");Eb();try{Vx(t,!1)}catch(e){throw e instanceof Ki&&Eb(),e}}function Vx(t,e){
|
|
30
|
+
2,"0")}:${r.getUTCMinutes().toString().padStart(2,"0")}:${r.getUTCSeconds().toString().padStart(2,"0")}.${r.getUTCMilliseconds().toString().padStart(3,"0")}`} %c${Em[t.level]}%c %c${t.category.join("\xB7")} %c${e}`,"color: gray;",Ux[t.level],"background-color: default;","color: gray;","color: default;",...n]}function wb(t={}){const e=t.formatter??Wx,n={trace:"debug",debug:"debug",info:"info",warning:"warn",error:"error",fatal:"error",...t.levelMap??{}},r=t.console??globalThis.console;return i=>{
|
|
31
|
+
const s=e(i),o=n[i.level];if(o===void 0)throw new TypeError(`Invalid log level: ${i.level}.`);if(typeof s=="string"){const a=s.replace(/\r?\n$/,"");r[o](a)}else r[o](...s)}}let km=null;const bb=new Set,Yd=new Set,zx=new Set;function Hx(t){return t.category.length===0||t.category.length===1&&t.category[0]==="logtape"||t.category.length===2&&t.category[0]==="logtape"&&t.category[1]==="meta"}function Kx(t){if(km!=null&&!t.reset)throw new Ki("Already configured; if you want to reset, turn on the res\
|
|
32
|
+
et flag.");if(zx.size>0)throw new Ki("Previously configured async disposables are still active. Use configure() instead or explicitly dispose them using dispose().");Eb();try{Vx(t,!1)}catch(e){throw e instanceof Ki&&Eb(),e}}function Vx(t,e){km=t;let n=!1,r=!1;const i=new Set;for(const o of t.loggers){Hx(o)&&(n=!0);const a=Array.isArray(o.category)?JSON.stringify(o.category):JSON.stringify([o.category]);if(i.has(a))throw new Ki(`Duplicate logger configuration for category: ${a}. Each category can\
|
|
33
33
|
only be configured once.`);i.add(a);const u=qo.getLogger(o.category);for(const c of o.sinks??[]){const l=t.sinks[c];if(!l)throw new Ki(`Sink not found: ${c}.`);u.sinks.push(l)}u.parentSinks=o.parentSinks??"inherit",o.lowestLevel!==void 0&&(u.lowestLevel=o.lowestLevel),o.level!==void 0&&(r=!0,u.filters.push(lb(o.level)));for(const c of o.filters??[]){const l=t.filters?.[c];if(l===void 0)throw new Ki(`Filter not found: ${c}.`);u.filters.push(lb(l))}bb.add(u)}qo.getLogger().contextLocalStorage=t.contextLocalStorage;
|
|
34
|
-
for(const o of Object.values(t.sinks)){if(Symbol.asyncDispose in o)throw new Ki("Async disposables cannot be used with configureSync().");Symbol.dispose in o&&Yd.add(o)}for(const o of Object.values(t.filters??{}))if(!(o==null||typeof o=="string")){if(Symbol.asyncDispose in o)throw new Ki("Async disposables cannot be used with configureSync().");Symbol.dispose in o&&Yd.add(o)}"process"in globalThis&&!("Deno"in globalThis)?process.on("exit",
|
|
34
|
+
for(const o of Object.values(t.sinks)){if(Symbol.asyncDispose in o)throw new Ki("Async disposables cannot be used with configureSync().");Symbol.dispose in o&&Yd.add(o)}for(const o of Object.values(t.filters??{}))if(!(o==null||typeof o=="string")){if(Symbol.asyncDispose in o)throw new Ki("Async disposables cannot be used with configureSync().");Symbol.dispose in o&&Yd.add(o)}"process"in globalThis&&!("Deno"in globalThis)?process.on("exit",Tm):addEventListener("unload",Tm);const s=qo.getLogger(["\
|
|
35
35
|
logtape","meta"]);n||s.sinks.push(wb()),s.info("LogTape loggers are configured. Note that LogTape itself uses the meta logger, which has category {metaLoggerCategory}. The meta logger purposes to log internal errors such as sink exceptions. If you are seeing this message, the meta logger is automatically configured. It's recommended to configure the meta logger with a separate sink so that you can easily notice if logging itself fails or is misconfigured. To turn off this message, configure\
|
|
36
|
-
the meta logger with higher log levels than {dismissLevel}. See also <https://logtape.org/manual/categories#meta-logger>.",{metaLoggerCategory:["logtape","meta"],dismissLevel:"info"}),r&&s.warn("The level option is deprecated in favor of lowestLevel option. Please update your configuration. See also <https://logtape.org/manual/levels#configuring-severity-levels>.")}function Eb(){
|
|
37
|
-
function
|
|
36
|
+
the meta logger with higher log levels than {dismissLevel}. See also <https://logtape.org/manual/categories#meta-logger>.",{metaLoggerCategory:["logtape","meta"],dismissLevel:"info"}),r&&s.warn("The level option is deprecated in favor of lowestLevel option. Please update your configuration. See also <https://logtape.org/manual/levels#configuring-severity-levels>.")}function Eb(){Tm(),Xx()}function Xx(){const t=qo.getLogger([]);t.resetDescendants(),delete t.contextLocalStorage,bb.clear(),km=null}
|
|
37
|
+
function Tm(){for(const t of Yd)t[Symbol.dispose]();Yd.clear()}var Ki=class extends Error{constructor(t){super(t),this.name="ConfigureError"}};const Yx=t=>{Cm.forEach(e=>{Jx(t,e)})},Cm=["name","message","stack","cause","errors"],Jx=(t,e)=>{const n=Am(t,e);if(n!==void 0){if(Qx(n)){si(t,e,t[e]);return}Zx(n)&&$b(t,e,n)}},Am=(t,e)=>{const n=Object.getOwnPropertyDescriptor(t,e);if(n!==void 0)return n;const r=Object.getPrototypeOf(t);return r===null?void 0:Am(r,e)},Qx=({get:t,set:e})=>t!==void 0&&e===
|
|
38
38
|
void 0,Zx=({enumerable:t,writable:e})=>t||!e,si=(t,e,n)=>{$b(t,e,{value:n})},$b=(t,e,n)=>{Object.defineProperty(t,e,{...n,..."get"in n||"set"in n?{}:{writable:!0},enumerable:!1,configurable:!0})},eP=(t,e)=>{if(Array.isArray(t.errors)){const n=t.errors.filter(tP).map(e).filter(Boolean);si(t,"errors",n)}else nP(t)?si(t,"errors",[]):t.errors!==void 0&&rP(t)},tP=t=>t!==void 0,nP=t=>"AggregateError"in globalThis&&(t.name==="AggregateError"||t instanceof AggregateError),rP=t=>{delete t.errors,t.errors!==
|
|
39
39
|
void 0&&si(t,"errors",[])},iP=(t,e)=>{if(!("cause"in t))return;const n=t.cause===void 0?t.cause:e(t.cause);n===void 0?delete t.cause:si(t,"cause",n)},Rb=t=>sP(t)||oP(t),sP=t=>{try{return t instanceof Error}catch{return!1}},oP=t=>{try{return aP.has(Object.prototype.toString.call(t))}catch{return!1}},aP=new Set(["[object Error]","[object DOMException]","[object DOMError]","[object Exception]"]);function Jd(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||
|
|
40
|
-
e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}const uP=t=>!Object.isExtensible(t)||
|
|
41
|
-
writable:!0,configurable:!0},n=Object.defineProperty(class extends Error{},"name",e);return Object.defineProperty(n.prototype,"name",e),n},pP=t=>{const e={};for(const n of hP(t))try{const r=t[n],{enumerable:i,configurable:s,writable:o=!0}=
|
|
42
|
-
hasOwn(t,e)}catch{return!1}},Db=t=>{const{name:e,message:n,stack:r,cause:i,errors:s,...o}=pP(t),a=yP(n,o),u=EP(e,a);return n===a&&$P(u,o),Object.entries({name:e,stack:r,cause:i,errors:s}).forEach(([c,l])=>{RP(u,c,l)}),r===void 0&&
|
|
43
|
-
globalThis?new AggregateError([],e):t in Tb?new Tb[t](e):new Error(e),Tb={Error,ReferenceError,TypeError,SyntaxError,RangeError,URIError,EvalError},$P=(t,e)=>{for(const n in e)n in t||(t[n]=e[n])},RP=(t,e,n)=>{n!==void 0&&si(t,e,n)},DP=t=>{try{const e=new Error(String(t));return
|
|
40
|
+
e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}const uP=t=>!Object.isExtensible(t)||Cm.some(e=>cP(t,e)||lP(t,e)),cP=(t,e)=>{const n=Object.getOwnPropertyDescriptor(t,e);return n!==void 0&&!n.configurable},lP=(t,e)=>{try{return t[e],!1}catch{return!0}},Sm=t=>{const e=dP(t.message,t.name);si(t,"stack",e)},dP=(t="",e="Error")=>{const n=fP(e),{stack:r}=new n(t);return typeof r=="string"&&r!==""?r:`${e}: ${t}`},fP=t=>{const e={value:t,enumerable:!1,
|
|
41
|
+
writable:!0,configurable:!0},n=Object.defineProperty(class extends Error{},"name",e);return Object.defineProperty(n.prototype,"name",e),n},pP=t=>{const e={};for(const n of hP(t))try{const r=t[n],{enumerable:i,configurable:s,writable:o=!0}=Am(t,n);Object.defineProperty(e,n,{value:r,enumerable:i,configurable:s,writable:o})}catch{}return e},hP=t=>{const e=mP(t);for(const n of Cm)gP(t,n)&&e.push(n);return e},mP=t=>{try{return Reflect.ownKeys(t)}catch{return[]}},gP=(t,e)=>{try{return e in t&&!Object.
|
|
42
|
+
hasOwn(t,e)}catch{return!1}},Db=t=>{const{name:e,message:n,stack:r,cause:i,errors:s,...o}=pP(t),a=yP(n,o),u=EP(e,a);return n===a&&$P(u,o),Object.entries({name:e,stack:r,cause:i,errors:s}).forEach(([c,l])=>{RP(u,c,l)}),r===void 0&&Sm(u),u},yP=(t,e)=>typeof t=="string"&&t!==""?t:bP(vP(e)),vP=t=>{try{return JSON.stringify(t)}catch{return wP(t)}},wP=t=>{try{return String(t)}catch{return"Invalid error"}},bP=t=>t.length<kb?t:`${t.slice(0,kb)}...`,kb=1e3,EP=(t,e)=>t==="AggregateError"&&"AggregateError"in
|
|
43
|
+
globalThis?new AggregateError([],e):t in Tb?new Tb[t](e):new Error(e),Tb={Error,ReferenceError,TypeError,SyntaxError,RangeError,URIError,EvalError},$P=(t,e)=>{for(const n in e)n in t||(t[n]=e[n])},RP=(t,e,n)=>{n!==void 0&&si(t,e,n)},DP=t=>{try{const e=new Error(String(t));return Sm(e),e}catch(e){return e}},{toString:kP}=Object.prototype,TP=t=>CP(t)?Db(t):Rb(t)?AP(t)?Db(t):t:DP(t),CP=t=>{try{return Jd(t)}catch{return!1}},AP=t=>SP(t)||uP(t)||_P(t),SP=t=>{try{return kP.call(t)==="[object Object]"}catch{
|
|
44
44
|
return!0}},_P=t=>typeof t.constructor!="function"||typeof t.constructor.name!="string"||t.constructor.name===""||t.constructor.prototype!==Object.getPrototypeOf(t),Qd=(t,{shallow:e=!1}={})=>Cb(t,[],e),Cb=(t,e,n)=>{if(e.includes(t))return;const r=n?xP:s=>Cb(s,[...e,t],n),i=TP(t);return PP(i,r),i},xP=t=>t,PP=(t,e)=>{NP(t),IP(t),OP(t),iP(t,e),eP(t,e),Yx(t)},NP=t=>{if(Zd(t.name))return;const e=Object.getPrototypeOf(t).name,n=Zd(e)?e:t.constructor.name;si(t,"name",n)},IP=t=>{Zd(t.message)||si(t,"mess\
|
|
45
|
-
age","")},OP=t=>{Zd(t.stack)||
|
|
45
|
+
age","")},OP=t=>{Zd(t.stack)||Sm(t)},Zd=t=>typeof t=="string"&&t!=="",LP=(t,e,n=t.name)=>{if(FP(e),typeof n!="string")throw new TypeError(`currentName must be a string: ${n}`);return n},FP=t=>{if(!MP(t))throw new TypeError(`ErrorClass must be a class: ${t}`);if(!Ab(t.prototype))throw new TypeError(`ErrorClass must inherit from Error: ${t}`);if(!BP(t))throw new TypeError(`ErrorClass must be have a valid constructor: ${t}`)},MP=t=>typeof t=="function"&&typeof t.prototype=="object"&&t.prototype!==null,
|
|
46
46
|
Ab=t=>t!==null&&(t.name==="Error"||Ab(Object.getPrototypeOf(t))),BP=t=>typeof t.prototype.constructor=="function",Sb=(t,e,n)=>{Object.defineProperty(t,e,{value:n,enumerable:!1,writable:!0,configurable:!0})},qP=(t,e)=>{Object.getPrototypeOf(t)!==e.prototype&&(jP(t,e),Pb(t,"constructor"),GP(t,e))},jP=(t,e)=>{Object.setPrototypeOf(t,e.prototype)},GP=(t,e)=>{Pb(t,"name");const n=_b(e.prototype);t.name!==n&&Sb(t,"name",n)},_b=t=>UP(t)??WP(t)??_b(Object.getPrototypeOf(t)),UP=t=>Object.hasOwn(t,"name")&&
|
|
47
47
|
xb(t.name)?t.name:void 0,WP=t=>typeof t.constructor=="function"&&xb(t.constructor.name)?t.constructor.name:void 0,xb=t=>typeof t=="string"&&t!=="",Pb=(t,e)=>{Object.hasOwn(t,e)&&delete t[e]},zP=(t,e)=>{if(!HP(t,e))return;const n=VP(t,e);Sb(t,"stack",n)},HP=(t,e)=>e!==t.name&&e!==""&&t.stack.includes(e)&&KP(),KP=()=>{class t extends Error{}const e={value:Nb,enumerable:!1,writable:!0,configurable:!0};Object.defineProperty(t,"name",e),Object.defineProperty(t.prototype,"name",e);const{stack:n}=new t(
|
|
48
48
|
"");return typeof n=="string"&&n.includes(Nb)},Nb="SetErrorClassError",VP=({name:t,stack:e},n)=>{if(e.startsWith(`${n}: `))return e.replace(n,t);const r=XP(n,t),[i,s]=r.find(([o])=>e.includes(o));return e.replace(i,s)},XP=(t,e)=>[[`
|
|
49
49
|
${t}: `,`
|
|
50
50
|
${e}: `],[`${t}: `,`${e}: `],[`${t} `,`${e} `],[t,e]],YP=(t,e,n)=>{const r=Qd(t),i=LP(r,e,n);return qP(r,e),zP(r,i),r},JP=(t,e)=>e.configurable===!1?QP(t,e):t1(t,e),QP=(t,e)=>({...e,...ZP(t,e),...e1(t,e)}),ZP=(t,e)=>e.writable===!0&&t.writable===!1?{writable:!1}:{},e1=(t,e)=>t.hasValue&&"value"in e&&e.writable===!0?{value:t.value}:{},t1=(t,e)=>{const n=Ya(t.enumerable,e.enumerable,!0),r=Ya(t.writable,e.writable,!0),i=Ya(t.configurable,e.configurable,!0);return{...n1(t,e,r),enumerable:n,configurable:i}},
|
|
51
51
|
n1=(t,e,n)=>t.hasValue?{value:t.value,writable:n}:!Ib(t)&&!Ib(e)?{value:e.value,writable:n}:{get:Ya(t.get,e.get),set:Ya(t.set,e.set)},Ib=({get:t,set:e})=>t!==void 0||e!==void 0,Ya=(t,e,n)=>t??e??n,r1=(t,e,n)=>{if(!i1(t))throw new TypeError(`Argument must be an object: ${t}`);if(!s1(e))throw new TypeError(`Property key must be a string, a symbol or an integer: ${e}`);return o1(n)},i1=t=>typeof t=="object"&&t!==null,s1=t=>{const e=typeof t;return e==="string"||e==="symbol"||e==="number"},o1=t=>{if(!Jd(
|
|
52
|
-
t))throw new TypeError(`Descriptor must be a plain object: ${t}`);const{enumerable:e,writable:n,configurable:r,value:i,get:s,set:o,...a}=t,u="value"in t;return a1({enumerable:e,writable:n,configurable:r,get:s,set:o,unknownProps:a,hasValue:u}),{enumerable:e,writable:n,configurable:r,value:i,get:s,set:o,hasValue:u}},a1=({enumerable:t,writable:e,configurable:n,get:r,set:i,unknownProps:s,hasValue:o})=>{Ob(o,r,"get"),Ob(o,i,"set"),
|
|
53
|
-
if(u1(e,n),t&&e!==void 0)throw new TypeError(`Descriptor property "value" and "${n}" must not both be defined: ${e}`)},u1=(t,e)=>{if(t!==void 0&&typeof t!="function")throw new TypeError(`Descriptor property "${e}" must be a function: ${t}`)},
|
|
52
|
+
t))throw new TypeError(`Descriptor must be a plain object: ${t}`);const{enumerable:e,writable:n,configurable:r,value:i,get:s,set:o,...a}=t,u="value"in t;return a1({enumerable:e,writable:n,configurable:r,get:s,set:o,unknownProps:a,hasValue:u}),{enumerable:e,writable:n,configurable:r,value:i,get:s,set:o,hasValue:u}},a1=({enumerable:t,writable:e,configurable:n,get:r,set:i,unknownProps:s,hasValue:o})=>{Ob(o,r,"get"),Ob(o,i,"set"),_m(t,"enumerable"),_m(e,"writable"),_m(n,"configurable"),c1(s)},Ob=(t,e,n)=>{
|
|
53
|
+
if(u1(e,n),t&&e!==void 0)throw new TypeError(`Descriptor property "value" and "${n}" must not both be defined: ${e}`)},u1=(t,e)=>{if(t!==void 0&&typeof t!="function")throw new TypeError(`Descriptor property "${e}" must be a function: ${t}`)},_m=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`Descriptor property "${e}" must be a boolean: ${t}`)},c1=t=>{const[e]=Object.keys(t);if(e!==void 0)throw new TypeError(`Unknown descriptor property "${e}": ${t[e]}`)},l1=(t,e,n)=>{const r=r1(
|
|
54
54
|
t,e,n),i=Lb(t,e),s=JP(r,i);return d1(t,e,s),t},Lb=(t,e)=>{const n=Object.getOwnPropertyDescriptor(t,e);if(n!==void 0)return n;const r=Object.getPrototypeOf(t);return r===null?{}:Lb(r,e)},d1=(t,e,n)=>{try{Object.defineProperty(t,e,n)}catch{}},f1=(t,e,n)=>{if(n!==void 0)return Fb(t,e,n);try{delete t[e]}catch{}if(t[e]!==void 0)return Fb(t,e)},Fb=(t,e,n)=>{const r=p1(e);l1(t,e,{value:n,...r})},p1=t=>typeof t=="string"&&t.startsWith("_")?{enumerable:!1}:{},h1=(t,e,n={})=>{if(Mb(t,"First argument"),Mb(
|
|
55
55
|
e,"Second argument"),!Jd(n))throw new TypeError(`Options must be a plain object: ${n}`);const{soft:r=!1}=n;if(typeof r!="boolean")throw new TypeError(`Option "soft" must be a boolean: ${r}`);return{soft:r}},Mb=(t,e)=>{if(t===void 0)throw new TypeError(`${e} is required.`);if(!m1(t))throw new TypeError(`${e} must be a plain object or an error: ${t}`)},m1=t=>Jd(t)||Rb(t),g1=({error:t,props:e,propName:n,soft:r})=>y1(n)||!b1.call(e,n)||r&&t[n]!==void 0,y1=t=>t in v1||w1.has(t),v1=new Error("check"),
|
|
56
56
|
w1=new Set(["prototype","errors","cause"]),{propertyIsEnumerable:b1}=Object.prototype,E1=(t,e,n)=>{const{soft:r}=h1(t,e,n);for(const i of Reflect.ownKeys(e))$1({error:t,props:e,propName:i,soft:r});return t},$1=({error:t,props:e,propName:n,soft:r})=>{g1({error:t,props:e,propName:n,soft:r})||f1(t,n,e[n])},ef=(t,e,n)=>{Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!1,configurable:!0})},R1=(t,e)=>{if(t.errors===void 0)return;const n=t.errors.map(r=>e(r).error).filter(Boolean);ef(t,"error\
|
|
@@ -67,56 +67,56 @@ ${t}`,F1=":",M1=`
|
|
|
67
67
|
`,B1=({parent:t,child:e,target:n,stackError:r})=>{const i=t.message,s=r.message;return n.message=e.message,I1(n,i,s)},q1=(t,e)=>Gb(t)===e,Gb=t=>typeof t=="object"&&t!==null?t.stack:void 0,j1=({wrap:t,target:e,source:n,childHasStack:r})=>t===r?e:(ef(e,"stack",n.stack),n),G1=t=>{const{wrap:e,name:n}=t;return typeof e!="boolean"?n==="Error":(Object.hasOwn(t,"wrap")&&delete t.wrap,e)},Ub=t=>Wb(t,[]).error,Wb=(t,e)=>{if(e.includes(t))return{};const n=c=>Wb(c,[...e,t]),r=Gb(t),i=Qd(t,{shallow:!0}),s=q1(
|
|
68
68
|
i,r);R1(i,n);const{parent:o,childHasStack:a}=U1(i,n);return{error:o,errorHasStack:s||a}},U1=(t,e)=>{const n=G1(t);if(t.cause===void 0)return{parent:t,childHasStack:!1};const{error:r,errorHasStack:i}=e(t.cause);return delete t.cause,{parent:W1({parent:t,child:r,childHasStack:i,wrap:n}),childHasStack:i}},W1=({parent:t,child:e,childHasStack:n,wrap:r})=>{if(e===void 0)return t;const[i,s]=r?[e,t]:[t,e],o=j1({wrap:r,target:i,source:s,childHasStack:n}),a=YP(i,i.constructor,o.name),u=B1({parent:t,child:e,
|
|
69
69
|
target:a,stackError:o});return D1({target:u,source:s,parent:t,child:e}),E1(u,s,{soft:!r})};function z1(t){const e=function(n,r){if(typeof r?.toJSON=="function"&&(r=r.toJSON()),!(r!==null&&typeof r=="object"))return r;if(t.has(r))return"[Circular]";t.add(r);const i=Array.isArray(r)?[]:{};for(const[s,o]of Object.entries(r))i[s]=e(s,o);return t.delete(r),i};return e}function H1(t,{indentation:e}={}){return JSON.stringify(t,z1(new WeakSet),e)}const zb=t=>t.split(`
|
|
70
|
-
`).map(e=>e.trim().replace("file://",""));function
|
|
70
|
+
`).map(e=>e.trim().replace("file://",""));function xm(t,e=2){return t=Array.isArray(t)?t:t.split(`
|
|
71
71
|
`),t.map(n=>`${" ".repeat(e)}${n}`).join(`
|
|
72
72
|
`)}function Un(t){if(typeof t=="string")return t;if(t instanceof Error){const e=Ub(t);if(e.stack){const n=zb(e.stack);return e.message+`
|
|
73
|
-
`+
|
|
73
|
+
`+xm(n.slice(1))}return e.message}return H1(t)}function K1(t){const e=Object.values(t.properties).filter(n=>n instanceof Error).map(n=>{const r=Ub(n);return r.stack&&(r.stack=zb(r.stack).join(`
|
|
74
74
|
`)),r});return e.length===0?null:e.length===1?e[0]:new AggregateError(e)}function V1(t,e){const n=K1(t.record);if(n){let r=n.message;return n.stack&&(r=r+`
|
|
75
|
-
`+
|
|
75
|
+
`+xm(n.stack.split(`
|
|
76
76
|
`).slice(1))),r=`${Q1.red}${r}${J1}`,{...t,message:t.message+`
|
|
77
|
-
`+
|
|
78
|
-
try{tN=!0;const e=t?.sinks??{};Kx({...t,sinks:{...e,console:e.console??Hb()},loggers:[{category:["logtape","meta"],sinks:["console"],lowestLevel:"warning"},...t?.loggers??[{category:"likec4",sinks:["console"],lowestLevel:"debug"}]]})}catch(e){console.error(e)}}function
|
|
79
|
-
t)==="[object Module]":!0}function
|
|
77
|
+
`+xm(r)}}return t}const X1={trace:"TRACE",debug:"DEBUG",info:"INFO ",warning:"WARN ",error:"ERROR",fatal:"FATAL"},Y1=t=>X1[t],J1="\x1B[0m",Q1={red:"\x1B[31m"};function Z1(t){const e=({timestamp:n,level:r,category:i,message:s})=>`${n} ${r} ${i} ${s}`;return vb({timestamp:"time",level:Y1,categoryStyle:"bold",categoryColor:"cyan",category:".",...t,format:n=>e(V1(n))})}function Hb(t){return wb({formatter:Z1(),...t})}const Wn=Mx("likec4");function eN(t){return Wn.getChild(t)}let tN=!1;function nN(t){
|
|
78
|
+
try{tN=!0;const e=t?.sinks??{};Kx({...t,sinks:{...e,console:e.console??Hb()},loggers:[{category:["logtape","meta"],sinks:["console"],lowestLevel:"warning"},...t?.loggers??[{category:"likec4",sinks:["console"],lowestLevel:"debug"}]]})}catch(e){console.error(e)}}function Pm(t){if(t===null||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);return e!==null&&e!==Object.prototype&&Object.getPrototypeOf(e)!==null||Symbol.iterator in t?!1:Symbol.toStringTag in t?Object.prototype.toString.call(
|
|
79
|
+
t)==="[object Module]":!0}function Nm(t,e,n=".",r){if(!Pm(e))return Nm(t,{},n,r);const i=Object.assign({},e);for(const s in t){if(s==="__proto__"||s==="constructor")continue;const o=t[s];o!=null&&(r&&r(i,s,o,n)||(Array.isArray(o)&&Array.isArray(i[s])?i[s]=[...o,...i[s]]:Pm(o)&&Pm(i[s])?i[s]=Nm(o,i[s],(n?`${n}.`:"")+s.toString(),r):i[s]=o))}return i}function rN(t){return(...e)=>e.reduce((n,r)=>Nm(n,r,"",t),{})}const Im=rN();function kt(t){return typeof t=="object"&&t!==null&&typeof t.$type=="stri\
|
|
80
80
|
ng"}function or(t){return typeof t=="object"&&t!==null&&typeof t.$refText=="string"}function iN(t){return typeof t=="object"&&t!==null&&typeof t.name=="string"&&typeof t.type=="string"&&typeof t.path=="string"}function tf(t){return typeof t=="object"&&t!==null&&kt(t.container)&&or(t.reference)&&typeof t.message=="string"}class Kb{constructor(){this.subtypes={},this.allSubtypes={}}isInstance(e,n){return kt(e)&&this.isSubtype(e.$type,n)}isSubtype(e,n){if(e===n)return!0;let r=this.subtypes[e];r||(r=
|
|
81
81
|
this.subtypes[e]={});const i=r[n];if(i!==void 0)return i;{const s=this.computeIsSubtype(e,n);return r[n]=s,s}}getAllSubTypes(e){const n=this.allSubtypes[e];if(n)return n;{const r=this.getAllTypes(),i=[];for(const s of r)this.isSubtype(s,e)&&i.push(s);return this.allSubtypes[e]=i,i}}}function Vi(t){return typeof t=="object"&&t!==null&&Array.isArray(t.content)}function Ps(t){return typeof t=="object"&&t!==null&&typeof t.tokenType=="object"}function Vb(t){return Vi(t)&&typeof t.fullText=="string"}class Jt{constructor(e,n){
|
|
82
82
|
this.startFn=e,this.nextFn=n}iterator(){const e={state:this.startFn(),next:()=>this.nextFn(e.state),[Symbol.iterator]:()=>e};return e}[Symbol.iterator](){return this.iterator()}isEmpty(){return!!this.iterator().next().done}count(){const e=this.iterator();let n=0,r=e.next();for(;!r.done;)n++,r=e.next();return n}toArray(){const e=[],n=this.iterator();let r;do r=n.next(),r.value!==void 0&&e.push(r.value);while(!r.done);return e}toSet(){return new Set(this)}toMap(e,n){const r=this.map(i=>[e?e(i):i,n?
|
|
83
|
-
n(i):i]);return new Map(r)}toString(){return this.join()}concat(e){return new Jt(()=>({first:this.startFn(),firstDone:!1,iterator:e[Symbol.iterator]()}),n=>{let r;if(!n.firstDone){do if(r=this.nextFn(n.first),!r.done)return r;while(!r.done);n.firstDone=!0}do if(r=n.iterator.next(),!r.done)return r;while(!r.done);return
|
|
84
|
-
s=r.next();for(;!s.done;){if(i>=n&&s.value===e)return i;s=r.next(),i++}return-1}every(e){const n=this.iterator();let r=n.next();for(;!r.done;){if(!e(r.value))return!1;r=n.next()}return!0}some(e){const n=this.iterator();let r=n.next();for(;!r.done;){if(e(r.value))return!0;r=n.next()}return!1}forEach(e){const n=this.iterator();let r=0,i=n.next();for(;!i.done;)e(i.value,r),i=n.next(),r++}map(e){return new Jt(this.startFn,n=>{const{done:r,value:i}=this.nextFn(n);return r?
|
|
85
|
-
return new Jt(this.startFn,n=>{let r;do if(r=this.nextFn(n),!r.done&&e(r.value))return r;while(!r.done);return
|
|
83
|
+
n(i):i]);return new Map(r)}toString(){return this.join()}concat(e){return new Jt(()=>({first:this.startFn(),firstDone:!1,iterator:e[Symbol.iterator]()}),n=>{let r;if(!n.firstDone){do if(r=this.nextFn(n.first),!r.done)return r;while(!r.done);n.firstDone=!0}do if(r=n.iterator.next(),!r.done)return r;while(!r.done);return Pn})}join(e=","){const n=this.iterator();let r="",i,s=!1;do i=n.next(),i.done||(s&&(r+=e),r+=sN(i.value)),s=!0;while(!i.done);return r}indexOf(e,n=0){const r=this.iterator();let i=0,
|
|
84
|
+
s=r.next();for(;!s.done;){if(i>=n&&s.value===e)return i;s=r.next(),i++}return-1}every(e){const n=this.iterator();let r=n.next();for(;!r.done;){if(!e(r.value))return!1;r=n.next()}return!0}some(e){const n=this.iterator();let r=n.next();for(;!r.done;){if(e(r.value))return!0;r=n.next()}return!1}forEach(e){const n=this.iterator();let r=0,i=n.next();for(;!i.done;)e(i.value,r),i=n.next(),r++}map(e){return new Jt(this.startFn,n=>{const{done:r,value:i}=this.nextFn(n);return r?Pn:{done:!1,value:e(i)}})}filter(e){
|
|
85
|
+
return new Jt(this.startFn,n=>{let r;do if(r=this.nextFn(n),!r.done&&e(r.value))return r;while(!r.done);return Pn})}nonNullable(){return this.filter(e=>e!=null)}reduce(e,n){const r=this.iterator();let i=n,s=r.next();for(;!s.done;)i===void 0?i=s.value:i=e(i,s.value),s=r.next();return i}reduceRight(e,n){return this.recursiveReduce(this.iterator(),e,n)}recursiveReduce(e,n,r){const i=e.next();if(i.done)return r;const s=this.recursiveReduce(e,n,r);return s===void 0?i.value:n(s,i.value)}find(e){const n=this.
|
|
86
86
|
iterator();let r=n.next();for(;!r.done;){if(e(r.value))return r.value;r=n.next()}}findIndex(e){const n=this.iterator();let r=0,i=n.next();for(;!i.done;){if(e(i.value))return r;i=n.next(),r++}return-1}includes(e){const n=this.iterator();let r=n.next();for(;!r.done;){if(r.value===e)return!0;r=n.next()}return!1}flatMap(e){return new Jt(()=>({this:this.startFn()}),n=>{do{if(n.iterator){const s=n.iterator.next();if(s.done)n.iterator=void 0;else return s}const{done:r,value:i}=this.nextFn(n.this);if(!r){
|
|
87
|
-
const s=e(i);if(nf(s))n.iterator=s[Symbol.iterator]();else return{done:!1,value:s}}}while(n.iterator);return
|
|
88
|
-
if(!n.done)return n.value}tail(e=1){return new Jt(()=>{const n=this.startFn();for(let r=0;r<e;r++)if(this.nextFn(n).done)return n;return n},this.nextFn)}limit(e){return new Jt(()=>({size:0,state:this.startFn()}),n=>(n.size++,n.size>e?
|
|
89
|
-
for(const i of e){const s=n?n(i):i;r.add(s)}return this.filter(i=>{const s=n?n(i):i;return!r.has(s)})}}function sN(t){return typeof t=="string"?t:typeof t>"u"?"undefined":typeof t.toString=="function"?t.toString():Object.prototype.toString.call(t)}function nf(t){return!!t&&typeof t[Symbol.iterator]=="function"}const Ja=new Jt(()=>{},()=>
|
|
90
|
-
n=>n.next());if(typeof e.length=="number")return new Jt(()=>({index:0}),n=>n.index<e.length?{done:!1,value:e[n.index++]}:
|
|
91
|
-
array=n)}}while(e.iterator||e.array||e.collIndex<t.length);return
|
|
92
|
-
state),prune:()=>{e.state.pruned=!0},[Symbol.iterator]:()=>e};return e}}var
|
|
93
|
-
e)return!0;return!1}function
|
|
87
|
+
const s=e(i);if(nf(s))n.iterator=s[Symbol.iterator]();else return{done:!1,value:s}}}while(n.iterator);return Pn})}flat(e){if(e===void 0&&(e=1),e<=0)return this;const n=e>1?this.flat(e-1):this;return new Jt(()=>({this:n.startFn()}),r=>{do{if(r.iterator){const o=r.iterator.next();if(o.done)r.iterator=void 0;else return o}const{done:i,value:s}=n.nextFn(r.this);if(!i)if(nf(s))r.iterator=s[Symbol.iterator]();else return{done:!1,value:s}}while(r.iterator);return Pn})}head(){const n=this.iterator().next();
|
|
88
|
+
if(!n.done)return n.value}tail(e=1){return new Jt(()=>{const n=this.startFn();for(let r=0;r<e;r++)if(this.nextFn(n).done)return n;return n},this.nextFn)}limit(e){return new Jt(()=>({size:0,state:this.startFn()}),n=>(n.size++,n.size>e?Pn:this.nextFn(n.state)))}distinct(e){return new Jt(()=>({set:new Set,internalState:this.startFn()}),n=>{let r;do if(r=this.nextFn(n.internalState),!r.done){const i=e?e(r.value):r.value;if(!n.set.has(i))return n.set.add(i),r}while(!r.done);return Pn})}exclude(e,n){const r=new Set;
|
|
89
|
+
for(const i of e){const s=n?n(i):i;r.add(s)}return this.filter(i=>{const s=n?n(i):i;return!r.has(s)})}}function sN(t){return typeof t=="string"?t:typeof t>"u"?"undefined":typeof t.toString=="function"?t.toString():Object.prototype.toString.call(t)}function nf(t){return!!t&&typeof t[Symbol.iterator]=="function"}const Ja=new Jt(()=>{},()=>Pn),Pn=Object.freeze({done:!0,value:void 0});function Ve(...t){if(t.length===1){const e=t[0];if(e instanceof Jt)return e;if(nf(e))return new Jt(()=>e[Symbol.iterator](),
|
|
90
|
+
n=>n.next());if(typeof e.length=="number")return new Jt(()=>({index:0}),n=>n.index<e.length?{done:!1,value:e[n.index++]}:Pn)}return t.length>1?new Jt(()=>({collIndex:0,arrIndex:0}),e=>{do{if(e.iterator){const n=e.iterator.next();if(!n.done)return n;e.iterator=void 0}if(e.array){if(e.arrIndex<e.array.length)return{done:!1,value:e.array[e.arrIndex++]};e.array=void 0,e.arrIndex=0}if(e.collIndex<t.length){const n=t[e.collIndex++];nf(n)?e.iterator=n[Symbol.iterator]():n&&typeof n.length=="number"&&(e.
|
|
91
|
+
array=n)}}while(e.iterator||e.array||e.collIndex<t.length);return Pn}):Ja}class jo extends Jt{constructor(e,n,r){super(()=>({iterators:r?.includeRoot?[[e][Symbol.iterator]()]:[n(e)[Symbol.iterator]()],pruned:!1}),i=>{for(i.pruned&&(i.iterators.pop(),i.pruned=!1);i.iterators.length>0;){const o=i.iterators[i.iterators.length-1].next();if(o.done)i.iterators.pop();else return i.iterators.push(n(o.value)[Symbol.iterator]()),o}return Pn})}iterator(){const e={state:this.startFn(),next:()=>this.nextFn(e.
|
|
92
|
+
state),prune:()=>{e.state.pruned=!0},[Symbol.iterator]:()=>e};return e}}var Om;(function(t){function e(s){return s.reduce((o,a)=>o+a,0)}t.sum=e;function n(s){return s.reduce((o,a)=>o*a,0)}t.product=n;function r(s){return s.reduce((o,a)=>Math.min(o,a))}t.min=r;function i(s){return s.reduce((o,a)=>Math.max(o,a))}t.max=i})(Om||(Om={}));function rf(t){return new jo(t,e=>Vi(e)?e.content:[],{includeRoot:!0})}function oN(t){return rf(t).filter(Ps)}function aN(t,e){for(;t.container;)if(t=t.container,t===
|
|
93
|
+
e)return!0;return!1}function Lm(t){return{start:{character:t.startColumn-1,line:t.startLine-1},end:{character:t.endColumn,line:t.endLine-1}}}function sf(t){if(!t)return;const{offset:e,end:n,range:r}=t;return{range:r,offset:e,end:n,length:n-e}}var oi;(function(t){t[t.Before=0]="Before",t[t.After=1]="After",t[t.OverlapFront=2]="OverlapFront",t[t.OverlapBack=3]="OverlapBack",t[t.Inside=4]="Inside",t[t.Outside=5]="Outside"})(oi||(oi={}));function uN(t,e){if(t.end.line<e.start.line||t.end.line===e.start.
|
|
94
94
|
line&&t.end.character<=e.start.character)return oi.Before;if(t.start.line>e.end.line||t.start.line===e.end.line&&t.start.character>=e.end.character)return oi.After;const n=t.start.line>e.start.line||t.start.line===e.start.line&&t.start.character>=e.start.character,r=t.end.line<e.end.line||t.end.line===e.end.line&&t.end.character<=e.end.character;return n&&r?oi.Inside:n?oi.OverlapBack:r?oi.OverlapFront:oi.Outside}function Xb(t,e){return uN(t,e)>oi.After}const Yb=/^[\w\p{L}]$/u;function Ns(t,e,n=Yb){
|
|
95
|
-
if(t){if(e>0){const r=e-t.offset,i=t.text.charAt(r);n.test(i)||e--}return Qb(t,e)}}function of(t,e){if(t){const n=cN(t,!0);if(n&&Jb(n,e))return n;if(Vb(t)){const r=t.content.findIndex(i=>!i.hidden);for(let i=r-1;i>=0;i--){const s=t.content[i];if(Jb(s,e))return s}}}}function Jb(t,e){return Ps(t)&&e.includes(t.tokenType.name)}function Qb(t,e){if(Ps(t))return t;if(Vi(t)){const n=Zb(t,e,!1);if(n)return Qb(n,e)}}function
|
|
95
|
+
if(t){if(e>0){const r=e-t.offset,i=t.text.charAt(r);n.test(i)||e--}return Qb(t,e)}}function of(t,e){if(t){const n=cN(t,!0);if(n&&Jb(n,e))return n;if(Vb(t)){const r=t.content.findIndex(i=>!i.hidden);for(let i=r-1;i>=0;i--){const s=t.content[i];if(Jb(s,e))return s}}}}function Jb(t,e){return Ps(t)&&e.includes(t.tokenType.name)}function Qb(t,e){if(Ps(t))return t;if(Vi(t)){const n=Zb(t,e,!1);if(n)return Qb(n,e)}}function Fm(t,e){if(Ps(t))return t;if(Vi(t)){const n=Zb(t,e,!0);if(n)return Fm(n,e)}}function Zb(t,e,n){
|
|
96
96
|
let r=0,i=t.content.length-1,s;for(;r<=i;){const o=Math.floor((r+i)/2),a=t.content[o];if(a.offset<=e&&a.end>e)return a;a.end<=e?(s=n?a:void 0,r=o+1):i=o-1}return s}function cN(t,e=!0){for(;t.container;){const n=t.container;let r=n.content.indexOf(t);for(;r>0;){r--;const i=n.content[r];if(e||!i.hidden)return i}t=n}}function lN(t,e=!0){for(;t.container;){const n=t.container;let r=n.content.indexOf(t);const i=n.content.length-1;for(;r<i;){r++;const s=n.content[r];if(e||!s.hidden)return s}t=n}}function dN(t,e){
|
|
97
97
|
const n=fN(t,e);return n?n.parent.content.slice(n.a+1,n.b):[]}function fN(t,e){const n=e0(t),r=e0(e);let i;for(let s=0;s<n.length&&s<r.length;s++){const o=n[s],a=r[s];if(o.parent===a.parent)i={parent:o.parent,a:o.index,b:a.index};else break}return i}function e0(t){const e=[];for(;t.container;){const n=t.container,r=n.content.indexOf(t);e.push({parent:n,index:r}),t=n}return e.reverse()}class t0 extends Error{constructor(e,n){super(e?`${n} at ${e.range.start.line}:${e.range.start.character}`:n)}}function Qa(t){
|
|
98
|
-
throw new Error("Error! The input value was not handled.")}const af="AbstractRule",uf="AbstractType",
|
|
99
|
-
Grammar",
|
|
100
|
-
return Ye.isInstance(t,pf)}const lu="SimpleType";function i0(t){return Ye.isInstance(t,lu)}const hf="StringLiteral",Go="TerminalRule";function ai(t){return Ye.isInstance(t,Go)}const du="Type";function
|
|
98
|
+
throw new Error("Error! The input value was not handled.")}const af="AbstractRule",uf="AbstractType",Mm="Condition",n0="TypeDefinition",Bm="ValueLiteral",Za="AbstractElement";function qm(t){return Ye.isInstance(t,Za)}const cf="ArrayLiteral",eu="ArrayType";function pN(t){return Ye.isInstance(t,eu)}const tu="BooleanLiteral";function hN(t){return Ye.isInstance(t,tu)}const nu="Conjunction";function mN(t){return Ye.isInstance(t,nu)}const ru="Disjunction";function gN(t){return Ye.isInstance(t,ru)}const lf="\
|
|
99
|
+
Grammar",jm="GrammarImport",iu="InferredType";function Gm(t){return Ye.isInstance(t,iu)}const su="Interface";function r0(t){return Ye.isInstance(t,su)}const Um="NamedArgument",ou="Negation";function yN(t){return Ye.isInstance(t,ou)}const df="NumberLiteral",ff="Parameter",au="ParameterReference";function vN(t){return Ye.isInstance(t,au)}const uu="ParserRule";function Vt(t){return Ye.isInstance(t,uu)}const cu="ReferenceType";function wN(t){return Ye.isInstance(t,cu)}const pf="ReturnType";function bN(t){
|
|
100
|
+
return Ye.isInstance(t,pf)}const lu="SimpleType";function i0(t){return Ye.isInstance(t,lu)}const hf="StringLiteral",Go="TerminalRule";function ai(t){return Ye.isInstance(t,Go)}const du="Type";function Wm(t){return Ye.isInstance(t,du)}const zm="TypeAttribute",fu="UnionType";function EN(t){return Ye.isInstance(t,fu)}const pu="Action";function Is(t){return Ye.isInstance(t,pu)}const hu="Alternatives";function Hm(t){return Ye.isInstance(t,hu)}const mu="Assignment";function jr(t){return Ye.isInstance(
|
|
101
101
|
t,mu)}const gu="CharacterRange";function $N(t){return Ye.isInstance(t,gu)}const yu="CrossReference";function Uo(t){return Ye.isInstance(t,yu)}const vu="EndOfFile";function RN(t){return Ye.isInstance(t,vu)}const wu="Group";function Xi(t){return Ye.isInstance(t,wu)}const bu="Keyword";function vr(t){return Ye.isInstance(t,bu)}const Eu="NegatedToken";function DN(t){return Ye.isInstance(t,Eu)}const $u="RegexToken";function kN(t){return Ye.isInstance(t,$u)}const Ru="RuleCall";function ui(t){return Ye.
|
|
102
|
-
isInstance(t,Ru)}const Du="TerminalAlternatives";function TN(t){return Ye.isInstance(t,Du)}const ku="TerminalGroup";function CN(t){return Ye.isInstance(t,ku)}const Tu="TerminalRuleCall";function s0(t){return Ye.isInstance(t,Tu)}const Cu="UnorderedGroup";function
|
|
103
|
-
ru,vu,lf,
|
|
104
|
-
isSubtype(
|
|
102
|
+
isInstance(t,Ru)}const Du="TerminalAlternatives";function TN(t){return Ye.isInstance(t,Du)}const ku="TerminalGroup";function CN(t){return Ye.isInstance(t,ku)}const Tu="TerminalRuleCall";function s0(t){return Ye.isInstance(t,Tu)}const Cu="UnorderedGroup";function Km(t){return Ye.isInstance(t,Cu)}const Au="UntilToken";function AN(t){return Ye.isInstance(t,Au)}const Su="Wildcard";function SN(t){return Ye.isInstance(t,Su)}class o0 extends Kb{getAllTypes(){return[Za,af,uf,pu,hu,cf,eu,mu,tu,gu,Mm,nu,yu,
|
|
103
|
+
ru,vu,lf,jm,wu,iu,su,bu,Um,Eu,ou,df,ff,au,uu,cu,$u,pf,Ru,lu,hf,Du,ku,Go,Tu,du,zm,n0,fu,Cu,Au,Bm,Su]}computeIsSubtype(e,n){switch(e){case pu:case hu:case mu:case gu:case yu:case vu:case wu:case bu:case Eu:case $u:case Ru:case Du:case ku:case Tu:case Cu:case Au:case Su:return this.isSubtype(Za,n);case cf:case df:case hf:return this.isSubtype(Bm,n);case eu:case cu:case lu:case fu:return this.isSubtype(n0,n);case tu:return this.isSubtype(Mm,n)||this.isSubtype(Bm,n);case nu:case ru:case ou:case au:return this.
|
|
104
|
+
isSubtype(Mm,n);case iu:case su:case du:return this.isSubtype(uf,n);case uu:return this.isSubtype(af,n)||this.isSubtype(uf,n);case Go:return this.isSubtype(af,n);default:return!1}}getReferenceType(e){const n=`${e.container.$type}:${e.property}`;switch(n){case"Action:type":case"CrossReference:type":case"Interface:superTypes":case"ParserRule:returnType":case"SimpleType:typeRef":return uf;case"Grammar:hiddenTokens":case"ParserRule:hiddenTokens":case"RuleCall:rule":return af;case"Grammar:usedGrammar\
|
|
105
105
|
s":return lf;case"NamedArgument:parameter":case"ParameterReference:parameter":return ff;case"TerminalRuleCall:rule":return Go;default:throw new Error(`${n} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case Za:return{name:Za,properties:[{name:"cardinality"},{name:"lookahead"}]};case cf:return{name:cf,properties:[{name:"elements",defaultValue:[]}]};case eu:return{name:eu,properties:[{name:"elementType"}]};case tu:return{name:tu,properties:[{name:"true",defaultValue:!1}]};case nu:return{
|
|
106
|
-
name:nu,properties:[{name:"left"},{name:"right"}]};case ru:return{name:ru,properties:[{name:"left"},{name:"right"}]};case lf:return{name:lf,properties:[{name:"definesHiddenTokens",defaultValue:!1},{name:"hiddenTokens",defaultValue:[]},{name:"imports",defaultValue:[]},{name:"interfaces",defaultValue:[]},{name:"isDeclared",defaultValue:!1},{name:"name"},{name:"rules",defaultValue:[]},{name:"types",defaultValue:[]},{name:"usedGrammars",defaultValue:[]}]};case
|
|
107
|
-
th"}]};case iu:return{name:iu,properties:[{name:"name"}]};case su:return{name:su,properties:[{name:"attributes",defaultValue:[]},{name:"name"},{name:"superTypes",defaultValue:[]}]};case
|
|
106
|
+
name:nu,properties:[{name:"left"},{name:"right"}]};case ru:return{name:ru,properties:[{name:"left"},{name:"right"}]};case lf:return{name:lf,properties:[{name:"definesHiddenTokens",defaultValue:!1},{name:"hiddenTokens",defaultValue:[]},{name:"imports",defaultValue:[]},{name:"interfaces",defaultValue:[]},{name:"isDeclared",defaultValue:!1},{name:"name"},{name:"rules",defaultValue:[]},{name:"types",defaultValue:[]},{name:"usedGrammars",defaultValue:[]}]};case jm:return{name:jm,properties:[{name:"pa\
|
|
107
|
+
th"}]};case iu:return{name:iu,properties:[{name:"name"}]};case su:return{name:su,properties:[{name:"attributes",defaultValue:[]},{name:"name"},{name:"superTypes",defaultValue:[]}]};case Um:return{name:Um,properties:[{name:"calledByName",defaultValue:!1},{name:"parameter"},{name:"value"}]};case ou:return{name:ou,properties:[{name:"value"}]};case df:return{name:df,properties:[{name:"value"}]};case ff:return{name:ff,properties:[{name:"name"}]};case au:return{name:au,properties:[{name:"parameter"}]};case uu:
|
|
108
108
|
return{name:uu,properties:[{name:"dataType"},{name:"definesHiddenTokens",defaultValue:!1},{name:"definition"},{name:"entry",defaultValue:!1},{name:"fragment",defaultValue:!1},{name:"hiddenTokens",defaultValue:[]},{name:"inferredType"},{name:"name"},{name:"parameters",defaultValue:[]},{name:"returnType"},{name:"wildcard",defaultValue:!1}]};case cu:return{name:cu,properties:[{name:"referenceType"}]};case pf:return{name:pf,properties:[{name:"name"}]};case lu:return{name:lu,properties:[{name:"primit\
|
|
109
|
-
iveType"},{name:"stringType"},{name:"typeRef"}]};case hf:return{name:hf,properties:[{name:"value"}]};case Go:return{name:Go,properties:[{name:"definition"},{name:"fragment",defaultValue:!1},{name:"hidden",defaultValue:!1},{name:"name"},{name:"type"}]};case du:return{name:du,properties:[{name:"name"},{name:"type"}]};case
|
|
109
|
+
iveType"},{name:"stringType"},{name:"typeRef"}]};case hf:return{name:hf,properties:[{name:"value"}]};case Go:return{name:Go,properties:[{name:"definition"},{name:"fragment",defaultValue:!1},{name:"hidden",defaultValue:!1},{name:"name"},{name:"type"}]};case du:return{name:du,properties:[{name:"name"},{name:"type"}]};case zm:return{name:zm,properties:[{name:"defaultValue"},{name:"isOptional",defaultValue:!1},{name:"name"},{name:"type"}]};case fu:return{name:fu,properties:[{name:"types",defaultValue:[]}]};case pu:
|
|
110
110
|
return{name:pu,properties:[{name:"cardinality"},{name:"feature"},{name:"inferredType"},{name:"lookahead"},{name:"operator"},{name:"type"}]};case hu:return{name:hu,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case mu:return{name:mu,properties:[{name:"cardinality"},{name:"feature"},{name:"lookahead"},{name:"operator"},{name:"terminal"}]};case gu:return{name:gu,properties:[{name:"cardinality"},{name:"left"},{name:"lookahead"},{name:"right"}]};case yu:return{
|
|
111
111
|
name:yu,properties:[{name:"cardinality"},{name:"deprecatedSyntax",defaultValue:!1},{name:"lookahead"},{name:"terminal"},{name:"type"}]};case vu:return{name:vu,properties:[{name:"cardinality"},{name:"lookahead"}]};case wu:return{name:wu,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"guardCondition"},{name:"lookahead"}]};case bu:return{name:bu,properties:[{name:"cardinality"},{name:"lookahead"},{name:"value"}]};case Eu:return{name:Eu,properties:[{name:"cardinality"},{name:"\
|
|
112
112
|
lookahead"},{name:"terminal"}]};case $u:return{name:$u,properties:[{name:"cardinality"},{name:"lookahead"},{name:"regex"}]};case Ru:return{name:Ru,properties:[{name:"arguments",defaultValue:[]},{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case Du:return{name:Du,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case ku:return{name:ku,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Tu:return{name:Tu,properties:[
|
|
113
|
-
{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case Cu:return{name:Cu,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Au:return{name:Au,properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case Su:return{name:Su,properties:[{name:"cardinality"},{name:"lookahead"}]};default:return{name:e,properties:[]}}}}const Ye=new o0;function
|
|
113
|
+
{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case Cu:return{name:Cu,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Au:return{name:Au,properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case Su:return{name:Su,properties:[{name:"cardinality"},{name:"lookahead"}]};default:return{name:e,properties:[]}}}}const Ye=new o0;function Vm(t){for(const[e,n]of Object.entries(t))e.startsWith("$")||(Array.isArray(n)?n.forEach((r,i)=>{kt(
|
|
114
114
|
r)&&(r.$container=t,r.$containerProperty=e,r.$containerIndex=i)}):kt(n)&&(n.$container=t,n.$containerProperty=e))}function zn(t,e){let n=t;for(;n;){if(e(n))return n;n=n.$container}}function Gr(t,e){let n=t;for(;n;){if(e(n))return!0;n=n.$container}return!1}function ut(t){const n=mf(t).$document;if(!n)throw new Error("AST node has no document.");return n}function mf(t){for(;t.$container;)t=t.$container;return t}function _u(t,e){if(!t)throw new Error("Node must be an AstNode.");const n=e?.range;return new Jt(
|
|
115
|
-
()=>({keys:Object.keys(t),keyIndex:0,arrayIndex:0}),r=>{for(;r.keyIndex<r.keys.length;){const i=r.keys[r.keyIndex];if(!i.startsWith("$")){const s=t[i];if(kt(s)){if(r.keyIndex++,
|
|
116
|
-
if(e?.range&&!
|
|
117
|
-
container:t,property:n}};if(Array.isArray(r)){for(;e.arrayIndex<r.length;){const i=e.arrayIndex++,s=r[i];if(or(s))return{done:!1,value:{reference:s,container:t,property:n,index:i}}}e.arrayIndex=0}}e.keyIndex++}return
|
|
118
|
-
name]=a0(i.defaultValue))}function a0(t){return Array.isArray(t)?[...t.map(a0)]:t}function
|
|
119
|
-
findRootNode:mf,getContainerOfType:zn,getDocument:ut,hasContainerOfType:Gr,linkContentToContainer:
|
|
115
|
+
()=>({keys:Object.keys(t),keyIndex:0,arrayIndex:0}),r=>{for(;r.keyIndex<r.keys.length;){const i=r.keys[r.keyIndex];if(!i.startsWith("$")){const s=t[i];if(kt(s)){if(r.keyIndex++,Xm(s,n))return{done:!1,value:s}}else if(Array.isArray(s)){for(;r.arrayIndex<s.length;){const o=r.arrayIndex++,a=s[o];if(kt(a)&&Xm(a,n))return{done:!1,value:a}}r.arrayIndex=0}}r.keyIndex++}return Pn})}function wr(t,e){if(!t)throw new Error("Root node must be an AstNode.");return new jo(t,n=>_u(n,e))}function ci(t,e){if(t){
|
|
116
|
+
if(e?.range&&!Xm(t,e.range))return new jo(t,()=>[])}else throw new Error("Root node must be an AstNode.");return new jo(t,n=>_u(n,e),{includeRoot:!0})}function Xm(t,e){var n;if(!e)return!0;const r=(n=t.$cstNode)===null||n===void 0?void 0:n.range;return r?Xb(r,e):!1}function gf(t){return new Jt(()=>({keys:Object.keys(t),keyIndex:0,arrayIndex:0}),e=>{for(;e.keyIndex<e.keys.length;){const n=e.keys[e.keyIndex];if(!n.startsWith("$")){const r=t[n];if(or(r))return e.keyIndex++,{done:!1,value:{reference:r,
|
|
117
|
+
container:t,property:n}};if(Array.isArray(r)){for(;e.arrayIndex<r.length;){const i=e.arrayIndex++,s=r[i];if(or(s))return{done:!1,value:{reference:s,container:t,property:n,index:i}}}e.arrayIndex=0}}e.keyIndex++}return Pn})}function _N(t,e=ut(t).parseResult.value){const n=[];return ci(e).forEach(r=>{gf(r).forEach(i=>{i.reference.ref===t&&n.push(i.reference)})}),Ve(n)}function Ym(t,e){const n=t.getTypeMetaData(e.$type),r=e;for(const i of n.properties)i.defaultValue!==void 0&&r[i.name]===void 0&&(r[i.
|
|
118
|
+
name]=a0(i.defaultValue))}function a0(t){return Array.isArray(t)?[...t.map(a0)]:t}function Jm(t,e){const n={$type:t.$type};for(const[r,i]of Object.entries(t))if(!r.startsWith("$"))if(kt(i))n[r]=Jm(i,e);else if(or(i))n[r]=e(n,r,i.$refNode,i.$refText);else if(Array.isArray(i)){const s=[];for(const o of i)kt(o)?s.push(Jm(o,e)):or(o)?s.push(e(n,r,o.$refNode,o.$refText)):s.push(o);n[r]=s}else n[r]=i;return Vm(n),n}const Wo={__proto__:null,assignMandatoryProperties:Ym,copyAstNode:Jm,findLocalReferences:_N,
|
|
119
|
+
findRootNode:mf,getContainerOfType:zn,getDocument:ut,hasContainerOfType:Gr,linkContentToContainer:Vm,streamAllContents:wr,streamAst:ci,streamContents:_u,streamReferences:gf};function Se(t){return t.charCodeAt(0)}function Qm(t,e){Array.isArray(t)?t.forEach(function(n){e.push(n)}):e.push(t)}function xu(t,e){if(t[e]===!0)throw"duplicate flag "+e;t[e],t[e]=!0}function zo(t){if(t===void 0)throw Error("Internal Error - Should never get here!");return!0}function xN(){throw Error("Internal Error - Shoul\
|
|
120
120
|
d never get here!")}function u0(t){return t.type==="Character"}const yf=[];for(let t=Se("0");t<=Se("9");t++)yf.push(t);const vf=[Se("_")].concat(yf);for(let t=Se("a");t<=Se("z");t++)vf.push(t);for(let t=Se("A");t<=Se("Z");t++)vf.push(t);const c0=[Se(" "),Se("\f"),Se(`
|
|
121
121
|
`),Se("\r"),Se(" "),Se("\v"),Se(" "),Se("\xA0"),Se("\u1680"),Se("\u2000"),Se("\u2001"),Se("\u2002"),Se("\u2003"),Se("\u2004"),Se("\u2005"),Se("\u2006"),Se("\u2007"),Se("\u2008"),Se("\u2009"),Se("\u200A"),Se("\u2028"),Se("\u2029"),Se("\u202F"),Se("\u205F"),Se("\u3000"),Se("\uFEFF")],PN=/[0-9a-fA-F]/,wf=/[0-9]/,NN=/[1-9]/;class l0{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=
|
|
122
122
|
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 r={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":xu(r,"global");break;case"i":xu(r,"ignoreCase");break;case"m":xu(r,"multiLine");break;case"u":xu(r,"unicode");break;case"y":xu(r,"sticky");break}if(this.idx!==this.input.length)
|
|
@@ -130,7 +130,7 @@ regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}deci
|
|
|
130
130
|
`);break;case"r":e=Se("\r");break;case"t":e=Se(" ");break;case"v":e=Se("\v");break}if(zo(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:Se("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){
|
|
131
131
|
return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){const e=this.popChar();return{type:"Character",value:Se(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case`
|
|
132
132
|
`:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:const e=this.popChar();return{type:"Character",value:Se(e)}}}characterClass(){const e=[];let n=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),n=!0);this.isClassAtom();){const r=this.classAtom();if(r.type,u0(r)&&this.isRangeDash()){this.consumeChar("-");const i=this.classAtom();if(i.type,u0(i)){if(i.value<r.value)throw Error("Range out of order in character class");e.push({from:r.value,to:i.
|
|
133
|
-
value})}else
|
|
133
|
+
value})}else Qm(r.value,e),e.push(Se("-")),Qm(i.value,e)}else Qm(r.value,e)}return this.consumeChar("]"),{type:"Set",complement:n,value:e}}classAtom(){switch(this.peekChar()){case"]":case`
|
|
134
134
|
`: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:Se("\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"\
|
|
135
135
|
x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}group(){let e=!0;switch(this.consumeChar("("),this.peekChar(0)){case"?":this.consumeChar("?"),this.consumeChar(":"),e=!1;break;default:this.groupIdx++;break}const n=this.disjunction();this.consumeChar(")");const r={type:"Group",capturing:e,value:n};return e&&(r.idx=this.groupIdx),r}positiveInteger(){let e=this.popChar();if(NN.test(e)===!1)throw Error("Expecting a\
|
|
136
136
|
positive integer");for(;wf.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(wf.test(e)===!1)throw Error("Expecting an integer");for(;wf.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){const e=this.popChar();switch(e){case`
|
|
@@ -143,124 +143,124 @@ rtAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);
|
|
|
143
143
|
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){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}}const d0=/\r?\n/gm,IN=new l0;class ON extends bf{constructor(){super(...arguments),this.isStarting=!0,this.endRegexpStack=[],this.multiline=!1}get endRegex(){
|
|
144
144
|
return this.endRegexpStack.join("")}reset(e){this.multiline=!1,this.regex=e,this.startRegexp="",this.isStarting=!0,this.endRegexpStack=[]}visitGroup(e){e.quantifier&&(this.isStarting=!1,this.endRegexpStack=[])}visitCharacter(e){const n=String.fromCharCode(e.value);if(!this.multiline&&n===`
|
|
145
145
|
`&&(this.multiline=!0),e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{const r=Ef(n);this.endRegexpStack.push(r),this.isStarting&&(this.startRegexp+=r)}}visitSet(e){if(!this.multiline){const n=this.regex.substring(e.loc.begin,e.loc.end),r=new RegExp(n);this.multiline=!!`
|
|
146
|
-
`.match(r)}if(e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{const n=this.regex.substring(e.loc.begin,e.loc.end);this.endRegexpStack.push(n),this.isStarting&&(this.startRegexp+=n)}}visitChildren(e){e.type==="Group"&&e.quantifier||super.visitChildren(e)}}const
|
|
146
|
+
`.match(r)}if(e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{const n=this.regex.substring(e.loc.begin,e.loc.end);this.endRegexpStack.push(n),this.isStarting&&(this.startRegexp+=n)}}visitChildren(e){e.type==="Group"&&e.quantifier||super.visitChildren(e)}}const Zm=new ON;function LN(t){try{return typeof t=="string"&&(t=new RegExp(t)),t=t.toString(),Zm.reset(t),Zm.visit(IN.pattern(t)),Zm.multiline}catch{return!1}}const FN=`\f
|
|
147
147
|
\r \v \xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF`.split("");function f0(t){const e=typeof t=="string"?new RegExp(t):t;return FN.some(n=>e.test(n))}function Ef(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function MN(t,e){const n=BN(t),r=e.match(n);return!!r&&r[0].length>0}function BN(t){typeof t=="string"&&(t=new RegExp(t));const e=t,n=t.source;let r=0;function i(){let s="",o;function a(c){s+=n.substr(r,c),r+=c}function u(c){
|
|
148
148
|
s+="(?:"+n.substr(r,c)+"|$)",r+=c}for(;r<n.length;)switch(n[r]){case"\\":switch(n[r+1]){case"c":u(3);break;case"x":u(4);break;case"u":e.unicode?n[r+2]==="{"?u(n.indexOf("}",r)-r+1):u(6):u(2);break;case"p":case"P":e.unicode?u(n.indexOf("}",r)-r+1):u(2);break;case"k":u(n.indexOf(">",r)-r+1);break;default:u(2);break}break;case"[":o=/\[(?:\\.|.)*?\]/g,o.lastIndex=r,o=o.exec(n)||[],u(o[0].length);break;case"|":case"^":case"$":case"*":case"+":case"?":a(1);break;case"{":o=/\{\d+,?\d*\}/g,o.lastIndex=r,
|
|
149
149
|
o=o.exec(n),o?a(o[0].length):u(1);break;case"(":if(n[r+1]==="?")switch(n[r+2]){case":":s+="(?:",r+=3,s+=i()+"|$)";break;case"=":s+="(?=",r+=3,s+=i()+")";break;case"!":o=r,r+=3,i(),s+=n.substr(o,r-o);break;case"<":switch(n[r+3]){case"=":case"!":o=r,r+=4,i(),s+=n.substr(o,r-o);break;default:a(n.indexOf(">",r)-r+1),s+=i()+"|$)";break}break}else a(1),s+=i()+"|$)";break;case")":return++r,s;default:u(1);break}return s}return new RegExp(i(),t.flags)}function $f(t){return t.rules.find(e=>Vt(e)&&e.entry)}
|
|
150
|
-
function p0(t){return t.rules.filter(e=>ai(e)&&e.hidden)}function
|
|
151
|
-
ref)&&Vt(n.type.ref.$container)&&e.add(n.type.ref.$container))}),e}function
|
|
152
|
-
t]}return Vi(t)&&t.astNode===n?t.content.flatMap(i=>
|
|
153
|
-
e&&s.push(o):r.prune()}while(!i.done);return s}function g0(t){var e;const n=t.astNode;for(;n===((e=t.container)===null||e===void 0?void 0:e.astNode);){const r=zn(t.grammarSource,jr);if(r)return r;t=t.container}}function
|
|
154
|
-
e)){if(jr(s)&&s.feature.toLowerCase()==="name")return n.set(t,s),s;if(ui(s)&&Vt(s.rule.ref))return i(s,s.rule.ref);if(i0(s)&&(!((r=s.typeRef)===null||r===void 0)&&r.ref))return i(s,s.typeRef.ref)}}function v0(t){const e=t.$container;if(Xi(e)){const n=e.elements,r=n.indexOf(t);for(let i=r-1;i>=0;i--){const s=n[i];if(Is(s))return s;{const o=wr(n[i]).find(Is);if(o)return o}}}if(
|
|
155
|
-
"+"}function jN(t){return t==="+="}function Rf(t){return b0(t,new Set)}function b0(t,e){if(e.has(t))return!0;e.add(t);for(const n of wr(t))if(ui(n)){if(!n.rule.ref||Vt(n.rule.ref)&&!b0(n.rule.ref,e))return!1}else{if(jr(n))return!1;if(Is(n))return!1}return!!t.definition}function GN(t){return
|
|
156
|
-
void 0)return!0;if(t.typeRef!==void 0){const n=t.typeRef.ref;return
|
|
150
|
+
function p0(t){return t.rules.filter(e=>ai(e)&&e.hidden)}function eg(t,e){const n=new Set,r=$f(t);if(!r)return new Set(t.rules);const i=[r].concat(p0(t));for(const o of i)h0(o,n,e);const s=new Set;for(const o of t.rules)(n.has(o.name)||ai(o)&&o.hidden)&&s.add(o);return s}function h0(t,e,n){e.add(t.name),wr(t).forEach(r=>{if(ui(r)||n&&s0(r)){const i=r.rule.ref;i&&!e.has(i.name)&&h0(i,e,n)}})}function qN(t){const e=new Set;return wr(t).forEach(n=>{Uo(n)&&(Vt(n.type.ref)&&e.add(n.type.ref),Gm(n.type.
|
|
151
|
+
ref)&&Vt(n.type.ref.$container)&&e.add(n.type.ref.$container))}),e}function tg(t){if(t.terminal)return t.terminal;if(t.type.ref){const e=sg(t.type.ref);return e?.terminal}}function m0(t){return t.hidden&&!f0(Iu(t))}function Ho(t,e){return!t||!e?[]:ng(t,e,t.astNode,!0)}function pn(t,e,n){if(!t||!e)return;const r=ng(t,e,t.astNode,!0);if(r.length!==0)return n!==void 0?n=Math.max(0,Math.min(n,r.length-1)):n=0,r[n]}function ng(t,e,n,r){if(!r){const i=zn(t.grammarSource,jr);if(i&&i.feature===e)return[
|
|
152
|
+
t]}return Vi(t)&&t.astNode===n?t.content.flatMap(i=>ng(i,e,n,!1)):[]}function rg(t,e){return t?ig(t,e,t?.astNode):[]}function Pu(t,e,n){if(!t)return;const r=ig(t,e,t?.astNode);if(r.length!==0)return n!==void 0?n=Math.max(0,Math.min(n,r.length-1)):n=0,r[n]}function ig(t,e,n){if(t.astNode!==n)return[];if(vr(t.grammarSource)&&t.grammarSource.value===e)return[t];const r=rf(t).iterator();let i;const s=[];do if(i=r.next(),!i.done){const o=i.value;o.astNode===n?vr(o.grammarSource)&&o.grammarSource.value===
|
|
153
|
+
e&&s.push(o):r.prune()}while(!i.done);return s}function g0(t){var e;const n=t.astNode;for(;n===((e=t.container)===null||e===void 0?void 0:e.astNode);){const r=zn(t.grammarSource,jr);if(r)return r;t=t.container}}function sg(t){let e=t;return Gm(e)&&(Is(e.$container)?e=e.$container.$container:Vt(e.$container)?e=e.$container:Qa(e.$container)),y0(t,e,new Map)}function y0(t,e,n){var r;function i(s,o){let a;return zn(s,jr)||(a=y0(o,o,n)),n.set(t,a),a}if(n.has(t))return n.get(t);n.set(t,void 0);for(const s of wr(
|
|
154
|
+
e)){if(jr(s)&&s.feature.toLowerCase()==="name")return n.set(t,s),s;if(ui(s)&&Vt(s.rule.ref))return i(s,s.rule.ref);if(i0(s)&&(!((r=s.typeRef)===null||r===void 0)&&r.ref))return i(s,s.typeRef.ref)}}function v0(t){const e=t.$container;if(Xi(e)){const n=e.elements,r=n.indexOf(t);for(let i=r-1;i>=0;i--){const s=n[i];if(Is(s))return s;{const o=wr(n[i]).find(Is);if(o)return o}}}if(qm(e))return v0(e)}function Ko(t,e){return t==="?"||t==="*"||Xi(e)&&!!e.guardCondition}function w0(t){return t==="*"||t===
|
|
155
|
+
"+"}function jN(t){return t==="+="}function Rf(t){return b0(t,new Set)}function b0(t,e){if(e.has(t))return!0;e.add(t);for(const n of wr(t))if(ui(n)){if(!n.rule.ref||Vt(n.rule.ref)&&!b0(n.rule.ref,e))return!1}else{if(jr(n))return!1;if(Is(n))return!1}return!!t.definition}function GN(t){return og(t.type,new Set)}function og(t,e){if(e.has(t))return!0;if(e.add(t),pN(t))return!1;if(wN(t))return!1;if(EN(t))return t.types.every(n=>og(n,e));if(i0(t)){if(t.primitiveType!==void 0)return!0;if(t.stringType!==
|
|
156
|
+
void 0)return!0;if(t.typeRef!==void 0){const n=t.typeRef.ref;return Wm(n)?og(n.type,e):!1}else return!1}else return!1}function Os(t){if(t.inferredType)return t.inferredType.name;if(t.dataType)return t.dataType;if(t.returnType){const e=t.returnType.ref;if(e){if(Vt(e))return e.name;if(r0(e)||Wm(e))return e.name}}}function Nu(t){var e;if(Vt(t))return Rf(t)?t.name:(e=Os(t))!==null&&e!==void 0?e:t.name;if(r0(t)||Wm(t)||bN(t))return t.name;if(Is(t)){const n=E0(t);if(n)return n}else if(Gm(t))return t.name;
|
|
157
157
|
throw new Error("Cannot get name of Unknown Type")}function E0(t){var e;if(t.inferredType)return t.inferredType.name;if(!((e=t.type)===null||e===void 0)&&e.ref)return Nu(t.type.ref)}function UN(t){var e,n,r;return ai(t)?(n=(e=t.type)===null||e===void 0?void 0:e.name)!==null&&n!==void 0?n:"string":Rf(t)?t.name:(r=Os(t))!==null&&r!==void 0?r:t.name}function $0(t){var e,n,r;return ai(t)?(n=(e=t.type)===null||e===void 0?void 0:e.name)!==null&&n!==void 0?n:"string":(r=Os(t))!==null&&r!==void 0?r:t.name}
|
|
158
|
-
function Iu(t){const e={s:!1,i:!1,u:!1},n=Vo(t.definition,e),r=Object.entries(e).filter(([,i])=>i).map(([i])=>i).join("");return new RegExp(n,r)}const
|
|
159
|
-
r=t.regex.substring(1,n),i=t.regex.substring(n+1);return e&&(e.i=i.includes("i"),e.s=i.includes("s"),e.u=i.includes("u")),li(r,{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1})}else{if(SN(t))return li(
|
|
160
|
-
cardinality,lookahead:t.lookahead})}function HN(t){return li(`${
|
|
161
|
-
return(e.wrap!==!1||e.lookahead)&&(t=`(${(n=e.lookahead)!==null&&n!==void 0?n:""}${t})`),e.cardinality?`${t}${e.cardinality}`:t}const
|
|
158
|
+
function Iu(t){const e={s:!1,i:!1,u:!1},n=Vo(t.definition,e),r=Object.entries(e).filter(([,i])=>i).map(([i])=>i).join("");return new RegExp(n,r)}const ag=/[\s\S]/.source;function Vo(t,e){if(TN(t))return WN(t);if(CN(t))return zN(t);if($N(t))return VN(t);if(s0(t)){const n=t.rule.ref;if(!n)throw new Error("Missing rule reference.");return li(Vo(n.definition),{cardinality:t.cardinality,lookahead:t.lookahead})}else{if(DN(t))return KN(t);if(AN(t))return HN(t);if(kN(t)){const n=t.regex.lastIndexOf("/"),
|
|
159
|
+
r=t.regex.substring(1,n),i=t.regex.substring(n+1);return e&&(e.i=i.includes("i"),e.s=i.includes("s"),e.u=i.includes("u")),li(r,{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1})}else{if(SN(t))return li(ag,{cardinality:t.cardinality,lookahead:t.lookahead});throw new Error(`Invalid terminal element: ${t?.$type}`)}}}function WN(t){return li(t.elements.map(e=>Vo(e)).join("|"),{cardinality:t.cardinality,lookahead:t.lookahead})}function zN(t){return li(t.elements.map(e=>Vo(e)).join(""),{cardinality:t.
|
|
160
|
+
cardinality,lookahead:t.lookahead})}function HN(t){return li(`${ag}*?${Vo(t.terminal)}`,{cardinality:t.cardinality,lookahead:t.lookahead})}function KN(t){return li(`(?!${Vo(t.terminal)})${ag}*?`,{cardinality:t.cardinality,lookahead:t.lookahead})}function VN(t){return t.right?li(`[${ug(t.left)}-${ug(t.right)}]`,{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1}):li(ug(t.left),{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1})}function ug(t){return Ef(t.value)}function li(t,e){var n;
|
|
161
|
+
return(e.wrap!==!1||e.lookahead)&&(t=`(${(n=e.lookahead)!==null&&n!==void 0?n:""}${t})`),e.cardinality?`${t}${e.cardinality}`:t}const cg={__proto__:null,findAssignment:g0,findNameAssignment:sg,findNodeForKeyword:Pu,findNodeForProperty:pn,findNodesForKeyword:rg,findNodesForKeywordInternal:ig,findNodesForProperty:Ho,getActionAtElement:v0,getActionType:E0,getAllReachableRules:eg,getAllRulesUsedForCrossReferences:qN,getCrossReferenceTerminal:tg,getEntryRule:$f,getExplicitRuleType:Os,getHiddenRules:p0,
|
|
162
162
|
getRuleType:$0,getRuleTypeName:UN,getTypeName:Nu,isArrayCardinality:w0,isArrayOperator:jN,isCommentTerminal:m0,isDataType:GN,isDataTypeRule:Rf,isOptionalCardinality:Ko,terminalRegex:Iu};function XN(t){const e=[],n=t.Grammar;for(const r of n.rules)ai(r)&&m0(r)&&LN(Iu(r))&&e.push(r.name);return{multilineCommentRules:e,nameRegexp:Yb}}var R0=typeof global=="object"&&global&&global.Object===Object&&global,YN=typeof self=="object"&&self&&self.Object===Object&&self,Ur=R0||YN||Function("return this")(),
|
|
163
163
|
ar=Ur.Symbol,D0=Object.prototype,JN=D0.hasOwnProperty,QN=D0.toString,Ou=ar?ar.toStringTag:void 0;function ZN(t){var e=JN.call(t,Ou),n=t[Ou];try{t[Ou]=void 0;var r=!0}catch{}var i=QN.call(t);return r&&(e?t[Ou]=n:delete t[Ou]),i}var eI=Object.prototype,tI=eI.toString;function nI(t){return tI.call(t)}var rI="[object Null]",iI="[object Undefined]",k0=ar?ar.toStringTag:void 0;function Yi(t){return t==null?t===void 0?iI:rI:k0&&k0 in Object(t)?ZN(t):nI(t)}function br(t){return t!=null&&typeof t=="objec\
|
|
164
164
|
t"}var sI="[object Symbol]";function Lu(t){return typeof t=="symbol"||br(t)&&Yi(t)==sI}function Df(t,e){for(var n=-1,r=t==null?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}var Je=Array.isArray,T0=ar?ar.prototype:void 0,C0=T0?T0.toString:void 0;function A0(t){if(typeof t=="string")return t;if(Je(t))return Df(t,A0)+"";if(Lu(t))return C0?C0.call(t):"";var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}var oI=/\s/;function aI(t){for(var e=t.length;e--&&oI.test(t.charAt(e)););return e}var uI=/^\s+/;
|
|
165
165
|
function cI(t){return t&&t.slice(0,aI(t)+1).replace(uI,"")}function ur(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var S0=NaN,lI=/^[-+]0x[0-9a-f]+$/i,dI=/^0b[01]+$/i,fI=/^0o[0-7]+$/i,pI=parseInt;function hI(t){if(typeof t=="number")return t;if(Lu(t))return S0;if(ur(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=ur(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=cI(t);var n=dI.test(t);return n||fI.test(t)?pI(t.slice(2),n?2:8):lI.test(t)?S0:+t}var _0=1/0,mI=17976931348623157e292;
|
|
166
|
-
function gI(t){if(!t)return t===0?t:0;if(t=hI(t),t===_0||t===-_0){var e=t<0?-1:1;return e*mI}return t===t?t:0}function kf(t){var e=gI(t),n=e%1;return e===e?n?e-n:e:0}function Ls(t){return t}var yI="[object AsyncFunction]",vI="[object Function]",wI="[object GeneratorFunction]",bI="[object Proxy]";function di(t){if(!ur(t))return!1;var e=Yi(t);return e==vI||e==wI||e==yI||e==bI}var
|
|
166
|
+
function gI(t){if(!t)return t===0?t:0;if(t=hI(t),t===_0||t===-_0){var e=t<0?-1:1;return e*mI}return t===t?t:0}function kf(t){var e=gI(t),n=e%1;return e===e?n?e-n:e:0}function Ls(t){return t}var yI="[object AsyncFunction]",vI="[object Function]",wI="[object GeneratorFunction]",bI="[object Proxy]";function di(t){if(!ur(t))return!1;var e=Yi(t);return e==vI||e==wI||e==yI||e==bI}var lg=Ur["__core-js_shared__"],x0=function(){var t=/[^.]+$/.exec(lg&&lg.keys&&lg.keys.IE_PROTO||"");return t?"Symbol(src)_\
|
|
167
167
|
1."+t:""}();function EI(t){return!!x0&&x0 in t}var $I=Function.prototype,RI=$I.toString;function Fs(t){if(t!=null){try{return RI.call(t)}catch{}try{return t+""}catch{}}return""}var DI=/[\\^$.*+?()[\]{}|]/g,kI=/^\[object .+?Constructor\]$/,TI=Function.prototype,CI=Object.prototype,AI=TI.toString,SI=CI.hasOwnProperty,_I=RegExp("^"+AI.call(SI).replace(DI,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function xI(t){if(!ur(t)||EI(t))return!1;var e=di(t)?_I:kI;
|
|
168
|
-
return e.test(Fs(t))}function PI(t,e){return t?.[e]}function Ms(t,e){var n=PI(t,e);return xI(n)?n:void 0}var
|
|
168
|
+
return e.test(Fs(t))}function PI(t,e){return t?.[e]}function Ms(t,e){var n=PI(t,e);return xI(n)?n:void 0}var dg=Ms(Ur,"WeakMap"),P0=Object.create,NI=function(){function t(){}return function(e){if(!ur(e))return{};if(P0)return P0(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function II(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 Ut(){}function OI(t,e){
|
|
169
169
|
var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}var LI=800,FI=16,MI=Date.now;function BI(t){var e=0,n=0;return function(){var r=MI(),i=FI-(r-n);if(n=r,i>0){if(++e>=LI)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function qI(t){return function(){return t}}var Tf=function(){try{var t=Ms(Object,"defineProperty");return t({},"",{}),t}catch{}}(),jI=Tf?function(t,e){return Tf(t,"toString",{configurable:!0,enumerable:!1,value:qI(e),writable:!0})}:Ls,GI=BI(jI);function N0(t,e){
|
|
170
|
-
for(var n=-1,r=t==null?0:t.length;++n<r&&e(t[n],n,t)!==!1;);return t}function I0(t,e,n,r){for(var i=t.length,s=n+-1;++s<i;)if(e(t[s],s,t))return s;return-1}function UI(t){return t!==t}function WI(t,e,n){for(var r=n-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1}function
|
|
171
|
-
symbol"&&HI.test(t))&&t>-1&&t%1==0&&t<e}function
|
|
172
|
-
return e=L0(e===void 0?t.length-1:e,0),function(){for(var r=arguments,i=-1,s=L0(r.length-e,0),o=Array(s);++i<s;)o[i]=r[e+i];i=-1;for(var a=Array(e+1);++i<e;)a[i]=r[i];return a[e]=n(o),II(t,this,a)}}function
|
|
173
|
-
t):!1}function JI(t){return
|
|
170
|
+
for(var n=-1,r=t==null?0:t.length;++n<r&&e(t[n],n,t)!==!1;);return t}function I0(t,e,n,r){for(var i=t.length,s=n+-1;++s<i;)if(e(t[s],s,t))return s;return-1}function UI(t){return t!==t}function WI(t,e,n){for(var r=n-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1}function fg(t,e,n){return e===e?WI(t,e,n):I0(t,UI,n)}function O0(t,e){var n=t==null?0:t.length;return!!n&&fg(t,e,0)>-1}var zI=9007199254740991,HI=/^(?:0|[1-9]\d*)$/;function Cf(t,e){var n=typeof t;return e=e??zI,!!e&&(n=="number"||n!="\
|
|
171
|
+
symbol"&&HI.test(t))&&t>-1&&t%1==0&&t<e}function pg(t,e,n){e=="__proto__"&&Tf?Tf(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function Fu(t,e){return t===e||t!==t&&e!==e}var KI=Object.prototype,VI=KI.hasOwnProperty;function Af(t,e,n){var r=t[e];(!(VI.call(t,e)&&Fu(r,n))||n===void 0&&!(e in t))&&pg(t,e,n)}function Mu(t,e,n,r){var i=!n;n||(n={});for(var s=-1,o=e.length;++s<o;){var a=e[s],u=void 0;u===void 0&&(u=t[a]),i?pg(n,a,u):Af(n,a,u)}return n}var L0=Math.max;function XI(t,e,n){
|
|
172
|
+
return e=L0(e===void 0?t.length-1:e,0),function(){for(var r=arguments,i=-1,s=L0(r.length-e,0),o=Array(s);++i<s;)o[i]=r[e+i];i=-1;for(var a=Array(e+1);++i<e;)a[i]=r[i];return a[e]=n(o),II(t,this,a)}}function hg(t,e){return GI(XI(t,e,Ls),t+"")}var YI=9007199254740991;function mg(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=YI}function Wr(t){return t!=null&&mg(t.length)&&!di(t)}function F0(t,e,n){if(!ur(n))return!1;var r=typeof e;return(r=="number"?Wr(n)&&Cf(e,n.length):r=="string"&&e in n)?Fu(n[e],
|
|
173
|
+
t):!1}function JI(t){return hg(function(e,n){var r=-1,i=n.length,s=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(s=t.length>3&&typeof s=="function"?(i--,s):void 0,o&&F0(n[0],n[1],o)&&(s=i<3?void 0:s,i=1),e=Object(e);++r<i;){var a=n[r];a&&t(e,a,r,s)}return e})}var QI=Object.prototype;function Bu(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||QI;return t===n}function ZI(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}var eO="[object Arguments]";function M0(t){return br(t)&&Yi(t)==
|
|
174
174
|
eO}var B0=Object.prototype,tO=B0.hasOwnProperty,nO=B0.propertyIsEnumerable,Sf=M0(function(){return arguments}())?M0:function(t){return br(t)&&tO.call(t,"callee")&&!nO.call(t,"callee")};function rO(){return!1}var q0=typeof exports=="object"&&exports&&!exports.nodeType&&exports,j0=q0&&typeof module=="object"&&module&&!module.nodeType&&module,iO=j0&&j0.exports===q0,G0=iO?Ur.Buffer:void 0,sO=G0?G0.isBuffer:void 0,qu=sO||rO,oO="[object Arguments]",aO="[object Array]",uO="[object Boolean]",cO="[object\
|
|
175
175
|
Date]",lO="[object Error]",dO="[object Function]",fO="[object Map]",pO="[object Number]",hO="[object Object]",mO="[object RegExp]",gO="[object Set]",yO="[object String]",vO="[object WeakMap]",wO="[object ArrayBuffer]",bO="[object DataView]",EO="[object Float32Array]",$O="[object Float64Array]",RO="[object Int8Array]",DO="[object Int16Array]",kO="[object Int32Array]",TO="[object Uint8Array]",CO="[object Uint8ClampedArray]",AO="[object Uint16Array]",SO="[object Uint32Array]",vt={};vt[EO]=vt[$O]=vt[RO]=
|
|
176
|
-
vt[DO]=vt[kO]=vt[TO]=vt[CO]=vt[AO]=vt[SO]=!0,vt[oO]=vt[aO]=vt[wO]=vt[uO]=vt[bO]=vt[cO]=vt[lO]=vt[dO]=vt[fO]=vt[pO]=vt[hO]=vt[mO]=vt[gO]=vt[yO]=vt[vO]=!1;function _O(t){return br(t)&&
|
|
177
|
-
|
|
176
|
+
vt[DO]=vt[kO]=vt[TO]=vt[CO]=vt[AO]=vt[SO]=!0,vt[oO]=vt[aO]=vt[wO]=vt[uO]=vt[bO]=vt[cO]=vt[lO]=vt[dO]=vt[fO]=vt[pO]=vt[hO]=vt[mO]=vt[gO]=vt[yO]=vt[vO]=!1;function _O(t){return br(t)&&mg(t.length)&&!!vt[Yi(t)]}function _f(t){return function(e){return t(e)}}var U0=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ju=U0&&typeof module=="object"&&module&&!module.nodeType&&module,xO=ju&&ju.exports===U0,gg=xO&&R0.process,Ji=function(){try{var t=ju&&ju.require&&ju.require("util").types;return t||
|
|
177
|
+
gg&&gg.binding&&gg.binding("util")}catch{}}(),W0=Ji&&Ji.isTypedArray,yg=W0?_f(W0):_O,PO=Object.prototype,NO=PO.hasOwnProperty;function z0(t,e){var n=Je(t),r=!n&&Sf(t),i=!n&&!r&&qu(t),s=!n&&!r&&!i&&yg(t),o=n||r||i||s,a=o?ZI(t.length,String):[],u=a.length;for(var c in t)(e||NO.call(t,c))&&!(o&&(c=="length"||i&&(c=="offset"||c=="parent")||s&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||Cf(c,u)))&&a.push(c);return a}function H0(t,e){return function(n){return t(e(n))}}var IO=H0(Object.keys,Object),
|
|
178
178
|
OO=Object.prototype,LO=OO.hasOwnProperty;function K0(t){if(!Bu(t))return IO(t);var e=[];for(var n in Object(t))LO.call(t,n)&&n!="constructor"&&e.push(n);return e}function cr(t){return Wr(t)?z0(t):K0(t)}var FO=Object.prototype,MO=FO.hasOwnProperty,Hn=JI(function(t,e){if(Bu(e)||Wr(e)){Mu(e,cr(e),t);return}for(var n in e)MO.call(e,n)&&Af(t,n,e[n])});function BO(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}var qO=Object.prototype,jO=qO.hasOwnProperty;function GO(t){if(!ur(t))return BO(
|
|
179
|
-
t);var e=Bu(t),n=[];for(var r in t)r=="constructor"&&(e||!jO.call(t,r))||n.push(r);return n}function
|
|
179
|
+
t);var e=Bu(t),n=[];for(var r in t)r=="constructor"&&(e||!jO.call(t,r))||n.push(r);return n}function vg(t){return Wr(t)?z0(t,!0):GO(t)}var UO=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,WO=/^\w*$/;function wg(t,e){if(Je(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||Lu(t)?!0:WO.test(t)||!UO.test(t)||e!=null&&t in Object(e)}var Gu=Ms(Object,"create");function zO(){this.__data__=Gu?Gu(null):{},this.size=0}function HO(t){var e=this.has(t)&&delete this.__data__[t];
|
|
180
180
|
return this.size-=e?1:0,e}var KO="__lodash_hash_undefined__",VO=Object.prototype,XO=VO.hasOwnProperty;function YO(t){var e=this.__data__;if(Gu){var n=e[t];return n===KO?void 0:n}return XO.call(e,t)?e[t]:void 0}var JO=Object.prototype,QO=JO.hasOwnProperty;function ZO(t){var e=this.__data__;return Gu?e[t]!==void 0:QO.call(e,t)}var eL="__lodash_hash_undefined__";function tL(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Gu&&e===void 0?eL:e,this}function Bs(t){var e=-1,n=t==null?0:t.
|
|
181
181
|
length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}Bs.prototype.clear=zO,Bs.prototype.delete=HO,Bs.prototype.get=YO,Bs.prototype.has=ZO,Bs.prototype.set=tL;function nL(){this.__data__=[],this.size=0}function xf(t,e){for(var n=t.length;n--;)if(Fu(t[n][0],e))return n;return-1}var rL=Array.prototype,iL=rL.splice;function sL(t){var e=this.__data__,n=xf(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():iL.call(e,n,1),--this.size,!0}function oL(t){var e=this.__data__,n=xf(e,t);return n<
|
|
182
182
|
0?void 0:e[n][1]}function aL(t){return xf(this.__data__,t)>-1}function uL(t,e){var n=this.__data__,r=xf(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}function fi(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}fi.prototype.clear=nL,fi.prototype.delete=sL,fi.prototype.get=oL,fi.prototype.has=aL,fi.prototype.set=uL;var Uu=Ms(Ur,"Map");function cL(){this.size=0,this.__data__={hash:new Bs,map:new(Uu||fi),string:new Bs}}function lL(t){var e=typeof t;
|
|
183
183
|
return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function Pf(t,e){var n=t.__data__;return lL(e)?n[typeof e=="string"?"string":"hash"]:n.map}function dL(t){var e=Pf(this,t).delete(t);return this.size-=e?1:0,e}function fL(t){return Pf(this,t).get(t)}function pL(t){return Pf(this,t).has(t)}function hL(t,e){var n=Pf(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}function pi(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.
|
|
184
|
-
set(r[0],r[1])}}pi.prototype.clear=cL,pi.prototype.delete=dL,pi.prototype.get=fL,pi.prototype.has=pL,pi.prototype.set=hL;var mL="Expected a function";function
|
|
185
|
-
size===gL&&n.clear(),r}),n=e.cache;return e}var vL=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,wL=/\\(\\)?/g,bL=yL(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(vL,function(n,r,i,s){e.push(i?s.replace(wL,"$1"):r||n)}),e});function EL(t){return t==null?"":A0(t)}function Nf(t,e){return Je(t)?t:
|
|
186
|
-
e=Nf(e,t);for(var n=0,r=e.length;t!=null&&n<r;)t=t[Wu(e[n++])];return n&&n==r?t:void 0}function $L(t,e,n){var r=t==null?void 0:
|
|
187
|
-
|
|
188
|
-
has(t)}var SL=200;function _L(t,e){var n=this.__data__;if(n instanceof fi){var r=n.__data__;if(!Uu||r.length<SL-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new pi(r)}return n.set(t,e),this.size=n.size,this}function zr(t){var e=this.__data__=new fi(t);this.size=e.size}zr.prototype.clear=kL,zr.prototype.delete=TL,zr.prototype.get=CL,zr.prototype.has=AL,zr.prototype.set=_L;function xL(t,e){return t&&Mu(e,cr(e),t)}function PL(t,e){return t&&Mu(e,
|
|
189
|
-
ject"&&exports&&!exports.nodeType&&exports,Q0=J0&&typeof module=="object"&&module&&!module.nodeType&&module,NL=Q0&&Q0.exports===J0,Z0=NL?Ur.Buffer:void 0,eE=Z0?Z0.allocUnsafe:void 0;function IL(t,e){var n=t.length,r=eE?eE(n):new t.constructor(n);return t.copy(r),r}function
|
|
190
|
-
null?[]:(t=Object(t),
|
|
191
|
-
bject Set]",uE="[object WeakMap]",cE="[object DataView]",GL=Fs(
|
|
184
|
+
set(r[0],r[1])}}pi.prototype.clear=cL,pi.prototype.delete=dL,pi.prototype.get=fL,pi.prototype.has=pL,pi.prototype.set=hL;var mL="Expected a function";function bg(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(mL);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],s=n.cache;if(s.has(i))return s.get(i);var o=t.apply(this,r);return n.cache=s.set(i,o)||s,o};return n.cache=new(bg.Cache||pi),n}bg.Cache=pi;var gL=500;function yL(t){var e=bg(t,function(r){return n.
|
|
185
|
+
size===gL&&n.clear(),r}),n=e.cache;return e}var vL=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,wL=/\\(\\)?/g,bL=yL(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(vL,function(n,r,i,s){e.push(i?s.replace(wL,"$1"):r||n)}),e});function EL(t){return t==null?"":A0(t)}function Nf(t,e){return Je(t)?t:wg(t,e)?[t]:bL(EL(t))}function Wu(t){if(typeof t=="string"||Lu(t))return t;var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function Eg(t,e){
|
|
186
|
+
e=Nf(e,t);for(var n=0,r=e.length;t!=null&&n<r;)t=t[Wu(e[n++])];return n&&n==r?t:void 0}function $L(t,e,n){var r=t==null?void 0:Eg(t,e);return r===void 0?n:r}function $g(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}var V0=ar?ar.isConcatSpreadable:void 0;function RL(t){return Je(t)||Sf(t)||!!(V0&&t&&t[V0])}function Rg(t,e,n,r,i){var s=-1,o=t.length;for(n||(n=RL),i||(i=[]);++s<o;){var a=t[s];n(a)?$g(i,a):r||(i[i.length]=a)}return i}function lr(t){var e=t==null?0:t.length;return e?
|
|
187
|
+
Rg(t):[]}var X0=H0(Object.getPrototypeOf,Object);function Y0(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),n=n>i?i:n,n<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var s=Array(i);++r<i;)s[r]=t[r+e];return s}function DL(t,e,n,r){var i=-1,s=t==null?0:t.length;for(r&&s&&(n=t[++i]);++i<s;)n=e(n,t[i],i,t);return n}function kL(){this.__data__=new fi,this.size=0}function TL(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}function CL(t){return this.__data__.get(t)}function AL(t){return this.__data__.
|
|
188
|
+
has(t)}var SL=200;function _L(t,e){var n=this.__data__;if(n instanceof fi){var r=n.__data__;if(!Uu||r.length<SL-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new pi(r)}return n.set(t,e),this.size=n.size,this}function zr(t){var e=this.__data__=new fi(t);this.size=e.size}zr.prototype.clear=kL,zr.prototype.delete=TL,zr.prototype.get=CL,zr.prototype.has=AL,zr.prototype.set=_L;function xL(t,e){return t&&Mu(e,cr(e),t)}function PL(t,e){return t&&Mu(e,vg(e),t)}var J0=typeof exports=="ob\
|
|
189
|
+
ject"&&exports&&!exports.nodeType&&exports,Q0=J0&&typeof module=="object"&&module&&!module.nodeType&&module,NL=Q0&&Q0.exports===J0,Z0=NL?Ur.Buffer:void 0,eE=Z0?Z0.allocUnsafe:void 0;function IL(t,e){var n=t.length,r=eE?eE(n):new t.constructor(n);return t.copy(r),r}function Dg(t,e){for(var n=-1,r=t==null?0:t.length,i=0,s=[];++n<r;){var o=t[n];e(o,n,t)&&(s[i++]=o)}return s}function tE(){return[]}var OL=Object.prototype,LL=OL.propertyIsEnumerable,nE=Object.getOwnPropertySymbols,kg=nE?function(t){return t==
|
|
190
|
+
null?[]:(t=Object(t),Dg(nE(t),function(e){return LL.call(t,e)}))}:tE;function FL(t,e){return Mu(t,kg(t),e)}var ML=Object.getOwnPropertySymbols,rE=ML?function(t){for(var e=[];t;)$g(e,kg(t)),t=X0(t);return e}:tE;function BL(t,e){return Mu(t,rE(t),e)}function iE(t,e,n){var r=e(t);return Je(t)?r:$g(r,n(t))}function Tg(t){return iE(t,cr,kg)}function qL(t){return iE(t,vg,rE)}var Cg=Ms(Ur,"DataView"),Ag=Ms(Ur,"Promise"),Xo=Ms(Ur,"Set"),sE="[object Map]",jL="[object Object]",oE="[object Promise]",aE="[o\
|
|
191
|
+
bject Set]",uE="[object WeakMap]",cE="[object DataView]",GL=Fs(Cg),UL=Fs(Uu),WL=Fs(Ag),zL=Fs(Xo),HL=Fs(dg),dr=Yi;(Cg&&dr(new Cg(new ArrayBuffer(1)))!=cE||Uu&&dr(new Uu)!=sE||Ag&&dr(Ag.resolve())!=oE||Xo&&dr(new Xo)!=aE||dg&&dr(new dg)!=uE)&&(dr=function(t){var e=Yi(t),n=e==jL?t.constructor:void 0,r=n?Fs(n):"";if(r)switch(r){case GL:return cE;case UL:return sE;case WL:return oE;case zL:return aE;case HL:return uE}return e});var KL=Object.prototype,VL=KL.hasOwnProperty;function XL(t){var e=t.length,
|
|
192
192
|
n=new t.constructor(e);return e&&typeof t[0]=="string"&&VL.call(t,"index")&&(n.index=t.index,n.input=t.input),n}var If=Ur.Uint8Array;function YL(t){var e=new t.constructor(t.byteLength);return new If(e).set(new If(t)),e}function JL(t,e){var n=t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}var QL=/\w*$/;function ZL(t){var e=new t.constructor(t.source,QL.exec(t));return e.lastIndex=t.lastIndex,e}var lE=ar?ar.prototype:void 0,dE=lE?lE.valueOf:void 0;function eF(t){return dE?Object(dE.
|
|
193
193
|
call(t)):{}}function tF(t,e){var n=t.buffer;return new t.constructor(n,t.byteOffset,t.length)}var nF="[object Boolean]",rF="[object Date]",iF="[object Map]",sF="[object Number]",oF="[object RegExp]",aF="[object Set]",uF="[object String]",cF="[object Symbol]",lF="[object ArrayBuffer]",dF="[object DataView]",fF="[object Float32Array]",pF="[object Float64Array]",hF="[object Int8Array]",mF="[object Int16Array]",gF="[object Int32Array]",yF="[object Uint8Array]",vF="[object Uint8ClampedArray]",wF="[ob\
|
|
194
194
|
ject Uint16Array]",bF="[object Uint32Array]";function EF(t,e,n){var r=t.constructor;switch(e){case lF:return YL(t);case nF:case rF:return new r(+t);case dF:return JL(t);case fF:case pF:case hF:case mF:case gF:case yF:case vF:case wF:case bF:return tF(t);case iF:return new r;case sF:case uF:return new r(t);case oF:return ZL(t);case aF:return new r;case cF:return eF(t)}}function $F(t){return typeof t.constructor=="function"&&!Bu(t)?NI(X0(t)):{}}var RF="[object Map]";function DF(t){return br(t)&&dr(
|
|
195
195
|
t)==RF}var fE=Ji&&Ji.isMap,kF=fE?_f(fE):DF,TF="[object Set]";function CF(t){return br(t)&&dr(t)==TF}var pE=Ji&&Ji.isSet,AF=pE?_f(pE):CF,SF=2,hE="[object Arguments]",_F="[object Array]",xF="[object Boolean]",PF="[object Date]",NF="[object Error]",mE="[object Function]",IF="[object GeneratorFunction]",OF="[object Map]",LF="[object Number]",gE="[object Object]",FF="[object RegExp]",MF="[object Set]",BF="[object String]",qF="[object Symbol]",jF="[object WeakMap]",GF="[object ArrayBuffer]",UF="[objec\
|
|
196
196
|
t DataView]",WF="[object Float32Array]",zF="[object Float64Array]",HF="[object Int8Array]",KF="[object Int16Array]",VF="[object Int32Array]",XF="[object Uint8Array]",YF="[object Uint8ClampedArray]",JF="[object Uint16Array]",QF="[object Uint32Array]",gt={};gt[hE]=gt[_F]=gt[GF]=gt[UF]=gt[xF]=gt[PF]=gt[WF]=gt[zF]=gt[HF]=gt[KF]=gt[VF]=gt[OF]=gt[LF]=gt[gE]=gt[FF]=gt[MF]=gt[BF]=gt[qF]=gt[XF]=gt[YF]=gt[JF]=gt[QF]=!0,gt[NF]=gt[mE]=gt[jF]=!1;function Of(t,e,n,r,i,s){var o,a=e&SF;if(o!==void 0)return o;if(!ur(
|
|
197
|
-
t))return t;var u=Je(t);if(u)return o=XL(t),OI(t,o);var c=dr(t),l=c==mE||c==IF;if(qu(t))return IL(t);if(c==gE||c==hE||l&&!i)return o=l?{}:$F(t),a?BL(t,PL(o,t)):FL(t,xL(o,t));if(!gt[c])return i?t:{};o=EF(t,c),s||(s=new zr);var f=s.get(t);if(f)return f;s.set(t,o),AF(t)?t.forEach(function(m){o.add(Of(m,e,n,m,t,s))}):kF(t)&&t.forEach(function(m,w){o.set(w,Of(m,e,n,w,t,s))});var d=
|
|
198
|
-
t,ZF)}function zu(t){for(var e=-1,n=t==null?0:t.length,r=0,i=[];++e<n;){var s=t[e];s&&(i[r++]=s)}return i}var eM="__lodash_hash_undefined__";function tM(t){return this.__data__.set(t,eM),this}function nM(t){return this.__data__.has(t)}function Yo(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new pi;++e<n;)this.add(t[e])}Yo.prototype.add=Yo.prototype.push=tM,Yo.prototype.has=nM;function yE(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}function
|
|
199
|
-
has(e)}var rM=1,iM=2;function vE(t,e,n,r,i,s){var o=n&rM,a=t.length,u=e.length;if(a!=u&&!(o&&u>a))return!1;var c=s.get(t),l=s.get(e);if(c&&l)return c==e&&l==t;var f=-1,d=!0,p=n&iM?new Yo:void 0;for(s.set(t,e),s.set(e,t);++f<a;){var m=t[f],w=e[f];if(r)var y=o?r(w,m,f,e,t,s):r(m,w,f,t,e,s);if(y!==void 0){if(y)continue;d=!1;break}if(p){if(!yE(e,function(g,b){if(!
|
|
200
|
-
d}function sM(t){var e=-1,n=Array(t.size);return t.forEach(function(r,i){n[++e]=[i,r]}),n}function
|
|
201
|
-
if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case yM:return!(t.byteLength!=e.byteLength||!s(new If(t),new If(e)));case uM:case cM:case fM:return Fu(+t,+e);case lM:return t.name==e.name&&t.message==e.message;case pM:case mM:return t==e+"";case dM:var a=sM;case hM:var u=r&oM;if(a||(a=
|
|
202
|
-
return!1}var bM=1,EM=Object.prototype,$M=EM.hasOwnProperty;function RM(t,e,n,r,i,s){var o=n&bM,a=
|
|
203
|
-
constructor;A!=N&&"constructor"in t&&"constructor"in e&&!(typeof A=="function"&&A instanceof A&&typeof N=="function"&&N instanceof N)&&(w=!1)}return s.delete(t),s.delete(e),w}var DM=1,bE="[object Arguments]",EE="[object Array]",Lf="[object Object]",kM=Object.prototype,$E=kM.hasOwnProperty;function TM(t,e,n,r,i,s){var o=Je(t),a=Je(e),u=o?EE:dr(t),c=a?EE:dr(e);u=u==bE?Lf:u,c=c==bE?Lf:c;var l=u==Lf,f=c==Lf,d=u==c;if(d&&qu(t)){if(!qu(e))return!1;o=!0,l=!1}if(d&&!l)return s||(s=new zr),o||
|
|
204
|
-
e,n,r,i,s):wM(t,e,u,n,r,i,s);if(!(n&DM)){var p=l&&$E.call(t,"__wrapped__"),m=f&&$E.call(e,"__wrapped__");if(p||m){var w=p?t.value():t,y=m?e.value():e;return s||(s=new zr),i(w,y,n,r,s)}}return d?(s||(s=new zr),RM(t,e,n,r,i,s)):!1}function
|
|
205
|
-
var a=o[0],u=t[a],c=o[1];if(o[2]){if(u===void 0&&!(a in t))return!1}else{var l=new zr,f;if(!(f===void 0?
|
|
206
|
-
null&&e in Object(t)}function kE(t,e,n){e=Nf(e,t);for(var r=-1,i=e.length,s=!1;++r<i;){var o=Wu(e[r]);if(!(s=t!=null&&n(t,o)))break;t=t[o]}return s||++r!=i?s:(i=t==null?0:t.length,!!i&&
|
|
207
|
-
return
|
|
208
|
-
for(var i=n.length,s=-1,o=Object(n);++s<i&&r(o[s],s,o)!==!1;);return n}}var qs=WM(UM);function zM(t,e,n,r){return qs(t,function(i,s,o){e(r,i,n(i),o)}),r}function HM(t,e){return function(n,r){var i=Je(n)?qM:zM,s=e?e():{};return i(n,t,Er(r),s)}}var TE=Object.prototype,KM=TE.hasOwnProperty,
|
|
209
|
-
(t[c]=s[c])}return t});function CE(t){return br(t)&&Wr(t)}var VM=200;function XM(t,e,n,r){var i=-1,s=O0,o=!0,a=t.length,u=[],c=e.length;if(!a)return u;e.length>=VM&&(s=
|
|
197
|
+
t))return t;var u=Je(t);if(u)return o=XL(t),OI(t,o);var c=dr(t),l=c==mE||c==IF;if(qu(t))return IL(t);if(c==gE||c==hE||l&&!i)return o=l?{}:$F(t),a?BL(t,PL(o,t)):FL(t,xL(o,t));if(!gt[c])return i?t:{};o=EF(t,c),s||(s=new zr);var f=s.get(t);if(f)return f;s.set(t,o),AF(t)?t.forEach(function(m){o.add(Of(m,e,n,m,t,s))}):kF(t)&&t.forEach(function(m,w){o.set(w,Of(m,e,n,w,t,s))});var d=Tg,p=u?void 0:d(t);return N0(p||t,function(m,w){p&&(w=m,m=t[w]),Af(o,w,Of(m,e,n,w,t,s))}),o}var ZF=4;function nn(t){return Of(
|
|
198
|
+
t,ZF)}function zu(t){for(var e=-1,n=t==null?0:t.length,r=0,i=[];++e<n;){var s=t[e];s&&(i[r++]=s)}return i}var eM="__lodash_hash_undefined__";function tM(t){return this.__data__.set(t,eM),this}function nM(t){return this.__data__.has(t)}function Yo(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new pi;++e<n;)this.add(t[e])}Yo.prototype.add=Yo.prototype.push=tM,Yo.prototype.has=nM;function yE(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}function Sg(t,e){return t.
|
|
199
|
+
has(e)}var rM=1,iM=2;function vE(t,e,n,r,i,s){var o=n&rM,a=t.length,u=e.length;if(a!=u&&!(o&&u>a))return!1;var c=s.get(t),l=s.get(e);if(c&&l)return c==e&&l==t;var f=-1,d=!0,p=n&iM?new Yo:void 0;for(s.set(t,e),s.set(e,t);++f<a;){var m=t[f],w=e[f];if(r)var y=o?r(w,m,f,e,t,s):r(m,w,f,t,e,s);if(y!==void 0){if(y)continue;d=!1;break}if(p){if(!yE(e,function(g,b){if(!Sg(p,b)&&(m===g||i(m,g,n,r,s)))return p.push(b)})){d=!1;break}}else if(!(m===w||i(m,w,n,r,s))){d=!1;break}}return s.delete(t),s.delete(e),
|
|
200
|
+
d}function sM(t){var e=-1,n=Array(t.size);return t.forEach(function(r,i){n[++e]=[i,r]}),n}function _g(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}var oM=1,aM=2,uM="[object Boolean]",cM="[object Date]",lM="[object Error]",dM="[object Map]",fM="[object Number]",pM="[object RegExp]",hM="[object Set]",mM="[object String]",gM="[object Symbol]",yM="[object ArrayBuffer]",vM="[object DataView]",wE=ar?ar.prototype:void 0,xg=wE?wE.valueOf:void 0;function wM(t,e,n,r,i,s,o){switch(n){case vM:
|
|
201
|
+
if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case yM:return!(t.byteLength!=e.byteLength||!s(new If(t),new If(e)));case uM:case cM:case fM:return Fu(+t,+e);case lM:return t.name==e.name&&t.message==e.message;case pM:case mM:return t==e+"";case dM:var a=sM;case hM:var u=r&oM;if(a||(a=_g),t.size!=e.size&&!u)return!1;var c=o.get(t);if(c)return c==e;r|=aM,o.set(t,e);var l=vE(a(t),a(e),r,i,s,o);return o.delete(t),l;case gM:if(xg)return xg.call(t)==xg.call(e)}
|
|
202
|
+
return!1}var bM=1,EM=Object.prototype,$M=EM.hasOwnProperty;function RM(t,e,n,r,i,s){var o=n&bM,a=Tg(t),u=a.length,c=Tg(e),l=c.length;if(u!=l&&!o)return!1;for(var f=u;f--;){var d=a[f];if(!(o?d in e:$M.call(e,d)))return!1}var p=s.get(t),m=s.get(e);if(p&&m)return p==e&&m==t;var w=!0;s.set(t,e),s.set(e,t);for(var y=o;++f<u;){d=a[f];var g=t[d],b=e[d];if(r)var R=o?r(b,g,d,e,t,s):r(g,b,d,t,e,s);if(!(R===void 0?g===b||i(g,b,n,r,s):R)){w=!1;break}y||(y=d=="constructor")}if(w&&!y){var A=t.constructor,N=e.
|
|
203
|
+
constructor;A!=N&&"constructor"in t&&"constructor"in e&&!(typeof A=="function"&&A instanceof A&&typeof N=="function"&&N instanceof N)&&(w=!1)}return s.delete(t),s.delete(e),w}var DM=1,bE="[object Arguments]",EE="[object Array]",Lf="[object Object]",kM=Object.prototype,$E=kM.hasOwnProperty;function TM(t,e,n,r,i,s){var o=Je(t),a=Je(e),u=o?EE:dr(t),c=a?EE:dr(e);u=u==bE?Lf:u,c=c==bE?Lf:c;var l=u==Lf,f=c==Lf,d=u==c;if(d&&qu(t)){if(!qu(e))return!1;o=!0,l=!1}if(d&&!l)return s||(s=new zr),o||yg(t)?vE(t,
|
|
204
|
+
e,n,r,i,s):wM(t,e,u,n,r,i,s);if(!(n&DM)){var p=l&&$E.call(t,"__wrapped__"),m=f&&$E.call(e,"__wrapped__");if(p||m){var w=p?t.value():t,y=m?e.value():e;return s||(s=new zr),i(w,y,n,r,s)}}return d?(s||(s=new zr),RM(t,e,n,r,i,s)):!1}function Pg(t,e,n,r,i){return t===e?!0:t==null||e==null||!br(t)&&!br(e)?t!==t&&e!==e:TM(t,e,n,r,Pg,i)}var CM=1,AM=2;function SM(t,e,n,r){var i=n.length,s=i;if(t==null)return!s;for(t=Object(t);i--;){var o=n[i];if(o[2]?o[1]!==t[o[0]]:!(o[0]in t))return!1}for(;++i<s;){o=n[i];
|
|
205
|
+
var a=o[0],u=t[a],c=o[1];if(o[2]){if(u===void 0&&!(a in t))return!1}else{var l=new zr,f;if(!(f===void 0?Pg(c,u,CM|AM,r,l):f))return!1}}return!0}function RE(t){return t===t&&!ur(t)}function _M(t){for(var e=cr(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,RE(i)]}return e}function DE(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}function xM(t){var e=_M(t);return e.length==1&&e[0][2]?DE(e[0][0],e[0][1]):function(n){return n===t||SM(n,t,e)}}function PM(t,e){return t!=
|
|
206
|
+
null&&e in Object(t)}function kE(t,e,n){e=Nf(e,t);for(var r=-1,i=e.length,s=!1;++r<i;){var o=Wu(e[r]);if(!(s=t!=null&&n(t,o)))break;t=t[o]}return s||++r!=i?s:(i=t==null?0:t.length,!!i&&mg(i)&&Cf(o,i)&&(Je(t)||Sf(t)))}function NM(t,e){return t!=null&&kE(t,e,PM)}var IM=1,OM=2;function LM(t,e){return wg(t)&&RE(e)?DE(Wu(t),e):function(n){var r=$L(n,t);return r===void 0&&r===e?NM(n,t):Pg(e,r,IM|OM)}}function FM(t){return function(e){return e?.[t]}}function MM(t){return function(e){return Eg(e,t)}}function BM(t){
|
|
207
|
+
return wg(t)?FM(Wu(t)):MM(t)}function Er(t){return typeof t=="function"?t:t==null?Ls:typeof t=="object"?Je(t)?LM(t[0],t[1]):xM(t):BM(t)}function qM(t,e,n,r){for(var i=-1,s=t==null?0:t.length;++i<s;){var o=t[i];e(r,o,n(o),t)}return r}function jM(t){return function(e,n,r){for(var i=-1,s=Object(e),o=r(e),a=o.length;a--;){var u=o[++i];if(n(s[u],u,s)===!1)break}return e}}var GM=jM();function UM(t,e){return t&&GM(t,e,cr)}function WM(t,e){return function(n,r){if(n==null)return n;if(!Wr(n))return t(n,r);
|
|
208
|
+
for(var i=n.length,s=-1,o=Object(n);++s<i&&r(o[s],s,o)!==!1;);return n}}var qs=WM(UM);function zM(t,e,n,r){return qs(t,function(i,s,o){e(r,i,n(i),o)}),r}function HM(t,e){return function(n,r){var i=Je(n)?qM:zM,s=e?e():{};return i(n,t,Er(r),s)}}var TE=Object.prototype,KM=TE.hasOwnProperty,Ng=hg(function(t,e){t=Object(t);var n=-1,r=e.length,i=r>2?e[2]:void 0;for(i&&F0(e[0],e[1],i)&&(r=1);++n<r;)for(var s=e[n],o=vg(s),a=-1,u=o.length;++a<u;){var c=o[a],l=t[c];(l===void 0||Fu(l,TE[c])&&!KM.call(t,c))&&
|
|
209
|
+
(t[c]=s[c])}return t});function CE(t){return br(t)&&Wr(t)}var VM=200;function XM(t,e,n,r){var i=-1,s=O0,o=!0,a=t.length,u=[],c=e.length;if(!a)return u;e.length>=VM&&(s=Sg,o=!1,e=new Yo(e));e:for(;++i<a;){var l=t[i],f=l;if(l=l!==0?l:0,o&&f===f){for(var d=c;d--;)if(e[d]===f)continue e;u.push(l)}else s(e,f,r)||u.push(l)}return u}var Ff=hg(function(t,e){return CE(t)?XM(t,Rg(e,1,CE,!0)):[]});function Jo(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}function rn(t,e,n){var r=t==null?0:t.length;return r?
|
|
210
210
|
(e=e===void 0?1:kf(e),Y0(t,e<0?0:e,r)):[]}function Hu(t,e,n){var r=t==null?0:t.length;return r?(e=e===void 0?1:kf(e),e=r-e,Y0(t,0,e<0?0:e)):[]}function YM(t){return typeof t=="function"?t:Ls}function ke(t,e){var n=Je(t)?N0:qs;return n(t,YM(e))}function JM(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function QM(t,e){var n=!0;return qs(t,function(r,i,s){return n=!!e(r,i,s),n}),n}function $r(t,e,n){var r=Je(t)?JM:QM;return r(t,Er(e))}function AE(t,e){var n=[];return qs(
|
|
211
|
-
t,function(r,i,s){e(r,i,s)&&n.push(r)}),n}function Kn(t,e){var n=Je(t)?
|
|
212
|
-
length):[];return qs(t,function(i,s,o){r[++n]=e(i,s,o)}),r}function ve(t,e){var n=Je(t)?Df:n2;return n(t,Er(e))}function Vn(t,e){return
|
|
213
|
-
e,function(n){return t[n]})}function Wt(t){return t==null?[]:l2(t,cr(t))}var d2=Math.max;function wn(t,e,n,r){t=Wr(t)?t:Wt(t),n=n?kf(n):0;var i=t.length;return n<0&&(n=d2(i+n,0)),
|
|
214
|
-
|
|
211
|
+
t,function(r,i,s){e(r,i,s)&&n.push(r)}),n}function Kn(t,e){var n=Je(t)?Dg:AE;return n(t,Er(e))}function ZM(t){return function(e,n,r){var i=Object(e);if(!Wr(e)){var s=Er(n);e=cr(e),n=function(a){return s(i[a],a,i)}}var o=t(e,n,r);return o>-1?i[s?e[o]:o]:void 0}}var e2=Math.max;function t2(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var i=n==null?0:kf(n);return i<0&&(i=e2(r+i,0)),I0(t,Er(e),i)}var Qo=ZM(t2);function Rr(t){return t&&t.length?t[0]:void 0}function n2(t,e){var n=-1,r=Wr(t)?Array(t.
|
|
212
|
+
length):[];return qs(t,function(i,s,o){r[++n]=e(i,s,o)}),r}function ve(t,e){var n=Je(t)?Df:n2;return n(t,Er(e))}function Vn(t,e){return Rg(ve(t,e))}var r2=Object.prototype,i2=r2.hasOwnProperty,s2=HM(function(t,e,n){i2.call(t,n)?t[n].push(e):pg(t,n,[e])}),o2=Object.prototype,a2=o2.hasOwnProperty;function u2(t,e){return t!=null&&a2.call(t,e)}function Te(t,e){return t!=null&&kE(t,e,u2)}var c2="[object String]";function Nn(t){return typeof t=="string"||!Je(t)&&br(t)&&Yi(t)==c2}function l2(t,e){return Df(
|
|
213
|
+
e,function(n){return t[n]})}function Wt(t){return t==null?[]:l2(t,cr(t))}var d2=Math.max;function wn(t,e,n,r){t=Wr(t)?t:Wt(t),n=n?kf(n):0;var i=t.length;return n<0&&(n=d2(i+n,0)),Nn(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&fg(t,e,n)>-1}function SE(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var i=0;return fg(t,e,i)}var f2="[object Map]",p2="[object Set]",h2=Object.prototype,m2=h2.hasOwnProperty;function ht(t){if(t==null)return!0;if(Wr(t)&&(Je(t)||typeof t=="string"||typeof t.splice=="function"||qu(t)||
|
|
214
|
+
yg(t)||Sf(t)))return!t.length;var e=dr(t);if(e==f2||e==p2)return!t.size;if(Bu(t))return!K0(t).length;for(var n in t)if(m2.call(t,n))return!1;return!0}var g2="[object RegExp]";function y2(t){return br(t)&&Yi(t)==g2}var _E=Ji&&Ji.isRegExp,hi=_E?_f(_E):y2;function mi(t){return t===void 0}function v2(t,e){return t<e}function w2(t,e,n){for(var r=-1,i=t.length;++r<i;){var s=t[r],o=e(s);if(o!=null&&(a===void 0?o===o&&!Lu(o):n(o,a)))var a=o,u=s}return u}function b2(t){return t&&t.length?w2(t,Ls,v2):void 0}
|
|
215
215
|
var E2="Expected a function";function $2(t){if(typeof t!="function")throw new TypeError(E2);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 R2(t,e,n,r){if(!ur(t))return t;e=Nf(e,t);for(var i=-1,s=e.length,o=s-1,a=t;a!=null&&++i<s;){var u=Wu(e[i]),c=n;if(u==="__proto__"||u==="constructor"||u==="prototype")return t;if(i!=o){var l=a[u];
|
|
216
|
-
c=void 0,c===void 0&&(c=ur(l)?l:Cf(e[i+1])?[]:{})}Af(a,u,c),a=a[u]}return t}function D2(t,e,n){for(var r=-1,i=e.length,s={};++r<i;){var o=e[r],a=
|
|
217
|
-
t)?
|
|
218
|
-
push(f),a.push(l)}else i(u,f,n)||(u!==a&&u.push(f),a.push(l))}return a}function
|
|
219
|
-
t}function x2(t){return P2(t)?t.LABEL:t.name}function P2(t){return
|
|
220
|
-
super(e.definition),this.orgText="",Hn(this,Dr(e,n=>n!==void 0))}}class
|
|
221
|
-
super(e.definition),this.idx=1,Hn(this,Dr(e,n=>n!==void 0))}}class
|
|
222
|
-
function e(n){return ve(n,Bf)}if(t instanceof En){const n={type:"NonTerminal",name:t.nonTerminalName,idx:t.idx};return
|
|
223
|
-
separator})),definition:e(t.definition)};if(t instanceof
|
|
224
|
-
terminalType.PATTERN;return t.terminalType.PATTERN&&(n.pattern=hi(r)?r.source:r),n}else{if(t instanceof Zo)return{type:"Rule",name:t.name,orgText:t.orgText,definition:e(t.definition)};throw Error("non exhaustive match")}}}class ea{visit(e){const n=e;switch(n.constructor){case En:return this.visitNonTerminal(n);case
|
|
225
|
-
return this.visitRepetitionWithSeparator(n);case Pt:return this.visitRepetition(n);case
|
|
226
|
-
|
|
227
|
-
if(t instanceof Xn)return"AT_LEAST_ONE";if(t instanceof Yn)return"AT_LEAST_ONE_SEP";if(t instanceof
|
|
228
|
-
Xn)this.walkAtLeastOne(r,s,n);else if(r instanceof Yn)this.walkAtLeastOneSep(r,s,n);else if(r instanceof
|
|
229
|
-
const i=LE(e,n,r);this.walk(e,i)}walkMany(e,n,r){const i=[new sn({definition:e.definition})].concat(n,r);this.walk(e,i)}walkManySep(e,n,r){const i=LE(e,n,r);this.walk(e,i)}walkOr(e,n,r){const i=n.concat(r);ke(e.definition,s=>{const o=new
|
|
230
|
-
t);if(O2(t))return F2(t);throw Error("non exhaustive match")}function L2(t){let e=[];const n=t.definition;let r=0,i=n.length>r,s,o=!0;for(;i&&o;)s=n[r],o=qf(s),e=e.concat(Ku(s)),r=r+1,i=n.length>r;return
|
|
231
|
-
const i=j2(e.referencedRule,e.idx)+this.topProd.name,s=n.concat(r),o=new
|
|
216
|
+
c=void 0,c===void 0&&(c=ur(l)?l:Cf(e[i+1])?[]:{})}Af(a,u,c),a=a[u]}return t}function D2(t,e,n){for(var r=-1,i=e.length,s={};++r<i;){var o=e[r],a=Eg(t,o);n(a,o)&&R2(s,Nf(o,t),a)}return s}function Dr(t,e){if(t==null)return{};var n=Df(qL(t),function(r){return[r]});return e=Er(e),D2(t,n,function(r,i){return e(r,i[0])})}function k2(t,e,n,r,i){return i(t,function(s,o,a){n=r?(r=!1,s):e(n,s,o,a)}),n}function bn(t,e,n){var r=Je(t)?DL:k2,i=arguments.length<3;return r(t,Er(e),n,i,qs)}function Mf(t,e){var n=Je(
|
|
217
|
+
t)?Dg:AE;return n(t,$2(Er(e)))}function T2(t,e){var n;return qs(t,function(r,i,s){return n=e(r,i,s),!n}),!!n}function xE(t,e,n){var r=Je(t)?yE:T2;return r(t,Er(e))}var C2=1/0,A2=Xo&&1/_g(new Xo([,-0]))[1]==C2?function(t){return new Xo(t)}:Ut,S2=200;function PE(t,e,n){var r=-1,i=O0,s=t.length,o=!0,a=[],u=a;if(s>=S2){var c=e?null:A2(t);if(c)return _g(c);o=!1,i=Sg,u=new Yo}else u=e?[]:a;e:for(;++r<s;){var l=t[r],f=e?e(l):l;if(l=l!==0?l:0,o&&f===f){for(var d=u.length;d--;)if(u[d]===f)continue e;e&&u.
|
|
218
|
+
push(f),a.push(l)}else i(u,f,n)||(u!==a&&u.push(f),a.push(l))}return a}function Ig(t){return t&&t.length?PE(t):[]}function _2(t,e){return t&&t.length?PE(t,Er(e)):[]}function Og(t){console&&console.error&&console.error(`Error: ${t}`)}function NE(t){console&&console.warn&&console.warn(`Warning: ${t}`)}function IE(t){const e=new Date().getTime(),n=t();return{time:new Date().getTime()-e,value:n}}function OE(t){function e(){}e.prototype=t;const n=new e;function r(){return typeof n.bar}return r(),r(),
|
|
219
|
+
t}function x2(t){return P2(t)?t.LABEL:t.name}function P2(t){return Nn(t.LABEL)&&t.LABEL!==""}class Hr{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),ke(this.definition,n=>{n.accept(e)})}}class En extends Hr{constructor(e){super([]),this.idx=1,Hn(this,Dr(e,n=>n!==void 0))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}}class Zo extends Hr{constructor(e){
|
|
220
|
+
super(e.definition),this.orgText="",Hn(this,Dr(e,n=>n!==void 0))}}class In extends Hr{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,Hn(this,Dr(e,n=>n!==void 0))}}class sn extends Hr{constructor(e){super(e.definition),this.idx=1,Hn(this,Dr(e,n=>n!==void 0))}}class Xn extends Hr{constructor(e){super(e.definition),this.idx=1,Hn(this,Dr(e,n=>n!==void 0))}}class Yn extends Hr{constructor(e){super(e.definition),this.idx=1,Hn(this,Dr(e,n=>n!==void 0))}}class Pt extends Hr{constructor(e){
|
|
221
|
+
super(e.definition),this.idx=1,Hn(this,Dr(e,n=>n!==void 0))}}class On extends Hr{constructor(e){super(e.definition),this.idx=1,Hn(this,Dr(e,n=>n!==void 0))}}class Ln extends Hr{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,Hn(this,Dr(e,n=>n!==void 0))}}class wt{constructor(e){this.idx=1,Hn(this,Dr(e,n=>n!==void 0))}accept(e){e.visit(this)}}function N2(t){return ve(t,Bf)}function Bf(t){
|
|
222
|
+
function e(n){return ve(n,Bf)}if(t instanceof En){const n={type:"NonTerminal",name:t.nonTerminalName,idx:t.idx};return Nn(t.label)&&(n.label=t.label),n}else{if(t instanceof In)return{type:"Alternative",definition:e(t.definition)};if(t instanceof sn)return{type:"Option",idx:t.idx,definition:e(t.definition)};if(t instanceof Xn)return{type:"RepetitionMandatory",idx:t.idx,definition:e(t.definition)};if(t instanceof Yn)return{type:"RepetitionMandatoryWithSeparator",idx:t.idx,separator:Bf(new wt({terminalType:t.
|
|
223
|
+
separator})),definition:e(t.definition)};if(t instanceof On)return{type:"RepetitionWithSeparator",idx:t.idx,separator:Bf(new wt({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof Pt)return{type:"Repetition",idx:t.idx,definition:e(t.definition)};if(t instanceof Ln)return{type:"Alternation",idx:t.idx,definition:e(t.definition)};if(t instanceof wt){const n={type:"Terminal",name:t.terminalType.name,label:x2(t.terminalType),idx:t.idx};Nn(t.label)&&(n.terminalLabel=t.label);const r=t.
|
|
224
|
+
terminalType.PATTERN;return t.terminalType.PATTERN&&(n.pattern=hi(r)?r.source:r),n}else{if(t instanceof Zo)return{type:"Rule",name:t.name,orgText:t.orgText,definition:e(t.definition)};throw Error("non exhaustive match")}}}class ea{visit(e){const n=e;switch(n.constructor){case En:return this.visitNonTerminal(n);case In:return this.visitAlternative(n);case sn:return this.visitOption(n);case Xn:return this.visitRepetitionMandatory(n);case Yn:return this.visitRepetitionMandatoryWithSeparator(n);case On:
|
|
225
|
+
return this.visitRepetitionWithSeparator(n);case Pt:return this.visitRepetition(n);case Ln:return this.visitAlternation(n);case wt:return this.visitTerminal(n);case Zo: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 I2(t){return t instanceof
|
|
226
|
+
In||t instanceof sn||t instanceof Pt||t instanceof Xn||t instanceof Yn||t instanceof On||t instanceof wt||t instanceof Zo}function qf(t,e=[]){return t instanceof sn||t instanceof Pt||t instanceof On?!0:t instanceof Ln?xE(t.definition,r=>qf(r,e)):t instanceof En&&wn(e,t)?!1:t instanceof Hr?(t instanceof En&&e.push(t),$r(t.definition,r=>qf(r,e))):!1}function O2(t){return t instanceof Ln}function Kr(t){if(t instanceof En)return"SUBRULE";if(t instanceof sn)return"OPTION";if(t instanceof Ln)return"OR";
|
|
227
|
+
if(t instanceof Xn)return"AT_LEAST_ONE";if(t instanceof Yn)return"AT_LEAST_ONE_SEP";if(t instanceof On)return"MANY_SEP";if(t instanceof Pt)return"MANY";if(t instanceof wt)return"CONSUME";throw Error("non exhaustive match")}class jf{walk(e,n=[]){ke(e.definition,(r,i)=>{const s=rn(e.definition,i+1);if(r instanceof En)this.walkProdRef(r,s,n);else if(r instanceof wt)this.walkTerminal(r,s,n);else if(r instanceof In)this.walkFlat(r,s,n);else if(r instanceof sn)this.walkOption(r,s,n);else if(r instanceof
|
|
228
|
+
Xn)this.walkAtLeastOne(r,s,n);else if(r instanceof Yn)this.walkAtLeastOneSep(r,s,n);else if(r instanceof On)this.walkManySep(r,s,n);else if(r instanceof Pt)this.walkMany(r,s,n);else if(r instanceof Ln)this.walkOr(r,s,n);else throw Error("non exhaustive match")})}walkTerminal(e,n,r){}walkProdRef(e,n,r){}walkFlat(e,n,r){const i=n.concat(r);this.walk(e,i)}walkOption(e,n,r){const i=n.concat(r);this.walk(e,i)}walkAtLeastOne(e,n,r){const i=[new sn({definition:e.definition})].concat(n,r);this.walk(e,i)}walkAtLeastOneSep(e,n,r){
|
|
229
|
+
const i=LE(e,n,r);this.walk(e,i)}walkMany(e,n,r){const i=[new sn({definition:e.definition})].concat(n,r);this.walk(e,i)}walkManySep(e,n,r){const i=LE(e,n,r);this.walk(e,i)}walkOr(e,n,r){const i=n.concat(r);ke(e.definition,s=>{const o=new In({definition:[s]});this.walk(o,i)})}}function LE(t,e,n){return[new sn({definition:[new wt({terminalType:t.separator})].concat(t.definition)})].concat(e,n)}function Ku(t){if(t instanceof En)return Ku(t.referencedRule);if(t instanceof wt)return M2(t);if(I2(t))return L2(
|
|
230
|
+
t);if(O2(t))return F2(t);throw Error("non exhaustive match")}function L2(t){let e=[];const n=t.definition;let r=0,i=n.length>r,s,o=!0;for(;i&&o;)s=n[r],o=qf(s),e=e.concat(Ku(s)),r=r+1,i=n.length>r;return Ig(e)}function F2(t){const e=ve(t.definition,n=>Ku(n));return Ig(lr(e))}function M2(t){return[t.terminalType]}const FE="_~IN~_";class B2 extends jf{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,n,r){}walkProdRef(e,n,r){
|
|
231
|
+
const i=j2(e.referencedRule,e.idx)+this.topProd.name,s=n.concat(r),o=new In({definition:s}),a=Ku(o);this.follows[i]=a}}function q2(t){const e={};return ke(t,n=>{const r=new B2(n).startWalking();Hn(e,r)}),e}function j2(t,e){return t.name+e+FE}let Gf={};const G2=new l0;function Uf(t){const e=t.toString();if(Gf.hasOwnProperty(e))return Gf[e];{const n=G2.pattern(e);return Gf[e]=n,n}}function U2(){Gf={}}const ME="Complement Sets are not supported for first char optimization",Wf=`Unable to use "first \
|
|
232
232
|
char" lexer optimizations:
|
|
233
|
-
`;function W2(t,e=!1){try{const n=Uf(t);return
|
|
233
|
+
`;function W2(t,e=!1){try{const n=Uf(t);return Lg(n.value,{},n.flags.ignoreCase)}catch(n){if(n.message===ME)e&&NE(`${Wf} Unable to optimize: < ${t.toString()} >
|
|
234
234
|
Complement Sets cannot be automatically optimized.
|
|
235
235
|
This will disable the lexer's first char optimizations.
|
|
236
236
|
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let r="";e&&(r=`
|
|
237
237
|
This will disable the lexer's first char optimizations.
|
|
238
|
-
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),
|
|
238
|
+
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),Og(`${Wf}
|
|
239
239
|
Failed parsing: < ${t.toString()} >
|
|
240
240
|
Using the @chevrotain/regexp-to-ast library
|
|
241
|
-
Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+r)}}return[]}function
|
|
242
|
-
Set":if(o.complement===!0)throw Error(ME);ke(o.value,u=>{if(typeof u=="number")zf(u,e,n);else{const c=u;if(n===!0)for(let l=c.from;l<=c.to;l++)zf(l,e,n);else{for(let l=c.from;l<=c.to&&l<Xu;l++)zf(l,e,n);if(c.to>=Xu){const l=c.from>=Xu?c.from:Xu,f=c.to,d=Qi(l),p=Qi(f);for(let m=d;m<=p;m++)e[m]=m}}}});break;case"Group":
|
|
243
|
-
break;default:throw Error("non exhaustive match!")}return Wt(e)}function zf(t,e,n){const r=Qi(t);e[r]=r,n===!0&&z2(t,e)}function z2(t,e){const n=String.fromCharCode(t),r=n.toUpperCase();if(r!==n){const i=Qi(r.charCodeAt(0));e[i]=i}else{const i=n.toLowerCase();if(i!==n){const s=Qi(i.charCodeAt(0));e[s]=s}}}function BE(t,e){return Qo(t.value,n=>{if(typeof n=="number")return wn(e,n);{const r=n;return Qo(e,i=>r.from<=i&&i<=r.to)!==void 0}})}function
|
|
244
|
-
!0:t.value?Je(t.value)?$r(t.value,
|
|
245
|
-
(this.found=!0)}}function
|
|
246
|
-
`],tracer:(b,R)=>R()});const n=e.tracer;n("initCharCodeToOptimizedIndexMap",()=>{gB()});let r;n("Reject Lexer.NA",()=>{r=Mf(t,b=>b[js]===
|
|
247
|
-
!0,R;if(typeof R=="string"){if(R.length===1)return R;{const A=R.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),N=new RegExp(A);return e.useSticky?GE(N):jE(N)}}else throw Error("non exhaustive match")}})});let o,a,u,c,l;n("misc mapping",()=>{o=ve(r,b=>b.tokenTypeIdx),a=ve(r,b=>{const R=b.GROUP;if(R!==
|
|
248
|
-
_MODE"))});let f;n("Line Terminator Handling",()=>{const b=zE(e.lineTerminatorCharacters);f=ve(r,R=>!1),e.positionTracking!=="onlyOffset"&&(f=ve(r,R=>Te(R,"LINE_BREAKS")?!!R.LINE_BREAKS:WE(R,b)===!1&&
|
|
249
|
-
let y=!0,g=[];return e.safeMode||n("First Char Optimization",()=>{g=bn(r,(b,R,A)=>{if(typeof R.PATTERN=="string"){const N=R.PATTERN.charCodeAt(0),V=Qi(N);
|
|
241
|
+
Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+r)}}return[]}function Lg(t,e,n){switch(t.type){case"Disjunction":for(let i=0;i<t.value.length;i++)Lg(t.value[i],e,n);break;case"Alternative":const r=t.value;for(let i=0;i<r.length;i++){const s=r[i];switch(s.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}const o=s;switch(o.type){case"Character":zf(o.value,e,n);break;case"\
|
|
242
|
+
Set":if(o.complement===!0)throw Error(ME);ke(o.value,u=>{if(typeof u=="number")zf(u,e,n);else{const c=u;if(n===!0)for(let l=c.from;l<=c.to;l++)zf(l,e,n);else{for(let l=c.from;l<=c.to&&l<Xu;l++)zf(l,e,n);if(c.to>=Xu){const l=c.from>=Xu?c.from:Xu,f=c.to,d=Qi(l),p=Qi(f);for(let m=d;m<=p;m++)e[m]=m}}}});break;case"Group":Lg(o.value,e,n);break;default:throw Error("Non Exhaustive Match")}const a=o.quantifier!==void 0&&o.quantifier.atLeast===0;if(o.type==="Group"&&Fg(o)===!1||o.type!=="Group"&&a===!1)break}
|
|
243
|
+
break;default:throw Error("non exhaustive match!")}return Wt(e)}function zf(t,e,n){const r=Qi(t);e[r]=r,n===!0&&z2(t,e)}function z2(t,e){const n=String.fromCharCode(t),r=n.toUpperCase();if(r!==n){const i=Qi(r.charCodeAt(0));e[i]=i}else{const i=n.toLowerCase();if(i!==n){const s=Qi(i.charCodeAt(0));e[s]=s}}}function BE(t,e){return Qo(t.value,n=>{if(typeof n=="number")return wn(e,n);{const r=n;return Qo(e,i=>r.from<=i&&i<=r.to)!==void 0}})}function Fg(t){const e=t.quantifier;return e&&e.atLeast===0?
|
|
244
|
+
!0:t.value?Je(t.value)?$r(t.value,Fg):Fg(t.value):!1}class H2 extends bf{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}super.visitChildren(e)}}visitCharacter(e){wn(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?BE(e,this.targetCharCodes)===void 0&&(this.found=!0):BE(e,this.targetCharCodes)!==void 0&&
|
|
245
|
+
(this.found=!0)}}function Mg(t,e){if(e instanceof RegExp){const n=Uf(e),r=new H2(t);return r.visit(n),r.found}else return Qo(e,n=>wn(t,n.charCodeAt(0)))!==void 0}const js="PATTERN",Vu="defaultMode",Hf="modes";let qE=typeof new RegExp("(?:)").sticky=="boolean";function K2(t,e){e=Ng(e,{useSticky:qE,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
|
|
246
|
+
`],tracer:(b,R)=>R()});const n=e.tracer;n("initCharCodeToOptimizedIndexMap",()=>{gB()});let r;n("Reject Lexer.NA",()=>{r=Mf(t,b=>b[js]===Fn.NA)});let i=!1,s;n("Transform Patterns",()=>{i=!1,s=ve(r,b=>{const R=b[js];if(hi(R)){const A=R.source;return A.length===1&&A!=="^"&&A!=="$"&&A!=="."&&!R.ignoreCase?A:A.length===2&&A[0]==="\\"&&!wn(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],A[1])?A[1]:e.useSticky?GE(R):jE(R)}else{if(di(R))return i=!0,{exec:R};if(typeof R=="object")return i=
|
|
247
|
+
!0,R;if(typeof R=="string"){if(R.length===1)return R;{const A=R.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),N=new RegExp(A);return e.useSticky?GE(N):jE(N)}}else throw Error("non exhaustive match")}})});let o,a,u,c,l;n("misc mapping",()=>{o=ve(r,b=>b.tokenTypeIdx),a=ve(r,b=>{const R=b.GROUP;if(R!==Fn.SKIPPED){if(Nn(R))return R;if(mi(R))return!1;throw Error("non exhaustive match")}}),u=ve(r,b=>{const R=b.LONGER_ALT;if(R)return Je(R)?ve(R,N=>SE(r,N)):[SE(r,R)]}),c=ve(r,b=>b.PUSH_MODE),l=ve(r,b=>Te(b,"POP\
|
|
248
|
+
_MODE"))});let f;n("Line Terminator Handling",()=>{const b=zE(e.lineTerminatorCharacters);f=ve(r,R=>!1),e.positionTracking!=="onlyOffset"&&(f=ve(r,R=>Te(R,"LINE_BREAKS")?!!R.LINE_BREAKS:WE(R,b)===!1&&Mg(b,R.PATTERN)))});let d,p,m,w;n("Misc Mapping #2",()=>{d=ve(r,UE),p=ve(s,pB),m=bn(r,(b,R)=>{const A=R.GROUP;return Nn(A)&&A!==Fn.SKIPPED&&(b[A]=[]),b},{}),w=ve(s,(b,R)=>({pattern:s[R],longerAlt:u[R],canLineTerminator:f[R],isCustom:d[R],short:p[R],group:a[R],push:c[R],pop:l[R],tokenTypeIdx:o[R],tokenType:r[R]}))});
|
|
249
|
+
let y=!0,g=[];return e.safeMode||n("First Char Optimization",()=>{g=bn(r,(b,R,A)=>{if(typeof R.PATTERN=="string"){const N=R.PATTERN.charCodeAt(0),V=Qi(N);Bg(b,V,w[A])}else if(Je(R.START_CHARS_HINT)){let N;ke(R.START_CHARS_HINT,V=>{const J=typeof V=="string"?V.charCodeAt(0):V,se=Qi(J);N!==se&&(N=se,Bg(b,se,w[A]))})}else if(hi(R.PATTERN))if(R.PATTERN.unicode)y=!1,e.ensureOptimizations&&Og(`${Wf} Unable to analyze < ${R.PATTERN.toString()} > pattern.
|
|
250
250
|
The regexp unicode flag is not currently supported by the regexp-to-ast library.
|
|
251
251
|
This will disable the lexer's first char optimizations.
|
|
252
|
-
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{const N=W2(R.PATTERN,e.ensureOptimizations);
|
|
252
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{const N=W2(R.PATTERN,e.ensureOptimizations);ht(N)&&(y=!1),ke(N,V=>{Bg(b,V,w[A])})}else e.ensureOptimizations&&Og(`${Wf} TokenType: <${R.name}> is using a custom token pattern without providing <start_chars_hint> parameter.
|
|
253
253
|
This will disable the lexer's first char optimizations.
|
|
254
254
|
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),y=!1;return b},[])}),{emptyGroups:m,patternIdxToConfig:w,charCodeToPatternIdxToConfig:g,hasCustom:i,canBeOptimized:y}}function V2(t,e){let n=[];const r=Y2(t);n=n.concat(r.errors);const i=J2(r.valid),s=i.valid;return n=n.concat(i.errors),n=n.concat(X2(s)),n=n.concat(sB(s)),n=n.concat(oB(s,e)),n=n.concat(aB(s)),n}function X2(t){let e=[];const n=Kn(t,r=>hi(r[js]));return e=e.concat(Z2(n)),e=e.concat(nB(
|
|
255
|
-
n)),e=e.concat(rB(n)),e=e.concat(iB(n)),e=e.concat(eB(n)),e}function Y2(t){const e=Kn(t,i=>!Te(i,js)),n=ve(e,i=>({message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:Nt.MISSING_PATTERN,tokenTypes:[i]})),r=Ff(t,e);return{errors:n,valid:r}}function J2(t){const e=Kn(t,i=>{const s=i[js];return!hi(s)&&!di(s)&&!Te(s,"exec")&&!
|
|
255
|
+
n)),e=e.concat(rB(n)),e=e.concat(iB(n)),e=e.concat(eB(n)),e}function Y2(t){const e=Kn(t,i=>!Te(i,js)),n=ve(e,i=>({message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:Nt.MISSING_PATTERN,tokenTypes:[i]})),r=Ff(t,e);return{errors:n,valid:r}}function J2(t){const e=Kn(t,i=>{const s=i[js];return!hi(s)&&!di(s)&&!Te(s,"exec")&&!Nn(s)}),n=ve(e,i=>({message:"Token Type: ->"+i.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or \
|
|
256
256
|
an Object matching the {ICustomPattern} interface.",type:Nt.INVALID_PATTERN,tokenTypes:[i]})),r=Ff(t,e);return{errors:n,valid:r}}const Q2=/[^\\][$]/;function Z2(t){class e extends bf{constructor(){super(...arguments),this.found=!1}visitEndAnchor(s){this.found=!0}}const n=Kn(t,i=>{const s=i.PATTERN;try{const o=Uf(s),a=new e;return a.visit(o),a.found}catch{return Q2.test(s.source)}});return ve(n,i=>({message:`Unexpected RegExp Anchor Error:
|
|
257
257
|
Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
|
|
258
258
|
See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:Nt.EOI_ANCHOR_FOUND,tokenTypes:[i]}))}function eB(t){const e=Kn(t,r=>r.PATTERN.test(""));return ve(e,r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' must not match an empty string",type:Nt.EMPTY_MATCH_PATTERN,tokenTypes:[r]}))}const tB=/[^\\[][\^]|^\^/;function nB(t){class e extends bf{constructor(){super(...arguments),this.found=!1}visitStartAnchor(s){this.found=!0}}const n=Kn(t,i=>{const s=i.PATTERN;
|
|
259
259
|
try{const o=Uf(s),a=new e;return a.visit(o),a.found}catch{return tB.test(s.source)}});return ve(n,i=>({message:`Unexpected RegExp Anchor Error:
|
|
260
260
|
Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
|
|
261
261
|
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:Nt.SOI_ANCHOR_FOUND,tokenTypes:[i]}))}function rB(t){const e=Kn(t,r=>{const i=r[js];return i instanceof RegExp&&(i.multiline||i.global)});return ve(e,r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:Nt.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[r]}))}function iB(t){const e=[];let n=ve(t,s=>bn(t,(o,a)=>(s.PATTERN.source===a.PATTERN.source&&!wn(e,a)&&a.
|
|
262
|
-
PATTERN!==
|
|
263
|
-
Lexer.SKIPPED/Lexer.NA/A String",type:Nt.INVALID_GROUP_TYPE_FOUND,tokenTypes:[r]}))}function oB(t,e){const n=Kn(t,i=>i.PUSH_MODE!==void 0&&!wn(e,i.PUSH_MODE));return ve(n,i=>({message:`Token Type: ->${i.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${i.PUSH_MODE}<-which does not exist`,type:Nt.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[i]}))}function aB(t){const e=[],n=bn(t,(r,i,s)=>{const o=i.PATTERN;return o===
|
|
262
|
+
PATTERN!==Fn.NA&&(e.push(a),o.push(a)),o),[]));n=zu(n);const r=Kn(n,s=>s.length>1);return ve(r,s=>{const o=ve(s,u=>u.name);return{message:`The same RegExp pattern ->${Rr(s).PATTERN}<-has been used in all of the following Token Types: ${o.join(", ")} <-`,type:Nt.DUPLICATE_PATTERNS_FOUND,tokenTypes:s}})}function sB(t){const e=Kn(t,r=>{if(!Te(r,"GROUP"))return!1;const i=r.GROUP;return i!==Fn.SKIPPED&&i!==Fn.NA&&!Nn(i)});return ve(e,r=>({message:"Token Type: ->"+r.name+"<- static 'GROUP' can only be\
|
|
263
|
+
Lexer.SKIPPED/Lexer.NA/A String",type:Nt.INVALID_GROUP_TYPE_FOUND,tokenTypes:[r]}))}function oB(t,e){const n=Kn(t,i=>i.PUSH_MODE!==void 0&&!wn(e,i.PUSH_MODE));return ve(n,i=>({message:`Token Type: ->${i.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${i.PUSH_MODE}<-which does not exist`,type:Nt.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[i]}))}function aB(t){const e=[],n=bn(t,(r,i,s)=>{const o=i.PATTERN;return o===Fn.NA||(Nn(o)?r.push({str:o,idx:s,tokenType:i}):hi(o)&&cB(o)&&r.push({str:o.
|
|
264
264
|
source,idx:s,tokenType:i})),r},[]);return ke(t,(r,i)=>{ke(n,({str:s,idx:o,tokenType:a})=>{if(i<o&&uB(s,r.PATTERN)){const u=`Token: ->${a.name}<- can never be matched.
|
|
265
265
|
Because it appears AFTER the Token Type ->${r.name}<-in the lexer's definition.
|
|
266
266
|
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:u,type:Nt.UNREACHABLE_PATTERN,tokenTypes:[r,a]})}})}),e}function uB(t,e){if(hi(e)){const n=e.exec(t);return n!==null&&n.index===0}else{if(di(e))return e(t,0,[],{});if(Te(e,"exec"))return e.exec(t,0,[],{});if(typeof e=="string")return e===t;throw Error("non exhaustive match")}}function cB(t){return Qo([".","\\","[","]","|","^","$","(",")","?","*","+","{"],n=>t.source.indexOf(n)!==-1)===void 0}function jE(t){
|
|
@@ -269,38 +269,38 @@ const e=t.ignoreCase?"i":"";return new RegExp(`^(?:${t.source})`,e)}function GE(
|
|
|
269
269
|
`,type:Nt.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),Te(t,Hf)&&Te(t,Vu)&&!Te(t.modes,t.defaultMode)&&r.push({message:`A MultiMode Lexer cannot be initialized with a ${Vu}: <${t.defaultMode}>which does not exist
|
|
270
270
|
`,type:Nt.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),Te(t,Hf)&&ke(t.modes,(i,s)=>{ke(i,(o,a)=>{if(mi(o))r.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${s}> at index: <${a}>
|
|
271
271
|
`,type:Nt.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(Te(o,"LONGER_ALT")){const u=Je(o.LONGER_ALT)?o.LONGER_ALT:[o.LONGER_ALT];ke(u,c=>{!mi(c)&&!wn(i,c)&&r.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${c.name}> on token <${o.name}> outside of mode <${s}>
|
|
272
|
-
`,type:Nt.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),r}function dB(t,e,n){const r=[];let i=!1;const s=zu(lr(Wt(t.modes))),o=Mf(s,u=>u[js]===
|
|
272
|
+
`,type:Nt.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),r}function dB(t,e,n){const r=[];let i=!1;const s=zu(lr(Wt(t.modes))),o=Mf(s,u=>u[js]===Fn.NA),a=zE(n);return e&&ke(o,u=>{const c=WE(u,a);if(c!==!1){const f={message:mB(u,c),type:c.issue,tokenType:u};r.push(f)}else Te(u,"LINE_BREAKS")?u.LINE_BREAKS===!0&&(i=!0):Mg(a,u.PATTERN)&&(i=!0)}),e&&!i&&r.push({message:`Warning: No LINE_BREAKS Found.
|
|
273
273
|
This Lexer has been defined to track line and column information,
|
|
274
274
|
But none of the Token Types can be identified as matching a line terminator.
|
|
275
275
|
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
|
|
276
|
-
for details.`,type:Nt.NO_LINE_BREAKS_FLAGS}),r}function fB(t){const e={},n=cr(t);return ke(n,r=>{const i=t[r];if(Je(i))e[r]=[];else throw Error("non exhaustive match")}),e}function UE(t){const e=t.PATTERN;if(hi(e))return!1;if(di(e))return!0;if(Te(e,"exec"))return!0;if(
|
|
277
|
-
lastIndex=n+1,!0;if(r===13)return t.charCodeAt(n+1)===10?this.lastIndex=n+2:this.lastIndex=n+1,!0}return!1},lastIndex:0};function WE(t,e){if(Te(t,"LINE_BREAKS"))return!1;if(hi(t.PATTERN)){try{
|
|
276
|
+
for details.`,type:Nt.NO_LINE_BREAKS_FLAGS}),r}function fB(t){const e={},n=cr(t);return ke(n,r=>{const i=t[r];if(Je(i))e[r]=[];else throw Error("non exhaustive match")}),e}function UE(t){const e=t.PATTERN;if(hi(e))return!1;if(di(e))return!0;if(Te(e,"exec"))return!0;if(Nn(e))return!1;throw Error("non exhaustive match")}function pB(t){return Nn(t)&&t.length===1?t.charCodeAt(0):!1}const hB={test:function(t){const e=t.length;for(let n=this.lastIndex;n<e;n++){const r=t.charCodeAt(n);if(r===10)return this.
|
|
277
|
+
lastIndex=n+1,!0;if(r===13)return t.charCodeAt(n+1)===10?this.lastIndex=n+2:this.lastIndex=n+1,!0}return!1},lastIndex:0};function WE(t,e){if(Te(t,"LINE_BREAKS"))return!1;if(hi(t.PATTERN)){try{Mg(e,t.PATTERN)}catch(n){return{issue:Nt.IDENTIFY_TERMINATOR,errMsg:n.message}}return!1}else{if(Nn(t.PATTERN))return!1;if(UE(t))return{issue:Nt.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function mB(t,e){if(e.issue===Nt.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usag\
|
|
278
278
|
e in pattern.
|
|
279
279
|
The problem is in the <${t.name}> Token Type
|
|
280
280
|
Root cause: ${e.errMsg}.
|
|
281
281
|
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(e.issue===Nt.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
|
|
282
282
|
The problem is in the <${t.name}> Token Type
|
|
283
|
-
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}function zE(t){return ve(t,n=>
|
|
284
|
-
!0}function Vf(t,e){return t.tokenTypeIdx===e.tokenTypeIdx}let HE=1;const KE={};function Ju(t){const e=yB(t);vB(e),bB(e),wB(e),ke(e,n=>{n.isParent=n.categoryMatches.length>0})}function yB(t){let e=nn(t),n=t,r=!0;for(;r;){n=zu(lr(ve(n,s=>s.CATEGORIES)));const i=Ff(n,e);e=e.concat(i),
|
|
283
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}function zE(t){return ve(t,n=>Nn(n)?n.charCodeAt(0):n)}function Bg(t,e,n){t[e]===void 0?t[e]=[n]:t[e].push(n)}const Xu=256;let Kf=[];function Qi(t){return t<Xu?t:Kf[t]}function gB(){if(ht(Kf)){Kf=new Array(65536);for(let t=0;t<65536;t++)Kf[t]=t>255?255+~~(t/255):t}}function Yu(t,e){const n=t.tokenTypeIdx;return n===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[n]===
|
|
284
|
+
!0}function Vf(t,e){return t.tokenTypeIdx===e.tokenTypeIdx}let HE=1;const KE={};function Ju(t){const e=yB(t);vB(e),bB(e),wB(e),ke(e,n=>{n.isParent=n.categoryMatches.length>0})}function yB(t){let e=nn(t),n=t,r=!0;for(;r;){n=zu(lr(ve(n,s=>s.CATEGORIES)));const i=Ff(n,e);e=e.concat(i),ht(i)?r=!1:n=i}return e}function vB(t){ke(t,e=>{XE(e)||(KE[HE]=e,e.tokenTypeIdx=HE++),YE(e)&&!Je(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),YE(e)||(e.CATEGORIES=[]),EB(e)||(e.categoryMatches=[]),$B(e)||(e.categoryMatchesMap=
|
|
285
285
|
{})})}function wB(t){ke(t,e=>{e.categoryMatches=[],ke(e.categoryMatchesMap,(n,r)=>{e.categoryMatches.push(KE[r].tokenTypeIdx)})})}function bB(t){ke(t,e=>{VE([],e)})}function VE(t,e){ke(t,n=>{e.categoryMatchesMap[n.tokenTypeIdx]=!0}),ke(e.CATEGORIES,n=>{const r=t.concat(e);wn(r,n)||VE(r,n)})}function XE(t){return Te(t,"tokenTypeIdx")}function YE(t){return Te(t,"CATEGORIES")}function EB(t){return Te(t,"categoryMatches")}function $B(t){return Te(t,"categoryMatchesMap")}function RB(t){return Te(t,"t\
|
|
286
|
-
okenTypeIdx")}const
|
|
286
|
+
okenTypeIdx")}const qg={buildUnableToPopLexerModeMessage(t){return`Unable to pop Lexer Mode after encountering Token ->${t.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(t,e,n,r,i){return`unexpected character: ->${t.charAt(e)}<- at offset: ${e}, skipped ${n} characters.`}};var Nt;(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.
|
|
287
287
|
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=
|
|
288
288
|
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"})(Nt||(Nt={}));const Qu={deferDefinitionErrorsHandling:!1,
|
|
289
289
|
positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
|
|
290
|
-
`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:
|
|
290
|
+
`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:qg,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(Qu);class Fn{constructor(e,n=Qu){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=(i,s)=>{if(this.traceInitPerf===!0){this.
|
|
291
291
|
traceInitIndent++;const o=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${o}--> <${i}>`);const{time:a,value:u}=IE(s),c=a>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&c(`${o}<-- <${i}> time: ${a}ms`),this.traceInitIndent--,u}else return s()},typeof n=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
|
|
292
292
|
a boolean 2nd argument is no longer supported`);this.config=Hn({},Qu,n);const r=this.config.traceInitPerf;r===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof r=="number"&&(this.traceInitMaxIdent=r,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let i,s=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===Qu.lineTerminatorsPattern)this.config.lineTerminatorsPattern=hB;else if(this.config.lineTerminatorCharacters===
|
|
293
293
|
Qu.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
|
|
294
294
|
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),Je(e)?i={modes:{defaultMode:nn(e)},defaultMode:Vu}:(s=!1,i=nn(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",
|
|
295
295
|
()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(lB(i,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(dB(i,this.trackStartLines,this.config.lineTerminatorCharacters))})),i.modes=i.modes?i.modes:{},ke(i.modes,(a,u)=>{i.modes[u]=Mf(a,c=>mi(c))});const o=cr(i.modes);if(ke(i.modes,(a,u)=>{this.TRACE_INIT(`Mode: <${u}> processing`,()=>{if(this.modes.push(u),
|
|
296
|
-
this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(V2(a,o))}),
|
|
297
|
-
c.charCodeToPatternIdxToConfig,this.emptyGroups=Hn({},this.emptyGroups,c.emptyGroups),this.hasCustom=c.hasCustom||this.hasCustom,this.canModeBeOptimized[u]=c.canBeOptimized}})}),this.defaultMode=i.defaultMode,!
|
|
296
|
+
this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(V2(a,o))}),ht(this.lexerDefinitionErrors)){Ju(a);let c;this.TRACE_INIT("analyzeTokenTypes",()=>{c=K2(a,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:n.positionTracking,ensureOptimizations:n.ensureOptimizations,safeMode:n.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[u]=c.patternIdxToConfig,this.charCodeToPatternIdxToConfig[u]=
|
|
297
|
+
c.charCodeToPatternIdxToConfig,this.emptyGroups=Hn({},this.emptyGroups,c.emptyGroups),this.hasCustom=c.hasCustom||this.hasCustom,this.canModeBeOptimized[u]=c.canBeOptimized}})}),this.defaultMode=i.defaultMode,!ht(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){const u=ve(this.lexerDefinitionErrors,c=>c.message).join(`-----------------------
|
|
298
298
|
`);throw new Error(`Errors detected in definition of Lexer:
|
|
299
299
|
`+u)}ke(this.lexerDefinitionWarning,a=>{NE(a.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(qE?(this.chopInput=Ls,this.match=this.matchWithTest):(this.updateLastIndex=Ut,this.match=this.matchWithExec),s&&(this.handleModes=Ut),this.trackStartLines===!1&&(this.computeNewColumn=Ls),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=Ut),/full/i.test(this.config.positionTracking))this.createTokenInstance=this.createFullToken;else if(/onlyStart/i.test(this.config.
|
|
300
300
|
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 Optim\
|
|
301
|
-
ization Warnings",()=>{const a=bn(this.canModeBeOptimized,(u,c,l)=>(c===!1&&u.push(l),u),[]);if(n.ensureOptimizations&&!
|
|
301
|
+
ization Warnings",()=>{const a=bn(this.canModeBeOptimized,(u,c,l)=>(c===!1&&u.push(l),u),[]);if(n.ensureOptimizations&&!ht(a))throw Error(`Lexer Modes: < ${a.join(", ")} > cannot be optimized.
|
|
302
302
|
Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
|
|
303
|
-
Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{U2()}),this.TRACE_INIT("toFastProperties",()=>{OE(this)})})}tokenize(e,n=this.defaultMode){if(!
|
|
303
|
+
Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{U2()}),this.TRACE_INIT("toFastProperties",()=>{OE(this)})})}tokenize(e,n=this.defaultMode){if(!ht(this.lexerDefinitionErrors)){const i=ve(this.lexerDefinitionErrors,s=>s.message).join(`-----------------------
|
|
304
304
|
`);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer:
|
|
305
305
|
`+i)}return this.tokenizeInternal(e,n)}tokenizeInternal(e,n){let r,i,s,o,a,u,c,l,f,d,p,m,w,y,g;const b=e,R=b.length;let A=0,N=0;const V=this.hasCustom?0:Math.floor(e.length/10),J=new Array(V),se=[];let ie=this.trackStartLines?1:void 0,we=this.trackStartLines?1:void 0;const M=fB(this.emptyGroups),T=this.trackStartLines,D=this.config.lineTerminatorsPattern;let F=0,x=[],_=[];const I=[],te=[];Object.freeze(te);let z;function C(){return x}function ne(_e){const le=Qi(_e),$e=_[le];return $e===void 0?te:
|
|
306
306
|
$e}const ye=_e=>{if(I.length===1&&_e.tokenType.PUSH_MODE===void 0){const le=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(_e);se.push({offset:_e.startOffset,line:_e.startLine,column:_e.startColumn,length:_e.image.length,message:le})}else{I.pop();const le=Jo(I);x=this.patternIdxToConfig[le],_=this.charCodeToPatternIdxToConfig[le],F=x.length;const $e=this.canModeBeOptimized[le]&&this.config.safeMode===!1;_&&$e?z=ne:z=C}};function Ie(_e){I.push(_e),_=this.charCodeToPatternIdxToConfig[_e],
|
|
@@ -309,9 +309,9 @@ null){if(a=L.longerAlt,a!==void 0){const O=a.length;for(s=0;s<O;s++){const G=x[a
|
|
|
309
309
|
e,f),A=A+f,we=this.computeNewColumn(we,f),T===!0&&L.canLineTerminator===!0){let xe=0,fe,O;D.lastIndex=0;do fe=D.test(u),fe===!0&&(O=D.lastIndex-1,xe++);while(fe===!0);xe!==0&&(ie=ie+xe,we=f-O,this.updateTokenEndLineColumnLocation(m,d,O,xe,ie,we,f))}this.handleModes(L,ye,Ie,m)}else{const xe=A,fe=ie,O=we;let G=K===!1;for(;G===!1&&A<R;)for(e=this.chopInput(e,1),A++,i=0;i<F;i++){const he=x[i],U=he.pattern,pe=he.short;if(pe!==!1?b.charCodeAt(A)===pe&&(G=!0):he.isCustom===!0?G=U.exec(b,A,J,M)!==null:(this.
|
|
310
310
|
updateLastIndex(U,A),G=U.exec(e)!==null),G===!0)break}if(w=A-xe,we=this.computeNewColumn(we,w),y=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(b,xe,w,fe,O),se.push({offset:xe,line:fe,column:O,length:w,message:y}),K===!1)break}}return this.hasCustom||(J.length=N),{tokens:J,groups:M,errors:se}}handleModes(e,n,r,i){if(e.pop===!0){const s=e.push;n(i),s!==void 0&&r.call(this,s)}else e.push!==void 0&&r.call(this,e.push)}chopInput(e,n){return e.substring(n)}updateLastIndex(e,n){e.lastIndex=
|
|
311
311
|
n}updateTokenEndLineColumnLocation(e,n,r,i,s,o,a){let u,c;n!==void 0&&(u=r===a-1,c=u?-1:0,i===1&&u===!0||(e.endLine=s+c,e.endColumn=o-1+-c))}computeNewColumn(e,n){return e+n}createOffsetOnlyToken(e,n,r,i){return{image:e,startOffset:n,tokenTypeIdx:r,tokenType:i}}createStartOnlyToken(e,n,r,i,s,o){return{image:e,startOffset:n,startLine:s,startColumn:o,tokenTypeIdx:r,tokenType:i}}createFullToken(e,n,r,i,s,o,a){return{image:e,startOffset:n,endOffset:n+a-1,startLine:s,endLine:s,startColumn:o,endColumn:o+
|
|
312
|
-
a-1,tokenTypeIdx:r,tokenType:i}}addTokenUsingPush(e,n,r){return e.push(r),n}addTokenUsingMemberAccess(e,n,r){return e[n]=r,n++,n}handlePayloadNoCustom(e,n){}handlePayloadWithCustom(e,n){n!==null&&(e.payload=n)}matchWithTest(e,n,r){return e.test(n)===!0?n.substring(r,e.lastIndex):null}matchWithExec(e,n){const r=e.exec(n);return r!==null?r[0]:null}}
|
|
313
|
-
to for example to completely ignore whitespace.",
|
|
314
|
-
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return Te(t,QE)&&(n.CATEGORIES=t[QE]),Ju([n]),Te(t,ZE)&&(n.LABEL=t[ZE]),Te(t,e$)&&(n.GROUP=t[e$]),Te(t,n$)&&(n.POP_MODE=t[n$]),Te(t,t$)&&(n.PUSH_MODE=t[t$]),Te(t,r$)&&(n.LONGER_ALT=t[r$]),Te(t,i$)&&(n.LINE_BREAKS=t[i$]),Te(t,s$)&&(n.START_CHARS_HINT=t[s$]),n}const Zi=o$({name:"EOF",pattern:
|
|
312
|
+
a-1,tokenTypeIdx:r,tokenType:i}}addTokenUsingPush(e,n,r){return e.push(r),n}addTokenUsingMemberAccess(e,n,r){return e[n]=r,n++,n}handlePayloadNoCustom(e,n){}handlePayloadWithCustom(e,n){n!==null&&(e.payload=n)}matchWithTest(e,n,r){return e.test(n)===!0?n.substring(r,e.lastIndex):null}matchWithExec(e,n){const r=e.exec(n);return r!==null?r[0]:null}}Fn.SKIPPED="This marks a skipped Token pattern, this means each token identified by it willbe consumed and then thrown into oblivion, this can be used \
|
|
313
|
+
to for example to completely ignore whitespace.",Fn.NA=/NOT_APPLICABLE/;function ta(t){return JE(t)?t.LABEL:t.name}function JE(t){return Nn(t.LABEL)&&t.LABEL!==""}const DB="parent",QE="categories",ZE="label",e$="group",t$="push_mode",n$="pop_mode",r$="longer_alt",i$="line_breaks",s$="start_chars_hint";function o$(t){return kB(t)}function kB(t){const e=t.pattern,n={};if(n.name=t.name,mi(e)||(n.PATTERN=e),Te(t,DB))throw`The parent property is no longer supported.
|
|
314
|
+
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return Te(t,QE)&&(n.CATEGORIES=t[QE]),Ju([n]),Te(t,ZE)&&(n.LABEL=t[ZE]),Te(t,e$)&&(n.GROUP=t[e$]),Te(t,n$)&&(n.POP_MODE=t[n$]),Te(t,t$)&&(n.PUSH_MODE=t[t$]),Te(t,r$)&&(n.LONGER_ALT=t[r$]),Te(t,i$)&&(n.LINE_BREAKS=t[i$]),Te(t,s$)&&(n.START_CHARS_HINT=t[s$]),n}const Zi=o$({name:"EOF",pattern:Fn.NA});Ju([Zi]);function jg(t,e,n,r,i,s,o,a){return{image:e,startOffset:n,endOffset:r,startLine:i,endLine:s,startColumn:o,
|
|
315
315
|
endColumn:a,tokenTypeIdx:t.tokenTypeIdx,tokenType:t}}function a$(t,e){return Yu(t,e)}const na={buildMismatchTokenMessage({expected:t,actual:e,previous:n,ruleName:r}){return`Expecting ${JE(t)?`--> ${ta(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:r,ruleName:i}){
|
|
316
316
|
const s="Expecting: ",a=`
|
|
317
317
|
but found: '`+Rr(e).image+"'";if(r)return s+r+a;{const u=bn(t,(d,p)=>d.concat(p),[]),c=ve(u,d=>`[${ve(d,p=>ta(p)).join(", ")}]`),f=`one of these possible Token sequences:
|
|
@@ -346,63 +346,63 @@ without consuming any Tokens. The grammar path that causes this is:
|
|
|
346
346
|
see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(t){return"deprecated"},buildDuplicateRuleNameError(t){let e;return t.topLevelRule instanceof Zo?e=t.topLevelRule.name:e=t.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${t.grammarName}<-`}};function CB(t,e){const n=new AB(t,e);return n.resolveRefs(),n.errors}class AB extends ea{constructor(e,n){super(),this.nameToTopRule=e,this.errMsgProvider=n,this.errors=[]}resolveRefs(){
|
|
347
347
|
ke(Wt(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){const n=this.nameToTopRule[e.nonTerminalName];if(n)e.referencedRule=n;else{const r=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:r,type:$n.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}}class SB extends jf{constructor(e,n){super(),this.topProd=e,this.path=n,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=
|
|
348
348
|
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=nn(this.path.ruleStack).reverse(),this.occurrenceStack=nn(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,r){if(e.referencedRule.name===
|
|
349
|
-
this.nextProductionName&&e.idx===this.nextProductionOccurrence){const i=n.concat(r);this.updateExpectedNext(),this.walk(e.referencedRule,i)}}updateExpectedNext(){
|
|
350
|
-
this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,n,r){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){const i=n.concat(r),s=new
|
|
349
|
+
this.nextProductionName&&e.idx===this.nextProductionOccurrence){const i=n.concat(r);this.updateExpectedNext(),this.walk(e.referencedRule,i)}}updateExpectedNext(){ht(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}}class _B extends SB{constructor(e,n){super(e,n),this.path=n,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=
|
|
350
|
+
this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,n,r){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){const i=n.concat(r),s=new In({definition:i});this.possibleTokTypes=Ku(s),this.found=!0}}}class Xf extends jf{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}}
|
|
351
351
|
class xB extends Xf{walkMany(e,n,r){if(e.idx===this.occurrence){const i=Rr(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof wt&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkMany(e,n,r)}}class u$ extends Xf{walkManySep(e,n,r){if(e.idx===this.occurrence){const i=Rr(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof wt&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkManySep(e,n,r)}}class PB extends Xf{walkAtLeastOne(e,n,r){
|
|
352
|
-
if(e.idx===this.occurrence){const i=Rr(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof wt&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(e,n,r)}}class c$ extends Xf{walkAtLeastOneSep(e,n,r){if(e.idx===this.occurrence){const i=Rr(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof wt&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(e,n,r)}}function
|
|
353
|
-
return a.concat(rn(t,i+1))}function o(a){const u=
|
|
354
|
-
u)}else if(a instanceof
|
|
355
|
-
EXIT_NONE_TERMINAL",s=[i],o="EXIT_ALTERNATIVE";let a=!1;const u=e.length,c=u-r-1,l=[],f=[];for(f.push({idx:-1,def:t,ruleStack:[],occurrenceStack:[]});!
|
|
352
|
+
if(e.idx===this.occurrence){const i=Rr(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof wt&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(e,n,r)}}class c$ extends Xf{walkAtLeastOneSep(e,n,r){if(e.idx===this.occurrence){const i=Rr(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof wt&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(e,n,r)}}function Gg(t,e,n=[]){n=nn(n);let r=[],i=0;function s(a){
|
|
353
|
+
return a.concat(rn(t,i+1))}function o(a){const u=Gg(s(a),e,n);return r.concat(u)}for(;n.length<e&&i<t.length;){const a=t[i];if(a instanceof In)return o(a.definition);if(a instanceof En)return o(a.definition);if(a instanceof sn)r=o(a.definition);else if(a instanceof Xn){const u=a.definition.concat([new Pt({definition:a.definition})]);return o(u)}else if(a instanceof Yn){const u=[new In({definition:a.definition}),new Pt({definition:[new wt({terminalType:a.separator})].concat(a.definition)})];return o(
|
|
354
|
+
u)}else if(a instanceof On){const u=a.definition.concat([new Pt({definition:[new wt({terminalType:a.separator})].concat(a.definition)})]);r=o(u)}else if(a instanceof Pt){const u=a.definition.concat([new Pt({definition:a.definition})]);r=o(u)}else{if(a instanceof Ln)return ke(a.definition,u=>{ht(u.definition)===!1&&(r=o(u.definition))}),r;if(a instanceof wt)n.push(a.terminalType);else throw Error("non exhaustive match")}i++}return r.push({partialPath:n,suffixDef:rn(t,i)}),r}function l$(t,e,n,r){const i="\
|
|
355
|
+
EXIT_NONE_TERMINAL",s=[i],o="EXIT_ALTERNATIVE";let a=!1;const u=e.length,c=u-r-1,l=[],f=[];for(f.push({idx:-1,def:t,ruleStack:[],occurrenceStack:[]});!ht(f);){const d=f.pop();if(d===o){a&&Jo(f).idx<=c&&f.pop();continue}const p=d.def,m=d.idx,w=d.ruleStack,y=d.occurrenceStack;if(ht(p))continue;const g=p[0];if(g===i){const b={idx:m,def:rn(p),ruleStack:Hu(w),occurrenceStack:Hu(y)};f.push(b)}else if(g instanceof wt)if(m<u-1){const b=m+1,R=e[b];if(n(R,g.terminalType)){const A={idx:b,def:rn(p),ruleStack:w,
|
|
356
356
|
occurrenceStack:y};f.push(A)}}else if(m===u-1)l.push({nextTokenType:g.terminalType,nextTokenOccurrence:g.idx,ruleStack:w,occurrenceStack:y}),a=!0;else throw Error("non exhaustive match");else if(g instanceof En){const b=nn(w);b.push(g.nonTerminalName);const R=nn(y);R.push(g.idx);const A={idx:m,def:g.definition.concat(s,rn(p)),ruleStack:b,occurrenceStack:R};f.push(A)}else if(g instanceof sn){const b={idx:m,def:rn(p),ruleStack:w,occurrenceStack:y};f.push(b),f.push(o);const R={idx:m,def:g.definition.
|
|
357
|
-
concat(rn(p)),ruleStack:w,occurrenceStack:y};f.push(R)}else if(g instanceof Xn){const b=new Pt({definition:g.definition,idx:g.idx}),R=g.definition.concat([b],rn(p)),A={idx:m,def:R,ruleStack:w,occurrenceStack:y};f.push(A)}else if(g instanceof Yn){const b=new wt({terminalType:g.separator}),R=new Pt({definition:[b].concat(g.definition),idx:g.idx}),A=g.definition.concat([R],rn(p)),N={idx:m,def:A,ruleStack:w,occurrenceStack:y};f.push(N)}else if(g instanceof
|
|
358
|
-
f.push(b),f.push(o);const R=new wt({terminalType:g.separator}),A=new Pt({definition:[R].concat(g.definition),idx:g.idx}),N=g.definition.concat([A],rn(p)),V={idx:m,def:N,ruleStack:w,occurrenceStack:y};f.push(V)}else if(g instanceof Pt){const b={idx:m,def:rn(p),ruleStack:w,occurrenceStack:y};f.push(b),f.push(o);const R=new Pt({definition:g.definition,idx:g.idx}),A=g.definition.concat([R],rn(p)),N={idx:m,def:A,ruleStack:w,occurrenceStack:y};f.push(N)}else if(g instanceof
|
|
359
|
-
1;b>=0;b--){const R=g.definition[b],A={idx:m,def:R.definition.concat(rn(p)),ruleStack:w,occurrenceStack:y};f.push(A),f.push(o)}else if(g instanceof
|
|
360
|
-
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"})(Tt||(Tt={}));function
|
|
361
|
-
etitionMandatoryWithSeparator")return Tt.REPETITION_MANDATORY_WITH_SEPARATOR;if(t instanceof
|
|
357
|
+
concat(rn(p)),ruleStack:w,occurrenceStack:y};f.push(R)}else if(g instanceof Xn){const b=new Pt({definition:g.definition,idx:g.idx}),R=g.definition.concat([b],rn(p)),A={idx:m,def:R,ruleStack:w,occurrenceStack:y};f.push(A)}else if(g instanceof Yn){const b=new wt({terminalType:g.separator}),R=new Pt({definition:[b].concat(g.definition),idx:g.idx}),A=g.definition.concat([R],rn(p)),N={idx:m,def:A,ruleStack:w,occurrenceStack:y};f.push(N)}else if(g instanceof On){const b={idx:m,def:rn(p),ruleStack:w,occurrenceStack:y};
|
|
358
|
+
f.push(b),f.push(o);const R=new wt({terminalType:g.separator}),A=new Pt({definition:[R].concat(g.definition),idx:g.idx}),N=g.definition.concat([A],rn(p)),V={idx:m,def:N,ruleStack:w,occurrenceStack:y};f.push(V)}else if(g instanceof Pt){const b={idx:m,def:rn(p),ruleStack:w,occurrenceStack:y};f.push(b),f.push(o);const R=new Pt({definition:g.definition,idx:g.idx}),A=g.definition.concat([R],rn(p)),N={idx:m,def:A,ruleStack:w,occurrenceStack:y};f.push(N)}else if(g instanceof Ln)for(let b=g.definition.length-
|
|
359
|
+
1;b>=0;b--){const R=g.definition[b],A={idx:m,def:R.definition.concat(rn(p)),ruleStack:w,occurrenceStack:y};f.push(A),f.push(o)}else if(g instanceof In)f.push({idx:m,def:g.definition.concat(rn(p)),ruleStack:w,occurrenceStack:y});else if(g instanceof Zo)f.push(NB(g,m,w,y));else throw Error("non exhaustive match")}return l}function NB(t,e,n,r){const i=nn(n);i.push(t.name);const s=nn(r);return s.push(1),{idx:e,def:t.definition,ruleStack:i,occurrenceStack:s}}var Tt;(function(t){t[t.OPTION=0]="OPTION",
|
|
360
|
+
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"})(Tt||(Tt={}));function Ug(t){if(t instanceof sn||t==="Option")return Tt.OPTION;if(t instanceof Pt||t==="Repetition")return Tt.REPETITION;if(t instanceof Xn||t==="RepetitionMandatory")return Tt.REPETITION_MANDATORY;if(t instanceof Yn||t==="Rep\
|
|
361
|
+
etitionMandatoryWithSeparator")return Tt.REPETITION_MANDATORY_WITH_SEPARATOR;if(t instanceof On||t==="RepetitionWithSeparator")return Tt.REPETITION_WITH_SEPARATOR;if(t instanceof Ln||t==="Alternation")return Tt.ALTERNATION;throw Error("non exhaustive match")}function d$(t){const{occurrence:e,rule:n,prodType:r,maxLookahead:i}=t,s=Ug(r);return s===Tt.ALTERNATION?Yf(e,n,i):Jf(e,n,s,i)}function IB(t,e,n,r,i,s){const o=Yf(t,e,n),a=m$(o)?Vf:Yu;return s(o,r,a,i)}function OB(t,e,n,r,i,s){const o=Jf(t,e,
|
|
362
362
|
i,n),a=m$(o)?Vf:Yu;return s(o[0],a,r)}function LB(t,e,n,r){const i=t.length,s=$r(t,o=>$r(o,a=>a.length===1));if(e)return function(o){const a=ve(o,u=>u.GATE);for(let u=0;u<i;u++){const c=t[u],l=c.length,f=a[u];if(!(f!==void 0&&f.call(this)===!1))e:for(let d=0;d<l;d++){const p=c[d],m=p.length;for(let w=0;w<m;w++){const y=this.LA(w+1);if(n(y,p[w])===!1)continue e}return u}}};if(s&&!r){const o=ve(t,u=>lr(u)),a=bn(o,(u,c,l)=>(ke(c,f=>{Te(u,f.tokenTypeIdx)||(u[f.tokenTypeIdx]=l),ke(f.categoryMatches,d=>{
|
|
363
|
-
Te(u,d)||(u[d]=l)})}),u),{});return function(){const u=this.LA(1);return a[u.tokenTypeIdx]}}else return function(){for(let o=0;o<i;o++){const a=t[o],u=a.length;e:for(let c=0;c<u;c++){const l=a[c],f=l.length;for(let d=0;d<f;d++){const p=this.LA(d+1);if(n(p,l[d])===!1)continue e}return o}}}}function FB(t,e,n){const r=$r(t,s=>s.length===1),i=t.length;if(r&&!n){const s=lr(t);if(s.length===1&&
|
|
363
|
+
Te(u,d)||(u[d]=l)})}),u),{});return function(){const u=this.LA(1);return a[u.tokenTypeIdx]}}else return function(){for(let o=0;o<i;o++){const a=t[o],u=a.length;e:for(let c=0;c<u;c++){const l=a[c],f=l.length;for(let d=0;d<f;d++){const p=this.LA(d+1);if(n(p,l[d])===!1)continue e}return o}}}}function FB(t,e,n){const r=$r(t,s=>s.length===1),i=t.length;if(r&&!n){const s=lr(t);if(s.length===1&&ht(s[0].categoryMatches)){const a=s[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===a}}else{
|
|
364
364
|
const o=bn(s,(a,u,c)=>(a[u.tokenTypeIdx]=!0,ke(u.categoryMatches,l=>{a[l]=!0}),a),[]);return function(){const a=this.LA(1);return o[a.tokenTypeIdx]===!0}}}else return function(){e:for(let s=0;s<i;s++){const o=t[s],a=o.length;for(let u=0;u<a;u++){const c=this.LA(u+1);if(e(c,o[u])===!1)continue e}return!0}return!1}}class MB extends jf{constructor(e,n,r){super(),this.topProd=e,this.targetOccurrence=n,this.targetProdType=r}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,n,r,i){
|
|
365
365
|
return e.idx===this.targetOccurrence&&this.targetProdType===n?(this.restDef=r.concat(i),!0):!1}walkOption(e,n,r){this.checkIsTarget(e,Tt.OPTION,n,r)||super.walkOption(e,n,r)}walkAtLeastOne(e,n,r){this.checkIsTarget(e,Tt.REPETITION_MANDATORY,n,r)||super.walkOption(e,n,r)}walkAtLeastOneSep(e,n,r){this.checkIsTarget(e,Tt.REPETITION_MANDATORY_WITH_SEPARATOR,n,r)||super.walkOption(e,n,r)}walkMany(e,n,r){this.checkIsTarget(e,Tt.REPETITION,n,r)||super.walkOption(e,n,r)}walkManySep(e,n,r){this.checkIsTarget(
|
|
366
366
|
e,Tt.REPETITION_WITH_SEPARATOR,n,r)||super.walkOption(e,n,r)}}class f$ extends ea{constructor(e,n,r){super(),this.targetOccurrence=e,this.targetProdType=n,this.targetRef=r,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,Tt.OPTION)}visitRepetition(e){this.checkIsTarget(e,Tt.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,Tt.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){
|
|
367
|
-
this.checkIsTarget(e,Tt.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,Tt.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,Tt.ALTERNATION)}}function p$(t){const e=new Array(t);for(let n=0;n<t;n++)e[n]=[];return e}function
|
|
368
|
-
o+u)}}e=i}return e}function BB(t,e,n){for(let r=0;r<t.length;r++){if(r===n)continue;const i=t[r];for(let s=0;s<e.length;s++){const o=e[s];if(i[o]===!0)return!1}}return!0}function h$(t,e){const n=ve(t,o=>
|
|
369
|
-
p,u)||
|
|
370
|
-
e:for(let n=0;n<t.length;n++){const r=t[n];if(r.length===e.length){for(let i=0;i<r.length;i++){const s=e[i],o=r[i];if((s===o||o.categoryMatchesMap[s.tokenTypeIdx]!==void 0)===!1)continue e}return!0}}return!1}function qB(t,e){return t.length<e.length&&$r(t,(n,r)=>{const i=e[r];return n===i||i.categoryMatchesMap[n.tokenTypeIdx]})}function m$(t){return $r(t,e=>$r(e,n=>$r(n,r=>
|
|
367
|
+
this.checkIsTarget(e,Tt.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,Tt.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,Tt.ALTERNATION)}}function p$(t){const e=new Array(t);for(let n=0;n<t;n++)e[n]=[];return e}function Wg(t){let e=[""];for(let n=0;n<t.length;n++){const r=t[n],i=[];for(let s=0;s<e.length;s++){const o=e[s];i.push(o+"_"+r.tokenTypeIdx);for(let a=0;a<r.categoryMatches.length;a++){const u="_"+r.categoryMatches[a];i.push(
|
|
368
|
+
o+u)}}e=i}return e}function BB(t,e,n){for(let r=0;r<t.length;r++){if(r===n)continue;const i=t[r];for(let s=0;s<e.length;s++){const o=e[s];if(i[o]===!0)return!1}}return!0}function h$(t,e){const n=ve(t,o=>Gg([o],1)),r=p$(n.length),i=ve(n,o=>{const a={};return ke(o,u=>{const c=Wg(u.partialPath);ke(c,l=>{a[l]=!0})}),a});let s=n;for(let o=1;o<=e;o++){const a=s;s=p$(a.length);for(let u=0;u<a.length;u++){const c=a[u];for(let l=0;l<c.length;l++){const f=c[l].partialPath,d=c[l].suffixDef,p=Wg(f);if(BB(i,
|
|
369
|
+
p,u)||ht(d)||f.length===e){const w=r[u];if(zg(w,f)===!1){w.push(f);for(let y=0;y<p.length;y++){const g=p[y];i[u][g]=!0}}}else{const w=Gg(d,o+1,f);s[u]=s[u].concat(w),ke(w,y=>{const g=Wg(y.partialPath);ke(g,b=>{i[u][b]=!0})})}}}}return r}function Yf(t,e,n,r){const i=new f$(t,Tt.ALTERNATION,r);return e.accept(i),h$(i.result,n)}function Jf(t,e,n,r){const i=new f$(t,n);e.accept(i);const s=i.result,a=new MB(e,t,n).startWalking(),u=new In({definition:s}),c=new In({definition:a});return h$([u,c],r)}function zg(t,e){
|
|
370
|
+
e:for(let n=0;n<t.length;n++){const r=t[n];if(r.length===e.length){for(let i=0;i<r.length;i++){const s=e[i],o=r[i];if((s===o||o.categoryMatchesMap[s.tokenTypeIdx]!==void 0)===!1)continue e}return!0}}return!1}function qB(t,e){return t.length<e.length&&$r(t,(n,r)=>{const i=e[r];return n===i||i.categoryMatchesMap[n.tokenTypeIdx]})}function m$(t){return $r(t,e=>$r(e,n=>$r(n,r=>ht(r.categoryMatches))))}function jB(t){const e=t.lookaheadStrategy.validate({rules:t.rules,tokenTypes:t.tokenTypes,grammarName:t.
|
|
371
371
|
grammarName});return ve(e,n=>Object.assign({type:$n.CUSTOM_LOOKAHEAD_VALIDATION},n))}function GB(t,e,n,r){const i=Vn(t,u=>UB(u,n)),s=tq(t,e,n),o=Vn(t,u=>JB(u,n)),a=Vn(t,u=>HB(u,t,r,n));return i.concat(s,o,a)}function UB(t,e){const n=new zB;t.accept(n);const r=n.allProductions,i=s2(r,WB),s=Dr(i,a=>a.length>1);return ve(Wt(s),a=>{const u=Rr(a),c=e.buildDuplicateFoundError(t,a),l=Kr(u),f={message:c,type:$n.DUPLICATE_PRODUCTIONS,ruleName:t.name,dslName:l,occurrence:u.idx},d=g$(u);return d&&(f.parameter=
|
|
372
372
|
d),f})}function WB(t){return`${Kr(t)}_#_${t.idx}_#_${g$(t)}`}function g$(t){return t instanceof wt?t.terminalType.name:t instanceof En?t.nonTerminalName:""}class zB extends ea{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.
|
|
373
373
|
push(e)}visitRepetition(e){this.allProductions.push(e)}visitAlternation(e){this.allProductions.push(e)}visitTerminal(e){this.allProductions.push(e)}}function HB(t,e,n,r){const i=[];if(bn(e,(o,a)=>a.name===t.name?o+1:o,0)>1){const o=r.buildDuplicateRuleNameError({topLevelRule:t,grammarName:n});i.push({message:o,type:$n.DUPLICATE_RULE_NAME,ruleName:t.name})}return i}function KB(t,e,n){const r=[];let i;return wn(e,t)||(i=`Invalid rule override, rule: ->${t}<- cannot be overridden in the grammar: ->${n}\
|
|
374
|
-
<-as it is not defined in any of the super grammars `,r.push({message:i,type:$n.INVALID_RULE_OVERRIDE,ruleName:t})),r}function y$(t,e,n,r=[]){const i=[],s=Qf(e.definition);if(
|
|
375
|
-
En)e.push(n.referencedRule);else if(n instanceof
|
|
376
|
-
e)}}function VB(t,e){const n=new
|
|
377
|
-
a,t,u,o),l=ZB(c,o,t,n),f=eq(c,o,t,n);return l.concat(f)})}class YB extends ea{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 JB(t,e){const n=new
|
|
378
|
-
{topLevelRule:t,alternation:s}),type:$n.TOO_MANY_ALTS,ruleName:t.name,occurrence:s.idx}]:[])}function QB(t,e,n){const r=[];return ke(t,i=>{const s=new YB;i.accept(s);const o=s.allProductions;ke(o,a=>{const u=
|
|
379
|
-
ke(u,l=>{const f=[c];ke(t,(d,p)=>{c!==p&&
|
|
374
|
+
<-as it is not defined in any of the super grammars `,r.push({message:i,type:$n.INVALID_RULE_OVERRIDE,ruleName:t})),r}function y$(t,e,n,r=[]){const i=[],s=Qf(e.definition);if(ht(s))return[];{const o=t.name;wn(s,t)&&i.push({message:n.buildLeftRecursionError({topLevelRule:t,leftRecursionPath:r}),type:$n.LEFT_RECURSION,ruleName:o});const u=Ff(s,r.concat([t])),c=Vn(u,l=>{const f=nn(r);return f.push(l),y$(t,l,n,f)});return i.concat(c)}}function Qf(t){let e=[];if(ht(t))return e;const n=Rr(t);if(n instanceof
|
|
375
|
+
En)e.push(n.referencedRule);else if(n instanceof In||n instanceof sn||n instanceof Xn||n instanceof Yn||n instanceof On||n instanceof Pt)e=e.concat(Qf(n.definition));else if(n instanceof Ln)e=lr(ve(n.definition,s=>Qf(s.definition)));else if(!(n instanceof wt))throw Error("non exhaustive match");const r=qf(n),i=t.length>1;if(r&&i){const s=rn(t);return e.concat(Qf(s))}else return e}class Hg extends ea{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(
|
|
376
|
+
e)}}function VB(t,e){const n=new Hg;t.accept(n);const r=n.alternations;return Vn(r,s=>{const o=Hu(s.definition);return Vn(o,(a,u)=>{const c=l$([a],[],Yu,1);return ht(c)?[{message:e.buildEmptyAlternationError({topLevelRule:t,alternation:s,emptyChoiceIdx:u}),type:$n.NONE_LAST_EMPTY_ALT,ruleName:t.name,occurrence:s.idx,alternative:u+1}]:[]})})}function XB(t,e,n){const r=new Hg;t.accept(r);let i=r.alternations;return i=Mf(i,o=>o.ignoreAmbiguities===!0),Vn(i,o=>{const a=o.idx,u=o.maxLookahead||e,c=Yf(
|
|
377
|
+
a,t,u,o),l=ZB(c,o,t,n),f=eq(c,o,t,n);return l.concat(f)})}class YB extends ea{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 JB(t,e){const n=new Hg;t.accept(n);const r=n.alternations;return Vn(r,s=>s.definition.length>255?[{message:e.buildTooManyAlternativesError(
|
|
378
|
+
{topLevelRule:t,alternation:s}),type:$n.TOO_MANY_ALTS,ruleName:t.name,occurrence:s.idx}]:[])}function QB(t,e,n){const r=[];return ke(t,i=>{const s=new YB;i.accept(s);const o=s.allProductions;ke(o,a=>{const u=Ug(a),c=a.maxLookahead||e,l=a.idx,d=Jf(l,i,u,c)[0];if(ht(lr(d))){const p=n.buildEmptyRepetitionError({topLevelRule:i,repetition:a});r.push({message:p,type:$n.NO_NON_EMPTY_LOOKAHEAD,ruleName:i.name})}})}),r}function ZB(t,e,n,r){const i=[],s=bn(t,(a,u,c)=>(e.definition[c].ignoreAmbiguities===!0||
|
|
379
|
+
ke(u,l=>{const f=[c];ke(t,(d,p)=>{c!==p&&zg(d,l)&&e.definition[p].ignoreAmbiguities!==!0&&f.push(p)}),f.length>1&&!zg(i,l)&&(i.push(l),a.push({alts:f,path:l}))}),a),[]);return ve(s,a=>{const u=ve(a.alts,l=>l+1);return{message:r.buildAlternationAmbiguityError({topLevelRule:n,alternation:e,ambiguityIndices:u,prefixPath:a.path}),type:$n.AMBIGUOUS_ALTS,ruleName:n.name,occurrence:e.idx,alternatives:a.alts}})}function eq(t,e,n,r){const i=bn(t,(o,a,u)=>{const c=ve(a,l=>({idx:u,path:l}));return o.concat(
|
|
380
380
|
c)},[]);return zu(Vn(i,o=>{if(e.definition[o.idx].ignoreAmbiguities===!0)return[];const u=o.idx,c=o.path,l=Kn(i,d=>e.definition[d.idx].ignoreAmbiguities!==!0&&d.idx<u&&qB(d.path,c));return ve(l,d=>{const p=[d.idx+1,u+1],m=e.idx===0?"":e.idx;return{message:r.buildAlternationPrefixAmbiguityError({topLevelRule:n,alternation:e,ambiguityIndices:p,prefixPath:d.path}),type:$n.AMBIGUOUS_PREFIX_ALTS,ruleName:n.name,occurrence:m,alternatives:p}})}))}function tq(t,e,n){const r=[],i=ve(e,s=>s.name);return ke(
|
|
381
|
-
t,s=>{const o=s.name;if(wn(i,o)){const a=n.buildNamespaceConflictError(s);r.push({message:a,type:$n.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:o})}}),r}function nq(t){const e=
|
|
381
|
+
t,s=>{const o=s.name;if(wn(i,o)){const a=n.buildNamespaceConflictError(s);r.push({message:a,type:$n.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:o})}}),r}function nq(t){const e=Ng(t,{errMsgProvider:TB}),n={};return ke(t.rules,r=>{n[r.name]=r}),CB(n,e.errMsgProvider)}function rq(t){return t=Ng(t,{errMsgProvider:Gs}),GB(t.rules,t.tokenTypes,t.errMsgProvider,t.grammarName)}const v$="MismatchedTokenException",w$="NoViableAltException",b$="EarlyExitException",E$="NotAllInputParsedException",$$=[v$,w$,b$,
|
|
382
382
|
E$];Object.freeze($$);function Zf(t){return wn($$,t.name)}class ep 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 R$ extends ep{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=v$}}class iq extends ep{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=w$}}class sq extends ep{constructor(e,n){super(e,n),this.name=E$}}class oq extends ep{constructor(e,n,r){
|
|
383
|
-
super(e,n),this.previousToken=r,this.name=b$}}const
|
|
383
|
+
super(e,n),this.previousToken=r,this.name=b$}}const Kg={},D$="InRuleRecoveryException";class aq extends Error{constructor(e){super(e),this.name=D$}}class uq{initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=Te(e,"recoveryEnabled")?e.recoveryEnabled:gi.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=cq)}getTokenToInsert(e){const n=jg(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return n.isInsertedInRecovery=!0,n}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){
|
|
384
384
|
return!0}tryInRepetitionRecovery(e,n,r,i){const s=this.findReSyncTokenType(),o=this.exportLexerState(),a=[];let u=!1;const c=this.LA(1);let l=this.LA(1);const f=()=>{const d=this.LA(0),p=this.errorMessageProvider.buildMismatchTokenMessage({expected:i,actual:c,previous:d,ruleName:this.getCurrRuleFullName()}),m=new R$(p,c,this.LA(0));m.resyncedTokens=Hu(a),this.SAVE_ERROR(m)};for(;!u;)if(this.tokenMatcher(l,i)){f();return}else if(r.call(this)){f(),e.apply(this,n);return}else this.tokenMatcher(l,s)?
|
|
385
385
|
u=!0:(l=this.SKIP_TOKEN(),this.addToResyncTokens(l,a));this.importLexerState(o)}shouldInRepetitionRecoveryBeTried(e,n,r){return!(r===!1||this.tokenMatcher(this.LA(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,n)))}getFollowsForInRuleRecovery(e,n){const r=this.getCurrentGrammarPath(e,n);return this.getNextPossibleTokenTypes(r)}tryInRuleRecovery(e,n){if(this.canRecoverWithSingleTokenInsertion(e,n))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(
|
|
386
|
-
e)){const r=this.SKIP_TOKEN();return this.consumeToken(),r}throw new aq("sad sad panda")}canPerformInRuleRecovery(e,n){return this.canRecoverWithSingleTokenInsertion(e,n)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,n){if(!this.canTokenTypeBeInsertedInRecovery(e)||
|
|
387
|
-
const n=this.getCurrFollowKey(),r=this.getFollowSetFromFollowKey(n);return wn(r,e)}findReSyncTokenType(){const e=this.flattenFollowSet();let n=this.LA(1),r=2;for(;;){const i=Qo(e,s=>a$(n,s));if(i!==void 0)return i;n=this.LA(r),r++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return
|
|
388
|
-
shortRuleNameToFullName(r)}}buildFullFollowKeyStack(){const e=this.RULE_STACK,n=this.RULE_OCCURRENCE_STACK;return ve(e,(r,i)=>i===0?
|
|
386
|
+
e)){const r=this.SKIP_TOKEN();return this.consumeToken(),r}throw new aq("sad sad panda")}canPerformInRuleRecovery(e,n){return this.canRecoverWithSingleTokenInsertion(e,n)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,n){if(!this.canTokenTypeBeInsertedInRecovery(e)||ht(n))return!1;const r=this.LA(1);return Qo(n,s=>this.tokenMatcher(r,s))!==void 0}canRecoverWithSingleTokenDeletion(e){return this.canTokenTypeBeDeletedInRecovery(e)?this.tokenMatcher(this.LA(2),e):!1}isInCurrentRuleReSyncSet(e){
|
|
387
|
+
const n=this.getCurrFollowKey(),r=this.getFollowSetFromFollowKey(n);return wn(r,e)}findReSyncTokenType(){const e=this.flattenFollowSet();let n=this.LA(1),r=2;for(;;){const i=Qo(e,s=>a$(n,s));if(i!==void 0)return i;n=this.LA(r),r++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return Kg;const e=this.getLastExplicitRuleShortName(),n=this.getLastExplicitRuleOccurrenceIndex(),r=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:n,inRule:this.
|
|
388
|
+
shortRuleNameToFullName(r)}}buildFullFollowKeyStack(){const e=this.RULE_STACK,n=this.RULE_OCCURRENCE_STACK;return ve(e,(r,i)=>i===0?Kg:{ruleName:this.shortRuleNameToFullName(r),idxInCallingRule:n[i],inRule:this.shortRuleNameToFullName(e[i-1])})}flattenFollowSet(){const e=ve(this.buildFullFollowKeyStack(),n=>this.getFollowSetFromFollowKey(n));return lr(e)}getFollowSetFromFollowKey(e){if(e===Kg)return[Zi];const n=e.ruleName+e.idxInCallingRule+FE+e.inRule;return this.resyncFollows[n]}addToResyncTokens(e,n){
|
|
389
389
|
return this.tokenMatcher(e,Zi)||n.push(e),n}reSyncTo(e){const n=[];let r=this.LA(1);for(;this.tokenMatcher(r,e)===!1;)r=this.SKIP_TOKEN(),this.addToResyncTokens(r,n);return Hu(n)}attemptInRepetitionRecovery(e,n,r,i,s,o,a){}getCurrentGrammarPath(e,n){const r=this.getHumanReadableRuleStack(),i=nn(this.RULE_OCCURRENCE_STACK);return{ruleStack:r,occurrenceStack:i,lastTok:e,lastTokOccurrence:n}}getHumanReadableRuleStack(){return ve(this.RULE_STACK,e=>this.shortRuleNameToFullName(e))}}function cq(t,e,n,r,i,s,o){
|
|
390
|
-
const a=this.getKeyForAutomaticLookahead(r,i);let u=this.firstAfterRepMap[a];if(u===void 0){const d=this.getCurrRuleFullName(),p=this.getGAstProductions()[d];u=new s(p,i).startWalking(),this.firstAfterRepMap[a]=u}let c=u.token,l=u.occurrence;const f=u.isEndOfRule;this.RULE_STACK.length===1&&f&&c===void 0&&(c=Zi,l=1),!(c===void 0||l===void 0)&&this.shouldInRepetitionRecoveryBeTried(c,l,o)&&this.tryInRepetitionRecovery(t,e,n,c)}const lq=4,es=8,k$=1<<es,T$=2<<es,
|
|
391
|
-
function
|
|
392
|
-
return Vn(e,n=>VB(n,Gs))}validateAmbiguousAlternationAlternatives(e,n){return Vn(e,r=>XB(r,n,Gs))}validateSomeNonEmptyLookaheadPath(e,n){return QB(e,n,Gs)}buildLookaheadForAlternation(e){return IB(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,LB)}buildLookaheadForOptional(e){return OB(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,
|
|
393
|
-
gi.dynamicTokensEnabled,this.maxLookahead=Te(e,"maxLookahead")?e.maxLookahead:gi.maxLookahead,this.lookaheadStrategy=Te(e,"lookaheadStrategy")?e.lookaheadStrategy:new
|
|
394
|
-
`${Kr(c)}${l}`,()=>{const f=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:c.idx,rule:n,maxLookahead:c.maxLookahead||this.maxLookahead,hasPredicates:c.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),d=
|
|
395
|
-
n,c.idx,
|
|
396
|
-
prodType:i}),u=
|
|
390
|
+
const a=this.getKeyForAutomaticLookahead(r,i);let u=this.firstAfterRepMap[a];if(u===void 0){const d=this.getCurrRuleFullName(),p=this.getGAstProductions()[d];u=new s(p,i).startWalking(),this.firstAfterRepMap[a]=u}let c=u.token,l=u.occurrence;const f=u.isEndOfRule;this.RULE_STACK.length===1&&f&&c===void 0&&(c=Zi,l=1),!(c===void 0||l===void 0)&&this.shouldInRepetitionRecoveryBeTried(c,l,o)&&this.tryInRepetitionRecovery(t,e,n,c)}const lq=4,es=8,k$=1<<es,T$=2<<es,Vg=3<<es,Xg=4<<es,Yg=5<<es,tp=6<<es;
|
|
391
|
+
function Jg(t,e,n){return n|e|t}class Qg{constructor(e){var n;this.maxLookahead=(n=e?.maxLookahead)!==null&&n!==void 0?n:gi.maxLookahead}validate(e){const n=this.validateNoLeftRecursion(e.rules);if(ht(n)){const r=this.validateEmptyOrAlternatives(e.rules),i=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),s=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...n,...r,...i,...s]}return n}validateNoLeftRecursion(e){return Vn(e,n=>y$(n,n,Gs))}validateEmptyOrAlternatives(e){
|
|
392
|
+
return Vn(e,n=>VB(n,Gs))}validateAmbiguousAlternationAlternatives(e,n){return Vn(e,r=>XB(r,n,Gs))}validateSomeNonEmptyLookaheadPath(e,n){return QB(e,n,Gs)}buildLookaheadForAlternation(e){return IB(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,LB)}buildLookaheadForOptional(e){return OB(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,Ug(e.prodType),FB)}}class dq{initLooksAhead(e){this.dynamicTokensEnabled=Te(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:
|
|
393
|
+
gi.dynamicTokensEnabled,this.maxLookahead=Te(e,"maxLookahead")?e.maxLookahead:gi.maxLookahead,this.lookaheadStrategy=Te(e,"lookaheadStrategy")?e.lookaheadStrategy:new Qg({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){ke(e,n=>{this.TRACE_INIT(`${n.name} Rule Lookahead`,()=>{const{alternation:r,repetition:i,option:s,repetitionMandatory:o,repetitionMandatoryWithSeparator:a,repetitionWithSeparator:u}=pq(n);ke(r,c=>{const l=c.idx===0?"":c.idx;this.TRACE_INIT(
|
|
394
|
+
`${Kr(c)}${l}`,()=>{const f=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:c.idx,rule:n,maxLookahead:c.maxLookahead||this.maxLookahead,hasPredicates:c.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),d=Jg(this.fullRuleNameToShort[n.name],k$,c.idx);this.setLaFuncCache(d,f)})}),ke(i,c=>{this.computeLookaheadFunc(n,c.idx,Vg,"Repetition",c.maxLookahead,Kr(c))}),ke(s,c=>{this.computeLookaheadFunc(n,c.idx,T$,"Option",c.maxLookahead,Kr(c))}),ke(o,c=>{this.computeLookaheadFunc(
|
|
395
|
+
n,c.idx,Xg,"RepetitionMandatory",c.maxLookahead,Kr(c))}),ke(a,c=>{this.computeLookaheadFunc(n,c.idx,tp,"RepetitionMandatoryWithSeparator",c.maxLookahead,Kr(c))}),ke(u,c=>{this.computeLookaheadFunc(n,c.idx,Yg,"RepetitionWithSeparator",c.maxLookahead,Kr(c))})})})}computeLookaheadFunc(e,n,r,i,s,o){this.TRACE_INIT(`${o}${n===0?"":n}`,()=>{const a=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:n,rule:e,maxLookahead:s||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,
|
|
396
|
+
prodType:i}),u=Jg(this.fullRuleNameToShort[e.name],r,n);this.setLaFuncCache(u,a)})}getKeyForAutomaticLookahead(e,n){const r=this.getLastExplicitRuleShortName();return Jg(r,e,n)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,n){this.lookAheadFuncsCache.set(e,n)}}class fq extends ea{constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.
|
|
397
397
|
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){
|
|
398
398
|
this.dslMethods.alternation.push(e)}}const np=new fq;function pq(t){np.reset(),t.accept(np);const e=np.dslMethods;return np.reset(),e}function C$(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.endOffset=e.endOffset):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset)}function A$(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&&
|
|
399
399
|
(t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine)}function hq(t,e,n){t.children[n]===void 0?t.children[n]=[e]:t.children[n].push(e)}function mq(t,e,n){t.children[e]===void 0?t.children[e]=[n]:t.children[e].push(n)}const gq="name";function S$(t,e){Object.defineProperty(t,gq,{enumerable:!1,configurable:!0,writable:!1,value:e})}function yq(t,e){const n=cr(t),r=n.length;for(let i=0;i<r;i++){const s=n[i],o=t[s],a=o.length;for(let u=0;u<a;u++){const c=o[u];c.tokenTypeIdx===void 0&&
|
|
400
|
-
this[c.name](c.children,e)}}}function vq(t,e){const n=function(){};S$(n,t+"BaseSemantics");const r={visit:function(i,s){if(Je(i)&&(i=i[0]),!mi(i))return this[i.name](i.children,s)},validateVisitor:function(){const i=bq(this,e);if(!
|
|
400
|
+
this[c.name](c.children,e)}}}function vq(t,e){const n=function(){};S$(n,t+"BaseSemantics");const r={visit:function(i,s){if(Je(i)&&(i=i[0]),!mi(i))return this[i.name](i.children,s)},validateVisitor:function(){const i=bq(this,e);if(!ht(i)){const s=ve(i,o=>o.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
|
|
401
401
|
${s.join(`
|
|
402
402
|
|
|
403
403
|
`).replace(/\n/g,`
|
|
404
|
-
`)}`)}}};return n.prototype=r,n.prototype.constructor=n,n._RULE_NAMES=e,n}function wq(t,e,n){const r=function(){};S$(r,t+"BaseSemanticsWithDefaults");const i=Object.create(n.prototype);return ke(e,s=>{i[s]=yq}),r.prototype=i,r.prototype.constructor=r,r}var
|
|
405
|
-
n ${t.constructor.name} CST Visitor.`,type:
|
|
404
|
+
`)}`)}}};return n.prototype=r,n.prototype.constructor=n,n._RULE_NAMES=e,n}function wq(t,e,n){const r=function(){};S$(r,t+"BaseSemanticsWithDefaults");const i=Object.create(n.prototype);return ke(e,s=>{i[s]=yq}),r.prototype=i,r.prototype.constructor=r,r}var Zg;(function(t){t[t.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",t[t.MISSING_METHOD=1]="MISSING_METHOD"})(Zg||(Zg={}));function bq(t,e){return Eq(t,e)}function Eq(t,e){const n=Kn(e,i=>di(t[i])===!1),r=ve(n,i=>({msg:`Missing visitor method: <${i}> o\
|
|
405
|
+
n ${t.constructor.name} CST Visitor.`,type:Zg.MISSING_METHOD,methodName:i}));return zu(r)}class $q{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=Te(e,"nodeLocationTracking")?e.nodeLocationTracking:gi.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=Ut,this.cstFinallyStateUpdate=Ut,this.cstPostTerminal=Ut,this.cstPostNonTerminal=Ut,this.cstPostRule=Ut;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=
|
|
406
406
|
A$,this.setNodeLocationFromNode=A$,this.cstPostRule=Ut,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=Ut,this.setNodeLocationFromNode=Ut,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=C$,this.setNodeLocationFromNode=C$,this.cstPostRule=Ut,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):
|
|
407
407
|
(this.setNodeLocationFromToken=Ut,this.setNodeLocationFromNode=Ut,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=Ut,this.setNodeLocationFromNode=Ut,this.cstPostRule=Ut,this.setInitialNodeLocation=Ut;else throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`)}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:NaN,
|
|
408
408
|
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.
|
|
@@ -422,20 +422,20 @@ e)){const o={message:Gs.buildDuplicateRuleNameError({topLevelRule:e,grammarName:
|
|
|
422
422
|
saveRecogState();try{return e.apply(this,n),!0}catch(i){if(Zf(i))return!1;throw i}finally{this.reloadRecogState(r),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return N2(Wt(this.gastProductionsCache))}}class kq{initRecognizerEngine(e,n){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=Vf,this.subruleIdx=0,this.definedRulesNames=[],this.
|
|
423
423
|
tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},Te(n,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
|
|
424
424
|
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
|
|
425
|
-
For Further details.`);if(Je(e)){if(
|
|
425
|
+
For Further details.`);if(Je(e)){if(ht(e))throw Error(`A Token Vocabulary cannot be empty.
|
|
426
426
|
Note that the first argument for the parser constructor
|
|
427
427
|
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.
|
|
428
428
|
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
|
|
429
|
-
For Further details.`)}if(Je(e))this.tokensMap=bn(e,(s,o)=>(s[o.name]=o,s),{});else if(Te(e,"modes")&&$r(lr(Wt(e.modes)),RB)){const s=lr(Wt(e.modes)),o=
|
|
429
|
+
For Further details.`)}if(Je(e))this.tokensMap=bn(e,(s,o)=>(s[o.name]=o,s),{});else if(Te(e,"modes")&&$r(lr(Wt(e.modes)),RB)){const s=lr(Wt(e.modes)),o=Ig(s);this.tokensMap=bn(o,(a,u)=>(a[u.name]=u,a),{})}else if(ur(e))this.tokensMap=nn(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=Zi;const r=Te(e,"modes")?lr(Wt(e.modes)):Wt(e),i=$r(r,s=>ht(s.categoryMatches));this.
|
|
430
430
|
tokenMatcher=i?Vf:Yu,Ju(Wt(this.tokensMap))}defineRule(e,n,r){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'
|
|
431
431
|
Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);const i=Te(r,"resyncEnabled")?r.resyncEnabled:op.resyncEnabled,s=Te(r,"recoveryValueFunc")?r.recoveryValueFunc:op.recoveryValueFunc,o=this.ruleShortNameIdx<<lq+es;this.ruleShortNameIdx++,this.shortRuleNameToFull[o]=e,this.fullRuleNameToShort[e]=o;let a;return this.outputCst===!0?a=function(...l){try{this.ruleInvocationStateUpdate(o,e,this.subruleIdx),n.apply(this,l);const f=this.CST_STACK[this.CST_STACK.
|
|
432
432
|
length-1];return this.cstPostRule(f),f}catch(f){return this.invokeRuleCatch(f,i,s)}finally{this.ruleFinallyStateUpdate()}}:a=function(...l){try{return this.ruleInvocationStateUpdate(o,e,this.subruleIdx),n.apply(this,l)}catch(f){return this.invokeRuleCatch(f,i,s)}finally{this.ruleFinallyStateUpdate()}},Object.assign(a,{ruleName:e,originalGrammarAction:n})}invokeRuleCatch(e,n,r){const i=this.RULE_STACK.length===1,s=n&&!this.isBackTracking()&&this.recoveryEnabled;if(Zf(e)){const o=e;if(s){const a=this.
|
|
433
433
|
findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(a))if(o.resyncedTokens=this.reSyncTo(a),this.outputCst){const u=this.CST_STACK[this.CST_STACK.length-1];return u.recoveredNode=!0,u}else return r(e);else{if(this.outputCst){const u=this.CST_STACK[this.CST_STACK.length-1];u.recoveredNode=!0,o.partialCstResult=u}throw o}}else{if(i)return this.moveToTerminatedState(),r(e);throw o}}else throw e}optionInternal(e,n){const r=this.getKeyForAutomaticLookahead(T$,n);return this.optionInternalLogic(e,n,
|
|
434
|
-
r)}optionInternalLogic(e,n,r){let i=this.getLaFuncFromCache(r),s;if(typeof e!="function"){s=e.DEF;const o=e.GATE;if(o!==void 0){const a=i;i=()=>o.call(this)&&a.call(this)}}else s=e;if(i.call(this)===!0)return s.call(this)}atLeastOneInternal(e,n){const r=this.getKeyForAutomaticLookahead(
|
|
435
|
-
this)}}else s=n;if(i.call(this)===!0){let o=this.doSingleRepetition(s);for(;i.call(this)===!0&&o===!0;)o=this.doSingleRepetition(s)}else throw this.raiseEarlyExitException(e,Tt.REPETITION_MANDATORY,n.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,n],i,
|
|
436
|
-
this)===!0){i.call(this);const a=()=>this.tokenMatcher(this.LA(1),s);for(;this.tokenMatcher(this.LA(1),s)===!0;)this.CONSUME(s),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,s,a,i,c$],a,tp,e,c$)}else throw this.raiseEarlyExitException(e,Tt.REPETITION_MANDATORY_WITH_SEPARATOR,n.ERR_MSG)}manyInternal(e,n){const r=this.getKeyForAutomaticLookahead(
|
|
437
|
-
unction"){s=n.DEF;const a=n.GATE;if(a!==void 0){const u=i;i=()=>a.call(this)&&u.call(this)}}else s=n;let o=!0;for(;i.call(this)===!0&&o===!0;)o=this.doSingleRepetition(s);this.attemptInRepetitionRecovery(this.manyInternal,[e,n],i,
|
|
438
|
-
LA(1),s);for(;this.tokenMatcher(this.LA(1),s)===!0;)this.CONSUME(s),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,s,a,i,u$],a,
|
|
434
|
+
r)}optionInternalLogic(e,n,r){let i=this.getLaFuncFromCache(r),s;if(typeof e!="function"){s=e.DEF;const o=e.GATE;if(o!==void 0){const a=i;i=()=>o.call(this)&&a.call(this)}}else s=e;if(i.call(this)===!0)return s.call(this)}atLeastOneInternal(e,n){const r=this.getKeyForAutomaticLookahead(Xg,e);return this.atLeastOneInternalLogic(e,n,r)}atLeastOneInternalLogic(e,n,r){let i=this.getLaFuncFromCache(r),s;if(typeof n!="function"){s=n.DEF;const o=n.GATE;if(o!==void 0){const a=i;i=()=>o.call(this)&&a.call(
|
|
435
|
+
this)}}else s=n;if(i.call(this)===!0){let o=this.doSingleRepetition(s);for(;i.call(this)===!0&&o===!0;)o=this.doSingleRepetition(s)}else throw this.raiseEarlyExitException(e,Tt.REPETITION_MANDATORY,n.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,n],i,Xg,e,PB)}atLeastOneSepFirstInternal(e,n){const r=this.getKeyForAutomaticLookahead(tp,e);this.atLeastOneSepFirstInternalLogic(e,n,r)}atLeastOneSepFirstInternalLogic(e,n,r){const i=n.DEF,s=n.SEP;if(this.getLaFuncFromCache(r).call(
|
|
436
|
+
this)===!0){i.call(this);const a=()=>this.tokenMatcher(this.LA(1),s);for(;this.tokenMatcher(this.LA(1),s)===!0;)this.CONSUME(s),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,s,a,i,c$],a,tp,e,c$)}else throw this.raiseEarlyExitException(e,Tt.REPETITION_MANDATORY_WITH_SEPARATOR,n.ERR_MSG)}manyInternal(e,n){const r=this.getKeyForAutomaticLookahead(Vg,e);return this.manyInternalLogic(e,n,r)}manyInternalLogic(e,n,r){let i=this.getLaFuncFromCache(r),s;if(typeof n!="f\
|
|
437
|
+
unction"){s=n.DEF;const a=n.GATE;if(a!==void 0){const u=i;i=()=>a.call(this)&&u.call(this)}}else s=n;let o=!0;for(;i.call(this)===!0&&o===!0;)o=this.doSingleRepetition(s);this.attemptInRepetitionRecovery(this.manyInternal,[e,n],i,Vg,e,xB,o)}manySepFirstInternal(e,n){const r=this.getKeyForAutomaticLookahead(Yg,e);this.manySepFirstInternalLogic(e,n,r)}manySepFirstInternalLogic(e,n,r){const i=n.DEF,s=n.SEP;if(this.getLaFuncFromCache(r).call(this)===!0){i.call(this);const a=()=>this.tokenMatcher(this.
|
|
438
|
+
LA(1),s);for(;this.tokenMatcher(this.LA(1),s)===!0;)this.CONSUME(s),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,s,a,i,u$],a,Yg,e,u$)}}repetitionSepSecondInternal(e,n,r,i,s){for(;r();)this.CONSUME(n),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,n,r,i,s],r,tp,e,s)}doSingleRepetition(e){const n=this.getLexerPosition();return e.call(this),this.getLexerPosition()>n}orInternal(e,n){const r=this.getKeyForAutomaticLookahead(k$,n),
|
|
439
439
|
i=Je(e)?e:e.DEF,o=this.getLaFuncFromCache(r).call(this,i);if(o!==void 0)return i[o].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 sq(n,e))}}subruleInternal(e,n,r){let i;try{
|
|
440
440
|
const s=r!==void 0?r.ARGS:void 0;return this.subruleIdx=n,i=e.apply(this,s),this.cstPostNonTerminal(i,r!==void 0&&r.LABEL!==void 0?r.LABEL:e.ruleName),i}catch(s){throw this.subruleInternalError(s,r,e.ruleName)}}subruleInternalError(e,n,r){throw Zf(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,n!==void 0&&n.LABEL!==void 0?n.LABEL:r),delete e.partialCstResult),e}consumeInternal(e,n,r){let i;try{const s=this.LA(1);this.tokenMatcher(s,e)===!0?(this.consumeToken(),i=s):
|
|
441
441
|
this.consumeInternalError(e,s,r)}catch(s){i=this.consumeInternalRecovery(e,n,s)}return this.cstPostTerminal(r!==void 0&&r.LABEL!==void 0?r.LABEL:e.name,i),i}consumeInternalError(e,n,r){let i;const s=this.LA(0);throw r!==void 0&&r.ERR_MSG?i=r.ERR_MSG:i=this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:n,previous:s,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new R$(i,n,s))}consumeInternalRecovery(e,n,r){if(this.recoveryEnabled&&r.name==="MismatchedTokenException"&&!this.
|
|
@@ -444,7 +444,7 @@ cstInvocationStateUpdate(n)}isBackTracking(){return this.isBackTrackingStack.len
|
|
|
444
444
|
_errors=[],this.errorMessageProvider=Te(e,"errorMessageProvider")?e.errorMessageProvider:gi.errorMessageProvider}SAVE_ERROR(e){if(Zf(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:nn(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return nn(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,n,r){const i=this.getCurrRuleFullName(),s=this.getGAstProductions()[i],
|
|
445
445
|
a=Jf(e,s,n,this.maxLookahead)[0],u=[];for(let l=1;l<=this.maxLookahead;l++)u.push(this.LA(l));const c=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:a,actual:u,previous:this.LA(0),customUserDescription:r,ruleName:i});throw this.SAVE_ERROR(new oq(c,this.LA(1),this.LA(0)))}raiseNoAltException(e,n){const r=this.getCurrRuleFullName(),i=this.getGAstProductions()[r],s=Yf(e,i,this.maxLookahead),o=[];for(let c=1;c<=this.maxLookahead;c++)o.push(this.LA(c));const a=this.LA(0),u=this.
|
|
446
446
|
errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:s,actual:o,previous:a,customUserDescription:n,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new iq(u,this.LA(1),a))}}class Cq{initContentAssist(){}computeContentAssist(e,n){const r=this.gastProductionsCache[e];if(mi(r))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return l$([r],n,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){const n=Rr(e.ruleStack),i=this.getGAstProductions()[n];return new _B(
|
|
447
|
-
i,e).startWalking()}}const rp={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(rp);const _$=!0,x$=Math.pow(2,es)-1,P$=o$({name:"RECORDING_PHASE_TOKEN",pattern:
|
|
447
|
+
i,e).startWalking()}}const rp={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(rp);const _$=!0,x$=Math.pow(2,es)-1,P$=o$({name:"RECORDING_PHASE_TOKEN",pattern:Fn.NA});Ju([P$]);const N$=jg(P$,`This IToken indicates the Parser is in Recording Phase
|
|
448
448
|
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(N$);const Aq={name:`This CSTNode indicates the Parser is in Recording Phase
|
|
449
449
|
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}};class Sq{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(r,i){return this.consumeInternalRecord(r,e,i)},this[`SUBRULE${n}`]=function(r,i){return this.subruleInternalRecord(r,e,i)},this[`OPTION${n}`]=function(r){return this.optionInternalRecord(
|
|
450
450
|
r,e)},this[`OR${n}`]=function(r){return this.orInternalRecord(r,e)},this[`MANY${n}`]=function(r){this.manyInternalRecord(e,r)},this[`MANY_SEP${n}`]=function(r){this.manySepFirstInternalRecord(e,r)},this[`AT_LEAST_ONE${n}`]=function(r){this.atLeastOneInternalRecord(e,r)},this[`AT_LEAST_ONE_SEP${n}`]=function(r){this.atLeastOneSepFirstInternalRecord(e,r)}}this.consume=function(e,n,r){return this.consumeInternalRecord(n,e,r)},this.subrule=function(e,n,r){return this.subruleInternalRecord(n,e,r)},this.
|
|
@@ -452,67 +452,67 @@ option=function(e,n){return this.optionInternalRecord(n,e)},this.or=function(e,n
|
|
|
452
452
|
SUBRULE${r}`],delete e[`OPTION${r}`],delete e[`OR${r}`],delete e[`MANY${r}`],delete e[`MANY_SEP${r}`],delete e[`AT_LEAST_ONE${r}`],delete e[`AT_LEAST_ONE_SEP${r}`]}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 sp}topLevelRuleRecord(e,n){try{const r=new Zo({definition:[],name:e});return r.name=e,this.recordingProdStack.push(r),
|
|
453
453
|
n.call(this),this.recordingProdStack.pop(),r}catch(r){if(r.KNOWN_RECORDER_ERROR!==!0)try{r.message=r.message+`
|
|
454
454
|
This error was thrown during the "grammar recording phase" For more info see:
|
|
455
|
-
https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw r}throw r}}optionInternalRecord(e,n){return Zu.call(this,sn,e,n)}atLeastOneInternalRecord(e,n){Zu.call(this,Xn,n,e)}atLeastOneSepFirstInternalRecord(e,n){Zu.call(this,Yn,n,e,_$)}manyInternalRecord(e,n){Zu.call(this,Pt,n,e)}manySepFirstInternalRecord(e,n){Zu.call(this,
|
|
455
|
+
https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw r}throw r}}optionInternalRecord(e,n){return Zu.call(this,sn,e,n)}atLeastOneInternalRecord(e,n){Zu.call(this,Xn,n,e)}atLeastOneSepFirstInternalRecord(e,n){Zu.call(this,Yn,n,e,_$)}manyInternalRecord(e,n){Zu.call(this,Pt,n,e)}manySepFirstInternalRecord(e,n){Zu.call(this,On,n,e,_$)}orInternalRecord(e,n){return _q.call(this,e,n)}subruleInternalRecord(e,n,r){if(ip(n),!e||Te(e,"ruleName")===!1){const a=new Error(`<SUBRULE${I$(
|
|
456
456
|
n)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>
|
|
457
457
|
inside top level rule: <${this.recordingProdStack[0].name}>`);throw a.KNOWN_RECORDER_ERROR=!0,a}const i=Jo(this.recordingProdStack),s=e.ruleName,o=new En({idx:n,nonTerminalName:s,label:r?.LABEL,referencedRule:void 0});return i.definition.push(o),this.outputCst?Aq:rp}consumeInternalRecord(e,n,r){if(ip(n),!XE(e)){const o=new Error(`<CONSUME${I$(n)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>
|
|
458
458
|
inside top level rule: <${this.recordingProdStack[0].name}>`);throw o.KNOWN_RECORDER_ERROR=!0,o}const i=Jo(this.recordingProdStack),s=new wt({idx:n,terminalType:e,label:r?.LABEL});return i.definition.push(s),N$}}function Zu(t,e,n,r=!1){ip(n);const i=Jo(this.recordingProdStack),s=di(e)?e:e.DEF,o=new t({definition:[],idx:n});return r&&(o.separator=e.SEP),Te(e,"MAX_LOOKAHEAD")&&(o.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(o),s.call(this),i.definition.push(o),this.recordingProdStack.
|
|
459
|
-
pop(),rp}function _q(t,e){ip(e);const n=Jo(this.recordingProdStack),r=Je(t)===!1,i=r===!1?t:t.DEF,s=new
|
|
459
|
+
pop(),rp}function _q(t,e){ip(e);const n=Jo(this.recordingProdStack),r=Je(t)===!1,i=r===!1?t:t.DEF,s=new Ln({definition:[],idx:e,ignoreAmbiguities:r&&t.IGNORE_AMBIGUITIES===!0});Te(t,"MAX_LOOKAHEAD")&&(s.maxLookahead=t.MAX_LOOKAHEAD);const o=xE(i,a=>di(a.GATE));return s.hasPredicates=o,n.definition.push(s),ke(i,a=>{const u=new In({definition:[]});s.definition.push(u),Te(a,"IGNORE_AMBIGUITIES")?u.ignoreAmbiguities=a.IGNORE_AMBIGUITIES:Te(a,"GATE")&&(u.ignoreAmbiguities=!0),this.recordingProdStack.
|
|
460
460
|
push(u),a.ALT.call(this),this.recordingProdStack.pop()}),rp}function I$(t){return t===0?"":`${t}`}function ip(t){if(t<0||t>x$){const e=new Error(`Invalid DSL Method idx value: <${t}>
|
|
461
461
|
Idx value must be a none negative value smaller than ${x$+1}`);throw e.KNOWN_RECORDER_ERROR=!0,e}}class xq{initPerformanceTracer(e){if(Te(e,"traceInitPerf")){const n=e.traceInitPerf,r=typeof n=="number";this.traceInitMaxIdent=r?n:1/0,this.traceInitPerf=r?n>0:n}else this.traceInitMaxIdent=0,this.traceInitPerf=gi.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,n){if(this.traceInitPerf===!0){this.traceInitIndent++;const r=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&
|
|
462
|
-
console.log(`${r}--> <${e}>`);const{time:i,value:s}=IE(n),o=i>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&o(`${r}<-- <${e}> time: ${i}ms`),this.traceInitIndent--,s}else return n()}}function Pq(t,e){e.forEach(n=>{const r=n.prototype;Object.getOwnPropertyNames(r).forEach(i=>{if(i==="constructor")return;const s=Object.getOwnPropertyDescriptor(r,i);s&&(s.get||s.set)?Object.defineProperty(t.prototype,i,s):t.prototype[i]=n.prototype[i]})})}const sp=
|
|
462
|
+
console.log(`${r}--> <${e}>`);const{time:i,value:s}=IE(n),o=i>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&o(`${r}<-- <${e}> time: ${i}ms`),this.traceInitIndent--,s}else return n()}}function Pq(t,e){e.forEach(n=>{const r=n.prototype;Object.getOwnPropertyNames(r).forEach(i=>{if(i==="constructor")return;const s=Object.getOwnPropertyDescriptor(r,i);s&&(s.get||s.set)?Object.defineProperty(t.prototype,i,s):t.prototype[i]=n.prototype[i]})})}const sp=jg(Zi,"",NaN,NaN,
|
|
463
463
|
NaN,NaN,NaN,NaN);Object.freeze(sp);const gi=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:na,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),op=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});var $n;(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",
|
|
464
464
|
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_LOOKAH\
|
|
465
465
|
EAD_VALIDATION"})($n||($n={}));function O$(t=void 0){return function(){return t}}class Kd{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",()=>{OE(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),ke(this.definedRulesNames,
|
|
466
|
-
i=>{const o=this[i].originalGrammarAction;let a;this.TRACE_INIT(`${i} Rule`,()=>{a=this.topLevelRuleRecord(i,o)}),this.gastProductionsCache[i]=a})}finally{this.disableRecording()}});let r=[];if(this.TRACE_INIT("Grammar Resolving",()=>{r=nq({rules:Wt(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(r)}),this.TRACE_INIT("Grammar Validations",()=>{if(
|
|
467
|
-
grammarName:n}),s=jB({lookaheadStrategy:this.lookaheadStrategy,rules:Wt(this.gastProductionsCache),tokenTypes:Wt(this.tokensMap),grammarName:n});this.definitionErrors=this.definitionErrors.concat(i,s)}}),
|
|
468
|
-
this.gastProductionsCache)}),this.preComputeLookaheadFunctions(Wt(this.gastProductionsCache))})),!Kd.DEFER_DEFINITION_ERRORS_HANDLING&&!
|
|
466
|
+
i=>{const o=this[i].originalGrammarAction;let a;this.TRACE_INIT(`${i} Rule`,()=>{a=this.topLevelRuleRecord(i,o)}),this.gastProductionsCache[i]=a})}finally{this.disableRecording()}});let r=[];if(this.TRACE_INIT("Grammar Resolving",()=>{r=nq({rules:Wt(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(r)}),this.TRACE_INIT("Grammar Validations",()=>{if(ht(r)&&this.skipValidations===!1){const i=rq({rules:Wt(this.gastProductionsCache),tokenTypes:Wt(this.tokensMap),errMsgProvider:Gs,
|
|
467
|
+
grammarName:n}),s=jB({lookaheadStrategy:this.lookaheadStrategy,rules:Wt(this.gastProductionsCache),tokenTypes:Wt(this.tokensMap),grammarName:n});this.definitionErrors=this.definitionErrors.concat(i,s)}}),ht(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{const i=q2(Wt(this.gastProductionsCache));this.resyncFollows=i}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var i,s;(s=(i=this.lookaheadStrategy).initialize)===null||s===void 0||s.call(i,{rules:Wt(
|
|
468
|
+
this.gastProductionsCache)}),this.preComputeLookaheadFunctions(Wt(this.gastProductionsCache))})),!Kd.DEFER_DEFINITION_ERRORS_HANDLING&&!ht(this.definitionErrors))throw e=ve(this.definitionErrors,i=>i.message),new Error(`Parser Definition Errors detected:
|
|
469
469
|
${e.join(`
|
|
470
470
|
-------------------------------
|
|
471
471
|
`)}`)})}constructor(e,n){this.definitionErrors=[],this.selfAnalysisDone=!1;const r=this;if(r.initErrorHandler(n),r.initLexerAdapter(),r.initLooksAhead(n),r.initRecognizerEngine(e,n),r.initRecoverable(n),r.initTreeBuilder(n),r.initContentAssist(),r.initGastRecorder(n),r.initPerformanceTracer(n),Te(n,"ignoredIssues"))throw new Error(`The <ignoredIssues> IParserConfig property has been deprecated.
|
|
472
472
|
Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
|
|
473
473
|
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
|
|
474
|
-
For further details.`);this.skipValidations=Te(n,"skipValidations")?n.skipValidations:gi.skipValidations}}Kd.DEFER_DEFINITION_ERRORS_HANDLING=!1,Pq(Kd,[uq,dq,$q,Rq,kq,Dq,Tq,Cq,Sq,xq]);class Nq extends Kd{constructor(e,n=gi){const r=nn(n);r.outputCst=!1,super(e,r)}}function ra(t,e,n){return`${t.name}_${e}_${n}`}const ts=1,Iq=2,L$=4,F$=5,ec=7,Oq=8,Lq=9,Fq=10,Mq=11,M$=12;class
|
|
475
|
-
super(e)}isEpsilon(){return!0}}class
|
|
476
|
-
set(i,s),t.ruleToStopState.set(i,o)}}function q$(t,e,n){return n instanceof wt?
|
|
477
|
-
n);return G$(t,e,n,i,s)}function Uq(t,e,n){const r=Xt(t,e,n,{type:L$});ns(t,r);const i=ia(t,e,r,n,Us(t,e,n));return j$(t,e,n,i)}function Wq(t,e,n){const r=Xt(t,e,n,{type:L$});ns(t,r);const i=ia(t,e,r,n,Us(t,e,n)),s=
|
|
474
|
+
For further details.`);this.skipValidations=Te(n,"skipValidations")?n.skipValidations:gi.skipValidations}}Kd.DEFER_DEFINITION_ERRORS_HANDLING=!1,Pq(Kd,[uq,dq,$q,Rq,kq,Dq,Tq,Cq,Sq,xq]);class Nq extends Kd{constructor(e,n=gi){const r=nn(n);r.outputCst=!1,super(e,r)}}function ra(t,e,n){return`${t.name}_${e}_${n}`}const ts=1,Iq=2,L$=4,F$=5,ec=7,Oq=8,Lq=9,Fq=10,Mq=11,M$=12;class ey{constructor(e){this.target=e}isEpsilon(){return!1}}class ty extends ey{constructor(e,n){super(e),this.tokenType=n}}class B$ extends ey{constructor(e){
|
|
475
|
+
super(e)}isEpsilon(){return!0}}class ny extends ey{constructor(e,n,r){super(e),this.rule=n,this.followState=r}isEpsilon(){return!0}}function Bq(t){const e={decisionMap:{},decisionStates:[],ruleToStartState:new Map,ruleToStopState:new Map,states:[]};qq(e,t);const n=t.length;for(let r=0;r<n;r++){const i=t[r],s=Us(e,i,i);s!==void 0&&Jq(e,i,s)}return e}function qq(t,e){const n=e.length;for(let r=0;r<n;r++){const i=e[r],s=Xt(t,i,void 0,{type:Iq}),o=Xt(t,i,void 0,{type:ec});s.stop=o,t.ruleToStartState.
|
|
476
|
+
set(i,s),t.ruleToStopState.set(i,o)}}function q$(t,e,n){return n instanceof wt?ry(t,e,n.terminalType,n):n instanceof En?Yq(t,e,n):n instanceof Ln?zq(t,e,n):n instanceof sn?Hq(t,e,n):n instanceof Pt?jq(t,e,n):n instanceof On?Gq(t,e,n):n instanceof Xn?Uq(t,e,n):n instanceof Yn?Wq(t,e,n):Us(t,e,n)}function jq(t,e,n){const r=Xt(t,e,n,{type:F$});ns(t,r);const i=ia(t,e,r,n,Us(t,e,n));return G$(t,e,n,i)}function Gq(t,e,n){const r=Xt(t,e,n,{type:F$});ns(t,r);const i=ia(t,e,r,n,Us(t,e,n)),s=ry(t,e,n.separator,
|
|
477
|
+
n);return G$(t,e,n,i,s)}function Uq(t,e,n){const r=Xt(t,e,n,{type:L$});ns(t,r);const i=ia(t,e,r,n,Us(t,e,n));return j$(t,e,n,i)}function Wq(t,e,n){const r=Xt(t,e,n,{type:L$});ns(t,r);const i=ia(t,e,r,n,Us(t,e,n)),s=ry(t,e,n.separator,n);return j$(t,e,n,i,s)}function zq(t,e,n){const r=Xt(t,e,n,{type:ts});ns(t,r);const i=ve(n.definition,o=>q$(t,e,o));return ia(t,e,r,n,...i)}function Hq(t,e,n){const r=Xt(t,e,n,{type:ts});ns(t,r);const i=ia(t,e,r,n,Us(t,e,n));return Kq(t,e,n,i)}function Us(t,e,n){const r=Kn(
|
|
478
478
|
ve(n.definition,i=>q$(t,e,i)),i=>i!==void 0);return r.length===1?r[0]:r.length===0?void 0:Xq(t,r)}function j$(t,e,n,r,i){const s=r.left,o=r.right,a=Xt(t,e,n,{type:Mq});ns(t,a);const u=Xt(t,e,n,{type:M$});return s.loopback=a,u.loopback=a,t.decisionMap[ra(e,i?"RepetitionMandatoryWithSeparator":"RepetitionMandatory",n.idx)]=a,qt(o,a),i===void 0?(qt(a,s),qt(a,u)):(qt(a,u),qt(a,i.left),qt(i.right,s)),{left:s,right:u}}function G$(t,e,n,r,i){const s=r.left,o=r.right,a=Xt(t,e,n,{type:Fq});ns(t,a);const u=Xt(
|
|
479
479
|
t,e,n,{type:M$}),c=Xt(t,e,n,{type:Lq});return a.loopback=c,u.loopback=c,qt(a,s),qt(a,u),qt(o,c),i!==void 0?(qt(c,u),qt(c,i.left),qt(i.right,s)):qt(c,a),t.decisionMap[ra(e,i?"RepetitionWithSeparator":"Repetition",n.idx)]=a,{left:a,right:u}}function Kq(t,e,n,r){const i=r.left,s=r.right;return qt(i,s),t.decisionMap[ra(e,"Option",n.idx)]=i,r}function ns(t,e){return t.decisionStates.push(e),e.decision=t.decisionStates.length-1,e.decision}function ia(t,e,n,r,...i){const s=Xt(t,e,r,{type:Oq,start:n});n.
|
|
480
|
-
end=s;for(const a of i)a!==void 0?(qt(n,a.left),qt(a.right,s)):qt(n,s);const o={left:n,right:s};return t.decisionMap[ra(e,Vq(r),r.idx)]=n,o}function Vq(t){if(t instanceof
|
|
481
|
-
length;for(let s=0;s<n-1;s++){const o=e[s];let a;o.left.transitions.length===1&&(a=o.left.transitions[0]);const u=a instanceof
|
|
482
|
-
referencedRule,i=t.ruleToStartState.get(r),s=Xt(t,e,n,{type:ts}),o=Xt(t,e,n,{type:ts}),a=new
|
|
483
|
-
i),i}function
|
|
480
|
+
end=s;for(const a of i)a!==void 0?(qt(n,a.left),qt(a.right,s)):qt(n,s);const o={left:n,right:s};return t.decisionMap[ra(e,Vq(r),r.idx)]=n,o}function Vq(t){if(t instanceof Ln)return"Alternation";if(t instanceof sn)return"Option";if(t instanceof Pt)return"Repetition";if(t instanceof On)return"RepetitionWithSeparator";if(t instanceof Xn)return"RepetitionMandatory";if(t instanceof Yn)return"RepetitionMandatoryWithSeparator";throw new Error("Invalid production type encountered")}function Xq(t,e){const n=e.
|
|
481
|
+
length;for(let s=0;s<n-1;s++){const o=e[s];let a;o.left.transitions.length===1&&(a=o.left.transitions[0]);const u=a instanceof ny,c=a,l=e[s+1].left;o.left.type===ts&&o.right.type===ts&&a!==void 0&&(u&&c.followState===o.right||a.target===o.right)?(u?c.followState=l:a.target=l,Qq(t,o.right)):qt(o.right,l)}const r=e[0],i=e[n-1];return{left:r.left,right:i.right}}function ry(t,e,n,r){const i=Xt(t,e,r,{type:ts}),s=Xt(t,e,r,{type:ts});return iy(i,new ty(s,n)),{left:i,right:s}}function Yq(t,e,n){const r=n.
|
|
482
|
+
referencedRule,i=t.ruleToStartState.get(r),s=Xt(t,e,n,{type:ts}),o=Xt(t,e,n,{type:ts}),a=new ny(i,r,o);return iy(s,a),{left:s,right:o}}function Jq(t,e,n){const r=t.ruleToStartState.get(e);qt(r,n.left);const i=t.ruleToStopState.get(e);return qt(n.right,i),{left:r,right:i}}function qt(t,e){const n=new B$(e);iy(t,n)}function Xt(t,e,n,r){const i=Object.assign({atn:t,production:n,epsilonOnlyTransitions:!1,rule:e,transitions:[],nextTokenWithinRule:[],stateNumber:t.states.length},r);return t.states.push(
|
|
483
|
+
i),i}function iy(t,e){t.transitions.length===0&&(t.epsilonOnlyTransitions=e.isEpsilon()),t.transitions.push(e)}function Qq(t,e){t.states.splice(t.states.indexOf(e),1)}const ap={};class sy{constructor(){this.map={},this.configs=[]}get size(){return this.configs.length}finalize(){this.map={}}add(e){const n=U$(e);n in this.map||(this.map[n]=this.configs.length,this.configs.push(e))}get elements(){return this.configs}get alts(){return ve(this.configs,e=>e.alt)}get key(){let e="";for(const n in this.
|
|
484
484
|
map)e+=n+":";return e}}function U$(t,e=!0){return`${e?`a${t.alt}`:""}s${t.state.stateNumber}:${t.stack.map(n=>n.stateNumber.toString()).join("_")}`}function Zq(t,e){const n={};return r=>{const i=r.toString();let s=n[i];return s!==void 0||(s={atnStartState:t,decision:e,states:{}},n[i]=s),s}}class W${constructor(){this.predicates=[]}is(e){return e>=this.predicates.length||this.predicates[e]}set(e,n){this.predicates[e]=n}toString(){let e="";const n=this.predicates.length;for(let r=0;r<n;r++)e+=this.
|
|
485
|
-
predicates[r]===!0?"1":"0";return e}}const z$=new W$;class ej extends
|
|
485
|
+
predicates[r]===!0?"1":"0";return e}}const z$=new W$;class ej extends Qg{constructor(e){var n;super(),this.logging=(n=e?.logging)!==null&&n!==void 0?n:r=>console.log(r)}initialize(e){this.atn=Bq(e.rules),this.dfas=tj(this.atn)}validateAmbiguousAlternationAlternatives(){return[]}validateEmptyOrAlternatives(){return[]}buildLookaheadForAlternation(e){const{prodOccurrence:n,rule:r,hasPredicates:i,dynamicTokensEnabled:s}=e,o=this.dfas,a=this.logging,u=ra(r,"Alternation",n),l=this.atn.decisionMap[u].decision,
|
|
486
486
|
f=ve(d$({maxLookahead:1,occurrence:n,prodType:"Alternation",rule:r}),d=>ve(d,p=>p[0]));if(H$(f,!1)&&!s){const d=bn(f,(p,m,w)=>(ke(m,y=>{y&&(p[y.tokenTypeIdx]=w,ke(y.categoryMatches,g=>{p[g]=w}))}),p),{});return i?function(p){var m;const w=this.LA(1),y=d[w.tokenTypeIdx];if(p!==void 0&&y!==void 0){const g=(m=p[y])===null||m===void 0?void 0:m.GATE;if(g!==void 0&&g.call(this)===!1)return}return y}:function(){const p=this.LA(1);return d[p.tokenTypeIdx]}}else return i?function(d){const p=new W$,m=d===
|
|
487
|
-
void 0?0:d.length;for(let y=0;y<m;y++){const g=d?.[y].GATE;p.set(y,g===void 0||g.call(this))}const w=
|
|
488
|
-
!s){const d=f[0],p=lr(d);if(p.length===1&&
|
|
489
|
-
void 0){if(e)break;return!1}const o=[s.tokenTypeIdx].concat(s.categoryMatches);for(const a of o)if(n.has(a)){if(!i.has(a))return!1}else n.add(a),i.add(a)}}return!0}function tj(t){const e=t.decisionStates.length,n=Array(e);for(let r=0;r<e;r++)n[r]=Zq(t.decisionStates[r],r);return n}function
|
|
487
|
+
void 0?0:d.length;for(let y=0;y<m;y++){const g=d?.[y].GATE;p.set(y,g===void 0||g.call(this))}const w=oy.call(this,o,l,p,a);return typeof w=="number"?w:void 0}:function(){const d=oy.call(this,o,l,z$,a);return typeof d=="number"?d:void 0}}buildLookaheadForOptional(e){const{prodOccurrence:n,rule:r,prodType:i,dynamicTokensEnabled:s}=e,o=this.dfas,a=this.logging,u=ra(r,i,n),l=this.atn.decisionMap[u].decision,f=ve(d$({maxLookahead:1,occurrence:n,prodType:i,rule:r}),d=>ve(d,p=>p[0]));if(H$(f)&&f[0][0]&&
|
|
488
|
+
!s){const d=f[0],p=lr(d);if(p.length===1&&ht(p[0].categoryMatches)){const w=p[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===w}}else{const m=bn(p,(w,y)=>(y!==void 0&&(w[y.tokenTypeIdx]=!0,ke(y.categoryMatches,g=>{w[g]=!0})),w),{});return function(){const w=this.LA(1);return m[w.tokenTypeIdx]===!0}}}return function(){const d=oy.call(this,o,l,z$,a);return typeof d=="object"?!1:d===0}}}function H$(t,e=!0){const n=new Set;for(const r of t){const i=new Set;for(const s of r){if(s===
|
|
489
|
+
void 0){if(e)break;return!1}const o=[s.tokenTypeIdx].concat(s.categoryMatches);for(const a of o)if(n.has(a)){if(!i.has(a))return!1}else n.add(a),i.add(a)}}return!0}function tj(t){const e=t.decisionStates.length,n=Array(e);for(let r=0;r<e;r++)n[r]=Zq(t.decisionStates[r],r);return n}function oy(t,e,n,r){const i=t[e](n);let s=i.start;if(s===void 0){const a=fj(i.atnStartState);s=X$(i,K$(a)),i.start=s}return nj.apply(this,[i,s,n,r])}function nj(t,e,n,r){let i=e,s=1;const o=[];let a=this.LA(s++);for(;;){
|
|
490
490
|
let u=uj(i,a);if(u===void 0&&(u=rj.apply(this,[t,i,a,s,n,r])),u===ap)return aj(o,i,a);if(u.isAcceptState===!0)return u.prediction;i=u,o.push(a),a=this.LA(s++)}}function rj(t,e,n,r,i,s){const o=cj(e.configs,n,i);if(o.size===0)return V$(t,e,n,ap),ap;let a=K$(o);const u=dj(o,i);if(u!==void 0)a.isAcceptState=!0,a.prediction=u,a.configs.uniqueAlt=u;else if(gj(o)){const c=b2(o.alts);a.isAcceptState=!0,a.prediction=c,a.configs.uniqueAlt=c,ij.apply(this,[t,r,o.alts,s])}return a=V$(t,e,n,a),a}function ij(t,e,n,r){
|
|
491
491
|
const i=[];for(let c=1;c<=e;c++)i.push(this.LA(c).tokenType);const s=t.atnStartState,o=s.rule,a=s.production,u=sj({topLevelRule:o,ambiguityIndices:n,production:a,prefixPath:i});r(u)}function sj(t){const e=ve(t.prefixPath,i=>ta(i)).join(", "),n=t.production.idx===0?"":t.production.idx;let r=`Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(", ")}> in <${oj(t.production)}${n}> inside <${t.topLevelRule.name}> Rule,
|
|
492
492
|
<${e}> may appears as a prefix path in all these alternatives.
|
|
493
493
|
`;return r=r+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
|
|
494
|
-
For Further details.`,r}function oj(t){if(t instanceof En)return"SUBRULE";if(t instanceof sn)return"OPTION";if(t instanceof
|
|
495
|
-
return{actualToken:n,possibleTokenTypes:i,tokenPath:t}}function uj(t,e){return t.edges[e.tokenTypeIdx]}function cj(t,e,n){const r=new
|
|
496
|
-
!hj(s))for(const o of i)s.add(o);return s}function lj(t,e){if(t instanceof
|
|
497
|
-
e,e)}function fj(t){const e=new
|
|
498
|
-
alt:t.alt,stack:t.stack};if(e instanceof
|
|
499
|
-
for(const e of Array.from(t.values()))if(Object.keys(e).length>1)return!0;return!1}function wj(t){for(const e of Array.from(t.values()))if(Object.keys(e).length===1)return!0;return!1}var Y$;(function(t){function e(n){return typeof n=="string"}t.is=e})(Y$||(Y$={}));var
|
|
494
|
+
For Further details.`,r}function oj(t){if(t instanceof En)return"SUBRULE";if(t instanceof sn)return"OPTION";if(t instanceof Ln)return"OR";if(t instanceof Xn)return"AT_LEAST_ONE";if(t instanceof Yn)return"AT_LEAST_ONE_SEP";if(t instanceof On)return"MANY_SEP";if(t instanceof Pt)return"MANY";if(t instanceof wt)return"CONSUME";throw Error("non exhaustive match")}function aj(t,e,n){const r=Vn(e.configs.elements,s=>s.state.transitions),i=_2(r.filter(s=>s instanceof ty).map(s=>s.tokenType),s=>s.tokenTypeIdx);
|
|
495
|
+
return{actualToken:n,possibleTokenTypes:i,tokenPath:t}}function uj(t,e){return t.edges[e.tokenTypeIdx]}function cj(t,e,n){const r=new sy,i=[];for(const o of t.elements){if(n.is(o.alt)===!1)continue;if(o.state.type===ec){i.push(o);continue}const a=o.state.transitions.length;for(let u=0;u<a;u++){const c=o.state.transitions[u],l=lj(c,e);l!==void 0&&r.add({state:l,alt:o.alt,stack:o.stack})}}let s;if(i.length===0&&r.size===1&&(s=r),s===void 0){s=new sy;for(const o of r.elements)up(o,s)}if(i.length>0&&
|
|
496
|
+
!hj(s))for(const o of i)s.add(o);return s}function lj(t,e){if(t instanceof ty&&a$(e,t.tokenType))return t.target}function dj(t,e){let n;for(const r of t.elements)if(e.is(r.alt)===!0){if(n===void 0)n=r.alt;else if(n!==r.alt)return}return n}function K$(t){return{configs:t,edges:{},isAcceptState:!1,prediction:-1}}function V$(t,e,n,r){return r=X$(t,r),e.edges[n.tokenTypeIdx]=r,r}function X$(t,e){if(e===ap)return e;const n=e.configs.key,r=t.states[n];return r!==void 0?r:(e.configs.finalize(),t.states[n]=
|
|
497
|
+
e,e)}function fj(t){const e=new sy,n=t.transitions.length;for(let r=0;r<n;r++){const s={state:t.transitions[r].target,alt:r,stack:[]};up(s,e)}return e}function up(t,e){const n=t.state;if(n.type===ec){if(t.stack.length>0){const i=[...t.stack],o={state:i.pop(),alt:t.alt,stack:i};up(o,e)}else e.add(t);return}n.epsilonOnlyTransitions||e.add(t);const r=n.transitions.length;for(let i=0;i<r;i++){const s=n.transitions[i],o=pj(t,s);o!==void 0&&up(o,e)}}function pj(t,e){if(e instanceof B$)return{state:e.target,
|
|
498
|
+
alt:t.alt,stack:t.stack};if(e instanceof ny){const n=[...t.stack,e.followState];return{state:e.target,alt:t.alt,stack:n}}}function hj(t){for(const e of t.elements)if(e.state.type===ec)return!0;return!1}function mj(t){for(const e of t.elements)if(e.state.type!==ec)return!1;return!0}function gj(t){if(mj(t))return!0;const e=yj(t.elements);return vj(e)&&!wj(e)}function yj(t){const e=new Map;for(const n of t){const r=U$(n,!1);let i=e.get(r);i===void 0&&(i={},e.set(r,i)),i[n.alt]=!0}return e}function vj(t){
|
|
499
|
+
for(const e of Array.from(t.values()))if(Object.keys(e).length>1)return!0;return!1}function wj(t){for(const e of Array.from(t.values()))if(Object.keys(e).length===1)return!0;return!1}var Y$;(function(t){function e(n){return typeof n=="string"}t.is=e})(Y$||(Y$={}));var ay;(function(t){function e(n){return typeof n=="string"}t.is=e})(ay||(ay={}));var J$;(function(t){t.MIN_VALUE=-2147483648,t.MAX_VALUE=2147483647;function e(n){return typeof n=="number"&&t.MIN_VALUE<=n&&n<=t.MAX_VALUE}t.is=e})(J$||(J$=
|
|
500
500
|
{}));var cp;(function(t){t.MIN_VALUE=0,t.MAX_VALUE=2147483647;function e(n){return typeof n=="number"&&t.MIN_VALUE<=n&&n<=t.MAX_VALUE}t.is=e})(cp||(cp={}));var ot;(function(t){function e(r,i){return r===Number.MAX_VALUE&&(r=cp.MAX_VALUE),i===Number.MAX_VALUE&&(i=cp.MAX_VALUE),{line:r,character:i}}t.create=e;function n(r){let i=r;return j.objectLiteral(i)&&j.uinteger(i.line)&&j.uinteger(i.character)}t.is=n})(ot||(ot={}));var Xe;(function(t){function e(r,i,s,o){if(j.uinteger(r)&&j.uinteger(i)&&j.uinteger(
|
|
501
501
|
s)&&j.uinteger(o))return{start:ot.create(r,i),end:ot.create(s,o)};if(ot.is(r)&&ot.is(i))return{start:r,end:i};throw new Error(`Range#create called with invalid arguments[${r}, ${i}, ${s}, ${o}]`)}t.create=e;function n(r){let i=r;return j.objectLiteral(i)&&ot.is(i.start)&&ot.is(i.end)}t.is=n})(Xe||(Xe={}));var lp;(function(t){function e(r,i){return{uri:r,range:i}}t.create=e;function n(r){let i=r;return j.objectLiteral(i)&&Xe.is(i.range)&&(j.string(i.uri)||j.undefined(i.uri))}t.is=n})(lp||(lp={}));
|
|
502
|
-
var Q$;(function(t){function e(r,i,s,o){return{targetUri:r,targetRange:i,targetSelectionRange:s,originSelectionRange:o}}t.create=e;function n(r){let i=r;return j.objectLiteral(i)&&Xe.is(i.targetRange)&&j.string(i.targetUri)&&Xe.is(i.targetSelectionRange)&&(Xe.is(i.originSelectionRange)||j.undefined(i.originSelectionRange))}t.is=n})(Q$||(Q$={}));var
|
|
503
|
-
i.red,0,1)&&j.numberRange(i.green,0,1)&&j.numberRange(i.blue,0,1)&&j.numberRange(i.alpha,0,1)}t.is=n})(
|
|
504
|
-
i.additionalTextEdits)||j.typedArray(i.additionalTextEdits,
|
|
505
|
-
(j.undefined(i.startCharacter)||j.uinteger(i.startCharacter))&&(j.undefined(i.endCharacter)||j.uinteger(i.endCharacter))&&(j.undefined(i.kind)||j.string(i.kind))}t.is=n})(nR||(nR={}));var
|
|
502
|
+
var Q$;(function(t){function e(r,i,s,o){return{targetUri:r,targetRange:i,targetSelectionRange:s,originSelectionRange:o}}t.create=e;function n(r){let i=r;return j.objectLiteral(i)&&Xe.is(i.targetRange)&&j.string(i.targetUri)&&Xe.is(i.targetSelectionRange)&&(Xe.is(i.originSelectionRange)||j.undefined(i.originSelectionRange))}t.is=n})(Q$||(Q$={}));var uy;(function(t){function e(r,i,s,o){return{red:r,green:i,blue:s,alpha:o}}t.create=e;function n(r){const i=r;return j.objectLiteral(i)&&j.numberRange(
|
|
503
|
+
i.red,0,1)&&j.numberRange(i.green,0,1)&&j.numberRange(i.blue,0,1)&&j.numberRange(i.alpha,0,1)}t.is=n})(uy||(uy={}));var Z$;(function(t){function e(r,i){return{range:r,color:i}}t.create=e;function n(r){const i=r;return j.objectLiteral(i)&&Xe.is(i.range)&&uy.is(i.color)}t.is=n})(Z$||(Z$={}));var eR;(function(t){function e(r,i,s){return{label:r,textEdit:i,additionalTextEdits:s}}t.create=e;function n(r){const i=r;return j.objectLiteral(i)&&j.string(i.label)&&(j.undefined(i.textEdit)||Mn.is(i))&&(j.undefined(
|
|
504
|
+
i.additionalTextEdits)||j.typedArray(i.additionalTextEdits,Mn.is))}t.is=n})(eR||(eR={}));var tR;(function(t){t.Comment="comment",t.Imports="imports",t.Region="region"})(tR||(tR={}));var nR;(function(t){function e(r,i,s,o,a,u){const c={startLine:r,endLine:i};return j.defined(s)&&(c.startCharacter=s),j.defined(o)&&(c.endCharacter=o),j.defined(a)&&(c.kind=a),j.defined(u)&&(c.collapsedText=u),c}t.create=e;function n(r){const i=r;return j.objectLiteral(i)&&j.uinteger(i.startLine)&&j.uinteger(i.startLine)&&
|
|
505
|
+
(j.undefined(i.startCharacter)||j.uinteger(i.startCharacter))&&(j.undefined(i.endCharacter)||j.uinteger(i.endCharacter))&&(j.undefined(i.kind)||j.string(i.kind))}t.is=n})(nR||(nR={}));var cy;(function(t){function e(r,i){return{location:r,message:i}}t.create=e;function n(r){let i=r;return j.defined(i)&&lp.is(i.location)&&j.string(i.message)}t.is=n})(cy||(cy={}));var Ws;(function(t){t.Error=1,t.Warning=2,t.Information=3,t.Hint=4})(Ws||(Ws={}));var rR;(function(t){t.Unnecessary=1,t.Deprecated=2})(rR||
|
|
506
506
|
(rR={}));var iR;(function(t){function e(n){const r=n;return j.objectLiteral(r)&&j.string(r.href)}t.is=e})(iR||(iR={}));var dp;(function(t){function e(r,i,s,o,a,u){let c={range:r,message:i};return j.defined(s)&&(c.severity=s),j.defined(o)&&(c.code=o),j.defined(a)&&(c.source=a),j.defined(u)&&(c.relatedInformation=u),c}t.create=e;function n(r){var i;let s=r;return j.defined(s)&&Xe.is(s.range)&&j.string(s.message)&&(j.number(s.severity)||j.undefined(s.severity))&&(j.integer(s.code)||j.string(s.code)||
|
|
507
|
-
j.undefined(s.code))&&(j.undefined(s.codeDescription)||j.string((i=s.codeDescription)===null||i===void 0?void 0:i.href))&&(j.string(s.source)||j.undefined(s.source))&&(j.undefined(s.relatedInformation)||j.typedArray(s.relatedInformation,
|
|
508
|
-
var
|
|
509
|
-
i.label)&&(j.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(j.string(i.description)||i.description===void 0)}t.is=n})(
|
|
510
|
-
is(o)&&(
|
|
511
|
-
"create"&&j.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||j.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||j.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||oa.is(i.annotationId))}t.is=n})(
|
|
512
|
-
kind==="rename"&&j.string(i.oldUri)&&j.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||j.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||j.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||oa.is(i.annotationId))}t.is=n})(
|
|
513
|
-
return i&&i.kind==="delete"&&j.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||j.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||j.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||oa.is(i.annotationId))}t.is=n})(
|
|
514
|
-
is=e})(
|
|
515
|
-
t.is=n})(
|
|
507
|
+
j.undefined(s.code))&&(j.undefined(s.codeDescription)||j.string((i=s.codeDescription)===null||i===void 0?void 0:i.href))&&(j.string(s.source)||j.undefined(s.source))&&(j.undefined(s.relatedInformation)||j.typedArray(s.relatedInformation,cy.is))}t.is=n})(dp||(dp={}));var sa;(function(t){function e(r,i,...s){let o={title:r,command:i};return j.defined(s)&&s.length>0&&(o.arguments=s),o}t.create=e;function n(r){let i=r;return j.defined(i)&&j.string(i.title)&&j.string(i.command)}t.is=n})(sa||(sa={}));
|
|
508
|
+
var Mn;(function(t){function e(s,o){return{range:s,newText:o}}t.replace=e;function n(s,o){return{range:{start:s,end:s},newText:o}}t.insert=n;function r(s){return{range:s,newText:""}}t.del=r;function i(s){const o=s;return j.objectLiteral(o)&&j.string(o.newText)&&Xe.is(o.range)}t.is=i})(Mn||(Mn={}));var ly;(function(t){function e(r,i,s){const o={label:r};return i!==void 0&&(o.needsConfirmation=i),s!==void 0&&(o.description=s),o}t.create=e;function n(r){const i=r;return j.objectLiteral(i)&&j.string(
|
|
509
|
+
i.label)&&(j.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(j.string(i.description)||i.description===void 0)}t.is=n})(ly||(ly={}));var oa;(function(t){function e(n){const r=n;return j.string(r)}t.is=e})(oa||(oa={}));var sR;(function(t){function e(s,o,a){return{range:s,newText:o,annotationId:a}}t.replace=e;function n(s,o,a){return{range:{start:s,end:s},newText:o,annotationId:a}}t.insert=n;function r(s,o){return{range:s,newText:"",annotationId:o}}t.del=r;function i(s){const o=s;return Mn.
|
|
510
|
+
is(o)&&(ly.is(o.annotationId)||oa.is(o.annotationId))}t.is=i})(sR||(sR={}));var dy;(function(t){function e(r,i){return{textDocument:r,edits:i}}t.create=e;function n(r){let i=r;return j.defined(i)&&gy.is(i.textDocument)&&Array.isArray(i.edits)}t.is=n})(dy||(dy={}));var fy;(function(t){function e(r,i,s){let o={kind:"create",uri:r};return i!==void 0&&(i.overwrite!==void 0||i.ignoreIfExists!==void 0)&&(o.options=i),s!==void 0&&(o.annotationId=s),o}t.create=e;function n(r){let i=r;return i&&i.kind===
|
|
511
|
+
"create"&&j.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||j.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||j.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||oa.is(i.annotationId))}t.is=n})(fy||(fy={}));var py;(function(t){function e(r,i,s,o){let a={kind:"rename",oldUri:r,newUri:i};return s!==void 0&&(s.overwrite!==void 0||s.ignoreIfExists!==void 0)&&(a.options=s),o!==void 0&&(a.annotationId=o),a}t.create=e;function n(r){let i=r;return i&&i.
|
|
512
|
+
kind==="rename"&&j.string(i.oldUri)&&j.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||j.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||j.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||oa.is(i.annotationId))}t.is=n})(py||(py={}));var hy;(function(t){function e(r,i,s){let o={kind:"delete",uri:r};return i!==void 0&&(i.recursive!==void 0||i.ignoreIfNotExists!==void 0)&&(o.options=i),s!==void 0&&(o.annotationId=s),o}t.create=e;function n(r){let i=r;
|
|
513
|
+
return i&&i.kind==="delete"&&j.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||j.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||j.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||oa.is(i.annotationId))}t.is=n})(hy||(hy={}));var my;(function(t){function e(n){let r=n;return r&&(r.changes!==void 0||r.documentChanges!==void 0)&&(r.documentChanges===void 0||r.documentChanges.every(i=>j.string(i.kind)?fy.is(i)||py.is(i)||hy.is(i):dy.is(i)))}t.
|
|
514
|
+
is=e})(my||(my={}));var oR;(function(t){function e(r){return{uri:r}}t.create=e;function n(r){let i=r;return j.defined(i)&&j.string(i.uri)}t.is=n})(oR||(oR={}));var aR;(function(t){function e(r,i){return{uri:r,version:i}}t.create=e;function n(r){let i=r;return j.defined(i)&&j.string(i.uri)&&j.integer(i.version)}t.is=n})(aR||(aR={}));var gy;(function(t){function e(r,i){return{uri:r,version:i}}t.create=e;function n(r){let i=r;return j.defined(i)&&j.string(i.uri)&&(i.version===null||j.integer(i.version))}
|
|
515
|
+
t.is=n})(gy||(gy={}));var uR;(function(t){function e(r,i,s,o){return{uri:r,languageId:i,version:s,text:o}}t.create=e;function n(r){let i=r;return j.defined(i)&&j.string(i.uri)&&j.string(i.languageId)&&j.integer(i.version)&&j.string(i.text)}t.is=n})(uR||(uR={}));var yy;(function(t){t.PlainText="plaintext",t.Markdown="markdown";function e(n){const r=n;return r===t.PlainText||r===t.Markdown}t.is=e})(yy||(yy={}));var tc;(function(t){function e(n){const r=n;return j.objectLiteral(n)&&yy.is(r.kind)&&j.
|
|
516
516
|
string(r.value)}t.is=e})(tc||(tc={}));var Ct;(function(t){t.Text=1,t.Method=2,t.Function=3,t.Constructor=4,t.Field=5,t.Variable=6,t.Class=7,t.Interface=8,t.Module=9,t.Property=10,t.Unit=11,t.Value=12,t.Enum=13,t.Keyword=14,t.Snippet=15,t.Color=16,t.File=17,t.Reference=18,t.Folder=19,t.EnumMember=20,t.Constant=21,t.Struct=22,t.Event=23,t.Operator=24,t.TypeParameter=25})(Ct||(Ct={}));var Rn;(function(t){t.PlainText=1,t.Snippet=2})(Rn||(Rn={}));var cR;(function(t){t.Deprecated=1})(cR||(cR={}));var lR;
|
|
517
517
|
(function(t){function e(r,i,s){return{newText:r,insert:i,replace:s}}t.create=e;function n(r){const i=r;return i&&j.string(i.newText)&&Xe.is(i.insert)&&Xe.is(i.replace)}t.is=n})(lR||(lR={}));var dR;(function(t){t.asIs=1,t.adjustIndentation=2})(dR||(dR={}));var fR;(function(t){function e(n){const r=n;return r&&(j.string(r.detail)||r.detail===void 0)&&(j.string(r.description)||r.description===void 0)}t.is=e})(fR||(fR={}));var pR;(function(t){function e(n){return{label:n}}t.create=e})(pR||(pR={}));var hR;
|
|
518
518
|
(function(t){function e(n,r){return{items:n||[],isIncomplete:!!r}}t.create=e})(hR||(hR={}));var fp;(function(t){function e(r){return r.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}t.fromPlainText=e;function n(r){const i=r;return j.string(i)||j.objectLiteral(i)&&j.string(i.language)&&j.string(i.value)}t.is=n})(fp||(fp={}));var mR;(function(t){function e(n){let r=n;return!!r&&j.objectLiteral(r)&&(tc.is(r.contents)||fp.is(r.contents)||j.typedArray(r.contents,fp.is))&&(n.range===void 0||Xe.is(n.range))}t.
|
|
@@ -521,15 +521,15 @@ t.Module=2,t.Namespace=3,t.Package=4,t.Class=5,t.Method=6,t.Property=7,t.Field=8
|
|
|
521
521
|
t.create=e})(ER||(ER={}));var $R;(function(t){function e(n,r,i,s){return s!==void 0?{name:n,kind:r,location:{uri:i,range:s}}:{name:n,kind:r,location:{uri:i}}}t.create=e})($R||($R={}));var RR;(function(t){function e(r,i,s,o,a,u){let c={name:r,detail:i,kind:s,range:o,selectionRange:a};return u!==void 0&&(c.children=u),c}t.create=e;function n(r){let i=r;return i&&j.string(i.name)&&j.number(i.kind)&&Xe.is(i.range)&&Xe.is(i.selectionRange)&&(i.detail===void 0||j.string(i.detail))&&(i.deprecated===void 0||
|
|
522
522
|
j.boolean(i.deprecated))&&(i.children===void 0||Array.isArray(i.children))&&(i.tags===void 0||Array.isArray(i.tags))}t.is=n})(RR||(RR={}));var DR;(function(t){t.Empty="",t.QuickFix="quickfix",t.Refactor="refactor",t.RefactorExtract="refactor.extract",t.RefactorInline="refactor.inline",t.RefactorRewrite="refactor.rewrite",t.Source="source",t.SourceOrganizeImports="source.organizeImports",t.SourceFixAll="source.fixAll"})(DR||(DR={}));var pp;(function(t){t.Invoked=1,t.Automatic=2})(pp||(pp={}));var kR;
|
|
523
523
|
(function(t){function e(r,i,s){let o={diagnostics:r};return i!=null&&(o.only=i),s!=null&&(o.triggerKind=s),o}t.create=e;function n(r){let i=r;return j.defined(i)&&j.typedArray(i.diagnostics,dp.is)&&(i.only===void 0||j.typedArray(i.only,j.string))&&(i.triggerKind===void 0||i.triggerKind===pp.Invoked||i.triggerKind===pp.Automatic)}t.is=n})(kR||(kR={}));var TR;(function(t){function e(r,i,s){let o={title:r},a=!0;return typeof i=="string"?(a=!1,o.kind=i):sa.is(i)?o.command=i:o.edit=i,a&&s!==void 0&&(o.
|
|
524
|
-
kind=s),o}t.create=e;function n(r){let i=r;return i&&j.string(i.title)&&(i.diagnostics===void 0||j.typedArray(i.diagnostics,dp.is))&&(i.kind===void 0||j.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||sa.is(i.command))&&(i.isPreferred===void 0||j.boolean(i.isPreferred))&&(i.edit===void 0||
|
|
524
|
+
kind=s),o}t.create=e;function n(r){let i=r;return i&&j.string(i.title)&&(i.diagnostics===void 0||j.typedArray(i.diagnostics,dp.is))&&(i.kind===void 0||j.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||sa.is(i.command))&&(i.isPreferred===void 0||j.boolean(i.isPreferred))&&(i.edit===void 0||my.is(i.edit))}t.is=n})(TR||(TR={}));var CR;(function(t){function e(r,i){let s={range:r};return j.defined(i)&&(s.data=i),s}t.create=e;function n(r){let i=r;return j.defined(i)&&Xe.is(
|
|
525
525
|
i.range)&&(j.undefined(i.command)||sa.is(i.command))}t.is=n})(CR||(CR={}));var AR;(function(t){function e(r,i){return{tabSize:r,insertSpaces:i}}t.create=e;function n(r){let i=r;return j.defined(i)&&j.uinteger(i.tabSize)&&j.boolean(i.insertSpaces)}t.is=n})(AR||(AR={}));var SR;(function(t){function e(r,i,s){return{range:r,target:i,data:s}}t.create=e;function n(r){let i=r;return j.defined(i)&&Xe.is(i.range)&&(j.undefined(i.target)||j.string(i.target))}t.is=n})(SR||(SR={}));var _R;(function(t){function e(r,i){
|
|
526
526
|
return{range:r,parent:i}}t.create=e;function n(r){let i=r;return j.objectLiteral(i)&&Xe.is(i.range)&&(i.parent===void 0||t.is(i.parent))}t.is=n})(_R||(_R={}));var Ue;(function(t){t.namespace="namespace",t.type="type",t.class="class",t.enum="enum",t.interface="interface",t.struct="struct",t.typeParameter="typeParameter",t.parameter="parameter",t.variable="variable",t.property="property",t.enumMember="enumMember",t.event="event",t.function="function",t.method="method",t.macro="macro",t.keyword="ke\
|
|
527
527
|
yword",t.modifier="modifier",t.comment="comment",t.string="string",t.number="number",t.regexp="regexp",t.operator="operator",t.decorator="decorator"})(Ue||(Ue={}));var Qe;(function(t){t.declaration="declaration",t.definition="definition",t.readonly="readonly",t.static="static",t.deprecated="deprecated",t.abstract="abstract",t.async="async",t.modification="modification",t.documentation="documentation",t.defaultLibrary="defaultLibrary"})(Qe||(Qe={}));var xR;(function(t){function e(n){const r=n;return j.
|
|
528
528
|
objectLiteral(r)&&(r.resultId===void 0||typeof r.resultId=="string")&&Array.isArray(r.data)&&(r.data.length===0||typeof r.data[0]=="number")}t.is=e})(xR||(xR={}));var PR;(function(t){function e(r,i){return{range:r,text:i}}t.create=e;function n(r){const i=r;return i!=null&&Xe.is(i.range)&&j.string(i.text)}t.is=n})(PR||(PR={}));var NR;(function(t){function e(r,i,s){return{range:r,variableName:i,caseSensitiveLookup:s}}t.create=e;function n(r){const i=r;return i!=null&&Xe.is(i.range)&&j.boolean(i.caseSensitiveLookup)&&
|
|
529
|
-
(j.string(i.variableName)||i.variableName===void 0)}t.is=n})(NR||(NR={}));var IR;(function(t){function e(r,i){return{range:r,expression:i}}t.create=e;function n(r){const i=r;return i!=null&&Xe.is(i.range)&&(j.string(i.expression)||i.expression===void 0)}t.is=n})(IR||(IR={}));var OR;(function(t){function e(r,i){return{frameId:r,stoppedLocation:i}}t.create=e;function n(r){const i=r;return j.defined(i)&&Xe.is(r.stoppedLocation)}t.is=n})(OR||(OR={}));var
|
|
530
|
-
return n===1||n===2}t.is=e})(
|
|
531
|
-
string(i.label)||j.typedArray(i.label,
|
|
532
|
-
command:s}}t.create=e})(MR||(MR={}));var BR;(function(t){function e(n){return{items:n}}t.create=e})(BR||(BR={}));var qR;(function(t){t.Invoked=0,t.Automatic=1})(qR||(qR={}));var jR;(function(t){function e(n,r){return{range:n,text:r}}t.create=e})(jR||(jR={}));var GR;(function(t){function e(n,r){return{triggerKind:n,selectedCompletionInfo:r}}t.create=e})(GR||(GR={}));var UR;(function(t){function e(n){const r=n;return j.objectLiteral(r)&&
|
|
529
|
+
(j.string(i.variableName)||i.variableName===void 0)}t.is=n})(NR||(NR={}));var IR;(function(t){function e(r,i){return{range:r,expression:i}}t.create=e;function n(r){const i=r;return i!=null&&Xe.is(i.range)&&(j.string(i.expression)||i.expression===void 0)}t.is=n})(IR||(IR={}));var OR;(function(t){function e(r,i){return{frameId:r,stoppedLocation:i}}t.create=e;function n(r){const i=r;return j.defined(i)&&Xe.is(r.stoppedLocation)}t.is=n})(OR||(OR={}));var vy;(function(t){t.Type=1,t.Parameter=2;function e(n){
|
|
530
|
+
return n===1||n===2}t.is=e})(vy||(vy={}));var wy;(function(t){function e(r){return{value:r}}t.create=e;function n(r){const i=r;return j.objectLiteral(i)&&(i.tooltip===void 0||j.string(i.tooltip)||tc.is(i.tooltip))&&(i.location===void 0||lp.is(i.location))&&(i.command===void 0||sa.is(i.command))}t.is=n})(wy||(wy={}));var LR;(function(t){function e(r,i,s){const o={position:r,label:i};return s!==void 0&&(o.kind=s),o}t.create=e;function n(r){const i=r;return j.objectLiteral(i)&&ot.is(i.position)&&(j.
|
|
531
|
+
string(i.label)||j.typedArray(i.label,wy.is))&&(i.kind===void 0||vy.is(i.kind))&&i.textEdits===void 0||j.typedArray(i.textEdits,Mn.is)&&(i.tooltip===void 0||j.string(i.tooltip)||tc.is(i.tooltip))&&(i.paddingLeft===void 0||j.boolean(i.paddingLeft))&&(i.paddingRight===void 0||j.boolean(i.paddingRight))}t.is=n})(LR||(LR={}));var FR;(function(t){function e(n){return{kind:"snippet",value:n}}t.createSnippet=e})(FR||(FR={}));var MR;(function(t){function e(n,r,i,s){return{insertText:n,filterText:r,range:i,
|
|
532
|
+
command:s}}t.create=e})(MR||(MR={}));var BR;(function(t){function e(n){return{items:n}}t.create=e})(BR||(BR={}));var qR;(function(t){t.Invoked=0,t.Automatic=1})(qR||(qR={}));var jR;(function(t){function e(n,r){return{range:n,text:r}}t.create=e})(jR||(jR={}));var GR;(function(t){function e(n,r){return{triggerKind:n,selectedCompletionInfo:r}}t.create=e})(GR||(GR={}));var UR;(function(t){function e(n){const r=n;return j.objectLiteral(r)&&ay.is(r.uri)&&j.string(r.name)}t.is=e})(UR||(UR={}));var WR;(function(t){
|
|
533
533
|
function e(s,o,a,u){return new bj(s,o,a,u)}t.create=e;function n(s){let o=s;return!!(j.defined(o)&&j.string(o.uri)&&(j.undefined(o.languageId)||j.string(o.languageId))&&j.uinteger(o.lineCount)&&j.func(o.getText)&&j.func(o.positionAt)&&j.func(o.offsetAt))}t.is=n;function r(s,o){let a=s.getText(),u=i(o,(l,f)=>{let d=l.range.start.line-f.range.start.line;return d===0?l.range.start.character-f.range.start.character:d}),c=a.length;for(let l=u.length-1;l>=0;l--){let f=u[l],d=s.offsetAt(f.range.start),
|
|
534
534
|
p=s.offsetAt(f.range.end);if(p<=c)a=a.substring(0,d)+f.newText+a.substring(p,a.length);else throw new Error("Overlapping edit");c=d}return a}t.applyEdits=r;function i(s,o){if(s.length<=1)return s;const a=s.length/2|0,u=s.slice(0,a),c=s.slice(a);i(u,o),i(c,o);let l=0,f=0,d=0;for(;l<u.length&&f<c.length;)o(u[l],c[f])<=0?s[d++]=u[l++]:s[d++]=c[f++];for(;l<u.length;)s[d++]=u[l++];for(;f<c.length;)s[d++]=c[f++];return s}})(WR||(WR={}));let bj=class{constructor(e,n,r,i){this._uri=e,this._languageId=n,
|
|
535
535
|
this._version=r,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let n=this.offsetAt(e.start),r=this.offsetAt(e.end);return this._content.substring(n,r)}return this._content}update(e,n){this._content=e.text,this._version=n,this._lineOffsets=void 0}getLineOffsets(){if(this._lineOffsets===void 0){let e=[],n=this._content,r=!0;for(let i=0;i<n.length;i++){r&&(e.push(i),r=!1);let s=n.charAt(
|
|
@@ -538,41 +538,41 @@ i);r=s==="\r"||s===`
|
|
|
538
538
|
`&&i++}r&&n.length>0&&e.push(n.length),this._lineOffsets=e}return this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let n=this.getLineOffsets(),r=0,i=n.length;if(i===0)return ot.create(0,e);for(;r<i;){let o=Math.floor((r+i)/2);n[o]>e?i=o:r=o+1}let s=r-1;return ot.create(s,e-n[s])}offsetAt(e){let n=this.getLineOffsets();if(e.line>=n.length)return this._content.length;if(e.line<0)return 0;let r=n[e.line],i=e.line+1<n.length?n[e.line+1]:this._content.length;return Math.
|
|
539
539
|
max(Math.min(r+e.character,i),r)}get lineCount(){return this.getLineOffsets().length}};var j;(function(t){const e=Object.prototype.toString;function n(p){return typeof p<"u"}t.defined=n;function r(p){return typeof p>"u"}t.undefined=r;function i(p){return p===!0||p===!1}t.boolean=i;function s(p){return e.call(p)==="[object String]"}t.string=s;function o(p){return e.call(p)==="[object Number]"}t.number=o;function a(p,m,w){return e.call(p)==="[object Number]"&&m<=p&&p<=w}t.numberRange=a;function u(p){
|
|
540
540
|
return e.call(p)==="[object Number]"&&-2147483648<=p&&p<=2147483647}t.integer=u;function c(p){return e.call(p)==="[object Number]"&&0<=p&&p<=2147483647}t.uinteger=c;function l(p){return e.call(p)==="[object Function]"}t.func=l;function f(p){return p!==null&&typeof p=="object"}t.objectLiteral=f;function d(p,m){return Array.isArray(p)&&p.every(m)}t.typedArray=d})(j||(j={}));class Ej{constructor(){this.nodeStack=[]}get current(){var e;return(e=this.nodeStack[this.nodeStack.length-1])!==null&&e!==void 0?
|
|
541
|
-
e:this.rootNode}buildRootNode(e){return this.rootNode=new HR(e),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){const n=new
|
|
542
|
-
e);r>=0&&n.content.splice(r,1)}}addHiddenNodes(e){const n=[];for(const s of e){const o=new
|
|
541
|
+
e:this.rootNode}buildRootNode(e){return this.rootNode=new HR(e),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){const n=new Ey;return n.grammarSource=e,n.root=this.rootNode,this.current.content.push(n),this.nodeStack.push(n),n}buildLeafNode(e,n){const r=new by(e.startOffset,e.image.length,Lm(e),e.tokenType,!n);return r.grammarSource=n,r.root=this.rootNode,this.current.content.push(r),r}removeNode(e){const n=e.container;if(n){const r=n.content.indexOf(
|
|
542
|
+
e);r>=0&&n.content.splice(r,1)}}addHiddenNodes(e){const n=[];for(const s of e){const o=new by(s.startOffset,s.image.length,Lm(s),s.tokenType,!0);o.root=this.rootNode,n.push(o)}let r=this.current,i=!1;if(r.content.length>0){r.content.push(...n);return}for(;r.container;){const s=r.container.content.indexOf(r);if(s>0){r.container.content.splice(s,0,...n),i=!0;break}r=r.container}i||this.rootNode.content.unshift(...n)}construct(e){const n=this.current;typeof e.$type=="string"&&(this.current.astNode=
|
|
543
543
|
e),e.$cstNode=n;const r=this.nodeStack.pop();r?.content.length===0&&this.removeNode(r)}}class zR{get parent(){return this.container}get feature(){return this.grammarSource}get hidden(){return!1}get astNode(){var e,n;const r=typeof((e=this._astNode)===null||e===void 0?void 0:e.$type)=="string"?this._astNode:(n=this.container)===null||n===void 0?void 0:n.astNode;if(!r)throw new Error("This node has no associated AST element");return r}set astNode(e){this._astNode=e}get element(){return this.astNode}get text(){
|
|
544
|
-
return this.root.fullText.substring(this.offset,this.end)}}class
|
|
544
|
+
return this.root.fullText.substring(this.offset,this.end)}}class by extends zR{get offset(){return this._offset}get length(){return this._length}get end(){return this._offset+this._length}get hidden(){return this._hidden}get tokenType(){return this._tokenType}get range(){return this._range}constructor(e,n,r,i,s=!1){super(),this._hidden=s,this._offset=e,this._tokenType=i,this._length=n,this._range=r}}class Ey extends zR{constructor(){super(...arguments),this.content=new zw(this)}get children(){return this.
|
|
545
545
|
content}get offset(){var e,n;return(n=(e=this.firstNonHiddenNode)===null||e===void 0?void 0:e.offset)!==null&&n!==void 0?n:0}get length(){return this.end-this.offset}get end(){var e,n;return(n=(e=this.lastNonHiddenNode)===null||e===void 0?void 0:e.end)!==null&&n!==void 0?n:0}get range(){const e=this.firstNonHiddenNode,n=this.lastNonHiddenNode;if(e&&n){if(this._rangeCache===void 0){const{range:r}=e,{range:i}=n;this._rangeCache={start:r.start,end:i.end.line<r.start.line?r.start:i.end}}return this.
|
|
546
546
|
_rangeCache}else return{start:ot.create(0,0),end:ot.create(0,0)}}get firstNonHiddenNode(){for(const e of this.content)if(!e.hidden)return e;return this.content[0]}get lastNonHiddenNode(){for(let e=this.content.length-1;e>=0;e--){const n=this.content[e];if(!n.hidden)return n}return this.content[this.content.length-1]}}class zw extends Array{constructor(e){super(),this.parent=e,Object.setPrototypeOf(this,zw.prototype)}push(...e){return this.addParents(e),super.push(...e)}unshift(...e){return this.
|
|
547
|
-
addParents(e),super.unshift(...e)}splice(e,n,...r){return this.addParents(r),super.splice(e,n,...r)}addParents(e){for(const n of e)n.container=this.parent}}class HR extends
|
|
547
|
+
addParents(e),super.unshift(...e)}splice(e,n,...r){return this.addParents(r),super.splice(e,n,...r)}addParents(e){for(const n of e)n.container=this.parent}}class HR extends Ey{get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}constructor(e){super(),this._text="",this._text=e??""}}const $y=Symbol("Datatype");function Ry(t){return t.$type===$y}const KR="\u200B",VR=t=>t.endsWith(KR)?t:t+KR;class XR{constructor(e){this._unorderedGroups=new Map,this.allRules=
|
|
548
548
|
new Map,this.lexer=e.parser.Lexer;const n=this.lexer.definition,r=e.LanguageMetaData.mode==="production";this.wrapper=new Tj(n,Object.assign(Object.assign({},e.parser.ParserConfig),{skipValidations:r,errorMessageProvider:e.parser.ParserErrorMessageProvider}))}alternatives(e,n){this.wrapper.wrapOr(e,n)}optional(e,n){this.wrapper.wrapOption(e,n)}many(e,n){this.wrapper.wrapMany(e,n)}atLeastOne(e,n){this.wrapper.wrapAtLeastOne(e,n)}getRule(e){return this.allRules.get(e)}isRecording(){return this.wrapper.
|
|
549
549
|
IS_RECORDING}get unorderedGroups(){return this._unorderedGroups}getRuleStack(){return this.wrapper.RULE_STACK}finalize(){this.wrapper.wrapSelfAnalysis()}}class $j extends XR{get current(){return this.stack[this.stack.length-1]}constructor(e){super(e),this.nodeBuilder=new Ej,this.stack=[],this.assignmentMap=new Map,this.linker=e.references.Linker,this.converter=e.parser.ValueConverter,this.astReflection=e.shared.AstReflection}rule(e,n){const r=this.computeRuleType(e),i=this.wrapper.DEFINE_RULE(VR(
|
|
550
|
-
e.name),this.startImplementation(r,n).bind(this));return this.allRules.set(e.name,i),e.entry&&(this.mainRule=i),i}computeRuleType(e){if(!e.fragment){if(Rf(e))return
|
|
550
|
+
e.name),this.startImplementation(r,n).bind(this));return this.allRules.set(e.name,i),e.entry&&(this.mainRule=i),i}computeRuleType(e){if(!e.fragment){if(Rf(e))return $y;{const n=Os(e);return n??e.name}}}parse(e,n={}){this.nodeBuilder.buildRootNode(e);const r=this.lexerResult=this.lexer.tokenize(e);this.wrapper.input=r.tokens;const i=n.rule?this.allRules.get(n.rule):this.mainRule;if(!i)throw new Error(n.rule?`No rule found with name '${n.rule}'`:"No main rule available.");const s=this.doParse(i);return this.
|
|
551
551
|
nodeBuilder.addHiddenNodes(r.hidden),this.unorderedGroups.clear(),this.lexerResult=void 0,{value:s,lexerErrors:r.errors,lexerReport:r.report,parserErrors:this.wrapper.errors}}doParse(e){let n=e.call(this.wrapper,{});if(this.stack.length>0&&(n=this.construct()),n===void 0)throw new Error("No result from parser");if(this.stack.length>0)throw new Error("Parser stack is not empty after parsing");return n}startImplementation(e,n){return r=>{const i=!this.isRecording()&&e!==void 0;if(i){const s={$type:e};
|
|
552
|
-
this.stack.push(s),e
|
|
553
|
-
isCrossRef:u}=this.getAssignment(r),c=this.current;if(a){const l=vr(r)?i.image:this.converter.convert(i.image,o);this.assign(a.operator,a.feature,l,o,u)}else if(
|
|
554
|
-
this.isRecording()||(a===void 0&&!r&&(a=this.construct()),a!==void 0&&o&&o.length>0&&this.performSubruleAssignment(a,i,o))}}performSubruleAssignment(e,n,r){const{assignment:i,isCrossRef:s}=this.getAssignment(n);if(i)this.assign(i.operator,i.feature,e,r,s);else if(!i){const o=this.current;if(
|
|
555
|
-
operator){r=this.construct(),this.nodeBuilder.removeNode(r.$cstNode),this.nodeBuilder.buildCompositeNode(n).content.push(r.$cstNode);const s={$type:e};this.stack.push(s),this.assign(n.operator,n.feature,r,r.$cstNode,!1)}else r.$type=e}}construct(){if(this.isRecording())return;const e=this.current;return
|
|
552
|
+
this.stack.push(s),e===$y&&(s.value="")}return n(r),i?this.construct():void 0}}extractHiddenTokens(e){const n=this.lexerResult.hidden;if(!n.length)return[];const r=e.startOffset;for(let i=0;i<n.length;i++)if(n[i].startOffset>r)return n.splice(0,i);return n.splice(0,n.length)}consume(e,n,r){const i=this.wrapper.wrapConsume(e,n);if(!this.isRecording()&&this.isValidToken(i)){const s=this.extractHiddenTokens(i);this.nodeBuilder.addHiddenNodes(s);const o=this.nodeBuilder.buildLeafNode(i,r),{assignment:a,
|
|
553
|
+
isCrossRef:u}=this.getAssignment(r),c=this.current;if(a){const l=vr(r)?i.image:this.converter.convert(i.image,o);this.assign(a.operator,a.feature,l,o,u)}else if(Ry(c)){let l=i.image;vr(r)||(l=this.converter.convert(l,o).toString()),c.value+=l}}}isValidToken(e){return!e.isInsertedInRecovery&&!isNaN(e.startOffset)&&typeof e.endOffset=="number"&&!isNaN(e.endOffset)}subrule(e,n,r,i,s){let o;!this.isRecording()&&!r&&(o=this.nodeBuilder.buildCompositeNode(i));let a;try{a=this.wrapper.wrapSubrule(e,n,s)}finally{
|
|
554
|
+
this.isRecording()||(a===void 0&&!r&&(a=this.construct()),a!==void 0&&o&&o.length>0&&this.performSubruleAssignment(a,i,o))}}performSubruleAssignment(e,n,r){const{assignment:i,isCrossRef:s}=this.getAssignment(n);if(i)this.assign(i.operator,i.feature,e,r,s);else if(!i){const o=this.current;if(Ry(o))o.value+=e.toString();else if(typeof e=="object"&&e){const u=this.assignWithoutOverride(e,o);this.stack.pop(),this.stack.push(u)}}}action(e,n){if(!this.isRecording()){let r=this.current;if(n.feature&&n.
|
|
555
|
+
operator){r=this.construct(),this.nodeBuilder.removeNode(r.$cstNode),this.nodeBuilder.buildCompositeNode(n).content.push(r.$cstNode);const s={$type:e};this.stack.push(s),this.assign(n.operator,n.feature,r,r.$cstNode,!1)}else r.$type=e}}construct(){if(this.isRecording())return;const e=this.current;return Vm(e),this.nodeBuilder.construct(e),this.stack.pop(),Ry(e)?this.converter.convert(e.value,e.$cstNode):(Ym(this.astReflection,e),e)}getAssignment(e){if(!this.assignmentMap.has(e)){const n=zn(e,jr);
|
|
556
556
|
this.assignmentMap.set(e,{assignment:n,isCrossRef:n?Uo(n.terminal):!1})}return this.assignmentMap.get(e)}assign(e,n,r,i,s){const o=this.current;let a;switch(s&&typeof r=="string"?a=this.linker.buildReference(o,n,i,r):a=r,e){case"=":{o[n]=a;break}case"?=":{o[n]=!0;break}case"+=":Array.isArray(o[n])||(o[n]=[]),o[n].push(a)}}assignWithoutOverride(e,n){for(const[i,s]of Object.entries(n)){const o=e[i];o===void 0?e[i]=s:Array.isArray(o)&&Array.isArray(s)&&(s.push(...o),e[i]=s)}const r=e.$cstNode;return r&&
|
|
557
557
|
(r.astNode=void 0,e.$cstNode=void 0),e}get definitionErrors(){return this.wrapper.definitionErrors}}class Rj{buildMismatchTokenMessage(e){return na.buildMismatchTokenMessage(e)}buildNotAllInputParsedMessage(e){return na.buildNotAllInputParsedMessage(e)}buildNoViableAltMessage(e){return na.buildNoViableAltMessage(e)}buildEarlyExitMessage(e){return na.buildEarlyExitMessage(e)}}class YR extends Rj{buildMismatchTokenMessage({expected:e,actual:n}){return`Expecting ${e.LABEL?"`"+e.LABEL+"`":e.name.endsWith(
|
|
558
558
|
":KW")?`keyword '${e.name.substring(0,e.name.length-3)}'`:`token of type '${e.name}'`} but found \`${n.image}\`.`}buildNotAllInputParsedMessage({firstRedundant:e}){return`Expecting end of file but found \`${e.image}\`.`}}class Dj extends XR{constructor(){super(...arguments),this.tokens=[],this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}action(){}construct(){}parse(e){this.resetState();const n=this.lexer.tokenize(e,{mode:"partial"});return this.tokens=n.tokens,
|
|
559
559
|
this.wrapper.input=[...this.tokens],this.mainRule.call(this.wrapper,{}),this.unorderedGroups.clear(),{tokens:this.tokens,elementStack:[...this.lastElementStack],tokenIndex:this.nextTokenIndex}}rule(e,n){const r=this.wrapper.DEFINE_RULE(VR(e.name),this.startImplementation(n).bind(this));return this.allRules.set(e.name,r),e.entry&&(this.mainRule=r),r}resetState(){this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}startImplementation(e){return n=>{const r=this.keepStackSize();
|
|
560
560
|
try{e(n)}finally{this.resetStackSize(r)}}}removeUnexpectedElements(){this.elementStack.splice(this.stackSize)}keepStackSize(){const e=this.elementStack.length;return this.stackSize=e,e}resetStackSize(e){this.removeUnexpectedElements(),this.stackSize=e}consume(e,n,r){this.wrapper.wrapConsume(e,n),this.isRecording()||(this.lastElementStack=[...this.elementStack,r],this.nextTokenIndex=this.currIdx+1)}subrule(e,n,r,i,s){this.before(i),this.wrapper.wrapSubrule(e,n,s),this.after(i)}before(e){this.isRecording()||
|
|
561
|
-
this.elementStack.push(e)}after(e){if(!this.isRecording()){const n=this.elementStack.lastIndexOf(e);n>=0&&this.elementStack.splice(n)}}get currIdx(){return this.wrapper.currIdx}}const kj={recoveryEnabled:!0,nodeLocationTracking:"full",skipValidations:!0,errorMessageProvider:new YR};class Tj extends Nq{constructor(e,n){const r=n&&"maxLookahead"in n;super(e,Object.assign(Object.assign(Object.assign({},kj),{lookaheadStrategy:r?new
|
|
562
|
-
()=>{}:void 0})}),n))}get IS_RECORDING(){return this.RECORDING_PHASE}DEFINE_RULE(e,n,r){return this.RULE(e,n,r)}wrapSelfAnalysis(){this.performSelfAnalysis()}wrapConsume(e,n){return this.consume(e,n,void 0)}wrapSubrule(e,n,r){return this.subrule(e,n,{ARGS:[r]})}wrapOr(e,n){this.or(e,n)}wrapOption(e,n){this.option(e,n)}wrapMany(e,n){this.many(e,n)}wrapAtLeastOne(e,n){this.atLeastOne(e,n)}}function JR(t,e,n){return Cj({parser:e,tokens:n,ruleNames:new Map},t),e}function Cj(t,e){const n=
|
|
563
|
-
e.rules).filter(Vt).filter(i=>n.has(i));for(const i of r){const s=Object.assign(Object.assign({},t),{consume:1,optional:1,subrule:1,many:1,or:1});t.parser.rule(i,zs(s,i.definition))}}function zs(t,e,n=!1){let r;if(vr(e))r=Ij(t,e);else if(Is(e))r=Aj(t,e);else if(jr(e))r=zs(t,e.terminal);else if(Uo(e))r=QR(t,e);else if(ui(e))r=Sj(t,e);else if(
|
|
564
|
-
`Unexpected element type: ${e.$type}`);return ZR(t,n?void 0:hp(e),r,e.cardinality)}function Aj(t,e){const n=Nu(e);return()=>t.parser.action(n,e)}function Sj(t,e){const n=e.rule.ref;if(Vt(n)){const r=t.subrule++,i=n.fragment,s=e.arguments.length>0?_j(n,e.arguments):()=>({});return o=>t.parser.subrule(r,eD(t,n),i,e,s(o))}else if(ai(n)){const r=t.consume++,i=
|
|
561
|
+
this.elementStack.push(e)}after(e){if(!this.isRecording()){const n=this.elementStack.lastIndexOf(e);n>=0&&this.elementStack.splice(n)}}get currIdx(){return this.wrapper.currIdx}}const kj={recoveryEnabled:!0,nodeLocationTracking:"full",skipValidations:!0,errorMessageProvider:new YR};class Tj extends Nq{constructor(e,n){const r=n&&"maxLookahead"in n;super(e,Object.assign(Object.assign(Object.assign({},kj),{lookaheadStrategy:r?new Qg({maxLookahead:n.maxLookahead}):new ej({logging:n.skipValidations?
|
|
562
|
+
()=>{}:void 0})}),n))}get IS_RECORDING(){return this.RECORDING_PHASE}DEFINE_RULE(e,n,r){return this.RULE(e,n,r)}wrapSelfAnalysis(){this.performSelfAnalysis()}wrapConsume(e,n){return this.consume(e,n,void 0)}wrapSubrule(e,n,r){return this.subrule(e,n,{ARGS:[r]})}wrapOr(e,n){this.or(e,n)}wrapOption(e,n){this.option(e,n)}wrapMany(e,n){this.many(e,n)}wrapAtLeastOne(e,n){this.atLeastOne(e,n)}}function JR(t,e,n){return Cj({parser:e,tokens:n,ruleNames:new Map},t),e}function Cj(t,e){const n=eg(e,!1),r=Ve(
|
|
563
|
+
e.rules).filter(Vt).filter(i=>n.has(i));for(const i of r){const s=Object.assign(Object.assign({},t),{consume:1,optional:1,subrule:1,many:1,or:1});t.parser.rule(i,zs(s,i.definition))}}function zs(t,e,n=!1){let r;if(vr(e))r=Ij(t,e);else if(Is(e))r=Aj(t,e);else if(jr(e))r=zs(t,e.terminal);else if(Uo(e))r=QR(t,e);else if(ui(e))r=Sj(t,e);else if(Hm(e))r=xj(t,e);else if(Km(e))r=Pj(t,e);else if(Xi(e))r=Nj(t,e);else if(RN(e)){const i=t.consume++;r=()=>t.parser.consume(i,Zi,e)}else throw new t0(e.$cstNode,
|
|
564
|
+
`Unexpected element type: ${e.$type}`);return ZR(t,n?void 0:hp(e),r,e.cardinality)}function Aj(t,e){const n=Nu(e);return()=>t.parser.action(n,e)}function Sj(t,e){const n=e.rule.ref;if(Vt(n)){const r=t.subrule++,i=n.fragment,s=e.arguments.length>0?_j(n,e.arguments):()=>({});return o=>t.parser.subrule(r,eD(t,n),i,e,s(o))}else if(ai(n)){const r=t.consume++,i=Dy(t,n.name);return()=>t.parser.consume(r,i,e)}else if(n)Qa();else throw new t0(e.$cstNode,`Undefined rule: ${e.rule.$refText}`)}function _j(t,e){
|
|
565
565
|
const n=e.map(r=>yi(r.value));return r=>{const i={};for(let s=0;s<n.length;s++){const o=t.parameters[s],a=n[s];i[o.name]=a(r)}return i}}function yi(t){if(gN(t)){const e=yi(t.left),n=yi(t.right);return r=>e(r)||n(r)}else if(mN(t)){const e=yi(t.left),n=yi(t.right);return r=>e(r)&&n(r)}else if(yN(t)){const e=yi(t.value);return n=>!e(n)}else if(vN(t)){const e=t.parameter.ref.name;return n=>n!==void 0&&n[e]===!0}else if(hN(t)){const e=!!t.true;return()=>e}Qa()}function xj(t,e){if(e.elements.length===
|
|
566
566
|
1)return zs(t,e.elements[0]);{const n=[];for(const i of e.elements){const s={ALT:zs(t,i,!0)},o=hp(i);o&&(s.GATE=yi(o)),n.push(s)}const r=t.or++;return i=>t.parser.alternatives(r,n.map(s=>{const o={ALT:()=>s.ALT(i)},a=s.GATE;return a&&(o.GATE=()=>a(i)),o}))}}function Pj(t,e){if(e.elements.length===1)return zs(t,e.elements[0]);const n=[];for(const a of e.elements){const u={ALT:zs(t,a,!0)},c=hp(a);c&&(u.GATE=yi(c)),n.push(u)}const r=t.or++,i=(a,u)=>{const c=u.getRuleStack().join("-");return`uGroup_${a}\
|
|
567
567
|
_${c}`},s=a=>t.parser.alternatives(r,n.map((u,c)=>{const l={ALT:()=>!0},f=t.parser;l.ALT=()=>{if(u.ALT(a),!f.isRecording()){const p=i(r,f);f.unorderedGroups.get(p)||f.unorderedGroups.set(p,[]);const m=f.unorderedGroups.get(p);typeof m?.[c]>"u"&&(m[c]=!0)}};const d=u.GATE;return d?l.GATE=()=>d(a):l.GATE=()=>{const p=f.unorderedGroups.get(i(r,f));return!p?.[c]},l})),o=ZR(t,hp(e),s,"*");return a=>{o(a),t.parser.isRecording()||t.parser.unorderedGroups.delete(i(r,t.parser))}}function Nj(t,e){const n=e.
|
|
568
|
-
elements.map(r=>zs(t,r));return r=>n.forEach(i=>i(r))}function hp(t){if(Xi(t))return t.guardCondition}function QR(t,e,n=e.terminal){if(n)if(ui(n)&&Vt(n.rule.ref)){const r=n.rule.ref,i=t.subrule++;return s=>t.parser.subrule(i,eD(t,r),!1,e,s)}else if(ui(n)&&ai(n.rule.ref)){const r=t.consume++,i=
|
|
569
|
-
if(!e.type.ref)throw new Error("Could not resolve reference to type: "+e.type.$refText);const r=
|
|
568
|
+
elements.map(r=>zs(t,r));return r=>n.forEach(i=>i(r))}function hp(t){if(Xi(t))return t.guardCondition}function QR(t,e,n=e.terminal){if(n)if(ui(n)&&Vt(n.rule.ref)){const r=n.rule.ref,i=t.subrule++;return s=>t.parser.subrule(i,eD(t,r),!1,e,s)}else if(ui(n)&&ai(n.rule.ref)){const r=t.consume++,i=Dy(t,n.rule.ref.name);return()=>t.parser.consume(r,i,e)}else if(vr(n)){const r=t.consume++,i=Dy(t,n.value);return()=>t.parser.consume(r,i,e)}else throw new Error("Could not build cross reference parser");else{
|
|
569
|
+
if(!e.type.ref)throw new Error("Could not resolve reference to type: "+e.type.$refText);const r=sg(e.type.ref),i=r?.terminal;if(!i)throw new Error("Could not find name assignment for type: "+Nu(e.type.ref));return QR(t,e,i)}}function Ij(t,e){const n=t.consume++,r=t.tokens[e.value];if(!r)throw new Error("Could not find token for keyword: "+e.value);return()=>t.parser.consume(n,r,e)}function ZR(t,e,n,r){const i=e&&yi(e);if(!r)if(i){const s=t.or++;return o=>t.parser.alternatives(s,[{ALT:()=>n(o),GATE:()=>i(
|
|
570
570
|
o)},{ALT:O$(),GATE:()=>!i(o)}])}else return n;if(r==="*"){const s=t.many++;return o=>t.parser.many(s,{DEF:()=>n(o),GATE:i?()=>i(o):void 0})}else if(r==="+"){const s=t.many++;if(i){const o=t.or++;return a=>t.parser.alternatives(o,[{ALT:()=>t.parser.atLeastOne(s,{DEF:()=>n(a)}),GATE:()=>i(a)},{ALT:O$(),GATE:()=>!i(a)}])}else return o=>t.parser.atLeastOne(s,{DEF:()=>n(o)})}else if(r==="?"){const s=t.optional++;return o=>t.parser.optional(s,{DEF:()=>n(o),GATE:i?()=>i(o):void 0})}else Qa()}function eD(t,e){
|
|
571
|
-
const n=Oj(t,e),r=t.parser.getRule(n);if(!r)throw new Error(`Rule "${n}" not found."`);return r}function Oj(t,e){if(Vt(e))return e.name;if(t.ruleNames.has(e))return t.ruleNames.get(e);{let n=e,r=n.$container,i=e.$type;for(;!Vt(r);)(Xi(r)||
|
|
572
|
-
Lexer,r=new Dj(t);return JR(e,r,n.definition),r.finalize(),r}function Fj(t){const e=Mj(t);return e.finalize(),e}function Mj(t){const e=t.Grammar,n=t.parser.Lexer,r=new $j(t);return JR(e,r,n.definition)}class Bj{constructor(){this.diagnostics=[]}buildTokens(e,n){const r=Ve(
|
|
573
|
-
[],e}buildTerminalTokens(e){return e.filter(ai).filter(n=>!n.fragment).map(n=>this.buildTerminalToken(n)).toArray()}buildTerminalToken(e){const n=Iu(e),r=this.requiresCustomPattern(n)?this.regexPatternFunction(n):n,i={name:e.name,PATTERN:r};return typeof r=="function"&&(i.LINE_BREAKS=!0),e.hidden&&(i.GROUP=f0(n)?
|
|
571
|
+
const n=Oj(t,e),r=t.parser.getRule(n);if(!r)throw new Error(`Rule "${n}" not found."`);return r}function Oj(t,e){if(Vt(e))return e.name;if(t.ruleNames.has(e))return t.ruleNames.get(e);{let n=e,r=n.$container,i=e.$type;for(;!Vt(r);)(Xi(r)||Hm(r)||Km(r))&&(i=r.elements.indexOf(n).toString()+":"+i),n=r,r=r.$container;return i=r.name+":"+i,t.ruleNames.set(e,i),i}}function Dy(t,e){const n=t.tokens[e];if(!n)throw new Error(`Token "${e}" not found."`);return n}function Lj(t){const e=t.Grammar,n=t.parser.
|
|
572
|
+
Lexer,r=new Dj(t);return JR(e,r,n.definition),r.finalize(),r}function Fj(t){const e=Mj(t);return e.finalize(),e}function Mj(t){const e=t.Grammar,n=t.parser.Lexer,r=new $j(t);return JR(e,r,n.definition)}class Bj{constructor(){this.diagnostics=[]}buildTokens(e,n){const r=Ve(eg(e,!1)),i=this.buildTerminalTokens(r),s=this.buildKeywordTokens(r,i,n);return s.push(...i),s}flushLexingReport(e){return{diagnostics:this.popDiagnostics()}}popDiagnostics(){const e=[...this.diagnostics];return this.diagnostics=
|
|
573
|
+
[],e}buildTerminalTokens(e){return e.filter(ai).filter(n=>!n.fragment).map(n=>this.buildTerminalToken(n)).toArray()}buildTerminalToken(e){const n=Iu(e),r=this.requiresCustomPattern(n)?this.regexPatternFunction(n):n,i={name:e.name,PATTERN:r};return typeof r=="function"&&(i.LINE_BREAKS=!0),e.hidden&&(i.GROUP=f0(n)?Fn.SKIPPED:"hidden"),i}requiresCustomPattern(e){return e.flags.includes("u")||e.flags.includes("s")?!0:!!(e.source.includes("?<=")||e.source.includes("?<!"))}regexPatternFunction(e){const n=new RegExp(
|
|
574
574
|
e,e.flags+"y");return(r,i)=>(n.lastIndex=i,n.exec(r))}buildKeywordTokens(e,n,r){return e.filter(Vt).flatMap(i=>wr(i).filter(vr)).distinct(i=>i.value).toArray().sort((i,s)=>s.value.length-i.value.length).map(i=>this.buildKeywordToken(i,n,!!r?.caseInsensitive))}buildKeywordToken(e,n,r){const i=this.buildKeywordPattern(e,r),s={name:e.value,PATTERN:i,LONGER_ALT:this.findLongerAlt(e,n)};return typeof i=="function"&&(s.LINE_BREAKS=!0),s}buildKeywordPattern(e,n){return n?new RegExp(Ef(e.value),"i"):e.value}findLongerAlt(e,n){
|
|
575
|
-
return n.reduce((r,i)=>{const s=i?.PATTERN;return s?.source&&MN("^"+s.source+"$",e.value)&&r.push(i),r},[])}}class tD{convert(e,n){let r=n.grammarSource;if(Uo(r)&&(r=
|
|
575
|
+
return n.reduce((r,i)=>{const s=i?.PATTERN;return s?.source&&MN("^"+s.source+"$",e.value)&&r.push(i),r},[])}}class tD{convert(e,n){let r=n.grammarSource;if(Uo(r)&&(r=tg(r)),ui(r)){const i=r.rule.ref;if(!i)throw new Error("This cst node was not parsed by a rule.");return this.runConverter(i,e,n)}return e}runConverter(e,n,r){var i;switch(e.name.toUpperCase()){case"INT":return Vr.convertInt(n);case"STRING":return Vr.convertString(n);case"ID":return Vr.convertID(n)}switch((i=$0(e))===null||i===void 0?
|
|
576
576
|
void 0:i.toLowerCase()){case"number":return Vr.convertNumber(n);case"boolean":return Vr.convertBoolean(n);case"bigint":return Vr.convertBigint(n);case"date":return Vr.convertDate(n);default:return n}}}var Vr;(function(t){function e(c){let l="";for(let f=1;f<c.length-1;f++){const d=c.charAt(f);if(d==="\\"){const p=c.charAt(++f);l+=n(p)}else l+=d}return l}t.convertString=e;function n(c){switch(c){case"b":return"\b";case"f":return"\f";case"n":return`
|
|
577
577
|
`;case"r":return"\r";case"t":return" ";case"v":return"\v";case"0":return"\0";default:return c}}function r(c){return c.charAt(0)==="^"?c.substring(1):c}t.convertID=r;function i(c){return parseInt(c)}t.convertInt=i;function s(c){return BigInt(c)}t.convertBigint=s;function o(c){return new Date(c)}t.convertDate=o;function a(c){return Number(c)}t.convertNumber=a;function u(c){return c.toLowerCase()==="true"}t.convertBoolean=u})(Vr||(Vr={}));function vi(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.
|
|
578
578
|
call(t,"default")?t.default:t}function qj(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}var Hs={},mp={},nD;function Ks(){
|
|
@@ -583,14 +583,14 @@ splice(u,1);return}else a=!0;if(a)throw new Error("When adding a listener with a
|
|
|
583
583
|
s}get event(){return this._event||(this._event=(s,o,a)=>{this._callbacks||(this._callbacks=new n),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(s,o);const u={dispose:()=>{this._callbacks&&(this._callbacks.remove(s,o),u.dispose=r._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(a)&&a.push(u),u}),this._event}fire(s){
|
|
584
584
|
this._callbacks&&this._callbacks.invoke.call(this._callbacks,s)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}}return Vs.Emitter=r,r._noop=function(){},Vs}var sD;function gp(){if(sD)return Hs;sD=1,Object.defineProperty(Hs,"__esModule",{value:!0}),Hs.CancellationTokenSource=Hs.CancellationToken=void 0;const t=Ks(),e=nc(),n=aa();var r;(function(a){a.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:n.Event.None}),a.Cancelled=Object.freeze({isCancellationRequested:!0,
|
|
585
585
|
onCancellationRequested:n.Event.None});function u(c){const l=c;return l&&(l===a.None||l===a.Cancelled||e.boolean(l.isCancellationRequested)&&!!l.onCancellationRequested)}a.is=u})(r||(Hs.CancellationToken=r={}));const i=Object.freeze(function(a,u){const c=(0,t.default)().timer.setTimeout(a.bind(u),0);return{dispose(){c.dispose()}}});class s{constructor(){this._isCancelled=!1}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){
|
|
586
|
-
return this._isCancelled}get onCancellationRequested(){return this._isCancelled?i:(this._emitter||(this._emitter=new n.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}}class o{get token(){return this._token||(this._token=new s),this._token}cancel(){this._token?this._token.cancel():this._token=r.Cancelled}dispose(){this._token?this._token instanceof s&&this._token.dispose():this._token=r.None}}return Hs.CancellationTokenSource=o,Hs}var
|
|
587
|
-
function jj(){return new Promise(t=>{typeof setImmediate>"u"?setTimeout(t,0):setImmediate(t)})}let yp=0,Gj=10;function Uj(){return yp=performance.now(),new
|
|
586
|
+
return this._isCancelled}get onCancellationRequested(){return this._isCancelled?i:(this._emitter||(this._emitter=new n.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}}class o{get token(){return this._token||(this._token=new s),this._token}cancel(){this._token?this._token.cancel():this._token=r.Cancelled}dispose(){this._token?this._token instanceof s&&this._token.dispose():this._token=r.None}}return Hs.CancellationTokenSource=o,Hs}var mt=gp();
|
|
587
|
+
function jj(){return new Promise(t=>{typeof setImmediate>"u"?setTimeout(t,0):setImmediate(t)})}let yp=0,Gj=10;function Uj(){return yp=performance.now(),new mt.CancellationTokenSource}const vp=Symbol("OperationCancelled");function wp(t){return t===vp}async function jt(t){if(t===mt.CancellationToken.None)return;const e=performance.now();if(e-yp>=Gj&&(yp=e,await jj(),yp=performance.now()),t.isCancellationRequested)throw vp}class ky{constructor(){this.promise=new Promise((e,n)=>{this.resolve=r=>(e(r),
|
|
588
588
|
this),this.reject=r=>(n(r),this)})}}class Vd{constructor(e,n,r,i){this._uri=e,this._languageId=n,this._version=r,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){const n=this.offsetAt(e.start),r=this.offsetAt(e.end);return this._content.substring(n,r)}return this._content}update(e,n){for(const r of e)if(Vd.isIncremental(r)){const i=uD(r.range),s=this.offsetAt(i.start),o=this.offsetAt(i.
|
|
589
589
|
end);this._content=this._content.substring(0,s)+r.text+this._content.substring(o,this._content.length);const a=Math.max(i.start.line,0),u=Math.max(i.end.line,0);let c=this._lineOffsets;const l=oD(r.text,!1,s);if(u-a===l.length)for(let d=0,p=l.length;d<p;d++)c[d+a+1]=l[d];else l.length<1e4?c.splice(a+1,u-a,...l):this._lineOffsets=c=c.slice(0,a+1).concat(l,c.slice(u+1));const f=r.text.length-(o-s);if(f!==0)for(let d=a+1+l.length,p=c.length;d<p;d++)c[d]=c[d]+f}else if(Vd.isFull(r))this._content=r.text,
|
|
590
590
|
this._lineOffsets=void 0;else throw new Error("Unknown change event received");this._version=n}getLineOffsets(){return this._lineOffsets===void 0&&(this._lineOffsets=oD(this._content,!0)),this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);const n=this.getLineOffsets();let r=0,i=n.length;if(i===0)return{line:0,character:e};for(;r<i;){const o=Math.floor((r+i)/2);n[o]>e?i=o:r=o+1}const s=r-1;return e=this.ensureBeforeEOL(e,n[s]),{line:s,character:e-n[s]}}offsetAt(e){const n=this.
|
|
591
591
|
getLineOffsets();if(e.line>=n.length)return this._content.length;if(e.line<0)return 0;const r=n[e.line];if(e.character<=0)return r;const i=e.line+1<n.length?n[e.line+1]:this._content.length,s=Math.min(r+e.character,i);return this.ensureBeforeEOL(s,r)}ensureBeforeEOL(e,n){for(;e>n&&aD(this._content.charCodeAt(e-1));)e--;return e}get lineCount(){return this.getLineOffsets().length}static isIncremental(e){const n=e;return n!=null&&typeof n.text=="string"&&n.range!==void 0&&(n.rangeLength===void 0||
|
|
592
|
-
typeof n.rangeLength=="number")}static isFull(e){const n=e;return n!=null&&typeof n.text=="string"&&n.range===void 0&&n.rangeLength===void 0}}var bp;(function(t){function e(i,s,o,a){return new Vd(i,s,o,a)}t.create=e;function n(i,s,o){if(i instanceof Vd)return i.update(s,o),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}t.update=n;function r(i,s){const o=i.getText(),a=
|
|
593
|
-
start.character-f.range.start.character:d});let u=0;const c=[];for(const l of a){const f=i.offsetAt(l.range.start);if(f<u)throw new Error("Overlapping edit");f>u&&c.push(o.substring(u,f)),l.newText.length&&c.push(l.newText),u=i.offsetAt(l.range.end)}return c.push(o.substr(u)),c.join("")}t.applyEdits=r})(bp||(bp={}));function
|
|
592
|
+
typeof n.rangeLength=="number")}static isFull(e){const n=e;return n!=null&&typeof n.text=="string"&&n.range===void 0&&n.rangeLength===void 0}}var bp;(function(t){function e(i,s,o,a){return new Vd(i,s,o,a)}t.create=e;function n(i,s,o){if(i instanceof Vd)return i.update(s,o),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}t.update=n;function r(i,s){const o=i.getText(),a=Ty(s.map(Wj),(l,f)=>{const d=l.range.start.line-f.range.start.line;return d===0?l.range.
|
|
593
|
+
start.character-f.range.start.character:d});let u=0;const c=[];for(const l of a){const f=i.offsetAt(l.range.start);if(f<u)throw new Error("Overlapping edit");f>u&&c.push(o.substring(u,f)),l.newText.length&&c.push(l.newText),u=i.offsetAt(l.range.end)}return c.push(o.substr(u)),c.join("")}t.applyEdits=r})(bp||(bp={}));function Ty(t,e){if(t.length<=1)return t;const n=t.length/2|0,r=t.slice(0,n),i=t.slice(n);Ty(r,e),Ty(i,e);let s=0,o=0,a=0;for(;s<r.length&&o<i.length;)e(r[s],i[o])<=0?t[a++]=r[s++]:t[a++]=
|
|
594
594
|
i[o++];for(;s<r.length;)t[a++]=r[s++];for(;o<i.length;)t[a++]=i[o++];return t}function oD(t,e,n=0){const r=e?[n]:[];for(let i=0;i<t.length;i++){const s=t.charCodeAt(i);aD(s)&&(s===13&&i+1<t.length&&t.charCodeAt(i+1)===10&&i++,r.push(n+i+1))}return r}function aD(t){return t===13||t===10}function uD(t){const e=t.start,n=t.end;return e.line>n.line||e.line===n.line&&e.character>n.character?{start:n,end:e}:t}function Wj(t){const e=uD(t.range);return e!==t.range?{newText:t.newText,range:e}:t}var cD;(()=>{
|
|
595
595
|
var t={975:M=>{function T(x){if(typeof x!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(x))}function D(x,_){for(var I,te="",z=0,C=-1,ne=0,ye=0;ye<=x.length;++ye){if(ye<x.length)I=x.charCodeAt(ye);else{if(I===47)break;I=47}if(I===47){if(!(C===ye-1||ne===1))if(C!==ye-1&&ne===2){if(te.length<2||z!==2||te.charCodeAt(te.length-1)!==46||te.charCodeAt(te.length-2)!==46){if(te.length>2){var Ie=te.lastIndexOf("/");if(Ie!==te.length-1){Ie===-1?(te="",z=0):z=(te=te.slice(0,
|
|
596
596
|
Ie)).length-1-te.lastIndexOf("/"),C=ye,ne=0;continue}}else if(te.length===2||te.length===1){te="",z=0,C=ye,ne=0;continue}}_&&(te.length>0?te+="/..":te="..",z=2)}else te.length>0?te+="/"+x.slice(C+1,ye):te=x.slice(C+1,ye),z=ye-C-1;C=ye,ne=0}else I===46&&ne!==-1?++ne:ne=-1}return te}var F={resolve:function(){for(var x,_="",I=!1,te=arguments.length-1;te>=-1&&!I;te--){var z;te>=0?z=arguments[te]:(x===void 0&&(x=process.cwd()),z=x),T(z),z.length!==0&&(_=z+"/"+_,I=z.charCodeAt(0)===47)}return _=D(_,!I),
|
|
@@ -613,28 +613,28 @@ encodeURIComponent(M.substring(x,_)),x=-1),F+=te):x===-1&&(x=_)}}return x!==-1&&
|
|
|
613
613
|
charCodeAt(1)>=97&&M.path.charCodeAt(1)<=122)&&M.path.charCodeAt(2)===58?M.path[1].toLowerCase()+M.path.substr(2):M.path,i&&(D=D.replace(/\//g,"\\")),D}function R(M,T){const D=T?g:y;let F="",{scheme:x,authority:_,path:I,query:te,fragment:z}=M;if(x&&(F+=x,F+=":"),(_||x==="file")&&(F+=l,F+=l),_){let C=_.indexOf("@");if(C!==-1){const ne=_.substr(0,C);_=_.substr(C+1),C=ne.lastIndexOf(":"),C===-1?F+=D(ne,!1,!1):(F+=D(ne.substr(0,C),!1,!1),F+=":",F+=D(ne.substr(C+1),!1,!0)),F+="@"}_=_.toLowerCase(),C=
|
|
614
614
|
_.lastIndexOf(":"),C===-1?F+=D(_,!1,!0):(F+=D(_.substr(0,C),!1,!0),F+=_.substr(C))}if(I){if(I.length>=3&&I.charCodeAt(0)===47&&I.charCodeAt(2)===58){const C=I.charCodeAt(1);C>=65&&C<=90&&(I=`/${String.fromCharCode(C+32)}:${I.substr(3)}`)}else if(I.length>=2&&I.charCodeAt(1)===58){const C=I.charCodeAt(0);C>=65&&C<=90&&(I=`${String.fromCharCode(C+32)}:${I.substr(2)}`)}F+=D(I,!0,!1)}return te&&(F+="?",F+=D(te,!1,!1)),z&&(F+="#",F+=T?z:y(z,!1,!1)),F}function A(M){try{return decodeURIComponent(M)}catch{
|
|
615
615
|
return M.length>3?M.substr(0,3)+A(M.substr(3)):M}}const N=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function V(M){return M.match(N)?M.replace(N,T=>A(T)):M}var J=n(975);const se=J.posix||J,ie="/";var we;(function(M){M.joinPath=function(T,...D){return T.with({path:se.join(T.path,...D)})},M.resolvePath=function(T,...D){let F=T.path,x=!1;F[0]!==ie&&(F=ie+F,x=!0);let _=se.resolve(F,...D);return x&&_[0]===ie&&!T.authority&&(_=_.substring(1)),T.with({path:_})},M.dirname=function(T){if(T.path.length===0||T.path===ie)
|
|
616
|
-
return T;let D=se.dirname(T.path);return D.length===1&&D.charCodeAt(0)===46&&(D=""),T.with({path:D})},M.basename=function(T){return se.basename(T.path)},M.extname=function(T){return se.extname(T.path)}})(we||(we={})),cD=r})();const{URI:
|
|
617
|
-
o?.toString()}t.equals=n;function r(s,o){const a=typeof s=="string"?
|
|
618
|
-
return
|
|
619
|
-
CancellationToken.None){const r=await this.fileSystemProvider.readFile(e);return this.createAsync(e,r,n)}fromTextDocument(e,n,r){return n=n??
|
|
616
|
+
return T;let D=se.dirname(T.path);return D.length===1&&D.charCodeAt(0)===46&&(D=""),T.with({path:D})},M.basename=function(T){return se.basename(T.path)},M.extname=function(T){return se.extname(T.path)}})(we||(we={})),cD=r})();const{URI:dt,Utils:rc}=cD;var ct;(function(t){t.basename=rc.basename,t.dirname=rc.dirname,t.extname=rc.extname,t.joinPath=rc.joinPath,t.resolvePath=rc.resolvePath;const e=typeof process=="object"&&(process==null?void 0:process.platform)==="win32";function n(s,o){return s?.toString()===
|
|
617
|
+
o?.toString()}t.equals=n;function r(s,o){const a=typeof s=="string"?dt.parse(s).path:s.path,u=typeof o=="string"?dt.parse(o).path:o.path,c=a.split("/").filter(m=>m.length>0),l=u.split("/").filter(m=>m.length>0);if(e){const m=/^[A-Z]:$/;if(c[0]&&m.test(c[0])&&(c[0]=c[0].toLowerCase()),l[0]&&m.test(l[0])&&(l[0]=l[0].toLowerCase()),c[0]!==l[0])return u.substring(1)}let f=0;for(;f<c.length&&c[f]===l[f];f++);const d="../".repeat(c.length-f),p=l.slice(f).join("/");return d+p}t.relative=r;function i(s){
|
|
618
|
+
return dt.parse(s.toString()).toString()}t.normalize=i})(ct||(ct={}));var qe;(function(t){t[t.Changed=0]="Changed",t[t.Parsed=1]="Parsed",t[t.IndexedContent=2]="IndexedContent",t[t.ComputedScopes=3]="ComputedScopes",t[t.Linked=4]="Linked",t[t.IndexedReferences=5]="IndexedReferences",t[t.Validated=6]="Validated"})(qe||(qe={}));class zj{constructor(e){this.serviceRegistry=e.ServiceRegistry,this.textDocuments=e.workspace.TextDocuments,this.fileSystemProvider=e.workspace.FileSystemProvider}async fromUri(e,n=mt.
|
|
619
|
+
CancellationToken.None){const r=await this.fileSystemProvider.readFile(e);return this.createAsync(e,r,n)}fromTextDocument(e,n,r){return n=n??dt.parse(e.uri),mt.CancellationToken.is(r)?this.createAsync(n,e,r):this.create(n,e,r)}fromString(e,n,r){return mt.CancellationToken.is(r)?this.createAsync(n,e,r):this.create(n,e,r)}fromModel(e,n){return this.create(n,{$model:e})}create(e,n,r){if(typeof n=="string"){const i=this.parse(e,n,r);return this.createLangiumDocument(i,e,void 0,n)}else if("$model"in n){
|
|
620
620
|
const i={value:n.$model,parserErrors:[],lexerErrors:[]};return this.createLangiumDocument(i,e)}else{const i=this.parse(e,n.getText(),r);return this.createLangiumDocument(i,e,n)}}async createAsync(e,n,r){if(typeof n=="string"){const i=await this.parseAsync(e,n,r);return this.createLangiumDocument(i,e,void 0,n)}else{const i=await this.parseAsync(e,n.getText(),r);return this.createLangiumDocument(i,e,n)}}createLangiumDocument(e,n,r,i){let s;if(r)s={parseResult:e,uri:n,state:qe.Parsed,references:[],
|
|
621
621
|
textDocument:r};else{const o=this.createTextDocumentGetter(n,i);s={parseResult:e,uri:n,state:qe.Parsed,references:[],get textDocument(){return o()}}}return e.value.$document=s,s}async update(e,n){var r,i;const s=(r=e.parseResult.value.$cstNode)===null||r===void 0?void 0:r.root.fullText,o=(i=this.textDocuments)===null||i===void 0?void 0:i.get(e.uri.toString()),a=o?o.getText():await this.fileSystemProvider.readFile(e.uri);if(o)Object.defineProperty(e,"textDocument",{value:o});else{const u=this.createTextDocumentGetter(
|
|
622
622
|
e.uri,a);Object.defineProperty(e,"textDocument",{get:u})}return s!==a&&(e.parseResult=await this.parseAsync(e.uri,a,n),e.parseResult.value.$document=e),e.state=qe.Parsed,e}parse(e,n,r){return this.serviceRegistry.getServices(e).parser.LangiumParser.parse(n,r)}parseAsync(e,n,r){return this.serviceRegistry.getServices(e).parser.AsyncParser.parse(n,r)}createTextDocumentGetter(e,n){const r=this.serviceRegistry;let i;return()=>i??(i=bp.create(e.toString(),r.getServices(e).LanguageMetaData.languageId,
|
|
623
623
|
0,n??""))}}class lD{constructor(e){this.documentMap=new Map,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.serviceRegistry=e.ServiceRegistry}get all(){return Ve(this.documentMap.values())}addDocument(e){const n=e.uri.toString();if(this.documentMap.has(n))throw new Error(`A document with the URI '${n}' is already present.`);this.documentMap.set(n,e)}getDocument(e){const n=e.toString();return this.documentMap.get(n)}async getOrCreateDocument(e,n){let r=this.getDocument(e);return r||
|
|
624
624
|
(r=await this.langiumDocumentFactory.fromUri(e,n),this.addDocument(r),r)}createDocument(e,n,r){if(r)return this.langiumDocumentFactory.fromString(n,e,r).then(i=>(this.addDocument(i),i));{const i=this.langiumDocumentFactory.fromString(n,e);return this.addDocument(i),i}}hasDocument(e){return this.documentMap.has(e.toString())}invalidateDocument(e){const n=e.toString(),r=this.documentMap.get(n);return r&&(this.serviceRegistry.getServices(e).references.Linker.unlink(r),r.state=qe.Changed,r.precomputedScopes=
|
|
625
|
-
void 0,r.diagnostics=void 0),r}deleteDocument(e){const n=e.toString(),r=this.documentMap.get(n);return r&&(r.state=qe.Changed,this.documentMap.delete(n)),r}}const
|
|
626
|
-
gf(r).forEach(i=>this.doLink(i,e))}doLink(e,n){var r;const i=e.reference;if(i._ref===void 0){i._ref=
|
|
625
|
+
void 0,r.diagnostics=void 0),r}deleteDocument(e){const n=e.toString(),r=this.documentMap.get(n);return r&&(r.state=qe.Changed,this.documentMap.delete(n)),r}}const Cy=Symbol("ref_resolving");class Hj{constructor(e){this.reflection=e.shared.AstReflection,this.langiumDocuments=()=>e.shared.workspace.LangiumDocuments,this.scopeProvider=e.references.ScopeProvider,this.astNodeLocator=e.workspace.AstNodeLocator}async link(e,n=mt.CancellationToken.None){for(const r of ci(e.parseResult.value))await jt(n),
|
|
626
|
+
gf(r).forEach(i=>this.doLink(i,e))}doLink(e,n){var r;const i=e.reference;if(i._ref===void 0){i._ref=Cy;try{const s=this.getCandidate(e);if(tf(s))i._ref=s;else if(i._nodeDescription=s,this.langiumDocuments().hasDocument(s.documentUri)){const o=this.loadAstNode(s);i._ref=o??this.createLinkingError(e,s)}else i._ref=void 0}catch(s){console.error(`An error occurred while resolving reference to '${i.$refText}':`,s);const o=(r=s.message)!==null&&r!==void 0?r:String(s);i._ref=Object.assign(Object.assign(
|
|
627
627
|
{},e),{message:`An error occurred while resolving reference to '${i.$refText}': ${o}`})}n.references.push(i)}}unlink(e){for(const n of e.references)delete n._ref,delete n._nodeDescription;e.references=[]}getCandidate(e){const r=this.scopeProvider.getScope(e).getElement(e.reference.$refText);return r??this.createLinkingError(e)}buildReference(e,n,r,i){const s=this,o={$refNode:r,$refText:i,get ref(){var a;if(kt(this._ref))return this._ref;if(iN(this._nodeDescription)){const u=s.loadAstNode(this._nodeDescription);
|
|
628
|
-
this._ref=u??s.createLinkingError({reference:o,container:e,property:n},this._nodeDescription)}else if(this._ref===void 0){this._ref=
|
|
628
|
+
this._ref=u??s.createLinkingError({reference:o,container:e,property:n},this._nodeDescription)}else if(this._ref===void 0){this._ref=Cy;const u=mf(e).$document,c=s.getLinkedNode({reference:o,container:e,property:n});if(c.error&&u&&u.state<qe.ComputedScopes)return this._ref=void 0;this._ref=(a=c.node)!==null&&a!==void 0?a:c.error,this._nodeDescription=c.descr,u?.references.push(this)}else if(this._ref===Cy)throw new Error(`Cyclic reference resolution detected: ${s.astNodeLocator.getAstNodePath(e)}\
|
|
629
629
|
/${n} (symbol '${i}')`);return kt(this._ref)?this._ref:void 0},get $nodeDescription(){return this._nodeDescription},get error(){return tf(this._ref)?this._ref:void 0}};return o}getLinkedNode(e){var n;try{const r=this.getCandidate(e);if(tf(r))return{error:r};const i=this.loadAstNode(r);return i?{node:i,descr:r}:{descr:r,error:this.createLinkingError(e,r)}}catch(r){console.error(`An error occurred while resolving reference to '${e.reference.$refText}':`,r);const i=(n=r.message)!==null&&n!==void 0?
|
|
630
630
|
n:String(r);return{error:Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${e.reference.$refText}': ${i}`})}}}loadAstNode(e){if(e.node)return e.node;const n=this.langiumDocuments().getDocument(e.documentUri);if(n)return this.astNodeLocator.getAstNode(n.parseResult.value,e.path)}createLinkingError(e,n){const r=mf(e.container).$document;r&&r.state<qe.ComputedScopes&&console.warn(`Attempted reference resolution before document reached ComputedScopes state \
|
|
631
631
|
(${r.uri}).`);const i=this.reflection.getReferenceType(e);return Object.assign(Object.assign({},e),{message:`Could not resolve reference to ${i} named '${e.reference.$refText}'.`,targetDescription:n})}}function Ep(t){return typeof t.name=="string"}class dD{getName(e){if(Ep(e))return e.name}getNameNode(e){return pn(e.$cstNode,"name")}}class Kj{constructor(e){this.nameProvider=e.references.NameProvider,this.index=e.shared.workspace.IndexManager,this.nodeLocator=e.workspace.AstNodeLocator}findDeclaration(e){
|
|
632
632
|
if(e){const n=g0(e),r=e.astNode;if(n&&r){const i=r[n.feature];if(or(i))return i.ref;if(Array.isArray(i)){for(const s of i)if(or(s)&&s.$refNode&&s.$refNode.offset<=e.offset&&s.$refNode.end>=e.end)return s.ref}}if(r){const i=this.nameProvider.getNameNode(r);if(i&&(i===e||aN(e,i)))return r}}}findDeclarationNode(e){const n=this.findDeclaration(e);if(n?.$cstNode){const r=this.nameProvider.getNameNode(n);return r??n.$cstNode}}findReferences(e,n){const r=[];if(n.includeDeclaration){const s=this.getReferenceToSelf(
|
|
633
|
-
e);s&&r.push(s)}let i=this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e));return n.documentUri&&(i=i.filter(s=>ct.equals(s.sourceUri,n.documentUri))),r.push(...i),Ve(r)}getReferenceToSelf(e){const n=this.nameProvider.getNameNode(e);if(n){const r=ut(e),i=this.nodeLocator.getAstNodePath(e);return{sourceUri:r.uri,sourcePath:i,targetUri:r.uri,targetPath:i,segment:sf(n),local:!0}}}}class Xs{constructor(e){if(this.map=new Map,e)for(const[n,r]of e)this.add(n,r)}get size(){return
|
|
633
|
+
e);s&&r.push(s)}let i=this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e));return n.documentUri&&(i=i.filter(s=>ct.equals(s.sourceUri,n.documentUri))),r.push(...i),Ve(r)}getReferenceToSelf(e){const n=this.nameProvider.getNameNode(e);if(n){const r=ut(e),i=this.nodeLocator.getAstNodePath(e);return{sourceUri:r.uri,sourcePath:i,targetUri:r.uri,targetPath:i,segment:sf(n),local:!0}}}}class Xs{constructor(e){if(this.map=new Map,e)for(const[n,r]of e)this.add(n,r)}get size(){return Om.sum(Ve(
|
|
634
634
|
this.map.values()).map(e=>e.length))}clear(){this.map.clear()}delete(e,n){if(n===void 0)return this.map.delete(e);{const r=this.map.get(e);if(r){const i=r.indexOf(n);if(i>=0)return r.length===1?this.map.delete(e):r.splice(i,1),!0}return!1}}get(e){var n;return(n=this.map.get(e))!==null&&n!==void 0?n:[]}has(e,n){if(n===void 0)return this.map.has(e);{const r=this.map.get(e);return r?r.indexOf(n)>=0:!1}}add(e,n){return this.map.has(e)?this.map.get(e).push(n):this.map.set(e,[n]),this}addAll(e,n){return this.
|
|
635
635
|
map.has(e)?this.map.get(e).push(...n):this.map.set(e,Array.from(n)),this}forEach(e){this.map.forEach((n,r)=>n.forEach(i=>e(i,r,this)))}[Symbol.iterator](){return this.entries().iterator()}entries(){return Ve(this.map.entries()).flatMap(([e,n])=>n.map(r=>[e,r]))}keys(){return Ve(this.map.keys())}values(){return Ve(this.map.values()).flat()}entriesGroupedByKey(){return Ve(this.map.entries())}}class fD{get size(){return this.map.size}constructor(e){if(this.map=new Map,this.inverse=new Map,e)for(const[
|
|
636
|
-
n,r]of e)this.set(n,r)}clear(){this.map.clear(),this.inverse.clear()}set(e,n){return this.map.set(e,n),this.inverse.set(n,e),this}get(e){return this.map.get(e)}getKey(e){return this.inverse.get(e)}delete(e){const n=this.map.get(e);return n!==void 0?(this.map.delete(e),this.inverse.delete(n),!0):!1}}class pD{constructor(e){this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider}async computeExports(e,n=
|
|
637
|
-
e.parseResult.value,e,void 0,n)}async computeExportsForNode(e,n,r=_u,i=
|
|
636
|
+
n,r]of e)this.set(n,r)}clear(){this.map.clear(),this.inverse.clear()}set(e,n){return this.map.set(e,n),this.inverse.set(n,e),this}get(e){return this.map.get(e)}getKey(e){return this.inverse.get(e)}delete(e){const n=this.map.get(e);return n!==void 0?(this.map.delete(e),this.inverse.delete(n),!0):!1}}class pD{constructor(e){this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider}async computeExports(e,n=mt.CancellationToken.None){return this.computeExportsForNode(
|
|
637
|
+
e.parseResult.value,e,void 0,n)}async computeExportsForNode(e,n,r=_u,i=mt.CancellationToken.None){const s=[];this.exportNode(e,s,n);for(const o of r(e))await jt(i),this.exportNode(o,s,n);return s}exportNode(e,n,r){const i=this.nameProvider.getName(e);i&&n.push(this.descriptions.createDescription(e,i,r))}async computeLocalScopes(e,n=mt.CancellationToken.None){const r=e.parseResult.value,i=new Xs;for(const s of wr(r))await jt(n),this.processNode(s,e,i);return i}processNode(e,n,r){const i=e.$container;
|
|
638
638
|
if(i){const s=this.nameProvider.getName(e);s&&r.add(i,this.descriptions.createDescription(e,s,n))}}}class Ys{constructor(e,n,r){var i;this.elements=e,this.outerScope=n,this.caseInsensitive=(i=r?.caseInsensitive)!==null&&i!==void 0?i:!1}getAllElements(){return this.outerScope?this.elements.concat(this.outerScope.getAllElements()):this.elements}getElement(e){const n=this.caseInsensitive?this.elements.find(r=>r.name.toLowerCase()===e.toLowerCase()):this.elements.find(r=>r.name===e);if(n)return n;if(this.
|
|
639
639
|
outerScope)return this.outerScope.getElement(e)}}class hD{constructor(e,n,r){var i;this.elements=new Map,this.caseInsensitive=(i=r?.caseInsensitive)!==null&&i!==void 0?i:!1;for(const s of e){const o=this.caseInsensitive?s.name.toLowerCase():s.name;this.elements.set(o,s)}this.outerScope=n}getElement(e){const n=this.caseInsensitive?e.toLowerCase():e,r=this.elements.get(n);if(r)return r;if(this.outerScope)return this.outerScope.getElement(e)}getAllElements(){let e=Ve(this.elements.values());return this.
|
|
640
640
|
outerScope&&(e=e.concat(this.outerScope.getAllElements())),e}}const Vj={getElement(){},getAllElements(){return Ja}};class mD{constructor(){this.toDispose=[],this.isDisposed=!1}onDispose(e){this.toDispose.push(e)}dispose(){this.throwIfDisposed(),this.clear(),this.isDisposed=!0,this.toDispose.forEach(e=>e.dispose())}throwIfDisposed(){if(this.isDisposed)throw new Error("This cache has already been disposed")}}class Xj extends mD{constructor(){super(...arguments),this.cache=new Map}has(e){return this.
|
|
@@ -647,63 +647,63 @@ AstNodeLocator,this.nameProvider=e.references.NameProvider,this.commentProvider=
|
|
|
647
647
|
has(e))if(or(n)){const d=n.ref,p=r?n.$refText:void 0;if(d){const m=ut(d);let w="";this.currentDocument&&this.currentDocument!==m&&(a?w=a(m.uri,n):w=m.uri.toString());const y=this.astNodeLocator.getAstNodePath(d);return{$ref:`${w}#${y}`,$refText:p}}else return{$error:(c=(u=n.error)===null||u===void 0?void 0:u.message)!==null&&c!==void 0?c:"Could not resolve reference",$refText:p}}else if(kt(n)){let d;if(s&&(d=this.addAstNodeRegionWithAssignmentsTo(Object.assign({},n)),(!e||n.$document)&&d?.$textRegion&&
|
|
648
648
|
(d.$textRegion.documentURI=(l=this.currentDocument)===null||l===void 0?void 0:l.uri.toString())),i&&!e&&(d??(d=Object.assign({},n)),d.$sourceText=(f=n.$cstNode)===null||f===void 0?void 0:f.text),o){d??(d=Object.assign({},n));const p=this.commentProvider.getComment(n);p&&(d.$comment=p.replace(/\r/g,""))}return d??n}else return n}addAstNodeRegionWithAssignmentsTo(e){const n=r=>({offset:r.offset,end:r.end,length:r.length,range:r.range});if(e.$cstNode){const r=e.$textRegion=n(e.$cstNode),i=r.assignments=
|
|
649
649
|
{};return Object.keys(e).filter(s=>!s.startsWith("$")).forEach(s=>{const o=Ho(e.$cstNode,s).map(n);o.length!==0&&(i[s]=o)}),e}}linkNode(e,n,r,i,s,o){for(const[u,c]of Object.entries(e))if(Array.isArray(c))for(let l=0;l<c.length;l++){const f=c[l];vD(f)?c[l]=this.reviveReference(e,u,n,f,r):kt(f)&&this.linkNode(f,n,r,e,u,l)}else vD(c)?e[u]=this.reviveReference(e,u,n,c,r):kt(c)&&this.linkNode(c,n,r,e,u);const a=e;a.$container=i,a.$containerProperty=s,a.$containerIndex=o}reviveReference(e,n,r,i,s){let o=i.
|
|
650
|
-
$refText,a=i.$error;if(i.$ref){const u=this.getRefNode(r,i.$ref,s.uriConverter);if(kt(u))return o||(o=this.nameProvider.getName(u)),{$refText:o??"",ref:u};a=u}if(a){const u={$refText:o??""};return u.error={container:e,property:n,message:a,reference:u},u}else return}getRefNode(e,n,r){try{const i=n.indexOf("#");if(i===0){const u=this.astNodeLocator.getAstNode(e,n.substring(1));return u||"Could not resolve path: "+n}if(i<0){const u=r?r(n):
|
|
651
|
-
c.parseResult.value:"Could not find document for URI: "+n}const s=r?r(n.substring(0,i)):
|
|
650
|
+
$refText,a=i.$error;if(i.$ref){const u=this.getRefNode(r,i.$ref,s.uriConverter);if(kt(u))return o||(o=this.nameProvider.getName(u)),{$refText:o??"",ref:u};a=u}if(a){const u={$refText:o??""};return u.error={container:e,property:n,message:a,reference:u},u}else return}getRefNode(e,n,r){try{const i=n.indexOf("#");if(i===0){const u=this.astNodeLocator.getAstNode(e,n.substring(1));return u||"Could not resolve path: "+n}if(i<0){const u=r?r(n):dt.parse(n),c=this.langiumDocuments.getDocument(u);return c?
|
|
651
|
+
c.parseResult.value:"Could not find document for URI: "+n}const s=r?r(n.substring(0,i)):dt.parse(n.substring(0,i)),o=this.langiumDocuments.getDocument(s);if(!o)return"Could not find document for URI: "+n;if(i===n.length-1)return o.parseResult.value;const a=this.astNodeLocator.getAstNode(o.parseResult.value,n.substring(i+1));return a||"Could not resolve URI: "+n}catch(i){return String(i)}}}class Qj{get map(){return this.fileExtensionMap}constructor(e){this.languageIdMap=new Map,this.fileExtensionMap=
|
|
652
652
|
new Map,this.fileNameMap=new Map,this.textDocuments=e?.workspace.TextDocuments}register(e){const n=e.LanguageMetaData;for(const r of n.fileExtensions)this.fileExtensionMap.has(r)&&console.warn(`The file extension ${r} is used by multiple languages. It is now assigned to '${n.languageId}'.`),this.fileExtensionMap.set(r,e);if(n.fileNames)for(const r of n.fileNames)this.fileNameMap.has(r)&&console.warn(`The file name ${r} is used by multiple languages. It is now assigned to '${n.languageId}'.`),this.
|
|
653
653
|
fileNameMap.set(r,e);this.languageIdMap.set(n.languageId,e),this.languageIdMap.size===1?this.singleton=e:this.singleton=void 0}getServices(e){var n,r,i;if(this.singleton!==void 0)return this.singleton;if(this.languageIdMap.size===0)throw new Error("The service registry is empty. Use `register` to register the services of a language.");const s=(r=(n=this.textDocuments)===null||n===void 0?void 0:n.get(e))===null||r===void 0?void 0:r.languageId;if(s!==void 0){const c=this.languageIdMap.get(s);if(c)
|
|
654
654
|
return c}const o=ct.extname(e),a=ct.basename(e),u=(i=this.fileNameMap.get(a))!==null&&i!==void 0?i:this.fileExtensionMap.get(o);if(!u)throw s?new Error(`The service registry contains no services for the extension '${o}' for language '${s}'.`):new Error(`The service registry contains no services for the extension '${o}'.`);return u}hasServices(e){try{return this.getServices(e),!0}catch{return!1}}get all(){return Array.from(this.languageIdMap.values())}}function ic(t){return{code:t}}var Rp;(function(t){
|
|
655
655
|
t.all=["fast","slow","built-in"]})(Rp||(Rp={}));class Zj{constructor(e){this.entries=new Xs,this.entriesBefore=[],this.entriesAfter=[],this.reflection=e.shared.AstReflection}register(e,n=this,r="fast"){if(r==="built-in")throw new Error("The 'built-in' category is reserved for lexer, parser, and linker errors.");for(const[i,s]of Object.entries(e)){const o=s;if(Array.isArray(o))for(const a of o){const u={check:this.wrapValidationException(a,n),category:r};this.addEntry(i,u)}else if(typeof o=="func\
|
|
656
656
|
tion"){const a={check:this.wrapValidationException(o,n),category:r};this.addEntry(i,a)}else Qa()}}wrapValidationException(e,n){return async(r,i,s)=>{await this.handleException(()=>e.call(n,r,i,s),"An error occurred during validation",i,r)}}async handleException(e,n,r,i){try{await e()}catch(s){if(wp(s))throw s;console.error(`${n}:`,s),s instanceof Error&&s.stack&&console.error(s.stack);const o=s instanceof Error?s.message:String(s);r("error",`${n}: ${o}`,{node:i})}}addEntry(e,n){if(e==="AstNode"){
|
|
657
657
|
this.entries.add("AstNode",n);return}for(const r of this.reflection.getAllSubTypes(e))this.entries.add(r,n)}getChecks(e,n){let r=Ve(this.entries.get(e)).concat(this.entries.get("AstNode"));return n&&(r=r.filter(i=>n.includes(i.category))),r.map(i=>i.check)}registerBeforeDocument(e,n=this){this.entriesBefore.push(this.wrapPreparationException(e,"An error occurred during set-up of the validation",n))}registerAfterDocument(e,n=this){this.entriesAfter.push(this.wrapPreparationException(e,"An error o\
|
|
658
|
-
ccurred during tear-down of the validation",n))}wrapPreparationException(e,n,r){return async(i,s,o,a)=>{await this.handleException(()=>e.call(r,i,s,o,a),n,s,i)}}get checksBefore(){return this.entriesBefore}get checksAfter(){return this.entriesAfter}}class e4{constructor(e){this.validationRegistry=e.validation.ValidationRegistry,this.metadata=e.LanguageMetaData}async validateDocument(e,n={},r=
|
|
658
|
+
ccurred during tear-down of the validation",n))}wrapPreparationException(e,n,r){return async(i,s,o,a)=>{await this.handleException(()=>e.call(r,i,s,o,a),n,s,i)}}get checksBefore(){return this.entriesBefore}get checksAfter(){return this.entriesAfter}}class e4{constructor(e){this.validationRegistry=e.validation.ValidationRegistry,this.metadata=e.LanguageMetaData}async validateDocument(e,n={},r=mt.CancellationToken.None){const i=e.parseResult,s=[];if(await jt(r),(!n.categories||n.categories.includes(
|
|
659
659
|
"built-in"))&&(this.processLexingErrors(i,s,n),n.stopAfterLexingErrors&&s.some(o=>{var a;return((a=o.data)===null||a===void 0?void 0:a.code)===Tr.LexingError})||(this.processParsingErrors(i,s,n),n.stopAfterParsingErrors&&s.some(o=>{var a;return((a=o.data)===null||a===void 0?void 0:a.code)===Tr.ParsingError}))||(this.processLinkingErrors(e,s,n),n.stopAfterLinkingErrors&&s.some(o=>{var a;return((a=o.data)===null||a===void 0?void 0:a.code)===Tr.LinkingError}))))return s;try{s.push(...await this.validateAst(
|
|
660
|
-
i.value,n,r))}catch(o){if(wp(o))throw o;console.error("An error occurred during validation:",o)}return await jt(r),s}processLexingErrors(e,n,r){var i,s,o;const a=[...e.lexerErrors,...(s=(i=e.lexerReport)===null||i===void 0?void 0:i.diagnostics)!==null&&s!==void 0?s:[]];for(const u of a){const c=(o=u.severity)!==null&&o!==void 0?o:"error",l={severity:
|
|
661
|
-
getSource()};n.push(l)}}processParsingErrors(e,n,r){for(const i of e.parserErrors){let s;if(isNaN(i.token.startOffset)){if("previousToken"in i){const o=i.previousToken;if(isNaN(o.startOffset)){const a={line:0,character:0};s={start:a,end:a}}else{const a={line:o.endLine-1,character:o.endColumn};s={start:a,end:a}}}}else s=
|
|
662
|
-
references){const s=i.error;if(s){const o={node:s.container,property:s.property,index:s.index,data:{code:Tr.LinkingError,containerType:s.container.$type,property:s.property,refText:s.reference.$refText}};n.push(this.toDiagnostic("error",s.message,o))}}}async validateAst(e,n,r=
|
|
663
|
-
CancellationToken.None){var s;const o=this.validationRegistry.checksBefore;for(const a of o)await jt(i),await a(e,r,(s=n.categories)!==null&&s!==void 0?s:[],i)}async validateAstNodes(e,n,r,i=
|
|
664
|
-
i),await a(e,r,(s=n.categories)!==null&&s!==void 0?s:[],i)}toDiagnostic(e,n,r){return{message:n,range:t4(r),severity:
|
|
665
|
-
t.node.$cstNode),e?e.range:{start:{line:0,character:0},end:{line:0,character:0}}}function
|
|
660
|
+
i.value,n,r))}catch(o){if(wp(o))throw o;console.error("An error occurred during validation:",o)}return await jt(r),s}processLexingErrors(e,n,r){var i,s,o;const a=[...e.lexerErrors,...(s=(i=e.lexerReport)===null||i===void 0?void 0:i.diagnostics)!==null&&s!==void 0?s:[]];for(const u of a){const c=(o=u.severity)!==null&&o!==void 0?o:"error",l={severity:Ay(c),range:{start:{line:u.line-1,character:u.column-1},end:{line:u.line-1,character:u.column+u.length-1}},message:u.message,data:n4(c),source:this.
|
|
661
|
+
getSource()};n.push(l)}}processParsingErrors(e,n,r){for(const i of e.parserErrors){let s;if(isNaN(i.token.startOffset)){if("previousToken"in i){const o=i.previousToken;if(isNaN(o.startOffset)){const a={line:0,character:0};s={start:a,end:a}}else{const a={line:o.endLine-1,character:o.endColumn};s={start:a,end:a}}}}else s=Lm(i.token);if(s){const o={severity:Ay("error"),range:s,message:i.message,data:ic(Tr.ParsingError),source:this.getSource()};n.push(o)}}}processLinkingErrors(e,n,r){for(const i of e.
|
|
662
|
+
references){const s=i.error;if(s){const o={node:s.container,property:s.property,index:s.index,data:{code:Tr.LinkingError,containerType:s.container.$type,property:s.property,refText:s.reference.$refText}};n.push(this.toDiagnostic("error",s.message,o))}}}async validateAst(e,n,r=mt.CancellationToken.None){const i=[],s=(o,a,u)=>{i.push(this.toDiagnostic(o,a,u))};return await this.validateAstBefore(e,n,s,r),await this.validateAstNodes(e,n,s,r),await this.validateAstAfter(e,n,s,r),i}async validateAstBefore(e,n,r,i=mt.
|
|
663
|
+
CancellationToken.None){var s;const o=this.validationRegistry.checksBefore;for(const a of o)await jt(i),await a(e,r,(s=n.categories)!==null&&s!==void 0?s:[],i)}async validateAstNodes(e,n,r,i=mt.CancellationToken.None){await Promise.all(ci(e).map(async s=>{await jt(i);const o=this.validationRegistry.getChecks(s.$type,n.categories);for(const a of o)await a(s,r,i)}))}async validateAstAfter(e,n,r,i=mt.CancellationToken.None){var s;const o=this.validationRegistry.checksAfter;for(const a of o)await jt(
|
|
664
|
+
i),await a(e,r,(s=n.categories)!==null&&s!==void 0?s:[],i)}toDiagnostic(e,n,r){return{message:n,range:t4(r),severity:Ay(e),code:r.code,codeDescription:r.codeDescription,tags:r.tags,relatedInformation:r.relatedInformation,data:r.data,source:this.getSource()}}getSource(){return this.metadata.languageId}}function t4(t){if(t.range)return t.range;let e;return typeof t.property=="string"?e=pn(t.node.$cstNode,t.property,t.index):typeof t.keyword=="string"&&(e=Pu(t.node.$cstNode,t.keyword,t.index)),e??(e=
|
|
665
|
+
t.node.$cstNode),e?e.range:{start:{line:0,character:0},end:{line:0,character:0}}}function Ay(t){switch(t){case"error":return 1;case"warning":return 2;case"info":return 3;case"hint":return 4;default:throw new Error("Invalid diagnostic severity: "+t)}}function n4(t){switch(t){case"error":return ic(Tr.LexingError);case"warning":return ic(Tr.LexingWarning);case"info":return ic(Tr.LexingInfo);case"hint":return ic(Tr.LexingHint);default:throw new Error("Invalid diagnostic severity: "+t)}}var Tr;(function(t){
|
|
666
666
|
t.LexingError="lexing-error",t.LexingWarning="lexing-warning",t.LexingInfo="lexing-info",t.LexingHint="lexing-hint",t.ParsingError="parsing-error",t.LinkingError="linking-error"})(Tr||(Tr={}));class wD{constructor(e){this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider}createDescription(e,n,r){const i=r??ut(e);n??(n=this.nameProvider.getName(e));const s=this.astNodeLocator.getAstNodePath(e);if(!n)throw new Error(`Node at path ${s} has no name.`);let o;const a=()=>{
|
|
667
|
-
var u;return o??(o=sf((u=this.nameProvider.getNameNode(e))!==null&&u!==void 0?u:e.$cstNode))};return{node:e,name:n,get nameSegment(){return a()},selectionSegment:sf(e.$cstNode),type:e.$type,documentUri:i.uri,path:s}}}class r4{constructor(e){this.nodeLocator=e.workspace.AstNodeLocator}async createDescriptions(e,n=
|
|
667
|
+
var u;return o??(o=sf((u=this.nameProvider.getNameNode(e))!==null&&u!==void 0?u:e.$cstNode))};return{node:e,name:n,get nameSegment(){return a()},selectionSegment:sf(e.$cstNode),type:e.$type,documentUri:i.uri,path:s}}}class r4{constructor(e){this.nodeLocator=e.workspace.AstNodeLocator}async createDescriptions(e,n=mt.CancellationToken.None){const r=[],i=e.parseResult.value;for(const s of ci(i))await jt(n),gf(s).filter(o=>!tf(o)).forEach(o=>{const a=this.createDescription(o);a&&r.push(a)});return r}createDescription(e){
|
|
668
668
|
const n=e.reference.$nodeDescription,r=e.reference.$refNode;if(!n||!r)return;const i=ut(e.container).uri;return{sourceUri:i,sourcePath:this.nodeLocator.getAstNodePath(e.container),targetUri:n.documentUri,targetPath:n.path,segment:sf(r),local:ct.equals(n.documentUri,i)}}}class i4{constructor(){this.segmentSeparator="/",this.indexSeparator="@"}getAstNodePath(e){if(e.$container){const n=this.getAstNodePath(e.$container),r=this.getPathSegment(e);return n+this.segmentSeparator+r}return""}getPathSegment({
|
|
669
|
-
$containerProperty:e,$containerIndex:n}){if(!e)throw new Error("Missing '$containerProperty' in AST node.");return n!==void 0?e+this.indexSeparator+n:e}getAstNode(e,n){return n.split(this.segmentSeparator).reduce((i,s)=>{if(!i||s.length===0)return i;const o=s.indexOf(this.indexSeparator);if(o>0){const a=s.substring(0,o),u=parseInt(s.substring(o+1)),c=i[a];return c?.[u]}return i[s]},e)}}var s4=aa();class o4{constructor(e){this._ready=new
|
|
669
|
+
$containerProperty:e,$containerIndex:n}){if(!e)throw new Error("Missing '$containerProperty' in AST node.");return n!==void 0?e+this.indexSeparator+n:e}getAstNode(e,n){return n.split(this.segmentSeparator).reduce((i,s)=>{if(!i||s.length===0)return i;const o=s.indexOf(this.indexSeparator);if(o>0){const a=s.substring(0,o),u=parseInt(s.substring(o+1)),c=i[a];return c?.[u]}return i[s]},e)}}var s4=aa();class o4{constructor(e){this._ready=new ky,this.settings={},this.workspaceConfig=!1,this.onConfigurationSectionUpdateEmitter=
|
|
670
670
|
new s4.Emitter,this.serviceRegistry=e.ServiceRegistry}get ready(){return this._ready.promise}initialize(e){var n,r;this.workspaceConfig=(r=(n=e.capabilities.workspace)===null||n===void 0?void 0:n.configuration)!==null&&r!==void 0?r:!1}async initialized(e){if(this.workspaceConfig){if(e.register){const n=this.serviceRegistry.all;e.register({section:n.map(r=>this.toSectionName(r.LanguageMetaData.languageId))})}if(e.fetchConfiguration){const n=this.serviceRegistry.all.map(i=>({section:this.toSectionName(
|
|
671
671
|
i.LanguageMetaData.languageId)})),r=await e.fetchConfiguration(n);n.forEach((i,s)=>{this.updateSectionConfiguration(i.section,r[s])})}}this._ready.resolve()}updateConfiguration(e){e.settings&&Object.keys(e.settings).forEach(n=>{const r=e.settings[n];this.updateSectionConfiguration(n,r),this.onConfigurationSectionUpdateEmitter.fire({section:n,configuration:r})})}updateSectionConfiguration(e,n){this.settings[e]=n}async getConfiguration(e,n){await this.ready;const r=this.toSectionName(e);if(this.settings[r])
|
|
672
672
|
return this.settings[r][n]}toSectionName(e){return`${e}`}get onConfigurationSectionUpdate(){return this.onConfigurationSectionUpdateEmitter.event}}var Js;(function(t){function e(n){return{dispose:async()=>await n()}}t.create=e})(Js||(Js={}));class a4{constructor(e){this.updateBuildOptions={validation:{categories:["built-in","fast"]}},this.updateListeners=[],this.buildPhaseListeners=new Xs,this.documentPhaseListeners=new Xs,this.buildState=new Map,this.documentBuildWaiters=new Map,this.currentState=
|
|
673
|
-
qe.Changed,this.langiumDocuments=e.workspace.LangiumDocuments,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.textDocuments=e.workspace.TextDocuments,this.indexManager=e.workspace.IndexManager,this.serviceRegistry=e.ServiceRegistry}async build(e,n={},r=
|
|
673
|
+
qe.Changed,this.langiumDocuments=e.workspace.LangiumDocuments,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.textDocuments=e.workspace.TextDocuments,this.indexManager=e.workspace.IndexManager,this.serviceRegistry=e.ServiceRegistry}async build(e,n={},r=mt.CancellationToken.None){var i,s;for(const o of e){const a=o.uri.toString();if(o.state===qe.Validated){if(typeof n.validation=="boolean"&&n.validation)o.state=qe.IndexedReferences,o.diagnostics=void 0,this.buildState.delete(a);else if(typeof n.
|
|
674
674
|
validation=="object"){const u=this.buildState.get(a),c=(i=u?.result)===null||i===void 0?void 0:i.validationChecks;if(c){const f=((s=n.validation.categories)!==null&&s!==void 0?s:Rp.all).filter(d=>!c.includes(d));f.length>0&&(this.buildState.set(a,{completed:!1,options:{validation:Object.assign(Object.assign({},n.validation),{categories:f})},result:u.result}),o.state=qe.IndexedReferences)}}}else this.buildState.delete(a)}this.currentState=qe.Changed,await this.emitUpdate(e.map(o=>o.uri),[]),await this.
|
|
675
|
-
buildDocuments(e,n,r)}async update(e,n,r=
|
|
675
|
+
buildDocuments(e,n,r)}async update(e,n,r=mt.CancellationToken.None){this.currentState=qe.Changed;for(const o of n)this.langiumDocuments.deleteDocument(o),this.buildState.delete(o.toString()),this.indexManager.remove(o);for(const o of e){if(!this.langiumDocuments.invalidateDocument(o)){const u=this.langiumDocumentFactory.fromModel({$type:"INVALID"},o);u.state=qe.Changed,this.langiumDocuments.addDocument(u)}this.buildState.delete(o.toString())}const i=Ve(e).concat(n).map(o=>o.toString()).toSet();this.
|
|
676
676
|
langiumDocuments.all.filter(o=>!i.has(o.uri.toString())&&this.shouldRelink(o,i)).forEach(o=>{this.serviceRegistry.getServices(o.uri).references.Linker.unlink(o),o.state=Math.min(o.state,qe.ComputedScopes),o.diagnostics=void 0}),await this.emitUpdate(e,n),await jt(r);const s=this.sortDocuments(this.langiumDocuments.all.filter(o=>{var a;return o.state<qe.Linked||!(!((a=this.buildState.get(o.uri.toString()))===null||a===void 0)&&a.completed)}).toArray());await this.buildDocuments(s,this.updateBuildOptions,
|
|
677
677
|
r)}async emitUpdate(e,n){await Promise.all(this.updateListeners.map(r=>r(e,n)))}sortDocuments(e){let n=0,r=e.length-1;for(;n<r;){for(;n<e.length&&this.hasTextDocument(e[n]);)n++;for(;r>=0&&!this.hasTextDocument(e[r]);)r--;n<r&&([e[n],e[r]]=[e[r],e[n]])}return e}hasTextDocument(e){var n;return!!(!((n=this.textDocuments)===null||n===void 0)&&n.get(e.uri))}shouldRelink(e,n){return e.references.some(r=>r.error!==void 0)?!0:this.indexManager.isAffected(e,n)}onUpdate(e){return this.updateListeners.push(
|
|
678
678
|
e),Js.create(()=>{const n=this.updateListeners.indexOf(e);n>=0&&this.updateListeners.splice(n,1)})}async buildDocuments(e,n,r){this.prepareBuild(e,n),await this.runCancelable(e,qe.Parsed,r,o=>this.langiumDocumentFactory.update(o,r)),await this.runCancelable(e,qe.IndexedContent,r,o=>this.indexManager.updateContent(o,r)),await this.runCancelable(e,qe.ComputedScopes,r,async o=>{const a=this.serviceRegistry.getServices(o.uri).references.ScopeComputation;o.precomputedScopes=await a.computeLocalScopes(
|
|
679
679
|
o,r)});const i=e.filter(o=>this.shouldLink(o));await this.runCancelable(i,qe.Linked,r,o=>this.serviceRegistry.getServices(o.uri).references.Linker.link(o,r)),await this.runCancelable(i,qe.IndexedReferences,r,o=>this.indexManager.updateReferences(o,r));const s=e.filter(o=>this.shouldValidate(o));await this.runCancelable(s,qe.Validated,r,o=>this.validate(o,r));for(const o of e){const a=this.buildState.get(o.uri.toString());a&&(a.completed=!0)}}prepareBuild(e,n){for(const r of e){const i=r.uri.toString(),
|
|
680
680
|
s=this.buildState.get(i);(!s||s.completed)&&this.buildState.set(i,{completed:!1,options:n,result:s?.result})}}async runCancelable(e,n,r,i){const s=e.filter(a=>a.state<n);for(const a of s)await jt(r),await i(a),a.state=n,await this.notifyDocumentPhase(a,n,r);const o=e.filter(a=>a.state===n);await this.notifyBuildPhase(o,n,r),this.currentState=n}onBuildPhase(e,n){return this.buildPhaseListeners.add(e,n),Js.create(()=>{this.buildPhaseListeners.delete(e,n)})}onDocumentPhase(e,n){return this.documentPhaseListeners.
|
|
681
|
-
add(e,n),Js.create(()=>{this.documentPhaseListeners.delete(e,n)})}waitUntil(e,n,r){let i;if(n&&"path"in n?i=n:r=n,r??(r=
|
|
681
|
+
add(e,n),Js.create(()=>{this.documentPhaseListeners.delete(e,n)})}waitUntil(e,n,r){let i;if(n&&"path"in n?i=n:r=n,r??(r=mt.CancellationToken.None),i){const s=this.langiumDocuments.getDocument(i);if(s&&s.state>=e)return Promise.resolve(i)}return this.currentState>=e?Promise.resolve(void 0):r.isCancellationRequested?Promise.reject(vp):new Promise((s,o)=>{const a=this.onBuildPhase(e,()=>{if(a.dispose(),u.dispose(),i){const c=this.langiumDocuments.getDocument(i);s(c?.uri)}else s(void 0)}),u=r.onCancellationRequested(
|
|
682
682
|
()=>{a.dispose(),u.dispose(),o(vp)})})}async notifyDocumentPhase(e,n,r){const s=this.documentPhaseListeners.get(n).slice();for(const o of s)try{await o(e,r)}catch(a){if(!wp(a))throw a}}async notifyBuildPhase(e,n,r){if(e.length===0)return;const s=this.buildPhaseListeners.get(n).slice();for(const o of s)await jt(r),await o(e,r)}shouldLink(e){var n;return(n=this.getBuildOptions(e).eagerLinking)!==null&&n!==void 0?n:!0}shouldValidate(e){return!!this.getBuildOptions(e).validation}async validate(e,n){
|
|
683
683
|
var r,i;const s=this.serviceRegistry.getServices(e.uri).validation.DocumentValidator,o=this.getBuildOptions(e).validation,a=typeof o=="object"?o:void 0,u=await s.validateDocument(e,a,n);e.diagnostics?e.diagnostics.push(...u):e.diagnostics=u;const c=this.buildState.get(e.uri.toString());if(c){(r=c.result)!==null&&r!==void 0||(c.result={});const l=(i=a?.categories)!==null&&i!==void 0?i:Rp.all;c.result.validationChecks?c.result.validationChecks.push(...l):c.result.validationChecks=[...l]}}getBuildOptions(e){
|
|
684
684
|
var n,r;return(r=(n=this.buildState.get(e.uri.toString()))===null||n===void 0?void 0:n.options)!==null&&r!==void 0?r:{}}}class bD{constructor(e){this.symbolIndex=new Map,this.symbolByTypeIndex=new Yj,this.referenceIndex=new Map,this.documents=e.workspace.LangiumDocuments,this.serviceRegistry=e.ServiceRegistry,this.astReflection=e.AstReflection}findAllReferences(e,n){const r=ut(e).uri,i=[];return this.referenceIndex.forEach(s=>{s.forEach(o=>{ct.equals(o.targetUri,r)&&o.targetPath===n&&i.push(o)})}),
|
|
685
685
|
Ve(i)}allElements(e,n){let r=Ve(this.symbolIndex.keys());return n&&(r=r.filter(i=>!n||n.has(i))),r.map(i=>this.getFileDescriptions(i,e)).flat()}getFileDescriptions(e,n){var r;return n?this.symbolByTypeIndex.get(e,n,()=>{var s;return((s=this.symbolIndex.get(e))!==null&&s!==void 0?s:[]).filter(a=>this.astReflection.isSubtype(a.type,n))}):(r=this.symbolIndex.get(e))!==null&&r!==void 0?r:[]}remove(e){const n=e.toString();this.symbolIndex.delete(n),this.symbolByTypeIndex.clear(n),this.referenceIndex.
|
|
686
|
-
delete(n)}async updateContent(e,n=
|
|
687
|
-
e.uri.toString());return r?r.some(i=>!i.local&&n.has(i.targetUri.toString())):!1}}class ED{constructor(e){this.initialBuildOptions={},this._ready=new
|
|
688
|
-
e.workspaceFolders)!==null&&n!==void 0?n:void 0}initialized(e){return this.mutex.write(n=>{var r;return this.initializeWorkspace((r=this.folders)!==null&&r!==void 0?r:[],n)})}async initializeWorkspace(e,n=
|
|
689
|
-
o.LanguageMetaData.fileNames)!==null&&a!==void 0?a:[]}),i=[],s=o=>{i.push(o),this.langiumDocuments.hasDocument(o.uri)||this.langiumDocuments.addDocument(o)};return await this.loadAdditionalDocuments(e,s),await Promise.all(e.map(o=>[o,this.getRootFolder(o)]).map(async o=>this.traverseFolder(...o,{fileExtensions:n,fileNames:r},s))),this._ready.resolve(),i}loadAdditionalDocuments(e,n){return Promise.resolve()}getRootFolder(e){return
|
|
690
|
-
readDirectory(n);await Promise.all(s.map(async o=>{if(this.includeEntry(e,o,r)){if(o.isDirectory)await this.traverseFolder(e,o.uri,r,i);else if(o.isFile){const a=await this.langiumDocuments.getOrCreateDocument(o.uri);i(a)}}}))}includeEntry(e,n,r){const i=ct.basename(n.uri);return i.startsWith(".")?!1:n.isDirectory?i!=="node_modules"&&i!=="out":n.isFile?r.fileExtensions.includes(ct.extname(n.uri))||r.fileNames.includes(ct.basename(n.uri)):!1}}class u4{buildUnexpectedCharactersMessage(e,n,r,i,s){return
|
|
691
|
-
buildUnexpectedCharactersMessage(e,n,r,i,s)}buildUnableToPopLexerModeMessage(e){return
|
|
692
|
-
chevrotainLexer=new
|
|
693
|
-
forEach(i=>r[i.name]=i),r}}function d4(t){return Array.isArray(t)&&(t.length===0||"name"in t[0])}function $D(t){return t&&"modes"in t&&"defaultMode"in t}function RD(t){return!d4(t)&&!$D(t)}function DD(t,e,n){let r,i;typeof t=="string"?(i=e,r=n):(i=t.range.start,r=e),i||(i=ot.create(0,0));const s=TD(t),o=
|
|
686
|
+
delete(n)}async updateContent(e,n=mt.CancellationToken.None){const i=await this.serviceRegistry.getServices(e.uri).references.ScopeComputation.computeExports(e,n),s=e.uri.toString();this.symbolIndex.set(s,i),this.symbolByTypeIndex.clear(s)}async updateReferences(e,n=mt.CancellationToken.None){const i=await this.serviceRegistry.getServices(e.uri).workspace.ReferenceDescriptionProvider.createDescriptions(e,n);this.referenceIndex.set(e.uri.toString(),i)}isAffected(e,n){const r=this.referenceIndex.get(
|
|
687
|
+
e.uri.toString());return r?r.some(i=>!i.local&&n.has(i.targetUri.toString())):!1}}class ED{constructor(e){this.initialBuildOptions={},this._ready=new ky,this.serviceRegistry=e.ServiceRegistry,this.langiumDocuments=e.workspace.LangiumDocuments,this.documentBuilder=e.workspace.DocumentBuilder,this.fileSystemProvider=e.workspace.FileSystemProvider,this.mutex=e.workspace.WorkspaceLock}get ready(){return this._ready.promise}get workspaceFolders(){return this.folders}initialize(e){var n;this.folders=(n=
|
|
688
|
+
e.workspaceFolders)!==null&&n!==void 0?n:void 0}initialized(e){return this.mutex.write(n=>{var r;return this.initializeWorkspace((r=this.folders)!==null&&r!==void 0?r:[],n)})}async initializeWorkspace(e,n=mt.CancellationToken.None){const r=await this.performStartup(e);await jt(n),await this.documentBuilder.build(r,this.initialBuildOptions,n)}async performStartup(e){const n=this.serviceRegistry.all.flatMap(o=>o.LanguageMetaData.fileExtensions),r=this.serviceRegistry.all.flatMap(o=>{var a;return(a=
|
|
689
|
+
o.LanguageMetaData.fileNames)!==null&&a!==void 0?a:[]}),i=[],s=o=>{i.push(o),this.langiumDocuments.hasDocument(o.uri)||this.langiumDocuments.addDocument(o)};return await this.loadAdditionalDocuments(e,s),await Promise.all(e.map(o=>[o,this.getRootFolder(o)]).map(async o=>this.traverseFolder(...o,{fileExtensions:n,fileNames:r},s))),this._ready.resolve(),i}loadAdditionalDocuments(e,n){return Promise.resolve()}getRootFolder(e){return dt.parse(e.uri)}async traverseFolder(e,n,r,i){const s=await this.fileSystemProvider.
|
|
690
|
+
readDirectory(n);await Promise.all(s.map(async o=>{if(this.includeEntry(e,o,r)){if(o.isDirectory)await this.traverseFolder(e,o.uri,r,i);else if(o.isFile){const a=await this.langiumDocuments.getOrCreateDocument(o.uri);i(a)}}}))}includeEntry(e,n,r){const i=ct.basename(n.uri);return i.startsWith(".")?!1:n.isDirectory?i!=="node_modules"&&i!=="out":n.isFile?r.fileExtensions.includes(ct.extname(n.uri))||r.fileNames.includes(ct.basename(n.uri)):!1}}class u4{buildUnexpectedCharactersMessage(e,n,r,i,s){return qg.
|
|
691
|
+
buildUnexpectedCharactersMessage(e,n,r,i,s)}buildUnableToPopLexerModeMessage(e){return qg.buildUnableToPopLexerModeMessage(e)}}const c4={mode:"full"};class l4{constructor(e){this.errorMessageProvider=e.parser.LexerErrorMessageProvider,this.tokenBuilder=e.parser.TokenBuilder;const n=this.tokenBuilder.buildTokens(e.Grammar,{caseInsensitive:e.LanguageMetaData.caseInsensitive});this.tokenTypes=this.toTokenTypeDictionary(n);const r=RD(n)?Object.values(n):n,i=e.LanguageMetaData.mode==="production";this.
|
|
692
|
+
chevrotainLexer=new Fn(r,{positionTracking:"full",skipValidations:i,errorMessageProvider:this.errorMessageProvider})}get definition(){return this.tokenTypes}tokenize(e,n=c4){var r,i,s;const o=this.chevrotainLexer.tokenize(e);return{tokens:o.tokens,errors:o.errors,hidden:(r=o.groups.hidden)!==null&&r!==void 0?r:[],report:(s=(i=this.tokenBuilder).flushLexingReport)===null||s===void 0?void 0:s.call(i,e)}}toTokenTypeDictionary(e){if(RD(e))return e;const n=$D(e)?Object.values(e.modes).flat():e,r={};return n.
|
|
693
|
+
forEach(i=>r[i.name]=i),r}}function d4(t){return Array.isArray(t)&&(t.length===0||"name"in t[0])}function $D(t){return t&&"modes"in t&&"defaultMode"in t}function RD(t){return!d4(t)&&!$D(t)}function DD(t,e,n){let r,i;typeof t=="string"?(i=e,r=n):(i=t.range.start,r=e),i||(i=ot.create(0,0));const s=TD(t),o=_y(r),a=p4({lines:s,position:i,options:o});return v4({index:0,tokens:a,position:i})}function kD(t,e){const n=_y(e),r=TD(t);if(r.length===0)return!1;const i=r[0],s=r[r.length-1],o=n.start,a=n.end;
|
|
694
694
|
return!!o?.exec(i)&&!!a?.exec(s)}function TD(t){let e="";return typeof t=="string"?e=t:e=t.text,e.split(d0)}const CD=/\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy,f4=/\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;function p4(t){var e,n,r;const i=[];let s=t.position.line,o=t.position.character;for(let a=0;a<t.lines.length;a++){const u=a===0,c=a===t.lines.length-1;let l=t.lines[a],f=0;if(u&&t.options.start){const p=(e=t.options.start)===null||e===void 0?void 0:e.exec(l);p&&(f=p.index+p[0].length)}else{const p=(n=
|
|
695
|
-
t.options.line)===null||n===void 0?void 0:n.exec(l);p&&(f=p.index+p[0].length)}if(c){const p=(r=t.options.end)===null||r===void 0?void 0:r.exec(l);p&&(l=l.substring(0,p.index))}if(l=l.substring(0,y4(l)),
|
|
695
|
+
t.options.line)===null||n===void 0?void 0:n.exec(l);p&&(f=p.index+p[0].length)}if(c){const p=(r=t.options.end)===null||r===void 0?void 0:r.exec(l);p&&(l=l.substring(0,p.index))}if(l=l.substring(0,y4(l)),Sy(l,f)>=l.length){if(i.length>0){const p=ot.create(s,o);i.push({type:"break",content:"",range:Xe.create(p,p)})}}else{CD.lastIndex=f;const p=CD.exec(l);if(p){const m=p[0],w=p[1],y=ot.create(s,o+f),g=ot.create(s,o+f+m.length);i.push({type:"tag",content:w,range:Xe.create(y,g)}),f+=m.length,f=Sy(l,f)}
|
|
696
696
|
if(f<l.length){const m=l.substring(f),w=Array.from(m.matchAll(f4));i.push(...h4(w,m,s,o+f))}}s++,o=0}return i.length>0&&i[i.length-1].type==="break"?i.slice(0,-1):i}function h4(t,e,n,r){const i=[];if(t.length===0){const s=ot.create(n,r),o=ot.create(n,r+e.length);i.push({type:"text",content:e,range:Xe.create(s,o)})}else{let s=0;for(const a of t){const u=a.index,c=e.substring(s,u);c.length>0&&i.push({type:"text",content:e.substring(s,u),range:Xe.create(ot.create(n,s+r),ot.create(n,u+r))});let l=c.
|
|
697
697
|
length+1;const f=a[1];if(i.push({type:"inline-tag",content:f,range:Xe.create(ot.create(n,s+l+r),ot.create(n,s+l+f.length+r))}),l+=f.length,a.length===4){l+=a[2].length;const d=a[3];i.push({type:"text",content:d,range:Xe.create(ot.create(n,s+l+r),ot.create(n,s+l+d.length+r))})}else i.push({type:"text",content:"",range:Xe.create(ot.create(n,s+l+r),ot.create(n,s+l+r))});s=u+a[0].length}const o=e.substring(s);o.length>0&&i.push({type:"text",content:o,range:Xe.create(ot.create(n,s+r),ot.create(n,s+r+
|
|
698
|
-
o.length))})}return i}const m4=/\S/,g4=/\s*$/;function
|
|
698
|
+
o.length))})}return i}const m4=/\S/,g4=/\s*$/;function Sy(t,e){const n=t.substring(e).match(m4);return n?e+n.index:t.length}function y4(t){const e=t.match(g4);if(e&&typeof e.index=="number")return e.index}function v4(t){var e,n,r,i;const s=ot.create(t.position.line,t.position.character);if(t.tokens.length===0)return new xD([],Xe.create(s,s));const o=[];for(;t.index<t.tokens.length;){const c=w4(t,o[o.length-1]);c&&o.push(c)}const a=(n=(e=o[0])===null||e===void 0?void 0:e.range.start)!==null&&n!==
|
|
699
699
|
void 0?n:s,u=(i=(r=o[o.length-1])===null||r===void 0?void 0:r.range.end)!==null&&i!==void 0?i:s;return new xD(o,Xe.create(a,u))}function w4(t,e){const n=t.tokens[t.index];if(n.type==="tag")return SD(t,!1);if(n.type==="text"||n.type==="inline-tag")return AD(t);b4(n,e),t.index++}function b4(t,e){if(e){const n=new PD("",t.range);"inlines"in e?e.inlines.push(n):e.content.inlines.push(n)}}function AD(t){let e=t.tokens[t.index];const n=e;let r=e;const i=[];for(;e&&e.type!=="break"&&e.type!=="tag";)i.push(
|
|
700
|
-
E4(t)),r=e,e=t.tokens[t.index];return new
|
|
701
|
-
const e=t.tokens[t.index++];return new PD(e.content,e.range)}function
|
|
702
|
-
return this.getAllTags().filter(n=>n.name===e)}getAllTags(){return this.elements.filter(e=>"name"in e)}toString(){let e="";for(const n of this.elements)if(e.length===0)e=n.toString();else{const r=n.toString();e+=ND(e)+r}return e.trim()}toMarkdown(e){let n="";for(const r of this.elements)if(n.length===0)n=r.toMarkdown(e);else{const i=r.toMarkdown(e);n+=ND(n)+i}return n.trim()}}class
|
|
700
|
+
E4(t)),r=e,e=t.tokens[t.index];return new Ny(i,Xe.create(n.range.start,r.range.end))}function E4(t){return t.tokens[t.index].type==="inline-tag"?SD(t,!0):_D(t)}function SD(t,e){const n=t.tokens[t.index++],r=n.content.substring(1),i=t.tokens[t.index];if(i?.type==="text")if(e){const s=_D(t);return new Py(r,new Ny([s],s.range),e,Xe.create(n.range.start,s.range.end))}else{const s=AD(t);return new Py(r,s,e,Xe.create(n.range.start,s.range.end))}else{const s=n.range;return new Py(r,new Ny([],s),e,s)}}function _D(t){
|
|
701
|
+
const e=t.tokens[t.index++];return new PD(e.content,e.range)}function _y(t){if(!t)return _y({start:"/**",end:"*/",line:"*"});const{start:e,end:n,line:r}=t;return{start:xy(e,!0),end:xy(n,!1),line:xy(r,!0)}}function xy(t,e){if(typeof t=="string"||typeof t=="object"){const n=typeof t=="string"?Ef(t):t.source;return e?new RegExp(`^\\s*${n}`):new RegExp(`\\s*${n}\\s*$`)}else return t}class xD{constructor(e,n){this.elements=e,this.range=n}getTag(e){return this.getAllTags().find(n=>n.name===e)}getTags(e){
|
|
702
|
+
return this.getAllTags().filter(n=>n.name===e)}getAllTags(){return this.elements.filter(e=>"name"in e)}toString(){let e="";for(const n of this.elements)if(e.length===0)e=n.toString();else{const r=n.toString();e+=ND(e)+r}return e.trim()}toMarkdown(e){let n="";for(const r of this.elements)if(n.length===0)n=r.toMarkdown(e);else{const i=r.toMarkdown(e);n+=ND(n)+i}return n.trim()}}class Py{constructor(e,n,r,i){this.name=e,this.content=n,this.inline=r,this.range=i}toString(){let e=`@${this.name}`;const n=this.
|
|
703
703
|
content.toString();return this.content.inlines.length===1?e=`${e} ${n}`:this.content.inlines.length>1&&(e=`${e}
|
|
704
704
|
${n}`),this.inline?`{${e}}`:e}toMarkdown(e){var n,r;return(r=(n=e?.renderTag)===null||n===void 0?void 0:n.call(e,this))!==null&&r!==void 0?r:this.toMarkdownDefault(e)}toMarkdownDefault(e){const n=this.content.toMarkdown(e);if(this.inline){const s=$4(this.name,n,e??{});if(typeof s=="string")return s}let r="";e?.tag==="italic"||e?.tag===void 0?r="*":e?.tag==="bold"?r="**":e?.tag==="bold-italic"&&(r="***");let i=`${r}@${this.name}${r}`;return this.content.inlines.length===1?i=`${i} \u2014 ${n}`:this.
|
|
705
705
|
content.inlines.length>1&&(i=`${i}
|
|
706
|
-
${n}`),this.inline?`{${i}}`:i}}function $4(t,e,n){var r,i;if(t==="linkplain"||t==="linkcode"||t==="link"){const s=e.indexOf(" ");let o=e;if(s>0){const u=
|
|
706
|
+
${n}`),this.inline?`{${i}}`:i}}function $4(t,e,n){var r,i;if(t==="linkplain"||t==="linkcode"||t==="link"){const s=e.indexOf(" ");let o=e;if(s>0){const u=Sy(e,s);o=e.substring(u),e=e.substring(0,s)}return(t==="linkcode"||t==="link"&&n.link==="code")&&(o=`\`${o}\``),(i=(r=n.renderLink)===null||r===void 0?void 0:r.call(n,e,o))!==null&&i!==void 0?i:R4(e,o)}}function R4(t,e){try{return dt.parse(t,!0),`[${e}](${t})`}catch{return t}}class Ny{constructor(e,n){this.inlines=e,this.range=n}toString(){let e="";
|
|
707
707
|
for(let n=0;n<this.inlines.length;n++){const r=this.inlines[n],i=this.inlines[n+1];e+=r.toString(),i&&i.range.start.line>r.range.start.line&&(e+=`
|
|
708
708
|
`)}return e}toMarkdown(e){let n="";for(let r=0;r<this.inlines.length;r++){const i=this.inlines[r],s=this.inlines[r+1];n+=i.toMarkdown(e),s&&s.range.start.line>i.range.start.line&&(n+=`
|
|
709
709
|
`)}return n}}class PD{constructor(e,n){this.text=e,this.range=n}toString(){return this.text}toMarkdown(){return this.text}}function ND(t){return t.endsWith(`
|
|
@@ -712,40 +712,40 @@ for(let n=0;n<this.inlines.length;n++){const r=this.inlines[n],i=this.inlines[n+
|
|
|
712
712
|
|
|
713
713
|
`}class D4{constructor(e){this.indexManager=e.shared.workspace.IndexManager,this.commentProvider=e.documentation.CommentProvider}getDocumentation(e){const n=this.commentProvider.getComment(e);if(n&&kD(n))return DD(n).toMarkdown({renderLink:(i,s)=>this.documentationLinkRenderer(e,i,s),renderTag:i=>this.documentationTagRenderer(e,i)})}documentationLinkRenderer(e,n,r){var i;const s=(i=this.findNameInPrecomputedScopes(e,n))!==null&&i!==void 0?i:this.findNameInGlobalScope(e,n);if(s&&s.nameSegment){const o=s.
|
|
714
714
|
nameSegment.range.start.line+1,a=s.nameSegment.range.start.character+1,u=s.documentUri.with({fragment:`L${o},${a}`});return`[${r}](${u.toString()})`}else return}documentationTagRenderer(e,n){}findNameInPrecomputedScopes(e,n){const i=ut(e).precomputedScopes;if(!i)return;let s=e;do{const a=i.get(s).find(u=>u.name===n);if(a)return a;s=s.$container}while(s)}findNameInGlobalScope(e,n){return this.indexManager.allElements().find(i=>i.name===n)}}class k4{constructor(e){this.grammarConfig=()=>e.parser.GrammarConfig}getComment(e){
|
|
715
|
-
var n;return yD(e)?e.$comment:(n=of(e.$cstNode,this.grammarConfig().multilineCommentRules))===null||n===void 0?void 0:n.text}}class T4{constructor(e){this.syncParser=e.parser.LangiumParser}parse(e,n){return Promise.resolve(this.syncParser.parse(e))}}class C4{constructor(){this.previousTokenSource=new
|
|
716
|
-
return this.enqueue(this.readQueue,e)}enqueue(e,n,r=
|
|
715
|
+
var n;return yD(e)?e.$comment:(n=of(e.$cstNode,this.grammarConfig().multilineCommentRules))===null||n===void 0?void 0:n.text}}class T4{constructor(e){this.syncParser=e.parser.LangiumParser}parse(e,n){return Promise.resolve(this.syncParser.parse(e))}}class C4{constructor(){this.previousTokenSource=new mt.CancellationTokenSource,this.writeQueue=[],this.readQueue=[],this.done=!0}write(e){this.cancelWrite();const n=Uj();return this.previousTokenSource=n,this.enqueue(this.writeQueue,e,n.token)}read(e){
|
|
716
|
+
return this.enqueue(this.readQueue,e)}enqueue(e,n,r=mt.CancellationToken.None){const i=new ky,s={action:n,deferred:i,cancellationToken:r};return e.push(s),this.performNextOperation(),i.promise}async performNextOperation(){if(!this.done)return;const e=[];if(this.writeQueue.length>0)e.push(this.writeQueue.shift());else if(this.readQueue.length>0)e.push(...this.readQueue.splice(0,this.readQueue.length));else return;this.done=!1,await Promise.all(e.map(async({action:n,deferred:r,cancellationToken:i})=>{
|
|
717
717
|
try{const s=await Promise.resolve().then(()=>n(i));r.resolve(s)}catch(s){wp(s)?r.resolve(void 0):r.reject(s)}})),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}}class A4{constructor(e){this.grammarElementIdMap=new fD,this.tokenTypeIdMap=new fD,this.grammar=e.Grammar,this.lexer=e.parser.Lexer,this.linker=e.references.Linker}dehydrate(e){return{lexerErrors:e.lexerErrors,lexerReport:e.lexerReport?this.dehydrateLexerReport(e.lexerReport):void 0,parserErrors:e.
|
|
718
718
|
parserErrors.map(n=>Object.assign(Object.assign({},n),{message:n.message})),value:this.dehydrateAstNode(e.value,this.createDehyrationContext(e.value))}}dehydrateLexerReport(e){return e}createDehyrationContext(e){const n=new Map,r=new Map;for(const i of ci(e))n.set(i,{});if(e.$cstNode)for(const i of rf(e.$cstNode))r.set(i,{});return{astNodes:n,cstNodes:r}}dehydrateAstNode(e,n){const r=n.astNodes.get(e);r.$type=e.$type,r.$containerIndex=e.$containerIndex,r.$containerProperty=e.$containerProperty,e.
|
|
719
719
|
$cstNode!==void 0&&(r.$cstNode=this.dehydrateCstNode(e.$cstNode,n));for(const[i,s]of Object.entries(e))if(!i.startsWith("$"))if(Array.isArray(s)){const o=[];r[i]=o;for(const a of s)kt(a)?o.push(this.dehydrateAstNode(a,n)):or(a)?o.push(this.dehydrateReference(a,n)):o.push(a)}else kt(s)?r[i]=this.dehydrateAstNode(s,n):or(s)?r[i]=this.dehydrateReference(s,n):s!==void 0&&(r[i]=s);return r}dehydrateReference(e,n){const r={};return r.$refText=e.$refText,e.$refNode&&(r.$refNode=n.cstNodes.get(e.$refNode)),
|
|
720
720
|
r}dehydrateCstNode(e,n){const r=n.cstNodes.get(e);return Vb(e)?r.fullText=e.fullText:r.grammarSource=this.getGrammarElementId(e.grammarSource),r.hidden=e.hidden,r.astNode=n.astNodes.get(e.astNode),Vi(e)?r.content=e.content.map(i=>this.dehydrateCstNode(i,n)):Ps(e)&&(r.tokenType=e.tokenType.name,r.offset=e.offset,r.length=e.length,r.startLine=e.range.start.line,r.startColumn=e.range.start.character,r.endLine=e.range.end.line,r.endColumn=e.range.end.character),r}hydrate(e){const n=e.value,r=this.createHydrationContext(
|
|
721
|
-
n);return"$cstNode"in n&&this.hydrateCstNode(n.$cstNode,r),{lexerErrors:e.lexerErrors,lexerReport:e.lexerReport,parserErrors:e.parserErrors,value:this.hydrateAstNode(n,r)}}createHydrationContext(e){const n=new Map,r=new Map;for(const s of ci(e))n.set(s,{});let i;if(e.$cstNode)for(const s of rf(e.$cstNode)){let o;"fullText"in s?(o=new HR(s.fullText),i=o):"content"in s?o=new
|
|
721
|
+
n);return"$cstNode"in n&&this.hydrateCstNode(n.$cstNode,r),{lexerErrors:e.lexerErrors,lexerReport:e.lexerReport,parserErrors:e.parserErrors,value:this.hydrateAstNode(n,r)}}createHydrationContext(e){const n=new Map,r=new Map;for(const s of ci(e))n.set(s,{});let i;if(e.$cstNode)for(const s of rf(e.$cstNode)){let o;"fullText"in s?(o=new HR(s.fullText),i=o):"content"in s?o=new Ey:"tokenType"in s&&(o=this.hydrateCstLeafNode(s)),o&&(r.set(s,o),o.root=i)}return{astNodes:n,cstNodes:r}}hydrateAstNode(e,n){
|
|
722
722
|
const r=n.astNodes.get(e);r.$type=e.$type,r.$containerIndex=e.$containerIndex,r.$containerProperty=e.$containerProperty,e.$cstNode&&(r.$cstNode=n.cstNodes.get(e.$cstNode));for(const[i,s]of Object.entries(e))if(!i.startsWith("$"))if(Array.isArray(s)){const o=[];r[i]=o;for(const a of s)kt(a)?o.push(this.setParent(this.hydrateAstNode(a,n),r)):or(a)?o.push(this.hydrateReference(a,r,i,n)):o.push(a)}else kt(s)?r[i]=this.setParent(this.hydrateAstNode(s,n),r):or(s)?r[i]=this.hydrateReference(s,r,i,n):s!==
|
|
723
723
|
void 0&&(r[i]=s);return r}setParent(e,n){return e.$container=n,e}hydrateReference(e,n,r,i){return this.linker.buildReference(n,r,i.cstNodes.get(e.$refNode),e.$refText)}hydrateCstNode(e,n,r=0){const i=n.cstNodes.get(e);if(typeof e.grammarSource=="number"&&(i.grammarSource=this.getGrammarElement(e.grammarSource)),i.astNode=n.astNodes.get(e.astNode),Vi(i))for(const s of e.content){const o=this.hydrateCstNode(s,n,r++);i.content.push(o)}return i}hydrateCstLeafNode(e){const n=this.getTokenType(e.tokenType),
|
|
724
|
-
r=e.offset,i=e.length,s=e.startLine,o=e.startColumn,a=e.endLine,u=e.endColumn,c=e.hidden;return new
|
|
725
|
-
let e=0;for(const n of ci(this.grammar))
|
|
724
|
+
r=e.offset,i=e.length,s=e.startLine,o=e.startColumn,a=e.endLine,u=e.endColumn,c=e.hidden;return new by(r,i,{start:{line:s,character:o},end:{line:a,character:u}},n,c)}getTokenType(e){return this.lexer.definition[e]}getGrammarElementId(e){if(e)return this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap(),this.grammarElementIdMap.get(e)}getGrammarElement(e){return this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap(),this.grammarElementIdMap.getKey(e)}createGrammarElementIdMap(){
|
|
725
|
+
let e=0;for(const n of ci(this.grammar))qm(n)&&this.grammarElementIdMap.set(n,e++)}}function ID(t){return{documentation:{CommentProvider:e=>new k4(e),DocumentationProvider:e=>new D4(e)},parser:{AsyncParser:e=>new T4(e),GrammarConfig:e=>XN(e),LangiumParser:e=>Fj(e),CompletionParser:e=>Lj(e),ValueConverter:()=>new tD,TokenBuilder:()=>new Bj,Lexer:e=>new l4(e),ParserErrorMessageProvider:()=>new YR,LexerErrorMessageProvider:()=>new u4},workspace:{AstNodeLocator:()=>new i4,AstNodeDescriptionProvider:e=>new wD(
|
|
726
726
|
e),ReferenceDescriptionProvider:e=>new r4(e)},references:{Linker:e=>new Hj(e),NameProvider:()=>new dD,ScopeProvider:e=>new gD(e),ScopeComputation:e=>new pD(e),References:e=>new Kj(e)},serializer:{Hydrator:e=>new A4(e),JsonSerializer:e=>new Jj(e)},validation:{DocumentValidator:e=>new e4(e),ValidationRegistry:e=>new Zj(e)},shared:()=>t.shared}}function OD(t){return{ServiceRegistry:e=>new Qj(e),workspace:{LangiumDocuments:e=>new lD(e),LangiumDocumentFactory:e=>new zj(e),DocumentBuilder:e=>new a4(e),
|
|
727
|
-
IndexManager:e=>new bD(e),WorkspaceManager:e=>new ED(e),FileSystemProvider:e=>t.fileSystemProvider(e),WorkspaceLock:()=>new C4,ConfigurationProvider:e=>new o4(e)}}}var Dp;(function(t){t.merge=(e,n)=>Tp(Tp({},e),n)})(Dp||(Dp={}));function kp(t,e,n,r,i,s,o,a,u){const c=[t,e,n,r,i,s,o,a,u].reduce(Tp,{});return FD(c)}const LD=Symbol("isProxy");function
|
|
727
|
+
IndexManager:e=>new bD(e),WorkspaceManager:e=>new ED(e),FileSystemProvider:e=>t.fileSystemProvider(e),WorkspaceLock:()=>new C4,ConfigurationProvider:e=>new o4(e)}}}var Dp;(function(t){t.merge=(e,n)=>Tp(Tp({},e),n)})(Dp||(Dp={}));function kp(t,e,n,r,i,s,o,a,u){const c=[t,e,n,r,i,s,o,a,u].reduce(Tp,{});return FD(c)}const LD=Symbol("isProxy");function Iy(t){if(t&&t[LD])for(const e of Object.values(t))Iy(e);return t}function FD(t,e){const n=new Proxy({},{deleteProperty:()=>!1,set:()=>{throw new Error(
|
|
728
728
|
"Cannot set property on injected service container")},get:(r,i)=>i===LD?!0:BD(r,i,t,e||n),getOwnPropertyDescriptor:(r,i)=>(BD(r,i,t,e||n),Object.getOwnPropertyDescriptor(r,i)),has:(r,i)=>i in t,ownKeys:()=>[...Object.getOwnPropertyNames(t)]});return n}const MD=Symbol();function BD(t,e,n,r){if(e in t){if(t[e]instanceof Error)throw new Error("Construction failure. Please make sure that your dependencies are constructable.",{cause:t[e]});if(t[e]===MD)throw new Error('Cycle detected. Please make "'+
|
|
729
729
|
String(e)+'" lazy. Visit https://langium.org/docs/reference/configuration-services/#resolving-cyclic-dependencies');return t[e]}else if(e in n){const i=n[e];t[e]=MD;try{t[e]=typeof i=="function"?i(r):FD(i,r)}catch(s){throw t[e]=s instanceof Error?s:void 0,s}return t[e]}else return}function Tp(t,e){if(e){for(const[n,r]of Object.entries(e))if(r!==void 0){const i=t[n];i!==null&&r!==null&&typeof i=="object"&&typeof r=="object"?t[n]=Tp(i,r):t[n]=r}}return t}class S4{readFile(){throw new Error("No fil\
|
|
730
|
-
e system is available.")}async readDirectory(){return[]}}const qD={fileSystemProvider:()=>new S4},_4={Grammar:()=>{},LanguageMetaData:()=>({caseInsensitive:!1,fileExtensions:[".langium"],languageId:"langium"})},x4={AstReflection:()=>new o0};function P4(){const t=kp(OD(qD),x4),e=kp(ID({shared:t}),_4);return t.ServiceRegistry.register(e),e}function N4(t){var e;const n=P4(),r=n.serializer.JsonSerializer.deserialize(t);return n.shared.workspace.LangiumDocumentFactory.fromModel(r,
|
|
730
|
+
e system is available.")}async readDirectory(){return[]}}const qD={fileSystemProvider:()=>new S4},_4={Grammar:()=>{},LanguageMetaData:()=>({caseInsensitive:!1,fileExtensions:[".langium"],languageId:"langium"})},x4={AstReflection:()=>new o0};function P4(){const t=kp(OD(qD),x4),e=kp(ID({shared:t}),_4);return t.ServiceRegistry.register(e),e}function N4(t){var e;const n=P4(),r=n.serializer.JsonSerializer.deserialize(t);return n.shared.workspace.LangiumDocumentFactory.fromModel(r,dt.parse(`memory://${(e=
|
|
731
731
|
r.name)!==null&&e!==void 0?e:"grammar"}.langium`)),r}var I4={done:!0,hasNext:!1},sc={done:!1,hasNext:!1},O4=()=>I4,L4=t=>({hasNext:!0,next:t,done:!1});function Le(t,...e){let n=t,r=e.map(s=>"lazy"in s?F4(s):void 0),i=0;for(;i<e.length;){if(r[i]===void 0||!M4(n)){let u=e[i];n=u(n),i+=1;continue}let s=[];for(let u=i;u<e.length;u++){let c=r[u];if(c===void 0||(s.push(c),c.isSingle))break}let o=[];for(let u of n)if(jD(u,o,s))break;let{isSingle:a}=s.at(-1);n=a?o[0]:o,i+=s.length}return n}function jD(t,e,n){
|
|
732
732
|
if(n.length===0)return e.push(t),!1;let r=t,i=sc,s=!1;for(let[o,a]of n.entries()){let{index:u,items:c}=a;if(c.push(r),i=a(r,u,c),a.index+=1,i.hasNext){if(i.hasMany??!1){for(let l of i.next)if(jD(l,e,n.slice(o+1)))return!0;return s}r=i.next}if(!i.hasNext)break;i.done&&(s=!0)}return i.hasNext&&e.push(r),s}function F4(t){let{lazy:e,lazyArgs:n}=t,r=e(...n);return Object.assign(r,{isSingle:e.single??!1,index:0,items:[]})}function M4(t){return typeof t=="string"||typeof t=="object"&&t!==null&&Symbol.iterator in
|
|
733
733
|
t}function GD(t,e){let n=e.length-t.length;if(n===1){let[r,...i]=e;return Le(r,{lazy:t,lazyArgs:i})}if(n===0){let r={lazy:t,lazyArgs:e};return Object.assign(i=>Le(i,r),r)}throw new Error("Wrong number of arguments")}function ua(...t){return GD(B4,t)}function B4(){let t=new Set;return e=>t.has(e)?sc:(t.add(e),{done:!1,hasNext:!0,next:e})}function Qs(...t){return at(Object.values,t)}function q4(...t){return at(j4,t)}function j4(t,e){return e(t),t}function G4(...t){return at(U4,t,W4)}var U4=(t,e)=>e<
|
|
734
|
-
0?[]:t.slice(0,e);function W4(t){if(t<=0)return O4;let e=t;return n=>(e-=1,{done:e<=0,hasNext:!0,next:n})}function
|
|
735
|
-
a,u)??0}}function K4(t){if(WD(t))return!0;if(typeof t!="object"||!Array.isArray(t))return!1;let[e,n,...r]=t;return WD(e)&&typeof n=="string"&&n in UD&&r.length===0}var WD=t=>typeof t=="function"&&t.length===1;function oc(...t){return at(V4,t)}function V4(t,e){let n=[...t];return n.sort(e),n}function X4(...t){return H4(Y4,t)}var Y4=(t,e)=>[...t].sort(e);function
|
|
734
|
+
0?[]:t.slice(0,e);function W4(t){if(t<=0)return O4;let e=t;return n=>(e-=1,{done:e<=0,hasNext:!0,next:n})}function Bn(...t){return at(z4,t)}var z4=(t,e)=>t.length>=e,UD={asc:(t,e)=>t>e,desc:(t,e)=>t<e};function H4(t,e){let[n,...r]=e;if(!K4(n)){let s=Oy(...r);return t(n,s)}let i=Oy(n,...r);return s=>t(s,i)}function Oy(t,e,...n){let r=typeof t=="function"?t:t[0],i=typeof t=="function"?"asc":t[1],{[i]:s}=UD,o=e===void 0?void 0:Oy(e,...n);return(a,u)=>{let c=r(a),l=r(u);return s(c,l)?1:s(l,c)?-1:o?.(
|
|
735
|
+
a,u)??0}}function K4(t){if(WD(t))return!0;if(typeof t!="object"||!Array.isArray(t))return!1;let[e,n,...r]=t;return WD(e)&&typeof n=="string"&&n in UD&&r.length===0}var WD=t=>typeof t=="function"&&t.length===1;function oc(...t){return at(V4,t)}function V4(t,e){let n=[...t];return n.sort(e),n}function X4(...t){return H4(Y4,t)}var Y4=(t,e)=>[...t].sort(e);function Ly(...t){return at(J4,t)}var J4=(t,e,n)=>t.reduce(e,n);function Q4(...t){return at(Z4,t)}function Z4(t){return[...t].reverse()}function Xr(...t){
|
|
736
736
|
return at(e3,t)}var e3=(t,e)=>t[e];function t3(...t){return at(n3,t)}function n3(t,e,n){let r={};for(let[i,s]of t.entries()){let o=e(s,i,t),a=n(s,i,t);r[o]=a}return r}function r3(...t){return at(i3,t)}function i3(t,e){let n={...t};for(let[r,i]of Object.entries(n))e(i,r,t)&&delete n[r];return n}function fr(...t){return at(s3,t)}function s3(t,e){let n={};for(let[r,i]of t.entries()){let[s,o]=e(i,r,t);n[s]=o}return n}function de(t){return!!t}function Yr(...t){return at(Object.keys,t)}function ac(...t){
|
|
737
737
|
return at(o3,t)}var o3=t=>t.at(-1);function bt(...t){return at(a3,t,u3)}var a3=(t,e)=>t.map(e),u3=t=>(e,n,r)=>({done:!1,hasNext:!0,next:t(e,n,r)});function Et(t){return t==null}function Jr(t){return typeof t=="number"&&!Number.isNaN(t)}function c3(t){return t instanceof Promise}function rs(t){return typeof t=="string"}function an(t){return t!==void 0}function It(t){return t===void 0?!0:typeof t=="string"||Array.isArray(t)?t.length===0:Object.keys(t).length===0}function Qr(t){return t!=null}function l3(t){
|
|
738
|
-
return e=>!t(e)}function zD(t){return Array.isArray(t)}function
|
|
738
|
+
return e=>!t(e)}function zD(t){return Array.isArray(t)}function Fy(t){return typeof t=="boolean"}var HD=Symbol("funnel/voidReducer"),d3=()=>HD;function f3(t,{triggerAt:e="end",minQuietPeriodMs:n,maxBurstDurationMs:r,minGapMs:i,reducer:s=d3}){let o,a,u,c,l=()=>{let p=u;p!==void 0&&(u=void 0,p===HD?t():t(p),a=setTimeout(f,i))},f=()=>{clearTimeout(a),a=void 0,o===void 0&&l()},d=()=>{clearTimeout(o),o=void 0,c=void 0,a===void 0&&l()};return{call:(...p)=>{let m=o===void 0&&a===void 0;if((e!=="start"||
|
|
739
739
|
m)&&(u=s(u,...p)),!(o===void 0&&!m)){{clearTimeout(o);let w=Date.now();c??=w;let y=Math.min(n,r-(w-c));o=setTimeout(d,y)}e!=="end"&&m&&l()}},cancel:()=>{clearTimeout(o),o=void 0,c=void 0,clearTimeout(a),a=void 0,u=void 0},flush:()=>{d(),f()},get isIdle(){return o===void 0&&a===void 0}}}function ca(...t){return at(p3,t)}var p3=(t,e)=>{let n=Object.create(null);for(let r=0;r<t.length;r++){let i=t[r],s=e(i,r,t);if(s!==void 0){let o=n[s];o===void 0?n[s]=[i]:o.push(i)}}return Object.setPrototypeOf(n,
|
|
740
740
|
Object.prototype),n};function h3(){return m3}var m3=t=>t;function uc(...t){return at(g3,t)}function g3(t,e){let n={};for(let[r,i]of t.entries()){let s=e(i,r,t);n[s]=i}return n}function Cr(...t){return at(y3,t,v3)}var y3=(t,e)=>t.flatMap(e),v3=t=>(e,n,r)=>{let i=t(e,n,r);return Array.isArray(i)?{done:!1,hasNext:!0,hasMany:!0,next:i}:{done:!1,hasNext:!0,next:i}};function KD(...t){return at(w3,t,b3)}function w3(t,e){return t.forEach(e),t}var b3=t=>(e,n,r)=>(t(e,n,r),{done:!1,hasNext:!0,next:e});function VD(...t){
|
|
741
741
|
return at(E3,t)}function E3(t,e){for(let[n,r]of Object.entries(t))e(r,n,t);return t}function $3(...t){return at(Object.fromEntries,t)}function cc(...t){return at(Object.entries,t)}function Pe(...t){return at(R3,t,D3)}var R3=(t,e)=>t.filter(e),D3=t=>(e,n,r)=>t(e,n,r)?{done:!1,hasNext:!0,next:e}:sc,XD=t=>Object.assign(t,{single:!0});function YD(...t){return at(k3,t,XD(T3))}var k3=(t,e)=>t.find(e),T3=t=>(e,n,r)=>t(e,n,r)?{done:!0,hasNext:!0,next:e}:sc;function JD(...t){return at(C3,t)}var C3=(t,e)=>{
|
|
742
|
-
for(let n=t.length-1;n>=0;n--){let r=t[n];if(e(r,n,t))return r}};function la(...t){return at(A3,t,XD(S3))}var A3=([t])=>t,S3=()=>_3,_3=t=>({hasNext:!0,next:t,done:!0});function
|
|
742
|
+
for(let n=t.length-1;n>=0;n--){let r=t[n];if(e(r,n,t))return r}};function la(...t){return at(A3,t,XD(S3))}var A3=([t])=>t,S3=()=>_3,_3=t=>({hasNext:!0,next:t,done:!0});function My(...t){return at(x3,t)}var x3=(t,e)=>[...t,...e];function P3(...t){return GD(N3,t)}function N3(t){if(t.length===0)return L4;let e=new Map;for(let n of t)e.set(n,(e.get(n)??0)+1);return n=>{let r=e.get(n);return r===void 0||r===0?{done:!1,hasNext:!0,next:n}:(e.set(n,r-1),sc)}}function I3(...t){return at(O3,t)}var O3=(t,e)=>e.
|
|
743
743
|
some(n=>n(t));function L3(...t){return at(F3,t)}function F3(t,e){if(e<1)throw new RangeError(`chunk: A chunk size of '${e.toString()}' would result in an infinite array`);if(t.length===0)return[];if(e>=t.length)return[[...t]];let n=Math.ceil(t.length/e),r=new Array(n);if(e===1)for(let[i,s]of t.entries())r[i]=[s];else for(let i=0;i<n;i+=1){let s=i*e;r[i]=t.slice(s,s+e)}return r}function QD(...t){return at(M3,t)}var M3=(t,{min:e,max:n})=>e!==void 0&&t<e?e:n!==void 0&&t>n?n:t,B3={reset:[0,0],bold:[
|
|
744
744
|
1,22,"\x1B[22m\x1B[1m"],dim:[2,22,"\x1B[22m\x1B[2m"],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,
|
|
745
|
-
39],cyanBright:[96,39],whiteBright:[97,39],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]},q3=Object.entries(B3);function
|
|
746
|
-
n32"||t&&n.TERM!=="dumb"||"CI"in n)||typeof window<"u"&&!!window.chrome}function G3(t=!1){let e=j3(t),n=(o,a,u,c)=>{let l="",f=0;do l+=o.substring(f,c)+u,f=c+a.length,c=o.indexOf(a,f);while(~c);return l+o.substring(f)},r=(o,a,u=o)=>{let c=l=>{let f=String(l),d=f.indexOf(a,o.length);return~d?o+n(f,a,u,d)+a:o+f+a};return c.open=o,c.close=a,c},i={isColorSupported:e},s=o=>`\x1B[${o}m`;for(let[o,a]of q3)i[o]=e?r(s(a[0]),s(a[1]),a[2]):
|
|
747
|
-
Zs={},Ot={},ZD;function
|
|
748
|
-
i;function s(c){return Array.isArray(c)}Ot.array=s;function o(c){return s(c)&&c.every(l=>e(l))}Ot.stringArray=o;function a(c,l){return Array.isArray(c)&&c.every(l)}Ot.typedArray=a;function u(c){return c&&i(c.then)}return Ot.thenable=u,Ot}var Ze={},eo={},to={},Cp={},
|
|
745
|
+
39],cyanBright:[96,39],whiteBright:[97,39],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]},q3=Object.entries(B3);function By(t){return String(t)}By.open="",By.close="";function j3(t=!1){let e=typeof process<"u"?process:void 0,n=e?.env||{},r=e?.argv||[];return!("NO_COLOR"in n||r.includes("--no-color"))&&("FORCE_COLOR"in n||r.includes("--color")||e?.platform==="wi\
|
|
746
|
+
n32"||t&&n.TERM!=="dumb"||"CI"in n)||typeof window<"u"&&!!window.chrome}function G3(t=!1){let e=j3(t),n=(o,a,u,c)=>{let l="",f=0;do l+=o.substring(f,c)+u,f=c+a.length,c=o.indexOf(a,f);while(~c);return l+o.substring(f)},r=(o,a,u=o)=>{let c=l=>{let f=String(l),d=f.indexOf(a,o.length);return~d?o+n(f,a,u,d)+a:o+f+a};return c.open=o,c.close=a,c},i={isColorSupported:e},s=o=>`\x1B[${o}m`;for(let[o,a]of q3)i[o]=e?r(s(a[0]),s(a[1]),a[2]):By;return i}var U3=process.env.FORCE_TTY!==void 0||G_(1),qn=G3(U3),
|
|
747
|
+
Zs={},Ot={},ZD;function qy(){if(ZD)return Ot;ZD=1,Object.defineProperty(Ot,"__esModule",{value:!0}),Ot.thenable=Ot.typedArray=Ot.stringArray=Ot.array=Ot.func=Ot.error=Ot.number=Ot.string=Ot.boolean=void 0;function t(c){return c===!0||c===!1}Ot.boolean=t;function e(c){return typeof c=="string"||c instanceof String}Ot.string=e;function n(c){return typeof c=="number"||c instanceof Number}Ot.number=n;function r(c){return c instanceof Error}Ot.error=r;function i(c){return typeof c=="function"}Ot.func=
|
|
748
|
+
i;function s(c){return Array.isArray(c)}Ot.array=s;function o(c){return s(c)&&c.every(l=>e(l))}Ot.stringArray=o;function a(c,l){return Array.isArray(c)&&c.every(l)}Ot.typedArray=a;function u(c){return c&&i(c.then)}return Ot.thenable=u,Ot}var Ze={},eo={},to={},Cp={},jy={},Ee={},ek;function tk(){if(ek)return Ee;ek=1,Object.defineProperty(Ee,"__esModule",{value:!0}),Ee.Message=Ee.NotificationType9=Ee.NotificationType8=Ee.NotificationType7=Ee.NotificationType6=Ee.NotificationType5=Ee.NotificationType4=
|
|
749
749
|
Ee.NotificationType3=Ee.NotificationType2=Ee.NotificationType1=Ee.NotificationType0=Ee.NotificationType=Ee.RequestType9=Ee.RequestType8=Ee.RequestType7=Ee.RequestType6=Ee.RequestType5=Ee.RequestType4=Ee.RequestType3=Ee.RequestType2=Ee.RequestType1=Ee.RequestType=Ee.RequestType0=Ee.AbstractMessageSignature=Ee.ParameterStructures=Ee.ResponseError=Ee.ErrorCodes=void 0;const t=nc();var e;(function(T){T.ParseError=-32700,T.InvalidRequest=-32600,T.MethodNotFound=-32601,T.InvalidParams=-32602,T.InternalError=
|
|
750
750
|
-32603,T.jsonrpcReservedErrorRangeStart=-32099,T.serverErrorStart=-32099,T.MessageWriteError=-32099,T.MessageReadError=-32098,T.PendingResponseRejected=-32097,T.ConnectionInactive=-32096,T.ServerNotInitialized=-32002,T.UnknownErrorCode=-32001,T.jsonrpcReservedErrorRangeEnd=-32e3,T.serverErrorEnd=-32e3})(e||(Ee.ErrorCodes=e={}));class n extends Error{constructor(D,F,x){super(F),this.code=t.number(D)?D:e.UnknownErrorCode,this.data=x,Object.setPrototypeOf(this,n.prototype)}toJson(){const D={code:this.
|
|
751
751
|
code,message:this.message};return this.data!==void 0&&(D.data=this.data),D}}Ee.ResponseError=n;class r{constructor(D){this.kind=D}static is(D){return D===r.auto||D===r.byName||D===r.byPosition}toString(){return this.kind}}Ee.ParameterStructures=r,r.auto=new r("auto"),r.byPosition=new r("byPosition"),r.byName=new r("byName");class i{constructor(D,F){this.method=D,this.numberOfParams=F}get parameterStructures(){return r.auto}}Ee.AbstractMessageSignature=i;class s extends i{constructor(D){super(D,0)}}
|
|
@@ -783,7 +783,7 @@ fireError(p),p}))}async doWrite(f,d,p){try{return await this.writable.write(d.jo
|
|
|
783
783
|
`;class r{constructor(s="utf-8"){this._encoding=s,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(s){const o=typeof s=="string"?this.fromString(s,this._encoding):s;this._chunks.push(o),this._totalLength+=o.byteLength}tryReadHeaders(s=!1){if(this._chunks.length===0)return;let o=0,a=0,u=0,c=0;e:for(;a<this._chunks.length;){const p=this._chunks[a];for(u=0;u<p.length;){switch(p[u]){case t:switch(o){case 0:o=1;break;case 2:o=3;break;default:o=0}break;case e:switch(o){case 1:
|
|
784
784
|
o=2;break;case 3:o=4,u++;break e;default:o=0}break;default:o=0}u++}c+=p.byteLength,a++}if(o!==4)return;const l=this._read(c+u),f=new Map,d=this.toString(l,"ascii").split(n);if(d.length<2)return f;for(let p=0;p<d.length-2;p++){const m=d[p],w=m.indexOf(":");if(w===-1)throw new Error(`Message header must separate key and value using ':'
|
|
785
785
|
${m}`);const y=m.substr(0,w),g=m.substr(w+1).trim();f.set(s?y.toLowerCase():y,g)}return f}tryReadBody(s){if(!(this._totalLength<s))return this._read(s)}get numberOfBytes(){return this._totalLength}_read(s){if(s===0)return this.emptyBuffer();if(s>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===s){const c=this._chunks[0];return this._chunks.shift(),this._totalLength-=s,this.asNative(c)}if(this._chunks[0].byteLength>s){const c=this._chunks[0],l=this.asNative(
|
|
786
|
-
c,s);return this._chunks[0]=c.slice(s),this._totalLength-=s,l}const o=this.allocNative(s);let a=0,u=0;for(;s>0;){const c=this._chunks[u];if(c.byteLength>s){const l=c.slice(0,s);o.set(l,a),a+=s,this._chunks[u]=c.slice(s),this._totalLength-=s,s-=s}else o.set(c,a),a+=c.byteLength,this._chunks.shift(),this._totalLength-=c.byteLength,s-=c.byteLength}return o}}return fc.AbstractMessageBuffer=r,fc}var
|
|
786
|
+
c,s);return this._chunks[0]=c.slice(s),this._totalLength-=s,l}const o=this.allocNative(s);let a=0,u=0;for(;s>0;){const c=this._chunks[u];if(c.byteLength>s){const l=c.slice(0,s);o.set(l,a),a+=s,this._chunks[u]=c.slice(s),this._totalLength-=s,s-=s}else o.set(c,a),a+=c.byteLength,this._chunks.shift(),this._totalLength-=c.byteLength,s-=c.byteLength}return o}}return fc.AbstractMessageBuffer=r,fc}var Gy={},dk;function X3(){return dk||(dk=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.
|
|
787
787
|
createMessageConnection=t.ConnectionOptions=t.MessageStrategy=t.CancellationStrategy=t.CancellationSenderStrategy=t.CancellationReceiverStrategy=t.RequestCancellationReceiverStrategy=t.IdCancellationReceiverStrategy=t.ConnectionStrategy=t.ConnectionError=t.ConnectionErrors=t.LogTraceNotification=t.SetTraceNotification=t.TraceFormat=t.TraceValues=t.Trace=t.NullLogger=t.ProgressType=t.ProgressToken=void 0;const e=Ks(),n=nc(),r=tk(),i=rk(),s=aa(),o=gp();var a;(function(D){D.type=new r.NotificationType(
|
|
788
788
|
"$/cancelRequest")})(a||(a={}));var u;(function(D){function F(x){return typeof x=="string"||typeof x=="number"}D.is=F})(u||(t.ProgressToken=u={}));var c;(function(D){D.type=new r.NotificationType("$/progress")})(c||(c={}));class l{constructor(){}}t.ProgressType=l;var f;(function(D){function F(x){return n.func(x)}D.is=F})(f||(f={})),t.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var d;(function(D){D[D.Off=0]="Off",D[D.Messages=1]="Messages",D[D.Compact=2]="Compact",
|
|
789
789
|
D[D.Verbose=3]="Verbose"})(d||(t.Trace=d={}));var p;(function(D){D.Off="off",D.Messages="messages",D.Compact="compact",D.Verbose="verbose"})(p||(t.TraceValues=p={})),function(D){function F(_){if(!n.string(_))return D.Off;switch(_=_.toLowerCase(),_){case"off":return D.Off;case"messages":return D.Messages;case"compact":return D.Compact;case"verbose":return D.Verbose;default:return D.Off}}D.fromString=F;function x(_){switch(_){case D.Off:return"off";case D.Messages:return"messages";case D.Compact:return"\
|
|
@@ -806,27 +806,27 @@ ${JSON.stringify($.error,void 0,4)}`):I.error("Received response message without
|
|
|
806
806
|
ler '${ee.method}' failed unexpectedly.`)}}}}function Gi($){if(Y())return;let W,ee;if($.method===a.type.method){const oe=$.params.id;fe.delete(oe),ii($);return}else{const oe=K.get($.method);oe&&(ee=oe.handler,W=oe.type)}if(ee||L)try{if(ii($),ee)if($.params===void 0)W!==void 0&&W.numberOfParams!==0&&W.parameterStructures!==r.ParameterStructures.byName&&I.error(`Notification ${$.method} defines ${W.numberOfParams} params but received none.`),ee();else if(Array.isArray($.params)){const oe=$.params;
|
|
807
807
|
$.method===c.type.method&&oe.length===2&&u.is(oe[0])?ee({token:oe[0],value:oe[1]}):(W!==void 0&&(W.parameterStructures===r.ParameterStructures.byName&&I.error(`Notification ${$.method} defines parameters by name but received parameters by position`),W.numberOfParams!==$.params.length&&I.error(`Notification ${$.method} defines ${W.numberOfParams} params but received ${oe.length} arguments`)),ee(...oe))}else W!==void 0&&W.parameterStructures===r.ParameterStructures.byPosition&&I.error(`Notificatio\
|
|
808
808
|
n ${$.method} defines parameters by position but received parameters by name`),ee($.params);else L&&L($.method,$.params)}catch(oe){oe.message?I.error(`Notification handler '${$.method}' failed with message: ${oe.message}`):I.error(`Notification handler '${$.method}' failed unexpectedly.`)}else ue.fire($)}function Ui($){if(!$){I.error("Received empty message.");return}I.error(`Received message which is neither a response nor a notification message:
|
|
809
|
-
${JSON.stringify($,null,4)}`);const W=$;if(n.string(W.id)||n.number(W.id)){const ee=W.id,oe=xe.get(ee);oe&&oe.reject(new Error("The received response has neither a result nor an error property."))}}function
|
|
809
|
+
${JSON.stringify($,null,4)}`);const W=$;if(n.string(W.id)||n.number(W.id)){const ee=W.id,oe=xe.get(ee);oe&&oe.reject(new Error("The received response has neither a result nor an error property."))}}function _n($){if($!=null)switch(G){case d.Verbose:return JSON.stringify($,null,4);case d.Compact:return JSON.stringify($);default:return}}function ks($){if(!(G===d.Off||!U))if(he===m.Text){let W;(G===d.Verbose||G===d.Compact)&&$.params&&(W=`Params: ${_n($.params)}
|
|
810
810
|
|
|
811
|
-
`),U.log(`Sending request '${$.method} - (${$.id})'.`,W)}else sr("send-request",$)}function Ts($){if(!(G===d.Off||!U))if(he===m.Text){let W;(G===d.Verbose||G===d.Compact)&&($.params?W=`Params: ${
|
|
811
|
+
`),U.log(`Sending request '${$.method} - (${$.id})'.`,W)}else sr("send-request",$)}function Ts($){if(!(G===d.Off||!U))if(he===m.Text){let W;(G===d.Verbose||G===d.Compact)&&($.params?W=`Params: ${_n($.params)}
|
|
812
812
|
|
|
813
813
|
`:W=`No parameters provided.
|
|
814
814
|
|
|
815
|
-
`),U.log(`Sending notification '${$.method}'.`,W)}else sr("send-notification",$)}function Br($,W,ee){if(!(G===d.Off||!U))if(he===m.Text){let oe;(G===d.Verbose||G===d.Compact)&&($.error&&$.error.data?oe=`Error data: ${
|
|
815
|
+
`),U.log(`Sending notification '${$.method}'.`,W)}else sr("send-notification",$)}function Br($,W,ee){if(!(G===d.Off||!U))if(he===m.Text){let oe;(G===d.Verbose||G===d.Compact)&&($.error&&$.error.data?oe=`Error data: ${_n($.error.data)}
|
|
816
816
|
|
|
817
|
-
`:$.result?oe=`Result: ${
|
|
817
|
+
`:$.result?oe=`Result: ${_n($.result)}
|
|
818
818
|
|
|
819
819
|
`:$.error===void 0&&(oe=`No result returned.
|
|
820
820
|
|
|
821
|
-
`)),U.log(`Sending response '${W} - (${$.id})'. Processing request took ${Date.now()-ee}ms`,oe)}else sr("send-response",$)}function Cs($){if(!(G===d.Off||!U))if(he===m.Text){let W;(G===d.Verbose||G===d.Compact)&&$.params&&(W=`Params: ${
|
|
821
|
+
`)),U.log(`Sending response '${W} - (${$.id})'. Processing request took ${Date.now()-ee}ms`,oe)}else sr("send-response",$)}function Cs($){if(!(G===d.Off||!U))if(he===m.Text){let W;(G===d.Verbose||G===d.Compact)&&$.params&&(W=`Params: ${_n($.params)}
|
|
822
822
|
|
|
823
|
-
`),U.log(`Received request '${$.method} - (${$.id})'.`,W)}else sr("receive-request",$)}function ii($){if(!(G===d.Off||!U||$.method===y.type.method))if(he===m.Text){let W;(G===d.Verbose||G===d.Compact)&&($.params?W=`Params: ${
|
|
823
|
+
`),U.log(`Received request '${$.method} - (${$.id})'.`,W)}else sr("receive-request",$)}function ii($){if(!(G===d.Off||!U||$.method===y.type.method))if(he===m.Text){let W;(G===d.Verbose||G===d.Compact)&&($.params?W=`Params: ${_n($.params)}
|
|
824
824
|
|
|
825
825
|
`:W=`No parameters provided.
|
|
826
826
|
|
|
827
|
-
`),U.log(`Received notification '${$.method}'.`,W)}else sr("receive-notification",$)}function As($,W){if(!(G===d.Off||!U))if(he===m.Text){let ee;if((G===d.Verbose||G===d.Compact)&&($.error&&$.error.data?ee=`Error data: ${
|
|
827
|
+
`),U.log(`Received notification '${$.method}'.`,W)}else sr("receive-notification",$)}function As($,W){if(!(G===d.Off||!U))if(he===m.Text){let ee;if((G===d.Verbose||G===d.Compact)&&($.error&&$.error.data?ee=`Error data: ${_n($.error.data)}
|
|
828
828
|
|
|
829
|
-
`:$.result?ee=`Result: ${
|
|
829
|
+
`:$.result?ee=`Result: ${_n($.result)}
|
|
830
830
|
|
|
831
831
|
`:$.error===void 0&&(ee=`No result returned.
|
|
832
832
|
|
|
@@ -840,7 +840,7 @@ ee=$.method,oe=v($,Be);const lt=$.numberOfParams;ze=o.CancellationToken.is(Be[lt
|
|
|
840
840
|
nction"&&Re.sender.enableCancellation(be),new Promise(async(Be,lt)=>{const nt=qr=>{Be(qr),Re.sender.cleanup(Me),tt?.dispose()},Gt=qr=>{lt(qr),Re.sender.cleanup(Me),tt?.dispose()},vn={method:ee,timerStart:Date.now(),resolve:nt,reject:Gt};try{xe.set(Me,vn),await F.write(be)}catch(qr){throw xe.delete(Me),vn.reject(new r.ResponseError(r.ErrorCodes.MessageWriteError,qr.message?qr.message:"Unknown reason")),I.error("Sending request failed."),qr}})},onRequest:($,W)=>{yr();let ee=null;return f.is($)?(ee=
|
|
841
841
|
void 0,ye=$):n.string($)?(ee=null,W!==void 0&&(ee=$,Ie.set($,{handler:W,type:void 0}))):W!==void 0&&(ee=$.method,Ie.set($.method,{type:$,handler:W})),{dispose:()=>{ee!==null&&(ee!==void 0?Ie.delete(ee):ye=void 0)}}},hasPendingResponse:()=>xe.size>0,trace:async($,W,ee)=>{let oe=!1,ze=m.Text;ee!==void 0&&(n.boolean(ee)?oe=ee:(oe=ee.sendNotification||!1,ze=ee.traceFormat||m.Text)),G=$,he=ze,G===d.Off?U=void 0:U=W,oe&&!X()&&!Y()&&await P.sendNotification(w.type,{value:d.toString($)})},onError:Ke.event,
|
|
842
842
|
onClose:it.event,onUnhandledNotification:ue.event,onDispose:re.event,end:()=>{F.end()},dispose:()=>{if(Y())return;pe=M.Disposed,re.fire(void 0);const $=new r.ResponseError(r.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(const W of xe.values())W.reject($);xe=new Map,O=new Map,fe=new Set,$e=new i.LinkedMap,n.func(F.dispose)&&F.dispose(),n.func(D.dispose)&&D.dispose()},listen:()=>{yr(),Mo(),pe=M.Listening,D.listen($s)},inspect:()=>{(0,e.default)().
|
|
843
|
-
console.log("inspect")}};return P.onNotification(y.type,$=>{if(G===d.Off||!U)return;const W=G===d.Verbose||G===d.Compact;U.log($.message,W?$.verbose:void 0)}),P.onNotification(c.type,$=>{const W=_e.get($.token);W?W($.value):Fe.fire($)}),P}t.createMessageConnection=T}(
|
|
843
|
+
console.log("inspect")}};return P.onNotification(y.type,$=>{if(G===d.Off||!U)return;const W=G===d.Verbose||G===d.Compact;U.log($.message,W?$.verbose:void 0)}),P.onNotification(c.type,$=>{const W=_e.get($.token);W?W($.value):Fe.fire($)}),P}t.createMessageConnection=T}(Gy)),Gy}var fk;function Uy(){return fk||(fk=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ProgressType=t.ProgressToken=t.createMessageConnection=t.NullLogger=t.ConnectionOptions=t.ConnectionStrategy=t.AbstractMessageBuffer=
|
|
844
844
|
t.WriteableStreamMessageWriter=t.AbstractMessageWriter=t.MessageWriter=t.ReadableStreamMessageReader=t.AbstractMessageReader=t.MessageReader=t.SharedArrayReceiverStrategy=t.SharedArraySenderStrategy=t.CancellationToken=t.CancellationTokenSource=t.Emitter=t.Event=t.Disposable=t.LRUCache=t.Touch=t.LinkedMap=t.ParameterStructures=t.NotificationType9=t.NotificationType8=t.NotificationType7=t.NotificationType6=t.NotificationType5=t.NotificationType4=t.NotificationType3=t.NotificationType2=t.NotificationType1=
|
|
845
845
|
t.NotificationType0=t.NotificationType=t.ErrorCodes=t.ResponseError=t.RequestType9=t.RequestType8=t.RequestType7=t.RequestType6=t.RequestType5=t.RequestType4=t.RequestType3=t.RequestType2=t.RequestType1=t.RequestType0=t.RequestType=t.Message=t.RAL=void 0,t.MessageStrategy=t.CancellationStrategy=t.CancellationSenderStrategy=t.CancellationReceiverStrategy=t.ConnectionError=t.ConnectionErrors=t.LogTraceNotification=t.SetTraceNotification=t.TraceFormat=t.TraceValues=t.Trace=void 0;const e=tk();Object.
|
|
846
846
|
defineProperty(t,"Message",{enumerable:!0,get:function(){return e.Message}}),Object.defineProperty(t,"RequestType",{enumerable:!0,get:function(){return e.RequestType}}),Object.defineProperty(t,"RequestType0",{enumerable:!0,get:function(){return e.RequestType0}}),Object.defineProperty(t,"RequestType1",{enumerable:!0,get:function(){return e.RequestType1}}),Object.defineProperty(t,"RequestType2",{enumerable:!0,get:function(){return e.RequestType2}}),Object.defineProperty(t,"RequestType3",{enumerable:!0,
|
|
@@ -855,13 +855,13 @@ const a=H3();Object.defineProperty(t,"MessageReader",{enumerable:!0,get:function
|
|
|
855
855
|
return l.ConnectionOptions}}),Object.defineProperty(t,"NullLogger",{enumerable:!0,get:function(){return l.NullLogger}}),Object.defineProperty(t,"createMessageConnection",{enumerable:!0,get:function(){return l.createMessageConnection}}),Object.defineProperty(t,"ProgressToken",{enumerable:!0,get:function(){return l.ProgressToken}}),Object.defineProperty(t,"ProgressType",{enumerable:!0,get:function(){return l.ProgressType}}),Object.defineProperty(t,"Trace",{enumerable:!0,get:function(){return l.Trace}}),
|
|
856
856
|
Object.defineProperty(t,"TraceValues",{enumerable:!0,get:function(){return l.TraceValues}}),Object.defineProperty(t,"TraceFormat",{enumerable:!0,get:function(){return l.TraceFormat}}),Object.defineProperty(t,"SetTraceNotification",{enumerable:!0,get:function(){return l.SetTraceNotification}}),Object.defineProperty(t,"LogTraceNotification",{enumerable:!0,get:function(){return l.LogTraceNotification}}),Object.defineProperty(t,"ConnectionErrors",{enumerable:!0,get:function(){return l.ConnectionErrors}}),
|
|
857
857
|
Object.defineProperty(t,"ConnectionError",{enumerable:!0,get:function(){return l.ConnectionError}}),Object.defineProperty(t,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return l.CancellationReceiverStrategy}}),Object.defineProperty(t,"CancellationSenderStrategy",{enumerable:!0,get:function(){return l.CancellationSenderStrategy}}),Object.defineProperty(t,"CancellationStrategy",{enumerable:!0,get:function(){return l.CancellationStrategy}}),Object.defineProperty(t,"MessageStrategy",
|
|
858
|
-
{enumerable:!0,get:function(){return l.MessageStrategy}});const f=Ks();t.RAL=f.default}(
|
|
858
|
+
{enumerable:!0,get:function(){return l.MessageStrategy}});const f=Ks();t.RAL=f.default}(jy)),jy}var pk;function Y3(){if(pk)return Cp;pk=1,Object.defineProperty(Cp,"__esModule",{value:!0});const t=W_,e=Uy();class n extends e.AbstractMessageBuffer{constructor(u="utf-8"){super(u)}emptyBuffer(){return n.emptyBuffer}fromString(u,c){return Buffer.from(u,c)}toString(u,c){return u instanceof Buffer?u.toString(c):new t.TextDecoder(c).decode(u)}asNative(u,c){return c===void 0?u instanceof Buffer?u:Buffer.
|
|
859
859
|
from(u):u instanceof Buffer?u.slice(0,c):Buffer.from(u,0,c)}allocNative(u){return Buffer.allocUnsafe(u)}}n.emptyBuffer=Buffer.allocUnsafe(0);class r{constructor(u){this.stream=u}onClose(u){return this.stream.on("close",u),e.Disposable.create(()=>this.stream.off("close",u))}onError(u){return this.stream.on("error",u),e.Disposable.create(()=>this.stream.off("error",u))}onEnd(u){return this.stream.on("end",u),e.Disposable.create(()=>this.stream.off("end",u))}onData(u){return this.stream.on("data",u),
|
|
860
860
|
e.Disposable.create(()=>this.stream.off("data",u))}}class i{constructor(u){this.stream=u}onClose(u){return this.stream.on("close",u),e.Disposable.create(()=>this.stream.off("close",u))}onError(u){return this.stream.on("error",u),e.Disposable.create(()=>this.stream.off("error",u))}onEnd(u){return this.stream.on("end",u),e.Disposable.create(()=>this.stream.off("end",u))}write(u,c){return new Promise((l,f)=>{const d=p=>{p==null?l():f(p)};typeof u=="string"?this.stream.write(u,c,d):this.stream.write(
|
|
861
861
|
u,d)})}end(){this.stream.end()}}const s=Object.freeze({messageBuffer:Object.freeze({create:a=>new n(a)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(a,u)=>{try{return Promise.resolve(Buffer.from(JSON.stringify(a,void 0,0),u.charset))}catch(c){return Promise.reject(c)}}}),decoder:Object.freeze({name:"application/json",decode:(a,u)=>{try{return a instanceof Buffer?Promise.resolve(JSON.parse(a.toString(u.charset))):Promise.resolve(JSON.parse(new t.TextDecoder(
|
|
862
862
|
u.charset).decode(a)))}catch(c){return Promise.reject(c)}}})}),stream:Object.freeze({asReadableStream:a=>new r(a),asWritableStream:a=>new i(a)}),console,timer:Object.freeze({setTimeout(a,u,...c){const l=setTimeout(a,u,...c);return{dispose:()=>clearTimeout(l)}},setImmediate(a,...u){const c=setImmediate(a,...u);return{dispose:()=>clearImmediate(c)}},setInterval(a,u,...c){const l=setInterval(a,u,...c);return{dispose:()=>clearInterval(l)}}})});function o(){return s}return function(a){function u(){e.
|
|
863
863
|
RAL.install(s)}a.install=u}(o||(o={})),Cp.default=o,Cp}var hk;function ro(){return hk||(hk=1,function(t){var e=to&&to.__createBinding||(Object.create?function(M,T,D,F){F===void 0&&(F=D);var x=Object.getOwnPropertyDescriptor(T,D);(!x||("get"in x?!T.__esModule:x.writable||x.configurable))&&(x={enumerable:!0,get:function(){return T[D]}}),Object.defineProperty(M,F,x)}:function(M,T,D,F){F===void 0&&(F=D),M[F]=T[D]}),n=to&&to.__exportStar||function(M,T){for(var D in M)D!=="default"&&!Object.prototype.
|
|
864
|
-
hasOwnProperty.call(T,D)&&e(T,M,D)};Object.defineProperty(t,"__esModule",{value:!0}),t.createMessageConnection=t.createServerSocketTransport=t.createClientSocketTransport=t.createServerPipeTransport=t.createClientPipeTransport=t.generateRandomPipeName=t.StreamMessageWriter=t.StreamMessageReader=t.SocketMessageWriter=t.SocketMessageReader=t.PortMessageWriter=t.PortMessageReader=t.IPCMessageWriter=t.IPCMessageReader=void 0;const r=Y3();r.default.install();const i=zi,s=z_,o=H_,a=K_,u=
|
|
864
|
+
hasOwnProperty.call(T,D)&&e(T,M,D)};Object.defineProperty(t,"__esModule",{value:!0}),t.createMessageConnection=t.createServerSocketTransport=t.createClientSocketTransport=t.createServerPipeTransport=t.createClientPipeTransport=t.generateRandomPipeName=t.StreamMessageWriter=t.StreamMessageReader=t.SocketMessageWriter=t.SocketMessageReader=t.PortMessageWriter=t.PortMessageReader=t.IPCMessageWriter=t.IPCMessageReader=void 0;const r=Y3();r.default.install();const i=zi,s=z_,o=H_,a=K_,u=Uy();n(Uy(),t);
|
|
865
865
|
class c extends u.AbstractMessageReader{constructor(T){super(),this.process=T;let D=this.process;D.on("error",F=>this.fireError(F)),D.on("close",()=>this.fireClose())}listen(T){return this.process.on("message",T),u.Disposable.create(()=>this.process.off("message",T))}}t.IPCMessageReader=c;class l extends u.AbstractMessageWriter{constructor(T){super(),this.process=T,this.errorCount=0;const D=this.process;D.on("error",F=>this.fireError(F)),D.on("close",()=>this.fireClose)}write(T){try{return typeof this.
|
|
866
866
|
process.send=="function"&&this.process.send(T,void 0,void 0,D=>{D?(this.errorCount++,this.handleError(D,T)):this.errorCount=0}),Promise.resolve()}catch(D){return this.handleError(D,T),Promise.reject(D)}}handleError(T,D){this.errorCount++,this.fireError(T,D,this.errorCount)}end(){}}t.IPCMessageWriter=l;class f extends u.AbstractMessageReader{constructor(T){super(),this.onData=new u.Emitter,T.on("close",()=>this.fireClose),T.on("error",D=>this.fireError(D)),T.on("message",D=>{this.onData.fire(D)})}listen(T){
|
|
867
867
|
return this.onData.event(T)}}t.PortMessageReader=f;class d extends u.AbstractMessageWriter{constructor(T){super(),this.port=T,this.errorCount=0,T.on("close",()=>this.fireClose()),T.on("error",D=>this.fireError(D))}write(T){try{return this.port.postMessage(T),Promise.resolve()}catch(D){return this.handleError(D,T),Promise.reject(D)}}handleError(T,D){this.errorCount++,this.fireError(T,D,this.errorCount)}end(){}}t.PortMessageWriter=d;class p extends u.ReadableStreamMessageReader{constructor(T,D="ut\
|
|
@@ -869,8 +869,8 @@ f-8"){super((0,r.default)().stream.asReadableStream(T),D)}}t.SocketMessageReader
|
|
|
869
869
|
default)().stream.asWritableStream(T),D)}}t.StreamMessageWriter=y;const g=process.env.XDG_RUNTIME_DIR,b=new Map([["linux",107],["darwin",103]]);function R(){const M=(0,o.randomBytes)(21).toString("hex");if(process.platform==="win32")return`\\\\.\\pipe\\vscode-jsonrpc-${M}-sock`;let T;g?T=i.join(g,`vscode-ipc-${M}.sock`):T=i.join(s.tmpdir(),`vscode-${M}.sock`);const D=b.get(process.platform);return D!==void 0&&T.length>D&&(0,r.default)().console.warn(`WARNING: IPC handle "${T}" is longer than ${D}\
|
|
870
870
|
characters.`),T}t.generateRandomPipeName=R;function A(M,T="utf-8"){let D;const F=new Promise((x,_)=>{D=x});return new Promise((x,_)=>{let I=(0,a.createServer)(te=>{I.close(),D([new p(te,T),new m(te,T)])});I.on("error",_),I.listen(M,()=>{I.removeListener("error",_),x({onConnected:()=>F})})})}t.createClientPipeTransport=A;function N(M,T="utf-8"){const D=(0,a.createConnection)(M);return[new p(D,T),new m(D,T)]}t.createServerPipeTransport=N;function V(M,T="utf-8"){let D;const F=new Promise((x,_)=>{D=
|
|
871
871
|
x});return new Promise((x,_)=>{const I=(0,a.createServer)(te=>{I.close(),D([new p(te,T),new m(te,T)])});I.on("error",_),I.listen(M,"127.0.0.1",()=>{I.removeListener("error",_),x({onConnected:()=>F})})})}t.createClientSocketTransport=V;function J(M,T="utf-8"){const D=(0,a.createConnection)(M,"127.0.0.1");return[new p(D,T),new m(D,T)]}t.createServerSocketTransport=J;function se(M){const T=M;return T.read!==void 0&&T.addListener!==void 0}function ie(M){const T=M;return T.write!==void 0&&T.addListener!==
|
|
872
|
-
void 0}function we(M,T,D,F){D||(D=u.NullLogger);const x=se(M)?new w(M):M,_=ie(T)?new y(T):T;return u.ConnectionStrategy.is(F)&&(F={connectionStrategy:F}),(0,u.createMessageConnection)(x,_,D,F)}t.createMessageConnection=we}(to)),to}var
|
|
873
|
-
e call to work.')}var Ap={exports:{}},yk;function
|
|
872
|
+
void 0}function we(M,T,D,F){D||(D=u.NullLogger);const x=se(M)?new w(M):M,_=ie(T)?new y(T):T;return u.ConnectionStrategy.is(F)&&(F={connectionStrategy:F}),(0,u.createMessageConnection)(x,_,D,F)}t.createMessageConnection=we}(to)),to}var Wy,mk;function gk(){return mk||(mk=1,Wy=ro()),Wy}var io={};function J3(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this requir\
|
|
873
|
+
e call to work.')}var Ap={exports:{}},yk;function zy(){return yk||(yk=1,function(t,e){(function(n){{var r=n(J3,e);r!==void 0&&(t.exports=r)}})(function(n,r){Object.defineProperty(r,"__esModule",{value:!0}),r.TextDocument=r.EOL=r.WorkspaceFolder=r.InlineCompletionContext=r.SelectedCompletionInfo=r.InlineCompletionTriggerKind=r.InlineCompletionList=r.InlineCompletionItem=r.StringValue=r.InlayHint=r.InlayHintLabelPart=r.InlayHintKind=r.InlineValueContext=r.InlineValueEvaluatableExpression=r.InlineValueVariableLookup=
|
|
874
874
|
r.InlineValueText=r.SemanticTokens=r.SemanticTokenModifiers=r.SemanticTokenTypes=r.SelectionRange=r.DocumentLink=r.FormattingOptions=r.CodeLens=r.CodeAction=r.CodeActionContext=r.CodeActionTriggerKind=r.CodeActionKind=r.DocumentSymbol=r.WorkspaceSymbol=r.SymbolInformation=r.SymbolTag=r.SymbolKind=r.DocumentHighlight=r.DocumentHighlightKind=r.SignatureInformation=r.ParameterInformation=r.Hover=r.MarkedString=r.CompletionList=r.CompletionItem=r.CompletionItemLabelDetails=r.InsertTextMode=r.InsertReplaceEdit=
|
|
875
875
|
r.CompletionItemTag=r.InsertTextFormat=r.CompletionItemKind=r.MarkupContent=r.MarkupKind=r.TextDocumentItem=r.OptionalVersionedTextDocumentIdentifier=r.VersionedTextDocumentIdentifier=r.TextDocumentIdentifier=r.WorkspaceChange=r.WorkspaceEdit=r.DeleteFile=r.RenameFile=r.CreateFile=r.TextDocumentEdit=r.AnnotatedTextEdit=r.ChangeAnnotationIdentifier=r.ChangeAnnotation=r.TextEdit=r.Command=r.Diagnostic=r.CodeDescription=r.DiagnosticTag=r.DiagnosticSeverity=r.DiagnosticRelatedInformation=r.FoldingRange=
|
|
876
876
|
r.FoldingRangeKind=r.ColorPresentation=r.ColorInformation=r.Color=r.LocationLink=r.Location=r.Range=r.Position=r.uinteger=r.integer=r.URI=r.DocumentUri=void 0;var i;(function(E){function S(h){return typeof h=="string"}E.is=S})(i||(r.DocumentUri=i={}));var s;(function(E){function S(h){return typeof h=="string"}E.is=S})(s||(r.URI=s={}));var o;(function(E){E.MIN_VALUE=-2147483648,E.MAX_VALUE=2147483647;function S(h){return typeof h=="number"&&E.MIN_VALUE<=h&&h<=E.MAX_VALUE}E.is=S})(o||(r.integer=o=
|
|
@@ -916,8 +916,8 @@ c.is(v.range)&&(v.parent===void 0||E.is(v.parent))}E.is=h})(Zt||(r.SelectionRang
|
|
|
916
916
|
number="number",E.regexp="regexp",E.operator="operator",E.decorator="decorator"})(Kt||(r.SemanticTokenTypes=Kt={}));var Mr;(function(E){E.declaration="declaration",E.definition="definition",E.readonly="readonly",E.static="static",E.deprecated="deprecated",E.abstract="abstract",E.async="async",E.modification="modification",E.documentation="documentation",E.defaultLibrary="defaultLibrary"})(Mr||(r.SemanticTokenModifiers=Mr={}));var ji;(function(E){function S(h){var k=h;return B.objectLiteral(k)&&(k.
|
|
917
917
|
resultId===void 0||typeof k.resultId=="string")&&Array.isArray(k.data)&&(k.data.length===0||typeof k.data[0]=="number")}E.is=S})(ji||(r.SemanticTokens=ji={}));var Es;(function(E){function S(k,v){return{range:k,text:v}}E.create=S;function h(k){var v=k;return v!=null&&c.is(v.range)&&B.string(v.text)}E.is=h})(Es||(r.InlineValueText=Es={}));var $s;(function(E){function S(k,v,P){return{range:k,variableName:v,caseSensitiveLookup:P}}E.create=S;function h(k){var v=k;return v!=null&&c.is(v.range)&&B.boolean(
|
|
918
918
|
v.caseSensitiveLookup)&&(B.string(v.variableName)||v.variableName===void 0)}E.is=h})($s||(r.InlineValueVariableLookup=$s={}));var Rs;(function(E){function S(k,v){return{range:k,expression:v}}E.create=S;function h(k){var v=k;return v!=null&&c.is(v.range)&&(B.string(v.expression)||v.expression===void 0)}E.is=h})(Rs||(r.InlineValueEvaluatableExpression=Rs={}));var Ds;(function(E){function S(k,v){return{frameId:k,stoppedLocation:v}}E.create=S;function h(k){var v=k;return B.defined(v)&&c.is(k.stoppedLocation)}
|
|
919
|
-
E.is=h})(Ds||(r.InlineValueContext=Ds={}));var Gi;(function(E){E.Type=1,E.Parameter=2;function S(h){return h===1||h===2}E.is=S})(Gi||(r.InlayHintKind=Gi={}));var Ui;(function(E){function S(k){return{value:k}}E.create=S;function h(k){var v=k;return B.objectLiteral(v)&&(v.tooltip===void 0||B.string(v.tooltip)||L.is(v.tooltip))&&(v.location===void 0||l.is(v.location))&&(v.command===void 0||V.is(v.command))}E.is=h})(Ui||(r.InlayHintLabelPart=Ui={}));var
|
|
920
|
-
label:v};return P!==void 0&&($.kind=P),$}E.create=S;function h(k){var v=k;return B.objectLiteral(v)&&u.is(v.position)&&(B.string(v.label)||B.typedArray(v.label,Ui.is))&&(v.kind===void 0||Gi.is(v.kind))&&v.textEdits===void 0||B.typedArray(v.textEdits,J.is)&&(v.tooltip===void 0||B.string(v.tooltip)||L.is(v.tooltip))&&(v.paddingLeft===void 0||B.boolean(v.paddingLeft))&&(v.paddingRight===void 0||B.boolean(v.paddingRight))}E.is=h})(
|
|
919
|
+
E.is=h})(Ds||(r.InlineValueContext=Ds={}));var Gi;(function(E){E.Type=1,E.Parameter=2;function S(h){return h===1||h===2}E.is=S})(Gi||(r.InlayHintKind=Gi={}));var Ui;(function(E){function S(k){return{value:k}}E.create=S;function h(k){var v=k;return B.objectLiteral(v)&&(v.tooltip===void 0||B.string(v.tooltip)||L.is(v.tooltip))&&(v.location===void 0||l.is(v.location))&&(v.command===void 0||V.is(v.command))}E.is=h})(Ui||(r.InlayHintLabelPart=Ui={}));var _n;(function(E){function S(k,v,P){var $={position:k,
|
|
920
|
+
label:v};return P!==void 0&&($.kind=P),$}E.create=S;function h(k){var v=k;return B.objectLiteral(v)&&u.is(v.position)&&(B.string(v.label)||B.typedArray(v.label,Ui.is))&&(v.kind===void 0||Gi.is(v.kind))&&v.textEdits===void 0||B.typedArray(v.textEdits,J.is)&&(v.tooltip===void 0||B.string(v.tooltip)||L.is(v.tooltip))&&(v.paddingLeft===void 0||B.boolean(v.paddingLeft))&&(v.paddingRight===void 0||B.boolean(v.paddingRight))}E.is=h})(_n||(r.InlayHint=_n={}));var ks;(function(E){function S(h){return{kind:"\
|
|
921
921
|
snippet",value:h}}E.createSnippet=S})(ks||(r.StringValue=ks={}));var Ts;(function(E){function S(h,k,v,P){return{insertText:h,filterText:k,range:v,command:P}}E.create=S})(Ts||(r.InlineCompletionItem=Ts={}));var Br;(function(E){function S(h){return{items:h}}E.create=S})(Br||(r.InlineCompletionList=Br={}));var Cs;(function(E){E.Invoked=0,E.Automatic=1})(Cs||(r.InlineCompletionTriggerKind=Cs={}));var ii;(function(E){function S(h,k){return{range:h,text:k}}E.create=S})(ii||(r.SelectedCompletionInfo=ii=
|
|
922
922
|
{}));var As;(function(E){function S(h,k){return{triggerKind:h,selectedCompletionInfo:k}}E.create=S})(As||(r.InlineCompletionContext=As={}));var sr;(function(E){function S(h){var k=h;return B.objectLiteral(k)&&s.is(k.uri)&&B.string(k.name)}E.is=S})(sr||(r.WorkspaceFolder=sr={})),r.EOL=[`
|
|
923
923
|
`,`\r
|
|
@@ -930,7 +930,7 @@ configurable:!0}),E.prototype.getText=function(S){if(S){var h=this.offsetAt(S.st
|
|
|
930
930
|
line+1]:this._content.length;return Math.max(Math.min(k+S.character,v),k)},Object.defineProperty(E.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),E}(),B;(function(E){var S=Object.prototype.toString;function h(be){return typeof be<"u"}E.defined=h;function k(be){return typeof be>"u"}E.undefined=k;function v(be){return be===!0||be===!1}E.boolean=v;function P(be){return S.call(be)==="[object String]"}E.string=P;function $(be){return S.call(
|
|
931
931
|
be)==="[object Number]"}E.number=$;function W(be,Be,lt){return S.call(be)==="[object Number]"&&Be<=be&&be<=lt}E.numberRange=W;function ee(be){return S.call(be)==="[object Number]"&&-2147483648<=be&&be<=2147483647}E.integer=ee;function oe(be){return S.call(be)==="[object Number]"&&0<=be&&be<=2147483647}E.uinteger=oe;function ze(be){return S.call(be)==="[object Function]"}E.func=ze;function Me(be){return be!==null&&typeof be=="object"}E.objectLiteral=Me;function tt(be,Be){return Array.isArray(be)&&
|
|
932
932
|
be.every(Be)}E.typedArray=tt})(B||(B={}))})}(Ap,Ap.exports)),Ap.exports}var Dn={},vk;function At(){if(vk)return Dn;vk=1,Object.defineProperty(Dn,"__esModule",{value:!0}),Dn.ProtocolNotificationType=Dn.ProtocolNotificationType0=Dn.ProtocolRequestType=Dn.ProtocolRequestType0=Dn.RegistrationType=Dn.MessageDirection=void 0;const t=ro();var e;(function(a){a.clientToServer="clientToServer",a.serverToClient="serverToClient",a.both="both"})(e||(Dn.MessageDirection=e={}));class n{constructor(u){this.method=
|
|
933
|
-
u}}Dn.RegistrationType=n;class r extends t.RequestType0{constructor(u){super(u)}}Dn.ProtocolRequestType0=r;class i extends t.RequestType{constructor(u){super(u,t.ParameterStructures.byName)}}Dn.ProtocolRequestType=i;class s extends t.NotificationType0{constructor(u){super(u)}}Dn.ProtocolNotificationType0=s;class o extends t.NotificationType{constructor(u){super(u,t.ParameterStructures.byName)}}return Dn.ProtocolNotificationType=o,Dn}var
|
|
933
|
+
u}}Dn.RegistrationType=n;class r extends t.RequestType0{constructor(u){super(u)}}Dn.ProtocolRequestType0=r;class i extends t.RequestType{constructor(u){super(u,t.ParameterStructures.byName)}}Dn.ProtocolRequestType=i;class s extends t.NotificationType0{constructor(u){super(u)}}Dn.ProtocolNotificationType0=s;class o extends t.NotificationType{constructor(u){super(u,t.ParameterStructures.byName)}}return Dn.ProtocolNotificationType=o,Dn}var Hy={},Lt={},wk;function Ky(){if(wk)return Lt;wk=1,Object.defineProperty(
|
|
934
934
|
Lt,"__esModule",{value:!0}),Lt.objectLiteral=Lt.typedArray=Lt.stringArray=Lt.array=Lt.func=Lt.error=Lt.number=Lt.string=Lt.boolean=void 0;function t(c){return c===!0||c===!1}Lt.boolean=t;function e(c){return typeof c=="string"||c instanceof String}Lt.string=e;function n(c){return typeof c=="number"||c instanceof Number}Lt.number=n;function r(c){return c instanceof Error}Lt.error=r;function i(c){return typeof c=="function"}Lt.func=i;function s(c){return Array.isArray(c)}Lt.array=s;function o(c){return s(
|
|
935
935
|
c)&&c.every(l=>e(l))}Lt.stringArray=o;function a(c,l){return Array.isArray(c)&&c.every(l)}Lt.typedArray=a;function u(c){return c!==null&&typeof c=="object"}return Lt.objectLiteral=u,Lt}var pc={},bk;function Q3(){if(bk)return pc;bk=1,Object.defineProperty(pc,"__esModule",{value:!0}),pc.ImplementationRequest=void 0;const t=At();var e;return function(n){n.method="textDocument/implementation",n.messageDirection=t.MessageDirection.clientToServer,n.type=new t.ProtocolRequestType(n.method)}(e||(pc.ImplementationRequest=
|
|
936
936
|
e={})),pc}var hc={},Ek;function Z3(){if(Ek)return hc;Ek=1,Object.defineProperty(hc,"__esModule",{value:!0}),hc.TypeDefinitionRequest=void 0;const t=At();var e;return function(n){n.method="textDocument/typeDefinition",n.messageDirection=t.MessageDirection.clientToServer,n.type=new t.ProtocolRequestType(n.method)}(e||(hc.TypeDefinitionRequest=e={})),hc}var so={},$k;function eG(){if($k)return so;$k=1,Object.defineProperty(so,"__esModule",{value:!0}),so.DidChangeWorkspaceFoldersNotification=so.WorkspaceFoldersRequest=
|
|
@@ -955,10 +955,10 @@ ki.TypeHierarchyPrepareRequest=void 0;const t=At();var e;(function(i){i.method="
|
|
|
955
955
|
y/subtypes",i.messageDirection=t.MessageDirection.clientToServer,i.type=new t.ProtocolRequestType(i.method)}(r||(ki.TypeHierarchySubtypesRequest=r={})),ki}var uo={},Lk;function hG(){if(Lk)return uo;Lk=1,Object.defineProperty(uo,"__esModule",{value:!0}),uo.InlineValueRefreshRequest=uo.InlineValueRequest=void 0;const t=At();var e;(function(r){r.method="textDocument/inlineValue",r.messageDirection=t.MessageDirection.clientToServer,r.type=new t.ProtocolRequestType(r.method)})(e||(uo.InlineValueRequest=
|
|
956
956
|
e={}));var n;return function(r){r.method="workspace/inlineValue/refresh",r.messageDirection=t.MessageDirection.serverToClient,r.type=new t.ProtocolRequestType0(r.method)}(n||(uo.InlineValueRefreshRequest=n={})),uo}var Ti={},Fk;function mG(){if(Fk)return Ti;Fk=1,Object.defineProperty(Ti,"__esModule",{value:!0}),Ti.InlayHintRefreshRequest=Ti.InlayHintResolveRequest=Ti.InlayHintRequest=void 0;const t=At();var e;(function(i){i.method="textDocument/inlayHint",i.messageDirection=t.MessageDirection.clientToServer,
|
|
957
957
|
i.type=new t.ProtocolRequestType(i.method)})(e||(Ti.InlayHintRequest=e={}));var n;(function(i){i.method="inlayHint/resolve",i.messageDirection=t.MessageDirection.clientToServer,i.type=new t.ProtocolRequestType(i.method)})(n||(Ti.InlayHintResolveRequest=n={}));var r;return function(i){i.method="workspace/inlayHint/refresh",i.messageDirection=t.MessageDirection.serverToClient,i.type=new t.ProtocolRequestType0(i.method)}(r||(Ti.InlayHintRefreshRequest=r={})),Ti}var Jn={},Mk;function gG(){if(Mk)return Jn;
|
|
958
|
-
Mk=1,Object.defineProperty(Jn,"__esModule",{value:!0}),Jn.DiagnosticRefreshRequest=Jn.WorkspaceDiagnosticRequest=Jn.DocumentDiagnosticRequest=Jn.DocumentDiagnosticReportKind=Jn.DiagnosticServerCancellationData=void 0;const t=ro(),e=
|
|
958
|
+
Mk=1,Object.defineProperty(Jn,"__esModule",{value:!0}),Jn.DiagnosticRefreshRequest=Jn.WorkspaceDiagnosticRequest=Jn.DocumentDiagnosticRequest=Jn.DocumentDiagnosticReportKind=Jn.DiagnosticServerCancellationData=void 0;const t=ro(),e=Ky(),n=At();var r;(function(u){function c(l){const f=l;return f&&e.boolean(f.retriggerRequest)}u.is=c})(r||(Jn.DiagnosticServerCancellationData=r={}));var i;(function(u){u.Full="full",u.Unchanged="unchanged"})(i||(Jn.DocumentDiagnosticReportKind=i={}));var s;(function(u){
|
|
959
959
|
u.method="textDocument/diagnostic",u.messageDirection=n.MessageDirection.clientToServer,u.type=new n.ProtocolRequestType(u.method),u.partialResult=new t.ProgressType})(s||(Jn.DocumentDiagnosticRequest=s={}));var o;(function(u){u.method="workspace/diagnostic",u.messageDirection=n.MessageDirection.clientToServer,u.type=new n.ProtocolRequestType(u.method),u.partialResult=new t.ProgressType})(o||(Jn.WorkspaceDiagnosticRequest=o={}));var a;return function(u){u.method="workspace/diagnostic/refresh",u.
|
|
960
960
|
messageDirection=n.MessageDirection.serverToClient,u.type=new n.ProtocolRequestType0(u.method)}(a||(Jn.DiagnosticRefreshRequest=a={})),Jn}var St={},Bk;function yG(){if(Bk)return St;Bk=1,Object.defineProperty(St,"__esModule",{value:!0}),St.DidCloseNotebookDocumentNotification=St.DidSaveNotebookDocumentNotification=St.DidChangeNotebookDocumentNotification=St.NotebookCellArrayChange=St.DidOpenNotebookDocumentNotification=St.NotebookDocumentSyncRegistrationType=St.NotebookDocument=St.NotebookCell=St.
|
|
961
|
-
ExecutionSummary=St.NotebookCellKind=void 0;const t=
|
|
961
|
+
ExecutionSummary=St.NotebookCellKind=void 0;const t=zy(),e=Ky(),n=At();var r;(function(p){p.Markup=1,p.Code=2;function m(w){return w===1||w===2}p.is=m})(r||(St.NotebookCellKind=r={}));var i;(function(p){function m(g,b){const R={executionOrder:g};return(b===!0||b===!1)&&(R.success=b),R}p.create=m;function w(g){const b=g;return e.objectLiteral(b)&&t.uinteger.is(b.executionOrder)&&(b.success===void 0||e.boolean(b.success))}p.is=w;function y(g,b){return g===b?!0:g==null||b===null||b===void 0?!1:g.executionOrder===
|
|
962
962
|
b.executionOrder&&g.success===b.success}p.equals=y})(i||(St.ExecutionSummary=i={}));var s;(function(p){function m(b,R){return{kind:b,document:R}}p.create=m;function w(b){const R=b;return e.objectLiteral(R)&&r.is(R.kind)&&t.DocumentUri.is(R.document)&&(R.metadata===void 0||e.objectLiteral(R.metadata))}p.is=w;function y(b,R){const A=new Set;return b.document!==R.document&&A.add("document"),b.kind!==R.kind&&A.add("kind"),b.executionSummary!==R.executionSummary&&A.add("executionSummary"),(b.metadata!==
|
|
963
963
|
void 0||R.metadata!==void 0)&&!g(b.metadata,R.metadata)&&A.add("metadata"),(b.executionSummary!==void 0||R.executionSummary!==void 0)&&!i.equals(b.executionSummary,R.executionSummary)&&A.add("executionSummary"),A}p.diff=y;function g(b,R){if(b===R)return!0;if(b==null||R===null||R===void 0||typeof b!=typeof R||typeof b!="object")return!1;const A=Array.isArray(b),N=Array.isArray(R);if(A!==N)return!1;if(A&&N){if(b.length!==R.length)return!1;for(let V=0;V<b.length;V++)if(!g(b[V],R[V]))return!1}if(e.objectLiteral(
|
|
964
964
|
b)&&e.objectLiteral(R)){const V=Object.keys(b),J=Object.keys(R);if(V.length!==J.length||(V.sort(),J.sort(),!g(V,J)))return!1;for(let se=0;se<V.length;se++){const ie=V[se];if(!g(b[ie],R[ie]))return!1}}return!0}})(s||(St.NotebookCell=s={}));var o;(function(p){function m(y,g,b,R){return{uri:y,notebookType:g,version:b,cells:R}}p.create=m;function w(y){const g=y;return e.objectLiteral(g)&&e.string(g.uri)&&t.integer.is(g.version)&&e.typedArray(g.cells,s.is)}p.is=w})(o||(St.NotebookDocument=o={}));var a;
|
|
@@ -972,7 +972,7 @@ t.UnregistrationRequest=t.RegistrationRequest=t.DocumentSelector=t.NotebookCellT
|
|
|
972
972
|
t.SemanticTokensRangeRequest=t.SemanticTokensDeltaRequest=t.SemanticTokensRequest=t.TokenFormat=t.CallHierarchyPrepareRequest=t.CallHierarchyOutgoingCallsRequest=t.CallHierarchyIncomingCallsRequest=t.WorkDoneProgressCancelNotification=t.WorkDoneProgressCreateRequest=t.WorkDoneProgress=t.SelectionRangeRequest=t.DeclarationRequest=t.FoldingRangeRefreshRequest=t.FoldingRangeRequest=t.ColorPresentationRequest=t.DocumentColorRequest=t.ConfigurationRequest=t.DidChangeWorkspaceFoldersNotification=t.WorkspaceFoldersRequest=
|
|
973
973
|
t.TypeDefinitionRequest=t.ImplementationRequest=t.ApplyWorkspaceEditRequest=t.ExecuteCommandRequest=t.PrepareRenameRequest=t.RenameRequest=t.PrepareSupportDefaultBehavior=t.DocumentOnTypeFormattingRequest=t.DocumentRangesFormattingRequest=t.DocumentRangeFormattingRequest=t.DocumentFormattingRequest=t.DocumentLinkResolveRequest=t.DocumentLinkRequest=t.CodeLensRefreshRequest=t.CodeLensResolveRequest=t.CodeLensRequest=t.WorkspaceSymbolResolveRequest=void 0,t.InlineCompletionRequest=t.DidCloseNotebookDocumentNotification=
|
|
974
974
|
t.DidSaveNotebookDocumentNotification=t.DidChangeNotebookDocumentNotification=t.NotebookCellArrayChange=t.DidOpenNotebookDocumentNotification=t.NotebookDocumentSyncRegistrationType=t.NotebookDocument=t.NotebookCell=t.ExecutionSummary=t.NotebookCellKind=t.DiagnosticRefreshRequest=t.WorkspaceDiagnosticRequest=t.DocumentDiagnosticRequest=t.DocumentDiagnosticReportKind=t.DiagnosticServerCancellationData=t.InlayHintRefreshRequest=t.InlayHintResolveRequest=t.InlayHintRequest=t.InlineValueRefreshRequest=
|
|
975
|
-
t.InlineValueRequest=t.TypeHierarchySupertypesRequest=t.TypeHierarchySubtypesRequest=t.TypeHierarchyPrepareRequest=void 0;const e=At(),n=
|
|
975
|
+
t.InlineValueRequest=t.TypeHierarchySupertypesRequest=t.TypeHierarchySubtypesRequest=t.TypeHierarchyPrepareRequest=void 0;const e=At(),n=zy(),r=Ky(),i=Q3();Object.defineProperty(t,"ImplementationRequest",{enumerable:!0,get:function(){return i.ImplementationRequest}});const s=Z3();Object.defineProperty(t,"TypeDefinitionRequest",{enumerable:!0,get:function(){return s.TypeDefinitionRequest}});const o=eG();Object.defineProperty(t,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return o.WorkspaceFoldersRequest}}),
|
|
976
976
|
Object.defineProperty(t,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return o.DidChangeWorkspaceFoldersNotification}});const a=tG();Object.defineProperty(t,"ConfigurationRequest",{enumerable:!0,get:function(){return a.ConfigurationRequest}});const u=nG();Object.defineProperty(t,"DocumentColorRequest",{enumerable:!0,get:function(){return u.DocumentColorRequest}}),Object.defineProperty(t,"ColorPresentationRequest",{enumerable:!0,get:function(){return u.ColorPresentationRequest}});
|
|
977
977
|
const c=rG();Object.defineProperty(t,"FoldingRangeRequest",{enumerable:!0,get:function(){return c.FoldingRangeRequest}}),Object.defineProperty(t,"FoldingRangeRefreshRequest",{enumerable:!0,get:function(){return c.FoldingRangeRefreshRequest}});const l=iG();Object.defineProperty(t,"DeclarationRequest",{enumerable:!0,get:function(){return l.DeclarationRequest}});const f=sG();Object.defineProperty(t,"SelectionRangeRequest",{enumerable:!0,get:function(){return f.SelectionRangeRequest}});const d=oG();
|
|
978
978
|
Object.defineProperty(t,"WorkDoneProgress",{enumerable:!0,get:function(){return d.WorkDoneProgress}}),Object.defineProperty(t,"WorkDoneProgressCreateRequest",{enumerable:!0,get:function(){return d.WorkDoneProgressCreateRequest}}),Object.defineProperty(t,"WorkDoneProgressCancelNotification",{enumerable:!0,get:function(){return d.WorkDoneProgressCancelNotification}});const p=aG();Object.defineProperty(t,"CallHierarchyIncomingCallsRequest",{enumerable:!0,get:function(){return p.CallHierarchyIncomingCallsRequest}}),
|
|
@@ -1004,14 +1004,14 @@ method="completionItem/resolve",h.messageDirection=e.MessageDirection.clientToSe
|
|
|
1004
1004
|
natureHelp",h.messageDirection=e.MessageDirection.clientToServer,h.type=new e.ProtocolRequestType(h.method)})(Zt||(t.SignatureHelpRequest=Zt={}));var Kt;(function(h){h.method="textDocument/definition",h.messageDirection=e.MessageDirection.clientToServer,h.type=new e.ProtocolRequestType(h.method)})(Kt||(t.DefinitionRequest=Kt={}));var Mr;(function(h){h.method="textDocument/references",h.messageDirection=e.MessageDirection.clientToServer,h.type=new e.ProtocolRequestType(h.method)})(Mr||(t.ReferencesRequest=
|
|
1005
1005
|
Mr={}));var ji;(function(h){h.method="textDocument/documentHighlight",h.messageDirection=e.MessageDirection.clientToServer,h.type=new e.ProtocolRequestType(h.method)})(ji||(t.DocumentHighlightRequest=ji={}));var Es;(function(h){h.method="textDocument/documentSymbol",h.messageDirection=e.MessageDirection.clientToServer,h.type=new e.ProtocolRequestType(h.method)})(Es||(t.DocumentSymbolRequest=Es={}));var $s;(function(h){h.method="textDocument/codeAction",h.messageDirection=e.MessageDirection.clientToServer,
|
|
1006
1006
|
h.type=new e.ProtocolRequestType(h.method)})($s||(t.CodeActionRequest=$s={}));var Rs;(function(h){h.method="codeAction/resolve",h.messageDirection=e.MessageDirection.clientToServer,h.type=new e.ProtocolRequestType(h.method)})(Rs||(t.CodeActionResolveRequest=Rs={}));var Ds;(function(h){h.method="workspace/symbol",h.messageDirection=e.MessageDirection.clientToServer,h.type=new e.ProtocolRequestType(h.method)})(Ds||(t.WorkspaceSymbolRequest=Ds={}));var Gi;(function(h){h.method="workspaceSymbol/reso\
|
|
1007
|
-
lve",h.messageDirection=e.MessageDirection.clientToServer,h.type=new e.ProtocolRequestType(h.method)})(Gi||(t.WorkspaceSymbolResolveRequest=Gi={}));var Ui;(function(h){h.method="textDocument/codeLens",h.messageDirection=e.MessageDirection.clientToServer,h.type=new e.ProtocolRequestType(h.method)})(Ui||(t.CodeLensRequest=Ui={}));var
|
|
1008
|
-
|
|
1007
|
+
lve",h.messageDirection=e.MessageDirection.clientToServer,h.type=new e.ProtocolRequestType(h.method)})(Gi||(t.WorkspaceSymbolResolveRequest=Gi={}));var Ui;(function(h){h.method="textDocument/codeLens",h.messageDirection=e.MessageDirection.clientToServer,h.type=new e.ProtocolRequestType(h.method)})(Ui||(t.CodeLensRequest=Ui={}));var _n;(function(h){h.method="codeLens/resolve",h.messageDirection=e.MessageDirection.clientToServer,h.type=new e.ProtocolRequestType(h.method)})(_n||(t.CodeLensResolveRequest=
|
|
1008
|
+
_n={}));var ks;(function(h){h.method="workspace/codeLens/refresh",h.messageDirection=e.MessageDirection.serverToClient,h.type=new e.ProtocolRequestType0(h.method)})(ks||(t.CodeLensRefreshRequest=ks={}));var Ts;(function(h){h.method="textDocument/documentLink",h.messageDirection=e.MessageDirection.clientToServer,h.type=new e.ProtocolRequestType(h.method)})(Ts||(t.DocumentLinkRequest=Ts={}));var Br;(function(h){h.method="documentLink/resolve",h.messageDirection=e.MessageDirection.clientToServer,h.
|
|
1009
1009
|
type=new e.ProtocolRequestType(h.method)})(Br||(t.DocumentLinkResolveRequest=Br={}));var Cs;(function(h){h.method="textDocument/formatting",h.messageDirection=e.MessageDirection.clientToServer,h.type=new e.ProtocolRequestType(h.method)})(Cs||(t.DocumentFormattingRequest=Cs={}));var ii;(function(h){h.method="textDocument/rangeFormatting",h.messageDirection=e.MessageDirection.clientToServer,h.type=new e.ProtocolRequestType(h.method)})(ii||(t.DocumentRangeFormattingRequest=ii={}));var As;(function(h){
|
|
1010
1010
|
h.method="textDocument/rangesFormatting",h.messageDirection=e.MessageDirection.clientToServer,h.type=new e.ProtocolRequestType(h.method)})(As||(t.DocumentRangesFormattingRequest=As={}));var sr;(function(h){h.method="textDocument/onTypeFormatting",h.messageDirection=e.MessageDirection.clientToServer,h.type=new e.ProtocolRequestType(h.method)})(sr||(t.DocumentOnTypeFormattingRequest=sr={}));var yr;(function(h){h.Identifier=1})(yr||(t.PrepareSupportDefaultBehavior=yr={}));var Mo;(function(h){h.method=
|
|
1011
1011
|
"textDocument/rename",h.messageDirection=e.MessageDirection.clientToServer,h.type=new e.ProtocolRequestType(h.method)})(Mo||(t.RenameRequest=Mo={}));var B;(function(h){h.method="textDocument/prepareRename",h.messageDirection=e.MessageDirection.clientToServer,h.type=new e.ProtocolRequestType(h.method)})(B||(t.PrepareRenameRequest=B={}));var E;(function(h){h.method="workspace/executeCommand",h.messageDirection=e.MessageDirection.clientToServer,h.type=new e.ProtocolRequestType(h.method)})(E||(t.ExecuteCommandRequest=
|
|
1012
|
-
E={}));var S;(function(h){h.method="workspace/applyEdit",h.messageDirection=e.MessageDirection.serverToClient,h.type=new e.ProtocolRequestType("workspace/applyEdit")})(S||(t.ApplyWorkspaceEditRequest=S={}))}(
|
|
1012
|
+
E={}));var S;(function(h){h.method="workspace/applyEdit",h.messageDirection=e.MessageDirection.serverToClient,h.type=new e.ProtocolRequestType("workspace/applyEdit")})(S||(t.ApplyWorkspaceEditRequest=S={}))}(Hy)),Hy}var Ec={},Gk;function bG(){if(Gk)return Ec;Gk=1,Object.defineProperty(Ec,"__esModule",{value:!0}),Ec.createProtocolConnection=void 0;const t=ro();function e(n,r,i,s){return t.ConnectionStrategy.is(s)&&(s={connectionStrategy:s}),(0,t.createMessageConnection)(n,r,i,s)}return Ec.createProtocolConnection=
|
|
1013
1013
|
e,Ec}var Uk;function EG(){return Uk||(Uk=1,function(t){var e=io&&io.__createBinding||(Object.create?function(s,o,a,u){u===void 0&&(u=a);var c=Object.getOwnPropertyDescriptor(o,a);(!c||("get"in c?!o.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(s,u,c)}:function(s,o,a,u){u===void 0&&(u=a),s[u]=o[a]}),n=io&&io.__exportStar||function(s,o){for(var a in s)a!=="default"&&!Object.prototype.hasOwnProperty.call(o,a)&&e(o,s,a)};Object.defineProperty(
|
|
1014
|
-
t,"__esModule",{value:!0}),t.LSPErrorCodes=t.createProtocolConnection=void 0,n(ro(),t),n(
|
|
1014
|
+
t,"__esModule",{value:!0}),t.LSPErrorCodes=t.createProtocolConnection=void 0,n(ro(),t),n(zy(),t),n(At(),t),n(wG(),t);var r=bG();Object.defineProperty(t,"createProtocolConnection",{enumerable:!0,get:function(){return r.createProtocolConnection}});var i;(function(s){s.lspReservedErrorRangeStart=-32899,s.RequestFailed=-32803,s.ServerCancelled=-32802,s.ContentModified=-32801,s.RequestCancelled=-32800,s.lspReservedErrorRangeEnd=-32800})(i||(t.LSPErrorCodes=i={}))}(io)),io}var Wk;function Ft(){return Wk||
|
|
1015
1015
|
(Wk=1,function(t){var e=eo&&eo.__createBinding||(Object.create?function(s,o,a,u){u===void 0&&(u=a);var c=Object.getOwnPropertyDescriptor(o,a);(!c||("get"in c?!o.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(s,u,c)}:function(s,o,a,u){u===void 0&&(u=a),s[u]=o[a]}),n=eo&&eo.__exportStar||function(s,o){for(var a in s)a!=="default"&&!Object.prototype.hasOwnProperty.call(o,a)&&e(o,s,a)};Object.defineProperty(t,"__esModule",{value:!0}),t.
|
|
1016
1016
|
createProtocolConnection=void 0;const r=gk();n(gk(),t),n(EG(),t);function i(s,o,a,u){return(0,r.createMessageConnection)(s,o,a,u)}t.createProtocolConnection=i}(eo)),eo}var Qn={},zk;function Hk(){if(zk)return Qn;zk=1,Object.defineProperty(Qn,"__esModule",{value:!0}),Qn.generateUuid=Qn.parse=Qn.isUUID=Qn.v4=Qn.empty=void 0;class t{constructor(u){this._value=u}asHex(){return this._value}equals(u){return this.asHex()===u.asHex()}}class e extends t{static _oneOf(u){return u[Math.floor(u.length*Math.random())]}static _randomHex(){
|
|
1017
1017
|
return e._oneOf(e._chars)}constructor(){super([e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),"-",e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),"-","4",e._randomHex(),e._randomHex(),e._randomHex(),"-",e._oneOf(e._timeHighBits),e._randomHex(),e._randomHex(),e._randomHex(),"-",e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e.
|
|
@@ -1020,7 +1020,7 @@ o,Qn}var Ci={},Kk;function $G(){if(Kk)return Ci;Kk=1,Object.defineProperty(Ci,"_
|
|
|
1020
1020
|
p!==void 0&&(m.message=p)):m.message=d,this._connection.sendProgress(t.WorkDoneProgress.type,this._token,m)}done(){n.Instances.delete(this._token),this._connection.sendProgress(t.WorkDoneProgress.type,this._token,{kind:"end"})}}n.Instances=new Map;class r extends n{constructor(d,p){super(d,p),this._source=new t.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose(),super.done()}cancel(){this._source.cancel()}}class i{constructor(){}begin(){}report(){}done(){}}
|
|
1021
1021
|
class s extends i{constructor(){super(),this._source=new t.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose()}cancel(){this._source.cancel()}}function o(f,d){if(d===void 0||d.workDoneToken===void 0)return new i;const p=d.workDoneToken;return delete d.workDoneToken,new n(f,p)}Ci.attachWorkDone=o;const a=f=>class extends f{constructor(){super(),this._progressSupported=!1}initialize(d){super.initialize(d),d?.window?.workDoneProgress===!0&&(this._progressSupported=
|
|
1022
1022
|
!0,this.connection.onNotification(t.WorkDoneProgressCancelNotification.type,p=>{let m=n.Instances.get(p.token);(m instanceof r||m instanceof s)&&m.cancel()}))}attachWorkDoneProgress(d){return d===void 0?new i:new n(this.connection,d)}createWorkDoneProgress(){if(this._progressSupported){const d=(0,e.generateUuid)();return this.connection.sendRequest(t.WorkDoneProgressCreateRequest.type,{token:d}).then(()=>new r(this.connection,d))}else return Promise.resolve(new s)}};Ci.ProgressFeature=a;var u;(function(f){
|
|
1023
|
-
f.type=new t.ProgressType})(u||(u={}));class c{constructor(d,p){this._connection=d,this._token=p}report(d){this._connection.sendProgress(u.type,this._token,d)}}function l(f,d){if(d===void 0||d.partialResultToken===void 0)return;const p=d.partialResultToken;return delete d.partialResultToken,new c(f,p)}return Ci.attachPartialResult=l,Ci}var $c={},Vk;function RG(){if(Vk)return $c;Vk=1,Object.defineProperty($c,"__esModule",{value:!0}),$c.ConfigurationFeature=void 0;const t=Ft(),e=
|
|
1023
|
+
f.type=new t.ProgressType})(u||(u={}));class c{constructor(d,p){this._connection=d,this._token=p}report(d){this._connection.sendProgress(u.type,this._token,d)}}function l(f,d){if(d===void 0||d.partialResultToken===void 0)return;const p=d.partialResultToken;return delete d.partialResultToken,new c(f,p)}return Ci.attachPartialResult=l,Ci}var $c={},Vk;function RG(){if(Vk)return $c;Vk=1,Object.defineProperty($c,"__esModule",{value:!0}),$c.ConfigurationFeature=void 0;const t=Ft(),e=qy(),n=r=>class extends r{getConfiguration(i){
|
|
1024
1024
|
return i?e.string(i)?this._getConfiguration({section:i}):this._getConfiguration(i):this._getConfiguration({})}_getConfiguration(i){let s={items:Array.isArray(i)?i:[i]};return this.connection.sendRequest(t.ConfigurationRequest.type,s).then(o=>Array.isArray(o)?Array.isArray(i)?o:o[0]:Array.isArray(i)?[]:null)}};return $c.ConfigurationFeature=n,$c}var Rc={},Xk;function DG(){if(Xk)return Rc;Xk=1,Object.defineProperty(Rc,"__esModule",{value:!0}),Rc.WorkspaceFoldersFeature=void 0;const t=Ft(),e=n=>class extends n{constructor(){
|
|
1025
1025
|
super(),this._notificationIsAutoRegistered=!1}initialize(r){super.initialize(r);let i=r.workspace;i&&i.workspaceFolders&&(this._onDidChangeWorkspaceFolders=new t.Emitter,this.connection.onNotification(t.DidChangeWorkspaceFoldersNotification.type,s=>{this._onDidChangeWorkspaceFolders.fire(s.event)}))}fillServerCapabilities(r){super.fillServerCapabilities(r);const i=r.workspace?.workspaceFolders?.changeNotifications;this._notificationIsAutoRegistered=i===!0||typeof i=="string"}getWorkspaceFolders(){
|
|
1026
1026
|
return this.connection.sendRequest(t.WorkspaceFoldersRequest.type)}get onDidChangeWorkspaceFolders(){if(!this._onDidChangeWorkspaceFolders)throw new Error("Client doesn't support sending workspace folder change events.");return!this._notificationIsAutoRegistered&&!this._unregistration&&(this._unregistration=this.connection.client.register(t.DidChangeWorkspaceFoldersNotification.type)),this._onDidChangeWorkspaceFolders.event}};return Rc.WorkspaceFoldersFeature=e,Rc}var Dc={},Yk;function kG(){if(Yk)
|
|
@@ -1054,7 +1054,7 @@ ie);if(y.push({old:we[0],new:ie}),J.delete(ie.document),J.size===0)break}}}if(V.
|
|
|
1054
1054
|
0||A.length>0||y.length>0||N.length>0)&&(b.cells={added:R,removed:A,changed:{data:y,textContent:N}}),(b.metadata!==void 0||b.cells!==void 0)&&this._onDidChange.fire(b)})),u.push(o.notebooks.synchronization.onDidSaveNotebookDocument(c=>{const l=this.notebookDocuments.get(c.notebookDocument.uri);l!==void 0&&this._onDidSave.fire(l)})),u.push(o.notebooks.synchronization.onDidCloseNotebookDocument(c=>{const l=this.notebookDocuments.get(c.notebookDocument.uri);if(l!==void 0){this._onDidClose.fire(l);for(const f of c.
|
|
1055
1055
|
cellTextDocuments)a.closeTextDocument({textDocument:f});this.notebookDocuments.delete(c.notebookDocument.uri);for(const f of l.cells)this.notebookCellMap.delete(f.document)}})),t.Disposable.create(()=>{u.forEach(c=>c.dispose())})}updateCellMap(o){for(const a of o.cells)this.notebookCellMap.set(a.document,[a,o])}}return co.NotebookDocuments=i,co}var Ic={},dT;function IG(){if(dT)return Ic;dT=1,Object.defineProperty(Ic,"__esModule",{value:!0}),Ic.MonikerFeature=void 0;const t=Ft(),e=n=>class extends n{get moniker(){
|
|
1056
1056
|
return{on:r=>{const i=t.MonikerRequest.type;return this.connection.onRequest(i,(s,o)=>r(s,o,this.attachWorkDoneProgress(s),this.attachPartialResultProgress(i,s)))}}}};return Ic.MonikerFeature=e,Ic}var fT;function pT(){if(fT)return Ze;fT=1,Object.defineProperty(Ze,"__esModule",{value:!0}),Ze.createConnection=Ze.combineFeatures=Ze.combineNotebooksFeatures=Ze.combineLanguagesFeatures=Ze.combineWorkspaceFeatures=Ze.combineWindowFeatures=Ze.combineClientFeatures=Ze.combineTracerFeatures=Ze.combineTelemetryFeatures=
|
|
1057
|
-
Ze.combineConsoleFeatures=Ze._NotebooksImpl=Ze._LanguagesImpl=Ze.BulkUnregistration=Ze.BulkRegistration=Ze.ErrorMessageTracker=void 0;const t=Ft(),e=
|
|
1057
|
+
Ze.combineConsoleFeatures=Ze._NotebooksImpl=Ze._LanguagesImpl=Ze.BulkUnregistration=Ze.BulkRegistration=Ze.ErrorMessageTracker=void 0;const t=Ft(),e=qy(),n=Hk(),r=$G(),i=RG(),s=DG(),o=kG(),a=Qk(),u=TG(),c=CG(),l=AG(),f=SG(),d=_G(),p=xG(),m=PG(),w=NG(),y=lT(),g=IG();function b(fe){if(fe!==null)return fe}class R{constructor(){this._messages=Object.create(null)}add(O){let G=this._messages[O];G||(G=0),G++,this._messages[O]=G}sendErrors(O){Object.keys(this._messages).forEach(G=>{O.window.showErrorMessage(
|
|
1058
1058
|
G)})}}Ze.ErrorMessageTracker=R;class A{constructor(){}rawAttach(O){this._rawConnection=O}attach(O){this._connection=O}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}fillServerCapabilities(O){}initialize(O){}error(O){this.send(t.MessageType.Error,O)}warn(O){this.send(t.MessageType.Warning,O)}info(O){this.send(t.MessageType.Info,O)}log(O){this.send(t.MessageType.Log,O)}debug(O){this.send(t.MessageType.Debug,O)}send(O,G){
|
|
1059
1059
|
this._rawConnection&&this._rawConnection.sendNotification(t.LogMessageNotification.type,{type:O,message:G}).catch(()=>{(0,t.RAL)().console.error("Sending log message failed")})}}class N{constructor(){}attach(O){this._connection=O}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(O){}fillServerCapabilities(O){}showErrorMessage(O,...G){let he={type:t.MessageType.Error,message:O,actions:G};return this.connection.sendRequest(
|
|
1060
1060
|
t.ShowMessageRequest.type,he).then(b)}showWarningMessage(O,...G){let he={type:t.MessageType.Warning,message:O,actions:G};return this.connection.sendRequest(t.ShowMessageRequest.type,he).then(b)}showInformationMessage(O,...G){let he={type:t.MessageType.Info,message:O,actions:G};return this.connection.sendRequest(t.ShowMessageRequest.type,he).then(b)}}const V=(0,u.ShowDocumentFeature)((0,r.ProgressFeature)(N));var J;(function(fe){function O(){return new se}fe.create=O})(J||(Ze.BulkRegistration=J={}));
|
|
@@ -1090,32 +1090,32 @@ d&&n.existsSync(d)&&(A[w]?A[w]=d+e.delimiter+A[w]:A[w]=d,m&&m(`NODE_PATH value i
|
|
|
1090
1090
|
create(null);Object.keys(process.env).forEach(y=>p[y]=process.env[y]),p.NO_UPDATE_NOTIFIER="true";const m={encoding:"utf8",env:p};s()&&(d="npm.cmd",m.shell=!0);let w=()=>{};try{process.on("SIGPIPE",w);let y=(0,r.spawnSync)(d,["config","get","prefix"],m).stdout;if(!y){f&&f("'npm config get prefix' didn't return a value.");return}let g=y.trim();return f&&f(`'npm config get prefix' value is: ${g}`),g.length>0?s()?e.join(g,"node_modules"):e.join(g,"lib","node_modules"):void 0}catch{return}finally{process.
|
|
1091
1091
|
removeListener("SIGPIPE",w)}}Tn.resolveGlobalNodePath=a;function u(f){let d="yarn",p={encoding:"utf8"};s()&&(d="yarn.cmd",p.shell=!0);let m=()=>{};try{process.on("SIGPIPE",m);let w=(0,r.spawnSync)(d,["global","dir","--json"],p),y=w.stdout;if(!y){f&&(f("'yarn global dir' didn't return a value."),w.stderr&&f(w.stderr));return}let g=y.trim().split(/\r?\n/);for(let b of g)try{let R=JSON.parse(b);if(R.type==="log")return e.join(R.data,"node_modules")}catch{}return}catch{return}finally{process.removeListener(
|
|
1092
1092
|
"SIGPIPE",m)}}Tn.resolveGlobalYarnPath=u;var c;(function(f){let d;function p(){return d!==void 0||(process.platform==="win32"?d=!1:d=!n.existsSync(__filename.toUpperCase())||!n.existsSync(__filename.toLowerCase())),d}f.isCaseSensitive=p;function m(w,y){return p()?e.normalize(y).indexOf(e.normalize(w))===0:e.normalize(y).toLowerCase().indexOf(e.normalize(w).toLowerCase())===0}f.isParent=m})(c||(Tn.FileSystem=c={}));function l(f,d,p,m){return p?(e.isAbsolute(p)||(p=e.join(f,p)),o(d,p,p,m).then(w=>c.
|
|
1093
|
-
isParent(p,w)?w:Promise.reject(new Error(`Failed to load ${d} from node path location.`))).then(void 0,w=>o(d,a(m),f,m))):o(d,a(m),f,m)}return Tn.resolveModulePath=l,Tn}var
|
|
1093
|
+
isParent(p,w)?w:Promise.reject(new Error(`Failed to load ${d} from node path location.`))).then(void 0,w=>o(d,a(m),f,m))):o(d,a(m),f,m)}return Tn.resolveModulePath=l,Tn}var Vy,mT;function gT(){return mT||(mT=1,Vy=Ft()),Vy}var lo={},Oc={},yT;function LG(){if(yT)return Oc;yT=1,Object.defineProperty(Oc,"__esModule",{value:!0}),Oc.InlineCompletionFeature=void 0;const t=Ft(),e=n=>class extends n{get inlineCompletion(){return{on:r=>this.connection.onRequest(t.InlineCompletionRequest.type,(i,s)=>r(i,s,
|
|
1094
1094
|
this.attachWorkDoneProgress(i)))}}};return Oc.InlineCompletionFeature=e,Oc}var vT;function FG(){return vT||(vT=1,function(t){var e=lo&&lo.__createBinding||(Object.create?function(u,c,l,f){f===void 0&&(f=l);var d=Object.getOwnPropertyDescriptor(c,l);(!d||("get"in d?!c.__esModule:d.writable||d.configurable))&&(d={enumerable:!0,get:function(){return c[l]}}),Object.defineProperty(u,f,d)}:function(u,c,l,f){f===void 0&&(f=l),u[f]=c[l]}),n=lo&&lo.__exportStar||function(u,c){for(var l in u)l!=="default"&&
|
|
1095
1095
|
!Object.prototype.hasOwnProperty.call(c,l)&&e(c,u,l)};Object.defineProperty(t,"__esModule",{value:!0}),t.ProposedFeatures=t.NotebookDocuments=t.TextDocuments=t.SemanticTokensBuilder=void 0;const r=Qk();Object.defineProperty(t,"SemanticTokensBuilder",{enumerable:!0,get:function(){return r.SemanticTokensBuilder}});const i=LG();n(Ft(),t);const s=uT();Object.defineProperty(t,"TextDocuments",{enumerable:!0,get:function(){return s.TextDocuments}});const o=lT();Object.defineProperty(t,"NotebookDocument\
|
|
1096
1096
|
s",{enumerable:!0,get:function(){return o.NotebookDocuments}}),n(pT(),t);var a;(function(u){u.all={__brand:"features",languages:i.InlineCompletionFeature}})(a||(t.ProposedFeatures=a={}))}(lo)),lo}var wT;function bT(){return wT||(wT=1,function(t){var e=Zs&&Zs.__createBinding||(Object.create?function(g,b,R,A){A===void 0&&(A=R);var N=Object.getOwnPropertyDescriptor(b,R);(!N||("get"in N?!b.__esModule:N.writable||N.configurable))&&(N={enumerable:!0,get:function(){return b[R]}}),Object.defineProperty(
|
|
1097
|
-
g,A,N)}:function(g,b,R,A){A===void 0&&(A=R),g[A]=b[R]}),n=Zs&&Zs.__exportStar||function(g,b){for(var R in g)R!=="default"&&!Object.prototype.hasOwnProperty.call(b,R)&&e(b,g,R)};Object.defineProperty(t,"__esModule",{value:!0}),t.createConnection=t.Files=void 0;const r=Xw,i=
|
|
1097
|
+
g,A,N)}:function(g,b,R,A){A===void 0&&(A=R),g[A]=b[R]}),n=Zs&&Zs.__exportStar||function(g,b){for(var R in g)R!=="default"&&!Object.prototype.hasOwnProperty.call(b,R)&&e(b,g,R)};Object.defineProperty(t,"__esModule",{value:!0}),t.createConnection=t.Files=void 0;const r=Xw,i=qy(),s=pT(),o=OG(),a=gT();n(gT(),t),n(FG(),t);var u;(function(g){g.uriToFilePath=o.uriToFilePath,g.resolveGlobalNodePath=o.resolveGlobalNodePath,g.resolveGlobalYarnPath=o.resolveGlobalYarnPath,g.resolve=o.resolve,g.resolveModulePath=
|
|
1098
1098
|
o.resolveModulePath})(u||(t.Files=u={}));function c(){}let l=!1,f;function d(){const g="--clientProcessId";function b(R){try{let A=parseInt(R);isNaN(A)||(f=setInterval(()=>{try{process.kill(A,0)}catch{process.exit(l?0:1)}},3e3))}catch{}}for(let R=2;R<process.argv.length;R++){let A=process.argv[R];if(A===g&&R+1<process.argv.length){b(process.argv[R+1]);return}else{let N=A.split("=");N[0]===g&&b(N[1])}}}d();const p={initialize:g=>{const b=g.processId;i.number(b)&&f===void 0&&setInterval(()=>{try{process.
|
|
1099
1099
|
kill(b,0)}catch{process.exit(l?0:1)}},3e3)},get shutdownReceived(){return l},set shutdownReceived(g){l=g},exit:g=>{process.exit(g)}};function m(g,b,R,A){let N,V,J,se;return g!==void 0&&g.__brand==="features"&&(N=g,g=b,b=R,R=A),a.ConnectionStrategy.is(g)||a.ConnectionOptions.is(g)?se=g:(V=g,J=b,se=R),w(V,J,se,N)}t.createConnection=m;function w(g,b,R,A){let N=!1;if(!g&&!b&&process.argv.length>2){let ie,we,M=process.argv.slice(2);for(let T=0;T<M.length;T++){let D=M[T];if(D==="--node-ipc"){g=new a.IPCMessageReader(
|
|
1100
1100
|
process),b=new a.IPCMessageWriter(process);break}else if(D==="--stdio"){N=!0,g=process.stdin,b=process.stdout;break}else if(D==="--socket"){ie=parseInt(M[T+1]);break}else if(D==="--pipe"){we=M[T+1];break}else{var V=D.split("=");if(V[0]==="--socket"){ie=parseInt(V[1]);break}else if(V[0]==="--pipe"){we=V[1];break}}}if(ie){let T=(0,a.createServerSocketTransport)(ie);g=T[0],b=T[1]}else if(we){let T=(0,a.createServerPipeTransport)(we);g=T[0],b=T[1]}}var J="Use arguments of createConnection or set com\
|
|
1101
1101
|
mand line parameters: '--node-ipc', '--stdio' or '--socket={number}'";if(!g)throw new Error("Connection input stream is not set. "+J);if(!b)throw new Error("Connection output stream is not set. "+J);if(i.func(g.read)&&i.func(g.on)){let ie=g;ie.on("end",()=>{process.exit(l?0:1)}),ie.on("close",()=>{process.exit(l?0:1)})}const se=ie=>{const we=(0,a.createProtocolConnection)(g,b,ie,R);return N&&y(ie),we};return(0,s.createConnection)(se,p,A)}function y(g){function b(A){return A.map(N=>typeof N=="str\
|
|
1102
1102
|
ing"?N:(0,r.inspect)(N)).join(" ")}const R=new Map;console.assert=function(N,...V){if(!N)if(V.length===0)g.error("Assertion failed");else{const[J,...se]=V;g.error(`Assertion failed: ${J} ${b(se)}`)}},console.count=function(N="default"){const V=String(N);let J=R.get(V)??0;J+=1,R.set(V,J),g.log(`${V}: ${V}`)},console.countReset=function(N){N===void 0?R.clear():R.delete(String(N))},console.debug=function(...N){g.log(b(N))},console.dir=function(N,V){g.log((0,r.inspect)(N,V))},console.log=function(...N){
|
|
1103
1103
|
g.log(b(N))},console.error=function(...N){g.error(b(N))},console.trace=function(...N){const V=new Error().stack.replace(/(.+\n){2}/,"");let J="Trace";N.length!==0&&(J+=`: ${b(N)}`),g.log(`${J}
|
|
1104
|
-
${V}`)},console.warn=function(...N){g.warn(b(N))}}}(Zs)),Zs}var ce=bT();function ET(t,e){const n={stacks:t,tokens:e};return MG(n),n.stacks.flat().forEach(i=>{i.property=void 0}),RT(n.stacks).map(i=>i[i.length-1])}function
|
|
1105
|
-
type:e.type},cardinalities:n,visited:r,plus:i});for(const l of c)i.add(l.feature);s.push(...c)}if(a){const c=a.elements.indexOf(u);c!==void 0&&c<a.elements.length-1&&s.push(...$T({feature:a,type:e.type},c+1,n,r,i)),s.every(l=>Ko(l.feature.cardinality,l.feature)||Ko(n.get(l.feature))||i.has(l.feature))&&s.push(...
|
|
1106
|
-
function da(t){var e,n,r;const{next:i,cardinalities:s,visited:o,plus:a}=t;if(i===void 0)return[];const{feature:u,type:c}=i;if(Xi(u))return o.has(u)?[]:(o.add(u),$T(i,0,s,o,a).map(l=>Sp(l,u.cardinality,s)));if(
|
|
1107
|
-
visited:o,plus:a}).map(f=>Sp(f,u.cardinality,s))}else{if(Is(u))return
|
|
1104
|
+
${V}`)},console.warn=function(...N){g.warn(b(N))}}}(Zs)),Zs}var ce=bT();function ET(t,e){const n={stacks:t,tokens:e};return MG(n),n.stacks.flat().forEach(i=>{i.property=void 0}),RT(n.stacks).map(i=>i[i.length-1])}function Xy(t){const{next:e,cardinalities:n,visited:r,plus:i}=t,s=[],o=e.feature;if(r.has(o))return[];Xi(o)||r.add(o);let a,u=o;for(;u.$container;)if(Xi(u.$container)){a=u.$container;break}else if(qm(u.$container))u=u.$container;else break;if(w0(u.cardinality)){const c=da({next:{feature:u,
|
|
1105
|
+
type:e.type},cardinalities:n,visited:r,plus:i});for(const l of c)i.add(l.feature);s.push(...c)}if(a){const c=a.elements.indexOf(u);c!==void 0&&c<a.elements.length-1&&s.push(...$T({feature:a,type:e.type},c+1,n,r,i)),s.every(l=>Ko(l.feature.cardinality,l.feature)||Ko(n.get(l.feature))||i.has(l.feature))&&s.push(...Xy({next:{feature:a,type:e.type},cardinalities:n,visited:r,plus:i}))}return s}function Yy(t){return kt(t)&&(t={feature:t}),da({next:t,cardinalities:new Map,visited:new Set,plus:new Set})}
|
|
1106
|
+
function da(t){var e,n,r;const{next:i,cardinalities:s,visited:o,plus:a}=t;if(i===void 0)return[];const{feature:u,type:c}=i;if(Xi(u))return o.has(u)?[]:(o.add(u),$T(i,0,s,o,a).map(l=>Sp(l,u.cardinality,s)));if(Hm(u)||Km(u))return u.elements.flatMap(l=>da({next:{feature:l,type:c,property:i.property},cardinalities:s,visited:o,plus:a})).map(l=>Sp(l,u.cardinality,s));if(jr(u)){const l={feature:u.terminal,type:c,property:(e=i.property)!==null&&e!==void 0?e:u.feature};return da({next:l,cardinalities:s,
|
|
1107
|
+
visited:o,plus:a}).map(f=>Sp(f,u.cardinality,s))}else{if(Is(u))return Xy({next:{feature:u,type:Nu(u),property:(n=i.property)!==null&&n!==void 0?n:u.feature},cardinalities:s,visited:o,plus:a});if(ui(u)&&Vt(u.rule.ref)){const l=u.rule.ref,f={feature:l.definition,type:l.fragment||l.dataType?void 0:(r=Os(l))!==null&&r!==void 0?r:l.name,property:i.property};return da({next:f,cardinalities:s,visited:o,plus:a}).map(d=>Sp(d,u.cardinality,s))}else return[i]}}function Sp(t,e,n){return n.set(t.feature,e),t}
|
|
1108
1108
|
function $T(t,e,n,r,i){var s;const o=[];let a;for(;e<t.feature.elements.length&&(a={feature:t.feature.elements[e++],type:t.type},o.push(...da({next:a,cardinalities:n,visited:r,plus:i})),!!Ko((s=a.feature.cardinality)!==null&&s!==void 0?s:n.get(a.feature),a.feature)););return o}function MG(t){for(const e of t.tokens){const n=RT(t.stacks,e);t.stacks=n}}function RT(t,e){const n=[];for(const r of t)n.push(...BG(r,e));return n}function BG(t,e){const n=new Map,r=new Set(t.map(s=>s.feature).filter(qG)),
|
|
1109
|
-
i=[];for(;t.length>0;){const s=t.pop(),o=
|
|
1110
|
-
t)?
|
|
1109
|
+
i=[];for(;t.length>0;){const s=t.pop(),o=Xy({next:s,cardinalities:n,plus:r,visited:new Set}).filter(a=>e?Jy(a.feature,e):!0);for(const a of o)i.push([...t,a]);if(!o.every(a=>Ko(a.feature.cardinality,a.feature)||Ko(n.get(a.feature))))break}return i}function qG(t){if(t.cardinality==="+")return!0;const e=zn(t,jr);return!!(e&&e.cardinality==="+")}function Jy(t,e){if(vr(t))return t.value===e.image;if(ui(t))return jG(t.rule.ref,e);if(Uo(t)){const n=tg(t);if(n)return Jy(n,e)}return!1}function jG(t,e){return Vt(
|
|
1110
|
+
t)?Yy(t.definition).some(r=>Jy(r.feature,e)):ai(t)?Iu(t).test(e.image):!1}function GG(t){const e=Array.from(new Set(t.flatMap(r=>{var i;return(i=r?.triggerCharacters)!==null&&i!==void 0?i:[]}))),n=Array.from(new Set(t.flatMap(r=>{var i;return(i=r?.allCommitCharacters)!==null&&i!==void 0?i:[]})));return{triggerCharacters:e.length>0?e:void 0,allCommitCharacters:n.length>0?n:void 0}}class DT{constructor(e){this.scopeProvider=e.references.ScopeProvider,this.grammar=e.Grammar,this.completionParser=e.
|
|
1111
1111
|
parser.CompletionParser,this.nameProvider=e.references.NameProvider,this.lexer=e.parser.Lexer,this.nodeKindProvider=e.shared.lsp.NodeKindProvider,this.fuzzyMatcher=e.shared.lsp.FuzzyMatcher,this.grammarConfig=e.parser.GrammarConfig,this.astReflection=e.shared.AstReflection,this.documentationProvider=e.documentation.DocumentationProvider}async getCompletion(e,n,r){const i=[],s=this.buildContexts(e,n.position),o=(c,l)=>{const f=this.fillCompletionItem(c,l);f&&i.push(f)},a=c=>vr(c.feature)?c.feature.
|
|
1112
1112
|
value:c.feature,u=[];for(const c of s)if(await Promise.all(Ve(c.features).distinct(a).exclude(u).map(l=>this.completionFor(c,l,o))),u.push(...c.features),!this.continueCompletion(i))break;return ce.CompletionList.create(this.deduplicateItems(i),!0)}deduplicateItems(e){return Ve(e).distinct(n=>`${n.kind}_${n.label}_${n.detail}`).toArray()}findFeaturesAt(e,n){const r=e.getText({start:ce.Position.create(0,0),end:e.positionAt(n)}),i=this.completionParser.parse(r),s=i.tokens;if(i.tokenIndex===0){const u=$f(
|
|
1113
|
-
this.grammar),c=
|
|
1114
|
-
assign({},c),{node:A,tokenOffset:b,tokenEndOffset:R,features:this.findFeaturesAt(o,b)})}const{nextTokenStart:f,nextTokenEnd:d,previousTokenStart:p,previousTokenEnd:m}=this.backtrackToAnyToken(a,u);let w=f;u<=f&&p!==void 0&&(w=p);const y=(i=
|
|
1115
|
-
g&&(yield Object.assign(Object.assign({},c),{node:y,tokenOffset:m,tokenEndOffset:m,features:this.findFeaturesAt(o,m)}))),y)g&&(yield Object.assign(Object.assign({},c),{node:y,tokenOffset:f,tokenEndOffset:d,features:this.findFeaturesAt(o,f)}));else{const b=$f(this.grammar);if(!b)throw new Error("Missing entry parser rule");yield Object.assign(Object.assign({},c),{tokenOffset:f,tokenEndOffset:d,features:
|
|
1113
|
+
this.grammar),c=Yy({feature:u.definition,type:Os(u)});return s.length>0?(s.shift(),ET(c.map(l=>[l]),s)):c}const o=[...s].splice(i.tokenIndex);return ET([i.elementStack.map(u=>({feature:u}))],o)}*buildContexts(e,n){var r,i;const s=e.parseResult.value.$cstNode;if(!s)return;const o=e.textDocument,a=o.getText(),u=o.offsetAt(n),c={document:e,textDocument:o,offset:u,position:n},l=this.findDataTypeRuleStart(s,u);if(l){const[b,R]=l,A=(r=Fm(s,b))===null||r===void 0?void 0:r.astNode;yield Object.assign(Object.
|
|
1114
|
+
assign({},c),{node:A,tokenOffset:b,tokenEndOffset:R,features:this.findFeaturesAt(o,b)})}const{nextTokenStart:f,nextTokenEnd:d,previousTokenStart:p,previousTokenEnd:m}=this.backtrackToAnyToken(a,u);let w=f;u<=f&&p!==void 0&&(w=p);const y=(i=Fm(s,w))===null||i===void 0?void 0:i.astNode;let g=!0;if(p!==void 0&&m!==void 0&&m===u&&(yield Object.assign(Object.assign({},c),{node:y,tokenOffset:p,tokenEndOffset:m,features:this.findFeaturesAt(o,p)}),g=this.performNextTokenCompletion(e,a.substring(p,m),p,m),
|
|
1115
|
+
g&&(yield Object.assign(Object.assign({},c),{node:y,tokenOffset:m,tokenEndOffset:m,features:this.findFeaturesAt(o,m)}))),y)g&&(yield Object.assign(Object.assign({},c),{node:y,tokenOffset:f,tokenEndOffset:d,features:this.findFeaturesAt(o,f)}));else{const b=$f(this.grammar);if(!b)throw new Error("Missing entry parser rule");yield Object.assign(Object.assign({},c),{tokenOffset:f,tokenEndOffset:d,features:Yy(b.definition)})}}performNextTokenCompletion(e,n,r,i){return new RegExp("\\P{L}$","u").test(n)}findDataTypeRuleStart(e,n){
|
|
1116
1116
|
var r,i;let s=Ns(e,n,this.grammarConfig.nameRegexp),o=!!(!((r=zn(s?.grammarSource,Vt))===null||r===void 0)&&r.dataType);if(o){for(;o;)s=s?.container,o=!!(!((i=zn(s?.grammarSource,Vt))===null||i===void 0)&&i.dataType);if(s)return[s.offset,s.end]}}continueCompletion(e){return e.length===0}backtrackToAnyToken(e,n){const r=this.lexer.tokenize(e).tokens;if(r.length===0)return{nextTokenStart:n,nextTokenEnd:n};let i;for(const s of r){if(s.startOffset>=n)return{nextTokenStart:n,nextTokenEnd:n,previousTokenStart:i?
|
|
1117
1117
|
i.startOffset:void 0,previousTokenEnd:i?i.endOffset+1:void 0};if(s.endOffset>=n)return{nextTokenStart:s.startOffset,nextTokenEnd:s.endOffset+1,previousTokenStart:i?i.startOffset:void 0,previousTokenEnd:i?i.endOffset+1:void 0};i=s}return{nextTokenStart:n,nextTokenEnd:n,previousTokenStart:i?i.startOffset:void 0,previousTokenEnd:i?i.endOffset+1:void 0}}completionFor(e,n,r){if(vr(n.feature))return this.completionForKeyword(e,n.feature,r);if(Uo(n.feature)&&e.node)return this.completionForCrossReference(
|
|
1118
|
-
e,n,r)}completionForCrossReference(e,n,r){const i=zn(n.feature,jr);let s=e.node;if(i&&s){n.type&&(s={$type:n.type,$container:s,$containerProperty:n.property},
|
|
1118
|
+
e,n,r)}completionForCrossReference(e,n,r){const i=zn(n.feature,jr);let s=e.node;if(i&&s){n.type&&(s={$type:n.type,$container:s,$containerProperty:n.property},Ym(this.astReflection,s));const o={reference:{$refText:""},container:s,property:i.feature};try{for(const a of this.getReferenceCandidates(o,e))r(e,this.createReferenceCompletionItem(a))}catch(a){console.error(a)}}}getReferenceCandidates(e,n){return this.scopeProvider.getScope(e).getAllElements()}createReferenceCompletionItem(e){const n=this.
|
|
1119
1119
|
nodeKindProvider.getCompletionItemKind(e),r=this.getReferenceDocumentation(e);return{nodeDescription:e,kind:n,documentation:r,detail:e.type,sortText:"0"}}getReferenceDocumentation(e){if(!e.node)return;const n=this.documentationProvider.getDocumentation(e.node);if(n)return{kind:"markdown",value:n}}completionForKeyword(e,n,r){this.filterKeyword(e,n)&&r(e,{label:n.value,kind:this.getKeywordCompletionItemKind(n),detail:"Keyword",sortText:"1"})}getKeywordCompletionItemKind(e){return ce.CompletionItemKind.
|
|
1120
1120
|
Keyword}filterKeyword(e,n){return new RegExp("\\p{L}","u").test(n.value)}fillCompletionItem(e,n){var r,i;let s;if(typeof n.label=="string")s=n.label;else if("node"in n){const c=this.nameProvider.getName(n.node);if(!c)return;s=c}else if("nodeDescription"in n)s=n.nodeDescription.name;else return;let o;typeof((r=n.textEdit)===null||r===void 0?void 0:r.newText)=="string"?o=n.textEdit.newText:typeof n.insertText=="string"?o=n.insertText:o=s;const a=(i=n.textEdit)!==null&&i!==void 0?i:this.buildCompletionTextEdit(
|
|
1121
1121
|
e,s,o);return a?{additionalTextEdits:n.additionalTextEdits,command:n.command,commitCharacters:n.commitCharacters,data:n.data,detail:n.detail,documentation:n.documentation,filterText:n.filterText,insertText:n.insertText,insertTextFormat:n.insertTextFormat,insertTextMode:n.insertTextMode,kind:n.kind,labelDetails:n.labelDetails,preselect:n.preselect,sortText:n.sortText,tags:n.tags,textEditText:n.textEditText,textEdit:a,label:s}:void 0}buildCompletionTextEdit(e,n,r){const s=e.textDocument.getText().
|
|
@@ -1125,8 +1125,8 @@ this.grammarConfig=e.parser.GrammarConfig}getDocumentHighlight(e,n,r){const i=e.
|
|
|
1125
1125
|
range)}}class WG{constructor(e){this.nameProvider=e.references.NameProvider,this.nodeKindProvider=e.shared.lsp.NodeKindProvider}getSymbols(e,n,r){return this.getSymbol(e,e.parseResult.value)}getSymbol(e,n){const r=n.$cstNode,i=this.nameProvider.getNameNode(n);if(i&&r){const s=this.nameProvider.getName(n);return[{kind:this.nodeKindProvider.getSymbolKind(n),name:s||i.text,range:r.range,selectionRange:i.range,children:this.getChildSymbols(e,n)}]}else return this.getChildSymbols(e,n)||[]}getChildSymbols(e,n){
|
|
1126
1126
|
const r=[];for(const i of _u(n)){const s=this.getSymbol(e,i);r.push(...s)}if(r.length>0)return r}}class zG{constructor(e){this.workspaceManager=e.workspace.WorkspaceManager,this.documentBuilder=e.workspace.DocumentBuilder,this.workspaceLock=e.workspace.WorkspaceLock,this.serviceRegistry=e.ServiceRegistry;let n=!1;e.lsp.LanguageServer.onInitialize(r=>{var i,s;n=!!(!((s=(i=r.capabilities.workspace)===null||i===void 0?void 0:i.didChangeWatchedFiles)===null||s===void 0)&&s.dynamicRegistration)}),e.lsp.
|
|
1127
1127
|
LanguageServer.onInitialized(r=>{n&&this.registerFileWatcher(e)})}registerFileWatcher(e){const n=[],r=Ve(e.ServiceRegistry.all).flatMap(s=>s.LanguageMetaData.fileExtensions).map(s=>s.startsWith(".")?s.substring(1):s).distinct().toArray();r.length>0&&n.push({globPattern:r.length===1?`**/*.${r[0]}`:`**/*.{${r.join(",")}}`});const i=Ve(e.ServiceRegistry.all).flatMap(s=>{var o;return(o=s.LanguageMetaData.fileNames)!==null&&o!==void 0?o:[]}).distinct().toArray();if(i.length>0&&n.push({globPattern:i.length===
|
|
1128
|
-
1?`**/${i[0]}`:`**/{${i.join(",")}}`}),n.length>0){const s=e.lsp.Connection,o={watchers:n};s?.client.register(ce.DidChangeWatchedFilesNotification.type,o)}}fireDocumentUpdate(e,n){e=e.filter(r=>this.serviceRegistry.hasServices(r)),this.workspaceManager.ready.then(()=>{this.workspaceLock.write(r=>this.documentBuilder.update(e,n,r))}).catch(r=>{console.error("Workspace initialization failed. Could not perform document update.",r)})}didChangeContent(e){this.fireDocumentUpdate([
|
|
1129
|
-
[])}didChangeWatchedFiles(e){const n=Ve(e.changes).filter(i=>i.type!==ce.FileChangeType.Deleted).distinct(i=>i.uri).map(i=>
|
|
1128
|
+
1?`**/${i[0]}`:`**/{${i.join(",")}}`}),n.length>0){const s=e.lsp.Connection,o={watchers:n};s?.client.register(ce.DidChangeWatchedFilesNotification.type,o)}}fireDocumentUpdate(e,n){e=e.filter(r=>this.serviceRegistry.hasServices(r)),this.workspaceManager.ready.then(()=>{this.workspaceLock.write(r=>this.documentBuilder.update(e,n,r))}).catch(r=>{console.error("Workspace initialization failed. Could not perform document update.",r)})}didChangeContent(e){this.fireDocumentUpdate([dt.parse(e.document.uri)],
|
|
1129
|
+
[])}didChangeWatchedFiles(e){const n=Ve(e.changes).filter(i=>i.type!==ce.FileChangeType.Deleted).distinct(i=>i.uri).map(i=>dt.parse(i.uri)).toArray(),r=Ve(e.changes).filter(i=>i.type===ce.FileChangeType.Deleted).distinct(i=>i.uri).map(i=>dt.parse(i.uri)).toArray();this.fireDocumentUpdate(n,r)}}class HG{constructor(e){this.commentNames=e.parser.GrammarConfig.multilineCommentRules}getFoldingRanges(e,n,r){const i=[],s=o=>i.push(o);return this.collectFolding(e,s),i}collectFolding(e,n){var r;const i=(r=
|
|
1130
1130
|
e.parseResult)===null||r===void 0?void 0:r.value;if(i){if(this.shouldProcessContent(i)){const s=wr(i).iterator();let o;do if(o=s.next(),!o.done){const a=o.value;this.shouldProcess(a)&&this.collectObjectFolding(e,a,n),this.shouldProcessContent(a)||s.prune()}while(!o.done)}this.collectCommentFolding(e,i,n)}}shouldProcess(e){return!0}shouldProcessContent(e){return!0}collectObjectFolding(e,n,r){const i=n.$cstNode;if(i){const s=this.toFoldingRange(e,i);s&&r(s)}}collectCommentFolding(e,n,r){const i=n.
|
|
1131
1131
|
$cstNode;if(i){for(const s of oN(i))if(this.commentNames.includes(s.tokenType.name)){const o=this.toFoldingRange(e,s,ce.FoldingRangeKind.Comment);o&&r(o)}}}toFoldingRange(e,n,r){const i=n.range,s=i.start;let o=i.end;if(!(o.line-s.line<2))return this.includeLastFoldingLine(n,r)||(o=e.textDocument.positionAt(e.textDocument.offsetAt({line:o.line,character:0})-1)),ce.FoldingRange.create(s.line,o.line,s.character,o.character,r)}includeLastFoldingLine(e,n){if(n===ce.FoldingRangeKind.Comment)return!1;const r=e.
|
|
1132
1132
|
text,i=r.charAt(r.length-1);return!(i==="}"||i===")"||i==="]")}}class KG{match(e,n){if(e.length===0)return!0;let r=!1,i,s=0;const o=n.length;for(let a=0;a<o;a++){const u=n.charCodeAt(a),c=e.charCodeAt(s);if((u===c||this.toUpperCharCode(u)===this.toUpperCharCode(c))&&(r||(r=i===void 0||this.isWordTransition(i,u)),r&&s++,s===e.length))return!0;i=u}return!1}isWordTransition(e,n){return TT<=e&&e<=CT&&VG<=n&&n<=XG||e===AT&&n!==AT}toUpperCharCode(e){return TT<=e&&e<=CT?e-32:e}}const TT=97,CT=122,VG=65,
|
|
@@ -1137,16 +1137,16 @@ parameter]:14,[ce.SemanticTokenTypes.property]:15,[ce.SemanticTokenTypes.regexp]
|
|
|
1137
1137
|
[ce.SemanticTokenModifiers.deprecated]:32,[ce.SemanticTokenModifiers.documentation]:64,[ce.SemanticTokenModifiers.modification]:128,[ce.SemanticTokenModifiers.readonly]:256,[ce.SemanticTokenModifiers.static]:512};function ZG(t){const e=[],n=[];let r=!0,i=!0,s=!0;for(const o of t)o&&(o.legend.tokenTypes.forEach((a,u)=>{const c=e[u];if(c&&c!==a)throw new Error(`Cannot merge '${c}' and '${a}' token types. They use the same index ${u}.`);e[u]=a}),o.legend.tokenModifiers.forEach((a,u)=>{const c=n[u];
|
|
1138
1138
|
if(c&&c!==a)throw new Error(`Cannot merge '${c}' and '${a}' token modifier. They use the same index ${u}.`);n[u]=a}),o.full?typeof o.full=="object"&&!o.full.delta&&(i=!1):r=!1,o.range||(s=!1));return{legend:{tokenTypes:e,tokenModifiers:n},full:r&&{delta:i},range:s}}class e8 extends ce.SemanticTokensBuilder{constructor(){super(...arguments),this._tokens=[]}push(e,n,r,i,s){this._tokens.push({line:e,char:n,length:r,tokenType:i,tokenModifiers:s})}build(){return this.applyTokens(),super.build()}buildEdits(){
|
|
1139
1139
|
return this.applyTokens(),super.buildEdits()}flush(){this.previousResult(this.id)}applyTokens(){for(const e of this._tokens.sort(this.compareTokens))super.push(e.line,e.char,e.length,e.tokenType,e.tokenModifiers);this._tokens=[]}compareTokens(e,n){return e.line===n.line?e.char-n.char:e.line-n.line}}class t8{constructor(e){this.tokensBuilders=new Map,e.shared.workspace.TextDocuments.onDidClose(n=>{this.tokensBuilders.delete(n.document.uri)}),e.shared.lsp.LanguageServer.onInitialize(n=>{var r;this.
|
|
1140
|
-
initialize((r=n.capabilities.textDocument)===null||r===void 0?void 0:r.semanticTokens)})}initialize(e){this.clientCapabilities=e}get tokenTypes(){return JG}get tokenModifiers(){return QG}get semanticTokensOptions(){return{legend:{tokenTypes:Object.keys(this.tokenTypes),tokenModifiers:Object.keys(this.tokenModifiers)},full:{delta:!0},range:!0}}async semanticHighlight(e,n,r=
|
|
1141
|
-
e),this.currentTokensBuilder.flush(),await this.computeHighlighting(e,this.createAcceptor(),r),this.currentTokensBuilder.build()}async semanticHighlightRange(e,n,r=
|
|
1140
|
+
initialize((r=n.capabilities.textDocument)===null||r===void 0?void 0:r.semanticTokens)})}initialize(e){this.clientCapabilities=e}get tokenTypes(){return JG}get tokenModifiers(){return QG}get semanticTokensOptions(){return{legend:{tokenTypes:Object.keys(this.tokenTypes),tokenModifiers:Object.keys(this.tokenModifiers)},full:{delta:!0},range:!0}}async semanticHighlight(e,n,r=mt.CancellationToken.None){return this.currentRange=void 0,this.currentDocument=e,this.currentTokensBuilder=this.getDocumentTokensBuilder(
|
|
1141
|
+
e),this.currentTokensBuilder.flush(),await this.computeHighlighting(e,this.createAcceptor(),r),this.currentTokensBuilder.build()}async semanticHighlightRange(e,n,r=mt.CancellationToken.None){return this.currentRange=n.range,this.currentDocument=e,this.currentTokensBuilder=this.getDocumentTokensBuilder(e),this.currentTokensBuilder.flush(),await this.computeHighlighting(e,this.createAcceptor(),r),this.currentTokensBuilder.build()}async semanticHighlightDelta(e,n,r=mt.CancellationToken.None){return this.
|
|
1142
1142
|
currentRange=void 0,this.currentDocument=e,this.currentTokensBuilder=this.getDocumentTokensBuilder(e),this.currentTokensBuilder.previousResult(n.previousResultId),await this.computeHighlighting(e,this.createAcceptor(),r),this.currentTokensBuilder.buildEdits()}createAcceptor(){return n=>{"line"in n?this.highlightToken({range:{start:{line:n.line,character:n.char},end:{line:n.line,character:n.char+n.length}},type:n.type,modifier:n.modifier}):"range"in n?this.highlightToken(n):"keyword"in n?this.highlightKeyword(
|
|
1143
1143
|
n):"property"in n?this.highlightProperty(n):this.highlightNode({node:n.cst,type:n.type,modifier:n.modifier})}}getDocumentTokensBuilder(e){const n=this.tokensBuilders.get(e.uri.toString());if(n)return n;const r=new e8;return this.tokensBuilders.set(e.uri.toString(),r),r}async computeHighlighting(e,n,r){const i=e.parseResult.value,s=ci(i,{range:this.currentRange}).iterator();let o;do if(o=s.next(),!o.done){await jt(r);const a=o.value;this.highlightElement(a,n)==="prune"&&s.prune()}while(!o.done)}highlightToken(e){
|
|
1144
1144
|
var n;const{range:r,type:i}=e;let s=e.modifier;if(this.currentRange&&!Xb(r,this.currentRange)||!this.currentDocument||!this.currentTokensBuilder)return;const o=this.tokenTypes[i];let a=0;if(s!==void 0){typeof s=="string"&&(s=[s]);for(const l of s){const f=this.tokenModifiers[l];a|=f}}const u=r.start.line,c=r.end.line;if(u===c){const l=r.start.character,f=r.end.character-l;this.currentTokensBuilder.push(u,l,f,o,a)}else if(!((n=this.clientCapabilities)===null||n===void 0)&&n.multilineTokenSupport){
|
|
1145
1145
|
const l=r.start.character,f=this.currentDocument.textDocument.offsetAt(r.start),d=this.currentDocument.textDocument.offsetAt(r.end);this.currentTokensBuilder.push(u,l,d-f,o,a)}else{const l=r.start;let f=this.currentDocument.textDocument.offsetAt({line:u+1,character:0});this.currentTokensBuilder.push(l.line,l.character,f-l.character-1,o,a);for(let d=u+1;d<c;d++){const p=f;f=this.currentDocument.textDocument.offsetAt({line:d+1,character:0}),this.currentTokensBuilder.push(d,0,f-p-1,o,a)}this.currentTokensBuilder.
|
|
1146
|
-
push(c,0,r.end.character,o,a)}}highlightProperty(e){const n=[];if(typeof e.index=="number"){const s=pn(e.node.$cstNode,e.property,e.index);s&&n.push(s)}else n.push(...Ho(e.node.$cstNode,e.property));const{type:r,modifier:i}=e;for(const s of n)this.highlightNode({node:s,type:r,modifier:i})}highlightKeyword(e){const{node:n,keyword:r,type:i,index:s,modifier:o}=e,a=[];if(typeof s=="number"){const u=Pu(n.$cstNode,r,s);u&&a.push(u)}else a.push(...
|
|
1146
|
+
push(c,0,r.end.character,o,a)}}highlightProperty(e){const n=[];if(typeof e.index=="number"){const s=pn(e.node.$cstNode,e.property,e.index);s&&n.push(s)}else n.push(...Ho(e.node.$cstNode,e.property));const{type:r,modifier:i}=e;for(const s of n)this.highlightNode({node:s,type:r,modifier:i})}highlightKeyword(e){const{node:n,keyword:r,type:i,index:s,modifier:o}=e,a=[];if(typeof s=="number"){const u=Pu(n.$cstNode,r,s);u&&a.push(u)}else a.push(...rg(n.$cstNode,r));for(const u of a)this.highlightNode({
|
|
1147
1147
|
node:u,type:i,modifier:o})}highlightNode(e){const{node:n,type:r,modifier:i}=e,s=n.range;this.highlightToken({range:s,type:r,modifier:i})}}var _T;(function(t){function e(r,i,s){const o=new Map;Object.entries(i).forEach(([c,l])=>o.set(l,c));let a=0,u=0;return n(r.data,5).map(c=>{a+=c[0],c[0]!==0&&(u=0),u+=c[1];const l=c[2];return{offset:s.textDocument.offsetAt({line:a,character:u}),tokenType:o.get(c[3]),tokenModifiers:c[4],text:s.textDocument.getText({start:{line:a,character:u},end:{line:a,character:u+
|
|
1148
1148
|
l}})}})}t.decode=e;function n(r,i){const s=[];for(let o=0;o<r.length;o+=i){const a=r.slice(o,o+i);s.push(a)}return s}})(_T||(_T={}));function n8(t){const e=[],n=[];t.forEach(i=>{i?.triggerCharacters&&e.push(...i.triggerCharacters),i?.retriggerCharacters&&n.push(...i.retriggerCharacters)});const r={triggerCharacters:e.length>0?Array.from(new Set(e)).sort():void 0,retriggerCharacters:n.length>0?Array.from(new Set(n)).sort():void 0};return r.triggerCharacters?r:void 0}class r8{constructor(e){this.onInitializeEmitter=
|
|
1149
|
-
new _p.Emitter,this.onInitializedEmitter=new _p.Emitter,this.services=e}get onInitialize(){return this.onInitializeEmitter.event}get onInitialized(){return this.onInitializedEmitter.event}async initialize(e){return this.eagerLoadServices(),this.fireInitializeOnDefaultServices(e),this.onInitializeEmitter.fire(e),this.onInitializeEmitter.dispose(),this.buildInitializeResult(e)}eagerLoadServices(){
|
|
1149
|
+
new _p.Emitter,this.onInitializedEmitter=new _p.Emitter,this.services=e}get onInitialize(){return this.onInitializeEmitter.event}get onInitialized(){return this.onInitializedEmitter.event}async initialize(e){return this.eagerLoadServices(),this.fireInitializeOnDefaultServices(e),this.onInitializeEmitter.fire(e),this.onInitializeEmitter.dispose(),this.buildInitializeResult(e)}eagerLoadServices(){Iy(this.services),this.services.ServiceRegistry.all.forEach(e=>Iy(e))}hasService(e){return this.services.
|
|
1150
1150
|
ServiceRegistry.all.some(r=>e(r)!==void 0)}buildInitializeResult(e){var n,r,i,s;const o=this.services.lsp.DocumentUpdateHandler,a=(n=this.services.lsp.FileOperationHandler)===null||n===void 0?void 0:n.fileOperationOptions,u=this.services.ServiceRegistry.all,c=this.hasService(z=>{var C;return(C=z.lsp)===null||C===void 0?void 0:C.Formatter}),l=u.map(z=>{var C,ne;return(ne=(C=z.lsp)===null||C===void 0?void 0:C.Formatter)===null||ne===void 0?void 0:ne.formatOnTypeOptions}).find(z=>!!z),f=this.hasService(
|
|
1151
1151
|
z=>{var C;return(C=z.lsp)===null||C===void 0?void 0:C.CodeActionProvider}),d=this.hasService(z=>{var C;return(C=z.lsp)===null||C===void 0?void 0:C.SemanticTokenProvider}),p=ZG(u.map(z=>{var C,ne;return(ne=(C=z.lsp)===null||C===void 0?void 0:C.SemanticTokenProvider)===null||ne===void 0?void 0:ne.semanticTokensOptions})),m=(i=(r=this.services.lsp)===null||r===void 0?void 0:r.ExecuteCommandHandler)===null||i===void 0?void 0:i.commands,w=this.hasService(z=>{var C;return(C=z.lsp)===null||C===void 0?void 0:
|
|
1152
1152
|
C.DocumentLinkProvider}),y=n8(u.map(z=>{var C,ne;return(ne=(C=z.lsp)===null||C===void 0?void 0:C.SignatureHelp)===null||ne===void 0?void 0:ne.signatureHelpOptions})),g=this.hasService(z=>{var C;return(C=z.lsp)===null||C===void 0?void 0:C.TypeProvider}),b=this.hasService(z=>{var C;return(C=z.lsp)===null||C===void 0?void 0:C.ImplementationProvider}),R=this.hasService(z=>{var C;return(C=z.lsp)===null||C===void 0?void 0:C.CompletionProvider}),A=GG(u.map(z=>{var C,ne;return(ne=(C=z.lsp)===null||C===void 0?
|
|
@@ -1158,8 +1158,8 @@ callHierarchyProvider:T?{}:void 0,typeHierarchyProvider:D?{}:void 0,documentLink
|
|
|
1158
1158
|
initialize(e),this.services.workspace.WorkspaceManager.initialize(e)}fireInitializedOnDefaultServices(e){const n=this.services.lsp.Connection,r=n?Object.assign(Object.assign({},e),{register:i=>n.client.register(_p.DidChangeConfigurationNotification.type,i),fetchConfiguration:i=>n.workspace.getConfiguration(i)}):e;this.services.workspace.ConfigurationProvider.initialized(r).catch(i=>console.error("Error in ConfigurationProvider initialization:",i)),this.services.workspace.WorkspaceManager.initialized(
|
|
1159
1159
|
e).catch(i=>console.error("Error in WorkspaceManager initialization:",i))}}class i8{getSymbolKind(e){return ce.SymbolKind.Field}getCompletionItemKind(e){return ce.CompletionItemKind.Reference}}class s8{constructor(e){this.nameProvider=e.references.NameProvider,this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}findReferences(e,n,r){const i=e.parseResult.value.$cstNode;if(!i)return[];const s=Ns(i,e.textDocument.offsetAt(n.position),this.grammarConfig.nameRegexp);return s?
|
|
1160
1160
|
this.getReferences(s,n,e):[]}getReferences(e,n,r){const i=[],s=this.references.findDeclaration(e);if(s){const o={includeDeclaration:n.context.includeDeclaration};this.references.findReferences(s,o).forEach(a=>{i.push(ce.Location.create(a.sourceUri.toString(),a.segment.range))})}return i}}class o8{constructor(e){this.references=e.references.References,this.nameProvider=e.references.NameProvider,this.grammarConfig=e.parser.GrammarConfig}async rename(e,n,r){const i={},s=e.parseResult.value.$cstNode;
|
|
1161
|
-
if(!s)return;const o=e.textDocument.offsetAt(n.position),a=Ns(s,o,this.grammarConfig.nameRegexp);if(!a)return;const u=this.references.findDeclaration(a);if(!u)return;const c={onlyLocal:!1,includeDeclaration:!0};return this.references.findReferences(u,c).forEach(f=>{const d=
|
|
1162
|
-
textDocument.offsetAt(n);if(r&&i){const s=Ns(r,i,this.grammarConfig.nameRegexp);if(!s)return;if(this.references.findDeclaration(s)||this.isNameNode(s))return s.range}}isNameNode(e){return e?.astNode&&Ep(e.astNode)&&e===this.nameProvider.getNameNode(e.astNode)}}class xT{constructor(e){this.indexManager=e.workspace.IndexManager,this.nodeKindProvider=e.lsp.NodeKindProvider,this.fuzzyMatcher=e.lsp.FuzzyMatcher}async getSymbols(e,n=
|
|
1161
|
+
if(!s)return;const o=e.textDocument.offsetAt(n.position),a=Ns(s,o,this.grammarConfig.nameRegexp);if(!a)return;const u=this.references.findDeclaration(a);if(!u)return;const c={onlyLocal:!1,includeDeclaration:!0};return this.references.findReferences(u,c).forEach(f=>{const d=Mn.replace(f.segment.range,n.newName),p=f.sourceUri.toString();i[p]?i[p].push(d):i[p]=[d]}),{changes:i}}prepareRename(e,n,r){return this.renameNodeRange(e,n.position)}renameNodeRange(e,n){const r=e.parseResult.value.$cstNode,i=e.
|
|
1162
|
+
textDocument.offsetAt(n);if(r&&i){const s=Ns(r,i,this.grammarConfig.nameRegexp);if(!s)return;if(this.references.findDeclaration(s)||this.isNameNode(s))return s.range}}isNameNode(e){return e?.astNode&&Ep(e.astNode)&&e===this.nameProvider.getNameNode(e.astNode)}}class xT{constructor(e){this.indexManager=e.workspace.IndexManager,this.nodeKindProvider=e.lsp.NodeKindProvider,this.fuzzyMatcher=e.lsp.FuzzyMatcher}async getSymbols(e,n=mt.CancellationToken.None){const r=[],i=e.query.toLowerCase();for(const s of this.
|
|
1163
1163
|
indexManager.allElements())if(await jt(n),this.fuzzyMatcher.match(i,s.name)){const o=this.getWorkspaceSymbol(s);o&&r.push(o)}return r}getWorkspaceSymbol(e){const n=e.nameSegment;if(n)return{kind:this.nodeKindProvider.getSymbolKind(e),name:e.name,location:{range:n.range,uri:e.documentUri.toString()}}}}class PT{constructor(e){this._configuration=e,this._syncedDocuments=new Map,this._onDidChangeContent=new ce.Emitter,this._onDidOpen=new ce.Emitter,this._onDidClose=new ce.Emitter,this._onDidSave=new ce.
|
|
1164
1164
|
Emitter,this._onWillSave=new ce.Emitter}get onDidOpen(){return this._onDidOpen.event}get onDidChangeContent(){return this._onDidChangeContent.event}get onWillSave(){return this._onWillSave.event}onWillSaveWaitUntil(e){this._willSaveWaitUntil=e}get onDidSave(){return this._onDidSave.event}get onDidClose(){return this._onDidClose.event}get(e){return this._syncedDocuments.get(ct.normalize(e))}set(e){const n=ct.normalize(e.uri);let r=!0;this._syncedDocuments.has(n)&&(r=!1),this._syncedDocuments.set(
|
|
1165
1165
|
n,e);const i=Object.freeze({document:e});return this._onDidOpen.fire(i),this._onDidChangeContent.fire(i),r}delete(e){const n=ct.normalize(typeof e=="object"&&"uri"in e?e.uri:e),r=this._syncedDocuments.get(n);r!==void 0&&(this._syncedDocuments.delete(n),this._onDidClose.fire(Object.freeze({document:r})))}all(){return Array.from(this._syncedDocuments.values())}keys(){return Array.from(this._syncedDocuments.keys())}listen(e){e.__textDocumentSync=ce.TextDocumentSyncKind.Incremental;const n=[];return n.
|
|
@@ -1188,11 +1188,11 @@ tabs,f=i.indentation;i.indentation+=l??0;const d=[];return u!==void 0?e?.hidden|
|
|
|
1188
1188
|
fitIntoOptions(n,s,i);const a=(r.options.insertSpaces?" ".repeat(r.options.tabSize):" ").repeat(r.indentation);return{newText:`${`
|
|
1189
1189
|
`.repeat(n)}${a}`,range:e}}createTabTextEdit(e,n,r){const s=(r.options.insertSpaces?" ".repeat(r.options.tabSize):" ").repeat(r.indentation),o=n?1:0,a=Math.max(e.end.line-e.start.line,o);return{newText:`${`
|
|
1190
1190
|
`.repeat(a)}${s}`,range:e}}fitIntoOptions(e,n,r){return r.allowMore?e=Math.max(n,e):r.allowLess&&(e=Math.min(n,e)),e}findFittingMove(e,n,r){if(n.length===0)return;if(n.length===1)return n[0];const i=e.end.line-e.start.line;for(const s of n){if(s.lines!==void 0&&i<=s.lines)return s;if(s.lines===void 0&&i===0)return s}return n[n.length-1]}iterateCstTree(e,n){const i=e.parseResult.value.$cstNode;return i?new jo(i,s=>this.iterateCst(s,n)):Ja}iterateCst(e,n){if(!Vi(e))return Ja;const r=n.indentation;
|
|
1191
|
-
return new Jt(()=>({index:0}),i=>i.index<e.content.length?{done:!1,value:e.content[i.index++]}:(n.indentation=r,
|
|
1192
|
-
$cstNode,r);n.push(...i)}return new Fr(n,this.collector)}keyword(e,n){const r=Pu(this.astNode.$cstNode,e,n);return new Fr(r?[r]:[],this.collector)}keywords(...e){const n=[];for(const r of e){const i=
|
|
1191
|
+
return new Jt(()=>({index:0}),i=>i.index<e.content.length?{done:!1,value:e.content[i.index++]}:(n.indentation=r,Pn))}}class p8{constructor(e,n){this.astNode=e,this.collector=n}node(e){return new Fr(e.$cstNode?[e.$cstNode]:[],this.collector)}nodes(...e){const n=[];for(const r of e)r.$cstNode&&n.push(r.$cstNode);return new Fr(n,this.collector)}property(e,n){const r=pn(this.astNode.$cstNode,e,n);return new Fr(r?[r]:[],this.collector)}properties(...e){const n=[];for(const r of e){const i=Ho(this.astNode.
|
|
1192
|
+
$cstNode,r);n.push(...i)}return new Fr(n,this.collector)}keyword(e,n){const r=Pu(this.astNode.$cstNode,e,n);return new Fr(r?[r]:[],this.collector)}keywords(...e){const n=[];for(const r of e){const i=rg(this.astNode.$cstNode,r);n.push(...i)}return new Fr(n,this.collector)}cst(e){return new Fr([...e],this.collector)}interior(e,n){const r=e.nodes,i=n.nodes;if(r.length!==1||i.length!==1)return new Fr([],this.collector);let s=r[0],o=i[0];if(s.offset>o.offset){const a=s;s=o,o=a}return new Fr(dN(s,o),this.
|
|
1193
1193
|
collector)}}class Fr{constructor(e,n){this.nodes=e,this.collector=n}prepend(e){for(const n of this.nodes)this.collector(n,"prepend",e);return this}append(e){for(const n of this.nodes)this.collector(n,"append",e);return this}surround(e){for(const n of this.nodes)this.collector(n,"prepend",e),this.collector(n,"append",e);return this}slice(e,n){return new Fr(this.nodes.slice(e,n),this.collector)}}var is;(function(t){function e(...l){return{options:{},moves:l.flatMap(f=>f.moves).sort(c)}}t.fit=e;function n(l){
|
|
1194
1194
|
return i(0,l)}t.noSpace=n;function r(l){return i(1,l)}t.oneSpace=r;function i(l,f){return{options:f??{},moves:[{characters:l}]}}t.spaces=i;function s(l){return o(1,l)}t.newLine=s;function o(l,f){return{options:f??{},moves:[{lines:l}]}}t.newLines=o;function a(l){return{options:l??{},moves:[{tabs:1,lines:1}]}}t.indent=a;function u(l){return{options:l??{},moves:[{tabs:0}]}}t.noIndent=u;function c(l,f){var d,p,m,w,y,g;const b=(d=l.lines)!==null&&d!==void 0?d:0,R=(p=f.lines)!==null&&p!==void 0?p:0,A=(m=
|
|
1195
|
-
l.tabs)!==null&&m!==void 0?m:0,N=(w=f.tabs)!==null&&w!==void 0?w:0,V=(y=l.characters)!==null&&y!==void 0?y:0,J=(g=f.characters)!==null&&g!==void 0?g:0;return b<R?-1:b>R?1:A<N?-1:A>N?1:V<J?-1:V>J?1:0}})(is||(is={}));var
|
|
1195
|
+
l.tabs)!==null&&m!==void 0?m:0,N=(w=f.tabs)!==null&&w!==void 0?w:0,V=(y=l.characters)!==null&&y!==void 0?y:0,J=(g=f.characters)!==null&&g!==void 0?g:0;return b<R?-1:b>R?1:A<N?-1:A>N?1:V<J?-1:V>J?1:0}})(is||(is={}));var Qy,NT;function h8(){return NT||(NT=1,Qy=bT()),Qy}h8();var fo={},Lc={},Fc={},po={},Ar={},Sr={},IT;function OT(){if(IT)return Sr;IT=1,Object.defineProperty(Sr,"__esModule",{value:!0}),Sr.normalizePath=Sr.isRootDirectory=Sr.convertSlashes=Sr.cleanPath=void 0;const t=zi;function e(a){
|
|
1196
1196
|
let u=(0,t.normalize)(a);return u.length>1&&u[u.length-1]===t.sep&&(u=u.substring(0,u.length-1)),u}Sr.cleanPath=e;const n=/[\\/]/g;function r(a,u){return a.replace(n,u)}Sr.convertSlashes=r;const i=/^[a-z]:[\\/]$/i;function s(a){return a==="/"||i.test(a)}Sr.isRootDirectory=s;function o(a,u){const{resolvePaths:c,normalizePath:l,pathSeparator:f}=u,d=process.platform==="win32"&&a.includes("/")||a.startsWith(".");if(c&&(a=(0,t.resolve)(a)),(l||d)&&(a=e(a)),a===".")return"";const p=a[a.length-1]!==f;return r(
|
|
1197
1197
|
p?a+f:a,f)}return Sr.normalizePath=o,Sr}var Si={},LT;function m8(){if(LT)return Si;LT=1,Object.defineProperty(Si,"__esModule",{value:!0}),Si.build=Si.joinDirectoryPath=Si.joinPathWithBasePath=void 0;const t=zi,e=OT();function n(a,u){return u+a}Si.joinPathWithBasePath=n;function r(a,u){return function(c,l){return l.startsWith(a)?l.replace(a,"")+c:(0,e.convertSlashes)((0,t.relative)(a,l),u.pathSeparator)+u.pathSeparator+c}}function i(a){return a}function s(a,u,c){return u+a+c}Si.joinDirectoryPath=
|
|
1198
1198
|
s;function o(a,u){const{relativePaths:c,includeBasePath:l}=u;return c&&a?r(a,u):l?n:i}return Si.build=o,Si}var Mc={},FT;function g8(){if(FT)return Mc;FT=1,Object.defineProperty(Mc,"__esModule",{value:!0}),Mc.build=void 0;function t(o){return function(a,u){u.push(a.substring(o.length)||".")}}function e(o){return function(a,u,c){const l=a.substring(o.length)||".";c.every(f=>f(l,!0))&&u.push(l)}}const n=(o,a)=>{a.push(o||".")},r=(o,a,u)=>{const c=o||".";u.every(l=>l(c,!0))&&a.push(c)},i=()=>{};function s(o,a){
|
|
@@ -1211,21 +1211,21 @@ b),this.groupFiles=c.build(b),this.resolveSymlink=l.build(b,this.isSynchronous),
|
|
|
1211
1211
|
controller:D}=this.state;if(D.signal.aborted||we&&we.aborted||ie&&A.length>ie)return;const F=this.getArray(this.state.paths);for(let x=0;x<g.length;++x){const _=g[x];if(_.isFile()||_.isSymbolicLink()&&!V&&!J){const I=this.joinPath(_.name,b);this.pushFile(I,F,this.state.counts,N)}else if(_.isDirectory()){let I=s.joinDirectoryPath(_.name,b,this.state.options.pathSeparator);if(se&&se(_.name,I))continue;this.pushDirectory(I,A,N),this.walkDirectory(this.state,I,I,R-1,this.walk)}else if(this.resolveSymlink&&
|
|
1212
1212
|
_.isSymbolicLink()){let I=s.joinPathWithBasePath(_.name,b);this.resolveSymlink(I,this.state,(te,z)=>{if(te.isDirectory()){if(z=(0,i.normalizePath)(z,this.state.options),se&&se(_.name,M?z:I+T))return;this.walkDirectory(this.state,z,M?z:I+T,R-1,this.walk)}else{z=M?z:I;const C=(0,r.basename)(z),ne=(0,i.normalizePath)((0,r.dirname)(z),this.state.options);z=this.joinPath(C,ne),this.pushFile(z,F,this.state.counts,N)}})}}this.groupFiles(this.state.groups,b,F)}}return Ar.Walker=w,Ar}var VT;function k8(){
|
|
1213
1213
|
if(VT)return po;VT=1,Object.defineProperty(po,"__esModule",{value:!0}),po.callback=po.promise=void 0;const t=KT();function e(r,i){return new Promise((s,o)=>{n(r,i,(a,u)=>{if(a)return o(a);s(u)})})}po.promise=e;function n(r,i,s){new t.Walker(r,i,s).start()}return po.callback=n,po}var zc={},XT;function T8(){if(XT)return zc;XT=1,Object.defineProperty(zc,"__esModule",{value:!0}),zc.sync=void 0;const t=KT();function e(n,r){return new t.Walker(n,r).start()}return zc.sync=e,zc}var YT;function C8(){if(YT)
|
|
1214
|
-
return Fc;YT=1,Object.defineProperty(Fc,"__esModule",{value:!0}),Fc.APIBuilder=void 0;const t=k8(),e=T8();class n{root;options;constructor(i,s){this.root=i,this.options=s}withPromise(){return(0,t.promise)(this.root,this.options)}withCallback(i){(0,t.callback)(this.root,this.options,i)}sync(){return(0,e.sync)(this.root,this.options)}}return Fc.APIBuilder=n,Fc}var
|
|
1214
|
+
return Fc;YT=1,Object.defineProperty(Fc,"__esModule",{value:!0}),Fc.APIBuilder=void 0;const t=k8(),e=T8();class n{root;options;constructor(i,s){this.root=i,this.options=s}withPromise(){return(0,t.promise)(this.root,this.options)}withCallback(i){(0,t.callback)(this.root,this.options,i)}sync(){return(0,e.sync)(this.root,this.options)}}return Fc.APIBuilder=n,Fc}var Zy={},ev,JT;function xp(){if(JT)return ev;JT=1;const t="\\\\/",e=`[^${t}]`,n="\\.",r="\\+",i="\\?",s="\\/",o="(?=.)",a="[^/]",u=`(?:${s}\
|
|
1215
1215
|
|$)`,c=`(?:^|${s})`,l=`${n}{1,2}${u}`,f=`(?!${n})`,d=`(?!${c}${l})`,p=`(?!${n}{0,1}${u})`,m=`(?!${l})`,w=`[^.${s}]`,y=`${a}*?`,b={DOT_LITERAL:n,PLUS_LITERAL:r,QMARK_LITERAL:i,SLASH_LITERAL:s,ONE_CHAR:o,QMARK:a,END_ANCHOR:u,DOTS_SLASH:l,NO_DOT:f,NO_DOTS:d,NO_DOT_SLASH:p,NO_DOTS_SLASH:m,QMARK_NO_DOT:w,STAR:y,START_ANCHOR:c,SEP:"/"},R={...b,SLASH_LITERAL:`[${t}]`,QMARK:e,STAR:`${e}*?`,DOTS_SLASH:`${n}{1,2}(?:[${t}]|$)`,NO_DOT:`(?!${n})`,NO_DOTS:`(?!(?:^|[${t}])${n}{1,2}(?:[${t}]|$))`,NO_DOT_SLASH:`\
|
|
1216
|
-
(?!${n}{0,1}(?:[${t}]|$))`,NO_DOTS_SLASH:`(?!${n}{1,2}(?:[${t}]|$))`,QMARK_NO_DOT:`[^.${t}]`,START_ANCHOR:`(?:^|[${t}])`,END_ANCHOR:`(?:[${t}]|$)`,SEP:"\\"},A={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};return
|
|
1216
|
+
(?!${n}{0,1}(?:[${t}]|$))`,NO_DOTS_SLASH:`(?!${n}{1,2}(?:[${t}]|$))`,QMARK_NO_DOT:`[^.${t}]`,START_ANCHOR:`(?:^|[${t}])`,END_ANCHOR:`(?:[${t}]|$)`,SEP:"\\"},A={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};return ev={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:A,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,
|
|
1217
1217
|
REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,
|
|
1218
1218
|
CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,
|
|
1219
|
-
CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(N){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${N.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(N){return N===!0?R:b}},
|
|
1219
|
+
CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(N){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${N.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(N){return N===!0?R:b}},ev}var QT;function Pp(){return QT||(QT=1,function(t){const{REGEX_BACKSLASH:e,REGEX_REMOVE_BACKSLASH:n,
|
|
1220
1220
|
REGEX_SPECIAL_CHARS:r,REGEX_SPECIAL_CHARS_GLOBAL:i}=xp();t.isObject=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),t.hasRegexChars=s=>r.test(s),t.isRegexChar=s=>s.length===1&&t.hasRegexChars(s),t.escapeRegex=s=>s.replace(i,"\\$1"),t.toPosixSlashes=s=>s.replace(e,"/"),t.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){const s=navigator.platform.toLowerCase();return s==="win32"||s==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1},t.removeBackslashes=
|
|
1221
1221
|
s=>s.replace(n,o=>o==="\\"?"":o),t.escapeLast=(s,o,a)=>{const u=s.lastIndexOf(o,a);return u===-1?s:s[u-1]==="\\"?t.escapeLast(s,o,u-1):`${s.slice(0,u)}\\${s.slice(u)}`},t.removePrefix=(s,o={})=>{let a=s;return a.startsWith("./")&&(a=a.slice(2),o.prefix="./"),a},t.wrapOutput=(s,o={},a={})=>{const u=a.contains?"":"^",c=a.contains?"":"$";let l=`${u}(?:${s})${c}`;return o.negated===!0&&(l=`(?:^(?!${l}).*$)`),l},t.basename=(s,{windows:o}={})=>{const a=s.split(o?/[\\/]/:"/"),u=a[a.length-1];return u===
|
|
1222
|
-
""?a[a.length-2]:u}}(
|
|
1222
|
+
""?a[a.length-2]:u}}(Zy)),Zy}var tv,ZT;function A8(){if(ZT)return tv;ZT=1;const t=Pp(),{CHAR_ASTERISK:e,CHAR_AT:n,CHAR_BACKWARD_SLASH:r,CHAR_COMMA:i,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:o,CHAR_FORWARD_SLASH:a,CHAR_LEFT_CURLY_BRACE:u,CHAR_LEFT_PARENTHESES:c,CHAR_LEFT_SQUARE_BRACKET:l,CHAR_PLUS:f,CHAR_QUESTION_MARK:d,CHAR_RIGHT_CURLY_BRACE:p,CHAR_RIGHT_PARENTHESES:m,CHAR_RIGHT_SQUARE_BRACKET:w}=xp(),y=R=>R===a||R===r,g=R=>{R.isPrefix!==!0&&(R.depth=R.isGlobstar?1/0:1)};return tv=(R,A)=>{const N=A||{},
|
|
1223
1223
|
V=R.length-1,J=N.parts===!0||N.scanToEnd===!0,se=[],ie=[],we=[];let M=R,T=-1,D=0,F=0,x=!1,_=!1,I=!1,te=!1,z=!1,C=!1,ne=!1,ye=!1,Ie=!1,L=!1,K=0,_e,le,$e={value:"",depth:0,isGlob:!1};const xe=()=>T>=V,fe=()=>M.charCodeAt(T+1),O=()=>(_e=le,M.charCodeAt(++T));for(;T<V;){le=O();let Ke;if(le===r){ne=$e.backslashes=!0,le=O(),le===u&&(C=!0);continue}if(C===!0||le===u){for(K++;xe()!==!0&&(le=O());){if(le===r){ne=$e.backslashes=!0,O();continue}if(le===u){K++;continue}if(C!==!0&&le===s&&(le=O())===s){if(x=
|
|
1224
1224
|
$e.isBrace=!0,I=$e.isGlob=!0,L=!0,J===!0)continue;break}if(C!==!0&&le===i){if(x=$e.isBrace=!0,I=$e.isGlob=!0,L=!0,J===!0)continue;break}if(le===p&&(K--,K===0)){C=!1,x=$e.isBrace=!0,L=!0;break}}if(J===!0)continue;break}if(le===a){if(se.push(T),ie.push($e),$e={value:"",depth:0,isGlob:!1},L===!0)continue;if(_e===s&&T===D+1){D+=2;continue}F=T+1;continue}if(N.noext!==!0&&(le===f||le===n||le===e||le===d||le===o)===!0&&fe()===c){if(I=$e.isGlob=!0,te=$e.isExtglob=!0,L=!0,le===o&&T===D&&(Ie=!0),J===!0){for(;xe()!==
|
|
1225
1225
|
!0&&(le=O());){if(le===r){ne=$e.backslashes=!0,le=O();continue}if(le===m){I=$e.isGlob=!0,L=!0;break}}continue}break}if(le===e){if(_e===e&&(z=$e.isGlobstar=!0),I=$e.isGlob=!0,L=!0,J===!0)continue;break}if(le===d){if(I=$e.isGlob=!0,L=!0,J===!0)continue;break}if(le===l){for(;xe()!==!0&&(Ke=O());){if(Ke===r){ne=$e.backslashes=!0,O();continue}if(Ke===w){_=$e.isBracket=!0,I=$e.isGlob=!0,L=!0;break}}if(J===!0)continue;break}if(N.nonegate!==!0&&le===o&&T===D){ye=$e.negated=!0,D++;continue}if(N.noparen!==
|
|
1226
1226
|
!0&&le===c){if(I=$e.isGlob=!0,J===!0){for(;xe()!==!0&&(le=O());){if(le===c){ne=$e.backslashes=!0,le=O();continue}if(le===m){L=!0;break}}continue}break}if(I===!0){if(L=!0,J===!0)continue;break}}N.noext===!0&&(te=!1,I=!1);let G=M,he="",U="";D>0&&(he=M.slice(0,D),M=M.slice(D),F-=D),G&&I===!0&&F>0?(G=M.slice(0,F),U=M.slice(F)):I===!0?(G="",U=M):G=M,G&&G!==""&&G!=="/"&&G!==M&&y(G.charCodeAt(G.length-1))&&(G=G.slice(0,-1)),N.unescape===!0&&(U&&(U=t.removeBackslashes(U)),G&&ne===!0&&(G=t.removeBackslashes(
|
|
1227
1227
|
G)));const pe={prefix:he,input:R,start:D,base:G,glob:U,isBrace:x,isBracket:_,isGlob:I,isExtglob:te,isGlobstar:z,negated:ye,negatedExtglob:Ie};if(N.tokens===!0&&(pe.maxDepth=0,y(le)||ie.push($e),pe.tokens=ie),N.parts===!0||N.tokens===!0){let Ke;for(let it=0;it<se.length;it++){const ue=Ke?Ke+1:D,Fe=se[it],re=R.slice(ue,Fe);N.tokens&&(it===0&&D!==0?(ie[it].isPrefix=!0,ie[it].value=he):ie[it].value=re,g(ie[it]),pe.maxDepth+=ie[it].depth),(it!==0||re!=="")&&we.push(re),Ke=Fe}if(Ke&&Ke+1<R.length){const it=R.
|
|
1228
|
-
slice(Ke+1);we.push(it),N.tokens&&(ie[ie.length-1].value=it,g(ie[ie.length-1]),pe.maxDepth+=ie[ie.length-1].depth)}pe.slashes=se,pe.parts=we}return pe},
|
|
1228
|
+
slice(Ke+1);we.push(it),N.tokens&&(ie[ie.length-1].value=it,g(ie[ie.length-1]),pe.maxDepth+=ie[ie.length-1].depth)}pe.slashes=se,pe.parts=we}return pe},tv}var nv,eC;function S8(){if(eC)return nv;eC=1;const t=xp(),e=Pp(),{MAX_LENGTH:n,POSIX_REGEX_SOURCE:r,REGEX_NON_SPECIAL_CHARS:i,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:o}=t,a=(l,f)=>{if(typeof f.expandRange=="function")return f.expandRange(...l,f);l.sort();const d=`[${l.join("-")}]`;try{new RegExp(d)}catch{return l.map(m=>e.escapeRegex(m)).join(
|
|
1229
1229
|
"..")}return d},u=(l,f)=>`Missing ${l}: "${f}" - use "\\\\${f}" to match literal characters`,c=(l,f)=>{if(typeof l!="string")throw new TypeError("Expected a string");l=o[l]||l;const d={...f},p=typeof d.maxLength=="number"?Math.min(n,d.maxLength):n;let m=l.length;if(m>p)throw new SyntaxError(`Input length: ${m}, exceeds maximum allowed length: ${p}`);const w={type:"bos",value:"",output:d.prepend||""},y=[w],g=d.capture?"":"?:",b=t.globChars(d.windows),R=t.extglobChars(b),{DOT_LITERAL:A,PLUS_LITERAL:N,
|
|
1230
1230
|
SLASH_LITERAL:V,ONE_CHAR:J,DOTS_SLASH:se,NO_DOT:ie,NO_DOT_SLASH:we,NO_DOTS_SLASH:M,QMARK:T,QMARK_NO_DOT:D,STAR:F,START_ANCHOR:x}=b,_=ue=>`(${g}(?:(?!${x}${ue.dot?se:A}).)*?)`,I=d.dot?"":ie,te=d.dot?T:D;let z=d.bash===!0?_(d):F;d.capture&&(z=`(${z})`),typeof d.noext=="boolean"&&(d.noextglob=d.noext);const C={input:l,index:-1,start:0,dot:d.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:y};l=e.removePrefix(l,C),m=l.length;const ne=[],
|
|
1231
1231
|
ye=[],Ie=[];let L=w,K;const _e=()=>C.index===m-1,le=C.peek=(ue=1)=>l[C.index+ue],$e=C.advance=()=>l[++C.index]||"",xe=()=>l.slice(C.index+1),fe=(ue="",Fe=0)=>{C.consumed+=ue,C.index+=Fe},O=ue=>{C.output+=ue.output!=null?ue.output:ue.value,fe(ue.value)},G=()=>{let ue=1;for(;le()==="!"&&(le(2)!=="("||le(3)==="?");)$e(),C.start++,ue++;return ue%2===0?!1:(C.negated=!0,C.start++,!0)},he=ue=>{C[ue]++,Ie.push(ue)},U=ue=>{C[ue]--,Ie.pop()},pe=ue=>{if(L.type==="globstar"){const Fe=C.braces>0&&(ue.type===
|
|
@@ -1249,52 +1249,52 @@ d)}${V})`,C.output=L.output,C.globstar=!0,fe(K+$e()),pe({type:"slash",value:"/",
|
|
|
1249
1249
|
"slash"||L.type==="dot")&&(L.type==="dot"?(C.output+=we,L.output+=we):d.dot===!0?(C.output+=M,L.output+=M):(C.output+=I,L.output+=I),le()!=="*"&&(C.output+=J,L.output+=J)),pe(Fe)}for(;C.brackets>0;){if(d.strictBrackets===!0)throw new SyntaxError(u("closing","]"));C.output=e.escapeLast(C.output,"["),U("brackets")}for(;C.parens>0;){if(d.strictBrackets===!0)throw new SyntaxError(u("closing",")"));C.output=e.escapeLast(C.output,"("),U("parens")}for(;C.braces>0;){if(d.strictBrackets===!0)throw new SyntaxError(
|
|
1250
1250
|
u("closing","}"));C.output=e.escapeLast(C.output,"{"),U("braces")}if(d.strictSlashes!==!0&&(L.type==="star"||L.type==="bracket")&&pe({type:"maybe_slash",value:"",output:`${V}?`}),C.backtrack===!0){C.output="";for(const ue of C.tokens)C.output+=ue.output!=null?ue.output:ue.value,ue.suffix&&(C.output+=ue.suffix)}return C};return c.fastpaths=(l,f)=>{const d={...f},p=typeof d.maxLength=="number"?Math.min(n,d.maxLength):n,m=l.length;if(m>p)throw new SyntaxError(`Input length: ${m}, exceeds maximum al\
|
|
1251
1251
|
lowed length: ${p}`);l=o[l]||l;const{DOT_LITERAL:w,SLASH_LITERAL:y,ONE_CHAR:g,DOTS_SLASH:b,NO_DOT:R,NO_DOTS:A,NO_DOTS_SLASH:N,STAR:V,START_ANCHOR:J}=t.globChars(d.windows),se=d.dot?A:R,ie=d.dot?N:R,we=d.capture?"":"?:",M={negated:!1,prefix:""};let T=d.bash===!0?".*?":V;d.capture&&(T=`(${T})`);const D=I=>I.noglobstar===!0?T:`(${we}(?:(?!${J}${I.dot?b:w}).)*?)`,F=I=>{switch(I){case"*":return`${se}${g}${T}`;case".*":return`${w}${g}${T}`;case"*.*":return`${se}${T}${w}${g}${T}`;case"*/*":return`${se}${T}${y}${g}${ie}${T}`;case"\
|
|
1252
|
-
**":return se+D(d);case"**/*":return`(?:${se}${D(d)}${y})?${ie}${g}${T}`;case"**/*.*":return`(?:${se}${D(d)}${y})?${ie}${T}${w}${g}${T}`;case"**/.*":return`(?:${se}${D(d)}${y})?${w}${g}${T}`;default:{const te=/^(.*?)\.(\w+)$/.exec(I);if(!te)return;const z=F(te[1]);return z?z+w+te[2]:void 0}}},x=e.removePrefix(l,M);let _=F(x);return _&&d.strictSlashes!==!0&&(_+=`${y}?`),_},
|
|
1252
|
+
**":return se+D(d);case"**/*":return`(?:${se}${D(d)}${y})?${ie}${g}${T}`;case"**/*.*":return`(?:${se}${D(d)}${y})?${ie}${T}${w}${g}${T}`;case"**/.*":return`(?:${se}${D(d)}${y})?${w}${g}${T}`;default:{const te=/^(.*?)\.(\w+)$/.exec(I);if(!te)return;const z=F(te[1]);return z?z+w+te[2]:void 0}}},x=e.removePrefix(l,M);let _=F(x);return _&&d.strictSlashes!==!0&&(_+=`${y}?`),_},nv=c,nv}var rv,tC;function nC(){if(tC)return rv;tC=1;const t=A8(),e=S8(),n=Pp(),r=xp(),i=o=>o&&typeof o=="object"&&!Array.isArray(
|
|
1253
1253
|
o),s=(o,a,u=!1)=>{if(Array.isArray(o)){const y=o.map(b=>s(b,a,u));return b=>{for(const R of y){const A=R(b);if(A)return A}return!1}}const c=i(o)&&o.tokens&&o.input;if(o===""||typeof o!="string"&&!c)throw new TypeError("Expected pattern to be a non-empty string");const l=a||{},f=l.windows,d=c?s.compileRe(o,a):s.makeRe(o,a,!1,!0),p=d.state;delete d.state;let m=()=>!1;if(l.ignore){const y={...a,ignore:null,onMatch:null,onResult:null};m=s(l.ignore,y,u)}const w=(y,g=!1)=>{const{isMatch:b,match:R,output:A}=s.
|
|
1254
1254
|
test(y,d,a,{glob:o,posix:f}),N={glob:o,state:p,regex:d,posix:f,input:y,output:A,match:R,isMatch:b};return typeof l.onResult=="function"&&l.onResult(N),b===!1?(N.isMatch=!1,g?N:!1):m(y)?(typeof l.onIgnore=="function"&&l.onIgnore(N),N.isMatch=!1,g?N:!1):(typeof l.onMatch=="function"&&l.onMatch(N),g?N:!0)};return u&&(w.state=p),w};return s.test=(o,a,u,{glob:c,posix:l}={})=>{if(typeof o!="string")throw new TypeError("Expected input to be a string");if(o==="")return{isMatch:!1,output:""};const f=u||{},
|
|
1255
1255
|
d=f.format||(l?n.toPosixSlashes:null);let p=o===c,m=p&&d?d(o):o;return p===!1&&(m=d?d(o):o,p=m===c),(p===!1||f.capture===!0)&&(f.matchBase===!0||f.basename===!0?p=s.matchBase(o,a,u,l):p=a.exec(m)),{isMatch:!!p,match:p,output:m}},s.matchBase=(o,a,u)=>(a instanceof RegExp?a:s.makeRe(a,u)).test(n.basename(o)),s.isMatch=(o,a,u)=>s(a,u)(o),s.parse=(o,a)=>Array.isArray(o)?o.map(u=>s.parse(u,a)):e(o,{...a,fastpaths:!1}),s.scan=(o,a)=>t(o,a),s.compileRe=(o,a,u=!1,c=!1)=>{if(u===!0)return o.output;const l=a||
|
|
1256
1256
|
{},f=l.contains?"":"^",d=l.contains?"":"$";let p=`${f}(?:${o.output})${d}`;o&&o.negated===!0&&(p=`^(?!${p}).*$`);const m=s.toRegex(p,a);return c===!0&&(m.state=o),m},s.makeRe=(o,a={},u=!1,c=!1)=>{if(!o||typeof o!="string")throw new TypeError("Expected a non-empty string");let l={negated:!1,fastpaths:!0};return a.fastpaths!==!1&&(o[0]==="."||o[0]==="*")&&(l.output=e.fastpaths(o,a)),l.output||(l=e(o,a)),s.compileRe(l,a,u,c)},s.toRegex=(o,a)=>{try{const u=a||{};return new RegExp(o,u.flags||(u.nocase?
|
|
1257
|
-
"i":""))}catch(u){if(a&&a.debug===!0)throw u;return/$^/}},s.constants=r,
|
|
1257
|
+
"i":""))}catch(u){if(a&&a.debug===!0)throw u;return/$^/}},s.constants=r,rv=s,rv}var iv,rC;function iC(){if(rC)return iv;rC=1;const t=nC(),e=Pp();function n(r,i,s=!1){return i&&(i.windows===null||i.windows===void 0)&&(i={...i,windows:e.isWindows()}),t(r,i,s)}return Object.assign(n,t),iv=n,iv}var sC;function _8(){if(sC)return Lc;sC=1,Object.defineProperty(Lc,"__esModule",{value:!0}),Lc.Builder=void 0;const t=zi,e=C8();var n=null;try{require.resolve("picomatch"),n=iC()}catch{}class r{globCache={};options={
|
|
1258
1258
|
maxDepth:1/0,suppressErrors:!0,pathSeparator:t.sep,filters:[]};globFunction;constructor(s){this.options={...this.options,...s},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(s){return this.options.pathSeparator=s,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(s){return this.options.maxDepth=s,this}withMaxFiles(s){
|
|
1259
1259
|
return this.options.maxFiles=s,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:s=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=s,this.withFullPaths()}withAbortSignal(s){return this.options.signal=s,this}normalize(){return this.options.normalizePath=!0,this}filter(s){return this.options.filters.push(s),this}onlyDirs(){return this.options.excludeFiles=
|
|
1260
1260
|
!0,this.options.includeDirs=!0,this}exclude(s){return this.options.exclude=s,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(s){return new e.APIBuilder(s||".",this.options)}withGlobFunction(s){return this.globFunction=s,this}crawlWithOptions(s,o){return this.options={...this.options,...o},new e.APIBuilder(s||".",this.options)}glob(...s){return this.globFunction?this.globWithOptions(s):this.globWithOptions(s,{dot:!0})}globWithOptions(s,...o){const a=this.globFunction||n;if(!a)throw new Error(
|
|
1261
|
-
"Please specify a glob function to use glob matching.");var u=this.globCache[s.join("\0")];return u||(u=a(s,...o),this.globCache[s.join("\0")]=u),this.options.filters.push(c=>u(c)),this}}return Lc.Builder=r,Lc}var
|
|
1261
|
+
"Please specify a glob function to use glob matching.");var u=this.globCache[s.join("\0")];return u||(u=a(s,...o),this.globCache[s.join("\0")]=u),this.options.filters.push(c=>u(c)),this}}return Lc.Builder=r,Lc}var sv={},oC;function x8(){return oC||(oC=1,Object.defineProperty(sv,"__esModule",{value:!0})),sv}var aC;function P8(){return aC||(aC=1,function(t){var e=fo&&fo.__createBinding||(Object.create?function(i,s,o,a){a===void 0&&(a=o);var u=Object.getOwnPropertyDescriptor(s,o);(!u||("get"in u?!s.
|
|
1262
1262
|
__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return s[o]}}),Object.defineProperty(i,a,u)}:function(i,s,o,a){a===void 0&&(a=o),i[a]=s[o]}),n=fo&&fo.__exportStar||function(i,s){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(s,o)&&e(s,i,o)};Object.defineProperty(t,"__esModule",{value:!0}),t.fdir=void 0;const r=_8();Object.defineProperty(t,"fdir",{enumerable:!0,get:function(){return r.Builder}}),n(x8(),t)}(fo)),fo}var N8=P8();class I8{constructor(){this.
|
|
1263
|
-
encoding="utf-8"}readFile(e){return Vw.promises.readFile(e.fsPath,this.encoding)}async readDirectory(e){return(await Vw.promises.readdir(e.fsPath,{withFileTypes:!0})).map(r=>({dirent:r,isFile:r.isFile(),isDirectory:r.isDirectory(),uri:ct.joinPath(e,r.name)}))}}const
|
|
1264
|
-
const Hc="DynamicViewRule";function
|
|
1265
|
-
t,yo)}const Bp="MetadataProperty";function ss(t){return H.isInstance(t,Bp)}const
|
|
1266
|
-
StringProperty";function zp(t){return H.isInstance(t,pa)}const ha="StyleProperty";function
|
|
1263
|
+
encoding="utf-8"}readFile(e){return Vw.promises.readFile(e.fsPath,this.encoding)}async readDirectory(e){return(await Vw.promises.readdir(e.fsPath,{withFileTypes:!0})).map(r=>({dirent:r,isFile:r.isFile(),isDirectory:r.isDirectory(),uri:ct.joinPath(e,r.name)}))}}const ov="ColorLiteral";function O8(t){return H.isInstance(t,ov)}const Np="DeploymentElement";function Ip(t){return H.isInstance(t,Np)}const av="DeploymentNodeOrElementKind",Op="DeploymentViewRule";function L8(t){return H.isInstance(t,Op)}
|
|
1264
|
+
const Hc="DynamicViewRule";function uv(t){return H.isInstance(t,Hc)}const go="ElementProperty";function F8(t){return H.isInstance(t,go)}const cv="ExpressionV2";function M8(t){return H.isInstance(t,cv)}const lv="ExtendElementProperty",Lp="FqnExpr";function uC(t){return H.isInstance(t,Lp)}const Fp="FqnExprOrWhere";function cC(t){return H.isInstance(t,Fp)}const Mp="FqnExprOrWith";function lC(t){return H.isInstance(t,Mp)}const dv="FqnReferenceable",yo="LikeC4View";function fv(t){return H.isInstance(
|
|
1265
|
+
t,yo)}const Bp="MetadataProperty";function ss(t){return H.isInstance(t,Bp)}const pv="ModelReferenceable",fa="Referenceable",qp="RelationExpr";function jp(t){return H.isInstance(t,qp)}const Gp="RelationExprOrWhere";function B8(t){return H.isInstance(t,Gp)}const Up="RelationExprOrWith";function q8(t){return H.isInstance(t,Up)}const Kc="RelationProperty",Wp="RelationshipStyleProperty";function dC(t){return H.isInstance(t,Wp)}const hv="SizeProperty";function j8(t){return H.isInstance(t,hv)}const pa="\
|
|
1266
|
+
StringProperty";function zp(t){return H.isInstance(t,pa)}const ha="StyleProperty";function mv(t){return H.isInstance(t,ha)}const Hp="ViewProperty";function G8(t){return H.isInstance(t,Hp)}const Vc="ViewRule";function U8(t){return H.isInstance(t,Vc)}const Kp="ViewRuleStyleOrGlobalRef";function gv(t){return H.isInstance(t,Kp)}const Xc="WhereElement";function fC(t){return H.isInstance(t,Xc)}const Yc="WhereElementExpression";function W8(t){return H.isInstance(t,Yc)}const pC="WhereExpression",Vp="Whe\
|
|
1267
1267
|
reKindEqual";function z8(t){return H.isInstance(t,Vp)}const Jc="WhereRelation";function hC(t){return H.isInstance(t,Jc)}const Qc="WhereRelationExpression";function H8(t){return H.isInstance(t,Qc)}const Xp="WhereTagEqual";function K8(t){return H.isInstance(t,Xp)}const Zc="ArrowProperty";function el(t){return H.isInstance(t,Zc)}const tl="BorderProperty";function Yp(t){return H.isInstance(t,tl)}const nl="ColorProperty";function vo(t){return H.isInstance(t,nl)}const wo="CustomColor",Jp="CustomElemen\
|
|
1268
|
-
tProperties";function V8(t){return H.isInstance(t,Jp)}const Qp="CustomRelationProperties";function X8(t){return H.isInstance(t,Qp)}const _i="DeployedInstance";function
|
|
1269
|
-
ntRelation";function xr(t){return H.isInstance(t,th)}const nh="DeploymentRelationBody";function J8(t){return H.isInstance(t,nh)}const rl="DeploymentView";function yC(t){return H.isInstance(t,rl)}const rh="DeploymentViewBody";function
|
|
1270
|
-
DynamicView";function vC(t){return H.isInstance(t,ga)}const ih="DynamicViewBody";function wC(t){return H.isInstance(t,ih)}const ul="DynamicViewGlobalPredicateRef";function bC(t){return H.isInstance(t,ul)}const cl="DynamicViewIncludePredicate";function EC(t){return H.isInstance(t,cl)}const sh="DynamicViewParallelSteps";function
|
|
1271
|
-
t,Zn)}const uh="ElementBody";function ch(t){return H.isInstance(t,uh)}const Pi="ElementKind";function $C(t){return H.isInstance(t,Pi)}const ll="ElementKindExpression";function RC(t){return H.isInstance(t,ll)}const lh="ElementRef";function
|
|
1272
|
-
ElementView";function dh(t){return H.isInstance(t,ya)}const fh="ElementViewBody";function
|
|
1273
|
-
ressions";function Z8(t){return H.isInstance(t,gh)}const yl="FqnExprWhere";function
|
|
1268
|
+
tProperties";function V8(t){return H.isInstance(t,Jp)}const Qp="CustomRelationProperties";function X8(t){return H.isInstance(t,Qp)}const _i="DeployedInstance";function jn(t){return H.isInstance(t,_i)}const Zp="DeployedInstanceBody";function mC(t){return H.isInstance(t,Zp)}const _r="DeploymentNode";function Cn(t){return H.isInstance(t,_r)}const eh="DeploymentNodeBody";function gC(t){return H.isInstance(t,eh)}const xi="DeploymentNodeKind";function Y8(t){return H.isInstance(t,xi)}const th="Deployme\
|
|
1269
|
+
ntRelation";function xr(t){return H.isInstance(t,th)}const nh="DeploymentRelationBody";function J8(t){return H.isInstance(t,nh)}const rl="DeploymentView";function yC(t){return H.isInstance(t,rl)}const rh="DeploymentViewBody";function yv(t){return H.isInstance(t,rh)}const il="DeploymentViewRulePredicate";function ma(t){return H.isInstance(t,il)}const sl="DeploymentViewRuleStyle";function ol(t){return H.isInstance(t,sl)}const al="DirectedRelationExpr";function Q8(t){return H.isInstance(t,al)}const ga="\
|
|
1270
|
+
DynamicView";function vC(t){return H.isInstance(t,ga)}const ih="DynamicViewBody";function wC(t){return H.isInstance(t,ih)}const ul="DynamicViewGlobalPredicateRef";function bC(t){return H.isInstance(t,ul)}const cl="DynamicViewIncludePredicate";function EC(t){return H.isInstance(t,cl)}const sh="DynamicViewParallelSteps";function vv(t){return H.isInstance(t,sh)}const wv="DynamicViewRef",oh="DynamicViewStep";function ah(t){return H.isInstance(t,oh)}const Zn="Element";function cn(t){return H.isInstance(
|
|
1271
|
+
t,Zn)}const uh="ElementBody";function ch(t){return H.isInstance(t,uh)}const Pi="ElementKind";function $C(t){return H.isInstance(t,Pi)}const ll="ElementKindExpression";function RC(t){return H.isInstance(t,ll)}const lh="ElementRef";function bv(t){return H.isInstance(t,lh)}const dl="ElementStringProperty";function fl(t){return H.isInstance(t,dl)}const pl="ElementStyleProperty";function hl(t){return H.isInstance(t,pl)}const ml="ElementTagExpression";function DC(t){return H.isInstance(t,ml)}const ya="\
|
|
1272
|
+
ElementView";function dh(t){return H.isInstance(t,ya)}const fh="ElementViewBody";function Ev(t){return H.isInstance(t,fh)}const $v="ElementViewRef",ph="Expressions";function kC(t){return H.isInstance(t,ph)}const gl="ExtendDeployment";function os(t){return H.isInstance(t,gl)}const hh="ExtendDeploymentBody";function Rv(t){return H.isInstance(t,hh)}const bo="ExtendElement";function Eo(t){return H.isInstance(t,bo)}const mh="ExtendElementBody";function Dv(t){return H.isInstance(t,mh)}const gh="FqnExp\
|
|
1273
|
+
ressions";function Z8(t){return H.isInstance(t,gh)}const yl="FqnExprWhere";function kv(t){return H.isInstance(t,yl)}const vl="FqnExprWith";function yh(t){return H.isInstance(t,vl)}const vh="FqnRef";function TC(t){return H.isInstance(t,vh)}const wl="FqnRefExpr";function Tv(t){return H.isInstance(t,wl)}const va="GlobalDynamicPredicateGroup";function bl(t){return H.isInstance(t,va)}const wa="GlobalPredicateGroup";function El(t){return H.isInstance(t,wa)}const ba="Globals";function Cv(t){return H.isInstance(
|
|
1274
1274
|
t,ba)}const wh="GlobalStyle";function Ea(t){return H.isInstance(t,wh)}const bh="GlobalStyleGroup";function $o(t){return H.isInstance(t,bh)}const $l="GlobalStyleId",Rl="HexColor";function eU(t){return H.isInstance(t,Rl)}const Dl="IconProperty";function as(t){return H.isInstance(t,Dl)}const us="Imported";function Zr(t){return H.isInstance(t,us)}const Eh="ImportsFromPoject";function kl(t){return H.isInstance(t,Eh)}const Tl="IncomingRelationExpr";function tU(t){return H.isInstance(t,Tl)}const Cl="In\
|
|
1275
|
-
OutRelationExpr";function CC(t){return H.isInstance(t,Cl)}const Ni="LibIcon";function nU(t){return H.isInstance(t,Ni)}const $h="LikeC4Grammar";function AC(t){return H.isInstance(t,$h)}const Rh="LikeC4Lib";function rU(t){return H.isInstance(t,Rh)}const Al="LineProperty";function Sl(t){return H.isInstance(t,Al)}const _l="LinkProperty";function xl(t){return H.isInstance(t,_l)}const Dh="MarkdownOrString";function
|
|
1276
|
-
t,Pl)}const Nl="MetadataBody";function sU(t){return H.isInstance(t,Nl)}const $a="Model";function SC(t){return H.isInstance(t,$a)}const Ra="ModelDeployments";function _C(t){return H.isInstance(t,Ra)}const Da="ModelViews";function Il(t){return H.isInstance(t,Da)}const Ol="MultipleProperty";function
|
|
1277
|
-
return H.isInstance(t,Fl)}const Ml="OpacityProperty";function Ch(t){return H.isInstance(t,Ml)}const Bl="OutgoingRelationExpr";function xC(t){return H.isInstance(t,Bl)}const ql="PaddingSizeProperty";function
|
|
1275
|
+
OutRelationExpr";function CC(t){return H.isInstance(t,Cl)}const Ni="LibIcon";function nU(t){return H.isInstance(t,Ni)}const $h="LikeC4Grammar";function AC(t){return H.isInstance(t,$h)}const Rh="LikeC4Lib";function rU(t){return H.isInstance(t,Rh)}const Al="LineProperty";function Sl(t){return H.isInstance(t,Al)}const _l="LinkProperty";function xl(t){return H.isInstance(t,_l)}const Dh="MarkdownOrString";function Av(t){return H.isInstance(t,Dh)}const Pl="MetadataAttribute";function iU(t){return H.isInstance(
|
|
1276
|
+
t,Pl)}const Nl="MetadataBody";function sU(t){return H.isInstance(t,Nl)}const $a="Model";function SC(t){return H.isInstance(t,$a)}const Ra="ModelDeployments";function _C(t){return H.isInstance(t,Ra)}const Da="ModelViews";function Il(t){return H.isInstance(t,Da)}const Ol="MultipleProperty";function Sv(t){return H.isInstance(t,Ol)}const kh="NavigateToProperty";function Th(t){return H.isInstance(t,kh)}const Ll="NotationProperty";function ka(t){return H.isInstance(t,Ll)}const Fl="NotesProperty";function _v(t){
|
|
1277
|
+
return H.isInstance(t,Fl)}const Ml="OpacityProperty";function Ch(t){return H.isInstance(t,Ml)}const Bl="OutgoingRelationExpr";function xC(t){return H.isInstance(t,Bl)}const ql="PaddingSizeProperty";function xv(t){return H.isInstance(t,ql)}const Ah="Relation";function ei(t){return H.isInstance(t,Ah)}const Sh="RelationBody";function oU(t){return H.isInstance(t,Sh)}const jl="RelationExprWhere";function Pv(t){return H.isInstance(t,jl)}const Gl="RelationExprWith";function Nv(t){return H.isInstance(t,
|
|
1278
1278
|
Gl)}const _h="RelationKindDotRef";function aU(t){return H.isInstance(t,_h)}const Ul="RelationNavigateToProperty";function Wl(t){return H.isInstance(t,Ul)}const cs="RelationshipKind";function PC(t){return H.isInstance(t,cs)}const zl="RelationStringProperty";function Hl(t){return H.isInstance(t,zl)}const Kl="RelationStyleProperty";function xh(t){return H.isInstance(t,Kl)}const Vl="RGBAColor";function uU(t){return H.isInstance(t,Vl)}const Xl="ShapeProperty";function Ph(t){return H.isInstance(t,Xl)}
|
|
1279
|
-
const Yl="ShapeSizeProperty";function
|
|
1280
|
-
onshipStringProperty";function IC(t){return H.isInstance(t,Ql)}const Pa="SpecificationRule";function OC(t){return H.isInstance(t,Pa)}const Na="SpecificationTag";function Zl(t){return H.isInstance(t,Na)}const Oh="StrictFqnElementRef";function
|
|
1281
|
-
t,Mh)}const td="TextSizeProperty";function
|
|
1279
|
+
const Yl="ShapeSizeProperty";function Iv(t){return H.isInstance(t,Yl)}const Nh="SpecificationColor";function Ih(t){return H.isInstance(t,Nh)}const Ta="SpecificationDeploymentNodeKind";function Ca(t){return H.isInstance(t,Ta)}const Aa="SpecificationElementKind";function Sa(t){return H.isInstance(t,Aa)}const Jl="SpecificationElementStringProperty";function NC(t){return H.isInstance(t,Jl)}const _a="SpecificationRelationshipKind";function xa(t){return H.isInstance(t,_a)}const Ql="SpecificationRelati\
|
|
1280
|
+
onshipStringProperty";function IC(t){return H.isInstance(t,Ql)}const Pa="SpecificationRule";function OC(t){return H.isInstance(t,Pa)}const Na="SpecificationTag";function Zl(t){return H.isInstance(t,Na)}const Oh="StrictFqnElementRef";function Ov(t){return H.isInstance(t,Oh)}const Lh="StrictFqnRef";function LC(t){return H.isInstance(t,Lh)}const ls="Tag";function ed(t){return H.isInstance(t,ls)}const Fh="TagRef";function FC(t){return H.isInstance(t,Fh)}const Mh="Tags";function MC(t){return H.isInstance(
|
|
1281
|
+
t,Mh)}const td="TextSizeProperty";function Lv(t){return H.isInstance(t,td)}const Fv="ViewRef",nd="ViewRuleAutoLayout";function rd(t){return H.isInstance(t,nd)}const id="ViewRuleGlobalPredicateRef";function Mv(t){return H.isInstance(t,id)}const sd="ViewRuleGlobalStyle";function Bv(t){return H.isInstance(t,sd)}const od="ViewRuleGroup";function ad(t){return H.isInstance(t,od)}const ud="ViewRulePredicate";function cd(t){return H.isInstance(t,ud)}const ld="ViewRuleStyle";function Ia(t){return H.isInstance(
|
|
1282
1282
|
t,ld)}const dd="ViewStringProperty";function Bh(t){return H.isInstance(t,dd)}const fd="WhereBinaryExpression";function cU(t){return H.isInstance(t,fd)}const pd="WhereElementKind";function lU(t){return H.isInstance(t,pd)}const hd="WhereElementNegation";function BC(t){return H.isInstance(t,hd)}const md="WhereElementTag";function dU(t){return H.isInstance(t,md)}const gd="WhereRelationKind";function qC(t){return H.isInstance(t,gd)}const yd="WhereRelationNegation";function jC(t){return H.isInstance(t,
|
|
1283
|
-
yd)}const vd="WhereRelationParticipantKind";function GC(t){return H.isInstance(t,vd)}const wd="WhereRelationParticipantTag";function UC(t){return H.isInstance(t,wd)}const bd="WhereRelationTag";function fU(t){return H.isInstance(t,bd)}const Ed="WildcardExpression";function WC(t){return H.isInstance(t,Ed)}class zC extends Kb{getAllTypes(){return[Zc,tl,
|
|
1284
|
-
yl,vl,gh,vh,wl,
|
|
1285
|
-
return this.isSubtype(Np,n)||this.isSubtype(fa,n);case xi:case Pi:return this.isSubtype(
|
|
1286
|
-
return this.isSubtype(go,n);case gl:case bo:case fa:return this.isSubtype(
|
|
1287
|
-
return this.isSubtype(pa,n);case Nl:return this.isSubtype(Bp,n);case Bp:return this.isSubtype(go,n)||this.isSubtype(
|
|
1283
|
+
yd)}const vd="WhereRelationParticipantKind";function GC(t){return H.isInstance(t,vd)}const wd="WhereRelationParticipantTag";function UC(t){return H.isInstance(t,wd)}const bd="WhereRelationTag";function fU(t){return H.isInstance(t,bd)}const Ed="WildcardExpression";function WC(t){return H.isInstance(t,Ed)}class zC extends Kb{getAllTypes(){return[Zc,tl,ov,nl,wo,Jp,Qp,_i,Zp,Np,_r,eh,xi,av,th,nh,rl,rh,Op,il,sl,al,ga,ih,ul,cl,sh,wv,Hc,oh,Zn,uh,Pi,ll,go,lh,dl,pl,ml,ya,fh,$v,cv,ph,gl,hh,bo,mh,lv,Lp,Fp,Mp,
|
|
1284
|
+
yl,vl,gh,vh,wl,dv,va,wa,wh,bh,$l,ba,Rl,Dl,us,Eh,Cl,Tl,Ni,$h,Rh,yo,Al,_l,Dh,Pl,Nl,Bp,$a,Ra,pv,Da,Ol,kh,Ll,Fl,Ml,Bl,ql,Vl,fa,Ah,Sh,qp,Gp,Up,jl,Gl,_h,Ul,Kc,zl,Kl,cs,Wp,Xl,Yl,hv,Nh,Ta,Aa,Jl,_a,Ql,Pa,Na,Oh,Lh,pa,ha,ls,Fh,Mh,td,Hp,Fv,Vc,nd,id,sd,od,ud,ld,Kp,dd,fd,Xc,Yc,pd,hd,md,pC,Vp,Jc,Qc,gd,yd,vd,wd,bd,Xp,Ed]}computeIsSubtype(e,n){switch(e){case Zc:case Al:return this.isSubtype(Wp,n);case tl:case Ol:case Ml:case Xl:return this.isSubtype(ha,n);case nl:return this.isSubtype(Wp,n)||this.isSubtype(ha,n);case _i:case _r:
|
|
1285
|
+
return this.isSubtype(Np,n)||this.isSubtype(fa,n);case xi:case Pi:return this.isSubtype(av,n);case rl:case ga:case ya:return this.isSubtype(yo,n);case il:case sl:return this.isSubtype(Op,n);case al:case Tl:case Cl:case Bl:return this.isSubtype(qp,n);case ul:case cl:return this.isSubtype(Hc,n);case Zn:return this.isSubtype(dv,n)||this.isSubtype(pv,n)||this.isSubtype(fa,n);case ll:case ml:case wl:case Ed:return this.isSubtype(Lp,n);case dl:return this.isSubtype(go,n)||this.isSubtype(pa,n);case pl:
|
|
1286
|
+
return this.isSubtype(go,n);case gl:case bo:case fa:return this.isSubtype(dv,n);case Lp:case yl:return this.isSubtype(Fp,n);case Fp:case vl:return this.isSubtype(Mp,n);case Mp:case Up:return this.isSubtype(cv,n);case Rl:case Vl:return this.isSubtype(ov,n);case Dl:return this.isSubtype(go,n)||this.isSubtype(ha,n);case us:return this.isSubtype(pv,n)||this.isSubtype(fa,n);case _l:return this.isSubtype(go,n)||this.isSubtype(lv,n)||this.isSubtype(Kc,n)||this.isSubtype(Hp,n);case Pl:case Ll:case Fl:case Jl:case Ql:
|
|
1287
|
+
return this.isSubtype(pa,n);case Nl:return this.isSubtype(Bp,n);case Bp:return this.isSubtype(go,n)||this.isSubtype(lv,n)||this.isSubtype(Kc,n);case ql:case Yl:case td:return this.isSubtype(hv,n)||this.isSubtype(ha,n);case qp:case jl:return this.isSubtype(Gp,n);case Gp:case Gl:return this.isSubtype(Up,n);case Ul:case Kl:return this.isSubtype(Kc,n);case zl:return this.isSubtype(Kc,n)||this.isSubtype(pa,n);case nd:return this.isSubtype(Op,n)||this.isSubtype(Hc,n)||this.isSubtype(Vc,n);case id:case od:case ud:
|
|
1288
1288
|
return this.isSubtype(Vc,n);case sd:case ld:return this.isSubtype(Kp,n);case Kp:return this.isSubtype(Hc,n)||this.isSubtype(Vc,n);case dd:return this.isSubtype(pa,n)||this.isSubtype(Hp,n);case fd:return this.isSubtype(Yc,n)||this.isSubtype(Qc,n);case Xc:case hd:return this.isSubtype(Yc,n);case Yc:case Qc:return this.isSubtype(pC,n);case pd:return this.isSubtype(Xc,n)||this.isSubtype(Vp,n);case md:return this.isSubtype(Xc,n)||this.isSubtype(Xp,n);case Jc:case yd:return this.isSubtype(Qc,n);case gd:case vd:
|
|
1289
1289
|
return this.isSubtype(Vp,n)||this.isSubtype(Jc,n);case wd:case bd:return this.isSubtype(Jc,n)||this.isSubtype(Xp,n);default:return!1}}getReferenceType(e){const n=`${e.container.$type}:${e.property}`;switch(n){case"ColorProperty:customColor":return wo;case"DeploymentNode:kind":return xi;case"DeploymentRelation:kind":case"DynamicViewStep:kind":case"OutgoingRelationExpr:kind":case"Relation:kind":case"RelationKindDotRef:kind":case"WhereRelationKind:value":return cs;case"DynamicViewGlobalPredicateRef\
|
|
1290
1290
|
:predicate":return va;case"DynamicViewRef:view":return ga;case"Element:kind":case"ElementKindExpression:kind":return Pi;case"ElementViewRef:view":return ya;case"FqnRef:value":case"StrictFqnRef:value":return fa;case"IconProperty:libicon":return Ni;case"Imported:imported":case"StrictFqnElementRef:el":return Zn;case"TagRef:tag":return ls;case"ViewRef:view":return yo;case"ViewRuleGlobalPredicateRef:predicate":return wa;case"ViewRuleGlobalStyle:style":return $l;case"WhereElementKind:value":case"Where\
|
|
1291
|
-
RelationParticipantKind:value":return
|
|
1291
|
+
RelationParticipantKind:value":return av;default:throw new Error(`${n} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case Zc:return{name:Zc,properties:[{name:"key"},{name:"value"}]};case tl:return{name:tl,properties:[{name:"key"},{name:"value"}]};case nl:return{name:nl,properties:[{name:"customColor"},{name:"key"},{name:"themeColor"}]};case wo:return{name:wo,properties:[{name:"name"}]};case Jp:return{name:Jp,properties:[{name:"props",defaultValue:[]}]};case Qp:return{name:Qp,properties:[
|
|
1292
1292
|
{name:"props",defaultValue:[]}]};case _i:return{name:_i,properties:[{name:"body"},{name:"name"},{name:"target"},{name:"title"}]};case Zp:return{name:Zp,properties:[{name:"elements",defaultValue:[]},{name:"props",defaultValue:[]},{name:"tags"}]};case _r:return{name:_r,properties:[{name:"body"},{name:"kind"},{name:"name"},{name:"title"}]};case eh:return{name:eh,properties:[{name:"elements",defaultValue:[]},{name:"props",defaultValue:[]},{name:"tags"}]};case xi:return{name:xi,properties:[{name:"nam\
|
|
1293
1293
|
e"}]};case th:return{name:th,properties:[{name:"body"},{name:"description"},{name:"dotKind"},{name:"kind"},{name:"source"},{name:"tags"},{name:"target"},{name:"technology"},{name:"title"}]};case nh:return{name:nh,properties:[{name:"props",defaultValue:[]},{name:"tags"}]};case rl:return{name:rl,properties:[{name:"body"},{name:"name"}]};case rh:return{name:rh,properties:[{name:"props",defaultValue:[]},{name:"rules",defaultValue:[]},{name:"tags"}]};case il:return{name:il,properties:[{name:"expr"},{
|
|
1294
1294
|
name:"isInclude",defaultValue:!1}]};case sl:return{name:sl,properties:[{name:"props",defaultValue:[]},{name:"targets"}]};case al:return{name:al,properties:[{name:"source"},{name:"target"}]};case ga:return{name:ga,properties:[{name:"body"},{name:"name"}]};case ih:return{name:ih,properties:[{name:"props",defaultValue:[]},{name:"rules",defaultValue:[]},{name:"steps",defaultValue:[]},{name:"tags"}]};case ul:return{name:ul,properties:[{name:"predicate"}]};case cl:return{name:cl,properties:[{name:"exp\
|
|
1295
|
-
rs"}]};case sh:return{name:sh,properties:[{name:"steps",defaultValue:[]}]};case
|
|
1295
|
+
rs"}]};case sh:return{name:sh,properties:[{name:"steps",defaultValue:[]}]};case wv:return{name:wv,properties:[{name:"view"}]};case oh:return{name:oh,properties:[{name:"custom"},{name:"dotKind"},{name:"isBackward",defaultValue:!1},{name:"kind"},{name:"source"},{name:"target"},{name:"title"}]};case Zn:return{name:Zn,properties:[{name:"body"},{name:"kind"},{name:"name"},{name:"props",defaultValue:[]}]};case uh:return{name:uh,properties:[{name:"elements",defaultValue:[]},{name:"props",defaultValue:[]},
|
|
1296
1296
|
{name:"tags"}]};case Pi:return{name:Pi,properties:[{name:"name"}]};case ll:return{name:ll,properties:[{name:"isEqual",defaultValue:!1},{name:"kind"}]};case lh:return{name:lh,properties:[{name:"modelElement"}]};case dl:return{name:dl,properties:[{name:"key"},{name:"value"}]};case pl:return{name:pl,properties:[{name:"key"},{name:"props",defaultValue:[]}]};case ml:return{name:ml,properties:[{name:"isEqual",defaultValue:!1},{name:"tag"}]};case ya:return{name:ya,properties:[{name:"body"},{name:"exten\
|
|
1297
|
-
ds"},{name:"name"},{name:"viewOf"}]};case fh:return{name:fh,properties:[{name:"props",defaultValue:[]},{name:"rules",defaultValue:[]},{name:"tags"}]};case
|
|
1297
|
+
ds"},{name:"name"},{name:"viewOf"}]};case fh:return{name:fh,properties:[{name:"props",defaultValue:[]},{name:"rules",defaultValue:[]},{name:"tags"}]};case $v:return{name:$v,properties:[{name:"view"}]};case ph:return{name:ph,properties:[{name:"prev"},{name:"value"}]};case gl:return{name:gl,properties:[{name:"body"},{name:"deploymentNode"}]};case hh:return{name:hh,properties:[{name:"elements",defaultValue:[]},{name:"props",defaultValue:[]},{name:"tags"}]};case bo:return{name:bo,properties:[{name:"\
|
|
1298
1298
|
body"},{name:"element"}]};case mh:return{name:mh,properties:[{name:"elements",defaultValue:[]},{name:"props",defaultValue:[]},{name:"tags"}]};case gh:return{name:gh,properties:[{name:"prev"},{name:"value"}]};case yl:return{name:yl,properties:[{name:"subject"},{name:"where"}]};case vl:return{name:vl,properties:[{name:"custom"},{name:"subject"}]};case vh:return{name:vh,properties:[{name:"parent"},{name:"value"}]};case wl:return{name:wl,properties:[{name:"ref"},{name:"selector"}]};case va:return{name:va,
|
|
1299
1299
|
properties:[{name:"name"},{name:"predicates",defaultValue:[]}]};case wa:return{name:wa,properties:[{name:"name"},{name:"predicates",defaultValue:[]}]};case ba:return{name:ba,properties:[{name:"name"},{name:"predicates",defaultValue:[]},{name:"styles",defaultValue:[]}]};case wh:return{name:wh,properties:[{name:"id"},{name:"props",defaultValue:[]},{name:"targets"}]};case bh:return{name:bh,properties:[{name:"id"},{name:"styles",defaultValue:[]}]};case $l:return{name:$l,properties:[{name:"name"}]};case Rl:
|
|
1300
1300
|
return{name:Rl,properties:[{name:"hex"}]};case Dl:return{name:Dl,properties:[{name:"key"},{name:"libicon"},{name:"value"}]};case us:return{name:us,properties:[{name:"imported"},{name:"prev"}]};case Eh:return{name:Eh,properties:[{name:"imports"},{name:"project"}]};case Tl:return{name:Tl,properties:[{name:"to"}]};case Cl:return{name:Cl,properties:[{name:"inout"}]};case Ni:return{name:Ni,properties:[{name:"name"}]};case $h:return{name:$h,properties:[{name:"deployments",defaultValue:[]},{name:"globa\
|
|
@@ -1304,8 +1304,8 @@ properties:[{name:"key"},{name:"value"}]};case Ll:return{name:Ll,properties:[{na
|
|
|
1304
1304
|
dotKind"},{name:"kind"},{name:"source"},{name:"tags"},{name:"target"},{name:"technology"},{name:"title"}]};case Sh:return{name:Sh,properties:[{name:"props",defaultValue:[]},{name:"tags"}]};case jl:return{name:jl,properties:[{name:"subject"},{name:"where"}]};case Gl:return{name:Gl,properties:[{name:"custom"},{name:"subject"}]};case _h:return{name:_h,properties:[{name:"kind"}]};case Ul:return{name:Ul,properties:[{name:"key"},{name:"value"}]};case cs:return{name:cs,properties:[{name:"name"}]};case zl:
|
|
1305
1305
|
return{name:zl,properties:[{name:"key"},{name:"value"}]};case Kl:return{name:Kl,properties:[{name:"key"},{name:"props",defaultValue:[]}]};case Vl:return{name:Vl,properties:[{name:"alpha"},{name:"blue"},{name:"green"},{name:"red"}]};case Xl:return{name:Xl,properties:[{name:"key"},{name:"value"}]};case Yl:return{name:Yl,properties:[{name:"key"},{name:"value"}]};case Nh:return{name:Nh,properties:[{name:"color"},{name:"name"}]};case Ta:return{name:Ta,properties:[{name:"kind"},{name:"props",defaultValue:[]},
|
|
1306
1306
|
{name:"tags"}]};case Aa:return{name:Aa,properties:[{name:"kind"},{name:"props",defaultValue:[]},{name:"tags"}]};case Jl:return{name:Jl,properties:[{name:"key"},{name:"value"}]};case _a:return{name:_a,properties:[{name:"kind"},{name:"props",defaultValue:[]}]};case Ql:return{name:Ql,properties:[{name:"key"},{name:"value"}]};case Pa:return{name:Pa,properties:[{name:"colors",defaultValue:[]},{name:"deploymentNodes",defaultValue:[]},{name:"elements",defaultValue:[]},{name:"name"},{name:"relationships",
|
|
1307
|
-
defaultValue:[]},{name:"tags",defaultValue:[]}]};case Na:return{name:Na,properties:[{name:"color"},{name:"tag"}]};case Oh:return{name:Oh,properties:[{name:"el"},{name:"parent"}]};case Lh:return{name:Lh,properties:[{name:"parent"},{name:"value"}]};case ls:return{name:ls,properties:[{name:"name"}]};case Fh:return{name:Fh,properties:[{name:"tag"}]};case Mh:return{name:Mh,properties:[{name:"prev"},{name:"values",defaultValue:[]}]};case td:return{name:td,properties:[{name:"key"},{name:"value"}]};case
|
|
1308
|
-
return{name:
|
|
1307
|
+
defaultValue:[]},{name:"tags",defaultValue:[]}]};case Na:return{name:Na,properties:[{name:"color"},{name:"tag"}]};case Oh:return{name:Oh,properties:[{name:"el"},{name:"parent"}]};case Lh:return{name:Lh,properties:[{name:"parent"},{name:"value"}]};case ls:return{name:ls,properties:[{name:"name"}]};case Fh:return{name:Fh,properties:[{name:"tag"}]};case Mh:return{name:Mh,properties:[{name:"prev"},{name:"values",defaultValue:[]}]};case td:return{name:td,properties:[{name:"key"},{name:"value"}]};case Fv:
|
|
1308
|
+
return{name:Fv,properties:[{name:"view"}]};case nd:return{name:nd,properties:[{name:"direction"},{name:"nodeSep"},{name:"rankSep"}]};case id:return{name:id,properties:[{name:"predicate"}]};case sd:return{name:sd,properties:[{name:"style"}]};case od:return{name:od,properties:[{name:"groupRules",defaultValue:[]},{name:"props",defaultValue:[]},{name:"title"}]};case ud:return{name:ud,properties:[{name:"exprs"},{name:"isInclude",defaultValue:!1}]};case ld:return{name:ld,properties:[{name:"props",defaultValue:[]},
|
|
1309
1309
|
{name:"targets"}]};case dd:return{name:dd,properties:[{name:"key"},{name:"value"}]};case fd:return{name:fd,properties:[{name:"left"},{name:"operator"},{name:"right"}]};case pd:return{name:pd,properties:[{name:"not",defaultValue:!1},{name:"operator"},{name:"value"}]};case hd:return{name:hd,properties:[{name:"value"}]};case md:return{name:md,properties:[{name:"not",defaultValue:!1},{name:"operator"},{name:"value"}]};case gd:return{name:gd,properties:[{name:"not",defaultValue:!1},{name:"operator"},
|
|
1310
1310
|
{name:"value"}]};case yd:return{name:yd,properties:[{name:"value"}]};case vd:return{name:vd,properties:[{name:"not",defaultValue:!1},{name:"operator"},{name:"participant"},{name:"value"}]};case wd:return{name:wd,properties:[{name:"not",defaultValue:!1},{name:"operator"},{name:"participant"},{name:"value"}]};case bd:return{name:bd,properties:[{name:"not",defaultValue:!1},{name:"operator"},{name:"value"}]};case Ed:return{name:Ed,properties:[{name:"isWildcard",defaultValue:!1}]};default:return{name:e,
|
|
1311
1311
|
properties:[]}}}}const H=new zC;let HC;const pU=()=>HC??(HC=N4(`{"$type":"Grammar","isDeclared":true,"name":"LikeC4","rules":[{"$type":"ParserRule","entry":true,"name":"LikeC4Grammar","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"imports","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Assignment","feature":"specifications","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"argumen\
|
|
@@ -1518,7 +1518,7 @@ SimpleType","typeRef":{"$ref":"#/rules@65"}}]}},{"$type":"Type","name":"Deployme
|
|
|
1518
1518
|
elements@0/inferredType"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@95/definition/elements@2/elements@0/inferredType"}}]}},{"$type":"Type","name":"WhereKindEqual","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@89/definition/elements@1/elements@0/inferredType"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@95/definition/elements@1/elements@0/inferredType"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@95/definition/elements@3/elements@0/infer\
|
|
1519
1519
|
redType"}}]}},{"$type":"Type","name":"WhereExpression","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@84"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@90"}}]}},{"$type":"Type","name":"DeploymentElement","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@97"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@99"}}]}},{"$type":"Type","name":"FqnReferenceable","type":{"$type":"UnionType","types":[{"$type":"SimpleType","\
|
|
1520
1520
|
typeRef":{"$ref":"#/types@1"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@20"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@24"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@101"}}]}},{"$type":"Type","name":"SizeProperty","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@125"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@126"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@127"}}]}}],"definesHiddenTokens":false,"hiddenTokens":[],"import\
|
|
1521
|
-
s":[],"interfaces":[],"usedGrammars":[]}`)),
|
|
1521
|
+
s":[],"interfaces":[],"usedGrammars":[]}`)),qv={languageId:"likec4",fileExtensions:[".c4",".likec4",".like-c4"],caseInsensitive:!1,mode:"production"},hU={skipValidations:!0,recoveryEnabled:!0,nodeLocationTracking:"full"},mU={AstReflection:()=>new zC},gU={Grammar:()=>pU(),LanguageMetaData:()=>qv,parser:{ParserConfig:()=>hU}},yU=[...Object.entries({aws:["activate","alexa-for-business","amplify","apache-mxnet-on-aws","api-gateway","app-config","app-flow","app-mesh","app-runner","app-stream","app-sy\
|
|
1522
1522
|
nc","application-auto-scaling","application-composer","application-cost-profiler","application-discovery-service","application-migration-service","artifact","athena","audit-manager","augmented-ai-a2i","aurora","auto-scaling","backint-agent","backup","batch","billing-conductor","bottlerocket","braket","budgets","certificate-manager","chatbot","chime","chime-sdk","chime-voice-connector","clean-rooms","client-vpn","cloud-control-api","cloud-development-kit","cloud-directory","cloud-formation","clou\
|
|
1523
1523
|
d-front","cloud-hsm","cloud-map","cloud-search","cloud-shell","cloud-trail","cloud-wan","cloud-watch","cloud9","code-artifact","code-build","code-catalyst","code-commit","code-deploy","code-guru","code-pipeline","code-star","code-whisperer","cognito","command-line-interface","comprehend","comprehend-medical","compute-optimizer","config","connect","console-mobile-application","control-tower","corretto","cost-and-usage-report","cost-explorer","data-exchange","data-pipeline","data-sync","data-zone",
|
|
1524
1524
|
"database-migration-service","deep-composer","deep-learning-amis","deep-learning-containers","deep-lens","deep-racer","detective","dev-ops-guru","device-farm","direct-connect","directory-service","distro-for-open-telemetry","document-db","dynamo-db","ec2","ec2-auto-scaling","ec2-image-builder","ecs-anywhere","efs","eks-anywhere","eks-cloud","eks-distro","elasti-cache","elastic-beanstalk","elastic-block-store","elastic-container-registry","elastic-container-service","elastic-disaster-recovery","e\
|
|
@@ -1570,22 +1570,22 @@ as","kibana","knex-js","knockout","kotlin","krakenjs","ktor","kubernetes","labvi
|
|
|
1570
1570
|
cript","pytest","python","python-poetry","pytorch","qodana","qt","quarkus","quasar","qwik","r","rabbitmq","rancher","raspberrypi","reach","react","react-bootstrap","realm","red-cube-s-epic-compiler-thingy-programming-re-ct","redhat","redis","redux","ren-py","rider","robot-operating-system-ros","rocksdb","rollup-js","rspec","rstudio","ruby","ruby-mine","ruby-on-rails","rust","salesforce","sanity","sass","scala","scalingo","sdl","selenium","sema-software","sequelize","shopware","sketch","slack","s\
|
|
1571
1571
|
ocket-io","solid-js","solidity","sonarqube","sourcetree","spark","splunk","spring","sql-developer","sqlalchemy","sqlite","ssh","stackoverflow","stata","storybook","streamlit","stylus","subversion","svelte","swagger","swift","symfony","tailwind-css","tauri","tensorflow","terraform","tex","the-algorithms","three-js","titanium-sdk","tomcat","tortoise-git","tower","traefik-mesh","traefik-proxy","travis-ci","trello","twitter","typescript","typo3","ubuntu","uml","unity","unix","unreal-engine","uwsgi",
|
|
1572
1572
|
"v8","vagrant","vala","vercel","veutify","vim","visualstudio","vite","vitejs","vscode","vsphere","vue","vue-storefront","vyper","webassembly","webflow","weblate","webpack","webstorm","windows8","windows11","woo-commerce","wordpress","xamarin","xcode","xml","yaml","yarn","yii-framework","yuno-host","zend-framework","zig"]})].flatMap(([t,e])=>e.map(n=>t+":"+n)),KC=["likec4lib {"," icons {",...yU.map(t=>" "+t)," }","}"].join(`
|
|
1573
|
-
`),VC="likec4builtin",vU=`${VC}:///likec4/lib/icons.c4`;function $d(t){return t.scheme===VC}const st=Wn.getChild("server");function Rd(t){st.error(Un(t))}function De(t){st.warn(Un(t))}var
|
|
1573
|
+
`),VC="likec4builtin",vU=`${VC}:///likec4/lib/icons.c4`;function $d(t){return t.scheme===VC}const st=Wn.getChild("server");function Rd(t){st.error(Un(t))}function De(t){st.warn(Un(t))}var jv,XC;function wU(){return XC||(XC=1,jv=nC()),jv}var bU=wU();const YC=vi(bU),EU=/^[\s\w\0+.-]{2,}:([/\\]{1,2})/,JC=/^[\s\w\0+.-]{2,}:([/\\]{2})?/,$U=/^([/\\]\s*){2,}[^/\\]/,RU=/^\.?\//;function Gv(t){return["./","../"].some(e=>t.startsWith(e))}function ds(t,e={}){return typeof e=="boolean"&&(e={acceptRelative:e}),
|
|
1574
1574
|
e.strict?EU.test(t):JC.test(t)||(e.acceptRelative?$U.test(t):!1)}function DU(t="",e){return t.endsWith("/")}function kU(t="",e){return(DU(t)?t.slice(0,-1):t)||"/"}function QC(t="",e){return t.endsWith("/")?t:t+"/"}function Dd(t=""){return t.startsWith("/")}function ZC(t=""){return(Dd(t)?t.slice(1):t)||"/"}function TU(t=""){return Dd(t)?t:"/"+t}function CU(t,e){if(AU(e))return t;const n=kU(e);if(!t.startsWith(n))return t;const r=t.slice(n.length);return r[0]==="/"?r:"/"+r}function AU(t){return!t||
|
|
1575
1575
|
t==="/"}function SU(t){return t&&t!=="/"}function eA(t,...e){let n=t||"";for(const r of e.filter(i=>SU(i)))if(n){const i=r.replace(RU,"");n=QC(n)+i}else n=r;return n}function qh(...t){const e=/\/(?!\/)/,n=t.filter(Boolean),r=[];let i=0;for(const o of n)if(!(!o||o==="/")){for(const[a,u]of o.split(e).entries())if(!(!u||u===".")){if(u===".."){if(r.length===1&&ds(r[0]))continue;r.pop(),i--;continue}if(a===1&&r[r.length-1]?.endsWith(":/")){r[r.length-1]+="/"+u;continue}r.push(u),i++}}let s=r.join("/");
|
|
1576
|
-
return i>=0?n[0]?.startsWith("/")&&!s.startsWith("/")?s="/"+s:n[0]?.startsWith("./")&&!s.startsWith("./")&&(s="./"+s):s="../".repeat(-1*i)+s,n[n.length-1]?.endsWith("/")&&!s.endsWith("/")&&(s+="/"),s}function tA(t){return
|
|
1576
|
+
return i>=0?n[0]?.startsWith("/")&&!s.startsWith("/")?s="/"+s:n[0]?.startsWith("./")&&!s.startsWith("./")&&(s="./"+s):s="../".repeat(-1*i)+s,n[n.length-1]?.endsWith("/")&&!s.endsWith("/")&&(s+="/"),s}function tA(t){return Uv(t,"")}function Uv(t,e){let n=t.match(JC);return n||(n=t.match(/^\/{2,}/)),n?e+t.slice(n[0].length):e+t}const _U=Symbol.for("ufo:protocolRelative");function xU(t="",e){const n=t.match(/^[\s\0]*(blob:|data:|javascript:|vbscript:)(.*)/i);if(n){const[,f,d=""]=n;return{protocol:f.
|
|
1577
1577
|
toLowerCase(),pathname:d,href:f+d,auth:"",host:"",search:"",hash:""}}if(!ds(t,{acceptRelative:!0}))return Oa(t);const[,r="",i,s=""]=t.replace(/\\/g,"/").match(/^[\s\0]*([\w+.-]{2,}:)?\/\/([^/@]+@)?(.*)/)||[];let[,o="",a=""]=s.match(/([^#/?]*)(.*)?/)||[];r==="file:"&&(a=a.replace(/\/(?=[A-Za-z]:)/,""));const{pathname:u,search:c,hash:l}=Oa(a);return{protocol:r.toLowerCase(),auth:i?i.slice(0,Math.max(0,i.length-1)):"",host:o,pathname:u,search:c,hash:l,[_U]:!r}}function Oa(t=""){const[e="",n="",r=""]=(t.
|
|
1578
1578
|
match(/([^#?]*)(\?[^#]*)?(#.*)?/)||[]).splice(1);return{pathname:e,search:n,hash:r}}const PU=/\/([^/]+)$/;function NU(t="",e){const{pathname:n}=xU(t),r=n.match(PU);return r?r[1]:void 0}var IU=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,OU=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,
|
|
1579
1579
|
LU=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,
|
|
1580
|
-
|
|
1581
|
-
"string"&&/[0-9A-Fa-f]/.test(t)}};let
|
|
1582
|
-
for(const i in r){const s=
|
|
1580
|
+
Wv={Space_Separator:IU,ID_Start:OU,ID_Continue:LU},Mt={isSpaceSeparator(t){return typeof t=="string"&&Wv.Space_Separator.test(t)},isIdStartChar(t){return typeof t=="string"&&(t>="a"&&t<="z"||t>="A"&&t<="Z"||t==="$"||t==="_"||Wv.ID_Start.test(t))},isIdContinueChar(t){return typeof t=="string"&&(t>="a"&&t<="z"||t>="A"&&t<="Z"||t>="0"&&t<="9"||t==="$"||t==="_"||t==="\u200C"||t==="\u200D"||Wv.ID_Continue.test(t))},isDigit(t){return typeof t=="string"&&/[0-9]/.test(t)},isHexDigit(t){return typeof t==
|
|
1581
|
+
"string"&&/[0-9A-Fa-f]/.test(t)}};let zv,An,Ii,jh,fs,Pr,Yt,Hv,kd;var FU=function(e,n){zv=String(e),An="start",Ii=[],jh=0,fs=1,Pr=0,Yt=void 0,Hv=void 0,kd=void 0;do Yt=MU(),jU[An]();while(Yt.type!=="eof");return typeof n=="function"?Kv({"":kd},"",n):kd};function Kv(t,e,n){const r=t[e];if(r!=null&&typeof r=="object")if(Array.isArray(r))for(let i=0;i<r.length;i++){const s=String(i),o=Kv(r,s,n);o===void 0?delete r[s]:Object.defineProperty(r,s,{value:o,writable:!0,enumerable:!0,configurable:!0})}else
|
|
1582
|
+
for(const i in r){const s=Kv(r,i,n);s===void 0?delete r[i]:Object.defineProperty(r,i,{value:s,writable:!0,enumerable:!0,configurable:!0})}return n.call(t,e,r)}let je,Ne,Td,Oi,He;function MU(){for(je="default",Ne="",Td=!1,Oi=1;;){He=Li();const t=nA[je]();if(t)return t}}function Li(){if(zv[jh])return String.fromCodePoint(zv.codePointAt(jh))}function Q(){const t=Li();return t===`
|
|
1583
1583
|
`?(fs++,Pr=0):t?Pr+=t.length:Pr++,t&&(jh+=t.length),t}const nA={default(){switch(He){case" ":case"\v":case"\f":case" ":case"\xA0":case"\uFEFF":case`
|
|
1584
1584
|
`:case"\r":case"\u2028":case"\u2029":Q();return;case"/":Q(),je="comment";return;case void 0:return Q(),$t("eof")}if(Mt.isSpaceSeparator(He)){Q();return}return nA[An]()},comment(){switch(He){case"*":Q(),je="multiLineComment";return;case"/":Q(),je="singleLineComment";return}throw Rt(Q())},multiLineComment(){switch(He){case"*":Q(),je="multiLineCommentAsterisk";return;case void 0:throw Rt(Q())}Q()},multiLineCommentAsterisk(){switch(He){case"*":Q();return;case"/":Q(),je="default";return;case void 0:throw Rt(
|
|
1585
1585
|
Q())}Q(),je="multiLineComment"},singleLineComment(){switch(He){case`
|
|
1586
1586
|
`:case"\r":case"\u2028":case"\u2029":Q(),je="default";return;case void 0:return Q(),$t("eof")}Q()},value(){switch(He){case"{":case"[":return $t("punctuator",Q());case"n":return Q(),Ro("ull"),$t("null",null);case"t":return Q(),Ro("rue"),$t("boolean",!0);case"f":return Q(),Ro("alse"),$t("boolean",!1);case"-":case"+":Q()==="-"&&(Oi=-1),je="sign";return;case".":Ne=Q(),je="decimalPointLeading";return;case"0":Ne=Q(),je="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"\
|
|
1587
|
-
9":Ne=Q(),je="decimalInteger";return;case"I":return Q(),Ro("nfinity"),$t("numeric",1/0);case"N":return Q(),Ro("aN"),$t("numeric",NaN);case'"':case"'":Td=Q()==='"',Ne="",je="string";return}throw Rt(Q())},identifierNameStartEscape(){if(He!=="u")throw Rt(Q());Q();const t=
|
|
1588
|
-
cape";return}if(Mt.isIdContinueChar(He)){Ne+=Q();return}return $t("identifier",Ne)},identifierNameEscape(){if(He!=="u")throw Rt(Q());Q();const t=
|
|
1587
|
+
9":Ne=Q(),je="decimalInteger";return;case"I":return Q(),Ro("nfinity"),$t("numeric",1/0);case"N":return Q(),Ro("aN"),$t("numeric",NaN);case'"':case"'":Td=Q()==='"',Ne="",je="string";return}throw Rt(Q())},identifierNameStartEscape(){if(He!=="u")throw Rt(Q());Q();const t=Vv();switch(t){case"$":case"_":break;default:if(!Mt.isIdStartChar(t))throw rA();break}Ne+=t,je="identifierName"},identifierName(){switch(He){case"$":case"_":case"\u200C":case"\u200D":Ne+=Q();return;case"\\":Q(),je="identifierNameEs\
|
|
1588
|
+
cape";return}if(Mt.isIdContinueChar(He)){Ne+=Q();return}return $t("identifier",Ne)},identifierNameEscape(){if(He!=="u")throw Rt(Q());Q();const t=Vv();switch(t){case"$":case"_":case"\u200C":case"\u200D":break;default:if(!Mt.isIdContinueChar(t))throw rA();break}Ne+=t,je="identifierName"},sign(){switch(He){case".":Ne=Q(),je="decimalPointLeading";return;case"0":Ne=Q(),je="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":Ne=Q(),je="decimalInteger";return;case"I":return Q(),
|
|
1589
1589
|
Ro("nfinity"),$t("numeric",Oi*(1/0));case"N":return Q(),Ro("aN"),$t("numeric",NaN)}throw Rt(Q())},zero(){switch(He){case".":Ne+=Q(),je="decimalPoint";return;case"e":case"E":Ne+=Q(),je="decimalExponent";return;case"x":case"X":Ne+=Q(),je="hexadecimal";return}return $t("numeric",Oi*0)},decimalInteger(){switch(He){case".":Ne+=Q(),je="decimalPoint";return;case"e":case"E":Ne+=Q(),je="decimalExponent";return}if(Mt.isDigit(He)){Ne+=Q();return}return $t("numeric",Oi*Number(Ne))},decimalPointLeading(){if(Mt.
|
|
1590
1590
|
isDigit(He)){Ne+=Q(),je="decimalFraction";return}throw Rt(Q())},decimalPoint(){switch(He){case"e":case"E":Ne+=Q(),je="decimalExponent";return}if(Mt.isDigit(He)){Ne+=Q(),je="decimalFraction";return}return $t("numeric",Oi*Number(Ne))},decimalFraction(){switch(He){case"e":case"E":Ne+=Q(),je="decimalExponent";return}if(Mt.isDigit(He)){Ne+=Q();return}return $t("numeric",Oi*Number(Ne))},decimalExponent(){switch(He){case"+":case"-":Ne+=Q(),je="decimalExponentSign";return}if(Mt.isDigit(He)){Ne+=Q(),je="\
|
|
1591
1591
|
decimalExponentInteger";return}throw Rt(Q())},decimalExponentSign(){if(Mt.isDigit(He)){Ne+=Q(),je="decimalExponentInteger";return}throw Rt(Q())},decimalExponentInteger(){if(Mt.isDigit(He)){Ne+=Q();return}return $t("numeric",Oi*Number(Ne))},hexadecimal(){if(Mt.isHexDigit(He)){Ne+=Q(),je="hexadecimalInteger";return}throw Rt(Q())},hexadecimalInteger(){if(Mt.isHexDigit(He)){Ne+=Q();return}return $t("numeric",Oi*Number(Ne))},string(){switch(He){case"\\":Q(),Ne+=BU();return;case'"':if(Td)return Q(),$t(
|
|
@@ -1593,11 +1593,11 @@ decimalExponentInteger";return}throw Rt(Q())},decimalExponentSign(){if(Mt.isDigi
|
|
|
1593
1593
|
`:case"\r":throw Rt(Q());case"\u2028":case"\u2029":GU(He);break;case void 0:throw Rt(Q())}Ne+=Q()},start(){switch(He){case"{":case"[":return $t("punctuator",Q())}je="value"},beforePropertyName(){switch(He){case"$":case"_":Ne=Q(),je="identifierName";return;case"\\":Q(),je="identifierNameStartEscape";return;case"}":return $t("punctuator",Q());case'"':case"'":Td=Q()==='"',je="string";return}if(Mt.isIdStartChar(He)){Ne+=Q(),je="identifierName";return}throw Rt(Q())},afterPropertyName(){if(He===":")return $t(
|
|
1594
1594
|
"punctuator",Q());throw Rt(Q())},beforePropertyValue(){je="value"},afterPropertyValue(){switch(He){case",":case"}":return $t("punctuator",Q())}throw Rt(Q())},beforeArrayValue(){if(He==="]")return $t("punctuator",Q());je="value"},afterArrayValue(){switch(He){case",":case"]":return $t("punctuator",Q())}throw Rt(Q())},end(){throw Rt(Q())}};function $t(t,e){return{type:t,value:e,line:fs,column:Pr}}function Ro(t){for(const e of t){if(Li()!==e)throw Rt(Q());Q()}}function BU(){switch(Li()){case"b":return Q(),
|
|
1595
1595
|
"\b";case"f":return Q(),"\f";case"n":return Q(),`
|
|
1596
|
-
`;case"r":return Q(),"\r";case"t":return Q()," ";case"v":return Q(),"\v";case"0":if(Q(),Mt.isDigit(Li()))throw Rt(Q());return"\0";case"x":return Q(),qU();case"u":return Q(),
|
|
1596
|
+
`;case"r":return Q(),"\r";case"t":return Q()," ";case"v":return Q(),"\v";case"0":if(Q(),Mt.isDigit(Li()))throw Rt(Q());return"\0";case"x":return Q(),qU();case"u":return Q(),Vv();case`
|
|
1597
1597
|
`:case"\u2028":case"\u2029":return Q(),"";case"\r":return Q(),Li()===`
|
|
1598
|
-
`&&Q(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":throw Rt(Q());case void 0:throw Rt(Q())}return Q()}function qU(){let t="",e=Li();if(!Mt.isHexDigit(e)||(t+=Q(),e=Li(),!Mt.isHexDigit(e)))throw Rt(Q());return t+=Q(),String.fromCodePoint(parseInt(t,16))}function
|
|
1599
|
-
type){case"identifier":case"string":
|
|
1600
|
-
if(Yt.type==="eof")throw Do();switch(Yt.value){case",":An="beforeArrayValue";return;case"]":Gh()}},end(){}};function
|
|
1598
|
+
`&&Q(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":throw Rt(Q());case void 0:throw Rt(Q())}return Q()}function qU(){let t="",e=Li();if(!Mt.isHexDigit(e)||(t+=Q(),e=Li(),!Mt.isHexDigit(e)))throw Rt(Q());return t+=Q(),String.fromCodePoint(parseInt(t,16))}function Vv(){let t="",e=4;for(;e-- >0;){const n=Li();if(!Mt.isHexDigit(n))throw Rt(Q());t+=Q()}return String.fromCodePoint(parseInt(t,16))}const jU={start(){if(Yt.type==="eof")throw Do();Xv()},beforePropertyName(){switch(Yt.
|
|
1599
|
+
type){case"identifier":case"string":Hv=Yt.value,An="afterPropertyName";return;case"punctuator":Gh();return;case"eof":throw Do()}},afterPropertyName(){if(Yt.type==="eof")throw Do();An="beforePropertyValue"},beforePropertyValue(){if(Yt.type==="eof")throw Do();Xv()},beforeArrayValue(){if(Yt.type==="eof")throw Do();if(Yt.type==="punctuator"&&Yt.value==="]"){Gh();return}Xv()},afterPropertyValue(){if(Yt.type==="eof")throw Do();switch(Yt.value){case",":An="beforePropertyName";return;case"}":Gh()}},afterArrayValue(){
|
|
1600
|
+
if(Yt.type==="eof")throw Do();switch(Yt.value){case",":An="beforeArrayValue";return;case"]":Gh()}},end(){}};function Xv(){let t;switch(Yt.type){case"punctuator":switch(Yt.value){case"{":t={};break;case"[":t=[];break}break;case"null":case"boolean":case"numeric":case"string":t=Yt.value;break}if(kd===void 0)kd=t;else{const e=Ii[Ii.length-1];Array.isArray(e)?e.push(t):Object.defineProperty(e,Hv,{value:t,writable:!0,enumerable:!0,configurable:!0})}if(t!==null&&typeof t=="object")Ii.push(t),Array.isArray(
|
|
1601
1601
|
t)?An="beforeArrayValue":An="beforePropertyName";else{const e=Ii[Ii.length-1];e==null?An="end":Array.isArray(e)?An="afterArrayValue":An="afterPropertyValue"}}function Gh(){Ii.pop();const t=Ii[Ii.length-1];t==null?An="end":Array.isArray(t)?An="afterArrayValue":An="afterPropertyValue"}function Rt(t){return Uh(t===void 0?`JSON5: invalid end of input at ${fs}:${Pr}`:`JSON5: invalid character '${iA(t)}' at ${fs}:${Pr}`)}function Do(){return Uh(`JSON5: invalid end of input at ${fs}:${Pr}`)}function rA(){
|
|
1602
1602
|
return Pr-=5,Uh(`JSON5: invalid identifier character at ${fs}:${Pr}`)}function GU(t){console.warn(`JSON5: '${iA(t)}' in strings is not valid ECMAScript; consider escaping`)}function iA(t){const e={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(e[t])return e[t];if(t<" "){const n=t.charCodeAt(0).toString(16);return"\\x"+("00"+n).substring(n.length)}return t}function Uh(t){const e=new SyntaxError(
|
|
1603
1603
|
t);return e.lineNumber=fs,e.columnNumber=Pr,e}var UU=function(e,n,r){const i=[];let s="",o,a,u="",c;if(n!=null&&typeof n=="object"&&!Array.isArray(n)&&(r=n.space,c=n.quote,n=n.replacer),typeof n=="function")a=n;else if(Array.isArray(n)){o=[];for(const w of n){let y;typeof w=="string"?y=w:(typeof w=="number"||w instanceof String||w instanceof Number)&&(y=String(w)),y!==void 0&&o.indexOf(y)<0&&o.push(y)}}return r instanceof Number?r=Number(r):r instanceof String&&(r=String(r)),typeof r=="number"?r>
|
|
@@ -1610,7 +1610,7 @@ continue}b+=N}const R=c||Object.keys(y).reduce((A,N)=>y[A]<y[N]?A:N);return b=b.
|
|
|
1610
1610
|
"[]";else if(u==="")b="["+g.join(",")+"]";else{let R=`,
|
|
1611
1611
|
`+s,A=g.join(R);b=`[
|
|
1612
1612
|
`+s+A+`,
|
|
1613
|
-
`+y+"]"}return i.pop(),s=y,b}};const WU={parse:FU,stringify:UU};var sA=WU,
|
|
1613
|
+
`+y+"]"}return i.pop(),s=y,b}};const WU={parse:FU,stringify:UU};var sA=WU,Yv;function oA(t){return{lang:t?.lang??Yv?.lang,message:t?.message,abortEarly:t?.abortEarly??Yv?.abortEarly,abortPipeEarly:t?.abortPipeEarly??Yv?.abortPipeEarly}}var zU;function HU(t){return zU?.get(t)}var KU;function VU(t){return KU?.get(t)}var XU;function YU(t,e){return XU?.get(t)?.get(e)}function aA(t){const e=typeof t;return e==="string"?`"${t}"`:e==="number"||e==="bigint"||e==="boolean"?`${t}`:e==="object"||e==="funct\
|
|
1614
1614
|
ion"?(t&&Object.getPrototypeOf(t)?.constructor?.name)??"null":e}function La(t,e,n,r,i){const s=i&&"input"in i?i.input:n.value,o=i?.expected??t.expects??null,a=i?.received??aA(s),u={kind:t.kind,type:t.type,input:s,expected:o,received:a,message:`Invalid ${e}: ${o?`Expected ${o} but r`:"R"}eceived ${a}`,requirement:t.requirement,path:i?.path,issues:i?.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly},c=t.kind==="schema",l=i?.message??t.message??YU(t.reference,u.lang)??(c?VU(
|
|
1615
1615
|
u.lang):null)??r.message??HU(u.lang);l!==void 0&&(u.message=typeof l=="function"?l(u):l),c&&(n.typed=!1),n.issues?n.issues.push(u):n.issues=[u]}function Cd(t){return{version:1,vendor:"valibot",validate(e){return t["~run"]({value:e},oA())}}}var JU=class extends Error{constructor(t){super(t[0].message),this.name="ValiError",this.issues=t}};function Ad(t){return{kind:"metadata",type:"description",reference:Ad,description:t}}function Sd(t,e){const n=aA(t);return{kind:"validation",type:"excludes",reference:Sd,
|
|
1616
1616
|
async:!1,expects:`!${n}`,requirement:t,message:e,"~run"(r,i){return r.typed&&r.value.includes(this.requirement)&&La(this,"content",r,i,{received:n}),r}}}function Wh(t){return{kind:"validation",type:"non_empty",reference:Wh,async:!1,expects:"!0",message:t,"~run"(e,n){return e.typed&&e.value.length===0&&La(this,"length",e,n,{received:"0"}),e}}}function QU(t,e,n){return typeof t.fallback=="function"?t.fallback(e,n):t.fallback}function uA(t,e,n){return typeof t.default=="function"?t.default(e,n):t.default}
|
|
@@ -1620,79 +1620,80 @@ r);if(u.issues){const c={type:"object",origin:"value",input:i,key:s,value:a};for
|
|
|
1620
1620
|
break}}else La(this,"type",n,r);return n}}}function zh(t,e){return{kind:"schema",type:"optional",reference:zh,expects:`(${t.expects} | undefined)`,async:!1,wrapped:t,default:e,get"~standard"(){return Cd(this)},"~run"(n,r){return n.value===void 0&&(this.default!==void 0&&(n.value=uA(this,n,r)),n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,r)}}}function _d(t){return{kind:"schema",type:"string",reference:_d,expects:"string",async:!1,message:t,get"~standard"(){return Cd(this)},"~run"(e,n){
|
|
1621
1621
|
return typeof e.value=="string"?e.typed=!0:La(this,"type",e,n),e}}}function ZU(t,e,n){const r=t["~run"]({value:e},oA(n));if(r.issues)throw new JU(r.issues);return r.value}function Hh(...t){return{...t[0],pipe:t,get"~standard"(){return Cd(this)},"~run"(e,n){for(const r of t)if(r.kind!=="metadata"){if(e.issues&&(r.kind==="schema"||r.kind==="transformation")){e.typed=!1;break}(!e.issues||!n.abortEarly&&!n.abortPipeEarly)&&(e=r["~run"](e,n))}return e}}}const eW=lA({name:Hh(_d(),Wh("Project name cann\
|
|
1622
1622
|
ot be empty"),Sd("default",'Project name cannot be "default"'),Sd(".",'Project name cannot contain ".", try to use A-z, 0-9, _ and -'),Sd("@",'Project name cannot contain "@", try to use A-z, 0-9, _ and -'),Sd("#",'Project name cannot contain "#", try to use A-z, 0-9, _ and -'),Ad("Project name, must be unique in the workspace")),title:zh(Hh(_d(),Wh("Project title cannot be empty if specified"),Ad("A human readable title for the project"))),contactPerson:zh(Hh(_d(),Wh("Contact person cannot be e\
|
|
1623
|
-
mpty if specified"),Ad("A person who has been involved in creating or maintaining this project"))),exclude:zh(Hh(cA(_d()),Ad('List of file patterns to exclude from the project, default is ["**/node_modules/**/*"]')))});function tW(t){return dA(sA.parse(t))}function dA(t){return ZU(eW,t)}const
|
|
1624
|
-
id:
|
|
1625
|
-
|
|
1626
|
-
let n=e.toString();const r=this.findProjectForDocument(n);return r.exclude?r.exclude(tA(n)):!1}isConfigFile(e){const n=NU(e.uri.toString())?.toLowerCase();return!!n&&
|
|
1623
|
+
mpty if specified"),Ad("A person who has been involved in creating or maintaining this project"))),exclude:zh(Hh(cA(_d()),Ad('List of file patterns to exclude from the project, default is ["**/node_modules/**/*"]')))});function tW(t){return dA(sA.parse(t))}function dA(t){return ZU(eW,t)}const Kh=st.getChild("ProjectsManager");class Sn{constructor(e){this.services=e,Kh.debug`created`}static DefaultProjectId="default";static ConfigFileNames=[".likec4rc",".likec4.config.json","likec4.config.json"];projectIdToFolder=new Y_;_projects=[];defaultGlobalProject={
|
|
1624
|
+
id:Sn.DefaultProjectId,config:{name:Sn.DefaultProjectId,exclude:["**/node_modules/**/*"]},exclude:YC("**/node_modules/**/*",{dot:!0})};get defaultProjectId(){if(!(this._projects.length>1))return this._projects[0]?.id??Sn.DefaultProjectId}get all(){return Bn(this._projects,1)?[...bt(this._projects,Xr("id")),Sn.DefaultProjectId]:[Sn.DefaultProjectId]}getProject(e){const n=typeof e=="string"?e:e.likec4ProjectId||this.belongsTo(e);if(n===Sn.DefaultProjectId){let s;try{s=this.services.workspace.WorkspaceManager.
|
|
1625
|
+
workspaceUri}catch(o){Kh.warn("Failed to get workspace URI, using default folder",{error:o}),s=dt.file("")}return{id:Sn.DefaultProjectId,config:this.defaultGlobalProject.config,folder:s}}const{config:r,folder:i}=xt(this._projects.find(s=>s.id===n),`Project "${n}" not found`);return{id:n,folder:dt.parse(i),config:r}}ensureProjectId(e){return e===Sn.DefaultProjectId?e:e?(Ae(this.projectIdToFolder.has(e),`Project ID ${e} is not registered`),e):xt(this.defaultProjectId,()=>`Specify exact project, kn\
|
|
1626
|
+
own: [${[...this.projectIdToFolder.keys()].join(", ")}]`)}hasMultipleProjects(){return this._projects.length>1}checkIfExcluded(e){let n=e.toString();const r=this.findProjectForDocument(n);return r.exclude?r.exclude(tA(n)):!1}isConfigFile(e){const n=NU(e.uri.toString())?.toLowerCase();return!!n&&Sn.ConfigFileNames.includes(n)}async loadConfigFile(e){if(!e.isDirectory&&this.isConfigFile(e))try{return await this.registerProject(e.uri)}catch(n){this.services.lsp.Connection?.window.showErrorMessage(`\
|
|
1627
|
+
LikeC4: Failed to register project at ${e.uri.toString()}
|
|
1627
1628
|
|
|
1628
|
-
${Un(n)}`),
|
|
1629
|
-
folder:o};return Et(n.exclude)?a.exclude=this.defaultGlobalProject.exclude:
|
|
1630
|
-
()=>this._projects.find(({folder:n})=>e.startsWith(n))??this.defaultGlobalProject)}_mappingsToProject;get mappingsToProject(){return this._mappingsToProject??=new $p(this.services),this._mappingsToProject}}const nW={fileSystemProvider:()=>new sW},rW=[...
|
|
1631
|
-
{resolvePaths:!1}).withFullPaths().filter(iW).crawl(e.fsPath).withPromise();for(const i of r)n.push({isFile:!0,isDirectory:!1,uri:
|
|
1632
|
-
const r=this.services.workspace.ProjectsManager;e.likec4ProjectId=r.belongsTo(e.uri),await super.updateContent(e,n)}projectElements(e,n,r){const i=this.services.workspace.ProjectsManager;return Ve(this.symbolIndex.keys()).filter(s=>i.belongsTo(s)===e&&(!r||r.has(s))).flatMap(s=>this.getFileDescriptions(s,n))}}const xd=Symbol.for("idattr"),
|
|
1633
|
-
textDocument.languageId===
|
|
1634
|
-
switch(!0){case vo(r):{const i=Pd(r);de(i)&&(n.color=i);break}case Sl(r):{n.line=r.value;break}case el(r):{switch(r.key){case"head":{n.head=r.value;break}case"tail":{n.tail=r.value;break}default:Oe(r)}break}default:Oe(r)}return n}function Jv(t,e){const{color:n,line:r,head:i,tail:s}=uW(t?.filter(dC),e);return{...n&&n!==Ha?{color:n}:{},...r&&r!==J_?{line:r}:{},...i&&i!==_s?{head:i}:{},...s?{tail:s}:{}}}function Pd(t){return t?.themeColor??t?.customColor
|
|
1635
|
-
nodeSep;let r;switch(t.direction){case"TopBottom":{r="TB";break}case"BottomTop":{r="BT";break}case"LeftRight":{r="LR";break}case"RightLeft":{r="RL";break}default:Oe(t.direction)}return{direction:r,...n&&{nodeSep:n},...e&&{rankSep:e}}}function cW(t){switch(t){case"TB":return"TopBottom";case"BT":return"BottomTop";case"LR":return"LeftRight";case"RL":return"RightLeft";default:Oe(t)}}function
|
|
1636
|
-
t)||gC(t)
|
|
1637
|
-
all.filter(n=>!ps(n)||$d(n.uri)?!1:(n.likec4ProjectId
|
|
1638
|
-
fileSystemProvider.readDirectory(
|
|
1639
|
-
workspace();return Ae(e,"Workspace not initialized"),
|
|
1640
|
-
24n,minutes:t/60000n%60n,seconds:t/1000n%60n,milliseconds:t%1000n,microseconds:0n,nanoseconds:0n}}function yW(t){switch(typeof t){case"number":{if(Number.isFinite(t))return mW(t);break}case"bigint":return gW(t)}throw new TypeError("Expected a finite number or bigint")}const vW=t=>t===0||t===0n,wW=(t,e)=>e===1||e===1n?t:`${t}s`,bW=1e-7,EW=24n*60n*60n*1000n;function mA(t,e){const n=typeof t=="bigint";if(!n&&!Number.isFinite(t))throw new TypeError("Expected
|
|
1641
|
-
0?"-":"";t=t<0?-t:t,e.colonNotation&&(e.compact=!1,e.formatSubMilliseconds=!1,e.separateMilliseconds=!1,e.verbose=!1),e.compact&&(e.unitCount=1,e.secondsDecimalDigits=0,e.millisecondsDecimalDigits=0);let i=[];const s=(l,f)=>{const d=Math.floor(l*10**f+bW);return(Math.round(d)/10**f).toFixed(f)},o=(l,f,d,p)=>{if(!((i.length===0||!e.colonNotation)&&vW(l)&&!(e.colonNotation&&d==="m"))){if(p??=String(l),e.colonNotation){const m=p.includes(".")?p.split("
|
|
1642
|
-
Math.max(0,w-m))+p}else p+=e.verbose?" "+wW(f,l):d;i.push(p)}},a=yW(t),u=BigInt(a.days);if(e.hideYearAndDays?o(BigInt(u)*24n+BigInt(a.hours),"hour","h"):(e.hideYear?o(u,"day","d"):(o(u/365n,"year","y"),o(u%365n,"day","d")),o(Number(a.hours),"hour","h")),o(Number(a.minutes),"minute","m"),!e.hideSeconds)if(e.separateMilliseconds||e.formatSubMilliseconds||!e.colonNotation&&t<1e3){const l=Number(a.seconds),f=Number(a.milliseconds),d=Number(a.microseconds),
|
|
1643
|
-
e.formatSubMilliseconds)o(f,"millisecond","ms"),o(d,"microsecond","\xB5s"),o(p,"nanosecond","ns");else{const m=f+d/1e3+p/1e6,w=typeof e.millisecondsDecimalDigits=="number"?e.millisecondsDecimalDigits:0,y=m>=1?Math.round(m):Math.ceil(m),g=w?m.toFixed(w):y;o(Number.parseFloat(g),"millisecond","ms",g)}}else{const l=(n?Number(t%EW):t)/1e3%60,f=typeof e.secondsDecimalDigits=="number"?e.secondsDecimalDigits:1,d=s(l,f),p=e.keepDecimalsOnWholeSeconds?d:d.replace(
|
|
1644
|
-
|
|
1645
|
-
t)?t.el.ref:t.modelElement.value.ref;return e?.$type==="Imported"&&(e=e.imported.ref),e?.$type==="Element"?e:void 0}function To(t){const e=[t.$type==="StrictFqnRef"?t.value.$refText:t.el.$refText];let n=t.parent;for(;n;)e.push(n.$type==="StrictFqnRef"?n.value.$refText:n.el.$refText),n=n.parent;return e.length===1?e[0]:e.reverse().join(".")}function $W(t){for(;t.parent;)t=t.parent;return t.value.ref??null}function RW(t){let e;for(;e=t.value?.ref;){if(Cn(e))
|
|
1646
|
-
return null;t=t.parent}return null}function DW(t){const e=$W(t);return e?.$type==="Imported"?e:null}function kW(t){let e;for(;e=t.value?.ref;){if(Ip(e))return!0;if(Et(t.parent))return!1;t=t.parent}return!1}function Bt(t){if(Zr(t)){for(;t.$type==="Imported"&&t.$container;)t=t.$container;Ae(kl(t))}if(kl(t))return t.project;const e=kt(t)?ut(t):t;return xt(e.likec4ProjectId,()=>`Invalid state, document ${e.uri} has no project ID assigned`)}function Nd(...t){
|
|
1647
|
-
e)}function gA(t){try{return t()}catch(e){st.debug("Safe call failed",{error:e});return}}function nw(){try{return performance.now()}catch{return Date.now()}}function
|
|
1648
|
-
|
|
1649
|
-
return!0}function IW(t,e){return Co(t.getTime(),e.getTime())}function OW(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function LW(t,e){return t===e}function EA(t,e,n){var r=t.size;if(r!==e.size)return!1;if(!r)return!0;for(var i=new Array(r),s=t.entries(),o,a,u=0;(o=s.next())&&!o.done;){for(var c=e.entries(),l=!1,f=0;(a=c.next())&&!a.done;){if(i[f]){f++;continue}var d=o.value,p=a.value;if(n.equals(d[0],p[0],
|
|
1650
|
-
l=i[f]=!0;break}f++}if(!l)return!1;u++}return!0}var FW=Co;function MW(t,e,n){var r=bA(t),i=r.length;if(bA(e).length!==i)return!1;for(;i-- >0;)if(!RA(t,e,n,r[i]))return!1;return!0}function Id(t,e,n){var r=vA(t),i=r.length;if(vA(e).length!==i)return!1;for(var s,o,a;i-- >0;)if(s=r[i],!RA(t,e,n,s)||(o=wA(t,s),a=wA(e,s),(o||a)&&(!o||!a||o.configurable!==a.configurable||o.enumerable!==a.enumerable||o.writable!==a.writable)))return!1;return!0}function BW(t,e){
|
|
1651
|
-
return t.source===e.source&&t.flags===e.flags}function $A(t,e,n){var r=t.size;if(r!==e.size)return!1;if(!r)return!0;for(var i=new Array(r),s=t.values(),o,a;(o=s.next())&&!o.done;){for(var u=e.values(),c=!1,l=0;(a=u.next())&&!a.done;){if(!i[l]&&n.equals(o.value,a.value,o.value,a.value,t,e,n)){c=i[l]=!0;break}l++}if(!c)return!1}return!0}function jW(t,e){var n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function GW(t,e){
|
|
1652
|
-
e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function RA(t,e,n,r){return(r===PW||r===xW||r===_W)&&(t.$$typeof||e.$$typeof)?!0:SW(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}var UW="[object Arguments]",WW="[object Boolean]",zW="[object Date]",HW="[object Error]",KW="[object Map]",VW="[object Number]",XW="[object Object]",YW="[object RegExp]",JW="[object Set]",QW="[object String]",ZW="[
|
|
1653
|
-
"function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,kA=Object.assign,tz=Object.prototype.toString.call.bind(Object.prototype.toString);function nz(t){var e=t.areArraysEqual,n=t.areDatesEqual,r=t.areErrorsEqual,i=t.areFunctionsEqual,s=t.areMapsEqual,o=t.areNumbersEqual,a=t.areObjectsEqual,u=t.arePrimitiveWrappersEqual,c=t.areRegExpsEqual,l=t.areSetsEqual,f=t.areTypedArraysEqual,d=t.areUrlsEqual;return function(m,w,y){if(m===w)return!0;if(m==null||
|
|
1654
|
-
return!1;if(g!=="object")return g==="number"?o(m,w,y):g==="function"?i(m,w,y):!1;var b=m.constructor;if(b!==w.constructor)return!1;if(b===Object)return a(m,w,y);if(ez(m))return e(m,w,y);if(DA!=null&&DA(m))return f(m,w,y);if(b===Date)return n(m,w,y);if(b===RegExp)return c(m,w,y);if(b===Map)return s(m,w,y);if(b===Set)return l(m,w,y);var R=tz(m);return R===zW?n(m,w,y):R===YW?c(m,w,y):R===KW?s(m,w,y):R===JW?l(m,w,y):R===XW?typeof m.then!="function"&&typeof w.
|
|
1655
|
-
R===HW?r(m,w,y):R===UW?a(m,w,y):R===WW||R===VW||R===QW?u(m,w,y):!1}}function rz(t){var e=t.circular,n=t.createCustomConfig,r=t.strict,i={areArraysEqual:r?Id:NW,areDatesEqual:IW,areErrorsEqual:OW,areFunctionsEqual:LW,areMapsEqual:r?yA(EA,Id):EA,areNumbersEqual:FW,areObjectsEqual:r?Id:MW,arePrimitiveWrappersEqual:BW,areRegExpsEqual:qW,areSetsEqual:r?yA($A,Id):$A,areTypedArraysEqual:r?Id:jW,areUrlsEqual:GW};if(n&&(i=kA({},i,n(i))),e){var s=
|
|
1656
|
-
u=
|
|
1657
|
-
equals:i,meta:void 0,strict:s};return function(u,c){return n(u,c,o)}}var rw=hs();hs({strict:!0}),hs({circular:!0}),hs({circular:!0,strict:!0}),hs({createInternalComparator:function(){return Co}}),hs({strict:!0,createInternalComparator:function(){return Co}}),hs({circular:!0,createInternalComparator:function(){return Co}}),hs({circular:!0,createInternalComparator:function(){return Co},strict:!0});function hs(t){t===void 0&&(t={});var e=t.circular,
|
|
1658
|
-
createState,s=t.strict,o=s===void 0?!1:s,a=rz(t),u=nz(a),c=r?r(u):iz(u);return sz({circular:n,comparator:u,createState:i,equals:c,strict:o})}var oz=Object.defineProperty,az=(t,e,n)=>e in t?oz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,TA=(t,e,n)=>az(t,typeof e!="symbol"?e+"":e,n);let uz=class qi{constructor(e,n){TA(this,"x"),TA(this,"y"),this.x=e,this.y=n}static of([e,n]){return new qi(e,n)}add(e){return new qi(this.x+e.x,this.
|
|
1659
|
-
y-e.y)}multiply(e){return new qi(this.x*e,this.y*e)}divide(e){return new qi(this.x/e,this.y/e)}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-e.x*this.y}hadamard(e){return new qi(this.x*e.x,this.y*e.y)}length(){return Math.sqrt(this.x**2+this.y**2)}normalize(){const e=this.length();return new qi(this.x/e,this.y/e)}rotateByRadians(e){const n=Math.cos(e),r=Math.sin(e);return new qi(this.x*n-this.y*r,this.x*r+this.y*n)}rotateByDegrees(e){
|
|
1660
|
-
const cz=100,CA=100,ms={top:50,right:40,bottom:40,left:40};function AA(t,e){const n=t.nodes.map(i=>{const s=e.nodes[i.id];if(!s)return i;const{x:o,y:a,width:u,height:c}=s;return{...i,width:u,height:c,position:[o,a]}}),r=t.edges.map(i=>{const s=e.edges[i.id];return s?{...i,...s}:i});return{...t,bounds:{x:e.x,y:e.y,width:e.width,height:e.height},nodes:n,edges:r}}function lz(t,e){const n=new Map(t.nodes.map(i=>[i.id,i]));if(t.hash===e.hash||fz(t,e))return _A(
|
|
1661
|
-
t.hasLayoutDrift=!0;const r=Ka.merge(...t.nodes.map(i=>e.nodes[i.id]).filter(i=>!!i));return t.nodes.filter(i=>i.parent==null).reduce((i,s)=>SA(s,i,n,e),{x:r.x,y:r.y+r.height+CA}),t.edges.filter(i=>!e.edges[i.id]).forEach(i=>dz(i,e)),AA(t,e)}function SA(t,e,n,r){let i=r.nodes[t.id];const s=i?.isCompound??!1,o=!i,a=o?e:{x:i.x,y:i.y},u=t.children.map(f=>r.nodes[f]).filter(f=>!!f),c=u.length>0&&Ka.merge(...u),l=s&&c?{x:c.x,y:c.y+c.height+CA}:{x:a.x+ms.left,
|
|
1662
|
-
f)).reduce((f,d)=>SA(d,f,n,r),l),i=t.children.length>0?xA(t,r):r.nodes[t.id]??{isCompound:!1,width:t.width,height:t.height,x:a.x,y:a.y},r.nodes[t.id]=i,o?{x:i.x+i.width+cz,y:i.y}:e}function dz(t,e){const n=e.nodes[t.source],r=e.nodes[t.target],i=PA(Ka.center(n)),s=PA(Ka.center(r)),o=s.subtract(i),a={...t?.labelBBox??{width:0,height:0},...o.divide(2).add(i)},u=o.multiply(.7).add(i),c=o.multiply(.3).add(i);e.edges[t.id]={points:[[i.x,i.y],[c.x,c.y],[u.x,
|
|
1663
|
-
function _A(t,e,n){t.filter(r=>r.children.length>0).forEach(r=>{_A(r.children.map(i=>e.get(i)).filter(i=>!!i),e,n),n.nodes[r.id]=xA(r,n)})}function xA(t,e){const n=Ka.merge(...t.children.map(r=>e.nodes[r]));return{isCompound:!0,x:n.x-ms.left,y:n.y-ms.top,width:n.width+ms.left+ms.right,height:n.height+ms.top+ms.bottom}}function fz(t,e){const n=r=>r.children.length>0;return rw(t.autoLayout,e.autoLayout)&&t.nodes.every(r=>{const i=e.nodes[r.id];return!!i&&
|
|
1664
|
-
edges[r.id])}function PA({x:t,y:e}){return new uz(t,e)}function NA(t){return typeof t=="object"&&t!==null&&typeof t.id=="string"}function iw(t){return typeof t=="object"&&t!==null&&t.$$type==="Node"&&typeof t.id=="string"}function IA(t){return iw(t)||NA(t)}function Od(t){return typeof t=="string"||IA(t)}function pz(t){return Array.isArray(t)&&t.every(Od)}function hz(t){return["n","ne","e","se","s","sw","w","nw","c"].includes(t)}function OA(t){if(IA(t))
|
|
1665
|
-
r)?{id:e,port:n,compass:r}:{id:e,port:n}}function mz(t){if(t.length<2&&(Od(t[0])&&Od(t[1]))===!1)throw Error("EdgeTargets must have at least 2 elements.");return t.map(e=>OA(e))}const
|
|
1666
|
-
Nr=vz((t,e)=>Array.from(wz(function*(){for(const n of t)yield e(n)})));class LA{options;getLocation(){return this.options?.locationFunction?.()??null}constructor(e){this.options=e}createElement(e,n,r=[]){return{location:this.getLocation(),...n,type:e,children:r}}}const rt=LA.prototype.createElement.bind(new LA),bz=/\r?\n/;function Ir(t){return e=>e.join(t)}function Ez(t){return e=>t+e+t}function gs(t,e){return n=>t+n+e}function
|
|
1667
|
-
"\\n").replace(/"/g,'\\"'),
|
|
1629
|
+
${Un(n)}`),Kh.error("Failed to register project at {uri}",{uri:e.uri.toString(),error:n});return}}async registerProject(e){if(dt.isUri(e)){const u=e,c=await this.services.workspace.FileSystemProvider.readFile(u),l=tW(c),f=qh(u.path,".."),d=u.with({path:f});return this.registerProject({config:l,folderUri:d})}const n=dA(e.config),{folderUri:r}=e;let i=n.name,s=1;for(;this.projectIdToFolder.has(i);)i=`${n.name}-${s++}`;let o;dt.isUri(r)?o=r.toString():o=ds(r)?r:Uv(r,"file://");const a={id:i,config:n,
|
|
1630
|
+
folder:o};return Et(n.exclude)?a.exclude=this.defaultGlobalProject.exclude:Bn(n.exclude,1)&&(a.exclude=YC(n.exclude,{dot:!0})),this._projects=Le([...this._projects,a],X4([({folder:u})=>tA(u).split("/").length,"desc"])),this.projectIdToFolder.set(i,o),Kh.info`register project ${i} folder: ${o}`,this.mappingsToProject.clear(),a}belongsTo(e){let n;return typeof e=="string"?n=ds(e)?e:Uv(e,"file://"):dt.isUri(e)?n=e.toString():n=e.uri.toString(),this.findProjectForDocument(n).id}findProjectForDocument(e){
|
|
1631
|
+
return this.mappingsToProject.get(e,()=>this._projects.find(({folder:n})=>e.startsWith(n))??this.defaultGlobalProject)}_mappingsToProject;get mappingsToProject(){return this._mappingsToProject??=new $p(this.services),this._mappingsToProject}}const nW={fileSystemProvider:()=>new sW},rW=[...qv.fileExtensions,...Sn.ConfigFileNames],iW=t=>rW.some(e=>t.endsWith(e));let sW=class extends I8{async readFile(e){return $d(e)?Promise.resolve(KC):await super.readFile(e)}async readDirectory(e){const n=[];try{
|
|
1632
|
+
const r=await new N8.fdir().withSymlinks({resolvePaths:!1}).withFullPaths().filter(iW).crawl(e.fsPath).withPromise();for(const i of r)n.push({isFile:!0,isDirectory:!1,uri:dt.file(i)})}catch(r){Rd(r)}return n}};class oW extends wD{constructor(e){super(e),this.services=e}createDescription(e,n,r){const i=r??ut(e),s=super.createDescription(e,n,r);return i.likec4ProjectId??=this.services.shared.workspace.ProjectsManager.belongsTo(i.uri),s.likec4ProjectId=i.likec4ProjectId,s}}class aW extends bD{constructor(e){
|
|
1633
|
+
super(e),this.services=e}async updateContent(e,n){const r=this.services.workspace.ProjectsManager;e.likec4ProjectId=r.belongsTo(e.uri),await super.updateContent(e,n)}projectElements(e,n,r){const i=this.services.workspace.ProjectsManager;return Ve(this.symbolIndex.keys()).filter(s=>i.belongsTo(s)===e&&(!r||r.has(s))).flatMap(s=>this.getFileDescriptions(s,n))}}const xd=Symbol.for("idattr"),Vh={writeId(t,e){return t[xd]=e,t},readId(t){return t[xd]}},Xh={writeId(t,e){return Et(e)?t[xd]=void 0:t[xd]=
|
|
1634
|
+
e,t},readId(t){return t[xd]}};function ps(t){return t.textDocument.languageId===qv.languageId}function ti(t){return t?.markdown||t?.text}function fA(t){const e=parseFloat(t);return isNaN(e)?100:QD(e,{min:0,max:100})}function pA({value:t}){return fA(t)}function Fa({value:t}){switch(t){case"xs":case"sm":case"md":case"lg":case"xl":return t;case"xsmall":return"xs";case"small":return"sm";case"medium":return"md";case"large":return"lg";case"xlarge":return"xl";default:Oe(t)}}function uW(t,e){const n={};
|
|
1635
|
+
if(!t||t.length===0)return n;for(const r of t)if(e(r))switch(!0){case vo(r):{const i=Pd(r);de(i)&&(n.color=i);break}case Sl(r):{n.line=r.value;break}case el(r):{switch(r.key){case"head":{n.head=r.value;break}case"tail":{n.tail=r.value;break}default:Oe(r)}break}default:Oe(r)}return n}function Jv(t,e){const{color:n,line:r,head:i,tail:s}=uW(t?.filter(dC),e);return{...n&&n!==Ha?{color:n}:{},...r&&r!==J_?{line:r}:{},...i&&i!==_s?{head:i}:{},...s?{tail:s}:{}}}function Pd(t){return t?.themeColor??t?.customColor?.
|
|
1636
|
+
$refText}function Qv(t){const e=t.rankSep,n=t.nodeSep;let r;switch(t.direction){case"TopBottom":{r="TB";break}case"BottomTop":{r="BT";break}case"LeftRight":{r="LR";break}case"RightLeft":{r="RL";break}default:Oe(t.direction)}return{direction:r,...n&&{nodeSep:n},...e&&{rankSep:e}}}function cW(t){switch(t){case"TB":return"TopBottom";case"BT":return"BottomTop";case"LR":return"LeftRight";case"RL":return"RightLeft";default:Oe(t)}}function Yh(t){return zn(t,e=>cd(e)||ma(e)||EC(e))}const Zv=t=>SC(t)||ch(
|
|
1637
|
+
t)||Dv(t)||Ev(t)||wC(t)||bv(t),ew=t=>_C(t)||yv(t)||gC(t)||Rv(t)||mC(t);function lW(t){for(;;){if(ew(t)||Zv(t))return!1;if(Cv(t)||Il(t))return!0;if(t.$container)t=t.$container;else return!1}}function dW(t){for(;;){if(ew(t))return!1;if(Zv(t))return!0;if(t.$container)t=t.$container;else return!1}}function fW(t){for(;;){if(Zv(t))return!1;if(ew(t))return!0;if(t.$container)t=t.$container;else return!1}}class pW extends lD{constructor(e){super(e),this.services=e}get allExcludingBuiltin(){const e=this.services.
|
|
1638
|
+
workspace.ProjectsManager;return super.all.filter(n=>!ps(n)||$d(n.uri)?!1:(n.likec4ProjectId=e.belongsTo(n.uri),!0))}projectDocuments(e){return this.allExcludingBuiltin.filter(n=>n.likec4ProjectId===e)}groupedByProject(){return ca(this.allExcludingBuiltin.toArray(),Xr("likec4ProjectId"))}}class hW extends ED{constructor(e){super(e),this.services=e,this.documentFactory=e.workspace.LangiumDocumentFactory}documentFactory;async loadAdditionalDocuments(e,n){const r=this.services.workspace.ProjectsManager;
|
|
1639
|
+
for(const i of e)try{const s=await this.fileSystemProvider.readDirectory(dt.parse(i.uri));for(const o of s)try{await r.loadConfigFile(o)}catch(a){Rd(a)}}catch(s){Rd(s)}n(this.documentFactory.fromString(KC,dt.parse(vU))),await super.loadAdditionalDocuments(e,n)}includeEntry(e,n,r){return this.services.workspace.ProjectsManager.isConfigFile(n)?!1:n.isFile?!this.services.workspace.ProjectsManager.checkIfExcluded(n.uri):super.includeEntry(e,n,r)}workspace(){return this.folders&&Q_(this.folders,1)?this.
|
|
1640
|
+
folders[0]:null}get workspaceUri(){const e=this.workspace();return Ae(e,"Workspace not initialized"),dt.parse(e.uri)}get workspaceURL(){const e=this.workspace();return Ae(e,"Workspace not initialized"),new URL(e.uri)}}const hA=t=>Number.isFinite(t)?t:0;function mW(t){return{days:Math.trunc(t/864e5),hours:Math.trunc(t/36e5%24),minutes:Math.trunc(t/6e4%60),seconds:Math.trunc(t/1e3%60),milliseconds:Math.trunc(t%1e3),microseconds:Math.trunc(hA(t*1e3)%1e3),nanoseconds:Math.trunc(hA(t*1e6)%1e3)}}function gW(t){
|
|
1641
|
+
return{days:t/86400000n,hours:t/3600000n%24n,minutes:t/60000n%60n,seconds:t/1000n%60n,milliseconds:t%1000n,microseconds:0n,nanoseconds:0n}}function yW(t){switch(typeof t){case"number":{if(Number.isFinite(t))return mW(t);break}case"bigint":return gW(t)}throw new TypeError("Expected a finite number or bigint")}const vW=t=>t===0||t===0n,wW=(t,e)=>e===1||e===1n?t:`${t}s`,bW=1e-7,EW=24n*60n*60n*1000n;function mA(t,e){const n=typeof t=="bigint";if(!n&&!Number.isFinite(t))throw new TypeError("Expected \
|
|
1642
|
+
a finite number or bigint");e={...e};const r=t<0?"-":"";t=t<0?-t:t,e.colonNotation&&(e.compact=!1,e.formatSubMilliseconds=!1,e.separateMilliseconds=!1,e.verbose=!1),e.compact&&(e.unitCount=1,e.secondsDecimalDigits=0,e.millisecondsDecimalDigits=0);let i=[];const s=(l,f)=>{const d=Math.floor(l*10**f+bW);return(Math.round(d)/10**f).toFixed(f)},o=(l,f,d,p)=>{if(!((i.length===0||!e.colonNotation)&&vW(l)&&!(e.colonNotation&&d==="m"))){if(p??=String(l),e.colonNotation){const m=p.includes(".")?p.split("\
|
|
1643
|
+
.")[0].length:p.length,w=i.length>0?2:1;p="0".repeat(Math.max(0,w-m))+p}else p+=e.verbose?" "+wW(f,l):d;i.push(p)}},a=yW(t),u=BigInt(a.days);if(e.hideYearAndDays?o(BigInt(u)*24n+BigInt(a.hours),"hour","h"):(e.hideYear?o(u,"day","d"):(o(u/365n,"year","y"),o(u%365n,"day","d")),o(Number(a.hours),"hour","h")),o(Number(a.minutes),"minute","m"),!e.hideSeconds)if(e.separateMilliseconds||e.formatSubMilliseconds||!e.colonNotation&&t<1e3){const l=Number(a.seconds),f=Number(a.milliseconds),d=Number(a.microseconds),
|
|
1644
|
+
p=Number(a.nanoseconds);if(o(l,"second","s"),e.formatSubMilliseconds)o(f,"millisecond","ms"),o(d,"microsecond","\xB5s"),o(p,"nanosecond","ns");else{const m=f+d/1e3+p/1e6,w=typeof e.millisecondsDecimalDigits=="number"?e.millisecondsDecimalDigits:0,y=m>=1?Math.round(m):Math.ceil(m),g=w?m.toFixed(w):y;o(Number.parseFloat(g),"millisecond","ms",g)}}else{const l=(n?Number(t%EW):t)/1e3%60,f=typeof e.secondsDecimalDigits=="number"?e.secondsDecimalDigits:1,d=s(l,f),p=e.keepDecimalsOnWholeSeconds?d:d.replace(
|
|
1645
|
+
/\.0+$/,"");o(Number.parseFloat(p),"second","s",p)}if(i.length===0)return r+"0"+(e.verbose?" milliseconds":"ms");const c=e.colonNotation?":":" ";return typeof e.unitCount=="number"&&(i=i.slice(0,Math.max(e.unitCount,1))),r+i.join(c)}class tw{toDispose=[];isDisposed=!1;onDispose(...e){this.toDispose.push(...e)}dispose(){this.throwIfDisposed(),this.isDisposed=!0;let e;for(;e=this.toDispose.pop();)try{e.dispose()}catch(n){Rd(n)}}throwIfDisposed(){if(this.isDisposed)throw new Error("This has already\
|
|
1646
|
+
been disposed")}}function ko(t){let e=Ov(t)?t.el.ref:t.modelElement.value.ref;return e?.$type==="Imported"&&(e=e.imported.ref),e?.$type==="Element"?e:void 0}function To(t){const e=[t.$type==="StrictFqnRef"?t.value.$refText:t.el.$refText];let n=t.parent;for(;n;)e.push(n.$type==="StrictFqnRef"?n.value.$refText:n.el.$refText),n=n.parent;return e.length===1?e[0]:e.reverse().join(".")}function $W(t){for(;t.parent;)t=t.parent;return t.value.ref??null}function RW(t){let e;for(;e=t.value?.ref;){if(Cn(e))
|
|
1647
|
+
return null;if(jn(e))return e;if(Et(t.parent))return null;t=t.parent}return null}function DW(t){const e=$W(t);return e?.$type==="Imported"?e:null}function kW(t){let e;for(;e=t.value?.ref;){if(Ip(e))return!0;if(Et(t.parent))return!1;t=t.parent}return!1}function Bt(t){if(Zr(t)){for(;t.$type==="Imported"&&t.$container;)t=t.$container;Ae(kl(t))}if(kl(t))return t.project;const e=kt(t)?ut(t):t;return xt(e.likec4ProjectId,()=>`Invalid state, document ${e.uri} has no project ID assigned`)}function Nd(...t){
|
|
1648
|
+
var e=t.length>1?t.join(":::"):t[0];return Z_(e)}function gA(t){try{return t()}catch(e){st.debug("Safe call failed",{error:e});return}}function nw(){try{return performance.now()}catch{return Date.now()}}function Jh(){const t=nw();return{get ms(){return nw()-t},get pretty(){return mA(nw()-t)}}}var TW=Object.getOwnPropertyNames,CW=Object.getOwnPropertySymbols,AW=Object.prototype.hasOwnProperty;function yA(t,e){return function(r,i,s){return t(r,i,s)&&e(r,i,s)}}function Qh(t){return function(n,r,i){
|
|
1649
|
+
if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,i);var s=i.cache,o=s.get(n),a=s.get(r);if(o&&a)return o===r&&a===n;s.set(n,r),s.set(r,n);var u=t(n,r,i);return s.delete(n),s.delete(r),u}}function vA(t){return TW(t).concat(CW(t))}var SW=Object.hasOwn||function(t,e){return AW.call(t,e)};function Co(t,e){return t===e||!t&&!e&&t!==t&&e!==e}var _W="__v",xW="__o",PW="_owner",wA=Object.getOwnPropertyDescriptor,bA=Object.keys;function NW(t,e,n){var r=t.length;if(e.length!==r)return!1;for(;r-- >
|
|
1650
|
+
0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function IW(t,e){return Co(t.getTime(),e.getTime())}function OW(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function LW(t,e){return t===e}function EA(t,e,n){var r=t.size;if(r!==e.size)return!1;if(!r)return!0;for(var i=new Array(r),s=t.entries(),o,a,u=0;(o=s.next())&&!o.done;){for(var c=e.entries(),l=!1,f=0;(a=c.next())&&!a.done;){if(i[f]){f++;continue}var d=o.value,p=a.value;if(n.equals(d[0],p[0],
|
|
1651
|
+
u,f,t,e,n)&&n.equals(d[1],p[1],d[0],p[0],t,e,n)){l=i[f]=!0;break}f++}if(!l)return!1;u++}return!0}var FW=Co;function MW(t,e,n){var r=bA(t),i=r.length;if(bA(e).length!==i)return!1;for(;i-- >0;)if(!RA(t,e,n,r[i]))return!1;return!0}function Id(t,e,n){var r=vA(t),i=r.length;if(vA(e).length!==i)return!1;for(var s,o,a;i-- >0;)if(s=r[i],!RA(t,e,n,s)||(o=wA(t,s),a=wA(e,s),(o||a)&&(!o||!a||o.configurable!==a.configurable||o.enumerable!==a.enumerable||o.writable!==a.writable)))return!1;return!0}function BW(t,e){
|
|
1652
|
+
return Co(t.valueOf(),e.valueOf())}function qW(t,e){return t.source===e.source&&t.flags===e.flags}function $A(t,e,n){var r=t.size;if(r!==e.size)return!1;if(!r)return!0;for(var i=new Array(r),s=t.values(),o,a;(o=s.next())&&!o.done;){for(var u=e.values(),c=!1,l=0;(a=u.next())&&!a.done;){if(!i[l]&&n.equals(o.value,a.value,o.value,a.value,t,e,n)){c=i[l]=!0;break}l++}if(!c)return!1}return!0}function jW(t,e){var n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function GW(t,e){
|
|
1653
|
+
return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function RA(t,e,n,r){return(r===PW||r===xW||r===_W)&&(t.$$typeof||e.$$typeof)?!0:SW(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}var UW="[object Arguments]",WW="[object Boolean]",zW="[object Date]",HW="[object Error]",KW="[object Map]",VW="[object Number]",XW="[object Object]",YW="[object RegExp]",JW="[object Set]",QW="[object String]",ZW="[o\
|
|
1654
|
+
bject URL]",ez=Array.isArray,DA=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,kA=Object.assign,tz=Object.prototype.toString.call.bind(Object.prototype.toString);function nz(t){var e=t.areArraysEqual,n=t.areDatesEqual,r=t.areErrorsEqual,i=t.areFunctionsEqual,s=t.areMapsEqual,o=t.areNumbersEqual,a=t.areObjectsEqual,u=t.arePrimitiveWrappersEqual,c=t.areRegExpsEqual,l=t.areSetsEqual,f=t.areTypedArraysEqual,d=t.areUrlsEqual;return function(m,w,y){if(m===w)return!0;if(m==null||
|
|
1655
|
+
w==null)return!1;var g=typeof m;if(g!==typeof w)return!1;if(g!=="object")return g==="number"?o(m,w,y):g==="function"?i(m,w,y):!1;var b=m.constructor;if(b!==w.constructor)return!1;if(b===Object)return a(m,w,y);if(ez(m))return e(m,w,y);if(DA!=null&&DA(m))return f(m,w,y);if(b===Date)return n(m,w,y);if(b===RegExp)return c(m,w,y);if(b===Map)return s(m,w,y);if(b===Set)return l(m,w,y);var R=tz(m);return R===zW?n(m,w,y):R===YW?c(m,w,y):R===KW?s(m,w,y):R===JW?l(m,w,y):R===XW?typeof m.then!="function"&&typeof w.
|
|
1656
|
+
then!="function"&&a(m,w,y):R===ZW?d(m,w,y):R===HW?r(m,w,y):R===UW?a(m,w,y):R===WW||R===VW||R===QW?u(m,w,y):!1}}function rz(t){var e=t.circular,n=t.createCustomConfig,r=t.strict,i={areArraysEqual:r?Id:NW,areDatesEqual:IW,areErrorsEqual:OW,areFunctionsEqual:LW,areMapsEqual:r?yA(EA,Id):EA,areNumbersEqual:FW,areObjectsEqual:r?Id:MW,arePrimitiveWrappersEqual:BW,areRegExpsEqual:qW,areSetsEqual:r?yA($A,Id):$A,areTypedArraysEqual:r?Id:jW,areUrlsEqual:GW};if(n&&(i=kA({},i,n(i))),e){var s=Qh(i.areArraysEqual),
|
|
1657
|
+
o=Qh(i.areMapsEqual),a=Qh(i.areObjectsEqual),u=Qh(i.areSetsEqual);i=kA({},i,{areArraysEqual:s,areMapsEqual:o,areObjectsEqual:a,areSetsEqual:u})}return i}function iz(t){return function(e,n,r,i,s,o,a){return t(e,n,a)}}function sz(t){var e=t.circular,n=t.comparator,r=t.createState,i=t.equals,s=t.strict;if(r)return function(u,c){var l=r(),f=l.cache,d=f===void 0?e?new WeakMap:void 0:f,p=l.meta;return n(u,c,{cache:d,equals:i,meta:p,strict:s})};if(e)return function(u,c){return n(u,c,{cache:new WeakMap,
|
|
1658
|
+
equals:i,meta:void 0,strict:s})};var o={cache:void 0,equals:i,meta:void 0,strict:s};return function(u,c){return n(u,c,o)}}var rw=hs();hs({strict:!0}),hs({circular:!0}),hs({circular:!0,strict:!0}),hs({createInternalComparator:function(){return Co}}),hs({strict:!0,createInternalComparator:function(){return Co}}),hs({circular:!0,createInternalComparator:function(){return Co}}),hs({circular:!0,createInternalComparator:function(){return Co},strict:!0});function hs(t){t===void 0&&(t={});var e=t.circular,
|
|
1659
|
+
n=e===void 0?!1:e,r=t.createInternalComparator,i=t.createState,s=t.strict,o=s===void 0?!1:s,a=rz(t),u=nz(a),c=r?r(u):iz(u);return sz({circular:n,comparator:u,createState:i,equals:c,strict:o})}var oz=Object.defineProperty,az=(t,e,n)=>e in t?oz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,TA=(t,e,n)=>az(t,typeof e!="symbol"?e+"":e,n);let uz=class qi{constructor(e,n){TA(this,"x"),TA(this,"y"),this.x=e,this.y=n}static of([e,n]){return new qi(e,n)}add(e){return new qi(this.x+e.x,this.
|
|
1660
|
+
y+e.y)}subtract(e){return new qi(this.x-e.x,this.y-e.y)}multiply(e){return new qi(this.x*e,this.y*e)}divide(e){return new qi(this.x/e,this.y/e)}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-e.x*this.y}hadamard(e){return new qi(this.x*e.x,this.y*e.y)}length(){return Math.sqrt(this.x**2+this.y**2)}normalize(){const e=this.length();return new qi(this.x/e,this.y/e)}rotateByRadians(e){const n=Math.cos(e),r=Math.sin(e);return new qi(this.x*n-this.y*r,this.x*r+this.y*n)}rotateByDegrees(e){
|
|
1661
|
+
return this.rotateByRadians(e*Math.PI/180)}};const cz=100,CA=100,ms={top:50,right:40,bottom:40,left:40};function AA(t,e){const n=t.nodes.map(i=>{const s=e.nodes[i.id];if(!s)return i;const{x:o,y:a,width:u,height:c}=s;return{...i,width:u,height:c,position:[o,a]}}),r=t.edges.map(i=>{const s=e.edges[i.id];return s?{...i,...s}:i});return{...t,bounds:{x:e.x,y:e.y,width:e.width,height:e.height},nodes:n,edges:r}}function lz(t,e){const n=new Map(t.nodes.map(i=>[i.id,i]));if(t.hash===e.hash||fz(t,e))return _A(
|
|
1662
|
+
t.nodes.filter(i=>!i.parent),n,e),AA(t,e);t.hasLayoutDrift=!0;const r=Ka.merge(...t.nodes.map(i=>e.nodes[i.id]).filter(i=>!!i));return t.nodes.filter(i=>i.parent==null).reduce((i,s)=>SA(s,i,n,e),{x:r.x,y:r.y+r.height+CA}),t.edges.filter(i=>!e.edges[i.id]).forEach(i=>dz(i,e)),AA(t,e)}function SA(t,e,n,r){let i=r.nodes[t.id];const s=i?.isCompound??!1,o=!i,a=o?e:{x:i.x,y:i.y},u=t.children.map(f=>r.nodes[f]).filter(f=>!!f),c=u.length>0&&Ka.merge(...u),l=s&&c?{x:c.x,y:c.y+c.height+CA}:{x:a.x+ms.left,
|
|
1663
|
+
y:a.y+ms.top};return t.children.map(f=>n.get(f)).reduce((f,d)=>SA(d,f,n,r),l),i=t.children.length>0?xA(t,r):r.nodes[t.id]??{isCompound:!1,width:t.width,height:t.height,x:a.x,y:a.y},r.nodes[t.id]=i,o?{x:i.x+i.width+cz,y:i.y}:e}function dz(t,e){const n=e.nodes[t.source],r=e.nodes[t.target],i=PA(Ka.center(n)),s=PA(Ka.center(r)),o=s.subtract(i),a={...t?.labelBBox??{width:0,height:0},...o.divide(2).add(i)},u=o.multiply(.7).add(i),c=o.multiply(.3).add(i);e.edges[t.id]={points:[[i.x,i.y],[c.x,c.y],[u.x,
|
|
1664
|
+
u.y],[s.x,s.y]],labelBBox:a,controlPoints:[u]}}function _A(t,e,n){t.filter(r=>r.children.length>0).forEach(r=>{_A(r.children.map(i=>e.get(i)).filter(i=>!!i),e,n),n.nodes[r.id]=xA(r,n)})}function xA(t,e){const n=Ka.merge(...t.children.map(r=>e.nodes[r]));return{isCompound:!0,x:n.x-ms.left,y:n.y-ms.top,width:n.width+ms.left+ms.right,height:n.height+ms.top+ms.bottom}}function fz(t,e){const n=r=>r.children.length>0;return rw(t.autoLayout,e.autoLayout)&&t.nodes.every(r=>{const i=e.nodes[r.id];return!!i&&
|
|
1665
|
+
n(r)===i.isCompound})&&t.edges.every(r=>!!e.edges[r.id])}function PA({x:t,y:e}){return new uz(t,e)}function NA(t){return typeof t=="object"&&t!==null&&typeof t.id=="string"}function iw(t){return typeof t=="object"&&t!==null&&t.$$type==="Node"&&typeof t.id=="string"}function IA(t){return iw(t)||NA(t)}function Od(t){return typeof t=="string"||IA(t)}function pz(t){return Array.isArray(t)&&t.every(Od)}function hz(t){return["n","ne","e","se","s","sw","w","nw","c"].includes(t)}function OA(t){if(IA(t))
|
|
1666
|
+
return t;const[e,n,r]=t.split(":");return hz(r)?{id:e,port:n,compass:r}:{id:e,port:n}}function mz(t){if(t.length<2&&(Od(t[0])&&Od(t[1]))===!1)throw Error("EdgeTargets must have at least 2 elements.");return t.map(e=>OA(e))}const Zh=Object.seal({Graph:null,Digraph:null,Subgraph:null,Node:null,Edge:null});function gz(t){return Object.assign(Object.seal(Object.assign({},Zh)),t)}function yz(...t){const[e,...n]=t;return(...r)=>n.reduce((i,s)=>s(i),e(...r))}function pr(t,...e){return yz(t,...e)}const vz=t=>(...e)=>n=>t(
|
|
1667
|
+
n,...e),wz=t=>({[Symbol.iterator]:t}),Nr=vz((t,e)=>Array.from(wz(function*(){for(const n of t)yield e(n)})));class LA{options;getLocation(){return this.options?.locationFunction?.()??null}constructor(e){this.options=e}createElement(e,n,r=[]){return{location:this.getLocation(),...n,type:e,children:r}}}const rt=LA.prototype.createElement.bind(new LA),bz=/\r?\n/;function Ir(t){return e=>e.join(t)}function Ez(t){return e=>t+e+t}function gs(t,e){return n=>t+n+e}function em(t){return e=>t+e}const FA=t=>t.
|
|
1668
|
+
replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/"/g,'\\"'),tm=t=>t.split(bz),Ld=(t,e,n)=>pr(tm,Nr(em(t==="space"?" ".repeat(e):`
|
|
1668
1669
|
`)),Ir(n)),Ao=t=>{switch(t){case"crlf":return`\r
|
|
1669
1670
|
`;case"lf":return`
|
|
1670
|
-
`}},$z={match(t){return t.type==="AttributeList"},print(t,e){if(e.children.length===0)return`${e.kind.toLocaleLowerCase()} [];`;const n=Ao(t.endOfLine);return pr(Nr(t.print),Ir(n),Ld(t.indentStyle,t.indentSize,n),gs(`${e.kind.toLocaleLowerCase()} [${n}`,`${n}];`))(e.children)}},Rz={match(t){return t.type==="Attribute"},print(t,e){return`${t.print(e.key)} = ${t.print(e.value)};`}},Dz={match(t){return t.type==="Comment"},print(t,e){const n=Ao(t.endOfLine);switch(e.kind){case"Block":return pr(
|
|
1671
|
-
|
|
1671
|
+
`}},$z={match(t){return t.type==="AttributeList"},print(t,e){if(e.children.length===0)return`${e.kind.toLocaleLowerCase()} [];`;const n=Ao(t.endOfLine);return pr(Nr(t.print),Ir(n),Ld(t.indentStyle,t.indentSize,n),gs(`${e.kind.toLocaleLowerCase()} [${n}`,`${n}];`))(e.children)}},Rz={match(t){return t.type==="Attribute"},print(t,e){return`${t.print(e.key)} = ${t.print(e.value)};`}},Dz={match(t){return t.type==="Comment"},print(t,e){const n=Ao(t.endOfLine);switch(e.kind){case"Block":return pr(tm,Nr(
|
|
1672
|
+
em(" * ")),Ir(n),gs(`/**${n}`,`${n} */`))(e.value);case"Macro":return pr(tm,Nr(em("# ")),Ir(n))(e.value);case"Slash":default:return pr(tm,Nr(em("// ")),Ir(n))(e.value)}}},kz={match(t){return t.type==="Dot"},print(t,e){return e.children.map(t.print).join(Ao(t.endOfLine))}},Tz={match(t){return t.type==="Edge"},print(t,e){const n=pr(Nr(t.print),Ir(t.directed?" -> ":" -- "))(e.targets);if(e.children.length===0)return`${n};`;const r=Ao(t.endOfLine),i=pr(Nr(t.print),Ir(r),Ld(t.indentStyle,t.indentSize,
|
|
1672
1673
|
r),gs(`[${r}`,`${r}];`))(e.children);return`${n} ${i}`}},Cz={match(t){return t.type==="Graph"},print(t,e){t.directed=e.directed;const n=[];if(e.strict&&n.push("strict"),n.push(e.directed?"digraph":"graph"),e.id&&n.push(t.print(e.id)),e.children.length===0)return`${n.join(" ")} {}`;const r=Ao(t.endOfLine),i=pr(Nr(t.print),Ir(r),Ld(t.indentStyle,t.indentSize,r),gs(`{${r}`,`${r}}`))(e.children);return`${n.join(" ")} ${i}`}},Az=pr(FA,Ez('"')),Sz=gs("<",">"),_z={match(t){return t.type==="Literal"},print(t,e){
|
|
1673
1674
|
switch(e.quoted){case"html":return Sz(e.value);case!0:return Az(e.value);case!1:default:return FA(e.value)}}},xz={match(t){return t.type==="Node"},print(t,e){const n=t.print(e.id);if(e.children.length===0)return`${n};`;const r=Ao(t.endOfLine),i=pr(Nr(t.print),Ir(r),Ld(t.indentStyle,t.indentSize,r),gs(`[${r}`,`${r}];`))(e.children);return`${n} ${i}`}},Pz={match(t){return t.type==="NodeRefGroup"},print(t,e){return pr(Nr(t.print),Ir(" "),gs("{","}"))(e.children)}},Nz={match(t){return t.type==="Node\
|
|
1674
1675
|
Ref"},print(t,e){const n=[t.print(e.id)];return e.port&&n.push(t.print(e.port)),e.compass&&n.push(t.print(e.compass)),n.join(":")}},Iz={match(t){return t.type==="Subgraph"},print(t,e){const n=["subgraph"];if(e.id&&n.push(t.print(e.id)),e.children.length===0)return`${n.join(" ")} {}`;const r=Ao(t.endOfLine),i=pr(Nr(t.print),Ir(r),Ld(t.indentStyle,t.indentSize,r),gs(`{${r}`,`${r}}`))(e.children);return`${n.join(" ")} ${i}`}},Oz=[$z,Rz,Dz,kz,Tz,Cz,_z,xz,Pz,Nz,Iz];class Lz{options;#e=[...Oz];constructor(e={}){
|
|
1675
|
-
this.options=e}print(e){const n=[...this.#e],{indentSize:r=2,indentStyle:i="space",endOfLine:s="lf"}=this.options,o={directed:!0,indentSize:r,indentStyle:i,endOfLine:s,print(a){for(const u of n)if(u.match(a))return u.print(o,a);throw Error()}};return o.print(e)}}function Fz(t,e){const n=new Lz(e).print(t);if(!n)throw new Error;return n}function
|
|
1676
|
-
slice(1,n.length-1),quoted:"html"},[])},[]):rt("Attribute",{key:rt("Literal",{value:t,quoted:!1},[]),value:rt("Literal",{value:e,quoted:!0},[])},[])}return rt("Attribute",{key:rt("Literal",{value:t,quoted:!1},[]),value:rt("Literal",{value:String(e),quoted:!1},[])},[])}function So(t,e){return rt("Comment",{kind:e,value:t},[])}function MA(t,e){return Array.from(function*(){for(const[n,r]of e.values)yield
|
|
1677
|
-
commentKind)),yield t.convert(n));for(const n of e.nodes)n.comment&&(yield So(n.comment,t.commentKind)),yield t.convert(n);for(const n of e.subgraphs)n.comment&&(yield So(n.comment,t.commentKind)),yield t.convert(n);for(const n of e.edges)n.comment&&(yield So(n.comment,t.commentKind)),yield t.convert(n)}())}const Mz={match(t){return t.$$type==="AttributeList"},convert(t,e){return rt("AttributeList",{kind:e.$$kind},e.values.map(([n,r])=>
|
|
1676
|
+
this.options=e}print(e){const n=[...this.#e],{indentSize:r=2,indentStyle:i="space",endOfLine:s="lf"}=this.options,o={directed:!0,indentSize:r,indentStyle:i,endOfLine:s,print(a){for(const u of n)if(u.match(a))return u.print(o,a);throw Error()}};return o.print(e)}}function Fz(t,e){const n=new Lz(e).print(t);if(!n)throw new Error;return n}function nm(t,e){if(typeof e=="string"){const n=e.trim();return/^<.+>$/ms.test(n)?rt("Attribute",{key:rt("Literal",{value:t,quoted:!1},[]),value:rt("Literal",{value:n.
|
|
1677
|
+
slice(1,n.length-1),quoted:"html"},[])},[]):rt("Attribute",{key:rt("Literal",{value:t,quoted:!1},[]),value:rt("Literal",{value:e,quoted:!0},[])},[])}return rt("Attribute",{key:rt("Literal",{value:t,quoted:!1},[]),value:rt("Literal",{value:String(e),quoted:!1},[])},[])}function So(t,e){return rt("Comment",{kind:e,value:t},[])}function MA(t,e){return Array.from(function*(){for(const[n,r]of e.values)yield nm(n,r);for(const n of Object.values(e.attributes))n.size>0&&(n.comment&&(yield So(n.comment,t.
|
|
1678
|
+
commentKind)),yield t.convert(n));for(const n of e.nodes)n.comment&&(yield So(n.comment,t.commentKind)),yield t.convert(n);for(const n of e.subgraphs)n.comment&&(yield So(n.comment,t.commentKind)),yield t.convert(n);for(const n of e.edges)n.comment&&(yield So(n.comment,t.commentKind)),yield t.convert(n)}())}const Mz={match(t){return t.$$type==="AttributeList"},convert(t,e){return rt("AttributeList",{kind:e.$$kind},e.values.map(([n,r])=>nm(n,r)))}},Bz={match(t){return t.$$type==="Edge"},convert(t,e){
|
|
1678
1679
|
return rt("Edge",{targets:e.targets.map(n=>iw(n)?rt("NodeRef",{id:rt("Literal",{value:n.id,quoted:!0},[])},[]):NA(n)?rt("NodeRef",{id:rt("Literal",{value:n.id,quoted:!0},[]),port:n.port?rt("Literal",{value:n.port,quoted:!0},[]):void 0,compass:n.compass?rt("Literal",{value:n.compass,quoted:!0},[]):void 0},[]):rt("NodeRefGroup",{},n.map(r=>iw(r)?rt("NodeRef",{id:rt("Literal",{value:r.id,quoted:!0},[])},[]):rt("NodeRef",{id:rt("Literal",{value:r.id,quoted:!0},[]),port:r.port?rt("Literal",{value:r.port,
|
|
1679
|
-
quoted:!0},[]):void 0,compass:r.compass?rt("Literal",{value:r.compass,quoted:!0},[]):void 0},[]))))},[...e.attributes.comment?[So(e.attributes.comment,t.commentKind)]:[],...e.attributes.values.map(([n,r])=>
|
|
1680
|
-
return rt("Node",{id:rt("Literal",{value:e.id,quoted:!0},[])},[...e.attributes.comment?[So(e.attributes.comment,t.commentKind)]:[],...e.attributes.values.map(([n,r])=>
|
|
1680
|
+
quoted:!0},[]):void 0,compass:r.compass?rt("Literal",{value:r.compass,quoted:!0},[]):void 0},[]))))},[...e.attributes.comment?[So(e.attributes.comment,t.commentKind)]:[],...e.attributes.values.map(([n,r])=>nm(n,r))])}},qz={match(t){return t.$$type==="Graph"},convert(t,e){return rt("Dot",{},[...e.comment?[So(e.comment,t.commentKind)]:[],rt("Graph",{directed:e.directed,strict:e.strict,id:e.id?rt("Literal",{value:e.id,quoted:!0},[]):void 0},MA(t,e))])}},jz={match(t){return t.$$type==="Node"},convert(t,e){
|
|
1681
|
+
return rt("Node",{id:rt("Literal",{value:e.id,quoted:!0},[])},[...e.attributes.comment?[So(e.attributes.comment,t.commentKind)]:[],...e.attributes.values.map(([n,r])=>nm(n,r))])}},Gz={match(t){return t.$$type==="Subgraph"},convert(t,e){return rt("Subgraph",{id:e.id?rt("Literal",{value:e.id,quoted:!0},[]):void 0},MA(t,e))}},Uz=[Mz,Bz,jz,qz,Gz];class Wz{options;#e=[...Uz];constructor(e={}){this.options=e}convert(e){const n=[...this.#e],{commentKind:r="Slash"}=this.options,i={commentKind:r,convert(s){
|
|
1681
1682
|
for(const o of n)if(o.match(s))return o.convert(i,s);throw Error()}};return i.convert(e)}}function zz(t,e){return new Wz(e).convert(t)}const q=new Proxy(Object.freeze({}),{get:(t,e)=>e});class sw{}class ow extends sw{#e=new Map;constructor(e){super(),e!==void 0&&this.apply(e)}get values(){return Array.from(this.#e.entries())}get size(){return this.#e.size}get(e){return this.#e.get(e)}set(e,n){n!=null&&this.#e.set(e,n)}delete(e){this.#e.delete(e)}apply(e){const n=Array.isArray(e)?e:Object.entries(
|
|
1682
|
-
e);for(const[r,i]of n)this.set(r,i)}clear(){this.#e.clear()}}class aw extends ow{$$kind;get $$type(){return"AttributeList"}comment;constructor(e,n){super(n),this.$$kind=e}}class BA extends ow{#e=
|
|
1683
|
+
e);for(const[r,i]of n)this.set(r,i)}clear(){this.#e.clear()}}class aw extends ow{$$kind;get $$type(){return"AttributeList"}comment;constructor(e,n){super(n),this.$$kind=e}}class BA extends ow{#e=Zh;id;comment;attributes=Object.freeze({graph:new aw("Graph"),edge:new aw("Edge"),node:new aw("Node")});get nodes(){return Array.from(this.#t.nodes.values())}get edges(){return Array.from(this.#t.edges.values())}get subgraphs(){return Array.from(this.#t.subgraphs.values())}#t={nodes:new Map,edges:new Set,
|
|
1683
1684
|
subgraphs:new Set};with(e){this.#e=gz(e)}addNode(e){this.#t.nodes.set(e.id,e)}addEdge(e){this.#t.edges.add(e)}addSubgraph(e){this.#t.subgraphs.add(e)}existNode(e){return this.#t.nodes.has(e)}existEdge(e){return this.#t.edges.has(e)}existSubgraph(e){return this.#t.subgraphs.has(e)}createSubgraph(...e){const n=new this.#e.Subgraph(...e);return n.with(this.#e),this.addSubgraph(n),n}removeNode(e){this.#t.nodes.delete(typeof e=="string"?e:e.id)}removeEdge(e){this.#t.edges.delete(e)}removeSubgraph(e){
|
|
1684
1685
|
this.#t.subgraphs.delete(e)}createNode(e,n){const r=new this.#e.Node(e,n);return this.addNode(r),r}getSubgraph(e){return Array.from(this.#t.subgraphs.values()).find(n=>n.id===e)}getNode(e){return this.#t.nodes.get(e)}createEdge(e,n){const r=e.map(s=>pz(s)?mz(s):OA(s)),i=new this.#e.Edge(r,n);return this.addEdge(i),i}subgraph(...e){const n=e.find(o=>typeof o=="string"),r=e.find(o=>typeof o=="object"&&o!==null),i=e.find(o=>typeof o=="function"),s=n?this.getSubgraph(n)??this.createSubgraph(n):this.
|
|
1685
1686
|
createSubgraph();return r!==void 0&&s.apply(r),i!==void 0&&i(s),s}node(e,...n){if(typeof e=="string"){const r=e,i=n.find(a=>typeof a=="object"&&a!==null),s=n.find(a=>typeof a=="function"),o=this.getNode(r)??this.createNode(r);return i!==void 0&&o.attributes.apply(i),s!==void 0&&s(o),o}typeof e=="object"&&e!==null&&this.attributes.node.apply(e)}edge(e,...n){if(Array.isArray(e)){const r=e,i=n.find(a=>typeof a=="object"),s=n.find(a=>typeof a=="function"),o=this.createEdge(r,i);return s!==void 0&&s(
|
|
1686
1687
|
o),o}typeof e=="object"&&e!==null&&this.attributes.edge.apply(e)}graph(e){this.attributes.graph.apply(e)}}class qA extends BA{get $$type(){return"Graph"}id;strict;constructor(...e){super(),this.id=e.find(r=>typeof r=="string"),this.strict=e.find(r=>typeof r=="boolean")??!1;const n=e.find(r=>typeof r=="object"&&r!==null);n!==void 0&&this.apply(n)}}class Hz extends qA{get directed(){return!0}}let Kz=class extends qA{get directed(){return!1}};class Vz extends BA{get $$type(){return"Subgraph"}id;constructor(...e){
|
|
1687
1688
|
super(),this.id=e.find(r=>typeof r=="string");const n=e.find(r=>typeof r=="object"&&r!==null);n!==void 0&&this.apply(n)}isSubgraphCluster(){return typeof this.id=="string"?this.id.startsWith("cluster"):!1}}class jA extends ow{comment}let Xz=class extends sw{id;get $$type(){return"Node"}comment;attributes;constructor(e,n){super(),this.id=e,this.attributes=new jA(n)}port(e){return typeof e=="string"?{id:this.id,port:e}:{id:this.id,...e}}};class Yz extends sw{targets;get $$type(){return"Edge"}comment;attributes;constructor(e,n){
|
|
1688
|
-
if(super(),this.targets=e,e.length<2&&(Od(e[0])&&Od(e[1]))===!1)throw Error("The element of Edge target is missing or not satisfied as Edge target.");this.attributes=new jA(n)}}Object.assign(
|
|
1689
|
+
if(super(),this.targets=e,e.length<2&&(Od(e[0])&&Od(e[1]))===!1)throw Error("The element of Edge target is missing or not satisfied as Edge target.");this.attributes=new jA(n)}}Object.assign(Zh,{Graph:Kz,Digraph:Hz,Subgraph:Vz,Node:Xz,Edge:Yz});function GA(t,e){return(...n)=>{const r=t?this.Digraph:this.Graph,i=n.find(u=>typeof u=="string"),s=n.find(u=>typeof u=="object"),o=n.find(u=>typeof u=="function"),a=new r(i,e,s);return a.with(this),typeof o=="function"&&o(a),a}}function UA(t,e=Zh){return Object.
|
|
1689
1690
|
freeze({digraph:GA.call(e,!0,t),graph:GA.call(e,!1,t)})}const WA=UA(!1),Jz=WA.digraph;WA.graph,UA(!0);function Qz(t,e){const n=zz(t,e?.convert);return Fz(n,e?.print)}var uw,zA;function Zz(){if(zA)return uw;zA=1;function t(r){let i=r.length-1,s=r[i];for(;s===" "||s===" ";)s=r[--i];return r.substring(0,i+1)}function e(r){return r.split(`
|
|
1690
1691
|
`).map(o=>t(o)).join(`
|
|
1691
1692
|
`)}uw=function(r,i){if(i=i||{},r==null)return r;var s=i.width||50,o=typeof i.indent=="string"?i.indent:" ",a=i.newline||`
|
|
1692
1693
|
`+o,u=typeof i.escape=="function"?i.escape:n,c=".{1,"+s+"}";i.cut!==!0&&(c+="([\\s\u200B]+|$)|[^\\s\u200B]+?([\\s\u200B]+|$)");var l=new RegExp(c,"g"),f=r.match(l)||[],d=o+f.map(function(p){return p.slice(-1)===`
|
|
1693
|
-
`&&(p=p.slice(0,p.length-1)),u(p)}).join(a);return i.trim===!0&&(d=e(d)),d};function n(r){return r}return uw}var e6=Zz();const t6=vi(e6),
|
|
1694
|
-
1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t),hsl2rgb:({h:t,s:e,l:n},r)=>{if(!e)return n*2.55;t/=360,e/=100,n/=100;const i=n<.5?n*(1+e):n+e-n*e,s=2*n-i;switch(r){case"r":return
|
|
1695
|
-
return((e-n)/a+(e<n?6:0))*60;case e:return((n-t)/a+2)*60;case n:return((t-e)/a+4)*60;default:return-1}}},n6={clamp:(t,e,n)=>e>n?Math.min(e,Math.max(n,t)):Math.min(n,Math.max(e,t)),round:t=>Math.round(t*1e10)/1e10},r6={dec2hex:t=>{const e=Math.round(t).toString(16);return e.length>1?e:`0${e}`}},Ge={channel:
|
|
1694
|
+
`&&(p=p.slice(0,p.length-1)),u(p)}).join(a);return i.trim===!0&&(d=e(d)),d};function n(r){return r}return uw}var e6=Zz();const t6=vi(e6),rm={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:t=>t>=255?255:t<0?0:t,g:t=>t>=255?255:t<0?0:t,b:t=>t>=255?255:t<0?0:t,h:t=>t%360,s:t=>t>=100?100:t<0?0:t,l:t=>t>=100?100:t<0?0:t,a:t=>t>=1?1:t<0?0:t},toLinear:t=>{const e=t/255;return t>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92},hue2rgb:(t,e,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<
|
|
1695
|
+
1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t),hsl2rgb:({h:t,s:e,l:n},r)=>{if(!e)return n*2.55;t/=360,e/=100,n/=100;const i=n<.5?n*(1+e):n+e-n*e,s=2*n-i;switch(r){case"r":return rm.hue2rgb(s,i,t+1/3)*255;case"g":return rm.hue2rgb(s,i,t)*255;case"b":return rm.hue2rgb(s,i,t-1/3)*255}},rgb2hsl:({r:t,g:e,b:n},r)=>{t/=255,e/=255,n/=255;const i=Math.max(t,e,n),s=Math.min(t,e,n),o=(i+s)/2;if(r==="l")return o*100;if(i===s)return 0;const a=i-s,u=o>.5?a/(2-i-s):a/(i+s);if(r==="s")return u*100;switch(i){case t:
|
|
1696
|
+
return((e-n)/a+(e<n?6:0))*60;case e:return((n-t)/a+2)*60;case n:return((t-e)/a+4)*60;default:return-1}}},n6={clamp:(t,e,n)=>e>n?Math.min(e,Math.max(n,t)):Math.min(n,Math.max(e,t)),round:t=>Math.round(t*1e10)/1e10},r6={dec2hex:t=>{const e=Math.round(t).toString(16);return e.length>1?e:`0${e}`}},Ge={channel:rm,lang:n6,unit:r6},ys={};for(let t=0;t<=255;t++)ys[t]=Ge.unit.dec2hex(t);const hn={ALL:0,RGB:1,HSL:2};class i6{constructor(){this.type=hn.ALL}get(){return this.type}set(e){if(this.type&&this.type!==
|
|
1696
1697
|
e)throw new Error("Cannot change both RGB and HSL channels at the same time");this.type=e}reset(){this.type=hn.ALL}is(e){return this.type===e}}class s6{constructor(e,n){this.color=n,this.changed=!1,this.data=e,this.type=new i6}set(e,n){return this.color=n,this.changed=!1,this.data=e,this.type.type=hn.ALL,this}_ensureHSL(){const e=this.data,{h:n,s:r,l:i}=e;n===void 0&&(e.h=Ge.channel.rgb2hsl(e,"h")),r===void 0&&(e.s=Ge.channel.rgb2hsl(e,"s")),i===void 0&&(e.l=Ge.channel.rgb2hsl(e,"l"))}_ensureRGB(){
|
|
1697
1698
|
const e=this.data,{r:n,g:r,b:i}=e;n===void 0&&(e.r=Ge.channel.hsl2rgb(e,"r")),r===void 0&&(e.g=Ge.channel.hsl2rgb(e,"g")),i===void 0&&(e.b=Ge.channel.hsl2rgb(e,"b"))}get r(){const e=this.data,n=e.r;return!this.type.is(hn.HSL)&&n!==void 0?n:(this._ensureHSL(),Ge.channel.hsl2rgb(e,"r"))}get g(){const e=this.data,n=e.g;return!this.type.is(hn.HSL)&&n!==void 0?n:(this._ensureHSL(),Ge.channel.hsl2rgb(e,"g"))}get b(){const e=this.data,n=e.b;return!this.type.is(hn.HSL)&&n!==void 0?n:(this._ensureHSL(),Ge.
|
|
1698
1699
|
channel.hsl2rgb(e,"b"))}get h(){const e=this.data,n=e.h;return!this.type.is(hn.RGB)&&n!==void 0?n:(this._ensureRGB(),Ge.channel.rgb2hsl(e,"h"))}get s(){const e=this.data,n=e.s;return!this.type.is(hn.RGB)&&n!==void 0?n:(this._ensureRGB(),Ge.channel.rgb2hsl(e,"s"))}get l(){const e=this.data,n=e.l;return!this.type.is(hn.RGB)&&n!==void 0?n:(this._ensureRGB(),Ge.channel.rgb2hsl(e,"l"))}get a(){return this.data.a}set r(e){this.type.set(hn.RGB),this.changed=!0,this.data.r=e}set g(e){this.type.set(hn.RGB),
|
|
@@ -1714,10 +1715,10 @@ return t.trim().replaceAll("&","&").replaceAll("<","<").replaceAll(">","&
|
|
|
1714
1715
|
`);return an(n)&&n>0&&i.length>n&&(i=i.slice(0,n)),i}function xo({text:t,maxchars:e,fontsize:n,maxLines:r,bold:i,color:s}){let o=XA(t,{maxchars:e,maxLines:r,sanitize:f6}).join("<BR/>");i&&(o=`<B>${o}</B>`);const a=s?` COLOR="${s}"`:"";return`<FONT POINT-SIZE="${Fi(n)}"${a}>${o}</FONT>`}function lw(t){return Math.round(en.textSizes[t])}function p6(t){switch(t){case"xs":case"sm":return 30;case"md":return 40;case"lg":case"xl":return 55;default:Oe(t)}}function h6(t,e,n){const r=["sm","xs"].includes(
|
|
1715
1716
|
n.shape),i=de(t.icon),s=[xo({text:t.title,fontsize:lw(n.text),maxchars:p6(n.shape),maxLines:r?1:3})];if(n.shape!=="xs"){de(t.technology?.trim())&&s.push(xo({text:t.technology,fontsize:Math.ceil(lw(n.text)*.65),maxchars:i?35:45,maxLines:1,color:e.loContrast}));const a=ex.from(t.description).text;a&&s.push(xo({text:a,fontsize:Math.ceil(lw(n.text)*.75),maxchars:i?35:45,maxLines:r?3:5,color:e.loContrast}))}if(s.length===1&&i===!1)return`<${s[0]}>`;const o=i?(a,u,c)=>{let l=`<TD ALIGN="TEXT" BALIGN="\
|
|
1716
1717
|
LEFT">${a}</TD>`;if(u===0){const f=c.length>1?` ROWSPAN="${c.length}"`:"";let d=76;["xs","sm"].includes(n.shape)&&(d=16),(t.shape==="queue"||t.shape==="mobile")&&(d+=20),l=`<TD${f} WIDTH="${d}"> </TD>${l}`,l=`${l}<TD${f} WIDTH="16"> </TD>`}return`<TR>${l}</TR>`}:a=>`<TR><TD>${a}</TD></TR>`;return`<<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="4">${s.map(o).join("")}</TABLE>>`}function m6(t,e){const n=xo({text:t.title.toUpperCase(),maxchars:50,fontsize:11,maxLines:1,bold:!0,color:e});return n.includes(
|
|
1717
|
-
"<BR/>")?`<<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0"><TR><TD ALIGN="TEXT" BALIGN="LEFT">${n}</TD></TR></TABLE>>`:`<${n}>`}const
|
|
1718
|
-
</TD></TR>`).join("");return`<<TABLE BORDER="0" CELLPADDING="3" CELLSPACING="0" ${dw}>${r}</TABLE>>`}function g6(t,e){const n=`<TABLE BORDER="0" CELLPADDING="6" ${dw}><TR><TD WIDTH="20" HEIGHT="20"><FONT POINT-SIZE="${Fi(14)}"><B>${t}</B></FONT></TD></TR></TABLE>`;return de(e?.trim())?`<${['<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">',"<TR>",`<TD>${n}</TD>`,`<TD ${dw} CELLPADDING="3">`,xo({text:e,maxchars:
|
|
1718
|
+
"<BR/>")?`<<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0"><TR><TD ALIGN="TEXT" BALIGN="LEFT">${n}</TD></TR></TABLE>>`:`<${n}>`}const im=40,YA=5,dw=`BGCOLOR="${en.relationships[Ha].labelBgColor}A0"`;function JA({label:t,technology:e}){const n=[];if(de(t?.trim())&&n.push(xo({text:t,maxchars:im,fontsize:14,maxLines:YA,bold:t==="[...]"})),de(e?.trim())&&n.push(xo({text:`[ ${e} ]`,fontsize:12,maxLines:1,maxchars:im})),n.length===0)return null;const r=n.map(i=>`<TR><TD ALIGN="TEXT" BALIGN="LEFT">${i}\
|
|
1719
|
+
</TD></TR>`).join("");return`<<TABLE BORDER="0" CELLPADDING="3" CELLSPACING="0" ${dw}>${r}</TABLE>>`}function g6(t,e){const n=`<TABLE BORDER="0" CELLPADDING="6" ${dw}><TR><TD WIDTH="20" HEIGHT="20"><FONT POINT-SIZE="${Fi(14)}"><B>${t}</B></FONT></TD></TR></TABLE>`;return de(e?.trim())?`<${['<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">',"<TR>",`<TD>${n}</TD>`,`<TD ${dw} CELLPADDING="3">`,xo({text:e,maxchars:im,fontsize:14,maxLines:5}),"</TD>","</TR>","</TABLE>"].join("")}>`:`<${n}>`}var fw,
|
|
1719
1720
|
QA;function pw(){if(QA)return fw;QA=1;function t(e){if(typeof e!="function")throw new Error("obliterator/iterator: expecting a function!");this.next=e}return typeof Symbol<"u"&&(t.prototype[Symbol.iterator]=function(){return this}),t.of=function(){var e=arguments,n=e.length,r=0;return new t(function(){return r>=n?{done:!0}:{done:!1,value:e[r++]}})},t.empty=function(){var e=new t(function(){return{done:!0}});return e},t.fromSequence=function(e){var n=0,r=e.length;return new t(function(){return n>=
|
|
1720
|
-
r?{done:!0}:{done:!1,value:e[n++]}})},t.is=function(e){return e instanceof t?!0:typeof e=="object"&&e!==null&&typeof e.next=="function"},fw=t,fw}var y6=pw();const hr=vi(y6);var
|
|
1721
|
+
r?{done:!0}:{done:!1,value:e[n++]}})},t.is=function(e){return e instanceof t?!0:typeof e=="object"&&e!==null&&typeof e.next=="function"},fw=t,fw}var y6=pw();const hr=vi(y6);var sm={},ZA;function v6(){return ZA||(ZA=1,sm.ARRAY_BUFFER_SUPPORT=typeof ArrayBuffer<"u",sm.SYMBOL_SUPPORT=typeof Symbol<"u"),sm}var hw,eS;function tS(){if(eS)return hw;eS=1;var t=pw(),e=v6(),n=e.ARRAY_BUFFER_SUPPORT,r=e.SYMBOL_SUPPORT;function i(s){return typeof s=="string"||Array.isArray(s)||n&&ArrayBuffer.isView(s)?t.fromSequence(
|
|
1721
1722
|
s):typeof s!="object"||s===null?null:r&&typeof s[Symbol.iterator]=="function"?s[Symbol.iterator]():typeof s.next=="function"?s:null}return hw=function(o){var a=i(o);if(!a)throw new Error("obliterator: target is not iterable nor a valid iterator.");return a},hw}var mw,nS;function w6(){if(nS)return mw;nS=1;var t=tS();return mw=function(n,r){for(var i=arguments.length>1?r:1/0,s=i!==1/0?new Array(i):[],o,a=0,u=t(n);;){if(a===i)return s;if(o=u.next(),o.done)return a!==r&&(s.length=a),s;s[a++]=o.value}},
|
|
1722
1723
|
mw}var b6=w6();const rS=vi(b6);var gw,iS;function E6(){if(iS)return gw;iS=1;var t=pw(),e=tS();return gw=function(){var r=arguments,i=null,s=-1;return new t(function(){var a=null;do{if(i===null){if(s++,s>=r.length)return{done:!0};i=e(r[s])}if(a=i.next(),a.done===!0){i=null;continue}break}while(!0);return a})},gw}var $6=E6();const Mi=vi($6);function R6(){const t=arguments[0];for(let e=1,n=arguments.length;e<n;e++)if(arguments[e])for(const r in arguments[e])t[r]=arguments[e][r];return t}let zt=R6;typeof Object.
|
|
1723
1724
|
assign=="function"&&(zt=Object.assign);function mr(t,e,n,r){const i=t._nodes.get(e);let s=null;return i&&(r==="mixed"?s=i.out&&i.out[n]||i.undirected&&i.undirected[n]:r==="directed"?s=i.out&&i.out[n]:s=i.undirected&&i.undirected[n]),s}function ln(t){return typeof t=="object"&&t!==null}function sS(t){let e;for(e in t)return!1;return!0}function gr(t,e,n){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:!0,value:n})}function Or(t,e,n){const r={enumerable:!0,configurable:!0};typeof n==
|
|
@@ -1770,14 +1771,14 @@ nd the "${u}" node in the graph.`);return bw(!0,this.multi,r==="mixed"?this.type
|
|
|
1770
1771
|
toUpperCase()+n.slice(1,-1);t.prototype[o]=function(){const u=Array.prototype.slice.call(arguments),c=u.pop();return u.push((f,d,p,m,w,y,g)=>c(f,d,p,m,w,y,g)),!!this[s].apply(this,u)};const a="every"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[a]=function(){const u=Array.prototype.slice.call(arguments),c=u.pop();return u.push((f,d,p,m,w,y,g)=>!c(f,d,p,m,w,y,g)),!this[s].apply(this,u)}}function uH(t,e){const{name:n,type:r,direction:i}=e,s=n.slice(0,-1)+"Entries";t.prototype[s]=function(o,a){if(r!==
|
|
1771
1772
|
"mixed"&&this.type!=="mixed"&&r!==this.type)return hr.empty();if(!arguments.length)return eH(this,r);if(arguments.length===1){o=""+o;const u=this._nodes.get(o);if(!u)throw new ae(`Graph.${s}: could not find the "${o}" node in the graph.`);return nH(r,i,u)}if(arguments.length===2){o=""+o,a=""+a;const u=this._nodes.get(o);if(!u)throw new ae(`Graph.${s}: could not find the "${o}" source node in the graph.`);if(!this._nodes.has(a))throw new ae(`Graph.${s}: could not find the "${a}" target node in \
|
|
1772
1773
|
the graph.`);return iH(r,i,u,a)}throw new ge(`Graph.${s}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function cH(t){V6.forEach(e=>{sH(t,e),oH(t,e),aH(t,e),uH(t,e)})}const lH=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"\
|
|
1773
|
-
undirectedNeighbors",type:"undirected"}];function
|
|
1774
|
-
i);if(typeof n=="string")return Bd(t,null,r,r[n],i)}const s=new
|
|
1775
|
-
keys(n),i=r.length;let s=0;return new hr(function(){let a=null;do{if(s>=i)return t&&t.wrap(n),{done:!0};const u=n[r[s++]],c=u.source,l=u.target;if(a=c===e?l:c,t&&t.has(a.key)){a=null;continue}}while(a===null);return{done:!1,value:{neighbor:a.key,attributes:a.attributes}}})}function fH(t,e,n){if(t!=="mixed"){if(t==="undirected")return qd(null,n,n.undirected);if(typeof e=="string")return qd(null,n,n[e])}let r=hr.empty();const i=new
|
|
1774
|
+
undirectedNeighbors",type:"undirected"}];function om(){this.A=null,this.B=null}om.prototype.wrap=function(t){this.A===null?this.A=t:this.B===null&&(this.B=t)},om.prototype.has=function(t){return this.A!==null&&t in this.A||this.B!==null&&t in this.B};function Bd(t,e,n,r,i){for(const s in r){const o=r[s],a=o.source,u=o.target,c=a===n?u:a;if(e&&e.has(c.key))continue;const l=i(c.key,c.attributes);if(t&&l)return c.key}}function $w(t,e,n,r,i){if(e!=="mixed"){if(e==="undirected")return Bd(t,null,r,r.undirected,
|
|
1775
|
+
i);if(typeof n=="string")return Bd(t,null,r,r[n],i)}const s=new om;let o;if(e!=="undirected"){if(n!=="out"){if(o=Bd(t,null,r,r.in,i),t&&o)return o;s.wrap(r.in)}if(n!=="in"){if(o=Bd(t,s,r,r.out,i),t&&o)return o;s.wrap(r.out)}}if(e!=="directed"&&(o=Bd(t,s,r,r.undirected,i),t&&o))return o}function dH(t,e,n){if(t!=="mixed"){if(t==="undirected")return Object.keys(n.undirected);if(typeof e=="string")return Object.keys(n[e])}const r=[];return $w(!1,t,e,n,function(i){r.push(i)}),r}function qd(t,e,n){const r=Object.
|
|
1776
|
+
keys(n),i=r.length;let s=0;return new hr(function(){let a=null;do{if(s>=i)return t&&t.wrap(n),{done:!0};const u=n[r[s++]],c=u.source,l=u.target;if(a=c===e?l:c,t&&t.has(a.key)){a=null;continue}}while(a===null);return{done:!1,value:{neighbor:a.key,attributes:a.attributes}}})}function fH(t,e,n){if(t!=="mixed"){if(t==="undirected")return qd(null,n,n.undirected);if(typeof e=="string")return qd(null,n,n[e])}let r=hr.empty();const i=new om;return t!=="undirected"&&(e!=="out"&&(r=Mi(r,qd(i,n,n.in))),e!==
|
|
1776
1777
|
"in"&&(r=Mi(r,qd(i,n,n.out)))),t!=="directed"&&(r=Mi(r,qd(i,n,n.undirected))),r}function pH(t,e){const{name:n,type:r,direction:i}=e;t.prototype[n]=function(s){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return[];s=""+s;const o=this._nodes.get(s);if(typeof o>"u")throw new ae(`Graph.${n}: could not find the "${s}" node in the graph.`);return dH(r==="mixed"?this.type:r,i,o)}}function hH(t,e){const{name:n,type:r,direction:i}=e,s="forEach"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[s]=function(c,l){
|
|
1777
1778
|
if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return;c=""+c;const f=this._nodes.get(c);if(typeof f>"u")throw new ae(`Graph.${s}: could not find the "${c}" node in the graph.`);$w(!1,r==="mixed"?this.type:r,i,f,l)};const o="map"+n[0].toUpperCase()+n.slice(1);t.prototype[o]=function(c,l){const f=[];return this[s](c,(d,p)=>{f.push(l(d,p))}),f};const a="filter"+n[0].toUpperCase()+n.slice(1);t.prototype[a]=function(c,l){const f=[];return this[s](c,(d,p)=>{l(d,p)&&f.push(d)}),f};const u="reduce"+
|
|
1778
1779
|
n[0].toUpperCase()+n.slice(1);t.prototype[u]=function(c,l,f){if(arguments.length<3)throw new ge(`Graph.${u}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let d=f;return this[s](c,(p,m)=>{d=l(d,p,m)}),d}}function mH(t,e){const{name:n,type:r,direction:i}=e,s=n[0].toUpperCase()+n.slice(1,-1),o="find"+s;t.prototype[o]=function(c,l){if(r!=="mixed"&&this.type!==
|
|
1779
1780
|
"mixed"&&r!==this.type)return;c=""+c;const f=this._nodes.get(c);if(typeof f>"u")throw new ae(`Graph.${o}: could not find the "${c}" node in the graph.`);return $w(!0,r==="mixed"?this.type:r,i,f,l)};const a="some"+s;t.prototype[a]=function(c,l){return!!this[o](c,l)};const u="every"+s;t.prototype[u]=function(c,l){return!this[o](c,(d,p)=>!l(d,p))}}function gH(t,e){const{name:n,type:r,direction:i}=e,s=n.slice(0,-1)+"Entries";t.prototype[s]=function(o){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)
|
|
1780
|
-
return hr.empty();o=""+o;const a=this._nodes.get(o);if(typeof a>"u")throw new ae(`Graph.${s}: could not find the "${o}" node in the graph.`);return fH(r==="mixed"?this.type:r,i,a)}}function yH(t){lH.forEach(e=>{pH(t,e),hH(t,e),mH(t,e),gH(t,e)})}function
|
|
1781
|
+
return hr.empty();o=""+o;const a=this._nodes.get(o);if(typeof a>"u")throw new ae(`Graph.${s}: could not find the "${o}" node in the graph.`);return fH(r==="mixed"?this.type:r,i,a)}}function yH(t){lH.forEach(e=>{pH(t,e),hH(t,e),mH(t,e),gH(t,e)})}function am(t,e,n,r,i){const s=r._nodes.values(),o=r.type;let a,u,c,l,f,d;for(;a=s.next(),a.done!==!0;){let p=!1;if(u=a.value,o!=="undirected"){l=u.out;for(c in l){f=l[c];do d=f.target,p=!0,i(u.key,d.key,u.attributes,d.attributes,f.key,f.attributes,f.undirected),
|
|
1781
1782
|
f=f.next;while(f)}}if(o!=="directed"){l=u.undirected;for(c in l)if(!(e&&u.key>c)){f=l[c];do d=f.target,d.key!==c&&(d=f.source),p=!0,i(u.key,d.key,u.attributes,d.attributes,f.key,f.attributes,f.undirected),f=f.next;while(f)}}n&&!p&&i(u.key,null,u.attributes,null,null,null,null)}}function vH(t,e){const n={key:t};return sS(e.attributes)||(n.attributes=zt({},e.attributes)),n}function wH(t,e,n){const r={key:e,source:n.source.key,target:n.target.key};return sS(n.attributes)||(r.attributes=zt({},n.attributes)),
|
|
1782
1783
|
t==="mixed"&&n.undirected&&(r.undirected=!0),r}function bH(t){if(!ln(t))throw new ge('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in t))throw new ge("Graph.import: serialized node is missing its key.");if("attributes"in t&&(!ln(t.attributes)||t.attributes===null))throw new ge("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function EH(t){if(!ln(t))throw new ge('Graph.impor\
|
|
1783
1784
|
t: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in t))throw new ge("Graph.import: serialized edge is missing its source.");if(!("target"in t))throw new ge("Graph.import: serialized edge is missing its target.");if("attributes"in t&&(!ln(t.attributes)||t.attributes===null))throw new ge("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in t&&typeof t.undirected!=
|
|
@@ -1791,7 +1792,7 @@ inDegree++,d&&(u.directedLoops++,t._directedSelfLoopCount++)),t.multi?f.attachMu
|
|
|
1791
1792
|
n set to false.`);let l=t._nodes.get(s),f=t._nodes.get(o),d,p;if(!n&&(d=t._edges.get(i),d)){if((d.source.key!==s||d.target.key!==o)&&(!r||d.source.key!==o||d.target.key!==s))throw new Ce(`Graph.${e}: inconsistency detected when attempting to merge the "${i}" edge with "${s}" source & "${o}" target vs. ("${d.source.key}", "${d.target.key}").`);p=d}if(!p&&!t.multi&&l&&(p=r?l.undirected[o]:l.out[o]),p){const b=[p.key,!1,!1,!1];if(u?!c:!a)return b;if(u){const R=p.attributes;p.attributes=c(R),t.emit(
|
|
1792
1793
|
"edgeAttributesUpdated",{type:"replace",key:p.key,attributes:p.attributes})}else zt(p.attributes,a),t.emit("edgeAttributesUpdated",{type:"merge",key:p.key,attributes:p.attributes,data:a});return b}a=a||{},u&&c&&(a=c(a));const m={key:null,undirected:r,source:s,target:o,attributes:a};if(n)i=t._edgeKeyGenerator();else if(i=""+i,t._edges.has(i))throw new Ce(`Graph.${e}: the "${i}" edge already exists in the graph.`);let w=!1,y=!1;l||(l=mS(t,s,{}),w=!0,s===o&&(f=l,y=!0)),f||(f=mS(t,o,{}),y=!0),d=new Ba(
|
|
1793
1794
|
r,i,l,f,a),t._edges.set(i,d);const g=s===o;return r?(l.undirectedDegree++,f.undirectedDegree++,g&&(l.undirectedLoops++,t._undirectedSelfLoopCount++)):(l.outDegree++,f.inDegree++,g&&(l.directedLoops++,t._directedSelfLoopCount++)),t.multi?d.attachMulti():d.attach(),r?t._undirectedSize++:t._directedSize++,m.key=i,t.emit("edgeAdded",m),[i,!0,w,y]}function qa(t,e){t._edges.delete(e.key);const{source:n,target:r,attributes:i}=e,s=e.undirected,o=n===r;s?(n.undirectedDegree--,r.undirectedDegree--,o&&(n.undirectedLoops--,
|
|
1794
|
-
t._undirectedSelfLoopCount--)):(n.outDegree--,r.inDegree--,o&&(n.directedLoops--,t._directedSelfLoopCount--)),t.multi?e.detachMulti():e.detach(),s?t._undirectedSize--:t._directedSize--,t.emit("edgeDropped",{key:e.key,attributes:i,source:n.key,target:r.key,undirected:s})}class
|
|
1795
|
+
t._undirectedSelfLoopCount--)):(n.outDegree--,r.inDegree--,o&&(n.directedLoops--,t._directedSelfLoopCount--)),t.multi?e.detachMulti():e.detach(),s?t._undirectedSize--:t._directedSize--,t.emit("edgeDropped",{key:e.key,attributes:i,source:n.key,target:r.key,undirected:s})}class pt extends Dx{constructor(e){if(super(),e=zt({},kH,e),typeof e.multi!="boolean")throw new ge(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${e.multi}".`);if(!RH.has(e.type))throw new ge(`Graph.con\
|
|
1795
1796
|
structor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${e.type}".`);if(typeof e.allowSelfLoops!="boolean")throw new ge(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${e.allowSelfLoops}".`);const n=e.type==="mixed"?aS:e.type==="directed"?uS:cS;gr(this,"NodeDataClass",n);const r="geid_"+$H()+"_";let i=0;const s=()=>{let o;do o=r+i++;while(this._edges.has(o));return o};gr(this,"_attributes",{}),gr(this,"_nodes",new Map),gr(
|
|
1796
1797
|
this,"_edges",new Map),gr(this,"_directedSize",0),gr(this,"_undirectedSize",0),gr(this,"_directedSelfLoopCount",0),gr(this,"_undirectedSelfLoopCount",0),gr(this,"_edgeKeyGenerator",s),gr(this,"_options",e),hS.forEach(o=>gr(this,o,this[o])),Or(this,"order",()=>this._nodes.size),Or(this,"size",()=>this._edges.size),Or(this,"directedSize",()=>this._directedSize),Or(this,"undirectedSize",()=>this._undirectedSize),Or(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),
|
|
1797
1798
|
Or(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),Or(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),Or(this,"multi",this._options.multi),Or(this,"type",this._options.type),Or(this,"allowSelfLoops",this._options.allowSelfLoops),Or(this,"implementation",()=>"graphology")}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(e){return this._nodes.has(""+e)}hasDirectedEdge(e,n){if(this.
|
|
@@ -1824,37 +1825,37 @@ return this._attributes[e]=n,this.emit("attributesUpdated",{type:"set",attribute
|
|
|
1824
1825
|
this}replaceAttributes(e){if(!ln(e))throw new ge("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=e,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this}mergeAttributes(e){if(!ln(e))throw new ge("Graph.mergeAttributes: provided attributes are not a plain object.");return zt(this._attributes,e),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:e}),this}updateAttributes(e){if(typeof e!="function")
|
|
1825
1826
|
throw new ge("Graph.updateAttributes: provided updater is not a function.");return this._attributes=e(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this}updateEachNodeAttributes(e,n){if(typeof e!="function")throw new ge("Graph.updateEachNodeAttributes: expecting an updater function.");if(n&&!oS(n))throw new ge("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const r=this._nodes.
|
|
1826
1827
|
values();let i,s;for(;i=r.next(),i.done!==!0;)s=i.value,s.attributes=e(s.key,s.attributes);this.emit("eachNodeAttributesUpdated",{hints:n||null})}updateEachEdgeAttributes(e,n){if(typeof e!="function")throw new ge("Graph.updateEachEdgeAttributes: expecting an updater function.");if(n&&!oS(n))throw new ge("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const r=this._edges.values();let i,s,o,a;for(;i=r.next(),i.done!==!0;)s=i.
|
|
1827
|
-
value,o=s.source,a=s.target,s.attributes=e(s.key,s.attributes,o.key,a.key,o.attributes,a.attributes,s.undirected);this.emit("eachEdgeAttributesUpdated",{hints:n||null})}forEachAdjacencyEntry(e){if(typeof e!="function")throw new ge("Graph.forEachAdjacencyEntry: expecting a callback.");
|
|
1828
|
-
"function")throw new ge("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");
|
|
1828
|
+
value,o=s.source,a=s.target,s.attributes=e(s.key,s.attributes,o.key,a.key,o.attributes,a.attributes,s.undirected);this.emit("eachEdgeAttributesUpdated",{hints:n||null})}forEachAdjacencyEntry(e){if(typeof e!="function")throw new ge("Graph.forEachAdjacencyEntry: expecting a callback.");am(!1,!1,!1,this,e)}forEachAdjacencyEntryWithOrphans(e){if(typeof e!="function")throw new ge("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");am(!1,!1,!0,this,e)}forEachAssymetricAdjacencyEntry(e){if(typeof e!=
|
|
1829
|
+
"function")throw new ge("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");am(!1,!0,!1,this,e)}forEachAssymetricAdjacencyEntryWithOrphans(e){if(typeof e!="function")throw new ge("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");am(!1,!0,!0,this,e)}nodes(){return typeof Array.from=="function"?Array.from(this._nodes.keys()):rS(this._nodes.keys(),this._nodes.size)}forEachNode(e){if(typeof e!="function")throw new ge("Graph.forEachNode: expecting a callback.");const n=this.
|
|
1829
1830
|
_nodes.values();let r,i;for(;r=n.next(),r.done!==!0;)i=r.value,e(i.key,i.attributes)}findNode(e){if(typeof e!="function")throw new ge("Graph.findNode: expecting a callback.");const n=this._nodes.values();let r,i;for(;r=n.next(),r.done!==!0;)if(i=r.value,e(i.key,i.attributes))return i.key}mapNodes(e){if(typeof e!="function")throw new ge("Graph.mapNode: expecting a callback.");const n=this._nodes.values();let r,i;const s=new Array(this.order);let o=0;for(;r=n.next(),r.done!==!0;)i=r.value,s[o++]=e(
|
|
1830
1831
|
i.key,i.attributes);return s}someNode(e){if(typeof e!="function")throw new ge("Graph.someNode: expecting a callback.");const n=this._nodes.values();let r,i;for(;r=n.next(),r.done!==!0;)if(i=r.value,e(i.key,i.attributes))return!0;return!1}everyNode(e){if(typeof e!="function")throw new ge("Graph.everyNode: expecting a callback.");const n=this._nodes.values();let r,i;for(;r=n.next(),r.done!==!0;)if(i=r.value,!e(i.key,i.attributes))return!1;return!0}filterNodes(e){if(typeof e!="function")throw new ge(
|
|
1831
1832
|
"Graph.filterNodes: expecting a callback.");const n=this._nodes.values();let r,i;const s=[];for(;r=n.next(),r.done!==!0;)i=r.value,e(i.key,i.attributes)&&s.push(i.key);return s}reduceNodes(e,n){if(typeof e!="function")throw new ge("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new ge("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could \
|
|
1832
1833
|
with a simple array.");let r=n;const i=this._nodes.values();let s,o;for(;s=i.next(),s.done!==!0;)o=s.value,r=e(r,o.key,o.attributes);return r}nodeEntries(){const e=this._nodes.values();return new hr(()=>{const n=e.next();if(n.done)return n;const r=n.value;return{value:{node:r.key,attributes:r.attributes},done:!1}})}export(){const e=new Array(this._nodes.size);let n=0;this._nodes.forEach((i,s)=>{e[n++]=vH(s,i)});const r=new Array(this._edges.size);return n=0,this._edges.forEach((i,s)=>{r[n++]=wH(
|
|
1833
|
-
this.type,s,i)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:r}}import(e,n=!1){if(e instanceof
|
|
1834
|
+
this.type,s,i)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:r}}import(e,n=!1){if(e instanceof pt)return e.forEachNode((u,c)=>{n?this.mergeNode(u,c):this.addNode(u,c)}),e.forEachEdge((u,c,l,f,d,p,m)=>{n?m?this.mergeUndirectedEdgeWithKey(u,l,f,c):this.mergeDirectedEdgeWithKey(u,l,f,c):m?this.addUndirectedEdgeWithKey(u,l,f,c):this.addDirectedEdgeWithKey(u,l,f,c)}),this;if(!ln(e))throw new ge("Graph.import: invalid argu\
|
|
1834
1835
|
ment. Expecting a serialized graph or, alternatively, a Graph instance.");if(e.attributes){if(!ln(e.attributes))throw new ge("Graph.import: invalid attributes. Expecting a plain object.");n?this.mergeAttributes(e.attributes):this.replaceAttributes(e.attributes)}let r,i,s,o,a;if(e.nodes){if(s=e.nodes,!Array.isArray(s))throw new ge("Graph.import: invalid nodes. Expecting an array.");for(r=0,i=s.length;r<i;r++){o=s[r],bH(o);const{key:u,attributes:c}=o;n?this.mergeNode(u,c):this.addNode(u,c)}}if(e.edges){
|
|
1835
1836
|
let u=!1;if(this.type==="undirected"&&(u=!0),s=e.edges,!Array.isArray(s))throw new ge("Graph.import: invalid edges. Expecting an array.");for(r=0,i=s.length;r<i;r++){a=s[r],EH(a);const{source:c,target:l,attributes:f,undirected:d=u}=a;let p;"key"in a?(p=n?d?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:d?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,p.call(this,a.key,c,l,f)):(p=n?d?this.mergeUndirectedEdge:this.mergeDirectedEdge:d?this.addUndirectedEdge:this.addDirectedEdge,
|
|
1836
|
-
p.call(this,c,l,f))}}return this}nullCopy(e){const n=new
|
|
1837
|
+
p.call(this,c,l,f))}}return this}nullCopy(e){const n=new pt(zt({},this._options,e));return n.replaceAttributes(zt({},this.getAttributes())),n}emptyCopy(e){const n=this.nullCopy(e);return this._nodes.forEach((r,i)=>{const s=zt({},r.attributes);r=new n.NodeDataClass(i,s),n._nodes.set(i,r)}),n}copy(e){if(e=e||{},typeof e.type=="string"&&e.type!==this.type&&e.type!=="mixed")throw new Ce(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${e.type}" because this would mean lo\
|
|
1837
1838
|
sing information about the current graph.`);if(typeof e.multi=="boolean"&&e.multi!==this.multi&&e.multi!==!0)throw new Ce("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if(typeof e.allowSelfLoops=="boolean"&&e.allowSelfLoops!==this.allowSelfLoops&&e.allowSelfLoops!==!0)throw new Ce("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not\
|
|
1838
1839
|
because this would mean losing information about the current graph.");const n=this.emptyCopy(e),r=this._edges.values();let i,s;for(;i=r.next(),i.done!==!0;)s=i.value,gS(n,"copy",!1,s.undirected,s.key,s.source.key,s.target.key,zt({},s.attributes));return n}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){const e={};this._nodes.forEach((s,o)=>{e[o]=s.attributes});const n={},r={};this._edges.forEach((s,o)=>{const a=s.undirected?"--":"->";let u="",c=s.source.key,l=s.target.
|
|
1839
|
-
key,f;s.undirected&&c>l&&(f=c,c=l,l=f);const d=`(${c})${a}(${l})`;o.startsWith("geid_")?this.multi&&(typeof r[d]>"u"?r[d]=0:r[d]++,u+=`${r[d]}. `):u+=`[${o}]: `,u+=d,n[u]=s.attributes});const i={};for(const s in this)this.hasOwnProperty(s)&&!hS.has(s)&&typeof this[s]!="function"&&typeof s!="symbol"&&(i[s]=this[s]);return i.attributes=this._attributes,i.nodes=e,i.edges=n,gr(i,"constructor",this.constructor),i}}typeof Symbol<"u"&&(
|
|
1840
|
-
inspect),DH.forEach(t=>{["add","merge","update"].forEach(e=>{const n=t.name(e),r=e==="add"?gS:CH;t.generateKey?
|
|
1841
|
-
nsistent indication that the graph should be multi in given options!");if(n.type!=="directed")throw new ge('DirectedGraph.from: inconsistent "'+n.type+'" type in given options!');super(n)}}class vS extends
|
|
1842
|
-
ptions!');super(n)}}class wS extends
|
|
1843
|
-
h.from: inconsistent "'+n.type+'" type in given options!');super(n)}}class ES extends
|
|
1844
|
-
import(e),i}}ja(
|
|
1840
|
+
key,f;s.undirected&&c>l&&(f=c,c=l,l=f);const d=`(${c})${a}(${l})`;o.startsWith("geid_")?this.multi&&(typeof r[d]>"u"?r[d]=0:r[d]++,u+=`${r[d]}. `):u+=`[${o}]: `,u+=d,n[u]=s.attributes});const i={};for(const s in this)this.hasOwnProperty(s)&&!hS.has(s)&&typeof this[s]!="function"&&typeof s!="symbol"&&(i[s]=this[s]);return i.attributes=this._attributes,i.nodes=e,i.edges=n,gr(i,"constructor",this.constructor),i}}typeof Symbol<"u"&&(pt.prototype[Symbol.for("nodejs.util.inspect.custom")]=pt.prototype.
|
|
1841
|
+
inspect),DH.forEach(t=>{["add","merge","update"].forEach(e=>{const n=t.name(e),r=e==="add"?gS:CH;t.generateKey?pt.prototype[n]=function(i,s,o){return r(this,n,!0,(t.type||this.type)==="undirected",null,i,s,o,e==="update")}:pt.prototype[n]=function(i,s,o,a){return r(this,n,!1,(t.type||this.type)==="undirected",i,s,o,a,e==="update")}})}),L6(pt),K6(pt),cH(pt),yH(pt);class yS extends pt{constructor(e){const n=zt({type:"directed"},e);if("multi"in n&&n.multi!==!1)throw new ge("DirectedGraph.from: inco\
|
|
1842
|
+
nsistent indication that the graph should be multi in given options!");if(n.type!=="directed")throw new ge('DirectedGraph.from: inconsistent "'+n.type+'" type in given options!');super(n)}}class vS extends pt{constructor(e){const n=zt({type:"undirected"},e);if("multi"in n&&n.multi!==!1)throw new ge("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(n.type!=="undirected")throw new ge('UndirectedGraph.from: inconsistent "'+n.type+'" type in given o\
|
|
1843
|
+
ptions!');super(n)}}class wS extends pt{constructor(e){const n=zt({multi:!0},e);if("multi"in n&&n.multi!==!0)throw new ge("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(n)}}class bS extends pt{constructor(e){const n=zt({type:"directed",multi:!0},e);if("multi"in n&&n.multi!==!0)throw new ge("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(n.type!=="directed")throw new ge('MultiDirectedGrap\
|
|
1844
|
+
h.from: inconsistent "'+n.type+'" type in given options!');super(n)}}class ES extends pt{constructor(e){const n=zt({type:"undirected",multi:!0},e);if("multi"in n&&n.multi!==!0)throw new ge("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(n.type!=="undirected")throw new ge('MultiUndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');super(n)}}function ja(t){t.from=function(e,n){const r=zt({},e.options,n),i=new t(r);return i.
|
|
1845
|
+
import(e),i}}ja(pt),ja(yS),ja(vS),ja(wS),ja(bS),ja(ES),pt.Graph=pt,pt.DirectedGraph=yS,pt.UndirectedGraph=vS,pt.MultiGraph=wS,pt.MultiDirectedGraph=bS,pt.MultiUndirectedGraph=ES,pt.InvalidArgumentsGraphError=ge,pt.NotFoundGraphError=ae,pt.UsageGraphError=Ce;const Rw="dashed",Dw=en.font,$S=eN("dot");class kw{constructor(e,n){this.view=e,this.specification=n,this.compoundIds=new Set(e.nodes.filter(er).map(i=>i.id)),this.edgesWithCompounds=new Set(this.compoundIds.size>0?e.edges.filter(i=>this.compoundIds.
|
|
1845
1846
|
has(i.source)||this.compoundIds.has(i.target)).map(i=>i.id):[]);for(const i of e.nodes)this.graphology.addNode(i.id,{origin:i,level:i.level,depth:i.depth??0,modelRef:i.modelRef??null,deploymentRef:i.deploymentRef??null,maxConnectedHierarchyDistance:0});for(const i of e.edges){let s=this.graphology.getNodeAttribute(i.source,"deploymentRef"),o=this.graphology.getNodeAttribute(i.target,"deploymentRef");(s===null||o===null)&&(s=this.graphology.getNodeAttribute(i.source,"modelRef"),o=this.graphology.
|
|
1846
1847
|
getNodeAttribute(i.target,"modelRef"));let a=-1;s!==null&&o!==null?a=tx(s,o):$S.warn(`Edge ${i.id} of view ${e.id} is invalid, sourceFqn: ${s}, targetFqn: ${o}`),this.graphology.addEdgeWithKey(i.id,i.source,i.target,{origin:i,hierarchyDistance:a,weight:1}),a>this.graphology.getNodeAttribute(i.source,"maxConnectedHierarchyDistance")&&this.graphology.mergeNodeAttributes(i.source,{maxConnectedHierarchyDistance:a}),a>this.graphology.getNodeAttribute(i.target,"maxConnectedHierarchyDistance")&&this.graphology.
|
|
1847
1848
|
mergeNodeAttributes(i.target,{maxConnectedHierarchyDistance:a})}this.graphology.forEachEdge((i,{hierarchyDistance:s},o,a,u,c)=>{const l=Math.max(u.maxConnectedHierarchyDistance,c.maxConnectedHierarchyDistance);if(l>s)this.graphology.mergeEdgeAttributes(i,{weight:l-s+1});else{const f=this.graphology.directedDegree(o),d=this.graphology.directedDegree(a);f===1&&d===1&&s>1&&this.graphology.mergeEdgeAttributes(i,{weight:s})}});const r=this.graphvizModel=this.createGraph();this.applyNodeAttributes(r.attributes.
|
|
1848
|
-
node),this.applyEdgeAttributes(r.attributes.edge),this.build(r),this.postBuild(r)}ids=new Set;subgraphs=new Map;nodes=new Map;edges=new Map;compoundIds;edgesWithCompounds;graphology=new
|
|
1849
|
+
node),this.applyEdgeAttributes(r.attributes.edge),this.build(r),this.postBuild(r)}ids=new Set;subgraphs=new Map;nodes=new Map;edges=new Map;compoundIds;edgesWithCompounds;graphology=new pt({allowSelfLoops:!0,multi:!0,type:"directed"});graphvizModel;get hasEdgesWithCompounds(){return this.edgesWithCompounds.size>0}postBuild(e){}build(e){const n=(i,s)=>{const o=this.generateGraphvizId(i),a=this.elementToSubgraph(i,s.subgraph(o));this.subgraphs.set(i.id,a);for(const u of i.children){const c=this.computedNode(
|
|
1849
1850
|
u);if(er(c))n(c,a);else{const l=xt(this.getGraphNode(c.id),`Graphviz Node not found for ${c.id}`);a.node(l.id)}}},r=[];for(const i of this.view.nodes)if(er(i))Et(i.parent)&&r.push(i);else{const s=this.generateGraphvizId(i),o=this.elementToNode(i,e.node(s));this.nodes.set(i.id,o)}for(const i of r)n(i,e);for(const i of this.view.edges){const s=this.addEdge(i,e);s&&this.edges.set(i.id,s)}}print(){return this.graphvizModel,Qz(this.graphvizModel,{print:{indentStyle:"space",indentSize:2}})}createGraph(){
|
|
1850
1851
|
const e=this.view.autoLayout,n=Jz({[q.likec4_viewId]:this.view.id,[q.bgcolor]:"transparent",[q.layout]:"dot",[q.compound]:!0,[q.rankdir]:e.direction,[q.TBbalance]:"min",[q.splines]:"spline",[q.outputorder]:"nodesfirst",[q.nodesep]:_t(e.nodeSep??110),[q.ranksep]:_t(e.rankSep??120),[q.pad]:_t(15),[q.fontname]:Dw});return n.attributes.graph.apply({[q.fontsize]:Fi(15),[q.labeljust]:e.direction==="RL"?"r":"l",[q.labelloc]:e.direction==="BT"?"b":"t",[q.margin]:50.1}),n}applyNodeAttributes(e){e.apply({
|
|
1851
1852
|
[q.fontname]:Dw,[q.shape]:"rect",[q.fillcolor]:en.elements[Bo].fill,[q.fontcolor]:en.elements[Bo].hiContrast,[q.color]:en.elements[Bo].stroke,[q.style]:"filled",[q.penwidth]:0})}applyEdgeAttributes(e){e.apply({[q.arrowsize]:.75,[q.fontname]:Dw,[q.fontsize]:Fi(14),[q.penwidth]:Fi(2),[q.color]:en.relationships[Ha].lineColor,[q.fontcolor]:en.relationships[Ha].labelColor})}checkNodeId(e,n=!1){return n?e="cluster_"+e:e.toLowerCase().startsWith("cluster")&&(e="nd_"+e),this.ids.has(e)?null:(this.ids.add(
|
|
1852
|
-
e),e)}generateGraphvizId(e){const n=er(e);let r=
|
|
1853
|
+
e),e)}generateGraphvizId(e){const n=er(e);let r=pm(e.id).toLowerCase(),i=this.checkNodeId(r,n);if(i!==null)return i;r=pm(e.id).toLowerCase();let s=1;do i=this.checkNodeId(r+"_"+s++,n);while(i===null);return i}elementToSubgraph(e,n){Ae(er(e),"node should be compound"),Ae(Jr(e.depth),"node.depth should be defined");const r=this.getElementColorValues(e.color),i=d6(r.loContrast);return n.apply({[q.likec4_id]:e.id,[q.likec4_level]:e.level,[q.likec4_depth]:e.depth,[q.fillcolor]:VA(r.fill,e.depth),[q.color]:VA(
|
|
1853
1854
|
r.stroke,e.depth),[q.style]:"filled",[q.margin]:Fi(e.children.length>1?40:32)}),It(e.title.trim())||n.set(q.label,m6(e,i)),n}elementToNode(e,n){Ae(!er(e),"node should not be compound");const r=de(e.icon),i=this.getElementColorValues(e.color);let s=e.style.size,o=e.style.textSize,a=e.style.padding;!s&&o&&(s=o),!o&&s&&(o=s),!a&&s&&(a=s),s??=bx,o??=Ex,a??=$x;const u=en.spacing[a];switch(n.attributes.apply({[q.likec4_id]:e.id,[q.likec4_level]:e.level,[q.label]:h6(e,i,{shape:s,text:o}),[q.margin]:`${_t(
|
|
1854
1855
|
r?8:u)},${_t(u)}`}),n.attributes.set(q.width,_t(en.sizes[s].width)),n.attributes.set(q.height,_t(en.sizes[s].height)),e.color!==Bo&&n.attributes.apply({[q.fillcolor]:i.fill,[q.fontcolor]:i.hiContrast,[q.color]:i.stroke}),e.shape){case"cylinder":case"storage":{n.attributes.apply({[q.margin]:`${_t(r?8:u)},${_t(0)}`,[q.penwidth]:Fi(2),[q.shape]:"cylinder"});break}case"browser":{n.attributes.apply({[q.margin]:`${_t(r?8:u+4)},${_t(u+6)}`});break}case"mobile":{n.attributes.apply({[q.margin]:`${_t(r?8:
|
|
1855
1856
|
u+4)},${_t(u)}`});break}case"queue":{n.attributes.apply({[q.width]:_t(en.sizes[s].width),[q.height]:_t(en.sizes[s].height-8),[q.margin]:`${_t(r?8:u+4)},${_t(u)}`});break}}return n}leafElements(e){return e===null?this.view.nodes.filter(n=>!er(n)):this.computedNode(e).children.flatMap(n=>{const r=this.computedNode(n);return er(r)?this.leafElements(r.id):r})}descendants(e){return e===null?this.view.nodes.slice():this.computedNode(e).children.flatMap(n=>{const r=this.computedNode(n);return[r,...this.
|
|
1856
1857
|
descendants(r.id)]})}computedNode(e){return xt(this.view.nodes.find(n=>n.id===e),`Node ${e} not found`)}getGraphNode(e){return this.nodes.get(e)??null}getSubgraph(e){return this.subgraphs.get(e)??null}edgeEndpoint(e,n){let r=this.computedNode(e),i=this.getGraphNode(e),s;return i||(Ae(er(r),"endpoint node should be compound"),s=this.getSubgraph(e)?.id,Ae(s,`subgraph ${e} not found`),r=xt(n(this.leafElements(e)),`leaf element in ${e} not found`),i=xt(this.getGraphNode(r.id),`source graphviz node ${r.
|
|
1857
|
-
id} not found`)),[r,i,s]}findInternalEdges(e){if(e===null)return this.view.edges.slice();const n=this.computedNode(e);return Le(this.descendants(e),Cr(r=>
|
|
1858
|
+
id} not found`)),[r,i,s]}findInternalEdges(e){if(e===null)return this.view.edges.slice();const n=this.computedNode(e);return Le(this.descendants(e),Cr(r=>My(r.inEdges,r.outEdges)),ua(),P3(My(n.inEdges,n.outEdges)),bt(r=>this.view.edges.find(i=>i.id===r)),Pe(de))}withoutCompoundEdges(e){return this.edgesWithCompounds.size===0?e:{...e,inEdges:e.inEdges.filter(n=>!this.edgesWithCompounds.has(n)),outEdges:e.outEdges.filter(n=>!this.edgesWithCompounds.has(n))}}assignGroups(){const e=Le(this.view.nodes,
|
|
1858
1859
|
Pe(er),bt(r=>r.id),oc(nx),Q4(),bt(r=>{const i=this.findInternalEdges(r).filter(s=>s.source!==s.target&&!this.compoundIds.has(s.source)&&!this.compoundIds.has(s.target));return{id:r,edges:i}}),Pe(({edges:r})=>r.length>1&&r.length<8),G4(4)),n=new Set;for(const r of e){const i=r.edges.filter(s=>!n.has(s.source)&&!n.has(s.target));for(const s of i)try{const o=xt(this.getGraphNode(s.source),`Graphviz Node not found for ${s.source}`),a=xt(this.getGraphNode(s.target),`Graphviz Node not found for ${s.target}`);
|
|
1859
1860
|
n.add(s.source),n.add(s.target),o.attributes.set(q.group,r.id),a.attributes.set(q.group,r.id)}catch(o){$S.error(`Failed to assign group to edge ${s.id}`,{error:o})}}}applyManualLayout({height:e,...n}){const r=n.x<0?-n.x:0,i=n.y<0?-n.y:0,s=r>0||i>0;for(const{id:o,...a}of n.nodes){const u=this.getGraphNode(o);if(!u)continue;const c=_t(a.center.x)+r,l=_t(e-a.center.y);a.fixedsize?u.attributes.apply({[q.pos]:`${c},${l}!`,[q.pin]:!0,[q.width]:_t(a.fixedsize.width),[q.height]:_t(a.fixedsize.height),[q.
|
|
1860
1861
|
fixedsize]:!0}):u.attributes.set(q.pos,`${c},${l}`)}for(const[o,a]of this.edges.entries()){a.attributes.delete(q.weight),a.attributes.delete(q.minlen),a.attributes.delete(q.constraint);const u=n.edges.find(c=>c.id===o)?.dotpos;u&&!s&&a.attributes.set(q.pos,u)}return this.graphvizModel.apply({[q.layout]:"fdp",[q.overlap]:"vpsc",[q.sep]:"+50,50",[q.esep]:"+10,10",[q.start]:"random2",[q.splines]:"compound",[q.K]:10}),this.graphvizModel.delete(q.compound),this.graphvizModel.delete(q.rankdir),this.graphvizModel.
|
|
@@ -1873,9 +1874,9 @@ g!=="none")return p.attributes.apply({[q.arrowhead]:mn(y),[q.arrowtail]:mn(g),[q
|
|
|
1873
1874
|
R.target);return er(A)||er(N)?!1:A.parent==null&&N.parent==null}):b=this.findInternalEdges(f).filter(R=>!(R.id===e.id||R.source===e.source&&R.target===e.target||R.source===e.target&&R.target===e.source)),b.length===0&&(f===null||this.leafElements(f).length<=3)&&p.attributes.set(q.minlen,0),p}}function RS(t){const[e,n,r,i]=t?t.split(",").map(a=>ni(+a)):[0,0,0,0],s=Math.round(r-e),o=Math.round(n-i);return{x:Math.round(e),y:Math.round(i),width:s,height:o}}function xH(t){try{const[e,n]=t.split(",");
|
|
1874
1875
|
return{x:ni(parseFloat(e)),y:ni(parseFloat(n))}}catch(e){throw new Error(`Failed on parsing pos: ${t}`,{cause:e})}}function PH(t){const{x:e,y:n}=xH(t.pos),r=KA(parseFloat(t.width)),i=KA(parseFloat(t.height));return{x:e-Math.round(r/2),y:n-Math.round(i/2),width:r,height:i}}function DS(t,[e,n]=[0,0]){if(!t||t.length===0)return null;let r=1/0,i=1/0,s=-1/0,o=-1/0,a=13;try{for(const c of t){if(c.op==="F"){a=ni(c.size);continue}if(c.op==="T"){let l=ni(c.pt[0])-e,f=ni(c.width);switch(c.align){case"r":l-=
|
|
1875
1876
|
f;break;case"c":l-=Math.round(f/2);break}r=Math.min(r,l),s=Math.max(s,l+f);let d=ni(c.pt[1])-n;i=Math.min(i,Math.round(d-a)),o=Math.max(o,d)}}}catch(c){return Wn.warn(`Failed on parsing label draw ops:
|
|
1876
|
-
{labelDrawOps}`,{e:c,labelDrawOps:t}),null}if(r===1/0)return null;const u=2;return{x:r-u,y:i-u,width:s-r+2*u,height:o-i+2*u}}function NH({_draw_:t,likec4_id:e="???"},n="<unknown view>"){try{const r=t.filter(s=>s.op.toLowerCase()==="b");Ae(
|
|
1877
|
+
{labelDrawOps}`,{e:c,labelDrawOps:t}),null}if(r===1/0)return null;const u=2;return{x:r-u,y:i-u,width:s-r+2*u,height:o-i+2*u}}function NH({_draw_:t,likec4_id:e="???"},n="<unknown view>"){try{const r=t.filter(s=>s.op.toLowerCase()==="b");Ae(Bn(r,1),`view ${n} edge ${e} should have at least one bezier draw op`),r.length>1&&Wn.warn(`view ${n} edge ${e} has more than one bezier draw op, using the first one only`);const i=r[0].points.map(s=>ni(s));return Ae(Bn(i,2),`view ${n} edge ${e} should have at \
|
|
1877
1878
|
least two points`),i}catch(r){throw new Error(`failed on parsing view ${n} edge ${e} _draw_:
|
|
1878
|
-
${JSON.stringify(t,null,2)}`,{cause:r})}}function IH(t,{id:e,source:n,target:r,dir:i,label:s,description:o,...a},u){const c=DS(t._ldraw_??t._tldraw_??t._hldraw_),l=t.dir==="back"||i==="back";return s=s&&c?XA(s,{maxchars:
|
|
1879
|
+
${JSON.stringify(t,null,2)}`,{cause:r})}}function IH(t,{id:e,source:n,target:r,dir:i,label:s,description:o,...a},u){const c=DS(t._ldraw_??t._tldraw_??t._hldraw_),l=t.dir==="back"||i==="back";return s=s&&c?XA(s,{maxchars:im,maxLines:YA}).join(`
|
|
1879
1880
|
`):null,{id:e,source:n,target:r,label:s,...de(o)&&{description:o},...de(t.pos)&&{dotpos:t.pos},points:NH(t,u),labelBBox:c,...l?{dir:"back"}:{},...a}}function OH(t,e){const n=RS(t.bb),{nodes:r,edges:i,manualLayout:s,...o}=e,a={...o,_stage:"layouted",bounds:n,nodes:[],edges:[]},u=t.objects??[];for(const l of r){const f=u.find(d=>d.likec4_id===l.id);Ae(f,`View ${o.id} node ${l.id} not found in graphviz output`);try{const{x:d,y:p,width:m,height:w}="bb"in f?RS(f.bb):PH(f),y=[d,p];a.nodes.push({...l,x:d,
|
|
1880
1881
|
y:p,position:y,width:m,height:w,labelBBox:DS(f._ldraw_,y)??{x:d,y:p,width:m,height:w}})}catch(d){throw new Error(`Failed on parsing node ${l.id}:
|
|
1881
1882
|
${JSON.stringify(f,null,2)}`,{cause:d})}}const c=t.edges??[];for(const l of i){const f=c.find(d=>d.likec4_id===l.id);if(!f){Wn.warn`View ${o.id} edge ${l.id} not found in graphviz output, skipping`;continue}a.edges.push(IH(f,l,o.id))}return a}class LH{value;next;constructor(e){this.value=e}}class FH{#e;#t;#r;constructor(){this.clear()}enqueue(e){const n=new LH(e);this.#e?(this.#t.next=n,this.#t=n):(this.#e=n,this.#t=n),this.#r++}dequeue(){const e=this.#e;if(e)return this.#e=this.#e.next,this.#r--,
|
|
@@ -1883,13 +1884,13 @@ e.value}peek(){if(this.#e)return this.#e.value}clear(){this.#e=void 0,this.#t=vo
|
|
|
1883
1884
|
l=>{o(u,l,c)});return Object.defineProperties(a,{activeCount:{get:()=>n},pendingCount:{get:()=>e.size},clearQueue:{value(){e.clear()}},concurrency:{get:()=>t,set(u){kS(u),t=u,queueMicrotask(()=>{for(;n<t&&e.size>0;)r()})}}}),a}function kS(t){if(!((Number.isInteger(t)||t===Number.POSITIVE_INFINITY)&&t>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up")}const BH=MH(1),jd=Wn.getChild("graphviz-wasm");class ir{static _graphviz=null;static opsCount=0;get concurrency(){return 1}dispose(){
|
|
1884
1885
|
Xa.unload(),ir._graphviz=null}[Symbol.dispose](){this.dispose()}graphviz(){return Promise.resolve().then(async()=>(ir._graphviz||(jd.debug`loading wasm`,ir.opsCount=0,ir._graphviz=Xa.load()),await ir._graphviz))}async attempt(e,n,r){return await BH(async()=>{try{const i=await r();return++ir.opsCount>=10&&(jd.debug`unloading wasm`,Xa.unload(),ir._graphviz=null),i}catch(i){jd.error(`FAILED GraphvizWasm. ${e}`,{error:i}),jd.error(`FAILED DOT:
|
|
1885
1886
|
`+n),Xa.unload(),ir._graphviz=null}jd.warn("Retrying..."),await ix(10,500);try{return await r()}finally{Xa.unload(),ir._graphviz=null}})}async unflatten(e){return await this.attempt("unflatten",e,async()=>(await this.graphviz()).unflatten(e,1,!1,3).replaceAll(/\t\[/g," [").replaceAll(/\t/g," "))}async acyclic(e){return await this.attempt("acyclic",e,async()=>{const n=(await this.graphviz()).acyclic(e,!0);return n.acyclic&&n.outFile||e})}async layoutJson(e){return await this.attempt("layout",e,
|
|
1886
|
-
async()=>(await this.graphviz()).layout(e,"json",void 0,{yInvert:!0}))}async svg(e){return await this.attempt("svg",e,async()=>(await this.graphviz()).layout(e,"svg"))}}const qH=({view:t,specification:e})=>{switch(!0){case ox(t):return new SH(t,e);case sx(t):return new AH(t,e);case
|
|
1887
|
+
async()=>(await this.graphviz()).layout(e,"json",void 0,{yInvert:!0}))}async svg(e){return await this.attempt("svg",e,async()=>(await this.graphviz()).layout(e,"svg"))}}const qH=({view:t,specification:e})=>{switch(!0){case ox(t):return new SH(t,e);case sx(t):return new AH(t,e);case hm(t):return new _H(t,e);default:Oe(t)}},Po=Wn.getChild(["layouter"]);class jH{graphviz;constructor(e){this.graphviz=e??new ir}dispose(){this.graphviz.dispose()}[Symbol.dispose](){this.dispose()}get graphvizPort(){return this.
|
|
1887
1888
|
graphviz}changePort(e){this.graphviz.dispose(),this.graphviz=e}async dotToJson(e){let n;try{n=await this.graphviz.layoutJson(e)}catch(r){throw Po.error(Un(r)),Po.error`Failed to convert DOT to JSON:\n${e}`,r}try{return JSON.parse(n)}catch(r){throw Po.error(Un(r)),Po.error`Failed to parse JSON:\n${n}\n. Generated from DOT:\n${e}`,r}}async layout(e){try{Po.debug`layouting view ${e.view.id}...`;let n=await this.dot(e);const{view:r}=e,i=await this.dotToJson(n);let s=OH(i,r);return r.manualLayout&&(s=
|
|
1888
1889
|
lz(s,r.manualLayout)),n=n.split(`
|
|
1889
1890
|
`).filter(o=>!(o.includes("margin")&&o.includes("50.1"))).join(`
|
|
1890
1891
|
`),Po.debug`layouting view ${e.view.id} done`,{dot:n,diagram:s}}catch(n){throw new Error(`Error during layout: ${e.view.id}`,{cause:n})}}async svg(e){let n=await this.dot(e);return n=n.split(`
|
|
1891
1892
|
`).filter(r=>!(r.includes("margin")&&r.includes("50.1"))).join(`
|
|
1892
|
-
`),{svg:await this.graphviz.svg(n),dot:n}}async dot(e){let n=qH(e).print();if(!
|
|
1893
|
+
`),{svg:await this.graphviz.svg(n),dot:n}}async dot(e){let n=qH(e).print();if(!hm(e.view))return n;try{return await this.graphviz.unflatten(n)}catch(r){return Po.warn(`Error during unflatten: ${e.view.id}`,{error:r}),n}}}var Tw={exports:{}},TS;function GH(){return TS||(TS=1,function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(u,c,l){this.fn=u,this.context=c,this.once=l||!1}function s(u,c,l,f,d){
|
|
1893
1894
|
if(typeof l!="function")throw new TypeError("The listener must be a function");var p=new i(l,f||u,d),m=n?n+c:c;return u._events[m]?u._events[m].fn?u._events[m]=[u._events[m],p]:u._events[m].push(p):(u._events[m]=p,u._eventsCount++),u}function o(u,c){--u._eventsCount===0?u._events=new r:delete u._events[c]}function a(){this._events=new r,this._eventsCount=0}a.prototype.eventNames=function(){var c=[],l,f;if(this._eventsCount===0)return c;for(f in l=this._events)e.call(l,f)&&c.push(n?f.slice(1):f);
|
|
1894
1895
|
return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(l)):c},a.prototype.listeners=function(c){var l=n?n+c:c,f=this._events[l];if(!f)return[];if(f.fn)return[f.fn];for(var d=0,p=f.length,m=new Array(p);d<p;d++)m[d]=f[d].fn;return m},a.prototype.listenerCount=function(c){var l=n?n+c:c,f=this._events[l];return f?f.fn?1:f.length:0},a.prototype.emit=function(c,l,f,d,p,m){var w=n?n+c:c;if(!this._events[w])return!1;var y=this._events[w],g=arguments.length,b,R;if(y.fn){switch(y.once&&
|
|
1895
1896
|
this.removeListener(c,y.fn,void 0,!0),g){case 1:return y.fn.call(y.context),!0;case 2:return y.fn.call(y.context,l),!0;case 3:return y.fn.call(y.context,l,f),!0;case 4:return y.fn.call(y.context,l,f,d),!0;case 5:return y.fn.call(y.context,l,f,d,p),!0;case 6:return y.fn.call(y.context,l,f,d,p,m),!0}for(R=1,b=new Array(g-1);R<g;R++)b[R-1]=arguments[R];y.fn.apply(y.context,b)}else{var A=y.length,N;for(R=0;R<A;R++)switch(y[R].once&&this.removeListener(c,y[R].fn,void 0,!0),g){case 1:y[R].fn.call(y[R].
|
|
@@ -1906,11 +1907,11 @@ setInterval(()=>{this.#v()},this.#a),this.#h=Date.now()+this.#a)}#v(){this.#r===
|
|
|
1906
1907
|
this.#n.setPriority(e,n)}async add(e,n={}){return n.id??=(this.#w++).toString(),n={timeout:this.timeout,throwOnTimeout:this.#g,...n},new Promise((r,i)=>{this.#n.enqueue(async()=>{this.#s++,this.#r++;try{n.signal?.throwIfAborted();let s=e({signal:n.signal});n.timeout&&(s=HH(Promise.resolve(s),{milliseconds:n.timeout})),n.signal&&(s=Promise.race([s,this.#k(n.signal)]));const o=await s;r(o),this.emit("completed",o)}catch(s){if(s instanceof CS&&!n.throwOnTimeout){r();return}i(s),this.emit("error",s)}finally{
|
|
1907
1908
|
this.#$()}},n),this.emit("add"),this.#l()})}async addAll(e,n){return Promise.all(e.map(async r=>this.add(r,n)))}start(){return this.#o?(this.#o=!1,this.#d(),this):this}pause(){this.#o=!0}clear(){this.#n=new this.#m}async onEmpty(){this.#n.size!==0&&await this.#f("empty")}async onSizeLessThan(e){this.#n.size<e||await this.#f("next",()=>this.#n.size<e)}async onIdle(){this.#s===0&&this.#n.size===0||await this.#f("idle")}async#f(e,n){return new Promise(r=>{const i=()=>{n&&!n()||(this.off(e,i),r())};
|
|
1908
1909
|
this.on(e,i)})}get size(){return this.#n.size}sizeBy(e){return this.#n.filter(e).length}get pending(){return this.#s}get isPaused(){return this.#o}}const ri=Wn.getChild(["layouter","queue"]);class _S extends jH{queue;isProcessingBatch=!1;constructor(e){super(e?.graphviz),this.queue=new XH({concurrency:e?.concurrency??this.graphvizPort.concurrency,timeout:e?.timeout??2e4,throwOnTimeout:e?.throwOnTimeout??!0})}async runInQueue(e){return this.isProcessingBatch?(ri.debug`waiting for batch to finish`,
|
|
1909
|
-
await this.queue.onIdle(),await
|
|
1910
|
-
concurrency,ri.debug`set queue concurrency to ${this.graphvizPort.concurrency}`})}async layout(e){const n=await this.runInQueue(async()=>await super.layout(e));if(!n)throw new Error("QueueGraphvizLayoter: layout failed");return n}async batchLayout(e){if(this.isProcessingBatch)return ri.debug`wait for previous layouts to finish`,await this.queue.onIdle(),await
|
|
1911
|
-
this.isProcessingBatch=!0;const r=[];try{for(const i of e.batch)ri.debug`add task for view ${i.view.id}`,this.queue.add(async()=>(await
|
|
1910
|
+
await this.queue.onIdle(),await mm(),await this.runInQueue(e)):(this.queue.size>this.queue.concurrency*2+1&&(ri.debug`task limit reached: ${this.queue.size} (pending: ${this.queue.pending}), waiting queue to shrink to ${this.queue.concurrency}`,await this.queue.onSizeLessThan(this.queue.concurrency+1)),ri.debug`add task to queue`,await this.queue.add(e))}changePort(e){super.changePort(e),this.queue.concurrency!==e.concurrency&&this.queue.onIdle().finally(()=>{this.queue.concurrency=this.graphvizPort.
|
|
1911
|
+
concurrency,ri.debug`set queue concurrency to ${this.graphvizPort.concurrency}`})}async layout(e){const n=await this.runInQueue(async()=>await super.layout(e));if(!n)throw new Error("QueueGraphvizLayoter: layout failed");return n}async batchLayout(e){if(this.isProcessingBatch)return ri.debug`wait for previous layouts to finish`,await this.queue.onIdle(),await mm(),await this.batchLayout(e);const n=this.queue.concurrency;ri.debug`starting batch layout, size: ${e.batch.length}, concurrency: ${n}`,
|
|
1912
|
+
this.isProcessingBatch=!0;const r=[];try{for(const i of e.batch)ri.debug`add task for view ${i.view.id}`,this.queue.add(async()=>(await mm(),await super.layout(i))).then(s=>{if(!s){e.onError?.(i,new Error(`Layout queue returned null for view ${i.view.id}`));return}r.push(s),e.onSuccess?.(i,s)}).catch(s=>{ri.error(`Fail layout view ${i.view.id}`,{err:s}),e.onError?.(i,s)}),this.queue.size>n+2&&(ri.debug`task limit reached: ${this.queue.size}, waiting queue to shrink to ${n}`,await this.queue.onSizeLessThan(
|
|
1912
1913
|
n+1))}finally{await this.queue.onIdle(),ri.debug`batch layout done`,this.isProcessingBatch=!1}return r}dispose(){this.queue.clear(),super.dispose()}}class YH{parser;locator;constructor(e){this.parser=e.likec4.ModelParser,this.locator=e.likec4.ModelLocator}getDocumentation(e){try{if(Cn(e)){const n=ut(e),r=this.parser.forDocument(n).parseDeploymentNode(e),i=[r.id];return r.title!==e.name&&i.push(" ",`**${r.title}**`),i.join(`
|
|
1913
|
-
`)}if(
|
|
1914
|
+
`)}if(jn(e)){const n=ut(e),r=this.parser.forDocument(n).parseDeployedInstance(e),[i,s]=fn.isImportRef(r.element)?[r.element.project,r.element.model]:[n.likec4ProjectId,r.element.model],o=i?this.locator.getParsedElement(s,i):this.locator.getParsedElement(s),a=[r.id,`_instance of_ ${r.element}`];return o&&a.push(" ",`**${o.title}**`),a.join(`
|
|
1914
1915
|
`)}if(cn(e)){const n=ut(e),r=this.parser.forDocument(n).parseElement(e);return r?[r.id," ",`**${r.title}**`].join(`
|
|
1915
1916
|
`):void 0}}catch(n){De(n)}}}function JH(t,e){return[t,e]=Cw(t,e)>0?[e,t]:[t,e],QH(t.range,e.range.start)}function Cw(t,e){const n=t.range.start.line-e.range.start.line;return n!==0?n:t.range.start.character-e.range.start.character}function QH(t,e){return!(e.line<t.start.line||e.line>t.end.line||e.line==t.start.line&&e.character<t.start.character||e.line==t.end.line&&e.character>t.end.character)}function xS(t){return t.range.start.line!=t.range.end.line}const Z={newLine:is.newLine({allowMore:!0}),
|
|
1916
1917
|
oneSpace:is.oneSpace(),noSpace:is.noSpace(),indent:is.indent({allowMore:!0}),noIndent:is.noIndent()};class ZH extends f8{options={quoteStyle:"auto"};extendedFormattingCommands=[];constructor(e){super(),e.shared.workspace.ConfigurationProvider.onConfigurationSectionUpdate(n=>this.onConfigurationUpdate(n.configuration.formatting))}doDocumentFormat(e,n,r){this.extendedFormattingCommands=[];const i=super.doDocumentFormat(e,n,r);return this.doExtendedFormatting(i),i}format(e){this.removeIndentFromTopLevelStatements(
|
|
@@ -1918,27 +1919,27 @@ e),this.indentContentInBraces(e),this.normalizeQuotes(e),this.formatImports(e),t
|
|
|
1918
1919
|
this.formatIncludeExcludeExpressions(e),this.formatWhereExpression(e),this.formatWhereRelationExpression(e),this.formatWhereElementExpression(e),this.formatRelationExpression(e),this.formatAutolayoutProperty(e),this.formatWithPredicate(e),this.formatViewRuleStyle(e),this.formatLeafProperty(e),this.formatLinkProperty(e),this.formatNavigateToProperty(e),this.formatTags(e)}formatTags(e){this.on(e,MC,(n,r)=>{const i=Ho(n.$cstNode,"values").filter(s=>s).slice(1);r.cst(i).prepend(Z.oneSpace),r.keywords(
|
|
1919
1920
|
",").prepend(Z.noSpace).append(Z.oneSpace)})}formatDeploymentRelation(e){this.on(e,xr,(n,r)=>{const i=n?.source?.$cstNode?[n?.source?.$cstNode]:[];r.cst(i).append(Z.oneSpace),r.keywords("]->").prepend(Z.noSpace),r.keywords("-[").append(Z.noSpace),r.nodes(...Pe([n.target,n.tags],de)).prepend(Z.oneSpace),r.properties("title","description","technology").prepend(Z.oneSpace)})}formatExtendDeployment(e){this.on(e,os,(n,r)=>{r.keywords("extend").append(Z.oneSpace)})}formatRelation(e){this.on(e,n=>ei(n)||
|
|
1920
1921
|
xr(n),(n,r)=>{const i=n?.source?.$cstNode?[n?.source?.$cstNode]:[];r.cst(i).append(Z.oneSpace),r.keywords("]->").prepend(Z.noSpace),r.keywords("-[").append(Z.noSpace),r.nodes(...Pe([n.target,n.tags],de)).prepend(Z.oneSpace),r.properties("title","description","technology").prepend(Z.oneSpace)}),this.on(e,ah,(n,r)=>{r.keywords("->","<-").surround(Z.oneSpace),r.property("dotKind").prepend(Z.oneSpace).append(Z.oneSpace),r.keywords("]->").prepend(Z.noSpace).append(Z.oneSpace),r.keywords("-[").prepend(
|
|
1921
|
-
Z.oneSpace).append(Z.noSpace),r.properties("title").prepend(Z.oneSpace)})}removeIndentFromTopLevelStatements(e){AC(e.$container)&&this.getNodeFormatter(e).keywords("specification","model","views","likec4lib","global","deployments","import").prepend(Z.noIndent)}indentContentInBraces(e){if(rU(e)||OC(e)||Sa(e)||xa(e)||Ca(e)||
|
|
1922
|
-
e)
|
|
1923
|
-
Z.oneSpace)}),this.on(e,vC)?.keywords("dynamic","view").append(Z.oneSpace),this.on(e,yC)?.keywords("deployment","view").append(Z.oneSpace)}formatLeafProperty(e){if(fl(e)||Hl(e)||Bh(e)||ka(e)||
|
|
1922
|
+
Z.oneSpace).append(Z.noSpace),r.properties("title").prepend(Z.oneSpace)})}removeIndentFromTopLevelStatements(e){AC(e.$container)&&this.getNodeFormatter(e).keywords("specification","model","views","likec4lib","global","deployments","import").prepend(Z.noIndent)}indentContentInBraces(e){if(rU(e)||OC(e)||Sa(e)||xa(e)||Ca(e)||Cv(e)||Ea(e)||$o(e)||El(e)||bl(e)||$o(e)||SC(e)||ch(e)||Dv(e)||oU(e)||xh(e)||sU(e)||Il(e)||Ev(e)||wC(e)||yv(e)||Ia(e)||ad(e)||V8(e)||X8(e)||hl(e)||vv(e)||_C(e)||gC(e)||J8(e)||mC(
|
|
1923
|
+
e)||Rv(e)){const n=this.getNodeFormatter(e),r=n.keywords("{"),i=n.keywords("}"),s=n.interior(r,i);let o=null;for(const a of s.nodes)(!o||!JH(o,a))&&n.cst([a]).prepend(Z.indent),o=a;r.prepend(Z.noIndent).prepend(Z.oneSpace),i.prepend(Z.noIndent).prepend(is.newLine({allowMore:!0}))}}appendKeywordsWithSpace(e){this.on(e,$C)?.keywords("element").append(Z.oneSpace)}formatView(e){this.on(e,dh,(n,r)=>{(n.extends||n.viewOf||n.name)&&r.keywords("view").append(Z.oneSpace),r.keywords("of","extends").surround(
|
|
1924
|
+
Z.oneSpace)}),this.on(e,vC)?.keywords("dynamic","view").append(Z.oneSpace),this.on(e,yC)?.keywords("deployment","view").append(Z.oneSpace)}formatLeafProperty(e){if(fl(e)||Hl(e)||Bh(e)||ka(e)||_v(e)||NC(e)||IC(e)||vo(e)||Sl(e)||el(e)||as(e)||Ph(e)||Yp(e)||Ch(e)||Sv(e)||Iv(e)||xv(e)||Lv(e)){const n=this.getNodeFormatter(e),r=n.keyword(":"),i=n.keywords("title","description","technology","notation","notes","color","line","head","tail","icon","shape","border","opacity","multiple","size","padding","t\
|
|
1924
1925
|
extSize");r.nodes.length===0?i.append(Z.oneSpace):r.prepend(Z.noSpace).append(Z.oneSpace),n.keyword(";").prepend(Z.noSpace).append(Z.newLine)}}formatLinkProperty(e){this.on(e,xl,(n,r)=>{r.keyword("link").append(Z.oneSpace),r.property("value").append(Z.oneSpace),r.keyword(":").prepend(Z.noSpace).append(Z.oneSpace),r.keyword(";").prepend(Z.noSpace).append(Z.newLine)})}formatNavigateToProperty(e){this.on(e,Th)?.property("key").append(Z.oneSpace)}formatAutolayoutProperty(e){this.on(e,rd,(n,r)=>{r.keyword(
|
|
1925
1926
|
"autoLayout").append(Z.oneSpace),r.property("rankSep").prepend(Z.oneSpace),r.property("nodeSep").prepend(Z.oneSpace)})}formatMetadataProperty(e){this.on(e,iU,(n,r)=>{r.property("key").append(Z.oneSpace),r.keyword(":").prepend(Z.noSpace).append(Z.oneSpace),r.keyword(";").prepend(Z.noSpace).append(Z.newLine)})}formatElementDeclaration(e){this.on(e,cn,(n,r)=>{const i=pn(n.$cstNode,"kind"),s=pn(n.$cstNode,"name");s&&i&&(Cw(s,i)>0?r.cst([i]).append(Z.oneSpace):(r.cst([s]).append(Z.oneSpace),r.cst([i]).
|
|
1926
1927
|
prepend(Z.oneSpace))),r.properties("props").prepend(Z.oneSpace)})}formatExtendElement(e){this.on(e,Eo,(n,r)=>{r.keywords("extend").append(Z.oneSpace)})}formatGlobals(e){this.on(e,Ea,(n,r)=>{r.keyword("style").append(Z.oneSpace),r.property("id").append(Z.oneSpace)}),this.on(e,$o,(n,r)=>{r.keyword("styleGroup").append(Z.oneSpace)}),this.on(e,El,(n,r)=>{r.keyword("predicateGroup").append(Z.oneSpace)}),this.on(e,bl,(n,r)=>{r.keyword("dynamicPredicateGroup").append(Z.oneSpace)})}formatImports(e){this.
|
|
1927
|
-
on(e,kl,(n,r)=>{r.keyword("import").append(Z.oneSpace),r.keywords("{","}","from").surround(Z.oneSpace)}),this.on(e,Zr,(n,r)=>{r.keywords(",").prepend(Z.noSpace).append(Z.oneSpace)})}formatSpecificationRule(e){if((Sa(e)||xa(e)||Zl(e)||Ca(e))&&this.getNodeFormatter(e).keywords("element","relationship","tag","deploymentNode").append(Z.oneSpace),Ih(e)){const n=this.getNodeFormatter(e);n.keyword("color").append(Z.oneSpace),n.property("name").append(Z.oneSpace)}}formatWithPredicate(e){(yh(e)||
|
|
1928
|
-
this.getNodeFormatter(e).keyword("with").prepend(Z.oneSpace)}formatDeploymentNodeDeclaration(e){this.on(e,Cn,(n,r)=>{const i=pn(n.$cstNode,"kind"),s=pn(n.$cstNode,"name");s&&i&&(Cw(s,i)>0?r.cst([i]).append(Z.oneSpace):(r.cst([s]).append(Z.oneSpace),r.cst([i]).prepend(Z.oneSpace))),r.properties("title").prepend(Z.oneSpace)})}formatDeployedInstance(e){this.on(e,
|
|
1929
|
-
r.property("title").prepend(Z.oneSpace)})}formatViewRuleGlobalStyle(e){this.on(e,
|
|
1930
|
-
keyword(",").prepend(Z.noSpace).append(Z.oneSpace),this.on(e,Z8)?.keyword(",").prepend(Z.noSpace).append(Z.oneSpace)}formatWhereExpression(e){(
|
|
1931
|
-
Z.oneSpace)}}formatWhereElementExpression(e){if(this.on(e,W8,(n,r)=>{r.property("operator").surround(Z.oneSpace)}),this.on(e,BC,(n,r)=>{r.keyword("not").append(Z.oneSpace)}),fC(e)||dU(e)||lU(e)){const n=this.getNodeFormatter(e);n.property("operator").surround(Z.oneSpace),n.property("not").surround(Z.oneSpace)}}formatIncludeExcludeExpressions(e){if(
|
|
1928
|
+
on(e,kl,(n,r)=>{r.keyword("import").append(Z.oneSpace),r.keywords("{","}","from").surround(Z.oneSpace)}),this.on(e,Zr,(n,r)=>{r.keywords(",").prepend(Z.noSpace).append(Z.oneSpace)})}formatSpecificationRule(e){if((Sa(e)||xa(e)||Zl(e)||Ca(e))&&this.getNodeFormatter(e).keywords("element","relationship","tag","deploymentNode").append(Z.oneSpace),Ih(e)){const n=this.getNodeFormatter(e);n.keyword("color").append(Z.oneSpace),n.property("name").append(Z.oneSpace)}}formatWithPredicate(e){(yh(e)||Nv(e))&&
|
|
1929
|
+
this.getNodeFormatter(e).keyword("with").prepend(Z.oneSpace)}formatDeploymentNodeDeclaration(e){this.on(e,Cn,(n,r)=>{const i=pn(n.$cstNode,"kind"),s=pn(n.$cstNode,"name");s&&i&&(Cw(s,i)>0?r.cst([i]).append(Z.oneSpace):(r.cst([s]).append(Z.oneSpace),r.cst([i]).prepend(Z.oneSpace))),r.properties("title").prepend(Z.oneSpace)})}formatDeployedInstance(e){this.on(e,jn,(n,r)=>{const i=n.$cstNode?.content.find(s=>s.text==="=");i&&r.cst([i]).surround(Z.oneSpace),r.keyword("instanceOf").append(Z.oneSpace),
|
|
1930
|
+
r.property("title").prepend(Z.oneSpace)})}formatViewRuleGlobalStyle(e){this.on(e,Bv,(n,r)=>{r.keywords("global","style").append(Z.oneSpace)})}formatViewRuleGlobalPredicate(e){const n=this.getNodeFormatter(e);(Mv(e)||bC(e))&&n.keywords("global","predicate").append(Z.oneSpace)}formatViewRuleGroup(e){this.on(e,ad,(n,r)=>{r.keyword("group").append(Z.oneSpace)})}formatViewRuleStyle(e){this.on(e,Ia)?.keyword("style").append(Z.oneSpace),this.on(e,ol)?.keyword("style").append(Z.oneSpace),this.on(e,kC)?.
|
|
1931
|
+
keyword(",").prepend(Z.noSpace).append(Z.oneSpace),this.on(e,Z8)?.keyword(",").prepend(Z.noSpace).append(Z.oneSpace)}formatWhereExpression(e){(Pv(e)||kv(e))&&this.getNodeFormatter(e).keyword("where").append(Z.oneSpace)}formatWhereRelationExpression(e){if(this.on(e,H8,(n,r)=>{r.property("operator").surround(Z.oneSpace)}),this.on(e,jC,(n,r)=>{r.keyword("not").append(Z.oneSpace)}),hC(e)||fU(e)||qC(e)){const n=this.getNodeFormatter(e);n.property("operator").surround(Z.oneSpace),n.property("not").surround(
|
|
1932
|
+
Z.oneSpace)}}formatWhereElementExpression(e){if(this.on(e,W8,(n,r)=>{r.property("operator").surround(Z.oneSpace)}),this.on(e,BC,(n,r)=>{r.keyword("not").append(Z.oneSpace)}),fC(e)||dU(e)||lU(e)){const n=this.getNodeFormatter(e);n.property("operator").surround(Z.oneSpace),n.property("not").surround(Z.oneSpace)}}formatIncludeExcludeExpressions(e){if(uv(e)||cd(e)||ma(e)){const n=this.getNodeFormatter(e);(!e.$cstNode||!xS(e.$cstNode))&&n.keywords("include","exclude").append(Z.oneSpace)}if(kC(e)){const n=this.
|
|
1932
1933
|
getNodeFormatter(e),r=this.findPredicateExpressionRoot(e),i=r?.$cstNode&&xS(r?.$cstNode);i&&n.property("value").prepend(Z.indent),n.keyword(",").prepend(Z.noSpace).append(i?Z.newLine:Z.oneSpace)}}formatRelationExpression(e){this.on(e,tU,(n,r)=>{r.keyword("->").append(Z.oneSpace)}),this.on(e,CC,(n,r)=>{r.keyword("->").prepend(Z.oneSpace)}),this.on(e,xC,(n,r)=>{r.keywords("->","<->").prepend(Z.oneSpace),r.keywords("-[").prepend(Z.oneSpace).append(Z.noSpace),r.keywords("]->").prepend(Z.noSpace).append(
|
|
1933
|
-
Z.oneSpace),r.property("dotKind").prepend(Z.oneSpace).append(Z.oneSpace)}),this.on(e,Q8,(n,r)=>{r.property("target").prepend(Z.oneSpace)})}findPredicateExpressionRoot(e){let n=e.$container;for(;;){if(!n||
|
|
1934
|
-
n(r,e);break;default:Oe(r.type)}}normalizeQuotes(e){if(this.options.quoteStyle==="ignore")return;let n=null;n=n??this.on(e,zp)?.property("value"),n=n??this.on(e,cn)?.properties("props"),n=n??this.on(e,kl)?.properties("project"),n=n??this.on(e,ei)?.properties("title","technology"),n=n??this.on(e,ad)?.properties("title"),n=n??this.on(e,ah)?.properties("title"),n=n??this.on(e,Cn)?.properties("title"),n=n??this.on(e,
|
|
1934
|
+
Z.oneSpace),r.property("dotKind").prepend(Z.oneSpace).append(Z.oneSpace)}),this.on(e,Q8,(n,r)=>{r.property("target").prepend(Z.oneSpace)})}findPredicateExpressionRoot(e){let n=e.$container;for(;;){if(!n||uv(n)||cd(n)||ma(n))return n;n=n.$container}}on(e,n,r){const i=n(e)?this.getNodeFormatter(e):void 0;return r&&i&&r(e,i),i}doExtendedFormatting(e){const n=this.quotesNormalizerFactory(this.extendedFormattingCommands);for(let r of this.extendedFormattingCommands)switch(r.type){case"normalizeQuotes":
|
|
1935
|
+
n(r,e);break;default:Oe(r.type)}}normalizeQuotes(e){if(this.options.quoteStyle==="ignore")return;let n=null;n=n??this.on(e,zp)?.property("value"),n=n??this.on(e,cn)?.properties("props"),n=n??this.on(e,kl)?.properties("project"),n=n??this.on(e,ei)?.properties("title","technology"),n=n??this.on(e,ad)?.properties("title"),n=n??this.on(e,ah)?.properties("title"),n=n??this.on(e,Cn)?.properties("title"),n=n??this.on(e,jn)?.properties("title"),n=n??this.on(e,xr)?.properties("title","technology"),n=n??this.
|
|
1935
1936
|
on(e,xl)?.properties("title"),n&&this.extendedFormattingCommands.push({type:"normalizeQuotes",region:n})}quotesNormalizerFactory(e){const n=this.options.quoteStyle!="auto"?this.options.quoteStyle:this.getAutoQuoteStyle(e);return(r,i)=>{const s=n==="single"?'"':"'",o=n==="single"?"'":'"',a=r.region.nodes.map(u=>({range:u.range,newText:o+this.escapeQuotesInternalQuotes(u.text.slice(1,-1),s,o)+o}));i.push(...a)}}escapeQuotesInternalQuotes(e,n,r){let i="",s=0;for(;s>=0;){let o=e.indexOf(r,s);if(o<0){
|
|
1936
1937
|
i+=e.slice(s);break}i+=e.slice(s,o),s=o+1;let a=!1;for(;o>0&&e[o-1]=="\\";)a=!a,o--;i+=a?r:`\\${r}`}return i}getAutoQuoteStyle(e){const n=e.flatMap(r=>r.region.nodes);return n.filter(r=>r.text[0]=='"').length*2>=n.length?"double":"single"}onConfigurationUpdate(e){this.options={...this.options,...e??{quoteStyle:"auto"}}}}const eK=st.getChild("LikeC4LanguageServices");class tK{constructor(e){this.services=e,this.views=e.likec4.Views,this.builder=e.likec4.ModelBuilder,this.projectsManager=e.shared.
|
|
1937
|
-
workspace.ProjectsManager}views;builder;projectsManager;get workspaceUri(){return this.services.shared.workspace.WorkspaceManager.workspaceUri}projects(){const e=this.services.shared.workspace.ProjectsManager,n=Le(this.services.shared.workspace.LangiumDocuments.groupedByProject(),cc(),bt(([s,o])=>{const a=s,{folder:u,config:c}=e.getProject(a);return{id:a,folder:u,config:c,documents:bt(o,Xr("uri"))}}));if(
|
|
1938
|
+
workspace.ProjectsManager}views;builder;projectsManager;get workspaceUri(){return this.services.shared.workspace.WorkspaceManager.workspaceUri}projects(){const e=this.services.shared.workspace.ProjectsManager,n=Le(this.services.shared.workspace.LangiumDocuments.groupedByProject(),cc(),bt(([s,o])=>{const a=s,{folder:u,config:c}=e.getProject(a);return{id:a,folder:u,config:c,documents:bt(o,Xr("uri"))}}));if(Bn(n,1))return n;const{folder:r,config:i}=e.getProject(Sn.DefaultProjectId);return[{id:Sn.DefaultProjectId,
|
|
1938
1939
|
folder:r,config:i,documents:null}]}async diagrams(){return await this.views.diagrams()}async computedModel(e){const n=this.projectsManager.ensureProjectId(e);return await this.builder.buildLikeC4Model(n)}async layoutedModel(e){const n=this.projectsManager.ensureProjectId(e),r=await this.builder.parseModel(n);if(!r)throw new Error("Failed to parse model");const i=await this.views.diagrams(n);return xs.create({...r.$data,_stage:"layouted",views:uc(i,Xr("id"))})}getErrors(){return this.services.shared.
|
|
1939
|
-
workspace.LangiumDocuments.allExcludingBuiltin.toArray().flatMap(e=>(e.diagnostics??[]).filter(n=>n.severity===Ws.Error).map(({message:n,range:r})=>({message:n,line:r.start.line,range:r,sourceFsPath:e.uri.fsPath})))}async notifyUpdate({changed:e,removed:n}){if(!e&&!n)return!1;const r=this.services.shared.workspace.WorkspaceLock;try{let i=!1;return await r.write(async s=>{await this.services.shared.workspace.DocumentBuilder.update(e?[
|
|
1940
|
+
workspace.LangiumDocuments.allExcludingBuiltin.toArray().flatMap(e=>(e.diagnostics??[]).filter(n=>n.severity===Ws.Error).map(({message:n,range:r})=>({message:n,line:r.start.line,range:r,sourceFsPath:e.uri.fsPath})))}async notifyUpdate({changed:e,removed:n}){if(!e&&!n)return!1;const r=this.services.shared.workspace.WorkspaceLock;try{let i=!1;return await r.write(async s=>{await this.services.shared.workspace.DocumentBuilder.update(e?[dt.file(e)]:[],n?[dt.file(n)]:[],s),i=!s.isCancellationRequested}),
|
|
1940
1941
|
i}catch(i){return eK.error(Un(i)),!1}}locate(e){switch(!0){case"element"in e:return this.services.likec4.ModelLocator.locateElement(e.element,e.projectId);case"relation"in e:return this.services.likec4.ModelLocator.locateRelation(e.relation,e.projectId);case"view"in e:return this.services.likec4.ModelLocator.locateView(e.view,e.projectId);case"deployment"in e:return this.services.likec4.ModelLocator.locateDeploymentElement(e.deployment,e.projectId);default:Oe(e)}}}class nK{constructor(e){this.services=
|
|
1941
|
-
e}async provideCodeLens(e,n,r){return ps(e)?(e.state<=qe.Linked&&(st.debug(`Waiting for document ${e.uri.path} to be Linked`),await this.services.shared.workspace.DocumentBuilder.waitUntil(qe.Linked,e.uri,r),st.debug("Document is linked")),e.parseResult.value.views.flatMap(i=>i.views).flatMap(i=>{const s=
|
|
1942
|
+
e}async provideCodeLens(e,n,r){return ps(e)?(e.state<=qe.Linked&&(st.debug(`Waiting for document ${e.uri.path} to be Linked`),await this.services.shared.workspace.DocumentBuilder.waitUntil(qe.Linked,e.uri,r),st.debug("Document is linked")),e.parseResult.value.views.flatMap(i=>i.views).flatMap(i=>{const s=Vh.readId(i),o=i.$cstNode?.range;if(!o||!s)return[];const a=Bt(i);return{range:{start:o.start,end:{line:o.start.line,character:o.start.character+4}},command:{command:"likec4.open-preview",arguments:[
|
|
1942
1943
|
s,a],title:"open preview"}}})):void 0}}const Aw=["color","shape","icon","border","opacity","multiple","size","textSize"].join(",");class rK extends DT{constructor(e){super(e),this.services=e}completionOptions={triggerCharacters:[".","#"]};completionForKeyword(e,n,r){if(this.filterKeyword(e,n))switch(!0){case n.value==="import":r(e,{label:n.value,kind:Ct.Snippet,insertTextFormat:Rn.Snippet,insertText:`${n.value} { $0 } from '\${1|${this.services.shared.workspace.ProjectsManager.all.join(",")}|}'`});
|
|
1943
1944
|
break;case(n.value==="deployment"&&Gr(e.node,Il)):r(e,{label:n.value,detail:"Insert deployment view",kind:Ct.Class,insertTextFormat:Rn.Snippet,insertText:["deployment view ${1:view_${TM_FILENAME_BASE}_${CURRENT_SECOND}} {"," title '${2:Untitled}'"," "," include $0","}"].join(`
|
|
1944
1945
|
`)});break;case["title","description","technology"].includes(n.value):r(e,{label:n.value,kind:Ct.Property,insertTextFormat:Rn.Snippet,insertText:`${n.value} '\${0}'`});break;case n.value==="color":r(e,{label:n.value,kind:Ct.Property,insertTextFormat:Rn.Snippet,insertText:`${n.value} \${1|${ax.join(",")}|}$0`});break;case n.value==="opacity":r(e,{label:n.value,kind:Ct.Property,insertTextFormat:Rn.Snippet,insertText:`${n.value} \${0:100}%`});break;case["views","specification","model","deployment",
|
|
@@ -1955,7 +1956,7 @@ break;case(n.value==="deployment"&&Gr(e.node,Il)):r(e,{label:n.value,detail:"Ins
|
|
|
1955
1956
|
}`});break;case n.value==="extend":r(e,{label:n.value,detail:"Extend another view",kind:Ct.Class,insertTextFormat:Rn.Snippet,insertText:`extend $1 {
|
|
1956
1957
|
$0
|
|
1957
1958
|
}`});break;case n.value==="autoLayout":r(e,{label:n.value,kind:Ct.Class,insertTextFormat:Rn.Snippet,insertText:"autoLayout ${1|TopBottom,BottomTop,LeftRight,RightLeft|}$0"});break;default:r(e,{label:n.value,kind:this.getKeywordCompletionItemKind(n),detail:"Keyword",sortText:"1"})}}}class iK extends kT{createDocumentHighlight(e){return ce.DocumentHighlight.create(e.segment.range,ce.DocumentHighlightKind.Read)}}class sK{constructor(e){this.services=e}async getDocumentLinks(e,n,r){return ps(e)?wr(e.
|
|
1958
|
-
parseResult.value).filter(xl).map(i=>{try{const s=pn(i.$cstNode,"value")?.range,o=s&&this.resolveLink(e,i.value);if(o&&ds(o))return{range:s,target:o}}catch(s){De(s)}return null}).nonNullable().toArray():[]}resolveLink(e,n){if(ds(n)||Dd(n))return n;if(
|
|
1959
|
+
parseResult.value).filter(xl).map(i=>{try{const s=pn(i.$cstNode,"value")?.range,o=s&&this.resolveLink(e,i.value);if(o&&ds(o))return{range:s,target:o}}catch(s){De(s)}return null}).nonNullable().toArray():[]}resolveLink(e,n){if(ds(n)||Dd(n))return n;if(Gv(n))return qh(e.uri.toString(),"../",n);const r=this.services.shared.workspace.ProjectsManager.getProject(e).folder;return qh(r.toString(),n)}relativeLink(e,n){if(Dd(n))return ZC(n);if(Gv(n)){const r=this.services.shared.workspace.ProjectsManager.
|
|
1959
1960
|
getProject(e).folder.toString(),i=new URL(e.uri.toString()),s=new URL(n,i).toString();return ZC(CU(s,r))}return null}}const PS=st.getChild("DocumentSymbolProvider");class oK{constructor(e){this.services=e,this.nodeKindProvider=e.shared.lsp.NodeKindProvider,this.parser=e.likec4.ModelParser,this.locator=e.likec4.ModelLocator,this.nameProvider=e.references.NameProvider}nodeKindProvider;nameProvider;parser;locator;async getSymbols(e,n,r){if(!ps(e))return[];e.state<=qe.Linked&&(PS.debug(`Waiting for \
|
|
1960
1961
|
document ${e.uri.path} to be Linked`),await this.services.shared.workspace.DocumentBuilder.waitUntil(qe.Linked,e.uri,r),PS.debug("document is Linked"));const{parseResult:{value:{specifications:i,models:s,deployments:o,views:a,likec4lib:u}}}=e;return[...u.map(c=>()=>this.getLikec4LibSymbol(c)),...i.map(c=>()=>this.getSpecSymbol(c)),...s.map(c=>()=>this.getModelSymbol(c)),...o.map(c=>()=>this.getDeploymentModelSymbol(c)),...a.map(c=>()=>this.getModelViewsSymbol(c))].flatMap(c=>{try{return c()??[]}catch(l){
|
|
1961
1962
|
return De(l),[]}})}getLikec4LibSymbol(e){const n=e?.$cstNode;if(!n)return[];const r=e.icons.map(i=>this.getLibIconSymbol(i)).filter(de);return r.length===0?[]:[{kind:kr.Namespace,name:"icons",range:n.range,selectionRange:Pu(n,"icons")?.range??n.range,children:r}]}getSpecSymbol(e){const n=e?.$cstNode;if(!n)return[];const r=pn(n,"name");if(!r)return[];const i=Le([...e.elements,...e.tags,...e.relationships],bt(s=>{try{if(Sa(s)||xa(s)||Ca(s))return this.getKindSymbol(s);if(Zl(s))return this.getTagSymbol(
|
|
@@ -1963,111 +1964,111 @@ s)}catch(o){return De(o),null}Oe(s)}),Pe(de));return i.length===0?[]:[{kind:kr.N
|
|
|
1963
1964
|
range:n.range,selectionRange:r.range,children:e.elements.flatMap(i=>this.getDeploymentElementSymbol(i))}]:[]}getElementsSymbol(e){try{if(Eo(e))return this.getExtendElementSymbol(e);if(cn(e))return this.getElementSymbol(e)}catch(n){De(n)}return[]}getExtendElementSymbol(e){const n=e.$cstNode,r=e.element.$cstNode,i=e.body;return!n||!r?[]:[{kind:this.symbolKind(e),name:To(e.element),range:n.range,selectionRange:r.range,children:i.elements.flatMap(s=>this.getElementsSymbol(s))}]}getElementSymbol(e){const n=e.
|
|
1964
1965
|
$cstNode,r=pn(n,"name");if(!r||!n)return[];const i=e.name,s=e.kind.$refText;return[{kind:this.symbolKind(e),name:i,range:n.range,selectionRange:r.range,detail:s,children:e.body?.elements.flatMap(o=>this.getElementsSymbol(o))??[]}]}getModelViewsSymbol(e){const n=e.$cstNode,r=pn(n,"name");return!r||!n?[]:[{kind:this.symbolKind(e),name:e.name,range:n.range,selectionRange:r.range,children:e.views.flatMap(i=>this.getViewSymbol(i))}]}getKindSymbol(e){return!e.$cstNode||!e.kind.$cstNode||It(e.kind.name)?
|
|
1965
1966
|
null:{kind:this.symbolKind(e),name:e.kind.name,range:e.$cstNode.range,selectionRange:e.kind.$cstNode.range}}getTagSymbol(e){return!e.$cstNode||!e.tag.$cstNode||It(e.tag.name)?null:{kind:this.symbolKind(e),name:"#"+e.tag.name,range:e.$cstNode.range,selectionRange:e.tag.$cstNode.range}}getLibIconSymbol(e){return!e.$cstNode||It(e.name)?null:{kind:this.symbolKind(e),name:e.name,range:e.$cstNode.range,selectionRange:e.$cstNode.range}}getViewSymbol(e){const n=e?.$cstNode;if(!n)return[];const r=e.name?
|
|
1966
|
-
pn(n,"name"):null;return r?[{kind:this.symbolKind(e),name:r.text,range:n.range,selectionRange:r.range,children:[]}]:[]}getDeploymentElementSymbol(e){try{if(Cn(e))return this.getDeploymentNodeSymbol(e);if(
|
|
1967
|
+
pn(n,"name"):null;return r?[{kind:this.symbolKind(e),name:r.text,range:n.range,selectionRange:r.range,children:[]}]:[]}getDeploymentElementSymbol(e){try{if(Cn(e))return this.getDeploymentNodeSymbol(e);if(jn(e))return this.getDeployedInstanceSymbol(e);if(os(e))return[]}catch(n){De(n)}return[]}getDeploymentNodeSymbol(e){const n=e.$cstNode,r=this.nameProvider.getNameNode(e);if(!r||!n)return[];const i=this.nameProvider.getNameStrict(e),s=e.kind.$refText;return[{kind:this.symbolKind(e),name:i,range:n.
|
|
1967
1968
|
range,selectionRange:r.range,detail:s,children:e.body?.elements.flatMap(o=>this.getDeploymentElementSymbol(o))??[]}]}getDeployedInstanceSymbol(e){const n=e.$cstNode,r=this.nameProvider.getNameNode(e);if(!r||!n)return[];const i=ut(e),s=this.parser.forDocument(i).parseDeployedInstance(e),o=this.nameProvider.getNameStrict(e),a="instance of "+s.element;return[{kind:this.symbolKind(e),name:o,range:n.range,selectionRange:r.range,detail:a,children:[]}]}symbolKind(e){return this.nodeKindProvider.getSymbolKind(
|
|
1968
1969
|
e)}}class aK extends ST{parser;locator;constructor(e){super(e),this.parser=e.likec4.ModelParser,this.locator=e.likec4.ModelLocator}getAstNodeHoverContent(e){if(ed(e))return{contents:{kind:"markdown",value:"tag `"+e.name+"`"}};if(Cn(e)){const n=ut(e),r=this.parser.forDocument(n).parseDeploymentNode(e),i=[r.id+" "];return r.title!==e.name&&i.push(`### ${r.title}`),i.push("deployment node `"+r.kind+"` "),{contents:{kind:"markdown",value:i.join(`
|
|
1969
|
-
`)}}}if(
|
|
1970
|
+
`)}}}if(jn(e)){const n=ut(e),r=this.parser.forDocument(n).parseDeployedInstance(e),[i,s]=fn.isImportRef(r.element)?[r.element.project,r.element.model]:[n.likec4ProjectId,r.element.model],o=i?this.locator.getParsedElement(s,i):this.locator.getParsedElement(s),a=[r.id+" ",`instance of \`${fn.flatten(r.element)}\``];return o&&a.push(`### ${o.title}`,"element kind `"+o.kind+"` "),{contents:{kind:"markdown",value:a.join(`
|
|
1970
1971
|
`)}}}if($C(e))return{contents:{kind:"markdown",value:"element kind `"+e.name+"`"}};if(Y8(e))return{contents:{kind:"markdown",value:"deployment node `"+e.name+"`"}};if(PC(e))return{contents:{kind:"markdown",value:"relationship kind `"+e.name+"`"}};if(cn(e)){const n=this.locator.getParsedElement(e);return n?{contents:{kind:"markdown",value:[n.id,`### ${n.title}`,"element kind `"+n.kind+"` "].join(`
|
|
1971
|
-
`)}}:void 0}}}class uK extends t8{highlightElement(e,n){if(cn(e)||Cn(e)||
|
|
1972
|
-
modifier:[Qe.definition,Qe.readonly]}),"prune";if(
|
|
1973
|
-
property:"kind",type:Ue.type,modifier:[Qe.definition]});return}if($o(e)||Ea(e)){n({node:e,property:"id",type:Ue.variable,modifier:[Qe.definition,Qe.readonly]});return}if(
|
|
1974
|
-
{node:e,property:"tag",type:Ue.type,modifier:[Qe.definition]});return}if(TC(e)||LC(e))return n({node:e,property:"value",type:Ue.variable,modifier:[Qe.definition,Qe.readonly]}),e.parent?void 0:"prune";if(
|
|
1972
|
+
`)}}:void 0}}}class uK extends t8{highlightElement(e,n){if(cn(e)||Cn(e)||jn(e))return this.highlightNameAndKind(e,n);if(fv(e))return this.highlightView(e,n);if(PC(e))return n({node:e,property:"name",type:Ue.function});if(nU(e))return n({node:e,property:"name",type:Ue.type,modifier:[Qe.definition]}),"prune";if((ei(e)||xC(e)||xr(e))&&"kind"in e&&n({node:e,property:"kind",type:Ue.function}),Th(e)||Wl(e))return n({node:e,property:"key",type:Ue.property}),n({node:e,property:"value",type:Ue.interface,
|
|
1973
|
+
modifier:[Qe.definition,Qe.readonly]}),"prune";if(Tv(e)||WC(e))return n({cst:e.$cstNode,type:Ue.variable,modifier:[Qe.definition,Qe.readonly]}),"prune";if(aU(e))return n({cst:e.$cstNode,type:Ue.function}),"prune";if(qC(e)&&de(e.value)){n({node:e,property:"value",type:Ue.function});return}if((fC(e)||hC(e))&&de(e.value)){n({node:e,property:"value",type:Ue.type,modifier:[Qe.definition,Qe.readonly]});return}if((GC(e)||UC(e))&&n({node:e,property:"participant",type:Ue.keyword}),RC(e)&&de(e.kind)){n({node:e,
|
|
1974
|
+
property:"kind",type:Ue.type,modifier:[Qe.definition]});return}if($o(e)||Ea(e)){n({node:e,property:"id",type:Ue.variable,modifier:[Qe.definition,Qe.readonly]});return}if(Bv(e)){n({node:e,property:"style",type:Ue.variable,modifier:[Qe.definition,Qe.readonly]});return}if(El(e)||bl(e)){n({node:e,property:"name",type:Ue.variable,modifier:[Qe.definition,Qe.readonly]});return}if(Mv(e)){n({node:e,property:"predicate",type:Ue.variable,modifier:[Qe.definition,Qe.readonly]});return}if(DC(e)&&de(e.tag)){n(
|
|
1975
|
+
{node:e,property:"tag",type:Ue.type,modifier:[Qe.definition]});return}if(TC(e)||LC(e))return n({node:e,property:"value",type:Ue.variable,modifier:[Qe.definition,Qe.readonly]}),e.parent?void 0:"prune";if(Ov(e))return n({node:e,property:"el",type:Ue.variable,modifier:[Qe.definition,Qe.readonly]}),e.parent?void 0:"prune";if(Ih(e)){n({node:e,keyword:"color",type:Ue.keyword}),n({node:e,property:"name",type:Ue.type,modifier:[Qe.declaration,Qe.readonly]});return}if(Zl(e)&&de(e.color)){n({node:e,keyword:"\
|
|
1975
1976
|
color",type:Ue.property});return}if((Sa(e)||xa(e)||Ca(e))&&n({node:e,property:"kind",type:Ue.type,modifier:[Qe.declaration,Qe.readonly]}),FC(e))return n({cst:e.$cstNode,type:Ue.type}),"prune";if(ed(e))return n({node:e,property:"name",type:Ue.type,modifier:[Qe.definition]});if((xh(e)||hl(e))&&n({node:e,property:"key",type:Ue.property}),Ch(e))return n({node:e,property:"key",type:Ue.property}),n({node:e,property:"value",type:Ue.number}),"prune";if(xl(e)||as(e)||zp(e))return n({node:e,property:"key",
|
|
1976
1977
|
type:Ue.property}),as(e)&&(e.libicon||e.value==="none")?(n({node:e,property:e.libicon?"libicon":"value",type:Ue.enum,modifier:[Qe.defaultLibrary]}),"prune"):("value"in e&&e.value&&!zp(e)&&n({node:e,property:"value",type:Ue.string}),"prune");if(vo(e)||Ph(e)||el(e)||Sl(e)||Yp(e)||j8(e))return n({node:e,property:"key",type:Ue.property}),"value"in e&&n({node:e,property:"value",type:Ue.enum}),"prune"}highlightNameAndKind(e,n){if(n({node:e,property:"name",type:Ue.variable,modifier:[Qe.declaration,Qe.readonly]}),
|
|
1977
|
-
|
|
1978
|
+
jn(e)||n({node:e,property:"kind",type:Ue.keyword,modifier:[]}),cn(e)){e.props.length>0&&n({node:e,property:"props",type:Ue.string});return}e.title&&n({node:e,property:"title",type:Ue.string})}highlightView(e,n){e.name&&n({node:e,property:"name",type:Ue.interface,modifier:[Qe.declaration,Qe.readonly,"local"]})}}class cK{get isStarted(){return!1}get port(){return NaN}start(e){return Promise.reject(new Error("Not implemented"))}stop(){return Promise.reject(new Error("Not implemented"))}}class lK{constructor(e){
|
|
1978
1979
|
this.services=e}create(e){throw new Error("NoopLikeC4MCPServerFactory - switch to implementation")}}class NS extends tw{constructor(e,n="fqn-index"){super(),this.services=e,this.cachePrefix=n,this.langiumDocuments=e.shared.workspace.LangiumDocuments,this.projects=e.shared.workspace.ProjectsManager,this.documentCache=new ob(r=>this.createDocumentIndex(r)),this.workspaceCache=new $p(e.shared,qe.IndexedContent),this.onDispose(e.shared.workspace.DocumentBuilder.onDocumentPhase(qe.IndexedContent,r=>{
|
|
1979
1980
|
ps(r)&&this.documentCache.set(r,this.createDocumentIndex(r))}))}projects;langiumDocuments;documentCache;workspaceCache;documents(e){return this.langiumDocuments.projectDocuments(e).filter(n=>ps(n)&&n.state>=qe.IndexedContent)}get(e){return e.state<qe.IndexedContent&&De(`Document ${e.uri.path} is not indexed`),this.documentCache.get(e)}resolve(e){return e.$type==="Imported"?this.getFqn(e.imported.ref):e.$type==="Element"?this.getFqn(e):this.services.likec4.DeploymentsIndex.getFqn(e)}getFqn(e){Ae(
|
|
1980
|
-
cn(e)||Ip(e));let n=
|
|
1981
|
-
get(i).rootElements().forEach(s=>{r.set(s.name,s)}),r),new
|
|
1982
|
-
u);return c.children(n).forEach(l=>{a.children.set(l.name,l)}),c.descendants(n).forEach(l=>{a.descendants.set(l.name,l)}),a},{children:new
|
|
1983
|
-
AstNodeDescriptionProvider,c=(f,d,p)=>{const m={...u.createDescription(f,d,e),id:p,likec4ProjectId:r};return
|
|
1984
|
-
for(const f of n)try{if(ei(f))continue;l(f,null)}catch(d){De(d)}return new Ua(i,s,o,a,r)}}function Sw(t){return[...t.associations()].flatMap(([e,n])=>n.length===1?n:[]).sort((e,n)=>Ax(e.name,n.name))}class Ua{constructor(e,n,r,i,s){this._rootElements=e,this._children=n,this._descendants=r,this._byfqn=i,this.projectId=s}static EMPTY=new Ua([],new
|
|
1985
|
-
get(e)??[]}descendants(e){return this._descendants.get(e)??[]}}class dK extends NS{constructor(e){super(e,"deployments-index"),this.services=e,this.Names=e.references.NameProvider}Names;createDocumentIndex(e){const n=e.parseResult.value.deployments.flatMap(d=>d.elements);if(n.length===0)return Ua.EMPTY;const r=e.likec4ProjectId??=this.projects.belongsTo(e),i=new Array,s=new
|
|
1986
|
-
d,p,e),id:m,likec4ProjectId:r};return
|
|
1987
|
-
f(d,null)}catch(p){De(p)}return new Ua(i,s,o,a,r)}}var _w=ro();function fK(t){const e=new Map;for(const n of t)if(
|
|
1988
|
-
return u.length<=1?e:(u.pop(),u.join(e)+e)}Ae(
|
|
1989
|
-
" to start with common prefix: "${n}"`),i=i.slice(n.length)):i=i.includes(e)?i.slice(i.lastIndexOf(e)+1):i,{view:r,parts:i.split(e)}}).sort((r,i)=>{if(r.parts.length!==i.parts.length)return r.parts.length-i.parts.length;for(let s=0;s<r.parts.length;s++){const o=
|
|
1990
|
-
tags:[],metadata:{}};i&&a.links.push(...i),s&&(a.tags=ua([...a.tags,...s])),o&&(a.metadata={...a.metadata,...o}),this.mergedData.set(r,a)}}applyExtended(e){const n=this.mergedData.get(e.id);if(!n)return e;let r=n.links;e.links&&e.links.length>0&&(r=[...e.links,...r]);let i=n.tags;e.tags&&e.tags.length>0&&(i=ua([...e.tags,...i]));let s=n.metadata;return e.metadata&&(s={...e.metadata,...n.metadata}),{...e,tags:
|
|
1991
|
-
"blue","ruby","orange","indigo","pink","teal","purple","amber","crimson","red","lime","yellow","violet"];function mK(t){const e=[],n=[];for(const[r,i]of cc(t))de(i.color)?e.push({tag:r,spec:{color:i.color}}):n.push(r);return Le(n,oc(
|
|
1981
|
+
cn(e)||Ip(e));let n=Xh.readId(e);if(de(n))return n;const r=ut(e);return Ae(ps(r)),De(`Document ${r.uri.path} is not indexed, but getFqn was called`),this.get(r),xt(Xh.readId(e),"Element fqn must be set, invalid state")}byFqn(e,n){return Ve(this.workspaceCache.get(`${this.cachePrefix}:${e}:fqn:${n}`,()=>this.documents(e).toArray().flatMap(r=>this.get(r).byFqn(n))))}rootElements(e){return Ve(this.workspaceCache.get(`${this.cachePrefix}:${e}:rootElements`,()=>{const n=this.documents(e).reduce((r,i)=>(this.
|
|
1982
|
+
get(i).rootElements().forEach(s=>{r.set(s.name,s)}),r),new xn);return Sw(n)}))}directChildrenOf(e,n){return Ve(this.workspaceCache.get(`${this.cachePrefix}:${e}:directChildrenOf:${n}`,()=>{const r=this.documents(e).reduce((i,s)=>(this.get(s).children(n).forEach(o=>{i.set(o.name,o)}),i),new xn);return Sw(r)}))}uniqueDescedants(e,n){return Ve(this.workspaceCache.get(`${this.cachePrefix}:${e}:uniqueDescedants:${n}`,()=>{const{children:r,descendants:i}=this.documents(e).reduce((a,u)=>{const c=this.get(
|
|
1983
|
+
u);return c.children(n).forEach(l=>{a.children.set(l.name,l)}),c.descendants(n).forEach(l=>{a.descendants.set(l.name,l)}),a},{children:new xn,descendants:new xn}),s=Sw(r),o=[...i.associations()].flatMap(([a,u])=>u.length===1&&!r.has(a)?u:[]);return[...s,...Tx(o)]}))}createDocumentIndex(e){const n=e.parseResult.value.models.flatMap(f=>f.elements);if(n.length===0)return Ua.EMPTY;const r=e.likec4ProjectId??=this.projects.belongsTo(e),i=new Array,s=new xn,o=new xn,a=new xn,u=this.services.workspace.
|
|
1984
|
+
AstNodeDescriptionProvider,c=(f,d,p)=>{const m={...u.createDescription(f,d,e),id:p,likec4ProjectId:r};return Xh.writeId(f,p),a.set(p,m),m},l=(f,d)=>{let p;if(cn(f)){p=Rx(f.name,d);const w=c(f,f.name,p);d?s.set(d,w):i.push(w)}else p=To(f.element);let m=[];if(an(f.body)&&!It(f.body.elements)){for(const w of f.body.elements)if(!ei(w))try{m.push(...l(w,p))}catch(y){De(y)}}m=[...s.get(p)??[],...m];for(const w of m)o.set(p,w);if(Eo(f))for(const w of Cx(p))for(const y of m)o.set(w,y);return o.get(p)??[]};
|
|
1985
|
+
for(const f of n)try{if(ei(f))continue;l(f,null)}catch(d){De(d)}return new Ua(i,s,o,a,r)}}function Sw(t){return[...t.associations()].flatMap(([e,n])=>n.length===1?n:[]).sort((e,n)=>Ax(e.name,n.name))}class Ua{constructor(e,n,r,i,s){this._rootElements=e,this._children=n,this._descendants=r,this._byfqn=i,this.projectId=s}static EMPTY=new Ua([],new xn,new xn,new xn,Sn.DefaultProjectId);rootElements(){return this._rootElements}byFqn(e){return this._byfqn.get(e)??[]}children(e){return this._children.
|
|
1986
|
+
get(e)??[]}descendants(e){return this._descendants.get(e)??[]}}class dK extends NS{constructor(e){super(e,"deployments-index"),this.services=e,this.Names=e.references.NameProvider}Names;createDocumentIndex(e){const n=e.parseResult.value.deployments.flatMap(d=>d.elements);if(n.length===0)return Ua.EMPTY;const r=e.likec4ProjectId??=this.projects.belongsTo(e),i=new Array,s=new xn,o=new xn,a=new xn,u=this.Names,c=this.services.workspace.AstNodeDescriptionProvider,l=(d,p,m)=>{const w={...c.createDescription(
|
|
1987
|
+
d,p,e),id:m,likec4ProjectId:r};return Xh.writeId(d,m),a.set(m,w),w},f=(d,p)=>{let m;if(os(d))m=To(d.deploymentNode);else{const y=u.getName(d);if(!de(y))return[];m=ux(y,p);const g=l(d,y,m);if(p?s.set(p,g):i.push(g),jn(d))return[]}let w=[];if(an(d.body)){for(const y of d.body.elements)if(!xr(y))try{w.push(...f(y,m))}catch(g){De(g)}}w=[...s.get(m)??[],...w];for(const y of w)o.set(m,y);if(os(d))for(const y of cx(m))for(const g of w)o.set(y,g);return o.get(m)??[]};for(const d of n)try{if(xr(d))continue;
|
|
1988
|
+
f(d,null)}catch(p){De(p)}return new Ua(i,s,o,a,r)}}var _w=ro();function fK(t){const e=new Map;for(const n of t)if(hm(n)&&n.viewOf&&Et(n.extends)){const r=e.get(n.viewOf)??[];r.push(n.id),e.set(n.viewOf,r)}for(const{id:n,nodes:r}of t)for(const i of r){const s=i.modelRef;if(i.navigateTo||!s)continue;const o=YD(e.get(s)??[],a=>a!==n);o&&(i.navigateTo=o)}return t}function pK(t,e="/"){const n=Le(t,bt(u=>u.docUri),Pe(de),ua());if(n.length===0)return"";if(n.length===1){const u=Oa(n[0]).pathname.split(e);
|
|
1989
|
+
return u.length<=1?e:(u.pop(),u.join(e)+e)}Ae(Bn(n,2),"Expected at least 2 unique URIs");const[r,...i]=n,s=Oa(r).pathname.split(e);let o=s.length;for(const u of i){if(u===r)continue;const c=Oa(u).pathname.split(e);for(let l=0;l<o;l++)c[l]!==s[l]&&(o=l);if(o===0)return""}const a=s.slice(0,o).join(e);return a.endsWith(e)?a:a+e}function hK(t){const e="/",n=pK(t,e);return t.map(r=>{if(!r.docUri)return{view:r,parts:[]};let i=Oa(r.docUri).pathname;return n.length>0?(Ae(i.startsWith(n),`Expect path "${i}\
|
|
1990
|
+
" to start with common prefix: "${n}"`),i=i.slice(n.length)):i=i.includes(e)?i.slice(i.lastIndexOf(e)+1):i,{view:r,parts:i.split(e)}}).sort((r,i)=>{if(r.parts.length!==i.parts.length)return r.parts.length-i.parts.length;for(let s=0;s<r.parts.length;s++){const o=gm(r.parts[s],i.parts[s]);if(o!==0)return o}return 0}).map(({parts:r,view:i})=>({...i,relativePath:r.join(e)}))}class IS{mergedData=new Map;merge(e){for(const n of e){const{id:r,links:i,tags:s,metadata:o}=n,a=this.mergedData.get(r)??{links:[],
|
|
1991
|
+
tags:[],metadata:{}};i&&a.links.push(...i),s&&(a.tags=ua([...a.tags,...s])),o&&(a.metadata={...a.metadata,...o}),this.mergedData.set(r,a)}}applyExtended(e){const n=this.mergedData.get(e.id);if(!n)return e;let r=n.links;e.links&&e.links.length>0&&(r=[...e.links,...r]);let i=n.tags;e.tags&&e.tags.length>0&&(i=ua([...e.tags,...i]));let s=n.metadata;return e.metadata&&(s={...e.metadata,...n.metadata}),{...e,tags:Bn(i,1)?i:null,links:Bn(r,1)?r:null,...!It(s)&&{metadata:s}}}}const OS=["tomato","grass",
|
|
1992
|
+
"blue","ruby","orange","indigo","pink","teal","purple","amber","crimson","red","lime","yellow","violet"];function mK(t){const e=[],n=[];for(const[r,i]of cc(t))de(i.color)?e.push({tag:r,spec:{color:i.color}}):n.push(r);return Le(n,oc(gm),bt((r,i)=>{const s=xt(OS[i%OS.length]);return{tag:r,spec:{color:s}}}),My(e),oc((r,i)=>gm(r.tag,i.tag)),t3(Xr("tag"),Xr("spec")))}class LS{specs={elements:{},deployments:{},relationships:{},colors:{}};tags;globals={predicates:{},dynamicPredicates:{},styles:{}};imports=new lx(
|
|
1992
1993
|
Set);constructor(e){const n={};for(const r of e){const{c4Specification:i,c4Globals:s,c4Imports:o}=r;Object.assign(n,i.tags),Object.assign(this.specs.elements,i.elements),Object.assign(this.specs.relationships,i.relationships),Object.assign(this.specs.colors,i.colors),Object.assign(this.specs.deployments,i.deployments),Object.assign(this.globals.predicates,s.predicates),Object.assign(this.globals.dynamicPredicates,s.dynamicPredicates),Object.assign(this.globals.styles,s.styles);for(const[a,u]of o)
|
|
1993
1994
|
this.imports.set(a,u)}this.tags=mK(n)}toModelElement=({tags:e,links:n,style:{color:r,shape:i,icon:s,opacity:o,border:a,size:u,multiple:c,padding:l,textSize:f},id:d,kind:p,title:m,description:w,technology:y,metadata:g})=>{try{const b=this.specs.elements[p];return b?(r??=b.style.color,i??=b.style.shape,s??=b.style.icon,o??=b.style.opacity,a??=b.style.border,y??=b.technology,c??=b.style.multiple,u??=b.style.size,l??=b.style.padding,f??=b.style.textSize,w??=b.description,n??=b.links,m=m===dn.nameFromFqn(
|
|
1994
|
-
d)&&b.title?b.title:m,{...r&&{color:r},...i&&{shape:i},...s&&{icon:s},...g&&!It(g)&&{metadata:g},...b.notation&&{notation:b.notation},style:{...a&&{border:a},...u&&{size:u},...l&&{padding:l},...f&&{textSize:f},...
|
|
1995
|
+
d)&&b.title?b.title:m,{...r&&{color:r},...i&&{shape:i},...s&&{icon:s},...g&&!It(g)&&{metadata:g},...b.notation&&{notation:b.notation},style:{...a&&{border:a},...u&&{size:u},...l&&{padding:l},...f&&{textSize:f},...Fy(c)&&{multiple:c},...Jr(o)&&{opacity:o}},links:n??null,tags:e??[],...y&&{technology:y},...w&&{description:w},title:m,kind:p,id:d}):(st.warn`No kind '${p}' found for ${d}`,null)}catch(b){De(b)}return null};toModelRelation=({astPath:e,source:n,target:r,kind:i,links:s,id:o,...a})=>Qr(i)&&
|
|
1995
1996
|
this.specs.relationships[i]?{...this.specs.relationships[i],...a,...s&&{links:s},source:n,target:r,kind:i,id:o}:{...s&&{links:s},...a,source:n,target:r,id:o};toDeploymentElement=e=>{if("element"in e&&!("kind"in e))return{...e,element:Va.flatten(e.element)};if("element"in e)return st.warn`Invalid ParsedAstDeployment ${e.id}, has both element and kind properties`,null;try{const n=this.specs.deployments[e.kind];if(!n)return st.warn`No kind ${e.kind} found for ${e.id}`,null;let{technology:r=n.technology,
|
|
1996
1997
|
notation:i=n.notation,style:s,title:o,description:a,...u}=e;return a??=n.description,o=o===dn.nameFromFqn(e.id)&&n.title?n.title:o,{...u,title:o,...a&&{description:a},...i&&{notation:i},...r&&{technology:r},style:{border:"dashed",opacity:10,...n.style,...s}}}catch(n){De(n)}return null};toDeploymentRelation=({astPath:e,source:n,target:r,kind:i,links:s,id:o,...a})=>Qr(i)&&this.specs.relationships[i]?{...this.specs.relationships[i],...a,...s&&{links:s},source:n,target:r,kind:i,id:o}:{...s&&{links:s},
|
|
1997
|
-
...a,source:n,target:r,id:o}}function gK(t,e){const n=new LS(e),r=Ss(n.specs.colors,y=>dx(y.color)),i=new Set,s=new IS,o=new IS,a=y=>{y?.metadata&&Yr(y.metadata).forEach(g=>i.add(g))},u=Le(e,Cr(y=>(s.merge(y.c4ExtendElements),bt(y.c4Elements,n.toModelElement))),Pe(de),Jw,
|
|
1998
|
+
...a,source:n,target:r,id:o}}function gK(t,e){const n=new LS(e),r=Ss(n.specs.colors,y=>dx(y.color)),i=new Set,s=new IS,o=new IS,a=y=>{y?.metadata&&Yr(y.metadata).forEach(g=>i.add(g))},u=Le(e,Cr(y=>(s.merge(y.c4ExtendElements),bt(y.c4Elements,n.toModelElement))),Pe(de),Jw,Ly((y,g)=>{const b=Zw(g.id);return b&&Et(y[b])?(st.debug`No parent found for ${g.id}`,y):(y[g.id]=s.applyExtended(g),a(y[g.id]),y)},{})),c=Le(e,Cr(y=>bt(y.c4Relations,n.toModelRelation)),Pe(y=>{if(!y)return!1;const g=dn.FqnRef.flatten(
|
|
1998
1999
|
y.source),b=dn.FqnRef.flatten(y.target);return Et(u[g])&&!Qw(g)||Et(u[b])&&!Qw(b)?(st.debug`Invalid relation ${y.id}
|
|
1999
2000
|
source: ${g} resolved: ${!!u[g]}
|
|
2000
|
-
target: ${b} resolved: ${!!u[b]}\n`,!1):!0}),KD(a),uc(Xr("id"))),l=Le(e,Cr(y=>(o.merge(y.c4ExtendDeployments),bt(y.c4Deployments,n.toDeploymentElement))),Pe(de),Jw,
|
|
2001
|
+
target: ${b} resolved: ${!!u[b]}\n`,!1):!0}),KD(a),uc(Xr("id"))),l=Le(e,Cr(y=>(o.merge(y.c4ExtendDeployments),bt(y.c4Deployments,n.toDeploymentElement))),Pe(de),Jw,Ly((y,g)=>{const b=Zw(g.id);return b&&Et(y[b])?(st.debug`No parent found for deployment element ${g.id}`,y):(y[g.id]=fx(g)?o.applyExtended(g):g,a(y[g.id]),y)},{})),f=Le(e,Cr(y=>bt(y.c4DeploymentRelations,n.toDeploymentRelation)),Pe(y=>y?Et(l[y.source.deployment])||Et(l[y.target.deployment])?(st.debug`Invalid deployment relation ${y.
|
|
2001
2002
|
id}
|
|
2002
2003
|
source: ${y.source.deployment} resolved: ${!!l[y.source.deployment]}
|
|
2003
|
-
target: ${y.target.deployment} resolved: ${!!l[y.target.deployment]}\n`,!1):!0:!1),
|
|
2004
|
+
target: ${y.target.deployment} resolved: ${!!l[y.target.deployment]}\n`,!1):!0:!1),Ly((y,g)=>an(y[g.id])?(st.debug`Duplicate deployment relation ${g.id}`,y):(a(g),y[g.id]=g,y),{}));function d(y){const g=y.uri.toString();return b=>{let{id:R,title:A,description:N,astPath:V,...J}=b;return b[dn._type]==="element"&&Et(A)&&"viewOf"in b&&(A=u[b.viewOf]?.title??null),Et(A)&&R==="index"&&(A="Landscape view"),{...J,[dn._stage]:"parsed",docUri:g,description:N,title:A,id:R}}}const p=Le(e,Cr(y=>bt(y.c4Views,
|
|
2004
2005
|
d(y))),hK);p.some(y=>y.id==="index")||p.unshift({[dn._stage]:"parsed",[dn._type]:"element",id:"index",title:"Landscape view",description:null,tags:null,links:null,rules:[{include:[{wildcard:!0}]}]});const m=Le(p,uc(Xr("id")),kx),w={id:t.id,name:t.config.name,...t.config.title&&{title:t.config.title}};return{data:{[dn._stage]:"parsed",projectId:t.id,project:w,specification:{tags:n.tags,elements:n.specs.elements,relationships:Ss(n.specs.relationships,({notation:y,technology:g,...b})=>({...y&&{notation:y},
|
|
2005
2006
|
...g&&{technology:g},style:b})),deployments:n.specs.deployments,...i.size>0&&{metadataKeys:[...i].sort(dn.compareNatural)},customColors:r},elements:u,relations:c,globals:n.globals,views:m,deployments:{elements:l,relations:f},imports:{}},imports:n.imports}}const yK=t=>`parsed-without-imports-${t}`,FS=t=>`parsed-model-${t}`,MS=t=>`computed-model-${t}`,No=st.getChild("model-builder");class vK extends tw{projects;parser;listeners=[];cache;DocumentBuilder;mutex;constructor(e){super(),this.projects=e.
|
|
2006
2007
|
shared.workspace.ProjectsManager,this.parser=e.likec4.ModelParser,this.cache=e.ValidatedWorkspaceCache,this.DocumentBuilder=e.shared.workspace.DocumentBuilder,this.mutex=e.shared.workspace.WorkspaceLock,this.onDispose(this.DocumentBuilder.onUpdate((n,r)=>{r.length>0&&this.notifyListeners(r)})),this.onDispose(this.DocumentBuilder.onBuildPhase(qe.Validated,(n,r)=>{const i=n.map(Xr("uri")).filter(l3($d));i.length>0&&this.notifyListeners(i)})),No.debug`created`}unsafeSyncParseModelData(e){const n=this.
|
|
2007
2008
|
cache,r=No.getChild(e),i=yK(e);return n.has(i)&&r.debug`unsafeSyncBuildModelData from cache`,n.get(i,()=>{try{const s=this.projects.getProject(e),o=this.documents(e);return o.length===0?(r.debug`no documents to build model`,null):(r.debug`unsafeSyncBuildModelData`,gK(s,o))}catch(s){return De(s),null}})}unsafeSyncJoinedModelData(e){const n=No.getChild(e),r=this.cache,i=FS(e);return r.get(i,()=>{const s=this.unsafeSyncParseModelData(e);if(!s)return null;let o=s.data;if(s.imports.size>0){n.debug`processing imports of ${e}`;
|
|
2008
|
-
const a=[...s.imports.associations()].reduce((u,[c,l])=>{const f=this.unsafeSyncParseModelData(c);if(f){const d=Le([...l],Cr(p=>f.data.elements[p]??[]));
|
|
2009
|
+
const a=[...s.imports.associations()].reduce((u,[c,l])=>{const f=this.unsafeSyncParseModelData(c);if(f){const d=Le([...l],Cr(p=>f.data.elements[p]??[]));Bn(d,1)&&(u[c]=d)}return u},{});o={...s.data,imports:a}}return xs.create(o)})}async parseModel(e,n=_w.CancellationToken.None){const r=this.projects.ensureProjectId(e),i=No.getChild(r),s=this.cache.get(FS(r));if(s)return i.debug`parseModel from cache`,s;const o=Jh();return await this.mutex.read(async()=>{await jt(n);const a=this.unsafeSyncJoinedModelData(
|
|
2009
2010
|
r);return i.debug`parseModel in ${o.pretty}`,a})}previousViews={};unsafeSyncBuildModel(e){const n=No.getChild(e),r=this.cache,i=this.cache;return r.get(MS(e),()=>{const s=this.unsafeSyncJoinedModelData(e);if(!s)return xs.EMPTY;const o=[];for(const u of Qs(s.$data.views)){const c=sb(u,s);if(!c.isSuccess){n.warn(Un(c.error));continue}o.push(c.view)}fK(o);const a=fr(o,u=>{const c=BS(e,u.id),l=this.previousViews[c],f=l&&rw(u,l)?l:u;return i.set(c,f),[u.id,f]});return this.previousViews={...this.previousViews,
|
|
2010
|
-
...a},xs.create({...s.$data,[dn._stage]:"computed",views:a})})}async buildLikeC4Model(e,n=_w.CancellationToken.None){const r=this.projects.ensureProjectId(e),i=No.getChild(r),s=this.cache.get(MS(r));if(s)return i.debug("buildLikeC4Model from cache"),s;const o=
|
|
2011
|
+
...a},xs.create({...s.$data,[dn._stage]:"computed",views:a})})}async buildLikeC4Model(e,n=_w.CancellationToken.None){const r=this.projects.ensureProjectId(e),i=No.getChild(r),s=this.cache.get(MS(r));if(s)return i.debug("buildLikeC4Model from cache"),s;const o=Jh();return await this.mutex.read(async()=>{await jt(n);const a=this.unsafeSyncBuildModel(r);return i.debug(`buildLikeC4Model in ${o.pretty}`),a})}async computeView(e,n,r=_w.CancellationToken.None){const i=this.projects.ensureProjectId(n),s=No.
|
|
2011
2012
|
getChild(i),o=this.cache,a=BS(i,e);if(o.has(a))return o.get(a);const u=await this.parseModel(i,r);return u?o.get(a,()=>{const c=u.$data.views[e];if(!c)return s.warn`computeView: cant find view ${e}`,null;s.debug`computeView: ${e}`;const l=sb(c,u);if(!l.isSuccess)return De(l.error),null;let f=l.view;const d=Le(u.$data.views,Qs(),Pe(px),Pe(m=>m.id!==e),ca(m=>m.viewOf));for(const m of f.nodes)if(!m.navigateTo){const w=d[m.id];w&&(m.navigateTo=w[0].id)}const p=this.previousViews[a];return p&&rw(f,p)?
|
|
2012
|
-
f=p:this.previousViews[a]=f,f}):null}onModelParsed(e){return this.listeners.push(e),Js.create(()=>{const n=this.listeners.indexOf(e);n>=0&&this.listeners.splice(n,1)})}documents(e){return this.parser.documents(e).toArray()}notifyListeners(e){for(const n of this.listeners)try{n(e)}catch(r){De(r)}}}function BS(t,e){return`computed-view-${t}-${e}`}const{findNodeForKeyword:qS,findNodeForProperty:
|
|
2013
|
+
f=p:this.previousViews[a]=f,f}):null}onModelParsed(e){return this.listeners.push(e),Js.create(()=>{const n=this.listeners.indexOf(e);n>=0&&this.listeners.splice(n,1)})}documents(e){return this.parser.documents(e).toArray()}notifyListeners(e){for(const n of this.listeners)try{n(e)}catch(r){De(r)}}}function BS(t,e){return`computed-view-${t}-${e}`}const{findNodeForKeyword:qS,findNodeForProperty:um}=cg,{getDocument:wK,streamAllContents:bK}=Wo,Ga=st.getChild("ModelLocator");class EK{constructor(e){this.
|
|
2013
2014
|
services=e,this.fqnIndex=e.likec4.FqnIndex,this.deploymentsIndex=e.likec4.DeploymentsIndex,this.langiumDocuments=e.shared.workspace.LangiumDocuments,this.parser=e.likec4.ModelParser,this.projects=e.shared.workspace.ProjectsManager}fqnIndex;deploymentsIndex;langiumDocuments;parser;projects;documents(e){return this.parser.documents(e)}getParsedElement(...e){let n,r;if(e.length===2?(n=e[0],r=e[1]):(n=e[0],r=rs(n)?this.projects.ensureProjectId():Bt(n)),rs(n)){const s=n,o=this.fqnIndex.byFqn(r,n).head();
|
|
2014
2015
|
if(!o)return null;const a=this.langiumDocuments.getDocument(o.documentUri);return a?this.parser.parse(a).c4Elements.find(u=>u.id===s)??null:null}const i=this.fqnIndex.getFqn(n);return this.parser.parse(wK(n)).c4Elements.find(s=>s.id===i)??null}locateElement(e,n){let[r,i]=hx(e);r??=this.projects.ensureProjectId(n);const s=this.fqnIndex.byFqn(r,i).head(),o=s?.nameSegment??s?.selectionSegment;return!s||!o?null:{uri:s.documentUri.toString(),range:o.range}}locateDeploymentElement(e,n){const r=this.projects.
|
|
2015
|
-
ensureProjectId(n),i=e,s=this.deploymentsIndex.byFqn(r,i).head(),o=s?.nameSegment??s?.selectionSegment;return!s||!o?null:{uri:s.documentUri.toString(),range:o.range}}locateRelation(e,n){const r=this.projects.ensureProjectId(n);for(const i of this.documents(r)){const s=i.c4Relations.find(u=>u.id===e)??i.c4DeploymentRelations.find(u=>u.id===e);if(!s)continue;const o=this.services.workspace.AstNodeLocator.getAstNode(i.parseResult.value,s.astPath);if(!ei(o)&&!xr(o))continue;let a=o.title?
|
|
2016
|
-
"title"):void 0;if(a??=o.kind?
|
|
2017
|
-
locateViewAst(e,n);if(!r)return null;const i=r.viewAst;let s=i.name?
|
|
2016
|
+
ensureProjectId(n),i=e,s=this.deploymentsIndex.byFqn(r,i).head(),o=s?.nameSegment??s?.selectionSegment;return!s||!o?null:{uri:s.documentUri.toString(),range:o.range}}locateRelation(e,n){const r=this.projects.ensureProjectId(n);for(const i of this.documents(r)){const s=i.c4Relations.find(u=>u.id===e)??i.c4DeploymentRelations.find(u=>u.id===e);if(!s)continue;const o=this.services.workspace.AstNodeLocator.getAstNode(i.parseResult.value,s.astPath);if(!ei(o)&&!xr(o))continue;let a=o.title?um(o.$cstNode,
|
|
2017
|
+
"title"):void 0;if(a??=o.kind?um(o.$cstNode,"kind"):void 0,a??=qS(o.$cstNode,"->"),a??=um(o.$cstNode,"target"),a??=o.$cstNode,!!a)return{uri:i.uri.toString(),range:a.range}}return null}locateViewAst(e,n){const r=this.projects.ensureProjectId(n);for(const i of this.documents(r)){const s=i.c4Views.find(a=>a.id===e);if(!s)continue;const o=this.services.workspace.AstNodeLocator.getAstNode(i.parseResult.value,s.astPath);if(fv(o))return{doc:i,view:s,viewAst:o}}return null}locateView(e,n){const r=this.
|
|
2018
|
+
locateViewAst(e,n);if(!r)return null;const i=r.viewAst;let s=i.name?um(i.$cstNode,"name"):void 0;return s??=qS(i.$cstNode,"view"),s??=i.$cstNode,s?{uri:r.doc.uri.toString(),range:s.range}:null}async locateDocumentTags(e,n){const r=this.langiumDocuments.getDocument(e);if(!r||!ps(r))return[];r.state<qe.Validated&&(Ga.debug(`Waiting for document ${r.uri.path} to be Validated`),await this.services.shared.workspace.DocumentBuilder.waitUntil(qe.Validated,r.uri,n));const i=Bt(r);Ga.debug(`locate docume\
|
|
2018
2019
|
nt tags for ${r.uri.path} in project ${i}`);try{const s=new LS(this.documents(i).toArray()).tags;Ga.debug("Assigned colors to tags",{tagSpecs:s});const o=Le(bK(r.parseResult.value),mx(a=>ed(a)||FC(a)),gx(),Cr(a=>{let u,c;try{ed(a)?(u=a.name,c=a.$cstNode):(u=a.tag.$refText,c=a.tag.$refNode);const l=s[u];return Ae(l,`Tag ${u} not found in merged specification`),Ae(c,`Tag ${u} does not have a $cstNode`),{name:u,color:l.color,range:c.range,isSpecification:ed(a)}}catch(l){return Ga.warn(`Fail on tag ${u}`,
|
|
2019
|
-
{err:l}),[]}}));return Ga.debug(`Found ${o.length} tags in document ${r.uri.path}`),o}catch(s){return Ga.warn(Un(s)),[]}}}var xw,jS;function $K(){return jS||(jS=1,xw=t=>{const e=t.match(/^[ \t]*(?=\S)/gm);return e?e.reduce((n,r)=>Math.min(n,r.length),1/0):0}),xw}var RK=$K();const DK=vi(RK);function
|
|
2020
|
-
try{const i=t(e,n,r);c3(i)&&await i;return}catch(i){const s=i instanceof Error?i.message:String(i);n("error",`Validation failed: ${s}`,{node:e}),st.debug(`Validation failed: ${s}`,{error:i})}}}const{getDocument:kK}=Wo,TK=t=>{const e=t.likec4.DeploymentsIndex,n=t.references.NameProvider;return
|
|
2021
|
-
node:r,range:o});const a=Bt(r),u=e.getFqn(r);e.byFqn(a,u).limit(2).toArray().length>1&&i("error",`Duplicate node name "${u}"`,{node:r,range:o})})},CK=t=>{const e=t.likec4.DeploymentsIndex,n=t.references.NameProvider;return
|
|
2022
|
-
a,u).limit(2).toArray().length>1&&i("error",`Duplicate instance name "${u}"`,{node:r,range:o})})},AK=t=>{const e=t.likec4.ModelParser;return
|
|
2020
|
+
{err:l}),[]}}));return Ga.debug(`Found ${o.length} tags in document ${r.uri.path}`),o}catch(s){return Ga.warn(Un(s)),[]}}}var xw,jS;function $K(){return jS||(jS=1,xw=t=>{const e=t.match(/^[ \t]*(?=\S)/gm);return e?e.reduce((n,r)=>Math.min(n,r.length),1/0):0}),xw}var RK=$K();const DK=vi(RK);function cm(t){const e=DK(t);if(e===0)return t;const n=new RegExp(`^[ \\t]{${e}}`,"gm");return t.replace(n,"")}const Io=["this","it","self","super","likec4lib","global"];function ft(t){return async function(e,n,r){
|
|
2021
|
+
try{const i=t(e,n,r);c3(i)&&await i;return}catch(i){const s=i instanceof Error?i.message:String(i);n("error",`Validation failed: ${s}`,{node:e}),st.debug(`Validation failed: ${s}`,{error:i})}}}const{getDocument:kK}=Wo,TK=t=>{const e=t.likec4.DeploymentsIndex,n=t.references.NameProvider;return ft((r,i)=>{const s=n.getName(r);if(!s){i("error","DeploymentNode must be named",{node:r});return}const o=xt(n.getNameNode(r),"name CstNode not found").range;Io.includes(s)&&i("error",`Reserved word: ${s}`,{
|
|
2022
|
+
node:r,range:o});const a=Bt(r),u=e.getFqn(r);e.byFqn(a,u).limit(2).toArray().length>1&&i("error",`Duplicate node name "${u}"`,{node:r,range:o})})},CK=t=>{const e=t.likec4.DeploymentsIndex,n=t.references.NameProvider;return ft((r,i)=>{const s=n.getName(r);if(!s){i("error","Deployed instance must be named, unique inside node",{node:r});return}const o=xt(n.getNameNode(r),"name CstNode not found").range;Io.includes(s)&&i("error",`Reserved word: ${s}`,{node:r,range:o});const a=Bt(r),u=e.getFqn(r);e.byFqn(
|
|
2023
|
+
a,u).limit(2).toArray().length>1&&i("error",`Duplicate instance name "${u}"`,{node:r,range:o})})},AK=t=>{const e=t.likec4.ModelParser;return ft((n,r)=>{if(!n.target?.value?.ref){let u=n.target?.$cstNode?.text??"";r("error",`DeploymentRelation target '${u}' not resolved`,{node:n,property:"target"});return}const i=kK(n),s=e.forDocument(i);let o;try{o=s._resolveDeploymentRelationSource(n)}catch{r("error","DeploymentRelation source not resolved",{node:n,property:"source"});return}if(fn.isImportRef(o)){
|
|
2023
2024
|
r("error","DeploymentRelation cannot refer imported model (not implemented yet)",{node:n,property:"source"});return}if(fn.isModelRef(o)){r("error","DeploymentRelation must refer deployment element",{node:n,property:"source"});return}const a=s.parseFqnRef(n.target);if(fn.isImportRef(a)){r("error","DeploymentRelation cannot refer imported model (not implemented yet)",{node:n,property:"target"});return}if(fn.isModelRef(a)){r("error","DeploymentRelation must refer deployment element",{node:n,property:"\
|
|
2024
|
-
target"});return}eb(o.deployment,a.deployment)&&r("error","Invalid parent-child relationship",{node:n})})},SK=t=>
|
|
2025
|
-
not found (not parsed/indexed yet)",{node:n,property:"target"}),s&&a&&(
|
|
2026
|
-
documentUri!==a||l.path!==u).head();if(c){const l=c.documentUri!==a;i("error",`Duplicate element name ${r.name!==s?r.name+" ("+s+")":r.name}`,{node:r,property:"name",...l&&{relatedInformation:[{location:{range:c.nameSegment?.range??c.selectionSegment?.range,uri:c.documentUri.toString()},message:"conflicting element"}]}})}})},NK=t=>
|
|
2027
|
-
return
|
|
2025
|
+
target"});return}eb(o.deployment,a.deployment)&&r("error","Invalid parent-child relationship",{node:n})})},SK=t=>ft((e,n)=>{const r=e.deploymentNode.value.ref;(!r||!Cn(r))&&n("error","ExtendDeployment allows only DeploymentNode",{node:e,property:"deploymentNode"})}),_K=t=>{const e=t.likec4.FqnIndex;return ft((n,r)=>{const i=ko(n.source),s=i&&e.getFqn(i);s||r("error","Source not found (not parsed/indexed yet)",{node:n,property:"source"});const o=ko(n.target),a=o&&e.getFqn(o);a||r("error","Target \
|
|
2026
|
+
not found (not parsed/indexed yet)",{node:n,property:"target"}),s&&a&&(ym(s,a)||ym(a,s))&&r("error","Invalid parent-child relationship",{node:n})})},{getDocument:xK}=Wo,PK=t=>{const e=t.likec4.FqnIndex,n=t.workspace.AstNodeLocator;return ft((r,i)=>{const s=e.getFqn(r);if(!s){i("error","Not indexed element",{node:r,property:"name"});return}Io.includes(r.name)&&i("error",`Reserved word: ${r.name}`,{node:r,property:"name"});const o=xK(r),a=o.uri,u=n.getAstNodePath(r),c=e.byFqn(Bt(o),s).filter(l=>l.
|
|
2027
|
+
documentUri!==a||l.path!==u).head();if(c){const l=c.documentUri!==a;i("error",`Duplicate element name ${r.name!==s?r.name+" ("+s+")":r.name}`,{node:r,property:"name",...l&&{relatedInformation:[{location:{range:c.nameSegment?.range??c.selectionSegment?.range,uri:c.documentUri.toString()},message:"conflicting element"}]}})}})},NK=t=>ft((e,n)=>{kW(e.modelElement)&&n("error","Only model elements allowed here",{node:e,property:"modelElement"})}),{getDocument:IK}=Wo,OK=t=>{const e=t.shared.workspace.ProjectsManager;
|
|
2028
|
+
return ft((n,r)=>{const i=IK(n),s=Bt(i);if(n.project===s){r("error","Imported project cannot be the same as the current project",{node:n,property:"project"});return}if(!e.all.includes(n.project)){r("error","Imported project not found",{node:n,property:"project"});return}})},LK=t=>(t.likec4.FqnIndex,ft((e,n)=>{})),FK=t=>ft((e,n)=>{const r=parseFloat(e.value);(isNaN(r)||r<0||r>100)&&n("warning","Value ignored, must be between 0% and 100%",{node:e,property:"value"})}),MK=t=>(e,n)=>{const r=e.$container;
|
|
2028
2029
|
r.props.some(i=>as(i)&&i!==e)&&n("error","Icon must be defined once",{node:e}),hl(r)&&ch(r.$container)&&r.$container.props.some(i=>as(i))&&n("warning","Redundant as icon defined on element",{node:e}),e.value?.startsWith("file://")&&n("error","Icon URI must not start with file://",{node:e,property:"value"})},BK=t=>(e,n)=>{Gr(e,ah)||n("error","Notes can be defined only inside dynamic view",{node:e})},qK=t=>(e,n)=>{if(e.$type==="HexColor"){if(e.hex===void 0||rs(e.hex)&&!e.hex.match(/^[a-fA-F0-9]+$/)){
|
|
2029
2030
|
n("error","Invalid HEX",{node:e,property:"hex"});return}const r=Jr(e.hex)?e.hex.toString().length:e.hex.length;r!==6&&r!==3&&r!==8&&n("error",`Invalid value "${e.$cstNode?.text}", must be 3, 6 or 8 characters long`,{node:e,property:"hex"});return}if(e.$type==="RGBAColor"){if((!Jr(e.red)||e.red<0||e.red>255)&&n("error","Invalid value, must be between 0 and 255",{node:e,property:"red"}),(!Jr(e.green)||e.green<0||e.green>255)&&n("error","Invalid value, must be between 0 and 255",{node:e,property:"g\
|
|
2030
|
-
reen"}),(!Jr(e.blue)||e.blue<0||e.blue>255)&&n("error","Invalid value, must be between 0 and 255",{node:e,property:"blue"}),Jr(e.alpha)&&(e.alpha<0||e.alpha>1)&&n("error","Invalid value, must be between 0 and 1",{node:e,property:"alpha"}),rs(e.alpha)){const r=parseFloat(e.alpha);(r<0||r>100)&&n("error","Invalid value, must be between 0% and 100%",{node:e,property:"alpha"})}return}Oe(e)},jK=t=>{const e=t.likec4.ModelParser;return
|
|
2031
|
+
reen"}),(!Jr(e.blue)||e.blue<0||e.blue>255)&&n("error","Invalid value, must be between 0 and 255",{node:e,property:"blue"}),Jr(e.alpha)&&(e.alpha<0||e.alpha>1)&&n("error","Invalid value, must be between 0 and 1",{node:e,property:"alpha"}),rs(e.alpha)){const r=parseFloat(e.alpha);(r<0||r>100)&&n("error","Invalid value, must be between 0% and 100%",{node:e,property:"alpha"})}return}Oe(e)},jK=t=>{const e=t.likec4.ModelParser;return ft((n,r)=>{const i=e.forDocument(ut(n)),s=gA(()=>i._resolveRelationSource(
|
|
2031
2032
|
n));if(!s){r("error","Source not resolved",{node:n,property:"source"});return}const o=gA(()=>i.parseFqnRef(n.target));if(!o){r("error","Target not resolved",{node:n,property:"target"});return}fn.isImportRef(s)&&(fn.isImportRef(o)?r("warning","Relationship between imported elements may not be visible in origin projects",{node:n}):r("warning","Relationship from imported element to local element may not be visible in origin project",{node:n,property:"source"})),eb(fn.flatten(s),fn.flatten(o))&&r("e\
|
|
2032
|
-
rror","Invalid parent-child relationship",{node:n})})},GK=t=>
|
|
2033
|
-
0&&n("warning","Prefer one global block per document",{node:e,property:"name"})}),HK=t=>{const e=t.shared.workspace.IndexManager;return
|
|
2034
|
-
toString()},message:"conflicting definition"}]}})}})},KK=t=>{const e=t.shared.workspace.IndexManager;return
|
|
2035
|
-
message:"conflicting definition"}]}})}})},VK=t=>{const e=t.shared.workspace.IndexManager;return
|
|
2036
|
-
Io.includes(n.name)&&r("error",`Reserved word: ${n.name}`,{node:n,property:"name"});const i=Bt(n);e.projectElements(i,cs).filter(s=>s.name===n.name).limit(2).count()>1&&r("error",`Duplicate RelationshipKind '${n.name}'`,{node:n,property:"name"})})},GS=t=>{const e=t.shared.workspace.IndexManager;return
|
|
2037
|
-
dicateGroup name '${n.name}'`,{node:n,property:"name"})})},YK=t=>{const e=t.shared.workspace.IndexManager;return
|
|
2038
|
-
s=>s.name===n.name).limit(2).count()>1&&r("error",`Duplicate view '${n.name}'`,{node:n,property:"name"})})},QK=t=>{const e=t.likec4.ModelParser;return
|
|
2039
|
-
isElementTagExpr(a)&&s):{r("warning","Predicate is ignored, as not supported in dynamic views",{node:n});return}case tn.isWildcard(a):case tn.isModelRef(a):case tn.isDeploymentRef(a):return;case tn.isElementKindExpr(a):case tn.isElementTagExpr(a):r("error","Invalid target (expect reference to specific element)",{node:n,property:"subject"});return;default:Oe(a)}})},ZK=t=>{const e=t.likec4.ModelParser;return
|
|
2033
|
+
rror","Invalid parent-child relationship",{node:n})})},GK=t=>ft((e,n)=>{e.$container.tags?.values&&e.tags?.values&&n("error","Relation cannot have tags in both header and body",{node:e.tags})}),UK=t=>ft((e,n)=>{e.$containerIndex&&e.$containerIndex>0&&n("warning","Prefer one specification per document",{node:e,property:"name"})}),WK=t=>ft((e,n)=>{e.$containerIndex&&e.$containerIndex>0&&n("warning","Prefer one model per document",{node:e,property:"name"})}),zK=t=>ft((e,n)=>{e.$containerIndex&&e.$containerIndex>
|
|
2034
|
+
0&&n("warning","Prefer one global block per document",{node:e,property:"name"})}),HK=t=>{const e=t.shared.workspace.IndexManager;return ft((n,r)=>{Io.includes(n.name)&&r("error",`Reserved word: ${n.name}`,{node:n,property:"name"});const i=Bt(n),s=e.projectElements(i,Pi).filter(o=>o.name===n.name&&o.node!==n).head();if(s){const o=s.documentUri!==ut(n).uri;r("error",`Duplicate element kind '${n.name}'`,{node:n,property:"name",...o&&{relatedInformation:[{location:{range:s.nameSegment.range,uri:s.documentUri.
|
|
2035
|
+
toString()},message:"conflicting definition"}]}})}})},KK=t=>{const e=t.shared.workspace.IndexManager;return ft((n,r)=>{Io.includes(n.name)&&r("error",`Reserved word: ${n.name}`,{node:n,property:"name"});const i=Bt(n),s=e.projectElements(i,xi).filter(o=>o.name===n.name&&o.node!==n).head();if(s){const o=s.documentUri!==ut(n).uri;r("error",`Duplicate deploymentNode kind '${n.name}'`,{node:n,property:"name",...o&&{relatedInformation:[{location:{range:s.nameSegment.range,uri:s.documentUri.toString()},
|
|
2036
|
+
message:"conflicting definition"}]}})}})},VK=t=>{const e=t.shared.workspace.IndexManager;return ft((n,r)=>{const i=n.name,s=Bt(n),o=e.projectElements(s,ls).filter(a=>a.name===i&&a.node!==n).head();if(o){const a=o.documentUri!==ut(n).uri;r("error",`Duplicate tag '${n.name}'`,{node:n,property:"name",...a&&{relatedInformation:[{location:{range:o.nameSegment.range,uri:o.documentUri.toString()},message:"conflicting definition"}]}})}})},XK=t=>{const e=t.shared.workspace.IndexManager;return ft((n,r)=>{
|
|
2037
|
+
Io.includes(n.name)&&r("error",`Reserved word: ${n.name}`,{node:n,property:"name"});const i=Bt(n);e.projectElements(i,cs).filter(s=>s.name===n.name).limit(2).count()>1&&r("error",`Duplicate RelationshipKind '${n.name}'`,{node:n,property:"name"})})},GS=t=>{const e=t.shared.workspace.IndexManager;return ft((n,r)=>{const i=Bt(n),s=e.projectElements(i,wa),o=e.projectElements(i,va);s.concat(o).filter(a=>a.name===n.name).limit(2).count()>1&&r("error",`Duplicate GlobalPredicateGroup or GlobalDynamicPre\
|
|
2038
|
+
dicateGroup name '${n.name}'`,{node:n,property:"name"})})},YK=t=>{const e=t.shared.workspace.IndexManager;return ft((n,r)=>{const i=Bt(n);e.projectElements(i,$l).filter(s=>s.name===n.name).limit(2).count()>1&&r("error",`Duplicate GlobalStyleId name '${n.name}'`,{node:n,property:"name"})})},JK=t=>{const e=t.shared.workspace.IndexManager;return ft((n,r)=>{if(!n.name)return;Io.includes(n.name)&&r("error",`Reserved word: ${n.name}`,{node:n,property:"name"});const i=Bt(n);e.projectElements(i,yo).filter(
|
|
2039
|
+
s=>s.name===n.name).limit(2).count()>1&&r("error",`Duplicate view '${n.name}'`,{node:n,property:"name"})})},QK=t=>{const e=t.likec4.ModelParser;return ft((n,r)=>{const i=Yh(n);if(i?.$type!=="DynamicViewIncludePredicate"&&i?.isInclude!==!0){r("error",'Invalid usage inside "exclude"',{node:n});return}const s=i.$type==="DynamicViewIncludePredicate",o=e.forDocument(ut(i));let a=tn.unwrap(o.parseFqnExprWith(n).custom.expr);switch(!0){case(tn.isWildcard(a)&&s):case(tn.isElementKindExpr(a)&&s):case(tn.
|
|
2040
|
+
isElementTagExpr(a)&&s):{r("warning","Predicate is ignored, as not supported in dynamic views",{node:n});return}case tn.isWildcard(a):case tn.isModelRef(a):case tn.isDeploymentRef(a):return;case tn.isElementKindExpr(a):case tn.isElementTagExpr(a):r("error","Invalid target (expect reference to specific element)",{node:n,property:"subject"});return;default:Oe(a)}})},ZK=t=>{const e=t.likec4.ModelParser;return ft((n,r)=>{const i=e.forDocument(ut(n)).parseFqnRefExpr(n),s=Yh(n),o=fW(n)&&!Gr(n,a=>ol(a)||
|
|
2040
2041
|
Ia(a));if(s?.$type==="DeploymentViewRulePredicate"||o){if(!Gr(n,jp)){if(tn.isModelRef(i)){r("error","Deployment view predicate must reference deployment model",{node:n});return}if(tn.isDeploymentRef(i)&&fn.isInsideInstanceRef(i.ref)){r("error","Must reference deployment nodes or instances, but not internals",{node:n});return}}de(n.selector)&&!Cn(n.ref.value?.ref)&&r("warning",`Selector '${n.selector}' applies to deployment nodes only, ignored here`,{node:n,property:"selector"});return}if(s?.$type===
|
|
2041
|
-
"DynamicViewIncludePredicate")switch(!0){case tn.isElementKindExpr(i):case tn.isElementTagExpr(i):case tn.isWildcard(i):{r("warning","Predicate is ignored, as not supported in dynamic views",{node:n});return}}})},e9=t=>
|
|
2042
|
-
e.from.$type==="WildcardExpression"){const r=zn(e,dh);r&&Et(r.viewOf)&&n("warning","Predicate is ignored as it concerns all relationships",{node:e})}}),n9=t=>{const e=t.likec4.ModelParser;return
|
|
2043
|
-
isIncoming(a)?c=a.incoming:Xd.isOutgoing(a)?c=a.outgoing:c=a.inout,tn.isModelRef(c)){r("error",u,{node:n});return}})},r9=t=>
|
|
2042
|
+
"DynamicViewIncludePredicate")switch(!0){case tn.isElementKindExpr(i):case tn.isElementTagExpr(i):case tn.isWildcard(i):{r("warning","Predicate is ignored, as not supported in dynamic views",{node:n});return}}})},e9=t=>ft((e,n)=>{if(e.to.$type==="WildcardExpression"&&!CC(e.$container)){const r=zn(e,dh);Et(r?.viewOf)&&n("warning","Predicate is ignored as it concerns all relationships",{node:e})}}),t9=t=>ft((e,n)=>{if(Yh(e)?.$type==="ViewRulePredicate"&&e.$container.$type!=="DirectedRelationExpr"&&
|
|
2043
|
+
e.from.$type==="WildcardExpression"){const r=zn(e,dh);r&&Et(r.viewOf)&&n("warning","Predicate is ignored as it concerns all relationships",{node:e})}}),n9=t=>{const e=t.likec4.ModelParser;return ft((n,r)=>{const i=zn(n,ma);if(!i||i.isInclude!==!0)return;const s=ut(n),o=e.forDocument(s);let a=Xd.unwrap(o.parseRelationExpr(n));const u="Model reference is allowed in exclude predicate only";if(Xd.isDirect(a)){(tn.isModelRef(a.source)||tn.isModelRef(a.target))&&r("error",u,{node:n});return}let c;if(Xd.
|
|
2044
|
+
isIncoming(a)?c=a.incoming:Xd.isOutgoing(a)?c=a.outgoing:c=a.inout,tn.isModelRef(c)){r("error",u,{node:n});return}})},r9=t=>ft((e,n)=>{const r=Yh(e);if(!(!r||r.$type=="DynamicViewIncludePredicate")&&!r.isInclude){n("error",'Invalid usage inside "exclude"',{node:e});return}});function i9(t){return e=>t.some(n=>n(e))}const s9=i9([kl,Zr,Cv,El,bl,Ea,$o,yh,Nv,uC,jp,vv,ah,L8,ma,M8,jp,Tv,G8,mv,MC,U8,uv,fv,gv,jn,Cn,xr,dC,ss,ei,F8,zp,Th,cn,bv,Eo,os,Sa,xa,Ca,Zl,Ih,OC,O8]),o9=t=>{let e=t;for(;e&&!AC(e);){if(s9(
|
|
2044
2045
|
e))return e;e=e.$container}};function a9(t){const e=t.state>=qe.Validated?t.diagnostics?.filter(r=>r.severity===Ws.Error)??[]:[],n=new WeakSet;for(const{node:r}of e){if(Et(r)||n.has(r))continue;n.add(r);const i=o9(r);i&&n.add(i)}return{isValid:r=>!n.has(r),invalidNodes:n}}function u9(t){st.debug("registerValidationChecks"),t.validation.ValidationRegistry.register({DeployedInstance:CK(t),DeploymentNodeKind:KK(t),DeploymentNode:TK(t),DeploymentRelation:AK(t),ExtendDeployment:SK(),FqnRefExpr:ZK(t),
|
|
2045
2046
|
RelationExpr:n9(t),NotesProperty:BK(),OpacityProperty:FK(),IconProperty:MK(),SpecificationRule:UK(),Model:WK(),Globals:zK(),GlobalPredicateGroup:GS(t),GlobalDynamicPredicateGroup:GS(t),GlobalStyleId:YK(t),DynamicViewStep:_K(t),LikeC4View:JK(t),Element:PK(t),ElementRef:NK(),ElementKind:HK(t),Relation:jK(t),RelationBody:GK(),Tag:VK(t),FqnExprWith:QK(t),RelationExprWith:r9(),RelationshipKind:XK(t),IncomingRelationExpr:e9(),OutgoingRelationExpr:t9(),ImportsFromPoject:OK(t),Imported:LK(t),ColorLiteral:qK()});
|
|
2046
2047
|
const e=t.shared.lsp.Connection;e&&t.shared.workspace.DocumentBuilder.onUpdate((n,r)=>{for(const i of r)st.debug(`clear diagnostics for deleted ${i.path}`),e.sendDiagnostics({uri:i.toString(),diagnostics:[]})})}function Pw(t){if(t==null)return;const e=gn(t);return rs(e)?e.split(`
|
|
2047
2048
|
`).join(" "):"md"in e?{md:e.md.split(`
|
|
2048
2049
|
`).join(" ")}:{txt:e.txt.split(`
|
|
2049
|
-
`).join(" ")}}function gn(t){if(t!=null)switch(!0){case rs(t):return
|
|
2050
|
-
text}`));return this.doc.c4Imports.set(n,r),yx(n,r)}return Eo(e)?To(e.element):os(e)?To(e.deploymentNode):Ip(e)?this.services.likec4.DeploymentsIndex.getFqn(e):this.services.likec4.FqnIndex.getFqn(e)}getAstNodePath(e){return this.services.workspace.AstNodeLocator.getAstNodePath(e)}getMetadata(e){if(!e||!this.isValid(e)||It(e.props))return;const n=Le(e.props,bt(r=>[r.key,gn(r.value)]),bt(([r,i])=>[r,i.md||i.txt]),Pe(([r,i])=>de(i)),$3());return It(n)?void 0:n}parseMarkdownOrString(e){if(
|
|
2050
|
+
`).join(" ")}}function gn(t){if(t!=null)switch(!0){case rs(t):return cm(t).trim();case(Av(t)&&de(t.markdown)):return{md:cm(t.markdown).trim()};case(Av(t)&&de(t.text)):return{txt:cm(t.text).trim()};default:return}}class c9{constructor(e,n){this.services=e,this.doc=n,this.isValid=a9(n).isValid}isValid;get project(){return this.services.shared.workspace.ProjectsManager.getProject(this.doc)}resolveFqn(e){if(Zr(e)){const n=Bt(e),r=this.resolveFqn(xt(e.imported.ref,`FqnRef is empty of imported: ${e.$cstNode?.
|
|
2051
|
+
text}`));return this.doc.c4Imports.set(n,r),yx(n,r)}return Eo(e)?To(e.element):os(e)?To(e.deploymentNode):Ip(e)?this.services.likec4.DeploymentsIndex.getFqn(e):this.services.likec4.FqnIndex.getFqn(e)}getAstNodePath(e){return this.services.workspace.AstNodeLocator.getAstNodePath(e)}getMetadata(e){if(!e||!this.isValid(e)||It(e.props))return;const n=Le(e.props,bt(r=>[r.key,gn(r.value)]),bt(([r,i])=>[r,i.md||i.txt]),Pe(([r,i])=>de(i)),$3());return It(n)?void 0:n}parseMarkdownOrString(e){if(Av(e))return gn(
|
|
2051
2052
|
e)}convertTags(e){return this.parseTags(e)}parseTags(e){let n=e?.tags;if(!n)return null;let r=[];for(;n;){try{if(this.isValid(n)){const i=n.values.map(s=>s.tag.ref?.name).filter(de);i.length>0&&r.push(...i)}}catch{}n=n.prev}return Gn(r)?ua(r):null}convertLinks(e){return this.parseLinks(e)}parseLinks(e){if(!(!e?.props||e.props.length===0))return Le(e.props,Pe(xl),Cr(n=>{if(!this.isValid(n))return[];const r=n.value;if(de(r)){const i=de(n.title)?Pw(n.title):void 0,s=this.services.lsp.DocumentLinkProvider.
|
|
2052
|
-
relativeLink(this.doc,r);return{url:r,...i&&{title:i},...s&&s!==r&&{relative:s}}}return[]}))}parseIconProperty(e){if(!e||!this.isValid(e))return;const{libicon:n,value:r}=e;switch(!0){case!!n:return n.ref?.name;case(r&&r==="none"):return r;case(r&&ds(r)):return r.startsWith("file:")?void 0:r;case(r&&
|
|
2053
|
+
relativeLink(this.doc,r);return{url:r,...i&&{title:i},...s&&s!==r&&{relative:s}}}return[]}))}parseIconProperty(e){if(!e||!this.isValid(e))return;const{libicon:n,value:r}=e;switch(!0){case!!n:return n.ref?.name;case(r&&r==="none"):return r;case(r&&ds(r)):return r.startsWith("file:")?void 0:r;case(r&&Gv(r)):return qh(this.doc.uri.toString(),"../",r);case(r&&Dd(r)):return eA(this.project.folder.toString(),r);default:return}}parseColorLiteral(e){if(this.isValid(e)){if(eU(e))return`#${e.hex}`;if(uU(e)){
|
|
2053
2054
|
let n=Jr(e.alpha)?e.alpha:void 0;return rs(e.alpha)&&(n=fA(e.alpha)/100),n!==void 0?`rgba(${e.red},${e.green},${e.blue},${n})`:`rgb(${e.red},${e.green},${e.blue})`}Oe(e)}}parseElementStyle(e){if(!e)return{};if(zD(e)){const n=this.parseStyleProps(e?.find(hl)?.props),r=this.parseIconProperty(e?.find(as));return r&&(n.icon=r),n}return this.parseStyleProps(e.props)}parseStyleProps(e){const n={};if(!e||e.length===0)return n;for(const r of e)if(this.isValid(r))switch(!0){case Yp(r):{de(r.value)&&(n.border=
|
|
2054
|
-
r.value);break}case vo(r):{const i=Pd(r);de(i)&&(n.color=i);break}case Ph(r):{de(r.value)&&(n.shape=r.value);break}case as(r):{const i=this.parseIconProperty(r);de(i)&&(n.icon=i);break}case Ch(r):{n.opacity=pA(r);break}case
|
|
2055
|
+
r.value);break}case vo(r):{const i=Pd(r);de(i)&&(n.color=i);break}case Ph(r):{de(r.value)&&(n.shape=r.value);break}case as(r):{const i=this.parseIconProperty(r);de(i)&&(n.icon=i);break}case Ch(r):{n.opacity=pA(r);break}case Sv(r):{n.multiple=Fy(r.value)?r.value:!1;break}case Iv(r):{de(r.value)&&(n.size=Fa(r));break}case xv(r):{de(r.value)&&(n.padding=Fa(r));break}case Lv(r):{de(r.value)&&(n.textSize=Fa(r));break}default:Oe(r)}return n}parseTitleDescriptionTechnology(e,n){const r=gn(e.title??ti(n.
|
|
2055
2056
|
title)),i=e.description?{txt:gn(e.description)}:this.parseMarkdownOrString(n.description),s=Pw(e.technology)??gn(ti(n.technology));return{...de(r)&&{title:r},...de(i)&&{description:i},...de(s)&&{technology:s}}}}function*l9(t){const e=tb.from(t.parseResult.value.deployments.flatMap(i=>i.elements)),n=[];let r;for(;r=e.shift();){if(xr(r)){n.push(r);continue}if(r.body&&r.body.elements.length>0)for(const i of r.body.elements)e.push(i);yield r}yield*n}function d9(t){return class extends t{parseDeployment(){
|
|
2056
|
-
const e=this.doc;for(const n of l9(e))try{switch(!0){case xr(n):{this.isValid(n)&&e.c4DeploymentRelations.push(this.parseDeploymentRelation(n));break}case
|
|
2057
|
-
ind not resolved").name,s=this.convertTags(e.body),o=this.parseElementStyle(e.body?.props),a=this.getMetadata(e.body?.props.find(ss)),u=Le(e.body?.props??[],Pe(n),Pe(fl),fr(d=>[d.key,d.value])),{title:c,...l}=this.parseTitleDescriptionTechnology({title:e.title},u),f=this.convertLinks(e.body);return{id:r,kind:i,title:c??
|
|
2057
|
+
const e=this.doc;for(const n of l9(e))try{switch(!0){case xr(n):{this.isValid(n)&&e.c4DeploymentRelations.push(this.parseDeploymentRelation(n));break}case jn(n):e.c4Deployments.push(this.parseDeployedInstance(n));break;case Cn(n):{e.c4Deployments.push(this.parseDeploymentNode(n));break}case os(n):{const r=this.parseExtendDeployment(n);r&&e.c4ExtendDeployments.push(r);break}default:Oe(n)}}catch(r){De(r)}}parseDeploymentNode(e){const n=this.isValid,r=this.resolveFqn(e),i=xt(e.kind.ref,"DeploymentK\
|
|
2058
|
+
ind not resolved").name,s=this.convertTags(e.body),o=this.parseElementStyle(e.body?.props),a=this.getMetadata(e.body?.props.find(ss)),u=Le(e.body?.props??[],Pe(n),Pe(fl),fr(d=>[d.key,d.value])),{title:c,...l}=this.parseTitleDescriptionTechnology({title:e.title},u),f=this.convertLinks(e.body);return{id:r,kind:i,title:c??pm(r),...a&&{metadata:a},...s&&{tags:s},...f&&Gn(f)&&{links:f},...l,style:o}}parseDeployedInstance(e){const n=this.isValid,r=this.resolveFqn(e),i=this.parseFqnRef(e.target.modelElement);
|
|
2058
2059
|
Ae(fn.isModelRef(i)||fn.isImportRef(i),"Target must be a model reference");const s=this.convertTags(e.body),o=this.parseElementStyle(e.body?.props),a=this.getMetadata(e.body?.props.find(ss)),u=Le(e.body?.props??[],Pe(n),Pe(fl),fr(f=>[f.key,f.value])),c=this.parseTitleDescriptionTechnology({title:e.title},u),l=this.convertLinks(e.body);return{id:r,element:i,...a&&{metadata:a},...s&&{tags:s},...l&&Gn(l)&&{links:l},...c,style:o}}parseExtendDeployment(e){if(!this.isValid(e))return null;const n=this.
|
|
2059
2060
|
resolveFqn(e),r=this.parseTags(e.body),i=this.getMetadata(e.body?.props.find(ss)),s=this.getAstNodePath(e),o=this.parseLinks(e.body)??[];return!r&&It(i??{})&&It(o)?null:{id:n,astPath:s,...i&&{metadata:i},...r&&{tags:r},...o&&Gn(o)&&{links:o}}}_resolveDeploymentRelationSource(e){if(an(e.source))return this.parseFqnRef(e.source);if(e.$container.$type==="DeploymentNodeBody"||e.$container.$type==="DeployedInstanceBody")return{deployment:this.resolveFqn(e.$container.$container)};throw new Error("Rela\
|
|
2060
2061
|
tionRefError: Invalid container for sourceless relation")}parseDeploymentRelation(e){const n=this.isValid,r=this.getAstNodePath(e),i=this._resolveDeploymentRelationSource(e);Ae(fn.isDeploymentRef(i),"Invalid source for deployment relation");const s=this.parseFqnRef(e.target);Ae(fn.isDeploymentRef(s),"Invalid target for deployment relation");const o=this.convertTags(e)??this.convertTags(e.body),a=this.convertLinks(e.body),u=(e.kind??e.dotKind?.kind)?.ref?.name,c=this.getMetadata(e.body?.props.find(
|
|
2061
2062
|
ss)),l=Le(e.body?.props??[],Pe(Hl),Pe(m=>de(m.value)),fr(m=>[m.key,m.value])),f=Le(e.body?.props??[],Pe(Wl),bt(m=>m.value.view.ref?.name),Pe(de),la()),d=this.parseTitleDescriptionTechnology({title:e.title},l),p=e.body?.props.find(xh);return{id:Nd("deployment",r,i.deployment,s.deployment),source:i,target:s,...d,...c&&{metadata:c},...u&&{kind:u},...o&&{tags:o},...Gn(a)&&{links:a},...Jv(p?.props,n),...f&&{navigateTo:f},astPath:r}}}}function f9(t){const e=t.length;let n=0,r=0;for(;r<e;){let i=t.charCodeAt(
|
|
2062
2063
|
r++);if((i&4294967168)===0){n++;continue}else if((i&4294965248)===0)n+=2;else{if(i>=55296&&i<=56319&&r<e){const s=t.charCodeAt(r);(s&64512)===56320&&(++r,i=((i&1023)<<10)+(s&1023)+65536)}(i&4294901760)===0?n+=3:n+=4}}return n}function p9(t,e,n){const r=t.length;let i=n,s=0;for(;s<r;){let o=t.charCodeAt(s++);if((o&4294967168)===0){e[i++]=o;continue}else if((o&4294965248)===0)e[i++]=o>>6&31|192;else{if(o>=55296&&o<=56319&&s<r){const a=t.charCodeAt(s);(a&64512)===56320&&(++s,o=((o&1023)<<10)+(a&1023)+
|
|
2063
2064
|
65536)}(o&4294901760)===0?(e[i++]=o>>12&15|224,e[i++]=o>>6&63|128):(e[i++]=o>>18&7|240,e[i++]=o>>12&63|128,e[i++]=o>>6&63|128)}e[i++]=o&63|128}}const h9=new TextEncoder,m9=50;function g9(t,e,n){h9.encodeInto(t,e.subarray(n))}function y9(t,e,n){t.length>m9?g9(t,e,n):p9(t,e,n)}const v9=4096;function US(t,e,n){let r=e;const i=r+n,s=[];let o="";for(;r<i;){const a=t[r++];if((a&128)===0)s.push(a);else if((a&224)===192){const u=t[r++]&63;s.push((a&31)<<6|u)}else if((a&240)===224){const u=t[r++]&63,c=t[r++]&
|
|
2064
|
-
63;s.push((a&31)<<12|u<<6|c)}else if((a&248)===240){const u=t[r++]&63,c=t[r++]&63,l=t[r++]&63;let f=(a&7)<<18|u<<12|c<<6|l;f>65535&&(f-=65536,s.push(f>>>10&1023|55296),f=56320|f&1023),s.push(f)}else s.push(a);s.length>=v9&&(o+=String.fromCharCode(...s),s.length=0)}return s.length>0&&(o+=String.fromCharCode(...s)),o}const w9=new TextDecoder,b9=200;function E9(t,e,n){const r=t.subarray(e,e+n);return w9.decode(r)}function $9(t,e,n){return n>b9?E9(t,e,n):US(t,e,n)}class
|
|
2065
|
+
63;s.push((a&31)<<12|u<<6|c)}else if((a&248)===240){const u=t[r++]&63,c=t[r++]&63,l=t[r++]&63;let f=(a&7)<<18|u<<12|c<<6|l;f>65535&&(f-=65536,s.push(f>>>10&1023|55296),f=56320|f&1023),s.push(f)}else s.push(a);s.length>=v9&&(o+=String.fromCharCode(...s),s.length=0)}return s.length>0&&(o+=String.fromCharCode(...s)),o}const w9=new TextDecoder,b9=200;function E9(t,e,n){const r=t.subarray(e,e+n);return w9.decode(r)}function $9(t,e,n){return n>b9?E9(t,e,n):US(t,e,n)}class lm{constructor(e,n){this.type=
|
|
2065
2066
|
e,this.data=n}}class rr extends Error{constructor(e){super(e);const n=Object.create(rr.prototype);Object.setPrototypeOf(this,n),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:rr.name})}}const Gd=4294967295;function R9(t,e,n){const r=n/4294967296,i=n;t.setUint32(e,r),t.setUint32(e+4,i)}function WS(t,e,n){const r=Math.floor(n/4294967296),i=n;t.setUint32(e,r),t.setUint32(e+4,i)}function zS(t,e){const n=t.getInt32(e),r=t.getUint32(e+4);return n*4294967296+r}function D9(t,e){const n=t.
|
|
2066
2067
|
getUint32(e),r=t.getUint32(e+4);return n*4294967296+r}const k9=-1,T9=4294967296-1,C9=17179869184-1;function A9({sec:t,nsec:e}){if(t>=0&&e>=0&&t<=C9)if(e===0&&t<=T9){const n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,t),n}else{const n=t/4294967296,r=t&4294967295,i=new Uint8Array(8),s=new DataView(i.buffer);return s.setUint32(0,e<<2|n&3),s.setUint32(4,r),i}else{const n=new Uint8Array(12),r=new DataView(n.buffer);return r.setUint32(0,e),WS(r,4,t),n}}function S9(t){const e=t.getTime(),
|
|
2067
2068
|
n=Math.floor(e/1e3),r=(e-n*1e3)*1e6,i=Math.floor(r/1e9);return{sec:n+i,nsec:r-i*1e9}}function _9(t){if(t instanceof Date){const e=S9(t);return A9(e)}else return null}function x9(t){const e=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(t.byteLength){case 4:return{sec:e.getUint32(0),nsec:0};case 8:{const n=e.getUint32(0),r=e.getUint32(4),i=(n&3)*4294967296+r,s=n>>>2;return{sec:i,nsec:s}}case 12:{const n=zS(e,4),r=e.getUint32(0);return{sec:n,nsec:r}}default:throw new rr(`Unrecognized data\
|
|
2068
|
-
size for timestamp (expected 4, 8, or 12): ${t.length}`)}}function P9(t){const e=x9(t);return new Date(e.sec*1e3+e.nsec/1e6)}const N9={type:k9,encode:_9,decode:P9};class
|
|
2069
|
-
const i=this.builtInEncoders[r];if(i!=null){const s=i(e,n);if(s!=null){const o=-1-r;return new
|
|
2070
|
-
function Nw(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):I9(t)?new Uint8Array(t):Uint8Array.from(t)}const O9=100,L9=2048;class Hw{constructor(e){this.entered=!1,this.extensionCodec=e?.extensionCodec??
|
|
2069
|
+
size for timestamp (expected 4, 8, or 12): ${t.length}`)}}function P9(t){const e=x9(t);return new Date(e.sec*1e3+e.nsec/1e6)}const N9={type:k9,encode:_9,decode:P9};class dm{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(N9)}register({type:e,encode:n,decode:r}){if(e>=0)this.encoders[e]=n,this.decoders[e]=r;else{const i=-1-e;this.builtInEncoders[i]=n,this.builtInDecoders[i]=r}}tryToEncode(e,n){for(let r=0;r<this.builtInEncoders.length;r++){
|
|
2070
|
+
const i=this.builtInEncoders[r];if(i!=null){const s=i(e,n);if(s!=null){const o=-1-r;return new lm(o,s)}}}for(let r=0;r<this.encoders.length;r++){const i=this.encoders[r];if(i!=null){const s=i(e,n);if(s!=null){const o=r;return new lm(o,s)}}}return e instanceof lm?e:null}decode(e,n,r){const i=n<0?this.builtInDecoders[-1-n]:this.decoders[n];return i?i(e,n,r):new lm(n,e)}}dm.defaultCodec=new dm;function I9(t){return t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer}
|
|
2071
|
+
function Nw(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):I9(t)?new Uint8Array(t):Uint8Array.from(t)}const O9=100,L9=2048;class Hw{constructor(e){this.entered=!1,this.extensionCodec=e?.extensionCodec??dm.defaultCodec,this.context=e?.context,this.useBigInt64=e?.useBigInt64??!1,this.maxDepth=e?.maxDepth??O9,this.initialBufferSize=e?.initialBufferSize??L9,this.sortKeys=e?.sortKeys??!1,this.forceFloat32=e?.forceFloat32??!1,this.ignoreUndefined=
|
|
2071
2072
|
e?.ignoreUndefined??!1,this.forceIntegerToFloat=e?.forceIntegerToFloat??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new Hw({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){
|
|
2072
2073
|
this.pos=0}encodeSharedRef(e){if(this.entered)return this.clone().encodeSharedRef(e);try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(e){if(this.entered)return this.clone().encode(e);try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(e,n){if(n>this.maxDepth)throw new Error(`Too deep objects in depth ${n}`);e==null?this.encodeNil():
|
|
2073
2074
|
typeof e=="boolean"?this.encodeBoolean(e):typeof e=="number"?this.forceIntegerToFloat?this.encodeNumberAsFloat(e):this.encodeNumber(e):typeof e=="string"?this.encodeString(e):this.useBigInt64&&typeof e=="bigint"?this.encodeBigInt64(e):this.encodeObject(e,n)}ensureBufferSizeToWrite(e){const n=this.pos+e;this.view.byteLength<n&&this.resizeBuffer(n*2)}resizeBuffer(e){const n=new ArrayBuffer(e),r=new Uint8Array(n),i=new DataView(n);r.set(this.bytes),this.view=i,this.bytes=r}encodeNil(){this.writeU8(
|
|
@@ -2084,7 +2085,7 @@ t)}function Iw(t){return`${t<0?"-":""}0x${Math.abs(t).toString(16).padStart(2,"0
|
|
|
2084
2085
|
length-1],i={bytes:e,str:n};r.length>=this.maxLengthPerKey?r[Math.random()*r.length|0]=i:r.push(i)}decode(e,n,r){const i=this.find(e,n,r);if(i!=null)return this.hit++,i;this.miss++;const s=US(e,n,r),o=Uint8Array.prototype.slice.call(e,n,n+r);return this.store(o,s),s}}const Ow="array",Ud="map_key",HS="map_value",j9=t=>{if(typeof t=="string"||typeof t=="number")return t;throw new rr("The type of key must be string or number but "+typeof t)};class G9{constructor(){this.stack=[],this.stackHeadPosition=
|
|
2085
2086
|
-1}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(e){const n=this.getUninitializedStateFromPool();n.type=Ow,n.position=0,n.size=e,n.array=new Array(e)}pushMapState(e){const n=this.getUninitializedStateFromPool();n.type=Ud,n.readCount=0,n.size=e,n.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){const e={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};
|
|
2086
2087
|
this.stack.push(e)}return this.stack[this.stackHeadPosition]}release(e){if(this.stack[this.stackHeadPosition]!==e)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(e.type===Ow){const r=e;r.size=0,r.array=void 0,r.position=0,r.type=void 0}if(e.type===Ud||e.type===HS){const r=e;r.size=0,r.map=void 0,r.readCount=0,r.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}}const Wd=-1,Lw=new DataView(new ArrayBuffer(0)),U9=new Uint8Array(
|
|
2087
|
-
Lw.buffer);try{Lw.getInt8(0)}catch(t){if(!(t instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}const KS=new RangeError("Insufficient data"),W9=new q9;class Kw{constructor(e){this.totalPos=0,this.pos=0,this.view=Lw,this.bytes=U9,this.headByte=Wd,this.stack=new G9,this.entered=!1,this.extensionCodec=e?.extensionCodec??
|
|
2088
|
+
Lw.buffer);try{Lw.getInt8(0)}catch(t){if(!(t instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}const KS=new RangeError("Insufficient data"),W9=new q9;class Kw{constructor(e){this.totalPos=0,this.pos=0,this.view=Lw,this.bytes=U9,this.headByte=Wd,this.stack=new G9,this.entered=!1,this.extensionCodec=e?.extensionCodec??dm.defaultCodec,this.context=e?.context,this.useBigInt64=e?.useBigInt64??
|
|
2088
2089
|
!1,this.rawStrings=e?.rawStrings??!1,this.maxStrLength=e?.maxStrLength??Gd,this.maxBinLength=e?.maxBinLength??Gd,this.maxArrayLength=e?.maxArrayLength??Gd,this.maxMapLength=e?.maxMapLength??Gd,this.maxExtLength=e?.maxExtLength??Gd,this.keyDecoder=e?.keyDecoder!==void 0?e.keyDecoder:W9,this.mapKeyConverter=e?.mapKeyConverter??j9}clone(){return new Kw({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.
|
|
2089
2090
|
maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=Wd,this.stack.reset()}setBuffer(e){const n=Nw(e);this.bytes=n,this.view=new DataView(n.buffer,n.byteOffset,n.byteLength),this.pos=0}appendBuffer(e){if(this.headByte===Wd&&!this.hasRemaining(1))this.setBuffer(e);else{const n=this.bytes.subarray(this.pos),r=Nw(e),i=new Uint8Array(n.length+r.length);i.set(n),i.set(
|
|
2090
2091
|
r,n.length),this.setBuffer(i)}}hasRemaining(e){return this.view.byteLength-this.pos>=e}createExtraByteError(e){const{view:n,pos:r}=this;return new RangeError(`Extra ${n.byteLength-r} of ${n.byteLength} byte(s) found at buffer[${e}]`)}decode(e){if(this.entered)return this.clone().decode(e);try{this.entered=!0,this.reinitializeState(),this.setBuffer(e);const n=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return n}finally{this.entered=!1}}*decodeMulti(e){if(this.
|
|
@@ -2101,27 +2102,27 @@ rawStrings||this.stateIsMapKey()?this.decodeUtf8String(e,n):this.decodeBinary(e,
|
|
|
2101
2102
|
Ud:!1}decodeBinary(e,n){if(e>this.maxBinLength)throw new rr(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(e+n))throw KS;const r=this.pos+n,i=this.bytes.subarray(r,r+e);return this.pos+=n+e,i}decodeExtension(e,n){if(e>this.maxExtLength)throw new rr(`Max length exceeded: ext length (${e}) > maxExtLength (${this.maxExtLength})`);const r=this.view.getInt8(this.pos+n),i=this.decodeBinary(e,n+1);return this.extensionCodec.decode(i,r,this.context)}lookU8(){
|
|
2102
2103
|
return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){const e=this.view.getUint8(this.pos);return this.pos++,e}readI8(){const e=this.view.getInt8(this.pos);return this.pos++,e}readU16(){const e=this.view.getUint16(this.pos);return this.pos+=2,e}readI16(){const e=this.view.getInt16(this.pos);return this.pos+=2,e}readU32(){const e=this.view.getUint32(this.pos);return this.pos+=4,e}readI32(){const e=this.view.getInt32(
|
|
2103
2104
|
this.pos);return this.pos+=4,e}readU64(){const e=D9(this.view,this.pos);return this.pos+=8,e}readI64(){const e=zS(this.view,this.pos);return this.pos+=8,e}readU64AsBigInt(){const e=this.view.getBigUint64(this.pos);return this.pos+=8,e}readI64AsBigInt(){const e=this.view.getBigInt64(this.pos);return this.pos+=8,e}readF32(){const e=this.view.getFloat32(this.pos);return this.pos+=4,e}readF64(){const e=this.view.getFloat64(this.pos);return this.pos+=8,e}}function z9(t,e){return new Kw(e).decode(t)}const H9=t=>typeof ArrayBuffer==
|
|
2104
|
-
"function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]",K9=(t,e=0,n=t.byteLength-e)=>{if(!H9(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return
|
|
2105
|
+
"function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]",K9=(t,e=0,n=t.byteLength-e)=>{if(!H9(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return vm.from(t,e,n)},VS=(t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?vm.from(t,e):vm.from(t)},V9=/^[A-Za-z0-9+/]*={0,2}$/,X9=t=>{if(t.length*3%4!==0)throw new TypeError(
|
|
2105
2106
|
"Incorrect padding on base64 string.");if(!V9.exec(t))throw new TypeError("Invalid base64 string.");const e=VS(t,"base64");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)},Y9=t=>{const e=VS(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)},J9=t=>{let e;if(typeof t=="string"?e=Y9(t):e=t,typeof e!="object"||typeof e.byteOffset!="number"||typeof e.byteLength!="number")throw new Error("@smithy/util-base64: toBase64 encoder function only accep\
|
|
2106
2107
|
ts string | Uint8Array.");return K9(e.buffer,e.byteOffset,e.byteLength).toString("base64")},{getDocument:Q9}=Wo;function Z9({nodes:t,edges:e,...n}){return{...n,nodes:Ss(t,({x:r,y:i,width:s,height:o,isCompound:a,...u})=>({...u,b:[r,i,s,o],c:a})),edges:Ss(e,({points:r,controlPoints:i,labelBBox:s,dotpos:o,...a})=>({...!!i&&{cp:i},...!!s&&{l:s},...!!o&&{dp:o},...a,p:r}))}}function e5({nodes:t,edges:e,autoLayout:n,...r}){return{...r,autoLayout:vx(n)?{direction:n}:n,nodes:Ss(t,({b:i,c:s,...o})=>({x:i[0],
|
|
2107
2108
|
y:i[1],width:i[2],height:i[3],isCompound:s,...o})),edges:Ss(e,({p:i,cp:s,l:o,dp:a,...u})=>({...!!s&&{controlPoints:s},...!!o&&{labelBBox:o},...!!a&&{dotpos:a},...u,points:i}))}}const XS=500;function t5(t){const e=F9(Z9(t)),n=J9(e),r=[];let i=0;for(;i<n.length;)r.push(" * "+n.slice(i,Math.min(i+XS,n.length))),i+=XS;return r.unshift("/**"," * @likec4-generated(v1)"),r.push(" */"),r.join(`
|
|
2108
2109
|
`)}function YS(t){return t.includes("@likec4-generated")}function n5(t){if(!YS(t))throw new Error(`Not a likec4-generated comment: ${t}`);const e=t.trim().split(`
|
|
2109
2110
|
`).filter(r=>!r.includes("**")&&!r.includes("@likec4-")&&!r.includes("*/")).map(r=>r.replaceAll("*","").trim()).join(""),n=X9(e);return e5(z9(n))}function Fw(t){const e=of(t.$cstNode,["BLOCK_COMMENT"]);if(!(!e||!YS(e.text)))try{return n5(e.text)}catch(n){const r=Q9(t);De(n),st.warn(`Ignoring manual layout of "${t.name??"unnamed"}" at ${r.uri.fsPath}:${1+(e.range.start.line||0)}`);return}}function r5(t){return class extends t{parseDeploymentView(e){const n=e.body;Ae(n,"DynamicElementView body is \
|
|
2110
|
-
not defined");const r=n.props.filter(this.isValid),i=this.getAstNodePath(e);let s=e.name;s||(s="deployment_"+Nd(this.doc.uri.toString(),i));const{title:o=null,description:a=null}=this.parseTitleDescriptionTechnology({},Le(r,Pe(Bh),fr(f=>[f.key,f.value]))),u=this.convertTags(n),c=this.convertLinks(n);
|
|
2111
|
+
not defined");const r=n.props.filter(this.isValid),i=this.getAstNodePath(e);let s=e.name;s||(s="deployment_"+Nd(this.doc.uri.toString(),i));const{title:o=null,description:a=null}=this.parseTitleDescriptionTechnology({},Le(r,Pe(Bh),fr(f=>[f.key,f.value]))),u=this.convertTags(n),c=this.convertLinks(n);Vh.writeId(e,s);const l=Fw(e);return{[dn._type]:"deployment",id:s,astPath:i,title:o,description:a,tags:u,links:Gn(c)?c:null,rules:n.rules.flatMap(f=>{try{return this.isValid(f)?this.parseDeploymentViewRule(
|
|
2111
2112
|
f):[]}catch(d){return De(d),[]}}),...l&&{manualLayout:l}}}parseDeploymentViewRule(e){if(ma(e))return this.parseDeploymentViewRulePredicate(e);if(rd(e))return Qv(e);if(ol(e))return this.parseDeploymentViewRuleStyle(e);Oe(e)}parseDeploymentViewRulePredicate(e){const n=[];let r=e.expr;for(;r;){try{const i=r.value;Qr(i)&&this.isValid(i)&&n.unshift(this.parseExpressionV2(i))}catch(i){De(i)}r=r.prev}return e.isInclude?{include:n}:{exclude:n}}parseDeploymentViewRuleStyle(e){const n=this.parseStyleProps(
|
|
2112
|
-
e.props.filter(
|
|
2113
|
+
e.props.filter(mv)),r=gn(ti(e.props.find(ka)?.value));return{targets:this.parseFqnExpressions(e.targets),style:n,...r&&{notation:r}}}}}const JS=({operator:t,not:e},n)=>t.startsWith("!=")?{neq:n}:t.startsWith("=")?{eq:n}:e?{neq:n}:{eq:n};function QS(t){return!GC(t)&&!UC(t)?null:t.participant}function zd(t){switch(!0){case K8(t):{const e=t.value.tag.ref?.name,n=QS(t);Ae(e,"Expected tag name");const r={tag:JS(t,e)};return n?{participant:n,operator:r}:r}case z8(t):{const e=t.value?.ref?.name,n=QS(t);
|
|
2113
2114
|
Ae(e,"Expected kind name");const r={kind:JS(t,e)};return n?{participant:n,operator:r}:r}case(BC(t)||jC(t)):return{not:zd(t.value)};case cU(t):{const e=zd(t.left),n=zd(t.right),r=t.operator.toLowerCase();return ZS(r,e,n)}default:Oe(t)}}function ZS(t,e,n){if(n===null)return e;switch(t){case"and":{const r=[rb(e)?e.and:e,rb(n)?n.and:n].flat();return Ae(Gn(r),"Expected non-empty array"),{and:r}}case"or":{const r=[nb(e)?e.or:e,nb(n)?n.or:n].flat();return Ae(Gn(r),"Expected non-empty array"),{or:r}}default:
|
|
2114
2115
|
Oe(t)}}function i5(t){return class extends t{parseFqnRef(e){const n=xt(e.value?.ref,`FqnRef is empty ${e.$cstNode?.range.start.line}:${e.$cstNode?.range.start.character}`);if(Zr(n)){const r={project:Bt(n),model:this.resolveFqn(xt(n.imported.ref,`FqnRef is empty of imported: ${n.$cstNode?.text}`))};return this.doc.c4Imports.set(r.project,r.model),r}if(cn(n)){const r=DW(e);if(r){const a={project:Bt(r),model:this.resolveFqn(n)};return this.doc.c4Imports.set(a.project,a.model),a}const i=RW(e);if(!i)
|
|
2115
2116
|
return{model:this.resolveFqn(n)};const s=this.resolveFqn(i),o=this.resolveFqn(n);return{deployment:s,element:o}}if(Ip(n))return{deployment:this.resolveFqn(n)};Oe(n)}parseExpressionV2(e){if(lC(e))return this.parseFqnExprOrWith(e);if(q8(e))return this.parseRelationExprOrWith(e);Oe(e)}parseFqnExprOrWith(e){if(yh(e))return this.parseFqnExprWith(e);if(cC(e))return this.parseFqnExprOrWhere(e);Oe(e)}parseFqnExprWith(e){const n=this.parseFqnExprOrWhere(e.subject);return(e.custom?.props??[]).reduce((r,i)=>{
|
|
2116
2117
|
if(!this.isValid(i))return r;if(Th(i)){const s=i.value.view.$refText;return de(s)&&(r.custom.navigateTo=s),r}if(fl(i))return an(i.value)&&(r.custom[i.key]=gn(ti(i.value))||""),r;if(as(i)){const s=this.parseIconProperty(i);return an(s)&&(r.custom[i.key]=s),r}if(vo(i)){const s=Pd(i);return an(s)&&(r.custom[i.key]=s),r}if(Ph(i)||Yp(i))return an(i.value)&&(r.custom[i.key]=i.value),r;if(Ch(i))return an(i.value)&&(r.custom[i.key]=pA(i)),r;if(ka(i)){const s=de(i.value)?gn(ti(i.value)):void 0;return s&&
|
|
2117
|
-
(r.custom[i.key]=s),r}if(
|
|
2118
|
-
if(WC(e))return{wildcard:!0};if(RC(e))return Ae(e.kind?.ref,"ElementKindExpr kind is not resolved: "+e.$cstNode?.text),{elementKind:e.kind.ref.name,isEqual:e.isEqual};if(DC(e))return Ae(e.tag.tag.ref,"ElementTagExpr tag is not resolved: "+e.$cstNode?.text),{elementTag:e.tag.tag.$refText,isEqual:e.isEqual};if(
|
|
2119
|
-
ref:n,selector:"descendants"};case e.selector===".*":return{ref:n,selector:"children"};default:return{ref:n}}}parseFqnExpressions(e){const n=[];let r=e;for(;r;){try{Qr(r.value)&&this.isValid(r.value)&&n.push(this.parseFqnExpr(r.value))}catch(i){De(i)}r=r.prev}return n.reverse()}parseRelationExprOrWith(e){if(
|
|
2120
|
-
[]).reduce((r,i)=>{if(Hl(i)||ka(i)||
|
|
2121
|
-
e);if(jp(e))return this.parseRelationExpr(e);Oe(e)}parseRelationExprWhere(e){Ae(!
|
|
2118
|
+
(r.custom[i.key]=s),r}if(Sv(i))return Fy(i.value)&&(r.custom[i.key]=i.value),r;if(Iv(i)||Lv(i)||xv(i))return de(i.value)&&(r.custom[i.key]=Fa(i)),r;Oe(i)},{custom:{expr:n}})}parseFqnExprOrWhere(e){if(kv(e))return this.parseFqnExprWhere(e);if(uC(e))return this.parseFqnExpr(e);Oe(e)}parseFqnExprWhere(e){return Ae(!kv(e.subject),"FqnExprWhere is not allowed as subject of FqnExprWhere"),{where:{expr:this.parseFqnExpr(e.subject),condition:e.where?zd(e.where):{kind:{neq:"--always-true--"}}}}}parseFqnExpr(e){
|
|
2119
|
+
if(WC(e))return{wildcard:!0};if(RC(e))return Ae(e.kind?.ref,"ElementKindExpr kind is not resolved: "+e.$cstNode?.text),{elementKind:e.kind.ref.name,isEqual:e.isEqual};if(DC(e))return Ae(e.tag.tag.ref,"ElementTagExpr tag is not resolved: "+e.$cstNode?.text),{elementTag:e.tag.tag.$refText,isEqual:e.isEqual};if(Tv(e))return this.parseFqnRefExpr(e);Oe(e)}parseFqnRefExpr(e){const n=this.parseFqnRef(e.ref);switch(!0){case e.selector==="._":return{ref:n,selector:"expanded"};case e.selector===".**":return{
|
|
2120
|
+
ref:n,selector:"descendants"};case e.selector===".*":return{ref:n,selector:"children"};default:return{ref:n}}}parseFqnExpressions(e){const n=[];let r=e;for(;r;){try{Qr(r.value)&&this.isValid(r.value)&&n.push(this.parseFqnExpr(r.value))}catch(i){De(i)}r=r.prev}return n.reverse()}parseRelationExprOrWith(e){if(Nv(e))return this.parseRelationExprWith(e);if(B8(e))return this.parseRelationExprOrWhere(e);Oe(e)}parseRelationExprWith(e){const n=this.parseRelationExprOrWhere(e.subject);return(e.custom?.props??
|
|
2121
|
+
[]).reduce((r,i)=>{if(Hl(i)||ka(i)||_v(i)){const s=de(i.value)?gn(ti(i.value)):void 0;return s&&(r.customRelation[i.key]=s),r}if(el(i))return de(i.value)&&(r.customRelation[i.key]=i.value),r;if(vo(i)){const s=Pd(i);return de(s)&&(r.customRelation[i.key]=s),r}if(Sl(i))return de(i.value)&&(r.customRelation[i.key]=i.value),r;if(Wl(i)){const s=i.value.view.ref?.name;return de(s)&&(r.customRelation.navigateTo=s),r}Oe(i)},{customRelation:{expr:n}})}parseRelationExprOrWhere(e){if(Pv(e))return this.parseRelationExprWhere(
|
|
2122
|
+
e);if(jp(e))return this.parseRelationExpr(e);Oe(e)}parseRelationExprWhere(e){Ae(!Pv(e.subject),"RelationExprWhere is not allowed as subject of RelationExprWhere");const n=this.parseRelationExpr(e.subject),r=n.where?.expr??n,i=n.where?.condition,s=e.where?zd(e.where):null;let o;return s&&i?o=ZS("and",i,s):o=s??i??{kind:{neq:"--always-true--"}},{where:{expr:r,condition:o}}}parseRelationExpr(e){switch(e.$type){case"DirectedRelationExpr":return this.wrapInWhere({source:this.parseFqnExpr(e.source.from),
|
|
2122
2123
|
target:this.parseFqnExpr(e.target),isBidirectional:e.source.isBidirectional},this.parseInlineKindCondition(e.source));case"InOutRelationExpr":return{inout:this.parseFqnExpr(e.inout.to)};case"OutgoingRelationExpr":return this.wrapInWhere({outgoing:this.parseFqnExpr(e.from)},this.parseInlineKindCondition(e));case"IncomingRelationExpr":return{incoming:this.parseFqnExpr(e.to)};default:Oe(e)}}parseInlineKindCondition(e){const n=e.kind??e.dotKind?.kind;return n?(Ae(n.ref,"Kind is not resolved: "+e.$cstNode?.
|
|
2123
2124
|
text),{kind:{eq:n.ref?.name}}):null}wrapInWhere(e,n){return n?{where:{expr:e,condition:n}}:e}}}function s5(t){return class extends t{parseGlobals(){const{parseResult:e,c4Globals:n}=this.doc,r=this.isValid,i=e.value.globals.filter(r),s=i.flatMap(a=>a.predicates.filter(r));for(const a of s)try{const u=a.name;if(!de(u))continue;if(u in n.predicates){st.warn(`Global predicate named "${u}" is already defined`);continue}this.parseAndStoreGlobalPredicateGroupOrDynamic(a,u,n)}catch(u){De(u)}const o=i.flatMap(
|
|
2124
|
-
a=>a.styles.filter(r));for(const a of o)try{const u=a.id.name;if(!de(u))continue;if(u in n.styles){st.warn(`Global style named "${u}" is already defined`);continue}const c=this.parseGlobalStyleOrGroup(a);
|
|
2125
|
+
a=>a.styles.filter(r));for(const a of o)try{const u=a.id.name;if(!de(u))continue;if(u in n.styles){st.warn(`Global style named "${u}" is already defined`);continue}const c=this.parseGlobalStyleOrGroup(a);Bn(c,1)&&(n.styles[u]=c)}catch(u){De(u)}}parseAndStoreGlobalPredicateGroupOrDynamic(e,n,r){if(El(e)){const i=this.parseGlobalPredicateGroup(e);Bn(i,1)&&(r.predicates[n]=i);return}if(bl(e)){const i=this.parseGlobalDynamicPredicateGroup(e);Bn(i,1)&&(r.dynamicPredicates[n]=i);return}Oe(e)}parseGlobalPredicateGroup(e){
|
|
2125
2126
|
return e.predicates.map(n=>this.parseViewRulePredicate(n))}parseGlobalDynamicPredicateGroup(e){return e.predicates.map(n=>this.parseDynamicViewIncludePredicate(n))}parseGlobalStyleOrGroup(e){if(Ea(e))return[this.parseViewRuleStyle(e)];if($o(e))return e.styles.map(n=>this.parseViewRuleStyle(n));Oe(e)}}}function o5(t){return class extends t{parseImports(){const e=this.doc.parseResult.value.imports??[];for(const n of e){const r=n.project;let i=n.imports;for(;i;){try{this.doc.c4Imports.set(r,this.resolveFqn(
|
|
2126
2127
|
xt(i.imported.ref,`ElementRef is empty of imported: ${i.imported.$refText}`)))}catch(s){De(s)}i=i.prev}}}}}const a5=st.getChild("ModelParser");function*u5(t){const e=tb.from(t.parseResult.value.models.flatMap(i=>i.elements)),n=[];let r;for(;r=e.shift();){if(ei(r)){n.push(r);continue}if(r.body&&r.body.elements&&r.body.elements.length>0)for(const i of r.body.elements)e.push(i);yield r}yield*n}function c5(t){return class extends t{parseModel(){const e=this.doc;for(const n of u5(e))try{if(cn(n)){e.c4Elements.
|
|
2127
2128
|
push(this.parseElement(n));continue}if(ei(n)){this.isValid(n)&&e.c4Relations.push(this.parseRelation(n));continue}if(Eo(n)){const r=this.parseExtendElement(n);r&&e.c4ExtendElements.push(r);continue}Oe(n)}catch(r){const i=this.getAstNodePath(n),s=Un(r),o=r instanceof Error?r.message:String(s);a5.warn(`Error on {eltype}: ${o}
|
|
@@ -2139,31 +2140,31 @@ flatMap(u=>u.elements.filter(r)))try{Object.assign(n.elements,this.parseElementS
|
|
|
2139
2140
|
description:void 0,technology:void 0},u),d=gn(ti(u.notation));return{[i]:{...c&&{title:c},...l&&{description:l},...f&&{technology:f},...d&&{notation:d},...s&&{tags:s},...a&&dn.isNonEmptyArray(a)&&{links:a},style:o}}}}}function f5(t){return class extends t{parseViews(){const e=this.isValid;for(const n of this.doc.parseResult.value.views){const r=n.styles.flatMap(s=>{try{return e(s)?this.parseViewRuleStyleOrGlobalRef(s):[]}catch(o){return De(o),[]}}),i=n.folder&&!It(n.folder.trim())?n.folder:null;
|
|
2140
2141
|
for(const s of n.views)try{if(!e(s))continue;switch(!0){case dh(s):this.doc.c4Views.push(this.parseElementView(s,r));break;case vC(s):this.doc.c4Views.push(this.parseDynamicElementView(s,r));break;case yC(s):this.doc.c4Views.push(this.parseDeploymentView(s));break;default:Oe(s)}if(i){const o=this.doc.c4Views.at(-1);o.title=i+" / "+(o.title||o.id)}}catch(o){De(o)}}}parseElementView(e,n){const r=e.body;Ae(r,"ElementView body is not defined");const i=this.getAstNodePath(e);let s=null;if("viewOf"in e){
|
|
2141
2142
|
const p=ko(e.viewOf),m=p&&this.resolveFqn(p);m?s=m:st.warn("viewOf is not resolved: "+e.$cstNode?.text)}let o=e.name;o||(o="view_"+Nd(this.doc.uri.toString(),i,s??""));const{title:a=null,description:u=null}=this.parseTitleDescriptionTechnology({},Le(r.props,Pe(p=>this.isValid(p)),Pe(Bh),fr(p=>[p.key,p.value]))),c=this.convertTags(r),l=this.convertLinks(r),f=Fw(e),d={[dn._type]:"element",id:o,astPath:i,title:a,description:u,tags:c,links:Gn(l)?l:null,rules:[...n,...r.rules.flatMap(p=>{try{return this.
|
|
2142
|
-
isValid(p)?this.parseElementViewRule(p):[]}catch(m){return De(m),[]}})],...s&&{viewOf:s},...f&&{manualLayout:f}};if(
|
|
2143
|
-
return this.parseViewRuleGroup(e);Oe(e)}parseViewRulePredicate(e){const n=[];let r=e.exprs;for(;r;){const{value:i,prev:s}=r;try{if(de(i)&&this.isValid(i)){const o=this.parsePredicate(i);n.unshift(o)}}catch(o){De(o)}if(!s)break;r=s}return e.isInclude?{include:n}:{exclude:n}}parseViewRuleGlobalPredicateRef(e){return{predicateId:e.predicate.$refText}}parseViewRuleStyleOrGlobalRef(e){if(Ia(e))return this.parseViewRuleStyle(e);if(
|
|
2144
|
-
const n=[];for(const r of e.groupRules)try{if(!this.isValid(r))continue;if(cd(r)){n.push(this.parseViewRulePredicate(r));continue}if(ad(r)){n.push(this.parseViewRuleGroup(r));continue}Oe(r)}catch(i){De(i)}return{title:Pw(e.title)??null,groupRules:n,...this.parseStyleProps(e.props)}}parseViewRuleStyle(e){const n=this.parseFqnExpressions(e.targets).filter(s=>dn.ModelExpression.isFqnExpr(s)),r=this.parseStyleProps(e.props.filter(
|
|
2145
|
-
{notation:i}}}parseViewRuleGlobalStyle(e){return{styleId:e.style.$refText}}parseDynamicElementView(e,n){const r=e.body;Ae(r,"DynamicElementView body is not defined");const i=this.isValid,s=r.props.filter(i),o=this.getAstNodePath(e);let a=e.name;a||(a="dynamic_"+Nd(this.doc.uri.toString(),o));const{title:u=null,description:c=null}=this.parseTitleDescriptionTechnology({},Le(s,Pe(Bh),fr(p=>[p.key,p.value]))),l=this.convertTags(r),f=this.convertLinks(r);
|
|
2146
|
-
dynamic",id:a,astPath:o,title:u,description:c,tags:l,links:Gn(f)?f:null,rules:[...n,...r.rules.flatMap(p=>{try{return i(p)?this.parseDynamicViewRule(p):[]}catch(m){return De(m),[]}},[])],steps:r.steps.reduce((p,m)=>{try{i(m)&&(
|
|
2143
|
+
isValid(p)?this.parseElementViewRule(p):[]}catch(m){return De(m),[]}})],...s&&{viewOf:s},...f&&{manualLayout:f}};if(Vh.writeId(e,d.id),"extends"in e){const p=e.extends.view.ref;return Ae(p?.name,"view extends is not resolved: "+e.$cstNode?.text),Object.assign(d,{extends:p.name})}return d}parseElementViewRule(e){if(cd(e))return this.parseViewRulePredicate(e);if(Mv(e))return this.parseViewRuleGlobalPredicateRef(e);if(gv(e))return this.parseViewRuleStyleOrGlobalRef(e);if(rd(e))return Qv(e);if(ad(e))
|
|
2144
|
+
return this.parseViewRuleGroup(e);Oe(e)}parseViewRulePredicate(e){const n=[];let r=e.exprs;for(;r;){const{value:i,prev:s}=r;try{if(de(i)&&this.isValid(i)){const o=this.parsePredicate(i);n.unshift(o)}}catch(o){De(o)}if(!s)break;r=s}return e.isInclude?{include:n}:{exclude:n}}parseViewRuleGlobalPredicateRef(e){return{predicateId:e.predicate.$refText}}parseViewRuleStyleOrGlobalRef(e){if(Ia(e))return this.parseViewRuleStyle(e);if(Bv(e))return this.parseViewRuleGlobalStyle(e);Oe(e)}parseViewRuleGroup(e){
|
|
2145
|
+
const n=[];for(const r of e.groupRules)try{if(!this.isValid(r))continue;if(cd(r)){n.push(this.parseViewRulePredicate(r));continue}if(ad(r)){n.push(this.parseViewRuleGroup(r));continue}Oe(r)}catch(i){De(i)}return{title:Pw(e.title)??null,groupRules:n,...this.parseStyleProps(e.props)}}parseViewRuleStyle(e){const n=this.parseFqnExpressions(e.targets).filter(s=>dn.ModelExpression.isFqnExpr(s)),r=this.parseStyleProps(e.props.filter(mv)),i=gn(ti(e.props.find(ka)?.value));return{targets:n,style:r,...i&&
|
|
2146
|
+
{notation:i}}}parseViewRuleGlobalStyle(e){return{styleId:e.style.$refText}}parseDynamicElementView(e,n){const r=e.body;Ae(r,"DynamicElementView body is not defined");const i=this.isValid,s=r.props.filter(i),o=this.getAstNodePath(e);let a=e.name;a||(a="dynamic_"+Nd(this.doc.uri.toString(),o));const{title:u=null,description:c=null}=this.parseTitleDescriptionTechnology({},Le(s,Pe(Bh),fr(p=>[p.key,p.value]))),l=this.convertTags(r),f=this.convertLinks(r);Vh.writeId(e,a);const d=Fw(e);return{[dn._type]:"\
|
|
2147
|
+
dynamic",id:a,astPath:o,title:u,description:c,tags:l,links:Gn(f)?f:null,rules:[...n,...r.rules.flatMap(p=>{try{return i(p)?this.parseDynamicViewRule(p):[]}catch(m){return De(m),[]}},[])],steps:r.steps.reduce((p,m)=>{try{i(m)&&(vv(m)?p.push(this.parseDynamicParallelSteps(m)):p.push(this.parseDynamicStep(m)))}catch(w){De(w)}return p},[]),...d&&{manualLayout:d}}}parseDynamicViewRule(e){if(EC(e))return this.parseDynamicViewIncludePredicate(e);if(bC(e))return this.parseViewRuleGlobalPredicateRef(e);if(gv(
|
|
2147
2148
|
e))return this.parseViewRuleStyleOrGlobalRef(e);if(rd(e))return Qv(e);Oe(e)}parseDynamicViewIncludePredicate(e){const n=[];let r=e.exprs;for(;r;){try{if(Qr(r.value)&&this.isValid(r.value)&&lC(r.value)){const i=this.parseElementPredicate(r.value);n.unshift(i)}}catch(i){De(i)}r=r.prev}return{include:n}}parseDynamicParallelSteps(e){return{__parallel:e.steps.map(n=>this.parseDynamicStep(n))}}parseDynamicStep(e){const n=ko(e.source);if(!n)throw new Error("Invalid reference to source");const r=ko(e.target);
|
|
2148
|
-
if(!r)throw new Error("Invalid reference to target");let i=this.resolveFqn(n),s=this.resolveFqn(r);const o=gn(e.title)??null;let a={source:i,target:s,title:o};if(e.isBackward&&(a={source:s,target:i,title:o,isBackward:!0}),!zD(e.custom?.props))return a;for(const u of e.custom.props)try{switch(!0){case Wl(u):{const c=u.value.view.ref?.name;de(c)&&(a.navigateTo=c);break}case Hl(u):case ka(u):{an(u.value)&&(a[u.key]=gn(ti(u.value))??"");break}case
|
|
2149
|
+
if(!r)throw new Error("Invalid reference to target");let i=this.resolveFqn(n),s=this.resolveFqn(r);const o=gn(e.title)??null;let a={source:i,target:s,title:o};if(e.isBackward&&(a={source:s,target:i,title:o,isBackward:!0}),!zD(e.custom?.props))return a;for(const u of e.custom.props)try{switch(!0){case Wl(u):{const c=u.value.view.ref?.name;de(c)&&(a.navigateTo=c);break}case Hl(u):case ka(u):{an(u.value)&&(a[u.key]=gn(ti(u.value))??"");break}case _v(u):{an(u.value)&&(a[u.key]=gn(u.value));break}case el(
|
|
2149
2150
|
u):{an(u.value)&&(a[u.key]=u.value);break}case vo(u):{const c=Pd(u);an(c)&&(a[u.key]=c);break}case Sl(u):{an(u.value)&&(a[u.key]=u.value);break}default:Oe(u)}}catch(c){De(c)}return a}}}const p5=Le(c9,i5,o5,c5,d9,r5,l5,d5,f5,s5);class h5 extends p5{}const Mw=st.getChild("ModelParser");class m5{constructor(e){this.services=e,e.shared.workspace.DocumentBuilder.onDocumentPhase(qe.Linked,n=>{try{$d(n.uri)||this.cachedParsers.set(n,this.createParser(n))}catch(r){Mw.warn(Un(r))}}),e.shared.workspace.DocumentBuilder.
|
|
2150
2151
|
onDocumentPhase(qe.Validated,n=>{n.diagnostics?.some(r=>r.severity===Ws.Error)&&this.cachedParsers.delete(n)})}cachedParsers=new ob(e=>this.createParser(e));documents(e){return this.services.shared.workspace.LangiumDocuments.projectDocuments(e).map(n=>this.parse(n))}parse(e){try{return this.forDocument(e).doc}catch(n){throw new Error(`Error parsing document ${e.uri.toString()}`,{cause:n})}}forDocument(e){return e.state<qe.Linked&&Mw.warn(`Document ${e.uri.toString()} is not linked`),this.cachedParsers.
|
|
2151
|
-
get(e)}createParser(e){const n={c4Specification:{tags:{},elements:{},relationships:{},colors:{},deployments:{}},c4Elements:[],c4ExtendElements:[],c4ExtendDeployments:[],c4Relations:[],c4Deployments:[],c4DeploymentRelations:[],c4Globals:{predicates:{},dynamicPredicates:{},styles:{}},c4Views:[],c4Imports:new
|
|
2152
|
-
Error parsing document ${e.uri.toString()}`,{cause:i})}return r}}class g5 extends tD{runConverter(e,n,r){return e.name==="MarkdownString"?((n.startsWith('"""')&&n.endsWith('"""')||n.startsWith("'''")&&n.endsWith("'''"))&&(n=n.slice(3,-3)),Vr.convertString(n)):super.runConverter(e,n,r)}}const{findNodeForKeyword:y5}=
|
|
2152
|
+
get(e)}createParser(e){const n={c4Specification:{tags:{},elements:{},relationships:{},colors:{},deployments:{}},c4Elements:[],c4ExtendElements:[],c4ExtendDeployments:[],c4Relations:[],c4Deployments:[],c4DeploymentRelations:[],c4Globals:{predicates:{},dynamicPredicates:{},styles:{}},c4Views:[],c4Imports:new xn(Set)};e=Object.assign(e,n);const r=new h5(this.services,e);try{r.parseSpecification(),r.parseImports(),r.parseModel(),r.parseGlobals(),r.parseDeployment(),r.parseViews()}catch(i){Mw.error(`\
|
|
2153
|
+
Error parsing document ${e.uri.toString()}`,{cause:i})}return r}}class g5 extends tD{runConverter(e,n,r){return e.name==="MarkdownString"?((n.startsWith('"""')&&n.endsWith('"""')||n.startsWith("'''")&&n.endsWith("'''"))&&(n=n.slice(3,-3)),Vr.convertString(n)):super.runConverter(e,n,r)}}const{findNodeForKeyword:y5}=cg,v5=(t,e,n=0)=>{const r=n>0?" ".repeat(n):"";return[r+`style ${t} {`,...cc(e).map(([i,s])=>r+` ${i} ${i==="opacity"?s.toString()+"%":s}`),r+"}"]},w5=(t,e)=>n=>{if(!Ia(n)&&!ol(n))return!1;
|
|
2153
2154
|
const r=n.targets.value;if(!r||de(n.targets.prev)||r.$type!=="FqnRefExpr"||de(r.selector))return!1;const i=r.ref?.value?.ref;return(i?e.resolve(i):null)===t};function b5(t,{view:e,viewAst:n,targets:r,style:i}){Ae(n.body,`View ${e.id} has no body`);const s=n.$cstNode;Ae(s,"viewCstNode");const o=ac(n.body.rules)?.$cstNode?.range.end??n.body.$cstNode?.range.end;Ae(o,"insertPos is not defined");const a=s.range.start.character+2,u=t.likec4.FqnIndex,c=Pe(n.body.rules,y=>Ia(y)||ol(y)),l=e[wx]==="elemen\
|
|
2154
|
-
t"?e.viewOf??null:null,f=[],d=[];r.forEach(y=>{const g=JD(c,w5(y,u)),b=l&&
|
|
2155
|
-
push(
|
|
2155
|
+
t"?e.viewOf??null:null,f=[],d=[];r.forEach(y=>{const g=JD(c,w5(y,u)),b=l&&ym(l,y)?y.substring(l.length+1):y;g?f.push({fqn:b,rule:g}):d.push({fqn:b})});const p={start:o,end:o},m=y=>{y.start.line<=p.start.line&&(y.start.line==p.start.line?p.start.character=Math.min(y.start.character,p.start.character):p.start=y.start),y.end.line>=p.end.line&&(y.end.line==p.end.line?p.end.character=Math.max(y.end.character,p.end.character):p.end=y.end)},w=[];if(d.length>0){const y=d.flatMap(({fqn:g})=>v5(g,i,a));w.
|
|
2156
|
+
push(Mn.insert(o,`
|
|
2156
2157
|
`+y.join(`
|
|
2157
|
-
`))),p.start={line:o.line+1,character:a},p.end={line:o.line+y.length,character:ac(y)?.length??0}}if(f.length>0)for(const{rule:y}of f){const g=y.$cstNode;Ae(g,"RuleCstNode not found");for(const[b,R]of cc(i)){const A=b==="opacity"?R.toString()+"%":R,N=y.props.find(ie=>ie.key===b);if(N&&N.$cstNode){const{range:{start:ie,end:we}}=N.$cstNode;m({start:ie,end:we}),w.push(
|
|
2158
|
-
start.character),se=J+b+" "+A;w.push(
|
|
2159
|
-
`+se)),m({start:{line:V.line+1,character:J.length},end:{line:V.line+1,character:se.length}})}}return{modifiedRange:p,edits:w}}const{findNodeForKeyword:E5}=
|
|
2158
|
+
`))),p.start={line:o.line+1,character:a},p.end={line:o.line+y.length,character:ac(y)?.length??0}}if(f.length>0)for(const{rule:y}of f){const g=y.$cstNode;Ae(g,"RuleCstNode not found");for(const[b,R]of cc(i)){const A=b==="opacity"?R.toString()+"%":R,N=y.props.find(ie=>ie.key===b);if(N&&N.$cstNode){const{range:{start:ie,end:we}}=N.$cstNode;m({start:ie,end:we}),w.push(Mn.replace({start:ie,end:we},b+" "+A));continue}const V=y5(g,"{")?.range.end;Ae(V,"Opening brace not found");const J=" ".repeat(2+g.range.
|
|
2159
|
+
start.character),se=J+b+" "+A;w.push(Mn.insert(V,`
|
|
2160
|
+
`+se)),m({start:{line:V.line+1,character:J.length},end:{line:V.line+1,character:se.length}})}}return{modifiedRange:p,edits:w}}const{findNodeForKeyword:E5}=cg;function $5(t,{view:e,viewAst:n,layout:r}){Ae(n.body,`View ${e.id} has no body`);const i=n.$cstNode;Ae(i,"viewCstNode");const s=cW(r.direction),o=JD(n.body.rules,rd);let a=`autoLayout ${s}`;if(Jr(r.rankSep)&&(a+=` ${r.rankSep}`,Jr(r.nodeSep)&&(a+=` ${r.nodeSep}`)),o&&o.$cstNode)return Mn.replace(o.$cstNode.range,a);const u=E5(n.body.$cstNode,
|
|
2160
2161
|
"}")?.range.start;Ae(u,"Closing brace not found");const c=` ${a}
|
|
2161
|
-
`;return
|
|
2162
|
-
0)return t;const s=i?/^/gm:/^(?!\s*$)/gm;return t.replace(s,r.repeat(e))}function D5(t,{viewAst:e,layout:n}){Ae(e.$cstNode,"invalid view.$cstNode");const r=of(e.$cstNode,["BLOCK_COMMENT"]);let i=t5(n);return e.$cstNode.range.start.character>0&&(i=R5(i,e.$cstNode.range.start.character)),r?
|
|
2162
|
+
`;return Mn.insert(u,c)}function R5(t,e=1,n={}){const{indent:r=" ",includeEmptyLines:i=!1}=n;if(typeof t!="string")throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof t}\``);if(typeof e!="number")throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof e}\``);if(e<0)throw new RangeError(`Expected \`count\` to be at least 0, got \`${e}\``);if(typeof r!="string")throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof r}\``);if(e===
|
|
2163
|
+
0)return t;const s=i?/^/gm:/^(?!\s*$)/gm;return t.replace(s,r.repeat(e))}function D5(t,{viewAst:e,layout:n}){Ae(e.$cstNode,"invalid view.$cstNode");const r=of(e.$cstNode,["BLOCK_COMMENT"]);let i=t5(n);return e.$cstNode.range.start.character>0&&(i=R5(i,e.$cstNode.range.start.character)),r?Mn.replace(r.range,i.trimStart()):Mn.insert({line:e.$cstNode.range.start.line,character:0},i+`
|
|
2163
2164
|
`)}class k5{constructor(e){this.services=e,this.locator=e.likec4.ModelLocator}locator;async applyChange(e){const n=this.services.shared.lsp.Connection;Ae(n,"LSP Connection not available");let r=null;try{await this.services.shared.workspace.WorkspaceLock.write(async()=>{const{doc:i,edits:s,modifiedRange:o}=this.convertToTextEdit(e),a={uri:i.textDocument.uri,version:i.textDocument.version};if(!s.length)return;const u=await n.workspace.applyEdit({label:`LikeC4 - change view ${e.viewId}`,edit:{changes:{
|
|
2164
2165
|
[a.uri]:s}}});if(!u.applied){n.window.showErrorMessage(`Failed to apply changes ${u.failureReason}`);return}r={uri:a.uri,range:o}})}catch(i){Wn.error(`Failed to apply change ${e.change.op} ${e.viewId}`,{error:i})}return r}convertToTextEdit({viewId:e,projectId:n,change:r}){const i=this.locator.locateViewAst(e,n);if(!i)throw new Error(`LikeC4ModelChanges: view not found: ${e}`);switch(r.op){case"change-element-style":return{doc:i.doc,...b5(this.services,{...i,targets:r.targets,style:r.style})};case"\
|
|
2165
2166
|
change-autolayout":{const o=$5(this.services,{...i,layout:r.layout});return{doc:i.doc,modifiedRange:o.range,edits:[o]}}case"save-manual-layout":const s=D5(this.services,{...i,layout:r.layout});return{doc:i.doc,modifiedRange:s.range,edits:[s]};default:Oe(r)}}}class T5 extends dD{constructor(e){super(),this.services=e}getNameStrict(e){return xt(this.getName(e),`Failed getName for ${this.services.workspace.AstNodeLocator.getAstNodePath(e)}`)}getName(e){if(Ep(e))return e.name;if(Zr(e))return e.imported.
|
|
2166
|
-
$refText;if(
|
|
2167
|
+
$refText;if(jn(e))return e.target.modelElement.value.$refText}getNameNode(e){if(Ep(e))return super.getNameNode(e);if(Zr(e))return e.imported.$refNode;if(jn(e))return e.target.modelElement.value.$refNode}}function C5(t){return Le(t,ca(e=>`${e.type}.${e.name}`),cc(),Cr(([e,n])=>n.length===1?n:[]))}class A5 extends pD{constructor(e){super(e)}async computeExports(e,n){const r=[];try{const{specifications:i,models:s,views:o,globals:a,likec4lib:u,deployments:c,imports:l}=e.parseResult.value;this.exportLibrary(
|
|
2167
2168
|
u,r,e),this.exportSpecification(i,r,e),this.exportModel(s,r,e),this.exportViews(o,r,e),this.exportGlobals(a,r,e),this.exportDeployments(c,r,e)}catch(i){De(i)}return r}exportViews(e,n,r){const i=e?.flatMap(s=>s.views);if(!(Et(i)||i.length===0))for(const s of i)try{de(s.name)&&n.push(this.descriptions.createDescription(s,s.name,r))}catch(o){De(o)}}exportGlobals(e,n,r){if(!(Et(e)||e.length===0)){for(const i of e.flatMap(s=>s.predicates))try{const s=i;de(s.name)&&n.push(this.descriptions.createDescription(
|
|
2168
2169
|
s,s.name,r))}catch(s){De(s)}for(const i of e.flatMap(s=>s.styles))try{const s=i.id;de(s.name)&&n.push(this.descriptions.createDescription(s,s.name,r))}catch(s){De(s)}}}exportModel(e,n,r){if(!(Et(e)||e.length===0))for(const i of e.flatMap(s=>s.elements))try{cn(i)&&de(i.name)&&n.push(this.descriptions.createDescription(i,i.name,r))}catch(s){De(s)}}exportLibrary(e,n,r){if(!Et(e))try{for(const i of e.flatMap(s=>s.icons))n.push(this.descriptions.createDescription(i,i.name,r))}catch(i){De(i)}}exportSpecification(e,n,r){
|
|
2169
2170
|
if(!(Et(e)||e.length===0))for(const i of e.flatMap(s=>[...s.elements,...s.relationships,...s.deploymentNodes,...s.tags,...s.colors]))try{switch(!0){case Ca(i):case Sa(i):{de(i.kind.name)&&n.push(this.descriptions.createDescription(i.kind,i.kind.name,r));continue}case Zl(i):{de(i.tag.name)&&n.push(this.descriptions.createDescription(i.tag,i.tag.name,r));continue}case xa(i):{de(i.kind.name)&&n.push(this.descriptions.createDescription(i.kind,i.kind.name,r));continue}case Ih(i):{de(i.name.name)&&n.push(
|
|
@@ -2171,12 +2172,12 @@ this.descriptions.createDescription(i.name,i.name.name,r));continue}default:Oe(i
|
|
|
2171
2172
|
s.push(...this.processDeployments(a,o,e))}catch(u){De(u)}for(const a of i.imports.flatMap(u=>u.imports))try{let u=a;for(;u;)s.push(this.descriptions.createDescription(u,u.imported.$refText,e)),u=u.prev}catch(u){De(u)}C5(s).forEach(a=>{o.add(i,a)}),r(o)})}processContainer(e,n,r){const i=new Xs,s=[];for(const a of e.elements){if(ei(a))continue;let u;if(cn(a)?(de(a.name)&&i.add(a.name,this.descriptions.createDescription(a,a.name,r)),u=a.body,u&&(n.add(u,this.descriptions.createDescription(a,"this",
|
|
2172
2173
|
r)),n.add(u,this.descriptions.createDescription(a,"it",r)))):Eo(a)&&(u=a.body),u&&u.elements.length>0)try{s.push(...this.processContainer(u,n,r))}catch(c){De(c)}}s.length&&Le(s,Pe(a=>!i.has(a.name)),ca(a=>a.name),VD((a,u)=>{a.length===1&&i.add(u,a[0])}));const o=[...i.values()];return n.addAll(e,o),o}processDeployments(e,n,r){const i=new Xs,s=[];for(const a of e.elements){if(xr(a))continue;let u=a.body;if(!os(a)){let c=this.nameProvider.getName(a);if(de(c)){const l=this.descriptions.createDescription(
|
|
2173
2174
|
a,c,r);i.add(c,l)}u&&(n.add(u,this.descriptions.createDescription(a,"this",r)),n.add(u,this.descriptions.createDescription(a,"it",r)))}if(u)try{s.push(...this.processDeployments(u,n,r))}catch(c){De(c)}}s.length&&Le(s,Pe(a=>!i.has(a.name)),ca(a=>a.name),VD((a,u)=>{a.length===1&&i.add(u,a[0])}));const o=[...i.values()];return n.addAll(e,o),o}}const{getDocument:e_}=Wo;class S5 extends gD{deploymentsIndex;fqnIndex;indexManager;constructor(e){super(e),this.indexManager=e.shared.workspace.IndexManager,
|
|
2174
|
-
this.fqnIndex=e.likec4.FqnIndex,this.deploymentsIndex=e.likec4.DeploymentsIndex}getScope(e){try{const n=Bt(e.container),r=this.reflection.getReferenceType(e);try{const i=e.container;if(TC(i))return new Ys(this.streamForFqnRef(n,i,e));if(LC(i))return this.getScopeForStrictFqnRef(n,i,e);if(r!==Zn)return this.getProjectScope(n,r,e);if(Zr(i)){const s=Bt(i);return new Ys(this.fqnIndex.rootElements(s))}if(
|
|
2175
|
+
this.fqnIndex=e.likec4.FqnIndex,this.deploymentsIndex=e.likec4.DeploymentsIndex}getScope(e){try{const n=Bt(e.container),r=this.reflection.getReferenceType(e);try{const i=e.container;if(TC(i))return new Ys(this.streamForFqnRef(n,i,e));if(LC(i))return this.getScopeForStrictFqnRef(n,i,e);if(r!==Zn)return this.getProjectScope(n,r,e);if(Zr(i)){const s=Bt(i);return new Ys(this.fqnIndex.rootElements(s))}if(Ov(i)&&e.property==="el"){const s=i.parent;return s?new Ys(this.fqnIndex.directChildrenOf(n,To(s))):
|
|
2175
2176
|
this.getProjectScope(n,r,e)}return new Ys(Ve(this.computeScope(n,e)))}catch(i){return De(i),this.getProjectScope(n,r,e)}}catch(n){return De(n),Vj}}*genUniqueDescedants(e){const n=e();if(!n)return;const r=Bt(n);if(cn(n)){const i=this.fqnIndex.getFqn(n);yield*this.fqnIndex.uniqueDescedants(r,i);return}if(Cn(n)){const i=this.deploymentsIndex.getFqn(n);yield*this.deploymentsIndex.uniqueDescedants(r,i)}}*genScopeExtendElement({element:e}){e.el.$nodeDescription&&(yield e.el.$nodeDescription),yield*this.
|
|
2176
2177
|
genUniqueDescedants(()=>ko(e))}*genScopeElementView({viewOf:e,extends:n}){if(e){e.modelElement.value.$nodeDescription&&(yield e.modelElement.value.$nodeDescription),yield*this.genUniqueDescedants(()=>ko(e));return}if(n){const r=n.view.ref;r&&(yield*this.genScopeElementView(r))}}getScopeForStrictFqnRef(e,n,r){const i=n.parent;return i?new Ys(this.deploymentsIndex.directChildrenOf(e,To(i)).filter(s=>this.reflection.isSubtype(s.type,_r))):this.getProjectScope(e,_r,r)}*genScopeExtendDeployment({deploymentNode:e}){
|
|
2177
|
-
e.value.$nodeDescription&&(yield e.value.$nodeDescription),yield*this.genUniqueDescedants(()=>{const n=e.value.ref;return n&&Cn(n)?n:void 0})}streamForFqnRef(e,n,r){const i=n.parent;if(!i)return Ve(this.genScopeForParentlessFqnRef(e,n,r));const s=i.value.ref;return s?Zr(s)?Ve(this.genUniqueDescedants(()=>s.imported.ref)):Cn(s)?Ve(this.genUniqueDescedants(()=>s)):
|
|
2178
|
-
genUniqueDescedants(()=>s)):Oe(s):Ja}*genScopeForParentlessFqnRef(e,n,r){Gr(n,
|
|
2179
|
-
reflection.isSubtype(r,Zn),s=this.reflection.isSubtype(r,Np),o=e_(n.container).precomputedScopes;if(!o){yield*this.getProjectScope(e,r,n).getAllElements();return}const a=c=>this.reflection.isSubtype(c.type,r);let u=n.container;for(;u;){const c=o.get(u).filter(a);c.length>0&&(yield*c),s
|
|
2178
|
+
e.value.$nodeDescription&&(yield e.value.$nodeDescription),yield*this.genUniqueDescedants(()=>{const n=e.value.ref;return n&&Cn(n)?n:void 0})}streamForFqnRef(e,n,r){const i=n.parent;if(!i)return Ve(this.genScopeForParentlessFqnRef(e,n,r));const s=i.value.ref;return s?Zr(s)?Ve(this.genUniqueDescedants(()=>s.imported.ref)):Cn(s)?Ve(this.genUniqueDescedants(()=>s)):jn(s)?Ve(this.genUniqueDescedants(()=>{const o=s.target.modelElement.value.ref;return Zr(o)?o.imported.ref:cn(o)?o:void 0})):cn(s)?Ve(this.
|
|
2179
|
+
genUniqueDescedants(()=>s)):Oe(s):Ja}*genScopeForParentlessFqnRef(e,n,r){Gr(n,bv)||dW(n)?yield*this.computeScope(e,r,Zn):lW(n)?(yield*this.computeScope(e,r,Zn),yield*this.computeScope(e,r,_r),yield*this.computeScope(e,r,_i)):(yield*this.computeScope(e,r,_r),yield*this.computeScope(e,r,_i),Gr(n,yv)&&(yield*this.computeScope(e,r,Zn)));const i=e_(n).precomputedScopes;i&&(yield*i.values().filter(s=>this.reflection.isSubtype(s.type,us)))}*computeScope(e,n,r=this.reflection.getReferenceType(n)){const i=this.
|
|
2180
|
+
reflection.isSubtype(r,Zn),s=this.reflection.isSubtype(r,Np),o=e_(n.container).precomputedScopes;if(!o){yield*this.getProjectScope(e,r,n).getAllElements();return}const a=c=>this.reflection.isSubtype(c.type,r);let u=n.container;for(;u;){const c=o.get(u).filter(a);c.length>0&&(yield*c),s&&Rv(u)&&(yield*this.genScopeExtendDeployment(u.$container)),i&&Dv(u)&&(yield*this.genScopeExtendElement(u.$container)),i&&Ev(u)&&(yield*this.genScopeElementView(u.$container)),u=u.$container}yield*this.getProjectScope(
|
|
2180
2181
|
e,r,n).getAllElements()}getProjectScope(e,n,r){return n===Ni?super.getGlobalScope(n,r):this.globalScopeCache.get(`${e}::${n}`,()=>new hD(this.indexManager.projectElements(e,n)))}getGlobalScope(e,n){if(e===Ni)return super.getGlobalScope(e,n);const r=Bt(n.container);return this.getProjectScope(r,e,n)}}var t_;(t=>t.type=new ce.NotificationType("likec4/onDidChangeModel"))(t_||={});var n_;(t=>t.type=new ce.NotificationType("likec4/onRequestOpenView"))(n_||={});var r_;(t=>t.req=new ce.RequestType("lik\
|
|
2181
2182
|
ec4/fetchComputedModel"))(r_||={});var i_;(t=>t.req=new ce.RequestType0("likec4/fetchViewsFromAllProjects"))(i_||={});var s_;(t=>t.req=new ce.RequestType("likec4/computeView"))(s_||={});var o_;(t=>t.req=new ce.RequestType("likec4/fetchLayoutedModel"))(o_||={});var a_;(t=>t.req=new ce.RequestType("likec4/layout-view"))(a_||={});var u_;(t=>t.Req=new ce.RequestType("likec4/validate-layout"))(u_||={});var c_;(t=>t.req=new ce.RequestType0("likec4/fetch-projects"))(c_||={});var l_;(t=>t.Req=new ce.RequestType(
|
|
2182
2183
|
"likec4/build"))(l_||={});var d_;(t=>t.Req=new ce.RequestType("likec4/locate"))(d_||={});var f_;(t=>t.Req=new ce.RequestType("likec4/change-view"))(f_||={});var p_;(t=>t.req=new ce.RequestType0("likec4/metrics"))(p_||={});var h_;(t=>t.req=new ce.RequestType("likec4/document-tags"))(h_||={});const tr=st.getChild("rpc");class _5 extends tw{constructor(e){super(),this.services=e}init(){const e=this.services.likec4.ModelBuilder,n=this.services.likec4.ModelLocator,r=this.services.likec4.ModelChanges,
|
|
@@ -2184,7 +2185,7 @@ i=this.services.likec4.Views,s=this.services.shared.lsp.Connection,o=this.servic
|
|
|
2184
2185
|
triggerAt:"end",minQuietPeriodMs:100,maxBurstDurationMs:500,minGapMs:300});let l=!0;this.onDispose(e.onModelParsed(()=>c.call()),s.onRequest(r_.req,async({projectId:d,cleanCaches:p},m)=>{if(tr.debug`received request ${"fetchComputedModel"} for project ${d}`,p){const y=(d?a.projectDocuments(d):a.all).map(g=>g.uri).toArray();await u.update(y,[],m)}const w=await e.buildLikeC4Model(d,m);return w!==xs.EMPTY?{model:w.$model}:{model:null}}),s.onRequest(s_.req,async({viewId:d,projectId:p},m)=>({view:await e.
|
|
2185
2186
|
computeView(d,p,m)})),s.onRequest(o_.req,async({projectId:d},p)=>{const m=await e.parseModel(d,p);if(m===null)return{model:null};const w=await i.diagrams(d,p);return{model:{...m.$data,_stage:"layouted",views:uc(w,y=>y.id)}}}),s.onRequest(a_.req,async({viewId:d,projectId:p},m)=>(tr.debug`received request ${"layoutView"} of ${d} from project ${p}`,{result:await i.layoutView(d,p,m)})),s.onRequest(u_.Req,async({projectId:d},p)=>{const m=await i.layoutAllViews(d,p);return{result:f(m.map(w=>w.diagram))}}),
|
|
2186
2187
|
s.onRequest(c_.req,async d=>{tr.debug`received request ${"FetchProjects"}`;const p=a.groupedByProject();return{projects:Ss(p,m=>bt(m,w=>w.uri.toString()))}}),s.onRequest(i_.req,async d=>{tr.debug`received request ${"FetchViewsFromAllProjects"}`;const p=o.all.map(async w=>{const y=await i.computedViews(w,d);return Le(y,bt(g=>({id:g.id,title:g.title??g.id,projectId:w})),oc((g,b)=>g.id==="index"?-1:b.id==="index"?1:g.title.localeCompare(b.title)))}),m=await Promise.allSettled(p);return await jt(d),
|
|
2187
|
-
{views:Le(m,Pe(w=>w.status==="fulfilled"),Cr(w=>w.value))}}),s.onRequest(l_.Req,async({docs:d},p)=>{const m=d.map(g=>
|
|
2188
|
+
{views:Le(m,Pe(w=>w.status==="fulfilled"),Cr(w=>w.value))}}),s.onRequest(l_.Req,async({docs:d},p)=>{const m=d.map(g=>dt.parse(g)),w=g=>m.every(b=>!ct.equals(b,g)),y=a.allExcludingBuiltin.toArray().filter(g=>w(g.uri)).map(g=>g.uri);tr.debug(`[ServerRpc] received request to build:
|
|
2188
2189
|
changed (total ${m.length}):${d.map(g=>`
|
|
2189
2190
|
- `+g).join("")}
|
|
2190
2191
|
deleted (total ${y.length}):${y.map(g=>`
|
|
@@ -2192,15 +2193,15 @@ s.onRequest(c_.req,async d=>{tr.debug`received request ${"FetchProjects"}`;const
|
|
|
2192
2193
|
`)}`),!l&&m.length+y.length>0&&await Promise.allSettled([...m,...y].map(async g=>{const b=g.toString();tr.debug(`clear diagnostics for ${b}`);try{await s.sendDiagnostics({uri:b,diagnostics:[]})}catch(R){tr.warn(`error clearing diagnostics for ${b}: ${R}`)}})),l=!1,await jt(p),await u.update(m,y,p)}),s.onRequest(d_.Req,d=>{switch(!0){case"element"in d:return n.locateElement(d.element,d.projectId);case"relation"in d:return n.locateRelation(d.relation,d.projectId);case"view"in d:return n.locateView(
|
|
2193
2194
|
d.view,d.projectId);case"deployment"in d:return n.locateDeploymentElement(d.deployment,d.projectId);default:Oe(d)}}),s.onRequest(f_.Req,async(d,p)=>(tr.debug`received request ${"changeView"} of ${d.viewId} from project ${d.projectId}`,await r.applyChange(d))),s.onRequest(p_.req,async d=>{const p=[...o.all].map(async y=>{const g=await e.buildLikeC4Model(y,d);return g===xs.EMPTY?Promise.reject(new Error("Model is empty")):{elementKinds:Yr(g.specification.elements).length,deploymentKinds:Yr(g.specification.
|
|
2194
2195
|
deployments).length,relationshipKinds:Yr(g.specification.relationships).length,tags:Yr(g.specification.tags).length,customColors:Yr(g.specification.customColors??{}).length,elements:Yr(g.$data.elements).length,deploymentNodes:[...g.deployment.nodes()].length,relationships:Yr(g.$data.relations).length,views:Yr(g.$data.views).length,projects:1}}),m=await Promise.allSettled(p);await jt(d);const w=m.filter(y=>y.status==="fulfilled").map(y=>y.value);return{metrics:w.length>0?w.reduce((y,g)=>({elementKinds:y.
|
|
2195
|
-
elementKinds+g.elementKinds,deploymentKinds:y.deploymentKinds+g.deploymentKinds,relationshipKinds:y.relationshipKinds+g.relationshipKinds,tags:y.tags+g.tags,customColors:y.customColors+g.customColors,elements:y.elements+g.elements,deploymentNodes:y.deploymentNodes+g.deploymentNodes,relationships:y.relationships+g.relationships,views:y.views+g.views,projects:y.projects+1})):null}}),s.onRequest(h_.req,async({documentUri:d},p)=>({tags:await n.locateDocumentTags(
|
|
2196
|
+
elementKinds+g.elementKinds,deploymentKinds:y.deploymentKinds+g.deploymentKinds,relationshipKinds:y.relationshipKinds+g.relationshipKinds,tags:y.tags+g.tags,customColors:y.customColors+g.customColors,elements:y.elements+g.elements,deploymentNodes:y.deploymentNodes+g.deploymentNodes,relationships:y.relationships+g.relationships,views:y.views+g.views,projects:y.projects+1})):null}}),s.onRequest(h_.req,async({documentUri:d},p)=>({tags:await n.locateDocumentTags(dt.parse(d),p)})),Js.create(()=>{c.cancel()}));
|
|
2196
2197
|
function f(d){return Le(d,Pe(p=>!!p.hasLayoutDrift),bt(p=>({uri:n.locateView(p.id).uri,viewId:p.id,severity:ce.DiagnosticSeverity.Warning,message:`Layout drift detected for view '${p.id}'`,range:n.locateView(p.id).range})))}}async openView(e){const n=this.services.shared.lsp.Connection;if(!n){tr.error("No LSP connection");return}await n.sendNotification(n_.type,e)}}class x5{constructor(e){this.services=e}getSymbolKind(e){const n=kt(e)?e.$type:e.type,r=(...i)=>i.some(s=>this.services.AstReflection.
|
|
2197
2198
|
isSubtype(n,s));switch(!0){case r(Zn,bo,_r,_i,us):return kr.Constructor;case r($a,Da,Ra,ba,Pa):return kr.Namespace;case r(yo):return kr.Class;case r(ls,Ni,wo,Na):return kr.EnumMember;case r(cs,_a):return kr.Event;case r(Pi,xi,Aa,Ta):return kr.TypeParameter}return kr.Field}getCompletionItemKind(e){const n=kt(e)?e.$type:e.type,r=(...i)=>i.some(s=>this.services.AstReflection.isSubtype(n,s));switch(!0){case r(wo):return Ct.Color;case r(Zn,_r,_i,bo,us):return Ct.Constructor;case r($a,Da,Ra,ba,Pa):return Ct.
|
|
2198
|
-
Module;case r(yo):return Ct.Class;case r(ls,Ni,wo,Na):return Ct.EnumMember;case r(cs,_a):return Ct.Event;case r(Pi,Aa,xi,Ta):return Ct.TypeParameter;default:return Ct.Reference}}}class P5 extends xT{}const
|
|
2199
|
-
n);return Qs(r.$data.views)}async layoutAllViews(e,n){const r=await this.ModelBuilder.buildLikeC4Model(e,n),i=Qs(r.$data.views);if(i.length===0)return[];const s=
|
|
2200
|
-
delete(l.view.id),this.cache.set(l.view,f),c.push(f)},onError:(l,f)=>{o.warn(`Fail layout view ${l.view.id}`,{error:f})}}),c.length!==i.length?o.warn`layouted ${c.length} of ${i.length} views in ${s.pretty}`:c.length>0&&o.debug`layouted all ${c.length} views in ${s.pretty}`,c}async layoutView(e,n,r){const i=await this.ModelBuilder.buildLikeC4Model(n,r),s=i.findView(e)?.$view,o=n?
|
|
2201
|
-
await Promise.resolve(a);try{const u=
|
|
2199
|
+
Module;case r(yo):return Ct.Class;case r(ls,Ni,wo,Na):return Ct.EnumMember;case r(cs,_a):return Ct.Event;case r(Pi,Aa,xi,Ta):return Ct.TypeParameter;default:return Ct.Reference}}}class P5 extends xT{}const fm=st.getChild("views");class N5{constructor(e){this.services=e,this.ModelBuilder=e.likec4.ModelBuilder}cache=new WeakMap;viewsWithReportedErrors=new Set;ModelBuilder;get layouter(){return this.services.likec4.Layouter}async computedViews(e,n){const r=await this.ModelBuilder.buildLikeC4Model(e,
|
|
2200
|
+
n);return Qs(r.$data.views)}async layoutAllViews(e,n){const r=await this.ModelBuilder.buildLikeC4Model(e,n),i=Qs(r.$data.views);if(i.length===0)return[];const s=Jh(),o=e?fm.getChild(e):fm;o.debug`layoutAll: ${i.length} views`;const a=[],u=r.$data.specification,c=[];for(const l of i){let f=this.cache.get(l);if(f){o.debug`layout ${l.id} from cache`,c.push(f);continue}a.push({view:l,specification:u})}return a.length>0&&await this.layouter.batchLayout({batch:a,onSuccess:(l,f)=>{this.viewsWithReportedErrors.
|
|
2201
|
+
delete(l.view.id),this.cache.set(l.view,f),c.push(f)},onError:(l,f)=>{o.warn(`Fail layout view ${l.view.id}`,{error:f})}}),c.length!==i.length?o.warn`layouted ${c.length} of ${i.length} views in ${s.pretty}`:c.length>0&&o.debug`layouted all ${c.length} views in ${s.pretty}`,c}async layoutView(e,n,r){const i=await this.ModelBuilder.buildLikeC4Model(n,r),s=i.findView(e)?.$view,o=n?fm.getChild(n):fm;if(!s)return o.warn`layoutView ${e} not found`,null;let a=this.cache.get(s);if(a)return o.debug`layout ${e} from cache`,
|
|
2202
|
+
await Promise.resolve(a);try{const u=Jh(),c=await this.layouter.layout({view:s,specification:i.$data.specification});return this.viewsWithReportedErrors.delete(e),this.cache.set(s,c),o.debug(`layout {viewId} ready in ${u.pretty}`,{viewId:e}),c}catch(u){if(!this.viewsWithReportedErrors.has(e)){const c=Un(u);this.services.shared.lsp.Connection?.window.showErrorMessage(`LikeC4: ${c}`),this.viewsWithReportedErrors.add(e),Rd(u)}return Promise.reject(u)}}async diagrams(e,n){return(await this.layoutAllViews(
|
|
2202
2203
|
e,n)).map(r=>r.diagram)}async viewsAsGraphvizOut(e,n){const r="All-LayoutedViews-DotWithSvg",i=this.services.ValidatedWorkspaceCache;if(i.has(r))return await Promise.resolve(i.get(r));const s=await this.ModelBuilder.buildLikeC4Model(e,n),o=Qs(s.$data.views);if(o.length===0)return[];const a=o.map(async l=>{const{dot:f,svg:d}=await this.layouter.svg({view:l,specification:s.$data.specification});return{id:l.id,dot:f,svg:d}}),u=[],c=await Promise.allSettled(a);for(const l of c)l.status==="fulfilled"?
|
|
2203
|
-
u.push(l.value):De(l.reason);return i.set(r,u),u}async openView(e,n){await this.services.Rpc.openView({viewId:e,projectId:n})}}const I5={lsp:{NodeKindProvider:t=>new x5(t),WorkspaceSymbolProvider:t=>new P5(t)},workspace:{IndexManager:t=>new aW(t),LangiumDocuments:t=>new pW(t),ProjectsManager:t=>new
|
|
2204
|
+
u.push(l.value):De(l.reason);return i.set(r,u),u}async openView(e,n){await this.services.Rpc.openView({viewId:e,projectId:n})}}const I5={lsp:{NodeKindProvider:t=>new x5(t),WorkspaceSymbolProvider:t=>new P5(t)},workspace:{IndexManager:t=>new aW(t),LangiumDocuments:t=>new pW(t),ProjectsManager:t=>new Sn(t),WorkspaceManager:t=>new hW(t)}};function Dt(t){return e=>new t(e)}const O5={documentation:{DocumentationProvider:Dt(YH)},ValidatedWorkspaceCache:t=>new $p(t.shared,qe.Validated),Rpc:Dt(_5),mcp:{
|
|
2204
2205
|
Server:Dt(cK),ServerFactory:Dt(lK)},likec4:{LanguageServices:Dt(tK),Layouter:t=>new _S({graphviz:new ir}),Views:Dt(N5),DeploymentsIndex:Dt(dK),ModelChanges:Dt(k5),FqnIndex:Dt(NS),ModelParser:Dt(m5),ModelBuilder:Dt(vK),ModelLocator:Dt(EK)},lsp:{CompletionProvider:Dt(rK),DocumentHighlightProvider:Dt(iK),DocumentSymbolProvider:Dt(oK),SemanticTokenProvider:Dt(uK),HoverProvider:Dt(aK),CodeLensProvider:Dt(nK),DocumentLinkProvider:Dt(sK),Formatter:Dt(ZH)},workspace:{AstNodeDescriptionProvider:Dt(oW)},references:{
|
|
2205
2206
|
NameProvider:Dt(T5),ScopeComputation:Dt(A5),ScopeProvider:Dt(S5)},parser:{ValueConverter:Dt(g5)}};function L5(t,e,n,r){const i=F5(t),s=[u8({shared:i}),gU,O5,e,n,r].reduce(m_,{}),o=kp(s);return i.ServiceRegistry.register(o),u9(o),t.connection?o.Rpc.init():i.workspace.ConfigurationProvider.initialized({}),{shared:i,likec4:o}}function F5(t={}){const e={...qD,...t};return kp(l8(e),mU,I5)}function m_(t,e){if(e){for(const[n,r]of Object.entries(e))if(r!==void 0){const i=t[n];i!==null&&r!==null&&typeof i==
|
|
2206
2207
|
"object"&&typeof r=="object"?t[n]=m_(i,r):t[n]=r}}return t}const M5=t=>({start:Hi.hrtime.bigint(),command:t.map(e=>B5(U_(e))).join(" "),state:{stdout:"",stderr:"",output:""}}),B5=t=>/[^\w./-]/.test(t)?`'${t.replaceAll("'","'\\''")}'`:t,q5=({stdin:t,stdout:e,stderr:n,stdio:r=[t,e,n],env:i,preferLocal:s,cwd:o=".",...a})=>{const u=o instanceof URL?q_(o):Wi.resolve(o),c=i?{...Hi.env,...i}:void 0,l=r[0]?.string;return{...a,input:l,stdio:l===void 0?r:["pipe",...r.slice(1)],env:s?j5(c??Hi.env,u):c,cwd:u}},
|
|
@@ -2229,24 +2230,24 @@ nr.warn(`Command ${r.command} has stderr:
|
|
|
2229
2230
|
`+e),r instanceof Oo&&!It(r.stdout))nr.warn(`Command: '${r.command}' returned result but also failed (exitcode ${r.exitCode}): "${r.stderr}"`),n=r.stdout;else throw r}return n}async acyclic(e){return Promise.reject(new Error("Method not implemented."))}async svg(e){let n;try{const r=await Hd(this.dotpath,["-Tsvg","-y"],{timeout:1e4,stdin:{string:e}});n=r.stdout,It(r.stderr)||nr.warn(`Command ${r.command} has stderr:
|
|
2230
2231
|
`+r.stderr)}catch(r){if(nr.error("FAILED GraphvizBinaryAdapter.svg",{error:r}),nr.warn(`FAILED DOT:
|
|
2231
2232
|
`+e),r instanceof Oo&&!It(r.stdout))nr.warn(`Command: '${r.command}' returned result but also failed (exitcode ${r.exitCode}):
|
|
2232
|
-
`+r.stderr),n=r.stdout;else throw r}return n}}const pV="likec4",__="1.36.
|
|
2233
|
-
tring"){e.error(
|
|
2234
|
-
services=e}isInitialized=!1;async initWorkspace(e){if(this.isInitialized)throw new Error("Workspace already initialized");const n=this.services.logger,r=this.services.shared.workspace.WorkspaceManager;n.info(`${
|
|
2235
|
-
likec4.ModelBuilder;const n=this.services.shared.workspace.LangiumDocuments,r=this.services.shared.workspace.DocumentBuilder,i=n.all.toArray(),s=i.filter(o=>!$d(o.uri));if(s.length===0)throw e.error("no LikeC4 sources found"),new Error("no LikeC4 sources found");e.info(`${
|
|
2236
|
-
be provided")},cli:{Workspace:wV(vV)}};function N_(t){const e=
|
|
2233
|
+
`+r.stderr),n=r.stdout;else throw r}return n}}const pV="likec4",__="1.36.1",Uw=Wn.getChild("cli");function x_(t){const e=Wn.getChild(t);return{info(n){e.info(n)},warn(n){if(n instanceof Error){e.warn(`${qn.red(n.name+" "+n.message)}`,{msg:n});return}if(typeof n=="string"){e.warn(n);return}e.warn`${n}`},warnOnce(n){e.warn(n)},error(n,r){let i=r?.error??n;if(i instanceof Error){if(n===i){e.error(`${qn.red(i.name+" "+i.message)}`,{error:i});return}e.error(qn.red(n),{error:i});return}if(typeof n=="s\
|
|
2234
|
+
tring"){e.error(qn.red(n));return}e.error`${n}`},clearScreen:function(n){},hasErrorLogged:function(n){throw new Error("Function not implemented.")},hasWarned:!1}}const Ww=()=>{},hV={info:Ww,warn:Ww,error:Ww},mV=1e6;function P_(t){const[e,n]=ab(t),r=e*1e3+n/mV;return{ms:r,pretty:mA(r)}}function gV(t){const e=ab();return{stopAndLog(n="done in "){n=qn.green(`${n}${P_(e).pretty}`),(t||Uw).info(n)}}}function yV(t,e){console.log(_x(t,{padding:1,margin:1,dimBorder:!0,...e}))}class vV{constructor(e){this.
|
|
2235
|
+
services=e}isInitialized=!1;async initWorkspace(e){if(this.isInitialized)throw new Error("Workspace already initialized");const n=this.services.logger,r=this.services.shared.workspace.WorkspaceManager;n.info(`${qn.dim("workspace:")} ${e.uri}`),r.initialize({capabilities:{},processId:null,rootUri:null,workspaceFolders:[e]}),await r.initializeWorkspace([e])}async init(){if(this.isInitialized)throw new Error("Workspace already initialized");this.isInitialized=!0;const e=this.services.logger;this.services.
|
|
2236
|
+
likec4.ModelBuilder;const n=this.services.shared.workspace.LangiumDocuments,r=this.services.shared.workspace.DocumentBuilder,i=n.all.toArray(),s=i.filter(o=>!$d(o.uri));if(s.length===0)throw e.error("no LikeC4 sources found"),new Error("no LikeC4 sources found");e.info(`${qn.dim("workspace:")} found ${s.length} source files`),s.length>1?await r.update(s.map(o=>o.uri),[],void 0):await r.build(i,{validation:!0})}}function wV(t){return e=>new t(e)}const bV={logger:()=>{throw new Error("Logger must \
|
|
2237
|
+
be provided")},cli:{Workspace:wV(vV)}};function N_(t){const e=Im(t,{useFileSystem:!0,logger:"default",graphviz:"wasm"});let n;switch(e.logger){case!1:n=hV;break;case"vite":n=x_("lang");break;case"default":n=Uw.getChild("lang");break;default:n=e.logger;break}const r=e.graphviz==="binary";n.info(`${qn.dim("version")} ${__}`),n.info(`${qn.dim("layout")} ${r?"binary":"wasm"}`);const i={logger:()=>n,likec4:{Layouter:()=>new _S({graphviz:r?new fV:new ir})}};return L5(e.useFileSystem?nW:{},bV,i).likec4}
|
|
2237
2238
|
const I_=t=>new Error(`Invalid model:
|
|
2238
2239
|
${t.getErrors().map(e=>` ${e.sourceFsPath}:${e.line} ${e.message.slice(0,200)}`).join(`
|
|
2239
|
-
`)}`);class bs{constructor(e,n,r){this.workspace=e,this.langium=n,this.isPrintErrorEnabled=r,this.logger=n.logger,this.isPrintErrorEnabled&&this.printErrors()}static async fromSource(e,n){const r=N_(
|
|
2240
|
-
i.path,r,n?.printErrors??!0);return n?.throwIfInvalid===!0&&o.hasErrors()?(o.dispose(),Promise.reject(I_(o))):o}static likec4Instances=new Map;static async fromWorkspace(e="",n){const r=M_(e);if(!F_(r))throw new Error(`Workspace not found: ${r}`);let i=bs.likec4Instances.get(r);if(!i){const s=N_(
|
|
2240
|
+
`)}`);class bs{constructor(e,n,r){this.workspace=e,this.langium=n,this.isPrintErrorEnabled=r,this.logger=n.logger,this.isPrintErrorEnabled&&this.printErrors()}static async fromSource(e,n){const r=N_(Im(n,{useFileSystem:!1,logger:!1,graphviz:"wasm"})),i=dt.from({scheme:"virtual",path:"/workspace"});await r.cli.Workspace.initWorkspace({uri:i.toString(),name:"virtual"});const s=ct.joinPath(i,"source.likec4");r.shared.workspace.LangiumDocuments.createDocument(s,e),await r.cli.Workspace.init();const o=new bs(
|
|
2241
|
+
i.path,r,n?.printErrors??!0);return n?.throwIfInvalid===!0&&o.hasErrors()?(o.dispose(),Promise.reject(I_(o))):o}static likec4Instances=new Map;static async fromWorkspace(e="",n){const r=M_(e);if(!F_(r))throw new Error(`Workspace not found: ${r}`);let i=bs.likec4Instances.get(r);if(!i){const s=N_(Im(n,{useFileSystem:!0,logger:"default",graphviz:"wasm"}));await s.cli.Workspace.initWorkspace({uri:j_(r).toString(),name:B_(r)}),await s.cli.Workspace.init(),i=new bs(r,s,n?.printErrors??!0),bs.likec4Instances.
|
|
2241
2242
|
set(r,i)}return n?.throwIfInvalid===!0&&i.hasErrors()?(i.dispose(),Promise.reject(I_(i))):i}logger;get languageServices(){return this.langium.likec4.LanguageServices}get viewsService(){return this.langium.likec4.Views}get LangiumDocuments(){return this.langium.shared.workspace.LangiumDocuments}ensureSingleProject(){const e=this.langium.likec4.LanguageServices.projects();if(e.length>1)throw this.logger.error(`Multiple projects found:
|
|
2242
2243
|
${e.map(n=>` - ${n.folder.fsPath}`).join(`
|
|
2243
2244
|
`)}
|
|
2244
2245
|
|
|
2245
|
-
${
|
|
2246
|
+
${qn.red("Please specify a project folder")}
|
|
2246
2247
|
`),new Error("Multiple projects found")}async diagrams(e){return await this.langium.likec4.Views.diagrams(e)}computedModel(e){const n=this.langium.shared.workspace.ProjectsManager.ensureProjectId(e);return this.langium.likec4.ModelBuilder.unsafeSyncBuildModel(n)}async projects(){const e=this.langium.shared.workspace.ProjectsManager.defaultProjectId;if(e)return[e];const n=(await Promise.allSettled(this.langium.shared.workspace.ProjectsManager.all.map(async r=>await this.langium.likec4.ModelBuilder.
|
|
2247
|
-
parseModel(r)?r:void 0))).filter(r=>r.status==="fulfilled").flatMap(r=>r.value??[]);return
|
|
2248
|
+
parseModel(r)?r:void 0))).filter(r=>r.status==="fulfilled").flatMap(r=>r.value??[]);return Bn(n,1)?n:["default"]}async layoutedModel(e){const n=this.langium.shared.workspace.ProjectsManager.ensureProjectId(e),r=await this.langium.likec4.ModelBuilder.parseModel(n);if(!r)throw new Error("Failed to parse model");const i=await this.viewsService.diagrams(n);return xs.create({...r.$data,_stage:"layouted",views:uc(i,Xr("id"))})}getErrors(){return this.LangiumDocuments.all.toArray().flatMap(e=>(e.diagnostics??
|
|
2248
2249
|
[]).filter(n=>n.severity===Ws.Error).map(({message:n,range:r})=>({message:n,line:r.start.line,range:r,sourceFsPath:e.uri.fsPath})))}hasErrors(){return this.LangiumDocuments.all.some(e=>e.diagnostics?.some(n=>n.severity===Ws.Error)??!1)}printErrors(){let e=!1;for(const n of this.LangiumDocuments.all){const r=n.diagnostics?.filter(i=>i.severity===1);if(r&&r.length>0){e=!0;const i=r.flatMap(s=>{const o=s.range.start.line,a=s.message.split(`
|
|
2249
|
-
`);return a.length>10&&(a.length=10,a.push("...")),a.map((u,c)=>c===0?" "+
|
|
2250
|
+
`);return a.length>10&&(a.length=10,a.push("...")),a.map((u,c)=>c===0?" "+qn.dim(`Line ${o}: `)+qn.red(u):" ".repeat(10)+qn.red(u))}).join(`
|
|
2250
2251
|
`);this.logger.error(`Invalid ${n.uri.fsPath}
|
|
2251
|
-
${i}`)}}return e}async notifyUpdate({changed:e,removed:n}){const r=this.langium.shared.workspace.WorkspaceLock;try{let i=!1;return await r.write(async s=>{await this.langium.shared.workspace.DocumentBuilder.update(e?[
|
|
2252
|
-
delete(e)}}export{iC as A,yV as B,Le as C,rs as D,QD as E,P_ as F,qj as G,pV as H,It as I,__ as J,gV as K,bs as L,
|
|
2252
|
+
${i}`)}}return e}async notifyUpdate({changed:e,removed:n}){const r=this.langium.shared.workspace.WorkspaceLock;try{let i=!1;return await r.write(async s=>{await this.langium.shared.workspace.DocumentBuilder.update(e?[dt.file(e)]:[],n?[dt.file(n)]:[],s),i=!s.isCancellationRequested}),i}catch(i){return this.logger.error(Un(i)),!1}}onModelUpdate(e){const n=this.langium.likec4.ModelBuilder.onModelParsed(()=>e());return()=>{n.dispose()}}dispose(){for(const[e,n]of bs.likec4Instances)n===this&&bs.likec4Instances.
|
|
2253
|
+
delete(e)}}export{iC as A,yV as B,Le as C,rs as D,QD as E,P_ as F,qj as G,pV as H,It as I,__ as J,gV as K,bs as L,cm as M,d0 as N,Bn as O,nN as P,Hb as Q,jo as T,ua as a,Pe as b,de as c,sA as d,bt as e,Ho as f,ut as g,la as h,kt as i,eA as j,x_ as k,fr as l,oc as m,Et as n,YD as o,Wn as p,vi as q,Qs as r,ds as s,Yr as t,qn as u,TU as v,QC as w,Uw as x,Hd as y,Un as z};
|